#!/usr/bin/env node import chalk from 'chalk' import { Command } from 'commander' import { render } from 'ink' import { App } from './components/App.js' import type { GitHubOptions } from './types/index.js' const program = new Command() program .name('bulk-private') .version('0.1.2') .description('Bulk private GitHub repositories') .option( '-t, --token ', 'GitHub personal access token (or use GITHUB_TOKEN env var)', ) .option( '-d, --dry-run', 'Run in dry mode without making actual changes', false, ) .option( '-l, --limit ', 'Limit the number of repositories to process', parseInt, ) .action(async (options) => { // Get token from options or environment const token = options.token || process.env['GITHUB_TOKEN'] if (!token) { console.error(chalk.red('Error: GitHub token is required')) console.error( chalk.yellow( 'Please provide a token using --token option or GITHUB_TOKEN environment variable', ), ) console.error( chalk.gray( 'You can create a token at: https://github.com/settings/tokens', ), ) console.error(chalk.gray('Required scopes: repo')) process.exit(1) } const appOptions: GitHubOptions = { token, dryRun: options.dryRun, limit: options.limit, } render() }) program.parse()