@makerkit/prd 0.0.4 → 0.0.5

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 (63) hide show
  1. package/.turbo/turbo-build.log +78 -0
  2. package/.turbo/turbo-test.log +19 -0
  3. package/.turbo/turbo-typecheck.log +6 -0
  4. package/README.md +7 -1
  5. package/dist/README.md +71 -0
  6. package/dist/attachment-paths-BAhRGiib.js +112 -0
  7. package/dist/attachment-paths-C-SWgoSx.mjs +77 -0
  8. package/dist/index.d.ts +81 -0
  9. package/{index.js → dist/index.js} +155 -562
  10. package/{index.mjs → dist/index.mjs} +87 -497
  11. package/{mcp.d.ts → dist/mcp.d.ts} +2 -4
  12. package/{mcp.js → dist/mcp.js} +24 -24
  13. package/{mcp.mjs → dist/mcp.mjs} +24 -24
  14. package/{node.d.ts → dist/node.d.ts} +4 -4
  15. package/{node.js → dist/node.js} +28 -4
  16. package/{node.mjs → dist/node.mjs} +30 -6
  17. package/dist/operations.d.ts +141 -0
  18. package/dist/operations.js +22 -0
  19. package/dist/operations.mjs +1 -0
  20. package/dist/package.json +54 -0
  21. package/dist/prd-operations-BvFxo9bg.mjs +459 -0
  22. package/dist/prd-operations-CcahfbOy.js +584 -0
  23. package/dist/prd.service-CTwKZV-3.d.ts +114 -0
  24. package/{prompts-oI_6dxvx.js → dist/prompts-1qhax_dj.js} +113 -164
  25. package/{prompts-CPlFVutB.mjs → dist/prompts-BlsYD0gf.mjs} +96 -129
  26. package/{prd.service-CV0-aQHk.d.ts → dist/schema-BwTnt0B9.d.ts} +424 -336
  27. package/package.json +26 -2
  28. package/src/__tests__/agent-workflow.test.ts +417 -0
  29. package/src/__tests__/attachments.test.ts +505 -0
  30. package/src/__tests__/node.test.ts +199 -0
  31. package/src/__tests__/plan-check.test.ts +390 -0
  32. package/src/__tests__/planning.test.ts +1137 -0
  33. package/src/__tests__/prd-operations.test.ts +571 -0
  34. package/src/__tests__/prd.service.test.ts +652 -0
  35. package/src/__tests__/prd.tool.test.ts +282 -0
  36. package/src/__tests__/templates.test.ts +145 -0
  37. package/src/applicability.ts +73 -0
  38. package/src/attachment-paths.ts +83 -0
  39. package/src/attachments.ts +166 -0
  40. package/src/edge-cases.ts +61 -0
  41. package/src/index.ts +33 -0
  42. package/src/markdown.ts +297 -0
  43. package/src/mcp/index.ts +875 -0
  44. package/src/mcp/tool-response.ts +85 -0
  45. package/src/node.ts +184 -0
  46. package/src/open-questions.ts +98 -0
  47. package/src/plan-check.ts +385 -0
  48. package/src/planning-operations.ts +524 -0
  49. package/src/prd-operations.ts +769 -0
  50. package/src/prd.service.ts +1165 -0
  51. package/src/prompts.ts +161 -0
  52. package/src/safe-file-name.ts +42 -0
  53. package/src/schema.ts +1090 -0
  54. package/src/templates.ts +173 -0
  55. package/src/testing/fake-mcp-server.ts +81 -0
  56. package/src/types.ts +381 -0
  57. package/tsconfig.json +23 -0
  58. package/tsconfig.lib.json +8 -0
  59. package/tsconfig.spec.json +7 -0
  60. package/tsdown.config.mts +12 -0
  61. package/vitest.config.mts +8 -0
  62. package/index.d.ts +0 -233
  63. /package/{LICENSE → dist/LICENSE} +0 -0
@@ -1,465 +1,8 @@
1
- import { $ as PhasesOutputSchema, A as DeleteUserStoryInputSchema, At as assertSafeFileName, B as GetPrdInputSchema, C as CriterionProofSchema, Ct as PRD_TEMPLATES, D as DeletePhaseInputSchema, Dt as attachmentsFolder, E as DecideEdgeCaseOutputSchema, Et as attachmentProjectPath, F as GetImplementationPromptsOutputSchema, G as GetStoryOutputSchema, H as GetProjectStatusInputSchema, I as GetImprovementSuggestionsInputSchema, J as ListTemplatesInputSchema, K as ListPrdsInputSchema, L as GetImprovementSuggestionsOutputSchema, M as ExportPrdMarkdownInputSchema, N as ExportPrdMarkdownOutputSchema, O as DeletePrdInputSchema, Ot as normalizeAttachments, P as GetImplementationPromptsInputSchema, Q as NotApplicableTopicSchema, R as GetNextStoryInputSchema, S as CreatePrdOutputSchema, St as UpdateUserStoryOutputSchema, T as DecideEdgeCaseInputSchema, Tt as getTemplate, U as GetProjectStatusOutputSchema, V as GetPrdOutputSchema, W as GetStoryInputSchema, X as MarkNotApplicableInputSchema, Y as ListTemplatesOutputSchema, Z as MarkNotApplicableOutputSchema, _ as CheckPlanInputSchema, _t as UpdatePrdSectionInputSchema, a as AddAttachmentInputSchema, at as ReorderPhasesInputSchema, b as CreateCustomPhaseOutputSchema, bt as UpdateStoryStatusOutputSchema, c as AddDecisionOutputSchema, ct as StoryAttachmentSchema, d as AddStoryLogInputSchema, dt as StoryPrioritySchema, et as PrdSectionValueSchemas, f as AddStoryLogOutputSchema, ft as StoryStatusSchema, g as AssignStoryToPhaseOutputSchema, gt as UpdatePhaseInputSchema, h as AssignStoryToPhaseInputSchema, ht as UpdateAttachmentOutputSchema, i as shapePrdPrompt, it as RemoveAttachmentOutputSchema, j as DeleteUserStoryOutputSchema, jt as assertSafeRelativePath, k as DeletePrdOutputSchema, kt as resolveAttachments, l as AddGlossaryTermInputSchema, lt as StoryComplexitySchema, m as AddUserStoryOutputSchema, mt as UpdateAttachmentInputSchema, n as implementStoryPrompt, nt as ProofKindSchema, o as AddAttachmentOutputSchema, ot as ResolveOpenQuestionInputSchema, p as AddUserStoryInputSchema, pt as StoryVerificationSchema, q as ListPrdsOutputSchema, r as reviewStoryPrompt, rt as RemoveAttachmentInputSchema, s as AddDecisionInputSchema, st as ResolveOpenQuestionOutputSchema, t as architectPrdPrompt, tt as PrdSummarySchema, u as AddGlossaryTermOutputSchema, ut as StoryLogEntrySchema, v as CheckPlanOutputSchema, vt as UpdatePrdSectionOutputSchema, w as CustomPhaseSchema, wt as TEMPLATE_IDS, x as CreatePrdInputSchema, xt as UpdateUserStoryInputSchema, y as CreateCustomPhaseInputSchema, yt as UpdateStoryStatusInputSchema, z as GetNextStoryOutputSchema } from "./prompts-CPlFVutB.mjs";
2
- import { join } from "node:path";
3
- //#region src/edge-cases.ts
4
- /**
5
- * Edge cases as stored, with hand-edited entries that would break readers
6
- * dropped: each needs a string id and case; status defaults to "open".
7
- */
8
- function normalizeEdgeCases(value) {
9
- if (!Array.isArray(value)) return [];
10
- return value.flatMap((entry) => {
11
- if (typeof entry !== "object" || entry === null) return [];
12
- const { id, case: caseText, expectedBehavior, status, storyIds } = entry;
13
- if (typeof id !== "string" || typeof caseText !== "string" || !caseText) return [];
14
- const ids = Array.isArray(storyIds) ? storyIds.filter((storyId) => typeof storyId === "string") : [];
15
- return [{
16
- id,
17
- case: caseText,
18
- expectedBehavior: typeof expectedBehavior === "string" ? expectedBehavior : "",
19
- status: status === "decided" ? "decided" : "open",
20
- ...ids.length > 0 ? { storyIds: ids } : {}
21
- }];
22
- });
23
- }
24
- /** The edge cases that apply to a story: those linked to it, and those linked to no story. */
25
- function edgeCasesForStory(prd, storyId) {
26
- return prd.edgeCases.filter((edgeCase) => !edgeCase.storyIds?.length || edgeCase.storyIds.includes(storyId));
27
- }
28
- /** Accepted decisions whose topic starts with `design`, e.g. `design:navigation`. */
29
- function designDecisions(prd) {
30
- return prd.decisionLog.filter((entry) => entry.status === "accepted" && entry.topic?.startsWith("design"));
31
- }
32
- //#endregion
33
- //#region src/prd-operations.ts
34
- /**
35
- * Pure PRD transforms.
36
- *
37
- * Everything here takes an already-loaded `StructuredPRD`, mutates it, and
38
- * returns the tool payload. No filesystem, no clock, no deps — the service is
39
- * left with load → transform → save, and every rule below is unit-testable
40
- * without a harness.
41
- */
42
- /**
43
- * Issues the next story id and advances the high-water mark.
44
- *
45
- * Deliberately not `max(existing) + 1`: delete the highest-numbered story and
46
- * that hands its id straight to the next one, so a story id quoted in a commit
47
- * or a decision-log topic would silently come to mean something else.
48
- */
49
- function nextId(items, prefix) {
50
- const highest = items.reduce((max, item) => {
51
- const match = new RegExp(`^${prefix}(\\d+)$`).exec(item.id);
52
- return match ? Math.max(max, Number(match[1])) : max;
53
- }, 0);
54
- return `${prefix}${String(highest + 1).padStart(3, "0")}`;
55
- }
56
- function nextStoryId(prd) {
57
- const highestPresent = prd.userStories.reduce((max, story) => {
58
- const match = /^US(\d+)$/.exec(story.id);
59
- return match ? Math.max(max, Number(match[1])) : max;
60
- }, 0);
61
- const next = Math.max(prd.metadata.lastStoryNumber ?? 0, highestPresent) + 1;
62
- prd.metadata.lastStoryNumber = next;
63
- return `US${String(next).padStart(3, "0")}`;
64
- }
65
- function recomputeProgress(prd) {
66
- const total = prd.userStories.length;
67
- const completed = prd.userStories.filter((story) => story.status === "completed").length;
68
- prd.progress = {
69
- completed,
70
- blocked: prd.userStories.filter((story) => story.status === "blocked").length,
71
- total,
72
- overall: total > 0 ? Math.round(completed / total * 100) : 0
73
- };
74
- }
75
- function appendChangeLog(prd, entry, today) {
76
- prd.changeLog.push(`${today}: ${entry}`);
77
- }
78
- function findStory(prd, storyId) {
79
- const story = prd.userStories.find((candidate) => candidate.id === storyId);
80
- if (!story) {
81
- const known = prd.userStories.map((candidate) => candidate.id).join(", ");
82
- throw new Error(`Story ${storyId} not found.` + (known ? ` Known stories: ${known}.` : " This PRD has no stories yet."));
83
- }
84
- return story;
85
- }
86
- const USER_STORY_SENTENCE = /^As an?\s+(.+?),\s*I want to\s+(.+?)\s+so that\s+(.+)$/i;
87
- /** Splits the rendered sentence back into its parts so one can be patched. */
88
- /** The parts of an "As a X, I want to Y so that Z" story, or undefined. */
89
- function splitUserStory(sentence) {
90
- const match = USER_STORY_SENTENCE.exec(sentence.trim());
91
- if (!match) return;
92
- return {
93
- userType: match[1],
94
- action: match[2],
95
- benefit: match[3]
96
- };
97
- }
98
- function renderUserStory(parts) {
99
- return `As a ${parts.userType}, I want to ${parts.action} so that ${parts.benefit}`;
100
- }
101
- function updateStory(prd, input, today) {
102
- const story = findStory(prd, input.storyId);
103
- const updated = [];
104
- if (input.userType !== void 0 || input.action !== void 0 || input.benefit !== void 0) {
105
- const current = splitUserStory(story.userStory);
106
- if (!current && (input.userType === void 0 || input.action === void 0 || input.benefit === void 0)) throw new Error(`Story ${story.id} does not use the "As a X, I want to Y so that Z" form, so its parts cannot be patched individually. Supply userType, action and benefit together.`);
107
- story.userStory = renderUserStory({
108
- userType: input.userType ?? current.userType,
109
- action: input.action ?? current.action,
110
- benefit: input.benefit ?? current.benefit
111
- });
112
- updated.push("userStory");
113
- if (input.benefit !== void 0 && input.businessValue === void 0) {
114
- story.businessValue = input.benefit;
115
- updated.push("businessValue");
116
- }
117
- }
118
- if (input.title !== void 0) {
119
- story.title = input.title;
120
- updated.push("title");
121
- }
122
- if (input.testSeams !== void 0) {
123
- story.testSeams = input.testSeams;
124
- updated.push("testSeams");
125
- }
126
- if (input.designNotes !== void 0) {
127
- story.designNotes = withoutBlanks(input.designNotes);
128
- updated.push("designNotes");
129
- }
130
- if (input.securityNotes !== void 0) {
131
- story.securityNotes = withoutBlanks(input.securityNotes);
132
- updated.push("securityNotes");
133
- }
134
- if (input.businessValue !== void 0) {
135
- story.businessValue = input.businessValue;
136
- updated.push("businessValue");
137
- }
138
- if (input.acceptanceCriteria !== void 0) {
139
- story.acceptanceCriteria = input.acceptanceCriteria.filter((entry) => entry.trim().length > 0);
140
- updated.push("acceptanceCriteria");
141
- if (input.proofs === void 0 && story.proofs?.length) {
142
- const kept = story.proofs.filter((proof) => story.acceptanceCriteria.includes(proof.criterion));
143
- if (kept.length !== story.proofs.length) {
144
- story.proofs = kept;
145
- updated.push("proofs");
146
- }
147
- }
148
- }
149
- if (input.proofs !== void 0) {
150
- story.proofs = validateProofs(story.acceptanceCriteria, input.proofs);
151
- updated.push("proofs");
152
- }
153
- if (input.priority !== void 0) {
154
- story.priority = input.priority;
155
- updated.push("priority");
156
- }
157
- if (input.estimatedComplexity !== void 0) {
158
- story.estimatedComplexity = input.estimatedComplexity;
159
- updated.push("estimatedComplexity");
160
- }
161
- if (input.dependencies !== void 0) {
162
- story.dependencies = validateDependencies(prd, story.id, input.dependencies);
163
- updated.push("dependencies");
164
- }
165
- if (input.notes !== void 0) {
166
- story.notes = input.notes;
167
- updated.push("notes");
168
- }
169
- if (input.attachmentIds !== void 0) {
170
- story.attachmentIds = validateAttachmentIds(prd, input.attachmentIds);
171
- updated.push("attachmentIds");
172
- }
173
- if (input.phaseId !== void 0) {
174
- assignStoryToPhase(prd, {
175
- filename: input.filename,
176
- storyId: story.id,
177
- phaseId: input.phaseId
178
- }, today);
179
- updated.push("phase");
180
- }
181
- if (updated.length === 0) throw new Error(`No fields supplied to update on ${story.id}. Provide at least one of: title, userType, action, benefit, businessValue, acceptanceCriteria, priority, estimatedComplexity, dependencies, notes, testSeams, proofs, designNotes, securityNotes, attachmentIds, phaseId.`);
182
- appendChangeLog(prd, `Updated ${story.id} (${updated.join(", ")})`, today);
183
- return {
184
- story_id: story.id,
185
- title: story.title,
186
- updated_fields: [...new Set(updated)],
187
- story
188
- };
189
- }
190
- function findAttachment(prd, attachmentId) {
191
- const attachment = prd.attachments.find((candidate) => candidate.id === attachmentId);
192
- if (!attachment) throw new Error(`Attachment "${attachmentId}" not found.`);
193
- return attachment;
194
- }
195
- /** Attachment ids must name attachments in the PRD. */
196
- function validateAttachmentIds(prd, ids) {
197
- for (const id of ids) findAttachment(prd, id);
198
- return [...new Set(ids)];
199
- }
200
- /**
201
- * Each proof must name one of the story's criteria, at most once, and a proof
202
- * no test makes must say why — the reason is what a reviewer judges.
203
- */
204
- function validateProofs(criteria, proofs) {
205
- const seen = /* @__PURE__ */ new Set();
206
- return proofs.map((proof) => {
207
- const criterion = criteria.find((candidate) => candidate.trim() === proof.criterion.trim());
208
- if (criterion === void 0) throw new Error(`Proof names a criterion the story does not have: "${proof.criterion}". Copy the criterion exactly.`);
209
- if (seen.has(criterion)) throw new Error(`Criterion "${criterion}" has more than one proof.`);
210
- seen.add(criterion);
211
- const reason = proof.reason?.trim();
212
- if ((proof.kind === "manual" || proof.kind === "post-deploy") && !reason) throw new Error(`A ${proof.kind} proof needs a reason: why no test can prove "${criterion}".`);
213
- const rubric = (proof.rubric ?? []).map((point) => point.trim()).filter(Boolean);
214
- if (proof.kind === "judge" && rubric.length === 0) throw new Error(`A judge proof needs a rubric: what the reviewer scores "${criterion}" against.`);
215
- const seam = proof.seam?.trim();
216
- const fallback = proof.fallback?.trim();
217
- return {
218
- criterion,
219
- kind: proof.kind,
220
- ...seam ? { seam } : {},
221
- ...reason ? { reason } : {},
222
- ...fallback ? { fallback } : {},
223
- ...rubric.length > 0 ? { rubric } : {}
224
- };
225
- });
226
- }
227
- /**
228
- * Dependencies must name real stories, never the story itself, and never form
229
- * a cycle — an unsatisfiable order is worse than no order at all.
230
- */
231
- function validateDependencies(prd, storyId, dependencies) {
232
- const unique = [...new Set(dependencies.filter((id) => id.trim().length > 0))];
233
- for (const id of unique) {
234
- if (id === storyId) throw new Error(`Story ${storyId} cannot depend on itself.`);
235
- findStory(prd, id);
236
- }
237
- const cycle = findCycle(new Map(prd.userStories.map((story) => [story.id, story.id === storyId ? unique : story.dependencies])), storyId);
238
- if (cycle) throw new Error(`Dependency cycle: ${cycle.join(" -> ")}. Remove one of these links.`);
239
- return unique;
240
- }
241
- function findCycle(edges, from) {
242
- const visiting = /* @__PURE__ */ new Set();
243
- const done = /* @__PURE__ */ new Set();
244
- const walk = (id, trail) => {
245
- if (done.has(id)) return void 0;
246
- if (visiting.has(id)) return [...trail, id];
247
- visiting.add(id);
248
- for (const next of edges.get(id) ?? []) {
249
- const found = walk(next, [...trail, id]);
250
- if (found) return found;
251
- }
252
- visiting.delete(id);
253
- done.add(id);
254
- };
255
- return walk(from, []);
256
- }
257
- function deleteStory(prd, storyId, today) {
258
- const story = findStory(prd, storyId);
259
- prd.userStories = prd.userStories.filter((candidate) => candidate.id !== storyId);
260
- const dependencyReferencesRemoved = [];
261
- for (const candidate of prd.userStories) if (candidate.dependencies.includes(storyId)) {
262
- candidate.dependencies = candidate.dependencies.filter((id) => id !== storyId);
263
- dependencyReferencesRemoved.push(candidate.id);
264
- }
265
- const phasesUpdated = [];
266
- for (const phase of prd.customPhases) if (phase.userStoryIds.includes(storyId)) {
267
- phase.userStoryIds = phase.userStoryIds.filter((id) => id !== storyId);
268
- phasesUpdated.push(phase.id);
269
- }
270
- prd.edgeCases = prd.edgeCases.flatMap((edgeCase) => {
271
- if (!edgeCase.storyIds?.includes(storyId)) return [edgeCase];
272
- const storyIds = edgeCase.storyIds.filter((id) => id !== storyId);
273
- return storyIds.length > 0 ? [{
274
- ...edgeCase,
275
- storyIds
276
- }] : [];
277
- });
278
- for (const question of prd.openQuestions) if (question.storyIds?.includes(storyId)) {
279
- const storyIds = question.storyIds.filter((id) => id !== storyId);
280
- if (storyIds.length > 0) question.storyIds = storyIds;
281
- else delete question.storyIds;
282
- }
283
- for (const entry of prd.decisionLog) if (entry.topic?.startsWith(`story:${storyId}:`) && entry.status === "accepted") entry.status = "superseded";
284
- recomputeProgress(prd);
285
- appendChangeLog(prd, `Deleted ${storyId} (${story.title})`, today);
286
- return {
287
- story_id: storyId,
288
- title: story.title,
289
- total_stories: prd.userStories.length,
290
- progress: prd.progress.overall,
291
- dependency_references_removed: dependencyReferencesRemoved,
292
- phases_updated: phasesUpdated
293
- };
294
- }
295
- function createPhase(prd, input, today) {
296
- const name = input.name.trim();
297
- if (prd.customPhases.some((phase) => phase.name.toLowerCase() === name.toLowerCase())) throw new Error(`A phase named "${name}" already exists.`);
298
- const phase = {
299
- id: nextId(prd.customPhases, "PHASE"),
300
- name,
301
- description: input.description,
302
- color: input.color,
303
- order: prd.customPhases.length,
304
- userStoryIds: []
305
- };
306
- prd.customPhases.push(phase);
307
- appendChangeLog(prd, `Created phase ${phase.id} (${name})`, today);
308
- return {
309
- phase: {
310
- id: phase.id,
311
- name: phase.name,
312
- description: phase.description,
313
- color: phase.color,
314
- order: phase.order,
315
- user_story_ids: phase.userStoryIds
316
- },
317
- total_phases: prd.customPhases.length
318
- };
319
- }
320
- function assignStoryToPhase(prd, input, today) {
321
- findStory(prd, input.storyId);
322
- const target = input.phaseId === null ? void 0 : prd.customPhases.find((phase) => phase.id === input.phaseId);
323
- if (input.phaseId !== null && !target) {
324
- const known = prd.customPhases.map((phase) => phase.id).join(", ");
325
- throw new Error(`Phase "${input.phaseId}" not found.` + (known ? ` Known phases: ${known}.` : " This PRD has no phases yet."));
326
- }
327
- const previous = prd.customPhases.find((phase) => phase.userStoryIds.includes(input.storyId));
328
- for (const phase of prd.customPhases) phase.userStoryIds = phase.userStoryIds.filter((id) => id !== input.storyId);
329
- target?.userStoryIds.push(input.storyId);
330
- appendChangeLog(prd, target ? `Assigned ${input.storyId} to ${target.id} (${target.name})` : `Removed ${input.storyId} from all phases`, today);
331
- return {
332
- story_id: input.storyId,
333
- phase_id: target?.id ?? null,
334
- phase_name: target?.name ?? null,
335
- moved_from: previous && previous.id !== target?.id ? previous.id : null
336
- };
337
- }
338
- /** Statuses that mean work on the story has started or finished. */
339
- const WORK_STATUSES = [
340
- "in_progress",
341
- "review",
342
- "completed"
343
- ];
344
- const PRIORITY_ORDER = {
345
- P0: 0,
346
- P1: 1,
347
- P2: 2,
348
- P3: 3
349
- };
350
- /** Dependencies of `story` that are not completed yet. */
351
- function incompleteDependencies(prd, story) {
352
- return story.dependencies.filter((id) => {
353
- return prd.userStories.find((candidate) => candidate.id === id)?.status !== "completed";
354
- });
355
- }
356
- /**
357
- * A story cannot be worked on, reviewed or completed before the stories it
358
- * depends on are completed. `not_started`, `research` and `blocked` stay
359
- * available so a story can still be planned or parked.
360
- */
361
- function assertCanEnterStatus(prd, story, status) {
362
- if (!WORK_STATUSES.includes(status)) return;
363
- const waitingOn = incompleteDependencies(prd, story);
364
- if (waitingOn.length > 0) throw new Error(`Cannot move ${story.id} to ${status}: it depends on ${waitingOn.join(", ")}, which ${waitingOn.length === 1 ? "is" : "are"} not completed yet.`);
365
- }
366
- /** Position of the story's phase; stories without a phase come last. */
367
- function phaseRank(prd, storyId) {
368
- const phase = prd.customPhases.find((candidate) => candidate.userStoryIds.includes(storyId));
369
- return phase ? phase.order : Number.MAX_SAFE_INTEGER;
370
- }
371
- /**
372
- * The next story to start: not started, every dependency completed, ordered
373
- * by phase, then priority, then position in the PRD.
374
- */
375
- function pickNextStory(prd) {
376
- const notStarted = prd.userStories.filter((story) => story.status === "not_started");
377
- const ready = notStarted.filter((story) => incompleteDependencies(prd, story).length === 0).sort((a, b) => phaseRank(prd, a.id) - phaseRank(prd, b.id) || PRIORITY_ORDER[a.priority] - PRIORITY_ORDER[b.priority] || prd.userStories.indexOf(a) - prd.userStories.indexOf(b));
378
- const waiting = notStarted.map((story) => ({
379
- id: story.id,
380
- title: story.title,
381
- waiting_on: incompleteDependencies(prd, story)
382
- })).filter((entry) => entry.waiting_on.length > 0);
383
- return {
384
- story: ready[0] ?? null,
385
- ready_count: ready.length,
386
- in_progress: prd.userStories.filter((story) => story.status === "in_progress").map((story) => story.id),
387
- waiting
388
- };
389
- }
390
- /**
391
- * Everything an agent needs to work on one story without loading the whole
392
- * PRD: the story, the scope boundaries, its dependencies with their hand-off
393
- * logs, and the log of the most recently completed story.
394
- */
395
- /** `filename` is the PRD's file name, used to give attachment paths. */
396
- function buildStoryContext(prd, storyId, filename) {
397
- const story = findStory(prd, storyId);
398
- const linked = new Set(story.attachmentIds ?? []);
399
- const phase = prd.customPhases.find((candidate) => candidate.userStoryIds.includes(story.id)) ?? null;
400
- const lastCompleted = prd.userStories.filter((candidate) => candidate.status === "completed").filter((candidate) => candidate.id !== story.id).sort((a, b) => (a.completedAt ?? "").localeCompare(b.completedAt ?? "")).at(-1) ?? null;
401
- return {
402
- prd: {
403
- title: prd.introduction.title,
404
- overview: prd.introduction.overview,
405
- non_goals: prd.nonGoals,
406
- out_of_scope: prd.outOfScope,
407
- global_acceptance_criteria: prd.acceptanceCriteria.global,
408
- attachments: resolveAttachments(filename, prd.attachments)
409
- },
410
- story,
411
- attachments: resolveAttachments(filename, prd.attachments.filter((attachment) => linked.has(attachment.id))),
412
- phase: phase ? {
413
- id: phase.id,
414
- name: phase.name
415
- } : null,
416
- edge_cases: edgeCasesForStory(prd, story.id),
417
- open_questions: prd.openQuestions.filter((question) => question.storyIds?.includes(story.id)),
418
- security: {
419
- permissions: prd.technicalContracts.permissions,
420
- compliance: prd.technicalRequirements.complianceRequirements,
421
- considerations: prd.securityConsiderations,
422
- story_notes: story.securityNotes ?? []
423
- },
424
- not_applicable: prd.notApplicable,
425
- design: {
426
- guidance: prd.designGuidance,
427
- story_notes: story.designNotes ?? [],
428
- decisions: designDecisions(prd).map(({ id, decision, rationale }) => ({
429
- id,
430
- decision,
431
- rationale
432
- }))
433
- },
434
- dependencies: story.dependencies.map((id) => {
435
- const dependency = prd.userStories.find((candidate) => candidate.id === id);
436
- return {
437
- id,
438
- title: dependency?.title ?? null,
439
- status: dependency?.status ?? null,
440
- log: dependency?.log ?? []
441
- };
442
- }),
443
- previous_story: lastCompleted ? {
444
- id: lastCompleted.id,
445
- title: lastCompleted.title,
446
- log: lastCompleted.log ?? []
447
- } : null
448
- };
449
- }
450
- function appendStoryLog(prd, storyId, entry) {
451
- const story = findStory(prd, storyId);
452
- story.log = [...story.log ?? [], entry];
453
- return {
454
- story_id: story.id,
455
- entries: story.log.length
456
- };
457
- }
458
- function withoutBlanks(entries) {
459
- return entries.map((entry) => entry.trim()).filter(Boolean);
460
- }
461
- //#endregion
462
- //#region src/applicability.ts
1
+ import { _ as updateStory, a as buildStoryContext, b as validateProofs, c as findAttachment, d as nextId, f as nextStoryId, g as splitUserStory, h as renderUserStory, i as assignStoryToPhase, l as findStory, m as recomputeProgress, n as appendStoryLog, o as createPhase, p as pickNextStory, r as assertCanEnterStatus, s as deleteStory, t as appendChangeLog, u as incompleteDependencies, v as validateAttachmentIds, x as normalizeEdgeCases, y as validateDependencies } from "./prd-operations-BvFxo9bg.mjs";
2
+ import { a as assertSafeFileName, i as resolveAttachments, n as attachmentsFolder, o as assertSafeRelativePath, r as normalizeAttachments, t as attachmentProjectPath } from "./attachment-paths-C-SWgoSx.mjs";
3
+ import { $ as PhasesOutputSchema, A as DeleteUserStoryInputSchema, B as GetPrdInputSchema, C as CriterionProofSchema, Ct as UpdateStoryStatusOutputSchema, D as DeletePhaseInputSchema, Dt as TEMPLATE_IDS, E as DecideEdgeCaseOutputSchema, Et as PRD_TEMPLATES, F as GetImplementationPromptsOutputSchema, G as GetStoryOutputSchema, H as GetProjectStatusInputSchema, I as GetImprovementSuggestionsInputSchema, J as ListTemplatesInputSchema, K as ListPrdsInputSchema, L as GetImprovementSuggestionsOutputSchema, M as ExportPrdMarkdownInputSchema, N as ExportPrdMarkdownOutputSchema, O as DeletePrdInputSchema, Ot as getTemplate, P as GetImplementationPromptsInputSchema, Q as NotApplicableTopicSchema, R as GetNextStoryInputSchema, S as CreatePrdOutputSchema, St as UpdateStoryStatusInputSchema, T as DecideEdgeCaseInputSchema, Tt as UpdateUserStoryOutputSchema, U as GetProjectStatusOutputSchema, V as GetPrdOutputSchema, W as GetStoryInputSchema, X as MarkNotApplicableInputSchema, Y as ListTemplatesOutputSchema, Z as MarkNotApplicableOutputSchema, _ as CheckPlanInputSchema, _t as UpdateAttachmentInputSchema, a as AddAttachmentInputSchema, at as ProofKindSchema, b as CreateCustomPhaseOutputSchema, bt as UpdatePrdSectionInputSchema, c as AddDecisionOutputSchema, ct as ReorderPhasesInputSchema, d as AddStoryLogInputSchema, dt as StoryAttachmentSchema, et as PrdCriticalitySchema, f as AddStoryLogOutputSchema, ft as StoryComplexitySchema, g as AssignStoryToPhaseOutputSchema, gt as StoryVerificationSchema, h as AssignStoryToPhaseInputSchema, ht as StoryStatusSchema, i as shapePrdPrompt, it as PrdSummarySchema, j as DeleteUserStoryOutputSchema, k as DeletePrdOutputSchema, l as AddGlossaryTermInputSchema, lt as ResolveOpenQuestionInputSchema, m as AddUserStoryOutputSchema, mt as StoryPrioritySchema, n as implementStoryPrompt, nt as PrdRoadmapUpdateSchema, o as AddAttachmentOutputSchema, ot as RemoveAttachmentInputSchema, p as AddUserStoryInputSchema, pt as StoryLogEntrySchema, q as ListPrdsOutputSchema, r as reviewStoryPrompt, rt as PrdSectionValueSchemas, s as AddDecisionInputSchema, st as RemoveAttachmentOutputSchema, t as architectPrdPrompt, tt as PrdRoadmapSchema, u as AddGlossaryTermOutputSchema, ut as ResolveOpenQuestionOutputSchema, v as CheckPlanOutputSchema, vt as UpdateAttachmentOutputSchema, w as CustomPhaseSchema, wt as UpdateUserStoryInputSchema, x as CreatePrdInputSchema, xt as UpdatePrdSectionOutputSchema, y as CreateCustomPhaseInputSchema, yt as UpdatePhaseInputSchema, z as GetNextStoryOutputSchema } from "./prompts-BlsYD0gf.mjs";
4
+ import { isAbsolute, join, relative, sep } from "node:path";
5
+ // src/applicability.ts
463
6
  /**
464
7
  * Parts of a PRD that can be marked "not applicable" (e.g. no rollout plan
465
8
  * for an internal tool), so the plan check stops asking for them and agents
@@ -503,8 +46,7 @@ function setNotApplicable(prd, input, today) {
503
46
  reason: prd.notApplicable[input.topic] ?? null
504
47
  };
505
48
  }
506
- //#endregion
507
- //#region src/attachments.ts
49
+ // src/attachments.ts
508
50
  /**
509
51
  * Adds an attachment and links it to the given stories. The caller checks
510
52
  * that a `path` exists on disk; this only validates the PRD.
@@ -592,8 +134,7 @@ function updateAttachment(prd, input, today) {
592
134
  stories_updated: storiesUpdated
593
135
  };
594
136
  }
595
- //#endregion
596
- //#region src/markdown.ts
137
+ // src/markdown.ts
597
138
  const STATUS_LABELS = {
598
139
  not_started: "[not started]",
599
140
  research: "[research]",
@@ -726,8 +267,7 @@ function bullets(items, emptyLabel) {
726
267
  if (items.length === 0) return emptyLabel ? [`- ${emptyLabel}`] : [];
727
268
  return items.map((item) => `- ${item}`);
728
269
  }
729
- //#endregion
730
- //#region src/open-questions.ts
270
+ // src/open-questions.ts
731
271
  /**
732
272
  * Open questions as stored. Older files hold plain strings; they become
733
273
  * questions with ids in list order. Entries without question text are dropped.
@@ -786,8 +326,7 @@ function blockingQuestions(prd) {
786
326
  const unfinished = new Set(prd.userStories.filter((story) => story.status !== "completed").map((story) => story.id));
787
327
  return prd.openQuestions.filter((question) => question.storyIds?.some((id) => unfinished.has(id)));
788
328
  }
789
- //#endregion
790
- //#region src/plan-check.ts
329
+ // src/plan-check.ts
791
330
  /** The not-applicable topic each "missing" check is about. */
792
331
  const CHECK_TOPICS = {
793
332
  "edge-cases": "edgeCases",
@@ -1001,8 +540,7 @@ function checkPlan(prd) {
1001
540
  items: applicable
1002
541
  };
1003
542
  }
1004
- //#endregion
1005
- //#region src/planning-operations.ts
543
+ // src/planning-operations.ts
1006
544
  /**
1007
545
  * Pure transforms for shaping a PRD after it was created: sections, decisions,
1008
546
  * open questions, glossary and phases. Same contract as `prd-operations`:
@@ -1024,7 +562,16 @@ function updatePrdSection(prd, input, today) {
1024
562
  }
1025
563
  const value = parsed.data;
1026
564
  let updated;
1027
- if (input.section === "risks") {
565
+ if (input.section === "roadmap") {
566
+ const patch = value;
567
+ const merged = Object.fromEntries(Object.entries({
568
+ ...prd.roadmap,
569
+ ...patch
570
+ }).filter(([key, value]) => !(Object.hasOwn(patch, key) && value == null)));
571
+ if (Object.keys(merged).length > 0) prd.roadmap = merged;
572
+ else delete prd.roadmap;
573
+ updated = Object.keys(patch);
574
+ } else if (input.section === "risks") {
1028
575
  const risks = value;
1029
576
  const assigned = [];
1030
577
  for (const risk of risks) assigned.push({
@@ -1247,8 +794,7 @@ function phasesPayload(prd) {
1247
794
  function normalizeText(value) {
1248
795
  return value.trim().replace(/\s+/g, " ").toLowerCase();
1249
796
  }
1250
- //#endregion
1251
- //#region src/prd.service.ts
797
+ // src/prd.service.ts
1252
798
  /**
1253
799
  * A write was based on an older revision of the PRD than the one on disk:
1254
800
  * someone else (an agent, Loop, another editor) changed it in between. Read
@@ -1272,11 +818,17 @@ function createPrdService(deps) {
1272
818
  }
1273
819
  var PrdService = class {
1274
820
  deps;
821
+ pendingWrite = Promise.resolve();
1275
822
  constructor(deps) {
1276
823
  this.deps = deps;
1277
824
  }
1278
825
  get prdsDir() {
1279
- return join(this.deps.rootPath, ".prds");
826
+ return this.deps.prdsDir ?? join(this.deps.rootPath, ".prds");
827
+ }
828
+ /** Path for agent-facing instructions, relative to the project when possible. */
829
+ get prdsPath() {
830
+ const path = relative(this.deps.rootPath, this.prdsDir);
831
+ return (isAbsolute(path) || path === ".." || path.startsWith(`..${sep}`) ? this.prdsDir : path || ".").split(sep).join("/");
1280
832
  }
1281
833
  async list() {
1282
834
  const filenames = await this.listFilenames();
@@ -1291,11 +843,20 @@ var PrdService = class {
1291
843
  progress: prd.progress.overall,
1292
844
  total_stories: prd.progress.total,
1293
845
  completed_stories: prd.progress.completed,
1294
- blocked_stories: prd.progress.blocked
846
+ blocked_stories: prd.progress.blocked,
847
+ ...prd.roadmap ? { roadmap: prd.roadmap } : {}
1295
848
  });
1296
849
  } catch (error) {
1297
850
  warnings.push(`Skipped ${filename}: ${error instanceof Error ? error.message : "unreadable"}`);
1298
851
  }
852
+ prds.sort((a, b) => {
853
+ const orderA = a.roadmap?.order ?? 1e400;
854
+ const orderB = b.roadmap?.order ?? 1e400;
855
+ const criticality = PrdCriticalitySchema.options;
856
+ const rankA = a.roadmap?.criticality ? criticality.indexOf(a.roadmap.criticality) : criticality.length;
857
+ const rankB = b.roadmap?.criticality ? criticality.indexOf(b.roadmap.criticality) : criticality.length;
858
+ return orderA === orderB ? rankA - rankB : orderA - orderB;
859
+ });
1299
860
  return {
1300
861
  prds,
1301
862
  total: prds.length,
@@ -1320,6 +881,7 @@ var PrdService = class {
1320
881
  const today = this.today();
1321
882
  const defaults = input.template ? getTemplate(input.template).defaults : {};
1322
883
  const prd = {
884
+ ...input.roadmap ? { roadmap: PrdRoadmapSchema.parse(input.roadmap) } : {},
1323
885
  introduction: {
1324
886
  title: input.title,
1325
887
  overview: input.overview,
@@ -1488,7 +1050,7 @@ var PrdService = class {
1488
1050
  const current = await this.load(filename);
1489
1051
  const currentRevision = current.metadata.revision ?? 0;
1490
1052
  if (input.expectedRevision !== void 0 && input.expectedRevision !== currentRevision) throw new PrdRevisionConflictError(filename, input.expectedRevision, currentRevision);
1491
- assertCanEnterStatus(current, findStory(current, input.storyId), input.status);
1053
+ this.assertStoryStatusUpdate(current, input);
1492
1054
  if (input.recordDeviations?.length) {
1493
1055
  if (input.status !== "completed") throw new Error("Deviations are recorded only when a story is completed.");
1494
1056
  assertLoggedDeviations(findStory(current, input.storyId), input.recordDeviations);
@@ -1504,8 +1066,7 @@ var PrdService = class {
1504
1066
  };
1505
1067
  }
1506
1068
  const prd = await this.load(filename);
1507
- const story = findStory(prd, input.storyId);
1508
- assertCanEnterStatus(prd, story, input.status);
1069
+ const story = this.assertStoryStatusUpdate(prd, input);
1509
1070
  const previousStatus = story.status;
1510
1071
  if (verification) {
1511
1072
  story.verification = {
@@ -1520,6 +1081,9 @@ var PrdService = class {
1520
1081
  delete story.completedAt;
1521
1082
  }
1522
1083
  story.status = input.status;
1084
+ if (input.status === "in_progress" || input.status === "review") {
1085
+ if (input.workerId) story.workerId = input.workerId;
1086
+ } else delete story.workerId;
1523
1087
  const recordedDecisions = input.recordDeviations?.length ? recordDeviations(prd, story, input.recordDeviations, this.today()) : [];
1524
1088
  if (input.notes) story.notes = input.notes;
1525
1089
  recomputeProgress(prd);
@@ -1548,8 +1112,7 @@ var PrdService = class {
1548
1112
  async getImplementationPrompts(filename) {
1549
1113
  const name = this.safeName(filename);
1550
1114
  const prd = await this.load(name);
1551
- const prompts = [];
1552
- for (const story of prd.userStories.filter((s) => s.status === "not_started" && incompleteDependencies(prd, s).length === 0).slice(0, 3)) prompts.push(implementStoryPrompt(name, story.id));
1115
+ const prompts = pickNextStory(prd).story ? [implementStoryPrompt(name)] : [];
1553
1116
  return {
1554
1117
  prompts,
1555
1118
  total: prompts.length
@@ -1631,20 +1194,38 @@ var PrdService = class {
1631
1194
  }
1632
1195
  async getStory(input) {
1633
1196
  const filename = this.safeName(input.filename);
1634
- return buildStoryContext(await this.load(filename), input.storyId, filename);
1197
+ const prd = await this.load(filename);
1198
+ return buildStoryContext(prd, input.storyId, filename, this.prdsPath);
1635
1199
  }
1636
1200
  async addStoryLog(input) {
1637
- const filename = this.safeName(input.filename);
1638
- const prd = await this.load(filename);
1639
- const result = appendStoryLog(prd, input.storyId, {
1640
- at: this.deps.now().toISOString(),
1641
- whatsNew: input.whatsNew,
1642
- technicalNotes: input.technicalNotes,
1643
- ...input.deviations?.length && { deviations: input.deviations }
1201
+ return this.mutate(input.filename, (prd) => {
1202
+ const story = findStory(prd, input.storyId);
1203
+ this.assertStoryOwner(story, input.workerId);
1204
+ if (input.workerId && !story.workerId) throw new Error(`Claim story ${story.id} before logging work.`);
1205
+ const result = appendStoryLog(prd, input.storyId, {
1206
+ at: this.deps.now().toISOString(),
1207
+ whatsNew: input.whatsNew,
1208
+ technicalNotes: input.technicalNotes,
1209
+ ...input.deviations?.length && { deviations: input.deviations }
1210
+ });
1211
+ appendChangeLog(prd, `Logged work on ${result.story_id}`, this.today());
1212
+ return result;
1644
1213
  });
1645
- appendChangeLog(prd, `Logged work on ${result.story_id}`, this.today());
1646
- await this.save(filename, prd);
1647
- return result;
1214
+ }
1215
+ assertStoryOwner(story, workerId) {
1216
+ if (story.workerId && story.workerId !== workerId) throw new Error(`Story ${story.id} is claimed by another worker.`);
1217
+ }
1218
+ assertStoryStatusUpdate(prd, input) {
1219
+ const story = findStory(prd, input.storyId);
1220
+ this.assertStoryOwner(story, input.workerId);
1221
+ assertCanEnterStatus(prd, story, input.status);
1222
+ if (input.workerId && !story.workerId) {
1223
+ const canClaim = input.status === "in_progress" && story.status !== "completed";
1224
+ const canResumeReview = input.status === "review" && story.status === "review";
1225
+ const canReportBlocker = input.status === "blocked" && story.status !== "completed" && Boolean(input.notes?.trim());
1226
+ if (!canClaim && !canResumeReview && !canReportBlocker) throw new Error(`Claim story ${story.id} before changing its status.`);
1227
+ }
1228
+ return story;
1648
1229
  }
1649
1230
  /** Files must already be in the PRD's folder, `.prds/<prd name>/`. */
1650
1231
  async addAttachment(input) {
@@ -1652,7 +1233,8 @@ var PrdService = class {
1652
1233
  if (input.path) {
1653
1234
  const folder = attachmentsFolder(filename);
1654
1235
  const path = assertSafeRelativePath(input.path, "attachment path");
1655
- if (!await this.deps.fileExists(join(this.prdsDir, folder, path))) throw new Error(`File ".prds/${folder}/${path}" not found. Save it in .prds/${folder}/ first.`);
1236
+ const fullPath = join(this.prdsDir, folder, path);
1237
+ if (!await this.deps.fileExists(fullPath)) throw new Error(`File "${fullPath}" not found. Save it in ${this.prdsPath}/${folder}/ first.`);
1656
1238
  }
1657
1239
  return this.mutate(filename, (prd) => addAttachment(prd, {
1658
1240
  ...input,
@@ -1702,7 +1284,15 @@ var PrdService = class {
1702
1284
  }
1703
1285
  return normalizePrd(parsed, this.today());
1704
1286
  }
1705
- async save(filename, prd) {
1287
+ save(filename, prd) {
1288
+ const path = join(this.prdsDir, filename);
1289
+ const write = () => this.saveRevision(filename, prd);
1290
+ if (this.deps.withWriteLock) return this.deps.withWriteLock(path, write);
1291
+ const pending = this.pendingWrite.then(write);
1292
+ this.pendingWrite = pending.catch(() => void 0);
1293
+ return pending;
1294
+ }
1295
+ async saveRevision(filename, prd) {
1706
1296
  const today = this.today();
1707
1297
  const path = join(this.prdsDir, filename);
1708
1298
  const loadedRevision = prd.metadata.revision ?? 0;
@@ -1744,6 +1334,7 @@ function normalizePrd(input, today) {
1744
1334
  const highestQuestion = openQuestions.reduce((max, question) => Math.max(max, Number(/^Q(\d+)$/.exec(question.id)?.[1] ?? 0)), 0);
1745
1335
  return {
1746
1336
  ...prd,
1337
+ roadmap: PrdRoadmapSchema.passthrough().optional().parse(prd.roadmap),
1747
1338
  introduction: {
1748
1339
  title: prd.introduction?.title ?? "Untitled PRD",
1749
1340
  overview: prd.introduction?.overview ?? "",
@@ -1847,5 +1438,4 @@ function assessComplexity(criteria) {
1847
1438
  if (count <= 8) return "L";
1848
1439
  return "XL";
1849
1440
  }
1850
- //#endregion
1851
- export { AddAttachmentInputSchema, AddAttachmentOutputSchema, AddDecisionInputSchema, AddDecisionOutputSchema, AddGlossaryTermInputSchema, AddGlossaryTermOutputSchema, AddStoryLogInputSchema, AddStoryLogOutputSchema, AddUserStoryInputSchema, AddUserStoryOutputSchema, AssignStoryToPhaseInputSchema, AssignStoryToPhaseOutputSchema, CheckPlanInputSchema, CheckPlanOutputSchema, CreateCustomPhaseInputSchema, CreateCustomPhaseOutputSchema, CreatePrdInputSchema, CreatePrdOutputSchema, CriterionProofSchema, CustomPhaseSchema, DecideEdgeCaseInputSchema, DecideEdgeCaseOutputSchema, DeletePhaseInputSchema, DeletePrdInputSchema, DeletePrdOutputSchema, DeleteUserStoryInputSchema, DeleteUserStoryOutputSchema, ExportPrdMarkdownInputSchema, ExportPrdMarkdownOutputSchema, GetImplementationPromptsInputSchema, GetImplementationPromptsOutputSchema, GetImprovementSuggestionsInputSchema, GetImprovementSuggestionsOutputSchema, GetNextStoryInputSchema, GetNextStoryOutputSchema, GetPrdInputSchema, GetPrdOutputSchema, GetProjectStatusInputSchema, GetProjectStatusOutputSchema, GetStoryInputSchema, GetStoryOutputSchema, ListPrdsInputSchema, ListPrdsOutputSchema, ListTemplatesInputSchema, ListTemplatesOutputSchema, MarkNotApplicableInputSchema, MarkNotApplicableOutputSchema, NOT_APPLICABLE_TOPICS, NotApplicableTopicSchema, PRD_TEMPLATES, PhasesOutputSchema, PrdRevisionConflictError, PrdSectionValueSchemas, PrdService, PrdSummarySchema, ProofKindSchema, RemoveAttachmentInputSchema, RemoveAttachmentOutputSchema, ReorderPhasesInputSchema, ResolveOpenQuestionInputSchema, ResolveOpenQuestionOutputSchema, StoryAttachmentSchema, StoryComplexitySchema, StoryLogEntrySchema, StoryPrioritySchema, StoryStatusSchema, StoryVerificationSchema, TEMPLATE_IDS, UpdateAttachmentInputSchema, UpdateAttachmentOutputSchema, UpdatePhaseInputSchema, UpdatePrdSectionInputSchema, UpdatePrdSectionOutputSchema, UpdateStoryStatusInputSchema, UpdateStoryStatusOutputSchema, UpdateUserStoryInputSchema, UpdateUserStoryOutputSchema, appendChangeLog, appendStoryLog, architectPrdPrompt, assertCanEnterStatus, assignStoryToPhase, attachmentProjectPath, attachmentsFolder, buildStoryContext, checkPlan, createPhase, createPrdService, deleteStory, findAttachment, findStory, formatPrdMarkdown, getTemplate, implementStoryPrompt, incompleteDependencies, isNotApplicable, nextId, nextStoryId, normalizePrd, pickNextStory, recomputeProgress, renderUserStory, resolveAttachments, reviewStoryPrompt, shapePrdPrompt, splitUserStory, updateStory, validateAttachmentIds, validateDependencies, validateProofs };
1441
+ export { AddAttachmentInputSchema, AddAttachmentOutputSchema, AddDecisionInputSchema, AddDecisionOutputSchema, AddGlossaryTermInputSchema, AddGlossaryTermOutputSchema, AddStoryLogInputSchema, AddStoryLogOutputSchema, AddUserStoryInputSchema, AddUserStoryOutputSchema, AssignStoryToPhaseInputSchema, AssignStoryToPhaseOutputSchema, CheckPlanInputSchema, CheckPlanOutputSchema, CreateCustomPhaseInputSchema, CreateCustomPhaseOutputSchema, CreatePrdInputSchema, CreatePrdOutputSchema, CriterionProofSchema, CustomPhaseSchema, DecideEdgeCaseInputSchema, DecideEdgeCaseOutputSchema, DeletePhaseInputSchema, DeletePrdInputSchema, DeletePrdOutputSchema, DeleteUserStoryInputSchema, DeleteUserStoryOutputSchema, ExportPrdMarkdownInputSchema, ExportPrdMarkdownOutputSchema, GetImplementationPromptsInputSchema, GetImplementationPromptsOutputSchema, GetImprovementSuggestionsInputSchema, GetImprovementSuggestionsOutputSchema, GetNextStoryInputSchema, GetNextStoryOutputSchema, GetPrdInputSchema, GetPrdOutputSchema, GetProjectStatusInputSchema, GetProjectStatusOutputSchema, GetStoryInputSchema, GetStoryOutputSchema, ListPrdsInputSchema, ListPrdsOutputSchema, ListTemplatesInputSchema, ListTemplatesOutputSchema, MarkNotApplicableInputSchema, MarkNotApplicableOutputSchema, NOT_APPLICABLE_TOPICS, NotApplicableTopicSchema, PRD_TEMPLATES, PhasesOutputSchema, PrdCriticalitySchema, PrdRevisionConflictError, PrdRoadmapSchema, PrdRoadmapUpdateSchema, PrdSectionValueSchemas, PrdService, PrdSummarySchema, ProofKindSchema, RemoveAttachmentInputSchema, RemoveAttachmentOutputSchema, ReorderPhasesInputSchema, ResolveOpenQuestionInputSchema, ResolveOpenQuestionOutputSchema, StoryAttachmentSchema, StoryComplexitySchema, StoryLogEntrySchema, StoryPrioritySchema, StoryStatusSchema, StoryVerificationSchema, TEMPLATE_IDS, UpdateAttachmentInputSchema, UpdateAttachmentOutputSchema, UpdatePhaseInputSchema, UpdatePrdSectionInputSchema, UpdatePrdSectionOutputSchema, UpdateStoryStatusInputSchema, UpdateStoryStatusOutputSchema, UpdateUserStoryInputSchema, UpdateUserStoryOutputSchema, appendChangeLog, appendStoryLog, architectPrdPrompt, assertCanEnterStatus, assignStoryToPhase, attachmentProjectPath, attachmentsFolder, buildStoryContext, checkPlan, createPhase, createPrdService, deleteStory, findAttachment, findStory, formatPrdMarkdown, getTemplate, implementStoryPrompt, incompleteDependencies, isNotApplicable, nextId, nextStoryId, normalizePrd, pickNextStory, recomputeProgress, renderUserStory, resolveAttachments, reviewStoryPrompt, shapePrdPrompt, splitUserStory, updateStory, validateAttachmentIds, validateDependencies, validateProofs };