@makerkit/prd 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +64 -2
- package/index.d.ts +227 -0
- package/index.js +1897 -0
- package/index.mjs +1791 -0
- package/mcp.d.ts +9 -0
- package/mcp.js +532 -0
- package/mcp.mjs +531 -0
- package/node.d.ts +19 -0
- package/node.js +94 -0
- package/node.mjs +92 -0
- package/package.json +47 -4
- package/prd.service-DSBp8sMl.d.ts +2327 -0
- package/prompts-Bber0S1Z.mjs +778 -0
- package/prompts-CIX8IeAx.js +1233 -0
package/mcp.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { r as PrdService } from "./prd.service-DSBp8sMl.js";
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
//#region src/mcp/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Registers the PRD tools on an MCP server. The caller builds the service, so
|
|
6
|
+
* it decides where PRDs live and which checks gate a story's completion.
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerPRDTools(server: McpServer, service: PrdService): void;
|
|
9
|
+
//#endregion
|
package/mcp.js
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_prompts = require("./prompts-CIX8IeAx.js");
|
|
3
|
+
let zod_v3 = require("zod/v3");
|
|
4
|
+
//#region src/mcp/tool-response.ts
|
|
5
|
+
/**
|
|
6
|
+
* Standard annotation presets. Every registered tool must declare one so MCP
|
|
7
|
+
* clients can gate permissions correctly (e.g. auto-approve read-only tools,
|
|
8
|
+
* always confirm destructive ones).
|
|
9
|
+
*/
|
|
10
|
+
const READ_ONLY_TOOL = {
|
|
11
|
+
readOnlyHint: true,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
openWorldHint: false
|
|
15
|
+
};
|
|
16
|
+
/** Writes files or state but can be re-applied safely and is reversible. */
|
|
17
|
+
const MUTATING_TOOL = {
|
|
18
|
+
readOnlyHint: false,
|
|
19
|
+
destructiveHint: false,
|
|
20
|
+
idempotentHint: false,
|
|
21
|
+
openWorldHint: false
|
|
22
|
+
};
|
|
23
|
+
/** Same as MUTATING_TOOL but repeating the call has no further effect. */
|
|
24
|
+
const IDEMPOTENT_MUTATING_TOOL = {
|
|
25
|
+
readOnlyHint: false,
|
|
26
|
+
destructiveHint: false,
|
|
27
|
+
idempotentHint: true,
|
|
28
|
+
openWorldHint: false
|
|
29
|
+
};
|
|
30
|
+
/** Deletes or irreversibly replaces data. Clients should always confirm. */
|
|
31
|
+
const DESTRUCTIVE_TOOL = {
|
|
32
|
+
readOnlyHint: false,
|
|
33
|
+
destructiveHint: true,
|
|
34
|
+
idempotentHint: false,
|
|
35
|
+
openWorldHint: false
|
|
36
|
+
};
|
|
37
|
+
function buildStructuredResponse(result) {
|
|
38
|
+
return {
|
|
39
|
+
structuredContent: result,
|
|
40
|
+
content: buildTextContent(JSON.stringify(result))
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function buildErrorResponse(tool, error) {
|
|
44
|
+
const message = `${tool} failed: ${toErrorMessage(error)}`;
|
|
45
|
+
return {
|
|
46
|
+
isError: true,
|
|
47
|
+
structuredContent: { error: { message } },
|
|
48
|
+
content: buildTextContent(message)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function toErrorMessage(error) {
|
|
52
|
+
if (error instanceof Error) return error.message;
|
|
53
|
+
return "Unknown error";
|
|
54
|
+
}
|
|
55
|
+
function buildTextContent(text) {
|
|
56
|
+
return [{
|
|
57
|
+
type: "text",
|
|
58
|
+
text
|
|
59
|
+
}];
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/mcp/index.ts
|
|
63
|
+
/**
|
|
64
|
+
* Registers the PRD tools on an MCP server. The caller builds the service, so
|
|
65
|
+
* it decides where PRDs live and which checks gate a story's completion.
|
|
66
|
+
*/
|
|
67
|
+
function registerPRDTools(server, service) {
|
|
68
|
+
server.registerTool("list_prds", {
|
|
69
|
+
title: "List PRDs",
|
|
70
|
+
description: "List Product Requirements Documents in .prds with title and story progress.",
|
|
71
|
+
inputSchema: require_prompts.ListPrdsInputSchema,
|
|
72
|
+
outputSchema: require_prompts.ListPrdsOutputSchema,
|
|
73
|
+
annotations: READ_ONLY_TOOL
|
|
74
|
+
}, async () => {
|
|
75
|
+
try {
|
|
76
|
+
return buildStructuredResponse(await service.list());
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return buildErrorResponse("list_prds", error);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
server.registerTool("get_prd", {
|
|
82
|
+
title: "Read a PRD",
|
|
83
|
+
description: "Get the full contents of one PRD file.",
|
|
84
|
+
inputSchema: require_prompts.GetPrdInputSchema,
|
|
85
|
+
outputSchema: require_prompts.GetPrdOutputSchema,
|
|
86
|
+
annotations: READ_ONLY_TOOL
|
|
87
|
+
}, async (input) => {
|
|
88
|
+
try {
|
|
89
|
+
const parsed = require_prompts.GetPrdInputSchema.parse(input);
|
|
90
|
+
return buildStructuredResponse(await service.get(parsed));
|
|
91
|
+
} catch (error) {
|
|
92
|
+
return buildErrorResponse("get_prd", error);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
server.registerTool("create_prd", {
|
|
96
|
+
title: "Create a PRD",
|
|
97
|
+
description: "Create a new structured PRD in .prds. The file name is derived from the title.",
|
|
98
|
+
inputSchema: require_prompts.CreatePrdInputSchema,
|
|
99
|
+
outputSchema: require_prompts.CreatePrdOutputSchema,
|
|
100
|
+
annotations: MUTATING_TOOL
|
|
101
|
+
}, async (input) => {
|
|
102
|
+
try {
|
|
103
|
+
const parsed = require_prompts.CreatePrdInputSchema.parse(input);
|
|
104
|
+
return buildStructuredResponse(await service.create(parsed));
|
|
105
|
+
} catch (error) {
|
|
106
|
+
return buildErrorResponse("create_prd", error);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
server.registerTool("delete_prd", {
|
|
110
|
+
title: "Delete a PRD",
|
|
111
|
+
description: "Permanently delete a PRD file. Its folder of attachments, if any, is kept.",
|
|
112
|
+
inputSchema: require_prompts.DeletePrdInputSchema,
|
|
113
|
+
outputSchema: require_prompts.DeletePrdOutputSchema,
|
|
114
|
+
annotations: DESTRUCTIVE_TOOL
|
|
115
|
+
}, async (input) => {
|
|
116
|
+
try {
|
|
117
|
+
const parsed = require_prompts.DeletePrdInputSchema.parse(input);
|
|
118
|
+
return buildStructuredResponse(await service.delete(parsed));
|
|
119
|
+
} catch (error) {
|
|
120
|
+
return buildErrorResponse("delete_prd", error);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
server.registerTool("add_user_story", {
|
|
124
|
+
title: "Add a user story",
|
|
125
|
+
description: "Append a user story with acceptance criteria to a PRD.",
|
|
126
|
+
inputSchema: require_prompts.AddUserStoryInputSchema,
|
|
127
|
+
outputSchema: require_prompts.AddUserStoryOutputSchema,
|
|
128
|
+
annotations: MUTATING_TOOL
|
|
129
|
+
}, async (input) => {
|
|
130
|
+
try {
|
|
131
|
+
const parsed = require_prompts.AddUserStoryInputSchema.parse(input);
|
|
132
|
+
return buildStructuredResponse(await service.addUserStory(parsed));
|
|
133
|
+
} catch (error) {
|
|
134
|
+
return buildErrorResponse("add_user_story", error);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
server.registerTool("update_story_status", {
|
|
138
|
+
title: "Update story status",
|
|
139
|
+
description: "Update a user story status. Marking a story \"completed\" runs the project checks (typecheck, lint) first and is rejected if they fail.",
|
|
140
|
+
inputSchema: require_prompts.UpdateStoryStatusInputSchema,
|
|
141
|
+
outputSchema: require_prompts.UpdateStoryStatusOutputSchema,
|
|
142
|
+
annotations: MUTATING_TOOL
|
|
143
|
+
}, async (input) => {
|
|
144
|
+
try {
|
|
145
|
+
const parsed = require_prompts.UpdateStoryStatusInputSchema.parse(input);
|
|
146
|
+
return buildStructuredResponse(await service.updateStoryStatus(parsed));
|
|
147
|
+
} catch (error) {
|
|
148
|
+
return buildErrorResponse("update_story_status", error);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
server.registerTool("update_user_story", {
|
|
152
|
+
title: "Update a user story",
|
|
153
|
+
description: "Edit an existing story's content. Every field is optional; only the ones supplied change. Use update_story_status for status.",
|
|
154
|
+
inputSchema: require_prompts.UpdateUserStoryInputSchema,
|
|
155
|
+
outputSchema: require_prompts.UpdateUserStoryOutputSchema,
|
|
156
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
157
|
+
}, async (input) => {
|
|
158
|
+
try {
|
|
159
|
+
const parsed = require_prompts.UpdateUserStoryInputSchema.parse(input);
|
|
160
|
+
return buildStructuredResponse(await service.updateUserStory(parsed));
|
|
161
|
+
} catch (error) {
|
|
162
|
+
return buildErrorResponse("update_user_story", error);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
server.registerTool("delete_user_story", {
|
|
166
|
+
title: "Delete a user story",
|
|
167
|
+
description: "Remove a story and clean up references to it in other stories' dependencies and in phases. Story ids are never reissued.",
|
|
168
|
+
inputSchema: require_prompts.DeleteUserStoryInputSchema,
|
|
169
|
+
outputSchema: require_prompts.DeleteUserStoryOutputSchema,
|
|
170
|
+
annotations: DESTRUCTIVE_TOOL
|
|
171
|
+
}, async (input) => {
|
|
172
|
+
try {
|
|
173
|
+
const parsed = require_prompts.DeleteUserStoryInputSchema.parse(input);
|
|
174
|
+
return buildStructuredResponse(await service.deleteUserStory(parsed));
|
|
175
|
+
} catch (error) {
|
|
176
|
+
return buildErrorResponse("delete_user_story", error);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
server.registerTool("create_custom_phase", {
|
|
180
|
+
title: "Create a delivery phase",
|
|
181
|
+
description: "Create a named phase (e.g. \"MVP\", \"Fast follow\") that stories can be grouped into.",
|
|
182
|
+
inputSchema: require_prompts.CreateCustomPhaseInputSchema,
|
|
183
|
+
outputSchema: require_prompts.CreateCustomPhaseOutputSchema,
|
|
184
|
+
annotations: MUTATING_TOOL
|
|
185
|
+
}, async (input) => {
|
|
186
|
+
try {
|
|
187
|
+
const parsed = require_prompts.CreateCustomPhaseInputSchema.parse(input);
|
|
188
|
+
return buildStructuredResponse(await service.createCustomPhase(parsed));
|
|
189
|
+
} catch (error) {
|
|
190
|
+
return buildErrorResponse("create_custom_phase", error);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
server.registerTool("assign_story_to_phase", {
|
|
194
|
+
title: "Assign a story to a phase",
|
|
195
|
+
description: "Move a story into a phase, or pass phaseId null to remove it from every phase. A story belongs to at most one phase.",
|
|
196
|
+
inputSchema: require_prompts.AssignStoryToPhaseInputSchema,
|
|
197
|
+
outputSchema: require_prompts.AssignStoryToPhaseOutputSchema,
|
|
198
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
199
|
+
}, async (input) => {
|
|
200
|
+
try {
|
|
201
|
+
const parsed = require_prompts.AssignStoryToPhaseInputSchema.parse(input);
|
|
202
|
+
return buildStructuredResponse(await service.assignStoryToPhase(parsed));
|
|
203
|
+
} catch (error) {
|
|
204
|
+
return buildErrorResponse("assign_story_to_phase", error);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
server.registerTool("export_prd_markdown", {
|
|
208
|
+
title: "Export PRD as Markdown",
|
|
209
|
+
description: "Write a Markdown rendering of the PRD next to the JSON file.",
|
|
210
|
+
inputSchema: require_prompts.ExportPrdMarkdownInputSchema,
|
|
211
|
+
outputSchema: require_prompts.ExportPrdMarkdownOutputSchema,
|
|
212
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
213
|
+
}, async (input) => {
|
|
214
|
+
try {
|
|
215
|
+
const parsed = require_prompts.ExportPrdMarkdownInputSchema.parse(input);
|
|
216
|
+
return buildStructuredResponse(await service.exportMarkdown(parsed));
|
|
217
|
+
} catch (error) {
|
|
218
|
+
return buildErrorResponse("export_prd_markdown", error);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
server.registerTool("get_implementation_prompts", {
|
|
222
|
+
title: "Implementation prompts",
|
|
223
|
+
description: "The implement_story instructions for the next unstarted stories, as text to paste into an agent that does not support MCP prompts.",
|
|
224
|
+
inputSchema: require_prompts.GetImplementationPromptsInputSchema,
|
|
225
|
+
outputSchema: require_prompts.GetImplementationPromptsOutputSchema,
|
|
226
|
+
annotations: READ_ONLY_TOOL
|
|
227
|
+
}, async (input) => {
|
|
228
|
+
try {
|
|
229
|
+
const { filename } = require_prompts.GetImplementationPromptsInputSchema.parse(input);
|
|
230
|
+
return buildStructuredResponse(await service.getImplementationPrompts(filename));
|
|
231
|
+
} catch (error) {
|
|
232
|
+
return buildErrorResponse("get_implementation_prompts", error);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
server.registerTool("get_improvement_suggestions", {
|
|
236
|
+
title: "PRD completeness checks",
|
|
237
|
+
description: "Rule-based suggestions for missing PRD sections (stories, metrics, scope guardrails, rollout plan).",
|
|
238
|
+
inputSchema: require_prompts.GetImprovementSuggestionsInputSchema,
|
|
239
|
+
outputSchema: require_prompts.GetImprovementSuggestionsOutputSchema,
|
|
240
|
+
annotations: READ_ONLY_TOOL
|
|
241
|
+
}, async (input) => {
|
|
242
|
+
try {
|
|
243
|
+
const { filename } = require_prompts.GetImprovementSuggestionsInputSchema.parse(input);
|
|
244
|
+
return buildStructuredResponse(await service.getImprovementSuggestions(filename));
|
|
245
|
+
} catch (error) {
|
|
246
|
+
return buildErrorResponse("get_improvement_suggestions", error);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
server.registerTool("get_project_status", {
|
|
250
|
+
title: "PRD project status",
|
|
251
|
+
description: "Progress, next steps, blockers, open questions and high risks for a PRD.",
|
|
252
|
+
inputSchema: require_prompts.GetProjectStatusInputSchema,
|
|
253
|
+
outputSchema: require_prompts.GetProjectStatusOutputSchema,
|
|
254
|
+
annotations: READ_ONLY_TOOL
|
|
255
|
+
}, async (input) => {
|
|
256
|
+
try {
|
|
257
|
+
const { filename } = require_prompts.GetProjectStatusInputSchema.parse(input);
|
|
258
|
+
return buildStructuredResponse(await service.getProjectStatus(filename));
|
|
259
|
+
} catch (error) {
|
|
260
|
+
return buildErrorResponse("get_project_status", error);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
server.registerTool("list_templates", {
|
|
264
|
+
title: "List PRD templates",
|
|
265
|
+
description: "Starting points for create_prd (e.g. a SaaS feature, an internal tool, an integration, a first version). Each says when to use it.",
|
|
266
|
+
inputSchema: require_prompts.ListTemplatesInputSchema,
|
|
267
|
+
outputSchema: require_prompts.ListTemplatesOutputSchema,
|
|
268
|
+
annotations: READ_ONLY_TOOL
|
|
269
|
+
}, async () => {
|
|
270
|
+
try {
|
|
271
|
+
return buildStructuredResponse(service.listTemplates());
|
|
272
|
+
} catch (error) {
|
|
273
|
+
return buildErrorResponse("list_templates", error);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
server.registerTool("check_plan", {
|
|
277
|
+
title: "Check what the plan is missing",
|
|
278
|
+
description: "A checklist of what the PRD still needs before and during the build. \"required\" items (no stories, stories without acceptance criteria, no scope limits) mean it is not ready to build; \"recommended\" items improve it. Each item names the section to change and, when relevant, the stories.",
|
|
279
|
+
inputSchema: require_prompts.CheckPlanInputSchema,
|
|
280
|
+
outputSchema: require_prompts.CheckPlanOutputSchema,
|
|
281
|
+
annotations: READ_ONLY_TOOL
|
|
282
|
+
}, async (input) => {
|
|
283
|
+
try {
|
|
284
|
+
const { filename } = require_prompts.CheckPlanInputSchema.parse(input);
|
|
285
|
+
return buildStructuredResponse(await service.checkPlan(filename));
|
|
286
|
+
} catch (error) {
|
|
287
|
+
return buildErrorResponse("check_plan", error);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
server.registerTool("get_next_story", {
|
|
291
|
+
title: "Next story to work on",
|
|
292
|
+
description: "The next not-started story whose dependencies are all completed, ordered by phase, priority and position. Also lists stories in progress and stories waiting on dependencies.",
|
|
293
|
+
inputSchema: require_prompts.GetNextStoryInputSchema,
|
|
294
|
+
outputSchema: require_prompts.GetNextStoryOutputSchema,
|
|
295
|
+
annotations: READ_ONLY_TOOL
|
|
296
|
+
}, async (input) => {
|
|
297
|
+
try {
|
|
298
|
+
const { filename } = require_prompts.GetNextStoryInputSchema.parse(input);
|
|
299
|
+
return buildStructuredResponse(await service.getNextStory(filename));
|
|
300
|
+
} catch (error) {
|
|
301
|
+
return buildErrorResponse("get_next_story", error);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
server.registerTool("get_story", {
|
|
305
|
+
title: "Story with context",
|
|
306
|
+
description: "One story with what is needed to implement it: PRD summary and scope limits, its phase, its dependencies and their hand-off logs, and the log of the most recently completed story. Prefer this over get_prd when working on a single story.",
|
|
307
|
+
inputSchema: require_prompts.GetStoryInputSchema,
|
|
308
|
+
outputSchema: require_prompts.GetStoryOutputSchema,
|
|
309
|
+
annotations: READ_ONLY_TOOL
|
|
310
|
+
}, async (input) => {
|
|
311
|
+
try {
|
|
312
|
+
return buildStructuredResponse(await service.getStory(require_prompts.GetStoryInputSchema.parse(input)));
|
|
313
|
+
} catch (error) {
|
|
314
|
+
return buildErrorResponse("get_story", error);
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
server.registerTool("add_story_log", {
|
|
318
|
+
title: "Log work on a story",
|
|
319
|
+
description: "Append a hand-off entry to a story: what a person can now try (whatsNew), notes for the next agent (technicalNotes) and where the work departed from the PRD (deviations). Write one when you finish a work session on a story.",
|
|
320
|
+
inputSchema: require_prompts.AddStoryLogInputSchema,
|
|
321
|
+
outputSchema: require_prompts.AddStoryLogOutputSchema,
|
|
322
|
+
annotations: MUTATING_TOOL
|
|
323
|
+
}, async (input) => {
|
|
324
|
+
try {
|
|
325
|
+
return buildStructuredResponse(await service.addStoryLog(require_prompts.AddStoryLogInputSchema.parse(input)));
|
|
326
|
+
} catch (error) {
|
|
327
|
+
return buildErrorResponse("add_story_log", error);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
server.registerTool("add_attachment", {
|
|
331
|
+
title: "Add an attachment",
|
|
332
|
+
description: "Record a file or link the plan refers to (a mockup, a screenshot, reference docs) and link it to the stories that use it. Save files in the PRD folder, .prds/<prd file name without .json>/, first. get_story returns a story's attachments with their paths.",
|
|
333
|
+
inputSchema: require_prompts.AddAttachmentInputSchema,
|
|
334
|
+
outputSchema: require_prompts.AddAttachmentOutputSchema,
|
|
335
|
+
annotations: MUTATING_TOOL
|
|
336
|
+
}, async (input) => {
|
|
337
|
+
try {
|
|
338
|
+
return buildStructuredResponse(await service.addAttachment(require_prompts.AddAttachmentInputSchema.parse(input)));
|
|
339
|
+
} catch (error) {
|
|
340
|
+
return buildErrorResponse("add_attachment", error);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
server.registerTool("remove_attachment", {
|
|
344
|
+
title: "Remove an attachment",
|
|
345
|
+
description: "Remove an attachment from the PRD and from every story that uses it. The file itself is kept.",
|
|
346
|
+
inputSchema: require_prompts.RemoveAttachmentInputSchema,
|
|
347
|
+
outputSchema: require_prompts.RemoveAttachmentOutputSchema,
|
|
348
|
+
annotations: DESTRUCTIVE_TOOL
|
|
349
|
+
}, async (input) => {
|
|
350
|
+
try {
|
|
351
|
+
return buildStructuredResponse(await service.removeAttachment(require_prompts.RemoveAttachmentInputSchema.parse(input)));
|
|
352
|
+
} catch (error) {
|
|
353
|
+
return buildErrorResponse("remove_attachment", error);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
server.registerTool("update_prd_section", {
|
|
357
|
+
title: "Update a PRD section",
|
|
358
|
+
description: "Change one section of a PRD after it was created: scope (nonGoals, outOfScope), assumptions, open questions, risks, edge cases (what can go wrong and what should happen), security considerations, design guidance, external dependencies, technical requirements and contracts (including permissions and compliance), global acceptance criteria, constraints, rollout and measurement plans, or the introduction, problem and solution. For risks, edge cases and security, think adversarially: assume things fail and that someone is actively trying to abuse the feature, and write down the specific failure or attack with what should happen.",
|
|
359
|
+
inputSchema: require_prompts.UpdatePrdSectionInputSchema,
|
|
360
|
+
outputSchema: require_prompts.UpdatePrdSectionOutputSchema,
|
|
361
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
362
|
+
}, async (input) => {
|
|
363
|
+
try {
|
|
364
|
+
return buildStructuredResponse(await service.updatePrdSection(require_prompts.UpdatePrdSectionInputSchema.parse(input)));
|
|
365
|
+
} catch (error) {
|
|
366
|
+
return buildErrorResponse("update_prd_section", error);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
server.registerTool("add_decision", {
|
|
370
|
+
title: "Record a decision",
|
|
371
|
+
description: "Add an entry to the PRD decision log. Use it for choices that are hard to reverse or would surprise someone reading the code later. Pass supersedes to replace an earlier decision.",
|
|
372
|
+
inputSchema: require_prompts.AddDecisionInputSchema,
|
|
373
|
+
outputSchema: require_prompts.AddDecisionOutputSchema,
|
|
374
|
+
annotations: MUTATING_TOOL
|
|
375
|
+
}, async (input) => {
|
|
376
|
+
try {
|
|
377
|
+
return buildStructuredResponse(await service.addDecision(require_prompts.AddDecisionInputSchema.parse(input)));
|
|
378
|
+
} catch (error) {
|
|
379
|
+
return buildErrorResponse("add_decision", error);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
server.registerTool("mark_not_applicable", {
|
|
383
|
+
title: "Mark a part of the PRD not applicable",
|
|
384
|
+
description: "Mark an optional part of a PRD (dataModel, outsideServices, security, design, qualityBar, edgeCases, rollout, measurement, glossary, risks) as not applicable, with a reason, so the plan check stops asking for it and agents do not invent it. Pass notApplicable false to undo. Do not mark security or edgeCases not applicable for features that take input from people or store their data.",
|
|
385
|
+
inputSchema: require_prompts.MarkNotApplicableInputSchema,
|
|
386
|
+
outputSchema: require_prompts.MarkNotApplicableOutputSchema,
|
|
387
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
388
|
+
}, async (input) => {
|
|
389
|
+
try {
|
|
390
|
+
return buildStructuredResponse(await service.markNotApplicable(require_prompts.MarkNotApplicableInputSchema.parse(input)));
|
|
391
|
+
} catch (error) {
|
|
392
|
+
return buildErrorResponse("mark_not_applicable", error);
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
server.registerTool("resolve_open_question", {
|
|
396
|
+
title: "Answer an open question",
|
|
397
|
+
description: "Answer an open question (by questionId, or by its exact text): it is removed from the PRD and, by default, the answer is recorded in the decision log.",
|
|
398
|
+
inputSchema: require_prompts.ResolveOpenQuestionInputSchema,
|
|
399
|
+
outputSchema: require_prompts.ResolveOpenQuestionOutputSchema,
|
|
400
|
+
annotations: MUTATING_TOOL
|
|
401
|
+
}, async (input) => {
|
|
402
|
+
try {
|
|
403
|
+
return buildStructuredResponse(await service.resolveOpenQuestion(require_prompts.ResolveOpenQuestionInputSchema.parse(input)));
|
|
404
|
+
} catch (error) {
|
|
405
|
+
return buildErrorResponse("resolve_open_question", error);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
server.registerTool("update_attachment", {
|
|
409
|
+
title: "Update an attachment",
|
|
410
|
+
description: "Change an attachment's title or note, or which stories use it (storyIds: links are added and removed to match).",
|
|
411
|
+
inputSchema: require_prompts.UpdateAttachmentInputSchema,
|
|
412
|
+
outputSchema: require_prompts.UpdateAttachmentOutputSchema,
|
|
413
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
414
|
+
}, async (input) => {
|
|
415
|
+
try {
|
|
416
|
+
return buildStructuredResponse(await service.updateAttachment(require_prompts.UpdateAttachmentInputSchema.parse(input)));
|
|
417
|
+
} catch (error) {
|
|
418
|
+
return buildErrorResponse("update_attachment", error);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
server.registerTool("decide_edge_case", {
|
|
422
|
+
title: "Decide an open edge case",
|
|
423
|
+
description: "Record what should happen for an open edge case; it becomes decided and binding for the stories it applies to.",
|
|
424
|
+
inputSchema: require_prompts.DecideEdgeCaseInputSchema,
|
|
425
|
+
outputSchema: require_prompts.DecideEdgeCaseOutputSchema,
|
|
426
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
427
|
+
}, async (input) => {
|
|
428
|
+
try {
|
|
429
|
+
return buildStructuredResponse(await service.decideEdgeCase(require_prompts.DecideEdgeCaseInputSchema.parse(input)));
|
|
430
|
+
} catch (error) {
|
|
431
|
+
return buildErrorResponse("decide_edge_case", error);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
server.registerTool("add_glossary_term", {
|
|
435
|
+
title: "Define a glossary term",
|
|
436
|
+
description: "Add or redefine a term in the PRD glossary, with words to avoid, so people and agents use the same names for the same things.",
|
|
437
|
+
inputSchema: require_prompts.AddGlossaryTermInputSchema,
|
|
438
|
+
outputSchema: require_prompts.AddGlossaryTermOutputSchema,
|
|
439
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
440
|
+
}, async (input) => {
|
|
441
|
+
try {
|
|
442
|
+
return buildStructuredResponse(await service.addGlossaryTerm(require_prompts.AddGlossaryTermInputSchema.parse(input)));
|
|
443
|
+
} catch (error) {
|
|
444
|
+
return buildErrorResponse("add_glossary_term", error);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
server.registerTool("update_phase", {
|
|
448
|
+
title: "Update a phase",
|
|
449
|
+
description: "Rename a phase or change its description or colour.",
|
|
450
|
+
inputSchema: require_prompts.UpdatePhaseInputSchema,
|
|
451
|
+
outputSchema: require_prompts.PhasesOutputSchema,
|
|
452
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
453
|
+
}, async (input) => {
|
|
454
|
+
try {
|
|
455
|
+
return buildStructuredResponse(await service.updatePhase(require_prompts.UpdatePhaseInputSchema.parse(input)));
|
|
456
|
+
} catch (error) {
|
|
457
|
+
return buildErrorResponse("update_phase", error);
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
server.registerTool("delete_phase", {
|
|
461
|
+
title: "Delete a phase",
|
|
462
|
+
description: "Delete a phase. Its stories stay in the PRD without a phase.",
|
|
463
|
+
inputSchema: require_prompts.DeletePhaseInputSchema,
|
|
464
|
+
outputSchema: require_prompts.PhasesOutputSchema,
|
|
465
|
+
annotations: DESTRUCTIVE_TOOL
|
|
466
|
+
}, async (input) => {
|
|
467
|
+
try {
|
|
468
|
+
return buildStructuredResponse(await service.deletePhase(require_prompts.DeletePhaseInputSchema.parse(input)));
|
|
469
|
+
} catch (error) {
|
|
470
|
+
return buildErrorResponse("delete_phase", error);
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
server.registerTool("reorder_phases", {
|
|
474
|
+
title: "Reorder phases",
|
|
475
|
+
description: "Set the order of all phases. get_next_story works through phases in this order.",
|
|
476
|
+
inputSchema: require_prompts.ReorderPhasesInputSchema,
|
|
477
|
+
outputSchema: require_prompts.PhasesOutputSchema,
|
|
478
|
+
annotations: IDEMPOTENT_MUTATING_TOOL
|
|
479
|
+
}, async (input) => {
|
|
480
|
+
try {
|
|
481
|
+
return buildStructuredResponse(await service.reorderPhases(require_prompts.ReorderPhasesInputSchema.parse(input)));
|
|
482
|
+
} catch (error) {
|
|
483
|
+
return buildErrorResponse("reorder_phases", error);
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
server.registerPrompt("shape_prd", {
|
|
487
|
+
title: "Shape a PRD",
|
|
488
|
+
description: "Interview the user round by round until the plan is clear, writing each decision into the PRD as it is made, then slice the work into stories and phases.",
|
|
489
|
+
argsSchema: {
|
|
490
|
+
idea: zod_v3.z.string().optional().describe("What to build, in a sentence or two"),
|
|
491
|
+
filename: zod_v3.z.string().optional().describe("Existing PRD to keep shaping, inside .prds"),
|
|
492
|
+
template: zod_v3.z.enum(require_prompts.TEMPLATE_IDS).optional().describe("Kind of work, see list_templates")
|
|
493
|
+
}
|
|
494
|
+
}, ({ idea, filename, template }) => ({ messages: [{
|
|
495
|
+
role: "user",
|
|
496
|
+
content: {
|
|
497
|
+
type: "text",
|
|
498
|
+
text: require_prompts.shapePrdPrompt(idea, filename, template)
|
|
499
|
+
}
|
|
500
|
+
}] }));
|
|
501
|
+
server.registerPrompt("review_story", {
|
|
502
|
+
title: "Review a story against its spec",
|
|
503
|
+
description: "Check the changes made for a story against its acceptance criteria, scope limits and test seams, and report a verdict.",
|
|
504
|
+
argsSchema: {
|
|
505
|
+
filename: zod_v3.z.string().describe("PRD file name inside .prds"),
|
|
506
|
+
storyId: zod_v3.z.string().describe("Story id such as US003"),
|
|
507
|
+
base: zod_v3.z.string().optional().describe("Git ref the story started from. Defaults to HEAD.")
|
|
508
|
+
}
|
|
509
|
+
}, ({ filename, storyId, base }) => ({ messages: [{
|
|
510
|
+
role: "user",
|
|
511
|
+
content: {
|
|
512
|
+
type: "text",
|
|
513
|
+
text: require_prompts.reviewStoryPrompt(filename, storyId, base)
|
|
514
|
+
}
|
|
515
|
+
}] }));
|
|
516
|
+
server.registerPrompt("implement_story", {
|
|
517
|
+
title: "Implement a PRD story",
|
|
518
|
+
description: "Instructions for implementing one story end to end with the PRD tools.",
|
|
519
|
+
argsSchema: {
|
|
520
|
+
filename: zod_v3.z.string().describe("PRD file name inside .prds"),
|
|
521
|
+
storyId: zod_v3.z.string().optional().describe("Story id such as US003. Omit to take the next ready one.")
|
|
522
|
+
}
|
|
523
|
+
}, ({ filename, storyId }) => ({ messages: [{
|
|
524
|
+
role: "user",
|
|
525
|
+
content: {
|
|
526
|
+
type: "text",
|
|
527
|
+
text: require_prompts.implementStoryPrompt(filename, storyId)
|
|
528
|
+
}
|
|
529
|
+
}] }));
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
532
|
+
exports.registerPRDTools = registerPRDTools;
|