#!/usr/bin/env bun import { install } from './install'; import type { BooleanArg, InstallArgs } from './types'; function parseArgs(args: string[]): InstallArgs { const result: InstallArgs = { tui: true, skills: 'yes', }; for (const arg of args) { if (arg === '--no-tui') { result.tui = false; } else if (arg.startsWith('--skills=')) { result.skills = arg.split('=')[1] as BooleanArg; } else if (arg === '--dry-run') { result.dryRun = true; } else if (arg === '--reset') { result.reset = true; } else if (arg === '-h' || arg === '--help') { printHelp(); process.exit(0); } } return result; } function printHelp(): void { console.log(` oh-my-opencode-slim installer Usage: bunx oh-my-opencode-slim install [OPTIONS] Options: --skills=yes|no Install recommended and bundled skills (default: yes) --no-tui Non-interactive mode --dry-run Simulate install without writing files --reset Force overwrite of existing configuration -h, --help Show this help message The installer generates an OpenAI configuration by default. For the full config reference, see docs/configuration.md. Examples: bunx oh-my-opencode-slim install bunx oh-my-opencode-slim install --no-tui --skills=yes bunx oh-my-opencode-slim install --reset `); } async function main(): Promise { const args = process.argv.slice(2); if (args.length === 0 || args[0] === 'install') { const hasSubcommand = args[0] === 'install'; const installArgs = parseArgs(args.slice(hasSubcommand ? 1 : 0)); const exitCode = await install(installArgs); process.exit(exitCode); } else if (args[0] === '-h' || args[0] === '--help') { printHelp(); process.exit(0); } else { console.error(`Unknown command: ${args[0]}`); console.error('Run with --help for usage information'); process.exit(1); } } main().catch((err) => { console.error('Fatal error:', err); process.exit(1); });