glasspane-install 1.31.0 → 1.31.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.
Files changed (2) hide show
  1. package/cli.js +18 -9
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -108,7 +108,7 @@ export const INSTALL_SH_URL =
108
108
  /** 发布线锚点(版本真源 = 根 package.json,由 scripts/set-version.mjs 统一改写,
109
109
  * 勿手改):npx 形态下本地没有仓库时,引导 clone 的就是这个 tag,与 install.sh
110
110
  * 的 `GLASSPANE_RELEASE` 同值——两条一键入口必须拿到同一份源码。 */
111
- export const RELEASE_VERSION = '1.31.0'
111
+ export const RELEASE_VERSION = '1.31.2'
112
112
  /** 发布 ref(tag 名)。GLASSPANE_REF 环境变量可覆盖(追主干用 `main`)。 */
113
113
  export const REPO_REF = `v${RELEASE_VERSION}`
114
114
 
@@ -1845,7 +1845,7 @@ export function tagVerifyDecision({ sig, pinRef, repoDir, acceptUnverified = fal
1845
1845
 
1846
1846
  /** 仓库里是否存在指定 tag ref(IO 探测,纯判定)。 */
1847
1847
  export function repoHasRef(repoDir, ref, { spawn = spawnSync } = {}) {
1848
- return spawn('git', ['-C', repoDir, 'rev-parse', '--verify', `refs/tags/${ref}`], { stdio: 'ignore' }).status === 0
1848
+ return spawn('git', ['-C', repoDir, 'rev-parse', '--verify', `refs/tags/${ref}`], { stdio: 'ignore', env: gitLocalePinnedEnv() }).status === 0
1849
1849
  }
1850
1850
 
1851
1851
  /**
@@ -1857,12 +1857,12 @@ export function repoHasRef(repoDir, ref, { spawn = spawnSync } = {}) {
1857
1857
  * 签名与产物之间这层对应关系一旦断,绿字就成了对没签过的字节作保。
1858
1858
  */
1859
1859
  export function tagTreeAgreement({ repoDir, ref, spawn = spawnSync } = {}) {
1860
- const head = spawn('git', ['-C', repoDir, 'rev-parse', '--verify', 'HEAD'], { encoding: 'utf8' })
1861
- const tagged = spawn('git', ['-C', repoDir, 'rev-parse', '--verify', `${ref}^{commit}`], { encoding: 'utf8' })
1860
+ const head = spawn('git', ['-C', repoDir, 'rev-parse', '--verify', 'HEAD'], { encoding: 'utf8', env: gitLocalePinnedEnv() })
1861
+ const tagged = spawn('git', ['-C', repoDir, 'rev-parse', '--verify', `${ref}^{commit}`], { encoding: 'utf8', env: gitLocalePinnedEnv() })
1862
1862
  if (head.status !== 0 || tagged.status !== 0) {
1863
1863
  return { ok: false, same: false, changed: null, head: null, tagCommit: null }
1864
1864
  }
1865
- const work = spawn('git', ['-C', repoDir, 'status', '--porcelain'], { encoding: 'utf8' })
1865
+ const work = spawn('git', ['-C', repoDir, 'status', '--porcelain'], { encoding: 'utf8', env: gitLocalePinnedEnv() })
1866
1866
  const changed = String(work.stdout ?? '').split('\n').filter((line) => line !== '').length
1867
1867
  const headSha = String(head.stdout ?? '').trim()
1868
1868
  const tagSha = String(tagged.stdout ?? '').trim()
@@ -1900,8 +1900,17 @@ export function tagVerifyAgainstTree({ verdict, tree, pinRef, repoDir }) {
1900
1900
  * 在这里用命令行旗标压住,树自己选不了。(`GNUPGHOME` 仍指向一次性钥匙环:用户的
1901
1901
  * `~/.gnupg` 既不是判据来源,也不该被这次运行读写。) */
1902
1902
  const GIT_VERIFY_PINNED_CONFIG = ['-c', 'gpg.program=gpg', '-c', 'gpg.format=openpgp']
1903
+ /** 需要**稳定措辞**的 git/gpg 子进程共用的那一枚环境(本仓唯一的拼写)。
1904
+ * 判据读的是英文句子,而散文跟着操作者的语言走:中文 locale 下本机实测同一趟 git fetch 回的是
1905
+ * `致命错误:无法找到远程引用 nosuchbranch`,而 `advanceExistingClone` 那句归因与
1906
+ * `install.sh` 的 `clone_failure_text` 都把这行原话转述给读者——两条入口对同一个失败因此给出
1907
+ * 两种语言的字节,而它们的用例(本仓的契约)只认一种。2026-11-07 记账。 */
1908
+ function gitLocalePinnedEnv() {
1909
+ return { ...process.env, LC_ALL: 'C', LANG: 'C' }
1910
+ }
1911
+
1903
1912
  function verifyEnv(gnupgHome = null) {
1904
- const env = { ...process.env, LC_ALL: 'C', LANG: 'C' }
1913
+ const env = gitLocalePinnedEnv()
1905
1914
  if (gnupgHome !== null) env.GNUPGHOME = gnupgHome
1906
1915
  return env
1907
1916
  }
@@ -3081,7 +3090,7 @@ function canonicalPath(p) {
3081
3090
 
3082
3091
  /** 问一次「这一带最近的仓库根在哪」,把答案作为数据交回去(不判定)。 */
3083
3092
  export function readRepoToplevel({ dir, spawn = spawnSync } = {}) {
3084
- const res = spawn('git', ['-C', dir, 'rev-parse', '--show-toplevel'], { encoding: 'utf8' })
3093
+ const res = spawn('git', ['-C', dir, 'rev-parse', '--show-toplevel'], { encoding: 'utf8', env: gitLocalePinnedEnv() })
3085
3094
  const answer = String(res?.stdout ?? '').trim()
3086
3095
  if (res?.status !== 0 || answer === '') {
3087
3096
  return { read: false, toplevel: null }
@@ -3241,7 +3250,7 @@ export function readCloneFacts({ targetDir, ref, spawn = spawnSync, fetchHead =
3241
3250
  if (toplevelProblem) {
3242
3251
  return { head: null, tagCommit: null, blocking: [], shallow: null, toplevelProblem, toplevel: top.toplevel }
3243
3252
  }
3244
- const read = (args) => spawn('git', ['-C', targetDir, ...args], { encoding: 'utf8' })
3253
+ const read = (args) => spawn('git', ['-C', targetDir, ...args], { encoding: 'utf8', env: gitLocalePinnedEnv() })
3245
3254
  const sha = (what) => {
3246
3255
  const res = read(['rev-parse', '--verify', what])
3247
3256
  return res.status === 0 ? String(res.stdout ?? '').trim() : null
@@ -3321,7 +3330,7 @@ export function advanceExistingClone({ repoDir, ref, spawn = spawnSync } = {}) {
3321
3330
  text: toplevelRefuseText({ targetDir: repoDir, problem: toplevelProblem }),
3322
3331
  }
3323
3332
  }
3324
- const read = (args) => spawn('git', ['-C', repoDir, ...args], { encoding: 'utf8' })
3333
+ const read = (args) => spawn('git', ['-C', repoDir, ...args], { encoding: 'utf8', env: gitLocalePinnedEnv() })
3325
3334
  const remoteNames = () => {
3326
3335
  const res = read(['remote'])
3327
3336
  return res.status === 0 ? String(res.stdout ?? '').split('\n').filter((line) => line !== '') : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glasspane-install",
3
- "version": "1.31.0",
3
+ "version": "1.31.2",
4
4
  "description": "GlassPane one-command installer: terminal onboarding → install deps → build TS + Swift engine → start daemon → open settings GUI for permission guide",
5
5
  "type": "module",
6
6
  "license": "MIT",