commandsTree top-level property

List<DartedCommand> commandsTree
final

All CLI commands for Oracular

Implementation

final List<DartedCommand> commandsTree = [
  // Create command
  DartedCommand(
    name: 'create',
    helperDescription: 'Create new Arcane projects (Flutter or Dart)',
    arguments: [
      DartedArgument(name: 'app-name', abbreviation: 'n'),
      DartedArgument(name: 'org', abbreviation: 'o', defaultValue: 'com.example'),
      DartedArgument(name: 'template', abbreviation: 't'),
      DartedArgument(name: 'class-name', abbreviation: 'c'),
      DartedArgument(name: 'output-dir', abbreviation: 'd'),
      DartedArgument(name: 'firebase-project-id', abbreviation: 'p'),
      DartedArgument(name: 'service-account-key', abbreviation: 'k'),
      DartedArgument(
        name: 'render-mode',
        abbreviation: 'R',
        description:
            'Jaspr render mode: csr | ssg | ssr | hybrid | embed '
            '(only meaningful for Jaspr templates; defaults derived from template).',
      ),
    ],
    flags: [
      DartedFlag(name: 'with-models', abbreviation: 'm'),
      DartedFlag(name: 'with-server', abbreviation: 's'),
      DartedFlag(name: 'with-firebase', abbreviation: 'f'),
      DartedFlag(name: 'with-cloud-run', abbreviation: 'r'),
      DartedFlag(name: 'yes', abbreviation: 'y'),
      DartedFlag(name: 'skip-check', abbreviation: 'x'),
      DartedFlag.help,
    ],
    callback: (args, flags) => handleCreate(_argsMap(args), _boolToMap(flags)),
    subCommands: [
      DartedCommand(
        name: 'templates',
        helperDescription: 'List available templates',
        callback: (args, flags) => handleListTemplates(_argsMap(args), _boolToMap(flags)),
      ),
    ],
  ),

  // Guide command
  DartedCommand(
    name: 'guide',
    helperDescription: 'Generate and print the project setup guide',
    flags: [
      DartedFlag(name: 'print', abbreviation: 'p'),
      DartedFlag.help,
    ],
    callback: (args, flags) => handleGuide(_argsMap(args), _boolToMap(flags)),
  ),

  // Open command
  DartedCommand(
    name: 'open',
    helperDescription: 'Open project folders and setup consoles',
    arguments: [
      DartedArgument(
        name: 'target',
        abbreviation: 't',
        isMainReq: true,
        description: 'guide, app, firebase, auth, firestore, storage, hosting',
      ),
    ],
    callback: (args, _) => handleOpenTarget((_argsMap(args)['target'] ?? '').toString()),
  ),

  // Check command
  DartedCommand(
    name: 'check',
    helperDescription: 'Check CLI tool availability',
    callback: (_, _) => handleCheckTools(),
    subCommands: [
      DartedCommand(
        name: 'tools',
        helperDescription: 'Check all tools (required and optional)',
        callback: (_, _) => handleCheckTools(),
      ),
      DartedCommand(
        name: 'flutter',
        helperDescription: 'Check Flutter installation',
        callback: (_, _) => handleCheckFlutter(),
      ),
      DartedCommand(
        name: 'firebase',
        helperDescription: 'Check Firebase CLI tools',
        callback: (_, _) => handleCheckFirebase(),
      ),
      DartedCommand(
        name: 'docker',
        helperDescription: 'Check Docker installation',
        callback: (_, _) => handleCheckDocker(),
      ),
      DartedCommand(
        name: 'gcloud',
        helperDescription: 'Check Google Cloud SDK',
        callback: (_, _) => handleCheckGcloud(),
      ),
      DartedCommand(
        name: 'doctor',
        helperDescription: 'Run flutter doctor',
        callback: (_, _) => handleDoctor(),
      ),
      DartedCommand(
        name: 'server',
        helperDescription: 'Check server deployment tools',
        callback: (_, _) => handleCheckServer(),
      ),
      DartedCommand(
        name: 'billing',
        helperDescription:
            'Check Firebase billing plan (Spark vs Blaze)',
        callback: (_, _) => handleCheckBilling(),
      ),
    ],
  ),

  // Build command — produce every artifact this project ships, in a
  // mode-aware way. Distinct from `deploy`: `build` never pushes images
  // or runs `firebase deploy`. Always safe to run.
  DartedCommand(
    name: 'build',
    helperDescription: 'Build artifacts (Flutter platforms, Jaspr, embed, images)',
    callback: (_, _) => _printBuildHelp(),
    subCommands: [
      // NOTE: every leaf name below MUST be globally unique across the
      // entire command tree. darted_cli flattens subcommands by leaf
      // name when matching the call stack, so `build flutter` would
      // otherwise resolve to `check flutter`. See commands.dart:130.
      DartedCommand(
        name: 'everything',
        helperDescription:
            'Build every artifact applicable to this project',
        callback: (_, _) => handleBuildAll(),
      ),
      DartedCommand(
        name: 'flutter-app',
        helperDescription:
            'Build Flutter platforms (defaults to every platform in setup_config.env)',
        arguments: [
          DartedArgument(
            name: 'platform',
            abbreviation: 'p',
            description:
                'Single platform to build (web, ios, android, macos, linux, windows). '
                'Omit to build every platform listed in setup_config.env.',
          ),
        ],
        flags: [DartedFlag.help],
        callback: (args, _) => handleBuildFlutter(_argsMap(args)),
      ),
      DartedCommand(
        name: 'jaspr-site',
        helperDescription:
            'Build the Jaspr site (render-mode aware: CSR / SSG / SSR / Hybrid / Embed)',
        callback: (_, _) => handleBuildJaspr(),
      ),
      DartedCommand(
        name: 'jaspr-image',
        helperDescription:
            'Build the Cloud Run image for the Jaspr server (SSR / hybrid only)',
        callback: (_, _) => handleBuildJasprServer(),
      ),
      DartedCommand(
        name: 'flutter-embed',
        helperDescription:
            'Build the Flutter web guest + Jaspr host bundle (embed template only)',
        callback: (_, _) => handleBuildFlutterEmbed(),
      ),
      DartedCommand(
        name: 'cli-binary',
        helperDescription:
            'Compile the Dart CLI to a native binary (arcane_cli_app only)',
        callback: (_, _) => handleBuildCli(),
      ),
    ],
  ),

  // Deploy command
  DartedCommand(
    name: 'deploy',
    helperDescription: 'Firebase and server deployment',
    callback: (_, _) => _printDeployHelp(),
    subCommands: [
      DartedCommand(
        name: 'firestore',
        helperDescription: 'Deploy Firestore rules and indexes',
        callback: (_, _) => handleDeployFirestore(),
      ),
      DartedCommand(
        name: 'storage',
        helperDescription: 'Deploy Storage rules',
        callback: (_, _) => handleDeployStorage(),
      ),
      DartedCommand(
        name: 'hosting',
        helperDescription: 'Deploy to Firebase Hosting (release)',
        callback: (_, _) => handleDeployHosting(),
      ),
      DartedCommand(
        name: 'hosting-beta',
        helperDescription: 'Deploy to Firebase Hosting (beta)',
        callback: (_, _) => handleDeployHostingBeta(),
      ),
      DartedCommand(
        name: 'jaspr-server',
        helperDescription:
            'Build + push + deploy the Jaspr server to Cloud Run (SSR / hybrid)',
        callback: (_, _) => handleDeployJasprServer(),
      ),
      DartedCommand(
        name: 'arcane-server',
        helperDescription:
            'Build + push + deploy the arcane_server companion to Cloud Run',
        callback: (_, _) => handleDeployServer(),
      ),
      DartedCommand(
        name: 'all',
        helperDescription: 'Deploy all Firebase resources',
        callback: (_, _) => handleDeployAll(),
      ),
      DartedCommand(
        name: 'firebase-setup',
        helperDescription:
            'Setup Firebase for a new project (alias of firebase-setup-full)',
        callback: (_, _) => handleFirebaseSetupFull(),
      ),
      DartedCommand(
        name: 'firebase-setup-full',
        helperDescription:
            'End-to-end Firebase setup: billing, init, auth, hosting, deploy',
        callback: (_, _) => handleFirebaseSetupFull(),
      ),
      DartedCommand(
        name: 'hosting-init',
        helperDescription:
            'Create the <project>-beta hosting site and apply targets',
        callback: (_, _) => handleHostingInit(),
      ),
      DartedCommand(
        name: 'firestore-init',
        helperDescription:
            'Ensure the default Firestore database exists',
        callback: (_, _) => handleFirestoreInit(),
      ),
      DartedCommand(
        name: 'storage-init',
        helperDescription: 'Ensure the default Storage bucket exists',
        callback: (_, _) => handleStorageInit(),
      ),
      DartedCommand(
        name: 'auth-providers',
        helperDescription:
            'Enable Email/Password and Google sign-in (best-effort + console hand-off)',
        callback: (_, _) => handleAuthProviders(),
      ),
      DartedCommand(
        name: 'artifact-cleanup',
        helperDescription:
            'Apply Artifact Registry cleanup policy for the server image',
        callback: (_, _) => handleArtifactCleanup(),
      ),
      DartedCommand(
        name: 'cloudrun-prune',
        helperDescription:
            'Prune Cloud Run revisions to the configured retention count',
        callback: (_, _) => handleCloudRunPrune(),
      ),
      DartedCommand(
        name: 'generate-configs',
        helperDescription: 'Generate Firebase configuration files',
        arguments: [
          DartedArgument(
            name: 'hybrid-dynamic-prefix',
            abbreviation: 'H',
          ),
        ],
        callback: (args, _) => handleGenerateConfigs(_argsMap(args)),
      ),
      DartedCommand(
        name: 'server-setup',
        helperDescription: 'Setup server for deployment',
        callback: (_, _) => handleServerSetup(),
      ),
      DartedCommand(
        name: 'server-build',
        helperDescription: 'Build server Docker image',
        callback: (_, _) => handleServerBuild(),
      ),
    ],
  ),

  // Config command
  DartedCommand(
    name: 'config',
    helperDescription: 'Configuration management',
    callback: (_, _) => handleConfigList(),
    subCommands: [
      DartedCommand(
        name: 'init',
        helperDescription: 'Initialize configuration file',
        flags: [DartedFlag(name: 'force', abbreviation: 'f')],
        callback: (args, flags) => handleConfigInit(_argsMap(args), _boolToMap(flags)),
      ),
      DartedCommand(
        name: 'get',
        helperDescription: 'Get a configuration value',
        arguments: [DartedArgument(name: 'key', abbreviation: 'k')],
        callback: (args, flags) => handleConfigGet(_argsMap(args), _boolToMap(flags)),
      ),
      DartedCommand(
        name: 'set',
        helperDescription: 'Set a configuration value',
        arguments: [
          DartedArgument(name: 'key', abbreviation: 'k'),
          DartedArgument(name: 'value', abbreviation: 'v'),
        ],
        callback: (args, flags) => handleConfigSet(_argsMap(args), _boolToMap(flags)),
      ),
      DartedCommand(
        name: 'list',
        helperDescription: 'List all configuration values',
        callback: (_, _) => handleConfigList(),
      ),
      DartedCommand(
        name: 'path',
        helperDescription: 'Show configuration file path',
        callback: (_, _) => handleConfigPath(),
      ),
    ],
  ),

  // Scripts command
  DartedCommand(
    name: 'scripts',
    helperDescription: 'Run scripts from pubspec.yaml',
    callback: (_, _) => handleScriptsList(),
    subCommands: [
      DartedCommand(
        name: 'list',
        helperDescription: 'List available scripts',
        callback: (_, _) => handleScriptsList(),
      ),
      DartedCommand(
        name: 'exec',
        helperDescription: 'Execute a script',
        arguments: [DartedArgument(name: 'script', abbreviation: 's')],
        flags: [DartedFlag(name: 'stream', abbreviation: 't')],
        callback: (args, flags) => handleScriptsExec(_argsMap(args), _boolToMap(flags)),
      ),
    ],
  ),

  // Templates command
  DartedCommand(
    name: 'templates',
    helperDescription: 'Manage template cache',
    callback: (_, _) => handleTemplatesStatus(),
    subCommands: [
      DartedCommand(
        name: 'status',
        helperDescription: 'Show template cache status',
        callback: (_, _) => handleTemplatesStatus(),
      ),
      DartedCommand(
        name: 'update',
        helperDescription: 'Download/update templates from GitHub',
        callback: (_, _) => handleTemplatesUpdate(),
      ),
      DartedCommand(
        name: 'clear',
        helperDescription: 'Clear the template cache',
        callback: (_, _) => handleTemplatesClear(),
      ),
      DartedCommand(
        name: 'path',
        helperDescription: 'Show template cache path',
        callback: (_, _) => handleTemplatesPath(),
      ),
    ],
  ),

  // Gitignore command
  DartedCommand(
    name: 'gitignore',
    helperDescription: 'Add standard .gitignore to current directory',
    flags: [
      DartedFlag(name: 'force', abbreviation: 'f'),
    ],
    callback: (args, flags) => handleGitignore(_argsMap(args), _boolToMap(flags)),
  ),

  // Rebuild / refresh command
  DartedCommand(
    name: 'rebuild',
    helperDescription:
        'Purge managed folders + rescaffold from saved config (Firebase untouched)',
    arguments: [
      DartedArgument(
        name: 'config',
        abbreviation: 'c',
        description: 'Path to setup_config.env (defaults to ./config/setup_config.env)',
      ),
      DartedArgument(
        name: 'output-dir',
        abbreviation: 'd',
        description: 'Project root that contains config/setup_config.env',
      ),
    ],
    flags: [
      DartedFlag(name: 'yes', abbreviation: 'y'),
      DartedFlag(name: 'dry-run', abbreviation: 'n'),
      DartedFlag.help,
    ],
    callback: (args, flags) => handleRebuild(_argsMap(args), _boolToMap(flags)),
  ),

  // Refresh — alias of rebuild for muscle memory.
  DartedCommand(
    name: 'refresh',
    helperDescription: 'Alias of `oracular rebuild`',
    arguments: [
      DartedArgument(name: 'config', abbreviation: 'c'),
      DartedArgument(name: 'output-dir', abbreviation: 'd'),
    ],
    flags: [
      DartedFlag(name: 'yes', abbreviation: 'y'),
      DartedFlag(name: 'dry-run', abbreviation: 'n'),
      DartedFlag.help,
    ],
    callback: (args, flags) => handleRebuild(_argsMap(args), _boolToMap(flags)),
  ),

  // Update command — surgical updates to existing projects (IDE wiring,
  // run configurations, etc.) without re-running the full wizard.
  DartedCommand(
    name: 'update',
    helperDescription: 'Update IDE wiring and project assets in-place',
    callback: (_, _) => _printUpdateHelp(),
    subCommands: [
      DartedCommand(
        name: 'runs',
        helperDescription:
            'Add/refresh IntelliJ run configs (Deploy All + Jaspr Serve/Build/Killall)',
        arguments: [
          DartedArgument(
            name: 'port',
            abbreviation: 'p',
            description:
                'Port for jaspr serve / killall (default: 8080)',
            defaultValue: '8080',
          ),
          DartedArgument(
            name: 'dir',
            abbreviation: 'd',
            description:
                'Project root containing config/setup_config.env (default: cwd)',
          ),
        ],
        flags: [
          DartedFlag.help,
        ],
        callback: (args, _) => handleUpdateRuns(_argsMap(args)),
      ),
    ],
  ),

  // Version command
  DartedCommand(
    name: 'version',
    helperDescription: 'Show version information',
    callback: (_, _) {
      print('Oracular CLI v$oracularVersion');
      print('Arcane Template System');
    },
  ),
];