Add restore command to undo Claude Code/opencode settings changes#6
Merged
Conversation
There was no way to undo what update_claude_settings() and update_opencode_settings() write, short of manually editing the JSON files or restoring a manual backup. Adds restore_claude_settings()/restore_opencode_settings(), which remove only the keys olist-code itself added (leaving any pre-existing settings/providers untouched), plus an `olist-code restore` command that runs both and clears the local adapter config.
4 tasks
felipegaudio
added a commit
that referenced
this pull request
Jul 24, 2026
There was no way to undo what update_claude_settings() and update_opencode_settings() write, short of manually editing the JSON files or restoring a manual backup. Adds restore_claude_settings()/restore_opencode_settings(), which remove only the keys olist-code itself added (leaving any pre-existing settings/providers untouched), plus an `olist-code restore` command that runs both and clears the local adapter config.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recreation of #4, rebased directly onto
mainnow that #1 (opencode support) is merged — the old branch's base (add-opencode-support) was deleted on merge and GitHub wouldn't let the original PR reopen/retarget.update_claude_settings()/update_opencode_settings()write to~/.claude/settings.json/~/.config/opencode/opencode.json(or.jsonc).config_resetonly cleared the local~/.olist-code-adapter/config.json— the actual harness settings stayed patched. Found this the hard way while manually testing Add opencode provider support alongside Claude Code settings #1 against a fake gateway: pointed a real Claude Code at a throwaway upstream with no way to revert except a manual backup.restore_claude_settings()/restore_opencode_settings()toconfig.py: each removes only the specific keys olist-code itself adds (theANTHROPIC_*env vars / theolist-ai-gatewayprovider entry), leaving any other settings/providers the user already had untouched. Also.jsonc-aware now (uses the same_resolve_opencode_settings_file()the updatedupdate_opencode_settings()uses), which the original Add restore command to undo Claude Code/opencode settings changes #4 predates.olist-code restoreCLI command that runs both plus removes the local adapter config, mirroringinit's "write everything" with a single "undo everything".Test plan
tests/test_config.py: no-op when file missing, removes only our keys/provider while preserving unrelated ones, cleans up emptyenv/providercontainers, deletes the opencode file entirely if we created it from scratch.pytest— full suite passes (66 passed).ruff check/mypyon touched files — no new issues (one pre-existing unrelated line-length warning).