Commit Graph

54 Commits

  • restructure flake for codex-rs (#888)
    Right now since the repo is having two different implementations of
    codex, flake was updated to work with both typescript implementation and
    rust implementation
  • chore: introduce new --native flag to Node module release process (#844)
    This PR introduces an optional build flag, `--native`, that will build a
    version of the Codex npm module that:
    
    - Includes both the Node.js and native Rust versions (for Mac and Linux)
    - Will run the native version if `CODEX_RUST=1` is set
    - Runs the TypeScript version otherwise
    
    Note this PR also updates the workflow URL to
    https://github.com/openai/codex/actions/runs/14872557396, as that is a
    build from today that includes everything up through
    https://github.com/openai/codex/pull/843.
    
    Test Plan:
    
    In `~/code/codex/codex-cli`, I ran:
    
    ```
    pnpm stage-release --native
    ```
    
    The end of the output was:
    
    ```
    Staged version 0.1.2505121317 for release in /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN
    Test Node:
        node /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN/bin/codex.js --help
    Test Rust:
        CODEX_RUST=1 node /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN/bin/codex.js --help
    Next:  cd "/var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.xd2p5ETYGN" && npm publish --tag native
    ```
    
    I verified that running each of these commands ran the expected version
    of Codex.
    
    While here, I also added `bin` to the `files` list in `package.json`,
    which should have been done as part of
    https://github.com/openai/codex/pull/757, as that added new entries to
    `bin` that were matched by `.gitignore` but should have been included in
    a release.
  • feat: added arceeai as a provider (#818)
    - Added ArceeAI as a provider  - https://conductor.arcee.ai/v1
    - Compatible with ArceeAI SLMs (Virtuoso, Maestro)
    - Works with ArceeAI's Conductor auto‑router models (auto, auto‑tool),
    once #817 is merged
  • fix: migrate to AGENTS.md (#764)
    Migrate from `codex.md` to `AGENTS.md`
  • Adds Azure OpenAI support (#769)
    ## Summary
    
    This PR introduces support for Azure OpenAI as a provider within the
    Codex CLI. Users can now configure the tool to leverage their Azure
    OpenAI deployments by specifying `"azure"` as the provider in
    `config.json` and setting the corresponding `AZURE_OPENAI_API_KEY` and
    `AZURE_OPENAI_API_VERSION` environment variables. This functionality is
    added alongside the existing provider options (OpenAI, OpenRouter,
    etc.).
    
    Related to #92
    
    **Note:** This PR is currently in **Draft** status because tests on the
    `main` branch are failing. It will be marked as ready for review once
    the `main` branch is stable and tests are passing.
    
    ---
    
    ## What’s Changed
    
    -   **Configuration (`config.ts`, `providers.ts`, `README.md`):**
    - Added `"azure"` to the supported `providers` list in `providers.ts`,
    specifying its name, default base URL structure, and environment
    variable key (`AZURE_OPENAI_API_KEY`).
    - Defined the `AZURE_OPENAI_API_VERSION` environment variable in
    `config.ts` with a default value (`2025-03-01-preview`).
        -   Updated `README.md` to:
            -   Include "azure" in the list of providers.
    - Add a configuration section for Azure OpenAI, detailing the required
    environment variables (`AZURE_OPENAI_API_KEY`,
    `AZURE_OPENAI_API_VERSION`) with examples.
    - **Client Instantiation (`terminal-chat.tsx`, `singlepass-cli-app.tsx`,
    `agent-loop.ts`, `compact-summary.ts`, `model-utils.ts`):**
    - Modified various components and utility functions where the OpenAI
    client is initialized.
    - Added conditional logic to check if the configured `provider` is
    `"azure"`.
    - If the provider is Azure, the `AzureOpenAI` client from the `openai`
    package is instantiated, using the configured `baseURL`, `apiKey` (from
    `AZURE_OPENAI_API_KEY`), and `apiVersion` (from
    `AZURE_OPENAI_API_VERSION`).
    - Otherwise, the standard `OpenAI` client is instantiated as before.
    -   **Dependencies:**
    - Relies on the `openai` package's built-in support for `AzureOpenAI`.
    No *new* external dependencies were added specifically for this Azure
    implementation beyond the `openai` package itself.
    
    ---
    
    ## How to Test
    
    *This has been tested locally and confirmed working with Azure OpenAI.*
    
    1.  **Configure `config.json`:**
    Ensure your `~/.codex/config.json` (or project-specific config) includes
    Azure and sets it as the active provider:
        ```json
        {
          "providers": {
            // ... other providers
            "azure": {
              "name": "AzureOpenAI",
    "baseURL": "https://YOUR_RESOURCE_NAME.openai.azure.com", // Replace
    with your Azure endpoint
              "envKey": "AZURE_OPENAI_API_KEY"
            }
          },
          "provider": "azure", // Set Azure as the active provider
          "model": "o4-mini" // Use your Azure deployment name here
          // ... other config settings
        }
        ```
    2.  **Set up Environment Variables:**
        ```bash
        # Set the API Key for your Azure OpenAI resource
        export AZURE_OPENAI_API_KEY="your-azure-api-key-here"
    
    # Set the API Version (Optional - defaults to `2025-03-01-preview` if
    not set)
    # Ensure this version is supported by your Azure deployment and endpoint
        export AZURE_OPENAI_API_VERSION="2025-03-01-preview"
        ```
    3.  **Get the Codex CLI by building from this PR branch:**
    Clone your fork, checkout this branch (`feat/azure-openai`), navigate to
    `codex-cli`, and build:
        ```bash
        # cd /path/to/your/fork/codex
        git checkout feat/azure-openai # Or your branch name
        cd codex-cli
        corepack enable
        pnpm install
        pnpm build
        ```
    4.  **Invoke Codex:**
    Run the locally built CLI using `node` from the `codex-cli` directory:
        ```bash
        node ./dist/cli.js "Explain the purpose of this PR"
        ```
    *(Alternatively, if you ran `pnpm link` after building, you can use
    `codex "Explain the purpose of this PR"` from anywhere)*.
    5. **Verify:** Confirm that the command executes successfully and
    interacts with your configured Azure OpenAI deployment.
    
    ---
    
    ## Tests
    
    - [x] Tested locally against an Azure OpenAI deployment using API Key
    authentication. Basic commands and interactions confirmed working.
    
    ---
    
    ## Checklist
    
    - [x] Added Azure provider details to configuration files
    (`providers.ts`, `config.ts`).
    - [x] Implemented conditional `AzureOpenAI` client initialization based
    on provider setting.
    -   [x] Ensured `apiVersion` is passed correctly to the Azure client.
    -   [x] Updated `README.md` with Azure OpenAI setup instructions.
    - [x] Manually tested core functionality against a live Azure OpenAI
    endpoint.
    - [x] Add/update automated tests for the Azure code path (pending `main`
    stability).
    
    cc @theabhinavdas @nikodem-wrona @fouad-openai @tibo-openai (adjust as
    needed)
    
    ---
    
    I have read the CLA Document and I hereby sign the CLA
  • chore: make build process a single script to run (#757)
    This introduces `./codex-cli/scripts/stage_release.sh`, which is a shell
    script that stages a release for the Node.js module in a temp directory.
    It updates the release to include these native binaries:
    
    ```
    bin/codex-linux-sandbox-arm64
    bin/codex-linux-sandbox-x64
    ```
    
    though this PR does not update Codex CLI to use them yet.
    
    When doing local development, run
    `./codex-cli/scripts/install_native_deps.sh` to install these in your
    own `bin/` folder.
    
    This PR also updates `README.md` to document the new workflow.
    
    ---
    [//]: # (BEGIN SAPLING FOOTER)
    Stack created with [Sapling](https://sapling-scm.com). Best reviewed
    with [ReviewStack](https://reviewstack.dev/openai/codex/pull/757).
    * #763
    * __->__ #757
  • fix: read version from package.json instead of modifying session.ts (#753)
    I am working to simplify the build process. As a first step, update
    `session.ts` so it reads the `version` from `package.json` at runtime so
    we no longer have to modify it during the build process. I want to get
    to a place where the build looks like:
    
    ```
    cd codex-cli
    pnpm i
    pnpm build
    RELEASE_DIR=$(mktemp -d)
    cp -r bin "$RELEASE_DIR/bin"
    cp -r dist "$RELEASE_DIR/dist"
    cp -r src "$RELEASE_DIR/src" # important if we want sourcemaps to continue to work
    cp ../README.md "$RELEASE_DIR"
    VERSION=$(printf '0.1.%d' $(date +%y%m%d%H%M))
    jq --arg version "$VERSION" '.version = $version' package.json > "$RELEASE_DIR/package.json"
    ```
    
    Then the contents of `$RELEASE_DIR` should be good to `npm publish`, no?
  • docs: provider config (#653)
    close: #651
    
    Hi! @tibo-openai 👋 Could you share some great examples of
    `instructions.md` files? Thanks!
    
    ---------
    
    Co-authored-by: Thibault Sottiaux <tibo@openai.com>
  • update: readme (#630)
    - mention support for ZDR
    - codex open source fund
  • feat: update README and config to support custom providers with API k… (#577)
    When using a non-built-in provider with the `--provider` option, users
    are prompted:
    
    ```
    Set the environment variable <provider>_API_KEY and re-run this command.
    You can create a <provider>_API_KEY in the <provider> dashboard.
    ```
    
    However, many users are confused because, even after correctly setting
    `<provider>_API_KEY`, authentication may still fail unless
    `OPENAI_API_KEY` is _also_ present in the environment. This is not
    intuitive and leads to ambiguity about which API key is actually
    required and used as a fallback, especially when using custom or
    third-party (non-listed) providers.
    
    Furthermore, the original README/documentation did not mention the
    requirement to set `<provider>_BASE_URL` for non-built-in providers,
    which is necessary for proper client behavior. This omission made the
    configuration process more difficult for users trying to integrate with
    custom endpoints.
  • add instructions for connecting to a visual debugger under Contributing (#496)
    While here, I also moved the Nix stuff to the end of the
    **Contributing** section and replaced some examples with `npm` to use
    `pnpm`.
  • add check to ensure ToC in README.md matches headings in the file (#541)
    This introduces a Python script (written by Codex!) to verify that the
    table of contents in the root `README.md` matches the headings. Like
    `scripts/asciicheck.py` in https://github.com/openai/codex/pull/513, it
    reports differences by default (and exits non-zero if there are any) and
    also has a `--fix` option to synchronize the ToC with the headings.
    
    This will be enforced by CI and the changes to `README.md` in this PR
    were generated by the script, so you can see that our ToC was missing
    some entries prior to this PR.
  • Enforce ASCII in README.md (#513)
    This all started because I was going to write a script to autogenerate
    the Table of Contents in the root `README.md`, but I noticed that the
    `href` for the "Why Codex?" heading was `#whycodex` instead of
    `#why-codex`. This piqued my curiosity and it turned out that the space
    in "Why Codex?" was not an ASCII space but **U+00A0**, a non-breaking
    space, and so GitHub ignored it when generating the `href` for the
    heading.
    
    This also meant that when I did a text search for `why codex` in the
    `README.md` in VS Code, the "Why Codex" heading did not match because of
    the presence of **U+00A0**.
    
    In short, these types of Unicode characters seem like a hazard, so I
    decided to introduce this script to flag them, and if desired, to
    replace them with "good enough" ASCII equivalents. For now, this only
    applies to the root `README.md` file, but I think we should ultimately
    apply this across our source code, as well, as we seem to have quite a
    lot of non-ASCII Unicode and it's probably going to cause `rg` to miss
    things.
    
    Contributions of this PR:
    
    * `./scripts/asciicheck.py`, which takes a list of filepaths and returns
    non-zero if any of them contain non-ASCII characters. (Currently, there
    is one exception for  aka **U+2728**, though I would like to default to
    an empty allowlist and then require all exceptions to be specified as
    flags.)
    * A `--fix` option that will attempt to rewrite files with violations
    using a equivalents from a hardcoded substitution list.
    * An update to `ci.yml` to verify `./scripts/asciicheck.py README.md`
    succeeds.
    * A cleanup of `README.md` using the `--fix` option as well as some
    editorial decisions on my part.
    * I tried to update the `href`s in the Table of Contents to reflect the
    changes in the heading titles. (TIL that if a heading has a character
    like `&` surrounded by spaces, it becomes `--` in the generated `href`.)
  • revert #386 due to unsafe shell command parsing (#478)
    Reverts https://github.com/openai/codex/pull/386 because:
    
    * The parsing logic for shell commands was unsafe (`split(/\s+/)`
    instead of something like `shell-quote`)
    * We have a different plan for supporting auto-approved commands.
  • feat: read approvalMode from config file (#298)
    This PR implements support for reading the approvalMode setting from the
    user's config file (`~/.codex/config.json` or `~/.codex/config.yaml`),
    allowing users to set a persistent default approval mode without needing
    to specify command-line flags for each session.
    
    Changes:
    - Added approvalMode to the AppConfig type in config.ts
    - Updated loadConfig() to read the approval mode from the config file
    - Modified saveConfig() to persist the approval mode setting
    - Updated CLI logic to respect the config-defined approval mode (while
    maintaining CLI flag priority)
    - Added comprehensive tests for approval mode config functionality
    - Updated README to document the new config option in both YAML and JSON
    formats
    - additions to `.gitignore` for other CLI tools
    
    Motivation:
    As a user who regularly works with CLI-tools, I found it odd to have to
    alias this with the command flags I wanted when `approvalMode` simply
    wasn't being parsed even though it was an optional prop in `config.ts`.
    This change allows me (and other users) to set the preference once in
    the config file, streamlining daily usage while maintaining the ability
    to override via command-line flags when needed.
    
    Testing:
    I've added a new test case loads and saves approvalMode correctly that
    verifies:
    - Reading the approvalMode from the config file works correctly
    - Saving the approvalMode to the config file works as expected
    - The value persists through load/save operations
    
    All tests related to the implementation are passing.
  • feat: add user-defined safe commands configuration and approval logic #380 (#386)
    This pull request adds a feature that allows users to configure
    auto-approved commands via a `safeCommands` array in the configuration
    file.
    
    ## Related Issue
    #380 
    
    ## Changes
    - Added loading and validation of the `safeCommands` array in
    `src/utils/config.ts`
    - Implemented auto-approval logic for commands matching `safeCommands`
    prefixes in `src/approvals.ts`
    - Added test cases in `src/tests/approvals.test.ts` to verify
    `safeCommands` behavior
    - Updated documentation with examples and explanations of the
    configuration
  • docs: update README to use pnpm commands (#390)
    Since we migrated to `pnpm` in #287, this updates the README to reflect
    that change.
    Just a small cleanup to align the commands with the current setup.
  • feat: add Nix flake for reproducible development environments (#225)
    This PR introduces a Nix flake configuration to enable reproducible
    development environments:
    
    - Adds flake.nix defining a devShell with necessary dependencies.
    - Updates README.md with usage instructions for `nix develop`.
    - Ensures CI compatibility with Nix for consistent builds.
  • feat(bin): support bun fallback runtime for codex CLI (#282)
    This PR adds a shell wrapper in `codex-cli/bin/codex` to detect node or
    bun as the runtime.
    
    It updates:
    - `package.json` bin entry
    - published files list to include bin/
    - README install instructions to include `bun install -g @openai/codex`
  • add(.github): issue templates (#283)
    Add issue templates for:
    - Bug report
    - Docs issue
  • feat: add notifications for MacOS using Applescript (#160)
    yolo'ed it with codex. Let me know if this looks good to you.
    
    https://github.com/openai/codex/issues/148
    
    tested with:
    ```
    npm run build:dev
    ```
    
    <img width="377" alt="Screenshot 2025-04-16 at 18 12 01"
    src="https://github.com/user-attachments/assets/79aa799b-b0b9-479d-84f1-bfb83d34bfb9"
    />
  • fix: npm run format:fix in root (#268)
    stupid minor. unless you have main branch push setup to fix this
    yourself, here you go
    
    Latest commit is failing the format step in repo root
    
    https://github.com/openai/codex/actions/runs/14524272942/job/40752229698
  • docs: mention dotenv support in Quickstart (#262)
    Add a note in Quickstart that you can drop your API key into a `.env`
    file
    (since dotenv support was introduced in 40266be #122).
    
     Ran `npm test && npm run lint && npm run typecheck` locally
    
    I have read the CLA Document and I hereby sign the CLA
    
    Signed-off-by: Dan Lewis <dglewi@gmail.com>
  • docs: add tracing instructions to README (#257)
    **What**?
    Add a `Tracing / Verbose Logging` section to the README
    
    **Why**?
    Enable easier troubleshooting by logging full API requests, responses,
    and prompt details used during code generation.
    
    **How**?
    
    Inserted the new section between `Non‑interactive / CI mode` and `FAQ`.
  • docs: clarify sandboxing situation on Linux (#103)
    There doesn't appear to actually be any sandboxing on Linux. Correct the
    README.
    
    Signed-off-by: Christopher Cooper <christopher@cg505.com>
  • Feat/add husky (#223)
    # Add Husky and lint-staged for automated code quality checks
    
    ## Description
    This PR adds Husky Git hooks and lint-staged to automate code quality
    checks during the development workflow.
    
    ## Features Added
    - Pre-commit hook that runs lint-staged to check files before committing
    - Pre-push hook that runs tests and type checking before pushing
    - Configuration for lint-staged to format and lint different file types
    - Documentation explaining the Husky setup and usage
    - Updated README.md with information about Git hooks
    
    ## Benefits
    - Ensures consistent code style across the project
    - Prevents pushing code with failing tests or type errors
    - Reduces the need for style-related code review comments
    - Improves overall code quality
    
    ## Implementation Details
    - Added Husky and lint-staged as dev dependencies
    - Created pre-commit and pre-push hooks
    - Added configuration for lint-staged
    - Added documentation in HUSKY.md
    - Updated README.md with a new section on Git hooks
    
    ## Testing
    The hooks have been tested locally and work as expected:
    - Pre-commit hook runs ESLint and Prettier on staged files
    - Pre-push hook runs tests and type checking
    
    I have read the CLA Document and I hereby sign the CLA
    
    ---------
    
    Signed-off-by: Alpha Diop <alphakhoss@gmail.com>
  • docs: add ZDR org limitation to README (#234)
    **What?**
    Add a section to the README documenting the current limitation for Codex
    with Zero Data Retention (ZDR) organizations.
    
    **Why?**
    Users from ZDR organizations encounter errors due to the Responses API’s
    requirement for `store:true`, which is incompatible with ZDR policies.
    See #106 for more info.
    
    **How?**
    - Added a new section in the README, after FAQ and before Funding. 
    - Explained the error message and reason.
    - Linked to documentation as linked in the issue.
  • document Codex open source fund (#162)
    I added a section about the Codex Open Source Fund to the README to
    reach more developers.
  • fmt (#161)
    Signed-off-by: Thibault Sottiaux <tibo@openai.com>
  • w
    Signed-off-by: Thibault Sottiaux <tibo@openai.com>
  • minor change in description of Build from source in README.md (#149)
    Separated the `node ./dist/cli.js --help ` and `node ./dist/cli.js `.
    The comment suggested `node ./dist/cli.js --help ` was to run the
    locally-built CLI but in fact it shows the usage an options. It is a
    minor change and clarifies the flow for new developers.
  • feat: add shell completion subcommand (#138)
    Why
    ---
    Improves the usability of the `codex` CLI by adding shell completion for
    file paths. This allows users to quickly complete file arguments using
    tab completion in bash, zsh, and fish shells. Enable via `eval "$(codex
    completion <shell>)"`.
  • add: release script (#96)
    * add: release script
    
    * add: src to npm module
    
    * fix: readme
    
    Signed-off-by: Fouad Matin <fouad@openai.com>
    
    ---------
    
    Signed-off-by: Fouad Matin <fouad@openai.com>
  • changing some readme text to make it more exact (#77)
    Making README more factually and grammatically exact.
  • [readme] security review recipe (#72)
    * [readme] security review recipe
  • Update README.md (#46)
    Fix a typo where a p should have been a q
  • remove rg requirement (#50)
    Signed-off-by: Thibault Sottiaux <tibo@openai.com>
  • [readme] Add recipe for code review (#40)
    One of my favorite use cases is a read-only one; have `codex` suggest areas of the codebase that need attention. From here, it's also easy for the user to select one of the proposed tasks and have `codex` make the PR.