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.
- package/README.md +7 -4
- package/agents/cloud-lite.md +14 -0
- package/agents/cloud.md +14 -0
- package/agents/data-lite.md +14 -0
- package/agents/data.md +14 -0
- package/agents/designer-lite.md +14 -0
- package/agents/designer.md +14 -0
- package/agents/devops-lite.md +14 -0
- package/agents/devops.md +14 -0
- package/agents/explorer-lite.md +14 -0
- package/agents/explorer.md +14 -0
- package/agents/finance-lite.md +14 -0
- package/agents/finance.md +14 -0
- package/agents/security-lite.md +14 -0
- package/agents/security.md +14 -0
- package/agents/starter-lite.md +14 -0
- package/agents/starter.md +14 -0
- package/agents/tester-lite.md +14 -0
- package/agents/tester.md +14 -0
- package/cli/index.mjs +274 -179
- package/package.json +4 -1
- package/packs/nextjs/CLAUDE.md +36 -1
- package/packs/nextjs/agents/builder.md +14 -0
- package/packs/nextjs/agents/doctor.md +14 -0
- package/packs/nextjs/agents/migrator.md +14 -0
- package/packs/nextjs/agents/reviewer.md +14 -0
- package/packs/nextjs/agents-lite/builder.md +14 -0
- package/packs/nextjs/agents-lite/doctor.md +14 -0
- package/packs/nextjs/agents-lite/migrator.md +14 -0
- package/packs/nextjs/agents-lite/reviewer.md +14 -0
- package/packs/react/CLAUDE.md +36 -1
- package/packs/react/agents/builder.md +14 -0
- package/packs/react/agents/doctor.md +14 -0
- package/packs/react/agents/migrator.md +14 -0
- package/packs/react/agents/reviewer.md +14 -0
- package/packs/react/agents-lite/builder.md +14 -0
- package/packs/react/agents-lite/doctor.md +14 -0
- package/packs/react/agents-lite/migrator.md +14 -0
- package/packs/react/agents-lite/reviewer.md +14 -0
- package/packs/svelte/CLAUDE.md +36 -1
- package/packs/svelte/agents/builder.md +14 -0
- package/packs/svelte/agents/doctor.md +14 -0
- package/packs/svelte/agents/migrator.md +14 -0
- package/packs/svelte/agents/reviewer.md +14 -0
- package/packs/svelte/agents-lite/builder.md +14 -0
- package/packs/svelte/agents-lite/doctor.md +14 -0
- package/packs/svelte/agents-lite/migrator.md +14 -0
- package/packs/svelte/agents-lite/reviewer.md +14 -0
- package/packs/vue/CLAUDE.md +36 -1
- package/packs/vue/agents/builder.md +14 -0
- package/packs/vue/agents/doctor.md +14 -0
- package/packs/vue/agents/migrator.md +14 -0
- package/packs/vue/agents/reviewer.md +14 -0
- package/packs/vue/agents-lite/builder.md +14 -0
- package/packs/vue/agents-lite/doctor.md +14 -0
- package/packs/vue/agents-lite/migrator.md +14 -0
- 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
|
|
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
|
-
|
|
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
|
-
|
|
81
|
-
|
|
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(
|
|
85
|
-
console.log(
|
|
86
|
-
console.log(
|
|
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
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
const createPkg = await
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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(
|
|
107
|
-
|
|
108
|
-
|
|
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
|
|
119
|
-
|
|
120
|
-
value: p,
|
|
121
|
-
hint: ''
|
|
122
|
-
}))
|
|
203
|
+
const detected = detectFramework(join(cwd, 'package.json'), packs)
|
|
204
|
+
let framework
|
|
123
205
|
|
|
124
|
-
|
|
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
|
|
128
|
-
|
|
129
|
-
|
|
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
|
|
134
|
-
|
|
135
|
-
|
|
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
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
261
|
+
const installSpecialists = await clack.confirm({
|
|
262
|
+
message: 'Install specialist agents?',
|
|
263
|
+
initialValue: true,
|
|
264
|
+
})
|
|
143
265
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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' ?
|
|
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
|
-
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
249
|
-
const
|
|
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
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (
|
|
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
|
-
|
|
272
|
-
}
|
|
383
|
+
if (globalAgentCount > 0) summaryLines.push(`\u2713 ${globalAgentCount} global agents (~/.claude/agents)`)
|
|
273
384
|
|
|
274
|
-
|
|
385
|
+
clack.note(summaryLines.join('\n'), `${packLabel} \u00b7 ${mode === 'full' ? 'Full' : 'Lite'}`)
|
|
275
386
|
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
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
|
-
|
|
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 (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
}
|
package/packs/nextjs/CLAUDE.md
CHANGED
|
@@ -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 `·`
|