codeplane-ai 27.4.5 → 27.4.7
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/codeplane +18 -9
- package/package.json +13 -13
- package/postinstall.mjs +49 -16
package/bin/codeplane
CHANGED
|
@@ -5,9 +5,12 @@ const fs = require("fs")
|
|
|
5
5
|
const path = require("path")
|
|
6
6
|
const os = require("os")
|
|
7
7
|
|
|
8
|
-
function run(target) {
|
|
8
|
+
function run(target, binDir) {
|
|
9
|
+
const env = { ...process.env }
|
|
10
|
+
if (binDir) env.CODEPLANE_BIN_DIR = binDir
|
|
9
11
|
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
12
|
stdio: "inherit",
|
|
13
|
+
env,
|
|
11
14
|
})
|
|
12
15
|
if (result.error) {
|
|
13
16
|
console.error(result.error.message)
|
|
@@ -19,18 +22,12 @@ function run(target) {
|
|
|
19
22
|
|
|
20
23
|
const envPath = process.env.CODEPLANE_BIN_PATH
|
|
21
24
|
if (envPath) {
|
|
22
|
-
run(envPath)
|
|
25
|
+
run(envPath, path.dirname(envPath))
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
const scriptPath = fs.realpathSync(__filename)
|
|
26
29
|
const scriptDir = path.dirname(scriptPath)
|
|
27
30
|
|
|
28
|
-
//
|
|
29
|
-
const cached = path.join(scriptDir, ".codeplane")
|
|
30
|
-
if (fs.existsSync(cached)) {
|
|
31
|
-
run(cached)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
31
|
const platformMap = {
|
|
35
32
|
darwin: "darwin",
|
|
36
33
|
linux: "linux",
|
|
@@ -176,4 +173,16 @@ if (!resolved) {
|
|
|
176
173
|
process.exit(1)
|
|
177
174
|
}
|
|
178
175
|
|
|
179
|
-
|
|
176
|
+
// Always pass the real platform-package bin dir so the spawned binary can
|
|
177
|
+
// locate sibling assets like runtime/tui/node-main.js, even when an upstream
|
|
178
|
+
// hardlink/copy in scriptDir means process.execPath is somewhere else.
|
|
179
|
+
const realBinDir = path.dirname(resolved)
|
|
180
|
+
|
|
181
|
+
// Use cached hardlink/copy in scriptDir for fast startup, but tell the child
|
|
182
|
+
// where its real assets live via CODEPLANE_BIN_DIR.
|
|
183
|
+
const cached = path.join(scriptDir, ".codeplane")
|
|
184
|
+
if (fs.existsSync(cached)) {
|
|
185
|
+
run(cached, realBinDir)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
run(resolved, realBinDir)
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
8
8
|
},
|
|
9
|
-
"version": "27.4.
|
|
9
|
+
"version": "27.4.7",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/devinoldenburg/codeplane",
|
|
19
19
|
"optionalDependencies": {
|
|
20
|
-
"codeplane-linux-arm64-musl": "27.4.
|
|
21
|
-
"codeplane-linux-x64": "27.4.
|
|
22
|
-
"codeplane-linux-x64-baseline-musl": "27.4.
|
|
23
|
-
"codeplane-darwin-x64-baseline": "27.4.
|
|
24
|
-
"codeplane-darwin-arm64": "27.4.
|
|
25
|
-
"codeplane-linux-x64-baseline": "27.4.
|
|
26
|
-
"codeplane-windows-arm64": "27.4.
|
|
27
|
-
"codeplane-windows-x64-baseline": "27.4.
|
|
28
|
-
"codeplane-linux-x64-musl": "27.4.
|
|
29
|
-
"codeplane-linux-arm64": "27.4.
|
|
30
|
-
"codeplane-windows-x64": "27.4.
|
|
31
|
-
"codeplane-darwin-x64": "27.4.
|
|
20
|
+
"codeplane-linux-arm64-musl": "27.4.7",
|
|
21
|
+
"codeplane-linux-x64": "27.4.7",
|
|
22
|
+
"codeplane-linux-x64-baseline-musl": "27.4.7",
|
|
23
|
+
"codeplane-darwin-x64-baseline": "27.4.7",
|
|
24
|
+
"codeplane-darwin-arm64": "27.4.7",
|
|
25
|
+
"codeplane-linux-x64-baseline": "27.4.7",
|
|
26
|
+
"codeplane-windows-arm64": "27.4.7",
|
|
27
|
+
"codeplane-windows-x64-baseline": "27.4.7",
|
|
28
|
+
"codeplane-linux-x64-musl": "27.4.7",
|
|
29
|
+
"codeplane-linux-arm64": "27.4.7",
|
|
30
|
+
"codeplane-windows-x64": "27.4.7",
|
|
31
|
+
"codeplane-darwin-x64": "27.4.7"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -155,18 +155,48 @@ function findBinary() {
|
|
|
155
155
|
)
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
function sleep(ms) {
|
|
159
|
+
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function tryFindBinaryWithRetry(attempts = 5, delayMs = 200) {
|
|
163
|
+
let lastError
|
|
164
|
+
for (let i = 0; i < attempts; i++) {
|
|
165
|
+
try {
|
|
166
|
+
return findBinary()
|
|
167
|
+
} catch (error) {
|
|
168
|
+
lastError = error
|
|
169
|
+
if (i < attempts - 1) await sleep(delayMs)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
throw lastError
|
|
173
|
+
}
|
|
174
|
+
|
|
158
175
|
async function main() {
|
|
176
|
+
if (os.platform() === "win32") {
|
|
177
|
+
// On Windows, the .exe is already included in the package and bin field points to it.
|
|
178
|
+
// No postinstall setup needed.
|
|
179
|
+
console.log("Windows detected: binary setup not needed (using packaged .exe)")
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
let binaryPath
|
|
159
184
|
try {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
185
|
+
binaryPath = (await tryFindBinaryWithRetry()).binaryPath
|
|
186
|
+
} catch (error) {
|
|
187
|
+
// The wrapper script (bin/codeplane) does its own findBinary at runtime,
|
|
188
|
+
// so a missing optional-dependency here only loses the .codeplane fast-
|
|
189
|
+
// start cache — it does NOT prevent codeplane from running. Warn but
|
|
190
|
+
// do not fail the install.
|
|
191
|
+
console.warn(
|
|
192
|
+
"[codeplane postinstall] Skipping fast-start cache: " +
|
|
193
|
+
(error && error.message ? error.message : String(error)) +
|
|
194
|
+
". The CLI will still work; startup may be slightly slower on first run.",
|
|
195
|
+
)
|
|
196
|
+
return
|
|
197
|
+
}
|
|
166
198
|
|
|
167
|
-
|
|
168
|
-
// Don't replace the wrapper script - it handles binary execution
|
|
169
|
-
const { binaryPath } = findBinary()
|
|
199
|
+
try {
|
|
170
200
|
const target = path.join(__dirname, "bin", ".codeplane")
|
|
171
201
|
if (fs.existsSync(target)) fs.unlinkSync(target)
|
|
172
202
|
try {
|
|
@@ -176,14 +206,17 @@ async function main() {
|
|
|
176
206
|
}
|
|
177
207
|
fs.chmodSync(target, 0o755)
|
|
178
208
|
} catch (error) {
|
|
179
|
-
console.
|
|
180
|
-
|
|
209
|
+
console.warn(
|
|
210
|
+
"[codeplane postinstall] Could not write fast-start cache: " +
|
|
211
|
+
(error && error.message ? error.message : String(error)) +
|
|
212
|
+
". The CLI will still work via the wrapper.",
|
|
213
|
+
)
|
|
181
214
|
}
|
|
182
215
|
}
|
|
183
216
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
217
|
+
main().catch((error) => {
|
|
218
|
+
console.warn(
|
|
219
|
+
"[codeplane postinstall] Unexpected error: " + (error && error.message ? error.message : String(error)),
|
|
220
|
+
)
|
|
188
221
|
process.exit(0)
|
|
189
|
-
}
|
|
222
|
+
})
|