mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 22:15:33 +00:00
fix(cursor): export missing symbols, eliminate subcommand sync risk, improve tests
- Export detectProvider and formatModelName from barrel index - Export CURSOR_SUBCOMMANDS from cursor-command.ts, import in ccs.ts - Use getCcsDir() in tests instead of manual path construction - Add handleCursorCommand routing test for unknown subcommand
This commit is contained in:
1 parent
cda037e7e5
commit
934238740e
4 files changed
+50
-25
No files matched your search
+9
-7
@@ -536,13 +536,15 @@ async function main(): Promise<void> {
|
||||
// Only route to command handler for known subcommands, otherwise treat as profile
|
||||
// Note: Bare `ccs cursor` shows help (unlike copilot which falls through to profile)
|
||||
// This is intentional — cursor has no profile-switching mode
|
||||
// Keep in sync with cursor-command.ts switch cases
|
||||
const CURSOR_SUBCOMMANDS = ['auth', 'status', 'models', 'start', 'stop', 'help', '--help', '-h'];
|
||||
if (firstArg === 'cursor' && (args.length === 1 || CURSOR_SUBCOMMANDS.includes(args[1]))) {
|
||||
// `ccs cursor <subcommand>` - route to cursor command handler
|
||||
const { handleCursorCommand } = await import('./commands/cursor-command');
|
||||
const exitCode = await handleCursorCommand(args.slice(1));
|
||||
process.exit(exitCode);
|
||||
if (firstArg === 'cursor') {
|
||||
const { handleCursorCommand, CURSOR_SUBCOMMANDS } = await import('./commands/cursor-command');
|
||||
if (
|
||||
args.length === 1 ||
|
||||
CURSOR_SUBCOMMANDS.includes(args[1] as (typeof CURSOR_SUBCOMMANDS)[number])
|
||||
) {
|
||||
const exitCode = await handleCursorCommand(args.slice(1));
|
||||
process.exit(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
// Special case: copilot command (GitHub Copilot integration)
|
||||
|
||||
@@ -23,6 +23,18 @@ const DEFAULT_CURSOR_CONFIG = {
|
||||
model: DEFAULT_CURSOR_MODEL,
|
||||
};
|
||||
|
||||
/** Valid cursor subcommands — imported by ccs.ts for routing */
|
||||
export const CURSOR_SUBCOMMANDS = [
|
||||
'auth',
|
||||
'status',
|
||||
'models',
|
||||
'start',
|
||||
'stop',
|
||||
'help',
|
||||
'--help',
|
||||
'-h',
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Handle cursor subcommand.
|
||||
*/
|
||||
|
||||
@@ -29,6 +29,8 @@ export {
|
||||
fetchModelsFromDaemon,
|
||||
getAvailableModels,
|
||||
getDefaultModel,
|
||||
detectProvider,
|
||||
formatModelName,
|
||||
} from './cursor-models';
|
||||
|
||||
// Executor
|
||||
|
||||
Reference in new issue
Block a user