You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constexitCode=result.status??1;if(exitCode===0)reconcilePlugins(before,dir);else{process.stderr.write(`${NAME}: pnpm failed in profile directory ${dir}\n`);if(args.some((argument)=>/^git\+|^github:|\.git(?:#|$)/.test(argument)))process.stderr.write(`${NAME}: git-hosted plugins build on install via their prepare script, ...\n`);}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
摘要
dsh plugin add github:<owner>/<repo>失败时,DSH 在任何 pnpm 非零退出后都会打印一条固定的 allowBuilds 提示("git-hosted plugins build on install via their prepare script, which pnpm blocks until allowed — add the exact key pnpm printed above under allowBuilds in pnpm-workspace.yaml")。该提示不区分失败原因:当失败是 git 解析阶段仓库不存在(git ls-remote返回 "Repository not found")时,构建从未开始,allowBuilds 完全不适用;提示里"pnpm printed above"的 key 在输出中也并不存在。同时 DSH 用stdio: "inherit"把 pnpm 的 stderr 直通终端,自身看不到错误文本,因此无法做任何分类——这正是 #871 的现象(添加 tui plugin 报错后,用户得到两条矛盾信息:真实的"仓库不存在"与一条误导性的构建白名单提示)。复现步骤
git ls-remote git+ssh://git@github.com/deepseek-harness/turtle-ui.git→remote: Repository not found.,随后 DSH 追加打印 allowBuilds 提示。根因(源码定位,rc.6)
apps/cli的lib/plugin-9h8shc4d.js(编译产物@deepseek-ai/dsh/lib/plugin-9h8shc4d.js):spawnSync("pnpm", args, { cwd: dir, stdio: "inherit", ... })——pnpm 的 stderr 直通终端,DSH 进程从不读取,因此后续只能依据退出码 + argv 猜测。
都打印同一条 allowBuilds 提示。该提示只对"pnpm 已成功解析并安装、但 prepare 脚本被
allowBuilds 拦截"这一种失败成立;对解析期失败(仓库 404)是错误诊断。
建议修复
方案 A(推荐)· 捕获并分类 pnpm stderr:把
stdio: "inherit"改为捕获 stderr(
stdio: ["inherit","inherit","pipe"]),按特征串分类输出:Repository not found/remote: Repository not found→ 提示"插件仓库不存在——检查 owner/repo 拼写、是否为公开仓库、是否正确使用了社区仓库的完整地址";
was blocked/ignored build scripts/allowBuilds→ 保留现有 allowBuilds 提示;pnpm failed,并把捕获的 stderr 尾部附在提示后(用户至少能看到原因)。方案 B(轻量)· 提示语加前提:不捕获输出,仅把提示改为"如果失败原因是
pnpm 拦截了 git 插件的 prepare 脚本,请 …",不再宣称"pnpm printed above"存在 key。
方案 C(增强)· add 前预检仓库:对
github:形式参数,先GET https://api.github.com/repos/<owner>/<repo>探测存在性与可见性,404 时直接给出明确错误并停止,避免把用户推进 pnpm 的 ssh 解析深渊。
影响
无效且无 key 可加),浪费时间并加深困惑
容易踩中——
github:deepseek-harness/<x>的组织名写错即触发不相关的 allowBuilds 提示
环境
验证材料
/^git\+|^github:|\.git(?:#|$)/匹配任何 git 参数 → 任何失败都触发同一条提示,与失败阶段无关
First analysis of discussion #871. Happy to open a PR with fix option A.
All reactions