|
1 | 1 | class Codex < Formula |
2 | 2 | desc "OpenAI's coding agent that runs in your terminal" |
3 | 3 | 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" |
6 | 6 | license "Apache-2.0" |
| 7 | + head "https://github.com/openai/codex.git", branch: "main" |
7 | 8 |
|
8 | 9 | bottle do |
9 | | - sha256 cellar: :any_skip_relocation, arm64_sequoia: "754cf31c59ec4bffde64e85e00a5e4de09400cb29aac35bf86003922e764b987" |
10 | | - sha256 cellar: :any_skip_relocation, arm64_sonoma: "754cf31c59ec4bffde64e85e00a5e4de09400cb29aac35bf86003922e764b987" |
11 | | - sha256 cellar: :any_skip_relocation, arm64_ventura: "754cf31c59ec4bffde64e85e00a5e4de09400cb29aac35bf86003922e764b987" |
12 | | - sha256 cellar: :any_skip_relocation, sonoma: "16d121f1f81e90c950fdc5b8b9bba62ab1c3445fd7ee5d06882e39e799535a16" |
13 | | - sha256 cellar: :any_skip_relocation, ventura: "16d121f1f81e90c950fdc5b8b9bba62ab1c3445fd7ee5d06882e39e799535a16" |
14 | | - sha256 cellar: :any_skip_relocation, arm64_linux: "754cf31c59ec4bffde64e85e00a5e4de09400cb29aac35bf86003922e764b987" |
15 | | - sha256 cellar: :any_skip_relocation, x86_64_linux: "754cf31c59ec4bffde64e85e00a5e4de09400cb29aac35bf86003922e764b987" |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "de52c42521b1eb60600fbdf03acc0ad0d26fd1be3eefbc52025ea480499ce75f" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "6f1148326eb88cd542defb40f3a67e516f68b43ba5c125e0051b8b2001286b71" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "cf952e4aaa33a0e7a466f88142b2308b666183356817078009fa509287a1bfd0" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "900f5c341f0d92d0ab57f154feb36e9e74c194adbf7b8780fcc0ed5d185bcfbe" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "4294b7944faf2913410c33215d751f507ccd1f845ed2be06acaf6bb72915df1a" |
| 15 | + sha256 cellar: :any_skip_relocation, arm64_linux: "5ca98099f91a0c67dfc91b7d598078ca8daa926de395259f25dffb26e38a8b38" |
| 16 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "cd89a26bfadf9c88d5f7aac77ab4832cf0c2f78eb4bfed8990b509589fa1a2c2" |
16 | 17 | end |
17 | 18 |
|
18 | | - depends_on "node" |
| 19 | + depends_on "rust" => :build |
19 | 20 |
|
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 |
23 | 24 |
|
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 |
27 | 30 |
|
28 | | - generate_completions_from_executable(bin/"codex", "completion") |
| 31 | + system "cargo", "install", "--bin", "codex", *std_cargo_args(path: "codex-rs/cli") |
29 | 32 | end |
30 | 33 |
|
31 | 34 | test do |
32 | | - # codex is a TUI application |
33 | 35 | 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") |
34 | 43 | end |
35 | 44 | end |
0 commit comments