@skillguard/cli 0.1.1 → 0.4.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/CHANGELOG.md +25 -0
- package/README.md +106 -10
- package/dist/cli.js +119 -25
- package/dist/commands/gate.d.ts +14 -0
- package/dist/commands/gate.js +17 -0
- package/dist/commands/limits.d.ts +8 -0
- package/dist/commands/limits.js +98 -0
- package/dist/commands/scan.d.ts +5 -2
- package/dist/commands/scan.js +72 -22
- package/dist/commands/verify.js +3 -3
- package/dist/commands/workflow.d.ts +21 -0
- package/dist/commands/workflow.js +143 -0
- package/dist/lib/api.d.ts +40 -0
- package/dist/lib/api.js +127 -0
- package/dist/lib/format.js +2 -0
- package/dist/lib/help.d.ts +2 -0
- package/dist/lib/help.js +240 -0
- package/dist/lib/version.d.ts +1 -0
- package/dist/lib/version.js +1 -0
- package/package.json +1 -1
package/dist/lib/help.js
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
const COMMAND_ALIASES = {
|
|
2
|
+
man: 'help',
|
|
3
|
+
};
|
|
4
|
+
function normalizeTopic(topic) {
|
|
5
|
+
if (!topic) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const normalized = topic.trim().toLowerCase();
|
|
9
|
+
const aliased = COMMAND_ALIASES[normalized] || normalized;
|
|
10
|
+
if (aliased === 'help' ||
|
|
11
|
+
aliased === 'init' ||
|
|
12
|
+
aliased === 'scan' ||
|
|
13
|
+
aliased === 'gate' ||
|
|
14
|
+
aliased === 'limits' ||
|
|
15
|
+
aliased === 'verify' ||
|
|
16
|
+
aliased === 'workflow') {
|
|
17
|
+
return aliased;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
export function renderGeneralHelp(version) {
|
|
22
|
+
return `SkillGuard CLI ${version}
|
|
23
|
+
|
|
24
|
+
Usage:
|
|
25
|
+
skillguard <command> [options]
|
|
26
|
+
|
|
27
|
+
Core commands:
|
|
28
|
+
init Save API key in local CLI config
|
|
29
|
+
scan Scan one file or recursively scan a directory
|
|
30
|
+
gate CI gate mode (0 pass, 1 fail)
|
|
31
|
+
limits Show anonymous/owner/agent remaining limits
|
|
32
|
+
verify Verify signed SKILL.md via SkillGuard JWKS
|
|
33
|
+
workflow Generate GitHub Actions workflow file
|
|
34
|
+
|
|
35
|
+
Help commands:
|
|
36
|
+
help [command]
|
|
37
|
+
man [command]
|
|
38
|
+
|
|
39
|
+
Quick start:
|
|
40
|
+
skillguard scan SKILL.md
|
|
41
|
+
skillguard gate .
|
|
42
|
+
skillguard workflow
|
|
43
|
+
skillguard workflow --auto-gh-push
|
|
44
|
+
|
|
45
|
+
Global flags:
|
|
46
|
+
-h, --help Show help
|
|
47
|
+
-v, --version Show version
|
|
48
|
+
--workflow Alias for "workflow"
|
|
49
|
+
|
|
50
|
+
Run "skillguard help <command>" for full command details.`;
|
|
51
|
+
}
|
|
52
|
+
function renderHelpCommandHelp() {
|
|
53
|
+
return `NAME
|
|
54
|
+
skillguard help, skillguard man - show detailed command help
|
|
55
|
+
|
|
56
|
+
SYNOPSIS
|
|
57
|
+
skillguard help [command]
|
|
58
|
+
skillguard man [command]
|
|
59
|
+
|
|
60
|
+
DESCRIPTION
|
|
61
|
+
Shows command-level help in a man-page style format.
|
|
62
|
+
If no command is provided, prints general CLI help.
|
|
63
|
+
|
|
64
|
+
EXAMPLES
|
|
65
|
+
skillguard help scan
|
|
66
|
+
skillguard man workflow`;
|
|
67
|
+
}
|
|
68
|
+
function renderInitHelp() {
|
|
69
|
+
return `NAME
|
|
70
|
+
skillguard init - save API key in local config
|
|
71
|
+
|
|
72
|
+
SYNOPSIS
|
|
73
|
+
skillguard init [--api-key <key>] [--base-url <url>]
|
|
74
|
+
|
|
75
|
+
DESCRIPTION
|
|
76
|
+
Writes ~/.config/skillguard/config.json with apiKey and apiUrl.
|
|
77
|
+
If --api-key is omitted, prompts interactively.
|
|
78
|
+
|
|
79
|
+
OPTIONS
|
|
80
|
+
--api-key <key> API key to persist
|
|
81
|
+
--base-url <url> API base URL (default: https://skillguard.ai)
|
|
82
|
+
|
|
83
|
+
EXIT CODES
|
|
84
|
+
0 success
|
|
85
|
+
4 usage/input/config error
|
|
86
|
+
5 external runtime error`;
|
|
87
|
+
}
|
|
88
|
+
function renderScanHelp() {
|
|
89
|
+
return `NAME
|
|
90
|
+
skillguard scan - scan SKILL.md content for risk
|
|
91
|
+
|
|
92
|
+
SYNOPSIS
|
|
93
|
+
skillguard scan [path] [options]
|
|
94
|
+
|
|
95
|
+
DESCRIPTION
|
|
96
|
+
Scans one file or recursively scans a directory for SKILL.md files.
|
|
97
|
+
If no path is provided, scans from current directory.
|
|
98
|
+
If no API key is configured, uses anonymous mode (rate-limited).
|
|
99
|
+
|
|
100
|
+
OPTIONS
|
|
101
|
+
--json Machine-readable JSON output
|
|
102
|
+
--fail-on <safe|warning|dangerous>
|
|
103
|
+
Explicit threshold mode (exit 0/1)
|
|
104
|
+
--timeout <ms> Request timeout (default: 30000)
|
|
105
|
+
--base-url <url> API base URL
|
|
106
|
+
--api-key <key> Override API key
|
|
107
|
+
--dry-run Show target files, skip API call
|
|
108
|
+
--quiet Suppress output, keep exit code
|
|
109
|
+
--no-color Disable ANSI colors
|
|
110
|
+
--skip-node-modules Skip node_modules (default: enabled)
|
|
111
|
+
--scan-all Disable skip filters for recursive scan
|
|
112
|
+
|
|
113
|
+
EXIT CODES
|
|
114
|
+
default mode (no --fail-on): safe=0, warning=1, dangerous=2
|
|
115
|
+
threshold mode (--fail-on): 0 below threshold, 1 threshold reached
|
|
116
|
+
4 usage/input/config error
|
|
117
|
+
5 network/API/runtime failure`;
|
|
118
|
+
}
|
|
119
|
+
function renderGateHelp() {
|
|
120
|
+
return `NAME
|
|
121
|
+
skillguard gate - CI gate mode for deterministic pass/fail
|
|
122
|
+
|
|
123
|
+
SYNOPSIS
|
|
124
|
+
skillguard gate [path] [options]
|
|
125
|
+
|
|
126
|
+
DESCRIPTION
|
|
127
|
+
Wrapper around scan with explicit threshold mode enabled.
|
|
128
|
+
Default fail-on is warning.
|
|
129
|
+
|
|
130
|
+
OPTIONS
|
|
131
|
+
Same as "skillguard scan".
|
|
132
|
+
--fail-on defaults to warning in gate mode.
|
|
133
|
+
|
|
134
|
+
EXIT CODES
|
|
135
|
+
0 below threshold
|
|
136
|
+
1 threshold reached
|
|
137
|
+
4 usage/input/config error
|
|
138
|
+
5 network/API/runtime failure`;
|
|
139
|
+
}
|
|
140
|
+
function renderLimitsHelp() {
|
|
141
|
+
return `NAME
|
|
142
|
+
skillguard limits - show remaining limits/quota
|
|
143
|
+
|
|
144
|
+
SYNOPSIS
|
|
145
|
+
skillguard limits [--json] [--timeout <ms>] [--base-url <url>] [--api-key <key>] [--no-color]
|
|
146
|
+
|
|
147
|
+
DESCRIPTION
|
|
148
|
+
Fetches /api/v1/limits and prints current request mode:
|
|
149
|
+
anonymous, owner, or agent.
|
|
150
|
+
|
|
151
|
+
OPTIONS
|
|
152
|
+
--json JSON output
|
|
153
|
+
--timeout <ms> Request timeout (default: 30000)
|
|
154
|
+
--base-url <url> API base URL
|
|
155
|
+
--api-key <key> Optional API key
|
|
156
|
+
--no-color Disable ANSI colors
|
|
157
|
+
|
|
158
|
+
EXIT CODES
|
|
159
|
+
0 success
|
|
160
|
+
4 usage/input/config error
|
|
161
|
+
5 network/API/runtime failure`;
|
|
162
|
+
}
|
|
163
|
+
function renderVerifyHelp() {
|
|
164
|
+
return `NAME
|
|
165
|
+
skillguard verify - verify signed SKILL.md content
|
|
166
|
+
|
|
167
|
+
SYNOPSIS
|
|
168
|
+
skillguard verify <path> [--json] [--timeout <ms>] [--base-url <url>]
|
|
169
|
+
|
|
170
|
+
DESCRIPTION
|
|
171
|
+
Verifies SkillGuard Ed25519 signature and content hash using JWKS.
|
|
172
|
+
|
|
173
|
+
OPTIONS
|
|
174
|
+
--json JSON output
|
|
175
|
+
--timeout <ms> Request timeout (default: 30000)
|
|
176
|
+
--base-url <url> API base URL
|
|
177
|
+
|
|
178
|
+
EXIT CODES
|
|
179
|
+
0 signature valid
|
|
180
|
+
1 invalid/tampered/expired signature
|
|
181
|
+
4 usage/input/config error
|
|
182
|
+
5 network/API/runtime failure`;
|
|
183
|
+
}
|
|
184
|
+
function renderWorkflowHelp() {
|
|
185
|
+
return `NAME
|
|
186
|
+
skillguard workflow - generate GitHub Actions workflow for CI gate
|
|
187
|
+
|
|
188
|
+
SYNOPSIS
|
|
189
|
+
skillguard workflow [options]
|
|
190
|
+
skillguard --workflow [options]
|
|
191
|
+
|
|
192
|
+
DESCRIPTION
|
|
193
|
+
Writes .github/workflows/skillguard.yml configured to run:
|
|
194
|
+
npx @skillguard/cli gate . --fail-on warning
|
|
195
|
+
|
|
196
|
+
OPTIONS
|
|
197
|
+
--path <file> Output workflow path
|
|
198
|
+
(default: .github/workflows/skillguard.yml)
|
|
199
|
+
--scan-path <path> Path passed to gate command (default: .)
|
|
200
|
+
--fail-on <safe|warning|dangerous>
|
|
201
|
+
Gate threshold (default: warning)
|
|
202
|
+
--print Print YAML to stdout, do not write files
|
|
203
|
+
--force Overwrite existing file
|
|
204
|
+
--auto-gh-push Run git add/commit/push after writing
|
|
205
|
+
|
|
206
|
+
EXIT CODES
|
|
207
|
+
0 success
|
|
208
|
+
4 usage/input/config error
|
|
209
|
+
5 runtime/git failure
|
|
210
|
+
|
|
211
|
+
EXAMPLES
|
|
212
|
+
skillguard workflow
|
|
213
|
+
skillguard workflow --print
|
|
214
|
+
skillguard workflow --auto-gh-push
|
|
215
|
+
skillguard --workflow --force`;
|
|
216
|
+
}
|
|
217
|
+
export function renderTopicHelp(command) {
|
|
218
|
+
const topic = normalizeTopic(command);
|
|
219
|
+
if (!topic) {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
switch (topic) {
|
|
223
|
+
case 'help':
|
|
224
|
+
return renderHelpCommandHelp();
|
|
225
|
+
case 'init':
|
|
226
|
+
return renderInitHelp();
|
|
227
|
+
case 'scan':
|
|
228
|
+
return renderScanHelp();
|
|
229
|
+
case 'gate':
|
|
230
|
+
return renderGateHelp();
|
|
231
|
+
case 'limits':
|
|
232
|
+
return renderLimitsHelp();
|
|
233
|
+
case 'verify':
|
|
234
|
+
return renderVerifyHelp();
|
|
235
|
+
case 'workflow':
|
|
236
|
+
return renderWorkflowHelp();
|
|
237
|
+
default:
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CLI_VERSION = "0.4.0";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CLI_VERSION = '0.4.0';
|