superpowers-zh 1.1.3 → 1.1.5

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
@@ -37,7 +37,7 @@ AI:在开始实现之前,我需要了解几个关键问题:
37
37
  [![npm version](https://img.shields.io/npm/v/superpowers-zh)](https://www.npmjs.com/package/superpowers-zh)
38
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
39
39
  [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://makeapullrequest.com)
40
- [![QQ群](https://img.shields.io/badge/QQ群-1071280067-blue?logo=tencentqq)](https://qm.qq.com/q/EeNQA9xCxy)
40
+
41
41
 
42
42
  ### 📊 项目规模
43
43
 
@@ -173,7 +173,7 @@ cp -r superpowers-zh/skills /your/project/.qwen/skills # Qwen Code
173
173
  | Git 提交规范 | 无 | Conventional Commits 中文适配 |
174
174
  | 文档规范 | 英文 | 中文排版规范 + 中英混排 |
175
175
  | MCP 构建 | 无 | MCP 服务器构建方法论 |
176
- | 社区 | Discord | QQ |
176
+ | 社区 | Discord | 微信公众号 + 微信群 |
177
177
 
178
178
  ---
179
179
 
@@ -193,11 +193,12 @@ cp -r superpowers-zh/skills /your/project/.qwen/skills # Qwen Code
193
193
 
194
194
  ---
195
195
 
196
- ## 社区交流
196
+ ## 交流 · Community
197
+
198
+ 微信公众号 **「AI不止语」**(微信搜索 `AI_BuZhiYu`)
199
+ 技术问答 · 项目更新 · 实战文章
197
200
 
198
- | 群名 | 群号 | 加入方式 |
199
- |------|------|---------|
200
- | AI 编程 & Agent 中文实践群 | **1071280067** | [点击加入](https://qm.qq.com/q/EeNQA9xCxy) |
201
+ 微信群:关注公众号后回复「群」获取入群方式
201
202
 
202
203
  ---
203
204
 
@@ -1,9 +1,28 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { existsSync, mkdirSync, cpSync, readdirSync, readFileSync, writeFileSync } from 'fs';
4
- import { resolve, dirname } from 'path';
3
+ import { existsSync, mkdirSync, cpSync, readdirSync, readFileSync, writeFileSync, copyFileSync, statSync } from 'fs';
4
+ import { resolve, dirname, join } from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
 
7
+ // Node 14/16 兼容:cpSync 在 Node 16.7+ 才可用
8
+ function copyDirSync(src, dest) {
9
+ if (typeof cpSync === 'function') {
10
+ cpSync(src, dest, { recursive: true });
11
+ return;
12
+ }
13
+ // 手动递归复制(兼容 Node 14+)
14
+ mkdirSync(dest, { recursive: true });
15
+ for (const entry of readdirSync(src, { withFileTypes: true })) {
16
+ const srcPath = join(src, entry.name);
17
+ const destPath = join(dest, entry.name);
18
+ if (entry.isDirectory()) {
19
+ copyDirSync(srcPath, destPath);
20
+ } else {
21
+ copyFileSync(srcPath, destPath);
22
+ }
23
+ }
24
+ }
25
+
7
26
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
27
  const PKG = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8'));
9
28
  const SKILLS_SRC = resolve(__dirname, '..', 'skills');
@@ -211,28 +230,84 @@ ${skillList}
211
230
  }
212
231
  }
213
232
 
233
+ // 工具名称别名映射(用户输入 -> TARGETS.name)
234
+ const TOOL_ALIASES = {
235
+ 'claude': 'Claude Code',
236
+ 'claude-code': 'Claude Code',
237
+ 'claudecode': 'Claude Code',
238
+ 'cursor': 'Cursor',
239
+ 'codex': 'Codex CLI',
240
+ 'kiro': 'Kiro',
241
+ 'deerflow': 'DeerFlow',
242
+ 'trae': 'Trae',
243
+ 'antigravity': 'Antigravity',
244
+ 'vscode': 'VS Code',
245
+ 'vs-code': 'VS Code',
246
+ 'openclaw': 'OpenClaw',
247
+ 'windsurf': 'Windsurf',
248
+ 'gemini': 'Gemini CLI',
249
+ 'gemini-cli': 'Gemini CLI',
250
+ 'aider': 'Aider',
251
+ 'opencode': 'OpenCode',
252
+ 'qwen': 'Qwen Code',
253
+ 'qwen-code': 'Qwen Code',
254
+ };
255
+
214
256
  function showHelp() {
257
+ const toolNames = [...new Set(Object.values(TOOL_ALIASES))];
215
258
  console.log(`
216
259
  superpowers-zh v${PKG.version} — AI 编程超能力中文版
217
260
 
218
261
  用法:
219
- npx superpowers-zh 安装 skills(及 agents)到当前项目
220
- npx superpowers-zh --help 显示帮助
221
- npx superpowers-zh --version 显示版本
262
+ npx superpowers-zh 自动检测工具并安装
263
+ npx superpowers-zh --tool cursor 指定工具安装(检测不到时使用)
264
+ npx superpowers-zh --help 显示帮助
265
+ npx superpowers-zh --version 显示版本
266
+
267
+ 支持的工具名:
268
+ ${Object.keys(TOOL_ALIASES).join(', ')}
222
269
 
223
270
  说明:
224
- 自动检测当前项目使用的 AI 编程工具:
225
- Claude Code / Cursor / Codex / Kiro / DeerFlow / Trae / Antigravity / VS Code / OpenClaw
226
- Windsurf / Gemini CLI / Aider / OpenCode / Qwen Code
227
- ${countDirs(SKILLS_SRC)} skills 安装到对应目录。
228
- Claude Code 还会额外安装 agents 到 .claude/agents/。
229
- 如果未检测到任何工具,默认安装到 .claude/skills/ 和 .claude/agents/。
271
+ 自动检测当前项目使用的 AI 编程工具,将 ${countDirs(SKILLS_SRC)} 个 skills 安装到对应目录。
272
+ 如果自动检测不到,请用 --tool 指定你的工具,例如:
273
+ npx superpowers-zh --tool cursor
274
+ npx superpowers-zh --tool trae
230
275
 
231
276
  项目:https://github.com/jnMetaCode/superpowers-zh
232
277
  `);
233
278
  }
234
279
 
235
- function install() {
280
+ function installForTarget(target) {
281
+ const dest = resolve(PROJECT_DIR, target.dir);
282
+ mkdirSync(dest, { recursive: true });
283
+ copyDirSync(SKILLS_SRC, dest);
284
+ const count = countDirs(dest);
285
+ console.log(` ✅ ${target.name}: ${count} 个 skills -> ${dest}`);
286
+
287
+ if (target.name === 'Trae') {
288
+ generateTraeBootstrapRule(PROJECT_DIR);
289
+ }
290
+
291
+ if (target.name === 'Antigravity') {
292
+ generateAntigravityBootstrap(PROJECT_DIR);
293
+ }
294
+
295
+ if (target.name === 'Aider') {
296
+ generateAiderBootstrap(PROJECT_DIR);
297
+ }
298
+
299
+ if (target.name === 'Gemini CLI') {
300
+ generateGeminiBootstrap(PROJECT_DIR);
301
+ }
302
+
303
+ if (target.name === 'Claude Code' && existsSync(AGENTS_SRC)) {
304
+ const agentsDest = resolve(PROJECT_DIR, '.claude', 'agents');
305
+ mkdirSync(agentsDest, { recursive: true });
306
+ copyDirSync(AGENTS_SRC, agentsDest);
307
+ }
308
+ }
309
+
310
+ function install(forceToolName) {
236
311
  try {
237
312
  console.log(`\n superpowers-zh v${PKG.version} — AI 编程超能力中文版\n`);
238
313
 
@@ -244,53 +319,45 @@ function install() {
244
319
  console.log(` 源: ${countDirs(SKILLS_SRC)} 个 skills`);
245
320
  console.log(` 目标项目: ${PROJECT_DIR}\n`);
246
321
 
322
+ // --tool 指定安装
323
+ if (forceToolName) {
324
+ const target = TARGETS.find(t => t.name === forceToolName);
325
+ if (!target) {
326
+ console.error(` ❌ 未知工具: ${forceToolName}`);
327
+ process.exit(1);
328
+ }
329
+ installForTarget(target);
330
+ console.log('\n 安装完成!重启你的 AI 编程工具即可生效。\n');
331
+ return;
332
+ }
333
+
334
+ // 自动检测
247
335
  let installed = 0;
248
336
 
249
337
  for (const target of TARGETS) {
250
338
  const detectPath = resolve(PROJECT_DIR, target.detect);
251
- const dest = resolve(PROJECT_DIR, target.dir);
252
-
253
339
  if (existsSync(detectPath)) {
254
- mkdirSync(dest, { recursive: true });
255
- cpSync(SKILLS_SRC, dest, { recursive: true });
256
- const count = countDirs(dest);
257
- console.log(` ✅ ${target.name}: ${count} 个 skills -> ${dest}`);
340
+ installForTarget(target);
258
341
  installed++;
259
-
260
- if (target.name === 'Trae') {
261
- generateTraeBootstrapRule(PROJECT_DIR);
262
- }
263
-
264
- if (target.name === 'Antigravity') {
265
- generateAntigravityBootstrap(PROJECT_DIR);
266
- }
267
-
268
- if (target.name === 'Aider') {
269
- generateAiderBootstrap(PROJECT_DIR);
270
- }
271
-
272
- if (target.name === 'Gemini CLI') {
273
- generateGeminiBootstrap(PROJECT_DIR);
274
- }
275
-
276
- if (target.name === 'Claude Code' && existsSync(AGENTS_SRC)) {
277
- const agentsDest = resolve(PROJECT_DIR, '.claude', 'agents');
278
- mkdirSync(agentsDest, { recursive: true });
279
- cpSync(AGENTS_SRC, agentsDest, { recursive: true });
280
- }
281
342
  }
282
343
  }
283
344
 
284
345
  if (installed === 0) {
346
+ console.log(' ⚠️ 未检测到任何已知的 AI 编程工具。\n');
347
+ console.log(' 如果你使用的是 Cursor、Trae 等工具,请用 --tool 指定:');
348
+ console.log(' npx superpowers-zh --tool cursor');
349
+ console.log(' npx superpowers-zh --tool trae\n');
350
+ console.log(' 现在将默认安装到 .claude/skills/(兼容 Claude Code / OpenClaw)\n');
351
+
285
352
  const dest = resolve(PROJECT_DIR, '.claude', 'skills');
286
353
  mkdirSync(dest, { recursive: true });
287
- cpSync(SKILLS_SRC, dest, { recursive: true });
354
+ copyDirSync(SKILLS_SRC, dest);
288
355
  console.log(` ✅ 默认安装: ${countDirs(dest)} 个 skills -> ${dest}`);
289
356
 
290
357
  if (existsSync(AGENTS_SRC)) {
291
358
  const agentsDest = resolve(PROJECT_DIR, '.claude', 'agents');
292
359
  mkdirSync(agentsDest, { recursive: true });
293
- cpSync(AGENTS_SRC, agentsDest, { recursive: true });
360
+ copyDirSync(AGENTS_SRC, agentsDest);
294
361
  console.log(` ✅ 默认安装: agents -> ${agentsDest}`);
295
362
  }
296
363
  }
@@ -302,13 +369,31 @@ function install() {
302
369
  }
303
370
  }
304
371
 
305
- const arg = process.argv[2];
306
- if (arg === '--help' || arg === '-h') {
372
+ const args = process.argv.slice(2);
373
+ const helpIdx = args.findIndex(a => a === '--help' || a === '-h');
374
+ const versionIdx = args.findIndex(a => a === '--version' || a === '-v');
375
+ const toolIdx = args.findIndex(a => a === '--tool' || a === '-t');
376
+
377
+ if (helpIdx !== -1) {
307
378
  showHelp();
308
- } else if (arg === '--version' || arg === '-v') {
379
+ } else if (versionIdx !== -1) {
309
380
  console.log(PKG.version);
310
- } else if (arg && arg.startsWith('-')) {
311
- console.warn(` 未知参数: ${arg}\n`);
381
+ } else if (toolIdx !== -1) {
382
+ const toolArg = args[toolIdx + 1];
383
+ if (!toolArg) {
384
+ console.error(' ❌ --tool 需要指定工具名,例如: --tool cursor\n');
385
+ showHelp();
386
+ process.exit(1);
387
+ }
388
+ const toolName = TOOL_ALIASES[toolArg.toLowerCase()];
389
+ if (!toolName) {
390
+ console.error(` ❌ 未知工具: ${toolArg}`);
391
+ console.error(` 支持的工具: ${Object.keys(TOOL_ALIASES).join(', ')}\n`);
392
+ process.exit(1);
393
+ }
394
+ install(toolName);
395
+ } else if (args.length > 0 && args[0].startsWith('-')) {
396
+ console.warn(` 未知参数: ${args[0]}\n`);
312
397
  showHelp();
313
398
  process.exit(1);
314
399
  } else {
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "superpowers-zh",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
+ "engines": {
5
+ "node": ">=14.0.0"
6
+ },
4
7
  "description": "AI 编程超能力中文增强版 — superpowers(99k+ ⭐)完整汉化 + 6 个中国原创 skills,支持 OpenClaw / Claude Code / Cursor / Windsurf / Kiro / Gemini CLI 等 14 款工具",
5
8
  "type": "module",
6
9
  "main": ".opencode/plugins/superpowers.js",