codex-potter 0.1.24 → 0.1.26-darwin-arm64

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 CHANGED
@@ -6,22 +6,19 @@ Install:
6
6
  npm install -g codex-potter
7
7
  ```
8
8
 
9
- Run:
10
-
11
- ```sh
12
- codex-potter --yolo
13
- ```
14
-
15
- Supported platforms (via bundled native binaries):
9
+ Supported platforms:
16
10
 
17
11
  - macOS: Apple Silicon + Intel
18
12
  - Linux: x86_64 + aarch64
19
13
  - Windows: x86_64 + aarch64 (ARM64)
20
- - Android: treated as Linux (uses the bundled Linux musl binaries)
21
14
 
22
- Build from source:
15
+ Packaging note:
23
16
 
24
- ```sh
25
- cargo build
26
- ./target/debug/codex-potter --yolo
27
- ```
17
+ - The `codex-potter` npm package ships a small cross-platform launcher.
18
+ - The native binary payload is delivered via platform-specific optional dependencies.
19
+ If you see an error like `Missing optional dependency codex-potter-<platform>`, reinstall
20
+ CodexPotter so your package manager can fetch the correct platform package.
21
+
22
+ ---
23
+
24
+ See https://github.com/breezewish/CodexPotter for full usage.
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
1
  {
2
2
  "name": "codex-potter",
3
- "version": "0.1.24",
3
+ "version": "0.1.26-darwin-arm64",
4
4
  "license": "Apache-2.0",
5
- "bin": {
6
- "codex-potter": "bin/codex-potter.js"
7
- },
8
- "type": "module",
9
- "engines": {
10
- "node": ">=16"
11
- },
5
+ "os": [
6
+ "darwin"
7
+ ],
8
+ "cpu": [
9
+ "arm64"
10
+ ],
12
11
  "files": [
13
- "bin",
14
- "vendor",
15
- "README.md"
12
+ "vendor"
16
13
  ],
17
14
  "repository": {
18
15
  "type": "git",
19
16
  "url": "https://github.com/breezewish/CodexPotter",
20
17
  "directory": "npm"
21
- }
18
+ },
19
+ "engines": {
20
+ "node": ">=16"
21
+ },
22
+ "packageManager": "pnpm@10.29.3+sha512.498e1fb4cca5aa06c1dcf2611e6fafc50972ffe7189998c409e90de74566444298ffe43e6cd2acdc775ba1aa7cc5e092a8b7054c811ba8c5770f84693d33d2dc"
22
23
  }
@@ -1,161 +0,0 @@
1
- #!/usr/bin/env node
2
- // Unified entry point for the CodexPotter CLI.
3
-
4
- import { spawn } from "node:child_process";
5
- import { existsSync } from "node:fs";
6
- import path from "node:path";
7
- import { fileURLToPath } from "node:url";
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = path.dirname(__filename);
11
-
12
- const { platform, arch } = process;
13
-
14
- let targetTriple = null;
15
- switch (platform) {
16
- case "linux":
17
- case "android":
18
- switch (arch) {
19
- case "x64":
20
- targetTriple = "x86_64-unknown-linux-musl";
21
- break;
22
- case "arm64":
23
- targetTriple = "aarch64-unknown-linux-musl";
24
- break;
25
- default:
26
- break;
27
- }
28
- break;
29
- case "darwin":
30
- switch (arch) {
31
- case "x64":
32
- targetTriple = "x86_64-apple-darwin";
33
- break;
34
- case "arm64":
35
- targetTriple = "aarch64-apple-darwin";
36
- break;
37
- default:
38
- break;
39
- }
40
- break;
41
- case "win32":
42
- switch (arch) {
43
- case "x64":
44
- targetTriple = "x86_64-pc-windows-msvc";
45
- break;
46
- case "arm64":
47
- targetTriple = "aarch64-pc-windows-msvc";
48
- break;
49
- default:
50
- break;
51
- }
52
- break;
53
- default:
54
- break;
55
- }
56
-
57
- if (!targetTriple) {
58
- throw new Error(`Unsupported platform: ${platform} (${arch})`);
59
- }
60
-
61
- const vendorRoot = path.join(__dirname, "..", "vendor");
62
- const archRoot = path.join(vendorRoot, targetTriple);
63
- const binaryName =
64
- process.platform === "win32" ? "codex-potter.exe" : "codex-potter";
65
- const binaryPath = path.join(archRoot, "codex-potter", binaryName);
66
-
67
- function getUpdatedPath(newDirs) {
68
- const pathSep = process.platform === "win32" ? ";" : ":";
69
- const existingPath = process.env.PATH || "";
70
- const updatedPath = [
71
- ...newDirs,
72
- ...existingPath.split(pathSep).filter(Boolean),
73
- ].join(pathSep);
74
- return updatedPath;
75
- }
76
-
77
- /**
78
- * Use heuristics to detect the package manager that was used to install CodexPotter
79
- * in order to give the user a hint about how to update it.
80
- */
81
- function detectPackageManager() {
82
- const userAgent = process.env.npm_config_user_agent || "";
83
- if (/\bbun\//.test(userAgent)) {
84
- return "bun";
85
- }
86
-
87
- const execPath = process.env.npm_execpath || "";
88
- if (execPath.includes("bun")) {
89
- return "bun";
90
- }
91
-
92
- if (
93
- __dirname.includes(".bun/install/global") ||
94
- __dirname.includes(".bun\\install\\global")
95
- ) {
96
- return "bun";
97
- }
98
-
99
- return userAgent ? "npm" : null;
100
- }
101
-
102
- const additionalDirs = [];
103
- const pathDir = path.join(archRoot, "path");
104
- if (existsSync(pathDir)) {
105
- additionalDirs.push(pathDir);
106
- }
107
- const updatedPath = getUpdatedPath(additionalDirs);
108
-
109
- const env = { ...process.env, PATH: updatedPath };
110
- const packageManagerEnvVar =
111
- detectPackageManager() === "bun"
112
- ? "CODEX_POTTER_MANAGED_BY_BUN"
113
- : "CODEX_POTTER_MANAGED_BY_NPM";
114
- env[packageManagerEnvVar] = "1";
115
-
116
- // Use an asynchronous spawn instead of spawnSync so that Node is able to
117
- // respond to signals (e.g. Ctrl-C / SIGINT) while the native binary is
118
- // executing. This allows us to forward those signals to the child process
119
- // and guarantees that when either the child terminates or the parent
120
- // receives a fatal signal, both processes exit in a predictable manner.
121
- const child = spawn(binaryPath, process.argv.slice(2), {
122
- stdio: "inherit",
123
- env,
124
- });
125
-
126
- child.on("error", (err) => {
127
- // eslint-disable-next-line no-console
128
- console.error(err);
129
- process.exit(1);
130
- });
131
-
132
- const forwardSignal = (signal) => {
133
- if (child.killed) {
134
- return;
135
- }
136
- try {
137
- child.kill(signal);
138
- } catch {
139
- /* ignore */
140
- }
141
- };
142
-
143
- ["SIGINT", "SIGTERM", "SIGHUP"].forEach((sig) => {
144
- process.on(sig, () => forwardSignal(sig));
145
- });
146
-
147
- const childResult = await new Promise((resolve) => {
148
- child.on("exit", (code, signal) => {
149
- if (signal) {
150
- resolve({ type: "signal", signal });
151
- } else {
152
- resolve({ type: "code", exitCode: code ?? 1 });
153
- }
154
- });
155
- });
156
-
157
- if (childResult.type === "signal") {
158
- process.kill(process.pid, childResult.signal);
159
- } else {
160
- process.exit(childResult.exitCode);
161
- }