specialist-agent 1.2.2 → 1.3.0
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/cli/index.mjs +95 -71
- package/package.json +1 -1
package/cli/index.mjs
CHANGED
|
@@ -16,37 +16,68 @@ const BOLD = '\x1b[1m'
|
|
|
16
16
|
const DIM = '\x1b[2m'
|
|
17
17
|
const NC = '\x1b[0m'
|
|
18
18
|
|
|
19
|
+
const W = 50
|
|
20
|
+
|
|
19
21
|
const rl = createInterface({ input: process.stdin, output: process.stdout })
|
|
20
22
|
rl.on('close', () => {
|
|
21
23
|
console.log()
|
|
22
24
|
process.exit(0)
|
|
23
25
|
})
|
|
24
26
|
|
|
25
|
-
function ask(question, options) {
|
|
27
|
+
function ask(question, options, stepInfo) {
|
|
26
28
|
return new Promise((resolve) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log()
|
|
34
|
-
}
|
|
35
|
-
|
|
29
|
+
const prefix = stepInfo ? `${BLUE}[${stepInfo}]${NC} ` : ''
|
|
30
|
+
console.log()
|
|
31
|
+
console.log(` ${prefix}${question}`)
|
|
32
|
+
if (options) {
|
|
33
|
+
console.log()
|
|
34
|
+
options.forEach((opt, i) => {
|
|
35
|
+
console.log(` ${BOLD}${i + 1}${NC}) ${opt.label}${opt.hint ? ` ${DIM}${opt.hint}${NC}` : ''}`)
|
|
36
|
+
})
|
|
37
|
+
console.log()
|
|
38
|
+
}
|
|
39
|
+
const doPrompt = () => {
|
|
40
|
+
rl.question(` ${BLUE}\u203a${NC} `, (answer) => {
|
|
36
41
|
if (options) {
|
|
37
42
|
const idx = parseInt(answer, 10) - 1
|
|
38
43
|
if (idx >= 0 && idx < options.length) {
|
|
39
44
|
resolve(options[idx].value)
|
|
40
45
|
} else {
|
|
41
|
-
console.log(`
|
|
42
|
-
|
|
46
|
+
console.log(` ${YELLOW}Enter a number between 1 and ${options.length}${NC}`)
|
|
47
|
+
doPrompt()
|
|
43
48
|
}
|
|
44
49
|
} else {
|
|
45
50
|
resolve(answer.trim())
|
|
46
51
|
}
|
|
47
52
|
})
|
|
48
53
|
}
|
|
49
|
-
|
|
54
|
+
doPrompt()
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function confirm(question, defaultYes, stepInfo) {
|
|
59
|
+
return new Promise((resolve) => {
|
|
60
|
+
const prefix = stepInfo ? `${BLUE}[${stepInfo}]${NC} ` : ''
|
|
61
|
+
const hint = defaultYes ? `${DIM}(Y/n)${NC}` : `${DIM}(y/N)${NC}`
|
|
62
|
+
console.log()
|
|
63
|
+
console.log(` ${prefix}${question} ${hint}`)
|
|
64
|
+
console.log()
|
|
65
|
+
const doPrompt = () => {
|
|
66
|
+
rl.question(` ${BLUE}\u203a${NC} `, (answer) => {
|
|
67
|
+
const val = answer.trim().toLowerCase()
|
|
68
|
+
if (val === '') {
|
|
69
|
+
resolve(defaultYes)
|
|
70
|
+
} else if (val === 'y' || val === 'yes') {
|
|
71
|
+
resolve(true)
|
|
72
|
+
} else if (val === 'n' || val === 'no') {
|
|
73
|
+
resolve(false)
|
|
74
|
+
} else {
|
|
75
|
+
console.log(` ${YELLOW}Enter Y or N${NC}`)
|
|
76
|
+
doPrompt()
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
doPrompt()
|
|
50
81
|
})
|
|
51
82
|
}
|
|
52
83
|
|
|
@@ -79,24 +110,23 @@ function getAgentNames(dir) {
|
|
|
79
110
|
|
|
80
111
|
async function main() {
|
|
81
112
|
const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
|
|
113
|
+
const ver = `v${pkg.version}`
|
|
82
114
|
|
|
115
|
+
// Header
|
|
83
116
|
console.log()
|
|
84
|
-
console.log(
|
|
85
|
-
console.log(
|
|
86
|
-
console.log(
|
|
87
|
-
console.log()
|
|
88
|
-
console.log(` ${
|
|
117
|
+
console.log(` ${BLUE}\u256d${'─'.repeat(W)}\u256e${NC}`)
|
|
118
|
+
console.log(` ${BLUE}\u2502${NC}${' '.repeat(W)}${BLUE}\u2502${NC}`)
|
|
119
|
+
console.log(` ${BLUE}\u2502${NC} ${BOLD}Specialist Agent${NC}${' '.repeat(W - 22 - ver.length)}${DIM}${ver}${NC} ${BLUE}\u2502${NC}`)
|
|
120
|
+
console.log(` ${BLUE}\u2502${NC} ${DIM}AI agents for Claude Code${NC}${' '.repeat(W - 28)}${BLUE}\u2502${NC}`)
|
|
121
|
+
console.log(` ${BLUE}\u2502${NC}${' '.repeat(W)}${BLUE}\u2502${NC}`)
|
|
122
|
+
console.log(` ${BLUE}\u2570${'─'.repeat(W)}\u256f${NC}`)
|
|
89
123
|
console.log()
|
|
90
124
|
|
|
91
125
|
// Check we're in a project
|
|
92
126
|
const cwd = process.cwd()
|
|
93
127
|
if (!existsSync(join(cwd, 'package.json'))) {
|
|
94
|
-
console.log(
|
|
95
|
-
|
|
96
|
-
const createPkg = await ask('Create a package.json to initialize this project?', [
|
|
97
|
-
{ label: 'Yes', value: true, hint: '(recommended)' },
|
|
98
|
-
{ label: 'No', value: false, hint: '(exit)' },
|
|
99
|
-
])
|
|
128
|
+
console.log(` ${YELLOW}\u26a0${NC} No package.json found in current directory.`)
|
|
129
|
+
const createPkg = await confirm('Create a package.json to initialize this project?', true)
|
|
100
130
|
if (!createPkg) {
|
|
101
131
|
console.log(` Run this command from the root of your project.`)
|
|
102
132
|
console.log()
|
|
@@ -104,7 +134,7 @@ async function main() {
|
|
|
104
134
|
}
|
|
105
135
|
const dirName = cwd.split(/[\\/]/).pop() || 'my-project'
|
|
106
136
|
writeFileSync(join(cwd, 'package.json'), JSON.stringify({ name: dirName, version: '0.1.0', private: true }, null, 2) + '\n')
|
|
107
|
-
console.log(` ${GREEN}
|
|
137
|
+
console.log(` ${GREEN}\u2713${NC} package.json created`)
|
|
108
138
|
console.log()
|
|
109
139
|
}
|
|
110
140
|
|
|
@@ -121,32 +151,26 @@ async function main() {
|
|
|
121
151
|
hint: ''
|
|
122
152
|
}))
|
|
123
153
|
|
|
124
|
-
const framework = await ask('Which framework?', packOptions)
|
|
154
|
+
const framework = await ask('Which framework?', packOptions, '1/4')
|
|
125
155
|
|
|
126
156
|
// 2. Mode
|
|
127
157
|
const mode = await ask('Agent mode?', [
|
|
128
|
-
{ label: 'Full', value: 'full', hint: '(Sonnet/Opus
|
|
129
|
-
{ label: 'Lite', value: 'lite', hint: '(Haiku
|
|
130
|
-
])
|
|
158
|
+
{ label: 'Full', value: 'full', hint: '(Sonnet/Opus)' },
|
|
159
|
+
{ label: 'Lite', value: 'lite', hint: '(Haiku \u2014 lower cost)' },
|
|
160
|
+
], '2/4')
|
|
131
161
|
|
|
132
162
|
// 3. Starter agent
|
|
133
|
-
const installStarter = await
|
|
134
|
-
{ label: 'Yes', value: true, hint: '(recommended)' },
|
|
135
|
-
{ label: 'No', value: false, hint: '' },
|
|
136
|
-
])
|
|
163
|
+
const installStarter = await confirm('Install @starter agent?', true, '3/4')
|
|
137
164
|
|
|
138
165
|
// 4. Specialist agents
|
|
139
|
-
const installSpecialists = await
|
|
140
|
-
{ label: 'Yes', value: true, hint: '(recommended)' },
|
|
141
|
-
{ label: 'No', value: false, hint: '' },
|
|
142
|
-
])
|
|
166
|
+
const installSpecialists = await confirm('Install specialist agents?', true, '4/4')
|
|
143
167
|
|
|
144
|
-
|
|
145
|
-
console.log(`${BLUE} ───────────────────────────────────────────────${NC}`)
|
|
146
|
-
console.log(` ${BOLD}Installing Specialist Agent${NC}`)
|
|
168
|
+
// Summary
|
|
147
169
|
const packLabel = packLabels[framework] || framework
|
|
148
|
-
console.log(
|
|
149
|
-
console.log(
|
|
170
|
+
console.log()
|
|
171
|
+
console.log(` ${BLUE}${'─'.repeat(W)}${NC}`)
|
|
172
|
+
console.log()
|
|
173
|
+
console.log(` ${packLabel} ${DIM}\u00b7${NC} ${mode === 'full' ? 'Full' : 'Lite'} ${DIM}\u00b7${NC} Starter: ${installStarter ? 'yes' : 'no'} ${DIM}\u00b7${NC} Specialists: ${installSpecialists ? 'yes' : 'no'}`)
|
|
150
174
|
console.log()
|
|
151
175
|
|
|
152
176
|
const packDir = join(ROOT, 'packs', framework)
|
|
@@ -155,16 +179,15 @@ async function main() {
|
|
|
155
179
|
const archSource = join(packDir, 'ARCHITECTURE.md')
|
|
156
180
|
const claudeSource = join(packDir, 'CLAUDE.md')
|
|
157
181
|
|
|
158
|
-
// Install agents
|
|
182
|
+
// Install pack agents
|
|
159
183
|
const agentsDest = join(cwd, '.claude', 'agents')
|
|
160
184
|
mkdirSync(agentsDest, { recursive: true })
|
|
161
185
|
const agentCount = copyDir(agentsSource, agentsDest)
|
|
162
186
|
const agentNames = getAgentNames(agentsDest)
|
|
163
187
|
|
|
164
188
|
agentNames.forEach(name => {
|
|
165
|
-
console.log(` ${GREEN}
|
|
189
|
+
console.log(` ${GREEN}\u2713${NC} @${name}`)
|
|
166
190
|
})
|
|
167
|
-
console.log(` ${GREEN}${agentCount} agents installed${NC}`)
|
|
168
191
|
|
|
169
192
|
// Install starter agent
|
|
170
193
|
if (installStarter) {
|
|
@@ -174,7 +197,7 @@ async function main() {
|
|
|
174
197
|
|
|
175
198
|
if (existsSync(starterSource)) {
|
|
176
199
|
cpSync(starterSource, starterDest)
|
|
177
|
-
console.log(` ${GREEN}
|
|
200
|
+
console.log(` ${GREEN}\u2713${NC} @starter`)
|
|
178
201
|
}
|
|
179
202
|
}
|
|
180
203
|
|
|
@@ -188,35 +211,36 @@ async function main() {
|
|
|
188
211
|
|
|
189
212
|
if (existsSync(source)) {
|
|
190
213
|
cpSync(source, dest)
|
|
191
|
-
console.log(` ${GREEN}
|
|
214
|
+
console.log(` ${GREEN}\u2713${NC} @${name}`)
|
|
192
215
|
}
|
|
193
216
|
}
|
|
194
217
|
}
|
|
195
218
|
|
|
219
|
+
console.log(` ${DIM}${agentCount} pack agents + extras installed${NC}`)
|
|
220
|
+
|
|
196
221
|
// Install skills
|
|
197
222
|
console.log()
|
|
198
223
|
const skillsDest = join(cwd, '.claude', 'skills')
|
|
199
224
|
mkdirSync(skillsDest, { recursive: true })
|
|
200
225
|
const skillCount = copyDir(skillsSource, skillsDest)
|
|
201
226
|
if (skillCount > 0) {
|
|
202
|
-
console.log(` ${GREEN}${skillCount} skills installed
|
|
227
|
+
console.log(` ${GREEN}\u2713${NC} ${skillCount} skills installed`)
|
|
203
228
|
} else {
|
|
204
229
|
console.log(` ${DIM} No skills available for this pack${NC}`)
|
|
205
230
|
}
|
|
206
231
|
|
|
207
232
|
// Install ARCHITECTURE.md
|
|
208
|
-
console.log()
|
|
209
233
|
const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
|
|
210
234
|
if (!existsSync(archDest)) {
|
|
211
235
|
if (existsSync(archSource)) {
|
|
212
236
|
mkdirSync(dirname(archDest), { recursive: true })
|
|
213
237
|
cpSync(archSource, archDest)
|
|
214
|
-
console.log(` ${GREEN}
|
|
238
|
+
console.log(` ${GREEN}\u2713${NC} docs/ARCHITECTURE.md`)
|
|
215
239
|
} else {
|
|
216
|
-
console.log(` ${YELLOW}
|
|
240
|
+
console.log(` ${YELLOW}\u26a0${NC} ARCHITECTURE.md not found in pack ${DIM}(skipped)${NC}`)
|
|
217
241
|
}
|
|
218
242
|
} else {
|
|
219
|
-
console.log(` ${
|
|
243
|
+
console.log(` ${DIM} docs/ARCHITECTURE.md already exists${NC}`)
|
|
220
244
|
}
|
|
221
245
|
|
|
222
246
|
// Install CLAUDE.md
|
|
@@ -224,24 +248,24 @@ async function main() {
|
|
|
224
248
|
if (!existsSync(claudeDest)) {
|
|
225
249
|
if (existsSync(claudeSource)) {
|
|
226
250
|
cpSync(claudeSource, claudeDest)
|
|
227
|
-
console.log(` ${GREEN}
|
|
251
|
+
console.log(` ${GREEN}\u2713${NC} CLAUDE.md`)
|
|
228
252
|
} else {
|
|
229
|
-
console.log(` ${YELLOW}
|
|
253
|
+
console.log(` ${YELLOW}\u26a0${NC} CLAUDE.md not found in pack ${DIM}(skipped)${NC}`)
|
|
230
254
|
}
|
|
231
255
|
} else {
|
|
232
|
-
console.log(` ${
|
|
256
|
+
console.log(` ${DIM} CLAUDE.md already exists${NC}`)
|
|
233
257
|
}
|
|
234
258
|
|
|
235
259
|
// Done
|
|
236
260
|
console.log()
|
|
237
|
-
console.log(
|
|
238
|
-
console.log(
|
|
239
|
-
console.log(
|
|
261
|
+
console.log(` ${BLUE}${'─'.repeat(W)}${NC}`)
|
|
262
|
+
console.log()
|
|
263
|
+
console.log(` ${GREEN}${BOLD}Setup complete!${NC}`)
|
|
240
264
|
console.log()
|
|
241
265
|
|
|
242
266
|
if (mode === 'lite') {
|
|
243
|
-
console.log(` ${
|
|
244
|
-
console.log(` ${
|
|
267
|
+
console.log(` ${DIM}Lite mode: agents run on Haiku (lower cost, faster).${NC}`)
|
|
268
|
+
console.log(` ${DIM}Switch to Full: npx specialist-agent init${NC}`)
|
|
245
269
|
console.log()
|
|
246
270
|
}
|
|
247
271
|
|
|
@@ -250,14 +274,13 @@ async function main() {
|
|
|
250
274
|
? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
|
|
251
275
|
: []
|
|
252
276
|
|
|
253
|
-
console.log(`
|
|
277
|
+
console.log(` Get started:`)
|
|
254
278
|
console.log()
|
|
255
|
-
console.log(` claude`)
|
|
256
|
-
console.log(` /agents
|
|
279
|
+
console.log(` ${DIM}$${NC} claude`)
|
|
280
|
+
console.log(` ${DIM}$${NC} /agents ${DIM}# list installed agents${NC}`)
|
|
257
281
|
if (installedSkills.length > 0) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
console.log(` ${skill}`)
|
|
282
|
+
installedSkills.slice(0, 2).forEach(skill => {
|
|
283
|
+
console.log(` ${DIM}$${NC} ${skill}`)
|
|
261
284
|
})
|
|
262
285
|
}
|
|
263
286
|
console.log()
|
|
@@ -271,6 +294,7 @@ async function main() {
|
|
|
271
294
|
rl.close()
|
|
272
295
|
}
|
|
273
296
|
|
|
297
|
+
// CLI argument handling
|
|
274
298
|
const args = process.argv.slice(2)
|
|
275
299
|
|
|
276
300
|
const validCommands = ['init']
|
|
@@ -284,16 +308,16 @@ if (command && !validCommands.includes(command)) {
|
|
|
284
308
|
if (args.includes('--help') || args.includes('-h')) {
|
|
285
309
|
const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
|
|
286
310
|
console.log()
|
|
287
|
-
console.log(` ${BOLD}specialist-agent${NC} v${pkg.version}`)
|
|
311
|
+
console.log(` ${BOLD}specialist-agent${NC} ${DIM}v${pkg.version}${NC}`)
|
|
288
312
|
console.log()
|
|
289
313
|
console.log(' Usage: specialist-agent [init] [options]')
|
|
290
314
|
console.log()
|
|
291
315
|
console.log(' Options:')
|
|
292
|
-
console.log(
|
|
293
|
-
console.log(
|
|
316
|
+
console.log(` -h, --help ${DIM}Show this help message${NC}`)
|
|
317
|
+
console.log(` -v, --version ${DIM}Show version number${NC}`)
|
|
294
318
|
console.log()
|
|
295
|
-
console.log(
|
|
296
|
-
console.log(
|
|
319
|
+
console.log(` ${DIM}Run the setup wizard to install AI agents for Claude Code.${NC}`)
|
|
320
|
+
console.log(` ${DIM}Can be executed from any directory (creates package.json if needed).${NC}`)
|
|
297
321
|
console.log()
|
|
298
322
|
process.exit(0)
|
|
299
323
|
}
|