ai-spec-dev 0.33.0 → 0.36.1
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/.claude/commands/add-lesson.md +34 -0
- package/.claude/commands/check-layers.md +65 -0
- package/.claude/commands/installed-deps.md +35 -0
- package/.claude/commands/recall-lessons.md +40 -0
- package/.claude/commands/scan-singletons.md +45 -0
- package/.claude/commands/verify-imports.md +48 -0
- package/.claude/settings.local.json +11 -1
- package/README.md +531 -213
- package/RELEASE_LOG.md +424 -0
- package/cli/commands/config.ts +18 -0
- package/cli/commands/create.ts +1248 -0
- package/cli/commands/dashboard.ts +62 -0
- package/cli/commands/init.ts +45 -8
- package/cli/commands/mock.ts +175 -0
- package/cli/commands/scan.ts +99 -0
- package/cli/commands/types.ts +69 -0
- package/cli/commands/vcr.ts +70 -0
- package/cli/index.ts +34 -2517
- package/cli/utils.ts +4 -0
- package/core/code-generator.ts +6 -4
- package/core/combined-generator.ts +13 -3
- package/core/dashboard-generator.ts +340 -0
- package/core/design-dialogue.ts +124 -0
- package/core/dsl-extractor.ts +9 -1
- package/core/dsl-feedback.ts +41 -5
- package/core/dsl-validator.ts +32 -0
- package/core/error-feedback.ts +46 -2
- package/core/key-store.ts +5 -4
- package/core/project-index.ts +301 -0
- package/core/provider-utils.ts +39 -4
- package/core/reviewer.ts +84 -6
- package/core/run-logger.ts +109 -3
- package/core/run-trend.ts +24 -4
- package/core/self-evaluator.ts +39 -11
- package/core/spec-generator.ts +14 -8
- package/core/task-generator.ts +17 -0
- package/core/types-generator.ts +219 -0
- package/core/vcr.ts +210 -0
- package/dist/cli/index.js +7407 -5643
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +7401 -5637
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +34 -5
- package/dist/index.d.ts +34 -5
- package/dist/index.js +497 -232
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +495 -233
- package/dist/index.mjs.map +1 -1
- package/docs-assets/purpose/architecture-overview.svg +64 -0
- package/docs-assets/purpose/create-pipeline.svg +113 -0
- package/docs-assets/purpose/task-layering.svg +74 -0
- package/package.json +1 -1
- package/prompts/codegen.prompt.ts +97 -9
- package/prompts/design.prompt.ts +59 -0
- package/prompts/spec.prompt.ts +8 -1
- package/prompts/tasks.prompt.ts +27 -2
- package/purpose.md +600 -174
- package/tests/code-generator.test.ts +253 -0
- package/tests/context-loader.test.ts +207 -0
- package/tests/dsl-validator.test.ts +105 -0
- package/tests/openapi-exporter.test.ts +310 -0
- package/tests/reviewer.test.ts +214 -0
- package/tests/spec-generator.test.ts +228 -0
- package/tests/spec-versioning.test.ts +205 -0
package/dist/index.d.mts
CHANGED
|
@@ -137,7 +137,7 @@ declare function createProvider(providerName: string, apiKey: string, modelName?
|
|
|
137
137
|
declare class SpecGenerator {
|
|
138
138
|
private provider;
|
|
139
139
|
constructor(provider: AIProvider);
|
|
140
|
-
generateSpec(idea: string, context?: ProjectContext): Promise<string>;
|
|
140
|
+
generateSpec(idea: string, context?: ProjectContext, architectureDecision?: string): Promise<string>;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
declare class SpecRefiner {
|
|
@@ -157,6 +157,15 @@ interface SpecTask {
|
|
|
157
157
|
layer: TaskLayer;
|
|
158
158
|
filesToTouch: string[];
|
|
159
159
|
acceptanceCriteria: string[];
|
|
160
|
+
/**
|
|
161
|
+
* Concrete, runnable verification steps — each entry is a specific command
|
|
162
|
+
* or action with an expected observable outcome.
|
|
163
|
+
* Examples:
|
|
164
|
+
* "POST /api/orders with body {...} → HTTP 201, body contains {id, status:'pending'}"
|
|
165
|
+
* "npm run build exits 0 with no TypeScript errors"
|
|
166
|
+
* "GET /api/orders/:id returns 404 when id does not exist"
|
|
167
|
+
*/
|
|
168
|
+
verificationSteps: string[];
|
|
160
169
|
dependencies: string[];
|
|
161
170
|
priority: TaskPriority;
|
|
162
171
|
/** Runtime checkpoint — set by code generator, persisted to tasks file */
|
|
@@ -174,6 +183,21 @@ declare function loadTasksForSpec(specFilePath: string): Promise<SpecTask[] | nu
|
|
|
174
183
|
/** Persist a single task's status to the tasks JSON file (checkpoint). */
|
|
175
184
|
declare function updateTaskStatus(specFilePath: string, taskId: string, status: TaskStatus): Promise<void>;
|
|
176
185
|
|
|
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;
|
|
177
201
|
type CodeGenMode = "claude-code" | "api" | "plan";
|
|
178
202
|
interface CodeGenOptions {
|
|
179
203
|
/** Run claude non-interactively via -p flag (saves tokens, good for automation) */
|
|
@@ -206,6 +230,10 @@ declare class CodeGenerator {
|
|
|
206
230
|
}
|
|
207
231
|
declare function printTaskProgress(completed: number, total: number, task: SpecTask, mode: "run" | "skip"): void;
|
|
208
232
|
|
|
233
|
+
/** Extract compliance score from Pass 0 output (looks for "ComplianceScore: X/10") */
|
|
234
|
+
declare function extractComplianceScore(complianceText: string): number;
|
|
235
|
+
/** Count missing requirements from Pass 0 output */
|
|
236
|
+
declare function extractMissingCount(complianceText: string): number;
|
|
209
237
|
declare class CodeReviewer {
|
|
210
238
|
private provider;
|
|
211
239
|
private projectRoot;
|
|
@@ -213,8 +241,9 @@ declare class CodeReviewer {
|
|
|
213
241
|
private getGitDiff;
|
|
214
242
|
private getDiffStats;
|
|
215
243
|
/**
|
|
216
|
-
*
|
|
217
|
-
* Pass
|
|
244
|
+
* Four-pass review:
|
|
245
|
+
* Pass 0 — spec compliance (exhaustive requirement coverage audit)
|
|
246
|
+
* Pass 1 — architecture (layer separation, contract design, auth posture)
|
|
218
247
|
* Pass 2 — implementation details (validation, error handling, edge cases)
|
|
219
248
|
* + historical issue recurrence check
|
|
220
249
|
* Pass 3 — impact assessment + code complexity
|
|
@@ -247,7 +276,7 @@ declare function printConstitutionHint(exists: boolean): void;
|
|
|
247
276
|
* from task-generator.ts (which already imports AIProvider from spec-generator).
|
|
248
277
|
*/
|
|
249
278
|
|
|
250
|
-
declare function generateSpecWithTasks(provider: AIProvider, idea: string, context?: ProjectContext): Promise<{
|
|
279
|
+
declare function generateSpecWithTasks(provider: AIProvider, idea: string, context?: ProjectContext, architectureDecision?: string): Promise<{
|
|
251
280
|
spec: string;
|
|
252
281
|
tasks: SpecTask[];
|
|
253
282
|
}>;
|
|
@@ -267,4 +296,4 @@ declare class GitWorktreeManager {
|
|
|
267
296
|
createWorktree(idea: string): Promise<string | null>;
|
|
268
297
|
}
|
|
269
298
|
|
|
270
|
-
export { type AIProvider, CONSTITUTION_FILE, ClaudeProvider, type CodeGenMode, type CodeGenOptions, CodeGenerator, CodeReviewer, ConstitutionGenerator, ContextLoader, DEFAULT_MODELS, ENV_KEY_MAP, FRONTEND_FRAMEWORKS, GeminiProvider, GitWorktreeManager, MiMoProvider, OpenAICompatibleProvider, PROVIDER_CATALOG, type ProjectContext, type ProviderMeta, SUPPORTED_PROVIDERS, type SharedConfigFile, SpecGenerator, SpecRefiner, type SpecTask, TaskGenerator, type TaskLayer, type TaskPriority, type TaskStatus, buildTaskPrompt, createProvider, generateSpecWithTasks, isFrontendDeps, loadConstitution, loadTasksForSpec, printConstitutionHint, printTaskProgress, printTasks, updateTaskStatus };
|
|
299
|
+
export { type AIProvider, CONSTITUTION_FILE, ClaudeProvider, type CodeGenMode, type CodeGenOptions, CodeGenerator, CodeReviewer, ConstitutionGenerator, ContextLoader, DEFAULT_MODELS, ENV_KEY_MAP, FRONTEND_FRAMEWORKS, GeminiProvider, GitWorktreeManager, MiMoProvider, OpenAICompatibleProvider, PROVIDER_CATALOG, type ProjectContext, type ProviderMeta, SUPPORTED_PROVIDERS, type SharedConfigFile, SpecGenerator, SpecRefiner, type SpecTask, TaskGenerator, type TaskLayer, type TaskPriority, type TaskStatus, buildTaskPrompt, createProvider, extractBehavioralContract, extractComplianceScore, extractMissingCount, generateSpecWithTasks, isFrontendDeps, loadConstitution, loadTasksForSpec, printConstitutionHint, printTaskProgress, printTasks, updateTaskStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -137,7 +137,7 @@ declare function createProvider(providerName: string, apiKey: string, modelName?
|
|
|
137
137
|
declare class SpecGenerator {
|
|
138
138
|
private provider;
|
|
139
139
|
constructor(provider: AIProvider);
|
|
140
|
-
generateSpec(idea: string, context?: ProjectContext): Promise<string>;
|
|
140
|
+
generateSpec(idea: string, context?: ProjectContext, architectureDecision?: string): Promise<string>;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
declare class SpecRefiner {
|
|
@@ -157,6 +157,15 @@ interface SpecTask {
|
|
|
157
157
|
layer: TaskLayer;
|
|
158
158
|
filesToTouch: string[];
|
|
159
159
|
acceptanceCriteria: string[];
|
|
160
|
+
/**
|
|
161
|
+
* Concrete, runnable verification steps — each entry is a specific command
|
|
162
|
+
* or action with an expected observable outcome.
|
|
163
|
+
* Examples:
|
|
164
|
+
* "POST /api/orders with body {...} → HTTP 201, body contains {id, status:'pending'}"
|
|
165
|
+
* "npm run build exits 0 with no TypeScript errors"
|
|
166
|
+
* "GET /api/orders/:id returns 404 when id does not exist"
|
|
167
|
+
*/
|
|
168
|
+
verificationSteps: string[];
|
|
160
169
|
dependencies: string[];
|
|
161
170
|
priority: TaskPriority;
|
|
162
171
|
/** Runtime checkpoint — set by code generator, persisted to tasks file */
|
|
@@ -174,6 +183,21 @@ declare function loadTasksForSpec(specFilePath: string): Promise<SpecTask[] | nu
|
|
|
174
183
|
/** Persist a single task's status to the tasks JSON file (checkpoint). */
|
|
175
184
|
declare function updateTaskStatus(specFilePath: string, taskId: string, status: TaskStatus): Promise<void>;
|
|
176
185
|
|
|
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;
|
|
177
201
|
type CodeGenMode = "claude-code" | "api" | "plan";
|
|
178
202
|
interface CodeGenOptions {
|
|
179
203
|
/** Run claude non-interactively via -p flag (saves tokens, good for automation) */
|
|
@@ -206,6 +230,10 @@ declare class CodeGenerator {
|
|
|
206
230
|
}
|
|
207
231
|
declare function printTaskProgress(completed: number, total: number, task: SpecTask, mode: "run" | "skip"): void;
|
|
208
232
|
|
|
233
|
+
/** Extract compliance score from Pass 0 output (looks for "ComplianceScore: X/10") */
|
|
234
|
+
declare function extractComplianceScore(complianceText: string): number;
|
|
235
|
+
/** Count missing requirements from Pass 0 output */
|
|
236
|
+
declare function extractMissingCount(complianceText: string): number;
|
|
209
237
|
declare class CodeReviewer {
|
|
210
238
|
private provider;
|
|
211
239
|
private projectRoot;
|
|
@@ -213,8 +241,9 @@ declare class CodeReviewer {
|
|
|
213
241
|
private getGitDiff;
|
|
214
242
|
private getDiffStats;
|
|
215
243
|
/**
|
|
216
|
-
*
|
|
217
|
-
* Pass
|
|
244
|
+
* Four-pass review:
|
|
245
|
+
* Pass 0 — spec compliance (exhaustive requirement coverage audit)
|
|
246
|
+
* Pass 1 — architecture (layer separation, contract design, auth posture)
|
|
218
247
|
* Pass 2 — implementation details (validation, error handling, edge cases)
|
|
219
248
|
* + historical issue recurrence check
|
|
220
249
|
* Pass 3 — impact assessment + code complexity
|
|
@@ -247,7 +276,7 @@ declare function printConstitutionHint(exists: boolean): void;
|
|
|
247
276
|
* from task-generator.ts (which already imports AIProvider from spec-generator).
|
|
248
277
|
*/
|
|
249
278
|
|
|
250
|
-
declare function generateSpecWithTasks(provider: AIProvider, idea: string, context?: ProjectContext): Promise<{
|
|
279
|
+
declare function generateSpecWithTasks(provider: AIProvider, idea: string, context?: ProjectContext, architectureDecision?: string): Promise<{
|
|
251
280
|
spec: string;
|
|
252
281
|
tasks: SpecTask[];
|
|
253
282
|
}>;
|
|
@@ -267,4 +296,4 @@ declare class GitWorktreeManager {
|
|
|
267
296
|
createWorktree(idea: string): Promise<string | null>;
|
|
268
297
|
}
|
|
269
298
|
|
|
270
|
-
export { type AIProvider, CONSTITUTION_FILE, ClaudeProvider, type CodeGenMode, type CodeGenOptions, CodeGenerator, CodeReviewer, ConstitutionGenerator, ContextLoader, DEFAULT_MODELS, ENV_KEY_MAP, FRONTEND_FRAMEWORKS, GeminiProvider, GitWorktreeManager, MiMoProvider, OpenAICompatibleProvider, PROVIDER_CATALOG, type ProjectContext, type ProviderMeta, SUPPORTED_PROVIDERS, type SharedConfigFile, SpecGenerator, SpecRefiner, type SpecTask, TaskGenerator, type TaskLayer, type TaskPriority, type TaskStatus, buildTaskPrompt, createProvider, generateSpecWithTasks, isFrontendDeps, loadConstitution, loadTasksForSpec, printConstitutionHint, printTaskProgress, printTasks, updateTaskStatus };
|
|
299
|
+
export { type AIProvider, CONSTITUTION_FILE, ClaudeProvider, type CodeGenMode, type CodeGenOptions, CodeGenerator, CodeReviewer, ConstitutionGenerator, ContextLoader, DEFAULT_MODELS, ENV_KEY_MAP, FRONTEND_FRAMEWORKS, GeminiProvider, GitWorktreeManager, MiMoProvider, OpenAICompatibleProvider, PROVIDER_CATALOG, type ProjectContext, type ProviderMeta, SUPPORTED_PROVIDERS, type SharedConfigFile, SpecGenerator, SpecRefiner, type SpecTask, TaskGenerator, type TaskLayer, type TaskPriority, type TaskStatus, buildTaskPrompt, createProvider, extractBehavioralContract, extractComplianceScore, extractMissingCount, generateSpecWithTasks, isFrontendDeps, loadConstitution, loadTasksForSpec, printConstitutionHint, printTaskProgress, printTasks, updateTaskStatus };
|