Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

feat(bin): support bun fallback runtime for codex CLI (#282)

Sam Verhasselt6ee589cd1a77
diff --git a/README.md b/README.md
index bcfbf4f401..b043d5ab79 100644
--- a/README.md
+++ b/README.md
@@ -241,6 +241,8 @@ Below are a few bite‑size examples you can copy‑paste. Replace the text in q
npm install -g @openai/codex
# or
yarn global add @openai/codex
+# or
+bun install -g @openai/codex
```
</details>
diff --git a/codex-cli/bin/codex b/codex-cli/bin/codex
new file mode 100644
index 0000000000..9bf96bf29d
--- /dev/null
+++ b/codex-cli/bin/codex
@@ -0,0 +1,20 @@
+#!/usr/bin/env sh
+# resolve script path in case of symlink
+SOURCE="$0"
+while [ -h "$SOURCE" ]; do
+ DIR=$(dirname "$SOURCE")
+ SOURCE=$(readlink "$SOURCE")
+ case "$SOURCE" in
+ /*) ;; # absolute path
+ *) SOURCE="$DIR/$SOURCE" ;; # relative path
+ esac
+done
+DIR=$(cd "$(dirname "$SOURCE")" && pwd)
+if command -v node >/dev/null 2>&1; then
+ exec node "$DIR/../dist/cli.js" "$@"
+elif command -v bun >/dev/null 2>&1; then
+ exec bun "$DIR/../dist/cli.js" "$@"
+else
+ echo "Error: node or bun is required to run codex" >&2
+ exit 1
+fi
\ No newline at end of file
diff --git a/codex-cli/package.json b/codex-cli/package.json
index 0aee067c9b..64c7a25c8e 100644
--- a/codex-cli/package.json
+++ b/codex-cli/package.json
@@ -3,7 +3,7 @@
"version": "0.1.2504161510",
"license": "Apache-2.0",
"bin": {
- "codex": "dist/cli.js"
+ "codex": "bin/codex"
},
"type": "module",
"engines": {
@@ -28,6 +28,7 @@
},
"files": [
"README.md",
+ "bin",
"dist",
"src"
],