luminae-helper 0.0.3 → 0.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luminae-helper",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Install AI skills to coding tools (Claude Code, Cursor, OpenCode, Trae, etc.)",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
@@ -1,15 +1,18 @@
1
1
  # skill-git-commit
2
2
 
3
- > Generate commit message from git diff
3
+ > Generate commit message from git diff and execute git commit
4
4
 
5
- **触发条件:** 当需要"生成提交信息"、"写 commit message"、"帮我写 commit"、"生成几个 commit 建议"时调用。
5
+ **触发条件:** 当需要"提交代码"、"帮我 commit"、"提交一下"、"commit 一下"时调用。
6
6
 
7
7
  ## 使用方式
8
8
 
9
9
  1. 执行 `git diff` 获取变更内容
10
10
  2. 分析变更文件路径和内容,判断变更类型
11
11
  3. 根据 Conventional Commits 规范生成 commit message
12
- 4. 输出建议供用户确认或修改
12
+ 4. 输出生成的 commit message 供用户知悉
13
+ 5. 直接执行 `git commit`(无需用户确认)
14
+
15
+ **如只需生成 commit message 而不执行提交,请使用 `skill-git-commit-msg`。**
13
16
 
14
17
  ## Conventional Commits 类型
15
18
 
@@ -57,6 +60,25 @@
57
60
  +120 行 / -30 行
58
61
  ```
59
62
 
63
+ ## 执行提交
64
+
65
+ 生成 commit message 后,直接执行以下命令(无需用户确认):
66
+
67
+ ```bash
68
+ git commit -m "<type>(<scope>): <subject>" -m "<body>"
69
+ ```
70
+
71
+ - 如果 body 为空,省略第二个 `-m` 参数
72
+ - 执行前先告知用户生成的 commit message 内容
73
+ - 执行后输出 commit 结果(含 commit hash)
74
+ - 如果 commit 失败,输出错误信息供用户排查
75
+
76
+ ### 注意事项
77
+
78
+ - 提交前先确认 `git add` 已完成(检查 `git status` 是否有未暂存变更)
79
+ - 如果有未暂存变更,提醒用户是否需要 `git add`,不要自动执行
80
+ - 不要使用 `git commit -a`,避免意外提交不相关的文件
81
+
60
82
  ## Conventional Commits 格式规范
61
83
 
62
84
  ```
@@ -0,0 +1,99 @@
1
+ # skill-git-commit-msg
2
+
3
+ > Generate commit message from git diff, and optionally execute git commit
4
+
5
+ **触发条件:** 当需要"生成提交信息"、"写 commit message"、"帮我写 commit"、"生成几个 commit 建议"时调用。
6
+
7
+ ## 使用方式
8
+
9
+ 1. 执行 `git diff` 获取变更内容
10
+ 2. 分析变更文件路径和内容,判断变更类型
11
+ 3. 根据 Conventional Commits 规范生成 commit message
12
+ 4. 输出生成的 commit message 供用户审阅
13
+ 5. 询问用户是否以当前生成的 message 进行 commit
14
+ 6. 如果用户回复"是"、"同意"、"确认"等肯定词,则执行 `git commit`;否则不执行
15
+
16
+ **注意:** 如需生成后直接提交(无需询问),请使用 `skill-git-commit`。
17
+
18
+ ## Conventional Commits 类型
19
+
20
+ | type | 使用场景 |
21
+ |------|---------|
22
+ | feat | 新功能 |
23
+ | fix | 修复 bug |
24
+ | docs | 文档更新 |
25
+ | style | 代码格式(不影响功能)|
26
+ | refactor | 重构(不影响功能)|
27
+ | perf | 性能优化 |
28
+ | test | 测试相关 |
29
+ | chore | 构建/工具/依赖更新 |
30
+ | wip | 开发中(未完成)|
31
+
32
+ ## 判断规则
33
+
34
+ - 变更文件在 `docs/` → `docs`
35
+ - 变更包含 `*.test.ts` / `*.spec.ts` / `__tests__/` → `test`
36
+ - 变更包含 `package.json` / `pnpm-lock.yaml` / `go.mod` → `chore`
37
+ - 变更修复了某个问题 → `fix`
38
+ - 变更添加了新功能点 → `feat`
39
+ - scope 优先取变更最集中的模块目录名
40
+
41
+ ## 输出格式
42
+
43
+ ```
44
+ ## 提交信息建议
45
+
46
+ **type:** feat
47
+ **scope:** auth
48
+ **subject:** 添加 JWT 登录功能
49
+
50
+ **body:**
51
+ 实现基于 JWT 的用户登录鉴权流程,包含 token 生成、验证和刷新机制。
52
+
53
+ 变更文件:
54
+ - src/auth/login.ts
55
+ - src/auth/jwt.ts
56
+ - src/middleware/auth.ts
57
+
58
+ ---
59
+
60
+ 原始 diff 摘要:
61
+ +120 行 / -30 行
62
+ ```
63
+
64
+ ## 可选提交
65
+
66
+ 生成 commit message 后,询问用户:`是否以该 message 进行 commit?`
67
+
68
+ - 用户回复"是"、"同意"、"确认"、"好"等肯定词 → 执行提交
69
+ - 用户回复否定或要求修改 → 不执行,等待用户进一步指示
70
+
71
+ 执行命令:
72
+
73
+ ```bash
74
+ git commit -m "<type>(<scope>): <subject>" -m "<body>"
75
+ ```
76
+
77
+ - 如果 body 为空,省略第二个 `-m` 参数
78
+ - 执行后输出 commit 结果(含 commit hash)
79
+ - 如果 commit 失败,输出错误信息供用户排查
80
+
81
+ ### 注意事项
82
+
83
+ - 提交前先确认 `git add` 已完成(检查 `git status` 是否有未暂存变更)
84
+ - 如果有未暂存变更,提醒用户是否需要 `git add`,不要自动执行
85
+ - 不要使用 `git commit -a`,避免意外提交不相关的文件
86
+
87
+ ## Conventional Commits 格式规范
88
+
89
+ ```
90
+ <type>(<scope>): <subject>
91
+
92
+ <body>
93
+ ```
94
+
95
+ - `type` 小写
96
+ - `scope` 可选,用小写字母
97
+ - `subject` 首字母小写,结尾不加句号
98
+ - `body` 使用中文,描述变更背景、原因和关键实现
99
+ - 标题和 body 之间空一行
package/src/cli.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { runInteractive } from "./lib/ui.js";
3
+ import { runInteractive, TERM_GUTTER } from "./lib/ui.js";
4
4
 
5
5
  async function main() {
6
6
  try {
7
7
  await runInteractive();
8
8
  } catch (error) {
9
9
  if (error?.name === "ExitPromptError") {
10
- console.log("\n 👋 Bye!\n");
10
+ console.log("\n" + TERM_GUTTER + "👋 Bye!\n");
11
11
  process.exit(0);
12
12
  }
13
- console.error("\n Error:", error.message ?? String(error));
13
+ console.error("\n" + TERM_GUTTER + "Error:", error.message ?? String(error));
14
14
  process.exit(1);
15
15
  }
16
16
  }
@@ -263,7 +263,7 @@ export default createPrompt((config, done) => {
263
263
  ];
264
264
  if (shortcuts.all) keys.push([shortcuts.all, "all"]);
265
265
  if (shortcuts.invert) keys.push([shortcuts.invert, "invert"]);
266
- keys.push(["⏎", "提交多选 / 执行功能行"]);
266
+ keys.push(["⏎", "提交 / 执行"]);
267
267
  const helpLine = theme.style.keysHelpTip(keys);
268
268
  const lines = [
269
269
  [prefix, message].filter(Boolean).join(" "),
@@ -70,6 +70,14 @@ export const TOOLS = [
70
70
  skillsDir: () => join(homedir(), ".zeroclaw", "skills"),
71
71
  installHint: "npm install -g zeroclaw",
72
72
  },
73
+ {
74
+ id: "codex",
75
+ name: "Codex",
76
+ command: "codex",
77
+ installMode: "file",
78
+ skillsDir: () => join(homedir(), ".codex", "commands"),
79
+ installHint: "npm install -g @openai/codex",
80
+ },
73
81
  ];
74
82
 
75
83
  // ── Skill auto-discovery ──
package/src/lib/ui.js CHANGED
@@ -6,6 +6,12 @@ import checkboxWithActionRows from "./checkbox-with-action-rows.js";
6
6
  import { SKILLS, TOOLS, detectInstalledTools } from "./constants.js";
7
7
  import { installSkillToTool, uninstallSkillFromTool } from "./installer.js";
8
8
 
9
+ /**
10
+ * 终端主内容区左侧统一的两空格缩进(与顶栏、收尾、错误提示对齐)。
11
+ * 所有面向用户的 `console.log` / 区块标题应以此开头,避免有的顶格、有的多空格。
12
+ */
13
+ export const TERM_GUTTER = " ";
14
+
9
15
  /**
10
16
  * 传给所有 @inquirer prompt 的 context。
11
17
  * `clearPromptOnDone: true` 会在 prompt 结束时用 ANSI 擦除整块 TUI 占用的行,
@@ -26,11 +32,19 @@ function afterPromptFlush() {
26
32
  });
27
33
  }
28
34
 
35
+ /**
36
+ * 打印步骤区块标题(青粗体 + 统一左侧 gutter + 段后空行)。
37
+ * @param {string} title 标题全文,例如「━━━ 选择 Skill ━━━」
38
+ */
39
+ function printSectionTitle(title) {
40
+ console.log(chalk.cyan.bold(TERM_GUTTER + title + "\n"));
41
+ }
42
+
29
43
  function printBanner() {
30
44
  console.clear();
31
45
  const banner = gradientString(["#4facfe", "#a855f7", "#f472b6"])(" LUMINAE HELPER ");
32
- console.log("\n " + banner);
33
- console.log(chalk.gray(" AI coding tools skill manager\n"));
46
+ console.log("\n" + TERM_GUTTER + banner);
47
+ console.log(chalk.gray(TERM_GUTTER + "AI coding tools' skills manager\n"));
34
48
  }
35
49
 
36
50
  /**
@@ -74,7 +88,7 @@ function withNavChoices(items, backLabel) {
74
88
  ...items,
75
89
  new Separator(),
76
90
  { name: chalk.yellow(backLabel), value: "__back__" },
77
- { name: "✕ 退出", value: "__exit__" },
91
+ { name: "✕ 退出", value: "__exit__" },
78
92
  ];
79
93
  }
80
94
 
@@ -97,7 +111,7 @@ async function stepSelectSkills() {
97
111
  while (true) {
98
112
  await afterPromptFlush();
99
113
  printBanner();
100
- console.log(chalk.cyan.bold("━━━ 选择 Skill ━━━\n"));
114
+ printSectionTitle("━━━ 选择 Skill ━━━");
101
115
 
102
116
  const skillChoices = SKILLS.map(s => ({
103
117
  name: s.name + " - " + s.description,
@@ -105,13 +119,13 @@ async function stepSelectSkills() {
105
119
  }));
106
120
 
107
121
  const theme = {
108
- prefix: chalk.cyan("◆"),
122
+ prefix: chalk.cyan(" ◆"),
109
123
  style: { highlight: (t) => chalk.cyan(t) },
110
124
  };
111
125
 
112
126
  const ans = await runCheckbox({
113
- message: " 选择 Skill (空格多选,回车提交;底部「↩ 返回 / ✕ 退出」为功能行:移上去后按回车):",
114
- choices: withNavChoices(skillChoices, "↩ 返回主菜单"),
127
+ message: "选择 Skill:",
128
+ choices: withNavChoices(skillChoices, "↩ 返回主菜单"),
115
129
  loop: false,
116
130
  theme,
117
131
  });
@@ -122,7 +136,7 @@ async function stepSelectSkills() {
122
136
  if (result === "exit") return "exit";
123
137
 
124
138
  if (result.length === 0) {
125
- console.log(chalk.yellow("\n 请至少选择一个 Skill"));
139
+ console.log(chalk.yellow(TERM_GUTTER + "请至少选择一个 Skill"));
126
140
  await new Promise(r => setTimeout(r, 1200));
127
141
  continue;
128
142
  }
@@ -136,7 +150,7 @@ async function stepSelectTools(installedTools) {
136
150
  while (true) {
137
151
  await afterPromptFlush();
138
152
  printBanner();
139
- console.log(chalk.cyan.bold("━━━ 选择目标工具 ━━━\n"));
153
+ printSectionTitle("━━━ 选择目标工具 ━━━");
140
154
 
141
155
  const toolChoices = installedTools.map(t => ({
142
156
  name: t.name,
@@ -144,13 +158,14 @@ async function stepSelectTools(installedTools) {
144
158
  }));
145
159
 
146
160
  const theme = {
147
- prefix: chalk.cyan("◆"),
161
+ prefix: chalk.cyan(" ◆"),
148
162
  style: { highlight: (t) => chalk.cyan(t) },
149
163
  };
150
164
 
165
+ // 第二步:底部为返回/退出功能行(移上后回车触发)
151
166
  const ans = await runCheckbox({
152
- message: " 选择工具 (空格多选,回车提交;底部「↩ 返回 / ✕ 退出」为功能行:移上去后按回车):",
153
- choices: withNavChoices(toolChoices, "↩ 返回上一步"),
167
+ message: "选择工具:",
168
+ choices: withNavChoices(toolChoices, "↩ 返回上一步"),
154
169
  loop: false,
155
170
  theme,
156
171
  });
@@ -161,7 +176,7 @@ async function stepSelectTools(installedTools) {
161
176
  if (result === "exit") return "exit";
162
177
 
163
178
  if (result.length === 0) {
164
- console.log(chalk.yellow("\n 请至少选择一个工具"));
179
+ console.log(chalk.yellow(TERM_GUTTER + "请至少选择一个工具"));
165
180
  await new Promise(r => setTimeout(r, 1200));
166
181
  continue;
167
182
  }
@@ -180,29 +195,23 @@ function asIdArray(v) {
180
195
  return v.filter((x) => typeof x === "string");
181
196
  }
182
197
 
183
- // ── Step 3: Preview + Confirm (Select with navigation) ──
184
- async function stepPreviewConfirm(skillIds, toolIds, installedTools, isUninstall) {
185
- const sids = asIdArray(skillIds);
186
- const tids = asIdArray(toolIds);
198
+ // ── Step 3: Preview + Confirm(仅标题 + 确认菜单;不再展示 Skill/工具明细)──
199
+ async function stepPreviewConfirm(isUninstall) {
187
200
  await afterPromptFlush();
188
201
  printBanner();
189
202
  const actionLabel = isUninstall ? "卸载" : "安装";
190
- console.log(chalk.cyan.bold("━━━ " + actionLabel + "预览 ━━━\n"));
191
- const skillNames = sids.map(id => SKILLS.find(s => s.id === id)?.name).join(", ");
192
- const toolNames = tids.map(id => installedTools.find(t => t.id === id)?.name).join(", ");
193
- console.log(" " + chalk.bold("Skill:") + " " + skillNames);
194
- console.log(" " + chalk.bold("工具:") + " " + toolNames);
195
- console.log();
203
+ printSectionTitle("━━━ " + actionLabel + "预览 ━━━");
204
+ // 第三步:标题下方不再打印 Skill/工具明细列表,由确认菜单直接操作
196
205
 
197
206
  const ans = await Select(
198
207
  {
199
- message: " 确认" + actionLabel + "?",
208
+ message: "确认" + actionLabel + "?",
200
209
  choices: [
201
- { name: "✓ 确认" + actionLabel, value: "confirm" },
202
- { name: "↩ 返回上一步", value: "back" },
203
- { name: "✕ 退出", value: "exit" },
210
+ { name: "✓ 确认" + actionLabel, value: "confirm" },
211
+ { name: "↩ 返回上一步", value: "back" },
212
+ { name: "✕ 退出", value: "exit" },
204
213
  ],
205
- theme: { prefix: chalk.cyan("◆"), style: { highlight: (t) => chalk.cyan(t) } },
214
+ theme: { prefix: chalk.cyan(" ◆"), style: { highlight: (t) => chalk.cyan(t) } },
206
215
  },
207
216
  inquirerContext
208
217
  ).catch(() => "back");
@@ -217,7 +226,7 @@ async function stepExecute(skillIds, toolIds, installedTools, isUninstall) {
217
226
  await afterPromptFlush();
218
227
  printBanner();
219
228
  console.log();
220
- console.log(chalk.cyan.bold("━━━ 执行中 ━━━\n"));
229
+ printSectionTitle("━━━ 执行中 ━━━");
221
230
 
222
231
  let allSuccess = true;
223
232
 
@@ -231,23 +240,23 @@ async function stepExecute(skillIds, toolIds, installedTools, isUninstall) {
231
240
 
232
241
  const supported = skill.installTargets?.some(tgt => tgt.toolId === toolId);
233
242
  if (!supported) {
234
- console.log(chalk.gray(" - " + skill.name + " × " + tool.name + " (不支持)"));
243
+ console.log(chalk.gray(TERM_GUTTER + "- " + skill.name + " × " + tool.name + " (不支持)"));
235
244
  continue;
236
245
  }
237
246
 
238
247
  if (isUninstall) {
239
248
  const result = uninstallSkillFromTool(skill, tool);
240
249
  if (result.success) {
241
- console.log(chalk.green(" ✓ " + skill.name + " ✓ " + tool.name));
250
+ console.log(chalk.green(TERM_GUTTER + "✓ " + skill.name + " - " + tool.name));
242
251
  } else {
243
- console.log(chalk.yellow(" - " + skill.name + " - " + tool.name + " (未安装)"));
252
+ console.log(chalk.yellow(TERM_GUTTER + "- " + skill.name + " - " + tool.name + " (未安装)"));
244
253
  }
245
254
  } else {
246
255
  const result = installSkillToTool(skill, tool);
247
256
  if (result.success) {
248
- console.log(chalk.green(" ✓ " + skill.name + " → " + tool.name));
257
+ console.log(chalk.green(TERM_GUTTER + "✓ " + skill.name + " → " + tool.name));
249
258
  } else {
250
- console.log(chalk.red(" ✗ " + skill.name + " → " + tool.name + ": " + result.message));
259
+ console.log(chalk.red(TERM_GUTTER + "✗ " + skill.name + " → " + tool.name + ": " + result.message));
251
260
  allSuccess = false;
252
261
  }
253
262
  }
@@ -256,9 +265,9 @@ async function stepExecute(skillIds, toolIds, installedTools, isUninstall) {
256
265
 
257
266
  console.log();
258
267
  if (allSuccess) {
259
- console.log(chalk.green(" ✅ 操作完成!\n"));
268
+ console.log(chalk.green(TERM_GUTTER + "✅ 操作完成!\n"));
260
269
  } else {
261
- console.log(chalk.yellow(" ⚠ 部分操作失败,请检查错误信息。\n"));
270
+ console.log(chalk.yellow(TERM_GUTTER + "⚠ 部分操作失败,请检查错误信息。\n"));
262
271
  }
263
272
 
264
273
  return allSuccess;
@@ -270,16 +279,17 @@ async function runFlow(isUninstall) {
270
279
  if (installedTools.length === 0) {
271
280
  await afterPromptFlush();
272
281
  printBanner();
273
- console.log(chalk.yellow("\n ⚠ 未检测到任何已安装的 AI 工具\n"));
274
- console.log(chalk.gray(" 请先安装以下工具之一:\n"));
282
+ console.log(chalk.yellow(TERM_GUTTER + "⚠ 未检测到任何已安装的 AI 工具\n"));
283
+ console.log(chalk.gray(TERM_GUTTER + "请先安装以下工具之一:\n"));
275
284
  TOOLS.forEach(t => {
276
- console.log(" " + chalk.cyan(t.name) + ": " + chalk.gray(t.installHint));
285
+ // 列表相对上一行再缩进一格 gutter,形成层级感
286
+ console.log(TERM_GUTTER + TERM_GUTTER + chalk.cyan(t.name) + ": " + chalk.gray(t.installHint));
277
287
  });
278
288
  console.log();
279
289
  await input(
280
290
  {
281
- message: " 按回车返回主菜单...",
282
- theme: { prefix: chalk.cyan("◆"), style: { highlight: (t) => chalk.cyan(t) } },
291
+ message: "按回车返回主菜单...",
292
+ theme: { prefix: chalk.cyan(" ◆"), style: { highlight: (t) => chalk.cyan(t) } },
283
293
  },
284
294
  inquirerContext
285
295
  ).catch(() => {});
@@ -304,7 +314,7 @@ async function runFlow(isUninstall) {
304
314
  selectedToolIds = result;
305
315
  step = 3;
306
316
  } else if (step === 3) {
307
- const result = await stepPreviewConfirm(selectedSkillIds, selectedToolIds, installedTools, isUninstall);
317
+ const result = await stepPreviewConfirm(isUninstall);
308
318
  if (result === "back") { step = 2; continue; }
309
319
  if (result === "exit") return "exit";
310
320
  step = 4;
@@ -316,24 +326,24 @@ async function runFlow(isUninstall) {
316
326
  if (allSuccess) break;
317
327
  attempt++;
318
328
  if (attempt < 3) {
319
- console.log(chalk.yellow(` 第 ${attempt} 次重试...\n`));
329
+ console.log(chalk.yellow(TERM_GUTTER + `第 ${attempt} 次重试...\n`));
320
330
  }
321
331
  }
322
332
  if (allSuccess) {
323
333
  await input(
324
334
  {
325
- message: " 按任意键退出...",
326
- theme: { prefix: chalk.cyan("◆"), style: { highlight: (t) => chalk.cyan(t) } },
335
+ message: "按任意键退出...",
336
+ theme: { prefix: chalk.cyan(" ◆"), style: { highlight: (t) => chalk.cyan(t) } },
327
337
  },
328
338
  inquirerContext
329
339
  ).catch(() => {});
330
340
  return "exit";
331
341
  } else {
332
- console.log(chalk.red(" ❌ 重试 3 次后仍有失败,请手动检查。\n"));
342
+ console.log(chalk.red(TERM_GUTTER + "❌ 重试 3 次后仍有失败,请手动检查。\n"));
333
343
  await input(
334
344
  {
335
- message: " 按任意键返回主菜单...",
336
- theme: { prefix: chalk.cyan("◆"), style: { highlight: (t) => chalk.cyan(t) } },
345
+ message: "按任意键返回主菜单...",
346
+ theme: { prefix: chalk.cyan(" ◆"), style: { highlight: (t) => chalk.cyan(t) } },
337
347
  },
338
348
  inquirerContext
339
349
  ).catch(() => {});
@@ -352,13 +362,13 @@ export async function runInteractive() {
352
362
 
353
363
  const action = await Select(
354
364
  {
355
- message: " 选择操作:",
365
+ message: "选择操作:",
356
366
  choices: [
357
- { name: padChoice("📦 安装 Skill", 20), value: "install" },
358
- { name: padChoice("🗑 卸载 Skill", 20), value: "uninstall" },
359
- { name: padChoice("✕ 退出", 20), value: "exit" },
367
+ { name: padChoice(" 安装 Skill", 20), value: "install" },
368
+ { name: padChoice(" 卸载 Skill", 20), value: "uninstall" },
369
+ { name: padChoice(" 退出", 20), value: "exit" },
360
370
  ],
361
- theme: { prefix: chalk.cyan("◆"), style: { highlight: (t) => chalk.cyan(t) } },
371
+ theme: { prefix: chalk.cyan(" ◆"), style: { highlight: (t) => chalk.cyan(t) } },
362
372
  },
363
373
  inquirerContext
364
374
  ).catch(() => "exit");
@@ -377,6 +387,6 @@ export async function runInteractive() {
377
387
  // "back" or "done" → loop continues, show main menu again
378
388
  }
379
389
 
380
- console.log(chalk.gray("\n 👋 Bye!\n"));
390
+ console.log(chalk.gray("\n" + TERM_GUTTER + "👋 Bye!\n"));
381
391
  process.exit(0);
382
392
  }