mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 04:15:52 +00:00
fix(cursor): route bare cursor through runtime profile
This commit is contained in:
1 parent
27f6a675be
commit
2d67f40175
19 files changed
+549
-59
No files matched your search
@@ -16,6 +16,7 @@ import { Config, Settings, ProfileMetadata } from '../types';
|
||||
import {
|
||||
UnifiedConfig,
|
||||
CopilotConfig,
|
||||
CursorConfig,
|
||||
CLIProxyVariantConfig,
|
||||
CompositeVariantConfig,
|
||||
CompositeTierConfig,
|
||||
@@ -49,6 +50,8 @@ export interface ProfileDetectionResult {
|
||||
env?: Record<string, string>;
|
||||
/** For copilot profile: the copilot config */
|
||||
copilotConfig?: CopilotConfig;
|
||||
/** For cursor profile: the cursor config */
|
||||
cursorConfig?: CursorConfig;
|
||||
/** For composite variants: true when variant mixes providers per tier */
|
||||
isComposite?: boolean;
|
||||
/** For composite variants: which tier is the default */
|
||||
@@ -252,6 +255,7 @@ class ProfileDetector {
|
||||
* Priority order:
|
||||
* 0. Hardcoded CLIProxy profiles (gemini, codex, agy, qwen)
|
||||
* 0.5. Copilot profile (if enabled in config)
|
||||
* 0.75. Cursor profile (if enabled in config)
|
||||
* 1. Unified config profiles (if config.yaml exists or CCS_UNIFIED_CONFIG=1)
|
||||
* 2. User-defined CLIProxy variants (config.cliproxy section) [legacy]
|
||||
* 3. Settings-based profiles (config.profiles section) [legacy]
|
||||
@@ -302,6 +306,35 @@ class ProfileDetector {
|
||||
};
|
||||
}
|
||||
|
||||
// Priority 0.75: Check Cursor profile - local Cursor daemon runtime
|
||||
if (profileName === 'cursor') {
|
||||
const unifiedConfig = this.readUnifiedConfig();
|
||||
const cursorConfig = unifiedConfig?.cursor;
|
||||
|
||||
if (!cursorConfig?.enabled) {
|
||||
const error = new Error(
|
||||
'Cursor profile is not enabled.\n\n' +
|
||||
'To enable Cursor integration:\n' +
|
||||
' 1. Run: ccs cursor enable\n' +
|
||||
' 2. Import auth: ccs cursor auth\n' +
|
||||
' 3. Start daemon: ccs cursor start\n\n' +
|
||||
'Or manually edit ~/.ccs/config.yaml:\n' +
|
||||
' cursor:\n' +
|
||||
' enabled: true'
|
||||
) as ProfileNotFoundError;
|
||||
error.profileName = profileName;
|
||||
error.suggestions = [];
|
||||
error.availableProfiles = this.listAvailableProfiles();
|
||||
throw error;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'cursor',
|
||||
name: 'cursor',
|
||||
cursorConfig,
|
||||
};
|
||||
}
|
||||
|
||||
// Priority 1: Try unified config if available
|
||||
const unifiedConfig = this.readUnifiedConfig();
|
||||
if (unifiedConfig) {
|
||||
@@ -452,6 +485,11 @@ class ProfileDetector {
|
||||
lines.push(` - copilot (model: ${currentCopilotModel})`);
|
||||
}
|
||||
|
||||
if (unifiedConfig.cursor?.enabled) {
|
||||
lines.push('Cursor local proxy:');
|
||||
lines.push(` - cursor (model: ${unifiedConfig.cursor.model})`);
|
||||
}
|
||||
|
||||
// CLIProxy variants from unified config
|
||||
const variants = Object.keys(unifiedConfig.cliproxy?.variants || {});
|
||||
if (variants.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user