Switchyard
Switchyard is a VS Code extension for managing Codex auth.json profiles from
a dedicated sidebar.
The extension saves only Codex authentication files, lists saved profiles, and
activates a profile by replacing the active ~/.codex/auth.json. It does not
manage CODEX_HOME, edit shell startup files, or launch Codex with alternate
homes.
Features
- Dedicated Switchyard Activity Bar view.
- Add a new Codex login from inside VS Code.
- Save the current
~/.codex/auth.json as a named profile.
- List saved profiles with optional email metadata and active account markers.
- Activate a saved profile with automatic backup of the previous active auth.
- Detect unknown current Codex auth files by comparing
tokens.account_id.
- Store saved auth copies under
~/.switchyard/codex-auth.
Open the Switchyard icon in the Activity Bar, then open Codex Profiles.
The sidebar view shows:
- the current
~/.codex/auth.json status
- a profile form for adding a fresh Codex login or saving the current auth
- saved Codex profile cards with active state, optional email, account id, and
activate/delete actions
Add Login runs codex login in an isolated temporary Codex home, then saves
only the resulting auth.json. Save Current copies the active
~/.codex/auth.json into Switchyard.
Requirements
- VS Code 1.90.0 or newer.
- Node.js 20 or newer for extension development.
- Codex CLI available on your
PATH when using Add Login.
- An existing
~/.codex/auth.json when using Save Current.
Commands
Open the Command Palette and run:
Switchyard: Add Codex Profile
Switchyard: Save Current Codex Profile
Switchyard: Activate Codex Profile
Switchyard: Refresh Codex Profiles
Switchyard: Delete Saved Codex Profile
Add a Profile
Add Codex Profile asks for a profile name and optional email, creates an
isolated temporary Codex home, runs codex login, then saves only the generated
auth.json.
Saved files live under:
~/.switchyard/codex-auth/<profile>/auth.json
If the logged-in tokens.account_id already exists, Switchyard refreshes the
existing saved profile instead of creating a duplicate.
Save Current Profile
Save Current Codex Profile reads:
~/.codex/auth.json
It requires tokens.account_id, then saves a copy into Switchyard with the
name and optional email you provide.
Activate a Profile
Activation compares the selected profile's saved tokens.account_id with the
current ~/.codex/auth.json.
If the selected profile is already active, nothing is replaced. Otherwise,
Switchyard writes a timestamped backup next to the active auth file before
replacing it.
If the current account id is not saved in Switchyard, the extension prompts you
to save the current auth first. Deleting a saved profile never deletes the
active ~/.codex/auth.json.
Storage And Security
Switchyard treats auth files as sensitive data.
- Saved auth files are written with user-only permissions where supported.
- Token fields are never displayed in the sidebar.
- Codex login output is redacted before it is written to the output channel.
- Activating a profile writes a timestamped backup before replacing an existing
active
~/.codex/auth.json.
Switchyard stores its registry at:
~/.switchyard/profiles.json
Saved Codex auth files are stored at:
~/.switchyard/codex-auth/<profile>/auth.json
Development
npm install
npm test
npm run check
Launch an Extension Development Host from VS Code with the included
.vscode/launch.json configuration.
Packaging
Install dependencies, run validation, then create a VSIX:
npm install
npm test
npm run check
npm run package
The generated .vsix can be installed locally with:
code --install-extension switchyard-0.1.0.vsix
Publishing
This extension is prepared for publishing with @vscode/vsce.
Before publishing, make sure the publisher, repository, homepage, and
bugs fields in package.json match your Marketplace publisher and public
repository.
npm install
npm test
npm run check
npm run publish:vsce
You can also package manually with npm run package and upload the generated
VSIX from the Visual Studio Marketplace publisher portal.
The Marketplace extension id will be:
aatitkarki.switchyard