fix(cli): allow ccs copilot as profile by routing only known subcommands

Changed copilot command routing logic to only intercept known subcommands
(auth, status, models, start, stop, enable, disable, help). When user runs
bare 'ccs copilot' without subcommands, it now falls through to profile
detection and executes Claude with the Copilot API backend.

This allows:
- `ccs copilot auth` → command handler (authenticate)
- `ccs copilot status` → command handler (show status)
- `ccs copilot` → profile execution (run Claude with Copilot)
This commit is contained in:
kaitranntt
2025-12-18 04:47:44 -05:00
parent 3a7cb0c4e8
commit 2c6dfe746b
+15 -2
View File
@@ -339,8 +339,21 @@ async function main(): Promise<void> {
}
// Special case: copilot command (GitHub Copilot integration)
if (firstArg === 'copilot') {
// `ccs copilot [subcommand]` - route to copilot command handler
// Only route to command handler for known subcommands, otherwise treat as profile
const COPILOT_SUBCOMMANDS = [
'auth',
'status',
'models',
'start',
'stop',
'enable',
'disable',
'help',
'--help',
'-h',
];
if (firstArg === 'copilot' && args.length > 1 && COPILOT_SUBCOMMANDS.includes(args[1])) {
// `ccs copilot <subcommand>` - route to copilot command handler
const { handleCopilotCommand } = await import('./commands/copilot-command');
const exitCode = await handleCopilotCommand(args.slice(1));
process.exit(exitCode);