luminae-helper 1.0.1 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.3
4
+
5
+ - git-push 重写为授权边界版:新增 UI 改动提交前截图自检规则。
6
+
3
7
  ## 0.0.12
4
8
 
5
9
  - Split the public CLI engine into its own `luminae-helper` repository.
6
- - Load public command/skill content from `evenweiss/ai-agent-skills` at build time.
10
+ - Load public command/skill content from `evenweiss/ai-skills` at build time.
7
11
  - Export `runCli()` so wrapper packages can reuse the CLI engine with their own bundled content.
package/README.md CHANGED
@@ -122,14 +122,14 @@ npm uninstall -g luminae-helper
122
122
 
123
123
  ### 同步公共技能
124
124
 
125
- `commands/` 和 `skills/` 是构建产物(gitignored)。本地开发时,保持 `ai-agent-skills` 为同级目录或设置环境变量:
125
+ `commands/` 和 `skills/` 是构建产物(gitignored)。本地开发时,保持 `ai-skills` 为同级目录或设置环境变量:
126
126
 
127
127
  ```bash
128
- git clone https://github.com/evenweiss/ai-agent-skills.git ../ai-agent-skills
129
- LUMINAE_SKILLS_SOURCE=../ai-agent-skills npm run sync-skills
128
+ git clone https://github.com/evenweiss/ai-skills.git ../ai-skills
129
+ LUMINAE_SKILLS_SOURCE=../ai-skills npm run sync-skills
130
130
  ```
131
131
 
132
- 脚本会扫描 `ai-agent-skills/commands/` 和 `ai-agent-skills/skills/`,将包含 `SKILL.md` 的子目录复制到本项目的对应目录。
132
+ 脚本会扫描 `ai-skills/commands/` 和 `ai-skills/skills/`,将包含 `SKILL.md` 的子目录复制到本项目的对应目录。
133
133
 
134
134
  ### 发布
135
135
 
@@ -1,83 +1,28 @@
1
1
  ---
2
2
  name: git-push
3
- description: 代码审查 + 提交 + 推送工作流:先 review 未提交代码,通过后生成 commit message 并自动 push
3
+ description: 用户要求 Git 提交、推送或提交前审查时使用;普通代码审查和解释 Git 用法不自动触发。
4
4
  ---
5
5
 
6
- # git-push
6
+ # Git 提交与推送
7
7
 
8
- > Code review + commit + push workflow
8
+ 按用户授权完成提交前审查、提交或推送。遵循当前项目规则,技能名称不代表额外授权。
9
9
 
10
- **触发条件:** 用户说"帮我提交代码"、"commit"、"git push"、"审查并推送"。
10
+ ## 操作边界
11
11
 
12
- ## 核心规则
12
+ - 用户明确调用本技能并要求只审查:只读检查和报告,不暂存、不修复、不提交、不推送。
13
+ - 只提交:审查通过后提交指定改动,不自动推送。
14
+ - 提交并推送或明确调用本技能且未限制动作:执行完整流程。只要求推送已有提交时,不创建新提交。
15
+ - 审查发现实质问题:报告位置、影响和修复建议,停止提交/推送,不自动修复。后续用户授权修复后,验证修复再继续已授权流程。
13
16
 
14
- 1. **先 review,后提交** — 执行 `git diff` 审查未提交代码
15
- 2. **发现问题立即停止** — 只输出问题与解决方案,**不修复、不提交、不推送**
16
- 3. **通过后生成提交信息** — 分析 diff 内容,按 Conventional Commits 规范生成 commit message
17
- 4. **执行提交流程** — `git add` → `git commit` → `git push`
18
- 5. **中文 body** — 描述变更背景、原因和关键实现
19
- 6. **Conventional Commits** — `<type>(<scope>): <subject>`
17
+ ## 执行
20
18
 
21
- ## 工作流
19
+ 1. 确认仓库、当前分支、工作区及暂存区;读工作区与暂存区 diff,识别用户指定文件或改动块。已有无关改动和暂存内容保持原样。
20
+ 2. 审查目标改动及必要的直接上下文,执行项目要求且与范围相称的检查。发现敏感信息、公共受控副本、依赖/构建契约限制时遵循项目边界。改动涉及样式、布局或交互时:先本地启动页面截图自检并随审查结论附截图,再进入提交——agent 看不见渲染结果的 UI 交付,约 70% 问题本可在这一步拦截(用户估算,2026-09 复盘)。
21
+ 3. 提交前核实实际提交范围恰好是用户授权范围。不使用无差别暂存;文件中混有其他改动时按块隔离。无法安全隔离或无法确认归属时询问,不擅自清空他人暂存内容。
22
+ 4. 按主要变更意图生成 Conventional Commit:`<type>(<scope>): <subject>`。scope 可省略,body 用中文解释背景和关键改动;不要仅凭文件扩展名判定类型。
23
+ 5. 只执行已授权动作。推送前确认目标 remote、branch/upstream 和将被推送的提交集合;不能只看最新一个提交。目标不明或包含未授权提交时先确认。禁止擅自强推、切分支、改历史或处理远端冲突。
24
+ 6. 回读提交文件清单、提交哈希和推送结果,确认未夹带无关改动。失败时报告停在哪一步,不把本地提交成功写成推送成功。
22
25
 
23
- ```
24
- 1. git status / git diff --stat / git diff
25
- ↓
26
- 2. Code Review(发现问题则停止)
27
- ↓
28
- 3. 生成 commit message(分析 diff,按 Conventional Commits 规范)
29
- ↓
30
- 4. git add <files>
31
- 5. git commit -m "<message>"
32
- 6. git push
33
- ```
26
+ ## 交付
34
27
 
35
- ---
36
-
37
- ## 项目自适应身份
38
-
39
- | 项目类型 | 身份 |
40
- |---------|------|
41
- | 前端/小程序 | 高级前端开发工程师 |
42
- | 后端(Java/Go/Python等)| 高级后端开发工程师 |
43
- | 其他 | 通用高级软件工程师 |
44
-
45
- **必须优先遵循「当前项目规则文件」的约束。**
46
-
47
- ---
48
-
49
- ## Commit Message 生成规则
50
-
51
- 分析 `git diff` 输出,判断 commit 类型和 scope:
52
-
53
- - 变更文件在 `docs/` → `docs`
54
- - 变更包含 `*.test.ts` / `*.spec.ts` / `__tests__/` → `test`
55
- - 变更包含 `package.json` / `pnpm-lock.yaml` / `go.mod` → `chore`
56
- - 变更修复了某个问题 → `fix`
57
- - 变更添加了新功能点 → `feat`
58
- - scope 优先取变更最集中的模块目录名
59
-
60
- 格式:`feat(auth): 添加 JWT 登录功能`
61
-
62
- ## 输出格式
63
-
64
- ```
65
- ## 项目类型识别
66
- - 类型:前端项目
67
- - 身份:高级前端开发工程师
68
-
69
- ## Review 结论
70
- ✅ 通过 / ❌ 不通过(附问题清单)
71
-
72
- ## 提交信息
73
- ```
74
- &lt;type&gt;(&lt;scope&gt;): &lt;subject&gt;
75
-
76
- &lt;body&gt;
77
- ```
78
-
79
- ## 执行结果
80
- - git add: ✅/❌
81
- - git commit: ✅/❌ (hash: <sha>)
82
- - git push: ✅/❌
83
- ```
28
+ 简要给出审查结论、实际验证、提交哈希及远端分支(如执行),列出阻塞或未执行动作。无需重复输出项目身份和整套流程模板。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luminae-helper",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Install public AI agent skills to coding tools",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -7,8 +7,8 @@ import { tmpdir } from "node:os";
7
7
  const strict = process.argv.includes("--strict");
8
8
  const scriptDir = import.meta.dirname;
9
9
  const packageRoot = join(scriptDir, "..");
10
- const sourceRepo = process.env.LUMINAE_SKILLS_SOURCE || join(packageRoot, "..", "ai-agent-skills");
11
- const remote = process.env.LUMINAE_SKILLS_REPO || "https://github.com/evenweiss/ai-agent-skills.git";
10
+ const sourceRepo = process.env.LUMINAE_SKILLS_SOURCE || join(packageRoot, "..", "ai-skills");
11
+ const remote = process.env.LUMINAE_SKILLS_REPO || "https://github.com/evenweiss/ai-skills.git";
12
12
  const copyDirs = ["commands", "skills"];
13
13
  const skip = new Set(["node_modules", ".git", ".DS_Store", "Thumbs.db"]);
14
14
 
@@ -32,13 +32,14 @@ function copyDir(from, to) {
32
32
  }
33
33
 
34
34
  function resolveSource() {
35
- if (copyDirs.some(d => hasSkillTree(join(sourceRepo, d)))) return sourceRepo;
35
+ // 优先拉取远端,失败时兜底用本地目录
36
36
  const tmp = mkdtempSync(join(tmpdir(), "luminae-skills-"));
37
37
  try {
38
38
  execFileSync("git", ["clone", "--depth", "1", remote, tmp], { stdio: "inherit" });
39
39
  return tmp;
40
40
  } catch (e) {
41
41
  rmSync(tmp, { recursive: true, force: true });
42
+ if (copyDirs.some(d => hasSkillTree(join(sourceRepo, d)))) return sourceRepo;
42
43
  if (strict) throw e;
43
44
  return null;
44
45
  }
@@ -46,23 +46,11 @@ export const TOOLS = [
46
46
  skillDir: () => join(homedir(), ".opencode", "skills"),
47
47
  installHint: "npm install -g opencode-ai",
48
48
  },
49
- {
50
- id: "trae",
51
- name: "Trae",
52
- command: "trae",
53
- commandDir: () => join(homedir(), ".trae", "commands"),
54
- skillDir: null,
55
- installHint: "Download from https://trae.ai",
56
- },
57
49
  ];
58
50
 
59
51
  // ── Skill auto-discovery ──
60
52
 
61
- /**
62
- * Get the package root directory.
63
- * import.meta.dirname = <luminae-helper>/src/lib
64
- * Package root = <luminae-helper>/
65
- */
53
+ /** ...same as before... */
66
54
  function getPackageDir() {
67
55
  if (globalThis.__LUMINAE_PACKAGE_ROOT__) {
68
56
  return globalThis.__LUMINAE_PACKAGE_ROOT__;
@@ -78,10 +66,6 @@ function getPackageDir() {
78
66
  return selfDir;
79
67
  }
80
68
 
81
- /**
82
- * Parse YAML frontmatter from SKILL.md content.
83
- * Only extracts `name` and `description`.
84
- */
85
69
  function parseSkillMeta(skillId, content) {
86
70
  let name = null;
87
71
  let description = null;
@@ -92,14 +76,11 @@ function parseSkillMeta(skillId, content) {
92
76
  const m = line.match(/^(\w+):\s*(.+)/);
93
77
  if (m) {
94
78
  let value = m[2].trim();
95
- // Strip YAML inline comments (unquoted # after value)
96
- // But preserve # inside quoted strings
97
79
  if (!((value.startsWith('"') && value.endsWith('"')) ||
98
80
  (value.startsWith("'") && value.endsWith("'")))) {
99
81
  const hashIdx = value.indexOf(" #");
100
82
  if (hashIdx !== -1) value = value.slice(0, hashIdx).trim();
101
83
  }
102
- // Strip surrounding quotes (single or double) from YAML values
103
84
  if ((value.startsWith('"') && value.endsWith('"')) ||
104
85
  (value.startsWith("'") && value.endsWith("'"))) {
105
86
  value = value.slice(1, -1);
@@ -110,13 +91,11 @@ function parseSkillMeta(skillId, content) {
110
91
  }
111
92
  }
112
93
 
113
- // Default name: skillId, capitalize words separated by hyphens
114
94
  if (!name) {
115
95
  name = skillId
116
96
  .replace(/(^|-)(\w)/g, (_, p, c) => (p === "-" ? " " : "") + c.toUpperCase());
117
97
  }
118
98
 
119
- // Default description: first blockquote line
120
99
  if (!description) {
121
100
  const bq = content.match(/^>\s*(.+)/m);
122
101
  if (bq) description = bq[1].trim();
@@ -125,14 +104,6 @@ function parseSkillMeta(skillId, content) {
125
104
  return { name, description };
126
105
  }
127
106
 
128
- /**
129
- * Generate installTargets for an entry based on tool capability.
130
- * - skillType "command" + tool supports commandDir → file mode (commands/)
131
- * - skillType "command" + tool only supports skillDir → fallback dir mode
132
- * - skillType "skill" + tool supports skillDir → dir mode (skills/)
133
- * - skillType "skill" + tool only supports commandDir → fallback file mode
134
- * - tool supports neither → skip
135
- */
136
107
  function generateInstallTargets(skillId, skillType) {
137
108
  const targets = [];
138
109
  for (const tool of TOOLS) {
@@ -148,7 +119,6 @@ function generateInstallTargets(skillId, skillType) {
148
119
  destPath: () => join(tool.commandDir(), `${skillId}.md`),
149
120
  });
150
121
  } else if (supportsSkill) {
151
- // Fallback: tool only supports skills, install command as skill
152
122
  targets.push({
153
123
  toolId: tool.id,
154
124
  installMode: "dir",
@@ -165,7 +135,6 @@ function generateInstallTargets(skillId, skillType) {
165
135
  destPath: () => join(tool.skillDir(), skillId),
166
136
  });
167
137
  } else if (supportsCommand) {
168
- // Fallback: tool only supports commands, install skill as command
169
138
  targets.push({
170
139
  toolId: tool.id,
171
140
  installMode: "file",
@@ -178,12 +147,6 @@ function generateInstallTargets(skillId, skillType) {
178
147
  return targets;
179
148
  }
180
149
 
181
- /**
182
- * Scan commands/ and skills/ directories and build SKILLS array automatically.
183
- * Each subdirectory containing a SKILL.md is a valid skill.
184
- * - commands/<skillId>/ → type: "command"
185
- * - skills/<skillId>/ → type: "skill"
186
- */
187
150
  export function discoverSkills() {
188
151
  const packageDir = getPackageDir();
189
152
  const skills = [];
@@ -232,11 +195,6 @@ export function discoverSkills() {
232
195
 
233
196
  export const SKILLS = discoverSkills();
234
197
 
235
- // ── Helpers ──
236
-
237
- /**
238
- * Detect which tools are installed on this machine.
239
- */
240
198
  export function detectInstalledTools() {
241
199
  return TOOLS.map((tool) => ({
242
200
  ...tool,
@@ -244,11 +202,6 @@ export function detectInstalledTools() {
244
202
  }));
245
203
  }
246
204
 
247
- /**
248
- * Find skill source directory bundled inside this package.
249
- * - command: <luminae-helper>/commands/<skillId>/
250
- * - skill: <luminae-helper>/skills/<skillId>/
251
- */
252
205
  export function getSkillSourcePath(skillId) {
253
206
  const skill = SKILLS.find(s => s.id === skillId);
254
207
  if (!skill) {