superpowers-zh 1.1.2 → 1.1.3
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/bin/superpowers-zh.js +152 -22
- package/package.json +1 -1
package/bin/superpowers-zh.js
CHANGED
|
@@ -32,32 +32,33 @@ function countDirs(dir) {
|
|
|
32
32
|
return readdirSync(dir, { withFileTypes: true }).filter(e => e.isDirectory()).length;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function scanSkillEntries(skillsDir) {
|
|
36
|
+
const entries = [];
|
|
37
|
+
if (!existsSync(skillsDir)) return entries;
|
|
38
|
+
for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
|
|
39
|
+
if (!entry.isDirectory()) continue;
|
|
40
|
+
const skillFile = resolve(skillsDir, entry.name, 'SKILL.md');
|
|
41
|
+
if (!existsSync(skillFile)) continue;
|
|
42
|
+
const content = readFileSync(skillFile, 'utf8');
|
|
43
|
+
const fmMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
44
|
+
if (!fmMatch) continue;
|
|
45
|
+
const nameMatch = fmMatch[1].match(/^name:\s*(.+)$/m);
|
|
46
|
+
const descMatch = fmMatch[1].match(/^description:\s*["']?(.+?)["']?\s*$/m);
|
|
47
|
+
if (nameMatch) {
|
|
48
|
+
entries.push({
|
|
49
|
+
name: nameMatch[1].trim(),
|
|
50
|
+
desc: descMatch ? descMatch[1].trim() : '',
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return entries;
|
|
55
|
+
}
|
|
56
|
+
|
|
35
57
|
function generateTraeBootstrapRule(projectDir) {
|
|
36
58
|
const rulesDir = resolve(projectDir, '.trae', 'rules');
|
|
37
59
|
mkdirSync(rulesDir, { recursive: true });
|
|
38
60
|
|
|
39
|
-
|
|
40
|
-
const skillsDir = resolve(projectDir, '.trae', 'skills');
|
|
41
|
-
const skillEntries = [];
|
|
42
|
-
if (existsSync(skillsDir)) {
|
|
43
|
-
for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
|
|
44
|
-
if (!entry.isDirectory()) continue;
|
|
45
|
-
const skillFile = resolve(skillsDir, entry.name, 'SKILL.md');
|
|
46
|
-
if (!existsSync(skillFile)) continue;
|
|
47
|
-
const content = readFileSync(skillFile, 'utf8');
|
|
48
|
-
const fmMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
49
|
-
if (!fmMatch) continue;
|
|
50
|
-
const nameMatch = fmMatch[1].match(/^name:\s*(.+)$/m);
|
|
51
|
-
const descMatch = fmMatch[1].match(/^description:\s*["']?(.+?)["']?\s*$/m);
|
|
52
|
-
if (nameMatch) {
|
|
53
|
-
skillEntries.push({
|
|
54
|
-
name: nameMatch[1].trim(),
|
|
55
|
-
desc: descMatch ? descMatch[1].trim() : '',
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
+
const skillEntries = scanSkillEntries(resolve(projectDir, '.trae', 'skills'));
|
|
61
62
|
const skillTable = skillEntries.map(s => `| ${s.name} | ${s.desc} |`).join('\n');
|
|
62
63
|
|
|
63
64
|
const rule = `---
|
|
@@ -93,6 +94,123 @@ ${skillTable}
|
|
|
93
94
|
console.log(` ✅ Trae: bootstrap rule -> ${rulePath}`);
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
function generateAntigravityBootstrap(projectDir) {
|
|
98
|
+
const skillEntries = scanSkillEntries(resolve(projectDir, '.antigravity', 'skills'));
|
|
99
|
+
const skillList = skillEntries.map(s => `- **${s.name}**: ${s.desc}`).join('\n');
|
|
100
|
+
|
|
101
|
+
const content = `# Superpowers-ZH 中文增强版
|
|
102
|
+
|
|
103
|
+
本项目已安装 superpowers-zh 技能框架(${skillEntries.length} 个 skills)。
|
|
104
|
+
|
|
105
|
+
## 核心规则
|
|
106
|
+
|
|
107
|
+
1. **收到任务时,先检查是否有匹配的 skill** — 哪怕只有 1% 的可能性也要检查
|
|
108
|
+
2. **设计先于编码** — 收到功能需求时,先用 brainstorming skill 做需求分析
|
|
109
|
+
3. **测试先于实现** — 写代码前先写测试(TDD)
|
|
110
|
+
4. **验证先于完成** — 声称完成前必须运行验证命令
|
|
111
|
+
|
|
112
|
+
## 可用 Skills
|
|
113
|
+
|
|
114
|
+
Skills 位于 \`.antigravity/skills/\` 目录,每个 skill 有独立的 \`SKILL.md\` 文件。
|
|
115
|
+
|
|
116
|
+
${skillList}
|
|
117
|
+
|
|
118
|
+
## 如何使用
|
|
119
|
+
|
|
120
|
+
当任务匹配某个 skill 时,读取对应的 \`.antigravity/skills/<skill-name>/SKILL.md\` 并严格遵循其流程。
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
// 写入 .antigravity/rules.md(不覆盖用户已有的 GEMINI.md / AGENTS.md)
|
|
124
|
+
const rulePath = resolve(projectDir, '.antigravity', 'rules.md');
|
|
125
|
+
writeFileSync(rulePath, content, 'utf8');
|
|
126
|
+
console.log(` ✅ Antigravity: bootstrap rule -> ${rulePath}`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function generateAiderBootstrap(projectDir) {
|
|
130
|
+
const skillEntries = scanSkillEntries(resolve(projectDir, '.aider', 'skills'));
|
|
131
|
+
const skillList = skillEntries.map(s => `- **${s.name}**: ${s.desc}`).join('\n');
|
|
132
|
+
|
|
133
|
+
const content = `# Superpowers-ZH 工作方法论
|
|
134
|
+
|
|
135
|
+
本项目使用 superpowers-zh 技能框架(${skillEntries.length} 个 skills)。
|
|
136
|
+
|
|
137
|
+
## 核心规则
|
|
138
|
+
|
|
139
|
+
1. **收到任务时,先检查是否有匹配的 skill** — 哪怕只有 1% 的可能性也要检查
|
|
140
|
+
2. **设计先于编码** — 收到功能需求时,先用 brainstorming skill 做需求分析
|
|
141
|
+
3. **测试先于实现** — 写代码前先写测试(TDD)
|
|
142
|
+
4. **验证先于完成** — 声称完成前必须运行验证命令
|
|
143
|
+
|
|
144
|
+
## 可用 Skills
|
|
145
|
+
|
|
146
|
+
Skills 位于 \`.aider/skills/\` 目录,每个 skill 有独立的 \`SKILL.md\` 文件。
|
|
147
|
+
|
|
148
|
+
${skillList}
|
|
149
|
+
|
|
150
|
+
## 如何使用
|
|
151
|
+
|
|
152
|
+
当任务匹配某个 skill 时,读取对应的 \`.aider/skills/<skill-name>/SKILL.md\` 并严格遵循其流程。
|
|
153
|
+
`;
|
|
154
|
+
|
|
155
|
+
// 写入 CONVENTIONS.md(Aider 原生支持自动加载此文件)
|
|
156
|
+
// 如果已有 CONVENTIONS.md,追加而不覆盖
|
|
157
|
+
const convPath = resolve(projectDir, 'CONVENTIONS.md');
|
|
158
|
+
if (existsSync(convPath)) {
|
|
159
|
+
const existing = readFileSync(convPath, 'utf8');
|
|
160
|
+
if (!existing.includes('superpowers-zh')) {
|
|
161
|
+
writeFileSync(convPath, existing + '\n\n' + content, 'utf8');
|
|
162
|
+
console.log(` ✅ Aider: 追加 skills 引用 -> ${convPath}`);
|
|
163
|
+
} else {
|
|
164
|
+
console.log(` ✅ Aider: CONVENTIONS.md 已包含 superpowers-zh 引用`);
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
writeFileSync(convPath, content, 'utf8');
|
|
168
|
+
console.log(` ✅ Aider: bootstrap -> ${convPath}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function generateGeminiBootstrap(projectDir) {
|
|
173
|
+
const skillEntries = scanSkillEntries(resolve(projectDir, '.gemini', 'skills'));
|
|
174
|
+
const skillList = skillEntries.map(s => `- **${s.name}**: ${s.desc}`).join('\n');
|
|
175
|
+
|
|
176
|
+
const content = `# Superpowers-ZH 中文增强版
|
|
177
|
+
|
|
178
|
+
本项目已安装 superpowers-zh 技能框架(${skillEntries.length} 个 skills)。
|
|
179
|
+
|
|
180
|
+
## 核心规则
|
|
181
|
+
|
|
182
|
+
1. **收到任务时,先检查是否有匹配的 skill** — 哪怕只有 1% 的可能性也要检查
|
|
183
|
+
2. **设计先于编码** — 收到功能需求时,先用 brainstorming skill 做需求分析
|
|
184
|
+
3. **测试先于实现** — 写代码前先写测试(TDD)
|
|
185
|
+
4. **验证先于完成** — 声称完成前必须运行验证命令
|
|
186
|
+
|
|
187
|
+
## 可用 Skills
|
|
188
|
+
|
|
189
|
+
Skills 位于 \`.gemini/skills/\` 目录,每个 skill 有独立的 \`SKILL.md\` 文件。
|
|
190
|
+
|
|
191
|
+
${skillList}
|
|
192
|
+
|
|
193
|
+
## 如何使用
|
|
194
|
+
|
|
195
|
+
当任务匹配某个 skill 时,读取对应的 \`.gemini/skills/<skill-name>/SKILL.md\` 并严格遵循其流程。
|
|
196
|
+
`;
|
|
197
|
+
|
|
198
|
+
// 写入 GEMINI.md(如果已存在则追加)
|
|
199
|
+
const geminiPath = resolve(projectDir, 'GEMINI.md');
|
|
200
|
+
if (existsSync(geminiPath)) {
|
|
201
|
+
const existing = readFileSync(geminiPath, 'utf8');
|
|
202
|
+
if (!existing.includes('superpowers-zh')) {
|
|
203
|
+
writeFileSync(geminiPath, existing + '\n\n' + content, 'utf8');
|
|
204
|
+
console.log(` ✅ Gemini CLI: 追加 skills 引用 -> ${geminiPath}`);
|
|
205
|
+
} else {
|
|
206
|
+
console.log(` ✅ Gemini CLI: GEMINI.md 已包含 superpowers-zh 引用`);
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
writeFileSync(geminiPath, content, 'utf8');
|
|
210
|
+
console.log(` ✅ Gemini CLI: bootstrap -> ${geminiPath}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
96
214
|
function showHelp() {
|
|
97
215
|
console.log(`
|
|
98
216
|
superpowers-zh v${PKG.version} — AI 编程超能力中文版
|
|
@@ -143,6 +261,18 @@ function install() {
|
|
|
143
261
|
generateTraeBootstrapRule(PROJECT_DIR);
|
|
144
262
|
}
|
|
145
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
|
+
|
|
146
276
|
if (target.name === 'Claude Code' && existsSync(AGENTS_SRC)) {
|
|
147
277
|
const agentsDest = resolve(PROJECT_DIR, '.claude', 'agents');
|
|
148
278
|
mkdirSync(agentsDest, { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superpowers-zh",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "AI 编程超能力中文增强版 — superpowers(99k+ ⭐)完整汉化 + 6 个中国原创 skills,支持 OpenClaw / Claude Code / Cursor / Windsurf / Kiro / Gemini CLI 等 14 款工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": ".opencode/plugins/superpowers.js",
|