@zhiman_innies/innies-codex 0.122.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ <p align="center"><code>npm i -g @openai/codex</code><br />or <code>brew install --cask codex</code></p>
2
+ <p align="center"><strong>Codex CLI</strong> is a coding agent from OpenAI that runs locally on your computer.
3
+ <p align="center">
4
+ <img src="https://github.com/openai/codex/blob/main/.github/codex-cli-splash.png" alt="Codex CLI splash" width="80%" />
5
+ </p>
6
+ </br>
7
+ If you want Codex in your code editor (VS Code, Cursor, Windsurf), <a href="https://developers.openai.com/codex/ide">install in your IDE.</a>
8
+ </br>If you want the desktop app experience, run <code>codex app</code> or visit <a href="https://chatgpt.com/codex?app-landing-page=true">the Codex App page</a>.
9
+ </br>If you are looking for the <em>cloud-based agent</em> from OpenAI, <strong>Codex Web</strong>, go to <a href="https://chatgpt.com/codex">chatgpt.com/codex</a>.</p>
10
+
11
+ ---
12
+
13
+ ## Quickstart
14
+
15
+ ### Installing and running Codex CLI
16
+
17
+ Install globally with your preferred package manager:
18
+
19
+ ```shell
20
+ # Install using npm
21
+ npm install -g @openai/codex
22
+ ```
23
+
24
+ ```shell
25
+ # Install using Homebrew
26
+ brew install --cask codex
27
+ ```
28
+
29
+ Then simply run `codex` to get started.
30
+
31
+ <details>
32
+ <summary>You can also go to the <a href="https://github.com/openai/codex/releases/latest">latest GitHub Release</a> and download the appropriate binary for your platform.</summary>
33
+
34
+ Each GitHub Release contains many executables, but in practice, you likely want one of these:
35
+
36
+ - macOS
37
+ - Apple Silicon/arm64: `codex-aarch64-apple-darwin.tar.gz`
38
+ - x86_64 (older Mac hardware): `codex-x86_64-apple-darwin.tar.gz`
39
+ - Linux
40
+ - x86_64: `codex-x86_64-unknown-linux-musl.tar.gz`
41
+ - arm64: `codex-aarch64-unknown-linux-musl.tar.gz`
42
+
43
+ Each archive contains a single entry with the platform baked into the name (e.g., `codex-x86_64-unknown-linux-musl`), so you likely want to rename it to `codex` after extracting it.
44
+
45
+ </details>
46
+
47
+ ### Using Codex with your ChatGPT plan
48
+
49
+ Run `codex` and select **Sign in with ChatGPT**. We recommend signing into your ChatGPT account to use Codex as part of your Plus, Pro, Business, Edu, or Enterprise plan. [Learn more about what's included in your ChatGPT plan](https://help.openai.com/en/articles/11369540-codex-in-chatgpt).
50
+
51
+ You can also use Codex with an API key, but this requires [additional setup](https://developers.openai.com/codex/auth#sign-in-with-an-api-key).
52
+
53
+ ## Docs
54
+
55
+ - [**Codex Documentation**](https://developers.openai.com/codex)
56
+ - [**Contributing**](./docs/contributing.md)
57
+ - [**Installing & building**](./docs/install.md)
58
+ - [**Open source fund**](./docs/open-source-fund.md)
59
+
60
+ This repository is licensed under the [Apache-2.0 License](LICENSE).
package/bin/codex.js ADDED
@@ -0,0 +1,202 @@
1
+ #!/usr/bin/env node
2
+ // Unified entry point for the Innies Codex CLI.
3
+
4
+ import { spawn } from "node:child_process";
5
+ import { existsSync } from "fs";
6
+ import { createRequire } from "node:module";
7
+ import path from "path";
8
+ import { fileURLToPath } from "url";
9
+
10
+ // __dirname equivalent in ESM
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = path.dirname(__filename);
13
+ const require = createRequire(import.meta.url);
14
+
15
+ const PLATFORM_PACKAGE_BY_TARGET = {
16
+ "x86_64-apple-darwin": "@zhiman_innies/innies-codex-darwin-x64",
17
+ "aarch64-apple-darwin": "@zhiman_innies/innies-codex-darwin-arm64",
18
+ };
19
+
20
+ const { platform, arch } = process;
21
+
22
+ let targetTriple = null;
23
+ switch (platform) {
24
+ case "darwin":
25
+ switch (arch) {
26
+ case "x64":
27
+ targetTriple = "x86_64-apple-darwin";
28
+ break;
29
+ case "arm64":
30
+ targetTriple = "aarch64-apple-darwin";
31
+ break;
32
+ default:
33
+ break;
34
+ }
35
+ break;
36
+ default:
37
+ break;
38
+ }
39
+
40
+ if (!targetTriple) {
41
+ throw new Error(
42
+ `Unsupported platform: ${platform} (${arch}). Innies Codex currently ships macOS builds only.`,
43
+ );
44
+ }
45
+
46
+ const platformPackage = PLATFORM_PACKAGE_BY_TARGET[targetTriple];
47
+ if (!platformPackage) {
48
+ throw new Error(`Unsupported target triple: ${targetTriple}`);
49
+ }
50
+
51
+ const inniesBinaryName = "innies";
52
+ const localVendorRoot = path.join(__dirname, "..", "vendor");
53
+ const localBinaryPath = path.join(
54
+ localVendorRoot,
55
+ targetTriple,
56
+ "codex",
57
+ inniesBinaryName,
58
+ );
59
+
60
+ let vendorRoot;
61
+ try {
62
+ const packageJsonPath = require.resolve(`${platformPackage}/package.json`);
63
+ vendorRoot = path.join(path.dirname(packageJsonPath), "vendor");
64
+ } catch {
65
+ if (existsSync(localBinaryPath)) {
66
+ vendorRoot = localVendorRoot;
67
+ } else {
68
+ const packageManager = detectPackageManager();
69
+ const updateCommand =
70
+ packageManager === "bun"
71
+ ? "bun install -g @zhiman_innies/innies-codex@latest"
72
+ : "npm install -g @zhiman_innies/innies-codex@latest";
73
+ throw new Error(
74
+ `Missing optional dependency ${platformPackage}. Reinstall Innies Codex: ${updateCommand}`,
75
+ );
76
+ }
77
+ }
78
+
79
+ if (!vendorRoot) {
80
+ const packageManager = detectPackageManager();
81
+ const updateCommand =
82
+ packageManager === "bun"
83
+ ? "bun install -g @zhiman_innies/innies-codex@latest"
84
+ : "npm install -g @zhiman_innies/innies-codex@latest";
85
+ throw new Error(
86
+ `Missing optional dependency ${platformPackage}. Reinstall Innies Codex: ${updateCommand}`,
87
+ );
88
+ }
89
+
90
+ const archRoot = path.join(vendorRoot, targetTriple);
91
+ const binaryPath = path.join(archRoot, "codex", inniesBinaryName);
92
+
93
+ // Use an asynchronous spawn instead of spawnSync so that Node is able to
94
+ // respond to signals (e.g. Ctrl-C / SIGINT) while the native binary is
95
+ // executing. This allows us to forward those signals to the child process
96
+ // and guarantees that when either the child terminates or the parent
97
+ // receives a fatal signal, both processes exit in a predictable manner.
98
+
99
+ function getUpdatedPath(newDirs) {
100
+ const pathSep = process.platform === "win32" ? ";" : ":";
101
+ const existingPath = process.env.PATH || "";
102
+ const updatedPath = [
103
+ ...newDirs,
104
+ ...existingPath.split(pathSep).filter(Boolean),
105
+ ].join(pathSep);
106
+ return updatedPath;
107
+ }
108
+
109
+ /**
110
+ * Use heuristics to detect the package manager that was used to install Innies Codex
111
+ * in order to give the user a hint about how to update it.
112
+ */
113
+ function detectPackageManager() {
114
+ const userAgent = process.env.npm_config_user_agent || "";
115
+ if (/\bbun\//.test(userAgent)) {
116
+ return "bun";
117
+ }
118
+
119
+ const execPath = process.env.npm_execpath || "";
120
+ if (execPath.includes("bun")) {
121
+ return "bun";
122
+ }
123
+
124
+ if (
125
+ __dirname.includes(".bun/install/global") ||
126
+ __dirname.includes(".bun\\install\\global")
127
+ ) {
128
+ return "bun";
129
+ }
130
+
131
+ return userAgent ? "npm" : null;
132
+ }
133
+
134
+ const additionalDirs = [];
135
+ const pathDir = path.join(archRoot, "path");
136
+ if (existsSync(pathDir)) {
137
+ additionalDirs.push(pathDir);
138
+ }
139
+ const updatedPath = getUpdatedPath(additionalDirs);
140
+
141
+ const env = { ...process.env, PATH: updatedPath };
142
+ const packageManagerEnvVar =
143
+ detectPackageManager() === "bun"
144
+ ? "CODEX_MANAGED_BY_BUN"
145
+ : "CODEX_MANAGED_BY_NPM";
146
+ env[packageManagerEnvVar] = "1";
147
+
148
+ const child = spawn(binaryPath, process.argv.slice(2), {
149
+ stdio: "inherit",
150
+ env,
151
+ });
152
+
153
+ child.on("error", (err) => {
154
+ // Typically triggered when the binary is missing or not executable.
155
+ // Re-throwing here will terminate the parent with a non-zero exit code
156
+ // while still printing a helpful stack trace.
157
+ // eslint-disable-next-line no-console
158
+ console.error(err);
159
+ process.exit(1);
160
+ });
161
+
162
+ // Forward common termination signals to the child so that it shuts down
163
+ // gracefully. In the handler we temporarily disable the default behavior of
164
+ // exiting immediately; once the child has been signaled we simply wait for
165
+ // its exit event which will in turn terminate the parent (see below).
166
+ const forwardSignal = (signal) => {
167
+ if (child.killed) {
168
+ return;
169
+ }
170
+ try {
171
+ child.kill(signal);
172
+ } catch {
173
+ /* ignore */
174
+ }
175
+ };
176
+
177
+ ["SIGINT", "SIGTERM", "SIGHUP"].forEach((sig) => {
178
+ process.on(sig, () => forwardSignal(sig));
179
+ });
180
+
181
+ // When the child exits, mirror its termination reason in the parent so that
182
+ // shell scripts and other tooling observe the correct exit status.
183
+ // Wrap the lifetime of the child process in a Promise so that we can await
184
+ // its termination in a structured way. The Promise resolves with an object
185
+ // describing how the child exited: either via exit code or due to a signal.
186
+ const childResult = await new Promise((resolve) => {
187
+ child.on("exit", (code, signal) => {
188
+ if (signal) {
189
+ resolve({ type: "signal", signal });
190
+ } else {
191
+ resolve({ type: "code", exitCode: code ?? 1 });
192
+ }
193
+ });
194
+ });
195
+
196
+ if (childResult.type === "signal") {
197
+ // Re-emit the same signal so that the parent terminates with the expected
198
+ // semantics (this also sets the correct exit code of 128 + n).
199
+ process.kill(process.pid, childResult.signal);
200
+ } else {
201
+ process.exit(childResult.exitCode);
202
+ }
package/bin/innies.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+
6
+ if (!process.env.CODEX_HOME) {
7
+ process.env.CODEX_HOME = path.join(os.homedir(), ".innies");
8
+ }
9
+
10
+ await import("./codex.js");
package/bin/rg ADDED
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env dotslash
2
+
3
+ {
4
+ "name": "rg",
5
+ "platforms": {
6
+ "macos-aarch64": {
7
+ "size": 1777930,
8
+ "hash": "sha256",
9
+ "digest": "378e973289176ca0c6054054ee7f631a065874a352bf43f0fa60ef079b6ba715",
10
+ "format": "tar.gz",
11
+ "path": "ripgrep-15.1.0-aarch64-apple-darwin/rg",
12
+ "providers": [
13
+ {
14
+ "url": "https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-aarch64-apple-darwin.tar.gz"
15
+ }
16
+ ]
17
+ },
18
+ "linux-aarch64": {
19
+ "size": 1869959,
20
+ "hash": "sha256",
21
+ "digest": "2b661c6ef508e902f388e9098d9c4c5aca72c87b55922d94abdba830b4dc885e",
22
+ "format": "tar.gz",
23
+ "path": "ripgrep-15.1.0-aarch64-unknown-linux-gnu/rg",
24
+ "providers": [
25
+ {
26
+ "url": "https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-aarch64-unknown-linux-gnu.tar.gz"
27
+ }
28
+ ]
29
+ },
30
+ "macos-x86_64": {
31
+ "size": 1894127,
32
+ "hash": "sha256",
33
+ "digest": "64811cb24e77cac3057d6c40b63ac9becf9082eedd54ca411b475b755d334882",
34
+ "format": "tar.gz",
35
+ "path": "ripgrep-15.1.0-x86_64-apple-darwin/rg",
36
+ "providers": [
37
+ {
38
+ "url": "https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-x86_64-apple-darwin.tar.gz"
39
+ }
40
+ ]
41
+ },
42
+ "linux-x86_64": {
43
+ "size": 2263077,
44
+ "hash": "sha256",
45
+ "digest": "1c9297be4a084eea7ecaedf93eb03d058d6faae29bbc57ecdaf5063921491599",
46
+ "format": "tar.gz",
47
+ "path": "ripgrep-15.1.0-x86_64-unknown-linux-musl/rg",
48
+ "providers": [
49
+ {
50
+ "url": "https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-x86_64-unknown-linux-musl.tar.gz"
51
+ }
52
+ ]
53
+ },
54
+ "windows-x86_64": {
55
+ "size": 1810687,
56
+ "hash": "sha256",
57
+ "digest": "124510b94b6baa3380d051fdf4650eaa80a302c876d611e9dba0b2e18d87493a",
58
+ "format": "zip",
59
+ "path": "ripgrep-15.1.0-x86_64-pc-windows-msvc/rg.exe",
60
+ "providers": [
61
+ {
62
+ "url": "https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-x86_64-pc-windows-msvc.zip"
63
+ }
64
+ ]
65
+ },
66
+ "windows-aarch64": {
67
+ "size": 1675460,
68
+ "hash": "sha256",
69
+ "digest": "00d931fb5237c9696ca49308818edb76d8eb6fc132761cb2a1bd616b2df02f8e",
70
+ "format": "zip",
71
+ "path": "ripgrep-15.1.0-aarch64-pc-windows-msvc/rg.exe",
72
+ "providers": [
73
+ {
74
+ "url": "https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-aarch64-pc-windows-msvc.zip"
75
+ }
76
+ ]
77
+ }
78
+ }
79
+ }
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@zhiman_innies/innies-codex",
3
+ "version": "0.122.11",
4
+ "license": "Apache-2.0",
5
+ "bin": {
6
+ "innies": "bin/innies.js"
7
+ },
8
+ "type": "module",
9
+ "engines": {
10
+ "node": ">=16"
11
+ },
12
+ "files": [
13
+ "bin"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/zhimanai/innies-codex",
18
+ "directory": "codex-cli"
19
+ },
20
+ "packageManager": "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc",
21
+ "optionalDependencies": {
22
+ "@zhiman_innies/innies-codex-darwin-x64": "0.122.11-darwin-x64",
23
+ "@zhiman_innies/innies-codex-darwin-arm64": "0.122.11-darwin-arm64"
24
+ }
25
+ }