← 返回 CLI 目录
scc
$ scc 社区开源 低风险 Ben Boyter (OSS) · 文件检索与编辑 · MIT / Unlicense · macos / linux / windows
scc(Sloc, Cloc and Code)在遵循 .gitignore 的前提下快速统计代码行、注释、空行与估算圈复杂度。通过 --format json 与 --by-file,Agent 可迅速定位高复杂度热点文件。
FCRS-1.0 综合评分
92 /100
极佳 (Excellent)
中置信度 (源码/文档)
零摩擦安装命令
brew install scc CLI vs MCP 选型建议 优先选 CLI
单文件本地 scc --format json 即可瞬间返回复杂度与代码量指标,无需 MCP 服务。
Agent 友好度体检单
✓ 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
✓ 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
Agent 友好度 24 / 25
支持 --format json(及 csv、html 等)、-s 确定性排序与干净的非交互 stdout。
- Native
--format jsonand--by-filereporting
安全与权限边界 25 / 25
纯只读本地分析器,零网络通信且自动遵守 .gitignore。
- Read-only Go binary; no credentials or external requests
安装与运行摩擦 14 / 15
单文件静态 Go 二进制,覆盖 brew、go install、choco、snap 与官方发布包。
- Zero-dependency binary across macOS, Linux, and Windows
能力覆盖与边际价值 13 / 15
在行数统计之外补充了语言与文件级的圈复杂度启发式指标。
- Fast parallel counting plus complexity estimates
维护与来源背书 8 / 10
由 Ben Boyter 持续维护,性能表现优异。
- Regular releases under
boyter/scc
文档与可验证性 8 / 10
README 与 --help 对各类格式、排除规则与复杂度算法均有说明。
- Comprehensive README and CLI help flags
安全边界、鉴权与放权指南
鉴权方式
无需鉴权
凭证存储位置
无需任何凭证;仅扫描本地可读文件。
潜在副作用
只读查询
费用与配额提示
100% 免费、离线且开源(MIT / Unlicense)。
可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# scc Agent Rules - Pass `--format json` (and `--no-cocomo` unless cost estimates are requested) for clean structured metrics. - Avoid `--by-file` without filtering on large monorepos to keep stdout bounded.
Agent 高频安全命令配方
只读查询(安全推荐)
以 JSON 输出代码量与复杂度汇总
scc --format json --no-cocomo .
输出各语言统计与复杂度得分,并省略非必要的成本估算字段。
按文件定位高复杂度热点
scc --by-file -s complexity --format json src/
按文件粒度拆分代码行与复杂度,辅助定位重构重点。
核心优势
- + 在
--format json中同时提供代码行数统计与圈复杂度热点定位。 - + 默认遵循
.gitignore,单文件 Go 二进制零依赖部署。
注意事项与踩坑点
- ! 默认附带的 COCOMO 工时估算偏启发式噪音,仅需指标时建议加上
--no-cocomo。
已验证兼容的 Agent 宿主
Claude Code Codex CLI Gemini CLI