← 返回 CLI 目录
Universal Ctags
$ ctags 社区开源 低风险 Universal Ctags (OSS) · 文件检索与编辑 · GPL-2.0 · macos / linux / windows
Universal Ctags(ctags)可在毫秒内为 100 余种语言建立类、函数、类型与变量索引。配合 -f - --output-format=json 可直接向 stdout 输出结构化 NDJSON 符号表,而不在磁盘留下 tags 文件。
FCRS-1.0 综合评分
83 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
brew install universal-ctags CLI vs MCP 选型建议 优先选 CLI
单条 ctags -f - --output-format=json 命令即可本地生成全库符号表,无需维护常驻 MCP 符号服务。
Agent 友好度体检单
本地探针实测证据 ✓ 原生 JSON 输出
✓ 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
✓ 只读模式开关
— 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
实测版本
—
冷启动耗时
3005 ms
退出码 (help / 非法参数)
— / —
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Hung
FCRS-1.0 六维评分拆解
Agent 友好度 19 / 25
在启用 Jansson 编译时支持 --output-format=json 与 --fields= 裁剪,但 macOS 默认系统 ctags 为不兼容的 BSD 版本。
--output-format=jsonand-f -enable structured stdout streaming
安全与权限边界 23 / 25
使用 -f - 时为纯只读;默认直接调用会在当前目录生成 ./tags 文件。
- Zero network calls; file write avoided via
-f -
安装与运行摩擦 12 / 15
可通过 brew install universal-ctags 与 Linux 包管理安装,在 macOS 上需注意与系统自带 ctags 的 PATH 优先级。
- Requires installing
universal-ctagsseparately from macOS systemctags
能力覆盖与边际价值 13 / 15
单遍扫描即可快速建立陌生大型仓库的跨语言符号概览。
- Supports over 100 programming languages out of the box
维护与来源背书 8 / 10
由活跃社区维护,是 Exuberant Ctags 的现代正统继任者。
- Active
universal-ctags/ctagsrepository
文档与可验证性 8 / 10
docs.ctags.io 文档详尽,且内置 --list-languages / --list-fields 自省参数。
- Self-describing
--list-*flags and Sphinx manual
安全边界、鉴权与放权指南
鉴权方式
无需鉴权
凭证存储位置
无需任何凭证;仅读取本地源码文件。
潜在副作用
只读查询 本地写入
费用与配额提示
100% 免费、离线且开源(GPL-2.0)。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Universal Ctags Agent Rules - ALWAYS pass `-f -` when inspecting symbols so `ctags` does not pollute the repo with a `./tags` file. - Exclude `node_modules`, `dist`, and `.git` with `--exclude`, and verify `ctags --version` is Universal (not macOS BSD ctags).
Agent 高频安全命令配方
只读查询(安全推荐)
向标准输出流式生成 NDJSON 符号表
ctags --output-format=json --fields=+nK -R -f - src/
输出带行号(+n)和完整类型(+K)的 JSON 符号对象,且不创建本地 tags 文件。
受控写入与预演
为编辑器生成标准
tags 索引文件 ctags -R --exclude=node_modules --exclude=.git -f tags src/
在排除依赖与版本控制目录后生成本地 tags 索引。
核心优势
- + 支持 100+ 语言的毫秒级符号索引,并提供
--output-format=json输出。 - + 支持
--fields与--kinds-<lang>细粒度过滤,显著减少输出体积。
注意事项与踩坑点
- ! 若未传入
-f -,默认会在工作目录写入./tags文件。 - ! JSON 输出依赖支持 Jansson 的 Universal Ctags 构建(非 macOS 自带
/usr/bin/ctags)。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI