specdx 0.4.0-alpha.20 → 0.4.0-alpha.22

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 (80) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +24 -6
  3. package/dist/{check-GGQB3SHI.js → check-PHXXA7VY.js} +64 -27
  4. package/dist/check-PHXXA7VY.js.map +1 -0
  5. package/dist/{chunk-ZB5R5SK5.js → chunk-3YXRWQGX.js} +11 -6
  6. package/dist/chunk-3YXRWQGX.js.map +1 -0
  7. package/dist/{chunk-FBMYBYFB.js → chunk-AQZQIURH.js} +18 -15
  8. package/dist/chunk-AQZQIURH.js.map +1 -0
  9. package/dist/chunk-DMGABJ6T.js +41 -0
  10. package/dist/chunk-DMGABJ6T.js.map +1 -0
  11. package/dist/{chunk-ZIPGRLYE.js → chunk-HCJDCS26.js} +2 -2
  12. package/dist/chunk-HCJDCS26.js.map +1 -0
  13. package/dist/{chunk-CI7KYTC7.js → chunk-KVLFW5MI.js} +2 -2
  14. package/dist/{chunk-CI7KYTC7.js.map → chunk-KVLFW5MI.js.map} +1 -1
  15. package/dist/{chunk-RY5CDUNN.js → chunk-NAWYG4VV.js} +2 -2
  16. package/dist/chunk-NAWYG4VV.js.map +1 -0
  17. package/dist/chunk-NHD44ZYN.js +20 -0
  18. package/dist/chunk-NHD44ZYN.js.map +1 -0
  19. package/dist/{chunk-MM325DR6.js → chunk-SNQNQ2MP.js} +3 -3
  20. package/dist/chunk-SNQNQ2MP.js.map +1 -0
  21. package/dist/{chunk-UZKOJL2N.js → chunk-UFTEMDPU.js} +31 -9
  22. package/dist/chunk-UFTEMDPU.js.map +1 -0
  23. package/dist/{chunk-T232GZ2L.js → chunk-YRQPY5NF.js} +2 -2
  24. package/dist/{diff-PHEX3HUT.js → diff-6C5LJ7SH.js} +25 -13
  25. package/dist/diff-6C5LJ7SH.js.map +1 -0
  26. package/dist/{dist-RT3MTIUW.js → dist-ROHCFKYT.js} +2 -2
  27. package/dist/{dist-DQ6NNKZO.js → dist-SOZ3I4RP.js} +7 -7
  28. package/dist/{generate-5VO6M4PB.js → generate-AVXZHH76.js} +5 -5
  29. package/dist/{generate-story-CJMV2F5K.js → generate-story-3O4T4CEV.js} +4 -4
  30. package/dist/{generate-test-plan-XBAFJKJI.js → generate-test-plan-Z46W3N3B.js} +3 -3
  31. package/dist/{graph-UZJMLX4J.js → graph-4RNURBNP.js} +47 -10
  32. package/dist/graph-4RNURBNP.js.map +1 -0
  33. package/dist/index.d.ts +111 -7
  34. package/dist/index.js +234 -54
  35. package/dist/index.js.map +1 -1
  36. package/dist/{lint-TVL2ILOQ.js → lint-PKWAK4CO.js} +33 -12
  37. package/dist/lint-PKWAK4CO.js.map +1 -0
  38. package/dist/main.js +3 -3
  39. package/dist/{mcp-F7LJBZ4X.js → mcp-VMHFWM3O.js} +3 -3
  40. package/dist/{migrate-DEFCNOAH.js → migrate-FKFC7UAO.js} +3 -3
  41. package/dist/{pack-PNLD5AYW.js → pack-DE4UBTCC.js} +12 -8
  42. package/dist/pack-DE4UBTCC.js.map +1 -0
  43. package/dist/{ready-2PHBPWJD.js → ready-IKVESKEB.js} +19 -10
  44. package/dist/ready-IKVESKEB.js.map +1 -0
  45. package/dist/skills/core/specdx-sprint-review/SKILL.md +1 -1
  46. package/dist/{skills-LHFTTEJ7.js → skills-36SRUEMR.js} +1 -1
  47. package/dist/skills-36SRUEMR.js.map +1 -0
  48. package/dist/{status-UKLQV4AI.js → status-NWMX2KJZ.js} +40 -27
  49. package/dist/status-NWMX2KJZ.js.map +1 -0
  50. package/dist/{update-KLDLDQZM.js → update-UFOHZEAK.js} +20 -11
  51. package/dist/update-UFOHZEAK.js.map +1 -0
  52. package/dist/{validate-FXD5WS4C.js → validate-EZHUB5TW.js} +34 -16
  53. package/dist/validate-EZHUB5TW.js.map +1 -0
  54. package/package.json +9 -9
  55. package/dist/check-GGQB3SHI.js.map +0 -1
  56. package/dist/chunk-FBMYBYFB.js.map +0 -1
  57. package/dist/chunk-GAM4MXPC.js +0 -15
  58. package/dist/chunk-GAM4MXPC.js.map +0 -1
  59. package/dist/chunk-MM325DR6.js.map +0 -1
  60. package/dist/chunk-RY5CDUNN.js.map +0 -1
  61. package/dist/chunk-UZKOJL2N.js.map +0 -1
  62. package/dist/chunk-ZB5R5SK5.js.map +0 -1
  63. package/dist/chunk-ZIPGRLYE.js.map +0 -1
  64. package/dist/diff-PHEX3HUT.js.map +0 -1
  65. package/dist/graph-UZJMLX4J.js.map +0 -1
  66. package/dist/lint-TVL2ILOQ.js.map +0 -1
  67. package/dist/pack-PNLD5AYW.js.map +0 -1
  68. package/dist/ready-2PHBPWJD.js.map +0 -1
  69. package/dist/skills-LHFTTEJ7.js.map +0 -1
  70. package/dist/status-UKLQV4AI.js.map +0 -1
  71. package/dist/update-KLDLDQZM.js.map +0 -1
  72. package/dist/validate-FXD5WS4C.js.map +0 -1
  73. /package/dist/{chunk-T232GZ2L.js.map → chunk-YRQPY5NF.js.map} +0 -0
  74. /package/dist/{dist-RT3MTIUW.js.map → dist-ROHCFKYT.js.map} +0 -0
  75. /package/dist/{dist-DQ6NNKZO.js.map → dist-SOZ3I4RP.js.map} +0 -0
  76. /package/dist/{generate-5VO6M4PB.js.map → generate-AVXZHH76.js.map} +0 -0
  77. /package/dist/{generate-story-CJMV2F5K.js.map → generate-story-3O4T4CEV.js.map} +0 -0
  78. /package/dist/{generate-test-plan-XBAFJKJI.js.map → generate-test-plan-Z46W3N3B.js.map} +0 -0
  79. /package/dist/{mcp-F7LJBZ4X.js.map → mcp-VMHFWM3O.js.map} +0 -0
  80. /package/dist/{migrate-DEFCNOAH.js.map → migrate-FKFC7UAO.js.map} +0 -0
@@ -1,6 +1,10 @@
1
1
  import {
2
+ createOutput
3
+ } from "./chunk-NHD44ZYN.js";
4
+ import {
5
+ resolveFormat,
2
6
  sharedArgs
3
- } from "./chunk-GAM4MXPC.js";
7
+ } from "./chunk-DMGABJ6T.js";
4
8
  import {
5
9
  GraphError,
6
10
  buildGraph,
@@ -9,16 +13,25 @@ import {
9
13
  loadConfig,
10
14
  parseSpec,
11
15
  resolveGlob
12
- } from "./chunk-MM325DR6.js";
13
- import "./chunk-ZIPGRLYE.js";
16
+ } from "./chunk-SNQNQ2MP.js";
17
+ import "./chunk-HCJDCS26.js";
14
18
  import "./chunk-5WRI5ZAA.js";
15
19
 
16
20
  // src/commands/core/graph.ts
17
21
  import { defineCommand } from "citty";
22
+ var FORMATS = ["pretty", "json", "dot"];
18
23
  var graph_default = defineCommand({
19
24
  meta: { name: "graph", description: "Print the spec dependency graph" },
20
- args: { ...sharedArgs },
25
+ args: { ...sharedArgs(FORMATS) },
21
26
  async run({ args }) {
27
+ const format = resolveFormat(args.format, FORMATS);
28
+ if (!format.ok) {
29
+ console.error(`
30
+ \u2717 ${format.message}
31
+ `);
32
+ process.exit(1);
33
+ }
34
+ const output = createOutput({ quiet: args.quiet });
22
35
  let config;
23
36
  const configDir = process.cwd();
24
37
  try {
@@ -46,7 +59,31 @@ var graph_default = defineCommand({
46
59
  }
47
60
  const referenceEdges = collectReferenceEdges(specs);
48
61
  const unreflected = findUnreflectedReferences(referenceEdges, idToEntry, graph);
49
- if (args.format === "dot") {
62
+ if (format.format === "json") {
63
+ console.log(
64
+ JSON.stringify(
65
+ {
66
+ nodes: sorted,
67
+ edges: graph.edges,
68
+ referenceEdges,
69
+ unreflectedReferences: unreflected.map(
70
+ ({ edge, requiringEntry, requiredEntry, createsCycle }) => ({
71
+ from: edge.fromId,
72
+ to: edge.toId,
73
+ relationship: edge.relationship,
74
+ requiringEntry,
75
+ requiredEntry,
76
+ createsCycle
77
+ })
78
+ )
79
+ },
80
+ null,
81
+ 2
82
+ )
83
+ );
84
+ return;
85
+ }
86
+ if (format.format === "dot") {
50
87
  console.log("digraph specs {");
51
88
  for (const edge of graph.edges) console.log(` "${edge.from}" -> "${edge.to}";`);
52
89
  for (const ref of referenceEdges) {
@@ -57,16 +94,16 @@ var graph_default = defineCommand({
57
94
  console.log("}");
58
95
  return;
59
96
  }
60
- console.log("\n Spec Dependency Graph:\n");
97
+ output.info("\n Spec Dependency Graph:\n");
61
98
  for (const node of sorted) {
62
99
  const downstream = graph.getDownstream(node);
63
100
  const arrow = downstream.length > 0 ? ` \u2192 ${downstream.join(", ")}` : "";
64
- console.log(` ${node}${arrow}`);
101
+ output.out(` ${node}${arrow}`);
65
102
  }
66
103
  if (referenceEdges.length > 0) {
67
- console.log("\n Reference edges (frontmatter):\n");
104
+ output.info("\n Reference edges (frontmatter):\n");
68
105
  for (const ref of referenceEdges) {
69
- console.log(` ${ref.fromId} \u2014${ref.relationship}\u2192 ${ref.toId}`);
106
+ output.out(` ${ref.fromId} \u2014${ref.relationship}\u2192 ${ref.toId}`);
70
107
  }
71
108
  }
72
109
  const suggestions = unreflected.filter((u) => !u.createsCycle);
@@ -100,4 +137,4 @@ var graph_default = defineCommand({
100
137
  export {
101
138
  graph_default as default
102
139
  };
103
- //# sourceMappingURL=graph-UZJMLX4J.js.map
140
+ //# sourceMappingURL=graph-4RNURBNP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/core/graph.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport {\n loadConfig,\n buildGraph,\n GraphError,\n parseSpec,\n resolveGlob,\n collectReferenceEdges,\n findUnreflectedReferences,\n} from \"@specdx/core\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { sharedArgs, resolveFormat } from \"../../shared-args.js\";\nimport { createOutput } from \"../../output.js\";\n\nconst FORMATS = [\"pretty\", \"json\", \"dot\"] as const;\n\nexport default defineCommand({\n meta: { name: \"graph\", description: \"Print the spec dependency graph\" },\n args: { ...sharedArgs(FORMATS) },\n async run({ args }) {\n const format = resolveFormat(args.format, FORMATS);\n if (!format.ok) {\n console.error(`\\n ✗ ${format.message}\\n`);\n process.exit(1);\n }\n const output = createOutput({ quiet: args.quiet });\n\n let config;\n const configDir = process.cwd();\n try {\n config = await loadConfig(undefined, configDir);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n try {\n const graph = buildGraph(config);\n const sorted = graph.topologicalSort();\n\n // Frontmatter references are a second, richer source of relationships;\n // surface them alongside config requires instead of silently ignoring\n // them (issue #8).\n const idToEntry = new Map<string, string>();\n const specs: ParsedSpec[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n specs.push(spec);\n if (typeof spec.frontmatter.id === \"string\") {\n idToEntry.set(spec.frontmatter.id, key);\n }\n }\n }\n const referenceEdges = collectReferenceEdges(specs);\n const unreflected = findUnreflectedReferences(referenceEdges, idToEntry, graph);\n\n if (format.format === \"json\") {\n console.log(\n JSON.stringify(\n {\n nodes: sorted,\n edges: graph.edges,\n referenceEdges,\n unreflectedReferences: unreflected.map(\n ({ edge, requiringEntry, requiredEntry, createsCycle }) => ({\n from: edge.fromId,\n to: edge.toId,\n relationship: edge.relationship,\n requiringEntry,\n requiredEntry,\n createsCycle,\n }),\n ),\n },\n null,\n 2,\n ),\n );\n return;\n }\n\n if (format.format === \"dot\") {\n console.log(\"digraph specs {\");\n for (const edge of graph.edges) console.log(` \"${edge.from}\" -> \"${edge.to}\";`);\n for (const ref of referenceEdges) {\n console.log(\n ` \"${ref.fromId}\" -> \"${ref.toId}\" [style=dashed, label=\"${ref.relationship}\"];`,\n );\n }\n console.log(\"}\");\n return;\n }\n\n output.info(\"\\n Spec Dependency Graph:\\n\");\n for (const node of sorted) {\n const downstream = graph.getDownstream(node);\n const arrow = downstream.length > 0 ? ` → ${downstream.join(\", \")}` : \"\";\n output.out(` ${node}${arrow}`);\n }\n\n if (referenceEdges.length > 0) {\n output.info(\"\\n Reference edges (frontmatter):\\n\");\n for (const ref of referenceEdges) {\n output.out(` ${ref.fromId} —${ref.relationship}→ ${ref.toId}`);\n }\n }\n\n const suggestions = unreflected.filter((u) => !u.createsCycle);\n const conflicts = unreflected.filter((u) => u.createsCycle);\n\n if (suggestions.length > 0) {\n console.log(\"\\n ⚠ References not reflected in config requires:\\n\");\n for (const { edge, requiringEntry, requiredEntry } of suggestions) {\n console.log(\n ` ${edge.fromId} ${edge.relationship} ${edge.toId} — add \"requires: [${requiredEntry}]\" to the \"${requiringEntry}\" entry in spec.config.yaml`,\n );\n }\n }\n\n if (conflicts.length > 0) {\n console.log(\"\\n ⚠ References that conflict with the requires chain:\\n\");\n for (const { edge, requiringEntry, requiredEntry } of conflicts) {\n console.log(\n ` ${edge.fromId} ${edge.relationship} ${edge.toId} — implies \"${requiringEntry}\" requires \"${requiredEntry}\", but that would create a cycle; review the reference or the config requires`,\n );\n }\n }\n\n console.log(\"\");\n } catch (err) {\n if (err instanceof GraphError) {\n console.error(` ✗ ${err.message}`);\n process.exit(1);\n }\n throw err;\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAc9B,IAAM,UAAU,CAAC,UAAU,QAAQ,KAAK;AAExC,IAAO,gBAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,SAAS,aAAa,kCAAkC;AAAA,EACtE,MAAM,EAAE,GAAG,WAAW,OAAO,EAAE;AAAA,EAC/B,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,UAAM,SAAS,cAAc,KAAK,QAAQ,OAAO;AACjD,QAAI,CAAC,OAAO,IAAI;AACd,cAAQ,MAAM;AAAA,WAAS,OAAO,OAAO;AAAA,CAAI;AACzC,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,UAAM,SAAS,aAAa,EAAE,OAAO,KAAK,MAAM,CAAC;AAEjD,QAAI;AACJ,UAAM,YAAY,QAAQ,IAAI;AAC9B,QAAI;AACF,eAAS,MAAM,WAAW,QAAW,SAAS;AAAA,IAChD,SAAS,KAAK;AACZ,cAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,cAAQ,KAAK,CAAC;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K,CAAC;AAAA,MAChB;AACA,YAAM;AAAA,IACR;AAAA,EACF;AACF,CAAC;","names":[]}
package/dist/index.d.ts CHANGED
@@ -6,6 +6,60 @@ interface ScaffoldOptions {
6
6
  }
7
7
  declare function scaffoldProject({ projectName, template, targetDir, }: ScaffoldOptions): Promise<void>;
8
8
 
9
+ declare const SPEC_TYPES: readonly ["prd", "technical-design", "user-story", "test-plan", "adr", "api-contract", "epic", "quick-spec", "project-context"];
10
+ type SpecType = (typeof SPEC_TYPES)[number];
11
+ interface SpecEntry {
12
+ path: string;
13
+ type: SpecType;
14
+ required?: boolean;
15
+ requires?: string[];
16
+ owner?: string;
17
+ }
18
+ interface PackCompressionConfig {
19
+ strip_boilerplate?: boolean;
20
+ stable_days?: number;
21
+ collapse_resolved_adrs?: boolean;
22
+ }
23
+ interface PackConfig {
24
+ max_tokens?: number;
25
+ format?: "xml" | "markdown" | "json";
26
+ compression?: PackCompressionConfig;
27
+ boilerplate_sections?: string[];
28
+ }
29
+ interface SdxConfig {
30
+ version: string;
31
+ project?: {
32
+ name?: string;
33
+ description?: string;
34
+ };
35
+ specs: Record<string, SpecEntry>;
36
+ lint?: {
37
+ extends?: string;
38
+ rules?: Record<string, unknown>;
39
+ ignore?: string[];
40
+ };
41
+ pack?: PackConfig;
42
+ diff?: {
43
+ baseline_ref?: string;
44
+ staleness_threshold_days?: number;
45
+ ignore_paths?: string[];
46
+ };
47
+ ci?: {
48
+ block_on?: ("error" | "warn" | "info")[];
49
+ post_comment?: boolean;
50
+ update_badge?: boolean;
51
+ trigger_paths?: string[];
52
+ };
53
+ check?: {
54
+ framework?: "auto" | "express" | "hono" | "nextjs";
55
+ routes_dir?: string;
56
+ app_dir?: string;
57
+ types_dir?: string;
58
+ tests_dir?: string;
59
+ ignore?: string[];
60
+ };
61
+ }
62
+
9
63
  type Severity = "error" | "warn" | "info";
10
64
  interface Diagnostic {
11
65
  ruleId: string;
@@ -28,13 +82,28 @@ interface RunLintOptions {
28
82
  }
29
83
  /** Lint results plus whether anything was actually linted (vacuous-pass audit). */
30
84
  interface RunLintResults extends LintResults {
31
- /** Number of specs linted. */
32
- specCount: number;
85
+ /** Number of spec files linted. Named for what it counts, not "count". */
86
+ specFiles: number;
33
87
  /** False when no specs resolved — "no diagnostics" is then not a pass. */
34
88
  assessed: boolean;
35
89
  }
36
90
  declare function runLint(options: RunLintOptions): Promise<RunLintResults>;
37
91
 
92
+ /** Options for the pack command. */
93
+ interface PackOptions {
94
+ /** Specific task or context to optimise relevance for. */
95
+ task?: string;
96
+ /** Glob patterns or spec IDs to include. */
97
+ specs?: string[];
98
+ /** Maximum token budget for the output. */
99
+ budget?: number;
100
+ /** Output format (e.g. "xml", "json", "markdown"). */
101
+ format?: string;
102
+ /** Include all specs without budget trimming. */
103
+ full?: boolean;
104
+ /** Preview what would be packed without writing output. */
105
+ dryRun?: boolean;
106
+ }
38
107
  /** Statistics about how the budget was allocated. */
39
108
  interface PackStats {
40
109
  /** Total token budget. */
@@ -137,7 +206,12 @@ interface DiffResult {
137
206
  }
138
207
  interface StatusResult {
139
208
  project: string;
140
- specCount: number;
209
+ /**
210
+ * Spec *files* resolved, not config entries — one glob entry can resolve to
211
+ * many files. The old name `specCount` did not say which, and meant the
212
+ * other thing in `runValidate` (audit run 5, F4).
213
+ */
214
+ specFiles: number;
141
215
  byStatus: Record<string, number>;
142
216
  lintHealth: {
143
217
  errors: number;
@@ -161,11 +235,41 @@ interface RunDiffOptions {
161
235
  format?: string;
162
236
  /** Compare the base ref against the working tree instead of a head ref. */
163
237
  working?: boolean;
238
+ /**
239
+ * Directory holding spec.config.yaml. Defaults to the process cwd; a library
240
+ * consumer needs to point it elsewhere (audit run 5, F8).
241
+ */
242
+ configDir?: string;
164
243
  }
165
244
  declare function runDiff(options: RunDiffOptions): Promise<DiffResult>;
166
245
 
167
- declare function runStatus(_options?: {
168
- format?: string;
169
- }): Promise<StatusResult>;
246
+ interface RunStatusOptions {
247
+ /**
248
+ * Directory holding spec.config.yaml. Defaults to the process cwd, which is
249
+ * right for the CLI and useless to a library consumer — `runLint` and
250
+ * `runPack` take one, so this does too (audit run 5, F8).
251
+ */
252
+ configDir?: string;
253
+ }
254
+ declare function runStatus(options?: RunStatusOptions): Promise<StatusResult>;
255
+
256
+ interface ValidateResult {
257
+ valid: boolean;
258
+ /** Number of spec entries declared in the config. */
259
+ specEntries?: number;
260
+ /** Number of spec files those entries actually resolve to. */
261
+ specFiles?: number;
262
+ /** Non-fatal honesty notes: entries resolving to nothing, empty suite. */
263
+ warnings: string[];
264
+ error?: string;
265
+ details?: unknown[];
266
+ }
267
+ /**
268
+ * Validate spec.config.yaml: a schema-valid config, a buildable dependency
269
+ * graph (issue #13), and declared spec paths that actually resolve. An entry
270
+ * that matches no files makes every downstream verdict vacuous, so it is
271
+ * reported here rather than silently flowing into lint/status/ready.
272
+ */
273
+ declare function runValidate(configDir: string): Promise<ValidateResult>;
170
274
 
171
- export { runDiff, runLint, runPack, runStatus, scaffoldProject };
275
+ export { type Diagnostic, type DiffResult, type LintResults, type PackOptions, type PackResult, type RunDiffOptions, type RunLintOptions, type RunLintResults, type RunPackOptions, type RunStatusOptions, type ScaffoldOptions, type SdxConfig, type SpecType, type StatusResult, type Template, type ValidateResult, runDiff, runLint, runPack, runStatus, runValidate, scaffoldProject };