specialist-agent 2.10.0 → 2.11.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/.claude-plugin/marketplace.json +5 -5
- package/.claude-plugin/plugin.json +2 -2
- package/.cursor-plugin/marketplace.json +1 -1
- package/.cursor-plugin/plugin.json +2 -2
- package/README.md +128 -250
- package/agents/analyst.md +1 -0
- package/agents/api.md +4 -4
- package/agents/architect-lite.md +2 -2
- package/agents/architect.md +6 -6
- package/agents/cloud-lite.md +1 -1
- package/agents/cloud.md +4 -4
- package/agents/data-lite.md +1 -1
- package/agents/data.md +4 -4
- package/agents/debugger.md +1 -0
- package/agents/deps.md +4 -4
- package/agents/designer-lite.md +1 -1
- package/agents/designer.md +4 -4
- package/agents/devops-lite.md +1 -1
- package/agents/devops.md +4 -4
- package/agents/docs.md +4 -4
- package/agents/executor.md +95 -0
- package/agents/explorer-lite.md +1 -1
- package/agents/explorer.md +4 -4
- package/agents/finance-lite.md +1 -1
- package/agents/finance.md +4 -4
- package/agents/i18n.md +4 -4
- package/agents/legal-lite.md +1 -1
- package/agents/legal.md +4 -4
- package/agents/marketing-lite.md +25 -0
- package/agents/marketing.md +179 -0
- package/agents/memory.md +13 -12
- package/agents/orchestrator.md +102 -0
- package/agents/pair.md +1 -0
- package/agents/perf.md +4 -4
- package/agents/planner.md +1 -0
- package/agents/product-lite.md +25 -0
- package/agents/product.md +186 -0
- package/agents/refactor.md +4 -4
- package/agents/ripple.md +1 -0
- package/agents/scout.md +1 -0
- package/agents/security-lite.md +1 -1
- package/agents/security.md +4 -4
- package/agents/sentry-triage-lite.md +54 -0
- package/agents/sentry-triage.md +214 -0
- package/agents/starter-lite.md +4 -4
- package/agents/starter.md +8 -8
- package/agents/support-lite.md +24 -0
- package/agents/support.md +190 -0
- package/agents/tdd.md +1 -0
- package/agents/tester-lite.md +1 -1
- package/agents/tester.md +43 -10
- package/cli/index.mjs +469 -324
- package/hooks/native/auto-dispatch.mjs +19 -26
- package/hooks/native/auto-format.mjs +5 -25
- package/hooks/native/mcp-discovery.mjs +168 -0
- package/hooks/native/security-config.json +4 -0
- package/hooks/native/security-guard.mjs +37 -24
- package/hooks/native/session-context.mjs +61 -18
- package/hooks/native/settings-template.json +9 -0
- package/package.json +1 -1
- package/packs/angular/agents/builder.md +10 -54
- package/packs/angular/agents/doctor.md +7 -61
- package/packs/angular/agents/migrator.md +7 -101
- package/packs/angular/agents/reviewer.md +22 -33
- package/packs/angular/skills/review-check-architecture/SKILL.md +7 -7
- package/packs/angular/skills/review-review/SKILL.md +1 -0
- package/packs/astro/agents/builder.md +10 -79
- package/packs/astro/agents/doctor.md +7 -61
- package/packs/astro/agents/migrator.md +7 -111
- package/packs/astro/agents/reviewer.md +22 -32
- package/packs/astro/skills/review-check-architecture/SKILL.md +9 -9
- package/packs/astro/skills/review-review/SKILL.md +1 -0
- package/packs/nextjs/agents/builder.md +11 -108
- package/packs/nextjs/agents/doctor.md +7 -62
- package/packs/nextjs/agents/migrator.md +6 -194
- package/packs/nextjs/agents/reviewer.md +22 -76
- package/packs/nextjs/skills/review-check-architecture/SKILL.md +15 -15
- package/packs/nextjs/skills/review-review/SKILL.md +1 -0
- package/packs/nuxt/agents/builder.md +10 -55
- package/packs/nuxt/agents/doctor.md +7 -61
- package/packs/nuxt/agents/migrator.md +7 -109
- package/packs/nuxt/agents/reviewer.md +22 -42
- package/packs/nuxt/skills/review-check-architecture/SKILL.md +11 -11
- package/packs/nuxt/skills/review-review/SKILL.md +1 -0
- package/packs/react/agents/builder.md +10 -55
- package/packs/react/agents/doctor.md +7 -61
- package/packs/react/agents/migrator.md +7 -106
- package/packs/react/agents/reviewer.md +22 -55
- package/packs/react/skills/review-check-architecture/SKILL.md +10 -10
- package/packs/react/skills/review-review/SKILL.md +1 -0
- package/packs/svelte/agents/builder.md +10 -58
- package/packs/svelte/agents/doctor.md +7 -60
- package/packs/svelte/agents/migrator.md +7 -118
- package/packs/svelte/agents/reviewer.md +22 -42
- package/packs/svelte/skills/review-check-architecture/SKILL.md +12 -12
- package/packs/svelte/skills/review-review/SKILL.md +1 -0
- package/packs/vue/agents/builder.md +10 -55
- package/packs/vue/agents/doctor.md +7 -61
- package/packs/vue/agents/migrator.md +7 -93
- package/packs/vue/agents/reviewer.md +20 -32
- package/packs/vue/skills/review-check-architecture/SKILL.md +10 -10
- package/packs/vue/skills/review-review/SKILL.md +1 -0
- package/skills/autofix/SKILL.md +166 -0
- package/skills/discovery/SKILL.md +218 -0
package/cli/index.mjs
CHANGED
|
@@ -18,6 +18,7 @@ const ROOT = resolve(__dirname, '..')
|
|
|
18
18
|
const YELLOW = '\x1b[33m'
|
|
19
19
|
const RED = '\x1b[31m'
|
|
20
20
|
const GREEN = '\x1b[32m'
|
|
21
|
+
const CYAN = '\x1b[36m'
|
|
21
22
|
const BOLD = '\x1b[1m'
|
|
22
23
|
const DIM = '\x1b[2m'
|
|
23
24
|
const NC = '\x1b[0m'
|
|
@@ -84,6 +85,7 @@ const HOOK_EVENT_MAP = {
|
|
|
84
85
|
'security-guard': 'PreToolUse',
|
|
85
86
|
'auto-dispatch': 'UserPromptSubmit',
|
|
86
87
|
'session-context': 'SessionStart',
|
|
88
|
+
'mcp-discovery': 'SessionStart',
|
|
87
89
|
'auto-format': 'PostToolUse',
|
|
88
90
|
}
|
|
89
91
|
|
|
@@ -99,6 +101,7 @@ function setupNativeHooks(cwd, selectedHooks) {
|
|
|
99
101
|
'security-config.json',
|
|
100
102
|
'auto-dispatch.mjs',
|
|
101
103
|
'session-context.mjs',
|
|
104
|
+
'mcp-discovery.mjs',
|
|
102
105
|
'auto-format.mjs',
|
|
103
106
|
]
|
|
104
107
|
for (const file of filesToCopy) {
|
|
@@ -203,14 +206,188 @@ function detectFramework(pkgPath, availablePacks) {
|
|
|
203
206
|
return null
|
|
204
207
|
}
|
|
205
208
|
|
|
209
|
+
// ── Platform Detection ──────────────────────────────
|
|
210
|
+
|
|
211
|
+
const PLATFORMS = {
|
|
212
|
+
'claude-code': {
|
|
213
|
+
label: 'Claude Code',
|
|
214
|
+
detect: (cwd) => true, // always install (primary platform)
|
|
215
|
+
},
|
|
216
|
+
'cursor': {
|
|
217
|
+
label: 'Cursor',
|
|
218
|
+
detect: (cwd) => {
|
|
219
|
+
if (existsSync(join(cwd, '.cursor'))) return true
|
|
220
|
+
if (existsSync(join(cwd, '.cursorignore'))) return true
|
|
221
|
+
if (existsSync(join(cwd, '.cursorrules'))) return true
|
|
222
|
+
try { execFileSync('cursor', ['--version'], { stdio: 'pipe', timeout: 3000 }); return true } catch { return false }
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
'windsurf': {
|
|
226
|
+
label: 'Windsurf',
|
|
227
|
+
detect: (cwd) => {
|
|
228
|
+
if (existsSync(join(cwd, '.windsurf'))) return true
|
|
229
|
+
if (existsSync(join(cwd, '.windsurfrules'))) return true
|
|
230
|
+
try { execFileSync('windsurf', ['--version'], { stdio: 'pipe', timeout: 3000 }); return true } catch { return false }
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
'vscode': {
|
|
234
|
+
label: 'VS Code',
|
|
235
|
+
detect: (cwd) => {
|
|
236
|
+
if (existsSync(join(cwd, '.vscode'))) return true
|
|
237
|
+
try { execFileSync('code', ['--version'], { stdio: 'pipe', timeout: 3000 }); return true } catch { return false }
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
'codex': {
|
|
241
|
+
label: 'Codex',
|
|
242
|
+
detect: (cwd) => {
|
|
243
|
+
if (existsSync(join(cwd, '.codex'))) return true
|
|
244
|
+
try { execFileSync('codex', ['--version'], { stdio: 'pipe', timeout: 3000 }); return true } catch { return false }
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
'opencode': {
|
|
248
|
+
label: 'OpenCode',
|
|
249
|
+
detect: (cwd) => {
|
|
250
|
+
if (existsSync(join(cwd, '.opencode'))) return true
|
|
251
|
+
if (existsSync(join(cwd, 'opencode.json'))) return true
|
|
252
|
+
try { execFileSync('opencode', ['--version'], { stdio: 'pipe', timeout: 3000 }); return true } catch { return false }
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function detectPlatforms(cwd) {
|
|
258
|
+
const detected = []
|
|
259
|
+
for (const [id, platform] of Object.entries(PLATFORMS)) {
|
|
260
|
+
if (platform.detect(cwd)) {
|
|
261
|
+
detected.push({ id, label: platform.label })
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return detected
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function setupPlatformConfigs(cwd, platforms, { framework, version }) {
|
|
268
|
+
const installed = []
|
|
269
|
+
|
|
270
|
+
for (const platform of platforms) {
|
|
271
|
+
switch (platform.id) {
|
|
272
|
+
case 'claude-code':
|
|
273
|
+
// Handled by main install flow
|
|
274
|
+
break
|
|
275
|
+
|
|
276
|
+
case 'cursor': {
|
|
277
|
+
const cursorDir = join(cwd, '.cursor')
|
|
278
|
+
mkdirSync(cursorDir, { recursive: true })
|
|
279
|
+
|
|
280
|
+
// Copy agents to .cursor/agents/ (Cursor reads agents from here)
|
|
281
|
+
const cursorAgentsDir = join(cursorDir, 'agents')
|
|
282
|
+
const claudeAgentsDir = join(cwd, '.claude', 'agents')
|
|
283
|
+
if (existsSync(claudeAgentsDir)) {
|
|
284
|
+
mkdirSync(cursorAgentsDir, { recursive: true })
|
|
285
|
+
copyDir(claudeAgentsDir, cursorAgentsDir)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
installed.push({ platform: 'Cursor', path: '.cursor/agents/' })
|
|
289
|
+
break
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
case 'windsurf': {
|
|
293
|
+
const windsurfDir = join(cwd, '.windsurf')
|
|
294
|
+
mkdirSync(windsurfDir, { recursive: true })
|
|
295
|
+
|
|
296
|
+
// Copy agents to .windsurf/agents/
|
|
297
|
+
const wsAgentsDir = join(windsurfDir, 'agents')
|
|
298
|
+
const claudeAgentsDir = join(cwd, '.claude', 'agents')
|
|
299
|
+
if (existsSync(claudeAgentsDir)) {
|
|
300
|
+
mkdirSync(wsAgentsDir, { recursive: true })
|
|
301
|
+
copyDir(claudeAgentsDir, wsAgentsDir)
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
installed.push({ platform: 'Windsurf', path: '.windsurf/agents/' })
|
|
305
|
+
break
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
case 'vscode': {
|
|
309
|
+
// VS Code uses .vscode/ — just ensure the settings reference .claude/
|
|
310
|
+
const vscodeDir = join(cwd, '.vscode')
|
|
311
|
+
mkdirSync(vscodeDir, { recursive: true })
|
|
312
|
+
|
|
313
|
+
const settingsPath = join(vscodeDir, 'settings.json')
|
|
314
|
+
let settings = {}
|
|
315
|
+
if (existsSync(settingsPath)) {
|
|
316
|
+
try { settings = JSON.parse(readFileSync(settingsPath, 'utf-8')) } catch {}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (!settings['specialist-agent.framework']) {
|
|
320
|
+
settings['specialist-agent.framework'] = framework || 'auto'
|
|
321
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2))
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
installed.push({ platform: 'VS Code', path: '.vscode/settings.json' })
|
|
325
|
+
break
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
case 'codex': {
|
|
329
|
+
// Codex reads from .claude/agents/ — same as Claude Code, just confirm
|
|
330
|
+
installed.push({ platform: 'Codex', path: '.claude/agents/' })
|
|
331
|
+
break
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
case 'opencode': {
|
|
335
|
+
// Copy agents to .opencode/agents/
|
|
336
|
+
const opencodeDir = join(cwd, '.opencode')
|
|
337
|
+
mkdirSync(join(opencodeDir, 'agents'), { recursive: true })
|
|
338
|
+
|
|
339
|
+
const claudeAgentsDir = join(cwd, '.claude', 'agents')
|
|
340
|
+
if (existsSync(claudeAgentsDir)) {
|
|
341
|
+
copyDir(claudeAgentsDir, join(opencodeDir, 'agents'))
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Copy opencode.json if it doesn't exist
|
|
345
|
+
const opencodeConfigSrc = join(ROOT, '.opencode', 'opencode.json')
|
|
346
|
+
const opencodeConfigDest = join(cwd, 'opencode.json')
|
|
347
|
+
if (!existsSync(opencodeConfigDest) && existsSync(opencodeConfigSrc)) {
|
|
348
|
+
cpSync(opencodeConfigSrc, opencodeConfigDest)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
installed.push({ platform: 'OpenCode', path: '.opencode/agents/' })
|
|
352
|
+
break
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return installed
|
|
358
|
+
}
|
|
359
|
+
|
|
206
360
|
// ── Guidance texts ───────────────────────────────────
|
|
207
361
|
|
|
208
|
-
function buildGettingStarted(agentNames, installedSkills, archInstalled) {
|
|
362
|
+
function buildGettingStarted(agentNames, installedSkills, archInstalled, isEmptyProject) {
|
|
209
363
|
const lines = []
|
|
210
364
|
|
|
365
|
+
if (isEmptyProject) {
|
|
366
|
+
lines.push('You\'re starting fresh — here\'s how to get going:')
|
|
367
|
+
lines.push('')
|
|
368
|
+
lines.push(' $ claude')
|
|
369
|
+
lines.push('')
|
|
370
|
+
if (agentNames.includes('starter')) {
|
|
371
|
+
lines.push(' Create a project from scratch:')
|
|
372
|
+
lines.push(' > "Use @starter to create an app with Next.js + PostgreSQL"')
|
|
373
|
+
lines.push(' > "Use @starter to create a Vue 3 SaaS with Stripe"')
|
|
374
|
+
lines.push('')
|
|
375
|
+
}
|
|
376
|
+
if (agentNames.includes('planner')) {
|
|
377
|
+
lines.push(' Plan before building:')
|
|
378
|
+
lines.push(' > /plan add user authentication with JWT')
|
|
379
|
+
lines.push(' > /discovery implement real-time chat with WebSocket')
|
|
380
|
+
lines.push('')
|
|
381
|
+
}
|
|
382
|
+
lines.push(' All 35 agents are installed. When you choose a framework,')
|
|
383
|
+
lines.push(' re-run to swap to framework-specific pack agents:')
|
|
384
|
+
lines.push(' > npx specialist-agent init')
|
|
385
|
+
return lines.join('\n')
|
|
386
|
+
}
|
|
387
|
+
|
|
211
388
|
if (archInstalled) {
|
|
212
389
|
lines.push('Agents enforce the architecture defined in docs/ARCHITECTURE.md.')
|
|
213
|
-
lines.push('They ensure consistency across modules
|
|
390
|
+
lines.push('They ensure consistency across modules — the more you use them,')
|
|
214
391
|
lines.push('the more value they deliver.')
|
|
215
392
|
lines.push('')
|
|
216
393
|
lines.push('To migrate your project to the new architecture:')
|
|
@@ -238,16 +415,19 @@ function buildGettingStarted(agentNames, installedSkills, archInstalled) {
|
|
|
238
415
|
if (installedSkills.length > 0) {
|
|
239
416
|
lines.push('')
|
|
240
417
|
lines.push('Skills (slash commands):')
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
418
|
+
const topSkills = ['/plan', '/tdd', '/audit', '/discovery']
|
|
419
|
+
const available = topSkills.filter(s => installedSkills.includes(s))
|
|
420
|
+
if (available.length > 0) {
|
|
421
|
+
available.forEach(skill => lines.push(` > ${skill}`))
|
|
422
|
+
} else {
|
|
423
|
+
installedSkills.slice(0, 4).forEach(skill => lines.push(` > ${skill}`))
|
|
424
|
+
}
|
|
244
425
|
}
|
|
245
426
|
|
|
246
427
|
if (agentNames.includes('starter')) {
|
|
247
428
|
lines.push('')
|
|
248
|
-
lines.push('
|
|
249
|
-
lines.push('
|
|
250
|
-
lines.push(' > "Use @starter to create my project"')
|
|
429
|
+
lines.push('Scaffold a new project from scratch:')
|
|
430
|
+
lines.push(' > "Use @starter to create an e-commerce app with Next.js"')
|
|
251
431
|
}
|
|
252
432
|
|
|
253
433
|
return lines.join('\n')
|
|
@@ -273,12 +453,12 @@ if (args.includes('--help') || args.includes('-h')) {
|
|
|
273
453
|
console.log(' Usage: specialist-agent <command> [options]')
|
|
274
454
|
console.log()
|
|
275
455
|
console.log(' Commands:')
|
|
276
|
-
console.log(` init ${DIM}Install agents and skills
|
|
277
|
-
console.log(` detect ${DIM}Detect
|
|
456
|
+
console.log(` init ${DIM}Install 35 agents and 24 skills (works on empty projects too)${NC}`)
|
|
457
|
+
console.log(` detect ${DIM}Detect architecture, monorepo, and suggest migrations${NC}`)
|
|
278
458
|
console.log(` create-agent <name> ${DIM}Create a custom agent from template${NC}`)
|
|
279
|
-
console.log(` list ${DIM}List installed agents and
|
|
459
|
+
console.log(` list ${DIM}List installed agents, skills, and memory${NC}`)
|
|
280
460
|
console.log(` profiles ${DIM}Manage AI team profiles${NC}`)
|
|
281
|
-
console.log(` community ${DIM}Manage community skills${NC}`)
|
|
461
|
+
console.log(` community ${DIM}Manage community skills (list/install/remove)${NC}`)
|
|
282
462
|
console.log()
|
|
283
463
|
console.log(' Options:')
|
|
284
464
|
console.log(` -h, --help ${DIM}Show this help message${NC}`)
|
|
@@ -286,8 +466,10 @@ if (args.includes('--help') || args.includes('-h')) {
|
|
|
286
466
|
console.log(` -f, --force ${DIM}Overwrite existing agents without asking${NC}`)
|
|
287
467
|
console.log()
|
|
288
468
|
console.log(' Examples:')
|
|
289
|
-
console.log(` ${DIM}$ specialist-agent init${NC}`)
|
|
290
|
-
console.log(` ${DIM}$ specialist-agent
|
|
469
|
+
console.log(` ${DIM}$ specialist-agent init # Install in existing project${NC}`)
|
|
470
|
+
console.log(` ${DIM}$ specialist-agent init # Start from empty dir (no framework yet)${NC}`)
|
|
471
|
+
console.log(` ${DIM}$ specialist-agent detect # Analyze architecture & get recommendations${NC}`)
|
|
472
|
+
console.log(` ${DIM}$ specialist-agent create-agent @qa # Create a custom agent${NC}`)
|
|
291
473
|
console.log(` ${DIM}$ specialist-agent profiles set startup-fast${NC}`)
|
|
292
474
|
console.log()
|
|
293
475
|
process.exit(0)
|
|
@@ -957,17 +1139,20 @@ async function main() {
|
|
|
957
1139
|
|
|
958
1140
|
clack.intro(`Specialist Agent ${DIM}v${pkg.version}${NC}`)
|
|
959
1141
|
|
|
960
|
-
// Check for updates
|
|
1142
|
+
// Check for updates (non-blocking)
|
|
961
1143
|
const latestVersion = await checkForUpdates(pkg.version)
|
|
962
1144
|
if (latestVersion) {
|
|
963
1145
|
clack.log.warn(`Update available: v${pkg.version} → v${latestVersion}`)
|
|
964
1146
|
clack.log.info(`${DIM}Run: npm i -g specialist-agent@latest${NC}`)
|
|
965
1147
|
}
|
|
966
1148
|
|
|
967
|
-
// Check we're in a project
|
|
968
1149
|
const cwd = process.cwd()
|
|
1150
|
+
|
|
1151
|
+
// ── Auto-detect everything ──────────────────────────
|
|
1152
|
+
|
|
1153
|
+
// Check/create package.json
|
|
969
1154
|
if (!existsSync(join(cwd, 'package.json'))) {
|
|
970
|
-
clack.log.warn('No package.json found
|
|
1155
|
+
clack.log.warn('No package.json found.')
|
|
971
1156
|
|
|
972
1157
|
const createPkg = await clack.confirm({
|
|
973
1158
|
message: 'Create a package.json to initialize this project?',
|
|
@@ -989,7 +1174,7 @@ async function main() {
|
|
|
989
1174
|
clack.log.success('package.json created')
|
|
990
1175
|
}
|
|
991
1176
|
|
|
992
|
-
//
|
|
1177
|
+
// Auto-detect framework
|
|
993
1178
|
const packs = readdirSync(join(ROOT, 'packs'), { withFileTypes: true })
|
|
994
1179
|
.filter(d => d.isDirectory())
|
|
995
1180
|
.map(d => d.name)
|
|
@@ -997,300 +1182,248 @@ async function main() {
|
|
|
997
1182
|
const packLabels = { vue: 'Vue 3', react: 'React', nextjs: 'Next.js', svelte: 'SvelteKit', angular: 'Angular', astro: 'Astro', nuxt: 'Nuxt' }
|
|
998
1183
|
|
|
999
1184
|
const detected = detectFramework(join(cwd, 'package.json'), packs)
|
|
1000
|
-
let framework
|
|
1001
1185
|
|
|
1002
|
-
|
|
1003
|
-
|
|
1186
|
+
// Auto-detect platforms
|
|
1187
|
+
const detectedPlatforms = detectPlatforms(cwd)
|
|
1188
|
+
const platformLabels = detectedPlatforms.map(p => p.label).join(', ')
|
|
1004
1189
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1190
|
+
// Auto-detect architecture
|
|
1191
|
+
let framework = detected
|
|
1192
|
+
const isEmptyProject = !detected
|
|
1193
|
+
const archDetection = detectProjectArchitecture(cwd, { framework: isEmptyProject ? null : framework })
|
|
1194
|
+
const detectedArch = archDetection.architecture
|
|
1195
|
+
const detectedArchName = ARCHITECTURE_PATTERNS[detectedArch]?.name || detectedArch
|
|
1011
1196
|
|
|
1012
|
-
|
|
1013
|
-
framework = detected
|
|
1014
|
-
} else {
|
|
1015
|
-
framework = await clack.select({
|
|
1016
|
-
message: 'Which framework?',
|
|
1017
|
-
options: packs.map(p => ({
|
|
1018
|
-
value: p,
|
|
1019
|
-
label: packLabels[p] || p.charAt(0).toUpperCase() + p.slice(1),
|
|
1020
|
-
})),
|
|
1021
|
-
})
|
|
1197
|
+
// ── Show detection results ──────────────────────────
|
|
1022
1198
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1199
|
+
const detectionLines = []
|
|
1200
|
+
if (detected) {
|
|
1201
|
+
detectionLines.push(`${GREEN}✓${NC} Framework: ${BOLD}${packLabels[detected] || detected}${NC}`)
|
|
1025
1202
|
} else {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1203
|
+
detectionLines.push(`${DIM}○ Framework: none detected (empty project)${NC}`)
|
|
1204
|
+
}
|
|
1205
|
+
detectionLines.push(`${GREEN}✓${NC} Platforms: ${BOLD}${platformLabels}${NC}`)
|
|
1206
|
+
if (detectedArch && detectedArch !== 'unstructured') {
|
|
1207
|
+
detectionLines.push(`${GREEN}✓${NC} Architecture: ${BOLD}${detectedArchName}${NC}`)
|
|
1208
|
+
}
|
|
1209
|
+
if (archDetection.monorepo) {
|
|
1210
|
+
detectionLines.push(`${GREEN}✓${NC} Monorepo: ${BOLD}${archDetection.monorepo.name}${NC} (${archDetection.monorepo.apps.length} apps/packages)`)
|
|
1211
|
+
}
|
|
1033
1212
|
|
|
1034
|
-
|
|
1213
|
+
clack.note(detectionLines.join('\n'), 'Auto-detected')
|
|
1214
|
+
|
|
1215
|
+
// ── Step 1: Framework (only ask if not detected) ────
|
|
1216
|
+
|
|
1217
|
+
if (!detected) {
|
|
1218
|
+
framework = 'none'
|
|
1219
|
+
clack.log.info('No framework detected — installing universal agents.')
|
|
1220
|
+
clack.log.info(`${DIM}When you choose a framework, re-run: npx specialist-agent init${NC}`)
|
|
1035
1221
|
}
|
|
1036
1222
|
|
|
1037
|
-
|
|
1223
|
+
const isNone = framework === 'none' || !framework
|
|
1224
|
+
|
|
1225
|
+
// ── Step 2: Mode ────────────────────────────────────
|
|
1226
|
+
|
|
1038
1227
|
const mode = await clack.select({
|
|
1039
1228
|
message: 'Agent mode?',
|
|
1040
1229
|
options: [
|
|
1041
|
-
{ value: 'full', label: 'Full', hint: 'Sonnet/Opus' },
|
|
1042
|
-
{ value: 'lite', label: 'Lite', hint: 'Haiku
|
|
1230
|
+
{ value: 'full', label: 'Full', hint: 'Sonnet/Opus — best quality' },
|
|
1231
|
+
{ value: 'lite', label: 'Lite', hint: 'Haiku — lower cost, faster' },
|
|
1043
1232
|
],
|
|
1044
1233
|
})
|
|
1045
1234
|
|
|
1046
1235
|
if (clack.isCancel(mode)) handleCancel()
|
|
1047
1236
|
|
|
1048
|
-
// 3
|
|
1049
|
-
const installStarter = await clack.confirm({
|
|
1050
|
-
message: 'Install @starter agent?',
|
|
1051
|
-
initialValue: true,
|
|
1052
|
-
})
|
|
1053
|
-
|
|
1054
|
-
if (clack.isCancel(installStarter)) handleCancel()
|
|
1055
|
-
|
|
1056
|
-
// 4. Workflow agents
|
|
1057
|
-
const installWorkflow = await clack.confirm({
|
|
1058
|
-
message: `Install workflow agents? ${DIM}(@planner, @executor, @tdd, @debugger, @pair)${NC}`,
|
|
1059
|
-
initialValue: true,
|
|
1060
|
-
})
|
|
1061
|
-
|
|
1062
|
-
if (clack.isCancel(installWorkflow)) handleCancel()
|
|
1063
|
-
|
|
1064
|
-
// 5. Specialist agents
|
|
1065
|
-
const installSpecialists = await clack.confirm({
|
|
1066
|
-
message: `Install specialist agents? ${DIM}(@api, @perf, @security, @finance, @data, @i18n, @docs, @deps, @legal, ...)${NC}`,
|
|
1067
|
-
initialValue: true,
|
|
1068
|
-
})
|
|
1069
|
-
|
|
1070
|
-
if (clack.isCancel(installSpecialists)) handleCancel()
|
|
1237
|
+
// ── Step 3: Install scope ──────────────────────────
|
|
1071
1238
|
|
|
1072
|
-
// 6. Install scope
|
|
1073
1239
|
const installScope = await clack.select({
|
|
1074
|
-
message: '
|
|
1240
|
+
message: 'Install scope?',
|
|
1075
1241
|
options: [
|
|
1076
|
-
{ value: 'project', label: 'This project
|
|
1077
|
-
{ value: 'global', label: '
|
|
1242
|
+
{ value: 'project', label: 'This project', hint: '.claude/agents/' },
|
|
1243
|
+
{ value: 'global', label: 'Global', hint: '~/.claude/agents/ — all projects' },
|
|
1078
1244
|
],
|
|
1079
1245
|
})
|
|
1080
1246
|
|
|
1081
1247
|
if (clack.isCancel(installScope)) handleCancel()
|
|
1082
1248
|
|
|
1083
|
-
// ──
|
|
1084
|
-
|
|
1085
|
-
let selectedHooks = []
|
|
1249
|
+
// ── Step 4: Customize (optional) ───────────────────
|
|
1086
1250
|
|
|
1087
|
-
const
|
|
1088
|
-
message: `
|
|
1089
|
-
initialValue:
|
|
1251
|
+
const customize = await clack.confirm({
|
|
1252
|
+
message: `Customize installation? ${DIM}(hooks, architecture, agent selection)${NC}`,
|
|
1253
|
+
initialValue: false,
|
|
1090
1254
|
})
|
|
1091
1255
|
|
|
1092
|
-
if (clack.isCancel(
|
|
1256
|
+
if (clack.isCancel(customize)) handleCancel()
|
|
1093
1257
|
|
|
1094
|
-
|
|
1258
|
+
let selectedHooks = ['security-guard', 'auto-dispatch', 'session-context', 'mcp-discovery']
|
|
1259
|
+
let installArch = true
|
|
1260
|
+
let selectedArchitecture = 'modular'
|
|
1261
|
+
let selectedArchVariant = 'full'
|
|
1262
|
+
let generateCustomArch = false
|
|
1263
|
+
let installStarter = true
|
|
1264
|
+
let installWorkflow = true
|
|
1265
|
+
let installSpecialists = true
|
|
1266
|
+
let installBusiness = true
|
|
1267
|
+
|
|
1268
|
+
if (customize) {
|
|
1269
|
+
// Native hooks selection
|
|
1095
1270
|
const hookChoices = await clack.multiselect({
|
|
1096
|
-
message: '
|
|
1271
|
+
message: 'Native Claude Code hooks:',
|
|
1097
1272
|
options: [
|
|
1098
|
-
{ value: 'security-guard', label: 'Security Guard', hint: 'Block dangerous commands
|
|
1099
|
-
{ value: 'auto-dispatch', label: 'Auto-Dispatch', hint: 'Suggest agents based on
|
|
1100
|
-
{ value: 'session-context', label: 'Session Context', hint: 'Inject project state on
|
|
1273
|
+
{ value: 'security-guard', label: 'Security Guard', hint: 'Block dangerous commands', selected: true },
|
|
1274
|
+
{ value: 'auto-dispatch', label: 'Auto-Dispatch', hint: 'Suggest agents based on prompt', selected: true },
|
|
1275
|
+
{ value: 'session-context', label: 'Session Context', hint: 'Inject project state on start', selected: true },
|
|
1276
|
+
{ value: 'mcp-discovery', label: 'MCP Discovery', hint: 'Detect MCP servers and enhance agents', selected: true },
|
|
1101
1277
|
{ value: 'auto-format', label: 'Auto-Format', hint: 'Format files after Write/Edit', selected: false },
|
|
1102
1278
|
],
|
|
1103
1279
|
required: false,
|
|
1104
1280
|
})
|
|
1105
1281
|
|
|
1106
|
-
if (!clack.isCancel(hookChoices)
|
|
1282
|
+
if (!clack.isCancel(hookChoices)) {
|
|
1107
1283
|
selectedHooks = hookChoices
|
|
1108
1284
|
}
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
// ── Architecture Detection & Guide ──────────────────
|
|
1112
|
-
|
|
1113
|
-
let installArch = false
|
|
1114
|
-
let selectedArchitecture = 'modular'
|
|
1115
|
-
let selectedArchVariant = 'full'
|
|
1116
|
-
let generateCustomArch = false
|
|
1117
|
-
|
|
1118
|
-
// Detect current architecture
|
|
1119
|
-
const archDetection = detectProjectArchitecture(cwd, { framework })
|
|
1120
|
-
const detectedArch = archDetection.architecture
|
|
1121
|
-
const detectedArchName = ARCHITECTURE_PATTERNS[detectedArch]?.name || detectedArch
|
|
1122
|
-
|
|
1123
|
-
if (detectedArch && detectedArch !== 'unstructured') {
|
|
1124
|
-
clack.log.info(`Detected architecture: ${BOLD}${detectedArchName}${NC}`)
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
// Monorepo detection
|
|
1128
|
-
if (archDetection.monorepo) {
|
|
1129
|
-
clack.log.info(`Monorepo detected: ${BOLD}${archDetection.monorepo.name}${NC} (${archDetection.monorepo.apps.length} apps/packages)`)
|
|
1130
|
-
}
|
|
1131
1285
|
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
options: [
|
|
1136
|
-
{
|
|
1137
|
-
value: 'detect-and-suggest',
|
|
1138
|
-
label: 'Detect & suggest improvements',
|
|
1139
|
-
hint: 'Analyze current architecture and recommend best practices',
|
|
1140
|
-
},
|
|
1141
|
-
{
|
|
1142
|
-
value: 'choose',
|
|
1143
|
-
label: 'Choose a specific architecture',
|
|
1144
|
-
hint: 'Pick from our catalog of patterns (Modular, Clean, Hexagonal, DDD, ...)',
|
|
1145
|
-
},
|
|
1146
|
-
{
|
|
1147
|
-
value: 'default',
|
|
1148
|
-
label: `Use default (Modular)`,
|
|
1149
|
-
hint: 'Install the standard modular ARCHITECTURE.md',
|
|
1150
|
-
},
|
|
1151
|
-
{
|
|
1152
|
-
value: 'skip',
|
|
1153
|
-
label: 'Skip',
|
|
1154
|
-
hint: 'No architecture guide',
|
|
1155
|
-
},
|
|
1156
|
-
],
|
|
1157
|
-
})
|
|
1158
|
-
|
|
1159
|
-
if (clack.isCancel(archAction)) handleCancel()
|
|
1160
|
-
|
|
1161
|
-
if (archAction === 'detect-and-suggest') {
|
|
1162
|
-
// Ask team size for better recommendations
|
|
1163
|
-
const teamSize = await clack.select({
|
|
1164
|
-
message: 'Team size?',
|
|
1286
|
+
// Agent group selection
|
|
1287
|
+
const agentGroups = await clack.multiselect({
|
|
1288
|
+
message: 'Agent groups to install:',
|
|
1165
1289
|
options: [
|
|
1166
|
-
{ value: '
|
|
1167
|
-
{ value: '
|
|
1168
|
-
{ value: '
|
|
1169
|
-
{ value: '
|
|
1290
|
+
{ value: 'core', label: 'Core', hint: '@builder, @reviewer, @doctor, @migrator, @starter', selected: true },
|
|
1291
|
+
{ value: 'workflow', label: 'Workflow', hint: '@planner, @executor, @tdd, @debugger, @pair, @analyst, @orchestrator', selected: true },
|
|
1292
|
+
{ value: 'specialist', label: 'Specialist', hint: '@api, @perf, @security, @finance, @data, @devops, @architect, ...', selected: true },
|
|
1293
|
+
{ value: 'business', label: 'Business', hint: '@marketing, @product, @support', selected: true },
|
|
1170
1294
|
],
|
|
1295
|
+
required: true,
|
|
1171
1296
|
})
|
|
1172
1297
|
|
|
1173
|
-
if (clack.isCancel(
|
|
1174
|
-
|
|
1175
|
-
|
|
1298
|
+
if (!clack.isCancel(agentGroups)) {
|
|
1299
|
+
installStarter = agentGroups.includes('core')
|
|
1300
|
+
installWorkflow = agentGroups.includes('workflow')
|
|
1301
|
+
installSpecialists = agentGroups.includes('specialist')
|
|
1302
|
+
installBusiness = agentGroups.includes('business')
|
|
1303
|
+
}
|
|
1176
1304
|
|
|
1177
|
-
//
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
:
|
|
1182
|
-
: ''
|
|
1183
|
-
|
|
1184
|
-
|
|
1305
|
+
// Architecture selection
|
|
1306
|
+
const archAction = await clack.select({
|
|
1307
|
+
message: 'Architecture guide?',
|
|
1308
|
+
options: [
|
|
1309
|
+
{ value: 'default', label: 'Modular (default)', hint: 'Feature-based — recommended for most projects' },
|
|
1310
|
+
{ value: 'choose', label: 'Choose pattern', hint: 'Clean, Hexagonal, DDD, CQRS, ...' },
|
|
1311
|
+
{ value: 'detect', label: 'Detect & suggest', hint: 'Analyze your project and recommend' },
|
|
1312
|
+
{ value: 'skip', label: 'Skip', hint: 'No architecture guide' },
|
|
1313
|
+
],
|
|
1314
|
+
})
|
|
1185
1315
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1316
|
+
if (clack.isCancel(archAction)) handleCancel()
|
|
1317
|
+
|
|
1318
|
+
if (archAction === 'skip') {
|
|
1319
|
+
installArch = false
|
|
1320
|
+
} else if (archAction === 'detect') {
|
|
1321
|
+
const teamSize = await clack.select({
|
|
1322
|
+
message: 'Team size?',
|
|
1323
|
+
options: [
|
|
1324
|
+
{ value: 'small', label: '1-3 developers' },
|
|
1325
|
+
{ value: 'medium', label: '3-10 developers' },
|
|
1326
|
+
{ value: 'large', label: '10-20 developers' },
|
|
1327
|
+
{ value: 'enterprise', label: '20+ developers' },
|
|
1328
|
+
],
|
|
1190
1329
|
})
|
|
1191
|
-
}
|
|
1192
1330
|
|
|
1193
|
-
|
|
1331
|
+
if (clack.isCancel(teamSize)) handleCancel()
|
|
1194
1332
|
|
|
1195
|
-
|
|
1196
|
-
clack.log.info(recs.reason)
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
const archChoice = await clack.select({
|
|
1200
|
-
message: 'Which architecture to adopt?',
|
|
1201
|
-
options: recOptions,
|
|
1202
|
-
})
|
|
1333
|
+
const recs = getRecommendations(archDetection, { teamSize })
|
|
1203
1334
|
|
|
1204
|
-
|
|
1335
|
+
const recOptions = []
|
|
1336
|
+
for (const rec of recs.recommendations) {
|
|
1337
|
+
const tagPrefix = rec.tag === 'recommended' ? '[RECOMMENDED] '
|
|
1338
|
+
: rec.tag === 'backend-recommended' ? '[BACKEND] '
|
|
1339
|
+
: ''
|
|
1340
|
+
const effortNote = rec.migration ? ` (effort: ${rec.migration.effort})` : ''
|
|
1341
|
+
const sameNote = rec.isSameArch ? ' (current)' : ''
|
|
1205
1342
|
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1343
|
+
recOptions.push({
|
|
1344
|
+
value: rec.id,
|
|
1345
|
+
label: `${tagPrefix}${rec.name}${sameNote}`,
|
|
1346
|
+
hint: `${rec.description.slice(0, 60)}${effortNote}`,
|
|
1347
|
+
})
|
|
1348
|
+
}
|
|
1210
1349
|
|
|
1211
|
-
|
|
1212
|
-
const chosenRec = recs.recommendations.find(r => r.id === archChoice)
|
|
1213
|
-
if (chosenRec?.variants.length > 0) {
|
|
1214
|
-
const variantOptions = chosenRec.variants.map(v => ({
|
|
1215
|
-
value: v.id,
|
|
1216
|
-
label: v.name,
|
|
1217
|
-
hint: v.description.slice(0, 70),
|
|
1218
|
-
}))
|
|
1350
|
+
recOptions.push({ value: 'skip', label: 'Skip', hint: 'No architecture guide' })
|
|
1219
1351
|
|
|
1220
|
-
|
|
1221
|
-
message: 'Which variant?',
|
|
1222
|
-
options: variantOptions,
|
|
1223
|
-
})
|
|
1352
|
+
if (recs.reason) clack.log.info(recs.reason)
|
|
1224
1353
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1354
|
+
const archChoice = await clack.select({
|
|
1355
|
+
message: 'Which architecture?',
|
|
1356
|
+
options: recOptions,
|
|
1357
|
+
})
|
|
1228
1358
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
if (
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
)
|
|
1236
|
-
|
|
1359
|
+
if (clack.isCancel(archChoice)) handleCancel()
|
|
1360
|
+
|
|
1361
|
+
if (archChoice !== 'skip') {
|
|
1362
|
+
selectedArchitecture = archChoice
|
|
1363
|
+
generateCustomArch = true
|
|
1364
|
+
|
|
1365
|
+
const chosenRec = recs.recommendations.find(r => r.id === archChoice)
|
|
1366
|
+
if (chosenRec?.variants.length > 0) {
|
|
1367
|
+
const variantChoice = await clack.select({
|
|
1368
|
+
message: 'Variant?',
|
|
1369
|
+
options: chosenRec.variants.map(v => ({
|
|
1370
|
+
value: v.id,
|
|
1371
|
+
label: v.name,
|
|
1372
|
+
hint: v.description.slice(0, 70),
|
|
1373
|
+
})),
|
|
1374
|
+
})
|
|
1375
|
+
|
|
1376
|
+
if (clack.isCancel(variantChoice)) handleCancel()
|
|
1377
|
+
selectedArchVariant = variantChoice
|
|
1378
|
+
}
|
|
1237
1379
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1380
|
+
if (chosenRec?.migration && !chosenRec.isSameArch) {
|
|
1381
|
+
clack.log.info(`${DIM}After install, use /migrate-architecture to apply.${NC}`)
|
|
1382
|
+
}
|
|
1383
|
+
} else {
|
|
1384
|
+
installArch = false
|
|
1243
1385
|
}
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
const archChoice = await clack.select({
|
|
1260
|
-
message: 'Which architecture pattern?',
|
|
1261
|
-
options: archOptions,
|
|
1262
|
-
})
|
|
1386
|
+
} else if (archAction === 'choose') {
|
|
1387
|
+
const archChoice = await clack.select({
|
|
1388
|
+
message: 'Architecture pattern?',
|
|
1389
|
+
options: [
|
|
1390
|
+
{ value: 'modular', label: 'Modular (Feature-Based)', hint: 'Recommended for most projects' },
|
|
1391
|
+
{ value: 'clean', label: 'Clean Architecture', hint: 'Domain > Use Cases > Adapters' },
|
|
1392
|
+
{ value: 'hexagonal', label: 'Hexagonal (Ports & Adapters)', hint: 'Core isolated' },
|
|
1393
|
+
{ value: 'fsd', label: 'Feature-Sliced Design', hint: 'Strict layered' },
|
|
1394
|
+
{ value: 'ddd', label: 'Domain-Driven Design', hint: 'Bounded contexts' },
|
|
1395
|
+
{ value: 'modular-monolith', label: 'Modular Monolith', hint: 'Backend/fullstack' },
|
|
1396
|
+
{ value: 'atomic', label: 'Atomic Design', hint: 'Component granularity' },
|
|
1397
|
+
{ value: 'cqrs', label: 'CQRS', hint: 'Command/query separation' },
|
|
1398
|
+
{ value: 'mvc', label: 'MVC / Layered', hint: 'Classic layers' },
|
|
1399
|
+
],
|
|
1400
|
+
})
|
|
1263
1401
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
generateCustomArch = true
|
|
1402
|
+
if (clack.isCancel(archChoice)) handleCancel()
|
|
1403
|
+
selectedArchitecture = archChoice
|
|
1404
|
+
generateCustomArch = true
|
|
1268
1405
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
})
|
|
1406
|
+
const variantChoice = await clack.select({
|
|
1407
|
+
message: 'Variant?',
|
|
1408
|
+
options: [
|
|
1409
|
+
{ value: 'full', label: 'Full', hint: 'All layers — established teams' },
|
|
1410
|
+
{ value: 'lite', label: 'Simplified', hint: 'Fewer layers — smaller teams' },
|
|
1411
|
+
],
|
|
1412
|
+
})
|
|
1277
1413
|
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
selectedArchitecture = 'modular'
|
|
1283
|
-
selectedArchVariant = 'full'
|
|
1414
|
+
if (clack.isCancel(variantChoice)) handleCancel()
|
|
1415
|
+
selectedArchVariant = variantChoice
|
|
1416
|
+
}
|
|
1417
|
+
// archAction === 'default': keep defaults
|
|
1284
1418
|
}
|
|
1285
|
-
// archAction === 'skip': installArch remains false
|
|
1286
1419
|
|
|
1287
|
-
// ── Install
|
|
1420
|
+
// ── Install ─────────────────────────────────────────
|
|
1288
1421
|
|
|
1289
|
-
const
|
|
1422
|
+
const defaultPack = isNone ? 'react' : framework
|
|
1423
|
+
const packDir = join(ROOT, 'packs', defaultPack)
|
|
1290
1424
|
const agentsSource = mode === 'lite' ? join(packDir, 'agents-lite') : join(packDir, 'agents')
|
|
1291
1425
|
const skillsSource = join(packDir, 'skills')
|
|
1292
|
-
const
|
|
1293
|
-
const claudeSource = join(packDir, 'CLAUDE.md')
|
|
1426
|
+
const claudeSource = isNone ? join(ROOT, 'CLAUDE.md') : join(packDir, 'CLAUDE.md')
|
|
1294
1427
|
|
|
1295
1428
|
const installGlobal = installScope === 'global'
|
|
1296
1429
|
const agentsDest = installGlobal
|
|
@@ -1298,15 +1431,13 @@ async function main() {
|
|
|
1298
1431
|
: join(cwd, '.claude', 'agents')
|
|
1299
1432
|
mkdirSync(agentsDest, { recursive: true })
|
|
1300
1433
|
|
|
1301
|
-
//
|
|
1302
|
-
const agentsLabel = installGlobal ? '~/.claude/agents/' : '.claude/agents/'
|
|
1434
|
+
// Handle existing agents
|
|
1303
1435
|
const existingAgents = detectExistingAgents(agentsDest)
|
|
1304
1436
|
let shouldOverwrite = forceMode
|
|
1305
1437
|
|
|
1306
1438
|
if (existingAgents.length > 0 && !forceMode) {
|
|
1307
|
-
clack.log.warn(`Existing agents detected in ${agentsLabel} (${existingAgents.length} files)`)
|
|
1308
1439
|
const overwriteChoice = await clack.confirm({
|
|
1309
|
-
message:
|
|
1440
|
+
message: `${existingAgents.length} existing agents found. Overwrite?`,
|
|
1310
1441
|
initialValue: false,
|
|
1311
1442
|
})
|
|
1312
1443
|
if (clack.isCancel(overwriteChoice)) handleCancel()
|
|
@@ -1314,100 +1445,94 @@ async function main() {
|
|
|
1314
1445
|
}
|
|
1315
1446
|
|
|
1316
1447
|
const s = clack.spinner()
|
|
1317
|
-
|
|
1318
|
-
s.start('Installing new agents and skills (preserving existing)...')
|
|
1319
|
-
} else {
|
|
1320
|
-
s.start('Installing agents and skills...')
|
|
1321
|
-
}
|
|
1448
|
+
s.start('Installing agents, skills, and platform configs...')
|
|
1322
1449
|
|
|
1323
1450
|
// Install pack agents
|
|
1324
|
-
if (
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
// Install starter agent
|
|
1331
|
-
if (installStarter) {
|
|
1332
|
-
const starterFile = mode === 'lite' ? 'starter-lite.md' : 'starter.md'
|
|
1333
|
-
const starterSource = join(ROOT, 'agents', starterFile)
|
|
1334
|
-
const starterDest = join(agentsDest, 'starter.md')
|
|
1335
|
-
if (existsSync(starterSource) && (shouldOverwrite || !existsSync(starterDest))) {
|
|
1336
|
-
cpSync(starterSource, starterDest)
|
|
1451
|
+
if (existsSync(agentsSource)) {
|
|
1452
|
+
if (shouldOverwrite) {
|
|
1453
|
+
copyDir(agentsSource, agentsDest)
|
|
1454
|
+
} else {
|
|
1455
|
+
copyNewOnly(agentsSource, agentsDest)
|
|
1337
1456
|
}
|
|
1338
1457
|
}
|
|
1339
1458
|
|
|
1340
|
-
// Install
|
|
1459
|
+
// Install all agent groups
|
|
1460
|
+
const allAgentNames = []
|
|
1461
|
+
|
|
1462
|
+
if (installStarter) allAgentNames.push('starter')
|
|
1463
|
+
|
|
1341
1464
|
if (installWorkflow) {
|
|
1342
|
-
|
|
1343
|
-
for (const name of workflowNames) {
|
|
1344
|
-
const suffix = mode === 'lite' ? '-lite.md' : '.md'
|
|
1345
|
-
const source = join(ROOT, 'agents', `${name}${suffix}`)
|
|
1346
|
-
const dest = join(agentsDest, `${name}.md`)
|
|
1347
|
-
if (existsSync(source) && (shouldOverwrite || !existsSync(dest))) {
|
|
1348
|
-
cpSync(source, dest)
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1465
|
+
allAgentNames.push('planner', 'executor', 'tdd', 'debugger', 'pair', 'analyst', 'orchestrator', 'scout', 'memory')
|
|
1351
1466
|
}
|
|
1352
1467
|
|
|
1353
|
-
// Install specialist agents
|
|
1354
1468
|
if (installSpecialists) {
|
|
1355
|
-
|
|
1469
|
+
allAgentNames.push(
|
|
1356
1470
|
'api', 'perf', 'i18n', 'docs', 'refactor', 'deps',
|
|
1357
1471
|
'explorer', 'finance', 'cloud', 'security', 'designer', 'data',
|
|
1358
|
-
'devops', 'tester', 'legal', 'architect', 'ripple'
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1472
|
+
'devops', 'tester', 'legal', 'architect', 'ripple', 'sentry-triage'
|
|
1473
|
+
)
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
if (installBusiness) {
|
|
1477
|
+
allAgentNames.push('marketing', 'product', 'support')
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
for (const name of allAgentNames) {
|
|
1481
|
+
const suffix = mode === 'lite' ? '-lite.md' : '.md'
|
|
1482
|
+
const source = join(ROOT, 'agents', `${name}${suffix}`)
|
|
1483
|
+
const dest = join(agentsDest, `${name}.md`)
|
|
1484
|
+
if (existsSync(source) && (shouldOverwrite || !existsSync(dest))) {
|
|
1485
|
+
cpSync(source, dest)
|
|
1367
1486
|
}
|
|
1368
1487
|
}
|
|
1369
1488
|
|
|
1370
|
-
// Install skills
|
|
1489
|
+
// Install skills
|
|
1371
1490
|
const skillsDest = join(cwd, '.claude', 'skills')
|
|
1372
1491
|
mkdirSync(skillsDest, { recursive: true })
|
|
1373
|
-
let skillCount =
|
|
1374
|
-
|
|
1375
|
-
|
|
1492
|
+
let skillCount = 0
|
|
1493
|
+
if (existsSync(skillsSource)) {
|
|
1494
|
+
skillCount = shouldOverwrite
|
|
1495
|
+
? copyDir(skillsSource, skillsDest)
|
|
1496
|
+
: copyNewOnly(skillsSource, skillsDest)
|
|
1497
|
+
}
|
|
1376
1498
|
|
|
1377
|
-
// Install generic skills
|
|
1378
1499
|
const genericSkillsSource = join(ROOT, 'skills')
|
|
1379
1500
|
if (existsSync(genericSkillsSource)) {
|
|
1380
|
-
|
|
1501
|
+
skillCount += shouldOverwrite
|
|
1381
1502
|
? copyDir(genericSkillsSource, skillsDest)
|
|
1382
1503
|
: copyNewOnly(genericSkillsSource, skillsDest)
|
|
1383
|
-
skillCount += genericSkillCount
|
|
1384
1504
|
}
|
|
1385
1505
|
|
|
1386
|
-
// Install native hooks (
|
|
1506
|
+
// Install native hooks (defaults: security-guard, auto-dispatch, session-context)
|
|
1387
1507
|
let nativeHooksInstalled = 0
|
|
1388
1508
|
if (selectedHooks.length > 0) {
|
|
1389
1509
|
nativeHooksInstalled = setupNativeHooks(cwd, selectedHooks)
|
|
1390
1510
|
}
|
|
1391
1511
|
|
|
1392
|
-
// Install ARCHITECTURE.md
|
|
1512
|
+
// Install ARCHITECTURE.md
|
|
1393
1513
|
const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
|
|
1394
1514
|
let archInstalled = false
|
|
1395
1515
|
if (installArch) {
|
|
1396
1516
|
if (generateCustomArch) {
|
|
1397
|
-
// Generate architecture guide for the selected pattern + framework + variant
|
|
1398
1517
|
const guide = generateArchitectureGuide({
|
|
1399
1518
|
architecture: selectedArchitecture,
|
|
1400
|
-
framework,
|
|
1519
|
+
framework: defaultPack,
|
|
1401
1520
|
variant: selectedArchVariant,
|
|
1402
1521
|
nextjsRouter: archDetection.nextjsRouter,
|
|
1403
1522
|
})
|
|
1404
1523
|
mkdirSync(dirname(archDest), { recursive: true })
|
|
1405
1524
|
writeFileSync(archDest, guide)
|
|
1406
1525
|
archInstalled = true
|
|
1407
|
-
} else if (!existsSync(archDest)
|
|
1408
|
-
//
|
|
1526
|
+
} else if (!existsSync(archDest)) {
|
|
1527
|
+
// Default: generate Modular architecture
|
|
1528
|
+
const guide = generateArchitectureGuide({
|
|
1529
|
+
architecture: 'modular',
|
|
1530
|
+
framework: defaultPack,
|
|
1531
|
+
variant: 'full',
|
|
1532
|
+
nextjsRouter: archDetection.nextjsRouter,
|
|
1533
|
+
})
|
|
1409
1534
|
mkdirSync(dirname(archDest), { recursive: true })
|
|
1410
|
-
|
|
1535
|
+
writeFileSync(archDest, guide)
|
|
1411
1536
|
archInstalled = true
|
|
1412
1537
|
}
|
|
1413
1538
|
}
|
|
@@ -1415,46 +1540,66 @@ async function main() {
|
|
|
1415
1540
|
// Install CLAUDE.md
|
|
1416
1541
|
const claudeDest = join(cwd, 'CLAUDE.md')
|
|
1417
1542
|
let claudeInstalled = false
|
|
1418
|
-
if (!existsSync(claudeDest)
|
|
1419
|
-
|
|
1420
|
-
|
|
1543
|
+
if (!existsSync(claudeDest)) {
|
|
1544
|
+
if (claudeSource && existsSync(claudeSource)) {
|
|
1545
|
+
cpSync(claudeSource, claudeDest)
|
|
1546
|
+
claudeInstalled = true
|
|
1547
|
+
} else {
|
|
1548
|
+
const rootClaude = join(ROOT, 'CLAUDE.md')
|
|
1549
|
+
if (existsSync(rootClaude)) {
|
|
1550
|
+
cpSync(rootClaude, claudeDest)
|
|
1551
|
+
claudeInstalled = true
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1421
1554
|
}
|
|
1422
1555
|
|
|
1556
|
+
// ── Setup platform configs ─────────────────────────
|
|
1557
|
+
|
|
1558
|
+
const extraPlatforms = detectedPlatforms.filter(p => p.id !== 'claude-code')
|
|
1559
|
+
const platformResults = extraPlatforms.length > 0
|
|
1560
|
+
? setupPlatformConfigs(cwd, extraPlatforms, { framework: defaultPack, version: pkg.version })
|
|
1561
|
+
: []
|
|
1562
|
+
|
|
1423
1563
|
s.stop('Installation complete')
|
|
1424
1564
|
|
|
1425
1565
|
// ── Summary ────────────────────────────────────────
|
|
1426
1566
|
|
|
1427
|
-
const
|
|
1428
|
-
const packLabel = packLabels[framework] || framework
|
|
1567
|
+
const installedAgentNames = getAgentNames(agentsDest)
|
|
1568
|
+
const packLabel = isNone ? 'Universal' : (packLabels[framework] || framework)
|
|
1429
1569
|
|
|
1430
1570
|
const summaryLines = []
|
|
1431
|
-
|
|
1432
|
-
if (skillCount > 0) summaryLines.push(
|
|
1433
|
-
if (nativeHooksInstalled > 0) summaryLines.push(
|
|
1571
|
+
summaryLines.push(`${BOLD}${installedAgentNames.length} agents${NC} installed`)
|
|
1572
|
+
if (skillCount > 0) summaryLines.push(`${BOLD}${skillCount} skills${NC} installed`)
|
|
1573
|
+
if (nativeHooksInstalled > 0) summaryLines.push(`${BOLD}${nativeHooksInstalled} native hooks${NC} configured`)
|
|
1434
1574
|
if (archInstalled) {
|
|
1435
1575
|
const archLabel = ARCHITECTURE_PATTERNS[selectedArchitecture]?.name || selectedArchitecture
|
|
1436
1576
|
const varLabel = selectedArchVariant === 'lite' ? ' (Simplified)' : ''
|
|
1437
|
-
summaryLines.push(
|
|
1577
|
+
summaryLines.push(`${GREEN}✓${NC} docs/ARCHITECTURE.md (${archLabel}${varLabel})`)
|
|
1438
1578
|
}
|
|
1439
|
-
if (claudeInstalled) summaryLines.push(
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1579
|
+
if (claudeInstalled) summaryLines.push(`${GREEN}✓${NC} CLAUDE.md`)
|
|
1580
|
+
|
|
1581
|
+
// Platform results
|
|
1582
|
+
summaryLines.push('')
|
|
1583
|
+
summaryLines.push(`${BOLD}Platforms:${NC}`)
|
|
1584
|
+
summaryLines.push(` ${GREEN}✓${NC} Claude Code → .claude/agents/`)
|
|
1585
|
+
for (const result of platformResults) {
|
|
1586
|
+
summaryLines.push(` ${GREEN}✓${NC} ${result.platform} → ${result.path}`)
|
|
1446
1587
|
}
|
|
1447
1588
|
|
|
1448
1589
|
if (existingAgents.length > 0 && !shouldOverwrite) {
|
|
1449
|
-
|
|
1590
|
+
summaryLines.push('')
|
|
1591
|
+
summaryLines.push(`${DIM}${existingAgents.length} existing agent(s) preserved. Use --force to overwrite.${NC}`)
|
|
1450
1592
|
}
|
|
1451
1593
|
|
|
1594
|
+
const scopeLabel = installGlobal ? 'Global' : 'Project'
|
|
1595
|
+
clack.note(summaryLines.join('\n'), `${packLabel} · ${mode === 'full' ? 'Full' : 'Lite'} · ${scopeLabel}`)
|
|
1596
|
+
|
|
1452
1597
|
// Getting started
|
|
1453
1598
|
const installedSkills = existsSync(skillsDest)
|
|
1454
1599
|
? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
|
|
1455
1600
|
: []
|
|
1456
1601
|
|
|
1457
|
-
clack.note(buildGettingStarted(
|
|
1602
|
+
clack.note(buildGettingStarted(installedAgentNames, installedSkills, archInstalled, isNone), 'Getting started')
|
|
1458
1603
|
|
|
1459
1604
|
if (mode === 'lite') {
|
|
1460
1605
|
clack.log.info(`${DIM}Lite mode: agents run on Haiku (lower cost, faster).${NC}`)
|