@brookmind/ai-toolkit 1.0.1 → 1.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/bin/cli.js +1 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +284 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -8
- package/src/index.js +0 -365
package/bin/cli.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { run } from '../
|
|
3
|
+
import { run } from '../dist/index.js';
|
|
4
4
|
|
|
5
5
|
run().catch((error) => {
|
|
6
|
-
if (error.name === 'ExitPromptError') {
|
|
7
|
-
console.log('\nInstallation cancelled.');
|
|
8
|
-
process.exit(0);
|
|
9
|
-
}
|
|
10
6
|
console.error(error);
|
|
11
7
|
process.exit(1);
|
|
12
8
|
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuEA,wBAAsB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAkQzC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { readdir, cp, mkdir, access, readFile } from 'fs/promises';
|
|
4
|
+
import { join, dirname } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { homedir } from 'os';
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const ROOT_DIR = join(__dirname, '..');
|
|
9
|
+
async function getDirectories(path) {
|
|
10
|
+
try {
|
|
11
|
+
const entries = await readdir(path, { withFileTypes: true });
|
|
12
|
+
return entries.filter(e => e.isDirectory()).map(e => e.name);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function getFiles(path, extension) {
|
|
19
|
+
try {
|
|
20
|
+
const entries = await readdir(path, { withFileTypes: true });
|
|
21
|
+
return entries
|
|
22
|
+
.filter(e => e.isFile() && e.name.endsWith(extension))
|
|
23
|
+
.map(e => e.name.replace(extension, ''));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function exists(path) {
|
|
30
|
+
try {
|
|
31
|
+
await access(path);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function getInstalledClaudeMcps() {
|
|
39
|
+
try {
|
|
40
|
+
const home = homedir();
|
|
41
|
+
const configPath = join(home, '.claude.json');
|
|
42
|
+
const content = await readFile(configPath, 'utf-8');
|
|
43
|
+
const config = JSON.parse(content);
|
|
44
|
+
if (config.mcpServers) {
|
|
45
|
+
return new Set(Object.keys(config.mcpServers));
|
|
46
|
+
}
|
|
47
|
+
return new Set();
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return new Set();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function getInstalledOpencodeMcps() {
|
|
54
|
+
try {
|
|
55
|
+
const home = homedir();
|
|
56
|
+
const configPath = join(home, '.config', 'opencode', 'opencode.json');
|
|
57
|
+
const content = await readFile(configPath, 'utf-8');
|
|
58
|
+
const config = JSON.parse(content);
|
|
59
|
+
if (config.mcp) {
|
|
60
|
+
return new Set(Object.keys(config.mcp));
|
|
61
|
+
}
|
|
62
|
+
return new Set();
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return new Set();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export async function run() {
|
|
69
|
+
console.clear();
|
|
70
|
+
p.intro(chalk.bgMagenta.white(' AI Toolkit Installer '));
|
|
71
|
+
// Get available items
|
|
72
|
+
const agents = await getFiles(join(ROOT_DIR, 'agents'), '.md');
|
|
73
|
+
const skills = await getDirectories(join(ROOT_DIR, 'skills'));
|
|
74
|
+
const mcps = await getDirectories(join(ROOT_DIR, 'mcps'));
|
|
75
|
+
const home = homedir();
|
|
76
|
+
// State
|
|
77
|
+
let step = 1;
|
|
78
|
+
let platform = null;
|
|
79
|
+
let selectedAgents = [];
|
|
80
|
+
let selectedSkills = [];
|
|
81
|
+
let selectedMcps = [];
|
|
82
|
+
// Step loop with back navigation
|
|
83
|
+
while (step <= 5) {
|
|
84
|
+
if (step === 1) {
|
|
85
|
+
// Step 1: Platform
|
|
86
|
+
p.log.info(chalk.cyan('Step 1/5: Platform'));
|
|
87
|
+
const result = await p.select({
|
|
88
|
+
message: 'Where do you want to install?',
|
|
89
|
+
options: [
|
|
90
|
+
{ value: 'claude', label: 'Claude Code' },
|
|
91
|
+
{ value: 'opencode', label: 'OpenCode' },
|
|
92
|
+
{ value: 'both', label: 'Both' },
|
|
93
|
+
],
|
|
94
|
+
});
|
|
95
|
+
if (p.isCancel(result)) {
|
|
96
|
+
p.cancel('Installation cancelled.');
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
platform = result;
|
|
100
|
+
step = 2;
|
|
101
|
+
}
|
|
102
|
+
else if (step === 2) {
|
|
103
|
+
// Step 2: Agents
|
|
104
|
+
p.log.info(chalk.cyan('Step 2/5: Agents'));
|
|
105
|
+
if (agents.length > 0) {
|
|
106
|
+
const agentOptions = [];
|
|
107
|
+
for (const agent of agents) {
|
|
108
|
+
let isInstalled = false;
|
|
109
|
+
if (platform === 'claude' || platform === 'both') {
|
|
110
|
+
if (await exists(join(home, '.claude', 'agents', `${agent}.md`))) {
|
|
111
|
+
isInstalled = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (platform === 'opencode' || platform === 'both') {
|
|
115
|
+
if (await exists(join(home, '.config', 'opencode', 'agent', `${agent}.md`))) {
|
|
116
|
+
isInstalled = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
agentOptions.push({
|
|
120
|
+
value: agent,
|
|
121
|
+
label: isInstalled ? `${agent} ${chalk.yellow('(installed)')}` : agent,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const result = await p.multiselect({
|
|
125
|
+
message: 'Select agents (space to toggle, enter to continue)',
|
|
126
|
+
options: agentOptions,
|
|
127
|
+
required: false,
|
|
128
|
+
});
|
|
129
|
+
if (p.isCancel(result)) {
|
|
130
|
+
p.cancel('Installation cancelled.');
|
|
131
|
+
process.exit(0);
|
|
132
|
+
}
|
|
133
|
+
selectedAgents = result;
|
|
134
|
+
}
|
|
135
|
+
step = 3;
|
|
136
|
+
}
|
|
137
|
+
else if (step === 3) {
|
|
138
|
+
// Step 3: Skills
|
|
139
|
+
p.log.info(chalk.cyan('Step 3/5: Skills'));
|
|
140
|
+
if (skills.length > 0) {
|
|
141
|
+
const skillOptions = [];
|
|
142
|
+
for (const skill of skills) {
|
|
143
|
+
let isInstalled = false;
|
|
144
|
+
if (platform === 'claude' || platform === 'both') {
|
|
145
|
+
if (await exists(join(home, '.claude', 'skills', skill))) {
|
|
146
|
+
isInstalled = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
skillOptions.push({
|
|
150
|
+
value: skill,
|
|
151
|
+
label: isInstalled ? `${skill} ${chalk.yellow('(installed)')}` : skill,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const result = await p.multiselect({
|
|
155
|
+
message: 'Select skills (space to toggle, enter to continue)',
|
|
156
|
+
options: skillOptions,
|
|
157
|
+
required: false,
|
|
158
|
+
});
|
|
159
|
+
if (p.isCancel(result)) {
|
|
160
|
+
p.cancel('Installation cancelled.');
|
|
161
|
+
process.exit(0);
|
|
162
|
+
}
|
|
163
|
+
selectedSkills = result;
|
|
164
|
+
}
|
|
165
|
+
step = 4;
|
|
166
|
+
}
|
|
167
|
+
else if (step === 4) {
|
|
168
|
+
// Step 4: MCPs
|
|
169
|
+
p.log.info(chalk.cyan('Step 4/5: MCPs'));
|
|
170
|
+
if (mcps.length > 0) {
|
|
171
|
+
// Check installed MCPs for both platforms
|
|
172
|
+
const claudeMcps = platform === 'claude' || platform === 'both'
|
|
173
|
+
? await getInstalledClaudeMcps()
|
|
174
|
+
: new Set();
|
|
175
|
+
const opencodeMcps = platform === 'opencode' || platform === 'both'
|
|
176
|
+
? await getInstalledOpencodeMcps()
|
|
177
|
+
: new Set();
|
|
178
|
+
const mcpOptions = mcps.map(mcp => {
|
|
179
|
+
const inClaude = claudeMcps.has(mcp);
|
|
180
|
+
const inOpencode = opencodeMcps.has(mcp);
|
|
181
|
+
let label = mcp;
|
|
182
|
+
if (platform === 'both') {
|
|
183
|
+
const tags = [];
|
|
184
|
+
if (inClaude)
|
|
185
|
+
tags.push('Claude');
|
|
186
|
+
if (inOpencode)
|
|
187
|
+
tags.push('OpenCode');
|
|
188
|
+
if (tags.length > 0) {
|
|
189
|
+
label += ` ${chalk.yellow(`(${tags.join(', ')})`)}`;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else if (inClaude || inOpencode) {
|
|
193
|
+
label += ` ${chalk.yellow('(installed)')}`;
|
|
194
|
+
}
|
|
195
|
+
return { value: mcp, label };
|
|
196
|
+
});
|
|
197
|
+
const result = await p.multiselect({
|
|
198
|
+
message: 'Select MCPs (space to toggle, enter to continue)',
|
|
199
|
+
options: mcpOptions,
|
|
200
|
+
required: false,
|
|
201
|
+
});
|
|
202
|
+
if (p.isCancel(result)) {
|
|
203
|
+
p.cancel('Installation cancelled.');
|
|
204
|
+
process.exit(0);
|
|
205
|
+
}
|
|
206
|
+
selectedMcps = result;
|
|
207
|
+
}
|
|
208
|
+
step = 5;
|
|
209
|
+
}
|
|
210
|
+
else if (step === 5) {
|
|
211
|
+
// Step 5: Confirm
|
|
212
|
+
p.log.info(chalk.cyan('Step 5/5: Confirm'));
|
|
213
|
+
const summary = [
|
|
214
|
+
`Platform: ${platform}`,
|
|
215
|
+
`Agents: ${selectedAgents.length > 0 ? selectedAgents.join(', ') : 'none'}`,
|
|
216
|
+
`Skills: ${selectedSkills.length > 0 ? selectedSkills.join(', ') : 'none'}`,
|
|
217
|
+
`MCPs: ${selectedMcps.length > 0 ? selectedMcps.join(', ') : 'none'}`,
|
|
218
|
+
].join('\n');
|
|
219
|
+
p.note(summary, 'Summary');
|
|
220
|
+
const confirm = await p.confirm({
|
|
221
|
+
message: 'Proceed with installation?',
|
|
222
|
+
});
|
|
223
|
+
if (p.isCancel(confirm) || !confirm) {
|
|
224
|
+
p.cancel('Installation cancelled.');
|
|
225
|
+
process.exit(0);
|
|
226
|
+
}
|
|
227
|
+
// Proceed with installation
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Installation
|
|
232
|
+
const s = p.spinner();
|
|
233
|
+
s.start('Installing...');
|
|
234
|
+
async function installClaude() {
|
|
235
|
+
const claudeDir = join(home, '.claude');
|
|
236
|
+
const agentsDir = join(claudeDir, 'agents');
|
|
237
|
+
const skillsDir = join(claudeDir, 'skills');
|
|
238
|
+
await mkdir(agentsDir, { recursive: true });
|
|
239
|
+
await mkdir(skillsDir, { recursive: true });
|
|
240
|
+
for (const agent of selectedAgents) {
|
|
241
|
+
const src = join(ROOT_DIR, 'agents', `${agent}.md`);
|
|
242
|
+
const dest = join(agentsDir, `${agent}.md`);
|
|
243
|
+
await cp(src, dest);
|
|
244
|
+
}
|
|
245
|
+
for (const skill of selectedSkills) {
|
|
246
|
+
const src = join(ROOT_DIR, 'skills', skill);
|
|
247
|
+
const dest = join(skillsDir, skill);
|
|
248
|
+
await cp(src, dest, { recursive: true, force: true });
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async function installOpencode() {
|
|
252
|
+
const opencodeDir = join(home, '.config', 'opencode');
|
|
253
|
+
const agentsDir = join(opencodeDir, 'agent');
|
|
254
|
+
const commandsDir = join(opencodeDir, 'command');
|
|
255
|
+
await mkdir(agentsDir, { recursive: true });
|
|
256
|
+
await mkdir(commandsDir, { recursive: true });
|
|
257
|
+
for (const agent of selectedAgents) {
|
|
258
|
+
const src = join(ROOT_DIR, 'agents', `${agent}.md`);
|
|
259
|
+
const dest = join(agentsDir, `${agent}.md`);
|
|
260
|
+
await cp(src, dest);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
try {
|
|
264
|
+
if (platform === 'claude' || platform === 'both') {
|
|
265
|
+
await installClaude();
|
|
266
|
+
}
|
|
267
|
+
if (platform === 'opencode' || platform === 'both') {
|
|
268
|
+
await installOpencode();
|
|
269
|
+
}
|
|
270
|
+
s.stop('Installation complete!');
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
s.stop('Installation failed');
|
|
274
|
+
p.log.error(error instanceof Error ? error.message : String(error));
|
|
275
|
+
process.exit(1);
|
|
276
|
+
}
|
|
277
|
+
// MCP instructions
|
|
278
|
+
if (selectedMcps.length > 0) {
|
|
279
|
+
const mcpInstructions = selectedMcps.map(mcp => ` → mcps/${mcp}/README.md`).join('\n');
|
|
280
|
+
p.note(mcpInstructions, 'MCP Setup Instructions');
|
|
281
|
+
}
|
|
282
|
+
p.outro(chalk.green('Done! Your tools are ready.'));
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACp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|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "AI Toolkit installer for Claude Code and OpenCode - agents, skills, and MCPs",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
7
8
|
"bin": {
|
|
8
9
|
"ai-toolkit": "./bin/cli.js"
|
|
9
10
|
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/davidcastillog/ai-toolkit.git"
|
|
14
|
+
},
|
|
10
15
|
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org",
|
|
11
17
|
"access": "public"
|
|
12
18
|
},
|
|
13
19
|
"scripts": {
|
|
14
|
-
"
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"start": "npm run build && node bin/cli.js",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
15
23
|
},
|
|
16
24
|
"keywords": [
|
|
17
25
|
"claude",
|
|
@@ -22,19 +30,22 @@
|
|
|
22
30
|
"skills",
|
|
23
31
|
"mcp"
|
|
24
32
|
],
|
|
25
|
-
"author": "
|
|
33
|
+
"author": "David Castillo",
|
|
26
34
|
"license": "MIT",
|
|
27
35
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"chalk": "^5.3.0"
|
|
30
|
-
|
|
36
|
+
"@clack/prompts": "^0.11.0",
|
|
37
|
+
"chalk": "^5.3.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^25.0.9",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
31
42
|
},
|
|
32
43
|
"engines": {
|
|
33
44
|
"node": ">=18.0.0"
|
|
34
45
|
},
|
|
35
46
|
"files": [
|
|
36
47
|
"bin",
|
|
37
|
-
"
|
|
48
|
+
"dist",
|
|
38
49
|
"agents",
|
|
39
50
|
"skills",
|
|
40
51
|
"mcps"
|
package/src/index.js
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import { select, checkbox } from '@inquirer/prompts';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
|
-
import { readdir, cp, mkdir, access } from 'fs/promises';
|
|
5
|
-
import { join, dirname } from 'path';
|
|
6
|
-
import { fileURLToPath } from 'url';
|
|
7
|
-
import { homedir } from 'os';
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const ROOT_DIR = join(__dirname, '..');
|
|
11
|
-
|
|
12
|
-
async function getDirectories(path) {
|
|
13
|
-
try {
|
|
14
|
-
const entries = await readdir(path, { withFileTypes: true });
|
|
15
|
-
return entries.filter(e => e.isDirectory()).map(e => e.name);
|
|
16
|
-
} catch {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function getFiles(path, extension) {
|
|
22
|
-
try {
|
|
23
|
-
const entries = await readdir(path, { withFileTypes: true });
|
|
24
|
-
return entries
|
|
25
|
-
.filter(e => e.isFile() && e.name.endsWith(extension))
|
|
26
|
-
.map(e => e.name.replace(extension, ''));
|
|
27
|
-
} catch {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function exists(path) {
|
|
33
|
-
try {
|
|
34
|
-
await access(path);
|
|
35
|
-
return true;
|
|
36
|
-
} catch {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const BACK = '__BACK__';
|
|
42
|
-
const CONTINUE = '__CONTINUE__';
|
|
43
|
-
|
|
44
|
-
function createChoices(items, includeBack = false) {
|
|
45
|
-
const choices = items.map(item => ({
|
|
46
|
-
name: item,
|
|
47
|
-
value: item,
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
choices.push({ name: chalk.green('─→ Continue'), value: CONTINUE });
|
|
51
|
-
|
|
52
|
-
if (includeBack) {
|
|
53
|
-
choices.push({ name: chalk.yellow('←─ Back'), value: BACK });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return choices;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export async function run() {
|
|
60
|
-
console.clear();
|
|
61
|
-
|
|
62
|
-
// Header
|
|
63
|
-
console.log('');
|
|
64
|
-
console.log(chalk.magenta('╔══════════════════════════════════╗'));
|
|
65
|
-
console.log(chalk.magenta('║') + chalk.white.bold(' CKW AI Toolkit Installer ') + chalk.magenta('║'));
|
|
66
|
-
console.log(chalk.magenta('╚══════════════════════════════════╝'));
|
|
67
|
-
console.log('');
|
|
68
|
-
|
|
69
|
-
// Get available items
|
|
70
|
-
const agents = await getFiles(join(ROOT_DIR, 'agents'), '.md');
|
|
71
|
-
const skills = await getDirectories(join(ROOT_DIR, 'skills'));
|
|
72
|
-
const mcps = await getDirectories(join(ROOT_DIR, 'mcps'));
|
|
73
|
-
|
|
74
|
-
// State
|
|
75
|
-
let step = 1;
|
|
76
|
-
let platform = null;
|
|
77
|
-
let selectedAgents = [];
|
|
78
|
-
let selectedSkills = [];
|
|
79
|
-
let selectedMcps = [];
|
|
80
|
-
|
|
81
|
-
const home = homedir();
|
|
82
|
-
|
|
83
|
-
// Navigation loop
|
|
84
|
-
while (step <= 5) {
|
|
85
|
-
|
|
86
|
-
if (step === 1) {
|
|
87
|
-
// Step 1: Platform
|
|
88
|
-
console.log(chalk.cyan('Step 1/5: Platform'));
|
|
89
|
-
console.log('');
|
|
90
|
-
|
|
91
|
-
platform = await select({
|
|
92
|
-
message: 'Where do you want to install?',
|
|
93
|
-
choices: [
|
|
94
|
-
{ name: 'Claude Code', value: 'claude' },
|
|
95
|
-
{ name: 'OpenCode', value: 'opencode' },
|
|
96
|
-
{ name: 'Both', value: 'both' },
|
|
97
|
-
{ name: chalk.yellow('←─ Cancel'), value: BACK }
|
|
98
|
-
]
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
if (platform === BACK) {
|
|
102
|
-
console.log(chalk.yellow('Installation cancelled.'));
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
step = 2;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
else if (step === 2) {
|
|
110
|
-
// Step 2: Agents
|
|
111
|
-
console.log('');
|
|
112
|
-
console.log(chalk.cyan('Step 2/5: Agents'));
|
|
113
|
-
console.log(chalk.dim('Select items with space, then choose Continue'));
|
|
114
|
-
console.log('');
|
|
115
|
-
|
|
116
|
-
if (agents.length > 0) {
|
|
117
|
-
// Check which agents already exist
|
|
118
|
-
const agentChoices = [];
|
|
119
|
-
for (const agent of agents) {
|
|
120
|
-
let alreadyInstalled = false;
|
|
121
|
-
|
|
122
|
-
if (platform === 'claude' || platform === 'both') {
|
|
123
|
-
if (await exists(join(home, '.claude', 'agents', `${agent}.md`))) {
|
|
124
|
-
alreadyInstalled = true;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (platform === 'opencode' || platform === 'both') {
|
|
128
|
-
if (await exists(join(home, '.config', 'opencode', 'agent', `${agent}.md`))) {
|
|
129
|
-
alreadyInstalled = true;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
agentChoices.push({
|
|
134
|
-
name: alreadyInstalled ? `${agent} ${chalk.yellow('(installed)')}` : agent,
|
|
135
|
-
value: agent,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
agentChoices.push({ name: chalk.green('─→ Continue'), value: CONTINUE });
|
|
140
|
-
agentChoices.push({ name: chalk.yellow('←─ Back'), value: BACK });
|
|
141
|
-
|
|
142
|
-
const result = await checkbox({
|
|
143
|
-
message: 'Select agents:',
|
|
144
|
-
choices: agentChoices,
|
|
145
|
-
theme: {
|
|
146
|
-
icon: {
|
|
147
|
-
checked: chalk.green('[✓]'),
|
|
148
|
-
unchecked: '[ ]',
|
|
149
|
-
cursor: '→'
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
if (result.includes(BACK)) {
|
|
155
|
-
step = 1;
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
selectedAgents = result.filter(r => r !== CONTINUE && r !== BACK);
|
|
160
|
-
|
|
161
|
-
if (!result.includes(CONTINUE)) {
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
step = 3;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
else if (step === 3) {
|
|
170
|
-
// Step 3: Skills
|
|
171
|
-
console.log('');
|
|
172
|
-
console.log(chalk.cyan('Step 3/5: Skills'));
|
|
173
|
-
console.log(chalk.dim('Select items with space, then choose Continue'));
|
|
174
|
-
console.log('');
|
|
175
|
-
|
|
176
|
-
if (skills.length > 0) {
|
|
177
|
-
// Check which skills already exist
|
|
178
|
-
const skillChoices = [];
|
|
179
|
-
for (const skill of skills) {
|
|
180
|
-
let alreadyInstalled = false;
|
|
181
|
-
|
|
182
|
-
if (platform === 'claude' || platform === 'both') {
|
|
183
|
-
if (await exists(join(home, '.claude', 'skills', skill))) {
|
|
184
|
-
alreadyInstalled = true;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
skillChoices.push({
|
|
189
|
-
name: alreadyInstalled ? `${skill} ${chalk.yellow('(installed)')}` : skill,
|
|
190
|
-
value: skill,
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
skillChoices.push({ name: chalk.green('─→ Continue'), value: CONTINUE });
|
|
195
|
-
skillChoices.push({ name: chalk.yellow('←─ Back'), value: BACK });
|
|
196
|
-
|
|
197
|
-
const result = await checkbox({
|
|
198
|
-
message: 'Select skills:',
|
|
199
|
-
choices: skillChoices,
|
|
200
|
-
theme: {
|
|
201
|
-
icon: {
|
|
202
|
-
checked: chalk.green('[✓]'),
|
|
203
|
-
unchecked: '[ ]',
|
|
204
|
-
cursor: '→'
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
if (result.includes(BACK)) {
|
|
210
|
-
step = 2;
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
selectedSkills = result.filter(r => r !== CONTINUE && r !== BACK);
|
|
215
|
-
|
|
216
|
-
if (!result.includes(CONTINUE)) {
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
step = 4;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
else if (step === 4) {
|
|
225
|
-
// Step 4: MCPs
|
|
226
|
-
console.log('');
|
|
227
|
-
console.log(chalk.cyan('Step 4/5: MCPs'));
|
|
228
|
-
console.log(chalk.dim('Select items with space, then choose Continue'));
|
|
229
|
-
console.log('');
|
|
230
|
-
|
|
231
|
-
if (mcps.length > 0) {
|
|
232
|
-
const result = await checkbox({
|
|
233
|
-
message: 'Select MCPs:',
|
|
234
|
-
choices: createChoices(mcps, true),
|
|
235
|
-
theme: {
|
|
236
|
-
icon: {
|
|
237
|
-
checked: chalk.green('[✓]'),
|
|
238
|
-
unchecked: '[ ]',
|
|
239
|
-
cursor: '→'
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
if (result.includes(BACK)) {
|
|
245
|
-
step = 3;
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
selectedMcps = result.filter(r => r !== CONTINUE && r !== BACK);
|
|
250
|
-
|
|
251
|
-
if (!result.includes(CONTINUE)) {
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
step = 5;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
else if (step === 5) {
|
|
260
|
-
// Step 5: Summary & Confirm
|
|
261
|
-
console.log('');
|
|
262
|
-
console.log(chalk.yellow('Summary'));
|
|
263
|
-
console.log('');
|
|
264
|
-
console.log(` Platform: ${chalk.white(platform)}`);
|
|
265
|
-
console.log(` Agents: ${chalk.white(selectedAgents.length > 0 ? selectedAgents.join(', ') : 'none')}`);
|
|
266
|
-
console.log(` Skills: ${chalk.white(selectedSkills.length > 0 ? selectedSkills.join(', ') : 'none')}`);
|
|
267
|
-
console.log(` MCPs: ${chalk.white(selectedMcps.length > 0 ? selectedMcps.join(', ') : 'none')}`);
|
|
268
|
-
console.log('');
|
|
269
|
-
|
|
270
|
-
const action = await select({
|
|
271
|
-
message: 'What would you like to do?',
|
|
272
|
-
choices: [
|
|
273
|
-
{ name: chalk.green('✓ Install'), value: 'install' },
|
|
274
|
-
{ name: chalk.yellow('←─ Back'), value: BACK },
|
|
275
|
-
{ name: chalk.red('✗ Cancel'), value: 'cancel' }
|
|
276
|
-
]
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
if (action === BACK) {
|
|
280
|
-
step = 4;
|
|
281
|
-
continue;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (action === 'cancel') {
|
|
285
|
-
console.log(chalk.yellow('Installation cancelled.'));
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// Proceed with installation
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// Installation
|
|
295
|
-
console.log('');
|
|
296
|
-
const spinner = ora('Installing...').start();
|
|
297
|
-
|
|
298
|
-
async function installClaude() {
|
|
299
|
-
const claudeDir = join(home, '.claude');
|
|
300
|
-
const agentsDir = join(claudeDir, 'agents');
|
|
301
|
-
const skillsDir = join(claudeDir, 'skills');
|
|
302
|
-
|
|
303
|
-
await mkdir(agentsDir, { recursive: true });
|
|
304
|
-
await mkdir(skillsDir, { recursive: true });
|
|
305
|
-
|
|
306
|
-
for (const agent of selectedAgents) {
|
|
307
|
-
const src = join(ROOT_DIR, 'agents', `${agent}.md`);
|
|
308
|
-
const dest = join(agentsDir, `${agent}.md`);
|
|
309
|
-
await cp(src, dest);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
for (const skill of selectedSkills) {
|
|
313
|
-
const src = join(ROOT_DIR, 'skills', skill);
|
|
314
|
-
const dest = join(skillsDir, skill);
|
|
315
|
-
await cp(src, dest, { recursive: true, force: true });
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
async function installOpencode() {
|
|
320
|
-
const opencodeDir = join(home, '.config', 'opencode');
|
|
321
|
-
const agentsDir = join(opencodeDir, 'agent');
|
|
322
|
-
const commandsDir = join(opencodeDir, 'command');
|
|
323
|
-
|
|
324
|
-
await mkdir(agentsDir, { recursive: true });
|
|
325
|
-
await mkdir(commandsDir, { recursive: true });
|
|
326
|
-
|
|
327
|
-
for (const agent of selectedAgents) {
|
|
328
|
-
const src = join(ROOT_DIR, 'agents', `${agent}.md`);
|
|
329
|
-
const dest = join(agentsDir, `${agent}.md`);
|
|
330
|
-
await cp(src, dest);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
try {
|
|
335
|
-
if (platform === 'claude' || platform === 'both') {
|
|
336
|
-
await installClaude();
|
|
337
|
-
}
|
|
338
|
-
if (platform === 'opencode' || platform === 'both') {
|
|
339
|
-
await installOpencode();
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
spinner.succeed('Installation complete!');
|
|
343
|
-
} catch (error) {
|
|
344
|
-
spinner.fail('Installation failed');
|
|
345
|
-
console.error(chalk.red(error.message));
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// Done
|
|
350
|
-
console.log('');
|
|
351
|
-
console.log(chalk.green('╔══════════════════════════════════╗'));
|
|
352
|
-
console.log(chalk.green('║ ✓ Installation Complete! ║'));
|
|
353
|
-
console.log(chalk.green('╚══════════════════════════════════╝'));
|
|
354
|
-
|
|
355
|
-
if (selectedMcps.length > 0) {
|
|
356
|
-
console.log('');
|
|
357
|
-
console.log(chalk.yellow('MCP Setup Instructions:'));
|
|
358
|
-
console.log('');
|
|
359
|
-
for (const mcp of selectedMcps) {
|
|
360
|
-
console.log(` → ${chalk.cyan(`mcps/${mcp}/README.md`)}`);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
console.log('');
|
|
365
|
-
}
|