@hyperdrive.bot/bmad-workflow 1.0.3 → 1.0.6

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.
@@ -159,70 +159,38 @@ ${options.contextFiles.map((f) => `- ${f}`).join('\n')}
159
159
  `;
160
160
  }
161
161
  // Add output format instructions (varies based on story format mode)
162
- prompt += options.storyFormat ? `## OUTPUT FORMAT - STORY MODE
163
- You MUST output tasks as BMAD-formatted STORIES with proper structure.
164
- Output ONLY valid YAML. DO NOT include markdown code fences or any other text.
165
-
166
- Each task will become a full story with:
167
- - Story ID: ${options.storyPrefix}-<number> (e.g., ${options.storyPrefix}-001, ${options.storyPrefix}-002)
168
- - User story format: "As a... I want... so that..."
169
- - Acceptance Criteria
170
- - Tasks/Subtasks breakdown
171
- - Dev Notes with testing info
172
-
173
- \`\`\`yaml
162
+ prompt += options.storyFormat ? `## OUTPUT FORMAT - STORY MODE - CRITICAL INSTRUCTIONS
163
+
164
+ **YOUR RESPONSE MUST BE PURE YAML ONLY.**
165
+ - Do NOT write any explanation, summary, or commentary
166
+ - Do NOT use markdown code fences
167
+ - Start your response DIRECTLY with "masterPrompt: |"
168
+
169
+ Each task becomes a BMAD story with user story format, acceptance criteria, and tasks breakdown.
170
+
171
+ The YAML structure MUST be:
172
+
174
173
  masterPrompt: |
175
- A reusable prompt template that applies to all stories.
176
- Include best practices, coding standards, and common guidelines for implementing these stories.
174
+ A reusable prompt template for all stories.
175
+ Include best practices and coding standards.
177
176
 
178
177
  tasks:
179
178
  - id: ${options.storyPrefix}-001
180
179
  title: "Clear, specific story title"
181
180
  description: "High-level description of what this story delivers"
182
181
  estimatedMinutes: 10
183
- dependencies: [] # Array of story IDs that must complete first
182
+ dependencies: []
184
183
  parallelizable: true
185
184
  agentType: "dev"
186
- targetFiles: # Optional: specific files this story operates on
185
+ targetFiles:
187
186
  - "path/to/file.js"
188
187
  prompt: |
189
- Create a story following BMAD story format:
190
-
191
- # Story ${options.storyPrefix}-001: [Title]
192
-
193
- ## Status
194
- Draft
195
-
196
- ## Story
197
- **As a** [role/persona],
198
- **I want** [capability/feature],
199
- **so that** [benefit/value]
200
-
201
- ## Acceptance Criteria
202
- 1. [Specific, testable criterion]
203
- 2. [Another criterion]
204
- 3. [Another criterion]
205
-
206
- ## Tasks / Subtasks
207
- - [ ] Task 1: [Description] (AC: #1)
208
- - [ ] Subtask 1.1: [Specific action]
209
- - [ ] Subtask 1.2: [Specific action]
210
- - [ ] Task 2: [Description] (AC: #2)
211
- - [ ] Subtask 2.1: [Specific action]
212
-
213
- ## Dev Notes
214
- [Relevant architecture info, integration points, file locations]
215
-
216
- ### Testing
217
- - Test file location: [path]
218
- - Test standards: [requirements]
219
- - Testing frameworks: [tools being used]
220
- - Specific requirements: [any special test needs]
221
-
222
- ## Change Log
223
- | Date | Version | Description | Author |
224
- |------|---------|-------------|--------|
225
- | [Date] | 1.0 | Story created | AI Agent |
188
+ Create a story following BMAD story format with:
189
+ - Status: Draft
190
+ - User story (As a... I want... so that...)
191
+ - Acceptance Criteria (numbered, testable)
192
+ - Tasks/Subtasks with AC references
193
+ - Dev Notes with testing info
226
194
  outputFile: "${sessionDir}/stories/${options.storyPrefix}-001.md"
227
195
 
228
196
  - id: ${options.storyPrefix}-002
@@ -233,40 +201,25 @@ tasks:
233
201
  parallelizable: false
234
202
  agentType: "dev"
235
203
  prompt: |
236
- [Story-formatted prompt as above]
204
+ Story-formatted prompt
237
205
  outputFile: "${sessionDir}/stories/${options.storyPrefix}-002.md"
238
206
 
239
- # ... more tasks (as stories)
240
- \`\`\`
207
+ ## STORY MODE RULES
208
+ - Task IDs: ${options.storyPrefix}-001, ${options.storyPrefix}-002, etc.
209
+ - Output files: ${sessionDir}/stories/
210
+ ${options.perFile ? '- **CRITICAL**: Create one story per file (per-file mode is ON)' : ''}
241
211
 
242
- **CRITICAL FOR STORY MODE:**
243
- - Task IDs MUST be story IDs: ${options.storyPrefix}-001, ${options.storyPrefix}-002, etc.
244
- - Output files MUST go to stories/ directory
245
- - Prompts MUST generate full story structure (not simple task outputs)
246
- - Each story must have user story format, acceptance criteria, and tasks breakdown
212
+ **REMEMBER: Your ENTIRE response must be valid YAML starting with "masterPrompt: |" - NO other text!**
213
+ ` : `## OUTPUT FORMAT - CRITICAL INSTRUCTIONS
247
214
 
248
- ## IMPORTANT RULES
249
- 1. Each story ID must be unique
250
- 2. Dependencies must reference valid story IDs
251
- 3. Circular dependencies are not allowed
252
- 4. Stories with no dependencies can run immediately
253
- 5. Stories with the same dependencies can run in parallel (if parallelizable: true)
254
- 6. All file paths in outputFile should use the session directory: ${sessionDir}/stories/
255
- ${options.perFile ? '7. **CRITICAL**: Create one story per file for the main work (per-file mode is ON)' : ''}
215
+ **YOUR RESPONSE MUST BE PURE YAML ONLY.**
216
+ - Do NOT write any explanation, summary, or commentary
217
+ - Do NOT use markdown code fences (\`\`\`yaml or \`\`\`)
218
+ - Do NOT write "Here's the task decomposition..." or similar
219
+ - Start your response DIRECTLY with "masterPrompt: |"
256
220
 
257
- ## EXAMPLE DEPENDENCY PATTERNS
221
+ The YAML structure MUST be:
258
222
 
259
- Sequential:
260
- ${options.storyPrefix}-001 (deps: []) → ${options.storyPrefix}-002 (deps: [${options.storyPrefix}-001])
261
-
262
- Parallel then join:
263
- ${options.storyPrefix}-001 (deps: []) → [${options.storyPrefix}-002, ${options.storyPrefix}-003] → ${options.storyPrefix}-004
264
-
265
- Now, decompose the goal into stories. Output ONLY the YAML structure.
266
- ` : `## OUTPUT FORMAT
267
- You MUST output ONLY valid YAML in the following structure. DO NOT include markdown code fences or any other text.
268
-
269
- \`\`\`yaml
270
223
  masterPrompt: |
271
224
  A reusable prompt template that applies to all tasks.
272
225
  Include best practices, coding standards, and common guidelines.
@@ -276,52 +229,39 @@ tasks:
276
229
  title: "Clear, specific task title"
277
230
  description: "Detailed description of what this task accomplishes"
278
231
  estimatedMinutes: 10
279
- dependencies: [] # Array of task IDs that must complete first
280
- parallelizable: true # Can this run in parallel with other tasks?
281
- agentType: "dev" # Agent type: dev, architect, qa, etc.
282
- targetFiles: # Optional: specific files this task operates on
232
+ dependencies: []
233
+ parallelizable: true
234
+ agentType: "dev"
235
+ targetFiles:
283
236
  - "path/to/file.js"
284
237
  prompt: |
285
238
  Specific prompt for the agent to execute this task.
286
- Include:
287
- - What to do
288
- - Where to do it (file paths)
289
- - Expected outcome
290
- - Any validation steps
239
+ Include what to do, where to do it, expected outcome, validation steps.
291
240
  outputFile: "${sessionDir}/outputs/task-001-output.md"
292
241
 
293
242
  - id: task-002
294
243
  title: "Next task"
295
244
  description: "Task description"
296
245
  estimatedMinutes: 5
297
- dependencies: ["task-001"] # Must wait for task-001
246
+ dependencies: ["task-001"]
298
247
  parallelizable: false
299
248
  agentType: "dev"
300
249
  prompt: |
301
250
  Task-specific prompt here
302
251
  outputFile: "${sessionDir}/outputs/task-002-output.md"
303
252
 
304
- # ... more tasks
305
- \`\`\`
306
-
307
- ## IMPORTANT RULES
308
- 1. Each task ID must be unique
253
+ ## YAML RULES
254
+ 1. Each task ID must be unique (task-001, task-002, etc.)
309
255
  2. Dependencies must reference valid task IDs
310
- 3. Circular dependencies are not allowed
311
- 4. Tasks with no dependencies can run immediately
312
- 5. Tasks with the same dependencies can run in parallel (if parallelizable: true)
313
- 6. All file paths in outputFile should use the session directory: ${sessionDir}/outputs/
314
- ${options.perFile ? '7. **CRITICAL**: Create one task per file for the main work (per-file mode is ON)' : ''}
315
-
316
- ## EXAMPLE DEPENDENCY PATTERNS
317
-
318
- Sequential:
319
- task-001 (deps: []) → task-002 (deps: [task-001]) → task-003 (deps: [task-002])
256
+ 3. No circular dependencies
257
+ 4. Use outputFile path: ${sessionDir}/outputs/
258
+ ${options.perFile ? '5. **CRITICAL**: Create one task per file (per-file mode is ON)' : ''}
320
259
 
321
- Parallel then join:
322
- task-001 (deps: []) → [task-002, task-003] (deps: [task-001]) → task-004 (deps: [task-002, task-003])
260
+ ## DEPENDENCY PATTERNS
261
+ - Sequential: task-001 → task-002 (deps: [task-001])
262
+ - Parallel: task-002, task-003 both depend on task-001, then task-004 depends on both
323
263
 
324
- Now, decompose the goal into tasks. Output ONLY the YAML structure.
264
+ **REMEMBER: Your ENTIRE response must be valid YAML starting with "masterPrompt: |" - NO other text!**
325
265
  `;
326
266
  return prompt;
327
267
  }
@@ -418,15 +358,25 @@ Now, decompose the goal into tasks. Output ONLY the YAML structure.
418
358
  startIndex = lines.findIndex((line) => line.trim().startsWith('tasks:'));
419
359
  }
420
360
  if (startIndex !== -1) {
421
- // Find the end of YAML content (stop at empty lines or obvious non-YAML content)
361
+ // For YAML task graphs, we expect the content to continue until the end
362
+ // since ## headers inside multiline strings (prompt: |) are valid YAML content.
363
+ // Only stop if we see clear non-YAML markers at the start of a line (no indentation).
422
364
  let endIndex = lines.length;
423
365
  for (let i = startIndex + 1; i < lines.length; i++) {
424
- const line = lines[i].trim();
425
- // Stop if we hit obvious non-YAML content
426
- if (line.startsWith('#') && !line.startsWith('# ') && i > startIndex + 5) {
427
- // Could be a comment, but if far from start, likely end of YAML
428
- endIndex = i;
429
- break;
366
+ const line = lines[i];
367
+ const trimmedLine = line.trim();
368
+ // Only stop at lines that are:
369
+ // 1. Not indented (start at column 0)
370
+ // 2. Look like markdown headers or prose (not YAML keys)
371
+ // 3. Are not empty lines (which are valid in YAML)
372
+ if (line.length > 0 && line[0] !== ' ' && line[0] !== '\t') {
373
+ // Line is not indented - check if it's a YAML key or non-YAML content
374
+ const isYamlKey = /^[a-zA-Z_][a-zA-Z0-9_]*:/.test(trimmedLine) || trimmedLine.startsWith('-');
375
+ if (!isYamlKey && !trimmedLine.startsWith('#')) {
376
+ // Non-indented, non-YAML content (like "Here's the summary...")
377
+ endIndex = i;
378
+ break;
379
+ }
430
380
  }
431
381
  }
432
382
  const yamlContent = lines.slice(startIndex, endIndex).join('\n');
@@ -535,21 +485,24 @@ Now, decompose the goal into tasks. Output ONLY the YAML structure.
535
485
  catch (error) {
536
486
  this.logger.warn({ error: error.message }, 'YAML validation failed, asking Claude to fix it');
537
487
  // YAML is invalid, ask Claude to fix it
538
- const fixPrompt = `The following YAML has syntax errors. Please fix ALL syntax errors and return ONLY the corrected YAML (no explanations, no markdown code fences, just the raw YAML):
488
+ const fixPrompt = `FIX THIS YAML - OUTPUT ONLY THE FIXED YAML, NOTHING ELSE.
489
+
490
+ **CRITICAL: Your response must be PURE YAML only. Start directly with "masterPrompt: |"**
491
+ - Do NOT write any explanation
492
+ - Do NOT use markdown code fences
493
+ - Do NOT say "Here's the fixed YAML" or anything similar
539
494
 
540
- ERROR: ${error.message}
495
+ ERROR TO FIX: ${error.message}
541
496
 
542
- INVALID YAML:
497
+ YAML TO FIX:
543
498
  ${output}
544
499
 
545
- Please output the CORRECTED YAML only. Ensure:
546
- 1. Proper indentation (2 spaces per level)
547
- 2. All strings with special characters are quoted
548
- 3. All lists and mappings are properly formatted
549
- 4. No syntax errors remain
500
+ RULES:
501
+ - Use 2 spaces for indentation
502
+ - Quote strings with special characters
503
+ - Ensure valid YAML syntax
550
504
 
551
- Output ONLY the corrected YAML:
552
- `;
505
+ YOUR RESPONSE MUST START WITH "masterPrompt: |" - NO OTHER TEXT ALLOWED!`;
553
506
  this.logger.info('Asking Claude to fix YAML errors');
554
507
  const fixResult = await this.agentRunner.runAgent(fixPrompt, {
555
508
  agentType: 'architect',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hyperdrive.bot/bmad-workflow",
3
3
  "description": "AI-driven development workflow orchestration CLI for BMAD projects",
4
- "version": "1.0.3",
4
+ "version": "1.0.6",
5
5
  "author": {
6
6
  "name": "DevSquad",
7
7
  "email": "marcelo@devsquad.email",