specialist-agent 1.2.2 → 1.4.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.
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 +14 -0
  17. package/agents/starter.md +14 -0
  18. package/agents/tester-lite.md +14 -0
  19. package/agents/tester.md +14 -0
  20. package/cli/index.mjs +274 -179
  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,54 +1,21 @@
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 rl = createInterface({ input: process.stdin, output: process.stdout })
20
- rl.on('close', () => {
21
- console.log()
22
- process.exit(0)
23
- })
24
-
25
- function ask(question, options) {
26
- return new Promise((resolve) => {
27
- const prompt = () => {
28
- if (options) {
29
- console.log()
30
- options.forEach((opt, i) => {
31
- console.log(` ${BOLD}${i + 1}${NC}) ${opt.label}${opt.hint ? ` ${DIM}${opt.hint}${NC}` : ''}`)
32
- })
33
- console.log()
34
- }
35
- rl.question(`${BLUE}${question}${NC} `, (answer) => {
36
- if (options) {
37
- const idx = parseInt(answer, 10) - 1
38
- if (idx >= 0 && idx < options.length) {
39
- resolve(options[idx].value)
40
- } else {
41
- console.log(` ${YELLOW}Invalid choice. Please enter a number between 1 and ${options.length}.${NC}`)
42
- prompt()
43
- }
44
- } else {
45
- resolve(answer.trim())
46
- }
47
- })
48
- }
49
- prompt()
50
- })
51
- }
18
+ // ── Helpers ──────────────────────────────────────────
52
19
 
53
20
  function copyDir(src, dest) {
54
21
  if (!existsSync(src)) return 0
@@ -77,35 +44,153 @@ function getAgentNames(dir) {
77
44
  })
78
45
  }
79
46
 
80
- async function main() {
81
- const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
47
+ function handleCancel() {
48
+ clack.cancel('Setup cancelled.')
49
+ process.exit(0)
50
+ }
51
+
52
+ async function checkForUpdates(currentVersion) {
53
+ try {
54
+ const res = await fetch('https://registry.npmjs.org/specialist-agent/latest', {
55
+ signal: AbortSignal.timeout(3000),
56
+ })
57
+ if (!res.ok) return null
58
+ const data = await res.json()
59
+ const latest = data.version
60
+ if (latest && latest !== currentVersion) return latest
61
+ return null
62
+ } catch {
63
+ return null
64
+ }
65
+ }
66
+
67
+ function detectFramework(pkgPath, availablePacks) {
68
+ if (!existsSync(pkgPath)) return null
69
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
70
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies }
71
+
72
+ // Order matters: next includes react, so check next first
73
+ if (deps['next'] && availablePacks.includes('nextjs')) return 'nextjs'
74
+ if ((deps['@sveltejs/kit'] || deps['svelte']) && availablePacks.includes('svelte')) return 'svelte'
75
+ if (deps['vue'] && availablePacks.includes('vue')) return 'vue'
76
+ if (deps['react'] && availablePacks.includes('react')) return 'react'
77
+
78
+ return null
79
+ }
82
80
 
81
+ // ── Guidance texts ───────────────────────────────────
82
+
83
+ function buildGettingStarted(agentNames, installedSkills) {
84
+ const lines = []
85
+
86
+ lines.push('Agents enforce the architecture defined in docs/ARCHITECTURE.md.')
87
+ lines.push('They ensure consistency across modules \u2014 the more you use them,')
88
+ lines.push('the more value they deliver.')
89
+ lines.push('')
90
+ lines.push('Examples:')
91
+ lines.push('')
92
+ lines.push(' $ claude')
93
+
94
+ if (agentNames.includes('builder')) {
95
+ lines.push(' > "Use @builder to create the products module with CRUD"')
96
+ }
97
+ if (agentNames.includes('reviewer')) {
98
+ lines.push(' > "Use @reviewer to review src/modules/auth/"')
99
+ }
100
+ if (agentNames.includes('doctor')) {
101
+ lines.push(' > "Use @doctor to investigate the dashboard error"')
102
+ }
103
+
104
+ if (installedSkills.length > 0) {
105
+ lines.push('')
106
+ lines.push('Skills (slash commands):')
107
+ installedSkills.slice(0, 3).forEach(skill => {
108
+ lines.push(` > ${skill}`)
109
+ })
110
+ }
111
+
112
+ if (agentNames.includes('starter')) {
113
+ lines.push('')
114
+ lines.push('If you need to scaffold a new project from scratch, @starter')
115
+ lines.push('can help with the initial setup (stack, backend, database).')
116
+ lines.push(' > "Use @starter to create my project"')
117
+ }
118
+
119
+ return lines.join('\n')
120
+ }
121
+
122
+ // ── CLI argument handling ────────────────────────────
123
+
124
+ const args = process.argv.slice(2)
125
+
126
+ const validCommands = ['init']
127
+ const command = args.find(a => !a.startsWith('-'))
128
+ if (command && !validCommands.includes(command)) {
129
+ console.error(` ${YELLOW}Unknown command: ${command}${NC}`)
130
+ console.error(` Run ${BOLD}specialist-agent --help${NC} for usage.`)
131
+ process.exit(1)
132
+ }
133
+
134
+ if (args.includes('--help') || args.includes('-h')) {
135
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
136
+ console.log()
137
+ console.log(` ${BOLD}specialist-agent${NC} ${DIM}v${pkg.version}${NC}`)
83
138
  console.log()
84
- console.log(`${BOLD}${BLUE} ╔═══════════════════════════════════════════════╗${NC}`)
85
- console.log(`${BOLD}${BLUE} ║ Specialist Agent — Setup Wizard ║${NC}`)
86
- console.log(`${BOLD}${BLUE} ╚═══════════════════════════════════════════════╝${NC}`)
139
+ console.log(' Usage: specialist-agent [init] [options]')
140
+ console.log()
141
+ console.log(' Options:')
142
+ console.log(` -h, --help ${DIM}Show this help message${NC}`)
143
+ console.log(` -v, --version ${DIM}Show version number${NC}`)
87
144
  console.log()
88
- console.log(` ${DIM}AI agents for Claude Code — any framework, any stack v${pkg.version}${NC}`)
145
+ console.log(` ${DIM}Run the setup wizard to install AI agents for Claude Code.${NC}`)
146
+ console.log(` ${DIM}Can be executed from any directory (creates package.json if needed).${NC}`)
89
147
  console.log()
148
+ process.exit(0)
149
+ }
150
+
151
+ if (args.includes('--version') || args.includes('-v')) {
152
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
153
+ console.log(pkg.version)
154
+ process.exit(0)
155
+ }
156
+
157
+ // ── Main ─────────────────────────────────────────────
158
+
159
+ async function main() {
160
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
161
+
162
+ clack.intro(`Specialist Agent ${DIM}v${pkg.version}${NC}`)
163
+
164
+ // Check for updates
165
+ const latestVersion = await checkForUpdates(pkg.version)
166
+ if (latestVersion) {
167
+ clack.log.warn(`Update available: v${pkg.version} → v${latestVersion}`)
168
+ clack.log.info(`${DIM}Run: npm i -g specialist-agent@latest${NC}`)
169
+ }
90
170
 
91
171
  // Check we're in a project
92
172
  const cwd = process.cwd()
93
173
  if (!existsSync(join(cwd, 'package.json'))) {
94
- console.log(`${YELLOW} ⚠ No package.json found in current directory.${NC}`)
95
- console.log()
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
- ])
174
+ clack.log.warn('No package.json found in current directory.')
175
+
176
+ const createPkg = await clack.confirm({
177
+ message: 'Create a package.json to initialize this project?',
178
+ initialValue: true,
179
+ })
180
+
181
+ if (clack.isCancel(createPkg)) handleCancel()
182
+
100
183
  if (!createPkg) {
101
- console.log(` Run this command from the root of your project.`)
102
- console.log()
184
+ clack.cancel('Run this command from the root of your project.')
103
185
  process.exit(1)
104
186
  }
187
+
105
188
  const dirName = cwd.split(/[\\/]/).pop() || 'my-project'
106
- writeFileSync(join(cwd, 'package.json'), JSON.stringify({ name: dirName, version: '0.1.0', private: true }, null, 2) + '\n')
107
- console.log(` ${GREEN}✅${NC} package.json created`)
108
- console.log()
189
+ writeFileSync(
190
+ join(cwd, 'package.json'),
191
+ JSON.stringify({ name: dirName, version: '0.1.0', private: true }, null, 2) + '\n'
192
+ )
193
+ clack.log.success('package.json created')
109
194
  }
110
195
 
111
196
  // 1. Framework
@@ -115,39 +200,86 @@ async function main() {
115
200
 
116
201
  const packLabels = { vue: 'Vue 3', react: 'React', nextjs: 'Next.js', svelte: 'SvelteKit' }
117
202
 
118
- const packOptions = packs.map(p => ({
119
- label: packLabels[p] || p.charAt(0).toUpperCase() + p.slice(1),
120
- value: p,
121
- hint: ''
122
- }))
203
+ const detected = detectFramework(join(cwd, 'package.json'), packs)
204
+ let framework
123
205
 
124
- const framework = await ask('Which framework?', packOptions)
206
+ if (detected) {
207
+ clack.log.success(`Detected ${packLabels[detected] || detected} from package.json`)
208
+
209
+ const useDetected = await clack.confirm({
210
+ message: `Use ${packLabels[detected] || detected} pack?`,
211
+ initialValue: true,
212
+ })
213
+
214
+ if (clack.isCancel(useDetected)) handleCancel()
215
+
216
+ if (useDetected) {
217
+ framework = detected
218
+ } else {
219
+ framework = await clack.select({
220
+ message: 'Which framework?',
221
+ options: packs.map(p => ({
222
+ value: p,
223
+ label: packLabels[p] || p.charAt(0).toUpperCase() + p.slice(1),
224
+ })),
225
+ })
226
+
227
+ if (clack.isCancel(framework)) handleCancel()
228
+ }
229
+ } else {
230
+ framework = await clack.select({
231
+ message: 'Which framework?',
232
+ options: packs.map(p => ({
233
+ value: p,
234
+ label: packLabels[p] || p.charAt(0).toUpperCase() + p.slice(1),
235
+ })),
236
+ })
237
+
238
+ if (clack.isCancel(framework)) handleCancel()
239
+ }
125
240
 
126
241
  // 2. Mode
127
- const mode = await ask('Agent mode?', [
128
- { label: 'Full', value: 'full', hint: '(Sonnet/Opus — detailed output, validation)' },
129
- { label: 'Lite', value: 'lite', hint: '(Haiku — lower cost, faster)' },
130
- ])
242
+ const mode = await clack.select({
243
+ message: 'Agent mode?',
244
+ options: [
245
+ { value: 'full', label: 'Full', hint: 'Sonnet/Opus' },
246
+ { value: 'lite', label: 'Lite', hint: 'Haiku \u2014 lower cost' },
247
+ ],
248
+ })
249
+
250
+ if (clack.isCancel(mode)) handleCancel()
131
251
 
132
252
  // 3. Starter agent
133
- const installStarter = await ask('Install @starter agent? (creates projects from scratch)', [
134
- { label: 'Yes', value: true, hint: '(recommended)' },
135
- { label: 'No', value: false, hint: '' },
136
- ])
253
+ const installStarter = await clack.confirm({
254
+ message: 'Install @starter agent?',
255
+ initialValue: true,
256
+ })
257
+
258
+ if (clack.isCancel(installStarter)) handleCancel()
137
259
 
138
260
  // 4. Specialist agents
139
- const installSpecialists = await ask('Install specialist agents? (@explorer, @finance, @cloud, @security, @designer, @data, @devops, @tester)', [
140
- { label: 'Yes', value: true, hint: '(recommended)' },
141
- { label: 'No', value: false, hint: '' },
142
- ])
261
+ const installSpecialists = await clack.confirm({
262
+ message: 'Install specialist agents?',
263
+ initialValue: true,
264
+ })
143
265
 
144
- console.log()
145
- console.log(`${BLUE} ───────────────────────────────────────────────${NC}`)
146
- console.log(` ${BOLD}Installing Specialist Agent${NC}`)
147
- const packLabel = packLabels[framework] || framework
148
- console.log(` ${DIM}Pack: ${packLabel} | Mode: ${mode} | Starter: ${installStarter ? 'yes' : 'no'} | Specialists: ${installSpecialists ? 'yes' : 'no'}${NC}`)
149
- console.log(`${BLUE} ───────────────────────────────────────────────${NC}`)
150
- console.log()
266
+ if (clack.isCancel(installSpecialists)) handleCancel()
267
+
268
+ // 5. Global install
269
+ let installGlobal = false
270
+ if (installStarter || installSpecialists) {
271
+ installGlobal = await clack.confirm({
272
+ message: 'Install generic agents globally (~/.claude/agents)?',
273
+ initialValue: false,
274
+ })
275
+
276
+ if (clack.isCancel(installGlobal)) handleCancel()
277
+ }
278
+
279
+ // ── Install files ──────────────────────────────────
280
+
281
+ const s = clack.spinner()
282
+ s.start('Installing agents and skills...')
151
283
 
152
284
  const packDir = join(ROOT, 'packs', framework)
153
285
  const agentsSource = mode === 'lite' ? join(packDir, 'agents-lite') : join(packDir, 'agents')
@@ -155,26 +287,18 @@ async function main() {
155
287
  const archSource = join(packDir, 'ARCHITECTURE.md')
156
288
  const claudeSource = join(packDir, 'CLAUDE.md')
157
289
 
158
- // Install agents
290
+ // Install pack agents
159
291
  const agentsDest = join(cwd, '.claude', 'agents')
160
292
  mkdirSync(agentsDest, { recursive: true })
161
293
  const agentCount = copyDir(agentsSource, agentsDest)
162
- const agentNames = getAgentNames(agentsDest)
163
-
164
- agentNames.forEach(name => {
165
- console.log(` ${GREEN}✅${NC} @${name}`)
166
- })
167
- console.log(` ${GREEN}${agentCount} agents installed${NC}`)
168
294
 
169
295
  // Install starter agent
170
296
  if (installStarter) {
171
297
  const starterFile = mode === 'lite' ? 'starter-lite.md' : 'starter.md'
172
298
  const starterSource = join(ROOT, 'agents', starterFile)
173
299
  const starterDest = join(agentsDest, 'starter.md')
174
-
175
300
  if (existsSync(starterSource)) {
176
301
  cpSync(starterSource, starterDest)
177
- console.log(` ${GREEN}✅${NC} @starter`)
178
302
  }
179
303
  }
180
304
 
@@ -182,129 +306,100 @@ async function main() {
182
306
  if (installSpecialists) {
183
307
  const specialistNames = ['explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
184
308
  for (const name of specialistNames) {
185
- const suffix = mode === 'lite' ? `-lite.md` : '.md'
309
+ const suffix = mode === 'lite' ? '-lite.md' : '.md'
186
310
  const source = join(ROOT, 'agents', `${name}${suffix}`)
187
311
  const dest = join(agentsDest, `${name}.md`)
188
-
189
312
  if (existsSync(source)) {
190
313
  cpSync(source, dest)
191
- console.log(` ${GREEN}✅${NC} @${name}`)
314
+ }
315
+ }
316
+ }
317
+
318
+ // Install agents globally
319
+ let globalAgentCount = 0
320
+ if (installGlobal) {
321
+ const globalAgentsDest = join(homedir(), '.claude', 'agents')
322
+ mkdirSync(globalAgentsDest, { recursive: true })
323
+
324
+ if (installStarter) {
325
+ const starterFile = mode === 'lite' ? 'starter-lite.md' : 'starter.md'
326
+ const starterSource = join(ROOT, 'agents', starterFile)
327
+ const starterGlobalDest = join(globalAgentsDest, 'starter.md')
328
+ if (existsSync(starterSource)) {
329
+ cpSync(starterSource, starterGlobalDest)
330
+ globalAgentCount++
331
+ }
332
+ }
333
+
334
+ if (installSpecialists) {
335
+ const specialistNames = ['explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
336
+ for (const name of specialistNames) {
337
+ const suffix = mode === 'lite' ? '-lite.md' : '.md'
338
+ const source = join(ROOT, 'agents', `${name}${suffix}`)
339
+ const dest = join(globalAgentsDest, `${name}.md`)
340
+ if (existsSync(source)) {
341
+ cpSync(source, dest)
342
+ globalAgentCount++
343
+ }
192
344
  }
193
345
  }
194
346
  }
195
347
 
196
348
  // Install skills
197
- console.log()
198
349
  const skillsDest = join(cwd, '.claude', 'skills')
199
350
  mkdirSync(skillsDest, { recursive: true })
200
351
  const skillCount = copyDir(skillsSource, skillsDest)
201
- if (skillCount > 0) {
202
- console.log(` ${GREEN}${skillCount} skills installed${NC}`)
203
- } else {
204
- console.log(` ${DIM} No skills available for this pack${NC}`)
205
- }
206
352
 
207
353
  // Install ARCHITECTURE.md
208
- console.log()
209
354
  const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
210
- if (!existsSync(archDest)) {
211
- if (existsSync(archSource)) {
212
- mkdirSync(dirname(archDest), { recursive: true })
213
- cpSync(archSource, archDest)
214
- console.log(` ${GREEN}✅${NC} docs/ARCHITECTURE.md`)
215
- } else {
216
- console.log(` ${YELLOW}⚠${NC} ARCHITECTURE.md not found in pack (skipped)`)
217
- }
218
- } else {
219
- console.log(` ${YELLOW}⚠${NC} docs/ARCHITECTURE.md already exists (not overwritten)`)
355
+ let archInstalled = false
356
+ if (!existsSync(archDest) && existsSync(archSource)) {
357
+ mkdirSync(dirname(archDest), { recursive: true })
358
+ cpSync(archSource, archDest)
359
+ archInstalled = true
220
360
  }
221
361
 
222
362
  // Install CLAUDE.md
223
363
  const claudeDest = join(cwd, 'CLAUDE.md')
224
- if (!existsSync(claudeDest)) {
225
- if (existsSync(claudeSource)) {
226
- cpSync(claudeSource, claudeDest)
227
- console.log(` ${GREEN}✅${NC} CLAUDE.md`)
228
- } else {
229
- console.log(` ${YELLOW}⚠${NC} CLAUDE.md not found in pack (skipped)`)
230
- }
231
- } else {
232
- console.log(` ${YELLOW}⚠${NC} CLAUDE.md already exists (not overwritten)`)
364
+ let claudeInstalled = false
365
+ if (!existsSync(claudeDest) && existsSync(claudeSource)) {
366
+ cpSync(claudeSource, claudeDest)
367
+ claudeInstalled = true
233
368
  }
234
369
 
235
- // Done
236
- console.log()
237
- console.log(`${GREEN} ═══════════════════════════════════════════════${NC}`)
238
- console.log(`${GREEN} 🎉 Specialist Agent installed successfully!${NC}`)
239
- console.log(`${GREEN} ═══════════════════════════════════════════════${NC}`)
240
- console.log()
370
+ s.stop('Installation complete')
241
371
 
242
- if (mode === 'lite') {
243
- console.log(` ${YELLOW}Lite mode: agents run on Haiku model (lower cost, faster).${NC}`)
244
- console.log(` ${YELLOW}To switch to Full agents: npx specialist-agent init${NC}`)
245
- console.log()
246
- }
372
+ // ── Summary ────────────────────────────────────────
247
373
 
248
- // Show installed skills as examples
249
- const installedSkills = existsSync(skillsDest)
250
- ? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
251
- : []
374
+ const agentNames = getAgentNames(agentsDest)
375
+ const packLabel = packLabels[framework] || framework
252
376
 
253
- console.log(` Open Claude Code and try:`)
254
- console.log()
255
- console.log(` claude`)
256
- console.log(` /agents ${DIM}# list agents${NC}`)
257
- if (installedSkills.length > 0) {
258
- const examples = installedSkills.slice(0, 2)
259
- examples.forEach(skill => {
260
- console.log(` ${skill}`)
261
- })
262
- }
263
- console.log()
264
- console.log(` Or just ask:`)
265
- console.log()
266
- console.log(` ${DIM}"Use @builder to create the products module with CRUD"${NC}`)
267
- console.log(` ${DIM}"Use @reviewer to explore src/modules/auth/"${NC}`)
268
- console.log(` ${DIM}"Use @doctor to investigate the dashboard error"${NC}`)
269
- console.log()
377
+ const summaryLines = []
378
+ agentNames.forEach(name => summaryLines.push(`\u2713 @${name}`))
379
+ if (skillCount > 0) summaryLines.push(`\u2713 ${skillCount} skills`)
380
+ if (archInstalled) summaryLines.push('\u2713 docs/ARCHITECTURE.md')
381
+ if (claudeInstalled) summaryLines.push('\u2713 CLAUDE.md')
270
382
 
271
- rl.close()
272
- }
383
+ if (globalAgentCount > 0) summaryLines.push(`\u2713 ${globalAgentCount} global agents (~/.claude/agents)`)
273
384
 
274
- const args = process.argv.slice(2)
385
+ clack.note(summaryLines.join('\n'), `${packLabel} \u00b7 ${mode === 'full' ? 'Full' : 'Lite'}`)
275
386
 
276
- const validCommands = ['init']
277
- const command = args.find(a => !a.startsWith('-'))
278
- if (command && !validCommands.includes(command)) {
279
- console.error(` ${YELLOW}Unknown command: ${command}${NC}`)
280
- console.error(` Run ${BOLD}specialist-agent --help${NC} for usage.`)
281
- process.exit(1)
282
- }
387
+ // Getting started
388
+ const installedSkills = existsSync(skillsDest)
389
+ ? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
390
+ : []
283
391
 
284
- if (args.includes('--help') || args.includes('-h')) {
285
- const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
286
- console.log()
287
- console.log(` ${BOLD}specialist-agent${NC} v${pkg.version}`)
288
- console.log()
289
- console.log(' Usage: specialist-agent [init] [options]')
290
- console.log()
291
- console.log(' Options:')
292
- console.log(' -h, --help Show this help message')
293
- console.log(' -v, --version Show version number')
294
- console.log()
295
- console.log(' Run the setup wizard to install AI agents for Claude Code.')
296
- console.log(' Can be executed from any directory (creates package.json if needed).')
297
- console.log()
298
- process.exit(0)
299
- }
392
+ clack.note(buildGettingStarted(agentNames, installedSkills), 'Getting started')
300
393
 
301
- if (args.includes('--version') || args.includes('-v')) {
302
- const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
303
- console.log(pkg.version)
304
- process.exit(0)
394
+ if (mode === 'lite') {
395
+ clack.log.info(`${DIM}Lite mode: agents run on Haiku (lower cost, faster).${NC}`)
396
+ clack.log.info(`${DIM}Switch to Full: npx specialist-agent init${NC}`)
397
+ }
398
+
399
+ clack.outro('Setup complete! Run claude to get started.')
305
400
  }
306
401
 
307
402
  main().catch((err) => {
308
- console.error(` ${YELLOW}Error: ${err.message}${NC}`)
403
+ clack.log.error(err.message)
309
404
  process.exit(1)
310
405
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specialist-agent",
3
- "version": "1.2.2",
3
+ "version": "1.4.0",
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
  }
@@ -8,9 +8,30 @@ Development toolkit for Next.js 14+ projects with TypeScript. Includes AI agents
8
8
 
9
9
  ## AI Team Configuration
10
10
 
11
- **Important: YOU MUST USE subagents when available for the task.**
12
11
  **Important: ALWAYS read docs/ARCHITECTURE.md before creating or modifying files.**
13
12
 
13
+ ### Auto-Dispatch Rules
14
+
15
+ You **MUST** automatically delegate to the correct agent based on the user's intent. Do NOT ask which agent to use — detect it from the request:
16
+
17
+ | User intent | Agent |
18
+ |-------------|-------|
19
+ | Create modules, components (Server/Client), services, hooks, pages, tests, or any new code | `@builder` |
20
+ | Review code, check architecture, analyze performance, explore modules | `@reviewer` |
21
+ | Investigate bugs, trace errors, debug issues | `@doctor` |
22
+ | Migrate legacy code, Pages Router to App Router, modernize modules | `@migrator` |
23
+ | Scaffold a new project from scratch | `@starter` |
24
+ | Payments, billing, invoicing, financial reporting | `@finance` |
25
+ | Cloud infra, IaC, serverless, containers | `@cloud` |
26
+ | Auth flows, security audit, RBAC, encryption | `@security` |
27
+ | Design systems, responsive layouts, accessibility, theming | `@designer` |
28
+ | Database modeling, migrations, caching, query optimization | `@data` |
29
+ | Docker, Kubernetes, CI/CD pipelines, monitoring | `@devops` |
30
+ | Test strategies, test suites, coverage, mocking | `@tester` |
31
+ | Explore unfamiliar codebase, onboarding, technical assessment | `@explorer` |
32
+
33
+ If a task spans multiple agents, invoke them in sequence (e.g., @builder then @reviewer).
34
+
14
35
  ### Stack
15
36
 
16
37
  - Next.js 14+ (App Router)
@@ -55,6 +76,20 @@ Development toolkit for Next.js 14+ projects with TypeScript. Includes AI agents
55
76
  | `/migration-migrate-module [path]` | Migrate entire module |
56
77
  | `/docs-onboard [module]` | Quick module overview for onboarding |
57
78
 
79
+ ### Execution Summary
80
+
81
+ At the end of every task, you **MUST** include a brief summary of agent and skill usage:
82
+
83
+ ```text
84
+ ──── Specialist Agent: 2 agents (@builder, @reviewer) · 1 skill (/dev-create-module)
85
+ ```
86
+
87
+ Rules:
88
+
89
+ - Only show agents/skills that were actually invoked during the execution
90
+ - If no agents or skills were used, omit the summary entirely
91
+ - Use the exact format above — single line, separated by `·`
92
+
58
93
  ### Key Patterns (details in docs/ARCHITECTURE.md)
59
94
 
60
95
  - **Server Components**: Default. Async, no hooks, no browser APIs. Data fetching here.
@@ -165,3 +165,17 @@ After completing work in any mode, provide:
165
165
  - Tests for new code → suggest @tester
166
166
  - Architecture validation → suggest @reviewer
167
167
  - Security concerns in new code → suggest @security
168
+
169
+ ## Execution Summary
170
+
171
+ At the end of every task, you **MUST** include a brief summary of agent and skill usage:
172
+
173
+ ```text
174
+ ──── Specialist Agent: 2 agents (@builder, @reviewer) · 1 skill (/dev-create-module)
175
+ ```
176
+
177
+ Rules:
178
+
179
+ - Only show agents/skills that were actually invoked during the execution
180
+ - If no agents or skills were used, omit the summary entirely
181
+ - Use the exact format above — single line, separated by `·`
@@ -174,3 +174,17 @@ After investigation, provide:
174
174
  - Regression test for the fix → suggest @tester
175
175
  - Architecture violation caused the bug → suggest @reviewer
176
176
  - Security vulnerability discovered → suggest @security
177
+
178
+ ## Execution Summary
179
+
180
+ At the end of every task, you **MUST** include a brief summary of agent and skill usage:
181
+
182
+ ```text
183
+ ──── Specialist Agent: 2 agents (@builder, @reviewer) · 1 skill (/dev-create-module)
184
+ ```
185
+
186
+ Rules:
187
+
188
+ - Only show agents/skills that were actually invoked during the execution
189
+ - If no agents or skills were used, omit the summary entirely
190
+ - Use the exact format above — single line, separated by `·`