@hyperdrive.bot/bmad-workflow 1.0.15 → 1.0.17
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.
|
@@ -147,6 +147,14 @@ export default class Workflow extends Command {
|
|
|
147
147
|
async run() {
|
|
148
148
|
const { args, flags } = await this.parse(Workflow);
|
|
149
149
|
try {
|
|
150
|
+
// Early validation: check input file exists before initializing anything
|
|
151
|
+
const inputPath = args.input;
|
|
152
|
+
if (!inputPath.includes('*') && !inputPath.includes('?')) {
|
|
153
|
+
const { existsSync } = await import('node:fs');
|
|
154
|
+
if (!existsSync(inputPath)) {
|
|
155
|
+
this.error(`File not found: ${inputPath}`, { exit: 1 });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
150
158
|
// Validate provider
|
|
151
159
|
if (!isProviderSupported(flags.provider)) {
|
|
152
160
|
this.error(`Unsupported provider: ${flags.provider}. Use 'claude', 'gemini', or 'opencode'.`, { exit: 1 });
|
|
@@ -208,7 +216,7 @@ export default class Workflow extends Command {
|
|
|
208
216
|
this.log('\n' + colors.success('✓ Workflow completed successfully!'));
|
|
209
217
|
}
|
|
210
218
|
catch (error) {
|
|
211
|
-
this.logger
|
|
219
|
+
this.logger?.error({ error: error.message }, 'Workflow command failed');
|
|
212
220
|
// Display user-friendly error
|
|
213
221
|
this.log('\n' + colors.error('✗ Workflow failed:'));
|
|
214
222
|
this.log(colors.error(` ${error.message}`));
|
|
@@ -338,6 +338,12 @@ Write output to: ${outputPath}`;
|
|
|
338
338
|
this.logger.info({ input }, 'Detecting input type');
|
|
339
339
|
try {
|
|
340
340
|
const result = await this.inputDetector.detect(input);
|
|
341
|
+
// Fail loudly when input type cannot be determined
|
|
342
|
+
if (result.type === null) {
|
|
343
|
+
const reason = result.error || 'Could not determine input type';
|
|
344
|
+
this.logger.error({ input, reason }, 'Input detection failed');
|
|
345
|
+
throw new ValidationError(reason, { input });
|
|
346
|
+
}
|
|
341
347
|
this.logger.info({
|
|
342
348
|
filePath: result.filePath,
|
|
343
349
|
inputType: result.type,
|
|
@@ -346,6 +352,8 @@ Write output to: ${outputPath}`;
|
|
|
346
352
|
return result;
|
|
347
353
|
}
|
|
348
354
|
catch (error) {
|
|
355
|
+
if (error instanceof ValidationError)
|
|
356
|
+
throw error;
|
|
349
357
|
this.logger.error({ error: error.message, input }, 'Failed to detect input type');
|
|
350
358
|
throw new ValidationError(`Failed to detect input type: ${error.message}`, {
|
|
351
359
|
input,
|
package/package.json
CHANGED