mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 12:15:57 +00:00
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:
+2
-5
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user