codex-potter 0.0.0-dev → 0.1.2
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/bin/codex-potter.js +49 -1
- package/package.json +2 -3
- package/vendor/aarch64-apple-darwin/codex-potter/codex-potter +0 -0
- package/vendor/aarch64-pc-windows-msvc/codex-potter/codex-potter.exe +0 -0
- package/vendor/aarch64-unknown-linux-musl/codex-potter/codex-potter +0 -0
- package/vendor/x86_64-apple-darwin/codex-potter/codex-potter +0 -0
- package/vendor/x86_64-pc-windows-msvc/codex-potter/codex-potter.exe +0 -0
- package/vendor/x86_64-unknown-linux-musl/codex-potter/codex-potter +0 -0
package/bin/codex-potter.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Unified entry point for the CodexPotter CLI.
|
|
3
3
|
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import { fileURLToPath } from "node:url";
|
|
7
8
|
|
|
@@ -63,7 +64,54 @@ const binaryName =
|
|
|
63
64
|
process.platform === "win32" ? "codex-potter.exe" : "codex-potter";
|
|
64
65
|
const binaryPath = path.join(archRoot, "codex-potter", binaryName);
|
|
65
66
|
|
|
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";
|
|
67
115
|
|
|
68
116
|
// Use an asynchronous spawn instead of spawnSync so that Node is able to
|
|
69
117
|
// respond to signals (e.g. Ctrl-C / SIGINT) while the native binary is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-potter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"codex-potter": "bin/codex-potter.js"
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "
|
|
19
|
+
"url": "https://github.com/breezewish/CodexPotter",
|
|
20
20
|
"directory": "npm"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|