luminae-helper 0.0.10 → 0.0.13

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 ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 0.0.12
4
+
5
+ - 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.
7
+ - Export `runCli()` so wrapper packages can reuse the CLI engine with their own bundled content.
package/README.md CHANGED
@@ -1,84 +1,50 @@
1
1
  # luminae-helper
2
2
 
3
- 将 AI skill 安装到本地 AI 编码工具的交互式 CLI。
3
+ Install public AI agent commands/skills into local AI coding tools.
4
4
 
5
- ## 安装
5
+ The package bundles a build-time snapshot from `evenweiss/ai-agent-skills`; runtime installation is local-only and does not fetch GitHub.
6
+
7
+ ## Install
6
8
 
7
9
  ```bash
8
- npm install -g luminae-helper
10
+ npm install -g luminae-helper --registry https://registry.npmjs.org/
9
11
  ```
10
12
 
11
- ## 使用
13
+ ## Use
12
14
 
13
15
  ```bash
14
- # 交互模式(默认)
15
16
  luminae-helper
16
-
17
- # 查看版本
18
17
  luminae-helper --version
19
- luminae-helper -v
20
-
21
- # 检查是否有新版本
22
18
  luminae-helper outdated
23
19
  ```
24
20
 
25
- ## 功能
26
-
27
- - **多选交互**:skill 和目标工具均支持 Checkbox 多选
28
- - **自动检测**:通过 `which`/`where` 检测本机已安装的 AI 工具
29
- - **安装防护**:往 SKILL.md 注入 `managed-by: luminae-helper` 标识,卸载时校验,避免误删用户文件
30
- - **失败重试**:安装失败自动重试 2 次;"不支持"等不可重试项单独汇总
31
- - **原子替换**:dir 模式安装先拷到临时目录,再 rename 替换;失败可回滚
32
-
33
- ## 支持的 AI 工具
34
-
35
- | 工具 | 命令 | commandDir | skillDir |
36
- |------|------|-----------|----------|
37
- | Claude Code | `claude` | `~/.claude/commands/` | `~/.claude/skills/` |
38
- | Codex | `codex` | — | `~/.codex/skills/` |
39
- | Cursor | `cursor` | — | `~/.cursor/skills/` |
40
- | Hermes Agent | `hermes` | — | `~/.hermes/skills/` |
41
- | OpenCode | `opencode` | — | `~/.opencode/skills/` |
42
- | Trae | `trae` | `~/.trae/commands/` | — |
43
-
44
- ## 包含的 skill
45
-
46
- 本版本包含以下通用 skill:
21
+ ## Supported tools
47
22
 
48
- - `identity` — 项目类型检测与 agent 身份设定
49
- - `git-commit` — Git commit 流程
50
- - `git-commit-msg` — Git commit message 生成
51
- - `git-push` — Git push 流程
23
+ | Tool | command source | skill source |
24
+ |---|---|---|
25
+ | Claude Code | `~/.claude/commands/` | `~/.claude/skills/` |
26
+ | Codex | — | `~/.codex/skills/` |
27
+ | Cursor | — | `~/.cursor/skills/` |
28
+ | Hermes Agent | — | `~/.hermes/skills/` |
29
+ | OpenCode | — | `~/.opencode/skills/` |
30
+ | Trae | `~/.trae/commands/` | — |
52
31
 
53
- ## 操作流程
32
+ ## Build-time skill source
54
33
 
55
- 1. 主菜单:选择 **安装** 或 **卸载**
56
- 2. 多选 skill/command(空格切换勾选,回车确认)
57
- 3. 多选目标工具(仅显示本机已安装的)
58
- 4. 预览确认
59
- 5. 执行;失败时自动重试可重试项
34
+ For local development, keep `ai-agent-skills` as a sibling directory or set:
60
35
 
61
- 任何步骤可用 Esc 返回上一步、Ctrl+C 退出。
62
-
63
- ## 安装规则
64
-
65
- 源目录决定优先安装方式,工具能力决定 fallback:
66
-
67
- | skill 源 | 工具能力 | 安装方式 |
68
- |---------|---------|---------|
69
- | `commands/` | 支持 commandDir | file 模式:`commandDir/<id>.md` |
70
- | `commands/` | 仅支持 skillDir | dir 模式(fallback):`skillDir/<id>/` |
71
- | `skills/` | 支持 skillDir | dir 模式:`skillDir/<id>/` |
72
- | `skills/` | 仅支持 commandDir | file 模式(fallback):`commandDir/<id>.md` |
73
-
74
- 例:Claude Code(双模式)→ `commands/identity` 装到 `~/.claude/commands/identity.md`。
36
+ ```bash
37
+ LUMINAE_SKILLS_SOURCE=/path/to/ai-agent-skills npm run sync-skills
38
+ ```
75
39
 
76
- ## 源码与变更
40
+ Publishing runs `scripts/fetch-skills.js --strict` and bundles `commands/` / `skills/` into the tarball.
77
41
 
78
- 源码:https://github.com/evenweiss/ai-toolkit/tree/main/tools/luminae-helper
42
+ ## Library API
79
43
 
80
- 变更日志:[CHANGELOG.md](./CHANGELOG.md)
44
+ ```js
45
+ import { runCli } from "luminae-helper";
81
46
 
82
- ## License
47
+ await runCli({ argv: process.argv.slice(2), packageRoot: import.meta.dirname });
48
+ ```
83
49
 
84
- MIT
50
+ `packageRoot` lets wrapper packages provide their own bundled `commands/` and `skills/` while reusing the CLI engine.
@@ -1,3 +1,8 @@
1
+ ---
2
+ name: git-commit
3
+ description: 根据 git diff 生成 Conventional Commits 规范的提交信息并直接执行 git commit
4
+ ---
5
+
1
6
  # git-commit
2
7
 
3
8
  > Generate commit message from git diff and execute git commit
@@ -1,3 +1,8 @@
1
+ ---
2
+ name: git-commit-msg
3
+ description: 根据 git diff 生成 Conventional Commits 规范的提交信息,由用户决定是否执行 git commit
4
+ ---
5
+
1
6
  # git-commit-msg
2
7
 
3
8
  > Generate commit message from git diff, and optionally execute git commit
@@ -1,3 +1,8 @@
1
+ ---
2
+ name: git-push
3
+ description: 代码审查 + 提交 + 推送工作流:先 review 未提交代码,通过后生成 commit message 并自动 push
4
+ ---
5
+
1
6
  # git-push
2
7
 
3
8
  > Code review + commit + push workflow
@@ -1,3 +1,8 @@
1
+ ---
2
+ name: identity
3
+ description: 检测项目类型并设定 Agent 身份,支持前端/后端/全栈/移动端/数据科学/DevOps 等类型识别
4
+ ---
5
+
1
6
  # identity
2
7
 
3
8
  > Detect project type and set agent identity - foundation for all tasks
package/package.json CHANGED
@@ -1,22 +1,31 @@
1
1
  {
2
2
  "name": "luminae-helper",
3
- "version": "0.0.10",
4
- "description": "Install AI skills to coding tools (Claude Code, Cursor, OpenCode, Trae, etc.)",
3
+ "version": "0.0.13",
4
+ "description": "Install public AI agent skills to coding tools",
5
5
  "type": "module",
6
- "main": "src/cli.js",
6
+ "main": "src/index.js",
7
7
  "bin": {
8
8
  "luminae-helper": "src/cli.js"
9
9
  },
10
10
  "files": [
11
11
  "src/cli.js",
12
+ "src/index.js",
12
13
  "src/lib/*.js",
13
14
  "src/utils/*.js",
15
+ "scripts/fetch-skills.js",
14
16
  "commands/",
15
17
  "skills/",
16
- "README.md"
18
+ "README.md",
19
+ "CHANGELOG.md"
17
20
  ],
18
21
  "scripts": {
19
- "start": "node src/cli.js"
22
+ "start": "node src/cli.js",
23
+ "dev": "node --watch src/cli.js",
24
+ "test": "vitest run",
25
+ "sync-skills": "node scripts/fetch-skills.js",
26
+ "prepare": "node scripts/fetch-skills.js",
27
+ "prepack": "node scripts/fetch-skills.js --strict",
28
+ "prepublishOnly": "node scripts/fetch-skills.js --strict"
20
29
  },
21
30
  "keywords": [
22
31
  "claude",
@@ -24,14 +33,13 @@
24
33
  "opencode",
25
34
  "trae",
26
35
  "skills",
27
- "ai-toolkit",
36
+ "ai-agent",
28
37
  "cli"
29
38
  ],
30
39
  "license": "MIT",
31
40
  "repository": {
32
41
  "type": "git",
33
- "url": "git+https://github.com/evenweiss/ai-toolkit.git",
34
- "directory": "tools/luminae-helper"
42
+ "url": "git+https://github.com/evenweiss/luminae-helper.git"
35
43
  },
36
44
  "engines": {
37
45
  "node": ">=18.0.0"
@@ -48,7 +56,7 @@
48
56
  "devDependencies": {
49
57
  "vitest": "^4.1.6"
50
58
  },
51
- "publishConfig": {
52
- "registry": "https://registry.npmjs.org/"
59
+ "exports": {
60
+ ".": "./src/index.js"
53
61
  }
54
62
  }
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync, rmSync, statSync } from "node:fs";
3
+ import { execFileSync } from "node:child_process";
4
+ import { join } from "node:path";
5
+ import { tmpdir } from "node:os";
6
+
7
+ const strict = process.argv.includes("--strict");
8
+ const scriptDir = import.meta.dirname;
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";
12
+ const copyDirs = ["commands", "skills"];
13
+ const skip = new Set(["node_modules", ".git", ".DS_Store", "Thumbs.db"]);
14
+
15
+ function hasSkillTree(root) {
16
+ if (!existsSync(root)) return false;
17
+ for (const name of readdirSync(root)) {
18
+ const child = join(root, name);
19
+ if (statSync(child).isDirectory() && existsSync(join(child, "SKILL.md"))) return true;
20
+ }
21
+ return false;
22
+ }
23
+
24
+ function copyDir(from, to) {
25
+ rmSync(to, { recursive: true, force: true });
26
+ if (!existsSync(from)) return false;
27
+ cpSync(from, to, {
28
+ recursive: true,
29
+ filter: (src) => !skip.has(src.split(/[/\\]/).pop()),
30
+ });
31
+ return true;
32
+ }
33
+
34
+ function resolveSource() {
35
+ if (copyDirs.some(d => hasSkillTree(join(sourceRepo, d)))) return sourceRepo;
36
+ const tmp = mkdtempSync(join(tmpdir(), "luminae-skills-"));
37
+ try {
38
+ execFileSync("git", ["clone", "--depth", "1", remote, tmp], { stdio: "inherit" });
39
+ return tmp;
40
+ } catch (e) {
41
+ rmSync(tmp, { recursive: true, force: true });
42
+ if (strict) throw e;
43
+ return null;
44
+ }
45
+ }
46
+
47
+ function main() {
48
+ const srcRoot = resolveSource();
49
+ if (!srcRoot) {
50
+ if (copyDirs.some(d => hasSkillTree(join(packageRoot, d)))) {
51
+ console.error("[fetch-skills] skipped: no source available, bundled skills already exist");
52
+ return;
53
+ }
54
+ console.warn("[fetch-skills] warning: no source available and no bundled skills found");
55
+ return;
56
+ }
57
+
58
+ let copied = 0;
59
+ for (const dir of copyDirs) {
60
+ const from = join(srcRoot, dir);
61
+ const to = join(packageRoot, dir);
62
+ if (hasSkillTree(from)) {
63
+ copyDir(from, to);
64
+ copied += 1;
65
+ console.error(`[fetch-skills] copied ${dir}: ${from} -> ${to}`);
66
+ } else {
67
+ rmSync(to, { recursive: true, force: true });
68
+ mkdirSync(to, { recursive: true });
69
+ }
70
+ }
71
+
72
+ if (strict && copied === 0) {
73
+ console.error("[fetch-skills] --strict: source contains no commands/ or skills/ entries");
74
+ process.exit(1);
75
+ }
76
+ }
77
+
78
+ main();
package/src/cli.js CHANGED
@@ -1,34 +1,8 @@
1
1
  #!/usr/bin/env node
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { runCli } from "./index.js";
2
5
 
3
- import { runInteractive, TERM_GUTTER } from "./lib/ui.js";
4
- import { printVersion, checkOutdated } from "./utils/version.js";
5
-
6
- const args = process.argv.slice(2);
7
-
8
- // --version / -v
9
- if (args.includes("--version") || args.includes("-v")) {
10
- printVersion();
11
- process.exit(0);
12
- }
13
-
14
- // outdated 子命令
15
- if (args[0] === "outdated") {
16
- await checkOutdated();
17
- process.exit(0);
18
- }
19
-
20
- // 默认:交互模式
21
- async function main() {
22
- try {
23
- await runInteractive();
24
- } catch (error) {
25
- if (error?.name === "ExitPromptError") {
26
- console.log("\n" + TERM_GUTTER + "👋 Bye!\n");
27
- process.exit(0);
28
- }
29
- console.error("\n" + TERM_GUTTER + "Error:", error.message ?? String(error));
30
- process.exit(1);
31
- }
32
- }
33
-
34
- main();
6
+ const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
7
+ const code = await runCli({ argv: process.argv.slice(2), packageRoot });
8
+ process.exit(code);
package/src/index.js ADDED
@@ -0,0 +1,31 @@
1
+ export async function runCli(options = {}) {
2
+ const argv = Array.isArray(options.argv) ? options.argv : process.argv.slice(2);
3
+ if (options.packageRoot) {
4
+ globalThis.__LUMINAE_PACKAGE_ROOT__ = options.packageRoot;
5
+ }
6
+
7
+ const { runInteractive, TERM_GUTTER } = await import("./lib/ui.js");
8
+ const { printVersion, checkOutdated } = await import("./utils/version.js");
9
+
10
+ if (argv.includes("--version") || argv.includes("-v")) {
11
+ printVersion();
12
+ return 0;
13
+ }
14
+
15
+ if (argv[0] === "outdated") {
16
+ await checkOutdated();
17
+ return 0;
18
+ }
19
+
20
+ try {
21
+ await runInteractive();
22
+ return 0;
23
+ } catch (error) {
24
+ if (error?.name === "ExitPromptError") {
25
+ console.log("\n" + TERM_GUTTER + "👋 Bye!\n");
26
+ return 0;
27
+ }
28
+ console.error("\n" + TERM_GUTTER + "Error:", error.message ?? String(error));
29
+ return 1;
30
+ }
31
+ }
@@ -64,6 +64,10 @@ export const TOOLS = [
64
64
  * Package root = <luminae-helper>/
65
65
  */
66
66
  function getPackageDir() {
67
+ if (globalThis.__LUMINAE_PACKAGE_ROOT__) {
68
+ return globalThis.__LUMINAE_PACKAGE_ROOT__;
69
+ }
70
+
67
71
  const selfDir = import.meta.dirname;
68
72
  if (selfDir.endsWith("/src/lib") || selfDir.endsWith("\\src\\lib")) {
69
73
  return join(selfDir, "..", "..");
package/src/lib/ui.js CHANGED
@@ -657,5 +657,5 @@ export async function runInteractive() {
657
657
  }
658
658
 
659
659
  console.log(chalk.gray("\n" + TERM_GUTTER + "👋 Bye!\n"));
660
- process.exit(0);
660
+ return;
661
661
  }
@@ -10,7 +10,8 @@ export const TERM_GUTTER = " ";
10
10
  * package.json 在 <package>/,需要上跳两级
11
11
  */
12
12
  function readPackageJson() {
13
- const pkgPath = join(import.meta.dirname, "..", "..", "package.json");
13
+ const packageRoot = globalThis.__LUMINAE_PACKAGE_ROOT__ || join(import.meta.dirname, "..", "..");
14
+ const pkgPath = join(packageRoot, "package.json");
14
15
  return JSON.parse(readFileSync(pkgPath, "utf-8"));
15
16
  }
16
17