41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { Command } from 'commander';
|
|
import chalk from 'chalk';
|
|
import {
|
|
createCreateCommand,
|
|
createListCommand,
|
|
createStatusCommand,
|
|
createMergeCommand,
|
|
createDestroyCommand,
|
|
createDiffCommand
|
|
} from './commands';
|
|
import { loadGlobalConfig } from './utils/file-utils';
|
|
|
|
const program = new Command();
|
|
|
|
program
|
|
.name('git-agent-sync')
|
|
.alias('gas')
|
|
.description('Manage isolated git worktrees for AI coding agents')
|
|
.version('1.0.0')
|
|
.addCommand(createCreateCommand())
|
|
.addCommand(createListCommand())
|
|
.addCommand(createStatusCommand())
|
|
.addCommand(createMergeCommand())
|
|
.addCommand(createDestroyCommand())
|
|
.addCommand(createDiffCommand())
|
|
.configureHelp({
|
|
subcommandTerm: (cmd) => cmd.name(),
|
|
argumentTerm: (arg) => `<${arg}>`,
|
|
optionTerm: (opt) => opt.short ? `-${opt.short}, --${opt.long}` : `--${opt.long}`
|
|
})
|
|
.addHelpCommand('help', 'Show help for a command');
|
|
|
|
program.parse();
|
|
|
|
process.on('unhandledRejection', (reason: any) => {
|
|
console.error(chalk.red('\n❌ Unhandled error:'), reason?.message || reason);
|
|
process.exit(1);
|
|
});
|