glasspane-harness 0.10.4 → 0.11.0
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +3 -3
- package/postinstall.mjs +34 -7
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ npm install -g glasspane-harness
|
|
|
109
109
|
bun add -g glasspane-harness
|
|
110
110
|
|
|
111
111
|
# or one-click (npm first, GitHub release asset as fallback)
|
|
112
|
-
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.
|
|
112
|
+
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.11.0/scripts/install.sh | bash
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
Two commands are installed: **`glasspane-harness`** and the short alias **`gp-harness`**.
|
package/README.zh-CN.md
CHANGED
|
@@ -91,7 +91,7 @@ Azure、OpenRouter 等等全在——几百个模型——每一个都用**你
|
|
|
91
91
|
```bash
|
|
92
92
|
npm install -g glasspane-harness # 推荐
|
|
93
93
|
bun add -g glasspane-harness
|
|
94
|
-
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.
|
|
94
|
+
curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/v0.11.0/scripts/install.sh | bash
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
会装出两个命令:**`glasspane-harness`** 与短别名 **`gp-harness`**。
|
package/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"postinstall": "node ./postinstall.mjs"
|
|
27
27
|
},
|
|
28
|
-
"version": "0.
|
|
28
|
+
"version": "0.11.0",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"os": [
|
|
31
31
|
"darwin"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"sideEffects": false,
|
|
46
46
|
"optionalDependencies": {
|
|
47
|
-
"glasspane-harness-darwin-arm64": "0.
|
|
48
|
-
"glasspane-harness-darwin-x64": "0.
|
|
47
|
+
"glasspane-harness-darwin-arm64": "0.11.0",
|
|
48
|
+
"glasspane-harness-darwin-x64": "0.11.0"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -230,13 +230,28 @@ function copyBinary(source, target) {
|
|
|
230
230
|
fs.chmodSync(target, 0o755)
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
/**
|
|
234
|
+
* The install has to prove it got *this* build, not merely "a binary that runs".
|
|
235
|
+
*
|
|
236
|
+
* `--version` exiting 0 used to be the whole check, so a platform package holding an older or
|
|
237
|
+
* mislabelled binary installed green and every later claim about "the version you just installed"
|
|
238
|
+
* was about bytes nobody compared. Both other channels already do this: `script/build.ts`'s smoke
|
|
239
|
+
* test fails when the answer differs from the build's own version, and `scripts/install.sh` refuses
|
|
240
|
+
* when the installed command reports something other than the release it asked for. This was the
|
|
241
|
+
* one channel left asserting nothing — and it is the one that runs on every user's machine.
|
|
242
|
+
*/
|
|
243
|
+
function verifyBinary(expectedVersion) {
|
|
234
244
|
const result = childProcess.spawnSync(targetBinary, ["--version"], {
|
|
235
245
|
encoding: "utf8",
|
|
236
|
-
stdio: "ignore",
|
|
246
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
237
247
|
windowsHide: true,
|
|
238
248
|
})
|
|
239
|
-
|
|
249
|
+
if (result.status !== 0) return { ok: false, detail: `--version exited ${result.status}` }
|
|
250
|
+
const got = (result.stdout ?? "").trim().split("\n")[0].trim()
|
|
251
|
+
if (got !== expectedVersion) {
|
|
252
|
+
return { ok: false, detail: `--version answers ${JSON.stringify(got)}, this package declares ${JSON.stringify(expectedVersion)}` }
|
|
253
|
+
}
|
|
254
|
+
return { ok: true, detail: got }
|
|
240
255
|
}
|
|
241
256
|
|
|
242
257
|
function main() {
|
|
@@ -252,19 +267,31 @@ function main() {
|
|
|
252
267
|
throw new Error(`glasspane-harness does not ship a build for your platform (${machineLabel()}). ${supported}`)
|
|
253
268
|
}
|
|
254
269
|
|
|
270
|
+
const expected = packageJson.version
|
|
271
|
+
// What each candidate actually answered, kept so the final refusal can name the observation
|
|
272
|
+
// instead of blaming the package manager for something it may have delivered correctly.
|
|
273
|
+
const seen = []
|
|
255
274
|
for (const name of names) {
|
|
256
275
|
try {
|
|
257
276
|
copyBinary(resolveBinary(name), targetBinary)
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
277
|
+
const check = verifyBinary(expected)
|
|
278
|
+
if (check.ok) return
|
|
279
|
+
seen.push(`${name}: ${check.detail}`)
|
|
280
|
+
} catch (error) {
|
|
281
|
+
if (installPackage(name)) {
|
|
282
|
+
const check = verifyBinary(expected)
|
|
283
|
+
if (check.ok) return
|
|
284
|
+
seen.push(`${name}: ${check.detail}`)
|
|
285
|
+
} else {
|
|
286
|
+
seen.push(`${name}: not installable here (${error instanceof Error ? error.message : "unknown failure"})`)
|
|
287
|
+
}
|
|
261
288
|
}
|
|
262
289
|
}
|
|
263
290
|
|
|
264
291
|
throw new Error(
|
|
265
292
|
`It seems your package manager failed to install the right glasspane-harness CLI package. Try manually installing ${names
|
|
266
293
|
.map((name) => JSON.stringify(name))
|
|
267
|
-
.join(" or ")}
|
|
294
|
+
.join(" or ")}.${seen.length === 0 ? "" : `\nWhat this run observed: ${seen.join("; ")}`}`,
|
|
268
295
|
)
|
|
269
296
|
}
|
|
270
297
|
|