superpowers-zh 1.1.3 → 1.1.4

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.
@@ -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');
@@ -252,7 +271,7 @@ function install() {
252
271
 
253
272
  if (existsSync(detectPath)) {
254
273
  mkdirSync(dest, { recursive: true });
255
- cpSync(SKILLS_SRC, dest, { recursive: true });
274
+ copyDirSync(SKILLS_SRC, dest);
256
275
  const count = countDirs(dest);
257
276
  console.log(` ✅ ${target.name}: ${count} 个 skills -> ${dest}`);
258
277
  installed++;
@@ -276,7 +295,7 @@ function install() {
276
295
  if (target.name === 'Claude Code' && existsSync(AGENTS_SRC)) {
277
296
  const agentsDest = resolve(PROJECT_DIR, '.claude', 'agents');
278
297
  mkdirSync(agentsDest, { recursive: true });
279
- cpSync(AGENTS_SRC, agentsDest, { recursive: true });
298
+ copyDirSync(AGENTS_SRC, agentsDest);
280
299
  }
281
300
  }
282
301
  }
@@ -284,13 +303,13 @@ function install() {
284
303
  if (installed === 0) {
285
304
  const dest = resolve(PROJECT_DIR, '.claude', 'skills');
286
305
  mkdirSync(dest, { recursive: true });
287
- cpSync(SKILLS_SRC, dest, { recursive: true });
306
+ copyDirSync(SKILLS_SRC, dest);
288
307
  console.log(` ✅ 默认安装: ${countDirs(dest)} 个 skills -> ${dest}`);
289
308
 
290
309
  if (existsSync(AGENTS_SRC)) {
291
310
  const agentsDest = resolve(PROJECT_DIR, '.claude', 'agents');
292
311
  mkdirSync(agentsDest, { recursive: true });
293
- cpSync(AGENTS_SRC, agentsDest, { recursive: true });
312
+ copyDirSync(AGENTS_SRC, agentsDest);
294
313
  console.log(` ✅ 默认安装: agents -> ${agentsDest}`);
295
314
  }
296
315
  }
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "superpowers-zh",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
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",