From d7e0d1cacff827ee1cd0015cbf8143e0a5346680 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Thu, 12 Feb 2026 08:04:42 +0700 Subject: [PATCH] fix(cursor): pass all args to handler, use getCursorConfig in routes - Route all cursor args to handler for proper unknown-subcommand reporting - Replace loadOrCreateUnifiedConfig + fallback with getCursorConfig() --- src/ccs.ts | 7 ++----- src/web-server/routes/cursor-routes.ts | 9 +++------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/ccs.ts b/src/ccs.ts index f21776d1..4404712e 100644 --- a/src/ccs.ts +++ b/src/ccs.ts @@ -554,14 +554,11 @@ async function main(): Promise { } // Special case: cursor command (Cursor IDE integration) - // Route to cursor handler for known subcommands or bare 'ccs cursor' (shows help) + // Route all cursor args to handler — handler deals with unknown subcommands // Note: cursor does not have enable/disable — it uses daemon start/stop instead - const CURSOR_SUBCOMMANDS = ['auth', 'status', 'models', 'start', 'stop', 'help', '--help', '-h']; if (firstArg === 'cursor') { const { handleCursorCommand } = await import('./commands/cursor-command'); - const exitCode = await handleCursorCommand( - args.length > 1 && CURSOR_SUBCOMMANDS.includes(args[1]) ? args.slice(1) : [] - ); + const exitCode = await handleCursorCommand(args.slice(1)); process.exit(exitCode); } diff --git a/src/web-server/routes/cursor-routes.ts b/src/web-server/routes/cursor-routes.ts index 8c01ea39..5f7d6a27 100644 --- a/src/web-server/routes/cursor-routes.ts +++ b/src/web-server/routes/cursor-routes.ts @@ -10,8 +10,7 @@ import { saveCredentials, validateToken, } from '../../cursor/cursor-auth'; -import { DEFAULT_CURSOR_CONFIG } from '../../config/unified-config-types'; -import { loadOrCreateUnifiedConfig } from '../../config/unified-config-loader'; +import { getCursorConfig } from '../../config/unified-config-loader'; import cursorSettingsRoutes from './cursor-settings-routes'; const router = Router(); @@ -66,8 +65,7 @@ async function stopDaemon(): Promise<{ success: boolean; message: string }> { */ router.get('/status', async (_req: Request, res: Response): Promise => { try { - const config = loadOrCreateUnifiedConfig(); - const cursorConfig = config.cursor ?? DEFAULT_CURSOR_CONFIG; + const cursorConfig = getCursorConfig(); const authStatus = checkAuthStatus(); const daemonStatus = await getDaemonStatus(cursorConfig.port); @@ -159,8 +157,7 @@ router.get('/models', async (_req: Request, res: Response): Promise => { */ router.post('/daemon/start', async (_req: Request, res: Response): Promise => { try { - const config = loadOrCreateUnifiedConfig(); - const cursorConfig = config.cursor ?? DEFAULT_CURSOR_CONFIG; + const cursorConfig = getCursorConfig(); const result = await startDaemon(cursorConfig.port, cursorConfig.ghost_mode); res.json(result); } catch (error) {