feat(ai): add Cursor CLI provider
This commit is contained in:
1 parent
25fd5677c7
commit
36e5fa4f4c
36 files changed
+1173
-36
No files matched your search
@@ -432,6 +432,22 @@ describe("settingsStore AI API key normalization", () => {
|
||||
opencodeCliEnv: { HTTPS_PROXY: "http://127.0.0.1:7890", EMPTY: "" },
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes Cursor CLI path and environment settings", () => {
|
||||
expect(
|
||||
normalizeAiConfig({
|
||||
provider: "cursor-cli",
|
||||
cursorCliPath: " ~/.local/bin/agent ",
|
||||
cursorCliEnv: { HTTPS_PROXY: "http://127.0.0.1:7890", EMPTY: null as unknown as string },
|
||||
}),
|
||||
).toMatchObject({
|
||||
provider: "cursor-cli",
|
||||
endpoint: "",
|
||||
model: "default",
|
||||
cursorCliPath: "~/.local/bin/agent",
|
||||
cursorCliEnv: { HTTPS_PROXY: "http://127.0.0.1:7890", EMPTY: "" },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("settingsStore MCP policy persistence", () => {
|
||||
|
||||
@@ -242,6 +242,16 @@ export const AI_PROVIDER_PRESETS: Record<AiProvider, AiProviderPreset> = {
|
||||
authMethod: "bearer",
|
||||
requiresApiKey: false,
|
||||
},
|
||||
"cursor-cli": {
|
||||
label: "Cursor CLI",
|
||||
iconSlug: "cursor",
|
||||
provider: "cursor-cli",
|
||||
endpoint: "",
|
||||
model: "default",
|
||||
apiStyle: "completions",
|
||||
authMethod: "bearer",
|
||||
requiresApiKey: false,
|
||||
},
|
||||
"pi-agent-cli": {
|
||||
label: "Pi Coding Agent",
|
||||
iconSlug: "pi",
|
||||
@@ -310,6 +320,8 @@ export function normalizeAiConfig(config: Partial<AiConfig> | null | undefined):
|
||||
piAgentCliEnv: normalizeAiEnv(config?.piAgentCliEnv),
|
||||
opencodeCliPath: config?.opencodeCliPath?.trim() || undefined,
|
||||
opencodeCliEnv: normalizeAiEnv(config?.opencodeCliEnv),
|
||||
cursorCliPath: config?.cursorCliPath?.trim() || undefined,
|
||||
cursorCliEnv: normalizeAiEnv(config?.cursorCliEnv),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1402,7 +1414,7 @@ export const useSettingsStore = defineStore("settings", () => {
|
||||
const config = aiConfigs.value.find((c) => c.id === activeModel.value!.configId);
|
||||
if (!config) return false;
|
||||
const preset = AI_PROVIDER_PRESETS[config.provider];
|
||||
if (config.provider === "codex-cli" || config.provider === "claude-code-cli" || config.provider === "pi-agent-cli" || config.provider === "opencode-cli") return true;
|
||||
if (config.provider === "codex-cli" || config.provider === "claude-code-cli" || config.provider === "pi-agent-cli" || config.provider === "opencode-cli" || config.provider === "cursor-cli") return true;
|
||||
return !!config.endpoint && !!activeModel.value!.modelId && (!preset.requiresApiKey || !!config.apiKey);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user