my-dev-kit-orchestrator 0.2.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.
- package/README.md +206 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +7 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +59 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +101 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/prompt.d.ts +3 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/prompt.js +122 -0
- package/dist/commands/prompt.js.map +1 -0
- package/dist/commands/start.d.ts +3 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +75 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +120 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +3 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +27 -0
- package/dist/program.js.map +1 -0
- package/dist/promptGenerator.d.ts +4 -0
- package/dist/promptGenerator.d.ts.map +1 -0
- package/dist/promptGenerator.js +1332 -0
- package/dist/promptGenerator.js.map +1 -0
- package/dist/run.d.ts +26 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +139 -0
- package/dist/run.js.map +1 -0
- package/dist/stageDetector.d.ts +18 -0
- package/dist/stageDetector.d.ts.map +1 -0
- package/dist/stageDetector.js +88 -0
- package/dist/stageDetector.js.map +1 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/workflows.d.ts +15 -0
- package/dist/workflows.d.ts.map +1 -0
- package/dist/workflows.js +140 -0
- package/dist/workflows.js.map +1 -0
- package/dist/workspace.d.ts +13 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +70 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,1332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.generateStagePrompt = generateStagePrompt;
|
|
37
|
+
exports.writeStagePrompts = writeStagePrompts;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
function header(ctx) {
|
|
41
|
+
return [
|
|
42
|
+
`Stage: ${ctx.stage}`,
|
|
43
|
+
`Workflow mode: ${ctx.mode}`,
|
|
44
|
+
`Run ID: ${ctx.runId}`,
|
|
45
|
+
`Project root: ${ctx.projectRoot}`,
|
|
46
|
+
`Run folder: ${ctx.runFolder}`,
|
|
47
|
+
'',
|
|
48
|
+
].join('\n');
|
|
49
|
+
}
|
|
50
|
+
// ─── Core shared stages ───────────────────────────────────────────────────────
|
|
51
|
+
function requestBriefPrompt(ctx) {
|
|
52
|
+
return `${header(ctx)}
|
|
53
|
+
Inputs:
|
|
54
|
+
- original request: ${ctx.runFolder}/00-request.txt
|
|
55
|
+
|
|
56
|
+
Task:
|
|
57
|
+
Produce ${ctx.runFolder}/artifacts/request-brief.txt (artifact: RequestBrief).
|
|
58
|
+
|
|
59
|
+
The RequestBrief must define:
|
|
60
|
+
- original request (verbatim from 00-request.txt)
|
|
61
|
+
- requested change
|
|
62
|
+
- target area (project, component, workflow, or command) if identifiable
|
|
63
|
+
- user-visible or externally observable behavior
|
|
64
|
+
- constraints
|
|
65
|
+
- non-goals
|
|
66
|
+
- success criteria
|
|
67
|
+
- ambiguity or missing information
|
|
68
|
+
- expected next stage: architecture-context
|
|
69
|
+
|
|
70
|
+
Required output artifact: RequestBrief
|
|
71
|
+
Output file: ${ctx.runFolder}/artifacts/request-brief.txt
|
|
72
|
+
|
|
73
|
+
Stop conditions:
|
|
74
|
+
- do not inspect code deeply in this stage
|
|
75
|
+
- do not write pseudocode
|
|
76
|
+
- do not write tests
|
|
77
|
+
- do not implement code
|
|
78
|
+
|
|
79
|
+
Return format:
|
|
80
|
+
Produce the artifact as a plain-text file using the template:
|
|
81
|
+
Artifact: RequestBrief
|
|
82
|
+
Workflow mode: ...
|
|
83
|
+
Original request: ...
|
|
84
|
+
Requested change: ...
|
|
85
|
+
Target area: ...
|
|
86
|
+
User-visible or external behavior: ...
|
|
87
|
+
Constraints: ...
|
|
88
|
+
Non-goals: ...
|
|
89
|
+
Success criteria: ...
|
|
90
|
+
Ambiguity or missing information: ...
|
|
91
|
+
Expected next stage: architecture-context
|
|
92
|
+
Status: complete | incomplete | blocked
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
function architectureContextPrompt(ctx) {
|
|
96
|
+
return `${header(ctx)}
|
|
97
|
+
Inputs:
|
|
98
|
+
- ${ctx.runFolder}/artifacts/request-brief.txt
|
|
99
|
+
- project root: ${ctx.projectRoot}
|
|
100
|
+
|
|
101
|
+
Task:
|
|
102
|
+
Retrieve bounded project context and synthesize it into the required workflow artifact.
|
|
103
|
+
|
|
104
|
+
Produce two output files:
|
|
105
|
+
1. Supporting retrieval report: ${ctx.runFolder}/reports/architecture-context-retrieval-report.txt
|
|
106
|
+
2. Required workflow artifact: ${ctx.runFolder}/artifacts/architecture-context-packet.txt (artifact: ArchitectureContextPacket)
|
|
107
|
+
|
|
108
|
+
Later workflow stages consume ArchitectureContextPacket.
|
|
109
|
+
Do not dump raw retrieval output directly into ArchitectureContextPacket.
|
|
110
|
+
Synthesize retrieval evidence into the artifact before writing it.
|
|
111
|
+
|
|
112
|
+
Graph-guided context acquisition sequence (when my-dev-kit is available):
|
|
113
|
+
|
|
114
|
+
Step 1 — Index or refresh the target repository:
|
|
115
|
+
npx @dailephd/my-dev-kit index --root . --src src --out .my-dev-kit --call-graph --json
|
|
116
|
+
|
|
117
|
+
Step 2 — Search for task-specific candidate nodes:
|
|
118
|
+
npx @dailephd/my-dev-kit search --index .my-dev-kit --query "<task-specific term>" --limit 20 --json
|
|
119
|
+
Run multiple queries for different aspects of the request.
|
|
120
|
+
|
|
121
|
+
Step 3 — Look up selected nodes and their relationships:
|
|
122
|
+
npx @dailephd/my-dev-kit lookup --index .my-dev-kit --node "<selected-node-id>" --depth 1 --json
|
|
123
|
+
|
|
124
|
+
Step 4 — Slice around the strongest relevant node:
|
|
125
|
+
npx @dailephd/my-dev-kit slice --index .my-dev-kit --node "<strongest-node-id>" --depth 2 --direction both --out .my-dev-kit/<task-name>-slice.json --json
|
|
126
|
+
|
|
127
|
+
Step 5 — Retrieve exact symbol source (preferred):
|
|
128
|
+
npx @dailephd/my-dev-kit source --index .my-dev-kit --node "<symbol-node-id>" --max-lines 160 --format numbered
|
|
129
|
+
or:
|
|
130
|
+
npx @dailephd/my-dev-kit source --index .my-dev-kit --file "<file-path>" --symbol "<symbol-name>" --max-lines 160 --format numbered
|
|
131
|
+
|
|
132
|
+
Step 6 — Use line-range retrieval only as fallback when symbol retrieval is insufficient:
|
|
133
|
+
npx @dailephd/my-dev-kit source --index .my-dev-kit --file "<file-path>" --start <start-line> --end <end-line> --max-lines <cap> --format numbered
|
|
134
|
+
|
|
135
|
+
Step 7 — Inspect semantic artifacts, tests, docs, or data-model artifacts only when relevant to the task.
|
|
136
|
+
|
|
137
|
+
Step 8 — Avoid whole-file reading unless bounded retrieval is insufficient. If a whole file must be read, state why.
|
|
138
|
+
|
|
139
|
+
If my-dev-kit is unavailable, use focused manual inspection of relevant files and symbols. Document what was inspected, why, and what bounded context was gathered.
|
|
140
|
+
|
|
141
|
+
The ArchitectureContextPacket must identify:
|
|
142
|
+
- relevant files
|
|
143
|
+
- relevant symbols
|
|
144
|
+
- relevant components, modules, routes, commands, services, or data boundaries
|
|
145
|
+
- relevant tests
|
|
146
|
+
- relevant docs
|
|
147
|
+
- state owners and data owners
|
|
148
|
+
- upstream dependencies
|
|
149
|
+
- downstream consumers
|
|
150
|
+
- existing patterns to preserve
|
|
151
|
+
- likely files or modules involved in this change
|
|
152
|
+
- context gaps or uncertainty
|
|
153
|
+
- selection rationale for each major file or symbol chosen
|
|
154
|
+
|
|
155
|
+
Required output artifact: ArchitectureContextPacket
|
|
156
|
+
Output file: ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
157
|
+
|
|
158
|
+
Supporting report output file: ${ctx.runFolder}/reports/architecture-context-retrieval-report.txt
|
|
159
|
+
|
|
160
|
+
Stop conditions:
|
|
161
|
+
- do not redesign the feature
|
|
162
|
+
- do not write pseudocode
|
|
163
|
+
- do not implement code
|
|
164
|
+
- do not write test files
|
|
165
|
+
- do not claim implementation or test implementation work in this stage
|
|
166
|
+
|
|
167
|
+
Return format:
|
|
168
|
+
|
|
169
|
+
Write the supporting retrieval report using this template:
|
|
170
|
+
|
|
171
|
+
Retrieval evidence report
|
|
172
|
+
|
|
173
|
+
Index artifacts used:
|
|
174
|
+
- Index directory:
|
|
175
|
+
- Refreshed or reused:
|
|
176
|
+
- manifest.json status:
|
|
177
|
+
- Semantic artifacts available:
|
|
178
|
+
|
|
179
|
+
Search queries run:
|
|
180
|
+
- Query:
|
|
181
|
+
Reason:
|
|
182
|
+
|
|
183
|
+
Candidate nodes selected:
|
|
184
|
+
- Node ID:
|
|
185
|
+
Reason:
|
|
186
|
+
|
|
187
|
+
Lookup commands run:
|
|
188
|
+
- Node ID:
|
|
189
|
+
Useful relationships found:
|
|
190
|
+
|
|
191
|
+
Graph slices created:
|
|
192
|
+
- Focus node:
|
|
193
|
+
- Depth:
|
|
194
|
+
- Direction:
|
|
195
|
+
- Output path:
|
|
196
|
+
- Reason:
|
|
197
|
+
|
|
198
|
+
Source symbols retrieved:
|
|
199
|
+
- Symbol node ID:
|
|
200
|
+
- File path:
|
|
201
|
+
- Reason:
|
|
202
|
+
|
|
203
|
+
Line-range fallback retrieval used:
|
|
204
|
+
- File path or none:
|
|
205
|
+
- Lines:
|
|
206
|
+
- Reason:
|
|
207
|
+
|
|
208
|
+
Full files read beyond retrieved source:
|
|
209
|
+
- File path or none:
|
|
210
|
+
- Reason:
|
|
211
|
+
- Missing context provided:
|
|
212
|
+
|
|
213
|
+
Semantic artifacts inspected:
|
|
214
|
+
- Artifact or command:
|
|
215
|
+
- Reason:
|
|
216
|
+
|
|
217
|
+
Context gaps or uncertainty:
|
|
218
|
+
- Gap:
|
|
219
|
+
Impact:
|
|
220
|
+
|
|
221
|
+
Then write ArchitectureContextPacket using this template:
|
|
222
|
+
|
|
223
|
+
Artifact: ArchitectureContextPacket
|
|
224
|
+
Workflow mode: ...
|
|
225
|
+
Project root: ...
|
|
226
|
+
|
|
227
|
+
Retrieval evidence used:
|
|
228
|
+
- Retrieval report: ${ctx.runFolder}/reports/architecture-context-retrieval-report.txt
|
|
229
|
+
- Index directory:
|
|
230
|
+
- Graph slice files:
|
|
231
|
+
- Source excerpts:
|
|
232
|
+
- Semantic artifacts:
|
|
233
|
+
|
|
234
|
+
Retrieval method:
|
|
235
|
+
- my-dev-kit used: yes | no
|
|
236
|
+
- graph-guided retrieval used: yes | no
|
|
237
|
+
- manual inspection used: yes | no
|
|
238
|
+
|
|
239
|
+
Relevant files: ...
|
|
240
|
+
Relevant symbols: ...
|
|
241
|
+
Relevant components / modules / commands / routes / services / boundaries: ...
|
|
242
|
+
Relevant tests: ...
|
|
243
|
+
Relevant docs: ...
|
|
244
|
+
State owners: ...
|
|
245
|
+
Data owners: ...
|
|
246
|
+
Upstream dependencies: ...
|
|
247
|
+
Downstream consumers: ...
|
|
248
|
+
Existing patterns to preserve: ...
|
|
249
|
+
Likely files or modules involved: ...
|
|
250
|
+
Context gaps or uncertainty: ...
|
|
251
|
+
Selection rationale: ...
|
|
252
|
+
Expected next stage: (next in workflow)
|
|
253
|
+
Status: complete | incomplete | blocked
|
|
254
|
+
`;
|
|
255
|
+
}
|
|
256
|
+
function behaviorModelPrompt(ctx) {
|
|
257
|
+
return `${header(ctx)}
|
|
258
|
+
Inputs:
|
|
259
|
+
- ${ctx.runFolder}/artifacts/request-brief.txt
|
|
260
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
261
|
+
|
|
262
|
+
Task:
|
|
263
|
+
Produce ${ctx.runFolder}/artifacts/behavior-model.txt (artifact: BehaviorModel).
|
|
264
|
+
|
|
265
|
+
Define intended behavior before pseudocode, implementation, or test writing begins.
|
|
266
|
+
|
|
267
|
+
The BehaviorModel must define:
|
|
268
|
+
- behavior summary
|
|
269
|
+
- externally visible behavior
|
|
270
|
+
- internal supporting behavior
|
|
271
|
+
- state variables
|
|
272
|
+
- inputs
|
|
273
|
+
- events
|
|
274
|
+
- derived values
|
|
275
|
+
- invariants
|
|
276
|
+
- valid states
|
|
277
|
+
- invalid states
|
|
278
|
+
- boundaries and partitions
|
|
279
|
+
- empty states
|
|
280
|
+
- error states
|
|
281
|
+
- loading or pending states when relevant
|
|
282
|
+
- external contracts
|
|
283
|
+
- state transitions
|
|
284
|
+
- behavior to preserve
|
|
285
|
+
- behavior intentionally changed
|
|
286
|
+
- unresolved design questions
|
|
287
|
+
|
|
288
|
+
Required output artifact: BehaviorModel
|
|
289
|
+
Output file: ${ctx.runFolder}/artifacts/behavior-model.txt
|
|
290
|
+
|
|
291
|
+
Stop conditions:
|
|
292
|
+
- do not write production code
|
|
293
|
+
- do not write test files
|
|
294
|
+
- do not produce implementation-specific code
|
|
295
|
+
|
|
296
|
+
Return format:
|
|
297
|
+
Produce the artifact as a plain-text file following the BehaviorModel template.
|
|
298
|
+
Artifact: BehaviorModel
|
|
299
|
+
Workflow mode: ...
|
|
300
|
+
Inputs used: ...
|
|
301
|
+
Behavior summary: ...
|
|
302
|
+
[all required sections]
|
|
303
|
+
Status: complete | incomplete | blocked
|
|
304
|
+
`;
|
|
305
|
+
}
|
|
306
|
+
function pseudocodePacketPrompt(ctx) {
|
|
307
|
+
return `${header(ctx)}
|
|
308
|
+
Inputs:
|
|
309
|
+
- ${ctx.runFolder}/artifacts/request-brief.txt
|
|
310
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
311
|
+
- ${ctx.runFolder}/artifacts/behavior-model.txt
|
|
312
|
+
|
|
313
|
+
Task:
|
|
314
|
+
Produce ${ctx.runFolder}/artifacts/pseudocode-packet.txt (artifact: PseudocodePacket).
|
|
315
|
+
|
|
316
|
+
Convert the BehaviorModel into implementation-neutral pseudocode.
|
|
317
|
+
This is the shared design contract for both implementation and testing.
|
|
318
|
+
|
|
319
|
+
The PseudocodePacket must define:
|
|
320
|
+
- behavior references
|
|
321
|
+
- data flow
|
|
322
|
+
- state flow
|
|
323
|
+
- state transitions
|
|
324
|
+
- derived-value rules
|
|
325
|
+
- validation rules
|
|
326
|
+
- empty-state handling
|
|
327
|
+
- error-state handling
|
|
328
|
+
- external contract handling
|
|
329
|
+
- component, module, service, route, command, or helper contracts
|
|
330
|
+
- acceptance criteria
|
|
331
|
+
- likely files or modules to modify
|
|
332
|
+
- implementation constraints
|
|
333
|
+
- assumptions preserved
|
|
334
|
+
- assumptions removed or guarded
|
|
335
|
+
- unresolved implementation questions
|
|
336
|
+
|
|
337
|
+
Required output artifact: PseudocodePacket
|
|
338
|
+
Output file: ${ctx.runFolder}/artifacts/pseudocode-packet.txt
|
|
339
|
+
|
|
340
|
+
Stop conditions:
|
|
341
|
+
- do not write production code
|
|
342
|
+
- do not write test files
|
|
343
|
+
- do not modify files
|
|
344
|
+
|
|
345
|
+
Return format:
|
|
346
|
+
Produce the artifact as a plain-text file following the PseudocodePacket template.
|
|
347
|
+
Artifact: PseudocodePacket
|
|
348
|
+
Workflow mode: ...
|
|
349
|
+
Inputs used: ...
|
|
350
|
+
[all required sections]
|
|
351
|
+
Status: complete | incomplete | blocked
|
|
352
|
+
`;
|
|
353
|
+
}
|
|
354
|
+
function testStrategyPrompt(ctx) {
|
|
355
|
+
return `${header(ctx)}
|
|
356
|
+
Inputs:
|
|
357
|
+
- ${ctx.runFolder}/artifacts/request-brief.txt
|
|
358
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
359
|
+
- ${ctx.runFolder}/artifacts/behavior-model.txt
|
|
360
|
+
- ${ctx.runFolder}/artifacts/pseudocode-packet.txt
|
|
361
|
+
|
|
362
|
+
Task:
|
|
363
|
+
Produce ${ctx.runFolder}/artifacts/test-strategy-packet.txt (artifact: TestStrategyPacket).
|
|
364
|
+
|
|
365
|
+
Derive test responsibilities from the BehaviorModel and PseudocodePacket.
|
|
366
|
+
Do not write test files in this stage.
|
|
367
|
+
|
|
368
|
+
The TestStrategyPacket must identify:
|
|
369
|
+
- behavior under test
|
|
370
|
+
- participating layers
|
|
371
|
+
- state variables
|
|
372
|
+
- events
|
|
373
|
+
- derived values
|
|
374
|
+
- invariants
|
|
375
|
+
- boundaries and partitions
|
|
376
|
+
- external contracts
|
|
377
|
+
- state transitions when relevant
|
|
378
|
+
- relevant failure modes
|
|
379
|
+
- existing tests
|
|
380
|
+
- test matrix
|
|
381
|
+
- test level assignment (unit / component / integration / end-to-end)
|
|
382
|
+
- required verification commands
|
|
383
|
+
- coverage gaps
|
|
384
|
+
- risks not covered and why
|
|
385
|
+
|
|
386
|
+
Each test responsibility must trace to at least one of:
|
|
387
|
+
- behavior
|
|
388
|
+
- invariant
|
|
389
|
+
- state transition
|
|
390
|
+
- derived value
|
|
391
|
+
- boundary
|
|
392
|
+
- external contract
|
|
393
|
+
- failure mode
|
|
394
|
+
|
|
395
|
+
Required output artifact: TestStrategyPacket
|
|
396
|
+
Output file: ${ctx.runFolder}/artifacts/test-strategy-packet.txt
|
|
397
|
+
|
|
398
|
+
Stop conditions:
|
|
399
|
+
- do not write test files in this stage
|
|
400
|
+
- do not write production code
|
|
401
|
+
- do not invent behavior not supported by prior artifacts
|
|
402
|
+
- do not include test responsibilities that cannot be traced to behavior, invariant, transition, derived value, boundary, contract, or failure mode
|
|
403
|
+
|
|
404
|
+
Return format:
|
|
405
|
+
Produce the artifact as a plain-text file following the TestStrategyPacket template.
|
|
406
|
+
Artifact: TestStrategyPacket
|
|
407
|
+
Workflow mode: ...
|
|
408
|
+
Inputs used: ...
|
|
409
|
+
[all required sections]
|
|
410
|
+
Status: complete | incomplete | blocked
|
|
411
|
+
`;
|
|
412
|
+
}
|
|
413
|
+
function implementationPrompt(ctx, extraInputs = []) {
|
|
414
|
+
const inputs = [
|
|
415
|
+
`- ${ctx.runFolder}/artifacts/request-brief.txt`,
|
|
416
|
+
`- ${ctx.runFolder}/artifacts/architecture-context-packet.txt`,
|
|
417
|
+
`- ${ctx.runFolder}/artifacts/behavior-model.txt`,
|
|
418
|
+
`- ${ctx.runFolder}/artifacts/pseudocode-packet.txt`,
|
|
419
|
+
...extraInputs.map((i) => `- ${ctx.runFolder}/artifacts/${i}`),
|
|
420
|
+
].join('\n');
|
|
421
|
+
return `${header(ctx)}
|
|
422
|
+
Inputs:
|
|
423
|
+
${inputs}
|
|
424
|
+
|
|
425
|
+
Task:
|
|
426
|
+
Implement the PseudocodePacket in the current project and produce ${ctx.runFolder}/artifacts/implementation-report.txt (artifact: ImplementationReport).
|
|
427
|
+
|
|
428
|
+
Read required source files and implement from the PseudocodePacket.
|
|
429
|
+
Follow the architecture and patterns identified in the ArchitectureContextPacket.
|
|
430
|
+
Preserve the BehaviorModel.
|
|
431
|
+
|
|
432
|
+
The ImplementationReport must include:
|
|
433
|
+
- files read
|
|
434
|
+
- files changed
|
|
435
|
+
- behavior implemented
|
|
436
|
+
- pseudocode sections implemented
|
|
437
|
+
- assumptions preserved
|
|
438
|
+
- assumptions removed or guarded
|
|
439
|
+
- deviations from the PseudocodePacket
|
|
440
|
+
- reason for each deviation
|
|
441
|
+
- blockers encountered
|
|
442
|
+
- unresolved risks
|
|
443
|
+
- tests that should be run
|
|
444
|
+
- notes for the test implementation stage
|
|
445
|
+
|
|
446
|
+
Required output artifact: ImplementationReport
|
|
447
|
+
Output file: ${ctx.runFolder}/artifacts/implementation-report.txt
|
|
448
|
+
|
|
449
|
+
Stop conditions:
|
|
450
|
+
- do not broaden scope without reporting a blocker
|
|
451
|
+
- do not create parallel architecture
|
|
452
|
+
- do not claim verification success without command evidence
|
|
453
|
+
- do not ignore contradictions in prior artifacts
|
|
454
|
+
- do not modify files outside justified scope
|
|
455
|
+
|
|
456
|
+
Return format:
|
|
457
|
+
Produce the artifact as a plain-text file following the ImplementationReport template.
|
|
458
|
+
Artifact: ImplementationReport
|
|
459
|
+
Workflow mode: ...
|
|
460
|
+
Inputs used: ...
|
|
461
|
+
[all required sections]
|
|
462
|
+
Status: complete | incomplete | blocked
|
|
463
|
+
`;
|
|
464
|
+
}
|
|
465
|
+
function testImplementationPrompt(ctx, extraInputs = []) {
|
|
466
|
+
const inputs = [
|
|
467
|
+
`- ${ctx.runFolder}/artifacts/behavior-model.txt`,
|
|
468
|
+
`- ${ctx.runFolder}/artifacts/pseudocode-packet.txt`,
|
|
469
|
+
`- ${ctx.runFolder}/artifacts/test-strategy-packet.txt`,
|
|
470
|
+
...extraInputs.map((i) => `- ${ctx.runFolder}/artifacts/${i}`),
|
|
471
|
+
`- ${ctx.runFolder}/artifacts/implementation-report.txt (if available)`,
|
|
472
|
+
].join('\n');
|
|
473
|
+
return `${header(ctx)}
|
|
474
|
+
Inputs:
|
|
475
|
+
${inputs}
|
|
476
|
+
|
|
477
|
+
Task:
|
|
478
|
+
Implement tests from the TestStrategyPacket and produce ${ctx.runFolder}/artifacts/test-implementation-report.txt (artifact: TestImplementationReport).
|
|
479
|
+
|
|
480
|
+
Follow the TestStrategyPacket. Do not invent a separate test strategy.
|
|
481
|
+
|
|
482
|
+
The TestImplementationReport must include:
|
|
483
|
+
- test files changed
|
|
484
|
+
- tests added
|
|
485
|
+
- tests updated
|
|
486
|
+
- behaviors covered
|
|
487
|
+
- invariants covered
|
|
488
|
+
- state transitions covered
|
|
489
|
+
- derived values covered
|
|
490
|
+
- boundaries covered
|
|
491
|
+
- external contracts covered
|
|
492
|
+
- failure modes covered
|
|
493
|
+
- TestStrategyPacket items not implemented
|
|
494
|
+
- reason for each missing test
|
|
495
|
+
- verification commands to run
|
|
496
|
+
|
|
497
|
+
Required output artifact: TestImplementationReport
|
|
498
|
+
Output file: ${ctx.runFolder}/artifacts/test-implementation-report.txt
|
|
499
|
+
|
|
500
|
+
Stop conditions:
|
|
501
|
+
- do not replace the TestStrategyPacket with a new unrelated strategy
|
|
502
|
+
- do not change production behavior unless reporting a blocker
|
|
503
|
+
- do not claim tests passed unless command evidence is included
|
|
504
|
+
|
|
505
|
+
Return format:
|
|
506
|
+
Produce the artifact as a plain-text file following the TestImplementationReport template.
|
|
507
|
+
Artifact: TestImplementationReport
|
|
508
|
+
Workflow mode: ...
|
|
509
|
+
[all required sections]
|
|
510
|
+
Status: complete | incomplete | blocked
|
|
511
|
+
`;
|
|
512
|
+
}
|
|
513
|
+
function verificationPrompt(ctx) {
|
|
514
|
+
return `${header(ctx)}
|
|
515
|
+
Inputs:
|
|
516
|
+
- ${ctx.runFolder}/artifacts/test-strategy-packet.txt
|
|
517
|
+
- ${ctx.runFolder}/artifacts/implementation-report.txt
|
|
518
|
+
- ${ctx.runFolder}/artifacts/test-implementation-report.txt
|
|
519
|
+
|
|
520
|
+
Task:
|
|
521
|
+
Run the required verification commands and produce ${ctx.runFolder}/artifacts/verification-report.txt (artifact: VerificationReport).
|
|
522
|
+
|
|
523
|
+
Use the commands identified in the TestStrategyPacket, ImplementationReport, and TestImplementationReport.
|
|
524
|
+
Run the narrowest relevant checks first, then broader validation.
|
|
525
|
+
|
|
526
|
+
The VerificationReport must include:
|
|
527
|
+
- commands run
|
|
528
|
+
- working directory for each command
|
|
529
|
+
- exit codes
|
|
530
|
+
- pass/fail status
|
|
531
|
+
- output summary
|
|
532
|
+
- failed tests if any
|
|
533
|
+
- skipped checks
|
|
534
|
+
- reason for skipped checks
|
|
535
|
+
- environment notes if relevant
|
|
536
|
+
- remaining verification gaps
|
|
537
|
+
|
|
538
|
+
Required output artifact: VerificationReport
|
|
539
|
+
Output file: ${ctx.runFolder}/artifacts/verification-report.txt
|
|
540
|
+
|
|
541
|
+
Stop conditions:
|
|
542
|
+
- do not claim checks passed unless command output was produced
|
|
543
|
+
- do not hide failed commands
|
|
544
|
+
- do not omit skipped required checks
|
|
545
|
+
|
|
546
|
+
Return format:
|
|
547
|
+
Produce the artifact as a plain-text file following the VerificationReport template.
|
|
548
|
+
Artifact: VerificationReport
|
|
549
|
+
Workflow mode: ...
|
|
550
|
+
[all required sections]
|
|
551
|
+
Status: complete | incomplete | blocked
|
|
552
|
+
`;
|
|
553
|
+
}
|
|
554
|
+
function judgePrompt(ctx) {
|
|
555
|
+
return `${header(ctx)}
|
|
556
|
+
Inputs:
|
|
557
|
+
- ${ctx.runFolder}/artifacts/request-brief.txt (or mode-specific entry artifact)
|
|
558
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
559
|
+
- ${ctx.runFolder}/artifacts/behavior-model.txt (or reconstruction)
|
|
560
|
+
- ${ctx.runFolder}/artifacts/pseudocode-packet.txt (or mode-specific equivalent)
|
|
561
|
+
- ${ctx.runFolder}/artifacts/test-strategy-packet.txt (or mode-specific strategy)
|
|
562
|
+
- ${ctx.runFolder}/artifacts/implementation-report.txt
|
|
563
|
+
- ${ctx.runFolder}/artifacts/test-implementation-report.txt
|
|
564
|
+
- ${ctx.runFolder}/artifacts/verification-report.txt
|
|
565
|
+
|
|
566
|
+
Task:
|
|
567
|
+
Review the implementation and tests against the workflow artifacts and produce ${ctx.runFolder}/artifacts/judge-report.txt (artifact: JudgeReport).
|
|
568
|
+
|
|
569
|
+
The JudgeReport must assess:
|
|
570
|
+
- implementation vs PseudocodePacket
|
|
571
|
+
- tests vs TestStrategyPacket
|
|
572
|
+
- behavior coverage
|
|
573
|
+
- architecture alignment
|
|
574
|
+
- scope control
|
|
575
|
+
- verification evidence
|
|
576
|
+
- risks and gaps
|
|
577
|
+
|
|
578
|
+
Verdict must be one of:
|
|
579
|
+
PASS | DESIGN_INCOMPLETE | PSEUDOCODE_INCOMPLETE | IMPLEMENTATION_MISMATCH |
|
|
580
|
+
TEST_COVERAGE_INCOMPLETE | ARCHITECTURE_MISMATCH | NEED_CONTEXT | SCOPE_VIOLATION |
|
|
581
|
+
NEED_VERIFICATION | BLOCKED
|
|
582
|
+
|
|
583
|
+
Required output artifact: JudgeReport
|
|
584
|
+
Output file: ${ctx.runFolder}/artifacts/judge-report.txt
|
|
585
|
+
|
|
586
|
+
Stop conditions:
|
|
587
|
+
- do not rewrite code
|
|
588
|
+
- do not approve without verification evidence
|
|
589
|
+
- do not hide uncertainty or gaps
|
|
590
|
+
|
|
591
|
+
Return format:
|
|
592
|
+
Produce the artifact as a plain-text file.
|
|
593
|
+
Artifact: JudgeReport
|
|
594
|
+
Workflow mode: ...
|
|
595
|
+
Verdict: ...
|
|
596
|
+
Recommended next stage if not PASS: ...
|
|
597
|
+
Status: complete
|
|
598
|
+
`;
|
|
599
|
+
}
|
|
600
|
+
function finalReportPrompt(ctx) {
|
|
601
|
+
return `${header(ctx)}
|
|
602
|
+
Inputs:
|
|
603
|
+
- ${ctx.runFolder}/artifacts/judge-report.txt
|
|
604
|
+
- ${ctx.runFolder}/artifacts/verification-report.txt
|
|
605
|
+
- ${ctx.runFolder}/artifacts/request-brief.txt (or mode-specific entry artifact)
|
|
606
|
+
- major design and implementation artifacts
|
|
607
|
+
|
|
608
|
+
Task:
|
|
609
|
+
Summarize the completed workflow and produce ${ctx.runFolder}/artifacts/final-report.txt (artifact: FinalReport).
|
|
610
|
+
|
|
611
|
+
The FinalReport must include:
|
|
612
|
+
- original request
|
|
613
|
+
- workflow mode
|
|
614
|
+
- run ID: ${ctx.runId}
|
|
615
|
+
- stages completed
|
|
616
|
+
- behavior designed
|
|
617
|
+
- architecture context used
|
|
618
|
+
- pseudocode summary
|
|
619
|
+
- tests designed
|
|
620
|
+
- implementation summary
|
|
621
|
+
- tests added or updated
|
|
622
|
+
- verification summary
|
|
623
|
+
- judge verdict
|
|
624
|
+
- unresolved risks
|
|
625
|
+
- follow-up recommendations if needed
|
|
626
|
+
|
|
627
|
+
Required output artifact: FinalReport
|
|
628
|
+
Output file: ${ctx.runFolder}/artifacts/final-report.txt
|
|
629
|
+
|
|
630
|
+
Stop conditions:
|
|
631
|
+
- do not exaggerate success
|
|
632
|
+
- do not omit failed or skipped verification
|
|
633
|
+
- do not hide unresolved risks
|
|
634
|
+
|
|
635
|
+
Return format:
|
|
636
|
+
Produce the artifact as a plain-text file following the FinalReport template.
|
|
637
|
+
Artifact: FinalReport
|
|
638
|
+
Workflow mode: ...
|
|
639
|
+
Run ID: ...
|
|
640
|
+
[all required sections]
|
|
641
|
+
Status: complete
|
|
642
|
+
`;
|
|
643
|
+
}
|
|
644
|
+
// ─── Repair-specific stages ───────────────────────────────────────────────────
|
|
645
|
+
function observedBehaviorReportPrompt(ctx) {
|
|
646
|
+
return `${header(ctx)}
|
|
647
|
+
Inputs:
|
|
648
|
+
- original request / observed behavior description: ${ctx.runFolder}/00-request.txt
|
|
649
|
+
|
|
650
|
+
Task:
|
|
651
|
+
Produce ${ctx.runFolder}/artifacts/observed-behavior-report.txt (artifact: ObservedBehaviorReport).
|
|
652
|
+
|
|
653
|
+
Capture the wrong or unexpected behavior without jumping to code-level causes.
|
|
654
|
+
|
|
655
|
+
The ObservedBehaviorReport must define:
|
|
656
|
+
- observed behavior (verbatim or close description)
|
|
657
|
+
- expected behavior if known
|
|
658
|
+
- triggering action or system event
|
|
659
|
+
- visible output or runtime symptom
|
|
660
|
+
- affected workflow or area
|
|
661
|
+
- frequency or reproducibility
|
|
662
|
+
- evidence available
|
|
663
|
+
- uncertainty
|
|
664
|
+
|
|
665
|
+
Required output artifact: ObservedBehaviorReport
|
|
666
|
+
Output file: ${ctx.runFolder}/artifacts/observed-behavior-report.txt
|
|
667
|
+
|
|
668
|
+
Stop conditions:
|
|
669
|
+
- do not guess code-level causes yet
|
|
670
|
+
- do not write pseudocode
|
|
671
|
+
- do not write tests
|
|
672
|
+
- do not implement code
|
|
673
|
+
|
|
674
|
+
Return format:
|
|
675
|
+
Produce the artifact as a plain-text file following the ObservedBehaviorReport template.
|
|
676
|
+
Artifact: ObservedBehaviorReport
|
|
677
|
+
Observed behavior: ...
|
|
678
|
+
Expected behavior: ...
|
|
679
|
+
[all required sections]
|
|
680
|
+
Status: complete | incomplete | blocked
|
|
681
|
+
`;
|
|
682
|
+
}
|
|
683
|
+
function behaviorTracePrompt(ctx) {
|
|
684
|
+
return `${header(ctx)}
|
|
685
|
+
Inputs:
|
|
686
|
+
- ${ctx.runFolder}/artifacts/observed-behavior-report.txt
|
|
687
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
688
|
+
|
|
689
|
+
Task:
|
|
690
|
+
Produce ${ctx.runFolder}/artifacts/behavior-trace.txt (artifact: BehaviorTrace).
|
|
691
|
+
|
|
692
|
+
Connect the observed behavior to the intended behavior model or pseudocode path.
|
|
693
|
+
|
|
694
|
+
The BehaviorTrace must identify:
|
|
695
|
+
- observed behavior reference
|
|
696
|
+
- matched behavior artifact if available
|
|
697
|
+
- matched behavior rule
|
|
698
|
+
- matched pseudocode section if available
|
|
699
|
+
- expected data flow
|
|
700
|
+
- expected state flow
|
|
701
|
+
- expected output
|
|
702
|
+
- missing design artifact if no match found
|
|
703
|
+
|
|
704
|
+
Required output artifact: BehaviorTrace
|
|
705
|
+
Output file: ${ctx.runFolder}/artifacts/behavior-trace.txt
|
|
706
|
+
|
|
707
|
+
Stop conditions:
|
|
708
|
+
- do not modify code
|
|
709
|
+
- do not write tests
|
|
710
|
+
- do not implement fixes yet
|
|
711
|
+
|
|
712
|
+
Return format:
|
|
713
|
+
Artifact: BehaviorTrace
|
|
714
|
+
[all required sections]
|
|
715
|
+
Status: complete | incomplete | blocked
|
|
716
|
+
`;
|
|
717
|
+
}
|
|
718
|
+
function divergenceReportPrompt(ctx) {
|
|
719
|
+
return `${header(ctx)}
|
|
720
|
+
Inputs:
|
|
721
|
+
- ${ctx.runFolder}/artifacts/observed-behavior-report.txt
|
|
722
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
723
|
+
- ${ctx.runFolder}/artifacts/behavior-trace.txt
|
|
724
|
+
|
|
725
|
+
Task:
|
|
726
|
+
Produce ${ctx.runFolder}/artifacts/divergence-report.txt (artifact: DivergenceReport).
|
|
727
|
+
|
|
728
|
+
Identify the first point where actual behavior diverges from intended behavior.
|
|
729
|
+
|
|
730
|
+
The DivergenceReport must include:
|
|
731
|
+
- expected path
|
|
732
|
+
- actual path
|
|
733
|
+
- first divergence point
|
|
734
|
+
- affected layer
|
|
735
|
+
- evidence
|
|
736
|
+
- correction category (behavior design update / pseudocode update / implementation correction / test correction / external contract correction / runtime state ordering correction / artifact update)
|
|
737
|
+
- uncertainty
|
|
738
|
+
|
|
739
|
+
Required output artifact: DivergenceReport
|
|
740
|
+
Output file: ${ctx.runFolder}/artifacts/divergence-report.txt
|
|
741
|
+
|
|
742
|
+
Stop conditions:
|
|
743
|
+
- do not modify code
|
|
744
|
+
- do not implement fixes yet
|
|
745
|
+
|
|
746
|
+
Return format:
|
|
747
|
+
Artifact: DivergenceReport
|
|
748
|
+
[all required sections]
|
|
749
|
+
Status: complete | incomplete | blocked
|
|
750
|
+
`;
|
|
751
|
+
}
|
|
752
|
+
function correctionDesignPrompt(ctx) {
|
|
753
|
+
return `${header(ctx)}
|
|
754
|
+
Inputs:
|
|
755
|
+
- ${ctx.runFolder}/artifacts/observed-behavior-report.txt
|
|
756
|
+
- ${ctx.runFolder}/artifacts/behavior-trace.txt
|
|
757
|
+
- ${ctx.runFolder}/artifacts/divergence-report.txt
|
|
758
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
759
|
+
|
|
760
|
+
Task:
|
|
761
|
+
Produce ${ctx.runFolder}/artifacts/correction-design.txt (artifact: CorrectionDesign).
|
|
762
|
+
|
|
763
|
+
Define how the system should be corrected before implementation.
|
|
764
|
+
|
|
765
|
+
The CorrectionDesign must include:
|
|
766
|
+
- correction goal
|
|
767
|
+
- artifact to update if any
|
|
768
|
+
- code behavior to change
|
|
769
|
+
- tests to add or update
|
|
770
|
+
- acceptance criteria
|
|
771
|
+
- risks
|
|
772
|
+
|
|
773
|
+
Required output artifact: CorrectionDesign
|
|
774
|
+
Output file: ${ctx.runFolder}/artifacts/correction-design.txt
|
|
775
|
+
|
|
776
|
+
Stop conditions:
|
|
777
|
+
- do not implement code in this stage
|
|
778
|
+
- do not write test files
|
|
779
|
+
|
|
780
|
+
Return format:
|
|
781
|
+
Artifact: CorrectionDesign
|
|
782
|
+
[all required sections]
|
|
783
|
+
Status: complete | incomplete | blocked
|
|
784
|
+
`;
|
|
785
|
+
}
|
|
786
|
+
function regressionTestStrategyPrompt(ctx) {
|
|
787
|
+
return `${header(ctx)}
|
|
788
|
+
Inputs:
|
|
789
|
+
- ${ctx.runFolder}/artifacts/divergence-report.txt
|
|
790
|
+
- ${ctx.runFolder}/artifacts/correction-design.txt
|
|
791
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
792
|
+
|
|
793
|
+
Task:
|
|
794
|
+
Produce ${ctx.runFolder}/artifacts/regression-test-strategy.txt (artifact: RegressionTestStrategy).
|
|
795
|
+
|
|
796
|
+
Define tests that prove the observed divergence cannot recur and cover related behavior.
|
|
797
|
+
|
|
798
|
+
The RegressionTestStrategy must include:
|
|
799
|
+
- divergence being protected against
|
|
800
|
+
- behavior or pseudocode rule being protected
|
|
801
|
+
- regression test responsibilities
|
|
802
|
+
- related boundary or transition coverage
|
|
803
|
+
- verification commands
|
|
804
|
+
|
|
805
|
+
Each test responsibility must trace to behavior, invariant, transition, derived value, boundary, contract, or failure mode.
|
|
806
|
+
Do not write test files in this stage.
|
|
807
|
+
|
|
808
|
+
Required output artifact: RegressionTestStrategy
|
|
809
|
+
Output file: ${ctx.runFolder}/artifacts/regression-test-strategy.txt
|
|
810
|
+
|
|
811
|
+
Stop conditions:
|
|
812
|
+
- do not write test files in this stage
|
|
813
|
+
- do not implement code
|
|
814
|
+
|
|
815
|
+
Return format:
|
|
816
|
+
Artifact: RegressionTestStrategy
|
|
817
|
+
[all required sections]
|
|
818
|
+
Status: complete | incomplete | blocked
|
|
819
|
+
`;
|
|
820
|
+
}
|
|
821
|
+
// ─── Test-mode-specific stages ────────────────────────────────────────────────
|
|
822
|
+
function testTargetBriefPrompt(ctx) {
|
|
823
|
+
return `${header(ctx)}
|
|
824
|
+
Inputs:
|
|
825
|
+
- original test target description: ${ctx.runFolder}/00-request.txt
|
|
826
|
+
|
|
827
|
+
Task:
|
|
828
|
+
Produce ${ctx.runFolder}/artifacts/test-target-brief.txt (artifact: TestTargetBrief).
|
|
829
|
+
|
|
830
|
+
Define the target of this test-design or test-implementation run.
|
|
831
|
+
|
|
832
|
+
The TestTargetBrief must include:
|
|
833
|
+
- test target
|
|
834
|
+
- target behavior or workflow
|
|
835
|
+
- whether code changes are allowed
|
|
836
|
+
- desired test depth
|
|
837
|
+
- constraints
|
|
838
|
+
- success criteria
|
|
839
|
+
|
|
840
|
+
Required output artifact: TestTargetBrief
|
|
841
|
+
Output file: ${ctx.runFolder}/artifacts/test-target-brief.txt
|
|
842
|
+
|
|
843
|
+
Stop conditions:
|
|
844
|
+
- do not write test files yet
|
|
845
|
+
- do not implement code
|
|
846
|
+
- do not write pseudocode
|
|
847
|
+
|
|
848
|
+
Return format:
|
|
849
|
+
Artifact: TestTargetBrief
|
|
850
|
+
[all required sections]
|
|
851
|
+
Status: complete | incomplete | blocked
|
|
852
|
+
`;
|
|
853
|
+
}
|
|
854
|
+
function behaviorReconstructionPrompt(ctx) {
|
|
855
|
+
return `${header(ctx)}
|
|
856
|
+
Inputs:
|
|
857
|
+
- ${ctx.runFolder}/artifacts/test-target-brief.txt
|
|
858
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
859
|
+
|
|
860
|
+
Task:
|
|
861
|
+
Produce ${ctx.runFolder}/artifacts/behavior-reconstruction.txt (artifact: BehaviorReconstruction).
|
|
862
|
+
|
|
863
|
+
Reconstruct behavior for the target feature when no BehaviorModel exists yet.
|
|
864
|
+
|
|
865
|
+
The BehaviorReconstruction must include:
|
|
866
|
+
- observed existing behavior
|
|
867
|
+
- current architecture evidence
|
|
868
|
+
- state variables
|
|
869
|
+
- events
|
|
870
|
+
- derived values
|
|
871
|
+
- invariants
|
|
872
|
+
- external contracts
|
|
873
|
+
- uncertainty
|
|
874
|
+
|
|
875
|
+
Required output artifact: BehaviorReconstruction
|
|
876
|
+
Output file: ${ctx.runFolder}/artifacts/behavior-reconstruction.txt
|
|
877
|
+
|
|
878
|
+
Stop conditions:
|
|
879
|
+
- do not write test files
|
|
880
|
+
- do not implement code
|
|
881
|
+
|
|
882
|
+
Return format:
|
|
883
|
+
Artifact: BehaviorReconstruction
|
|
884
|
+
[all required sections]
|
|
885
|
+
Status: complete | incomplete | blocked
|
|
886
|
+
`;
|
|
887
|
+
}
|
|
888
|
+
function pseudocodeSummaryPrompt(ctx) {
|
|
889
|
+
return `${header(ctx)}
|
|
890
|
+
Inputs:
|
|
891
|
+
- ${ctx.runFolder}/artifacts/test-target-brief.txt
|
|
892
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
893
|
+
- ${ctx.runFolder}/artifacts/behavior-reconstruction.txt
|
|
894
|
+
|
|
895
|
+
Task:
|
|
896
|
+
Produce ${ctx.runFolder}/artifacts/pseudocode-summary.txt (artifact: PseudocodeSummary).
|
|
897
|
+
|
|
898
|
+
Summarize existing implementation behavior in pseudocode form when no full PseudocodePacket exists.
|
|
899
|
+
|
|
900
|
+
The PseudocodeSummary must include:
|
|
901
|
+
- implementation-neutral behavior summary
|
|
902
|
+
- data flow
|
|
903
|
+
- state flow
|
|
904
|
+
- derived values
|
|
905
|
+
- validation rules
|
|
906
|
+
- error or empty state handling
|
|
907
|
+
- uncertainty
|
|
908
|
+
|
|
909
|
+
Required output artifact: PseudocodeSummary
|
|
910
|
+
Output file: ${ctx.runFolder}/artifacts/pseudocode-summary.txt
|
|
911
|
+
|
|
912
|
+
Stop conditions:
|
|
913
|
+
- do not write test files
|
|
914
|
+
- do not implement code
|
|
915
|
+
|
|
916
|
+
Return format:
|
|
917
|
+
Artifact: PseudocodeSummary
|
|
918
|
+
[all required sections]
|
|
919
|
+
Status: complete | incomplete | blocked
|
|
920
|
+
`;
|
|
921
|
+
}
|
|
922
|
+
// ─── Refactor-mode-specific stages ───────────────────────────────────────────
|
|
923
|
+
function refactorBriefPrompt(ctx) {
|
|
924
|
+
return `${header(ctx)}
|
|
925
|
+
Inputs:
|
|
926
|
+
- original refactor goal: ${ctx.runFolder}/00-request.txt
|
|
927
|
+
|
|
928
|
+
Task:
|
|
929
|
+
Produce ${ctx.runFolder}/artifacts/refactor-brief.txt (artifact: RefactorBrief).
|
|
930
|
+
|
|
931
|
+
Define the intended code-structure change and behavior-preservation requirement.
|
|
932
|
+
|
|
933
|
+
The RefactorBrief must include:
|
|
934
|
+
- refactor goal
|
|
935
|
+
- behavior that must remain unchanged
|
|
936
|
+
- target area
|
|
937
|
+
- constraints
|
|
938
|
+
- non-goals
|
|
939
|
+
- success criteria
|
|
940
|
+
|
|
941
|
+
Required output artifact: RefactorBrief
|
|
942
|
+
Output file: ${ctx.runFolder}/artifacts/refactor-brief.txt
|
|
943
|
+
|
|
944
|
+
Stop conditions:
|
|
945
|
+
- do not inspect code deeply
|
|
946
|
+
- do not write pseudocode
|
|
947
|
+
- do not implement code
|
|
948
|
+
- do not write tests
|
|
949
|
+
|
|
950
|
+
Return format:
|
|
951
|
+
Artifact: RefactorBrief
|
|
952
|
+
[all required sections]
|
|
953
|
+
Status: complete | incomplete | blocked
|
|
954
|
+
`;
|
|
955
|
+
}
|
|
956
|
+
function existingBehaviorMapPrompt(ctx) {
|
|
957
|
+
return `${header(ctx)}
|
|
958
|
+
Inputs:
|
|
959
|
+
- ${ctx.runFolder}/artifacts/refactor-brief.txt
|
|
960
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
961
|
+
|
|
962
|
+
Task:
|
|
963
|
+
Produce ${ctx.runFolder}/artifacts/existing-behavior-map.txt (artifact: ExistingBehaviorMap).
|
|
964
|
+
|
|
965
|
+
Map the behavior that must remain stable during the refactor.
|
|
966
|
+
|
|
967
|
+
The ExistingBehaviorMap must include:
|
|
968
|
+
- current behaviors
|
|
969
|
+
- state variables
|
|
970
|
+
- events
|
|
971
|
+
- derived values
|
|
972
|
+
- invariants
|
|
973
|
+
- external contracts
|
|
974
|
+
- existing tests
|
|
975
|
+
- behavior gaps
|
|
976
|
+
|
|
977
|
+
Required output artifact: ExistingBehaviorMap
|
|
978
|
+
Output file: ${ctx.runFolder}/artifacts/existing-behavior-map.txt
|
|
979
|
+
|
|
980
|
+
Stop conditions:
|
|
981
|
+
- do not implement code
|
|
982
|
+
- do not write tests
|
|
983
|
+
- do not write pseudocode
|
|
984
|
+
|
|
985
|
+
Return format:
|
|
986
|
+
Artifact: ExistingBehaviorMap
|
|
987
|
+
[all required sections]
|
|
988
|
+
Status: complete | incomplete | blocked
|
|
989
|
+
`;
|
|
990
|
+
}
|
|
991
|
+
function preservedInvariantListPrompt(ctx) {
|
|
992
|
+
return `${header(ctx)}
|
|
993
|
+
Inputs:
|
|
994
|
+
- ${ctx.runFolder}/artifacts/refactor-brief.txt
|
|
995
|
+
- ${ctx.runFolder}/artifacts/existing-behavior-map.txt
|
|
996
|
+
|
|
997
|
+
Task:
|
|
998
|
+
Produce ${ctx.runFolder}/artifacts/preserved-invariant-list.txt (artifact: PreservedInvariantList).
|
|
999
|
+
|
|
1000
|
+
Define what must remain true after the refactor.
|
|
1001
|
+
|
|
1002
|
+
The PreservedInvariantList must include:
|
|
1003
|
+
- invariants to preserve
|
|
1004
|
+
- affected code areas
|
|
1005
|
+
- tests protecting each invariant
|
|
1006
|
+
- missing tests
|
|
1007
|
+
|
|
1008
|
+
Required output artifact: PreservedInvariantList
|
|
1009
|
+
Output file: ${ctx.runFolder}/artifacts/preserved-invariant-list.txt
|
|
1010
|
+
|
|
1011
|
+
Stop conditions:
|
|
1012
|
+
- do not implement code
|
|
1013
|
+
- do not write test files yet
|
|
1014
|
+
|
|
1015
|
+
Return format:
|
|
1016
|
+
Artifact: PreservedInvariantList
|
|
1017
|
+
[all required sections]
|
|
1018
|
+
Status: complete | incomplete | blocked
|
|
1019
|
+
`;
|
|
1020
|
+
}
|
|
1021
|
+
function compatibilityTestStrategyPrompt(ctx) {
|
|
1022
|
+
return `${header(ctx)}
|
|
1023
|
+
Inputs:
|
|
1024
|
+
- ${ctx.runFolder}/artifacts/existing-behavior-map.txt
|
|
1025
|
+
- ${ctx.runFolder}/artifacts/preserved-invariant-list.txt
|
|
1026
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
1027
|
+
|
|
1028
|
+
Task:
|
|
1029
|
+
Produce ${ctx.runFolder}/artifacts/compatibility-test-strategy.txt (artifact: CompatibilityTestStrategy).
|
|
1030
|
+
|
|
1031
|
+
Define tests that prove the refactor preserved behavior.
|
|
1032
|
+
|
|
1033
|
+
The CompatibilityTestStrategy must include:
|
|
1034
|
+
- preserved behavior
|
|
1035
|
+
- compatibility test responsibilities
|
|
1036
|
+
- existing tests to run
|
|
1037
|
+
- new tests needed
|
|
1038
|
+
- verification commands
|
|
1039
|
+
|
|
1040
|
+
Each test responsibility must trace to behavior, invariant, transition, derived value, boundary, contract, or failure mode.
|
|
1041
|
+
Do not write test files in this stage.
|
|
1042
|
+
|
|
1043
|
+
Required output artifact: CompatibilityTestStrategy
|
|
1044
|
+
Output file: ${ctx.runFolder}/artifacts/compatibility-test-strategy.txt
|
|
1045
|
+
|
|
1046
|
+
Stop conditions:
|
|
1047
|
+
- do not write test files in this stage
|
|
1048
|
+
- do not implement code
|
|
1049
|
+
|
|
1050
|
+
Return format:
|
|
1051
|
+
Artifact: CompatibilityTestStrategy
|
|
1052
|
+
[all required sections]
|
|
1053
|
+
Status: complete | incomplete | blocked
|
|
1054
|
+
`;
|
|
1055
|
+
}
|
|
1056
|
+
function refactorPseudocodePacketPrompt(ctx) {
|
|
1057
|
+
return `${header(ctx)}
|
|
1058
|
+
Inputs:
|
|
1059
|
+
- ${ctx.runFolder}/artifacts/refactor-brief.txt
|
|
1060
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
1061
|
+
- ${ctx.runFolder}/artifacts/existing-behavior-map.txt
|
|
1062
|
+
- ${ctx.runFolder}/artifacts/preserved-invariant-list.txt
|
|
1063
|
+
- ${ctx.runFolder}/artifacts/compatibility-test-strategy.txt
|
|
1064
|
+
|
|
1065
|
+
Task:
|
|
1066
|
+
Produce ${ctx.runFolder}/artifacts/refactor-pseudocode-packet.txt (artifact: RefactorPseudocodePacket).
|
|
1067
|
+
|
|
1068
|
+
Define the implementation-neutral design for the refactor. Preserve the behavior identified in ExistingBehaviorMap.
|
|
1069
|
+
|
|
1070
|
+
The RefactorPseudocodePacket must include:
|
|
1071
|
+
- target structure
|
|
1072
|
+
- data flow changes
|
|
1073
|
+
- invariants preserved
|
|
1074
|
+
- files allowed to change
|
|
1075
|
+
- component or module contracts
|
|
1076
|
+
- acceptance criteria
|
|
1077
|
+
- assumptions preserved
|
|
1078
|
+
- unresolved implementation questions
|
|
1079
|
+
|
|
1080
|
+
Required output artifact: RefactorPseudocodePacket
|
|
1081
|
+
Output file: ${ctx.runFolder}/artifacts/refactor-pseudocode-packet.txt
|
|
1082
|
+
|
|
1083
|
+
Stop conditions:
|
|
1084
|
+
- do not write production code
|
|
1085
|
+
- do not write test files
|
|
1086
|
+
- do not modify files
|
|
1087
|
+
|
|
1088
|
+
Return format:
|
|
1089
|
+
Artifact: RefactorPseudocodePacket
|
|
1090
|
+
[all required sections]
|
|
1091
|
+
Status: complete | incomplete | blocked
|
|
1092
|
+
`;
|
|
1093
|
+
}
|
|
1094
|
+
// ─── Harden-mode-specific stages ─────────────────────────────────────────────
|
|
1095
|
+
function hardeningBriefPrompt(ctx) {
|
|
1096
|
+
return `${header(ctx)}
|
|
1097
|
+
Inputs:
|
|
1098
|
+
- original hardening goal: ${ctx.runFolder}/00-request.txt
|
|
1099
|
+
|
|
1100
|
+
Task:
|
|
1101
|
+
Produce ${ctx.runFolder}/artifacts/hardening-brief.txt (artifact: HardeningBrief).
|
|
1102
|
+
|
|
1103
|
+
Define the robustness or failure-handling improvement requested.
|
|
1104
|
+
|
|
1105
|
+
The HardeningBrief must include:
|
|
1106
|
+
- hardening goal
|
|
1107
|
+
- target behavior or boundary
|
|
1108
|
+
- current risk
|
|
1109
|
+
- constraints
|
|
1110
|
+
- success criteria
|
|
1111
|
+
|
|
1112
|
+
Required output artifact: HardeningBrief
|
|
1113
|
+
Output file: ${ctx.runFolder}/artifacts/hardening-brief.txt
|
|
1114
|
+
|
|
1115
|
+
Stop conditions:
|
|
1116
|
+
- do not inspect code deeply
|
|
1117
|
+
- do not write pseudocode
|
|
1118
|
+
- do not implement code
|
|
1119
|
+
- do not write tests
|
|
1120
|
+
|
|
1121
|
+
Return format:
|
|
1122
|
+
Artifact: HardeningBrief
|
|
1123
|
+
[all required sections]
|
|
1124
|
+
Status: complete | incomplete | blocked
|
|
1125
|
+
`;
|
|
1126
|
+
}
|
|
1127
|
+
function assumptionReportPrompt(ctx) {
|
|
1128
|
+
return `${header(ctx)}
|
|
1129
|
+
Inputs:
|
|
1130
|
+
- ${ctx.runFolder}/artifacts/hardening-brief.txt
|
|
1131
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
1132
|
+
|
|
1133
|
+
Task:
|
|
1134
|
+
Produce ${ctx.runFolder}/artifacts/assumption-report.txt (artifact: AssumptionReport).
|
|
1135
|
+
|
|
1136
|
+
Identify assumptions currently made by the code or design.
|
|
1137
|
+
|
|
1138
|
+
For each assumption include:
|
|
1139
|
+
- assumption statement
|
|
1140
|
+
- source of assumption
|
|
1141
|
+
- where it is used
|
|
1142
|
+
- what breaks if false
|
|
1143
|
+
- decision (preserve / remove / validate / guard)
|
|
1144
|
+
- required follow-up
|
|
1145
|
+
|
|
1146
|
+
Required output artifact: AssumptionReport
|
|
1147
|
+
Output file: ${ctx.runFolder}/artifacts/assumption-report.txt
|
|
1148
|
+
|
|
1149
|
+
Stop conditions:
|
|
1150
|
+
- do not implement code
|
|
1151
|
+
- do not write tests
|
|
1152
|
+
|
|
1153
|
+
Return format:
|
|
1154
|
+
Artifact: AssumptionReport
|
|
1155
|
+
[all required sections]
|
|
1156
|
+
Status: complete | incomplete | blocked
|
|
1157
|
+
`;
|
|
1158
|
+
}
|
|
1159
|
+
function failureModeMatrixPrompt(ctx) {
|
|
1160
|
+
return `${header(ctx)}
|
|
1161
|
+
Inputs:
|
|
1162
|
+
- ${ctx.runFolder}/artifacts/hardening-brief.txt
|
|
1163
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
1164
|
+
- ${ctx.runFolder}/artifacts/assumption-report.txt
|
|
1165
|
+
|
|
1166
|
+
Task:
|
|
1167
|
+
Produce ${ctx.runFolder}/artifacts/failure-mode-matrix.txt (artifact: FailureModeMatrix).
|
|
1168
|
+
|
|
1169
|
+
Classify realistic ways the behavior can fail and decide how each should be handled.
|
|
1170
|
+
|
|
1171
|
+
For each failure mode include:
|
|
1172
|
+
- failure mode
|
|
1173
|
+
- category (input / state / contract / parser / storage / async / rendering / data volume / configuration / environment)
|
|
1174
|
+
- trigger
|
|
1175
|
+
- affected layer
|
|
1176
|
+
- current behavior
|
|
1177
|
+
- desired behavior
|
|
1178
|
+
- handling strategy (prevent / recover / surface to user / log / retry / ignore safely / fail fast)
|
|
1179
|
+
- required code change
|
|
1180
|
+
- required test
|
|
1181
|
+
- priority
|
|
1182
|
+
|
|
1183
|
+
Required output artifact: FailureModeMatrix
|
|
1184
|
+
Output file: ${ctx.runFolder}/artifacts/failure-mode-matrix.txt
|
|
1185
|
+
|
|
1186
|
+
Stop conditions:
|
|
1187
|
+
- do not implement code
|
|
1188
|
+
- do not write tests yet
|
|
1189
|
+
|
|
1190
|
+
Return format:
|
|
1191
|
+
Artifact: FailureModeMatrix
|
|
1192
|
+
[all required sections]
|
|
1193
|
+
Status: complete | incomplete | blocked
|
|
1194
|
+
`;
|
|
1195
|
+
}
|
|
1196
|
+
function guardPseudocodePacketPrompt(ctx) {
|
|
1197
|
+
return `${header(ctx)}
|
|
1198
|
+
Inputs:
|
|
1199
|
+
- ${ctx.runFolder}/artifacts/hardening-brief.txt
|
|
1200
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
1201
|
+
- ${ctx.runFolder}/artifacts/assumption-report.txt
|
|
1202
|
+
- ${ctx.runFolder}/artifacts/failure-mode-matrix.txt
|
|
1203
|
+
|
|
1204
|
+
Task:
|
|
1205
|
+
Produce ${ctx.runFolder}/artifacts/guard-pseudocode-packet.txt (artifact: GuardPseudocodePacket).
|
|
1206
|
+
|
|
1207
|
+
Define pseudocode for validation, guards, recovery paths, and error or empty states.
|
|
1208
|
+
|
|
1209
|
+
The GuardPseudocodePacket must include:
|
|
1210
|
+
- assumptions being guarded
|
|
1211
|
+
- failure modes handled
|
|
1212
|
+
- validation rules
|
|
1213
|
+
- guard rules
|
|
1214
|
+
- recovery behavior
|
|
1215
|
+
- error-state behavior
|
|
1216
|
+
- acceptance criteria
|
|
1217
|
+
|
|
1218
|
+
Required output artifact: GuardPseudocodePacket
|
|
1219
|
+
Output file: ${ctx.runFolder}/artifacts/guard-pseudocode-packet.txt
|
|
1220
|
+
|
|
1221
|
+
Stop conditions:
|
|
1222
|
+
- do not write production code
|
|
1223
|
+
- do not write test files
|
|
1224
|
+
- do not modify files
|
|
1225
|
+
|
|
1226
|
+
Return format:
|
|
1227
|
+
Artifact: GuardPseudocodePacket
|
|
1228
|
+
[all required sections]
|
|
1229
|
+
Status: complete | incomplete | blocked
|
|
1230
|
+
`;
|
|
1231
|
+
}
|
|
1232
|
+
function resilienceTestStrategyPrompt(ctx) {
|
|
1233
|
+
return `${header(ctx)}
|
|
1234
|
+
Inputs:
|
|
1235
|
+
- ${ctx.runFolder}/artifacts/assumption-report.txt
|
|
1236
|
+
- ${ctx.runFolder}/artifacts/failure-mode-matrix.txt
|
|
1237
|
+
- ${ctx.runFolder}/artifacts/guard-pseudocode-packet.txt
|
|
1238
|
+
- ${ctx.runFolder}/artifacts/architecture-context-packet.txt
|
|
1239
|
+
|
|
1240
|
+
Task:
|
|
1241
|
+
Produce ${ctx.runFolder}/artifacts/resilience-test-strategy.txt (artifact: ResilienceTestStrategy).
|
|
1242
|
+
|
|
1243
|
+
Define tests that verify hardening behavior.
|
|
1244
|
+
|
|
1245
|
+
The ResilienceTestStrategy must include:
|
|
1246
|
+
- assumptions tested
|
|
1247
|
+
- failure modes tested
|
|
1248
|
+
- validation tests
|
|
1249
|
+
- guard tests
|
|
1250
|
+
- recovery tests
|
|
1251
|
+
- error-state tests
|
|
1252
|
+
- verification commands
|
|
1253
|
+
- remaining risks
|
|
1254
|
+
|
|
1255
|
+
Each test responsibility must trace to assumption, failure mode, boundary, contract, or behavior.
|
|
1256
|
+
Do not write test files in this stage.
|
|
1257
|
+
|
|
1258
|
+
Required output artifact: ResilienceTestStrategy
|
|
1259
|
+
Output file: ${ctx.runFolder}/artifacts/resilience-test-strategy.txt
|
|
1260
|
+
|
|
1261
|
+
Stop conditions:
|
|
1262
|
+
- do not write test files in this stage
|
|
1263
|
+
- do not implement code
|
|
1264
|
+
|
|
1265
|
+
Return format:
|
|
1266
|
+
Artifact: ResilienceTestStrategy
|
|
1267
|
+
[all required sections]
|
|
1268
|
+
Status: complete | incomplete | blocked
|
|
1269
|
+
`;
|
|
1270
|
+
}
|
|
1271
|
+
// ─── Stage router ─────────────────────────────────────────────────────────────
|
|
1272
|
+
function generateStagePrompt(meta, stageName) {
|
|
1273
|
+
const stageIndex = meta.stages.findIndex((s) => s.name === stageName);
|
|
1274
|
+
if (stageIndex === -1) {
|
|
1275
|
+
throw new Error(`Stage "${stageName}" not found in ${meta.mode} workflow`);
|
|
1276
|
+
}
|
|
1277
|
+
const ctx = {
|
|
1278
|
+
stage: stageName,
|
|
1279
|
+
mode: meta.mode,
|
|
1280
|
+
runId: meta.runId,
|
|
1281
|
+
projectRoot: meta.projectRoot,
|
|
1282
|
+
runFolder: meta.runFolder,
|
|
1283
|
+
stageNumber: stageIndex + 1,
|
|
1284
|
+
totalStages: meta.stages.length,
|
|
1285
|
+
};
|
|
1286
|
+
switch (stageName) {
|
|
1287
|
+
// shared
|
|
1288
|
+
case 'architecture-context': return architectureContextPrompt(ctx);
|
|
1289
|
+
case 'behavior-model': return behaviorModelPrompt(ctx);
|
|
1290
|
+
case 'pseudocode-packet': return pseudocodePacketPrompt(ctx);
|
|
1291
|
+
case 'test-strategy': return testStrategyPrompt(ctx);
|
|
1292
|
+
case 'implementation': return implementationPrompt(ctx);
|
|
1293
|
+
case 'test-implementation': return testImplementationPrompt(ctx);
|
|
1294
|
+
case 'verification': return verificationPrompt(ctx);
|
|
1295
|
+
case 'judge': return judgePrompt(ctx);
|
|
1296
|
+
case 'final-report': return finalReportPrompt(ctx);
|
|
1297
|
+
// feature
|
|
1298
|
+
case 'request-brief': return requestBriefPrompt(ctx);
|
|
1299
|
+
// repair
|
|
1300
|
+
case 'observed-behavior-report': return observedBehaviorReportPrompt(ctx);
|
|
1301
|
+
case 'behavior-trace': return behaviorTracePrompt(ctx);
|
|
1302
|
+
case 'divergence-report': return divergenceReportPrompt(ctx);
|
|
1303
|
+
case 'correction-design': return correctionDesignPrompt(ctx);
|
|
1304
|
+
case 'regression-test-strategy': return regressionTestStrategyPrompt(ctx);
|
|
1305
|
+
// test
|
|
1306
|
+
case 'test-target-brief': return testTargetBriefPrompt(ctx);
|
|
1307
|
+
case 'behavior-reconstruction': return behaviorReconstructionPrompt(ctx);
|
|
1308
|
+
case 'pseudocode-summary': return pseudocodeSummaryPrompt(ctx);
|
|
1309
|
+
// refactor
|
|
1310
|
+
case 'refactor-brief': return refactorBriefPrompt(ctx);
|
|
1311
|
+
case 'existing-behavior-map': return existingBehaviorMapPrompt(ctx);
|
|
1312
|
+
case 'preserved-invariant-list': return preservedInvariantListPrompt(ctx);
|
|
1313
|
+
case 'compatibility-test-strategy': return compatibilityTestStrategyPrompt(ctx);
|
|
1314
|
+
case 'refactor-pseudocode-packet': return refactorPseudocodePacketPrompt(ctx);
|
|
1315
|
+
// harden
|
|
1316
|
+
case 'hardening-brief': return hardeningBriefPrompt(ctx);
|
|
1317
|
+
case 'assumption-report': return assumptionReportPrompt(ctx);
|
|
1318
|
+
case 'failure-mode-matrix': return failureModeMatrixPrompt(ctx);
|
|
1319
|
+
case 'guard-pseudocode-packet': return guardPseudocodePacketPrompt(ctx);
|
|
1320
|
+
case 'resilience-test-strategy': return resilienceTestStrategyPrompt(ctx);
|
|
1321
|
+
default:
|
|
1322
|
+
throw new Error(`No prompt generator for stage: "${stageName}"`);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
function writeStagePrompts(meta) {
|
|
1326
|
+
for (const stage of meta.stages) {
|
|
1327
|
+
const promptContent = generateStagePrompt(meta, stage.name);
|
|
1328
|
+
const promptPath = path.join(meta.runFolder, stage.promptFile);
|
|
1329
|
+
fs.writeFileSync(promptPath, promptContent, 'utf8');
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
//# sourceMappingURL=promptGenerator.js.map
|