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.
- 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 +15 -1
- package/agents/starter.md +15 -1
- package/agents/tester-lite.md +15 -1
- package/agents/tester.md +19 -5
- package/cli/index.mjs +327 -204
- 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,90 +1,48 @@
|
|
|
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
|
-
|
|
18
|
+
// ── Helpers ──────────────────────────────────────────
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
81
|
-
|
|
39
|
+
}
|
|
40
|
+
return count
|
|
82
41
|
}
|
|
83
42
|
|
|
84
|
-
function
|
|
85
|
-
if (!existsSync(
|
|
86
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
129
|
-
|
|
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
|
-
|
|
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(
|
|
137
|
-
|
|
138
|
-
|
|
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
|
|
149
|
-
|
|
150
|
-
value: p,
|
|
151
|
-
hint: ''
|
|
152
|
-
}))
|
|
228
|
+
const detected = detectFramework(join(cwd, 'package.json'), packs)
|
|
229
|
+
let framework
|
|
153
230
|
|
|
154
|
-
|
|
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
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
189
|
-
|
|
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' ?
|
|
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
|
-
|
|
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 =
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
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}`)
|
|
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
|
-
|
|
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}`)
|
|
412
|
+
let claudeInstalled = false
|
|
413
|
+
if (!existsSync(claudeDest) && existsSync(claudeSource)) {
|
|
414
|
+
cpSync(claudeSource, claudeDest)
|
|
415
|
+
claudeInstalled = true
|
|
257
416
|
}
|
|
258
417
|
|
|
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()
|
|
418
|
+
s.stop('Installation complete')
|
|
265
419
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
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 (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
"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
|
}
|