mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-25 17:22:27 +08:00
Switching, adding, editing, sync and entering or leaving local routing now write Gemini CLI and Grok Build through the write engine. Whole-file rewrites, backfill before switching and snippet merging are gone. Gemini CLI: - Only the key-field lines in .env change; comments, order and the user's own variables stay. In settings.json only security.auth.selectedType and model.name change. Both files commit as one operation. - selectedType follows the provider type (Google login for official cards, API key otherwise) instead of the row, so a /auth choice an older version stored in a row can no longer send a third-party card through Google login. - Local routing writes the route's model name along with the local address and placeholder key, so switching to a route with another model rewrites the client, as Claude Code does. - Vertex rows pass validation with GOOGLE_API_KEY or GOOGLE_GENAI_USE_VERTEXAI instead of GEMINI_API_KEY. - The common-config snippet is frozen like Claude's and Codex's; its UI and the explainer dialog are removed. New rows keep commonConfigEnabled: true for older versions that sync them. Grok Build: - Only models.default and the [model."<name>"] table CC Switch wrote change; MCP servers and the user's other tables stay. - The written table name is recorded in live-state.json in the same operation, and switching away removes the recorded table rather than whatever models.default points to now, so a default changed in Grok's /settings no longer leaves the old provider's table behind. Without a record (just upgraded), the table is inferred from the current row. Tables holding the proxy placeholder key are always removed. - Local routing writes the route's table pointing at the local /grokbuild/v1 endpoint with the placeholder key through the engine. An official card cannot be a route. Editors: - Both editors show what the client files will look like after switching. On save, key fields go to the row and other edits go to live as global settings with a three-way check. Gemini row fields that never reach live can be added to the global settings; Grok's can be copied, as in Codex. The TOML diffing shared with Codex moves to editor_toml.rs. Also: - First-run import no longer moves key fields (GEMINI_MODEL, Codex model_reasoning_effort and the like) from the default row into the snippet, where a frozen snippet would lose them. - The .env patch can remove keys unconditionally and parse entries.