cyber-sdd 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.
Files changed (126) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +2 -2
  3. package/.plugin/plugin.json +1 -1
  4. package/agents/sdd-spec-judge.md +3 -3
  5. package/agents/sdd-warden.md +8 -0
  6. package/dist/check-project-specs/scripts/check-project-specs.js +1 -0
  7. package/package.json +2 -2
  8. package/skills/align-spec/README.md +3 -3
  9. package/skills/align-spec/SKILL.md +1 -1
  10. package/skills/align-spec/scripts/align-spec.bundle.mjs +6753 -0
  11. package/skills/align-spec/scripts/align-spec.mjs +12 -0
  12. package/skills/architect-impl-governance/SKILL.md +3 -1
  13. package/skills/architect-spec-governance/SKILL.md +5 -1
  14. package/skills/blast-estimate/README.md +1 -1
  15. package/skills/blast-estimate/SKILL.md +1 -1
  16. package/skills/blast-estimate/scripts/blast-estimate.bundle.mjs +593 -0
  17. package/skills/blast-estimate/scripts/blast-estimate.mjs +12 -0
  18. package/skills/check-field-mandates/SKILL.md +1 -1
  19. package/skills/check-field-mandates/scripts/check-field-mandates.bundle.mjs +251 -0
  20. package/skills/check-field-mandates/scripts/check-field-mandates.mjs +12 -0
  21. package/skills/check-partition-quality/SKILL.md +1 -1
  22. package/skills/check-partition-quality/scripts/check-partition-quality.bundle.mjs +233 -0
  23. package/skills/check-partition-quality/scripts/check-partition-quality.mjs +12 -0
  24. package/skills/check-plan-safety/README.md +3 -3
  25. package/skills/check-plan-safety/SKILL.md +1 -1
  26. package/skills/check-plan-safety/scripts/check-plan-safety.bundle.mjs +107 -0
  27. package/skills/check-plan-safety/scripts/check-plan-safety.mjs +12 -0
  28. package/skills/check-plugin-manifests/SKILL.md +1 -1
  29. package/skills/check-plugin-manifests/scripts/check-plugin-manifests.bundle.mjs +248 -0
  30. package/skills/check-plugin-manifests/scripts/check-plugin-manifests.mjs +12 -0
  31. package/skills/check-project-specs/README.md +3 -3
  32. package/skills/check-project-specs/SKILL.md +2 -2
  33. package/skills/check-project-specs/scripts/check-project-specs.bundle.mjs +584 -0
  34. package/skills/check-project-specs/scripts/check-project-specs.mjs +12 -0
  35. package/skills/check-project-specs/scripts/check-project-specs.mts +1 -0
  36. package/skills/check-retired-terms/README.md +2 -2
  37. package/skills/check-retired-terms/SKILL.md +2 -2
  38. package/skills/check-retired-terms/scripts/check-retired-terms.bundle.mjs +184 -0
  39. package/skills/check-retired-terms/scripts/check-retired-terms.mjs +12 -0
  40. package/skills/check-scenario-overlap/README.md +2 -2
  41. package/skills/check-scenario-overlap/SKILL.md +1 -1
  42. package/skills/check-scenario-overlap/scripts/check-scenario-overlap.bundle.mjs +175 -0
  43. package/skills/check-scenario-overlap/scripts/check-scenario-overlap.mjs +12 -0
  44. package/skills/check-spec-references/README.md +1 -1
  45. package/skills/check-spec-references/SKILL.md +1 -1
  46. package/skills/check-spec-references/scripts/check-spec-references.bundle.mjs +285 -0
  47. package/skills/check-spec-references/scripts/check-spec-references.mjs +12 -0
  48. package/skills/check-spec-structure/README.md +2 -2
  49. package/skills/check-spec-structure/SKILL.md +1 -1
  50. package/skills/check-spec-structure/scripts/check-spec-structure.bundle.mjs +241 -0
  51. package/skills/check-spec-structure/scripts/check-spec-structure.mjs +12 -0
  52. package/skills/collision-ladder/SKILL.md +2 -2
  53. package/skills/collision-ladder/scripts/collision-ladder.bundle.mjs +7041 -0
  54. package/skills/collision-ladder/scripts/collision-ladder.mjs +12 -0
  55. package/skills/collision-ladder/scripts/collision-ladder.mts +4 -2
  56. package/skills/concept-index/README.md +2 -2
  57. package/skills/concept-index/SKILL.md +1 -1
  58. package/skills/concept-index/scripts/concept-index.bundle.mjs +181 -0
  59. package/skills/concept-index/scripts/concept-index.mjs +12 -0
  60. package/skills/discover-plans/README.md +2 -2
  61. package/skills/discover-plans/SKILL.md +1 -1
  62. package/skills/discover-plans/scripts/discover-plans.bundle.mjs +135 -0
  63. package/skills/discover-plans/scripts/discover-plans.mjs +12 -0
  64. package/skills/discover-specs/README.md +1 -1
  65. package/skills/discover-specs/SKILL.md +1 -1
  66. package/skills/discover-specs/scripts/discover-specs.bundle.mjs +319 -0
  67. package/skills/discover-specs/scripts/discover-specs.mjs +12 -0
  68. package/skills/doctrine-loop/SKILL.md +2 -2
  69. package/skills/formation-loop/SKILL.md +10 -0
  70. package/skills/gate-validation-governance/SKILL.md +1 -1
  71. package/skills/init/README.md +3 -3
  72. package/skills/init/SKILL.md +3 -3
  73. package/skills/init/scripts/wire-statusline.bundle.mjs +166 -0
  74. package/skills/init/scripts/wire-statusline.mjs +12 -0
  75. package/skills/manage-ignore/README.md +5 -5
  76. package/skills/manage-ignore/SKILL.md +1 -1
  77. package/skills/manage-ignore/scripts/manage-ignore.bundle.mjs +244 -0
  78. package/skills/manage-ignore/scripts/manage-ignore.mjs +12 -0
  79. package/skills/manage-scenario-bridge/README.md +3 -3
  80. package/skills/manage-scenario-bridge/SKILL.md +1 -1
  81. package/skills/manage-scenario-bridge/scripts/manage-scenario-bridge.bundle.mjs +237 -0
  82. package/skills/manage-scenario-bridge/scripts/manage-scenario-bridge.mjs +12 -0
  83. package/skills/manage-spec-anchors/README.md +4 -4
  84. package/skills/manage-spec-anchors/SKILL.md +1 -1
  85. package/skills/manage-spec-anchors/scripts/manage-spec-anchors.bundle.mjs +308 -0
  86. package/skills/manage-spec-anchors/scripts/manage-spec-anchors.mjs +12 -0
  87. package/skills/mission-graph/SKILL.md +9 -9
  88. package/skills/mission-graph/scripts/mission-graph.bundle.mjs +1038 -0
  89. package/skills/mission-graph/scripts/mission-graph.mjs +12 -0
  90. package/skills/pause-mission/SKILL.md +1 -1
  91. package/skills/place-node/README.md +1 -1
  92. package/skills/place-node/SKILL.md +1 -1
  93. package/skills/place-node/scripts/place-node.bundle.mjs +115 -0
  94. package/skills/place-node/scripts/place-node.mjs +12 -0
  95. package/skills/plan-retirement/SKILL.md +1 -1
  96. package/skills/plan-retirement/scripts/retire-plans.bundle.mjs +121 -0
  97. package/skills/plan-retirement/scripts/retire-plans.mjs +12 -0
  98. package/skills/plan-retirement/scripts/retire-plans.mts +6 -0
  99. package/skills/resolve-governances/README.md +1 -1
  100. package/skills/resolve-governances/SKILL.md +1 -1
  101. package/skills/resolve-governances/scripts/resolve-governances.bundle.mjs +350 -0
  102. package/skills/resolve-governances/scripts/resolve-governances.mjs +12 -0
  103. package/skills/resolve-tracking/SKILL.md +1 -1
  104. package/skills/resolve-tracking/scripts/resolve-tracking.bundle.mjs +150 -0
  105. package/skills/resolve-tracking/scripts/resolve-tracking.mjs +12 -0
  106. package/skills/scaffold-project-spec/SKILL.md +2 -2
  107. package/skills/sdd/SKILL.md +1 -1
  108. package/skills/spec-gate/SKILL.md +4 -4
  109. package/skills/spec-gate/scripts/check-spec-state.bundle.mjs +420 -0
  110. package/skills/spec-gate/scripts/check-spec-state.mjs +12 -0
  111. package/skills/spec-gate/scripts/check-suite.bundle.mjs +6498 -0
  112. package/skills/spec-gate/scripts/check-suite.mjs +12 -0
  113. package/skills/spec-gate/scripts/classify-edit-class.bundle.mjs +6577 -0
  114. package/skills/spec-gate/scripts/classify-edit-class.mjs +12 -0
  115. package/skills/spec-producer-governance/SKILL.md +2 -2
  116. package/skills/spec-structure-governance/README.md +4 -2
  117. package/skills/spec-structure-governance/SKILL.md +42 -7
  118. package/skills/start-mission/SKILL.md +1 -1
  119. package/skills/touch-set-correction/SKILL.md +1 -1
  120. package/skills/touch-set-correction/scripts/touch-set-correction.bundle.mjs +6655 -0
  121. package/skills/touch-set-correction/scripts/touch-set-correction.mjs +12 -0
  122. package/skills/touch-set-correction/scripts/touch-set-correction.mts +12 -3
  123. package/skills/verify-scenarios/README.md +3 -3
  124. package/skills/verify-scenarios/SKILL.md +2 -2
  125. package/skills/verify-scenarios/scripts/verify-scenarios.bundle.mjs +6537 -0
  126. package/skills/verify-scenarios/scripts/verify-scenarios.mjs +12 -0
@@ -0,0 +1,248 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync } from "node:fs";
3
+ import { dirname, join, relative, sep } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ //#region skills/check-plugin-manifests/scripts/check-plugin-manifests.mts
6
+ /**
7
+ * Directories that hold a manifest one level below the plugin root.
8
+ *
9
+ * This is a path-shape list, not a provenance one: `.plugin/` holds the **canonical** manifest and
10
+ * the other two hold its generated vendor copies, but all three sit one level down, so a pointer
11
+ * inside any of them resolves against the parent. Naming it for vendors would contradict the
12
+ * spec's own vocabulary and has already misled one reader.
13
+ */
14
+ const MANIFEST_DIRS = [
15
+ ".plugin",
16
+ ".claude-plugin",
17
+ ".codex-plugin"
18
+ ];
19
+ const MANIFEST_NAME = "plugin.json";
20
+ const SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git"]);
21
+ /**
22
+ * Every manifest at a conventional location under `root`, repo-relative and path-sorted.
23
+ *
24
+ * A manifest is a `plugin.json` either inside a vendor directory, or sitting beside a
25
+ * `package.json` (a package-root manifest). Sorted so a sweep's report order is deterministic.
26
+ * A symlink is included: it resolves to a real manifest, and a broken one must surface as
27
+ * unreadable rather than vanish from the sweep.
28
+ */
29
+ /** Directory entries, or none where the directory cannot be read. */
30
+ function safeReaddir(dir) {
31
+ try {
32
+ return readdirSync(dir, { withFileTypes: true });
33
+ } catch {
34
+ return [];
35
+ }
36
+ }
37
+ function discoverManifests(root) {
38
+ const found = [];
39
+ const walk = (dir) => {
40
+ for (const e of safeReaddir(dir)) {
41
+ const full = join(dir, e.name);
42
+ if (e.isDirectory()) {
43
+ if (!SKIP_DIRS.has(e.name)) walk(full);
44
+ continue;
45
+ }
46
+ if (e.name !== MANIFEST_NAME) continue;
47
+ const parent = dirname(full);
48
+ if (MANIFEST_DIRS.includes(parent.split(sep).pop() ?? "") || existsSync(join(parent, "package.json"))) found.push(full);
49
+ }
50
+ };
51
+ walk(root);
52
+ return found.map((f) => relative(root, f).split(sep).join("/")).sort();
53
+ }
54
+ /**
55
+ * The plugin root a manifest's pointers resolve against — NOT the manifest's own directory.
56
+ *
57
+ * A vendor manifest sits one level down, and its `./skills` still names the plugin's skills
58
+ * directory. A guard resolving relative to the file it just read reports every vendor manifest as
59
+ * entirely broken.
60
+ */
61
+ function pluginRootOf(manifestRelPath) {
62
+ const parts = manifestRelPath.split("/");
63
+ const parentName = parts[parts.length - 2];
64
+ const drop = parentName !== void 0 && MANIFEST_DIRS.includes(parentName) ? 2 : 1;
65
+ return parts.slice(0, parts.length - drop).join("/");
66
+ }
67
+ /** Every `./`-prefixed string value in the manifest, paired with the key it sits under. */
68
+ function extractPointers(manifest) {
69
+ const out = [];
70
+ const visit = (value, key) => {
71
+ if (typeof value === "string") {
72
+ if (value.startsWith("./")) out.push({
73
+ key,
74
+ pointer: value
75
+ });
76
+ return;
77
+ }
78
+ if (Array.isArray(value)) {
79
+ for (const item of value) visit(item, key);
80
+ return;
81
+ }
82
+ if (value !== null && typeof value === "object") for (const [k, v] of Object.entries(value)) visit(v, k);
83
+ };
84
+ visit(manifest, "");
85
+ return out;
86
+ }
87
+ /**
88
+ * The nearest `package.json` at or above the plugin root, and whether it publishes.
89
+ *
90
+ * A package publishes when it is not `private` AND declares a `files` allowlist. A `private`
91
+ * package ships no tarball, so its `files` constrains nothing. A package declaring no `files` at
92
+ * all ships everything, so there is no allowlist to be outside of — npm's own semantic, and
93
+ * inverting it manufactures a finding against every pointer in the package.
94
+ */
95
+ function owningPackage(root, pluginRoot) {
96
+ let dir = pluginRoot;
97
+ for (;;) {
98
+ const candidate = dir === "" ? "package.json" : `${dir}/package.json`;
99
+ const abs = join(root, candidate);
100
+ if (existsSync(abs)) try {
101
+ const pkg = JSON.parse(readFileSync(abs, "utf8"));
102
+ const files = Array.isArray(pkg.files) ? pkg.files.filter((f) => typeof f === "string") : null;
103
+ const packs = pkg.private !== true;
104
+ return {
105
+ path: candidate,
106
+ packs,
107
+ publishes: packs && files !== null,
108
+ files: files ?? []
109
+ };
110
+ } catch {
111
+ return {
112
+ path: candidate,
113
+ packs: false,
114
+ publishes: false,
115
+ files: []
116
+ };
117
+ }
118
+ if (dir === "") return null;
119
+ dir = dir.split("/").slice(0, -1).join("/");
120
+ }
121
+ }
122
+ /**
123
+ * Whether a `files` allowlist covers a pointer, compared on the leading path segment.
124
+ *
125
+ * Both sides are normalized past a leading `./`, because an allowlist may legitimately spell an
126
+ * entry either way and a pointer always carries the prefix — comparing them raw reports a shipped
127
+ * component as unpublished.
128
+ *
129
+ * A `!`-prefixed entry is an exclusion and needs no special case: its leading `!` is part of its
130
+ * first segment, so it can never equal a real segment and is never read as an inclusion.
131
+ */
132
+ function filesCovers(files, pointer) {
133
+ const head = (path) => path.replace(/^\.\//, "").split("/")[0];
134
+ const segment = head(pointer);
135
+ if (segment === void 0 || segment === "") return true;
136
+ return files.some((entry) => {
137
+ const h = head(entry);
138
+ return h === "*" || h === "**" || h === segment;
139
+ });
140
+ }
141
+ /** Whether a package that packs a tarball ships the package-relative path `./<rel>`. */
142
+ function ships(pkg, rel) {
143
+ return pkg?.packs === true && (!pkg.publishes || filesCovers(pkg.files, `./${rel}`));
144
+ }
145
+ /** Every symbolic link at or below `abs` — the path itself included, links never followed. */
146
+ function findSymlinks(abs) {
147
+ let stat;
148
+ try {
149
+ stat = lstatSync(abs);
150
+ } catch {
151
+ return [];
152
+ }
153
+ if (stat.isSymbolicLink()) return [abs];
154
+ if (!stat.isDirectory()) return [];
155
+ return safeReaddir(abs).filter((e) => !SKIP_DIRS.has(e.name)).flatMap((e) => findSymlinks(join(abs, e.name)));
156
+ }
157
+ function sweep(root, manifests) {
158
+ const findings = [];
159
+ const linksSeen = /* @__PURE__ */ new Set();
160
+ const reportLinks = (rel, abs, key, pointer) => {
161
+ for (const link of findSymlinks(abs)) {
162
+ const linkRel = relative(root, link).split(sep).join("/");
163
+ if (linksSeen.has(linkRel)) continue;
164
+ linksSeen.add(linkRel);
165
+ findings.push({
166
+ kind: "symlink",
167
+ manifest: rel,
168
+ ...key === void 0 ? {} : {
169
+ key,
170
+ pointer
171
+ },
172
+ detail: `${linkRel} is a symbolic link — the registry rejects a package that ships one`
173
+ });
174
+ }
175
+ };
176
+ for (const rel of manifests) {
177
+ let parsed;
178
+ try {
179
+ parsed = JSON.parse(readFileSync(join(root, rel), "utf8"));
180
+ } catch {
181
+ findings.push({
182
+ kind: "unreadable",
183
+ manifest: rel,
184
+ detail: "not readable as JSON"
185
+ });
186
+ continue;
187
+ }
188
+ const pluginRoot = pluginRootOf(rel);
189
+ const pkg = owningPackage(root, pluginRoot);
190
+ const pkgDir = pkg ? dirname(pkg.path) : "";
191
+ const fromPkg = (path) => relative(join(root, pkgDir), join(root, path)).split(sep).join("/");
192
+ if (ships(pkg, fromPkg(rel))) reportLinks(rel, join(root, rel));
193
+ for (const { key, pointer } of extractPointers(parsed)) {
194
+ const target = join(root, pluginRoot, pointer);
195
+ if (!existsSync(target)) {
196
+ findings.push({
197
+ kind: "unresolved",
198
+ manifest: rel,
199
+ key,
200
+ pointer,
201
+ detail: "names no path on disk"
202
+ });
203
+ continue;
204
+ }
205
+ if (pkg?.publishes && !filesCovers(pkg.files, pointer)) {
206
+ findings.push({
207
+ kind: "unpublished",
208
+ manifest: rel,
209
+ key,
210
+ pointer,
211
+ detail: `declared but not published — ${pkg.path} files omits it`
212
+ });
213
+ continue;
214
+ }
215
+ if (ships(pkg, fromPkg(join(pluginRoot, pointer)))) reportLinks(rel, target, key, pointer);
216
+ }
217
+ }
218
+ return findings;
219
+ }
220
+ function formatReport(manifests, findings) {
221
+ if (manifests.length === 0) return "check-plugin-manifests: no plugin manifest found\n";
222
+ if (findings.length === 0) return `check-plugin-manifests: ${manifests.length} manifest(s) OK\n`;
223
+ return `${findings.map((f) => ` ${f.kind.padEnd(11)} ${f.manifest}${f.key ? ` [${f.key}] ${f.pointer}` : ""} — ${f.detail}`).join("\n")}\ncheck-plugin-manifests: ${findings.length} finding(s) across ${manifests.length} manifest(s)\n`;
224
+ }
225
+ function main(argv) {
226
+ let root = ".";
227
+ for (let i = 0; i < argv.length; i++) {
228
+ const a = argv[i];
229
+ if (a === "--root") {
230
+ const next = argv[++i];
231
+ if (next === void 0) {
232
+ process.stderr.write("check-plugin-manifests: --root needs a directory\n");
233
+ return 1;
234
+ }
235
+ root = next;
236
+ continue;
237
+ }
238
+ process.stderr.write(`check-plugin-manifests: unrecognized flag ${a}\n`);
239
+ return 1;
240
+ }
241
+ const manifests = discoverManifests(root);
242
+ const findings = sweep(root, manifests);
243
+ process.stdout.write(formatReport(manifests, findings));
244
+ return findings.length === 0 ? 0 : 1;
245
+ }
246
+ if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) process.exit(main(process.argv.slice(2)));
247
+ //#endregion
248
+ export { discoverManifests, extractPointers, filesCovers, findSymlinks, formatReport, main, owningPackage, pluginRootOf, sweep };
@@ -0,0 +1,12 @@
1
+ // Launcher for the engine of the same name. Run it as `node <skill>/scripts/<engine>.mjs`.
2
+ // A checkout runs the .mts source. An npm install keeps the skill under node_modules, where Node
3
+ // will not strip types, so it runs the self-contained bundle built for the package.
4
+ import { spawnSync } from 'node:child_process'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const self = fileURLToPath(import.meta.url)
8
+ const installed = /[\\/]node_modules[\\/]/.test(self)
9
+ const target = self.replace(/\.mjs$/, installed ? '.bundle.mjs' : '.mts')
10
+ const run = spawnSync(process.execPath, [...process.execArgv, target, ...process.argv.slice(2)], { stdio: 'inherit' })
11
+ if (run.error) throw run.error
12
+ process.exitCode = run.status ?? 1
@@ -3,9 +3,9 @@
3
3
  Runs every project-spec check — over the whole corpus, or over one project's spec.
4
4
 
5
5
  ```bash
6
- node scripts/check-project-specs.mts --corpus # every project-spec + the coverage guard
7
- node scripts/check-project-specs.mts # one project, resolved from cwd
8
- node scripts/check-project-specs.mts --project <dir> # one project, explicit dir
6
+ node scripts/check-project-specs.mjs --corpus # every project-spec + the coverage guard
7
+ node scripts/check-project-specs.mjs # one project, resolved from cwd
8
+ node scripts/check-project-specs.mjs --project <dir> # one project, explicit dir
9
9
  ```
10
10
 
11
11
  The **corpus** scope is the repo's commit floor, wired as the root `check:specs`; it is total by
@@ -48,8 +48,8 @@ mapping and no path is ever written into a package's scripts.
48
48
  ## Run it
49
49
 
50
50
  ```bash
51
- node "<skill>/scripts/check-project-specs.mts" --corpus # the whole corpus — the commit floor
52
- node "<skill>/scripts/check-project-specs.mts" [--project <dir>] # one project-spec
51
+ node "<skill>/scripts/check-project-specs.mjs" --corpus # the whole corpus — the commit floor
52
+ node "<skill>/scripts/check-project-specs.mjs" [--project <dir>] # one project-spec
53
53
  ```
54
54
 
55
55
  The corpus scope is wired as the repo's root `check:specs`; the project scope is wired as each