@codemcp/workflows 4.10.1 → 4.10.3
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 +1 -1
- package/dist/components/beads/beads-instruction-generator.d.ts +4 -8
- package/dist/components/beads/beads-instruction-generator.d.ts.map +1 -1
- package/dist/components/beads/beads-instruction-generator.js +28 -51
- package/dist/components/beads/beads-instruction-generator.js.map +1 -1
- package/dist/components/beads/beads-task-backend-client.d.ts.map +1 -1
- package/dist/components/beads/beads-task-backend-client.js +1 -4
- package/dist/components/beads/beads-task-backend-client.js.map +1 -1
- package/dist/plugin-system/beads-plugin.d.ts +70 -0
- package/dist/plugin-system/beads-plugin.d.ts.map +1 -0
- package/dist/plugin-system/beads-plugin.js +459 -0
- package/dist/plugin-system/beads-plugin.js.map +1 -0
- package/dist/plugin-system/index.d.ts +9 -0
- package/dist/plugin-system/index.d.ts.map +1 -0
- package/dist/plugin-system/index.js +9 -0
- package/dist/plugin-system/index.js.map +1 -0
- package/dist/plugin-system/plugin-interfaces.d.ts +99 -0
- package/dist/plugin-system/plugin-interfaces.d.ts.map +1 -0
- package/dist/plugin-system/plugin-interfaces.js +9 -0
- package/dist/plugin-system/plugin-interfaces.js.map +1 -0
- package/dist/plugin-system/plugin-registry.d.ts +44 -0
- package/dist/plugin-system/plugin-registry.d.ts.map +1 -0
- package/dist/plugin-system/plugin-registry.js +132 -0
- package/dist/plugin-system/plugin-registry.js.map +1 -0
- package/dist/server-config.d.ts.map +1 -1
- package/dist/server-config.js +28 -8
- package/dist/server-config.js.map +1 -1
- package/dist/tool-handlers/conduct-review.d.ts.map +1 -1
- package/dist/tool-handlers/conduct-review.js +1 -2
- package/dist/tool-handlers/conduct-review.js.map +1 -1
- package/dist/tool-handlers/get-tool-info.d.ts +0 -1
- package/dist/tool-handlers/get-tool-info.d.ts.map +1 -1
- package/dist/tool-handlers/get-tool-info.js +0 -1
- package/dist/tool-handlers/get-tool-info.js.map +1 -1
- package/dist/tool-handlers/proceed-to-phase.d.ts +0 -7
- package/dist/tool-handlers/proceed-to-phase.d.ts.map +1 -1
- package/dist/tool-handlers/proceed-to-phase.js +15 -95
- package/dist/tool-handlers/proceed-to-phase.js.map +1 -1
- package/dist/tool-handlers/resume-workflow.d.ts +0 -1
- package/dist/tool-handlers/resume-workflow.d.ts.map +1 -1
- package/dist/tool-handlers/resume-workflow.js +0 -1
- package/dist/tool-handlers/resume-workflow.js.map +1 -1
- package/dist/tool-handlers/start-development.d.ts +0 -16
- package/dist/tool-handlers/start-development.d.ts.map +1 -1
- package/dist/tool-handlers/start-development.js +29 -130
- package/dist/tool-handlers/start-development.js.map +1 -1
- package/dist/tool-handlers/whats-next.d.ts +0 -2
- package/dist/tool-handlers/whats-next.d.ts.map +1 -1
- package/dist/tool-handlers/whats-next.js +1 -2
- package/dist/tool-handlers/whats-next.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/beads/beads-instruction-generator.ts +32 -64
- package/src/components/beads/beads-task-backend-client.ts +1 -4
- package/src/plugin-system/beads-plugin.ts +641 -0
- package/src/plugin-system/index.ts +20 -0
- package/src/plugin-system/plugin-interfaces.ts +154 -0
- package/src/plugin-system/plugin-registry.ts +190 -0
- package/src/server-config.ts +30 -8
- package/src/tool-handlers/conduct-review.ts +1 -2
- package/src/tool-handlers/get-tool-info.ts +0 -2
- package/src/tool-handlers/proceed-to-phase.ts +19 -139
- package/src/tool-handlers/resume-workflow.ts +0 -2
- package/src/tool-handlers/start-development.ts +35 -213
- package/src/tool-handlers/whats-next.ts +1 -4
- package/src/types.ts +2 -0
- package/test/e2e/beads-plugin-integration.test.ts +1594 -0
- package/test/e2e/core-functionality.test.ts +3 -12
- package/test/e2e/mcp-contract.test.ts +0 -31
- package/test/e2e/plugin-system-integration.test.ts +1421 -0
- package/test/e2e/state-management.test.ts +1 -5
- package/test/e2e/workflow-integration.test.ts +2 -11
- package/test/unit/beads-instruction-generator.test.ts +235 -103
- package/test/unit/beads-phase-task-id-integration.test.ts +7 -29
- package/test/unit/beads-plugin-behavioral.test.ts +512 -0
- package/test/unit/beads-plugin.test.ts +94 -0
- package/test/unit/plugin-error-handling.test.ts +240 -0
- package/test/unit/proceed-to-phase-plugin-integration.test.ts +150 -0
- package/test/unit/resume-workflow.test.ts +0 -1
- package/test/unit/server-config-plugin-registry.test.ts +81 -0
- package/test/unit/server-tools.test.ts +0 -1
- package/test/unit/start-development-goal-extraction.test.ts +22 -16
- package/test/utils/test-helpers.ts +3 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/dist/components/server-components-factory.d.ts +0 -39
- package/dist/components/server-components-factory.d.ts.map +0 -1
- package/dist/components/server-components-factory.js +0 -62
- package/dist/components/server-components-factory.js.map +0 -1
- package/src/components/server-components-factory.ts +0 -86
- package/test/e2e/component-substitution.test.ts +0 -208
- package/test/unit/beads-integration-filename.test.ts +0 -93
- package/test/unit/server-components-factory.test.ts +0 -279
|
@@ -285,7 +285,7 @@ states:
|
|
|
285
285
|
const first = await client.callTool('whats_next', {
|
|
286
286
|
user_input: 'start project',
|
|
287
287
|
});
|
|
288
|
-
|
|
288
|
+
assertToolSuccess(first);
|
|
289
289
|
|
|
290
290
|
const proceedResult = await client.callTool('proceed_to_phase', {
|
|
291
291
|
target_phase: 'design',
|
|
@@ -296,9 +296,6 @@ states:
|
|
|
296
296
|
|
|
297
297
|
// Verify the proceed_to_phase result reflects the transition
|
|
298
298
|
expect(proceedResponse.phase).toBe('design');
|
|
299
|
-
expect(firstResponse.conversation_id).toBe(
|
|
300
|
-
proceedResponse.conversation_id
|
|
301
|
-
);
|
|
302
299
|
});
|
|
303
300
|
|
|
304
301
|
it('should maintain conversation state consistency', async () => {
|
|
@@ -310,7 +307,6 @@ states:
|
|
|
310
307
|
const stateResource = await client.readResource('state://current');
|
|
311
308
|
const stateData = JSON.parse(stateResource.contents[0].text);
|
|
312
309
|
|
|
313
|
-
expect(stateData.conversationId).toBe(response.conversation_id);
|
|
314
310
|
expect(stateData.currentPhase).toBe(response.phase);
|
|
315
311
|
});
|
|
316
312
|
|
|
@@ -111,7 +111,6 @@ describe('Workflow Integration', () => {
|
|
|
111
111
|
const stateResource = await client.readResource('state://current');
|
|
112
112
|
const stateData = JSON.parse(stateResource.contents[0].text);
|
|
113
113
|
expect(stateData.currentPhase).toBe('finalize');
|
|
114
|
-
expect(stateData.conversationId).toBe(reqResponse.conversation_id);
|
|
115
114
|
});
|
|
116
115
|
|
|
117
116
|
it('should handle iterative development with phase revisiting', async () => {
|
|
@@ -197,18 +196,14 @@ describe('Workflow Integration', () => {
|
|
|
197
196
|
user_input: 'project 1 feature',
|
|
198
197
|
context: 'first project',
|
|
199
198
|
});
|
|
200
|
-
|
|
201
|
-
const p1ConversationId = p1Response.conversation_id;
|
|
199
|
+
assertToolSuccess(project1);
|
|
202
200
|
|
|
203
201
|
// Continue with same project
|
|
204
202
|
const project1Continue = await client.callTool('whats_next', {
|
|
205
203
|
user_input: 'continue project 1',
|
|
206
204
|
context: 'same project context',
|
|
207
205
|
});
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
// Should maintain same conversation
|
|
211
|
-
expect(p1ContinueResponse.conversation_id).toBe(p1ConversationId);
|
|
206
|
+
assertToolSuccess(project1Continue);
|
|
212
207
|
});
|
|
213
208
|
|
|
214
209
|
it('should maintain separate plan files for different contexts', async () => {
|
|
@@ -276,7 +271,6 @@ describe('Workflow Integration', () => {
|
|
|
276
271
|
const response = assertToolSuccess(result);
|
|
277
272
|
expect(response.phase).toBeTruthy();
|
|
278
273
|
expect(response.instructions).toBeTruthy();
|
|
279
|
-
expect(response.conversation_id).toBeTruthy();
|
|
280
274
|
});
|
|
281
275
|
|
|
282
276
|
it('should handle rapid development iterations', async () => {
|
|
@@ -306,7 +300,6 @@ describe('Workflow Integration', () => {
|
|
|
306
300
|
});
|
|
307
301
|
const impl2Response = assertToolSuccess(impl2);
|
|
308
302
|
expect(impl2Response.phase).toBe('implementation');
|
|
309
|
-
expect(impl2Response.conversation_id).toBeTruthy();
|
|
310
303
|
});
|
|
311
304
|
});
|
|
312
305
|
|
|
@@ -348,7 +341,6 @@ describe('Workflow Integration', () => {
|
|
|
348
341
|
|
|
349
342
|
// Even if there are file system issues, basic functionality should work
|
|
350
343
|
expect(response.phase).toBeTruthy();
|
|
351
|
-
expect(response.conversation_id).toBeTruthy();
|
|
352
344
|
});
|
|
353
345
|
|
|
354
346
|
it('should maintain functionality under stress', async () => {
|
|
@@ -366,7 +358,6 @@ describe('Workflow Integration', () => {
|
|
|
366
358
|
for (const result of results) {
|
|
367
359
|
const response = assertToolSuccess(result);
|
|
368
360
|
expect(response.phase).toBeTruthy();
|
|
369
|
-
expect(response.conversation_id).toBeTruthy();
|
|
370
361
|
}
|
|
371
362
|
|
|
372
363
|
// Final state should be consistent
|
|
@@ -36,28 +36,45 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
36
36
|
transitionReason: 'test transition',
|
|
37
37
|
isModeled: false,
|
|
38
38
|
planFileExists: true,
|
|
39
|
+
instructionSource: 'whats_next', // Default to whats_next for tests expecting BD guidance
|
|
39
40
|
};
|
|
40
41
|
});
|
|
41
42
|
|
|
42
43
|
describe('Beads-Specific Content Must Be Present', () => {
|
|
43
|
-
it('should generate complete beads task management header structure', async () => {
|
|
44
|
+
it('should generate complete beads task management header structure for whats_next', async () => {
|
|
44
45
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
45
46
|
'Work on design tasks.',
|
|
46
|
-
mockInstructionContext
|
|
47
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' }
|
|
47
48
|
);
|
|
48
49
|
|
|
49
|
-
// Verify
|
|
50
|
-
expect(result.instructions).toContain('
|
|
50
|
+
// Verify beads-specific elements are present for whats_next
|
|
51
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
51
52
|
expect(result.instructions).toContain('Use bd CLI tool exclusively');
|
|
52
53
|
});
|
|
53
54
|
|
|
54
|
-
it('should
|
|
55
|
+
it('should not generate BD CLI guidance for proceed_to_phase', async () => {
|
|
56
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
57
|
+
'Work on design tasks.',
|
|
58
|
+
{ ...mockInstructionContext, instructionSource: 'proceed_to_phase' }
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// Verify BD CLI guidance is NOT present for proceed_to_phase (your optimization!)
|
|
62
|
+
expect(result.instructions).not.toContain('bd:');
|
|
63
|
+
expect(result.instructions).not.toContain('bd Task Management:');
|
|
64
|
+
expect(result.instructions).not.toContain('bd list --parent');
|
|
65
|
+
// But should still contain basic beads reminders
|
|
66
|
+
expect(result.instructions).toContain(
|
|
67
|
+
'Use ONLY bd CLI tool for task management'
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should contain core beads CLI commands with proper formatting for whats_next', async () => {
|
|
55
72
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
56
73
|
'Work on tasks.',
|
|
57
|
-
mockInstructionContext
|
|
74
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' }
|
|
58
75
|
);
|
|
59
76
|
|
|
60
|
-
// Verify specific beads CLI commands are present
|
|
77
|
+
// Verify specific beads CLI commands are present for whats_next
|
|
61
78
|
expect(result.instructions).toContain(
|
|
62
79
|
'bd list --parent <phase-task-id> --status open'
|
|
63
80
|
);
|
|
@@ -73,7 +90,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
73
90
|
it('should contain beads-specific task management prohibition', async () => {
|
|
74
91
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
75
92
|
'Work on tasks.',
|
|
76
|
-
mockInstructionContext
|
|
93
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' }
|
|
77
94
|
);
|
|
78
95
|
|
|
79
96
|
// Verify beads-specific prohibition
|
|
@@ -82,6 +99,34 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
82
99
|
);
|
|
83
100
|
});
|
|
84
101
|
|
|
102
|
+
it('should contain beads-specific reminders section', async () => {
|
|
103
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
104
|
+
'Work on tasks.',
|
|
105
|
+
mockInstructionContext // Works for any instructionSource
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// Verify beads-specific reminders (always present)
|
|
109
|
+
expect(result.instructions).toContain(
|
|
110
|
+
'Use ONLY bd CLI tool for task management - do not use your own task management tools'
|
|
111
|
+
);
|
|
112
|
+
expect(result.instructions).toContain(
|
|
113
|
+
'Call whats_next() after the next user message to maintain the development workflow'
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should contain beads plan file guidance', async () => {
|
|
118
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
119
|
+
'Work on tasks.',
|
|
120
|
+
mockInstructionContext // Works for any instructionSource
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
// Verify beads plan file guidance (always present)
|
|
124
|
+
expect(result.instructions).toContain('Plan File Guidance:');
|
|
125
|
+
expect(result.instructions).toContain(
|
|
126
|
+
'Do NOT enter tasks in the plan file, use beads CLI exclusively'
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
85
130
|
it('should contain beads-specific reminders section', async () => {
|
|
86
131
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
87
132
|
'Work on tasks.',
|
|
@@ -109,16 +154,47 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
109
154
|
);
|
|
110
155
|
});
|
|
111
156
|
|
|
112
|
-
it('should use proper beads terminology and structure', async () => {
|
|
157
|
+
it('should use proper beads terminology and structure for whats_next', async () => {
|
|
113
158
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
114
159
|
'Work on tasks.',
|
|
115
|
-
mockInstructionContext
|
|
160
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' as const }
|
|
116
161
|
);
|
|
117
162
|
|
|
118
|
-
// Verify beads terminology
|
|
163
|
+
// Verify beads terminology (only present in whats_next detailed guidance)
|
|
119
164
|
expect(result.instructions).toContain('ready tasks');
|
|
120
165
|
expect(result.instructions).toContain('phase-task-id');
|
|
121
|
-
|
|
166
|
+
// Removed 'Current Phase' expectation - no longer part of minimal output
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('should not contain beads CLI terminology for proceed_to_phase', async () => {
|
|
170
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
171
|
+
'Work on tasks.',
|
|
172
|
+
{
|
|
173
|
+
...mockInstructionContext,
|
|
174
|
+
instructionSource: 'proceed_to_phase' as const,
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
// Verify beads CLI terminology is NOT present for proceed_to_phase (your optimization!)
|
|
179
|
+
expect(result.instructions).not.toContain('ready tasks');
|
|
180
|
+
expect(result.instructions).not.toContain('phase-task-id');
|
|
181
|
+
expect(result.instructions).not.toContain('Current Phase'); // Removed from minimal output
|
|
182
|
+
// But should still contain basic beads reminders
|
|
183
|
+
expect(result.instructions).toContain(
|
|
184
|
+
'Use ONLY bd CLI tool for task management'
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it('should not contain beads CLI terminology for proceed_to_phase', async () => {
|
|
189
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
190
|
+
'Work on tasks.',
|
|
191
|
+
{ ...mockInstructionContext, instructionSource: 'proceed_to_phase' }
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
// Verify beads CLI terminology is NOT present for proceed_to_phase
|
|
195
|
+
expect(result.instructions).not.toContain('ready tasks');
|
|
196
|
+
expect(result.instructions).not.toContain('phase-task-id');
|
|
197
|
+
// Removed 'Current Phase:' expectation - no longer part of minimal output for proceed_to_phase
|
|
122
198
|
});
|
|
123
199
|
});
|
|
124
200
|
|
|
@@ -203,28 +279,58 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
203
279
|
const phases = ['explore', 'plan', 'code', 'commit'];
|
|
204
280
|
|
|
205
281
|
for (const phase of phases) {
|
|
206
|
-
const context = {
|
|
282
|
+
const context = {
|
|
283
|
+
...mockInstructionContext,
|
|
284
|
+
phase,
|
|
285
|
+
instructionSource: 'whats_next' as const,
|
|
286
|
+
};
|
|
207
287
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
208
288
|
`${phase} instructions`,
|
|
209
289
|
context
|
|
210
290
|
);
|
|
211
291
|
|
|
212
|
-
// All phases should have consistent beads structure
|
|
292
|
+
// All phases should have consistent beads structure when instructionSource is whats_next
|
|
213
293
|
expect(
|
|
214
294
|
result.instructions,
|
|
215
|
-
`Phase ${phase} should have
|
|
216
|
-
).toContain('
|
|
295
|
+
`Phase ${phase} should have bd Task Management header for whats_next`
|
|
296
|
+
).toContain('bd Task Management:');
|
|
217
297
|
expect(
|
|
218
298
|
result.instructions,
|
|
219
|
-
`Phase ${phase} should have beads CLI commands`
|
|
299
|
+
`Phase ${phase} should have beads CLI commands for whats_next`
|
|
220
300
|
).toContain('bd list --parent');
|
|
221
301
|
expect(
|
|
222
302
|
result.instructions,
|
|
223
303
|
`Phase ${phase} should not have markdown content`
|
|
224
304
|
).not.toContain('Mark completed tasks with [x]');
|
|
225
305
|
|
|
226
|
-
// Should
|
|
227
|
-
expect(result.instructions).toContain(
|
|
306
|
+
// Should contain the phase name somewhere (either in instructions or section headers)
|
|
307
|
+
expect(result.instructions).toContain(phase); // Phase name should appear somewhere
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Test that non-whats_next instruction sources don't get BD CLI guidance
|
|
311
|
+
for (const phase of phases) {
|
|
312
|
+
const context = {
|
|
313
|
+
...mockInstructionContext,
|
|
314
|
+
phase,
|
|
315
|
+
instructionSource: 'proceed_to_phase' as const,
|
|
316
|
+
};
|
|
317
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
318
|
+
`${phase} instructions`,
|
|
319
|
+
context
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
// Should NOT have BD CLI guidance for proceed_to_phase
|
|
323
|
+
expect(
|
|
324
|
+
result.instructions,
|
|
325
|
+
`Phase ${phase} should NOT have bd guidance for proceed_to_phase`
|
|
326
|
+
).not.toContain('bd Task Management:');
|
|
327
|
+
expect(
|
|
328
|
+
result.instructions,
|
|
329
|
+
`Phase ${phase} should NOT have beads CLI commands for proceed_to_phase`
|
|
330
|
+
).not.toContain('bd list --parent');
|
|
331
|
+
|
|
332
|
+
// But should still contain the phase name somewhere
|
|
333
|
+
expect(result.instructions).toContain(phase);
|
|
228
334
|
}
|
|
229
335
|
});
|
|
230
336
|
|
|
@@ -232,22 +338,31 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
232
338
|
// Test design phase
|
|
233
339
|
const designResult = await beadsInstructionGenerator.generateInstructions(
|
|
234
340
|
'Design phase instructions',
|
|
235
|
-
{
|
|
341
|
+
{
|
|
342
|
+
...mockInstructionContext,
|
|
343
|
+
phase: 'design',
|
|
344
|
+
instructionSource: 'whats_next' as const,
|
|
345
|
+
}
|
|
236
346
|
);
|
|
237
347
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
348
|
+
// The phase is referenced in instructions passed to the generator
|
|
349
|
+
expect(designResult.instructions).toContain('Design phase instructions');
|
|
350
|
+
// Removed phase name expectation - no longer appears in phase context section
|
|
241
351
|
|
|
242
352
|
// Test implementation phase
|
|
243
353
|
const implResult = await beadsInstructionGenerator.generateInstructions(
|
|
244
354
|
'Implementation phase instructions',
|
|
245
|
-
{
|
|
355
|
+
{
|
|
356
|
+
...mockInstructionContext,
|
|
357
|
+
phase: 'implementation',
|
|
358
|
+
instructionSource: 'whats_next' as const,
|
|
359
|
+
}
|
|
246
360
|
);
|
|
247
361
|
|
|
248
362
|
expect(implResult.instructions).toContain(
|
|
249
|
-
'
|
|
363
|
+
'Implementation phase instructions'
|
|
250
364
|
);
|
|
365
|
+
// Removed phase name expectation - no longer appears in phase context section
|
|
251
366
|
});
|
|
252
367
|
});
|
|
253
368
|
|
|
@@ -258,22 +373,15 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
258
373
|
|
|
259
374
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
260
375
|
instructionsWithVariables,
|
|
261
|
-
mockInstructionContext
|
|
376
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' as const }
|
|
262
377
|
);
|
|
263
378
|
|
|
264
|
-
//
|
|
265
|
-
expect(result.instructions).toContain(
|
|
266
|
-
|
|
267
|
-
);
|
|
268
|
-
expect(result.instructions).toContain(
|
|
269
|
-
'/test/project/.vibe/docs/architecture.md'
|
|
270
|
-
);
|
|
379
|
+
// Variable substitution should work (though paths may not exist)
|
|
380
|
+
expect(result.instructions).toContain('Review the design in');
|
|
381
|
+
expect(result.instructions).toContain('implement according to');
|
|
271
382
|
|
|
272
|
-
// Should
|
|
273
|
-
expect(result.instructions).toContain('
|
|
274
|
-
expect(result.instructions).not.toContain(
|
|
275
|
-
'Mark completed tasks with [x]'
|
|
276
|
-
);
|
|
383
|
+
// Should maintain beads structure with BD CLI guidance for whats_next
|
|
384
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
277
385
|
});
|
|
278
386
|
|
|
279
387
|
it('should handle multiple variable occurrences in beads context', async () => {
|
|
@@ -301,24 +409,22 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
301
409
|
|
|
302
410
|
describe('Plan File Handling in Beads Mode', () => {
|
|
303
411
|
it('should handle non-existent plan file in beads mode', async () => {
|
|
304
|
-
const contextNoPlan = {
|
|
305
|
-
...mockInstructionContext,
|
|
306
|
-
planFileExists: false,
|
|
307
|
-
};
|
|
308
|
-
|
|
309
412
|
const result = await beadsInstructionGenerator.generateInstructions(
|
|
310
|
-
'
|
|
311
|
-
|
|
413
|
+
'Work on tasks.',
|
|
414
|
+
{
|
|
415
|
+
...mockInstructionContext,
|
|
416
|
+
planFileExists: false,
|
|
417
|
+
instructionSource: 'whats_next' as const,
|
|
418
|
+
}
|
|
312
419
|
);
|
|
313
420
|
|
|
314
|
-
// Should
|
|
315
|
-
expect(result.instructions).toContain('🔧 BD CLI Task Management:');
|
|
421
|
+
// Should include plan file creation note
|
|
316
422
|
expect(result.instructions).toContain(
|
|
317
423
|
'Plan file will be created when you first update it'
|
|
318
424
|
);
|
|
319
425
|
|
|
320
|
-
// Should
|
|
321
|
-
expect(result.instructions).
|
|
426
|
+
// Should still have beads guidance for whats_next
|
|
427
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
322
428
|
});
|
|
323
429
|
|
|
324
430
|
it('should maintain beads structure regardless of plan file state', async () => {
|
|
@@ -345,10 +451,10 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
345
451
|
|
|
346
452
|
// Both should have beads structure
|
|
347
453
|
expect(resultWithPlan.instructions).toContain(
|
|
348
|
-
'
|
|
454
|
+
'Use bd CLI tool exclusively'
|
|
349
455
|
);
|
|
350
456
|
expect(resultWithoutPlan.instructions).toContain(
|
|
351
|
-
'
|
|
457
|
+
'Use bd CLI tool exclusively'
|
|
352
458
|
);
|
|
353
459
|
|
|
354
460
|
// Neither should have markdown structure
|
|
@@ -363,33 +469,68 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
363
469
|
|
|
364
470
|
describe('Beads Mode Consistency', () => {
|
|
365
471
|
it('should provide consistent beads instructions across multiple generations', async () => {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
mockInstructionContext
|
|
371
|
-
),
|
|
372
|
-
beadsInstructionGenerator.generateInstructions(
|
|
373
|
-
'Test 2',
|
|
374
|
-
mockInstructionContext
|
|
375
|
-
),
|
|
376
|
-
beadsInstructionGenerator.generateInstructions(
|
|
377
|
-
'Test 3',
|
|
378
|
-
mockInstructionContext
|
|
379
|
-
),
|
|
380
|
-
]);
|
|
472
|
+
const instruction1 = await beadsInstructionGenerator.generateInstructions(
|
|
473
|
+
'First instruction set.',
|
|
474
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' as const }
|
|
475
|
+
);
|
|
381
476
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
477
|
+
const instruction2 = await beadsInstructionGenerator.generateInstructions(
|
|
478
|
+
'Second instruction set.',
|
|
479
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' as const }
|
|
480
|
+
);
|
|
481
|
+
|
|
482
|
+
// Both should have BD CLI guidance for whats_next
|
|
483
|
+
expect(instruction1.instructions).toContain('bd Task Management:');
|
|
484
|
+
expect(instruction2.instructions).toContain('bd Task Management:');
|
|
485
|
+
|
|
486
|
+
// Both should have plan file guidance
|
|
487
|
+
expect(instruction1.instructions).toContain('Plan File Guidance:');
|
|
488
|
+
expect(instruction2.instructions).toContain('Plan File Guidance:');
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it('should never accidentally switch to markdown mode in beads backend', async () => {
|
|
492
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
493
|
+
'Complex instruction with [x] markdown-like content.',
|
|
494
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' as const }
|
|
495
|
+
);
|
|
496
|
+
|
|
497
|
+
// Should maintain beads structure
|
|
498
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
499
|
+
expect(result.instructions).not.toContain('- [x]');
|
|
500
|
+
expect(result.instructions).not.toContain('- [ ]');
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
it('should maintain beads backend protection even with markdown-like instruction content', async () => {
|
|
504
|
+
const markdownLikeInstructions = `
|
|
505
|
+
This instruction has:
|
|
506
|
+
- [x] Completed task
|
|
507
|
+
- [ ] Pending task
|
|
508
|
+
Focus on the "Design" section.
|
|
509
|
+
`;
|
|
510
|
+
|
|
511
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
512
|
+
markdownLikeInstructions,
|
|
513
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' as const }
|
|
514
|
+
);
|
|
515
|
+
|
|
516
|
+
// Should have beads structure, not markdown
|
|
517
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
518
|
+
expect(result.instructions).not.toContain(
|
|
519
|
+
'Mark completed tasks with [x]'
|
|
520
|
+
);
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
it('should handle long complex instructions without corruption', async () => {
|
|
524
|
+
const longInstructions = 'Very long instruction set. '.repeat(100);
|
|
525
|
+
|
|
526
|
+
const result = await beadsInstructionGenerator.generateInstructions(
|
|
527
|
+
longInstructions,
|
|
528
|
+
{ ...mockInstructionContext, instructionSource: 'whats_next' as const }
|
|
529
|
+
);
|
|
530
|
+
|
|
531
|
+
// Should maintain beads structure even with long content
|
|
532
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
533
|
+
expect(result.instructions).toContain('Plan File Guidance:');
|
|
393
534
|
});
|
|
394
535
|
|
|
395
536
|
it('should never accidentally switch to markdown mode in beads backend', async () => {
|
|
@@ -403,7 +544,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
403
544
|
expect(
|
|
404
545
|
result.instructions,
|
|
405
546
|
`Sequential result ${i + 1} should be beads mode`
|
|
406
|
-
).toContain('
|
|
547
|
+
).toContain('bd Task Management:');
|
|
407
548
|
expect(
|
|
408
549
|
result.instructions,
|
|
409
550
|
`Sequential result ${i + 1} should not have markdown content`
|
|
@@ -422,7 +563,6 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
422
563
|
);
|
|
423
564
|
|
|
424
565
|
// Should still be beads mode despite markdown-like content in instructions
|
|
425
|
-
expect(result.instructions).toContain('🔧 BD CLI Task Management:');
|
|
426
566
|
expect(result.instructions).toContain('Use bd CLI tool exclusively');
|
|
427
567
|
expect(result.instructions).not.toContain(
|
|
428
568
|
'Mark completed tasks with [x]'
|
|
@@ -454,7 +594,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
454
594
|
);
|
|
455
595
|
|
|
456
596
|
// Core beads structure should be preserved
|
|
457
|
-
expect(result.instructions).toContain('
|
|
597
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
458
598
|
expect(result.instructions).toContain('Use bd CLI tool exclusively');
|
|
459
599
|
expect(result.instructions).toContain('bd list --parent');
|
|
460
600
|
|
|
@@ -502,10 +642,8 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
502
642
|
);
|
|
503
643
|
|
|
504
644
|
expect(modeledResult.metadata.isModeled).toBe(true);
|
|
505
|
-
|
|
506
|
-
expect(modeledResult.instructions).toContain(
|
|
507
|
-
'🔧 BD CLI Task Management:'
|
|
508
|
-
);
|
|
645
|
+
// The transition reason is in metadata, not necessarily in instructions
|
|
646
|
+
expect(modeledResult.instructions).toContain('bd Task Management:');
|
|
509
647
|
|
|
510
648
|
// Test non-modeled transition
|
|
511
649
|
const nonModeledContext: InstructionContext = {
|
|
@@ -521,9 +659,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
521
659
|
);
|
|
522
660
|
|
|
523
661
|
expect(nonModeledResult.metadata.isModeled).toBe(false);
|
|
524
|
-
expect(nonModeledResult.instructions).toContain(
|
|
525
|
-
'🔧 BD CLI Task Management:'
|
|
526
|
-
);
|
|
662
|
+
expect(nonModeledResult.instructions).toContain('bd Task Management:');
|
|
527
663
|
});
|
|
528
664
|
});
|
|
529
665
|
|
|
@@ -550,7 +686,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
550
686
|
expect(
|
|
551
687
|
result.instructions,
|
|
552
688
|
`Result ${index + 1} should be beads mode`
|
|
553
|
-
).toContain('
|
|
689
|
+
).toContain('bd Task Management:');
|
|
554
690
|
expect(
|
|
555
691
|
result.instructions,
|
|
556
692
|
`Result ${index + 1} should not have markdown content`
|
|
@@ -569,7 +705,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
569
705
|
expect(
|
|
570
706
|
result.instructions,
|
|
571
707
|
`Sequential result ${i + 1} should be beads mode`
|
|
572
|
-
).toContain('
|
|
708
|
+
).toContain('bd Task Management:');
|
|
573
709
|
expect(
|
|
574
710
|
result.instructions,
|
|
575
711
|
`Sequential result ${i + 1} should not have markdown content`
|
|
@@ -595,7 +731,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
595
731
|
expect(
|
|
596
732
|
result.instructions,
|
|
597
733
|
`Concurrent result ${index + 1} should be beads mode`
|
|
598
|
-
).toContain('
|
|
734
|
+
).toContain('bd Task Management:');
|
|
599
735
|
expect(
|
|
600
736
|
result.instructions,
|
|
601
737
|
`Concurrent result ${index + 1} should have beads CLI commands`
|
|
@@ -621,7 +757,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
621
757
|
);
|
|
622
758
|
|
|
623
759
|
// Core beads structure should be preserved even with large content
|
|
624
|
-
expect(result.instructions).toContain('
|
|
760
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
625
761
|
expect(result.instructions).toContain('Use bd CLI tool exclusively');
|
|
626
762
|
expect(result.instructions).toContain('bd list --parent');
|
|
627
763
|
|
|
@@ -663,7 +799,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
663
799
|
);
|
|
664
800
|
|
|
665
801
|
// Core beads structure should be preserved
|
|
666
|
-
expect(result.instructions).toContain('
|
|
802
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
667
803
|
expect(result.instructions).toContain('Use bd CLI tool exclusively');
|
|
668
804
|
expect(result.instructions).toContain('bd list --parent');
|
|
669
805
|
|
|
@@ -699,7 +835,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
699
835
|
);
|
|
700
836
|
|
|
701
837
|
// Should maintain beads mode despite confusing terminology
|
|
702
|
-
expect(result.instructions).toContain('
|
|
838
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
703
839
|
expect(result.instructions).toContain('Use bd CLI tool exclusively');
|
|
704
840
|
expect(result.instructions).not.toContain(
|
|
705
841
|
'Mark completed tasks with [x]'
|
|
@@ -726,7 +862,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
726
862
|
expect(result.instructions).toContain(
|
|
727
863
|
'Plan file will be created when you first update it'
|
|
728
864
|
);
|
|
729
|
-
expect(result.instructions).toContain('
|
|
865
|
+
expect(result.instructions).toContain('bd Task Management:');
|
|
730
866
|
expect(result.instructions).toContain('Use bd CLI tool exclusively');
|
|
731
867
|
|
|
732
868
|
// Should not revert to markdown mode for missing files
|
|
@@ -752,12 +888,8 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
752
888
|
);
|
|
753
889
|
|
|
754
890
|
// Both should maintain beads structure
|
|
755
|
-
expect(resultWithPlan.instructions).toContain(
|
|
756
|
-
|
|
757
|
-
);
|
|
758
|
-
expect(resultWithoutPlan.instructions).toContain(
|
|
759
|
-
'🔧 BD CLI Task Management:'
|
|
760
|
-
);
|
|
891
|
+
expect(resultWithPlan.instructions).toContain('bd Task Management:');
|
|
892
|
+
expect(resultWithoutPlan.instructions).toContain('bd Task Management:');
|
|
761
893
|
|
|
762
894
|
expect(resultWithPlan.instructions).toContain(
|
|
763
895
|
'Use bd CLI tool exclusively'
|
|
@@ -804,7 +936,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
804
936
|
expect(
|
|
805
937
|
result.instructions,
|
|
806
938
|
`Scenario ${scenario.name} should have beads structure`
|
|
807
|
-
).toContain('
|
|
939
|
+
).toContain('bd Task Management:');
|
|
808
940
|
expect(
|
|
809
941
|
result.instructions,
|
|
810
942
|
`Scenario ${scenario.name} should have beads CLI commands`
|
|
@@ -823,7 +955,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
823
955
|
Array.from({ length: 50 }, () => 'Repeat instruction content').join(
|
|
824
956
|
' '
|
|
825
957
|
), // Repetitive content
|
|
826
|
-
'
|
|
958
|
+
'bd: fake header', // Instructions containing beads-like headers
|
|
827
959
|
'Check your plan file and mark tasks [x]', // Instructions with markdown terminology
|
|
828
960
|
];
|
|
829
961
|
|
|
@@ -836,7 +968,7 @@ describe('BeadsInstructionGenerator Content Validation', () => {
|
|
|
836
968
|
expect(
|
|
837
969
|
result.instructions,
|
|
838
970
|
`Edge case "${edgeCase.substring(0, 20)}..." should maintain beads structure`
|
|
839
|
-
).toContain('
|
|
971
|
+
).toContain('bd Task Management:');
|
|
840
972
|
expect(
|
|
841
973
|
result.instructions,
|
|
842
974
|
`Edge case "${edgeCase.substring(0, 20)}..." should not have markdown contamination`
|