tools-count-sloc
Present a summary of the code base including lines of source code and complexity metrics.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-12
- Stars
- ★ 3
- Forks
- 4
01 前言 Front Matter
- name
- tools-count-sloc
- description
- Present a summary of the code base including lines of source code and complexity metrics.
- allowed-tools
- Bash(*)
- argument-hint
- [path] (default: repo root)
02 资源文件 1
- 脚本complexity.sh4.3 KB
03 SKILL.md 正文
Count lines of source code and present complexity metrics for the codebase.
Input
Optional argument: a subdirectory to scope the analysis (e.g. components/dispatcher/v0). Defaults to the repository root.
Steps
- Determine the target directory:
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
if [[ -n "$ARGUMENTS" ]]; then
TARGET="$REPO_ROOT/$ARGUMENTS"
if [[ ! -d "$TARGET" ]]; then
echo "Error: directory not found: $TARGET" >&2
exit 1
fi
else
TARGET="$REPO_ROOT"
fi
- Ensure
tokeiis installed (it's a fast, accurate SLOC counter written in Rust):
if ! command -v tokei &>/dev/null; then
echo "Installing tokei..."
cargo install tokei --quiet
fi
- Run tokei for the SLOC summary, excluding build artifacts and vendored dependencies:
tokei "$TARGET" --exclude deps/spdk-build --exclude target --sort code
- Run the complexity analysis script to produce per-component metrics:
SCRIPT="$(git rev-parse --show-toplevel)/.claude/skills/tools-count-sloc/complexity.sh"
bash "$SCRIPT" "$TARGET"
-
Present the results to the user in a clear summary with:
- Total lines of code (by language)
- Breakdown by component/directory
- Complexity indicators (files with highest function counts, deepest nesting)
- Comparison of code vs tests vs comments ratios
-
Write out the presented results to SUMMARY.md file. Interactively allow user to specify a different directory.
04 同仓库更多 Skills
tools-spin-sync
Synchronize Spin/Promela models with current source code and re-verify
tools-spin-model
Create a new Spin/Promela formal verification model for a system property
tools-creusot-install
Install the Creusot Rust verification tool
tools-creusot-init
Prepare an existing Cargo project to use Creusot formal verification
tools-creusot-coq-install
Add Coq 8.20 as an additional prover to an existing Creusot installation, for verification conditions that SMT solvers cannot discharge
tools-creusot-annotate-interfaces
Formally verify a component's properties with Creusot and annotate its interface definitions