sdtk-spec-kit 0.6.1 → 0.7.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/README.md +12 -3
- package/package.json +1 -1
- package/src/commands/help.js +4 -0
- package/src/commands/project-help.js +120 -0
- package/src/commands/project.js +18 -0
- package/src/lib/project-promote.js +44 -9
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
It exposes the `sdtk-spec` CLI as the primary upstream command surface.
|
|
6
6
|
|
|
7
|
-
Package version in this source snapshot: `0.
|
|
7
|
+
Package version in this source snapshot: `0.7.0`
|
|
8
8
|
Full usage guide: `products/sdtk-spec/governance/SDTK_SPEC_USAGE_GUIDE.md`
|
|
9
9
|
|
|
10
10
|
Wraps the `SDTK-SPEC` PowerShell toolkit for portable, reproducible feature documentation scaffolding.
|
|
@@ -268,8 +268,11 @@ Run premium project intelligence workflows against an existing consumer reposito
|
|
|
268
268
|
sdtk-spec project ingest # Build deterministic project foundation + staged docs baseline (Pro)
|
|
269
269
|
sdtk-spec project audit # Read-only readiness / risk / gap audit (Pro)
|
|
270
270
|
sdtk-spec project refresh # Incrementally refresh managed .sdtk/project/ artifacts (Pro)
|
|
271
|
+
sdtk-spec project promote # Publish reviewed staged docs into docs/ for sdtk-wiki (free; dry-run by default)
|
|
271
272
|
```
|
|
272
273
|
|
|
274
|
+
Every verb accepts `--help` for verb-scoped usage, e.g. `sdtk-spec project promote --help`.
|
|
275
|
+
|
|
273
276
|
Examples:
|
|
274
277
|
|
|
275
278
|
```bash
|
|
@@ -281,17 +284,23 @@ sdtk-spec project audit --project-path ./my-project --json
|
|
|
281
284
|
|
|
282
285
|
# Incrementally refresh foundation, evidence packs, and staged docs baseline
|
|
283
286
|
sdtk-spec project refresh --project-path ./my-project
|
|
287
|
+
|
|
288
|
+
# Publish the reviewed staged docs baseline into docs/ (dry-run first, then apply)
|
|
289
|
+
sdtk-spec project promote --project-path ./my-project
|
|
290
|
+
sdtk-spec project promote --project-path ./my-project --apply
|
|
284
291
|
```
|
|
285
292
|
|
|
286
293
|
Key facts:
|
|
287
294
|
|
|
288
295
|
- `project ingest`, `project audit`, and `project refresh` are Pro features.
|
|
289
296
|
- All three commands require a valid Pro entitlement (unlock with `sdtk-spec activate --license`) and a cached premium pack.
|
|
290
|
-
-
|
|
297
|
+
- `project promote` is **free**: it only copies the already-generated staged docs baseline into live `docs/`. No entitlement or premium pack is required.
|
|
298
|
+
- All Pro artifacts stay project-local under `<project>/.sdtk/project/`.
|
|
291
299
|
- `project ingest` writes reusable foundation artifacts such as census, source inventory, profile, module graph, runtime markers, evidence packs, and a staged docs baseline.
|
|
292
300
|
- `project audit` is read-only. It does not mutate live `/docs/`, write new staged docs, or refresh ingest artifacts in place.
|
|
293
301
|
- `project refresh` is incremental and requires an existing managed ingest baseline.
|
|
294
|
-
-
|
|
302
|
+
- `project promote` is a dry-run by default; it classifies existing live docs as identical (`=`) or differing (`≠`) from staged, skips differing docs unless `--force` is given, and only writes on `--apply`.
|
|
303
|
+
- None of the Pro project commands modify live `/docs/`; draft outputs remain under `.sdtk/project/`. `promote` is the one verb that writes into `docs/`, and only with `--apply`.
|
|
295
304
|
- Maintainer-root guardrails block using the SDTK maintainer monorepo root as a premium project target.
|
|
296
305
|
|
|
297
306
|
### `sdtk-spec runtime`
|
package/package.json
CHANGED
package/src/commands/help.js
CHANGED
|
@@ -284,6 +284,10 @@ function cmdHelp() {
|
|
|
284
284
|
" sdtk-spec project audit --project-path ./my-project --json",
|
|
285
285
|
" sdtk-spec project refresh --project-path ./my-project",
|
|
286
286
|
" sdtk-spec project refresh --project-path ./my-project --json",
|
|
287
|
+
" sdtk-spec project promote --project-path ./my-project",
|
|
288
|
+
" sdtk-spec project promote --project-path ./my-project --apply",
|
|
289
|
+
" sdtk-spec project promote --project-path ./my-project --apply --force",
|
|
290
|
+
" sdtk-spec project promote --project-path ./my-project --json",
|
|
287
291
|
"",
|
|
288
292
|
" # Override entitlement repo (bash/zsh):",
|
|
289
293
|
" export SDTK_ENTITLEMENT_REPO=owner/repo",
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// BK-338: per-verb help for `sdtk-spec project <verb> --help`.
|
|
4
|
+
//
|
|
5
|
+
// Before this, every project verb rejected `--help` ("Unknown flag") because
|
|
6
|
+
// the flag was not in its FLAG_DEFS. Help is centralized (not command-local
|
|
7
|
+
// like sdtk-wiki), so this module renders one help block per verb. The flag
|
|
8
|
+
// lists here MUST match each verb's *_FLAG_DEFS; the parity test
|
|
9
|
+
// (test_sdtk_spec_project_help_parity.py) fails the build if they drift.
|
|
10
|
+
|
|
11
|
+
const PROJECT_VERB_HELP = {
|
|
12
|
+
ingest: {
|
|
13
|
+
summary: "Build reusable project census and profile foundation from an existing repo (Pro).",
|
|
14
|
+
usage: "sdtk-spec project ingest [options]",
|
|
15
|
+
tier: "Pro",
|
|
16
|
+
flags: [
|
|
17
|
+
["--project-path <path>", "Target project directory to ingest (default: cwd)"],
|
|
18
|
+
["--output-dir <path>", "Foundation output directory (default: <project>/.sdtk/project)"],
|
|
19
|
+
["--json", "Print result summary as JSON"],
|
|
20
|
+
],
|
|
21
|
+
notes: [
|
|
22
|
+
"Requires a valid Pro entitlement and a cached premium pack.",
|
|
23
|
+
"Stages a draft SDTK docs baseline under .sdtk/project/DOC_SYNTHESIS_BASELINE/.",
|
|
24
|
+
"Live project /docs/ is not modified by project ingest.",
|
|
25
|
+
"Maintainer-root guard: refuses the SDTK maintainer monorepo root as an ingest target.",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
audit: {
|
|
29
|
+
summary: "Read-only audit: readiness score, gap list, risk list, next steps (Pro).",
|
|
30
|
+
usage: "sdtk-spec project audit [options]",
|
|
31
|
+
tier: "Pro",
|
|
32
|
+
flags: [
|
|
33
|
+
["--project-path <path>", "Target project directory to audit (default: cwd)"],
|
|
34
|
+
["--output-dir <path>", "Foundation read path (default: <project>/.sdtk/project)"],
|
|
35
|
+
["--json", "Print audit result as deterministic JSON"],
|
|
36
|
+
],
|
|
37
|
+
notes: [
|
|
38
|
+
"Requires a valid Pro entitlement and a cached premium pack.",
|
|
39
|
+
"Read-only: does not modify live /docs/ or write new staged/foundation artifacts.",
|
|
40
|
+
"Uses cached ingest artifacts when present; otherwise bounded ephemeral analysis.",
|
|
41
|
+
"Maintainer-root guard: refuses the SDTK maintainer monorepo root as an audit target.",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
refresh: {
|
|
45
|
+
summary: "Incremental managed refresh of .sdtk/project/ artifacts (Pro).",
|
|
46
|
+
usage: "sdtk-spec project refresh [options]",
|
|
47
|
+
tier: "Pro",
|
|
48
|
+
flags: [
|
|
49
|
+
["--project-path <path>", "Target project directory to refresh (default: cwd)"],
|
|
50
|
+
["--output-dir <path>", "Foundation output directory (default: <project>/.sdtk/project)"],
|
|
51
|
+
["--json", "Print result summary as JSON"],
|
|
52
|
+
],
|
|
53
|
+
notes: [
|
|
54
|
+
"Requires a valid Pro entitlement and a cached premium pack.",
|
|
55
|
+
"Incremental: requires an existing managed ingest baseline (run 'project ingest' first).",
|
|
56
|
+
"Updates only .sdtk/project/ artifacts; does not modify live /docs/.",
|
|
57
|
+
"Maintainer-root guard: refuses the SDTK maintainer monorepo root as a refresh target.",
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
promote: {
|
|
61
|
+
summary: "Publish reviewed staged docs into /docs/ for sdtk-wiki (free; dry-run by default).",
|
|
62
|
+
usage: "sdtk-spec project promote [options]",
|
|
63
|
+
tier: "free",
|
|
64
|
+
flags: [
|
|
65
|
+
["--project-path <path>", "Target project directory (default: cwd)"],
|
|
66
|
+
["--output-dir <path>", "Foundation read path (default: <project>/.sdtk/project)"],
|
|
67
|
+
["--apply", "Perform the copy (default is a dry-run plan only)"],
|
|
68
|
+
["--force", "Overwrite existing live docs (default: skip existing)"],
|
|
69
|
+
["--json", "Print the promote plan/result as JSON"],
|
|
70
|
+
],
|
|
71
|
+
notes: [
|
|
72
|
+
"Free: publishes staged docs from .sdtk/project/DOC_SYNTHESIS_BASELINE/docs/ into <project>/docs/.",
|
|
73
|
+
"Default is a dry-run that prints the plan and writes nothing; add --apply to publish.",
|
|
74
|
+
"Existing live docs are classified as identical (=) or differing (≠) from staged;",
|
|
75
|
+
" differing docs are skipped unless --force is given (human-review-first).",
|
|
76
|
+
"After promote, run 'sdtk-wiki atlas build' to index the docs into the knowledge graph.",
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
function renderProjectVerbHelp(verb) {
|
|
82
|
+
const h = PROJECT_VERB_HELP[verb];
|
|
83
|
+
if (!h) return null;
|
|
84
|
+
const lines = [
|
|
85
|
+
`sdtk-spec project ${verb} — ${h.summary}`,
|
|
86
|
+
"",
|
|
87
|
+
"Usage:",
|
|
88
|
+
` ${h.usage}`,
|
|
89
|
+
"",
|
|
90
|
+
`Options (${h.tier}):`,
|
|
91
|
+
];
|
|
92
|
+
for (const [flag, desc] of h.flags) {
|
|
93
|
+
lines.push(` ${flag.padEnd(26)} ${desc}`);
|
|
94
|
+
}
|
|
95
|
+
lines.push("", "Notes:");
|
|
96
|
+
for (const note of h.notes) lines.push(` - ${note}`);
|
|
97
|
+
return lines.join("\n");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function renderProjectOverview() {
|
|
101
|
+
const lines = [
|
|
102
|
+
"sdtk-spec project — existing-project intelligence subcommands",
|
|
103
|
+
"",
|
|
104
|
+
"Usage:",
|
|
105
|
+
" sdtk-spec project <subcommand> [options]",
|
|
106
|
+
" sdtk-spec project <subcommand> --help Show verb-specific help",
|
|
107
|
+
"",
|
|
108
|
+
"Subcommands:",
|
|
109
|
+
];
|
|
110
|
+
for (const [verb, h] of Object.entries(PROJECT_VERB_HELP)) {
|
|
111
|
+
lines.push(` ${verb.padEnd(9)} ${h.summary}`);
|
|
112
|
+
}
|
|
113
|
+
return lines.join("\n");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module.exports = {
|
|
117
|
+
PROJECT_VERB_HELP,
|
|
118
|
+
renderProjectVerbHelp,
|
|
119
|
+
renderProjectOverview,
|
|
120
|
+
};
|
package/src/commands/project.js
CHANGED
|
@@ -4,10 +4,15 @@ const { runProjectIngest } = require("../lib/project-ingest");
|
|
|
4
4
|
const { runProjectAudit } = require("../lib/project-audit");
|
|
5
5
|
const { runProjectRefresh } = require("../lib/project-refresh");
|
|
6
6
|
const { runProjectPromote } = require("../lib/project-promote");
|
|
7
|
+
const { renderProjectVerbHelp, renderProjectOverview } = require("./project-help");
|
|
7
8
|
const { ValidationError } = require("../lib/errors");
|
|
8
9
|
|
|
9
10
|
const PROJECT_SUBCOMMANDS = new Set(["ingest", "audit", "refresh", "promote"]);
|
|
10
11
|
|
|
12
|
+
function wantsHelp(args) {
|
|
13
|
+
return args.some((a) => a === "-h" || a === "--help");
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
* Top-level dispatcher for `sdtk-spec project <subcommand>`.
|
|
13
18
|
*
|
|
@@ -34,12 +39,25 @@ async function cmdProject(args) {
|
|
|
34
39
|
|
|
35
40
|
const [subcommand, ...rest] = args;
|
|
36
41
|
|
|
42
|
+
// BK-338: `sdtk-spec project --help` / `-h` prints the verb overview (exit 0).
|
|
43
|
+
if (subcommand === "-h" || subcommand === "--help") {
|
|
44
|
+
console.log(renderProjectOverview());
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
37
48
|
if (!PROJECT_SUBCOMMANDS.has(subcommand)) {
|
|
38
49
|
throw new ValidationError(
|
|
39
50
|
`Unknown project subcommand: "${subcommand}". Valid subcommands: ingest, audit, refresh, promote.`
|
|
40
51
|
);
|
|
41
52
|
}
|
|
42
53
|
|
|
54
|
+
// BK-338: `sdtk-spec project <verb> --help` prints verb-scoped help (exit 0),
|
|
55
|
+
// never touching entitlement or the filesystem.
|
|
56
|
+
if (wantsHelp(rest)) {
|
|
57
|
+
console.log(renderProjectVerbHelp(subcommand));
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
switch (subcommand) {
|
|
44
62
|
case "ingest":
|
|
45
63
|
return runProjectIngest(rest);
|
|
@@ -37,6 +37,17 @@ function listFilesRel(root) {
|
|
|
37
37
|
return out;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Byte-exact comparison of two files. Returns false if either is unreadable.
|
|
42
|
+
*/
|
|
43
|
+
function filesIdentical(a, b) {
|
|
44
|
+
try {
|
|
45
|
+
return fs.readFileSync(a).equals(fs.readFileSync(b));
|
|
46
|
+
} catch (_e) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
40
51
|
/**
|
|
41
52
|
* Promote reviewed staged docs (.sdtk/project/DOC_SYNTHESIS_BASELINE/docs/**)
|
|
42
53
|
* into the live <project>/docs/** tree so sdtk-wiki can index them.
|
|
@@ -72,11 +83,25 @@ async function runProjectPromote(args) {
|
|
|
72
83
|
const liveDocsRoot = path.join(config.projectPath, "docs");
|
|
73
84
|
const relFiles = listFilesRel(stagedDocsRoot);
|
|
74
85
|
|
|
75
|
-
|
|
86
|
+
// BK-337: classify each existing live doc as identical or differing from the
|
|
87
|
+
// staged version, so a returning user is not silently left with stale docs.
|
|
88
|
+
// `skipExisting` is retained (= identical ∪ differs) for backward compatibility.
|
|
89
|
+
const plan = {
|
|
90
|
+
create: [],
|
|
91
|
+
overwrite: [],
|
|
92
|
+
skipExisting: [],
|
|
93
|
+
identical: [],
|
|
94
|
+
differs: [],
|
|
95
|
+
};
|
|
76
96
|
for (const rel of relFiles) {
|
|
77
97
|
const target = path.join(liveDocsRoot, rel);
|
|
78
|
-
if (!fs.existsSync(target))
|
|
79
|
-
|
|
98
|
+
if (!fs.existsSync(target)) {
|
|
99
|
+
plan.create.push(rel);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const same = filesIdentical(path.join(stagedDocsRoot, rel), target);
|
|
103
|
+
(same ? plan.identical : plan.differs).push(rel);
|
|
104
|
+
if (flags.force) plan.overwrite.push(rel);
|
|
80
105
|
else plan.skipExisting.push(rel);
|
|
81
106
|
}
|
|
82
107
|
|
|
@@ -113,13 +138,23 @@ async function runProjectPromote(args) {
|
|
|
113
138
|
console.log("");
|
|
114
139
|
console.log(` New files: ${plan.create.length}`);
|
|
115
140
|
plan.create.forEach((r) => console.log(` + docs/${r}`));
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
141
|
+
if (!flags.force) {
|
|
142
|
+
if (plan.identical.length) {
|
|
143
|
+
console.log(` Unchanged (identical, skipped): ${plan.identical.length}`);
|
|
144
|
+
plan.identical.forEach((r) => console.log(` = docs/${r}`));
|
|
145
|
+
}
|
|
146
|
+
if (plan.differs.length) {
|
|
147
|
+
console.log(
|
|
148
|
+
` Differs from staged (skipped — use --force to update): ${plan.differs.length}`
|
|
149
|
+
);
|
|
150
|
+
plan.differs.forEach((r) => console.log(` ≠ docs/${r}`));
|
|
151
|
+
}
|
|
152
|
+
} else if (plan.overwrite.length) {
|
|
121
153
|
console.log(` Will overwrite: ${plan.overwrite.length}`);
|
|
122
|
-
plan.overwrite.forEach((r) =>
|
|
154
|
+
plan.overwrite.forEach((r) => {
|
|
155
|
+
const state = plan.differs.includes(r) ? "differs" : "identical";
|
|
156
|
+
console.log(` ~ docs/${r} (${state})`);
|
|
157
|
+
});
|
|
123
158
|
}
|
|
124
159
|
console.log("");
|
|
125
160
|
|