ai-spec-dev 0.37.0 → 0.41.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 (67) hide show
  1. package/README.md +381 -1796
  2. package/RELEASE_LOG.md +231 -0
  3. package/cli/commands/create.ts +9 -1176
  4. package/cli/commands/dashboard.ts +1 -1
  5. package/cli/pipeline/helpers.ts +34 -0
  6. package/cli/pipeline/multi-repo.ts +483 -0
  7. package/cli/pipeline/single-repo.ts +755 -0
  8. package/cli/utils.ts +2 -0
  9. package/core/code-generator.ts +52 -341
  10. package/core/codegen/helpers.ts +219 -0
  11. package/core/codegen/topo-sort.ts +98 -0
  12. package/core/constitution-consolidator.ts +2 -2
  13. package/core/dsl-coverage-checker.ts +298 -0
  14. package/core/dsl-extractor.ts +19 -46
  15. package/core/dsl-feedback.ts +1 -1
  16. package/core/dsl-validator.ts +74 -0
  17. package/core/error-feedback.ts +95 -11
  18. package/core/frontend-context-loader.ts +27 -5
  19. package/core/knowledge-memory.ts +52 -0
  20. package/core/mock/fixtures.ts +89 -0
  21. package/core/mock/proxy.ts +380 -0
  22. package/core/mock-server-generator.ts +12 -460
  23. package/core/requirement-decomposer.ts +4 -28
  24. package/core/reviewer.ts +1 -1
  25. package/core/safe-json.ts +76 -0
  26. package/core/spec-updater.ts +5 -21
  27. package/core/token-budget.ts +124 -0
  28. package/core/vcr.ts +20 -1
  29. package/dist/cli/index.js +4110 -3534
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/cli/index.mjs +4237 -3661
  32. package/dist/cli/index.mjs.map +1 -1
  33. package/dist/index.d.mts +18 -16
  34. package/dist/index.d.ts +18 -16
  35. package/dist/index.js +310 -182
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +308 -180
  38. package/dist/index.mjs.map +1 -1
  39. package/package.json +2 -2
  40. package/purpose.md +173 -33
  41. package/tests/auto-consolidation.test.ts +109 -0
  42. package/tests/combined-generator.test.ts +81 -0
  43. package/tests/constitution-consolidator.test.ts +161 -0
  44. package/tests/constitution-generator.test.ts +94 -0
  45. package/tests/contract-bridge.test.ts +201 -0
  46. package/tests/design-dialogue.test.ts +108 -0
  47. package/tests/dsl-coverage-checker.test.ts +230 -0
  48. package/tests/dsl-feedback.test.ts +45 -0
  49. package/tests/dsl-validator-xref.test.ts +99 -0
  50. package/tests/error-feedback-repair.test.ts +319 -0
  51. package/tests/error-feedback-validation.test.ts +91 -0
  52. package/tests/frontend-context-loader.test.ts +609 -0
  53. package/tests/global-constitution.test.ts +110 -0
  54. package/tests/key-store.test.ts +73 -0
  55. package/tests/knowledge-memory.test.ts +327 -0
  56. package/tests/project-index.test.ts +206 -0
  57. package/tests/prompt-hasher.test.ts +19 -0
  58. package/tests/requirement-decomposer.test.ts +171 -0
  59. package/tests/reviewer.test.ts +4 -1
  60. package/tests/run-logger.test.ts +289 -0
  61. package/tests/run-snapshot.test.ts +113 -0
  62. package/tests/safe-json.test.ts +63 -0
  63. package/tests/spec-updater.test.ts +161 -0
  64. package/tests/test-generator.test.ts +146 -0
  65. package/tests/token-budget.test.ts +124 -0
  66. package/tests/vcr-hash.test.ts +101 -0
  67. package/tests/workspace-loader.test.ts +277 -0
package/dist/index.d.mts CHANGED
@@ -146,6 +146,22 @@ declare class SpecRefiner {
146
146
  refineLoop(initialSpec: string): Promise<string>;
147
147
  }
148
148
 
149
+ /**
150
+ * Extract a behavioral contract summary from a generated file.
151
+ *
152
+ * Captures:
153
+ * - export interface / type / enum — full multi-line blocks (the actual TS contracts)
154
+ * - export function / const / class — opening signature line
155
+ * - Throw statements — error codes & validation constraints
156
+ *
157
+ * Multi-line blocks (interface, type alias with {}) are captured in full so
158
+ * downstream tasks see complete method signatures and field shapes, not just
159
+ * a single-line "export interface Foo {" that conveys nothing.
160
+ *
161
+ * Falls back to first 3000 chars for CommonJS files with no explicit exports.
162
+ */
163
+ declare function extractBehavioralContract(content: string): string;
164
+
149
165
  declare function buildTaskPrompt(spec: string, context?: ProjectContext): string;
150
166
  type TaskLayer = "data" | "infra" | "service" | "api" | "view" | "route" | "test";
151
167
  type TaskPriority = "high" | "medium" | "low";
@@ -183,21 +199,8 @@ declare function loadTasksForSpec(specFilePath: string): Promise<SpecTask[] | nu
183
199
  /** Persist a single task's status to the tasks JSON file (checkpoint). */
184
200
  declare function updateTaskStatus(specFilePath: string, taskId: string, status: TaskStatus): Promise<void>;
185
201
 
186
- /**
187
- * Extract a behavioral contract summary from a generated file.
188
- *
189
- * Captures:
190
- * - export interface / type / enum — full multi-line blocks (the actual TS contracts)
191
- * - export function / const / class — opening signature line
192
- * - Throw statements — error codes & validation constraints
193
- *
194
- * Multi-line blocks (interface, type alias with {}) are captured in full so
195
- * downstream tasks see complete method signatures and field shapes, not just
196
- * a single-line "export interface Foo {" that conveys nothing.
197
- *
198
- * Falls back to first 3000 chars for CommonJS files with no explicit exports.
199
- */
200
- declare function extractBehavioralContract(content: string): string;
202
+ declare function printTaskProgress(completed: number, total: number, task: SpecTask, mode: "run" | "skip"): void;
203
+
201
204
  type CodeGenMode = "claude-code" | "api" | "plan";
202
205
  interface CodeGenOptions {
203
206
  /** Run claude non-interactively via -p flag (saves tokens, good for automation) */
@@ -228,7 +231,6 @@ declare class CodeGenerator {
228
231
  private generateFiles;
229
232
  private runPlanMode;
230
233
  }
231
- declare function printTaskProgress(completed: number, total: number, task: SpecTask, mode: "run" | "skip"): void;
232
234
 
233
235
  /** Extract compliance score from Pass 0 output (looks for "ComplianceScore: X/10") */
234
236
  declare function extractComplianceScore(complianceText: string): number;
package/dist/index.d.ts CHANGED
@@ -146,6 +146,22 @@ declare class SpecRefiner {
146
146
  refineLoop(initialSpec: string): Promise<string>;
147
147
  }
148
148
 
149
+ /**
150
+ * Extract a behavioral contract summary from a generated file.
151
+ *
152
+ * Captures:
153
+ * - export interface / type / enum — full multi-line blocks (the actual TS contracts)
154
+ * - export function / const / class — opening signature line
155
+ * - Throw statements — error codes & validation constraints
156
+ *
157
+ * Multi-line blocks (interface, type alias with {}) are captured in full so
158
+ * downstream tasks see complete method signatures and field shapes, not just
159
+ * a single-line "export interface Foo {" that conveys nothing.
160
+ *
161
+ * Falls back to first 3000 chars for CommonJS files with no explicit exports.
162
+ */
163
+ declare function extractBehavioralContract(content: string): string;
164
+
149
165
  declare function buildTaskPrompt(spec: string, context?: ProjectContext): string;
150
166
  type TaskLayer = "data" | "infra" | "service" | "api" | "view" | "route" | "test";
151
167
  type TaskPriority = "high" | "medium" | "low";
@@ -183,21 +199,8 @@ declare function loadTasksForSpec(specFilePath: string): Promise<SpecTask[] | nu
183
199
  /** Persist a single task's status to the tasks JSON file (checkpoint). */
184
200
  declare function updateTaskStatus(specFilePath: string, taskId: string, status: TaskStatus): Promise<void>;
185
201
 
186
- /**
187
- * Extract a behavioral contract summary from a generated file.
188
- *
189
- * Captures:
190
- * - export interface / type / enum — full multi-line blocks (the actual TS contracts)
191
- * - export function / const / class — opening signature line
192
- * - Throw statements — error codes & validation constraints
193
- *
194
- * Multi-line blocks (interface, type alias with {}) are captured in full so
195
- * downstream tasks see complete method signatures and field shapes, not just
196
- * a single-line "export interface Foo {" that conveys nothing.
197
- *
198
- * Falls back to first 3000 chars for CommonJS files with no explicit exports.
199
- */
200
- declare function extractBehavioralContract(content: string): string;
202
+ declare function printTaskProgress(completed: number, total: number, task: SpecTask, mode: "run" | "skip"): void;
203
+
201
204
  type CodeGenMode = "claude-code" | "api" | "plan";
202
205
  interface CodeGenOptions {
203
206
  /** Run claude non-interactively via -p flag (saves tokens, good for automation) */
@@ -228,7 +231,6 @@ declare class CodeGenerator {
228
231
  private generateFiles;
229
232
  private runPlanMode;
230
233
  }
231
- declare function printTaskProgress(completed: number, total: number, task: SpecTask, mode: "run" | "skip"): void;
232
234
 
233
235
  /** Extract compliance score from Pass 0 output (looks for "ComplianceScore: X/10") */
234
236
  declare function extractComplianceScore(complianceText: string): number;