Skip to content
10 changes: 10 additions & 0 deletions docs/reference/storage-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Override root:
| --- | --- |
| Unified settings | `~/.codex/multi-auth/settings.json` |
| Accounts | `~/.codex/multi-auth/openai-codex-accounts.json` |
| Named backups | `~/.codex/multi-auth/backups/<name>.json` |
| Accounts backup | `~/.codex/multi-auth/openai-codex-accounts.json.bak` |
| Accounts WAL | `~/.codex/multi-auth/openai-codex-accounts.json.wal` |
| Flagged accounts | `~/.codex/multi-auth/openai-codex-flagged-accounts.json` |
Expand Down Expand Up @@ -56,6 +57,7 @@ Backup metadata:
When project-scoped behavior is enabled:

- `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json`
- `~/.codex/multi-auth/projects/<project-key>/backups/<name>.json`

`<project-key>` is derived as:

Expand Down Expand Up @@ -100,6 +102,13 @@ Rules:
- `.rotate.`, `.tmp`, and `.wal` names are rejected
- existing files are not overwritten unless a lower-level force path is used explicitly

Restore workflow:

1. Run `codex auth login`.
2. Open the `Recovery` section.
3. Choose `Restore From Backup`.
4. Pick a backup and confirm the merge summary before import.

---

## oc-chatgpt Target Paths
Expand All @@ -115,6 +124,7 @@ Experimental sync targets the companion `oc-chatgpt-multi-auth` storage layout:
## Verification Commands

```bash
codex auth login
codex auth status
codex auth list
```
Expand Down
11 changes: 11 additions & 0 deletions lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export type LoginMode =
| "check"
| "deep-check"
| "verify-flagged"
| "restore-backup"
| "cancel";

export interface ExistingAccountInfo {
Expand Down Expand Up @@ -233,6 +234,14 @@ async function promptLoginModeFallback(
) {
return { mode: "verify-flagged" };
}
if (
normalized === "u" ||
normalized === "backup" ||
normalized === "restore" ||
normalized === "restore-backup"
) {
return { mode: "restore-backup" };
}
if (normalized === "q" || normalized === "quit")
return { mode: "cancel" };
console.log(UI_COPY.fallback.invalidModePrompt);
Expand Down Expand Up @@ -287,6 +296,8 @@ export async function promptLoginMode(
return { mode: "deep-check" };
case "verify-flagged":
return { mode: "verify-flagged" };
case "restore-backup":
return { mode: "restore-backup" };
case "select-account": {
const accountAction = await showAccountDetails(action.account);
if (accountAction === "delete") {
Expand Down
Loading