Skip to content

feat(validate): --file mode + dspack-validate bin — the standalone surface (DX-3 §4)#30

Merged
ryandmonk merged 1 commit into
mainfrom
feat/dx3-validate-file
Jul 22, 2026
Merged

feat(validate): --file mode + dspack-validate bin — the standalone surface (DX-3 §4)#30
ryandmonk merged 1 commit into
mainfrom
feat/dx3-validate-file

Conversation

@ryandmonk

Copy link
Copy Markdown
Contributor

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 on scripts/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.
  • One validator, enforced: the new dspack-validate bin is scripts/validate.mjs (package.json bin entry, 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 OIDC release.yml mirroring the proven pattern.
  • CI guards the fail-first behavior: the pre---file harness silently ignored the flag and exited 0 even pointed at a negative fixture (captured before implementing). validate.yml and release.yml now assert file mode accepts a valid document and rejects an invalid one.
  • ADOPTING.md, same change per the invariant: step 1 states the refusal guarantee + ledger (matching export 0.3.0's behavior) with npm install primary; step 2 retired with numbering kept; step 10 becomes npx -p @aestheticfunction/dspack-spec dspack-validate --file … / npm run validate -- --file … — both explicitly the same validator. README charter updated.

Verification

  • File mode: valid doc → exit 0; negative fixture → exit 1 with the same finding text as examples mode.
  • npm run validate → examples PASS (2); negative mode → 18/18 rejected — unchanged.
  • npm pack --dry-run: bin target scripts/validate.mjs included.

After merge: tag v0.4.0 → OIDC publish (requires one-time trusted-publisher registration on npmjs.com: repository aestheticfunction/dspack, workflow release.yml).

🤖 Generated with Claude Code

…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>
Copilot AI review requested due to automatic review settings July 22, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mjs directly as the dspack-validate bin via package.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 on v* 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 thread scripts/validate.mjs
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 thread scripts/validate.mjs
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.
@ryandmonk
ryandmonk merged commit cf593c7 into main Jul 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants