Commit Graph
33 Commits
Author SHA1 Message Date
James Peter f3385da970 fix(cli/windows): robust unzip in runtime bootstrap (powershell full-path, pwsh, tar fallback; extract to user cache) 2025-09-11 22:35:17 +10:00
James Peter 9132e2bfc1 fix(cli/windows): always print bootstrap error; remove debug gate
Also:
- chore(release): delete legacy stage_release.sh and remove references
- ci(release): add ESM integrity guard for bin/coder.js in npm pack tarball
- docs(npm): clarify prepublishOnly guidance
2025-09-11 22:18:38 +10:00
James Peter 09fdd2fd43 fix(codex-cli/bin): coder.js is pure ESM — replace internal require() with ESM fs APIs; avoid require in isWSL() 2025-09-11 20:02:17 +10:00
James Peter 6a0befcd2b fix(cli/windows): avoid EBUSY/EPERM on global upgrades by keeping native .exe in per-user cache; launcher prefers cache\n\n- Postinstall: on Windows, install binary to %LocalAppData%\just-every\code\<version> and do not leave a copy in node_modules.\n- Launcher: run from cache when available; mirror into node_modules only on Unix.\n- Outcome: global npm upgrades no longer fail when the CLI is running. 2025-09-11 10:06:49 +10:00
James Peter 08609e46c7 merge: integrate upstream/main (prefer ours); keep TUI fork, drop legacy vt100 tests, retain local common.rs 2025-09-03 19:49:35 +10:00
Michael BolinandGitHub b720b45461 fix: include arm64 Windows executable in npm module (#3067)
This is in support of https://github.com/openai/codex/issues/2979.

Tested by running:

```
./codex-cli/scripts/install_native_deps.sh --workflow-url https://github.com/openai/codex/actions/runs/17416421450
```
2025-09-02 15:43:42 -07:00
James Peter 8a0251e908 fix(cli/coder): de-duplicate validateBinary to avoid ESM redeclare error under Bun/Node 23 2025-08-30 14:15:21 +10:00
James Peter d4c65fc01f fix(cli/coder): make bootstrap helper async; fix Bun global install when postinstall is blocked\n\nBun can block postinstall; our coder entry bootstraps the native binary.\nIt used an await inside a non-async function, causing a syntax error under Node.\nNow the helper is async and the top-level call awaits it correctly. 2025-08-30 13:59:41 +10:00
James Peter 3da2934f7d fix(cli/install): bootstrap native binary on first run; drop unpublished win optional dep\n\n- Add self-bootstrap in bin/coder.js to fetch validated platform binary when postinstall is blocked (e.g., Bun global)\n- Prefer cached binary, then optional platform pkg, then GitHub release download\n- Remove @just-every/code-win32-x64 from optionalDependencies to avoid Bun 404 noise on non-Windows installs\n- Build verified with ./build-fast.sh 2025-08-30 13:39:39 +10:00
James Peter a8c4832940 fix(cli/bin): stop delegating to system 'code' (VS Code) when invoked via npm/npx; always run bundled binary and show path\n\n- Remove fragile delegation heuristic that caused to open VS Code\n- Print a concise notice under npx showing the exact binary path in use\n- Keep postinstall collision handling for global installs unchanged\n\nThis restores expected behavior and makes collisions visible during npx runs. 2025-08-29 15:44:56 +10:00
James Peter f25c5f3199 chore: commit local work (CLI + core + TUI) 2025-08-29 14:20:24 +10:00
James Peter 7f7f3f6bd9 cli(downloads): verify Content-Length, add retries/timeouts; improve WSL guidance\n\n- postinstall: bytes count vs Content-Length, inactivity/absolute timeouts, retry with backoff\n- coder.js: WSL detection + tailored guidance when binaries missing/invalid 2025-08-20 07:46:25 +10:00
James Peter e6646c4d72 cli(windows): guard against corrupt/empty downloads and improve spawn errors\n\n- postinstall: robust download + header validation (MZ/ELF/Mach-O), delete on failure\n- coder.js: pre-spawn binary header check; clearer EFTYPE/ENOEXEC/EACCES guidance\n- reduces confusing Windows EFTYPE crashes from partial downloads 2025-08-19 13:51:46 +10:00
James Peter fc17d512b7 refactor(naming): switch binaries and artifacts from 'coder' to 'code'; keep 'coder' as fallback alias only. Update workflows, scripts, and postinstall. 2025-08-17 20:45:10 +10:00
James Peter e1f9079b50 chore: commit pending changes on main (CLI, TUI, core, docs) 2025-08-17 18:55:58 +10:00
James Peter 434f13571f chore(rebrand): rename user-facing Coder → Code; update links to new repo
- Update TUI titles, labels, messages
- Update onboarding copy and links
- Update MCP titles and human-output banner
- Update README branding and URLs
- postinstall: switch release URL to just-every/code; offer optional 'code' alias without collisions
- package.json repository URL updated

Note: CLI command remains 'coder' to avoid VS Code collision; optional alias offered interactively.
2025-08-16 12:10:29 +10:00
James Peter b67a0da2b1 Merge upstream changes from openai/codex
Successfully merged all upstream changes while preserving our custom functionality:
- Kept our browser integration and screenshot features
- Preserved agent tracking and multi-agent support
- Maintained our live ring widget and custom UI components
- Integrated upstream's streaming improvements and new conversation manager
- Combined both versions' protocol updates and event handling

All conflicts resolved with preference for our functionality where there were genuine differences.
2025-08-14 08:16:36 +10:00
DylanandGitHub 06283e2694 [codex-cli] Add ripgrep as a dependency for node environment (#2237)
## Summary
Ripgrep is our preferred tool for file search. When users install via
`brew install codex`, it's automatically installed as a dependency. We
want to ensure that users running via an npm install also have this
tool! Microsoft has already solved this problem for VS Code - let's not
reinvent the wheel.

This approach of appending to the PATH directly might be a bit
heavy-handed, but feels reasonably robust to a variety of environment
concerns. Open to thoughts on better approaches here!

## Testing
- [x] confirmed this import approach works with `node -e "const { rgPath
} = require('@vscode/ripgrep'); require('child_process').spawn(rgPath,
['--version'], { stdio: 'inherit' })"`
- [x] Ran codex.js locally with `rg` uninstalled, asked it to run `which
rg`. Output below:

```
⚡ Ran command which rg; echo $?
  ⎿ /Users/dylan.hurd/code/dh--npm-rg/node_modules/@vscode/ripgrep/bin/rg
    0

codex
Re-running to confirm the path and exit code.

- Path: `/Users/dylan.hurd/code/dh--npm-rg/node_modules/@vscode/ripgrep/bin/rg`
- Exit code: `0`
```
2025-08-13 13:49:27 -07:00
James Peter d1641caa42 fix: handle permission errors for binaries on Linux/WSL
- Add automatic chmod +x when running coder.js on Unix systems
- Fix postinstall script to use octal notation for chmod (0o755)
- Add better error messages when binary is not executable
- Always try to fix permissions for existing binaries
- Bump version to 0.1.2 for hotfix release
2025-08-12 06:55:01 +10:00
James Peter 596944c64b fix: remove dangling symlinks from codex-cli/bin and update gitignore
- Remove tracked symlinks that were causing build failures
- Add gitignore patterns to prevent binary symlinks from being tracked
- Fixes 'cp: not writing through dangling symlink' error in release workflow
2025-08-11 22:29:50 +10:00
James Peter e88aebf24f feat: add coder fork enhancements - mouse scrolling, glitch animation, and improved TUI 2025-08-11 21:51:46 +10:00
James Peter 279e211228 feat: set up code fork with rebranding and npm publishing
- Rename binaries from codex to code across all Cargo.toml files
- Create @just-every/code npm package with generic build scripts
- Add CODE_HOME environment variable support (falls back to CODEX_HOME)
- Create GitHub Actions workflow for automated npm releases
- Update JavaScript wrapper from codex.js to code.js
- Add FORK_SETUP.md documentation
- Configure dual-branch strategy for fork management
2025-08-10 15:57:12 +10:00
Michael BolinandGitHub f82bb30dba feat: include Windows binary of the CLI in the npm release (#2040)
To date, the build scripts in `codex-cli` still supported building the
old TypeScript version of the Codex CLI to give Windows users something
they can run, but we are just going to have them use the Rust version
like everyone else, so:

- updates `codex-cli/bin/codex.js` so that we run the native binary or
throw if the target platform/arch is not supported (no more conditional
usage based on `CODEX_RUST`, `use-native` file, etc.)
- drops the `--native` flag from `codex-cli/scripts/stage_release.sh`
and updates all the code paths to behave as if `--native` were passed
(i.e., it is the only way to run it now)

Tested this by running:

```
./codex-cli/scripts/stage_rust_release.py --release-version 0.20.0-alpha.2
```
2025-08-08 14:44:35 -07:00
d2a6586738 check for updates (#1764)
1. Ping https://api.github.com/repos/openai/codex/releases/latest (at
most once every 20 hrs)
2. Store the result in ~/.codex/version.jsonl
3. If CARGO_PKG_VERSION < latest_version, print a message at boot.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2025-08-02 00:31:38 +00:00
Michael BolinandGitHub 4fe6720622 fix: update bin/codex.js so it listens for exit on the child process (#1590)
When Codex CLI is installed via `npm`, we use a `.js` wrapper script to
launch the Rust binary.

- Previously, we were not listening for signals to ensure that killing
the Node.js process would also kill the underlying Rust process.
- We also did not have a proper `exit` handler in place on the child
process to ensure we exited from the Node.js process.

This PR fixes these things and hopefully addresses
https://github.com/openai/codex/issues/1570.

This also adds logic so that Windows falls back to the TypeScript CLI
again, which should address https://github.com/openai/codex/issues/1573.
2025-07-16 16:35:29 -07:00
pchuriandGitHub 80b8bb822a Add Android platform support for Codex CLI (#1488)
## Summary
Add Android platform support to Codex CLI

## What?
- Added `android` to the list of supported platforms in
`codex-cli/bin/codex.js`
- Treats Android as Linux for binary compatibility

## Why?
- Fixes "Unsupported platform: android (arm64)" error on Termux
- Enables Codex CLI usage on Android devices via Termux
- Improves platform compatibility without affecting other platforms

## How?
- Modified the platform detection switch statement to include `case
"android":`
- Android falls through to the same logic as Linux, using appropriate
ARM64 binaries
- Minimal change with no breaking effects on existing functionality

## Testing
- Tested on Android/Termux environment
- Verified the fix resolves the platform detection error
- Confirmed no impact on other platforms

## Related Issues
Fixes the "Unsupported platform: android (arm64)" error reported by
Termux users
2025-07-09 22:06:55 -07:00
Michael BolinandGitHub a7a21aece3 fix: use aarch64-unknown-linux-musl instead of aarch64-unknown-linux-gnu (#1228)
Now that we have published a GitHub Release that contains arm64 musl
artifacts for Linux, update the following scripts to take advantage of
them:

- `dotslash-config.json` now uses musl artifacts for the `linux-aarch64`
target
- `install_native_deps.sh` for the TypeScript CLI now includes
`codex-linux-sandbox-aarch64-unknown-linux-musl` instead of
`codex-linux-sandbox-aarch64-unknown-linux-gnu` for sandboxing
- `codex-cli/bin/codex.js` now checks for `aarch64-unknown-linux-musl`
artifacts instead of `aarch64-unknown-linux-gnu` ones
2025-06-05 22:45:45 -07:00
Michael BolinandGitHub 28a7b51a43 fix: for the @native release of the Node module, use the Rust version by default (#1084)
Added logic so that when we run `./scripts/stage_release.sh --native`
(for the `@native` version of the Node module), we drop a `use-native`
file next to `codex.js`. If present, `codex.js` will now run the Rust
CLI.

Ran `./scripts/stage_release.sh --native` and verified that when the
running `codex.js` in the staged folder:

```
$ /var/folders/wm/f209bc1n2bd_r0jncn9s6j_00000gp/T/tmp.efvEvBlSN6/bin/codex.js --version
codex-cli 0.0.2505220956
```

it ran the expected Rust version of the CLI, as desired.

While here, I also updated the Rust version to one that I cut today,
which includes the new shell environment policy config option:
https://github.com/openai/codex/pull/1061. Note this may "break" some
users if the processes spawned by Codex need extra environment
variables. (We are still working to determine what the right defaults
should be for this option.)
2025-05-22 13:42:55 -07:00
Michael BolinandGitHub 49f65c5532 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.
2025-05-12 13:38:10 -07:00
Fouad MatinandGitHub dffa632ead fix: /bug report command, thinking indicator (#381)
- Fix `/bug` report command
- Fix thinking indicator
2025-04-18 18:13:34 -07:00
PramaandGitHub df8cfb62d8 fix: Improper spawn of sh on Windows Powershell (#318)
# Fix CLI launcher on Windows by replacing `sh`-based entrypoint with
cross-platform Node script

## What's changed

* This PR attempts to replace the sh-based entry point with a node
script that works on all platforms including Windows Powershell and CMD

## Why 

* Previously, when installing Codex globally via `npm i -g
@openai/codex`, Windows resulted in a broken CLI issue due to the `ps1`
launcher trying to execute `sh.exe`.

* If users don't have Unix-style shell, running the command will fail as
seen below since `sh.exe` can't be found

* Output:
 ``` 
& : The term 'sh.exe' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is
correct and try again.
At C:\Users\{user}\AppData\Roaming\npm\codex.ps1:24 char:7
+     & "sh$exe"  "$basedir/node_modules/@openai/codex/bin/codex" $args
+       ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (sh.exe:String) [],
CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
```



## How
* By using a Node based entry point that resolves the path to the compiled ESM bundle and dynamically loads it using native ESM

* Removed dependency on platform-specific launchers allowing a single entrypoint to work everywhere Node.js runs.


## Result

Codex CLI now supports cross-platform and launches correctly via:
* macOS / Linux
* Windows PowerShell
* GitBash
* CMD
* WSL

Directly addresses #316 

![image](https://github.com/user-attachments/assets/85faaca4-24bc-47c9-8160-4e30df6da4c3)


![image](https://github.com/user-attachments/assets/a13f7adc-52c1-4c0e-af02-e35a35dc45d4)
2025-04-18 11:35:51 -07:00
Fouad MatinandGitHub 03146fbfb1 add: changelog (#308)
- Release `@openai/[email protected]`
- Add changelog
2025-04-17 23:34:05 -07:00
Sam VerhasseltandGitHub 2822d68fe4 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`
2025-04-17 17:32:19 -07:00