feat(ai): add CodeBuddy Code CLI provider
This commit is contained in:
1 parent
f5e7a37c8d
commit
1a3645a04d
38 files changed
+1697
-19
No files matched your search
@@ -142,6 +142,30 @@ describe("useAiModelCatalog", () => {
|
||||
expect(apiMock.aiListModels).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("tracks CodeBuddy executable and environment changes without depending on environment key order", async () => {
|
||||
const initial: AiConfigItem = {
|
||||
...config(),
|
||||
provider: "codebuddy-cli",
|
||||
endpoint: "",
|
||||
apiKey: "",
|
||||
model: "default",
|
||||
codebuddyCliPath: "/opt/homebrew/bin/codebuddy",
|
||||
codebuddyCliEnv: { HTTPS_PROXY: "http://127.0.0.1:7890", NO_PROXY: "localhost" },
|
||||
};
|
||||
apiMock.aiListModels.mockResolvedValueOnce([{ id: "first" }]).mockResolvedValueOnce([{ id: "second" }]);
|
||||
|
||||
await expect(catalog.loadModels(initial)).resolves.toEqual([{ id: "first" }]);
|
||||
await expect(
|
||||
catalog.loadModels({
|
||||
...initial,
|
||||
codebuddyCliEnv: { NO_PROXY: "localhost", HTTPS_PROXY: "http://127.0.0.1:7890" },
|
||||
}),
|
||||
).resolves.toEqual([{ id: "first" }]);
|
||||
await expect(catalog.loadModels({ ...initial, codebuddyCliPath: "/usr/local/bin/codebuddy" })).resolves.toEqual([{ id: "second" }]);
|
||||
|
||||
expect(apiMock.aiListModels).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it("does not let a stale request overwrite a newer provider catalog", async () => {
|
||||
let resolveInitial: ((models: { id: string }[]) => void) | undefined;
|
||||
apiMock.aiListModels
|
||||
|
||||
@@ -59,6 +59,7 @@ function configSignature(config: AiConfigItem): string {
|
||||
piAgentCliPath: config.piAgentCliPath ?? null,
|
||||
opencodeCliPath: config.opencodeCliPath ?? null,
|
||||
cursorCliPath: config.cursorCliPath ?? null,
|
||||
codebuddyCliPath: config.codebuddyCliPath ?? null,
|
||||
connectionFingerprint: fingerprint(
|
||||
JSON.stringify({
|
||||
apiKey: config.apiKey,
|
||||
@@ -69,6 +70,7 @@ function configSignature(config: AiConfigItem): string {
|
||||
piAgentCliEnv: sortedRecord(config.piAgentCliEnv),
|
||||
opencodeCliEnv: sortedRecord(config.opencodeCliEnv),
|
||||
cursorCliEnv: sortedRecord(config.cursorCliEnv),
|
||||
codebuddyCliEnv: sortedRecord(config.codebuddyCliEnv),
|
||||
}),
|
||||
),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user