@makerkit/prd 0.0.0 → 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/package.json +2 -21
- package/.turbo/turbo-build.log +0 -46
- package/.turbo/turbo-test.log +0 -21
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/README.md +0 -65
- package/dist/package.json +0 -49
- package/src/__tests__/agent-workflow.test.ts +0 -377
- package/src/__tests__/attachments.test.ts +0 -475
- package/src/__tests__/node.test.ts +0 -141
- package/src/__tests__/plan-check.test.ts +0 -229
- package/src/__tests__/planning.test.ts +0 -1059
- package/src/__tests__/prd-operations.test.ts +0 -423
- package/src/__tests__/prd.service.test.ts +0 -477
- package/src/__tests__/prd.tool.test.ts +0 -282
- package/src/__tests__/templates.test.ts +0 -141
- package/src/applicability.ts +0 -73
- package/src/attachment-paths.ts +0 -78
- package/src/attachments.ts +0 -160
- package/src/edge-cases.ts +0 -52
- package/src/index.ts +0 -35
- package/src/markdown.ts +0 -268
- package/src/mcp/index.ts +0 -839
- package/src/mcp/tool-response.ts +0 -85
- package/src/node.ts +0 -146
- package/src/open-questions.ts +0 -93
- package/src/plan-check.ts +0 -282
- package/src/planning-operations.ts +0 -429
- package/src/prd-operations.ts +0 -690
- package/src/prd.service.ts +0 -1051
- package/src/prompts.ts +0 -110
- package/src/safe-file-name.ts +0 -42
- package/src/schema.ts +0 -976
- package/src/templates.ts +0 -173
- package/src/testing/fake-mcp-server.ts +0 -81
- package/src/types.ts +0 -333
- package/tsconfig.json +0 -23
- package/tsconfig.lib.json +0 -8
- package/tsconfig.spec.json +0 -7
- package/tsdown.config.mts +0 -11
- package/vitest.config.mts +0 -8
- /package/{dist/LICENSE → LICENSE} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/index.mjs → index.mjs} +0 -0
- /package/{dist/mcp.d.ts → mcp.d.ts} +0 -0
- /package/{dist/mcp.js → mcp.js} +0 -0
- /package/{dist/mcp.mjs → mcp.mjs} +0 -0
- /package/{dist/node.d.ts → node.d.ts} +0 -0
- /package/{dist/node.js → node.js} +0 -0
- /package/{dist/node.mjs → node.mjs} +0 -0
- /package/{dist/prd.service-DSBp8sMl.d.ts → prd.service-DSBp8sMl.d.ts} +0 -0
- /package/{dist/prompts-Bber0S1Z.mjs → prompts-Bber0S1Z.mjs} +0 -0
- /package/{dist/prompts-CIX8IeAx.js → prompts-CIX8IeAx.js} +0 -0
|
@@ -1,477 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
type PrdDeps,
|
|
5
|
-
type PrdVerificationResult,
|
|
6
|
-
createPrdService,
|
|
7
|
-
} from '../prd.service';
|
|
8
|
-
import { implementStoryPrompt } from '../prompts';
|
|
9
|
-
|
|
10
|
-
const normalize = (path: string) => path.replace(/\\/g, '/');
|
|
11
|
-
|
|
12
|
-
const PASSING: PrdVerificationResult = {
|
|
13
|
-
passed: true,
|
|
14
|
-
checks: ['typecheck', 'lint'],
|
|
15
|
-
errors: 0,
|
|
16
|
-
warnings: 0,
|
|
17
|
-
diagnostics: [],
|
|
18
|
-
messages: [],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const FAILING: PrdVerificationResult = {
|
|
22
|
-
passed: false,
|
|
23
|
-
checks: ['typecheck', 'lint'],
|
|
24
|
-
errors: 2,
|
|
25
|
-
warnings: 1,
|
|
26
|
-
diagnostics: [
|
|
27
|
-
{
|
|
28
|
-
file: 'apps/web/app/page.tsx',
|
|
29
|
-
line: 12,
|
|
30
|
-
message: 'TS2322 boom',
|
|
31
|
-
severity: 'error',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
file: 'packages/ui/x.ts',
|
|
35
|
-
line: null,
|
|
36
|
-
message: 'unused',
|
|
37
|
-
severity: 'warning',
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
messages: [],
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
function createHarness(
|
|
44
|
-
overrides: Partial<PrdDeps> = {},
|
|
45
|
-
initialFiles: Record<string, string> = {},
|
|
46
|
-
) {
|
|
47
|
-
const files: Record<string, string> = { ...initialFiles };
|
|
48
|
-
const dirs = new Set<string>();
|
|
49
|
-
|
|
50
|
-
const deps: PrdDeps = {
|
|
51
|
-
rootPath: '/repo',
|
|
52
|
-
async readdir() {
|
|
53
|
-
return Object.keys(files);
|
|
54
|
-
},
|
|
55
|
-
async readFile(path) {
|
|
56
|
-
const content = files[basename(path)];
|
|
57
|
-
if (content === undefined) throw new Error('ENOENT');
|
|
58
|
-
return content;
|
|
59
|
-
},
|
|
60
|
-
async writeFile(path, content) {
|
|
61
|
-
files[basename(path)] = content;
|
|
62
|
-
},
|
|
63
|
-
async mkdir(path) {
|
|
64
|
-
dirs.add(normalize(path));
|
|
65
|
-
},
|
|
66
|
-
async unlink(path) {
|
|
67
|
-
if (!(basename(path) in files)) {
|
|
68
|
-
throw Object.assign(new Error('ENOENT'), { code: 'ENOENT' });
|
|
69
|
-
}
|
|
70
|
-
delete files[basename(path)];
|
|
71
|
-
},
|
|
72
|
-
async fileExists(path) {
|
|
73
|
-
return basename(path) in files;
|
|
74
|
-
},
|
|
75
|
-
now: () => new Date('2026-09-06T10:00:00Z'),
|
|
76
|
-
verifyCompletion: async () => PASSING,
|
|
77
|
-
...overrides,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return { service: createPrdService(deps), files, dirs };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function basename(path: string) {
|
|
84
|
-
return normalize(path).split('/').pop() ?? '';
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const BASE_INPUT = {
|
|
88
|
-
title: 'Notes Feature',
|
|
89
|
-
overview: 'Users keep notes',
|
|
90
|
-
problemStatement: 'No notes',
|
|
91
|
-
marketOpportunity: 'Everyone wants notes',
|
|
92
|
-
targetUsers: ['makers'],
|
|
93
|
-
solutionDescription: 'Add notes',
|
|
94
|
-
keyFeatures: ['create', 'list'],
|
|
95
|
-
successMetrics: ['10 notes/day'],
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
describe('PrdService.create / list / get / delete', () => {
|
|
99
|
-
it('creates a PRD file named after the title and lists it', async () => {
|
|
100
|
-
const { service, files, dirs } = createHarness();
|
|
101
|
-
|
|
102
|
-
const created = await service.create(BASE_INPUT);
|
|
103
|
-
|
|
104
|
-
expect(created.filename).toBe('notes-feature.json');
|
|
105
|
-
expect(normalize(created.path)).toBe('/repo/.prds/notes-feature.json');
|
|
106
|
-
expect(dirs.has('/repo/.prds')).toBe(true);
|
|
107
|
-
expect(JSON.parse(files['notes-feature.json']!).metadata.created).toBe(
|
|
108
|
-
'2026-09-06',
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const list = await service.list();
|
|
112
|
-
expect(list.total).toBe(1);
|
|
113
|
-
expect(list.warnings).toEqual([]);
|
|
114
|
-
expect(list.prds[0]).toMatchObject({
|
|
115
|
-
filename: 'notes-feature.json',
|
|
116
|
-
title: 'Notes Feature',
|
|
117
|
-
progress: 0,
|
|
118
|
-
total_stories: 0,
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('refuses to overwrite an existing PRD with the same slug', async () => {
|
|
123
|
-
const { service, files } = createHarness();
|
|
124
|
-
await service.create(BASE_INPUT);
|
|
125
|
-
files['notes-feature.json'] = JSON.stringify({
|
|
126
|
-
introduction: { title: 'Keep me' },
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
await expect(
|
|
130
|
-
service.create({ ...BASE_INPUT, title: 'notes feature!' }),
|
|
131
|
-
).rejects.toThrow(/already exists/);
|
|
132
|
-
|
|
133
|
-
expect(JSON.parse(files['notes-feature.json']!).introduction.title).toBe(
|
|
134
|
-
'Keep me',
|
|
135
|
-
);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it('reports malformed files as warnings when listing', async () => {
|
|
139
|
-
const { service } = createHarness({}, { 'broken.json': '{not json' });
|
|
140
|
-
|
|
141
|
-
const result = await service.list();
|
|
142
|
-
|
|
143
|
-
expect(result.total).toBe(0);
|
|
144
|
-
expect(result.warnings).toEqual([
|
|
145
|
-
'Skipped broken.json: PRD file "broken.json" is not valid JSON',
|
|
146
|
-
]);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('returns the normalised document from get', async () => {
|
|
150
|
-
const { service } = createHarness(
|
|
151
|
-
{},
|
|
152
|
-
{ 'old.json': '{"introduction":{"title":"Old"}}' },
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
const result = await service.get({ filename: 'old.json' });
|
|
156
|
-
|
|
157
|
-
expect(result.prd.introduction).toEqual({
|
|
158
|
-
title: 'Old',
|
|
159
|
-
overview: '',
|
|
160
|
-
lastUpdated: '2026-09-06',
|
|
161
|
-
});
|
|
162
|
-
expect(result.prd.customPhases).toEqual([]);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it.each(['../x.json', 'a/b.json', '.hidden.json'])(
|
|
166
|
-
'rejects unsafe filename %j on every entry point',
|
|
167
|
-
async (filename) => {
|
|
168
|
-
const { service } = createHarness();
|
|
169
|
-
|
|
170
|
-
await expect(service.get({ filename })).rejects.toThrow(
|
|
171
|
-
/Invalid PRD file name/,
|
|
172
|
-
);
|
|
173
|
-
await expect(service.delete({ filename })).rejects.toThrow(
|
|
174
|
-
/Invalid PRD file name/,
|
|
175
|
-
);
|
|
176
|
-
// load() is public and used by the dev tool with a URL segment.
|
|
177
|
-
await expect(service.load(filename)).rejects.toThrow(
|
|
178
|
-
/Invalid PRD file name/,
|
|
179
|
-
);
|
|
180
|
-
},
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
it('deletes a PRD, distinguishes missing files from other errors', async () => {
|
|
184
|
-
const { service, files } = createHarness({
|
|
185
|
-
async unlink(path) {
|
|
186
|
-
if (basename(path) === 'locked.json') {
|
|
187
|
-
throw Object.assign(new Error('EACCES'), { code: 'EACCES' });
|
|
188
|
-
}
|
|
189
|
-
if (!(basename(path) in files)) {
|
|
190
|
-
throw Object.assign(new Error('ENOENT'), { code: 'ENOENT' });
|
|
191
|
-
}
|
|
192
|
-
delete files[basename(path)];
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
await service.create(BASE_INPUT);
|
|
196
|
-
|
|
197
|
-
await service.delete({ filename: 'notes-feature.json' });
|
|
198
|
-
expect(files['notes-feature.json']).toBeUndefined();
|
|
199
|
-
|
|
200
|
-
await expect(
|
|
201
|
-
service.delete({ filename: 'notes-feature.json' }),
|
|
202
|
-
).rejects.toThrow(/not found/);
|
|
203
|
-
await expect(service.delete({ filename: 'locked.json' })).rejects.toThrow(
|
|
204
|
-
/EACCES/,
|
|
205
|
-
);
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
describe('PrdService stories', () => {
|
|
210
|
-
async function withStory(overrides: Partial<PrdDeps> = {}) {
|
|
211
|
-
const harness = createHarness(overrides);
|
|
212
|
-
await harness.service.create(BASE_INPUT);
|
|
213
|
-
|
|
214
|
-
const story = await harness.service.addUserStory({
|
|
215
|
-
filename: 'notes-feature.json',
|
|
216
|
-
userType: 'member',
|
|
217
|
-
action: 'create a note quickly',
|
|
218
|
-
benefit: 'I remember things',
|
|
219
|
-
acceptanceCriteria: ['form exists', 'note saved', 'list updates'],
|
|
220
|
-
priority: 'P1',
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
return { ...harness, story };
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
it('adds a story with derived id, title and complexity', async () => {
|
|
227
|
-
const { story, files } = await withStory();
|
|
228
|
-
|
|
229
|
-
expect(story).toEqual({
|
|
230
|
-
story_id: 'US001',
|
|
231
|
-
title: 'Create A Note Quickly',
|
|
232
|
-
complexity: 'S',
|
|
233
|
-
total_stories: 1,
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
const prd = JSON.parse(files['notes-feature.json']!);
|
|
237
|
-
expect(prd.userStories[0].userStory).toBe(
|
|
238
|
-
'As a member, I want to create a note quickly so that I remember things',
|
|
239
|
-
);
|
|
240
|
-
expect(prd.progress.total).toBe(1);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it('moves a story to in_progress without running checks', async () => {
|
|
244
|
-
let calls = 0;
|
|
245
|
-
const { service } = await withStory({
|
|
246
|
-
verifyCompletion: async () => {
|
|
247
|
-
calls += 1;
|
|
248
|
-
return PASSING;
|
|
249
|
-
},
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
const result = await service.updateStoryStatus({
|
|
253
|
-
filename: 'notes-feature.json',
|
|
254
|
-
storyId: 'US001',
|
|
255
|
-
status: 'in_progress',
|
|
256
|
-
notes: 'started',
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
expect(calls).toBe(0);
|
|
260
|
-
expect(result).toEqual({
|
|
261
|
-
story_id: 'US001',
|
|
262
|
-
title: 'Create A Note Quickly',
|
|
263
|
-
status: 'in_progress',
|
|
264
|
-
progress: 0,
|
|
265
|
-
verification: null,
|
|
266
|
-
});
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
it('refuses to complete a story when verification fails', async () => {
|
|
270
|
-
const { service, files } = await withStory({
|
|
271
|
-
verifyCompletion: async () => FAILING,
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
await expect(
|
|
275
|
-
service.updateStoryStatus({
|
|
276
|
-
filename: 'notes-feature.json',
|
|
277
|
-
storyId: 'US001',
|
|
278
|
-
status: 'completed',
|
|
279
|
-
}),
|
|
280
|
-
).rejects.toThrow(
|
|
281
|
-
/Cannot mark US001 as completed: verification failed \(2 errors, 1 warnings across typecheck, lint\)\. First diagnostics: apps\/web\/app\/page\.tsx:12 TS2322 boom/,
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
const prd = JSON.parse(files['notes-feature.json']!);
|
|
285
|
-
expect(prd.userStories[0].status).toBe('not_started');
|
|
286
|
-
expect(prd.progress.completed).toBe(0);
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
it('surfaces infrastructure failures that produced no diagnostics', async () => {
|
|
290
|
-
const { service } = await withStory({
|
|
291
|
-
verifyCompletion: async () => ({
|
|
292
|
-
...FAILING,
|
|
293
|
-
errors: 0,
|
|
294
|
-
warnings: 0,
|
|
295
|
-
diagnostics: [],
|
|
296
|
-
messages: ['typecheck: fail (spawn pnpm ENOENT)'],
|
|
297
|
-
}),
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
await expect(
|
|
301
|
-
service.updateStoryStatus({
|
|
302
|
-
filename: 'notes-feature.json',
|
|
303
|
-
storyId: 'US001',
|
|
304
|
-
status: 'completed',
|
|
305
|
-
}),
|
|
306
|
-
).rejects.toThrow(/typecheck: fail \(spawn pnpm ENOENT\)/);
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
it('completes a story and records verification when checks pass', async () => {
|
|
310
|
-
const { service, files } = await withStory();
|
|
311
|
-
|
|
312
|
-
const result = await service.updateStoryStatus({
|
|
313
|
-
filename: 'notes-feature.json',
|
|
314
|
-
storyId: 'US001',
|
|
315
|
-
status: 'completed',
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
expect(result.status).toBe('completed');
|
|
319
|
-
expect(result.progress).toBe(100);
|
|
320
|
-
expect(result.verification).toEqual({
|
|
321
|
-
verified_at: '2026-09-06T10:00:00.000Z',
|
|
322
|
-
checks: ['typecheck', 'lint'],
|
|
323
|
-
passed: true,
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
const prd = JSON.parse(files['notes-feature.json']!);
|
|
327
|
-
expect(prd.userStories[0].completedAt).toBe('2026-09-06');
|
|
328
|
-
expect(prd.userStories[0].verification.passed).toBe(true);
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it('does not overwrite stories added while verification was running', async () => {
|
|
332
|
-
let harness: ReturnType<typeof createHarness> | undefined;
|
|
333
|
-
|
|
334
|
-
const deps: Partial<PrdDeps> = {
|
|
335
|
-
async verifyCompletion() {
|
|
336
|
-
// Simulate a concurrent add_user_story landing mid-verification.
|
|
337
|
-
await harness!.service.addUserStory({
|
|
338
|
-
filename: 'notes-feature.json',
|
|
339
|
-
userType: 'admin',
|
|
340
|
-
action: 'archive notes',
|
|
341
|
-
benefit: 'tidy',
|
|
342
|
-
acceptanceCriteria: ['works'],
|
|
343
|
-
priority: 'P3',
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
return PASSING;
|
|
347
|
-
},
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
harness = createHarness(deps);
|
|
351
|
-
await harness.service.create(BASE_INPUT);
|
|
352
|
-
await harness.service.addUserStory({
|
|
353
|
-
filename: 'notes-feature.json',
|
|
354
|
-
userType: 'member',
|
|
355
|
-
action: 'create a note',
|
|
356
|
-
benefit: 'memory',
|
|
357
|
-
acceptanceCriteria: ['a', 'b'],
|
|
358
|
-
priority: 'P1',
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
const result = await harness.service.updateStoryStatus({
|
|
362
|
-
filename: 'notes-feature.json',
|
|
363
|
-
storyId: 'US001',
|
|
364
|
-
status: 'completed',
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
const prd = JSON.parse(harness.files['notes-feature.json']!);
|
|
368
|
-
expect(prd.userStories).toHaveLength(2);
|
|
369
|
-
expect(prd.userStories[0].status).toBe('completed');
|
|
370
|
-
expect(prd.userStories[1].title).toBe('Archive Notes');
|
|
371
|
-
expect(result.progress).toBe(50);
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it('clears verification when a completed story is reopened', async () => {
|
|
375
|
-
const { service, files } = await withStory();
|
|
376
|
-
|
|
377
|
-
await service.updateStoryStatus({
|
|
378
|
-
filename: 'notes-feature.json',
|
|
379
|
-
storyId: 'US001',
|
|
380
|
-
status: 'completed',
|
|
381
|
-
});
|
|
382
|
-
await service.updateStoryStatus({
|
|
383
|
-
filename: 'notes-feature.json',
|
|
384
|
-
storyId: 'US001',
|
|
385
|
-
status: 'review',
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
const prd = JSON.parse(files['notes-feature.json']!);
|
|
389
|
-
expect(prd.userStories[0].verification).toBeUndefined();
|
|
390
|
-
expect(prd.userStories[0].completedAt).toBeUndefined();
|
|
391
|
-
expect(prd.progress.completed).toBe(0);
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
it('throws for unknown stories before running checks', async () => {
|
|
395
|
-
let calls = 0;
|
|
396
|
-
const { service } = await withStory({
|
|
397
|
-
verifyCompletion: async () => {
|
|
398
|
-
calls += 1;
|
|
399
|
-
return PASSING;
|
|
400
|
-
},
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
await expect(
|
|
404
|
-
service.updateStoryStatus({
|
|
405
|
-
filename: 'notes-feature.json',
|
|
406
|
-
storyId: 'US999',
|
|
407
|
-
status: 'completed',
|
|
408
|
-
}),
|
|
409
|
-
).rejects.toThrow(/Story US999 not found/);
|
|
410
|
-
expect(calls).toBe(0);
|
|
411
|
-
});
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
describe('PrdService reports', () => {
|
|
415
|
-
it('exports markdown next to the JSON file', async () => {
|
|
416
|
-
const { service, files } = createHarness();
|
|
417
|
-
await service.create(BASE_INPUT);
|
|
418
|
-
|
|
419
|
-
const result = await service.exportMarkdown({
|
|
420
|
-
filename: 'notes-feature.json',
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
expect(result.markdown_file).toBe('notes-feature.md');
|
|
424
|
-
expect(files['notes-feature.md']).toContain('# Notes Feature');
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
it('produces prompts, suggestions and status', async () => {
|
|
428
|
-
const { service } = createHarness();
|
|
429
|
-
await service.create(BASE_INPUT);
|
|
430
|
-
|
|
431
|
-
expect(
|
|
432
|
-
(await service.getImplementationPrompts('notes-feature.json')).total,
|
|
433
|
-
).toBe(0);
|
|
434
|
-
|
|
435
|
-
await service.addUserStory({
|
|
436
|
-
filename: 'notes-feature.json',
|
|
437
|
-
userType: 'member',
|
|
438
|
-
action: 'do x',
|
|
439
|
-
benefit: 'y',
|
|
440
|
-
acceptanceCriteria: ['one'],
|
|
441
|
-
priority: 'P2',
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
const prompts =
|
|
445
|
-
await service.getImplementationPrompts('notes-feature.json');
|
|
446
|
-
expect(prompts.total).toBe(1);
|
|
447
|
-
expect(prompts.prompts[0]).toBe(
|
|
448
|
-
implementStoryPrompt('notes-feature.json', 'US001'),
|
|
449
|
-
);
|
|
450
|
-
expect(prompts.prompts[0]).not.toMatch(/Mark the story completed/);
|
|
451
|
-
|
|
452
|
-
const suggestions =
|
|
453
|
-
await service.getImprovementSuggestions('notes-feature.json');
|
|
454
|
-
expect(suggestions.suggestions).toContain(
|
|
455
|
-
'1 stories need more detailed acceptance criteria',
|
|
456
|
-
);
|
|
457
|
-
|
|
458
|
-
const status = await service.getProjectStatus('notes-feature.json');
|
|
459
|
-
expect(status.next_steps).toEqual(['Start: Do X']);
|
|
460
|
-
expect(status.blockers).toEqual([]);
|
|
461
|
-
|
|
462
|
-
// A story waiting on an unfinished dependency gets no prompt yet.
|
|
463
|
-
await service.addUserStory({
|
|
464
|
-
filename: 'notes-feature.json',
|
|
465
|
-
userType: 'member',
|
|
466
|
-
action: 'do z',
|
|
467
|
-
benefit: 'y',
|
|
468
|
-
acceptanceCriteria: ['one'],
|
|
469
|
-
priority: 'P2',
|
|
470
|
-
dependencies: ['US001'],
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
expect(
|
|
474
|
-
(await service.getImplementationPrompts('notes-feature.json')).total,
|
|
475
|
-
).toBe(1);
|
|
476
|
-
});
|
|
477
|
-
});
|