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()
This commit is contained in:
Tam Nhu Tran
2026-02-12 08:04:42 +07:00
parent f9834c81c9
commit d7e0d1cacf
2 changed files with 5 additions and 11 deletions
+2 -5
View File
@@ -554,14 +554,11 @@ async function main(): Promise<void> {
}
// 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);
}
+3 -6
View File
@@ -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<void> => {
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<void> => {
*/
router.post('/daemon/start', async (_req: Request, res: Response): Promise<void> => {
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) {