[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81868":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":16,"lastSyncTime":28,"discoverSource":29},81868,"any-switch","riverscn\u002Fany-switch","riverscn","Safely switch local app accounts, profiles, and state for Claude Code, OpenAI Codex, and extensible app definitions.","",null,"Rust",27,4,22,0,2,5,2.1,"MIT License",false,"main",[23,24],"account-management","profile-management","2026-06-12 02:04:20","# any-switch\n\n[简体中文](README.zh-CN.md)\n\n`any-switch` switches local app profiles and state.\n\nUse it when one app has several local setups and you want to move between them\nwithout hand-editing files, copying tokens, or remembering which config entries\nbelong together.\n\nExamples:\n\n- switch Claude Code between a personal account and a work account;\n- switch Codex between ChatGPT OAuth and an API-key provider;\n- switch any supported local tool between different endpoints, models, accounts,\n  workspaces, or other file-backed state.\n\nThe first built-in apps are Claude Code and OpenAI Codex. The tool itself is not\nAI-specific: app definitions describe what local state can be captured and\nrestored, and `any-switch` handles the backup, redaction, drift checks, and\nwrite safety around that state.\n\n## What It Does\n\n`any-switch` keeps named profiles on your machine. A profile is the local state\nyou want an app to use, such as:\n\n- account identity and OAuth credential state;\n- API keys and provider settings;\n- model, endpoint, and environment settings;\n- JSON, TOML, file, Keychain, or environment fragments declared by an app\n  definition.\n\nWhen you switch profiles, `any-switch` shows the plan, creates backups, writes\nonly the declared targets, and avoids printing secret values.\n\n## Install\n\n`any-switch` is distributed as a source-built CLI. The install command compiles\nthe Rust binary on your machine instead of downloading an unsigned macOS or\nWindows binary.\n\nThe current release scope is a macOS-evidenced stage release: macOS Claude\nOAuth import has real local evidence, while broader restart checks plus Linux\nand Windows real-app evidence are tracked as follow-up work. This release does\nnot claim full `docs\u002Fdesign.md` section 13 coverage.\n\n### 1. Install Rust\n\n```bash\nrustup toolchain install 1.95.0\n```\n\nIf `rustup` is not installed yet, install Rust from \u003Chttps:\u002F\u002Frustup.rs> first.\n\n### 2. Install any-switch\n\nFor most npm-based CLI users:\n\n```bash\nnpm install -g any-switch\nany-switch --version\n```\n\nThe first npm install can take a little while because it runs Cargo once and\nstores the compiled binary inside the npm package. After that, run\n`any-switch` directly.\n\nFor Rust users:\n\n```bash\ncargo install any-switch --locked\nany-switch --version\n```\n\n`npx any-switch --version` can work for a quick trial, but it may compile on\nfirst use and may compile again if npm's cache is cleared. Prefer a global\ninstall for regular use.\n\nFor local development from a checkout:\n\n```bash\ncargo install --path .\n```\n\nCheck the installation:\n\n```bash\nany-switch --version\nany-switch doctor\n```\n\n## Quick Start\n\nSee the apps that this build knows about:\n\n```bash\nany-switch apps\n```\n\nCapture the current login or state of an app as a profile:\n\n```bash\nany-switch import-current \u003Capp> personal\n```\n\nList saved profiles:\n\n```bash\nany-switch list\n```\n\nSwitch to a profile:\n\n```bash\nany-switch use \u003Cprofile-id> --dry-run\nany-switch use \u003Cprofile-id>\n```\n\nCheck what is active:\n\n```bash\nany-switch status \u003Capp>\nany-switch doctor \u003Capp>\n```\n\nBuilt-in examples:\n\n```bash\nany-switch import-current codex personal\nany-switch import-current claude work --kind oauth_capture\nany-switch use codex-personal\n```\n\n## Common Workflows\n\n### Save the Current App State\n\nUse `import-current` after you have already logged in or configured the target\napp in the normal way:\n\n```bash\nany-switch import-current \u003Capp> personal\n```\n\nThis is the right flow for OAuth-based app state, because the app owns the real\nlogin process. `any-switch` captures the local state after login; it does not log\nin for you. For built-in apps this may look like\n`any-switch import-current codex personal` or\n`any-switch import-current claude work --kind oauth_capture`.\n\n### Add a Static Profile\n\nUse `add` when the profile can be described with fields such as an API key,\nmodel, provider, or base URL. Field names are defined by the selected app\ndefinition and profile kind:\n\n```bash\nany-switch add \u003Capp> work --kind \u003Ckind> --field key=value\n```\n\nBuilt-in Codex example:\n\n```bash\nany-switch add codex openai --kind file_template \\\n  --secret-field api_key=@prompt \\\n  --field model=gpt-5-codex \\\n  --field model_provider=openai\n```\n\nSecret fields can be read from a masked interactive prompt, stdin, an\nenvironment variable, or a local file:\n\n```bash\n--secret-field api_key=@prompt\n--secret-field api_key=@stdin\n--secret-field api_key=@env:OPENAI_API_KEY\n--secret-field api_key=@file:~\u002Fsecrets\u002Fopenai-api-key\n```\n\nUse `@prompt` for normal interactive setup. Use `@env:NAME`, `@stdin`, or\n`@file:PATH` when scripting.\n\n### Preview Before Writing\n\nUse `--dry-run` to inspect a switch without changing local files:\n\n```bash\nany-switch use \u003Cprofile-id> --dry-run\n```\n\n### Recover a Target From Backup\n\nBackups are created before managed targets are overwritten. Inspect them with:\n\n```bash\nany-switch backup list\n```\n\nRestore an app from a specific backup when needed:\n\n```bash\nany-switch restore-target \u003Capp> \u003Cbackup-id>\n```\n\n`restore-target` restores live app state from the backup. It does not mark a\nprofile active, so run `any-switch status \u003Capp>` afterwards to inspect the\nresult. Confirm the restore by typing `yes` in an interactive terminal, or add\n`--yes` in scripts and CI.\n\n## Safety Notes\n\n- Profiles are stored under `~\u002F.any-switch` by default. This directory can\n  contain static secrets, OAuth captures, and defensive backups. Keep it out of\n  cloud-synced folders such as iCloud Drive, Dropbox, OneDrive, and Google\n  Drive; `doctor` warns when it detects a known sync root. Set `ANY_SWITCH_HOME`\n  to an absolute path under your home directory if you want a separate state\n  directory.\n- Secret values are redacted from normal command output and JSON output.\n- Do not commit `~\u002F.any-switch` or any generated profile\u002Fcapture files.\n- Quit the target app before OAuth or process-sensitive operations. OAuth\n  credentials can rotate while the app is running, so `--allow-running` does not\n  apply to those operations.\n- Use `--assume-app-stopped` only when the app is actually stopped but process\n  detection reports a false positive; confirm with `--yes` in scripts or by\n  typing `yes` in an interactive terminal. Do not pass it preemptively: if no\n  matching process was detected, any-switch rejects the flag and asks you to\n  retry without it.\n- For static file or environment profiles, `--allow-running` is available,\n  but stopping the app first is still safer because the app may rewrite its own\n  config files.\n- `--yes` confirms high-risk actions non-interactively, such as `use`,\n  `restore-target`, `remove`, or `--assume-app-stopped`. In an interactive\n  terminal you may omit `--yes` and type `yes` at the prompt instead. Neither\n  confirmation path disables identity checks, backup checks, path checks, locks,\n  schema validation, or secret redaction. `add` and ordinary `import-current`\n  do not accept `--yes` because they create or capture state instead of\n  overwriting the target app. `import-current --yes` is valid only with\n  `--assume-app-stopped`.\n\n## Troubleshooting\n\nStart with:\n\n```bash\nany-switch doctor\nany-switch doctor \u003Capp>\nany-switch status \u003Capp>\n```\n\nUseful next steps:\n\n- `IdentityMissing`: the app does not currently expose the identity fields that\n  the profile kind requires. Make sure the app is logged in, then run\n  `doctor \u003Capp>` again.\n- `TargetMissing`: run `doctor \u003Capp>` and look for `definition_capture_source`\n  rows. They show whether the current platform credential source, such as a\n  Keychain entry or credentials file, is `exists`, `missing`, or `warning`\n  because existence could not be confirmed. If a warning row includes `hint:`,\n  follow that source-specific next step first. For macOS Keychain checks, avoid\n  `security find-generic-password -w` unless you intentionally need to reveal\n  the credential.\n- `DriftBeforeWriteback`: the live app state no longer matches the active\n  profile. Run `status \u003Capp>` to inspect it. If the live state is valuable,\n  import it as a new profile before switching away.\n- `AppRunning`: quit the target app and retry. Use `--assume-app-stopped` only\n  for a process-detection false positive, then confirm with `--yes` or the\n  interactive prompt.\n- `ImportAmbiguous`: pass `--kind \u003Ckind>` or clean up the app's current auth\n  files so only one import rule matches.\n\n## Custom Apps\n\n`any-switch` can be extended with app definitions under `apps.d\u002F*.yaml`.\nDefinitions declare the local targets an app uses and which trusted handlers can\ncapture or write them. This lets new apps reuse the same safety model without\nadding app-specific branches to the core CLI.\n\nFor the full model, see\n[docs\u002Fdesign.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Fdesign.md).\n\nTo inspect or customize app definitions:\n\n```bash\nany-switch apps show \u003Capp>\nany-switch apps export \u003Capp> --source system\nany-switch apps export \u003Capp> --source resolved\nany-switch apps export \u003Capp> --as override --output ~\u002F.any-switch\u002Foverrides.d\u002F\u003Capp>.yaml\nany-switch apps validate ~\u002F.any-switch\u002Foverrides.d\u002F\u003Capp>.yaml\n```\n\n## More Docs\n\n- [docs\u002Fuser-guide.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Fuser-guide.md):\n  practical user guide with common workflows, safety flags, and\n  troubleshooting.\n- [README.zh-CN.md](README.zh-CN.md): simplified Chinese README.\n- [docs\u002Fuser-guide.zh-CN.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Fuser-guide.zh-CN.md):\n  simplified Chinese user guide.\n- [docs\u002Fdesign.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Fdesign.md):\n  architecture and safety model.\n- [docs\u002Fmanual-verification.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Fmanual-verification.md):\n  real-app checks that cannot be fully proven in CI.\n- [docs\u002Facceptance.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Facceptance.md):\n  acceptance coverage.\n- [docs\u002Fevidence-followups.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Fevidence-followups.md):\n  deferred manual evidence tracking before full section 13 coverage is claimed.\n- [docs\u002Frelease.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002Fdocs\u002Frelease.md):\n  release packaging and signing.\n- [CHANGELOG.md](CHANGELOG.md): user-facing release notes.\n- [CONTRIBUTING.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002FCONTRIBUTING.md):\n  development and contribution rules.\n- [.github\u002FISSUE_TEMPLATE\u002Frelease_checklist.yml](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002F.github\u002FISSUE_TEMPLATE\u002Frelease_checklist.yml):\n  release evidence checklist for maintainers.\n- [CODE_OF_CONDUCT.md](https:\u002F\u002Fgithub.com\u002Friverscn\u002Fany-switch\u002Fblob\u002Fmain\u002FCODE_OF_CONDUCT.md):\n  community standards.\n- [SECURITY.md](SECURITY.md): vulnerability reporting.\n\n## Development\n\nRun the local verification script before opening a pull request:\n\n```bash\nscripts\u002Fverify-local.sh\nscripts\u002Fverify-packages.sh\n```\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","any-switch 是一个用于安全切换本地应用程序账户、配置文件和状态的工具，支持 Claude Code 和 OpenAI Codex 等应用。其核心功能包括管理多个本地设置，并在不同设置之间无缝切换，无需手动编辑文件或记忆配置项。技术上，它使用 Rust 语言编写，具备备份、敏感信息处理、一致性检查等特性，确保数据的安全性和完整性。适用于需要频繁在个人与工作账户间切换，或是需要在不同API提供商、模型、环境设置中灵活变动的应用场景。","2026-06-11 04:07:01","CREATED_QUERY"]