glasspane-harness 0.7.6 → 0.7.8

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
@@ -116,8 +116,9 @@ Two commands are installed: **`glasspane-harness`** and the short alias **`gp-ha
116
116
  Some package managers do not run install scripts by default, and the wrapper's
117
117
  `postinstall` is what places the real binary. Measured on 0.7.0: npm installs fine (npm 11+
118
118
  may print an `allow-scripts` notice on the first install; the command still works), while
119
- `bun add -g` skips that step and the command then prints its own remedy — run the one line
120
- it names. See [docs/install.md](docs/install.md#channels).
119
+ `bun add -g` skips that step and the command then prints its own remedy — from 0.7.7 that
120
+ line names this install's own directory, so running it verbatim is the fix. See
121
+ [docs/install.md](docs/install.md#channels).
121
122
 
122
123
  **macOS only.** The engine, the permission model and the evidence pipeline exist only on
123
124
  macOS, so the npm distribution is macOS-only too: the package declares `os: darwin` and
package/README.zh-CN.md CHANGED
@@ -95,7 +95,8 @@ curl -fsSL https://raw.githubusercontent.com/jingzhao-l/glasspane-harness/main/s
95
95
 
96
96
  有的包管理器默认不跑安装脚本,而把真二进制放到位的正是 wrapper 的 `postinstall`。
97
97
  0.7.0 实测:npm 这条路是好的(npm 11+ 首次安装会打一条 `allow-scripts` 提示,命令照样能跑);
98
- `bun add -g` 会跳过那一步,命令于是打印它自己的补救——照它点名的一行执行即可。
98
+ `bun add -g` 会跳过那一步,命令于是打印它自己的补救——0.7.7 起那一句点名的是**这一份安装自己
99
+ 的目录**,所以照抄执行就是修法。
99
100
  详见 [docs/install.md](docs/install.md)。
100
101
 
101
102
  **只支持 macOS。** 引擎、权限模型、证据流水线都只存在于 macOS,npm 分发随之收成
@@ -1,10 +1,31 @@
1
+ #!/bin/sh
2
+ self=$0
3
+ i=0
4
+ while [ -L "$self" ] && [ $i -lt 8 ]; do
5
+ t=$(readlink "$self")
6
+ case $t in
7
+ /*) self=$t ;;
8
+ *) self=$(CDPATH= cd -P -- "$(dirname -- "$self")" && printf '%s/%s' "$PWD" "$t") ;;
9
+ esac
10
+ i=$((i + 1))
11
+ done
12
+ here=$(CDPATH= cd -P -- "$(dirname -- "$self")/.." 2>/dev/null && pwd)
1
13
  echo "Error: glasspane-harness's postinstall script was not run." >&2
2
14
  echo "" >&2
3
- echo "This occurs when using --ignore-scripts during installation, or when using a" >&2
4
- echo "package manager like pnpm that does not run postinstall scripts by default." >&2
15
+ echo "The command on your PATH is still the placeholder the tarball ships, not the" >&2
16
+ echo "binary. Managers leave it in place when they gate lifecycle scripts: bun blocks a" >&2
17
+ echo "dependency's scripts until you trust it, npm skips them under --ignore-scripts," >&2
18
+ echo "and some managers skip them by default." >&2
5
19
  echo "" >&2
6
- echo "To fix this, run the postinstall script manually:" >&2
7
- echo " cd node_modules/glasspane-harness && node postinstall.mjs" >&2
20
+ if [ -n "$here" ]; then
21
+ echo "Run this install's own postinstall step:" >&2
22
+ echo " cd \"$here\" && node postinstall.mjs" >&2
23
+ echo "" >&2
24
+ fi
25
+ echo "Or let the package manager run it:" >&2
26
+ echo ' cd "$(npm root -g)/glasspane-harness" && node postinstall.mjs # npm global install' >&2
27
+ echo " bun pm trust glasspane-harness # in the project you installed into" >&2
8
28
  echo "" >&2
9
- echo "Or reinstall glasspane-harness without the --ignore-scripts flag." >&2
29
+ echo "Either way the check afterwards is the same, and only a version number means it" >&2
30
+ echo "worked: glasspane-harness --version" >&2
10
31
  exit 1
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "scripts": {
26
26
  "postinstall": "node ./postinstall.mjs"
27
27
  },
28
- "version": "0.7.6",
28
+ "version": "0.7.8",
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.7.6",
48
- "glasspane-harness-darwin-x64": "0.7.6"
47
+ "glasspane-harness-darwin-arm64": "0.7.8",
48
+ "glasspane-harness-darwin-x64": "0.7.8"
49
49
  }
50
50
  }
package/postinstall.mjs CHANGED
@@ -28,6 +28,9 @@ const arch = archMap[os.arch()] ?? os.arch()
28
28
  // keeps these constants in step with it (this file ships inside the npm wrapper).
29
29
  const base = `glasspane-harness-${platform}-${arch}`
30
30
  const sourceBinary = platform === "windows" ? "glasspane-harness.exe" : "glasspane-harness"
31
+ // Same rule as the names above: the value lives in product.json (`npm.registry`), and
32
+ // harness/tools/product-surface.mjs is what keeps this literal from drifting away from it.
33
+ const REGISTRY = "https://registry.npmjs.org"
31
34
  const targetBinary = path.join(__dirname, "bin", "glasspane-harness.exe")
32
35
 
33
36
  function supportsAvx2() {
@@ -133,7 +136,23 @@ function installPackage(name) {
133
136
  try {
134
137
  const result = childProcess.spawnSync(
135
138
  "npm",
136
- ["install", "--ignore-scripts", "--no-save", "--loglevel=error", "--prefix", temp, `${name}@${version}`],
139
+ [
140
+ "install",
141
+ "--ignore-scripts",
142
+ "--no-save",
143
+ "--loglevel=error",
144
+ // The registry has to be named. npm resolves `npm_config_registry` (which npm exports
145
+ // into lifecycle scripts), `NPM_CONFIG_REGISTRY`, `~/.npmrc` and a project `.npmrc`, so
146
+ // without this the bytes fetched here — then chmod 0755 and executed — come from
147
+ // whatever mirror the ambient config names, and the package's integrity hash is
148
+ // self-attested by that same mirror. `script/verify-published.ts` passes `--registry`
149
+ // for exactly this reason; the install path is the one that runs on a user's machine.
150
+ "--registry",
151
+ REGISTRY,
152
+ "--prefix",
153
+ temp,
154
+ `${name}@${version}`,
155
+ ],
137
156
  { stdio: "inherit", windowsHide: true },
138
157
  )
139
158
  if (result.status !== 0) return