mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-25 17:22:27 +08:00
feat(agy): integrate Antigravity CLI management (#8268)
Add Antigravity CLI (agy) as a managed app: provider switching for the native login and API-key modes, MCP and Skills sync through ~/.gemini/config, session browsing and session-log usage import. Co-authored-by: peterLwk888 <lwk1124@outlook.com>
This commit is contained in:
1 parent
19798e2f92
commit
c7dceb8036
109 files changed
+4421
-219
No files matched your search
@@ -71,6 +71,26 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe("useAddProviderMutation", () => {
|
||||
it("adds an agy profile without silently activating it", async () => {
|
||||
const { wrapper } = createWrapper();
|
||||
const { result } = renderHook(() => useAddProviderMutation("agy"), {
|
||||
wrapper,
|
||||
});
|
||||
await act(async () =>
|
||||
result.current.mutateAsync({
|
||||
name: "Relay",
|
||||
settingsConfig: { env: { GEMINI_API_KEY: "fixture" } },
|
||||
addToLive: false,
|
||||
}),
|
||||
);
|
||||
expect(apiMocks.add).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ name: "Relay" }),
|
||||
"agy",
|
||||
false,
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
|
||||
it("duplicates Claude Desktop official providers with a fresh id", async () => {
|
||||
const { wrapper } = createWrapper();
|
||||
const { result } = renderHook(
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { act, renderHook } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { useGeminiConfigState } from "@/components/providers/forms/hooks/useGeminiConfigState";
|
||||
|
||||
const initialData = {
|
||||
settingsConfig: {
|
||||
env: { GEMINI_MODEL: "legacy-model", GEMINI_API_KEY: "fixture" },
|
||||
config: {
|
||||
model: { name: "native-model", temperature: 0.5 },
|
||||
theme: "keep",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
describe("Gemini and Antigravity model configuration", () => {
|
||||
it("displays and updates the native agy model, preserving unrelated fields", () => {
|
||||
const { result } = renderHook(() =>
|
||||
useGeminiConfigState({ initialData, preferConfigModel: true }),
|
||||
);
|
||||
expect(result.current.geminiModel).toBe("native-model");
|
||||
act(() => result.current.handleGeminiModelChange("new-model"));
|
||||
expect(result.current.geminiModel).toBe("new-model");
|
||||
expect(JSON.parse(result.current.geminiConfig)).toEqual({
|
||||
model: { name: "new-model", temperature: 0.5 },
|
||||
theme: "keep",
|
||||
});
|
||||
expect(result.current.geminiEnv).toContain("GEMINI_MODEL=new-model");
|
||||
act(() => result.current.handleGeminiModelChange(""));
|
||||
expect(result.current.geminiModel).toBe("");
|
||||
expect(JSON.parse(result.current.geminiConfig).model.name).toBe("");
|
||||
});
|
||||
|
||||
it("keeps the existing Gemini CLI env model behavior", () => {
|
||||
const { result } = renderHook(() => useGeminiConfigState({ initialData }));
|
||||
expect(result.current.geminiModel).toBe("legacy-model");
|
||||
act(() => result.current.handleGeminiModelChange("new-model"));
|
||||
expect(result.current.geminiModel).toBe("new-model");
|
||||
expect(JSON.parse(result.current.geminiConfig).model.name).toBe(
|
||||
"native-model",
|
||||
);
|
||||
});
|
||||
|
||||
it("loads legacy agy env models and follows valid JSON model edits", () => {
|
||||
const legacy = {
|
||||
settingsConfig: {
|
||||
env: { GEMINI_MODEL: "legacy-model" },
|
||||
config: { model: { name: null } },
|
||||
},
|
||||
};
|
||||
const { result } = renderHook(() =>
|
||||
useGeminiConfigState({ initialData: legacy, preferConfigModel: true }),
|
||||
);
|
||||
expect(result.current.geminiModel).toBe("legacy-model");
|
||||
act(() =>
|
||||
result.current.handleGeminiConfigChange(
|
||||
'{"model":{"name":"json-model"}}',
|
||||
),
|
||||
);
|
||||
expect(result.current.geminiModel).toBe("json-model");
|
||||
act(() => result.current.handleGeminiConfigChange('{"model":'));
|
||||
expect(result.current.geminiModel).toBe("json-model");
|
||||
expect(result.current.configError).not.toBe("");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user