Code Stats

分析代码仓库的统计信息(行数、文件数,语言分布)。用于了解项目规模和复杂度。当需要了解项目有多大、有多少代码时使用。

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 345 · 5 current installs · 5 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Suspicious
high confidence
!
Purpose & Capability
The code's functionality (recursively counting files and lines by extension) matches the skill description. However the implementation uses a fixed WORKSPACE path ('/home/duan/.openclaw/workspace') rather than acting on the current working directory or an explicitly provided path. The hard-coded home path with a specific username is unexpected and may not match the installing user's environment.
!
Instruction Scope
SKILL.md states it analyzes the 'current workspace' and instructs running node skills/code-stats/index.js, but the script always scans the fixed WORKSPACE path. The script will read every non-hidden file under that directory (subject to IGNORE_DIRS), which means it can access any file present in that workspace — this is consistent with the stated purpose but narrower/less flexible than the documentation implies and has privacy implications.
Install Mechanism
No install spec; the package is instruction + a small JS script with no external dependencies. Nothing is downloaded or written during install, which is low risk.
Credentials
The skill requests no environment variables or credentials, which is appropriate. Nonetheless it reads files from the user's workspace (a form of broad read access). That file-system access is inherent to its purpose but should be acknowledged as sensitive — there's no configuration to limit the scanned path.
Persistence & Privilege
The skill does not request persistent privileges. always is false and it does not modify system or other skills' configuration.
What to consider before installing
This skill is small and appears to do what it claims, but inspect and/or modify it before use: 1) The script is hard-coded to /home/duan/.openclaw/workspace (including a specific username). If you expect it to analyze a different folder, change WORKSPACE or add a command-line/path option. 2) It will recursively read all non-hidden files under that path — treat it as having broad read access to anything in your workspace; don't run it against a workspace containing secrets. 3) The walker does not guard against symlink cycles — a malicious or accidental cyclic symlink could cause excessive recursion. 4) If the repo is empty totalLines can be 0 and the percentage calculation will produce NaN — harmless but noisy. Recommended actions: run in a sandbox or on a copy of the workspace first, or edit the script to accept a path argument and to add cycle detection/limits. If you do not trust the code author, do not run it on sensitive data.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk97bzym1748z7q8n37f67dkv7582721v

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Code Stats

分析当前工作区的代码统计信息。

使用方法

node skills/code-stats/index.js

或者在 OpenClaw 中作为技能使用。

功能特性

  • 总文件数统计 - 统计项目中的所有代码文件
  • 总行数统计 - 统计代码总行数
  • 语言分布 - 按编程语言分类统计
  • 百分比计算 - 计算各语言占比

支持的语言

  • JavaScript / TypeScript
  • Python
  • JSON / YAML
  • Markdown
  • Shell / Bash
  • HTML / CSS

示例输出

📊 Code Stats for /home/duan/.openclaw/workspace
========================================
Total Files: 408
Total Lines: 68,095

By Language:
  JavaScript: 176 files, 36,983 lines (54.3%)
  Markdown: 100 files, 16,365 lines (24.0%)
  TypeScript: 17 files, 2,359 lines (3.5%)
  Python: 3 files, 1,195 lines (1.8%)

使用场景

  1. 了解项目规模
  2. 评估代码复杂度
  3. 统计各语言占比
  4. 定期跟踪代码量变化

Files

3 total
Select a file
Select a file to preview.

Comments

Loading comments…