@makerkit/prd 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +46 -0
- package/.turbo/turbo-test.log +21 -0
- package/.turbo/turbo-typecheck.log +1 -0
- package/README.md +64 -2
- package/dist/LICENSE +21 -0
- package/dist/README.md +65 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +1897 -0
- package/dist/index.mjs +1791 -0
- package/dist/mcp.d.ts +9 -0
- package/dist/mcp.js +532 -0
- package/dist/mcp.mjs +531 -0
- package/dist/node.d.ts +19 -0
- package/dist/node.js +94 -0
- package/dist/node.mjs +92 -0
- package/dist/package.json +49 -0
- package/dist/prd.service-DSBp8sMl.d.ts +2327 -0
- package/dist/prompts-Bber0S1Z.mjs +778 -0
- package/dist/prompts-CIX8IeAx.js +1233 -0
- package/package.json +66 -4
- package/src/__tests__/agent-workflow.test.ts +377 -0
- package/src/__tests__/attachments.test.ts +475 -0
- package/src/__tests__/node.test.ts +141 -0
- package/src/__tests__/plan-check.test.ts +229 -0
- package/src/__tests__/planning.test.ts +1059 -0
- package/src/__tests__/prd-operations.test.ts +423 -0
- package/src/__tests__/prd.service.test.ts +477 -0
- package/src/__tests__/prd.tool.test.ts +282 -0
- package/src/__tests__/templates.test.ts +141 -0
- package/src/applicability.ts +73 -0
- package/src/attachment-paths.ts +78 -0
- package/src/attachments.ts +160 -0
- package/src/edge-cases.ts +52 -0
- package/src/index.ts +35 -0
- package/src/markdown.ts +268 -0
- package/src/mcp/index.ts +839 -0
- package/src/mcp/tool-response.ts +85 -0
- package/src/node.ts +146 -0
- package/src/open-questions.ts +93 -0
- package/src/plan-check.ts +282 -0
- package/src/planning-operations.ts +429 -0
- package/src/prd-operations.ts +690 -0
- package/src/prd.service.ts +1051 -0
- package/src/prompts.ts +110 -0
- package/src/safe-file-name.ts +42 -0
- package/src/schema.ts +976 -0
- package/src/templates.ts +173 -0
- package/src/testing/fake-mcp-server.ts +81 -0
- package/src/types.ts +333 -0
- package/tsconfig.json +23 -0
- package/tsconfig.lib.json +8 -0
- package/tsconfig.spec.json +7 -0
- package/tsdown.config.mts +11 -0
- package/vitest.config.mts +8 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
$ tsdown && node ../../scripts/prepare-dist.mjs
|
|
2
|
+
ℹ tsdown v0.23.0 powered by rolldown v1.2.13
|
|
3
|
+
ℹ config file: /Users/giancarlo/Code/makerkit/packages/prd/tsdown.config.mts
|
|
4
|
+
ℹ entry: src/index.ts, src/node.ts, src/mcp/index.ts
|
|
5
|
+
ℹ entry: src/index.ts, src/node.ts, src/mcp/index.ts
|
|
6
|
+
ℹ tsconfig: tsconfig.lib.json
|
|
7
|
+
ℹ tsconfig: tsconfig.lib.json
|
|
8
|
+
ℹ Build start
|
|
9
|
+
ℹ Cleaning 15 files
|
|
10
|
+
ℹ [ESM] dist/index.mjs 57.30 kB │ gzip: 14.75 kB
|
|
11
|
+
ℹ [ESM] dist/mcp.mjs 21.44 kB │ gzip: 4.71 kB
|
|
12
|
+
ℹ [ESM] dist/node.mjs 2.79 kB │ gzip: 1.19 kB
|
|
13
|
+
ℹ [ESM] dist/prompts-D-8eu2qV.mjs 31.30 kB │ gzip: 9.07 kB
|
|
14
|
+
ℹ [ESM] 4 files, total: 112.84 kB
|
|
15
|
+
src/prd.service.ts (87:21) [33m[UNRESOLVED_IMPORT] [0mCould not resolve 'node:path' in src/prd.service.ts
|
|
16
|
+
[38;5;246m╭[0m[38;5;246m─[0m[38;5;246m[[0m src/prd.service.ts:87:22 [38;5;246m][0m
|
|
17
|
+
[38;5;246m│[0m
|
|
18
|
+
[38;5;246m87 │[0m [38;5;249mi[0m[38;5;249mm[0m[38;5;249mp[0m[38;5;249mo[0m[38;5;249mr[0m[38;5;249mt[0m[38;5;249m [0m[38;5;249m{[0m[38;5;249m [0m[38;5;249mj[0m[38;5;249mo[0m[38;5;249mi[0m[38;5;249mn[0m[38;5;249m [0m[38;5;249m}[0m[38;5;249m [0m[38;5;249mf[0m[38;5;249mr[0m[38;5;249mo[0m[38;5;249mm[0m[38;5;249m [0m'node:path'[38;5;249m;[0m
|
|
19
|
+
[38;5;240m │[0m ─────┬─────
|
|
20
|
+
[38;5;240m │[0m ╰─────── Module not found, treating it as an external dependency
|
|
21
|
+
[38;5;240m │[0m
|
|
22
|
+
[38;5;240m │[0m [38;5;115mHelp[0m: The "main" field here was ignored. Main fields must be configured explicitly when using the "neutral" platform.
|
|
23
|
+
[38;5;246m────╯[0m
|
|
24
|
+
|
|
25
|
+
src/node.ts (12:7) [33m[UNRESOLVED_IMPORT] [0mCould not resolve 'node:fs/promises' in src/node.ts
|
|
26
|
+
[38;5;246m╭[0m[38;5;246m─[0m[38;5;246m[[0m src/node.ts:12:8 [38;5;246m][0m
|
|
27
|
+
[38;5;246m│[0m
|
|
28
|
+
[38;5;246m12 │[0m [38;5;249m}[0m[38;5;249m [0m[38;5;249mf[0m[38;5;249mr[0m[38;5;249mo[0m[38;5;249mm[0m[38;5;249m [0m'node:fs/promises'[38;5;249m;[0m
|
|
29
|
+
[38;5;240m │[0m ─────────┬────────
|
|
30
|
+
[38;5;240m │[0m ╰────────── Module not found, treating it as an external dependency
|
|
31
|
+
[38;5;240m │[0m
|
|
32
|
+
[38;5;240m │[0m [38;5;115mHelp[0m: The "main" field here was ignored. Main fields must be configured explicitly when using the "neutral" platform.
|
|
33
|
+
[38;5;246m────╯[0m
|
|
34
|
+
|
|
35
|
+
✔ Build complete in 472ms
|
|
36
|
+
ℹ [CJS] dist/index.js 59.60 kB │ gzip: 14.68 kB
|
|
37
|
+
ℹ [CJS] dist/mcp.js 21.14 kB │ gzip: 4.40 kB
|
|
38
|
+
ℹ [CJS] dist/node.js 3.04 kB │ gzip: 1.27 kB
|
|
39
|
+
ℹ [CJS] dist/prompts-DUS02Mwl.js 41.35 kB │ gzip: 9.39 kB
|
|
40
|
+
ℹ [CJS] 4 files, total: 125.15 kB
|
|
41
|
+
ℹ [CJS] dist/index.d.ts 14.49 kB │ gzip: 3.91 kB
|
|
42
|
+
ℹ [CJS] dist/node.d.ts 0.94 kB │ gzip: 0.51 kB
|
|
43
|
+
ℹ [CJS] dist/mcp.d.ts 0.42 kB │ gzip: 0.28 kB
|
|
44
|
+
ℹ [CJS] dist/prd.service-DoTF-akm.d.ts 61.23 kB │ gzip: 9.37 kB
|
|
45
|
+
ℹ [CJS] 4 files, total: 77.08 kB
|
|
46
|
+
✔ Build complete in 777ms
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
$ vitest run
|
|
2
|
+
|
|
3
|
+
[1m[30m[46m RUN [49m[39m[22m [36mv5.0.4 [39m[90m/Users/giancarlo/Code/makerkit/packages/prd[39m
|
|
4
|
+
|
|
5
|
+
[32m✓[39m src/__tests__/templates.test.ts [2m([22m[2m4 tests[22m[2m)[22m[32m 10[2mms[22m[39m
|
|
6
|
+
[32m✓[39m src/__tests__/plan-check.test.ts [2m([22m[2m6 tests[22m[2m)[22m[32m 3[2mms[22m[39m
|
|
7
|
+
[32m✓[39m src/__tests__/prd-operations.test.ts [2m([22m[2m24 tests[22m[2m)[22m[32m 5[2mms[22m[39m
|
|
8
|
+
[32m✓[39m src/__tests__/prd.tool.test.ts [2m([22m[2m9 tests[22m[2m)[22m[32m 17[2mms[22m[39m
|
|
9
|
+
[32m✓[39m src/__tests__/attachments.test.ts [2m([22m[2m14 tests[22m[2m)[22m[32m 18[2mms[22m[39m
|
|
10
|
+
[32m✓[39m src/__tests__/agent-workflow.test.ts [2m([22m[2m12 tests[22m[2m)[22m[32m 21[2mms[22m[39m
|
|
11
|
+
[32m✓[39m src/__tests__/planning.test.ts [2m([22m[2m17 tests[22m[2m)[22m[32m 23[2mms[22m[39m
|
|
12
|
+
[32m✓[39m src/__tests__/prd.service.test.ts [2m([22m[2m18 tests[22m[2m)[22m[32m 16[2mms[22m[39m
|
|
13
|
+
[32m✓[39m src/__tests__/node.test.ts [2m([22m[2m6 tests[22m[2m)[22m[33m 941[2mms[22m[39m
|
|
14
|
+
[32m✓[39m createScriptVerifier [2m(4)[22m
|
|
15
|
+
[33m[2m✓[22m[39m passes when every defined check exits 0[33m 307[2mms[22m[39m
|
|
16
|
+
|
|
17
|
+
[2m Test Files [22m [1m[32m9 passed[39m[22m[90m (9)[39m
|
|
18
|
+
[2m Tests [22m [1m[32m110 passed[39m[22m[90m (110)[39m
|
|
19
|
+
[2m Start at [22m 23:31:27
|
|
20
|
+
[2m Duration [22m 1.15s[2m (tests 47%, transform 41%, import 10%, worker 2%)[22m
|
|
21
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ tsc --noEmit -p tsconfig.lib.json && tsc --noEmit -p tsconfig.spec.json
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @makerkit/prd
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Structured product requirements documents (PRDs) stored as JSON files in `.prds/`, plus the tools to manage them from code or from a coding agent over MCP.
|
|
4
|
+
|
|
5
|
+
- **Format**: a typed `StructuredPRD` (stories, statuses, priorities, dependencies, phases, risks, decisions) with Zod schemas. Hand-written files are normalized on load. Text fields may use Markdown; list items (acceptance criteria, non-goals, ...) keep to inline Markdown, and raw HTML is not rendered.
|
|
6
|
+
- **Service**: create PRDs, add and update user stories, move stories through `not_started → research → in_progress → review → completed`, export markdown.
|
|
7
|
+
- **Completion gate**: a story can only be marked `completed` when the project's checks pass, so "done" means the code verifies.
|
|
8
|
+
- **MCP tools**: the same operations exposed to Claude Code, Codex, OpenCode or any MCP client.
|
|
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.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @makerkit/prd
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { createPrdService } from '@makerkit/prd';
|
|
22
|
+
import { createNodePrdDeps } from '@makerkit/prd/node';
|
|
23
|
+
|
|
24
|
+
const prds = createPrdService(createNodePrdDeps(process.cwd()));
|
|
25
|
+
|
|
26
|
+
const { prds: list } = await prds.list();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
By default, completing a story runs the project's `typecheck` and `lint` scripts with its package manager (scripts that do not exist are skipped). Pass your own check instead:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
createNodePrdDeps(root, {
|
|
33
|
+
verifyCompletion: async () => ({
|
|
34
|
+
passed: true,
|
|
35
|
+
checks: ['custom'],
|
|
36
|
+
errors: 0,
|
|
37
|
+
warnings: 0,
|
|
38
|
+
diagnostics: [],
|
|
39
|
+
messages: [],
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### MCP
|
|
45
|
+
|
|
46
|
+
Requires `@modelcontextprotocol/sdk`.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
50
|
+
import { createPrdService } from '@makerkit/prd';
|
|
51
|
+
import { registerPRDTools } from '@makerkit/prd/mcp';
|
|
52
|
+
import { createNodePrdDeps } from '@makerkit/prd/node';
|
|
53
|
+
|
|
54
|
+
const server = new McpServer({ name: 'prd', version: '1.0.0' });
|
|
55
|
+
|
|
56
|
+
registerPRDTools(server, createPrdService(createNodePrdDeps()));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Credits
|
|
60
|
+
|
|
61
|
+
The `shape_prd` interview and the story-slicing rules are adapted from ideas in Matt Pocock's [skills](https://github.com/mattpocock/skills) (MIT), in particular grilling and to-tickets.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Makerkit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @makerkit/prd
|
|
2
|
+
|
|
3
|
+
Structured product requirements documents (PRDs) stored as JSON files in `.prds/`, plus the tools to manage them from code or from a coding agent over MCP.
|
|
4
|
+
|
|
5
|
+
- **Format**: a typed `StructuredPRD` (stories, statuses, priorities, dependencies, phases, risks, decisions) with Zod schemas. Hand-written files are normalized on load. Text fields may use Markdown; list items (acceptance criteria, non-goals, ...) keep to inline Markdown, and raw HTML is not rendered.
|
|
6
|
+
- **Service**: create PRDs, add and update user stories, move stories through `not_started → research → in_progress → review → completed`, export markdown.
|
|
7
|
+
- **Completion gate**: a story can only be marked `completed` when the project's checks pass, so "done" means the code verifies.
|
|
8
|
+
- **MCP tools**: the same operations exposed to Claude Code, Codex, OpenCode or any MCP client.
|
|
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.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @makerkit/prd
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { createPrdService } from '@makerkit/prd';
|
|
22
|
+
import { createNodePrdDeps } from '@makerkit/prd/node';
|
|
23
|
+
|
|
24
|
+
const prds = createPrdService(createNodePrdDeps(process.cwd()));
|
|
25
|
+
|
|
26
|
+
const { prds: list } = await prds.list();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
By default, completing a story runs the project's `typecheck` and `lint` scripts with its package manager (scripts that do not exist are skipped). Pass your own check instead:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
createNodePrdDeps(root, {
|
|
33
|
+
verifyCompletion: async () => ({
|
|
34
|
+
passed: true,
|
|
35
|
+
checks: ['custom'],
|
|
36
|
+
errors: 0,
|
|
37
|
+
warnings: 0,
|
|
38
|
+
diagnostics: [],
|
|
39
|
+
messages: [],
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### MCP
|
|
45
|
+
|
|
46
|
+
Requires `@modelcontextprotocol/sdk`.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
50
|
+
import { createPrdService } from '@makerkit/prd';
|
|
51
|
+
import { registerPRDTools } from '@makerkit/prd/mcp';
|
|
52
|
+
import { createNodePrdDeps } from '@makerkit/prd/node';
|
|
53
|
+
|
|
54
|
+
const server = new McpServer({ name: 'prd', version: '1.0.0' });
|
|
55
|
+
|
|
56
|
+
registerPRDTools(server, createPrdService(createNodePrdDeps()));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Credits
|
|
60
|
+
|
|
61
|
+
The `shape_prd` interview and the story-slicing rules are adapted from ideas in Matt Pocock's [skills](https://github.com/mattpocock/skills) (MIT), in particular grilling and to-tickets.
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { $ as DeletePrdOutputSchema, $t as ResolveOpenQuestionOutput, A as AssignStoryToPhaseOutput, An as DecisionLogEntry, At as ListPrdsOutputSchema, B as CreatePrdInputSchema, Bn as StoryTraceabilityMap, Bt as PhasesOutputSchema, C as AddStoryLogOutputSchema, Cn as UpdateUserStoryInputSchema, Ct as GetProjectStatusOutputSchema, D as AddUserStoryOutputSchema, Dn as Attachment, Dt as GetStoryOutputSchema, E as AddUserStoryOutput, En as AgentTaskPacket, Et as GetStoryOutput, F as CreateCustomPhaseInput, Fn as RiskItem, Ft as MarkNotApplicableInputSchema, G as DecideEdgeCaseInputSchema, Gt as RemoveAttachmentInput, H as CreatePrdOutputSchema, Hn as StructuredPRD, Ht as PrdSectionValueSchemas, I as CreateCustomPhaseInputSchema, In as StoryComplexity, It as MarkNotApplicableOutput, J as DeletePhaseInput, Jt as RemoveAttachmentOutputSchema, K as DecideEdgeCaseOutput, Kt as RemoveAttachmentInputSchema, L as CreateCustomPhaseOutput, Ln as StoryLogEntry, Lt as MarkNotApplicableOutputSchema, M as CheckPlanInputSchema, Mn as GlossaryTerm, Mt as ListTemplatesOutput, N as CheckPlanOutput, Nn as NotApplicableTopic, Nt as ListTemplatesOutputSchema, O as AssignStoryToPhaseInput, On as CrossDependency, Ot as ListPrdsInputSchema, P as CheckPlanOutputSchema, Pn as OpenQuestion, Pt as MarkNotApplicableInput, Q as DeletePrdOutput, Qt as ResolveOpenQuestionInputSchema, R as CreateCustomPhaseOutputSchema, Rn as StoryPriority, Rt as NotApplicableTopicSchema, S as AddStoryLogOutput, Sn as UpdateUserStoryInput, St as GetProjectStatusOutput, T as AddUserStoryInputSchema, Tn as UpdateUserStoryOutputSchema, Tt as GetStoryInputSchema, U as CustomPhaseSchema, Un as UserStory, Ut as PrdSummary, V as CreatePrdOutput, Vn as StoryVerification, Vt as PrdSection, W as DecideEdgeCaseInput, Wt as PrdSummarySchema, X as DeletePrdInput, Xt as ReorderPhasesInputSchema, Y as DeletePhaseInputSchema, Yt as ReorderPhasesInput, Z as DeletePrdInputSchema, Zt as ResolveOpenQuestionInput, _ as AddGlossaryTermInputSchema, _n as UpdatePrdSectionOutputSchema, _t as GetPrdInput, a as PrdVerificationResult, an as StoryPrioritySchema, at as ExportPrdMarkdownInputSchema, b as AddStoryLogInput, bn as UpdateStoryStatusOutput, bt as GetPrdOutputSchema, c as AddAttachmentInput, cn as UpdateAttachmentInput, ct as GetImplementationPromptsInputSchema, d as AddAttachmentOutputSchema, dn as UpdateAttachmentOutputSchema, dt as GetImprovementSuggestionsInputSchema, en as ResolveOpenQuestionOutputSchema, et as DeleteUserStoryInput, f as AddDecisionInput, fn as UpdatePhaseInput, ft as GetImprovementSuggestionsOutput, g as AddGlossaryTermInput, gn as UpdatePrdSectionOutput, gt as GetNextStoryOutputSchema, h as AddDecisionOutputSchema, hn as UpdatePrdSectionInputSchema, ht as GetNextStoryOutput, i as PrdVerificationDiagnostic, in as StoryLogEntrySchema, it as ExportPrdMarkdownInput, j as AssignStoryToPhaseOutputSchema, jn as EdgeCase, jt as ListTemplatesInputSchema, k as AssignStoryToPhaseInputSchema, kn as CustomPhase, kt as ListPrdsOutput, l as AddAttachmentInputSchema, ln as UpdateAttachmentInputSchema, lt as GetImplementationPromptsOutput, m as AddDecisionOutput, mn as UpdatePrdSectionInput, mt as GetNextStoryInputSchema, n as PrdRevisionConflictError, nn as StoryAttachmentSchema, nt as DeleteUserStoryOutput, o as createPrdService, on as StoryStatusSchema, ot as ExportPrdMarkdownOutput, p as AddDecisionInputSchema, pn as UpdatePhaseInputSchema, pt as GetImprovementSuggestionsOutputSchema, q as DecideEdgeCaseOutputSchema, qt as RemoveAttachmentOutput, r as PrdService, rn as StoryComplexitySchema, rt as DeleteUserStoryOutputSchema, s as normalizePrd, sn as StoryVerificationSchema, st as ExportPrdMarkdownOutputSchema, t as PrdDeps, tn as StoryAttachment, tt as DeleteUserStoryInputSchema, u as AddAttachmentOutput, un as UpdateAttachmentOutput, ut as GetImplementationPromptsOutputSchema, v as AddGlossaryTermOutput, vn as UpdateStoryStatusInput, vt as GetPrdInputSchema, w as AddUserStoryInput, wn as UpdateUserStoryOutput, wt as GetStoryInput, x as AddStoryLogInputSchema, xn as UpdateStoryStatusOutputSchema, xt as GetProjectStatusInputSchema, y as AddGlossaryTermOutputSchema, yn as UpdateStoryStatusInputSchema, yt as GetPrdOutput, z as CreatePrdInput, zn as StoryStatus, zt as PhasesOutput } from "./prd.service-DSBp8sMl.js";
|
|
2
|
+
//#region src/prd-operations.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Pure PRD transforms.
|
|
5
|
+
*
|
|
6
|
+
* Everything here takes an already-loaded `StructuredPRD`, mutates it, and
|
|
7
|
+
* returns the tool payload. No filesystem, no clock, no deps — the service is
|
|
8
|
+
* left with load → transform → save, and every rule below is unit-testable
|
|
9
|
+
* without a harness.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Issues the next story id and advances the high-water mark.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately not `max(existing) + 1`: delete the highest-numbered story and
|
|
15
|
+
* that hands its id straight to the next one, so a story id quoted in a commit
|
|
16
|
+
* or a decision-log topic would silently come to mean something else.
|
|
17
|
+
*/
|
|
18
|
+
export declare function nextId(items: {
|
|
19
|
+
id: string;
|
|
20
|
+
}[], prefix: string): string;
|
|
21
|
+
export declare function nextStoryId(prd: StructuredPRD): string;
|
|
22
|
+
export declare function recomputeProgress(prd: StructuredPRD): void;
|
|
23
|
+
export declare function appendChangeLog(prd: StructuredPRD, entry: string, today: string): void;
|
|
24
|
+
export declare function findStory(prd: StructuredPRD, storyId: string): UserStory;
|
|
25
|
+
/** Splits the rendered sentence back into its parts so one can be patched. */
|
|
26
|
+
/** The parts of an "As a X, I want to Y so that Z" story, or undefined. */
|
|
27
|
+
export declare function splitUserStory(sentence: string): {
|
|
28
|
+
userType: string;
|
|
29
|
+
action: string;
|
|
30
|
+
benefit: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
export declare function renderUserStory(parts: {
|
|
33
|
+
userType: string;
|
|
34
|
+
action: string;
|
|
35
|
+
benefit: string;
|
|
36
|
+
}): string;
|
|
37
|
+
export declare function updateStory(prd: StructuredPRD, input: UpdateUserStoryInput, today: string): UpdateUserStoryOutput;
|
|
38
|
+
export declare function findAttachment(prd: StructuredPRD, attachmentId: string): Attachment;
|
|
39
|
+
/** Attachment ids must name attachments in the PRD. */
|
|
40
|
+
export declare function validateAttachmentIds(prd: StructuredPRD, ids: string[]): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Dependencies must name real stories, never the story itself, and never form
|
|
43
|
+
* a cycle — an unsatisfiable order is worse than no order at all.
|
|
44
|
+
*/
|
|
45
|
+
export declare function validateDependencies(prd: StructuredPRD, storyId: string, dependencies: string[]): string[];
|
|
46
|
+
export declare function deleteStory(prd: StructuredPRD, storyId: string, today: string): DeleteUserStoryOutput;
|
|
47
|
+
export declare function createPhase(prd: StructuredPRD, input: CreateCustomPhaseInput, today: string): CreateCustomPhaseOutput;
|
|
48
|
+
export declare function assignStoryToPhase(prd: StructuredPRD, input: AssignStoryToPhaseInput, today: string): AssignStoryToPhaseOutput;
|
|
49
|
+
/** Dependencies of `story` that are not completed yet. */
|
|
50
|
+
export declare function incompleteDependencies(prd: StructuredPRD, story: UserStory): string[];
|
|
51
|
+
/**
|
|
52
|
+
* A story cannot be worked on, reviewed or completed before the stories it
|
|
53
|
+
* depends on are completed. `not_started`, `research` and `blocked` stay
|
|
54
|
+
* available so a story can still be planned or parked.
|
|
55
|
+
*/
|
|
56
|
+
export declare function assertCanEnterStatus(prd: StructuredPRD, story: UserStory, status: StoryStatus): void;
|
|
57
|
+
/**
|
|
58
|
+
* The next story to start: not started, every dependency completed, ordered
|
|
59
|
+
* by phase, then priority, then position in the PRD.
|
|
60
|
+
*/
|
|
61
|
+
export declare function pickNextStory(prd: StructuredPRD): {
|
|
62
|
+
story: UserStory;
|
|
63
|
+
ready_count: number;
|
|
64
|
+
in_progress: string[];
|
|
65
|
+
waiting: {
|
|
66
|
+
id: string;
|
|
67
|
+
title: string;
|
|
68
|
+
waiting_on: string[];
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Everything an agent needs to work on one story without loading the whole
|
|
73
|
+
* PRD: the story, the scope boundaries, its dependencies with their hand-off
|
|
74
|
+
* logs, and the log of the most recently completed story.
|
|
75
|
+
*/
|
|
76
|
+
/** `filename` is the PRD's file name, used to give attachment paths. */
|
|
77
|
+
export declare function buildStoryContext(prd: StructuredPRD, storyId: string, filename: string): {
|
|
78
|
+
prd: {
|
|
79
|
+
title: string;
|
|
80
|
+
overview: string;
|
|
81
|
+
non_goals: string[];
|
|
82
|
+
out_of_scope: string[];
|
|
83
|
+
global_acceptance_criteria: string[];
|
|
84
|
+
attachments: {
|
|
85
|
+
title: string;
|
|
86
|
+
id: string;
|
|
87
|
+
path?: string | undefined;
|
|
88
|
+
url?: string | undefined;
|
|
89
|
+
note?: string | undefined;
|
|
90
|
+
}[];
|
|
91
|
+
};
|
|
92
|
+
story: UserStory;
|
|
93
|
+
attachments: {
|
|
94
|
+
title: string;
|
|
95
|
+
id: string;
|
|
96
|
+
path?: string | undefined;
|
|
97
|
+
url?: string | undefined;
|
|
98
|
+
note?: string | undefined;
|
|
99
|
+
}[];
|
|
100
|
+
phase: {
|
|
101
|
+
id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
} | null;
|
|
104
|
+
edge_cases: EdgeCase[];
|
|
105
|
+
open_questions: OpenQuestion[];
|
|
106
|
+
security: {
|
|
107
|
+
permissions: string[];
|
|
108
|
+
compliance: string[];
|
|
109
|
+
considerations: string[];
|
|
110
|
+
story_notes: string[];
|
|
111
|
+
};
|
|
112
|
+
not_applicable: Record<string, string>;
|
|
113
|
+
design: {
|
|
114
|
+
guidance: string[];
|
|
115
|
+
story_notes: string[];
|
|
116
|
+
decisions: {
|
|
117
|
+
id: string;
|
|
118
|
+
decision: string;
|
|
119
|
+
rationale: string;
|
|
120
|
+
}[];
|
|
121
|
+
};
|
|
122
|
+
dependencies: {
|
|
123
|
+
id: string;
|
|
124
|
+
title: string | null;
|
|
125
|
+
status: StoryStatus | null;
|
|
126
|
+
log: StoryLogEntry[];
|
|
127
|
+
}[];
|
|
128
|
+
previous_story: {
|
|
129
|
+
id: string;
|
|
130
|
+
title: string;
|
|
131
|
+
log: StoryLogEntry[];
|
|
132
|
+
} | null;
|
|
133
|
+
};
|
|
134
|
+
export declare function appendStoryLog(prd: StructuredPRD, storyId: string, entry: StoryLogEntry): {
|
|
135
|
+
story_id: string;
|
|
136
|
+
entries: number;
|
|
137
|
+
};
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/attachment-paths.d.ts
|
|
140
|
+
/**
|
|
141
|
+
* The folder for a PRD's files, relative to `.prds`: the PRD file name
|
|
142
|
+
* without `.json`, so `notes.json` keeps its files in `.prds/notes/`.
|
|
143
|
+
*/
|
|
144
|
+
export declare function attachmentsFolder(filename: string): string;
|
|
145
|
+
/** An attachment's file relative to the project root, e.g. `.prds/notes/a.png`. */
|
|
146
|
+
export declare function attachmentProjectPath(filename: string, path: string): string;
|
|
147
|
+
/** Attachments as an agent needs them: file paths from the project root. */
|
|
148
|
+
export declare function resolveAttachments(filename: string, attachments: Attachment[]): StoryAttachment[];
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/applicability.d.ts
|
|
151
|
+
/**
|
|
152
|
+
* Parts of a PRD that can be marked "not applicable" (e.g. no rollout plan
|
|
153
|
+
* for an internal tool), so the plan check stops asking for them and agents
|
|
154
|
+
* do not invent them. The core (overview, problem, solution, scope, stories)
|
|
155
|
+
* always applies.
|
|
156
|
+
*/
|
|
157
|
+
export declare const NOT_APPLICABLE_TOPICS: readonly ["dataModel", "outsideServices", "security", "design", "qualityBar", "edgeCases", "rollout", "measurement", "glossary", "risks"];
|
|
158
|
+
export declare function isNotApplicable(prd: StructuredPRD, topic: NotApplicableTopic): boolean;
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/markdown.d.ts
|
|
161
|
+
/**
|
|
162
|
+
* Pass the PRD file name to link attachment files relative to `.prds/`, where
|
|
163
|
+
* the markdown export is written.
|
|
164
|
+
*/
|
|
165
|
+
export declare function formatPrdMarkdown(prd: StructuredPRD, filename?: string): string;
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/templates.d.ts
|
|
168
|
+
/**
|
|
169
|
+
* Starting points for new PRDs. A template fills sections the author would
|
|
170
|
+
* otherwise start empty, and gives `shape_prd` extra questions that matter for
|
|
171
|
+
* that kind of work. Everything it adds can be edited or removed afterwards.
|
|
172
|
+
*/
|
|
173
|
+
interface PrdTemplate {
|
|
174
|
+
id: TemplateId;
|
|
175
|
+
name: string;
|
|
176
|
+
description: string;
|
|
177
|
+
/** Sentence an agent can use to pick the right template. */
|
|
178
|
+
whenToUse: string;
|
|
179
|
+
defaults: {
|
|
180
|
+
nonGoals?: string[];
|
|
181
|
+
outOfScope?: string[];
|
|
182
|
+
openQuestions?: string[];
|
|
183
|
+
globalAcceptanceCriteria?: string[];
|
|
184
|
+
qualityStandards?: string[];
|
|
185
|
+
technicalConstraints?: string[];
|
|
186
|
+
rolloutPhases?: string[];
|
|
187
|
+
rollbackConditions?: string[];
|
|
188
|
+
};
|
|
189
|
+
/** Extra questions for the shaping interview. */
|
|
190
|
+
interviewFocus: string[];
|
|
191
|
+
}
|
|
192
|
+
export declare const TEMPLATE_IDS: readonly ["saas-feature", "internal-tool", "integration", "mvp"];
|
|
193
|
+
type TemplateId = (typeof TEMPLATE_IDS)[number];
|
|
194
|
+
export declare const PRD_TEMPLATES: readonly PrdTemplate[];
|
|
195
|
+
export declare function getTemplate(id: TemplateId): PrdTemplate;
|
|
196
|
+
//#endregion
|
|
197
|
+
//#region src/prompts.d.ts
|
|
198
|
+
/**
|
|
199
|
+
* The instructions behind the MCP prompts, exported so other tools (e.g. a
|
|
200
|
+
* UI that shows what to ask the agent) give exactly the same text.
|
|
201
|
+
*/
|
|
202
|
+
export declare function shapePrdPrompt(idea?: string, filename?: string, templateId?: TemplateId): string;
|
|
203
|
+
export declare function reviewStoryPrompt(filename: string, storyId: string, base?: string): string;
|
|
204
|
+
export declare function implementStoryPrompt(filename: string, storyId?: string): string;
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region src/plan-check.d.ts
|
|
207
|
+
/**
|
|
208
|
+
* What a plan is still missing, as items a UI can render as a checklist and an
|
|
209
|
+
* agent can act on. `required` items mean the plan is not ready to build;
|
|
210
|
+
* `recommended` items make it better but do not block.
|
|
211
|
+
*/
|
|
212
|
+
interface PlanCheckItem {
|
|
213
|
+
/** Stable key, e.g. `stories` or `vague-stories`. */
|
|
214
|
+
id: string;
|
|
215
|
+
/** The PRD section to change, matching `update_prd_section` where possible. */
|
|
216
|
+
section: string;
|
|
217
|
+
message: string;
|
|
218
|
+
severity: 'required' | 'recommended';
|
|
219
|
+
/** Stories the item is about, when it is about specific stories. */
|
|
220
|
+
storyIds?: string[];
|
|
221
|
+
}
|
|
222
|
+
export declare function checkPlan(prd: StructuredPRD): {
|
|
223
|
+
ready_to_build: boolean;
|
|
224
|
+
items: PlanCheckItem[];
|
|
225
|
+
};
|
|
226
|
+
//#endregion
|
|
227
|
+
export { AddAttachmentInput, AddAttachmentInputSchema, AddAttachmentOutput, AddAttachmentOutputSchema, AddDecisionInput, AddDecisionInputSchema, AddDecisionOutput, AddDecisionOutputSchema, AddGlossaryTermInput, AddGlossaryTermInputSchema, AddGlossaryTermOutput, AddGlossaryTermOutputSchema, AddStoryLogInput, AddStoryLogInputSchema, AddStoryLogOutput, AddStoryLogOutputSchema, AddUserStoryInput, AddUserStoryInputSchema, AddUserStoryOutput, AddUserStoryOutputSchema, type AgentTaskPacket, AssignStoryToPhaseInput, AssignStoryToPhaseInputSchema, AssignStoryToPhaseOutput, AssignStoryToPhaseOutputSchema, type Attachment, CheckPlanInputSchema, CheckPlanOutput, CheckPlanOutputSchema, CreateCustomPhaseInput, CreateCustomPhaseInputSchema, CreateCustomPhaseOutput, CreateCustomPhaseOutputSchema, CreatePrdInput, CreatePrdInputSchema, CreatePrdOutput, CreatePrdOutputSchema, type CrossDependency, type CustomPhase, CustomPhaseSchema, DecideEdgeCaseInput, DecideEdgeCaseInputSchema, DecideEdgeCaseOutput, DecideEdgeCaseOutputSchema, type DecisionLogEntry, DeletePhaseInput, DeletePhaseInputSchema, DeletePrdInput, DeletePrdInputSchema, DeletePrdOutput, DeletePrdOutputSchema, DeleteUserStoryInput, DeleteUserStoryInputSchema, DeleteUserStoryOutput, DeleteUserStoryOutputSchema, type EdgeCase, ExportPrdMarkdownInput, ExportPrdMarkdownInputSchema, ExportPrdMarkdownOutput, ExportPrdMarkdownOutputSchema, GetImplementationPromptsInputSchema, GetImplementationPromptsOutput, GetImplementationPromptsOutputSchema, GetImprovementSuggestionsInputSchema, GetImprovementSuggestionsOutput, GetImprovementSuggestionsOutputSchema, GetNextStoryInputSchema, GetNextStoryOutput, GetNextStoryOutputSchema, GetPrdInput, GetPrdInputSchema, GetPrdOutput, GetPrdOutputSchema, GetProjectStatusInputSchema, GetProjectStatusOutput, GetProjectStatusOutputSchema, GetStoryInput, GetStoryInputSchema, GetStoryOutput, GetStoryOutputSchema, type GlossaryTerm, ListPrdsInputSchema, ListPrdsOutput, ListPrdsOutputSchema, ListTemplatesInputSchema, ListTemplatesOutput, ListTemplatesOutputSchema, MarkNotApplicableInput, MarkNotApplicableInputSchema, MarkNotApplicableOutput, MarkNotApplicableOutputSchema, type NotApplicableTopic, NotApplicableTopicSchema, type OpenQuestion, PhasesOutput, PhasesOutputSchema, type PlanCheckItem, type PrdDeps, PrdRevisionConflictError, PrdSection, PrdSectionValueSchemas, PrdService, PrdSummary, PrdSummarySchema, type PrdTemplate, type PrdVerificationDiagnostic, type PrdVerificationResult, RemoveAttachmentInput, RemoveAttachmentInputSchema, RemoveAttachmentOutput, RemoveAttachmentOutputSchema, ReorderPhasesInput, ReorderPhasesInputSchema, ResolveOpenQuestionInput, ResolveOpenQuestionInputSchema, ResolveOpenQuestionOutput, ResolveOpenQuestionOutputSchema, type RiskItem, StoryAttachment, StoryAttachmentSchema, type StoryComplexity, StoryComplexitySchema, type StoryLogEntry, StoryLogEntrySchema, type StoryPriority, StoryPrioritySchema, type StoryStatus, StoryStatusSchema, type StoryTraceabilityMap, type StoryVerification, StoryVerificationSchema, type StructuredPRD, type TemplateId, UpdateAttachmentInput, UpdateAttachmentInputSchema, UpdateAttachmentOutput, UpdateAttachmentOutputSchema, UpdatePhaseInput, UpdatePhaseInputSchema, UpdatePrdSectionInput, UpdatePrdSectionInputSchema, UpdatePrdSectionOutput, UpdatePrdSectionOutputSchema, UpdateStoryStatusInput, UpdateStoryStatusInputSchema, UpdateStoryStatusOutput, UpdateStoryStatusOutputSchema, UpdateUserStoryInput, UpdateUserStoryInputSchema, UpdateUserStoryOutput, UpdateUserStoryOutputSchema, type UserStory, createPrdService, normalizePrd };
|