Skip to content

[codex] Fix setup.sh overwriting Claude Code settings#14

Draft
happy-pills-dev wants to merge 1 commit into
srnichols:masterfrom
happy-pills-dev:codex/fix-claude-settings-merge
Draft

[codex] Fix setup.sh overwriting Claude Code settings#14
happy-pills-dev wants to merge 1 commit into
srnichols:masterfrom
happy-pills-dev:codex/fix-claude-settings-merge

Conversation

@happy-pills-dev

Copy link
Copy Markdown

What changed

Fixes the Claude Code setup path in setup.sh so it no longer overwrites an existing ~/.claude/settings.json.

The installer now:

  • creates settings.json when it does not exist
  • backs up an existing settings file before modifying it
  • preserves unrelated Claude Code settings and existing MCP servers
  • only adds or updates mcpServers.openbrain
  • refuses to overwrite invalid/non-object JSON or an invalid mcpServers shape

Why

Option 3 previously used cat > "$CONFIG", replacing the full Claude Code settings file and potentially deleting user permissions, existing MCP servers, or other configuration. That matches the data-loss behavior reported in #13.

Validation

  • bash -n setup.sh
  • focused Git Bash test that merges into an existing settings file while preserving unrelated keys and existing MCP servers
  • focused Git Bash test that leaves invalid JSON untouched and creates a backup before failing safely

Closes #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: setup.sh option 3 overwrites ~/.claude/settings.json, destroying existing Claude Code configuration

1 participant