@hyperdrive.bot/bmad-workflow 1.0.8 → 1.0.10

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.
@@ -35,6 +35,7 @@ export default class Decompose extends Command {
35
35
  execute: import("@oclif/core/interfaces").BooleanFlag<boolean>;
36
36
  'file-pattern': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
37
37
  'max-parallel': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
38
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
39
  'output-dir': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
39
40
  'per-file': import("@oclif/core/interfaces").BooleanFlag<boolean>;
40
41
  'plan-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -73,6 +73,9 @@ export default class Decompose extends Command {
73
73
  default: 3,
74
74
  description: 'Maximum number of tasks to run in parallel',
75
75
  }),
76
+ model: Flags.string({
77
+ description: 'Model to use for AI provider. Format varies by provider: Claude (claude-opus-4-5-20251101), Gemini (gemini-2.5-pro), OpenCode (anthropic/claude-3-5-sonnet)',
78
+ }),
76
79
  'output-dir': Flags.string({
77
80
  default: 'docs/decompose-sessions',
78
81
  description: 'Directory for session outputs',
@@ -144,6 +147,7 @@ export default class Decompose extends Command {
144
147
  filePattern: flags['file-pattern'],
145
148
  goal: args.goal,
146
149
  maxParallel: flags['max-parallel'],
150
+ model: flags.model,
147
151
  perFile: flags['per-file'],
148
152
  planOnly: flags['plan-only'],
149
153
  storyFormat: flags['story-format'],
@@ -37,6 +37,7 @@ export default class EpicsCreate extends Command {
37
37
  start: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
38
38
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
39
  cwd: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
41
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
41
42
  task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
42
43
  };
@@ -26,6 +26,7 @@ export default class PrdFix extends Command {
26
26
  static description: string;
27
27
  static examples: string[];
28
28
  static flags: {
29
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
30
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
30
31
  reference: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
32
  };
@@ -40,6 +40,9 @@ export default class PrdFix extends Command {
40
40
  '<%= config.bin %> <%= command.id %> docs/PRD-feature.md --provider gemini',
41
41
  ];
42
42
  static flags = {
43
+ model: Flags.string({
44
+ description: 'Model to use for AI provider. Format varies by provider: Claude (claude-opus-4-5-20251101), Gemini (gemini-2.5-pro), OpenCode (anthropic/claude-3-5-sonnet)',
45
+ }),
43
46
  provider: Flags.string({
44
47
  default: 'claude',
45
48
  description: 'AI provider to use (claude, gemini, or opencode)',
@@ -35,6 +35,7 @@ export default class StoriesCreateCommand extends Command {
35
35
  start: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
36
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
37
37
  cwd: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
39
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
39
40
  task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
41
  };
@@ -37,6 +37,7 @@ export default class StoriesDevelopCommand extends Command {
37
37
  reference: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
38
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
39
39
  cwd: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
40
41
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
41
42
  task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
42
43
  };
@@ -32,6 +32,7 @@ export default class StoriesQaCommand extends Command {
32
32
  'dev-prompt': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
33
33
  interval: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
34
34
  'max-retries': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
35
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
36
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
36
37
  'qa-prompt': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
37
38
  reference: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -73,6 +73,9 @@ export default class StoriesQaCommand extends Command {
73
73
  default: 2,
74
74
  description: 'Maximum QA → Dev fix cycles before giving up (0 = QA only, no fix-forward)',
75
75
  }),
76
+ model: Flags.string({
77
+ description: 'Model to use for AI provider. Format varies by provider: Claude (claude-opus-4-5-20251101), Gemini (gemini-2.5-pro), OpenCode (anthropic/claude-3-5-sonnet)',
78
+ }),
76
79
  provider: Flags.string({
77
80
  default: 'claude',
78
81
  description: 'AI provider to use (claude, gemini, or opencode)',
@@ -31,6 +31,7 @@ export default class Workflow extends Command {
31
31
  parallel: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
32
32
  pipeline: import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
33
  'prd-interval': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
34
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
35
  prefix: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
35
36
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
36
37
  qa: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -72,6 +72,9 @@ export default class Workflow extends Command {
72
72
  default: 60,
73
73
  description: 'Seconds between epic creation batches',
74
74
  }),
75
+ model: Flags.string({
76
+ description: 'Model to use for AI provider. Format varies by provider: Claude (claude-opus-4-5-20251101), Gemini (gemini-2.5-pro), OpenCode (anthropic/claude-3-5-sonnet)',
77
+ }),
75
78
  prefix: Flags.string({
76
79
  default: '',
77
80
  description: 'Filename prefix for generated files',
@@ -151,6 +154,7 @@ export default class Workflow extends Command {
151
154
  dryRun: flags['dry-run'],
152
155
  epicInterval: flags['epic-interval'],
153
156
  input: args.input,
157
+ model: flags.model,
154
158
  parallel: flags.parallel,
155
159
  pipeline: flags.pipeline,
156
160
  prdInterval: flags['prd-interval'],
@@ -27,6 +27,13 @@ export interface AgentOptions {
27
27
  * Additional CLI flags to pass to the Claude executable
28
28
  */
29
29
  flags?: string[];
30
+ /**
31
+ * Model to use for this agent execution (provider-specific format)
32
+ * - Claude: e.g., 'claude-opus-4-5-20251101', 'claude-sonnet-4-5-20250929'
33
+ * - Gemini: e.g., 'gemini-2.5-pro', 'gemini-2.5-flash'
34
+ * - OpenCode: e.g., 'anthropic/claude-3-5-sonnet', 'openai/gpt-4o'
35
+ */
36
+ model?: string;
30
37
  /**
31
38
  * Callback invoked when prompt is sent (for logging)
32
39
  */
@@ -17,6 +17,10 @@ export interface ProviderConfig {
17
17
  * Default flags to pass to the CLI
18
18
  */
19
19
  flags: string[];
20
+ /**
21
+ * Flag used to specify model selection (e.g., '--model')
22
+ */
23
+ modelFlag: string;
20
24
  /**
21
25
  * Whether this provider supports @file references natively
22
26
  */
@@ -8,16 +8,19 @@ export const PROVIDER_CONFIGS = {
8
8
  claude: {
9
9
  command: 'claude',
10
10
  flags: ['--dangerously-skip-permissions', '--print'],
11
+ modelFlag: '--model',
11
12
  supportsFileReferences: true,
12
13
  },
13
14
  gemini: {
14
15
  command: 'gemini',
15
16
  flags: ['-p', '--yolo'],
17
+ modelFlag: '--model',
16
18
  supportsFileReferences: false,
17
19
  },
18
20
  opencode: {
19
- command: 'opencode',
21
+ command: process.env.HOME + '/.opencode/bin/opencode',
20
22
  flags: ['run', '--format', 'json'],
23
+ modelFlag: '--model',
21
24
  supportsFileReferences: true,
22
25
  },
23
26
  };
@@ -68,6 +68,15 @@ export interface WorkflowConfig {
68
68
  * @default 60
69
69
  */
70
70
  prdInterval: number;
71
+ /**
72
+ * Model to use for AI provider
73
+ *
74
+ * Format varies by provider:
75
+ * - Claude: claude-opus-4-5-20251101, claude-sonnet-4-5-20250929
76
+ * - Gemini: gemini-2.5-pro, gemini-2.5-flash
77
+ * - OpenCode: anthropic/claude-3-5-sonnet, openai/gpt-4o
78
+ */
79
+ model?: string;
71
80
  /**
72
81
  * Filename prefix for generated files
73
82
  *
@@ -157,7 +157,8 @@ export class ClaudeAgentRunner {
157
157
  await writeFile(tempFile, prompt, 'utf8');
158
158
  // Build command with temp file
159
159
  const flags = this.config.flags.join(' ');
160
- const command = `${this.config.command} ${flags} < "${tempFile}"`;
160
+ const modelArg = options.model ? `${this.config.modelFlag} ${options.model}` : '';
161
+ const command = `${this.config.command} ${flags} ${modelArg} < "${tempFile}"`.replace(/\s+/g, ' ').trim();
161
162
  // Log the command being executed
162
163
  this.logger.info({
163
164
  promptLength: prompt.length,
@@ -150,7 +150,8 @@ export class GeminiAgentRunner {
150
150
  .replaceAll('$', String.raw `\$`);
151
151
  // Build command with provider config flags
152
152
  // Gemini uses -p flag which expects the prompt as the next argument
153
- const command = `${this.config.command} -p "${escapedPrompt}" --yolo < /dev/null`;
153
+ const modelArg = options.model ? `${this.config.modelFlag} ${options.model}` : '';
154
+ const command = `${this.config.command} -p "${escapedPrompt}" --yolo ${modelArg} < /dev/null`.replace(/\s+/g, ' ').trim();
154
155
  // Log the command being executed (truncated for readability)
155
156
  this.logger.info({
156
157
  commandLength: command.length,
@@ -155,10 +155,11 @@ export class OpenCodeAgentRunner {
155
155
  tempDir = await mkdtemp(join(tmpdir(), 'opencode-prompt-'));
156
156
  tempFile = join(tempDir, 'prompt.txt');
157
157
  await writeFile(tempFile, prompt, 'utf8');
158
- // Build command with --file flag (Open Code specific)
159
- // Format: opencode run --format json --file "${tempFile}"
158
+ // Build command - use stdin to pass the prompt (handles newlines better)
159
+ // Format: cat tempfile | opencode run --format json [--model provider/model] -
160
160
  const flags = this.config.flags.join(' ');
161
- const command = `${this.config.command} ${flags} --file "${tempFile}"`;
161
+ const modelArg = options.model ? `${this.config.modelFlag} ${options.model}` : '';
162
+ const command = `cat "${tempFile}" | ${this.config.command} ${flags} ${modelArg} -`.replace(/\s+/g, ' ').trim();
162
163
  // Log the command being executed
163
164
  this.logger.info({
164
165
  command,
@@ -263,47 +264,65 @@ export class OpenCodeAgentRunner {
263
264
  if (!stdoutData || stdoutData.trim().length === 0) {
264
265
  return '';
265
266
  }
266
- try {
267
- const parsed = JSON.parse(stdoutData);
268
- // Try common JSON response structures
269
- // Open Code may output different structures depending on version
270
- if (typeof parsed === 'string') {
271
- return parsed;
272
- }
273
- if (parsed.content) {
274
- return String(parsed.content);
275
- }
276
- if (parsed.message) {
277
- return String(parsed.message);
278
- }
279
- if (parsed.response) {
280
- return String(parsed.response);
281
- }
282
- if (parsed.output) {
283
- return String(parsed.output);
284
- }
285
- if (parsed.text) {
286
- return String(parsed.text);
287
- }
288
- // If we have a result array, try to extract content
289
- if (Array.isArray(parsed)) {
290
- const messages = parsed
291
- .filter((item) => item.type === 'message' || item.content || item.text)
292
- .map((item) => item.content || item.text || item.message || '')
293
- .filter(Boolean);
294
- if (messages.length > 0) {
295
- return messages.join('\n');
267
+ // Open Code outputs NDJSON (newline-delimited JSON)
268
+ // Each line is a separate JSON object: step_start, text, step_finish
269
+ // We need to extract the "text" from entries with type="text"
270
+ const lines = stdoutData.trim().split('\n');
271
+ const textParts = [];
272
+ for (const line of lines) {
273
+ if (!line.trim())
274
+ continue;
275
+ try {
276
+ const parsed = JSON.parse(line);
277
+ // Handle JSON string (like "Just a string")
278
+ if (typeof parsed === 'string') {
279
+ textParts.push(parsed);
280
+ continue;
296
281
  }
282
+ // Handle JSON array
283
+ if (Array.isArray(parsed)) {
284
+ for (const item of parsed) {
285
+ if (item.content)
286
+ textParts.push(item.content);
287
+ else if (item.text)
288
+ textParts.push(item.text);
289
+ else if (item.message)
290
+ textParts.push(item.message);
291
+ }
292
+ continue;
293
+ }
294
+ // Extract text from "text" type entries (Open Code NDJSON format)
295
+ if (parsed.type === 'text' && parsed.part?.text) {
296
+ textParts.push(parsed.part.text);
297
+ }
298
+ else if (parsed.text) {
299
+ textParts.push(parsed.text);
300
+ }
301
+ else if (parsed.content) {
302
+ textParts.push(parsed.content);
303
+ }
304
+ else if (parsed.message) {
305
+ textParts.push(parsed.message);
306
+ }
307
+ else if (parsed.response) {
308
+ textParts.push(parsed.response);
309
+ }
310
+ else if (parsed.output) {
311
+ textParts.push(parsed.output);
312
+ }
313
+ }
314
+ catch {
315
+ // If line isn't valid JSON, it might be plain text output
316
+ this.logger.debug({ lineLength: line.length }, 'Line is not JSON, treating as plain text');
317
+ textParts.push(line);
297
318
  }
298
- // Fallback: stringify the parsed object
299
- this.logger.debug({ parsedKeys: Object.keys(parsed) }, 'Unknown JSON structure, returning stringified');
300
- return JSON.stringify(parsed, null, 2);
301
319
  }
302
- catch {
303
- // JSON parsing failed, return raw output
304
- this.logger.debug({ stdoutLength: stdoutData.length }, 'JSON parsing failed, returning raw output');
305
- return stdoutData;
320
+ if (textParts.length > 0) {
321
+ return textParts.join('\n');
306
322
  }
323
+ // Fallback: return raw output
324
+ this.logger.debug({ stdoutLength: stdoutData.length }, 'No text extracted, returning raw output');
325
+ return stdoutData;
307
326
  }
308
327
  /**
309
328
  * Build detailed error context for debugging process failures
@@ -41,6 +41,7 @@ export class TaskDecompositionService {
41
41
  // Execute Claude agent to generate task graph
42
42
  const result = await this.agentRunner.runAgent(prompt, {
43
43
  agentType: (options.agent ?? 'architect'),
44
+ model: options.model,
44
45
  references: options.contextFiles,
45
46
  timeout: options.taskTimeout ?? 600_000, // 10 min default for planning
46
47
  });
@@ -119,6 +119,8 @@ export interface DecomposeOptions {
119
119
  goal: string;
120
120
  /** Maximum number of tasks to run in parallel */
121
121
  maxParallel?: number;
122
+ /** Model to use for AI provider */
123
+ model?: string;
122
124
  /** Enable per-file task generation for file-heavy operations */
123
125
  perFile?: boolean;
124
126
  /** Plan only without executing */
@@ -23,6 +23,7 @@
23
23
  export declare const agentFlags: {
24
24
  agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
25
  cwd: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ model: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
27
  provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
27
28
  task: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
29
  };
@@ -30,6 +30,10 @@ export const agentFlags = {
30
30
  description: 'Working directory path to pass to AI agents. Agents will operate in this directory.',
31
31
  helpGroup: 'Agent Customization',
32
32
  }),
33
+ model: Flags.string({
34
+ description: 'Model to use for AI provider. Format varies by provider: Claude (claude-opus-4-5-20251101), Gemini (gemini-2.5-pro), OpenCode (anthropic/claude-3-5-sonnet)',
35
+ helpGroup: 'Agent Customization',
36
+ }),
33
37
  provider: Flags.string({
34
38
  default: 'claude',
35
39
  description: 'AI provider to use (claude, gemini, or opencode). Defaults to claude.',
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.8",
4
+ "version": "1.0.10",
5
5
  "author": {
6
6
  "name": "DevSquad",
7
7
  "email": "marcelo@devsquad.email",