run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<void> run() async {
final manualFlag = argResults?['manual'] as bool? ?? false;
final legacyFlag = argResults?['legacy'] as bool? ?? false;
final workflowPath = argResults?['workflow'] as String? ?? 'WORKFLOW.md';
final config = await _configService.loadConfig();
final modeStr = config.executionMode ?? 'automatic';
final mode = ExecutionMode.values.firstWhere(
(m) => m.name == modeStr,
orElse: () => ExecutionMode.automatic,
);
if (manualFlag || mode == ExecutionMode.manual) {
_runManualMode();
return;
}
final useWorkflow = !legacyFlag && File(workflowPath).existsSync();
if (useWorkflow) {
await _runWorkflowMode(workflowPath);
} else {
if (!File('WORKFLOW.md').existsSync()) {
logger.warn(
'WORKFLOW.md not found. Falling back to legacy convoy mode. '
'Run `spectra new` to scaffold a WORKFLOW.md.',
);
}
await _runLegacyMode();
}
}