specdx 0.4.0-alpha.9 → 0.5.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 (115) hide show
  1. package/.claude-plugin/plugin.json +7 -2
  2. package/README.md +283 -0
  3. package/dist/{check-4FSSC6HN.js → check-RH5SCXWW.js} +68 -30
  4. package/dist/check-RH5SCXWW.js.map +1 -0
  5. package/dist/{chunk-N77RNV7J.js → chunk-3YXRWQGX.js} +217 -42
  6. package/dist/chunk-3YXRWQGX.js.map +1 -0
  7. package/dist/chunk-5WRI5ZAA.js +31 -0
  8. package/dist/chunk-6EQIDZ4D.js +185 -0
  9. package/dist/chunk-6EQIDZ4D.js.map +1 -0
  10. package/dist/chunk-6WFNZH7F.js +2846 -0
  11. package/dist/chunk-6WFNZH7F.js.map +1 -0
  12. package/dist/{chunk-AKNPCB37.js → chunk-BMOOLUPG.js} +32 -12
  13. package/dist/chunk-BMOOLUPG.js.map +1 -0
  14. package/dist/{chunk-IHTYAW7C.js → chunk-BP3SB35W.js} +111 -7
  15. package/dist/chunk-BP3SB35W.js.map +1 -0
  16. package/dist/chunk-CQETLJTZ.js +103 -0
  17. package/dist/chunk-CQETLJTZ.js.map +1 -0
  18. package/dist/chunk-DMGABJ6T.js +41 -0
  19. package/dist/chunk-DMGABJ6T.js.map +1 -0
  20. package/dist/chunk-NHD44ZYN.js +20 -0
  21. package/dist/chunk-NHD44ZYN.js.map +1 -0
  22. package/dist/{chunk-7JXW2GTJ.js → chunk-XRWLPU24.js} +18 -2
  23. package/dist/chunk-XRWLPU24.js.map +1 -0
  24. package/dist/chunk-ZIODMXST.js +1146 -0
  25. package/dist/chunk-ZIODMXST.js.map +1 -0
  26. package/dist/diff-QO7HMAK3.js +200 -0
  27. package/dist/diff-QO7HMAK3.js.map +1 -0
  28. package/dist/{dist-4DIRTBJH.js → dist-JPWHWMV2.js} +88 -26
  29. package/dist/dist-JPWHWMV2.js.map +1 -0
  30. package/dist/{dist-RL2DT3ZE.js → dist-ROHCFKYT.js} +3 -2
  31. package/dist/dist-ROHCFKYT.js.map +1 -0
  32. package/dist/generate-MS4BM7RU.js +21 -0
  33. package/dist/generate-MS4BM7RU.js.map +1 -0
  34. package/dist/{generate-story-EFHGINHA.js → generate-story-OMM322L7.js} +43 -19
  35. package/dist/generate-story-OMM322L7.js.map +1 -0
  36. package/dist/{generate-test-plan-BO7444RG.js → generate-test-plan-75W7SZIO.js} +61 -11
  37. package/dist/generate-test-plan-75W7SZIO.js.map +1 -0
  38. package/dist/{graph-5XINV7PT.js → graph-QOTMXENE.js} +49 -11
  39. package/dist/graph-QOTMXENE.js.map +1 -0
  40. package/dist/index.d.ts +302 -0
  41. package/dist/index.js +2996 -357
  42. package/dist/index.js.map +1 -1
  43. package/dist/lint-LPFLHVO4.js +184 -0
  44. package/dist/lint-LPFLHVO4.js.map +1 -0
  45. package/dist/main.js +10 -229
  46. package/dist/main.js.map +1 -1
  47. package/dist/mcp-OEC43SPF.js +35 -0
  48. package/dist/mcp-OEC43SPF.js.map +1 -0
  49. package/dist/{migrate-4KF6GHLO.js → migrate-CBP2AVLH.js} +21 -9
  50. package/dist/migrate-CBP2AVLH.js.map +1 -0
  51. package/dist/{pack-DSOODXAN.js → pack-X6FSWORJ.js} +41 -13
  52. package/dist/pack-X6FSWORJ.js.map +1 -0
  53. package/dist/{ready-6DNKIHP6.js → ready-7MJWRGLT.js} +55 -14
  54. package/dist/ready-7MJWRGLT.js.map +1 -0
  55. package/dist/skills/{specdx-author-spec.md → core/specdx-author-spec/SKILL.md} +10 -6
  56. package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-01-frontmatter.md +1 -1
  57. package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-02-sections.md +41 -0
  58. package/dist/skills/{specdx-onboard.md → core/specdx-onboard/SKILL.md} +8 -3
  59. package/dist/skills/{specdx-plan-from-spec.md → core/specdx-plan-from-spec/SKILL.md} +5 -1
  60. package/dist/skills/{specdx-pre-commit.md → core/specdx-pre-commit/SKILL.md} +16 -2
  61. package/dist/skills/{specdx-review-spec.md → core/specdx-review-spec/SKILL.md} +5 -1
  62. package/dist/skills/core/specdx-router/SKILL.md +67 -0
  63. package/dist/skills/{specdx-sprint-review.md → core/specdx-sprint-review/SKILL.md} +6 -2
  64. package/dist/skills/{specdx-start-task.md → core/specdx-start-task/SKILL.md} +5 -1
  65. package/dist/skills/{specdx-check-drift.md → experimental/specdx-check-drift/SKILL.md} +10 -4
  66. package/dist/skills/{specdx-verify.md → experimental/specdx-verify/SKILL.md} +6 -2
  67. package/dist/skills-36SRUEMR.js +121 -0
  68. package/dist/skills-36SRUEMR.js.map +1 -0
  69. package/dist/{status-WZK247CI.js → status-UUPZYX3J.js} +63 -32
  70. package/dist/status-UUPZYX3J.js.map +1 -0
  71. package/dist/{update-JTNSYX3B.js → update-EI7IJRHG.js} +22 -12
  72. package/dist/update-EI7IJRHG.js.map +1 -0
  73. package/dist/{validate-LBDYWUDX.js → validate-HTTZLQWI.js} +36 -17
  74. package/dist/validate-HTTZLQWI.js.map +1 -0
  75. package/hooks/hooks.json +12 -6
  76. package/hooks/session-start +35 -3
  77. package/package.json +28 -13
  78. package/dist/changelog-XUVHY3QK.js +0 -93
  79. package/dist/changelog-XUVHY3QK.js.map +0 -1
  80. package/dist/check-4FSSC6HN.js.map +0 -1
  81. package/dist/chunk-7JXW2GTJ.js.map +0 -1
  82. package/dist/chunk-AKNPCB37.js.map +0 -1
  83. package/dist/chunk-DAZCOUVK.js +0 -496
  84. package/dist/chunk-DAZCOUVK.js.map +0 -1
  85. package/dist/chunk-GAM4MXPC.js +0 -15
  86. package/dist/chunk-GAM4MXPC.js.map +0 -1
  87. package/dist/chunk-IHTYAW7C.js.map +0 -1
  88. package/dist/chunk-N77RNV7J.js.map +0 -1
  89. package/dist/chunk-SRZ33RJP.js +0 -1147
  90. package/dist/chunk-SRZ33RJP.js.map +0 -1
  91. package/dist/diff-OXZ34NU4.js +0 -107
  92. package/dist/diff-OXZ34NU4.js.map +0 -1
  93. package/dist/dist-4DIRTBJH.js.map +0 -1
  94. package/dist/explain-QBV3AESQ.js +0 -109
  95. package/dist/explain-QBV3AESQ.js.map +0 -1
  96. package/dist/generate-7GNPT2WJ.js +0 -13
  97. package/dist/generate-7GNPT2WJ.js.map +0 -1
  98. package/dist/generate-story-EFHGINHA.js.map +0 -1
  99. package/dist/generate-test-plan-BO7444RG.js.map +0 -1
  100. package/dist/graph-5XINV7PT.js.map +0 -1
  101. package/dist/lint-PTMWMLDQ.js +0 -122
  102. package/dist/lint-PTMWMLDQ.js.map +0 -1
  103. package/dist/mcp-BGFAPM6G.js +0 -17
  104. package/dist/mcp-BGFAPM6G.js.map +0 -1
  105. package/dist/migrate-4KF6GHLO.js.map +0 -1
  106. package/dist/pack-DSOODXAN.js.map +0 -1
  107. package/dist/ready-6DNKIHP6.js.map +0 -1
  108. package/dist/skills-3GBBWZW2.js +0 -93
  109. package/dist/skills-3GBBWZW2.js.map +0 -1
  110. package/dist/status-WZK247CI.js.map +0 -1
  111. package/dist/update-JTNSYX3B.js.map +0 -1
  112. package/dist/validate-LBDYWUDX.js.map +0 -1
  113. /package/dist/{dist-RL2DT3ZE.js.map → chunk-5WRI5ZAA.js.map} +0 -0
  114. /package/dist/skills/{spec-type-reference.md → core/specdx-author-spec/references/spec-type-reference.md} +0 -0
  115. /package/dist/skills/{specdx-author-spec → core/specdx-author-spec/references}/step-03-finalize.md +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,15 +13,25 @@ import {
9
13
  loadConfig,
10
14
  parseSpec,
11
15
  resolveGlob
12
- } from "./chunk-IHTYAW7C.js";
13
- import "./chunk-7JXW2GTJ.js";
16
+ } from "./chunk-BP3SB35W.js";
17
+ import "./chunk-XRWLPU24.js";
18
+ import "./chunk-5WRI5ZAA.js";
14
19
 
15
- // src/commands/graph.ts
20
+ // src/commands/core/graph.ts
16
21
  import { defineCommand } from "citty";
22
+ var FORMATS = ["pretty", "json", "dot"];
17
23
  var graph_default = defineCommand({
18
24
  meta: { name: "graph", description: "Print the spec dependency graph" },
19
- args: { ...sharedArgs },
25
+ args: { ...sharedArgs(FORMATS) },
20
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 });
21
35
  let config;
22
36
  const configDir = process.cwd();
23
37
  try {
@@ -45,7 +59,31 @@ var graph_default = defineCommand({
45
59
  }
46
60
  const referenceEdges = collectReferenceEdges(specs);
47
61
  const unreflected = findUnreflectedReferences(referenceEdges, idToEntry, graph);
48
- 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") {
49
87
  console.log("digraph specs {");
50
88
  for (const edge of graph.edges) console.log(` "${edge.from}" -> "${edge.to}";`);
51
89
  for (const ref of referenceEdges) {
@@ -56,16 +94,16 @@ var graph_default = defineCommand({
56
94
  console.log("}");
57
95
  return;
58
96
  }
59
- console.log("\n Spec Dependency Graph:\n");
97
+ output.info("\n Spec Dependency Graph:\n");
60
98
  for (const node of sorted) {
61
99
  const downstream = graph.getDownstream(node);
62
100
  const arrow = downstream.length > 0 ? ` \u2192 ${downstream.join(", ")}` : "";
63
- console.log(` ${node}${arrow}`);
101
+ output.out(` ${node}${arrow}`);
64
102
  }
65
103
  if (referenceEdges.length > 0) {
66
- console.log("\n Reference edges (frontmatter):\n");
104
+ output.info("\n Reference edges (frontmatter):\n");
67
105
  for (const ref of referenceEdges) {
68
- console.log(` ${ref.fromId} \u2014${ref.relationship}\u2192 ${ref.toId}`);
106
+ output.out(` ${ref.fromId} \u2014${ref.relationship}\u2192 ${ref.toId}`);
69
107
  }
70
108
  }
71
109
  const suggestions = unreflected.filter((u) => !u.createsCycle);
@@ -99,4 +137,4 @@ var graph_default = defineCommand({
99
137
  export {
100
138
  graph_default as default
101
139
  };
102
- //# sourceMappingURL=graph-5XINV7PT.js.map
140
+ //# sourceMappingURL=graph-QOTMXENE.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;AAAA,IAChB;AACA,QAAI;AACF,YAAM,QAAQ,WAAW,MAAM;AAC/B,YAAM,SAAS,MAAM,gBAAgB;AAKrC,YAAM,YAAY,oBAAI,IAAoB;AAC1C,YAAM,QAAsB,C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ScaffoldOptions {
3
+ projectName: string;
4
+ template: Template;
5
+ targetDir: string;
6
+ }
7
+ declare function scaffoldProject({ projectName, template, targetDir, }: ScaffoldOptions): Promise<void>;
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
+ * Linting for agent instruction files — AGENTS.md, CLAUDE.md and friends.
63
+ *
64
+ * These are not specs and never become `ParsedSpec`: they carry no
65
+ * frontmatter, they are absent from `specs`, and they never enter the
66
+ * dependency graph. See `specs/adr/2026-08-11-linting-formats-we-do-not-own.md`.
67
+ *
68
+ * Presence of this key is what turns the feature on. Auto-discovering
69
+ * AGENTS.md would add diagnostics to every existing suite on upgrade, and
70
+ * `strict` would promote them to errors and break pipelines that never asked
71
+ * for this.
72
+ */
73
+ agents?: {
74
+ /** Globs, relative to the config directory. Defaults to AGENTS.md and CLAUDE.md. */
75
+ paths?: string[];
76
+ /** Ceiling for a single agent file, counted with the same tokenizer `pack` uses. */
77
+ max_tokens?: number;
78
+ /** Per-rule severity overrides, keyed by full rule id (`agents/size-budget`). */
79
+ rules?: Record<string, unknown>;
80
+ };
81
+ }
82
+
83
+ type Severity = "error" | "warn" | "info";
84
+ interface Diagnostic {
85
+ ruleId: string;
86
+ severity: Severity;
87
+ message: string;
88
+ filePath: string;
89
+ line?: number;
90
+ section?: string;
91
+ }
92
+ interface LintResults {
93
+ diagnostics: Diagnostic[];
94
+ hasErrors: boolean;
95
+ hasWarnings: boolean;
96
+ }
97
+
98
+ interface RunLintOptions {
99
+ configDir: string;
100
+ specPath?: string;
101
+ preset?: "minimal" | "recommended" | "strict";
102
+ }
103
+ /** Lint results plus whether anything was actually linted (vacuous-pass audit). */
104
+ interface RunLintResults extends LintResults {
105
+ /** Number of spec files linted. Named for what it counts, not "count". */
106
+ specFiles: number;
107
+ /** False when no specs resolved — "no diagnostics" is then not a pass. */
108
+ assessed: boolean;
109
+ /**
110
+ * Agent instruction files linted. Zero when `agents` is not configured, which
111
+ * is not a failure — the feature is opt-in. A configured `agents.paths` that
112
+ * matches nothing is reported as an error diagnostic instead, because that
113
+ * is a config promising a check that is not running.
114
+ */
115
+ agentFiles: number;
116
+ }
117
+ declare function runLint(options: RunLintOptions): Promise<RunLintResults>;
118
+
119
+ /** Options for the pack command. */
120
+ interface PackOptions {
121
+ /** Specific task or context to optimise relevance for. */
122
+ task?: string;
123
+ /** Glob patterns or spec IDs to include. */
124
+ specs?: string[];
125
+ /** Maximum token budget for the output. */
126
+ budget?: number;
127
+ /** Output format (e.g. "xml", "json", "markdown"). */
128
+ format?: string;
129
+ /** Include all specs without budget trimming. */
130
+ full?: boolean;
131
+ /** Preview what would be packed without writing output. */
132
+ dryRun?: boolean;
133
+ }
134
+ /** Statistics about how the budget was allocated. */
135
+ interface PackStats {
136
+ /** Total token budget. */
137
+ budget: number;
138
+ /** Tokens actually used. */
139
+ used: number;
140
+ /** Number of specs included in the output. */
141
+ specsIncluded: number;
142
+ /** Number of specs excluded due to budget or relevance. */
143
+ specsExcluded: number;
144
+ /** Number of sections that were compressed. */
145
+ sectionsCompressed: number;
146
+ /** Number of sections omitted entirely to fit the budget. */
147
+ sectionsOmitted: number;
148
+ /** Per-spec allocation details. */
149
+ allocations: SpecAllocation[];
150
+ }
151
+ /** Result returned by the pack operation. */
152
+ interface PackResult {
153
+ /** The formatted output string. */
154
+ output: string;
155
+ /** Statistics about the pack run. */
156
+ stats: PackStats;
157
+ }
158
+ /** Token allocation detail for a single spec. */
159
+ interface SpecAllocation {
160
+ /** Identifier of the spec. */
161
+ specId: string;
162
+ /** Spec type (e.g. "adr", "rfc", "runbook"). */
163
+ type: string;
164
+ /** Computed relevance score (0-1). */
165
+ relevance: number;
166
+ /** Tokens allocated to this spec. */
167
+ tokens: number;
168
+ /** Whether this spec was compressed. */
169
+ compressed: boolean;
170
+ /** Whether this spec was included in the output. */
171
+ included: boolean;
172
+ }
173
+
174
+ interface RunPackOptions {
175
+ configDir: string;
176
+ task?: string;
177
+ specs?: string[];
178
+ budget?: number;
179
+ format?: "xml" | "markdown" | "json";
180
+ full?: boolean;
181
+ dryRun?: boolean;
182
+ }
183
+ declare function runPack(options: RunPackOptions): Promise<PackResult & {
184
+ specsResolved: number;
185
+ }>;
186
+
187
+ type FieldChangeType = "added" | "removed" | "modified" | "broken-reference";
188
+ interface FieldChange {
189
+ field: string;
190
+ type: FieldChangeType;
191
+ before?: unknown;
192
+ after?: unknown;
193
+ }
194
+ interface SectionChange {
195
+ heading: string;
196
+ type: "added" | "removed" | "modified";
197
+ contentDiff?: string;
198
+ }
199
+ interface SpecDiff {
200
+ specId: string;
201
+ filePath: string;
202
+ frontmatter: FieldChange[];
203
+ sections: SectionChange[];
204
+ summary: string;
205
+ }
206
+ interface DownstreamImpact {
207
+ specId: string;
208
+ filePath: string;
209
+ distance: number;
210
+ lastUpdated: string | null;
211
+ staleness: number;
212
+ reason: string;
213
+ }
214
+ interface ImpactAnalysis {
215
+ changedSpec: string;
216
+ downstream: DownstreamImpact[];
217
+ totalAffected: number;
218
+ }
219
+ interface DiffResult {
220
+ diffs: SpecDiff[];
221
+ added: string[];
222
+ removed: string[];
223
+ impact: ImpactAnalysis[];
224
+ summary: string;
225
+ /**
226
+ * Spec files changed in the working tree but not covered by the comparison.
227
+ *
228
+ * A ref-to-ref diff cannot see uncommitted work, so reporting "no changes"
229
+ * without this would be a false all-clear. Always empty in working mode,
230
+ * where those changes are part of the comparison.
231
+ */
232
+ uncommittedSpecFiles: string[];
233
+ }
234
+ interface StatusResult {
235
+ project: string;
236
+ /**
237
+ * Spec *files* resolved, not config entries — one glob entry can resolve to
238
+ * many files. The old name `specCount` did not say which, and meant the
239
+ * other thing in `runValidate` (audit run 5, F4).
240
+ */
241
+ specFiles: number;
242
+ byStatus: Record<string, number>;
243
+ lintHealth: {
244
+ errors: number;
245
+ warnings: number;
246
+ passing: number;
247
+ };
248
+ staleSpecs: {
249
+ specId: string;
250
+ daysSinceUpdate: number;
251
+ owner?: string;
252
+ }[];
253
+ integrityIssues: string[];
254
+ /** "unassessed" when the suite resolved to zero specs — never a vacuous "healthy". */
255
+ verdict: "healthy" | "warnings" | "errors" | "unassessed";
256
+ }
257
+
258
+ interface RunDiffOptions {
259
+ base?: string;
260
+ head?: string;
261
+ spec?: string;
262
+ format?: string;
263
+ /** Compare the base ref against the working tree instead of a head ref. */
264
+ working?: boolean;
265
+ /**
266
+ * Directory holding spec.config.yaml. Defaults to the process cwd; a library
267
+ * consumer needs to point it elsewhere (audit run 5, F8).
268
+ */
269
+ configDir?: string;
270
+ }
271
+ declare function runDiff(options: RunDiffOptions): Promise<DiffResult>;
272
+
273
+ interface RunStatusOptions {
274
+ /**
275
+ * Directory holding spec.config.yaml. Defaults to the process cwd, which is
276
+ * right for the CLI and useless to a library consumer — `runLint` and
277
+ * `runPack` take one, so this does too (audit run 5, F8).
278
+ */
279
+ configDir?: string;
280
+ }
281
+ declare function runStatus(options?: RunStatusOptions): Promise<StatusResult>;
282
+
283
+ interface ValidateResult {
284
+ valid: boolean;
285
+ /** Number of spec entries declared in the config. */
286
+ specEntries?: number;
287
+ /** Number of spec files those entries actually resolve to. */
288
+ specFiles?: number;
289
+ /** Non-fatal honesty notes: entries resolving to nothing, empty suite. */
290
+ warnings: string[];
291
+ error?: string;
292
+ details?: unknown[];
293
+ }
294
+ /**
295
+ * Validate spec.config.yaml: a schema-valid config, a buildable dependency
296
+ * graph (issue #13), and declared spec paths that actually resolve. An entry
297
+ * that matches no files makes every downstream verdict vacuous, so it is
298
+ * reported here rather than silently flowing into lint/status/ready.
299
+ */
300
+ declare function runValidate(configDir: string): Promise<ValidateResult>;
301
+
302
+ 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 };