Metadata-Version: 2.4
Name: codex-manager
Version: 3.0.0
Summary: Codex account snapshot manager
Author-email: Dhruv <dhruv13x@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/dhruv13x/codex-manager
Project-URL: Repository, https://github.com/dhruv13x/codex-manager
Project-URL: Issues, https://github.com/dhruv13x/codex-manager/issues
Keywords: codex,backup,cli,automation
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: rich>=13.0.0
Requires-Dist: boto3>=1.28.0
Requires-Dist: b2sdk>=2.0.0
Requires-Dist: relm>=7.1.1
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: pytest-timeout>=2.2.0; extra == "dev"
Requires-Dist: pytest-json-report>=1.5.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
Requires-Dist: pyfakefs>=5.0.0; extra == "dev"
Requires-Dist: ruff>=0.6.0; extra == "dev"
Requires-Dist: black>=24.3.0; extra == "dev"
Requires-Dist: mypy>=1.11.0; extra == "dev"
Requires-Dist: types-PyYAML>=6.0; extra == "dev"

# Codex Manager

`codex-manager` is a CLI for backing up Codex account state and tracking account cooldown data from live `/status` output.

## Core model

- Backups are stored as `*.tar.gz` archives plus adjacent `*.metadata.json`.
- Metadata is the source of truth for `cooldown`, `recommend`, and account rotation decisions.
- Live Codex `/status` output is parsed to capture:
  - account email
  - quota text
  - quota percent left when available
  - weekly reset timestamp

## Main commands

- `cm backup`: capture live status, build archive metadata, and create a backup.
- `cm status`: parse live status and patch the latest metadata for the current account.
- `cm cooldown`: show account availability from stored metadata, optionally merged with live status.
- `cm recommend`: choose the best account to use next.
- `cm use`: switch to another account, defaulting to auth-only restore unless `--clean` is used.
- `cm restore`: restore a full backup into the Codex home.

## Status tracking policy

- `use` and `restore` sync the current account status before switching away from it.
- If live status capture fails, the command retries once.
- If status capture fails twice, the command exits and instructs the user to rerun with `--without-status-check`.

## Emergency fallback

`--without-status-check` exists for cases where Codex layout changes or live status is temporarily unavailable.

In that mode:

- cooldown is estimated as `now + 7 days`
- metadata is still written so cooldown state is not lost
- fallback archive and metadata names are based on the estimated reset time, not the current time

## Storage defaults

- manager home: `~/.codex-manager`
- backup directory: `~/.codex-manager/backups`
- Codex home: `~/.codex`

## Cloud support

- Backblaze B2 is supported for remote backup metadata and archive storage.
- Local and cloud entries can be merged for recommendation and cooldown reporting.
