Skip to content

Feature/windows#1

Open
hanley-development wants to merge 2 commits into
MacSteini:mainfrom
hanley-development:feature/windows
Open

Feature/windows#1
hanley-development wants to merge 2 commits into
MacSteini:mainfrom
hanley-development:feature/windows

Conversation

@hanley-development

@hanley-development hanley-development commented Jun 23, 2026

Copy link
Copy Markdown

Summary

  • Add passive Windows support by resolving Codex paths with pathlib instead of hardcoded ~/.codex strings.
  • Preserve existing macOS/Linux behavior by defaulting to Path.home() / ".codex" when CODEX_HOME is not set.
  • Respect CODEX_HOME when users need to point the tool at a non-default Codex data directory.
  • Derive auth.json from the resolved Codex home directory.
  • Add stdlib unittest coverage for default and override path behavior.
  • Update .gitignore for generated/local files.

README follow-up

README.md was intentionally left unchanged in this PR. A follow-up documentation PR should make these exact updates:

  1. In ## Requirements, replace:
- macOS or Linux.
- Local Codex state under `~/.codex` for `local-usage`.
- A Codex login at `~/.codex/auth.json` and network access for `resets`, `online-usage`, `all` and menu quick summaries.

No third-party Python packages are required. Windows is not supported because the script expects Unix-style paths, an executable shebang workflow and a Codex home at `~/.codex`.

with:

- macOS, Linux or Windows.
- Local Codex state under your Codex home directory for `local-usage`.
- A Codex login at `auth.json` inside your Codex home directory and network access for `resets`, `online-usage`, `all` and menu quick summaries.

No third-party Python packages are required. By default, Codex Usage reads Codex data from `Path.home() / ".codex"`. Set `CODEX_HOME` to use a different Codex home directory.
  1. In ## Install And Run,
    add
a PowerShell example after the python3 codex_usage.py example:
py -3 .\codex_usage.py
py -3 .\codex_usage.py local-usage
  1. In ## Privacy And Authentication, replace:
~/.codex/auth.json

with:

<Codex home>/auth.json

and add:

The Codex home directory is `Path.home() / ".codex"` unless `CODEX_HOME` is set.
  1. In ## Troubleshooting, update the authentication troubleshooting workflow at README.md:252.

Current text:

If the script says `~/.codex/auth.json` is missing or malformed, sign in to Codex first, then run the script again. Codex Usage reuses that existing login; it does not ask for, store or need an OpenAI API key.

Replace with:

If the script says `<Codex home>/auth.json` is missing or malformed, sign in to Codex first, then run the script again. Codex Usage reuses that existing login; it does not ask for, store or need an OpenAI API key.

By default, `<Codex home>` is `Path.home() / ".codex"`, so the default auth file remains `~/.codex/auth.json` on macOS/Linux and the equivalent `.codex\auth.json` directory under the user profile on Windows. If your Codex data is stored somewhere else, set `CODEX_HOME` to that directory before running the script.

Test Plan

python -B -m unittest
python -m py_compile .\codex_usage.py
ruff check .\codex_usage.py .\tests
ruff format --check .\codex_usage.py .\tests
pyflakes .\codex_usage.py .\tests

Fixes #2 on merge

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.

Improve Codex home path discovery for cross-platform compatibility

1 participant