#!/usr/bin/env node import { Command } from 'commander'; import chalk from 'chalk'; import { initCommand } from './commands/init'; import { pullCommand } from './commands/pull'; import { pushCommand } from './commands/push'; import { statusCommand } from './commands/status'; const program = new Command(); program .name('kisync') .description('CLI tool for syncing local folders with KIS API Builder') .version('1.0.0'); program .command('init') .description('Initialize a new kisync project in the current directory') .action(async () => { try { await initCommand(); } catch (err: any) { console.error(chalk.red(`Error: ${err.message}`)); process.exit(1); } }); program .command('pull') .description('Download all endpoints from server to local files') .option('--force', 'Overwrite local changes without prompting') .action(async (opts) => { try { await pullCommand(opts.force); } catch (err: any) { console.error(chalk.red(`Error: ${err.message}`)); process.exit(1); } }); program .command('push') .description('Upload local changes to server') .option('--force', 'Force push, overwriting server changes') .action(async (opts) => { try { await pushCommand(opts.force); } catch (err: any) { console.error(chalk.red(`Error: ${err.message}`)); process.exit(1); } }); program .command('status') .description('Show sync status — what changed locally and on server') .action(async () => { try { await statusCommand(); } catch (err: any) { console.error(chalk.red(`Error: ${err.message}`)); process.exit(1); } }); program.parse();