@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.
Files changed (93) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/components/beads/beads-instruction-generator.d.ts +4 -8
  3. package/dist/components/beads/beads-instruction-generator.d.ts.map +1 -1
  4. package/dist/components/beads/beads-instruction-generator.js +28 -51
  5. package/dist/components/beads/beads-instruction-generator.js.map +1 -1
  6. package/dist/components/beads/beads-task-backend-client.d.ts.map +1 -1
  7. package/dist/components/beads/beads-task-backend-client.js +1 -4
  8. package/dist/components/beads/beads-task-backend-client.js.map +1 -1
  9. package/dist/plugin-system/beads-plugin.d.ts +70 -0
  10. package/dist/plugin-system/beads-plugin.d.ts.map +1 -0
  11. package/dist/plugin-system/beads-plugin.js +459 -0
  12. package/dist/plugin-system/beads-plugin.js.map +1 -0
  13. package/dist/plugin-system/index.d.ts +9 -0
  14. package/dist/plugin-system/index.d.ts.map +1 -0
  15. package/dist/plugin-system/index.js +9 -0
  16. package/dist/plugin-system/index.js.map +1 -0
  17. package/dist/plugin-system/plugin-interfaces.d.ts +99 -0
  18. package/dist/plugin-system/plugin-interfaces.d.ts.map +1 -0
  19. package/dist/plugin-system/plugin-interfaces.js +9 -0
  20. package/dist/plugin-system/plugin-interfaces.js.map +1 -0
  21. package/dist/plugin-system/plugin-registry.d.ts +44 -0
  22. package/dist/plugin-system/plugin-registry.d.ts.map +1 -0
  23. package/dist/plugin-system/plugin-registry.js +132 -0
  24. package/dist/plugin-system/plugin-registry.js.map +1 -0
  25. package/dist/server-config.d.ts.map +1 -1
  26. package/dist/server-config.js +28 -8
  27. package/dist/server-config.js.map +1 -1
  28. package/dist/tool-handlers/conduct-review.d.ts.map +1 -1
  29. package/dist/tool-handlers/conduct-review.js +1 -2
  30. package/dist/tool-handlers/conduct-review.js.map +1 -1
  31. package/dist/tool-handlers/get-tool-info.d.ts +0 -1
  32. package/dist/tool-handlers/get-tool-info.d.ts.map +1 -1
  33. package/dist/tool-handlers/get-tool-info.js +0 -1
  34. package/dist/tool-handlers/get-tool-info.js.map +1 -1
  35. package/dist/tool-handlers/proceed-to-phase.d.ts +0 -7
  36. package/dist/tool-handlers/proceed-to-phase.d.ts.map +1 -1
  37. package/dist/tool-handlers/proceed-to-phase.js +15 -95
  38. package/dist/tool-handlers/proceed-to-phase.js.map +1 -1
  39. package/dist/tool-handlers/resume-workflow.d.ts +0 -1
  40. package/dist/tool-handlers/resume-workflow.d.ts.map +1 -1
  41. package/dist/tool-handlers/resume-workflow.js +0 -1
  42. package/dist/tool-handlers/resume-workflow.js.map +1 -1
  43. package/dist/tool-handlers/start-development.d.ts +0 -16
  44. package/dist/tool-handlers/start-development.d.ts.map +1 -1
  45. package/dist/tool-handlers/start-development.js +29 -130
  46. package/dist/tool-handlers/start-development.js.map +1 -1
  47. package/dist/tool-handlers/whats-next.d.ts +0 -2
  48. package/dist/tool-handlers/whats-next.d.ts.map +1 -1
  49. package/dist/tool-handlers/whats-next.js +1 -2
  50. package/dist/tool-handlers/whats-next.js.map +1 -1
  51. package/dist/types.d.ts +2 -0
  52. package/dist/types.d.ts.map +1 -1
  53. package/package.json +2 -2
  54. package/src/components/beads/beads-instruction-generator.ts +32 -64
  55. package/src/components/beads/beads-task-backend-client.ts +1 -4
  56. package/src/plugin-system/beads-plugin.ts +641 -0
  57. package/src/plugin-system/index.ts +20 -0
  58. package/src/plugin-system/plugin-interfaces.ts +154 -0
  59. package/src/plugin-system/plugin-registry.ts +190 -0
  60. package/src/server-config.ts +30 -8
  61. package/src/tool-handlers/conduct-review.ts +1 -2
  62. package/src/tool-handlers/get-tool-info.ts +0 -2
  63. package/src/tool-handlers/proceed-to-phase.ts +19 -139
  64. package/src/tool-handlers/resume-workflow.ts +0 -2
  65. package/src/tool-handlers/start-development.ts +35 -213
  66. package/src/tool-handlers/whats-next.ts +1 -4
  67. package/src/types.ts +2 -0
  68. package/test/e2e/beads-plugin-integration.test.ts +1594 -0
  69. package/test/e2e/core-functionality.test.ts +3 -12
  70. package/test/e2e/mcp-contract.test.ts +0 -31
  71. package/test/e2e/plugin-system-integration.test.ts +1421 -0
  72. package/test/e2e/state-management.test.ts +1 -5
  73. package/test/e2e/workflow-integration.test.ts +2 -11
  74. package/test/unit/beads-instruction-generator.test.ts +235 -103
  75. package/test/unit/beads-phase-task-id-integration.test.ts +7 -29
  76. package/test/unit/beads-plugin-behavioral.test.ts +512 -0
  77. package/test/unit/beads-plugin.test.ts +94 -0
  78. package/test/unit/plugin-error-handling.test.ts +240 -0
  79. package/test/unit/proceed-to-phase-plugin-integration.test.ts +150 -0
  80. package/test/unit/resume-workflow.test.ts +0 -1
  81. package/test/unit/server-config-plugin-registry.test.ts +81 -0
  82. package/test/unit/server-tools.test.ts +0 -1
  83. package/test/unit/start-development-goal-extraction.test.ts +22 -16
  84. package/test/utils/test-helpers.ts +3 -1
  85. package/tsconfig.build.tsbuildinfo +1 -1
  86. package/dist/components/server-components-factory.d.ts +0 -39
  87. package/dist/components/server-components-factory.d.ts.map +0 -1
  88. package/dist/components/server-components-factory.js +0 -62
  89. package/dist/components/server-components-factory.js.map +0 -1
  90. package/src/components/server-components-factory.ts +0 -86
  91. package/test/e2e/component-substitution.test.ts +0 -208
  92. package/test/unit/beads-integration-filename.test.ts +0 -93
  93. package/test/unit/server-components-factory.test.ts +0 -279
@@ -11,10 +11,7 @@ import {
11
11
  type GeneratedInstructions,
12
12
  type YamlStateMachine,
13
13
  ProjectDocsManager,
14
- TaskBackendManager,
15
- type TaskBackendConfig,
16
14
  } from '@codemcp/workflows-core';
17
- import { BeadsTaskBackendClient } from './beads-task-backend-client.js';
18
15
 
19
16
  /**
20
17
  * Beads-specific instruction generator
@@ -22,20 +19,15 @@ import { BeadsTaskBackendClient } from './beads-task-backend-client.js';
22
19
  export class BeadsInstructionGenerator implements IInstructionGenerator {
23
20
  private projectDocsManager: ProjectDocsManager;
24
21
 
25
- constructor(
26
- _taskBackendClient?: BeadsTaskBackendClient,
27
- _taskBackendDetector: () => TaskBackendConfig = TaskBackendManager.detectTaskBackend
28
- ) {
22
+ constructor() {
29
23
  this.projectDocsManager = new ProjectDocsManager();
30
- // Task backend client and detector may be used in future enhancements
31
24
  }
32
25
 
33
26
  /**
34
- * Set the state machine definition (kept for interface compatibility)
27
+ * Set the state machine definition (interface requirement)
35
28
  */
36
29
  setStateMachine(_stateMachine: YamlStateMachine): void {
37
- // Not needed for beads implementation but kept for interface compliance
38
- return;
30
+ // No-op: beads uses CLI for state management
39
31
  }
40
32
 
41
33
  /**
@@ -109,20 +101,13 @@ export class BeadsInstructionGenerator implements IInstructionGenerator {
109
101
  baseInstructions: string,
110
102
  context: InstructionContext
111
103
  ): Promise<string> {
112
- const {
113
- phase,
114
- conversationContext,
115
- transitionReason,
116
- isModeled,
117
- planFileExists,
118
- } = context;
104
+ const { planFileExists } = context;
119
105
 
120
106
  // Generate beads-specific task management guidance
121
- const beadsTaskGuidance = await this.generateBeadsTaskGuidance(context);
107
+ const beadsTaskGuidance = await this.generateBeadsCLIGuidance(context);
122
108
 
123
109
  // Beads-optimized instruction structure
124
- const enhanced = `You are in the ${phase} phase.
125
- ${baseInstructions}
110
+ let enhanced = `${baseInstructions}
126
111
 
127
112
  **Plan File Guidance:**
128
113
  Use the plan file as memory for the current objective
@@ -130,84 +115,67 @@ Use the plan file as memory for the current objective
130
115
  - Add relevant notes to help maintain context
131
116
  - Do NOT enter tasks in the plan file, use beads CLI exclusively for task management
132
117
 
133
- **🔧 BD CLI Task Management:**
134
118
  ${beadsTaskGuidance}`;
135
119
 
136
- // Add project context
137
- const enhancedWithContext =
138
- enhanced +
139
- `\n\n**Project Context:**
140
- - Project: ${conversationContext.projectPath}
141
- - Branch: ${conversationContext.gitBranch}
142
- - Current Phase: ${phase}`;
143
-
144
- // Add transition context if this is a modeled transition
145
- let final = enhancedWithContext;
146
- if (isModeled && transitionReason) {
147
- final += `\n\n**Phase Context:**
148
- - ${transitionReason}`;
149
- }
150
-
151
120
  // Add plan file creation note if needed
152
121
  if (!planFileExists) {
153
- final +=
122
+ enhanced +=
154
123
  '\n\n**Note**: Plan file will be created when you first update it.';
155
124
  }
156
125
 
157
126
  // Add beads-specific reminders
158
- final += `\n\n**Important Reminders:**
127
+ enhanced += `\n\n**Important Reminders:**
159
128
  - Use ONLY bd CLI tool for task management - do not use your own task management tools
160
129
  - Call whats_next() after the next user message to maintain the development workflow`;
161
130
 
162
- return final;
131
+ return enhanced;
163
132
  }
164
133
 
165
134
  /**
166
135
  * Generate beads-specific task management guidance
167
136
  */
168
- private async generateBeadsTaskGuidance(
137
+ private async generateBeadsCLIGuidance(
169
138
  context: InstructionContext
170
139
  ): Promise<string> {
171
- const { phase } = context;
140
+ const { instructionSource } = context;
172
141
 
173
- // Extract phase task ID from plan file (this would need to be implemented)
174
- const phaseTaskId = await this.extractPhaseTaskId(context);
142
+ // For whats_next, provide detailed guidance
143
+ if (instructionSource === 'whats_next') {
144
+ let additionalInstructions = `**bd Task Management:**
145
+ `;
175
146
 
176
- if (!phaseTaskId) {
177
- return `- Use bd CLI tool exclusively
147
+ const phaseTaskId = await this.extractPhaseTaskId(context);
148
+
149
+ if (!phaseTaskId) {
150
+ return (
151
+ additionalInstructions +
152
+ `- Use bd CLI tool exclusively
178
153
  - **Start by listing ready tasks**: \`bd list --parent <phase-task-id> --status open\`
179
154
  - **Create new tasks**: \`bd create 'Task title' --parent <phase-task-id> -p <priority>\`
180
155
  - **Update status when working**: \`bd update <task-id> --status in_progress\`
181
156
  - **Complete tasks**: \`bd close <task-id>\`
182
157
  - **Focus on ready tasks first** - let beads handle dependencies
183
- - Add new tasks as they are identified during your work with the user`;
184
- }
185
-
186
- return `
187
- You are currently in the ${this.capitalizePhase(phase)} phase. All work items should be created as children of ${phaseTaskId}.
158
+ - Add new tasks as they are identified during your work with the user`
159
+ );
160
+ }
188
161
 
189
- **Focus on ${this.capitalizePhase(phase)} Phase Tasks** (subtasks of \`${phaseTaskId}\`):
162
+ return (
163
+ additionalInstructions +
164
+ `
165
+ **Focus on subtasks of \`${phaseTaskId}\`**:
190
166
  • \`bd list --parent ${phaseTaskId} --status open\` - List ready work items
191
167
  • \`bd update <task-id> --status in_progress\` - Start working on a specific task
192
168
  • \`bd close <task-id>\` - Mark task complete when finished
193
169
 
194
170
  **New Tasks for Current Phase**:
195
171
  • \`bd create 'Task description' --parent ${phaseTaskId} -p <priority>\` - Create work item under current phase
196
- • \`bd dep add <task-id> <depends-on-id>\` - Define dependencies for a task:
197
-
198
-
199
- **Essential bd Commands**:
200
- • \`bd list --parent ${phaseTaskId} --status open\` - List ready work items
201
- • \`bd update <task-id> --status in_progress\` - Start working
202
- • \`bd close <task-id>\` - Complete work item
203
- • \`bd show ${phaseTaskId}\` - View phase and its work items
172
+ • \`bd dep add <task-id> <depends-on-id>\` - Define dependencies for a task:`
173
+ );
174
+ }
204
175
 
205
- **Immediate Action**: Run \`bd list --parent ${phaseTaskId} --status open\` to see ready tasks.`;
176
+ return '';
206
177
  }
207
178
 
208
- /**
209
- * Extract phase task ID from plan file (simplified implementation)
210
- */
211
179
  private async extractPhaseTaskId(
212
180
  context: InstructionContext
213
181
  ): Promise<string | null> {
@@ -97,8 +97,7 @@ export class BeadsTaskBackendClient implements ITaskBackendClient {
97
97
  return [];
98
98
  }
99
99
 
100
- // Parse text output from beads CLI (since JSON format may not be available)
101
- // This is a simplified parser - would need to be adjusted based on actual beads output format
100
+ // Parse beads CLI text output
102
101
  const lines = result.stdout.trim().split('\n');
103
102
  const tasks: BackendTask[] = [];
104
103
 
@@ -109,8 +108,6 @@ export class BeadsTaskBackendClient implements ITaskBackendClient {
109
108
  !line.startsWith('●') &&
110
109
  !line.includes('Tip:')
111
110
  ) {
112
- // Extract task ID and title from beads output format
113
- // This is based on observed beads CLI output format
114
111
  const match = line.match(/^○?\s*([^\s]+)\s+.*?\s+-\s+(.+)$/);
115
112
  if (match) {
116
113
  tasks.push({