specialist-agent 1.3.0 → 1.4.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 (57) hide show
  1. package/README.md +7 -4
  2. package/agents/cloud-lite.md +14 -0
  3. package/agents/cloud.md +14 -0
  4. package/agents/data-lite.md +14 -0
  5. package/agents/data.md +14 -0
  6. package/agents/designer-lite.md +14 -0
  7. package/agents/designer.md +14 -0
  8. package/agents/devops-lite.md +14 -0
  9. package/agents/devops.md +14 -0
  10. package/agents/explorer-lite.md +14 -0
  11. package/agents/explorer.md +14 -0
  12. package/agents/finance-lite.md +14 -0
  13. package/agents/finance.md +14 -0
  14. package/agents/security-lite.md +14 -0
  15. package/agents/security.md +14 -0
  16. package/agents/starter-lite.md +15 -1
  17. package/agents/starter.md +15 -1
  18. package/agents/tester-lite.md +15 -1
  19. package/agents/tester.md +19 -5
  20. package/cli/index.mjs +327 -204
  21. package/package.json +4 -1
  22. package/packs/nextjs/CLAUDE.md +36 -1
  23. package/packs/nextjs/agents/builder.md +14 -0
  24. package/packs/nextjs/agents/doctor.md +14 -0
  25. package/packs/nextjs/agents/migrator.md +14 -0
  26. package/packs/nextjs/agents/reviewer.md +14 -0
  27. package/packs/nextjs/agents-lite/builder.md +14 -0
  28. package/packs/nextjs/agents-lite/doctor.md +14 -0
  29. package/packs/nextjs/agents-lite/migrator.md +14 -0
  30. package/packs/nextjs/agents-lite/reviewer.md +14 -0
  31. package/packs/react/CLAUDE.md +36 -1
  32. package/packs/react/agents/builder.md +14 -0
  33. package/packs/react/agents/doctor.md +14 -0
  34. package/packs/react/agents/migrator.md +14 -0
  35. package/packs/react/agents/reviewer.md +14 -0
  36. package/packs/react/agents-lite/builder.md +14 -0
  37. package/packs/react/agents-lite/doctor.md +14 -0
  38. package/packs/react/agents-lite/migrator.md +14 -0
  39. package/packs/react/agents-lite/reviewer.md +14 -0
  40. package/packs/svelte/CLAUDE.md +36 -1
  41. package/packs/svelte/agents/builder.md +14 -0
  42. package/packs/svelte/agents/doctor.md +14 -0
  43. package/packs/svelte/agents/migrator.md +14 -0
  44. package/packs/svelte/agents/reviewer.md +14 -0
  45. package/packs/svelte/agents-lite/builder.md +14 -0
  46. package/packs/svelte/agents-lite/doctor.md +14 -0
  47. package/packs/svelte/agents-lite/migrator.md +14 -0
  48. package/packs/svelte/agents-lite/reviewer.md +14 -0
  49. package/packs/vue/CLAUDE.md +36 -1
  50. package/packs/vue/agents/builder.md +14 -0
  51. package/packs/vue/agents/doctor.md +14 -0
  52. package/packs/vue/agents/migrator.md +14 -0
  53. package/packs/vue/agents/reviewer.md +14 -0
  54. package/packs/vue/agents-lite/builder.md +14 -0
  55. package/packs/vue/agents-lite/doctor.md +14 -0
  56. package/packs/vue/agents-lite/migrator.md +14 -0
  57. package/packs/vue/agents-lite/reviewer.md +14 -0
package/cli/index.mjs CHANGED
@@ -1,90 +1,48 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { createInterface } from 'readline'
3
+ import * as clack from '@clack/prompts'
4
4
  import { existsSync, mkdirSync, cpSync, readdirSync, readFileSync, writeFileSync } from 'fs'
5
5
  import { join, dirname, resolve } from 'path'
6
6
  import { fileURLToPath } from 'url'
7
+ import { homedir } from 'os'
7
8
 
8
9
  const __filename = fileURLToPath(import.meta.url)
9
10
  const __dirname = dirname(__filename)
10
11
  const ROOT = resolve(__dirname, '..')
11
12
 
12
- const GREEN = '\x1b[32m'
13
- const BLUE = '\x1b[34m'
14
13
  const YELLOW = '\x1b[33m'
15
14
  const BOLD = '\x1b[1m'
16
15
  const DIM = '\x1b[2m'
17
16
  const NC = '\x1b[0m'
18
17
 
19
- const W = 50
18
+ // ── Helpers ──────────────────────────────────────────
20
19
 
21
- const rl = createInterface({ input: process.stdin, output: process.stdout })
22
- rl.on('close', () => {
23
- console.log()
24
- process.exit(0)
25
- })
26
-
27
- function ask(question, options, stepInfo) {
28
- return new Promise((resolve) => {
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) => {
41
- if (options) {
42
- const idx = parseInt(answer, 10) - 1
43
- if (idx >= 0 && idx < options.length) {
44
- resolve(options[idx].value)
45
- } else {
46
- console.log(` ${YELLOW}Enter a number between 1 and ${options.length}${NC}`)
47
- doPrompt()
48
- }
49
- } else {
50
- resolve(answer.trim())
51
- }
52
- })
53
- }
54
- doPrompt()
55
- })
20
+ function copyDir(src, dest) {
21
+ if (!existsSync(src)) return 0
22
+ cpSync(src, dest, { recursive: true })
23
+ return countFiles(dest)
56
24
  }
57
25
 
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
- })
26
+ function copyNewOnly(src, dest) {
27
+ if (!existsSync(src)) return 0
28
+ let count = 0
29
+ for (const entry of readdirSync(src, { withFileTypes: true })) {
30
+ const srcPath = join(src, entry.name)
31
+ const destPath = join(dest, entry.name)
32
+ if (entry.isDirectory()) {
33
+ mkdirSync(destPath, { recursive: true })
34
+ count += copyNewOnly(srcPath, destPath)
35
+ } else if (entry.name.endsWith('.md') && !existsSync(destPath)) {
36
+ cpSync(srcPath, destPath)
37
+ count++
79
38
  }
80
- doPrompt()
81
- })
39
+ }
40
+ return count
82
41
  }
83
42
 
84
- function copyDir(src, dest) {
85
- if (!existsSync(src)) return 0
86
- cpSync(src, dest, { recursive: true })
87
- return countFiles(dest)
43
+ function detectExistingAgents(agentsDir) {
44
+ if (!existsSync(agentsDir)) return []
45
+ return readdirSync(agentsDir).filter(f => f.endsWith('.md'))
88
46
  }
89
47
 
90
48
  function countFiles(dir) {
@@ -108,34 +66,156 @@ function getAgentNames(dir) {
108
66
  })
109
67
  }
110
68
 
111
- async function main() {
112
- const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
113
- const ver = `v${pkg.version}`
69
+ function handleCancel() {
70
+ clack.cancel('Setup cancelled.')
71
+ process.exit(0)
72
+ }
73
+
74
+ async function checkForUpdates(currentVersion) {
75
+ try {
76
+ const res = await fetch('https://registry.npmjs.org/specialist-agent/latest', {
77
+ signal: AbortSignal.timeout(3000),
78
+ })
79
+ if (!res.ok) return null
80
+ const data = await res.json()
81
+ const latest = data.version
82
+ if (latest && latest !== currentVersion) return latest
83
+ return null
84
+ } catch {
85
+ return null
86
+ }
87
+ }
88
+
89
+ function detectFramework(pkgPath, availablePacks) {
90
+ if (!existsSync(pkgPath)) return null
91
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
92
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies }
93
+
94
+ // Order matters: next includes react, so check next first
95
+ if (deps['next'] && availablePacks.includes('nextjs')) return 'nextjs'
96
+ if ((deps['@sveltejs/kit'] || deps['svelte']) && availablePacks.includes('svelte')) return 'svelte'
97
+ if (deps['vue'] && availablePacks.includes('vue')) return 'vue'
98
+ if (deps['react'] && availablePacks.includes('react')) return 'react'
99
+
100
+ return null
101
+ }
102
+
103
+ // ── Guidance texts ───────────────────────────────────
104
+
105
+ function buildGettingStarted(agentNames, installedSkills) {
106
+ const lines = []
107
+
108
+ lines.push('Agents enforce the architecture defined in docs/ARCHITECTURE.md.')
109
+ lines.push('They ensure consistency across modules \u2014 the more you use them,')
110
+ lines.push('the more value they deliver.')
111
+ lines.push('')
112
+ lines.push('Examples:')
113
+ lines.push('')
114
+ lines.push(' $ claude')
115
+
116
+ if (agentNames.includes('builder')) {
117
+ lines.push(' > "Use @builder to create the products module with CRUD"')
118
+ }
119
+ if (agentNames.includes('reviewer')) {
120
+ lines.push(' > "Use @reviewer to review src/modules/auth/"')
121
+ }
122
+ if (agentNames.includes('doctor')) {
123
+ lines.push(' > "Use @doctor to investigate the dashboard error"')
124
+ }
125
+
126
+ if (installedSkills.length > 0) {
127
+ lines.push('')
128
+ lines.push('Skills (slash commands):')
129
+ installedSkills.slice(0, 3).forEach(skill => {
130
+ lines.push(` > ${skill}`)
131
+ })
132
+ }
133
+
134
+ if (agentNames.includes('starter')) {
135
+ lines.push('')
136
+ lines.push('If you need to scaffold a new project from scratch, @starter')
137
+ lines.push('can help with the initial setup (stack, backend, database).')
138
+ lines.push(' > "Use @starter to create my project"')
139
+ }
140
+
141
+ return lines.join('\n')
142
+ }
143
+
144
+ // ── CLI argument handling ────────────────────────────
145
+
146
+ const args = process.argv.slice(2)
114
147
 
115
- // Header
148
+ const validCommands = ['init']
149
+ const command = args.find(a => !a.startsWith('-'))
150
+ if (command && !validCommands.includes(command)) {
151
+ console.error(` ${YELLOW}Unknown command: ${command}${NC}`)
152
+ console.error(` Run ${BOLD}specialist-agent --help${NC} for usage.`)
153
+ process.exit(1)
154
+ }
155
+
156
+ if (args.includes('--help') || args.includes('-h')) {
157
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
158
+ console.log()
159
+ console.log(` ${BOLD}specialist-agent${NC} ${DIM}v${pkg.version}${NC}`)
116
160
  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}`)
161
+ console.log(' Usage: specialist-agent [init] [options]')
123
162
  console.log()
163
+ console.log(' Options:')
164
+ console.log(` -h, --help ${DIM}Show this help message${NC}`)
165
+ console.log(` -v, --version ${DIM}Show version number${NC}`)
166
+ console.log(` -f, --force ${DIM}Overwrite existing agents without asking${NC}`)
167
+ console.log()
168
+ console.log(` ${DIM}Run the setup wizard to install AI agents for Claude Code.${NC}`)
169
+ console.log(` ${DIM}Can be executed from any directory (creates package.json if needed).${NC}`)
170
+ console.log()
171
+ process.exit(0)
172
+ }
173
+
174
+ if (args.includes('--version') || args.includes('-v')) {
175
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
176
+ console.log(pkg.version)
177
+ process.exit(0)
178
+ }
179
+
180
+ const forceMode = args.includes('--force') || args.includes('-f')
181
+
182
+ // ── Main ─────────────────────────────────────────────
183
+
184
+ async function main() {
185
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
186
+
187
+ clack.intro(`Specialist Agent ${DIM}v${pkg.version}${NC}`)
188
+
189
+ // Check for updates
190
+ const latestVersion = await checkForUpdates(pkg.version)
191
+ if (latestVersion) {
192
+ clack.log.warn(`Update available: v${pkg.version} → v${latestVersion}`)
193
+ clack.log.info(`${DIM}Run: npm i -g specialist-agent@latest${NC}`)
194
+ }
124
195
 
125
196
  // Check we're in a project
126
197
  const cwd = process.cwd()
127
198
  if (!existsSync(join(cwd, 'package.json'))) {
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)
199
+ clack.log.warn('No package.json found in current directory.')
200
+
201
+ const createPkg = await clack.confirm({
202
+ message: 'Create a package.json to initialize this project?',
203
+ initialValue: true,
204
+ })
205
+
206
+ if (clack.isCancel(createPkg)) handleCancel()
207
+
130
208
  if (!createPkg) {
131
- console.log(` Run this command from the root of your project.`)
132
- console.log()
209
+ clack.cancel('Run this command from the root of your project.')
133
210
  process.exit(1)
134
211
  }
212
+
135
213
  const dirName = cwd.split(/[\\/]/).pop() || 'my-project'
136
- writeFileSync(join(cwd, 'package.json'), JSON.stringify({ name: dirName, version: '0.1.0', private: true }, null, 2) + '\n')
137
- console.log(` ${GREEN}\u2713${NC} package.json created`)
138
- console.log()
214
+ writeFileSync(
215
+ join(cwd, 'package.json'),
216
+ JSON.stringify({ name: dirName, version: '0.1.0', private: true }, null, 2) + '\n'
217
+ )
218
+ clack.log.success('package.json created')
139
219
  }
140
220
 
141
221
  // 1. Framework
@@ -145,33 +225,83 @@ async function main() {
145
225
 
146
226
  const packLabels = { vue: 'Vue 3', react: 'React', nextjs: 'Next.js', svelte: 'SvelteKit' }
147
227
 
148
- const packOptions = packs.map(p => ({
149
- label: packLabels[p] || p.charAt(0).toUpperCase() + p.slice(1),
150
- value: p,
151
- hint: ''
152
- }))
228
+ const detected = detectFramework(join(cwd, 'package.json'), packs)
229
+ let framework
153
230
 
154
- const framework = await ask('Which framework?', packOptions, '1/4')
231
+ if (detected) {
232
+ clack.log.success(`Detected ${packLabels[detected] || detected} from package.json`)
233
+
234
+ const useDetected = await clack.confirm({
235
+ message: `Use ${packLabels[detected] || detected} pack?`,
236
+ initialValue: true,
237
+ })
238
+
239
+ if (clack.isCancel(useDetected)) handleCancel()
240
+
241
+ if (useDetected) {
242
+ framework = detected
243
+ } else {
244
+ framework = await clack.select({
245
+ message: 'Which framework?',
246
+ options: packs.map(p => ({
247
+ value: p,
248
+ label: packLabels[p] || p.charAt(0).toUpperCase() + p.slice(1),
249
+ })),
250
+ })
251
+
252
+ if (clack.isCancel(framework)) handleCancel()
253
+ }
254
+ } else {
255
+ framework = await clack.select({
256
+ message: 'Which framework?',
257
+ options: packs.map(p => ({
258
+ value: p,
259
+ label: packLabels[p] || p.charAt(0).toUpperCase() + p.slice(1),
260
+ })),
261
+ })
262
+
263
+ if (clack.isCancel(framework)) handleCancel()
264
+ }
155
265
 
156
266
  // 2. Mode
157
- const mode = await ask('Agent mode?', [
158
- { label: 'Full', value: 'full', hint: '(Sonnet/Opus)' },
159
- { label: 'Lite', value: 'lite', hint: '(Haiku \u2014 lower cost)' },
160
- ], '2/4')
267
+ const mode = await clack.select({
268
+ message: 'Agent mode?',
269
+ options: [
270
+ { value: 'full', label: 'Full', hint: 'Sonnet/Opus' },
271
+ { value: 'lite', label: 'Lite', hint: 'Haiku \u2014 lower cost' },
272
+ ],
273
+ })
274
+
275
+ if (clack.isCancel(mode)) handleCancel()
161
276
 
162
277
  // 3. Starter agent
163
- const installStarter = await confirm('Install @starter agent?', true, '3/4')
278
+ const installStarter = await clack.confirm({
279
+ message: 'Install @starter agent?',
280
+ initialValue: true,
281
+ })
282
+
283
+ if (clack.isCancel(installStarter)) handleCancel()
164
284
 
165
285
  // 4. Specialist agents
166
- const installSpecialists = await confirm('Install specialist agents?', true, '4/4')
286
+ const installSpecialists = await clack.confirm({
287
+ message: `Install specialist agents? ${DIM}(@finance, @cloud, @security, @designer, @data, @devops, @tester, @explorer)${NC}`,
288
+ initialValue: true,
289
+ })
167
290
 
168
- // Summary
169
- const packLabel = packLabels[framework] || framework
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'}`)
174
- console.log()
291
+ if (clack.isCancel(installSpecialists)) handleCancel()
292
+
293
+ // 5. Global install
294
+ let installGlobal = false
295
+ if (installStarter || installSpecialists) {
296
+ installGlobal = await clack.confirm({
297
+ message: 'Install generic agents globally (~/.claude/agents)?',
298
+ initialValue: false,
299
+ })
300
+
301
+ if (clack.isCancel(installGlobal)) handleCancel()
302
+ }
303
+
304
+ // ── Install files ──────────────────────────────────
175
305
 
176
306
  const packDir = join(ROOT, 'packs', framework)
177
307
  const agentsSource = mode === 'lite' ? join(packDir, 'agents-lite') : join(packDir, 'agents')
@@ -179,25 +309,42 @@ async function main() {
179
309
  const archSource = join(packDir, 'ARCHITECTURE.md')
180
310
  const claudeSource = join(packDir, 'CLAUDE.md')
181
311
 
182
- // Install pack agents
183
312
  const agentsDest = join(cwd, '.claude', 'agents')
184
313
  mkdirSync(agentsDest, { recursive: true })
185
- const agentCount = copyDir(agentsSource, agentsDest)
186
- const agentNames = getAgentNames(agentsDest)
187
314
 
188
- agentNames.forEach(name => {
189
- console.log(` ${GREEN}\u2713${NC} @${name}`)
190
- })
315
+ // Detect existing agents
316
+ const existingAgents = detectExistingAgents(agentsDest)
317
+ let shouldOverwrite = forceMode
318
+
319
+ if (existingAgents.length > 0 && !forceMode) {
320
+ clack.log.warn(`Existing agents detected in .claude/agents/ (${existingAgents.length} files)`)
321
+ const overwriteChoice = await clack.confirm({
322
+ message: 'Overwrite existing agent files?',
323
+ initialValue: false,
324
+ })
325
+ if (clack.isCancel(overwriteChoice)) handleCancel()
326
+ shouldOverwrite = overwriteChoice
327
+ }
328
+
329
+ const s = clack.spinner()
330
+ if (existingAgents.length > 0 && !shouldOverwrite) {
331
+ s.start('Installing new agents and skills (preserving existing)...')
332
+ } else {
333
+ s.start('Installing agents and skills...')
334
+ }
335
+
336
+ // Install pack agents
337
+ const agentCount = shouldOverwrite
338
+ ? copyDir(agentsSource, agentsDest)
339
+ : copyNewOnly(agentsSource, agentsDest)
191
340
 
192
341
  // Install starter agent
193
342
  if (installStarter) {
194
343
  const starterFile = mode === 'lite' ? 'starter-lite.md' : 'starter.md'
195
344
  const starterSource = join(ROOT, 'agents', starterFile)
196
345
  const starterDest = join(agentsDest, 'starter.md')
197
-
198
- if (existsSync(starterSource)) {
346
+ if (existsSync(starterSource) && (shouldOverwrite || !existsSync(starterDest))) {
199
347
  cpSync(starterSource, starterDest)
200
- console.log(` ${GREEN}\u2713${NC} @starter`)
201
348
  }
202
349
  }
203
350
 
@@ -205,130 +352,106 @@ async function main() {
205
352
  if (installSpecialists) {
206
353
  const specialistNames = ['explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
207
354
  for (const name of specialistNames) {
208
- const suffix = mode === 'lite' ? `-lite.md` : '.md'
355
+ const suffix = mode === 'lite' ? '-lite.md' : '.md'
209
356
  const source = join(ROOT, 'agents', `${name}${suffix}`)
210
357
  const dest = join(agentsDest, `${name}.md`)
211
-
212
- if (existsSync(source)) {
358
+ if (existsSync(source) && (shouldOverwrite || !existsSync(dest))) {
213
359
  cpSync(source, dest)
214
- console.log(` ${GREEN}\u2713${NC} @${name}`)
215
360
  }
216
361
  }
217
362
  }
218
363
 
219
- console.log(` ${DIM}${agentCount} pack agents + extras installed${NC}`)
364
+ // Install agents globally
365
+ let globalAgentCount = 0
366
+ if (installGlobal) {
367
+ const globalAgentsDest = join(homedir(), '.claude', 'agents')
368
+ mkdirSync(globalAgentsDest, { recursive: true })
369
+
370
+ if (installStarter) {
371
+ const starterFile = mode === 'lite' ? 'starter-lite.md' : 'starter.md'
372
+ const starterSource = join(ROOT, 'agents', starterFile)
373
+ const starterGlobalDest = join(globalAgentsDest, 'starter.md')
374
+ if (existsSync(starterSource) && (shouldOverwrite || !existsSync(starterGlobalDest))) {
375
+ cpSync(starterSource, starterGlobalDest)
376
+ globalAgentCount++
377
+ }
378
+ }
379
+
380
+ if (installSpecialists) {
381
+ const specialistNames = ['explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
382
+ for (const name of specialistNames) {
383
+ const suffix = mode === 'lite' ? '-lite.md' : '.md'
384
+ const source = join(ROOT, 'agents', `${name}${suffix}`)
385
+ const dest = join(globalAgentsDest, `${name}.md`)
386
+ if (existsSync(source) && (shouldOverwrite || !existsSync(dest))) {
387
+ cpSync(source, dest)
388
+ globalAgentCount++
389
+ }
390
+ }
391
+ }
392
+ }
220
393
 
221
394
  // Install skills
222
- console.log()
223
395
  const skillsDest = join(cwd, '.claude', 'skills')
224
396
  mkdirSync(skillsDest, { recursive: true })
225
- const skillCount = copyDir(skillsSource, skillsDest)
226
- if (skillCount > 0) {
227
- console.log(` ${GREEN}\u2713${NC} ${skillCount} skills installed`)
228
- } else {
229
- console.log(` ${DIM} No skills available for this pack${NC}`)
230
- }
397
+ const skillCount = shouldOverwrite
398
+ ? copyDir(skillsSource, skillsDest)
399
+ : copyNewOnly(skillsSource, skillsDest)
231
400
 
232
401
  // Install ARCHITECTURE.md
233
402
  const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
234
- if (!existsSync(archDest)) {
235
- if (existsSync(archSource)) {
236
- mkdirSync(dirname(archDest), { recursive: true })
237
- cpSync(archSource, archDest)
238
- console.log(` ${GREEN}\u2713${NC} docs/ARCHITECTURE.md`)
239
- } else {
240
- console.log(` ${YELLOW}\u26a0${NC} ARCHITECTURE.md not found in pack ${DIM}(skipped)${NC}`)
241
- }
242
- } else {
243
- console.log(` ${DIM} docs/ARCHITECTURE.md already exists${NC}`)
403
+ let archInstalled = false
404
+ if (!existsSync(archDest) && existsSync(archSource)) {
405
+ mkdirSync(dirname(archDest), { recursive: true })
406
+ cpSync(archSource, archDest)
407
+ archInstalled = true
244
408
  }
245
409
 
246
410
  // Install CLAUDE.md
247
411
  const claudeDest = join(cwd, 'CLAUDE.md')
248
- if (!existsSync(claudeDest)) {
249
- if (existsSync(claudeSource)) {
250
- cpSync(claudeSource, claudeDest)
251
- console.log(` ${GREEN}\u2713${NC} CLAUDE.md`)
252
- } else {
253
- console.log(` ${YELLOW}\u26a0${NC} CLAUDE.md not found in pack ${DIM}(skipped)${NC}`)
254
- }
255
- } else {
256
- console.log(` ${DIM} CLAUDE.md already exists${NC}`)
412
+ let claudeInstalled = false
413
+ if (!existsSync(claudeDest) && existsSync(claudeSource)) {
414
+ cpSync(claudeSource, claudeDest)
415
+ claudeInstalled = true
257
416
  }
258
417
 
259
- // Done
260
- console.log()
261
- console.log(` ${BLUE}${'─'.repeat(W)}${NC}`)
262
- console.log()
263
- console.log(` ${GREEN}${BOLD}Setup complete!${NC}`)
264
- console.log()
418
+ s.stop('Installation complete')
265
419
 
266
- if (mode === 'lite') {
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}`)
269
- console.log()
420
+ // ── Summary ────────────────────────────────────────
421
+
422
+ const agentNames = getAgentNames(agentsDest)
423
+ const packLabel = packLabels[framework] || framework
424
+
425
+ const summaryLines = []
426
+ agentNames.forEach(name => summaryLines.push(`\u2713 @${name}`))
427
+ if (skillCount > 0) summaryLines.push(`\u2713 ${skillCount} skills`)
428
+ if (archInstalled) summaryLines.push('\u2713 docs/ARCHITECTURE.md')
429
+ if (claudeInstalled) summaryLines.push('\u2713 CLAUDE.md')
430
+
431
+ if (globalAgentCount > 0) summaryLines.push(`\u2713 ${globalAgentCount} global agents (~/.claude/agents)`)
432
+
433
+ clack.note(summaryLines.join('\n'), `${packLabel} \u00b7 ${mode === 'full' ? 'Full' : 'Lite'}`)
434
+
435
+ if (existingAgents.length > 0 && !shouldOverwrite) {
436
+ clack.log.info(`${DIM}${existingAgents.length} existing agent(s) preserved. Use --force to overwrite.${NC}`)
270
437
  }
271
438
 
272
- // Show installed skills as examples
439
+ // Getting started
273
440
  const installedSkills = existsSync(skillsDest)
274
441
  ? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
275
442
  : []
276
443
 
277
- console.log(` Get started:`)
278
- console.log()
279
- console.log(` ${DIM}$${NC} claude`)
280
- console.log(` ${DIM}$${NC} /agents ${DIM}# list installed agents${NC}`)
281
- if (installedSkills.length > 0) {
282
- installedSkills.slice(0, 2).forEach(skill => {
283
- console.log(` ${DIM}$${NC} ${skill}`)
284
- })
285
- }
286
- console.log()
287
- console.log(` Or just ask:`)
288
- console.log()
289
- console.log(` ${DIM}"Use @builder to create the products module with CRUD"${NC}`)
290
- console.log(` ${DIM}"Use @reviewer to explore src/modules/auth/"${NC}`)
291
- console.log(` ${DIM}"Use @doctor to investigate the dashboard error"${NC}`)
292
- console.log()
293
-
294
- rl.close()
295
- }
296
-
297
- // CLI argument handling
298
- const args = process.argv.slice(2)
299
-
300
- const validCommands = ['init']
301
- const command = args.find(a => !a.startsWith('-'))
302
- if (command && !validCommands.includes(command)) {
303
- console.error(` ${YELLOW}Unknown command: ${command}${NC}`)
304
- console.error(` Run ${BOLD}specialist-agent --help${NC} for usage.`)
305
- process.exit(1)
306
- }
444
+ clack.note(buildGettingStarted(agentNames, installedSkills), 'Getting started')
307
445
 
308
- if (args.includes('--help') || args.includes('-h')) {
309
- const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
310
- console.log()
311
- console.log(` ${BOLD}specialist-agent${NC} ${DIM}v${pkg.version}${NC}`)
312
- console.log()
313
- console.log(' Usage: specialist-agent [init] [options]')
314
- console.log()
315
- console.log(' Options:')
316
- console.log(` -h, --help ${DIM}Show this help message${NC}`)
317
- console.log(` -v, --version ${DIM}Show version number${NC}`)
318
- 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}`)
321
- console.log()
322
- process.exit(0)
323
- }
446
+ if (mode === 'lite') {
447
+ clack.log.info(`${DIM}Lite mode: agents run on Haiku (lower cost, faster).${NC}`)
448
+ clack.log.info(`${DIM}Switch to Full: npx specialist-agent init${NC}`)
449
+ }
324
450
 
325
- if (args.includes('--version') || args.includes('-v')) {
326
- const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
327
- console.log(pkg.version)
328
- process.exit(0)
451
+ clack.outro('Setup complete! Run claude to get started.')
329
452
  }
330
453
 
331
454
  main().catch((err) => {
332
- console.error(` ${YELLOW}Error: ${err.message}${NC}`)
455
+ clack.log.error(err.message)
333
456
  process.exit(1)
334
457
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specialist-agent",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "description": "AI agents for Claude Code — any framework, any stack",
6
6
  "bin": {
@@ -44,5 +44,8 @@
44
44
  "repository": {
45
45
  "type": "git",
46
46
  "url": "https://github.com/HerbertJulio/specialist-agent"
47
+ },
48
+ "dependencies": {
49
+ "@clack/prompts": "^1.0.1"
47
50
  }
48
51
  }