Skip to content

Commit cec7e03

Browse files
committed
codex 0.2.0 (TypeScript -> Rust)
Bump to 0.2.0 and builds the CLI from its Rust sources instead of downloading pre-built artifacts from npm. As we are moving to the Rust version as the source of truth for the Codex CLI: openai/codex#1174 This updates the brew formula to build the Rust version of the CLI from source. https://github.com/openai/codex/releases/tag/rust-v0.2.0 is the first GitHub Release that is not tagged as "pre-release."
1 parent 9065feb commit cec7e03

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

Formula/c/codex.rb

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
class Codex < Formula
22
desc "OpenAI's coding agent that runs in your terminal"
33
homepage "https://github.com/openai/codex"
4-
url "https://registry.npmjs.org/@openai/codex/-/codex-0.1.2505291658.tgz"
5-
sha256 "066a11322e815d680799330cf360bc9601deb0a40d907546c2cda9eb22cca86a"
4+
url "https://github.com/openai/codex/archive/refs/tags/rust-v0.2.0.tar.gz"
5+
sha256 "aa59d6af465d1fe89a82ae684ae3d8d5e6c1f6fbc270cc389c5966c6e969d867"
66
license "Apache-2.0"
7+
head "https://github.com/openai/codex.git", branch: "main"
78

89
bottle do
910
sha256 cellar: :any_skip_relocation, arm64_sequoia: "754cf31c59ec4bffde64e85e00a5e4de09400cb29aac35bf86003922e764b987"
@@ -15,21 +16,29 @@ class Codex < Formula
1516
sha256 cellar: :any_skip_relocation, x86_64_linux: "754cf31c59ec4bffde64e85e00a5e4de09400cb29aac35bf86003922e764b987"
1617
end
1718

18-
depends_on "node"
19+
depends_on "rust" => :build
1920

20-
def install
21-
system "npm", "install", *std_npm_args
22-
bin.install_symlink Dir["#{libexec}/bin/*"]
21+
on_linux do
22+
depends_on "openssl@3"
23+
end
2324

24-
# Remove incompatible pre-built binaries
25-
libexec.glob("lib/node_modules/@openai/codex/bin/*")
26-
.each { |f| rm_r(f) if f.extname != ".js" }
25+
def install
26+
if OS.linux?
27+
ENV["OPENSSL_DIR"] = Formula["openssl@3"].opt_prefix
28+
ENV["OPENSSL_NO_VENDOR"] = "1"
29+
end
2730

28-
generate_completions_from_executable(bin/"codex", "completion")
31+
system "cargo", "install", "--bin", "codex", *std_cargo_args(path: "codex-rs/cli")
2932
end
3033

3134
test do
32-
# codex is a TUI application
3335
assert_match version.to_s, shell_output("#{bin}/codex --version")
36+
37+
assert_equal "Reading prompt from stdin...\nNo prompt provided via stdin.\n",
38+
pipe_output("#{bin}/codex exec 2>&1", "", 1)
39+
40+
return unless OS.linux?
41+
42+
assert_equal "hello\n", shell_output("#{bin}/codex debug landlock echo hello")
3443
end
3544
end

0 commit comments

Comments
 (0)