handleCreate function
Handle create command
Implementation
Future<void> handleCreate(
Map<String, dynamic> args,
Map<String, dynamic> flags,
) async {
UserPrompt.printBanner(
'Oracular Project Creator',
subtitle: 'Arcane Template System',
);
// Check required tools first
final skipCheck = flags['skip-check'] == true;
if (!skipCheck) {
final checker = ToolChecker();
final result = await checker.checkRequired();
if (!result.allRequiredInstalled) {
error(
'Required tools are missing. Run "oracular check tools" for details.',
);
exit(1);
}
}
final yes = flags['yes'] == true;
// Gather configuration
final config = await _gatherConfig(
appName: args['app-name'] as String?,
org: args['org'] as String?,
template: args['template'] as String?,
className: args['class-name'] as String?,
outputDir: args['output-dir'] as String?,
withModels: flags['with-models'] == true,
withServer: flags['with-server'] == true,
withFirebase: flags['with-firebase'] == true,
firebaseProjectId: args['firebase-project-id'] as String?,
withCloudRun: flags['with-cloud-run'] == true,
serviceAccountKey: args['service-account-key'] as String?,
renderMode: args['render-mode'] as String?,
interactive: !yes,
);
// Show config and confirm
if (!yes) {
UserPrompt.printConfigPreview(config.toDisplayMap());
final confirmed = await UserPrompt.askYesNo('Proceed with these settings?');
if (!confirmed) {
warn('Operation cancelled');
return;
}
}
// Execute creation
await _executeCreation(config, nonInteractive: yes);
}