agent-skill-validator 0.0.0-stage → 0.1.1

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 The agent-skill-validator authors
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 CHANGED
@@ -1,3 +1,253 @@
1
- # Temporary Holding Version
1
+ # Skill Validator CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Offline Node 22+ validator for directories containing `SKILL.md`. Uses the
4
+ website's deterministic rules, security heuristics, static package checks, and
5
+ token estimates. No network requests, AI calls, or execution of skill scripts.
6
+
7
+ **Status:** implemented and tested locally; published to public npm as
8
+ `agent-skill-validator`. The CLI is a general tool and carries no Vinted
9
+ dependency.
10
+
11
+ ## Try locally
12
+
13
+ From the repository root:
14
+
15
+ ```sh
16
+ npm --prefix cli ci
17
+ npm --prefix cli run build
18
+ node cli/dist/cli.js validate cli/test/fixtures/skills/csv-summary
19
+ node cli/dist/cli.js --help
20
+ ```
21
+
22
+ Build an installable tarball with `npm pack` from `cli/`, then install that
23
+ tarball in another project with `npm install -D /absolute/path/to/the.tgz`.
24
+ Both `skill-validator` and `skillval` invoke the same command.
25
+
26
+ Install it from public npm:
27
+
28
+ ```sh
29
+ npm install -D agent-skill-validator
30
+ ```
31
+
32
+ Both `skill-validator` and `skillval` are installed as commands. The package
33
+ has no runtime dependencies on Vinted infrastructure.
34
+
35
+ ## Commands
36
+
37
+ After installing the package locally:
38
+
39
+ ```sh
40
+ skill-validator validate skills
41
+ skill-validator skills/foo/SKILL.md # validate is the default command
42
+ skill-validator doctor # install/config/discovery diagnostics
43
+ skill-validator rules list # web-only rules are marked [web/live only]
44
+ skill-validator rules explain B4
45
+ skill-validator prompt skills/foo # offline repair prompt, to stdout
46
+ ```
47
+
48
+ With no paths, discovery starts at `skills/` in the current directory if it
49
+ exists, otherwise at the current directory. Paths must stay within the nearest
50
+ Git repository root (or the current directory when outside Git).
51
+
52
+ ### Reports and flags
53
+
54
+ ```sh
55
+ skill-validator validate skills --format json --out report.json
56
+ skill-validator validate skills --format junit,json,markdown --report-dir reports
57
+ skill-validator validate skills --fail-on critical --quiet
58
+ ```
59
+
60
+ - `--format`: comma-separated `text,json,junit,markdown`; default `text`.
61
+ - `--report-dir`: required for multiple formats. Fixed filenames are
62
+ `report.txt`, `report.json`, `junit.xml`, and `report.md`.
63
+ - `--out`: a single-format destination; `-` means stdout. Mutually exclusive
64
+ with `--report-dir`. Outputs must stay inside the repository and outside skill
65
+ directories, so reports cannot overwrite skill source.
66
+ - `--fail-on`: `critical`, `high`, `suggestion`, `info`, or `none`; default `high`.
67
+ - `--quiet`: counts and gate line only in text output; machine formats stay intact.
68
+ - `--config`: explicit config path, otherwise `.skill-validator.json` at repo root.
69
+
70
+ File output creates parent directories and writes atomically. Its short summary
71
+ goes to stderr; stdout JSON/XML is not mixed with logs. Text is uncolored. Text
72
+ and Markdown cap output at 20 findings per skill; JSON and JUnit are complete.
73
+ Destinations inside any skill are refused, including unselected or ignored skills
74
+ and filesystem case aliases. Failed writes remove their owned temporary file and
75
+ leave any existing destination intact.
76
+
77
+ Exit codes:
78
+
79
+ - `0`: no findings meet the configured threshold.
80
+ - `1`: findings fail the gate.
81
+ - `2`: invalid invocation, config, missing skills, incomplete discovery,
82
+ unreadable or refused input, or output I/O failure. A closed stdout/stderr pipe
83
+ exits 2 without an unhandled stack trace and without forcing pending output to
84
+ be truncated.
85
+ - `3`: internal CLI error; includes a reporting URL. Set
86
+ `SKILL_VALIDATOR_DEBUG=1` for a stack trace, which may contain sensitive data.
87
+
88
+ Zero skills is never a successful validation. `doctor` can report zero skills
89
+ without failing because it is diagnostic, not a gate.
90
+
91
+ ## Configuration
92
+
93
+ The default gate is `high`. A team can initially choose `critical` with reviewed
94
+ severity overrides, then tighten the gate after checking real skills:
95
+
96
+ ```json
97
+ {
98
+ "failOn": "critical",
99
+ "ruleSeverities": {
100
+ "TT-003": "high",
101
+ "DE-002": "suggestion"
102
+ },
103
+ "ignore": ["drafts/**"]
104
+ }
105
+ ```
106
+
107
+ Flags override config. Unknown keys, rule IDs, and severity values are errors,
108
+ as are overrides for web/live-only rules (AI-assisted review, URL/registry
109
+ liveness, HP-001): the CLI never reports them, so an override cannot take effect.
110
+ Overrides change visible findings and preserve `originalSeverity` in JSON;
111
+ they do not hide rules. First-party API integrations can legitimately read tokens
112
+ and make requests, which is why the example recalibrates those security rules.
113
+
114
+ `ignore` accepts repo-relative glob patterns and affects **skill discovery only**.
115
+ Each pattern is limited to 1,024 characters and 128 glob operators; invalid or
116
+ unevaluable patterns are configuration errors, not internal crashes.
117
+ It cannot hide files inside a discovered skill. `.git` and `node_modules` are
118
+ excluded at the root of a skill only; nested copies (for example
119
+ `scripts/node_modules`) are scanned and count toward the per-skill limits below.
120
+ Discovery itself never descends into `.git` or `node_modules`. Protect CI configuration with CODEOWNERS/review requirements:
121
+ a PR-controlled threshold can otherwise weaken its own gate.
122
+
123
+ ## Scope and safety
124
+
125
+ - Discovery descends at most four directories below each input root. If any
126
+ eligible directory (not ignored, not `.git`/`node_modules`) lies below that
127
+ limit, the run exits 2 and names it, even when other skills were found, so a
128
+ gate never passes on a partly searched tree. Pass a narrower root, or add
129
+ directories without skills to `ignore`. `doctor` reports them without failing.
130
+ Overlapping inputs are deduplicated, including explicit nested inputs. Nested
131
+ skills stay in their parent bundle so rule A0 can report them. A skill's contents
132
+ are loaded as a complete bundle rather than subject to the discovery depth limit.
133
+ - Symlinks and nonregular skill files are refused. Per-skill limits are 2,000 files,
134
+ 100 MiB total file size, and 5 MiB per text file. Discovery and bundle traversal
135
+ each cap directories at 10,000; discovery counts unique directories, not repeated
136
+ overlapping visits. Bundle nesting is capped at 64.
137
+ - Archives are not CLI inputs. Binary files contribute metadata and size, not
138
+ decoded content. Skills and inputs are never executed.
139
+ - JavaScript `.js`, `.mjs`, and `.cjs` files are decoded and security-scanned with
140
+ the same executable-risk weighting. Malformed frontmatter mappings and eval
141
+ document/case shapes produce findings instead of passing silently or crashing.
142
+ - These checks bound ordinary validation; they are not a sandbox against a
143
+ separate process maliciously changing directories during a scan.
144
+ - Security patterns currently report the first matching occurrence per rule/file.
145
+ A passing result is not proof a skill is safe or effective.
146
+
147
+ The website additionally performs liveness and optional AI review, so its complete
148
+ report can differ. CLI reports explicitly list `ai-review` and `liveness` as not
149
+ run. Static known-hallucinated-package rule HP-002 still runs offline.
150
+
151
+ ### Report contract and privacy
152
+
153
+ JSON has `schemaVersion: 1`, relative paths, stable finding fingerprints, and an
154
+ explicit `gate`. The published package includes
155
+ [`schema/report.schema.json`](schema/report.schema.json). Fingerprints normalize
156
+ line endings and include diagnostic text so separate eval cases stay distinct.
157
+ They exclude line numbers and severity; wording changes can change an identifier.
158
+ They are identifiers, not a baseline feature.
159
+ Legal POSIX names such as colons and newlines retain their identity. A relative
160
+ path that could be read as a Windows drive-absolute or rooted path (a drive letter
161
+ and colon followed by a separator or nothing, or a leading backslash) is prefixed
162
+ with `./`; the prefixed path resolves to the same file. Absolute and `..` paths
163
+ never appear in reports.
164
+
165
+ JUnit includes one failing testcase per blocking finding and an `@summary` case
166
+ per skill. A testcase is named by rule ID; when a rule blocks more than once in
167
+ a skill, the name becomes `<ruleId>:<fingerprint>` so cases stay distinct.
168
+ Advisory findings are neither failures nor fake skipped tests. Counts match the
169
+ gate; timestamps and durations are omitted for stable output.
170
+ XML attribute encoding preserves tabs, newlines, and carriage returns in paths,
171
+ so distinct files do not merge into the same Jenkins testcase identity.
172
+
173
+ Security snippets are omitted from reports and from repair prompts, and common
174
+ credential patterns are redacted from both. This is best-effort, not complete
175
+ secret detection. Prompts still quote other source content (for example
176
+ descriptions and suggested replacements), and reports include skill paths and
177
+ finding text. Treat both as potentially sensitive; use appropriate artifact
178
+ access/retention. Text and Markdown output show control characters in paths as
179
+ visible `\uXXXX` escapes; JSON keeps the exact path.
180
+
181
+ ## Jenkins example
182
+
183
+ **After publishing:** pin the verified package version, commit the consumer's
184
+ package manifest/lockfile and registry configuration, and add at least one real
185
+ skill before enabling this gate. This npm-based example assumes an existing
186
+ `package-lock.json`; a pnpm consumer should use its matching frozen lockfile.
187
+
188
+ ```groovy
189
+ pipeline {
190
+ agent { label 'shared' }
191
+ tools { nodejs 'NodeJS-22.14-pnpm10' }
192
+ options { timestamps(); timeout(time: 10, unit: 'MINUTES') }
193
+ stages {
194
+ stage('Install') {
195
+ steps { sh 'npm ci --ignore-scripts' }
196
+ }
197
+ stage('Validate skills') {
198
+ steps {
199
+ // Remove stale artifacts before invocation, including crash paths.
200
+ dir('skill-validator-report') { deleteDir() }
201
+ script {
202
+ def status = sh(returnStatus: true, script: '''
203
+ ./node_modules/.bin/skill-validator validate skills \
204
+ --format junit,json,markdown \
205
+ --report-dir skill-validator-report --quiet
206
+ ''')
207
+ if (status != 0) {
208
+ error("skill-validator exited ${status}; see reports and log")
209
+ }
210
+ }
211
+ }
212
+ post {
213
+ always {
214
+ archiveArtifacts artifacts: 'skill-validator-report/*', allowEmptyArchive: true
215
+ junit testResults: 'skill-validator-report/junit.xml', allowEmptyResults: false
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+ ```
222
+
223
+ Missing JUnit is an error, not an empty successful test run. Enable the required
224
+ status check and protect policy files when installing this in `design-ai-skills`.
225
+ The example has not yet been executed on a Jenkins agent.
226
+
227
+ ## Development
228
+
229
+ From `cli/`, run `npm ci`, `npm run typecheck`, and `npm test`. The tests build
230
+ the bundle, validate report schemas/JUnit, exercise the exit-code and filesystem
231
+ contracts, and install a packed tarball without runtime dependencies.
232
+ Also run root typecheck, tests, and build when changing shared engine code.
233
+ The test suite uses Python 3's standard library for XML round-trips and isolated
234
+ OS-level write/pipe fault injection; Python is not a package runtime dependency.
235
+ [`.github/workflows/ci.yml`](../.github/workflows/ci.yml) runs these checks for
236
+ the application, CLI, and server across its OS/Node matrix. It never publishes
237
+ packages or deploys the app.
238
+
239
+ ## Publishing
240
+
241
+ The release script publishes `agent-skill-validator` to public npm. Publishing
242
+ requires an `NPM_TOKEN` automation token with publish access, supplied outside
243
+ source control. Do not put credentials in docs, tracked `.npmrc` files, or chat.
244
+
245
+ - `scripts/publish-cli.sh test`: publishes with the `canary` dist-tag. Use a unique
246
+ prerelease version; a dist-tag does not make an existing version overwritable.
247
+ - `scripts/publish-cli.sh release`: requires a clean tree and an exact
248
+ `cli-vX.Y.Z` tag on HEAD matching `cli/package.json`. Runs checks, packs, and
249
+ publishes that exact tarball with `latest`; an already-published version is skipped.
250
+
251
+ CLI tags are independent of web `vX.Y.Z` tags and do not require a Playground
252
+ deploy. After the first publish, confirm `npm view agent-skill-validator version`
253
+ reports the new release before updating any consumer.