mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
Choosing module granularity over item granularity is based on a similar choice made in the standard library to balance readabilty, with easy to read diffs. This saves 2098 lines or about 33% of the lines spent writing imports. This is beneficial to both human readers who have to scroll past large import blocks when reading a file as well as codex which shouldn't have to add as many tokens to its context. Manual changes to rustfmt.toml, rust-ci.yml, justfile, docs/contributing and docs/install. The actual format commit is intentionally in a second commit to make it easier to rebase this PR as main moves (drop the next commit and re-run cargo +nightly fmt). Added cargo nightly to the ci and justfile. In theory this is unstable, but in real world use this tends to hit a problems perhaps once every 6 months. The fix is usually fairly easy (pin a version briefly), and the problems tend to be fixed pretty quickly.
1.5 KiB
1.5 KiB
Install & build
System requirements
| Requirement | Details |
|---|---|
| Operating systems | macOS 12+, Ubuntu 20.04+/Debian 10+, or Windows 11 via WSL2 |
| Git (optional, recommended) | 2.23+ for built-in PR helpers |
| RAM | 4-GB minimum (8-GB recommended) |
DotSlash
The GitHub Release also contains a DotSlash file for the Codex CLI named codex. Using a DotSlash file makes it possible to make a lightweight commit to source control to ensure all contributors use the same version of an executable, regardless of what platform they use for development.
Build from source
# Clone the repository and navigate to the root of the Cargo workspace.
git clone https://github.com/openai/codex.git
cd codex/codex-rs
# Install the Rust toolchain, if necessary.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
rustup component add rustfmt
rustup component add clippy
rustup install nightly # For rustfmt with unstable options.
# Build Codex.
cargo build
# Launch the TUI with a sample prompt.
cargo run --bin codex -- "explain this codebase to me"
# After making changes, ensure the code is clean.
cargo +nightly fmt
cargo clippy --tests
# Run the tests.
cargo test