From 8d525a5011a331247070535ad62d975a14181715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AI=E4=B8=8D=E6=AD=A2=E8=AF=AD?= <12096460+jnMetaCode@users.noreply.github.com> Date: Tue, 2 Jun 2026 21:38:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(install):=20=E6=A3=80=E6=B5=8B=E8=90=BD?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=E4=B8=8D=E5=86=8D=E9=9D=99=E9=BB=98=E5=85=9C?= =?UTF-8?q?=E5=BA=95=E5=AE=89=E8=A3=85=20(#33)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 零参数 npx superpowers-zh 自动检测不到任何工具目录时,原本会静默兜底 安装到 .claude/skills/。但 Antigravity / Trae 等工具不一定在项目里留下 检测目录(如 .antigravity/),这些工具的用户因此被误装成默认目标,且因 文件实际落在 .claude/ 而非预期目录,卸载时显示成功但文件依旧存在。 改为:检测落空时明确报错并列出 --tool 用法后退出,不做任何安装。 带 .claude/ 目录的项目仍会被自动检测命中,裸命令安装行为不变。 修复 #33。 --- bin/superpowers-zh.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/bin/superpowers-zh.js b/bin/superpowers-zh.js index a632925..18e8273 100755 --- a/bin/superpowers-zh.js +++ b/bin/superpowers-zh.js @@ -748,18 +748,17 @@ function install(forceToolName, force) { } if (installed === 0) { - console.log(' ⚠️ 未检测到任何已知的 AI 编程工具。\n'); - console.log(' 如果你使用的是 Cursor、Trae 等工具,请用 --tool 指定:'); - console.log(' npx superpowers-zh --tool cursor'); - console.log(' npx superpowers-zh --tool trae\n'); - console.log(' 现在将默认安装到 .claude/skills/(兼容 Claude Code / OpenClaw)\n'); - - const dest = resolve(PROJECT_DIR, '.claude', 'skills'); - mkdirSync(dest, { recursive: true }); - copyDirSync(SKILLS_SRC, dest); - console.log(` ✅ 默认安装: ${countDirs(dest)} 个 skills -> ${dest}`); - - generateClaudeCodeBootstrap(PROJECT_DIR); + // 检测落空时不再静默装 Claude Code —— 否则 Antigravity / Trae 等 + // 不会在项目里留下检测目录的工具,会被误装成 Claude(见 issue #33)。 + // 改为明确报错并教用户用 --tool 显式指定。 + console.log(' ⚠️ 未在当前目录检测到任何已知 AI 编程工具的项目标记。\n'); + console.log(' 为避免装错工具,未做任何安装。请用 --tool 显式指定你的工具,例如:\n'); + console.log(' npx superpowers-zh --tool claude # Claude Code / Copilot CLI'); + console.log(' npx superpowers-zh --tool antigravity # Google Antigravity'); + console.log(' npx superpowers-zh --tool trae # Trae'); + console.log(' npx superpowers-zh --tool cursor # Cursor\n'); + console.log(` 全部可用别名:${Object.keys(TOOL_ALIASES).join(', ')}\n`); + process.exit(1); } console.log('\n 安装完成!重启你的 AI 编程工具即可生效。\n');