Problem
When running coding-gateway configure or launching a tool, the CLI fully overwrites the config files for all three supported tools:
- Claude Code (
~/.claude/settings.json): Overwrites the entire file with just apiKeyHelper + env. This destroys mcpServers, permissions, hooks, allow rules, enabledPlugins, and all other user settings.
- Codex (
~/.codex/config.toml): Replaces the entire file with a single Databricks profile, destroying any user-defined profiles or model providers.
- Gemini CLI (
~/.gemini/.env): Replaces the entire file with 4 gateway variables. The token refresh thread also re-overwrites the file every 30 minutes.
This happens on every launch, not just during explicit configuration.
Impact
- Users lose MCP server configurations, permission rules, hooks, plugin settings, and custom env vars
- The backup mechanism only captures the config from the very first run and is never updated
- Users who have customized their Claude Code setup will have everything silently destroyed
Expected Behavior
The tool should read-merge-write: read existing config, deep-merge only the keys it manages, and write back — preserving everything else. On logout, it should surgically remove only its managed keys.
Acceptance Criteria
Problem
When running
coding-gateway configureor launching a tool, the CLI fully overwrites the config files for all three supported tools:~/.claude/settings.json): Overwrites the entire file with justapiKeyHelper+env. This destroysmcpServers,permissions,hooks,allowrules,enabledPlugins, and all other user settings.~/.codex/config.toml): Replaces the entire file with a single Databricks profile, destroying any user-defined profiles or model providers.~/.gemini/.env): Replaces the entire file with 4 gateway variables. The token refresh thread also re-overwrites the file every 30 minutes.This happens on every launch, not just during explicit configuration.
Impact
Expected Behavior
The tool should read-merge-write: read existing config, deep-merge only the keys it manages, and write back — preserving everything else. On logout, it should surgically remove only its managed keys.
Acceptance Criteria
settings.jsonmerge: onlyapiKeyHelperand gateway env vars are written; all other keys preserved.envmerge: only 4 gateway vars are updated; other env vars preserved