Skip to content

[codex] Sync active changes before profile switch - #1

Merged
kuliantnt merged 2 commits into
mainfrom
codex/sync-back-before-switching
Jun 6, 2026
Merged

[codex] Sync active changes before profile switch#1
kuliantnt merged 2 commits into
mainfrom
codex/sync-back-before-switching

Conversation

@kuliantnt

Copy link
Copy Markdown
Owner

Summary

Add sync-back before switching profiles and include bundled Codex preset examples.

Before cc-switch use/next or cc-switch cx use/next overwrites the active config files, the command now checks whether the active files have changed from the recorded current profile. If changes are detected, interactive terminals ask whether to sync them back, while non-interactive environments sync automatically.

This prevents manual edits to Claude or Codex config files from being lost during profile switches. The PR also includes bundled openai and xxxcom Codex preset examples with README documentation updates.

Changes

  • Bump the crate version to 0.1.4.
  • Add Claude current profile tracking at ~/.cc-switch-simple/current.
  • Add Claude sync-back before backup and overwrite.
  • Compare Claude settings by canonical JSON value and write back the raw active file content.
  • Update Claude next, list, and current behavior to respect recorded current profile when appropriate.
  • Add Codex sync-back for config.toml and auth.json.
  • Validate active Codex auth.json before syncing.
  • Skip missing Codex target files during sync-back.
  • Add bundled Codex preset examples under codex/openai and codex/xxxcom.
  • Update README files for bundled Codex presets.
  • Add regression tests for Claude and Codex behavior.

Verification

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test

Release note

新增切换前自动回填当前配置,避免手动修改 Claude / Codex 配置后切换 profile 导致修改丢失;同时内置 Codex 示例预设。

@kuliantnt
kuliantnt marked this pull request as ready for review June 6, 2026 13:15
@kuliantnt
kuliantnt merged commit 0b12cb1 into main Jun 6, 2026
5 checks passed
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.

1 participant