ai-spec-dev 0.1.0 → 0.14.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/settings.local.json +18 -0
- package/README.md +1211 -146
- package/RELEASE_LOG.md +1444 -0
- package/cli/index.ts +1961 -0
- package/cli/welcome.ts +151 -0
- package/core/code-generator.ts +740 -0
- package/core/combined-generator.ts +63 -0
- package/core/constitution-consolidator.ts +141 -0
- package/core/constitution-generator.ts +89 -0
- package/core/context-loader.ts +453 -0
- package/core/contract-bridge.ts +217 -0
- package/core/dsl-extractor.ts +337 -0
- package/core/dsl-types.ts +166 -0
- package/core/dsl-validator.ts +450 -0
- package/core/error-feedback.ts +354 -0
- package/core/frontend-context-loader.ts +602 -0
- package/core/global-constitution.ts +88 -0
- package/core/key-store.ts +49 -0
- package/core/knowledge-memory.ts +171 -0
- package/core/mock-server-generator.ts +571 -0
- package/core/openapi-exporter.ts +361 -0
- package/core/requirement-decomposer.ts +198 -0
- package/core/reviewer.ts +259 -0
- package/core/spec-assessor.ts +99 -0
- package/core/spec-generator.ts +428 -0
- package/core/spec-refiner.ts +89 -0
- package/core/spec-updater.ts +227 -0
- package/core/spec-versioning.ts +213 -0
- package/core/task-generator.ts +174 -0
- package/core/test-generator.ts +273 -0
- package/core/workspace-loader.ts +256 -0
- package/dist/cli/index.js +6717 -672
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +6717 -670
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +147 -27
- package/dist/index.d.ts +147 -27
- package/dist/index.js +2337 -286
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2329 -285
- package/dist/index.mjs.map +1 -1
- package/git/worktree.ts +109 -0
- package/index.ts +9 -0
- package/package.json +4 -28
- package/prompts/codegen.prompt.ts +259 -0
- package/prompts/consolidate.prompt.ts +73 -0
- package/prompts/constitution.prompt.ts +63 -0
- package/prompts/decompose.prompt.ts +168 -0
- package/prompts/dsl.prompt.ts +203 -0
- package/prompts/frontend-spec.prompt.ts +191 -0
- package/prompts/global-constitution.prompt.ts +61 -0
- package/prompts/spec-assess.prompt.ts +53 -0
- package/prompts/spec.prompt.ts +102 -0
- package/prompts/tasks.prompt.ts +35 -0
- package/prompts/testgen.prompt.ts +84 -0
- package/prompts/update.prompt.ts +131 -0
- package/purpose.docx +0 -0
- package/purpose.md +444 -0
- package/tsconfig.json +14 -0
- package/tsup.config.ts +10 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export const specPrompt = `You are an expert Software Architect. Your task is to convert the user's raw feature idea into a structured, detailed, and immediately actionable Markdown specification.
|
|
2
|
+
|
|
3
|
+
The spec MUST be written in Chinese (中文). Be comprehensive but focused — every section should contain practical, project-specific information derived from the provided project context.
|
|
4
|
+
|
|
5
|
+
Use the EXACT following template structure:
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Feature Spec: {功能名称}
|
|
10
|
+
|
|
11
|
+
## 1. 功能概述 (Overview)
|
|
12
|
+
用 2-3 句话简洁说明这个功能是什么,以及它解决的核心问题。
|
|
13
|
+
|
|
14
|
+
## 2. 背景与动机 (Background)
|
|
15
|
+
- 当前存在什么问题或缺失?
|
|
16
|
+
- 为什么现在需要构建这个功能?
|
|
17
|
+
- 对用户/业务的价值是什么?
|
|
18
|
+
|
|
19
|
+
## 3. 用户故事 (User Stories)
|
|
20
|
+
- 作为 **[用户角色]**,我希望 **[完成某操作]**,以便 **[获得某价值]**
|
|
21
|
+
(列出 2-4 个核心用户故事,覆盖主要使用场景)
|
|
22
|
+
|
|
23
|
+
## 4. 功能需求 (Functional Requirements)
|
|
24
|
+
|
|
25
|
+
### 4.1 核心功能
|
|
26
|
+
- [ ] 需求 1:详细描述期望行为
|
|
27
|
+
- [ ] 需求 2:详细描述期望行为
|
|
28
|
+
|
|
29
|
+
### 4.2 边界条件与错误处理
|
|
30
|
+
- 输入验证规则(字段类型、长度、格式要求)
|
|
31
|
+
- 错误场景及对应的处理策略
|
|
32
|
+
- 权限控制要求(哪些角色可以访问)
|
|
33
|
+
|
|
34
|
+
## 5. API 设计 (API Design)
|
|
35
|
+
|
|
36
|
+
### 接口列表
|
|
37
|
+
| Method | Endpoint | Auth Required | Description |
|
|
38
|
+
|--------|----------|:-------------:|-------------|
|
|
39
|
+
| POST | /api/... | ✅ | 创建... |
|
|
40
|
+
| GET | /api/... | ✅ | 获取... |
|
|
41
|
+
|
|
42
|
+
### 请求/响应示例
|
|
43
|
+
|
|
44
|
+
**[接口名称]**
|
|
45
|
+
|
|
46
|
+
\`\`\`
|
|
47
|
+
POST /api/example
|
|
48
|
+
Authorization: Bearer {token}
|
|
49
|
+
Content-Type: application/json
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
请求体:
|
|
53
|
+
\`\`\`json
|
|
54
|
+
{
|
|
55
|
+
"field1": "string",
|
|
56
|
+
"field2": 0
|
|
57
|
+
}
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
成功响应 (200):
|
|
61
|
+
\`\`\`json
|
|
62
|
+
{
|
|
63
|
+
"code": 0,
|
|
64
|
+
"message": "success",
|
|
65
|
+
"data": {}
|
|
66
|
+
}
|
|
67
|
+
\`\`\`
|
|
68
|
+
|
|
69
|
+
错误响应:
|
|
70
|
+
\`\`\`json
|
|
71
|
+
{
|
|
72
|
+
"code": 40001,
|
|
73
|
+
"message": "错误描述"
|
|
74
|
+
}
|
|
75
|
+
\`\`\`
|
|
76
|
+
|
|
77
|
+
## 6. 数据模型 (Data Model)
|
|
78
|
+
描述需要新增或修改的数据库表/字段(使用 Prisma Schema 格式)。
|
|
79
|
+
|
|
80
|
+
\`\`\`prisma
|
|
81
|
+
model ExampleModel {
|
|
82
|
+
id Int @id @default(autoincrement())
|
|
83
|
+
createdAt DateTime @default(now())
|
|
84
|
+
updatedAt DateTime @updatedAt
|
|
85
|
+
}
|
|
86
|
+
\`\`\`
|
|
87
|
+
|
|
88
|
+
## 7. 非功能性需求 (Non-functional Requirements)
|
|
89
|
+
- **性能**: 接口响应时间要求,并发量预估
|
|
90
|
+
- **安全**: 认证授权机制,敏感数据的处理方式
|
|
91
|
+
- **可靠性**: 幂等性要求,重试策略
|
|
92
|
+
- **可维护性**: 日志记录要求,监控指标
|
|
93
|
+
|
|
94
|
+
## 8. 实施要点 (Implementation Notes)
|
|
95
|
+
- **集成点**: 需要与哪些现有模块、服务或外部 API 交互
|
|
96
|
+
- **实施顺序**: 建议的开发步骤(例:数据模型 → 服务层 → 控制器 → 路由 → 测试)
|
|
97
|
+
- **技术注意事项**: 潜在的技术难点,推荐的库或实现方案
|
|
98
|
+
- **测试要点**: 关键的单元测试和集成测试场景
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
根据用户的想法和项目上下文生成上述完整 Spec。确保 API 设计与现有项目的路由风格、错误码规范保持一致,数据模型与现有 Prisma Schema 协调。`;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const tasksSystemPrompt = `You are a Senior Software Architect. Decompose the provided Feature Spec into an ordered list of discrete implementation tasks.
|
|
2
|
+
|
|
3
|
+
Output ONLY a valid JSON array. No markdown fences, no explanation.
|
|
4
|
+
|
|
5
|
+
Each task object must have these exact fields:
|
|
6
|
+
{
|
|
7
|
+
"id": "TASK-001", // sequential, zero-padded
|
|
8
|
+
"title": "...", // short action phrase, e.g. "Add UserFavorite Prisma model"
|
|
9
|
+
"description": "...", // 1-2 sentences, specific and actionable
|
|
10
|
+
"layer": "data|service|api|test|infra", // implementation layer
|
|
11
|
+
"filesToTouch": ["..."], // VERIFIED paths only — see rules below
|
|
12
|
+
"acceptanceCriteria": ["..."], // verifiable completion conditions
|
|
13
|
+
"dependencies": ["TASK-001"], // task ids that must complete first (empty array if none)
|
|
14
|
+
"priority": "high|medium|low"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Layer ordering guidance (implement in this order):
|
|
18
|
+
1. "data" — DB schema changes, migrations, seed data
|
|
19
|
+
2. "infra" — config, env vars, external service setup
|
|
20
|
+
3. "service" — business logic, service classes
|
|
21
|
+
4. "api" — controllers, routes, middleware, validators
|
|
22
|
+
5. "test" — unit tests, integration tests
|
|
23
|
+
|
|
24
|
+
CRITICAL — filesToTouch Rules (hallucination prevention):
|
|
25
|
+
- ONLY use paths that appear in the "Verified File Inventory" section of the prompt.
|
|
26
|
+
- For NEW files that don't exist yet, derive the path by following the naming pattern of sibling files already in the inventory (same directory, same extension, same casing).
|
|
27
|
+
- For EXISTING singleton files (i18n, constants, enums, route index), you MUST use the exact path from the inventory. NEVER invent a sub-path or nested variant.
|
|
28
|
+
- If you are unsure of the exact path for a new file, leave it as "TBD:<description>" rather than guessing.
|
|
29
|
+
- Cross-check: after writing all tasks, verify every path in filesToTouch exists in the inventory or is a logical new sibling. If it doesn't pass this check, fix it.
|
|
30
|
+
|
|
31
|
+
Other rules:
|
|
32
|
+
- acceptanceCriteria must be verifiable (not vague like "works correctly")
|
|
33
|
+
- dependencies must reflect real implementation order
|
|
34
|
+
- Aim for 4-10 tasks total — not too granular, not too coarse
|
|
35
|
+
- Each task should be completable in one focused coding session`;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export const testGenSystemPrompt = `You are a Senior QA Engineer generating test skeletons for a Node.js/TypeScript project.
|
|
2
|
+
|
|
3
|
+
Rules:
|
|
4
|
+
1. Output ONLY a JSON array — no markdown fences, no explanations outside the JSON
|
|
5
|
+
2. Generate test files using the project's existing test framework (Jest or Vitest)
|
|
6
|
+
3. Each test file must import the module under test and follow existing test patterns
|
|
7
|
+
4. Generate describe/it blocks with meaningful test names — do NOT implement assertions, use placeholder comments
|
|
8
|
+
5. Cover: happy path, validation errors, auth checks, edge cases per the DSL
|
|
9
|
+
6. For each endpoint, generate at least: one success test, one validation error test, one auth test (if auth=true)
|
|
10
|
+
7. For each model, generate at least: one creation test, one unique constraint test (if unique fields exist)
|
|
11
|
+
8. Keep test structure flat — max 2 levels of describe nesting
|
|
12
|
+
9. Use relative imports matching the project structure
|
|
13
|
+
10. Output format: JSON array of {"file": "relative/path", "content": "full source"}`;
|
|
14
|
+
|
|
15
|
+
// ─── TDD Test Generation (real assertions, not skeletons) ─────────────────────
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* TDD mode: generate tests with REAL assertions based on the DSL.
|
|
19
|
+
* These tests are written BEFORE implementation and are expected to fail initially.
|
|
20
|
+
* The error feedback loop then drives the implementation to make them pass.
|
|
21
|
+
*/
|
|
22
|
+
export const tddTestGenSystemPrompt = `You are a Senior QA Engineer writing TDD tests for a Node.js/TypeScript project.
|
|
23
|
+
|
|
24
|
+
These tests are written BEFORE the implementation exists. They MUST:
|
|
25
|
+
1. Have real, executable assertions — NO "TODO" comments, NO placeholder stubs
|
|
26
|
+
2. Be runnable immediately (they should FAIL with "module not found" or assertion errors, not syntax errors)
|
|
27
|
+
3. Use supertest for HTTP endpoint tests, or direct function imports for service/unit tests
|
|
28
|
+
4. Cover: happy path, validation errors (400), auth errors (401/403), not-found (404)
|
|
29
|
+
|
|
30
|
+
Rules:
|
|
31
|
+
1. Output ONLY a JSON array — no markdown fences, no explanations outside the JSON
|
|
32
|
+
2. Generate test files using the project's existing test framework (Jest or Vitest)
|
|
33
|
+
3. Use supertest for endpoint integration tests: import request from 'supertest'; import app from '../src/app'
|
|
34
|
+
4. For each endpoint:
|
|
35
|
+
- Success case: correct request → assert status + response shape (e.g. expect(res.body.data.id).toBeDefined())
|
|
36
|
+
- Validation error: missing/invalid field → assert 400 + correct error code
|
|
37
|
+
- Auth test (if auth=true): missing token → assert 401
|
|
38
|
+
5. For each model with unique fields: test that duplicate creation returns 409 or the project's conflict code
|
|
39
|
+
6. Assert specific fields and codes from the DSL — never use "expect(res.status).not.toBe(500)" as a substitute
|
|
40
|
+
7. Use beforeAll/afterAll for test setup/teardown if needed
|
|
41
|
+
8. Keep test structure flat — max 2 levels of describe nesting
|
|
42
|
+
9. Use relative imports matching the project structure
|
|
43
|
+
10. Output format: JSON array of {"file": "relative/path", "content": "full source"}
|
|
44
|
+
|
|
45
|
+
Example of a CORRECT TDD test (with real assertions):
|
|
46
|
+
\`\`\`
|
|
47
|
+
it('POST /api/v1/tasks → 201 with task data', async () => {
|
|
48
|
+
const res = await request(app)
|
|
49
|
+
.post('/api/v1/tasks')
|
|
50
|
+
.set('Authorization', 'Bearer test-token')
|
|
51
|
+
.send({ title: 'My task', status: 'todo', dueDate: '2026-12-31' });
|
|
52
|
+
expect(res.status).toBe(201);
|
|
53
|
+
expect(res.body.code).toBe(0);
|
|
54
|
+
expect(res.body.data).toMatchObject({ title: 'My task', status: 'todo' });
|
|
55
|
+
expect(res.body.data.id).toBeDefined();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('POST /api/v1/tasks → 400 MISSING_FIELD when title absent', async () => {
|
|
59
|
+
const res = await request(app)
|
|
60
|
+
.post('/api/v1/tasks')
|
|
61
|
+
.set('Authorization', 'Bearer test-token')
|
|
62
|
+
.send({ status: 'todo' });
|
|
63
|
+
expect(res.status).toBe(400);
|
|
64
|
+
expect(res.body.code).toBe('MISSING_FIELD');
|
|
65
|
+
});
|
|
66
|
+
\`\`\``;
|
|
67
|
+
|
|
68
|
+
export const testGenFrontendSystemPrompt = `You are a Senior Frontend QA Engineer generating test skeletons for a React/Vue/Next.js project.
|
|
69
|
+
|
|
70
|
+
Rules:
|
|
71
|
+
1. Output ONLY a JSON array — no markdown fences, no explanations outside the JSON
|
|
72
|
+
2. Use React Testing Library (@testing-library/react) for component tests unless the project uses Cypress, in which case generate Cypress spec files
|
|
73
|
+
3. Generate describe/it (or describe/test) blocks with meaningful names — do NOT implement assertions, use TODO comments
|
|
74
|
+
4. For each component spec (CMP-*):
|
|
75
|
+
- One render test: "renders without crashing"
|
|
76
|
+
- One prop test per required prop: "renders correctly with <prop>"
|
|
77
|
+
- One interaction test per event: "calls <handler> when <action>"
|
|
78
|
+
- One loading state test if the component has async API calls
|
|
79
|
+
5. For API call tests, test the custom hook if present, not the component directly
|
|
80
|
+
6. Optimistic update flows: add a test for the rollback case (simulate server error)
|
|
81
|
+
7. For throttle/debounce: add a test that verifies the delay behavior with jest.useFakeTimers()
|
|
82
|
+
8. Keep test structure flat — max 2 levels of describe nesting
|
|
83
|
+
9. Use relative imports matching project structure — import from existing hook/service files
|
|
84
|
+
10. Output format: JSON array of {"file": "relative/path", "content": "full source"}`;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { SpecDSL } from "../core/dsl-types";
|
|
2
|
+
import { ProjectContext } from "../core/context-loader";
|
|
3
|
+
|
|
4
|
+
// ─── System Prompt ────────────────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
export const specUpdateSystemPrompt = `You are a Senior Software Architect updating an existing Feature Spec based on a change request.
|
|
7
|
+
|
|
8
|
+
Rules:
|
|
9
|
+
1. Read the EXISTING spec carefully — understand what is already designed.
|
|
10
|
+
2. Apply ONLY the changes described in the change request. Do not rewrite sections that are not affected.
|
|
11
|
+
3. Preserve the original spec structure, headings, and wording for unchanged sections.
|
|
12
|
+
4. For changed sections: update them in place. Clearly integrate new requirements.
|
|
13
|
+
5. If a change is additive (new endpoint, new field), append it in the correct section.
|
|
14
|
+
6. If a change is a modification, update the existing content — do not duplicate it.
|
|
15
|
+
7. Output the COMPLETE updated spec in Markdown. All original sections must be present.
|
|
16
|
+
8. Do NOT add a changelog or "Changes in v2" annotation inside the spec body — the versioning is handled externally.
|
|
17
|
+
|
|
18
|
+
Output: the full updated Markdown spec, nothing else.`;
|
|
19
|
+
|
|
20
|
+
export const dslUpdateSystemPrompt = `You are a precise DSL extractor updating an existing SpecDSL JSON based on a change request.
|
|
21
|
+
|
|
22
|
+
You will receive:
|
|
23
|
+
- The ORIGINAL DSL (JSON)
|
|
24
|
+
- The UPDATED spec (Markdown)
|
|
25
|
+
- The CHANGE DESCRIPTION
|
|
26
|
+
|
|
27
|
+
Rules:
|
|
28
|
+
1. Output a COMPLETE updated DSL JSON that represents the full updated spec.
|
|
29
|
+
2. Preserve all unchanged endpoints, models, and behaviors exactly.
|
|
30
|
+
3. For changed or new items: apply the change precisely.
|
|
31
|
+
4. For removed items: omit them from the output.
|
|
32
|
+
5. Follow the same DSL structure: version, feature, models, endpoints, behaviors, components.
|
|
33
|
+
6. Output ONLY valid JSON — no markdown fences, no explanations.`;
|
|
34
|
+
|
|
35
|
+
// ─── User Prompts ─────────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
export function buildSpecUpdatePrompt(
|
|
38
|
+
changeRequest: string,
|
|
39
|
+
existingSpec: string,
|
|
40
|
+
existingDsl: SpecDSL | null,
|
|
41
|
+
context?: ProjectContext
|
|
42
|
+
): string {
|
|
43
|
+
const constitutionSection = context?.constitution
|
|
44
|
+
? `\n=== Project Constitution (all changes must comply) ===\n${context.constitution.slice(0, 1500)}\n`
|
|
45
|
+
: "";
|
|
46
|
+
|
|
47
|
+
const dslSummary = existingDsl
|
|
48
|
+
? `\n=== Current DSL Summary (for reference) ===
|
|
49
|
+
Feature: ${existingDsl.feature.title}
|
|
50
|
+
Models: ${existingDsl.models.map((m) => m.name).join(", ") || "none"}
|
|
51
|
+
Endpoints: ${existingDsl.endpoints.map((e) => `${e.method} ${e.path}`).join(", ") || "none"}
|
|
52
|
+
Behaviors: ${existingDsl.behaviors.length}
|
|
53
|
+
\n`
|
|
54
|
+
: "";
|
|
55
|
+
|
|
56
|
+
return `You are updating an existing Feature Spec.
|
|
57
|
+
|
|
58
|
+
=== Change Request ===
|
|
59
|
+
${changeRequest}
|
|
60
|
+
${constitutionSection}${dslSummary}
|
|
61
|
+
=== Existing Spec (update this) ===
|
|
62
|
+
${existingSpec}
|
|
63
|
+
|
|
64
|
+
Apply the change request to the spec above. Output the complete updated spec in Markdown.`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function buildDslUpdatePrompt(
|
|
68
|
+
changeRequest: string,
|
|
69
|
+
originalDsl: SpecDSL,
|
|
70
|
+
updatedSpec: string
|
|
71
|
+
): string {
|
|
72
|
+
return `Update the DSL JSON to reflect the following changes.
|
|
73
|
+
|
|
74
|
+
=== Change Request ===
|
|
75
|
+
${changeRequest}
|
|
76
|
+
|
|
77
|
+
=== Original DSL (JSON) ===
|
|
78
|
+
${JSON.stringify(originalDsl, null, 2)}
|
|
79
|
+
|
|
80
|
+
=== Updated Spec (Markdown — the source of truth) ===
|
|
81
|
+
${updatedSpec}
|
|
82
|
+
|
|
83
|
+
Output the complete updated DSL JSON only. No markdown fences.`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function buildAffectedFilesPrompt(
|
|
87
|
+
changeRequest: string,
|
|
88
|
+
originalDsl: SpecDSL,
|
|
89
|
+
updatedDsl: SpecDSL,
|
|
90
|
+
projectFileStructure: string[]
|
|
91
|
+
): string {
|
|
92
|
+
// Compute a simple diff summary
|
|
93
|
+
const addedEndpoints = updatedDsl.endpoints.filter(
|
|
94
|
+
(e) => !originalDsl.endpoints.find((o) => o.id === e.id)
|
|
95
|
+
);
|
|
96
|
+
const modifiedEndpoints = updatedDsl.endpoints.filter((e) => {
|
|
97
|
+
const orig = originalDsl.endpoints.find((o) => o.id === e.id);
|
|
98
|
+
return orig && JSON.stringify(orig) !== JSON.stringify(e);
|
|
99
|
+
});
|
|
100
|
+
const addedModels = updatedDsl.models.filter(
|
|
101
|
+
(m) => !originalDsl.models.find((o) => o.name === m.name)
|
|
102
|
+
);
|
|
103
|
+
const modifiedModels = updatedDsl.models.filter((m) => {
|
|
104
|
+
const orig = originalDsl.models.find((o) => o.name === m.name);
|
|
105
|
+
return orig && JSON.stringify(orig) !== JSON.stringify(m);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const diffLines: string[] = [];
|
|
109
|
+
if (addedEndpoints.length) diffLines.push(`Added endpoints: ${addedEndpoints.map((e) => `${e.method} ${e.path}`).join(", ")}`);
|
|
110
|
+
if (modifiedEndpoints.length) diffLines.push(`Modified endpoints: ${modifiedEndpoints.map((e) => `${e.method} ${e.path}`).join(", ")}`);
|
|
111
|
+
if (addedModels.length) diffLines.push(`Added models: ${addedModels.map((m) => m.name).join(", ")}`);
|
|
112
|
+
if (modifiedModels.length) diffLines.push(`Modified models: ${modifiedModels.map((m) => m.name).join(", ")}`);
|
|
113
|
+
|
|
114
|
+
return `Given the DSL change below, list ONLY the files that need to be created or modified.
|
|
115
|
+
Do not include files that are not affected by this change.
|
|
116
|
+
|
|
117
|
+
=== Change Summary ===
|
|
118
|
+
${changeRequest}
|
|
119
|
+
|
|
120
|
+
=== DSL Delta ===
|
|
121
|
+
${diffLines.join("\n") || "Minor internal changes — determine affected files from the change request."}
|
|
122
|
+
|
|
123
|
+
=== Existing Files ===
|
|
124
|
+
${projectFileStructure.slice(0, 50).join("\n")}
|
|
125
|
+
|
|
126
|
+
Output ONLY a valid JSON array:
|
|
127
|
+
[
|
|
128
|
+
{"file": "src/controllers/userController.ts", "action": "modify", "description": "Add new endpoint handler"},
|
|
129
|
+
{"file": "src/routes/client/index.ts", "action": "modify", "description": "Register new route"}
|
|
130
|
+
]`;
|
|
131
|
+
}
|
package/purpose.docx
ADDED
|
Binary file
|