feat(validate): --file mode + dspack-validate bin — the standalone surface (DX-3 §4)#30
Merged
Merged
Conversation
…rface (DX-3 §4) One validator, two front-ends. --file <path>... runs the identical validation (schema, back-compat, governance consistency, categories) over named documents; the examples/ and negative-fixture modes are untouched. The package becomes publishable (@aestheticfunction/ dspack-spec, bin dspack-validate = scripts/validate.mjs verbatim) with a tag-triggered OIDC release workflow; CI now guards file mode in both directions — the pre---file harness silently ignored the flag and exited 0 pointing at a negative fixture (fail-first baseline). ADOPTING.md updated in the same change per the invariant: step 1 carries the refusal guarantee and ledger, step 2 is retired (snapshots declare the current spec version), step 10 uses the standalone surface. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR turns the existing validation harness into a publishable, standalone CLI surface by adding --file support to scripts/validate.mjs, wiring it directly as the dspack-validate npm bin, and adding CI/release workflows to guard the new behavior and publish on tags.
Changes:
- Add
--file <path> [<path>...]mode to run the same schema/back-compat/governance/category validation over explicitly provided documents. - Publish
scripts/validate.mjsdirectly as thedspack-validatebin viapackage.json(and package the necessary spec/schema/example artifacts). - Extend CI (
validate.yml) and add tag-driven OIDC publishing (release.yml) to assert file-mode pass/fail behavior and publish onv*tags.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/validate.mjs | Adds --file mode and adjusts output labeling for documents vs examples. |
| README.md | Updates repo “Kind” description to reflect the new npm package + bin. |
| package.json | Makes the package publishable, adds bin entry, and restricts packed files. |
| ADOPTING.md | Updates adoption steps to use the standalone dspack-validate --file workflow and retires the old “set version” step. |
| .github/workflows/validate.yml | Adds CI assertions that file mode accepts a known-good doc and rejects a known-bad fixture. |
| .github/workflows/release.yml | Adds an OIDC trusted-publishing workflow gated on version tags with full validation prior to publish. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
328
to
+342
| function main() { | ||
| const args = process.argv.slice(2); | ||
| const negativeMode = args.includes("--fixtures") && args[args.indexOf("--fixtures") + 1] === "negative"; | ||
| // --file <path> [<path>...]: every argument after the flag that does not | ||
| // start with "-" names a document to validate. | ||
| let fileArgs = null; | ||
| const fileFlag = args.indexOf("--file"); | ||
| if (fileFlag !== -1) { | ||
| fileArgs = []; | ||
| for (let i = fileFlag + 1; i < args.length && !args[i].startsWith("-"); i++) fileArgs.push(args[i]); | ||
| if (fileArgs.length === 0) { | ||
| console.error("usage: validate --file <path.dspack.json> [<path>...]"); | ||
| process.exit(1); | ||
| } | ||
| } |
Comment on lines
+377
to
380
| const docs = fileArgs ?? listDocs(EXAMPLES_DIR); | ||
| if (docs.length === 0) { | ||
| console.error(`no examples found in ${EXAMPLES_DIR}`); | ||
| process.exit(1); |
Comment on lines
+25
to
+26
| # Guards the fail-first behavior: the pre---file harness silently | ||
| # ignored the flag and exited 0 on this exact invocation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the accepted DX-3 design §4 (standalone validation) plus the §6 ADOPTING.md deltas, in lockstep with dspack-export#9.
What changes
--file <path> [<path>...]mode onscripts/validate.mjs: identical validation (schema, back-compat, governance consistency incl. S1/S2 over embedded examples, categories) over named documents. Default examples mode and negative-fixture mode byte-untouched in behavior.dspack-validatebin isscripts/validate.mjs(package.jsonbinentry, no wrapper code at all). The package becomes publishable —@aestheticfunction/dspack-spec(schemas, spec, reference contracts, ADOPTING.md, the harness; 88.7 kB, 21 files) — with a tag-triggered OIDCrelease.ymlmirroring the proven pattern.--fileharness silently ignored the flag and exited 0 even pointed at a negative fixture (captured before implementing).validate.ymlandrelease.ymlnow assert file mode accepts a valid document and rejects an invalid one.npx -p @aestheticfunction/dspack-spec dspack-validate --file …/npm run validate -- --file …— both explicitly the same validator. README charter updated.Verification
npm run validate→ examples PASS (2); negative mode → 18/18 rejected — unchanged.npm pack --dry-run: bin targetscripts/validate.mjsincluded.After merge: tag
v0.4.0→ OIDC publish (requires one-time trusted-publisher registration on npmjs.com: repositoryaestheticfunction/dspack, workflowrelease.yml).🤖 Generated with Claude Code