@makerkit/prd 0.0.0 → 0.0.2

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 (54) hide show
  1. package/README.md +1 -1
  2. package/{dist/index.d.ts → index.d.ts} +1 -0
  3. package/{dist/index.js → index.js} +74 -151
  4. package/{dist/index.mjs → index.mjs} +62 -140
  5. package/{dist/mcp.js → mcp.js} +12 -1
  6. package/{dist/mcp.mjs → mcp.mjs} +12 -1
  7. package/package.json +2 -21
  8. package/{dist/prompts-Bber0S1Z.mjs → prompts-B0ciGmv-.mjs} +101 -3
  9. package/{dist/prompts-CIX8IeAx.js → prompts-CTRnq1J5.js} +142 -2
  10. package/.turbo/turbo-build.log +0 -46
  11. package/.turbo/turbo-test.log +0 -21
  12. package/.turbo/turbo-typecheck.log +0 -1
  13. package/dist/README.md +0 -65
  14. package/dist/package.json +0 -49
  15. package/src/__tests__/agent-workflow.test.ts +0 -377
  16. package/src/__tests__/attachments.test.ts +0 -475
  17. package/src/__tests__/node.test.ts +0 -141
  18. package/src/__tests__/plan-check.test.ts +0 -229
  19. package/src/__tests__/planning.test.ts +0 -1059
  20. package/src/__tests__/prd-operations.test.ts +0 -423
  21. package/src/__tests__/prd.service.test.ts +0 -477
  22. package/src/__tests__/prd.tool.test.ts +0 -282
  23. package/src/__tests__/templates.test.ts +0 -141
  24. package/src/applicability.ts +0 -73
  25. package/src/attachment-paths.ts +0 -78
  26. package/src/attachments.ts +0 -160
  27. package/src/edge-cases.ts +0 -52
  28. package/src/index.ts +0 -35
  29. package/src/markdown.ts +0 -268
  30. package/src/mcp/index.ts +0 -839
  31. package/src/mcp/tool-response.ts +0 -85
  32. package/src/node.ts +0 -146
  33. package/src/open-questions.ts +0 -93
  34. package/src/plan-check.ts +0 -282
  35. package/src/planning-operations.ts +0 -429
  36. package/src/prd-operations.ts +0 -690
  37. package/src/prd.service.ts +0 -1051
  38. package/src/prompts.ts +0 -110
  39. package/src/safe-file-name.ts +0 -42
  40. package/src/schema.ts +0 -976
  41. package/src/templates.ts +0 -173
  42. package/src/testing/fake-mcp-server.ts +0 -81
  43. package/src/types.ts +0 -333
  44. package/tsconfig.json +0 -23
  45. package/tsconfig.lib.json +0 -8
  46. package/tsconfig.spec.json +0 -7
  47. package/tsdown.config.mts +0 -11
  48. package/vitest.config.mts +0 -8
  49. /package/{dist/LICENSE → LICENSE} +0 -0
  50. /package/{dist/mcp.d.ts → mcp.d.ts} +0 -0
  51. /package/{dist/node.d.ts → node.d.ts} +0 -0
  52. /package/{dist/node.js → node.js} +0 -0
  53. /package/{dist/node.mjs → node.mjs} +0 -0
  54. /package/{dist/prd.service-DSBp8sMl.d.ts → prd.service-DSBp8sMl.d.ts} +0 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@ Structured product requirements documents (PRDs) stored as JSON files in `.prds/
7
7
  - **Completion gate**: a story can only be marked `completed` when the project's checks pass, so "done" means the code verifies.
8
8
  - **MCP tools**: the same operations exposed to Claude Code, Codex, OpenCode or any MCP client.
9
9
  - **Attachments**: files (mockups, screenshots, reference docs) live in a folder next to the PRD, `.prds/<prd name>/`, and links can be recorded too. Stories reference them by id, and `get_story` returns them with their paths.
10
- - **Prompts**: `shape_prd` interviews you round by round (numbered questions, each with a recommended answer and its reason) and writes every decision into the PRD; `implement_story` walks an agent through one story and its hand-off log. The same text is exported (`implementStoryPrompt`, `shapePrdPrompt`, `reviewStoryPrompt`) for UIs and agents without MCP prompt support.
10
+ - **Prompts**: `shape_prd` interviews you round by round (numbered questions, each with a recommended answer and its reason) and writes every decision into the PRD; `architect_prd` designs the shape all stories share (using the project's `architect` skill when it has one) and records it as an attachment the story agents build against; `implement_story` walks an agent through one story and its hand-off log; `review_story` checks the result against the spec. The same text is exported (`shapePrdPrompt`, `architectPrdPrompt`, `implementStoryPrompt`, `reviewStoryPrompt`) for UIs and agents without MCP prompt support.
11
11
 
12
12
  ## Install
13
13
 
@@ -200,6 +200,7 @@ export declare function getTemplate(id: TemplateId): PrdTemplate;
200
200
  * UI that shows what to ask the agent) give exactly the same text.
201
201
  */
202
202
  export declare function shapePrdPrompt(idea?: string, filename?: string, templateId?: TemplateId): string;
203
+ export declare function architectPrdPrompt(filename: string): string;
203
204
  export declare function reviewStoryPrompt(filename: string, storyId: string, base?: string): string;
204
205
  export declare function implementStoryPrompt(filename: string, storyId?: string): string;
205
206
  //#endregion
@@ -1,84 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_prompts = require("./prompts-CIX8IeAx.js");
2
+ const require_prompts = require("./prompts-CTRnq1J5.js");
3
3
  let node_path = require("node:path");
4
- //#region src/safe-file-name.ts
5
- /**
6
- * Accept only a bare file name. Anything that could escape the intended
7
- * directory (path separators, parent references, hidden files) is rejected
8
- * before the filesystem is touched.
9
- */
10
- function assertSafeFileName(value, label = "file name") {
11
- const name = value.trim();
12
- if (name.length === 0 || name.includes("..") || name.includes("/") || name.includes("\\") || name.startsWith(".")) throw new Error(`Invalid ${label} "${value}"`);
13
- return name;
14
- }
15
- /**
16
- * Accept only a relative path that stays inside the directory it is joined
17
- * to: no absolute paths, no `..`, no backslashes, no empty or hidden segments.
18
- * This is a check on the text only; code that serves the file must still
19
- * resolve symlinks before reading it.
20
- */
21
- function assertSafeRelativePath(value, label = "path") {
22
- const path = value.trim();
23
- const segments = path.split("/");
24
- if (path.length === 0 || path.includes("\\") || /^[a-zA-Z]:/.test(path) || segments.some((segment) => segment.length === 0 || segment.startsWith("."))) throw new Error(`Invalid ${label} "${value}"`);
25
- return path;
26
- }
27
- //#endregion
28
- //#region src/attachment-paths.ts
29
- /**
30
- * The folder for a PRD's files, relative to `.prds`: the PRD file name
31
- * without `.json`, so `notes.json` keeps its files in `.prds/notes/`.
32
- */
33
- function attachmentsFolder(filename) {
34
- return filename.replace(/\.json$/, "");
35
- }
36
- /** An attachment's file relative to the project root, e.g. `.prds/notes/a.png`. */
37
- function attachmentProjectPath(filename, path) {
38
- return `.prds/${attachmentsFolder(filename)}/${path}`;
39
- }
40
- /** Attachments as an agent needs them: file paths from the project root. */
41
- function resolveAttachments(filename, attachments) {
42
- return attachments.map(({ path, ...attachment }) => ({
43
- ...attachment,
44
- ...path ? { path: attachmentProjectPath(filename, path) } : {}
45
- }));
46
- }
47
- /**
48
- * Attachments as stored, with hand-edited entries that would break readers
49
- * or point outside the PRD folder dropped: each needs a string id and title
50
- * and either a safe relative path or an http(s) url.
51
- */
52
- function normalizeAttachments(value) {
53
- if (!Array.isArray(value)) return [];
54
- return value.flatMap((entry) => {
55
- if (typeof entry !== "object" || entry === null) return [];
56
- const { id, title, path, url, note } = entry;
57
- if (typeof id !== "string" || typeof title !== "string") return [];
58
- const base = {
59
- id,
60
- title,
61
- ...typeof note === "string" && note ? { note } : {}
62
- };
63
- if (typeof path === "string" && url === void 0 && isSafePath(path)) return [{
64
- ...base,
65
- path
66
- }];
67
- if (typeof url === "string" && path === void 0 && /^https?:\/\//i.test(url)) return [{
68
- ...base,
69
- url
70
- }];
71
- return [];
72
- });
73
- }
74
- function isSafePath(path) {
75
- try {
76
- return assertSafeRelativePath(path) === path;
77
- } catch {
78
- return false;
79
- }
80
- }
81
- //#endregion
82
4
  //#region src/edge-cases.ts
83
5
  /**
84
6
  * Edge cases as stored, with hand-edited entries that would break readers
@@ -446,10 +368,10 @@ function buildStoryContext(prd, storyId, filename) {
446
368
  non_goals: prd.nonGoals,
447
369
  out_of_scope: prd.outOfScope,
448
370
  global_acceptance_criteria: prd.acceptanceCriteria.global,
449
- attachments: resolveAttachments(filename, prd.attachments)
371
+ attachments: require_prompts.resolveAttachments(filename, prd.attachments)
450
372
  },
451
373
  story,
452
- attachments: resolveAttachments(filename, prd.attachments.filter((attachment) => linked.has(attachment.id))),
374
+ attachments: require_prompts.resolveAttachments(filename, prd.attachments.filter((attachment) => linked.has(attachment.id))),
453
375
  phase: phase ? {
454
376
  id: phase.id,
455
377
  name: phase.name
@@ -545,66 +467,6 @@ function setNotApplicable(prd, input, today) {
545
467
  };
546
468
  }
547
469
  //#endregion
548
- //#region src/open-questions.ts
549
- /**
550
- * Open questions as stored. Older files hold plain strings; they become
551
- * questions with ids in list order. Entries without question text are dropped.
552
- */
553
- function normalizeOpenQuestions(value) {
554
- if (!Array.isArray(value)) return [];
555
- const questions = [];
556
- for (const entry of value) {
557
- if (typeof entry === "string") {
558
- if (entry.trim()) questions.push({
559
- id: "",
560
- question: entry
561
- });
562
- continue;
563
- }
564
- if (typeof entry !== "object" || entry === null) continue;
565
- const { id, question, why, options, recommended, storyIds } = entry;
566
- if (typeof question !== "string" || !question.trim()) continue;
567
- const strings = (list) => Array.isArray(list) ? list.filter((item) => typeof item === "string" && item.length > 0) : [];
568
- questions.push({
569
- id: typeof id === "string" ? id : "",
570
- question,
571
- ...typeof why === "string" && why ? { why } : {},
572
- ...strings(options).length ? { options: strings(options) } : {},
573
- ...typeof recommended === "string" && recommended ? { recommended } : {},
574
- ...strings(storyIds).length ? { storyIds: strings(storyIds) } : {}
575
- });
576
- }
577
- let highest = questions.reduce((max, question) => {
578
- const match = /^Q(\d+)$/.exec(question.id);
579
- return match ? Math.max(max, Number(match[1])) : max;
580
- }, 0);
581
- return questions.map((question) => question.id ? question : {
582
- ...question,
583
- id: formatQuestionId(++highest)
584
- });
585
- }
586
- function formatQuestionId(number) {
587
- return `Q${String(number).padStart(3, "0")}`;
588
- }
589
- /**
590
- * The next question id. Answered questions are quoted in decisions, so an id
591
- * is never handed out twice: the high-water mark is kept in metadata.
592
- */
593
- function nextQuestionId(prd, extra = []) {
594
- const present = [...prd.openQuestions, ...extra].reduce((max, question) => {
595
- const match = /^Q(\d+)$/.exec(question.id);
596
- return match ? Math.max(max, Number(match[1])) : max;
597
- }, 0);
598
- const next = Math.max(prd.metadata.lastQuestionNumber ?? 0, present) + 1;
599
- prd.metadata.lastQuestionNumber = next;
600
- return formatQuestionId(next);
601
- }
602
- /** Open questions that block a story that is not completed yet. */
603
- function blockingQuestions(prd) {
604
- const unfinished = new Set(prd.userStories.filter((story) => story.status !== "completed").map((story) => story.id));
605
- return prd.openQuestions.filter((question) => question.storyIds?.some((id) => unfinished.has(id)));
606
- }
607
- //#endregion
608
470
  //#region src/attachments.ts
609
471
  /**
610
472
  * Adds an attachment and links it to the given stories. The caller checks
@@ -613,7 +475,7 @@ function blockingQuestions(prd) {
613
475
  function addAttachment(prd, input, today) {
614
476
  if (Boolean(input.path) === Boolean(input.url)) throw new Error("Give either path or url for an attachment, not both.");
615
477
  if (input.url && !/^https?:\/\//i.test(input.url)) throw new Error("An attachment url must start with http:// or https://.");
616
- const path = input.path ? assertSafeRelativePath(input.path, "attachment path") : void 0;
478
+ const path = input.path ? require_prompts.assertSafeRelativePath(input.path, "attachment path") : void 0;
617
479
  const stories = (input.storyIds ?? []).map((id) => findStory(prd, id));
618
480
  const id = nextAttachmentId(prd);
619
481
  prd.attachments.push({
@@ -626,7 +488,7 @@ function addAttachment(prd, input, today) {
626
488
  appendChangeLog(prd, `Added attachment ${id} (${input.title})`, today);
627
489
  return {
628
490
  attachment_id: id,
629
- path: path ? attachmentProjectPath(input.filename, path) : null,
491
+ path: path ? require_prompts.attachmentProjectPath(input.filename, path) : null,
630
492
  stories_updated: stories.map((story) => story.id),
631
493
  total_attachments: prd.attachments.length
632
494
  };
@@ -799,7 +661,7 @@ function formatStory(story) {
799
661
  }
800
662
  function formatAttachment(attachment, filename) {
801
663
  const title = oneLine(attachment.title).replace(/[[\]]/g, "\\$&");
802
- const target = attachment.url ? linkTarget(attachment.url) : filename ? linkTarget(encodeURI(`${attachmentsFolder(filename)}/${attachment.path}`)) : void 0;
664
+ const target = attachment.url ? linkTarget(attachment.url) : filename ? linkTarget(encodeURI(`${require_prompts.attachmentsFolder(filename)}/${attachment.path}`)) : void 0;
803
665
  const label = target ? `[${title}](${target})` : `${title} (${attachment.path})`;
804
666
  const note = attachment.note ? ` - ${oneLine(attachment.note)}` : "";
805
667
  return `- ${attachment.id}: ${label}${note}`;
@@ -817,6 +679,66 @@ function bullets(items, emptyLabel) {
817
679
  return items.map((item) => `- ${item}`);
818
680
  }
819
681
  //#endregion
682
+ //#region src/open-questions.ts
683
+ /**
684
+ * Open questions as stored. Older files hold plain strings; they become
685
+ * questions with ids in list order. Entries without question text are dropped.
686
+ */
687
+ function normalizeOpenQuestions(value) {
688
+ if (!Array.isArray(value)) return [];
689
+ const questions = [];
690
+ for (const entry of value) {
691
+ if (typeof entry === "string") {
692
+ if (entry.trim()) questions.push({
693
+ id: "",
694
+ question: entry
695
+ });
696
+ continue;
697
+ }
698
+ if (typeof entry !== "object" || entry === null) continue;
699
+ const { id, question, why, options, recommended, storyIds } = entry;
700
+ if (typeof question !== "string" || !question.trim()) continue;
701
+ const strings = (list) => Array.isArray(list) ? list.filter((item) => typeof item === "string" && item.length > 0) : [];
702
+ questions.push({
703
+ id: typeof id === "string" ? id : "",
704
+ question,
705
+ ...typeof why === "string" && why ? { why } : {},
706
+ ...strings(options).length ? { options: strings(options) } : {},
707
+ ...typeof recommended === "string" && recommended ? { recommended } : {},
708
+ ...strings(storyIds).length ? { storyIds: strings(storyIds) } : {}
709
+ });
710
+ }
711
+ let highest = questions.reduce((max, question) => {
712
+ const match = /^Q(\d+)$/.exec(question.id);
713
+ return match ? Math.max(max, Number(match[1])) : max;
714
+ }, 0);
715
+ return questions.map((question) => question.id ? question : {
716
+ ...question,
717
+ id: formatQuestionId(++highest)
718
+ });
719
+ }
720
+ function formatQuestionId(number) {
721
+ return `Q${String(number).padStart(3, "0")}`;
722
+ }
723
+ /**
724
+ * The next question id. Answered questions are quoted in decisions, so an id
725
+ * is never handed out twice: the high-water mark is kept in metadata.
726
+ */
727
+ function nextQuestionId(prd, extra = []) {
728
+ const present = [...prd.openQuestions, ...extra].reduce((max, question) => {
729
+ const match = /^Q(\d+)$/.exec(question.id);
730
+ return match ? Math.max(max, Number(match[1])) : max;
731
+ }, 0);
732
+ const next = Math.max(prd.metadata.lastQuestionNumber ?? 0, present) + 1;
733
+ prd.metadata.lastQuestionNumber = next;
734
+ return formatQuestionId(next);
735
+ }
736
+ /** Open questions that block a story that is not completed yet. */
737
+ function blockingQuestions(prd) {
738
+ const unfinished = new Set(prd.userStories.filter((story) => story.status !== "completed").map((story) => story.id));
739
+ return prd.openQuestions.filter((question) => question.storyIds?.some((id) => unfinished.has(id)));
740
+ }
741
+ //#endregion
820
742
  //#region src/plan-check.ts
821
743
  /** The not-applicable topic each "missing" check is about. */
822
744
  const CHECK_TOPICS = {
@@ -1591,8 +1513,8 @@ var PrdService = class {
1591
1513
  async addAttachment(input) {
1592
1514
  const filename = this.safeName(input.filename);
1593
1515
  if (input.path) {
1594
- const folder = attachmentsFolder(filename);
1595
- const path = assertSafeRelativePath(input.path, "attachment path");
1516
+ const folder = require_prompts.attachmentsFolder(filename);
1517
+ const path = require_prompts.assertSafeRelativePath(input.path, "attachment path");
1596
1518
  if (!await this.deps.fileExists((0, node_path.join)(this.prdsDir, folder, path))) throw new Error(`File ".prds/${folder}/${path}" not found. Save it in .prds/${folder}/ first.`);
1597
1519
  }
1598
1520
  return this.mutate(filename, (prd) => addAttachment(prd, {
@@ -1665,7 +1587,7 @@ var PrdService = class {
1665
1587
  }
1666
1588
  }
1667
1589
  safeName(filename) {
1668
- return assertSafeFileName(filename, "PRD file name");
1590
+ return require_prompts.assertSafeFileName(filename, "PRD file name");
1669
1591
  }
1670
1592
  today() {
1671
1593
  return this.deps.now().toISOString().slice(0, 10);
@@ -1749,7 +1671,7 @@ function normalizePrd(input, today) {
1749
1671
  designGuidance: Array.isArray(prd.designGuidance) ? prd.designGuidance.filter((item) => typeof item === "string") : [],
1750
1672
  decisionLog: prd.decisionLog ?? [],
1751
1673
  glossary: prd.glossary ?? [],
1752
- attachments: normalizeAttachments(prd.attachments),
1674
+ attachments: require_prompts.normalizeAttachments(prd.attachments),
1753
1675
  agentTaskPackets: prd.agentTaskPackets ?? [],
1754
1676
  changeLog: prd.changeLog ?? [],
1755
1677
  metadata: {
@@ -1866,10 +1788,11 @@ exports.UpdateUserStoryInputSchema = require_prompts.UpdateUserStoryInputSchema;
1866
1788
  exports.UpdateUserStoryOutputSchema = require_prompts.UpdateUserStoryOutputSchema;
1867
1789
  exports.appendChangeLog = appendChangeLog;
1868
1790
  exports.appendStoryLog = appendStoryLog;
1791
+ exports.architectPrdPrompt = require_prompts.architectPrdPrompt;
1869
1792
  exports.assertCanEnterStatus = assertCanEnterStatus;
1870
1793
  exports.assignStoryToPhase = assignStoryToPhase;
1871
- exports.attachmentProjectPath = attachmentProjectPath;
1872
- exports.attachmentsFolder = attachmentsFolder;
1794
+ exports.attachmentProjectPath = require_prompts.attachmentProjectPath;
1795
+ exports.attachmentsFolder = require_prompts.attachmentsFolder;
1873
1796
  exports.buildStoryContext = buildStoryContext;
1874
1797
  exports.checkPlan = checkPlan;
1875
1798
  exports.createPhase = createPhase;
@@ -1888,7 +1811,7 @@ exports.normalizePrd = normalizePrd;
1888
1811
  exports.pickNextStory = pickNextStory;
1889
1812
  exports.recomputeProgress = recomputeProgress;
1890
1813
  exports.renderUserStory = renderUserStory;
1891
- exports.resolveAttachments = resolveAttachments;
1814
+ exports.resolveAttachments = require_prompts.resolveAttachments;
1892
1815
  exports.reviewStoryPrompt = require_prompts.reviewStoryPrompt;
1893
1816
  exports.shapePrdPrompt = require_prompts.shapePrdPrompt;
1894
1817
  exports.splitUserStory = splitUserStory;
@@ -1,83 +1,5 @@
1
- import { $ as PrdSummarySchema, A as ExportPrdMarkdownInputSchema, B as GetProjectStatusInputSchema, C as DecideEdgeCaseInputSchema, D as DeletePrdOutputSchema, E as DeletePrdInputSchema, F as GetImprovementSuggestionsOutputSchema, G as ListPrdsOutputSchema, H as GetStoryInputSchema, I as GetNextStoryInputSchema, J as MarkNotApplicableInputSchema, K as ListTemplatesInputSchema, L as GetNextStoryOutputSchema, M as GetImplementationPromptsInputSchema, N as GetImplementationPromptsOutputSchema, O as DeleteUserStoryInputSchema, P as GetImprovementSuggestionsInputSchema, Q as PrdSectionValueSchemas, R as GetPrdInputSchema, S as CustomPhaseSchema, St as getTemplate, T as DeletePhaseInputSchema, U as GetStoryOutputSchema, V as GetProjectStatusOutputSchema, W as ListPrdsInputSchema, X as NotApplicableTopicSchema, Y as MarkNotApplicableOutputSchema, Z as PhasesOutputSchema, _ as CheckPlanOutputSchema, _t as UpdateStoryStatusOutputSchema, a as AddAttachmentOutputSchema, at as StoryAttachmentSchema, b as CreatePrdInputSchema, bt as PRD_TEMPLATES, c as AddGlossaryTermInputSchema, ct as StoryPrioritySchema, d as AddStoryLogOutputSchema, dt as UpdateAttachmentInputSchema, et as RemoveAttachmentInputSchema, f as AddUserStoryInputSchema, ft as UpdateAttachmentOutputSchema, g as CheckPlanInputSchema, gt as UpdateStoryStatusInputSchema, h as AssignStoryToPhaseOutputSchema, ht as UpdatePrdSectionOutputSchema, i as AddAttachmentInputSchema, it as ResolveOpenQuestionOutputSchema, j as ExportPrdMarkdownOutputSchema, k as DeleteUserStoryOutputSchema, l as AddGlossaryTermOutputSchema, lt as StoryStatusSchema, m as AssignStoryToPhaseInputSchema, mt as UpdatePrdSectionInputSchema, n as reviewStoryPrompt, nt as ReorderPhasesInputSchema, o as AddDecisionInputSchema, ot as StoryComplexitySchema, p as AddUserStoryOutputSchema, pt as UpdatePhaseInputSchema, q as ListTemplatesOutputSchema, r as shapePrdPrompt, rt as ResolveOpenQuestionInputSchema, s as AddDecisionOutputSchema, st as StoryLogEntrySchema, t as implementStoryPrompt, tt as RemoveAttachmentOutputSchema, u as AddStoryLogInputSchema, ut as StoryVerificationSchema, v as CreateCustomPhaseInputSchema, vt as UpdateUserStoryInputSchema, w as DecideEdgeCaseOutputSchema, x as CreatePrdOutputSchema, xt as TEMPLATE_IDS, y as CreateCustomPhaseOutputSchema, yt as UpdateUserStoryOutputSchema, z as GetPrdOutputSchema } from "./prompts-Bber0S1Z.mjs";
1
+ import { $ as PrdSectionValueSchemas, A as DeleteUserStoryOutputSchema, B as GetPrdOutputSchema, C as CustomPhaseSchema, Ct as getTemplate, D as DeletePrdInputSchema, Dt as resolveAttachments, E as DeletePhaseInputSchema, Et as normalizeAttachments, F as GetImprovementSuggestionsInputSchema, G as ListPrdsInputSchema, H as GetProjectStatusOutputSchema, I as GetImprovementSuggestionsOutputSchema, J as ListTemplatesOutputSchema, K as ListPrdsOutputSchema, L as GetNextStoryInputSchema, M as ExportPrdMarkdownOutputSchema, N as GetImplementationPromptsInputSchema, O as DeletePrdOutputSchema, Ot as assertSafeFileName, P as GetImplementationPromptsOutputSchema, Q as PhasesOutputSchema, R as GetNextStoryOutputSchema, S as CreatePrdOutputSchema, St as TEMPLATE_IDS, T as DecideEdgeCaseOutputSchema, Tt as attachmentsFolder, U as GetStoryInputSchema, V as GetProjectStatusInputSchema, W as GetStoryOutputSchema, X as MarkNotApplicableOutputSchema, Y as MarkNotApplicableInputSchema, Z as NotApplicableTopicSchema, _ as CheckPlanInputSchema, _t as UpdateStoryStatusInputSchema, a as AddAttachmentInputSchema, at as ResolveOpenQuestionOutputSchema, b as CreateCustomPhaseOutputSchema, bt as UpdateUserStoryOutputSchema, c as AddDecisionOutputSchema, ct as StoryLogEntrySchema, d as AddStoryLogInputSchema, dt as StoryVerificationSchema, et as PrdSummarySchema, f as AddStoryLogOutputSchema, ft as UpdateAttachmentInputSchema, g as AssignStoryToPhaseOutputSchema, gt as UpdatePrdSectionOutputSchema, h as AssignStoryToPhaseInputSchema, ht as UpdatePrdSectionInputSchema, i as shapePrdPrompt, it as ResolveOpenQuestionInputSchema, j as ExportPrdMarkdownInputSchema, k as DeleteUserStoryInputSchema, kt as assertSafeRelativePath, l as AddGlossaryTermInputSchema, lt as StoryPrioritySchema, m as AddUserStoryOutputSchema, mt as UpdatePhaseInputSchema, n as implementStoryPrompt, nt as RemoveAttachmentOutputSchema, o as AddAttachmentOutputSchema, ot as StoryAttachmentSchema, p as AddUserStoryInputSchema, pt as UpdateAttachmentOutputSchema, q as ListTemplatesInputSchema, r as reviewStoryPrompt, rt as ReorderPhasesInputSchema, s as AddDecisionInputSchema, st as StoryComplexitySchema, t as architectPrdPrompt, tt as RemoveAttachmentInputSchema, u as AddGlossaryTermOutputSchema, ut as StoryStatusSchema, v as CheckPlanOutputSchema, vt as UpdateStoryStatusOutputSchema, w as DecideEdgeCaseInputSchema, wt as attachmentProjectPath, x as CreatePrdInputSchema, xt as PRD_TEMPLATES, y as CreateCustomPhaseInputSchema, yt as UpdateUserStoryInputSchema, z as GetPrdInputSchema } from "./prompts-B0ciGmv-.mjs";
2
2
  import { join } from "node:path";
3
- //#region src/safe-file-name.ts
4
- /**
5
- * Accept only a bare file name. Anything that could escape the intended
6
- * directory (path separators, parent references, hidden files) is rejected
7
- * before the filesystem is touched.
8
- */
9
- function assertSafeFileName(value, label = "file name") {
10
- const name = value.trim();
11
- if (name.length === 0 || name.includes("..") || name.includes("/") || name.includes("\\") || name.startsWith(".")) throw new Error(`Invalid ${label} "${value}"`);
12
- return name;
13
- }
14
- /**
15
- * Accept only a relative path that stays inside the directory it is joined
16
- * to: no absolute paths, no `..`, no backslashes, no empty or hidden segments.
17
- * This is a check on the text only; code that serves the file must still
18
- * resolve symlinks before reading it.
19
- */
20
- function assertSafeRelativePath(value, label = "path") {
21
- const path = value.trim();
22
- const segments = path.split("/");
23
- if (path.length === 0 || path.includes("\\") || /^[a-zA-Z]:/.test(path) || segments.some((segment) => segment.length === 0 || segment.startsWith("."))) throw new Error(`Invalid ${label} "${value}"`);
24
- return path;
25
- }
26
- //#endregion
27
- //#region src/attachment-paths.ts
28
- /**
29
- * The folder for a PRD's files, relative to `.prds`: the PRD file name
30
- * without `.json`, so `notes.json` keeps its files in `.prds/notes/`.
31
- */
32
- function attachmentsFolder(filename) {
33
- return filename.replace(/\.json$/, "");
34
- }
35
- /** An attachment's file relative to the project root, e.g. `.prds/notes/a.png`. */
36
- function attachmentProjectPath(filename, path) {
37
- return `.prds/${attachmentsFolder(filename)}/${path}`;
38
- }
39
- /** Attachments as an agent needs them: file paths from the project root. */
40
- function resolveAttachments(filename, attachments) {
41
- return attachments.map(({ path, ...attachment }) => ({
42
- ...attachment,
43
- ...path ? { path: attachmentProjectPath(filename, path) } : {}
44
- }));
45
- }
46
- /**
47
- * Attachments as stored, with hand-edited entries that would break readers
48
- * or point outside the PRD folder dropped: each needs a string id and title
49
- * and either a safe relative path or an http(s) url.
50
- */
51
- function normalizeAttachments(value) {
52
- if (!Array.isArray(value)) return [];
53
- return value.flatMap((entry) => {
54
- if (typeof entry !== "object" || entry === null) return [];
55
- const { id, title, path, url, note } = entry;
56
- if (typeof id !== "string" || typeof title !== "string") return [];
57
- const base = {
58
- id,
59
- title,
60
- ...typeof note === "string" && note ? { note } : {}
61
- };
62
- if (typeof path === "string" && url === void 0 && isSafePath(path)) return [{
63
- ...base,
64
- path
65
- }];
66
- if (typeof url === "string" && path === void 0 && /^https?:\/\//i.test(url)) return [{
67
- ...base,
68
- url
69
- }];
70
- return [];
71
- });
72
- }
73
- function isSafePath(path) {
74
- try {
75
- return assertSafeRelativePath(path) === path;
76
- } catch {
77
- return false;
78
- }
79
- }
80
- //#endregion
81
3
  //#region src/edge-cases.ts
82
4
  /**
83
5
  * Edge cases as stored, with hand-edited entries that would break readers
@@ -544,66 +466,6 @@ function setNotApplicable(prd, input, today) {
544
466
  };
545
467
  }
546
468
  //#endregion
547
- //#region src/open-questions.ts
548
- /**
549
- * Open questions as stored. Older files hold plain strings; they become
550
- * questions with ids in list order. Entries without question text are dropped.
551
- */
552
- function normalizeOpenQuestions(value) {
553
- if (!Array.isArray(value)) return [];
554
- const questions = [];
555
- for (const entry of value) {
556
- if (typeof entry === "string") {
557
- if (entry.trim()) questions.push({
558
- id: "",
559
- question: entry
560
- });
561
- continue;
562
- }
563
- if (typeof entry !== "object" || entry === null) continue;
564
- const { id, question, why, options, recommended, storyIds } = entry;
565
- if (typeof question !== "string" || !question.trim()) continue;
566
- const strings = (list) => Array.isArray(list) ? list.filter((item) => typeof item === "string" && item.length > 0) : [];
567
- questions.push({
568
- id: typeof id === "string" ? id : "",
569
- question,
570
- ...typeof why === "string" && why ? { why } : {},
571
- ...strings(options).length ? { options: strings(options) } : {},
572
- ...typeof recommended === "string" && recommended ? { recommended } : {},
573
- ...strings(storyIds).length ? { storyIds: strings(storyIds) } : {}
574
- });
575
- }
576
- let highest = questions.reduce((max, question) => {
577
- const match = /^Q(\d+)$/.exec(question.id);
578
- return match ? Math.max(max, Number(match[1])) : max;
579
- }, 0);
580
- return questions.map((question) => question.id ? question : {
581
- ...question,
582
- id: formatQuestionId(++highest)
583
- });
584
- }
585
- function formatQuestionId(number) {
586
- return `Q${String(number).padStart(3, "0")}`;
587
- }
588
- /**
589
- * The next question id. Answered questions are quoted in decisions, so an id
590
- * is never handed out twice: the high-water mark is kept in metadata.
591
- */
592
- function nextQuestionId(prd, extra = []) {
593
- const present = [...prd.openQuestions, ...extra].reduce((max, question) => {
594
- const match = /^Q(\d+)$/.exec(question.id);
595
- return match ? Math.max(max, Number(match[1])) : max;
596
- }, 0);
597
- const next = Math.max(prd.metadata.lastQuestionNumber ?? 0, present) + 1;
598
- prd.metadata.lastQuestionNumber = next;
599
- return formatQuestionId(next);
600
- }
601
- /** Open questions that block a story that is not completed yet. */
602
- function blockingQuestions(prd) {
603
- const unfinished = new Set(prd.userStories.filter((story) => story.status !== "completed").map((story) => story.id));
604
- return prd.openQuestions.filter((question) => question.storyIds?.some((id) => unfinished.has(id)));
605
- }
606
- //#endregion
607
469
  //#region src/attachments.ts
608
470
  /**
609
471
  * Adds an attachment and links it to the given stories. The caller checks
@@ -816,6 +678,66 @@ function bullets(items, emptyLabel) {
816
678
  return items.map((item) => `- ${item}`);
817
679
  }
818
680
  //#endregion
681
+ //#region src/open-questions.ts
682
+ /**
683
+ * Open questions as stored. Older files hold plain strings; they become
684
+ * questions with ids in list order. Entries without question text are dropped.
685
+ */
686
+ function normalizeOpenQuestions(value) {
687
+ if (!Array.isArray(value)) return [];
688
+ const questions = [];
689
+ for (const entry of value) {
690
+ if (typeof entry === "string") {
691
+ if (entry.trim()) questions.push({
692
+ id: "",
693
+ question: entry
694
+ });
695
+ continue;
696
+ }
697
+ if (typeof entry !== "object" || entry === null) continue;
698
+ const { id, question, why, options, recommended, storyIds } = entry;
699
+ if (typeof question !== "string" || !question.trim()) continue;
700
+ const strings = (list) => Array.isArray(list) ? list.filter((item) => typeof item === "string" && item.length > 0) : [];
701
+ questions.push({
702
+ id: typeof id === "string" ? id : "",
703
+ question,
704
+ ...typeof why === "string" && why ? { why } : {},
705
+ ...strings(options).length ? { options: strings(options) } : {},
706
+ ...typeof recommended === "string" && recommended ? { recommended } : {},
707
+ ...strings(storyIds).length ? { storyIds: strings(storyIds) } : {}
708
+ });
709
+ }
710
+ let highest = questions.reduce((max, question) => {
711
+ const match = /^Q(\d+)$/.exec(question.id);
712
+ return match ? Math.max(max, Number(match[1])) : max;
713
+ }, 0);
714
+ return questions.map((question) => question.id ? question : {
715
+ ...question,
716
+ id: formatQuestionId(++highest)
717
+ });
718
+ }
719
+ function formatQuestionId(number) {
720
+ return `Q${String(number).padStart(3, "0")}`;
721
+ }
722
+ /**
723
+ * The next question id. Answered questions are quoted in decisions, so an id
724
+ * is never handed out twice: the high-water mark is kept in metadata.
725
+ */
726
+ function nextQuestionId(prd, extra = []) {
727
+ const present = [...prd.openQuestions, ...extra].reduce((max, question) => {
728
+ const match = /^Q(\d+)$/.exec(question.id);
729
+ return match ? Math.max(max, Number(match[1])) : max;
730
+ }, 0);
731
+ const next = Math.max(prd.metadata.lastQuestionNumber ?? 0, present) + 1;
732
+ prd.metadata.lastQuestionNumber = next;
733
+ return formatQuestionId(next);
734
+ }
735
+ /** Open questions that block a story that is not completed yet. */
736
+ function blockingQuestions(prd) {
737
+ const unfinished = new Set(prd.userStories.filter((story) => story.status !== "completed").map((story) => story.id));
738
+ return prd.openQuestions.filter((question) => question.storyIds?.some((id) => unfinished.has(id)));
739
+ }
740
+ //#endregion
819
741
  //#region src/plan-check.ts
820
742
  /** The not-applicable topic each "missing" check is about. */
821
743
  const CHECK_TOPICS = {
@@ -1788,4 +1710,4 @@ function assessComplexity(criteria) {
1788
1710
  return "XL";
1789
1711
  }
1790
1712
  //#endregion
1791
- export { AddAttachmentInputSchema, AddAttachmentOutputSchema, AddDecisionInputSchema, AddDecisionOutputSchema, AddGlossaryTermInputSchema, AddGlossaryTermOutputSchema, AddStoryLogInputSchema, AddStoryLogOutputSchema, AddUserStoryInputSchema, AddUserStoryOutputSchema, AssignStoryToPhaseInputSchema, AssignStoryToPhaseOutputSchema, CheckPlanInputSchema, CheckPlanOutputSchema, CreateCustomPhaseInputSchema, CreateCustomPhaseOutputSchema, CreatePrdInputSchema, CreatePrdOutputSchema, 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, RemoveAttachmentInputSchema, RemoveAttachmentOutputSchema, ReorderPhasesInputSchema, ResolveOpenQuestionInputSchema, ResolveOpenQuestionOutputSchema, StoryAttachmentSchema, StoryComplexitySchema, StoryLogEntrySchema, StoryPrioritySchema, StoryStatusSchema, StoryVerificationSchema, TEMPLATE_IDS, UpdateAttachmentInputSchema, UpdateAttachmentOutputSchema, UpdatePhaseInputSchema, UpdatePrdSectionInputSchema, UpdatePrdSectionOutputSchema, UpdateStoryStatusInputSchema, UpdateStoryStatusOutputSchema, UpdateUserStoryInputSchema, UpdateUserStoryOutputSchema, appendChangeLog, appendStoryLog, 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 };
1713
+ export { AddAttachmentInputSchema, AddAttachmentOutputSchema, AddDecisionInputSchema, AddDecisionOutputSchema, AddGlossaryTermInputSchema, AddGlossaryTermOutputSchema, AddStoryLogInputSchema, AddStoryLogOutputSchema, AddUserStoryInputSchema, AddUserStoryOutputSchema, AssignStoryToPhaseInputSchema, AssignStoryToPhaseOutputSchema, CheckPlanInputSchema, CheckPlanOutputSchema, CreateCustomPhaseInputSchema, CreateCustomPhaseOutputSchema, CreatePrdInputSchema, CreatePrdOutputSchema, 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, 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 };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_prompts = require("./prompts-CIX8IeAx.js");
2
+ const require_prompts = require("./prompts-CTRnq1J5.js");
3
3
  let zod_v3 = require("zod/v3");
4
4
  //#region src/mcp/tool-response.ts
5
5
  /**
@@ -498,6 +498,17 @@ function registerPRDTools(server, service) {
498
498
  text: require_prompts.shapePrdPrompt(idea, filename, template)
499
499
  }
500
500
  }] }));
501
+ server.registerPrompt("architect_prd", {
502
+ title: "Architect a PRD",
503
+ description: "Design the shape all stories share (data model, modules, entry points, test seams) before any is built, and record it in the PRD as the contract to build against.",
504
+ argsSchema: { filename: zod_v3.z.string().describe("PRD file name inside .prds") }
505
+ }, ({ filename }) => ({ messages: [{
506
+ role: "user",
507
+ content: {
508
+ type: "text",
509
+ text: require_prompts.architectPrdPrompt(filename)
510
+ }
511
+ }] }));
501
512
  server.registerPrompt("review_story", {
502
513
  title: "Review a story against its spec",
503
514
  description: "Check the changes made for a story against its acceptance criteria, scope limits and test seams, and report a verdict.",
@@ -1,4 +1,4 @@
1
- import { A as ExportPrdMarkdownInputSchema, B as GetProjectStatusInputSchema, C as DecideEdgeCaseInputSchema, D as DeletePrdOutputSchema, E as DeletePrdInputSchema, F as GetImprovementSuggestionsOutputSchema, G as ListPrdsOutputSchema, H as GetStoryInputSchema, I as GetNextStoryInputSchema, J as MarkNotApplicableInputSchema, K as ListTemplatesInputSchema, L as GetNextStoryOutputSchema, M as GetImplementationPromptsInputSchema, N as GetImplementationPromptsOutputSchema, O as DeleteUserStoryInputSchema, P as GetImprovementSuggestionsInputSchema, R as GetPrdInputSchema, T as DeletePhaseInputSchema, U as GetStoryOutputSchema, V as GetProjectStatusOutputSchema, W as ListPrdsInputSchema, Y as MarkNotApplicableOutputSchema, Z as PhasesOutputSchema, _ as CheckPlanOutputSchema, _t as UpdateStoryStatusOutputSchema, a as AddAttachmentOutputSchema, b as CreatePrdInputSchema, c as AddGlossaryTermInputSchema, d as AddStoryLogOutputSchema, dt as UpdateAttachmentInputSchema, et as RemoveAttachmentInputSchema, f as AddUserStoryInputSchema, ft as UpdateAttachmentOutputSchema, g as CheckPlanInputSchema, gt as UpdateStoryStatusInputSchema, h as AssignStoryToPhaseOutputSchema, ht as UpdatePrdSectionOutputSchema, i as AddAttachmentInputSchema, it as ResolveOpenQuestionOutputSchema, j as ExportPrdMarkdownOutputSchema, k as DeleteUserStoryOutputSchema, l as AddGlossaryTermOutputSchema, m as AssignStoryToPhaseInputSchema, mt as UpdatePrdSectionInputSchema, n as reviewStoryPrompt, nt as ReorderPhasesInputSchema, o as AddDecisionInputSchema, p as AddUserStoryOutputSchema, pt as UpdatePhaseInputSchema, q as ListTemplatesOutputSchema, r as shapePrdPrompt, rt as ResolveOpenQuestionInputSchema, s as AddDecisionOutputSchema, t as implementStoryPrompt, tt as RemoveAttachmentOutputSchema, u as AddStoryLogInputSchema, v as CreateCustomPhaseInputSchema, vt as UpdateUserStoryInputSchema, w as DecideEdgeCaseOutputSchema, x as CreatePrdOutputSchema, xt as TEMPLATE_IDS, y as CreateCustomPhaseOutputSchema, yt as UpdateUserStoryOutputSchema, z as GetPrdOutputSchema } from "./prompts-Bber0S1Z.mjs";
1
+ import { A as DeleteUserStoryOutputSchema, B as GetPrdOutputSchema, D as DeletePrdInputSchema, E as DeletePhaseInputSchema, F as GetImprovementSuggestionsInputSchema, G as ListPrdsInputSchema, H as GetProjectStatusOutputSchema, I as GetImprovementSuggestionsOutputSchema, J as ListTemplatesOutputSchema, K as ListPrdsOutputSchema, L as GetNextStoryInputSchema, M as ExportPrdMarkdownOutputSchema, N as GetImplementationPromptsInputSchema, O as DeletePrdOutputSchema, P as GetImplementationPromptsOutputSchema, Q as PhasesOutputSchema, R as GetNextStoryOutputSchema, S as CreatePrdOutputSchema, St as TEMPLATE_IDS, T as DecideEdgeCaseOutputSchema, U as GetStoryInputSchema, V as GetProjectStatusInputSchema, W as GetStoryOutputSchema, X as MarkNotApplicableOutputSchema, Y as MarkNotApplicableInputSchema, _ as CheckPlanInputSchema, _t as UpdateStoryStatusInputSchema, a as AddAttachmentInputSchema, at as ResolveOpenQuestionOutputSchema, b as CreateCustomPhaseOutputSchema, bt as UpdateUserStoryOutputSchema, c as AddDecisionOutputSchema, d as AddStoryLogInputSchema, f as AddStoryLogOutputSchema, ft as UpdateAttachmentInputSchema, g as AssignStoryToPhaseOutputSchema, gt as UpdatePrdSectionOutputSchema, h as AssignStoryToPhaseInputSchema, ht as UpdatePrdSectionInputSchema, i as shapePrdPrompt, it as ResolveOpenQuestionInputSchema, j as ExportPrdMarkdownInputSchema, k as DeleteUserStoryInputSchema, l as AddGlossaryTermInputSchema, m as AddUserStoryOutputSchema, mt as UpdatePhaseInputSchema, n as implementStoryPrompt, nt as RemoveAttachmentOutputSchema, o as AddAttachmentOutputSchema, p as AddUserStoryInputSchema, pt as UpdateAttachmentOutputSchema, q as ListTemplatesInputSchema, r as reviewStoryPrompt, rt as ReorderPhasesInputSchema, s as AddDecisionInputSchema, t as architectPrdPrompt, tt as RemoveAttachmentInputSchema, u as AddGlossaryTermOutputSchema, v as CheckPlanOutputSchema, vt as UpdateStoryStatusOutputSchema, w as DecideEdgeCaseInputSchema, x as CreatePrdInputSchema, y as CreateCustomPhaseInputSchema, yt as UpdateUserStoryInputSchema, z as GetPrdInputSchema } from "./prompts-B0ciGmv-.mjs";
2
2
  import { z } from "zod/v3";
3
3
  //#region src/mcp/tool-response.ts
4
4
  /**
@@ -497,6 +497,17 @@ function registerPRDTools(server, service) {
497
497
  text: shapePrdPrompt(idea, filename, template)
498
498
  }
499
499
  }] }));
500
+ server.registerPrompt("architect_prd", {
501
+ title: "Architect a PRD",
502
+ description: "Design the shape all stories share (data model, modules, entry points, test seams) before any is built, and record it in the PRD as the contract to build against.",
503
+ argsSchema: { filename: z.string().describe("PRD file name inside .prds") }
504
+ }, ({ filename }) => ({ messages: [{
505
+ role: "user",
506
+ content: {
507
+ type: "text",
508
+ text: architectPrdPrompt(filename)
509
+ }
510
+ }] }));
500
511
  server.registerPrompt("review_story", {
501
512
  title: "Review a story against its spec",
502
513
  description: "Check the changes made for a story against its acceptance criteria, scope limits and test seams, and report a verdict.",