mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-10 04:19:29 +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)
|
// 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
|
// 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') {
|
if (firstArg === 'cursor') {
|
||||||
const { handleCursorCommand } = await import('./commands/cursor-command');
|
const { handleCursorCommand } = await import('./commands/cursor-command');
|
||||||
const exitCode = await handleCursorCommand(
|
const exitCode = await handleCursorCommand(args.slice(1));
|
||||||
args.length > 1 && CURSOR_SUBCOMMANDS.includes(args[1]) ? args.slice(1) : []
|
|
||||||
);
|
|
||||||
process.exit(exitCode);
|
process.exit(exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ import {
|
|||||||
saveCredentials,
|
saveCredentials,
|
||||||
validateToken,
|
validateToken,
|
||||||
} from '../../cursor/cursor-auth';
|
} from '../../cursor/cursor-auth';
|
||||||
import { DEFAULT_CURSOR_CONFIG } from '../../config/unified-config-types';
|
import { getCursorConfig } from '../../config/unified-config-loader';
|
||||||
import { loadOrCreateUnifiedConfig } from '../../config/unified-config-loader';
|
|
||||||
import cursorSettingsRoutes from './cursor-settings-routes';
|
import cursorSettingsRoutes from './cursor-settings-routes';
|
||||||
|
|
||||||
const router = Router();
|
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> => {
|
router.get('/status', async (_req: Request, res: Response): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const config = loadOrCreateUnifiedConfig();
|
const cursorConfig = getCursorConfig();
|
||||||
const cursorConfig = config.cursor ?? DEFAULT_CURSOR_CONFIG;
|
|
||||||
const authStatus = checkAuthStatus();
|
const authStatus = checkAuthStatus();
|
||||||
const daemonStatus = await getDaemonStatus(cursorConfig.port);
|
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> => {
|
router.post('/daemon/start', async (_req: Request, res: Response): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const config = loadOrCreateUnifiedConfig();
|
const cursorConfig = getCursorConfig();
|
||||||
const cursorConfig = config.cursor ?? DEFAULT_CURSOR_CONFIG;
|
|
||||||
const result = await startDaemon(cursorConfig.port, cursorConfig.ghost_mode);
|
const result = await startDaemon(cursorConfig.port, cursorConfig.ghost_mode);
|
||||||
res.json(result);
|
res.json(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user