@sdd-method/verify-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 +201 -0
- package/NOTICE +17 -0
- package/README.md +7 -0
- package/dist/lib/catalogue/baseline-check.js +136 -0
- package/dist/lib/catalogue/canonical-schema.yaml +3557 -0
- package/dist/lib/catalogue/cli-version.js +10 -0
- package/dist/lib/catalogue/coverage-predicates.js +603 -0
- package/dist/lib/catalogue/coverage-render.js +522 -0
- package/dist/lib/catalogue/coverage-run.js +115 -0
- package/dist/lib/catalogue/csv-reader.js +97 -0
- package/dist/lib/catalogue/csv-writer.js +96 -0
- package/dist/lib/catalogue/ddl-generator.js +233 -0
- package/dist/lib/catalogue/engine-validator.js +222 -0
- package/dist/lib/catalogue/finding-identity.js +183 -0
- package/dist/lib/catalogue/findings.js +46 -0
- package/dist/lib/catalogue/fk-validator.js +136 -0
- package/dist/lib/catalogue/gate-checks.js +338 -0
- package/dist/lib/catalogue/graph-projection.js +329 -0
- package/dist/lib/catalogue/impact-run.js +228 -0
- package/dist/lib/catalogue/manifest-loader.js +422 -0
- package/dist/lib/catalogue/relationship-semantics.js +66 -0
- package/dist/lib/catalogue/rubric-coverage-map.yaml +764 -0
- package/dist/lib/catalogue/scaffold-delta.js +261 -0
- package/dist/lib/catalogue/schema-compat.js +52 -0
- package/dist/lib/catalogue/schema-loader.js +87 -0
- package/dist/lib/catalogue/scores-coverage.js +535 -0
- package/dist/lib/catalogue/staleness-verdicts.js +345 -0
- package/dist/lib/catalogue/validate.js +176 -0
- package/dist/lib/catalogue/version.js +18 -0
- package/dist/lib/list/discover.js +100 -0
- package/dist/lib/list/format.js +84 -0
- package/dist/lib/list/index.js +16 -0
- package/dist/lib/lock-file.js +413 -0
- package/dist/lib/pack/log.js +18 -0
- package/dist/lib/pack/schema.js +121 -0
- package/dist/lib/pack/seed.js +182 -0
- package/dist/lib/pack/validate.js +49 -0
- package/dist/lib/package-version.js +25 -0
- package/dist/lib/repo-kind.js +129 -0
- package/dist/lib/scripts.js +7 -0
- package/dist/lib/validate/aggregate.js +35 -0
- package/dist/lib/validate/bundle-coherence.js +69 -0
- package/dist/lib/validate/dispatch.js +218 -0
- package/dist/lib/validate/index.js +88 -0
- package/dist/lib/validate/runner.js +85 -0
- package/dist/verbs/catalogue-verify.js +114 -0
- package/dist/verbs/list.js +45 -0
- package/dist/verbs/pack-validate.js +17 -0
- package/dist/verbs/path-option.js +25 -0
- package/dist/verbs/validate.js +22 -0
- package/dist/verify-bin.js +8 -0
- package/dist/verify-program.js +115 -0
- package/package.json +32 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Third entrypoint: the VERIFY surface — M-ADR 0212 §4.3b.
|
|
2
|
+
//
|
|
3
|
+
// A binary that CANNOT WRITE to the repository it is pointed at. That is the
|
|
4
|
+
// whole property, and it is the one a pipeline can rely on: whatever runs
|
|
5
|
+
// `sdd-verify` in CI can judge a repository and cannot change it.
|
|
6
|
+
//
|
|
7
|
+
// Two criteria admit a verb here, and both are required:
|
|
8
|
+
// 1. it does not write to the target repository — TESTED, not read from a
|
|
9
|
+
// description: the package acceptance check runs every verb in every mode
|
|
10
|
+
// against a clean checkout and requires `git status --porcelain` to be
|
|
11
|
+
// empty. Reading help text misfiled four verbs before that test existed
|
|
12
|
+
// (`sync`, `render`, `catalogue graph`, `metamodel roundtrip`).
|
|
13
|
+
// 2. it has something to act on in an adopter repository today. A read-only
|
|
14
|
+
// verb can fail this and pass (1): `metamodel roundtrip` is producer-only,
|
|
15
|
+
// `catalogue migration-map` serves a finished migration. Neither is here.
|
|
16
|
+
//
|
|
17
|
+
// ⚠ The boundary is ABSENCE, not a menu. The package ships only the import
|
|
18
|
+
// closure of this file, so an excluded verb's code is not present to be reached
|
|
19
|
+
// by any path — including `mcp serve`, which exposes the SDD as tools and would
|
|
20
|
+
// hand authoring back through a second door. That is why registration imports
|
|
21
|
+
// per-subcommand registrars (`catalogue-verify.ts`, `pack-validate.ts`) and never
|
|
22
|
+
// a barrel that re-exports a build path.
|
|
23
|
+
//
|
|
24
|
+
// Verbs are the SAME registrars the full CLI uses: one implementation, two
|
|
25
|
+
// surfaces, so behaviour cannot drift between them.
|
|
26
|
+
import { Command, CommanderError } from "commander";
|
|
27
|
+
import { getPackageVersion } from "./lib/package-version.js";
|
|
28
|
+
import { registerCatalogueBaselineCheck, registerCatalogueImpact, registerCatalogueValidate, registerCatalogueVersion, } from "./verbs/catalogue-verify.js";
|
|
29
|
+
import { registerList } from "./verbs/list.js";
|
|
30
|
+
import { registerPackValidate } from "./verbs/pack-validate.js";
|
|
31
|
+
import { registerValidate } from "./verbs/validate.js";
|
|
32
|
+
const SPEC_URL = "https://github.com/tomfosteruk/sdd-method/blob/main/docs/method/cli/sdd-cli-specification.md";
|
|
33
|
+
/** The full surface, as `<verb>` or `<verb> <subcommand>`. Asserted by test. */
|
|
34
|
+
export const VERIFY_SURFACE = [
|
|
35
|
+
"validate",
|
|
36
|
+
"list",
|
|
37
|
+
"pack validate",
|
|
38
|
+
"catalogue validate",
|
|
39
|
+
"catalogue impact",
|
|
40
|
+
"catalogue baseline-check",
|
|
41
|
+
"catalogue version",
|
|
42
|
+
];
|
|
43
|
+
const OUTSIDE = "is not part of sdd-verify, which cannot write to the repository it is pointed at. " +
|
|
44
|
+
"Authoring and maintenance verbs are in @sdd-method/sdd-cli.";
|
|
45
|
+
/**
|
|
46
|
+
* Refuse anything outside the surface BEFORE commander parses it. Left to
|
|
47
|
+
* commander, `sdd-verify sync --help` prints top-level usage and exits 0 — in a
|
|
48
|
+
* pipeline that is a step that runs nothing and passes, which is the failure
|
|
49
|
+
* this binary exists to prevent. So an excluded verb fails, loudly, whatever
|
|
50
|
+
* flags accompany it.
|
|
51
|
+
*/
|
|
52
|
+
export function rejectOutsideSurface(program, argv) {
|
|
53
|
+
const words = argv.filter((a) => !a.startsWith("-"));
|
|
54
|
+
if (words.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
const [verb, sub] = words;
|
|
57
|
+
if (verb === "help")
|
|
58
|
+
return;
|
|
59
|
+
const cmd = program.commands.find((c) => c.name() === verb);
|
|
60
|
+
if (!cmd)
|
|
61
|
+
throw new Error(`'${verb}' ${OUTSIDE}`);
|
|
62
|
+
const subs = cmd.commands.map((c) => c.name()).filter((n) => n !== "help");
|
|
63
|
+
if (subs.length > 0 && sub !== undefined && sub !== "help" && !subs.includes(sub)) {
|
|
64
|
+
throw new Error(`'${verb} ${sub}' ${OUTSIDE}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export async function runVerify(argv) {
|
|
68
|
+
const program = buildVerifyProgram();
|
|
69
|
+
if (argv.length === 0) {
|
|
70
|
+
program.outputHelp();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
rejectOutsideSurface(program, argv);
|
|
74
|
+
try {
|
|
75
|
+
await program.parseAsync([...argv], { from: "user" });
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
if (err instanceof CommanderError) {
|
|
79
|
+
if (err.code === "commander.help" ||
|
|
80
|
+
err.code === "commander.helpDisplayed" ||
|
|
81
|
+
err.code === "commander.version") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export function buildVerifyProgram() {
|
|
89
|
+
const program = new Command();
|
|
90
|
+
program
|
|
91
|
+
.name("sdd-verify")
|
|
92
|
+
.description("Verify an SDD repository without changing it — validate, list, and read-only catalogue and pack checks. Cannot write to the repository it is pointed at.")
|
|
93
|
+
.version(getPackageVersion(), "-v, --version")
|
|
94
|
+
.addHelpText("after", `\nSpec: ${SPEC_URL}\nAuthoring and maintenance verbs (sync, catalogue build, init, scaffold, mcp, …) are in @sdd-method/sdd-cli.`)
|
|
95
|
+
.exitOverride()
|
|
96
|
+
.configureOutput({
|
|
97
|
+
writeOut: (str) => process.stdout.write(str),
|
|
98
|
+
writeErr: (str) => process.stderr.write(str),
|
|
99
|
+
});
|
|
100
|
+
registerValidate(program);
|
|
101
|
+
registerList(program);
|
|
102
|
+
const pack = program
|
|
103
|
+
.command("pack")
|
|
104
|
+
.description("Validate adopter-shipped context-pack seeds (ADR 0151) — read-only");
|
|
105
|
+
registerPackValidate(pack);
|
|
106
|
+
const catalogue = program
|
|
107
|
+
.command("catalogue")
|
|
108
|
+
.description("Validate and query per-SDD catalogues (ADR 0134) — read-only, never rebuilds");
|
|
109
|
+
registerCatalogueValidate(catalogue);
|
|
110
|
+
registerCatalogueImpact(catalogue);
|
|
111
|
+
registerCatalogueBaselineCheck(catalogue);
|
|
112
|
+
registerCatalogueVersion(catalogue);
|
|
113
|
+
return program;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=verify-program.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sdd-method/verify-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Verify an SDD repository without changing it — validate, list, and read-only catalogue and pack checks. Ships only the code those verbs reach; it cannot write to the repository it is pointed at. Authoring and maintenance are in @sdd-method/sdd-cli.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"sdd-verify": "dist/verify-bin.js"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=20.0.0"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"commander": "^12.1.0",
|
|
15
|
+
"yaml": "^2.5.0",
|
|
16
|
+
"zod": "^4.3.6",
|
|
17
|
+
"@duckdb/node-api": "^1.5.5-r.3"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/tomfosteruk/sdd-cli.git"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"NOTICE"
|
|
31
|
+
]
|
|
32
|
+
}
|