specialist-agent 1.3.0 → 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 +273 -202
- 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,85 +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
|
-
|
|
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
|
-
})
|
|
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()
|
|
81
|
-
})
|
|
82
|
-
}
|
|
18
|
+
// ── Helpers ──────────────────────────────────────────
|
|
83
19
|
|
|
84
20
|
function copyDir(src, dest) {
|
|
85
21
|
if (!existsSync(src)) return 0
|
|
@@ -108,34 +44,153 @@ function getAgentNames(dir) {
|
|
|
108
44
|
})
|
|
109
45
|
}
|
|
110
46
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
+
}
|
|
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
|
+
}
|
|
114
133
|
|
|
115
|
-
|
|
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}`)
|
|
138
|
+
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}`)
|
|
116
144
|
console.log()
|
|
117
|
-
console.log(` ${
|
|
118
|
-
console.log(` ${
|
|
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}`)
|
|
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}`)
|
|
123
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
|
+
}
|
|
124
170
|
|
|
125
171
|
// Check we're in a project
|
|
126
172
|
const cwd = process.cwd()
|
|
127
173
|
if (!existsSync(join(cwd, 'package.json'))) {
|
|
128
|
-
|
|
129
|
-
|
|
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
|
+
|
|
130
183
|
if (!createPkg) {
|
|
131
|
-
|
|
132
|
-
console.log()
|
|
184
|
+
clack.cancel('Run this command from the root of your project.')
|
|
133
185
|
process.exit(1)
|
|
134
186
|
}
|
|
187
|
+
|
|
135
188
|
const dirName = cwd.split(/[\\/]/).pop() || 'my-project'
|
|
136
|
-
writeFileSync(
|
|
137
|
-
|
|
138
|
-
|
|
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')
|
|
139
194
|
}
|
|
140
195
|
|
|
141
196
|
// 1. Framework
|
|
@@ -145,33 +200,86 @@ async function main() {
|
|
|
145
200
|
|
|
146
201
|
const packLabels = { vue: 'Vue 3', react: 'React', nextjs: 'Next.js', svelte: 'SvelteKit' }
|
|
147
202
|
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
203
|
+
const detected = detectFramework(join(cwd, 'package.json'), packs)
|
|
204
|
+
let framework
|
|
205
|
+
|
|
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
|
+
})
|
|
153
237
|
|
|
154
|
-
|
|
238
|
+
if (clack.isCancel(framework)) handleCancel()
|
|
239
|
+
}
|
|
155
240
|
|
|
156
241
|
// 2. Mode
|
|
157
|
-
const mode = await
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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()
|
|
161
251
|
|
|
162
252
|
// 3. Starter agent
|
|
163
|
-
const installStarter = await confirm(
|
|
253
|
+
const installStarter = await clack.confirm({
|
|
254
|
+
message: 'Install @starter agent?',
|
|
255
|
+
initialValue: true,
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
if (clack.isCancel(installStarter)) handleCancel()
|
|
164
259
|
|
|
165
260
|
// 4. Specialist agents
|
|
166
|
-
const installSpecialists = await confirm(
|
|
261
|
+
const installSpecialists = await clack.confirm({
|
|
262
|
+
message: 'Install specialist agents?',
|
|
263
|
+
initialValue: true,
|
|
264
|
+
})
|
|
167
265
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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...')
|
|
175
283
|
|
|
176
284
|
const packDir = join(ROOT, 'packs', framework)
|
|
177
285
|
const agentsSource = mode === 'lite' ? join(packDir, 'agents-lite') : join(packDir, 'agents')
|
|
@@ -183,21 +291,14 @@ async function main() {
|
|
|
183
291
|
const agentsDest = join(cwd, '.claude', 'agents')
|
|
184
292
|
mkdirSync(agentsDest, { recursive: true })
|
|
185
293
|
const agentCount = copyDir(agentsSource, agentsDest)
|
|
186
|
-
const agentNames = getAgentNames(agentsDest)
|
|
187
|
-
|
|
188
|
-
agentNames.forEach(name => {
|
|
189
|
-
console.log(` ${GREEN}\u2713${NC} @${name}`)
|
|
190
|
-
})
|
|
191
294
|
|
|
192
295
|
// Install starter agent
|
|
193
296
|
if (installStarter) {
|
|
194
297
|
const starterFile = mode === 'lite' ? 'starter-lite.md' : 'starter.md'
|
|
195
298
|
const starterSource = join(ROOT, 'agents', starterFile)
|
|
196
299
|
const starterDest = join(agentsDest, 'starter.md')
|
|
197
|
-
|
|
198
300
|
if (existsSync(starterSource)) {
|
|
199
301
|
cpSync(starterSource, starterDest)
|
|
200
|
-
console.log(` ${GREEN}\u2713${NC} @starter`)
|
|
201
302
|
}
|
|
202
303
|
}
|
|
203
304
|
|
|
@@ -205,130 +306,100 @@ async function main() {
|
|
|
205
306
|
if (installSpecialists) {
|
|
206
307
|
const specialistNames = ['explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
|
|
207
308
|
for (const name of specialistNames) {
|
|
208
|
-
const suffix = mode === 'lite' ?
|
|
309
|
+
const suffix = mode === 'lite' ? '-lite.md' : '.md'
|
|
209
310
|
const source = join(ROOT, 'agents', `${name}${suffix}`)
|
|
210
311
|
const dest = join(agentsDest, `${name}.md`)
|
|
211
|
-
|
|
212
312
|
if (existsSync(source)) {
|
|
213
313
|
cpSync(source, dest)
|
|
214
|
-
console.log(` ${GREEN}\u2713${NC} @${name}`)
|
|
215
314
|
}
|
|
216
315
|
}
|
|
217
316
|
}
|
|
218
317
|
|
|
219
|
-
|
|
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
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
220
347
|
|
|
221
348
|
// Install skills
|
|
222
|
-
console.log()
|
|
223
349
|
const skillsDest = join(cwd, '.claude', 'skills')
|
|
224
350
|
mkdirSync(skillsDest, { recursive: true })
|
|
225
351
|
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
|
-
}
|
|
231
352
|
|
|
232
353
|
// Install ARCHITECTURE.md
|
|
233
354
|
const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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}`)
|
|
355
|
+
let archInstalled = false
|
|
356
|
+
if (!existsSync(archDest) && existsSync(archSource)) {
|
|
357
|
+
mkdirSync(dirname(archDest), { recursive: true })
|
|
358
|
+
cpSync(archSource, archDest)
|
|
359
|
+
archInstalled = true
|
|
244
360
|
}
|
|
245
361
|
|
|
246
362
|
// Install CLAUDE.md
|
|
247
363
|
const claudeDest = join(cwd, 'CLAUDE.md')
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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}`)
|
|
364
|
+
let claudeInstalled = false
|
|
365
|
+
if (!existsSync(claudeDest) && existsSync(claudeSource)) {
|
|
366
|
+
cpSync(claudeSource, claudeDest)
|
|
367
|
+
claudeInstalled = true
|
|
257
368
|
}
|
|
258
369
|
|
|
259
|
-
|
|
260
|
-
console.log()
|
|
261
|
-
console.log(` ${BLUE}${'─'.repeat(W)}${NC}`)
|
|
262
|
-
console.log()
|
|
263
|
-
console.log(` ${GREEN}${BOLD}Setup complete!${NC}`)
|
|
264
|
-
console.log()
|
|
370
|
+
s.stop('Installation complete')
|
|
265
371
|
|
|
266
|
-
|
|
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()
|
|
270
|
-
}
|
|
372
|
+
// ── Summary ────────────────────────────────────────
|
|
271
373
|
|
|
272
|
-
|
|
273
|
-
const
|
|
274
|
-
? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
|
|
275
|
-
: []
|
|
374
|
+
const agentNames = getAgentNames(agentsDest)
|
|
375
|
+
const packLabel = packLabels[framework] || framework
|
|
276
376
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if (
|
|
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()
|
|
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')
|
|
293
382
|
|
|
294
|
-
|
|
295
|
-
}
|
|
383
|
+
if (globalAgentCount > 0) summaryLines.push(`\u2713 ${globalAgentCount} global agents (~/.claude/agents)`)
|
|
296
384
|
|
|
297
|
-
|
|
298
|
-
const args = process.argv.slice(2)
|
|
385
|
+
clack.note(summaryLines.join('\n'), `${packLabel} \u00b7 ${mode === 'full' ? 'Full' : 'Lite'}`)
|
|
299
386
|
|
|
300
|
-
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
console.error(` Run ${BOLD}specialist-agent --help${NC} for usage.`)
|
|
305
|
-
process.exit(1)
|
|
306
|
-
}
|
|
387
|
+
// Getting started
|
|
388
|
+
const installedSkills = existsSync(skillsDest)
|
|
389
|
+
? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
|
|
390
|
+
: []
|
|
307
391
|
|
|
308
|
-
|
|
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
|
-
}
|
|
392
|
+
clack.note(buildGettingStarted(agentNames, installedSkills), 'Getting started')
|
|
324
393
|
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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.')
|
|
329
400
|
}
|
|
330
401
|
|
|
331
402
|
main().catch((err) => {
|
|
332
|
-
|
|
403
|
+
clack.log.error(err.message)
|
|
333
404
|
process.exit(1)
|
|
334
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 `·`
|