@clawmaster/skillguard-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cydiar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,213 @@
1
+ <p align="center">
2
+ <h1 align="center">SkillGuard CLI</h1>
3
+ <p align="center"><strong>Security Audit CLI for AI Agent Skills</strong></p>
4
+ <p align="center">
5
+ The command-line version of <a href="https://github.com/clawmaster-ai/skill-guard">SkillGuard</a> — zero infrastructure, same engine.
6
+ </p>
7
+ <p align="center">
8
+ 10 Dimensions · 109 Rules · A–F Risk Grading · Token Cost Estimation
9
+ </p>
10
+ <p align="center">
11
+ <a href="#quick-start">Quick Start</a> ·
12
+ <a href="#features">Features</a> ·
13
+ <a href="#security-dimensions">Dimensions</a> ·
14
+ <a href="#architecture">Architecture</a> ·
15
+ <a href="#cli-reference">CLI Reference</a> ·
16
+ <a href="#claude-code-skills">Skills</a>
17
+ </p>
18
+ </p>
19
+
20
+ ---
21
+
22
+ ## What is SkillGuard CLI?
23
+
24
+ **SkillGuard CLI** is the standalone command-line version of [SkillGuard](https://github.com/clawmaster-ai/skill-guard), the security audit platform for AI agent skills. While the original SkillGuard requires FastAPI, Celery, Redis, and SQLite, the CLI version packages the same scanning engine into a single `npx` command with **zero infrastructure dependencies**.
25
+
26
+ Paste a GitHub or [ClawHub](https://clawhub.ai) URL — get a full security report in your terminal.
27
+
28
+ Audit methodology is based on **OWASP LLM Top 10**, **SLSA**, and **Google SAIF**.
29
+
30
+ ## Quick Start
31
+
32
+ ```bash
33
+ # Scan a GitHub skill repository
34
+ npx @clawmaster/skillguard-cli https://github.com/user/my-skill
35
+
36
+ # Scan a local skill directory
37
+ npx @clawmaster/skillguard-cli ./path/to/skill
38
+
39
+ # Scan a ClawHub skill
40
+ npx @clawmaster/skillguard-cli https://clawhub.ai/author/skill-name
41
+
42
+ # Scan all skills in a marketplace directory
43
+ npx @clawmaster/skillguard-cli ./marketplace --all
44
+ ```
45
+
46
+ ## Features
47
+
48
+ ### 🔍 Static Analysis
49
+ Pattern-based scanning across **10 security dimensions** with **109 audit rules** (67 built-in + 42 configurable). Covers OWASP LLM Top 10, SLSA supply chain, and Google SAIF framework — from prompt injection to license compliance, every risk surface is checked.
50
+
51
+ ### 📊 A–F Risk Grading
52
+ One glance, one grade. Every skill gets a clear **A–F letter rating** with per-dimension score breakdown, severity distribution, and actionable remediation in both Chinese and English.
53
+
54
+ ### 💰 Token Cost Estimation
55
+ 4-level token analysis (**L1** SKILL.md → **L2** eager/lazy references → **L3** all files) with multi-model cost projections across Claude Sonnet, Claude Opus, Gemini, and GPT. Know exactly how much a skill costs before you install it.
56
+
57
+ ### 📦 Multi-Skill Detection
58
+ Drop a marketplace directory or monorepo — SkillGuard CLI automatically discovers every skill inside, scans them all, and generates an aggregated summary report.
59
+
60
+ ### 🌐 Bilingual Reports
61
+ Full **CN/EN** remediation guidance for every finding. Switch with `--lang zh` or `--lang en`.
62
+
63
+ ### ⚙️ Configurable Rules
64
+ YAML-based rule engine — enable, disable, adjust severity, or add whitelist entries. Ship your own security policy alongside the default 42-rule set with `--rules`.
65
+
66
+ ### 📄 Multiple Output Formats
67
+ Terminal (colored), JSON (machine-readable), and Markdown (documentation-friendly). Pick the right format for your workflow.
68
+
69
+ ## Security Dimensions
70
+
71
+ | # | Dimension | Coverage |
72
+ |---|-----------|----------|
73
+ | 1 | Prompt Injection | Direct/indirect injection patterns, zero-width chars, hidden instructions |
74
+ | 2 | Permission Escalation | Missing `allowed-tools`, sudo, chmod 777, dangerous tool combinations |
75
+ | 3 | Data Exfiltration | Credential theft, env leaks, outbound HTTP, webhook tunneling |
76
+ | 4 | Destructive Operations | Path traversal, sensitive file deletion, git force push |
77
+ | 5 | Supply Chain | Pipe-to-shell, unpinned dependencies, unverified Docker images |
78
+ | 6 | Code Security | Arbitrary eval, shell injection, SQL injection, XSS |
79
+ | 7 | Credential Leaks | Hardcoded API keys, JWT tokens, PEM private keys |
80
+ | 8 | Least Privilege | Missing tool declarations, shell + network + write combos |
81
+ | 9 | License Compliance | Proprietary restrictions, non-commercial clauses |
82
+ | 10 | Resource Abuse | Infinite loops, excessive retries, recursive functions without base case |
83
+
84
+ ## Architecture
85
+
86
+ ```mermaid
87
+ flowchart TD
88
+ CLI((CLI — npx @clawmaster/skillguard-cli)) -->|"URL or Path"| Fetcher[Repo Fetcher]
89
+ Fetcher -->|"GitHub Tarball / Git Clone"| GitHub[(GitHub)]
90
+ Fetcher -->|"ClawHub ZIP API"| ClawHub[(ClawHub)]
91
+ Fetcher -->|"Local Path"| Local[(Local Dir)]
92
+ Fetcher --> Scanner[Static Scan Engine — 10 Dimensions]
93
+ Scanner --> Rules[YAML Rules Engine — 42 Configurable]
94
+ Scanner --> Token[Token Estimator — L1/L2/L3]
95
+ Token --> Cost[Multi-Model Cost Calculator]
96
+ Scanner --> Renderer[Output Renderer]
97
+ Cost --> Renderer
98
+ Renderer -->|"--json"| JSON[JSON Output]
99
+ Renderer -->|"--md"| Markdown[Markdown Report]
100
+ Renderer -->|"default"| Terminal[Terminal — Colored]
101
+
102
+ classDef startEndStyle fill:#e8f5e8,stroke:#4caf50,stroke-width:3px,color:#000
103
+ classDef processStyle fill:#e3f2fd,stroke:#2196f3,stroke-width:2px,color:#000
104
+ classDef decisionStyle fill:#fff3e0,stroke:#ff9800,stroke-width:2px,color:#000
105
+ classDef dataStyle fill:#f3e5f5,stroke:#9c27b0,stroke-width:2px,color:#000
106
+ classDef outputStyle fill:#fce4ec,stroke:#e91e63,stroke-width:2px,color:#000
107
+
108
+ class CLI startEndStyle
109
+ class Fetcher,Scanner,Rules,Token,Cost processStyle
110
+ class GitHub,ClawHub,Local dataStyle
111
+ class Renderer decisionStyle
112
+ class JSON,Markdown,Terminal outputStyle
113
+ ```
114
+
115
+ ### How it differs from SkillGuard
116
+
117
+ | | SkillGuard (Web) | SkillGuard CLI |
118
+ |--|------------------|----------------|
119
+ | Interface | Web UI + WebSocket | Terminal |
120
+ | Infrastructure | FastAPI + Celery + Redis + SQLite | None — single `npx` command |
121
+ | Deep Scan | LLM-driven (Phase 2 in CLI) | Stubs ready, coming soon |
122
+ | Output | HTML reports | Terminal, JSON, Markdown |
123
+ | Distribution | Self-hosted | `npm install -g @clawmaster/skillguard-cli` |
124
+ | Scan engine | Same 109 rules | Same 109 rules |
125
+
126
+ ## CLI Reference
127
+
128
+ ```
129
+ skillguard <target> [options]
130
+
131
+ Arguments:
132
+ target Local directory, GitHub URL, or ClawHub URL
133
+
134
+ Options:
135
+ --all Scan all skill subdirectories (marketplace mode)
136
+ --json [file] Output as JSON (stdout or file)
137
+ --md <file> Output as Markdown report
138
+ --rules <path> Custom rules.yaml file
139
+ --min-level <A-F> Filter by minimum risk level (default: A)
140
+ --min-severity <severity> Filter by minimum severity (default: INFO)
141
+ --lang <en|zh> Output language (default: en)
142
+ -V, --version Show version
143
+ -h, --help Show help
144
+ ```
145
+
146
+ ### Examples
147
+
148
+ ```bash
149
+ # Quick audit with terminal output
150
+ npx @clawmaster/skillguard-cli https://github.com/anthropics/claude-code
151
+
152
+ # JSON report to file
153
+ npx @clawmaster/skillguard-cli ./my-skill --json report.json
154
+
155
+ # Markdown report
156
+ npx @clawmaster/skillguard-cli ./my-skill --md audit-report.md
157
+
158
+ # Chinese remediation text
159
+ npx @clawmaster/skillguard-cli ./my-skill --lang zh
160
+
161
+ # Only show HIGH and CRITICAL findings
162
+ npx @clawmaster/skillguard-cli ./my-skill --min-severity HIGH
163
+
164
+ # Marketplace scan with custom rules
165
+ npx @clawmaster/skillguard-cli ./skills-directory --all --rules custom-rules.yaml
166
+ ```
167
+
168
+ ## Claude Code Skills
169
+
170
+ SkillGuard CLI ships with three **Claude Code Skills** for integrated usage:
171
+
172
+ | Skill | Description |
173
+ |-------|-------------|
174
+ | `skills/audit/` | Run security audits directly from Claude Code |
175
+ | `skills/explain-report/` | Explain findings, assess real risk vs false positives |
176
+ | `skills/suggest-fixes/` | Generate concrete code fixes for findings |
177
+
178
+ ## Tech Stack
179
+
180
+ | Component | Technology | Role |
181
+ |-----------|-----------|------|
182
+ | Language | **TypeScript** | Type-safe scanning engine |
183
+ | Runtime | **Node.js ≥ 18** | ESM module system |
184
+ | CLI Framework | **Commander** | Argument parsing and help generation |
185
+ | Rule Engine | **js-yaml** | 109 configurable rules in YAML format |
186
+ | Terminal Output | **chalk** | Colored severity badges and risk grades |
187
+ | GitHub Fetcher | **tar** | Tarball download + extraction |
188
+ | ClawHub Fetcher | **unzipper** | ZIP download + extraction |
189
+ | Token Estimator | Built-in | 4-level (L1/L2-eager/L2-lazy/L3) token & cost projection |
190
+ | Build | **tsup** | Single-file ESM bundle (85KB) |
191
+ | Tests | **vitest** | Fast unit and integration testing |
192
+
193
+ ## Versioning
194
+
195
+ This project follows [Pride Versioning](https://pridever.org/) (`PROUD.DEFAULT.SHAME`):
196
+
197
+ - **PROUD** — bumped when releasing features we're genuinely proud of
198
+ - **DEFAULT** — bumped for ordinary, acceptable releases
199
+ - **SHAME** — bumped when fixing embarrassing bugs
200
+
201
+ Current version: **0.1.0**
202
+
203
+ ## License
204
+
205
+ This project is licensed under the [MIT License](LICENSE).
206
+
207
+ You are free to use, modify, and distribute SkillGuard CLI in both personal and commercial projects. See the [LICENSE](LICENSE) file for full terms.
208
+
209
+ ---
210
+
211
+ <p align="center">
212
+ <sub>CLI version of <a href="https://github.com/clawmaster-ai/skill-guard">SkillGuard</a> · Built for the AI Agent ecosystem · <a href="https://clawhub.ai">ClawHub</a></sub>
213
+ </p>