kele-ai 0.0.0-stage → 1.0.1

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.
Files changed (3) hide show
  1. package/README.md +46 -2
  2. package/bin/cli.mjs +114 -0
  3. package/package.json +16 -4
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # kele
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 平时不用管。需要搭项目或补缺口时,在对话里输入 `/kele`。
4
+
5
+ 它不会自己出现。
6
+
7
+ ## 安装
8
+
9
+ 全家桶一条命令:
10
+
11
+ ```bash
12
+ npx kele-ai
13
+ ```
14
+
15
+ 会先安装本仓库的 `kele` 和 `dune-init`,再询问要不要装推荐的轻量上游技能。不想中途回答时:
16
+
17
+ ```bash
18
+ npx kele-ai --all
19
+ ```
20
+
21
+ 这只会安装 `grill-me`、`grill-with-docs`、`improve-codebase-architecture`,以及 pstack 里需要手动调用的 `poteto-mode`、`architect`、`interrogate`、`create-verification-skill`、`maintain-verification-skill`、`tdd`。不会安装 gstack,也不会跑它的 bun。
22
+
23
+ 需要 gstack 的 `guard` 时:
24
+
25
+ ```bash
26
+ npx kele-ai --with-gstack
27
+ ```
28
+
29
+ 这条同样不运行 gstack 的 setup,也不执行 bun install。
30
+
31
+ 只装本仓库技能:
32
+
33
+ ```bash
34
+ npx skills add kuidream/kele-ai-skills -g -a cursor claude-code --skill kele --skill dune-init
35
+ ```
36
+
37
+ ## 更新
38
+
39
+ ```bash
40
+ npx kele-ai update
41
+ ```
42
+
43
+ 会把本仓库和已经装过的上游技能同步到最新版。
44
+
45
+ ## 使用
46
+
47
+ 在 Cursor 或 Claude Code 里输入 `/kele`。后面可以加一句人话,例如 `/kele 只补测试`,也可以不写。它先体检,给你一张短清单,你确认后才动手。
package/bin/cli.mjs ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process';
3
+ import readline from 'node:readline/promises';
4
+ import process from 'node:process';
5
+
6
+ const args = process.argv.slice(2).filter((arg) => arg !== '--');
7
+ const auto = args.includes('--all');
8
+ const withGstack = args.includes('--with-gstack');
9
+ const command = args.find((arg) => !arg.startsWith('-')) ?? 'install';
10
+
11
+ const agents = ['-a', 'cursor', 'claude-code'];
12
+ const mattpocockSkills = ['grill-me', 'grill-with-docs', 'improve-codebase-architecture'];
13
+ const pstackSkills = [
14
+ 'poteto-mode',
15
+ 'architect',
16
+ 'interrogate',
17
+ 'create-verification-skill',
18
+ 'maintain-verification-skill',
19
+ 'tdd',
20
+ ];
21
+
22
+ function skillFlags(names) {
23
+ return names.flatMap((name) => ['--skill', name]);
24
+ }
25
+
26
+ function runSkills(skillsArgs) {
27
+ const useShell = process.platform === 'win32';
28
+ const commandArgs = ['--yes', 'skills', ...skillsArgs];
29
+ return new Promise((resolve, reject) => {
30
+ const child = spawn(useShell ? 'npx.cmd' : 'npx', commandArgs, {
31
+ stdio: 'inherit',
32
+ shell: useShell,
33
+ });
34
+ child.on('error', () => {
35
+ console.error('无法运行 npx。请先安装 Node.js。');
36
+ reject(new Error('npx'));
37
+ });
38
+ child.on('exit', (code) => resolve(code ?? 1));
39
+ });
40
+ }
41
+
42
+ async function installRepo() {
43
+ const code = await runSkills([
44
+ 'add',
45
+ 'kuidream/kele-ai-skills',
46
+ '-g',
47
+ '-y',
48
+ ...agents,
49
+ '--skill',
50
+ 'kele',
51
+ '--skill',
52
+ 'dune-init',
53
+ ]);
54
+ if (code !== 0) process.exit(code);
55
+ }
56
+
57
+ async function installUpstream(includeGstack) {
58
+ const steps = [
59
+ ['add', 'mattpocock/skills', '-g', '-y', ...agents, ...skillFlags(mattpocockSkills)],
60
+ [
61
+ 'add',
62
+ 'https://github.com/cursor/plugins/tree/main/pstack',
63
+ '-g',
64
+ '-y',
65
+ ...agents,
66
+ ...skillFlags(pstackSkills),
67
+ ],
68
+ ];
69
+ if (includeGstack) {
70
+ steps.push(['add', 'garrytan/gstack', '-g', '-y', ...agents, '--skill', 'guard']);
71
+ }
72
+ for (const step of steps) {
73
+ const code = await runSkills(step);
74
+ if (code !== 0) process.exit(code);
75
+ }
76
+ }
77
+
78
+ async function askUpstream() {
79
+ console.log('是否一并安装推荐的轻量上游技能?');
80
+ console.log('grill-me、grill-with-docs、improve-codebase-architecture');
81
+ console.log('pstack:poteto-mode、architect、interrogate、create-verification-skill、maintain-verification-skill、tdd');
82
+ console.log('gstack 较重。需要时再运行:npx kele-ai --with-gstack');
83
+ if (!process.stdin.isTTY) {
84
+ console.log('当前没有交互终端,已跳过上游。要一起安装请运行:npx kele-ai --all');
85
+ return false;
86
+ }
87
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
88
+ const answer = (await rl.question('输入 y 安装,直接回车跳过:')).trim().toLowerCase();
89
+ rl.close();
90
+ return answer === 'y' || answer === 'yes' || answer === '是';
91
+ }
92
+
93
+ function done(kind) {
94
+ const title = kind === 'update' ? '更新完成。' : '安装完成。';
95
+ console.log(`${title}平时零打扰,在 Cursor 或 Claude Code 里直接输入 /kele 即可启动。`);
96
+ }
97
+
98
+ async function main() {
99
+ if (command === 'update') {
100
+ const code = await runSkills(['update', '-g', '-y']);
101
+ if (code !== 0) process.exit(code);
102
+ done('update');
103
+ return;
104
+ }
105
+ if (command !== 'install') {
106
+ console.error('用法:npx kele-ai [install] [--all] [--with-gstack] | npx kele-ai update');
107
+ process.exit(1);
108
+ }
109
+ await installRepo();
110
+ if (auto || withGstack || (await askUpstream())) await installUpstream(withGstack);
111
+ done('install');
112
+ }
113
+
114
+ main().catch(() => process.exit(1));
package/package.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "name": "kele-ai",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "一键安装 kele。平时零打扰,需要时输入 /kele。",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": "https://github.com/kuidream/kele-ai-skills",
8
+ "bin": {
9
+ "kele-ai": "./bin/cli.mjs"
10
+ },
11
+ "files": [
12
+ "bin/",
13
+ "README.md"
14
+ ],
15
+ "engines": {
16
+ "node": ">=18"
17
+ }
18
+ }