← 返回 CLI 目录
tokei
$ tokei 社区开源 低风险 XAMPPRocky (OSS) · 文件检索与编辑 · MIT / Apache-2.0 · macos / linux / windows
tokei 能在毫秒级统计 150 余种编程语言的文件数、有效代码行、注释行与空行,并默认尊重 .gitignore。配合 --output json,Agent 在深入读代码前即可快速掌握仓库规模与语言构成。
FCRS-1.0 综合评分
94 /100
极佳 (Excellent)
中置信度 (源码/文档)
零摩擦安装命令
brew install tokei CLI vs MCP 选型建议 优先选 CLI
本地执行 tokei --output json 毫秒级返回,完全无需 RPC 或 MCP 包装开销。
Agent 友好度体检单
✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
✓ 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
Agent 友好度 24 / 25
支持 --output json(及 yaml/cbor)、干净的非 TTY 输出和零交互确定性执行。
- Native
--output jsonstructured statistics
安全与权限边界 25 / 25
纯只读本地 Rust 二进制,无网络请求且自动跳过 .gitignore。
- Zero write, network, or credential side effects
安装与运行摩擦 14 / 15
单文件静态 Rust 二进制,支持 brew、cargo 及各系统包管理器。
- Cross-platform static binary for macOS, Linux, and Windows
能力覆盖与边际价值 14 / 15
百毫秒内即可让 Agent 掌握代码库体量与技术栈占比。
- Parallel language-aware line counting across 150+ languages
维护与来源背书 9 / 10
社区广泛采用的开源标准工具(XAMPPRocky/tokei),采用 MIT/Apache-2.0 双许可。
- Established OSS tool with broad CI and developer adoption
文档与可验证性 8 / 10
README 与 --help 对输出格式和排序选项说明简明清晰。
- Clear README and
--helpreference
安全边界、鉴权与放权指南
鉴权方式
无需鉴权
凭证存储位置
无需任何凭证;仅读取本地源码文件。
潜在副作用
只读查询
费用与配额提示
100% 免费、离线且开源(MIT / Apache-2.0)。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# tokei Agent Rules - Use `tokei --output json` (optionally piped through `jq`) when first sizing an unfamiliar repo. - Pass `-e` to exclude generated vendor directories if they are committed outside `.gitignore`.
Agent 高频安全命令配方
只读查询(安全推荐)
以 JSON 格式获取仓库语言分布
tokei --output json .
输出各语言的文件数、代码行、注释行与空行 JSON 统计。
按代码行数排序展示主要语言
tokei -s code src/
打印按有效代码量降序排列的紧凑摘要表。
核心优势
- + 严格只读且支持
--output json,便于瞬间完成仓库画像。 - + 自动遵循
.gitignore,精准区分 150+ 语言的代码与注释。
注意事项与踩坑点
- ! 完整
--output json默认包含每文件条目(可用--files或在巨型仓库配合jq精简)。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI