gateproof 0.2.1 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +132 -340
  2. package/dist/act.d.ts +45 -0
  3. package/dist/act.d.ts.map +1 -1
  4. package/dist/act.js +22 -0
  5. package/dist/act.js.map +1 -1
  6. package/dist/action-executors.d.ts +17 -0
  7. package/dist/action-executors.d.ts.map +1 -1
  8. package/dist/action-executors.js +60 -0
  9. package/dist/action-executors.js.map +1 -1
  10. package/dist/assert.d.ts +20 -0
  11. package/dist/assert.d.ts.map +1 -1
  12. package/dist/assert.js +32 -0
  13. package/dist/assert.js.map +1 -1
  14. package/dist/authority.d.ts +34 -0
  15. package/dist/authority.d.ts.map +1 -0
  16. package/dist/authority.js +141 -0
  17. package/dist/authority.js.map +1 -0
  18. package/dist/cli/gateproof.js +81 -5
  19. package/dist/cli/gateproof.js.map +1 -1
  20. package/dist/filepath-backend.d.ts +64 -0
  21. package/dist/filepath-backend.d.ts.map +1 -0
  22. package/dist/filepath-backend.js +126 -0
  23. package/dist/filepath-backend.js.map +1 -0
  24. package/dist/filepath-protocol.d.ts +214 -0
  25. package/dist/filepath-protocol.d.ts.map +1 -0
  26. package/dist/filepath-protocol.js +239 -0
  27. package/dist/filepath-protocol.js.map +1 -0
  28. package/dist/filepath-runtime.d.ts +100 -0
  29. package/dist/filepath-runtime.d.ts.map +1 -0
  30. package/dist/filepath-runtime.js +190 -0
  31. package/dist/filepath-runtime.js.map +1 -0
  32. package/dist/http-backend.d.ts +9 -0
  33. package/dist/http-backend.d.ts.map +1 -1
  34. package/dist/http-backend.js +50 -8
  35. package/dist/http-backend.js.map +1 -1
  36. package/dist/index.d.ts +11 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +9 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/prd/index.d.ts +2 -0
  41. package/dist/prd/index.d.ts.map +1 -1
  42. package/dist/prd/index.js +4 -0
  43. package/dist/prd/index.js.map +1 -1
  44. package/dist/prd/loop.d.ts +160 -0
  45. package/dist/prd/loop.d.ts.map +1 -0
  46. package/dist/prd/loop.js +462 -0
  47. package/dist/prd/loop.js.map +1 -0
  48. package/dist/prd/runner.d.ts +2 -5
  49. package/dist/prd/runner.d.ts.map +1 -1
  50. package/dist/prd/runner.js +154 -122
  51. package/dist/prd/runner.js.map +1 -1
  52. package/dist/prd/scope-defaults.d.ts +75 -0
  53. package/dist/prd/scope-defaults.d.ts.map +1 -0
  54. package/dist/prd/scope-defaults.js +235 -0
  55. package/dist/prd/scope-defaults.js.map +1 -0
  56. package/dist/prd/types.d.ts +80 -0
  57. package/dist/prd/types.d.ts.map +1 -1
  58. package/dist/report.d.ts +70 -0
  59. package/dist/report.d.ts.map +1 -1
  60. package/dist/report.js +183 -0
  61. package/dist/report.js.map +1 -1
  62. package/package.json +11 -3
@@ -0,0 +1,462 @@
1
+ /**
2
+ * Native PRD loop function - enables agents and scripts to run the retry loop
3
+ * without external bash orchestration.
4
+ *
5
+ * This is an additive feature - the existing `bun run prd:loop` command remains unchanged.
6
+ */
7
+ import { resolve } from "node:path";
8
+ import { readFileSync, existsSync, mkdirSync, appendFileSync } from "node:fs";
9
+ import { execSync } from "node:child_process";
10
+ import { runPrd } from "./runner";
11
+ /**
12
+ * Loads a PRD from a file path by dynamic import
13
+ */
14
+ async function loadPrd(prdPath) {
15
+ const absolutePath = resolve(prdPath);
16
+ const mod = await import(`file://${absolutePath}`);
17
+ // Handle both default export and named 'prd' export
18
+ if (mod.default && typeof mod.default === 'object' && 'stories' in mod.default) {
19
+ return mod.default;
20
+ }
21
+ if (mod.prd && typeof mod.prd === 'object' && 'stories' in mod.prd) {
22
+ return mod.prd;
23
+ }
24
+ throw new Error(`PRD file must export 'prd' or a default object with 'stories': ${prdPath}`);
25
+ }
26
+ /**
27
+ * Gets a truncated git diff
28
+ */
29
+ function getRecentDiff(baseRef = "HEAD", maxLines = 100) {
30
+ try {
31
+ const diff = execSync(`git diff ${baseRef}`, {
32
+ encoding: "utf-8",
33
+ cwd: process.cwd(),
34
+ maxBuffer: 1024 * 1024, // 1MB
35
+ });
36
+ const lines = diff.split("\n");
37
+ if (lines.length > maxLines) {
38
+ return lines.slice(0, maxLines).join("\n") + `\n... (truncated, ${lines.length - maxLines} more lines)`;
39
+ }
40
+ return diff;
41
+ }
42
+ catch {
43
+ return "(no diff available)";
44
+ }
45
+ }
46
+ /**
47
+ * Builds a context object for the agent
48
+ */
49
+ function buildAgentContext(prdPath, result, iteration, baseRef) {
50
+ const prdContent = readFileSync(prdPath, "utf-8");
51
+ const failedStory = result.failedStory;
52
+ // Build a focused slice of the PRD relevant to the failure
53
+ let prdSlice = "";
54
+ if (failedStory) {
55
+ prdSlice = `Story: ${failedStory.id}\nTitle: ${failedStory.title}\nGate: ${failedStory.gateFile}`;
56
+ if (failedStory.scope) {
57
+ prdSlice += `\nScope: ${JSON.stringify(failedStory.scope, null, 2)}`;
58
+ }
59
+ if (failedStory.progress && failedStory.progress.length > 0) {
60
+ prdSlice += `\nProgress: ${failedStory.progress.join(", ")}`;
61
+ }
62
+ }
63
+ // Build failure summary
64
+ let failureSummary = "";
65
+ if (result.error) {
66
+ failureSummary = result.error.message;
67
+ }
68
+ if (result.report?.failedStory) {
69
+ const storyResult = result.report.stories.find(s => s.id === result.report?.failedStory?.id);
70
+ if (storyResult?.error) {
71
+ failureSummary += `\n${storyResult.error.tag || storyResult.error.name}: ${storyResult.error.message}`;
72
+ }
73
+ }
74
+ return {
75
+ prdSlice,
76
+ failureSummary,
77
+ recentDiff: getRecentDiff(baseRef),
78
+ prdContent,
79
+ failedStory,
80
+ lastReport: result.report,
81
+ iteration,
82
+ };
83
+ }
84
+ /**
85
+ * Ensures the .gateproof directory exists
86
+ */
87
+ function ensureGateproofDir(cwd) {
88
+ const dir = resolve(cwd, ".gateproof");
89
+ if (!existsSync(dir)) {
90
+ mkdirSync(dir, { recursive: true });
91
+ }
92
+ return dir;
93
+ }
94
+ /**
95
+ * Appends iteration evidence to the evidence log
96
+ */
97
+ function appendEvidenceLog(cwd, iteration, status, report) {
98
+ const gateproofDir = ensureGateproofDir(cwd);
99
+ const logPath = resolve(gateproofDir, "evidence.log");
100
+ const entry = {
101
+ timestamp: new Date().toISOString(),
102
+ iteration,
103
+ passed: status.passed,
104
+ durationMs: status.durationMs,
105
+ failedStory: status.failedStory?.id,
106
+ failure: status.failure,
107
+ storiesRun: report?.stories.map(s => ({ id: s.id, status: s.status })),
108
+ };
109
+ appendFileSync(logPath, JSON.stringify(entry) + "\n", "utf-8");
110
+ }
111
+ /**
112
+ * Default agent that logs a warning (real agent integration requires API key)
113
+ */
114
+ async function defaultNoopAgent(ctx) {
115
+ console.warn("[runPrdLoop] No agent function provided. Provide an agent option to enable automatic fixes.");
116
+ console.log("\n--- Agent Context ---");
117
+ console.log(`Iteration: ${ctx.iteration}`);
118
+ console.log(`Failed story: ${ctx.failedStory?.id || "(none)"}`);
119
+ console.log(`Failure: ${ctx.failureSummary}`);
120
+ console.log("---\n");
121
+ return { changes: [] };
122
+ }
123
+ /**
124
+ * Wraps a promise with a timeout and an AbortController for real cancellation.
125
+ * The caller should pass the AbortSignal into the underlying work so it actually stops.
126
+ */
127
+ function withTimeout(fn, ms, label) {
128
+ const controller = new AbortController();
129
+ let timer;
130
+ const timeout = new Promise((_, reject) => {
131
+ timer = setTimeout(() => {
132
+ controller.abort();
133
+ reject(new Error(`${label} timed out after ${ms}ms`));
134
+ }, ms);
135
+ });
136
+ return Promise.race([fn(controller.signal), timeout]).finally(() => clearTimeout(timer));
137
+ }
138
+ /**
139
+ * Generates a short run ID for namespacing report files in concurrent CI.
140
+ */
141
+ function generateRunId() {
142
+ const ts = Date.now().toString(36);
143
+ const rand = Math.random().toString(36).slice(2, 6);
144
+ return `${ts}-${rand}`;
145
+ }
146
+ /**
147
+ * Runs the PRD loop, iterating until all gates pass or maxIterations is reached.
148
+ *
149
+ * This is the native, programmatic way to run the gateproof retry loop.
150
+ * It can be called from scripts, tests, or integrated into custom tooling.
151
+ *
152
+ * @example
153
+ * ```ts
154
+ * import { runPrdLoop } from "gateproof/prd";
155
+ *
156
+ * const result = await runPrdLoop("./prd.ts", {
157
+ * maxIterations: 5,
158
+ * maxTotalMs: 300_000, // 5 minute wall-clock budget
159
+ * iterationTimeoutMs: 60_000, // 1 minute per agent call
160
+ * agent: async (ctx) => {
161
+ * // Make changes based on ctx.failureSummary
162
+ * return { changes: ["fixed the bug"] };
163
+ * },
164
+ * onIteration: (status) => {
165
+ * console.log(`Attempt ${status.attempt}: ${status.passed ? "passed" : "failed"}`);
166
+ * },
167
+ * });
168
+ *
169
+ * if (result.success) {
170
+ * console.log("All gates passed!");
171
+ * }
172
+ * ```
173
+ */
174
+ export async function runPrdLoop(
175
+ /** Path to prd.ts file OR a Story object to run a single story */
176
+ prdPathOrStory, options = {}) {
177
+ const { maxIterations = 7, maxTotalMs, iterationTimeoutMs, agent = defaultNoopAgent, onIteration, autoCommit = false, cwd = process.cwd(), reportPath, checkScope = true, baseRef, writeEvidenceLog = false, quiet = false, } = options;
178
+ const startTime = Date.now();
179
+ const gateproofDir = ensureGateproofDir(cwd);
180
+ const runId = generateRunId();
181
+ const effectiveReportPath = reportPath ?? resolve(gateproofDir, `prd-report-${runId}.json`);
182
+ // Determine the PRD path
183
+ let prdPath;
184
+ let singleStoryPrd;
185
+ if (typeof prdPathOrStory === "string") {
186
+ prdPath = resolve(cwd, prdPathOrStory);
187
+ }
188
+ else {
189
+ // Single story mode - create a synthetic PRD
190
+ const story = prdPathOrStory;
191
+ prdPath = resolve(cwd, "prd.ts"); // For context building only
192
+ singleStoryPrd = { stories: [story] };
193
+ }
194
+ const log = quiet ? () => { } : console.log;
195
+ for (let iteration = 1; iteration <= maxIterations; iteration++) {
196
+ // Check wall-clock budget
197
+ if (maxTotalMs && (Date.now() - startTime) >= maxTotalMs) {
198
+ log(`\n⏱️ Wall-clock budget exhausted (${maxTotalMs}ms)`);
199
+ break;
200
+ }
201
+ const iterStart = Date.now();
202
+ log(`\n=== PRD Loop Iteration ${iteration}/${maxIterations} ===`);
203
+ // Load or use the PRD
204
+ let prd;
205
+ if (singleStoryPrd) {
206
+ prd = singleStoryPrd;
207
+ }
208
+ else {
209
+ try {
210
+ // Clear module cache for hot reloading
211
+ delete require.cache[prdPath];
212
+ prd = await loadPrd(prdPath);
213
+ }
214
+ catch (err) {
215
+ const msg = err instanceof Error ? err.message : String(err);
216
+ return {
217
+ success: false,
218
+ attempts: iteration,
219
+ finalFailure: `Failed to load PRD: ${msg}`,
220
+ totalDurationMs: Date.now() - startTime,
221
+ };
222
+ }
223
+ }
224
+ // Run the PRD
225
+ const result = await runPrd(prd, cwd, {
226
+ reportPath: effectiveReportPath,
227
+ checkScope,
228
+ baseRef,
229
+ });
230
+ const iterDuration = Date.now() - iterStart;
231
+ // Build status for callback
232
+ const status = {
233
+ attempt: iteration,
234
+ passed: result.success,
235
+ failure: result.error?.message,
236
+ failedStory: result.failedStory,
237
+ durationMs: iterDuration,
238
+ };
239
+ // Write evidence log if enabled
240
+ if (writeEvidenceLog) {
241
+ appendEvidenceLog(cwd, iteration, status, result.report);
242
+ }
243
+ // Call iteration callback
244
+ onIteration?.(status);
245
+ if (result.success) {
246
+ log("\n✅ All PRD stories passed!");
247
+ return {
248
+ success: true,
249
+ attempts: iteration,
250
+ lastReport: result.report,
251
+ totalDurationMs: Date.now() - startTime,
252
+ };
253
+ }
254
+ log(`\n❌ Gate failed: ${result.failedStory?.id || "unknown"}`);
255
+ if (result.error) {
256
+ log(` ${result.error.message}`);
257
+ }
258
+ // If this is the last iteration, don't call the agent
259
+ if (iteration >= maxIterations) {
260
+ break;
261
+ }
262
+ // Check wall-clock budget before calling agent
263
+ if (maxTotalMs && (Date.now() - startTime) >= maxTotalMs) {
264
+ log(`\n⏱️ Wall-clock budget exhausted (${maxTotalMs}ms), skipping agent`);
265
+ break;
266
+ }
267
+ // Build context and call agent
268
+ const ctx = buildAgentContext(prdPath, result, iteration, baseRef ?? (process.env.CI ? "origin/main" : "HEAD"));
269
+ log("\n🤖 Calling agent to fix...");
270
+ try {
271
+ const agentResult = iterationTimeoutMs
272
+ ? await withTimeout((signal) => agent({ ...ctx, signal }), iterationTimeoutMs, "Agent call")
273
+ : await agent(ctx);
274
+ if (agentResult.changes.length > 0) {
275
+ log(` Made ${agentResult.changes.length} change(s):`);
276
+ for (const change of agentResult.changes.slice(0, 5)) {
277
+ log(` - ${change}`);
278
+ }
279
+ if (agentResult.changes.length > 5) {
280
+ log(` ... and ${agentResult.changes.length - 5} more`);
281
+ }
282
+ // Auto-commit if enabled
283
+ if (autoCommit && agentResult.commitMsg) {
284
+ const commitMsg = agentResult.commitMsg;
285
+ if (typeof autoCommit === "object" && autoCommit.git) {
286
+ await autoCommit.git.add(["."]);
287
+ await autoCommit.git.commit(commitMsg);
288
+ log(` 📝 Committed: ${commitMsg}`);
289
+ }
290
+ else {
291
+ try {
292
+ execSync(`git add -A && git commit -m ${JSON.stringify(commitMsg)}`, {
293
+ cwd,
294
+ encoding: "utf-8",
295
+ });
296
+ log(` 📝 Committed: ${commitMsg}`);
297
+ }
298
+ catch {
299
+ log(` ⚠️ Commit failed (maybe no changes?)`);
300
+ }
301
+ }
302
+ }
303
+ }
304
+ else {
305
+ log(" No changes made by agent");
306
+ }
307
+ }
308
+ catch (err) {
309
+ const msg = err instanceof Error ? err.message : String(err);
310
+ log(` ⚠️ Agent error: ${msg}`);
311
+ }
312
+ }
313
+ // Failed after all iterations
314
+ const lastReport = existsSync(effectiveReportPath)
315
+ ? JSON.parse(readFileSync(effectiveReportPath, "utf-8"))
316
+ : undefined;
317
+ return {
318
+ success: false,
319
+ attempts: maxIterations,
320
+ finalFailure: `Failed after ${maxIterations} iterations`,
321
+ lastReport,
322
+ totalDurationMs: Date.now() - startTime,
323
+ };
324
+ }
325
+ /**
326
+ * Creates an agent function that uses the OpenCode Zen API.
327
+ * This is a convenience wrapper for the most common use case.
328
+ *
329
+ * @example
330
+ * ```ts
331
+ * const agent = createOpenCodeAgent({
332
+ * apiKey: process.env.OPENCODE_ZEN_API_KEY,
333
+ * model: "big-pickle",
334
+ * timeoutMs: 60_000,
335
+ * });
336
+ *
337
+ * await runPrdLoop("./prd.ts", { agent });
338
+ * ```
339
+ */
340
+ export function createOpenCodeAgent(config) {
341
+ const { apiKey = process.env.OPENCODE_ZEN_API_KEY, endpoint = "https://opencode.ai/zen/v1", model = "big-pickle", maxSteps = 10, timeoutMs = 120_000, maxRetries = 1, } = config;
342
+ if (!apiKey) {
343
+ throw new Error("createOpenCodeAgent requires an API key (set OPENCODE_ZEN_API_KEY or pass apiKey)");
344
+ }
345
+ return async (ctx) => {
346
+ // Dynamic import to avoid requiring ai/openai-compatible as hard deps
347
+ const { generateText, tool } = await import("ai");
348
+ const { createOpenAICompatible } = await import("@ai-sdk/openai-compatible");
349
+ const { z } = await import("zod");
350
+ const { existsSync, readFileSync, writeFileSync } = await import("node:fs");
351
+ const opencode = createOpenAICompatible({
352
+ name: "opencode-zen",
353
+ apiKey,
354
+ baseURL: endpoint,
355
+ });
356
+ const changes = [];
357
+ // Define tools - using type assertions to work around strict AI SDK typing
358
+ // The runtime behavior is correct per AI SDK documentation
359
+ const readTool = tool({
360
+ description: "Read the contents of a file at the given path.",
361
+ parameters: z.object({
362
+ path: z.string().describe("The file path to read"),
363
+ }),
364
+ execute: async (params) => {
365
+ if (!existsSync(params.path))
366
+ return `Error: file not found: ${params.path}`;
367
+ return readFileSync(params.path, "utf8");
368
+ },
369
+ });
370
+ const writeTool = tool({
371
+ description: "Write file contents exactly (overwrites).",
372
+ parameters: z.object({
373
+ path: z.string().describe("File path"),
374
+ content: z.string().describe("Full file contents"),
375
+ }),
376
+ execute: async (params) => {
377
+ writeFileSync(params.path, params.content, "utf8");
378
+ changes.push(`Wrote ${params.path}`);
379
+ return `Wrote ${params.path}`;
380
+ },
381
+ });
382
+ const replaceTool = tool({
383
+ description: "Replace a string in a file. Fails if the string is not found.",
384
+ parameters: z.object({
385
+ path: z.string().describe("File path"),
386
+ old_string: z.string().describe("String to replace"),
387
+ new_string: z.string().describe("Replacement string"),
388
+ }),
389
+ execute: async (params) => {
390
+ if (!existsSync(params.path))
391
+ return `Error: file not found: ${params.path}`;
392
+ const content = readFileSync(params.path, "utf8");
393
+ if (!content.includes(params.old_string)) {
394
+ return `Error: string not found in ${params.path}`;
395
+ }
396
+ const next = content.replace(params.old_string, params.new_string);
397
+ writeFileSync(params.path, next, "utf8");
398
+ changes.push(`Updated ${params.path}`);
399
+ return `Updated ${params.path}`;
400
+ },
401
+ });
402
+ const tools = { read: readTool, write: writeTool, replace: replaceTool };
403
+ const prompt = `You are a gateproof loop agent.
404
+
405
+ Goal:
406
+ - Make the PRD pass (all gates green).
407
+
408
+ Rules:
409
+ - Use the provided tools to inspect and edit files.
410
+ - Keep changes minimal and scoped to what's needed to pass.
411
+ - Fix only the specific failing assertion.
412
+
413
+ PRD Content:
414
+ ${ctx.prdContent}
415
+
416
+ Failed Story:
417
+ ${ctx.prdSlice}
418
+
419
+ Failure Summary:
420
+ ${ctx.failureSummary}
421
+
422
+ Recent Diff:
423
+ ${ctx.recentDiff}
424
+ `;
425
+ // Retry wrapper for transient LLM errors (429, 5xx)
426
+ let lastError;
427
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
428
+ try {
429
+ await withTimeout((signal) => generateText({
430
+ model: opencode(model),
431
+ tools,
432
+ maxSteps: maxSteps,
433
+ prompt,
434
+ abortSignal: ctx.signal ?? signal,
435
+ }), timeoutMs, "LLM generateText");
436
+ // If we get here, the call succeeded
437
+ return {
438
+ changes,
439
+ commitMsg: changes.length > 0
440
+ ? `fix(prd): ${ctx.failedStory?.id || "gate"} - iteration ${ctx.iteration}`
441
+ : undefined,
442
+ };
443
+ }
444
+ catch (err) {
445
+ lastError = err;
446
+ const isRetryable = err instanceof Error && (err.message.includes("429") ||
447
+ err.message.includes("500") ||
448
+ err.message.includes("502") ||
449
+ err.message.includes("503") ||
450
+ err.message.includes("rate"));
451
+ if (isRetryable && attempt < maxRetries) {
452
+ const backoffMs = 1000 * Math.pow(2, attempt); // 1s, 2s, 4s...
453
+ await new Promise((r) => setTimeout(r, backoffMs));
454
+ continue;
455
+ }
456
+ throw err;
457
+ }
458
+ }
459
+ throw lastError;
460
+ };
461
+ }
462
+ //# sourceMappingURL=loop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/prd/loop.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAW,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAiB,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAqB,MAAM,UAAU,CAAC;AA+GrD;;GAEG;AACH,KAAK,UAAU,OAAO,CAAqB,OAAe;IACxD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,UAAU,YAAY,EAAE,CAAC,CAAC;IAEnD,oDAAoD;IACpD,IAAI,GAAG,CAAC,OAAO,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,SAAS,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAC/E,OAAO,GAAG,CAAC,OAAmB,CAAC;IACjC,CAAC;IACD,IAAI,GAAG,CAAC,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ,IAAI,SAAS,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;QACnE,OAAO,GAAG,CAAC,GAAe,CAAC;IAC7B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kEAAkE,OAAO,EAAE,CAAC,CAAC;AAC/F,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,UAAkB,MAAM,EA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BAC3B,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;oBAC3B,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC7B,CAAC;gBACF,IAAI,WAAW,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;oBACxC,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB;oBAC/D,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;oBACnD,SAAS;gBACX,CAAC;gBACD,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;QAED,MAAM,SAAS,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
@@ -8,11 +8,8 @@ export interface RunPrdResult {
8
8
  }
9
9
  /**
10
10
  * Runs a PRD by executing story gates in dependency order.
11
- * Stops on first failure.
12
- *
13
- * @param options.reportPath - If provided, writes a structured JSON report to this path
14
- * @param options.checkScope - If true, validates scope constraints against git diff
15
- * @param options.baseRef - Git ref to compare against for scope checking (default: "HEAD" for local, "origin/main" for CI)
11
+ * Independent stories (no mutual dependencies) within a level run concurrently.
12
+ * Stops on first failure within a level.
16
13
  */
17
14
  export declare function runPrd<TId extends string>(prd: Prd<TId>, cwd?: string, options?: {
18
15
  reportPath?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/prd/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAc,MAAM,SAAS,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAoC,MAAM,WAAW,CAAC;AAI/E,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IAC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