Windows: tryExec probes binaries with `command -v`, so every binary check false-negatives (DetectEnv reports bun/git absent; LinkUser silently skips git init)

未关闭 适合新手
#3,023 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
bun, typescript

调研方向

从 skills/LifeOS/Tools/InstallEngine.ts 开始,重点关注 tryExec、detectTool、detectHarness 和 initLocalRepo,然后在 Windows 上运行提供的 detectTool 探测。将仅适用于 POSIX 的二进制文件检测替换为跨平台安全的查找,同时保留版本命令,并验证 DetectEnv、harness 检测以及通过 LinkUser 进行的 repository 初始化。完成的标准是:在 Windows 上能够检测到已安装的 git、bun 和 harness 二进制文件,在 Git 可用时运行 git init,并且非 Windows 系统上的现有行为仍然正常。

由索引模型根据 Issue 内容生成。

描述

Version

LifeOS 8.761.0 · attestation: unattested (could not extract v8.761.0: tar (child): Cannot connect to C: resolve failed

gzip: stdin: unexpected end of file
tar: Child returned status 128
tar: Error is not recoverable: exiting now)

What is broken

On Windows every binary-presence probe in the install tools returns a false negative, because tryExec hands its argument to execSync with no shell override: Node then spawns %ComSpec% (cmd.exe), where command -v is not a command, so the call throws and the helper returns null. Three call sites read that as "the binary is not installed". detectTool backs the bun and git fields of DetectEnv and the environment block of Report.ts collect, both of which report the tools absent on a machine where they run normally. detectHarness's hasBin can never match a harness binary, so harness confidence is pinned at assumed even when the claude CLI is on PATH, and Setup step 1 asks the operator to confirm a harness the code could have proven. initLocalRepo takes its git-missing branch, so LinkUser skips git init on both the USER tree and the config root and records "reason": "git not found on PATH". That last one is the costly symptom: the boundary symlinks are established and the install reports success, so a Windows install silently ends up with no local history on the principal's personal tree, which is the thing that step exists to provide.

Where (file:line)

skills/LifeOS/Tools/InstallEngine.ts:85 (tryExec); call sites :113 detectTool, :137 detectHarness hasBin, :1070 initLocalRepo

Repro on a clean tree
# Windows 11, git-bash shell. git and bun are both installed and resolve on PATH.

git clone --depth 1 https://github.com/danielmiessler/LifeOS   # HEAD 94bd8f2
T="$PWD/LifeOS/LifeOS"

# p.ts calls the SHIPPED exported detectTool and prints no filesystem paths:
#   const root = process.argv[2];
#   const { detectTool } = await import(`${root}/Tools/InstallEngine.ts`);
#   for (const [bin, v] of [["git","git --version"], ["bun","bun --version"]])
#     console.log(bin, detectTool(bin, v).installed, !!Bun.which(bin));

bun p.ts "$T"
# Seen:     git: detectTool says installed=false | resolves on PATH=true
#           bun: detectTool says installed=false | resolves on PATH=true
# Expected: installed=true for both

# The same cause, observed through the shipped tools on a real install:

bun Tools/DetectEnv.ts
#   "bun": { "installed": false }     <- bun is running this very script
#   "git": { "installed": false }
#   "harness": { "name": "claude-code", "confidence": "assumed" }   <- claude IS on PATH

bun Tools/InstallAll.ts --yes --json
#   LinkUser "repo"       -> { "action": "skipped", "reason": "git not found on PATH" }
#            "configRepo" -> { "action": "skipped", "reason": "git not found on PATH" }
#   ...while `git --version` in the same shell prints git version 2.56.1.windows.1
Negative control

Probe: bun C:/lifeos-repro/probes/p-commandv.ts C:/lifeos-repro/upstream/LifeOS · exit 1 · captured 2026-11-29T01:31:58.967Z

Red looks like: RED: shipped detectTool reports a binary absent while it is installed and on PATH

git: detectTool says installed=false | resolves on PATH=true
bun: detectTool says installed=false | resolves on PATH=true
RED: shipped detectTool reports a binary absent while it is installed and on PATH
Suggested fix

Untested shape. Resolve binary presence with a runtime API rather than a POSIX shell builtin: Bun.which(name) is already used elsewhere in the payload (LIFEOS/TOOLS/lifeos.ts uses it for the claude lookup) and is platform-correct. detectTool could use it for the presence check and keep tryExec only for the version string, which is a real command on every platform. Alternatively branch tryExec on process.platform and use where instead of command -v on Windows. The guard at :1070 has a third option: drop the probe entirely and let git init fail, since initLocalRepo already handles a failed init and reports it.

Note that the POSIX assumption in tryExec is wider than these three call sites: detectOS also shells out to sw_vers, uname and cat /etc/os-release through the same helper, which is why the Windows branch there already special-cases ver.

Environment
  • OS: Windows (x64)
  • Harness: claude-code
  • bun: not found · git: not found
  • Doctor broken: identity-placeholders, ripgrep, imagemagick, ffmpeg, ytdlp, jq
主要语言
TypeScript
星标
20k
派生
2.5k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

danielmiessler/LifeOS 的其他 Issue

查看 danielmiessler/LifeOS 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。