specialist-agent 2.10.0 → 2.11.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/.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 +466 -343
- 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,39 +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()
|
|
969
|
-
if (!existsSync(join(cwd, 'package.json'))) {
|
|
970
|
-
clack.log.warn('No package.json found in current directory.')
|
|
971
|
-
|
|
972
|
-
const createPkg = await clack.confirm({
|
|
973
|
-
message: 'Create a package.json to initialize this project?',
|
|
974
|
-
initialValue: true,
|
|
975
|
-
})
|
|
976
|
-
|
|
977
|
-
if (clack.isCancel(createPkg)) handleCancel()
|
|
978
1150
|
|
|
979
|
-
|
|
980
|
-
clack.cancel('Run this command from the root of your project.')
|
|
981
|
-
process.exit(1)
|
|
982
|
-
}
|
|
1151
|
+
// ── Auto-detect everything ──────────────────────────
|
|
983
1152
|
|
|
984
|
-
|
|
985
|
-
writeFileSync(
|
|
986
|
-
join(cwd, 'package.json'),
|
|
987
|
-
JSON.stringify({ name: dirName, version: '0.1.0', private: true }, null, 2) + '\n'
|
|
988
|
-
)
|
|
989
|
-
clack.log.success('package.json created')
|
|
990
|
-
}
|
|
1153
|
+
// package.json is optional — init continues without it
|
|
991
1154
|
|
|
992
|
-
//
|
|
1155
|
+
// Auto-detect framework
|
|
993
1156
|
const packs = readdirSync(join(ROOT, 'packs'), { withFileTypes: true })
|
|
994
1157
|
.filter(d => d.isDirectory())
|
|
995
1158
|
.map(d => d.name)
|
|
@@ -997,300 +1160,248 @@ async function main() {
|
|
|
997
1160
|
const packLabels = { vue: 'Vue 3', react: 'React', nextjs: 'Next.js', svelte: 'SvelteKit', angular: 'Angular', astro: 'Astro', nuxt: 'Nuxt' }
|
|
998
1161
|
|
|
999
1162
|
const detected = detectFramework(join(cwd, 'package.json'), packs)
|
|
1000
|
-
let framework
|
|
1001
1163
|
|
|
1002
|
-
|
|
1003
|
-
|
|
1164
|
+
// Auto-detect platforms
|
|
1165
|
+
const detectedPlatforms = detectPlatforms(cwd)
|
|
1166
|
+
const platformLabels = detectedPlatforms.map(p => p.label).join(', ')
|
|
1004
1167
|
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1168
|
+
// Auto-detect architecture
|
|
1169
|
+
let framework = detected
|
|
1170
|
+
const isEmptyProject = !detected
|
|
1171
|
+
const archDetection = detectProjectArchitecture(cwd, { framework: isEmptyProject ? null : framework })
|
|
1172
|
+
const detectedArch = archDetection.architecture
|
|
1173
|
+
const detectedArchName = ARCHITECTURE_PATTERNS[detectedArch]?.name || detectedArch
|
|
1011
1174
|
|
|
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
|
-
})
|
|
1175
|
+
// ── Show detection results ──────────────────────────
|
|
1022
1176
|
|
|
1023
|
-
|
|
1024
|
-
|
|
1177
|
+
const detectionLines = []
|
|
1178
|
+
if (detected) {
|
|
1179
|
+
detectionLines.push(`${GREEN}✓${NC} Framework: ${BOLD}${packLabels[detected] || detected}${NC}`)
|
|
1025
1180
|
} else {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1181
|
+
detectionLines.push(`${DIM}○ Framework: none detected (empty project)${NC}`)
|
|
1182
|
+
}
|
|
1183
|
+
detectionLines.push(`${GREEN}✓${NC} Platforms: ${BOLD}${platformLabels}${NC}`)
|
|
1184
|
+
if (detectedArch && detectedArch !== 'unstructured') {
|
|
1185
|
+
detectionLines.push(`${GREEN}✓${NC} Architecture: ${BOLD}${detectedArchName}${NC}`)
|
|
1186
|
+
}
|
|
1187
|
+
if (archDetection.monorepo) {
|
|
1188
|
+
detectionLines.push(`${GREEN}✓${NC} Monorepo: ${BOLD}${archDetection.monorepo.name}${NC} (${archDetection.monorepo.apps.length} apps/packages)`)
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
clack.note(detectionLines.join('\n'), 'Auto-detected')
|
|
1033
1192
|
|
|
1034
|
-
|
|
1193
|
+
// ── Step 1: Framework (only ask if not detected) ────
|
|
1194
|
+
|
|
1195
|
+
if (!detected) {
|
|
1196
|
+
framework = 'none'
|
|
1197
|
+
clack.log.info('No framework detected — installing universal agents.')
|
|
1198
|
+
clack.log.info(`${DIM}When you choose a framework, re-run: npx specialist-agent init${NC}`)
|
|
1035
1199
|
}
|
|
1036
1200
|
|
|
1037
|
-
|
|
1201
|
+
const isNone = framework === 'none' || !framework
|
|
1202
|
+
|
|
1203
|
+
// ── Step 2: Mode ────────────────────────────────────
|
|
1204
|
+
|
|
1038
1205
|
const mode = await clack.select({
|
|
1039
1206
|
message: 'Agent mode?',
|
|
1040
1207
|
options: [
|
|
1041
|
-
{ value: 'full', label: 'Full', hint: 'Sonnet/Opus' },
|
|
1042
|
-
{ value: 'lite', label: 'Lite', hint: 'Haiku
|
|
1208
|
+
{ value: 'full', label: 'Full', hint: 'Sonnet/Opus — best quality' },
|
|
1209
|
+
{ value: 'lite', label: 'Lite', hint: 'Haiku — lower cost, faster' },
|
|
1043
1210
|
],
|
|
1044
1211
|
})
|
|
1045
1212
|
|
|
1046
1213
|
if (clack.isCancel(mode)) handleCancel()
|
|
1047
1214
|
|
|
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()
|
|
1215
|
+
// ── Step 3: Install scope ──────────────────────────
|
|
1063
1216
|
|
|
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()
|
|
1071
|
-
|
|
1072
|
-
// 6. Install scope
|
|
1073
1217
|
const installScope = await clack.select({
|
|
1074
|
-
message: '
|
|
1218
|
+
message: 'Install scope?',
|
|
1075
1219
|
options: [
|
|
1076
|
-
{ value: 'project', label: 'This project
|
|
1077
|
-
{ value: 'global', label: '
|
|
1220
|
+
{ value: 'project', label: 'This project', hint: '.claude/agents/' },
|
|
1221
|
+
{ value: 'global', label: 'Global', hint: '~/.claude/agents/ — all projects' },
|
|
1078
1222
|
],
|
|
1079
1223
|
})
|
|
1080
1224
|
|
|
1081
1225
|
if (clack.isCancel(installScope)) handleCancel()
|
|
1082
1226
|
|
|
1083
|
-
// ──
|
|
1084
|
-
|
|
1085
|
-
let selectedHooks = []
|
|
1227
|
+
// ── Step 4: Customize (optional) ───────────────────
|
|
1086
1228
|
|
|
1087
|
-
const
|
|
1088
|
-
message: `
|
|
1089
|
-
initialValue:
|
|
1229
|
+
const customize = await clack.confirm({
|
|
1230
|
+
message: `Customize installation? ${DIM}(hooks, architecture, agent selection)${NC}`,
|
|
1231
|
+
initialValue: false,
|
|
1090
1232
|
})
|
|
1091
1233
|
|
|
1092
|
-
if (clack.isCancel(
|
|
1234
|
+
if (clack.isCancel(customize)) handleCancel()
|
|
1093
1235
|
|
|
1094
|
-
|
|
1236
|
+
let selectedHooks = ['security-guard', 'auto-dispatch', 'session-context', 'mcp-discovery']
|
|
1237
|
+
let installArch = true
|
|
1238
|
+
let selectedArchitecture = 'modular'
|
|
1239
|
+
let selectedArchVariant = 'full'
|
|
1240
|
+
let generateCustomArch = false
|
|
1241
|
+
let installStarter = true
|
|
1242
|
+
let installWorkflow = true
|
|
1243
|
+
let installSpecialists = true
|
|
1244
|
+
let installBusiness = true
|
|
1245
|
+
|
|
1246
|
+
if (customize) {
|
|
1247
|
+
// Native hooks selection
|
|
1095
1248
|
const hookChoices = await clack.multiselect({
|
|
1096
|
-
message: '
|
|
1249
|
+
message: 'Native Claude Code hooks:',
|
|
1097
1250
|
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
|
|
1251
|
+
{ value: 'security-guard', label: 'Security Guard', hint: 'Block dangerous commands', selected: true },
|
|
1252
|
+
{ value: 'auto-dispatch', label: 'Auto-Dispatch', hint: 'Suggest agents based on prompt', selected: true },
|
|
1253
|
+
{ value: 'session-context', label: 'Session Context', hint: 'Inject project state on start', selected: true },
|
|
1254
|
+
{ value: 'mcp-discovery', label: 'MCP Discovery', hint: 'Detect MCP servers and enhance agents', selected: true },
|
|
1101
1255
|
{ value: 'auto-format', label: 'Auto-Format', hint: 'Format files after Write/Edit', selected: false },
|
|
1102
1256
|
],
|
|
1103
1257
|
required: false,
|
|
1104
1258
|
})
|
|
1105
1259
|
|
|
1106
|
-
if (!clack.isCancel(hookChoices)
|
|
1260
|
+
if (!clack.isCancel(hookChoices)) {
|
|
1107
1261
|
selectedHooks = hookChoices
|
|
1108
1262
|
}
|
|
1109
|
-
}
|
|
1110
1263
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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
|
-
|
|
1132
|
-
// Ask about architecture
|
|
1133
|
-
const archAction = await clack.select({
|
|
1134
|
-
message: 'Architecture guide for your project?',
|
|
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?',
|
|
1264
|
+
// Agent group selection
|
|
1265
|
+
const agentGroups = await clack.multiselect({
|
|
1266
|
+
message: 'Agent groups to install:',
|
|
1165
1267
|
options: [
|
|
1166
|
-
{ value: '
|
|
1167
|
-
{ value: '
|
|
1168
|
-
{ value: '
|
|
1169
|
-
{ value: '
|
|
1268
|
+
{ value: 'core', label: 'Core', hint: '@builder, @reviewer, @doctor, @migrator, @starter', selected: true },
|
|
1269
|
+
{ value: 'workflow', label: 'Workflow', hint: '@planner, @executor, @tdd, @debugger, @pair, @analyst, @orchestrator', selected: true },
|
|
1270
|
+
{ value: 'specialist', label: 'Specialist', hint: '@api, @perf, @security, @finance, @data, @devops, @architect, ...', selected: true },
|
|
1271
|
+
{ value: 'business', label: 'Business', hint: '@marketing, @product, @support', selected: true },
|
|
1170
1272
|
],
|
|
1273
|
+
required: true,
|
|
1171
1274
|
})
|
|
1172
1275
|
|
|
1173
|
-
if (clack.isCancel(
|
|
1174
|
-
|
|
1175
|
-
|
|
1276
|
+
if (!clack.isCancel(agentGroups)) {
|
|
1277
|
+
installStarter = agentGroups.includes('core')
|
|
1278
|
+
installWorkflow = agentGroups.includes('workflow')
|
|
1279
|
+
installSpecialists = agentGroups.includes('specialist')
|
|
1280
|
+
installBusiness = agentGroups.includes('business')
|
|
1281
|
+
}
|
|
1176
1282
|
|
|
1177
|
-
//
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
:
|
|
1182
|
-
: ''
|
|
1183
|
-
|
|
1184
|
-
|
|
1283
|
+
// Architecture selection
|
|
1284
|
+
const archAction = await clack.select({
|
|
1285
|
+
message: 'Architecture guide?',
|
|
1286
|
+
options: [
|
|
1287
|
+
{ value: 'default', label: 'Modular (default)', hint: 'Feature-based — recommended for most projects' },
|
|
1288
|
+
{ value: 'choose', label: 'Choose pattern', hint: 'Clean, Hexagonal, DDD, CQRS, ...' },
|
|
1289
|
+
{ value: 'detect', label: 'Detect & suggest', hint: 'Analyze your project and recommend' },
|
|
1290
|
+
{ value: 'skip', label: 'Skip', hint: 'No architecture guide' },
|
|
1291
|
+
],
|
|
1292
|
+
})
|
|
1185
1293
|
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1294
|
+
if (clack.isCancel(archAction)) handleCancel()
|
|
1295
|
+
|
|
1296
|
+
if (archAction === 'skip') {
|
|
1297
|
+
installArch = false
|
|
1298
|
+
} else if (archAction === 'detect') {
|
|
1299
|
+
const teamSize = await clack.select({
|
|
1300
|
+
message: 'Team size?',
|
|
1301
|
+
options: [
|
|
1302
|
+
{ value: 'small', label: '1-3 developers' },
|
|
1303
|
+
{ value: 'medium', label: '3-10 developers' },
|
|
1304
|
+
{ value: 'large', label: '10-20 developers' },
|
|
1305
|
+
{ value: 'enterprise', label: '20+ developers' },
|
|
1306
|
+
],
|
|
1190
1307
|
})
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
recOptions.push({ value: 'skip', label: 'Skip', hint: 'No architecture guide' })
|
|
1194
1308
|
|
|
1195
|
-
|
|
1196
|
-
clack.log.info(recs.reason)
|
|
1197
|
-
}
|
|
1309
|
+
if (clack.isCancel(teamSize)) handleCancel()
|
|
1198
1310
|
|
|
1199
|
-
|
|
1200
|
-
message: 'Which architecture to adopt?',
|
|
1201
|
-
options: recOptions,
|
|
1202
|
-
})
|
|
1311
|
+
const recs = getRecommendations(archDetection, { teamSize })
|
|
1203
1312
|
|
|
1204
|
-
|
|
1313
|
+
const recOptions = []
|
|
1314
|
+
for (const rec of recs.recommendations) {
|
|
1315
|
+
const tagPrefix = rec.tag === 'recommended' ? '[RECOMMENDED] '
|
|
1316
|
+
: rec.tag === 'backend-recommended' ? '[BACKEND] '
|
|
1317
|
+
: ''
|
|
1318
|
+
const effortNote = rec.migration ? ` (effort: ${rec.migration.effort})` : ''
|
|
1319
|
+
const sameNote = rec.isSameArch ? ' (current)' : ''
|
|
1205
1320
|
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1321
|
+
recOptions.push({
|
|
1322
|
+
value: rec.id,
|
|
1323
|
+
label: `${tagPrefix}${rec.name}${sameNote}`,
|
|
1324
|
+
hint: `${rec.description.slice(0, 60)}${effortNote}`,
|
|
1325
|
+
})
|
|
1326
|
+
}
|
|
1210
1327
|
|
|
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
|
-
}))
|
|
1328
|
+
recOptions.push({ value: 'skip', label: 'Skip', hint: 'No architecture guide' })
|
|
1219
1329
|
|
|
1220
|
-
|
|
1221
|
-
message: 'Which variant?',
|
|
1222
|
-
options: variantOptions,
|
|
1223
|
-
})
|
|
1330
|
+
if (recs.reason) clack.log.info(recs.reason)
|
|
1224
1331
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1332
|
+
const archChoice = await clack.select({
|
|
1333
|
+
message: 'Which architecture?',
|
|
1334
|
+
options: recOptions,
|
|
1335
|
+
})
|
|
1228
1336
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
if (
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
)
|
|
1236
|
-
|
|
1337
|
+
if (clack.isCancel(archChoice)) handleCancel()
|
|
1338
|
+
|
|
1339
|
+
if (archChoice !== 'skip') {
|
|
1340
|
+
selectedArchitecture = archChoice
|
|
1341
|
+
generateCustomArch = true
|
|
1342
|
+
|
|
1343
|
+
const chosenRec = recs.recommendations.find(r => r.id === archChoice)
|
|
1344
|
+
if (chosenRec?.variants.length > 0) {
|
|
1345
|
+
const variantChoice = await clack.select({
|
|
1346
|
+
message: 'Variant?',
|
|
1347
|
+
options: chosenRec.variants.map(v => ({
|
|
1348
|
+
value: v.id,
|
|
1349
|
+
label: v.name,
|
|
1350
|
+
hint: v.description.slice(0, 70),
|
|
1351
|
+
})),
|
|
1352
|
+
})
|
|
1353
|
+
|
|
1354
|
+
if (clack.isCancel(variantChoice)) handleCancel()
|
|
1355
|
+
selectedArchVariant = variantChoice
|
|
1356
|
+
}
|
|
1237
1357
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1358
|
+
if (chosenRec?.migration && !chosenRec.isSameArch) {
|
|
1359
|
+
clack.log.info(`${DIM}After install, use /migrate-architecture to apply.${NC}`)
|
|
1360
|
+
}
|
|
1361
|
+
} else {
|
|
1362
|
+
installArch = false
|
|
1243
1363
|
}
|
|
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
|
-
})
|
|
1364
|
+
} else if (archAction === 'choose') {
|
|
1365
|
+
const archChoice = await clack.select({
|
|
1366
|
+
message: 'Architecture pattern?',
|
|
1367
|
+
options: [
|
|
1368
|
+
{ value: 'modular', label: 'Modular (Feature-Based)', hint: 'Recommended for most projects' },
|
|
1369
|
+
{ value: 'clean', label: 'Clean Architecture', hint: 'Domain > Use Cases > Adapters' },
|
|
1370
|
+
{ value: 'hexagonal', label: 'Hexagonal (Ports & Adapters)', hint: 'Core isolated' },
|
|
1371
|
+
{ value: 'fsd', label: 'Feature-Sliced Design', hint: 'Strict layered' },
|
|
1372
|
+
{ value: 'ddd', label: 'Domain-Driven Design', hint: 'Bounded contexts' },
|
|
1373
|
+
{ value: 'modular-monolith', label: 'Modular Monolith', hint: 'Backend/fullstack' },
|
|
1374
|
+
{ value: 'atomic', label: 'Atomic Design', hint: 'Component granularity' },
|
|
1375
|
+
{ value: 'cqrs', label: 'CQRS', hint: 'Command/query separation' },
|
|
1376
|
+
{ value: 'mvc', label: 'MVC / Layered', hint: 'Classic layers' },
|
|
1377
|
+
],
|
|
1378
|
+
})
|
|
1263
1379
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
generateCustomArch = true
|
|
1380
|
+
if (clack.isCancel(archChoice)) handleCancel()
|
|
1381
|
+
selectedArchitecture = archChoice
|
|
1382
|
+
generateCustomArch = true
|
|
1268
1383
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
})
|
|
1384
|
+
const variantChoice = await clack.select({
|
|
1385
|
+
message: 'Variant?',
|
|
1386
|
+
options: [
|
|
1387
|
+
{ value: 'full', label: 'Full', hint: 'All layers — established teams' },
|
|
1388
|
+
{ value: 'lite', label: 'Simplified', hint: 'Fewer layers — smaller teams' },
|
|
1389
|
+
],
|
|
1390
|
+
})
|
|
1277
1391
|
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
selectedArchitecture = 'modular'
|
|
1283
|
-
selectedArchVariant = 'full'
|
|
1392
|
+
if (clack.isCancel(variantChoice)) handleCancel()
|
|
1393
|
+
selectedArchVariant = variantChoice
|
|
1394
|
+
}
|
|
1395
|
+
// archAction === 'default': keep defaults
|
|
1284
1396
|
}
|
|
1285
|
-
// archAction === 'skip': installArch remains false
|
|
1286
1397
|
|
|
1287
|
-
// ── Install
|
|
1398
|
+
// ── Install ─────────────────────────────────────────
|
|
1288
1399
|
|
|
1289
|
-
const
|
|
1400
|
+
const defaultPack = isNone ? 'react' : framework
|
|
1401
|
+
const packDir = join(ROOT, 'packs', defaultPack)
|
|
1290
1402
|
const agentsSource = mode === 'lite' ? join(packDir, 'agents-lite') : join(packDir, 'agents')
|
|
1291
1403
|
const skillsSource = join(packDir, 'skills')
|
|
1292
|
-
const
|
|
1293
|
-
const claudeSource = join(packDir, 'CLAUDE.md')
|
|
1404
|
+
const claudeSource = isNone ? join(ROOT, 'CLAUDE.md') : join(packDir, 'CLAUDE.md')
|
|
1294
1405
|
|
|
1295
1406
|
const installGlobal = installScope === 'global'
|
|
1296
1407
|
const agentsDest = installGlobal
|
|
@@ -1298,15 +1409,13 @@ async function main() {
|
|
|
1298
1409
|
: join(cwd, '.claude', 'agents')
|
|
1299
1410
|
mkdirSync(agentsDest, { recursive: true })
|
|
1300
1411
|
|
|
1301
|
-
//
|
|
1302
|
-
const agentsLabel = installGlobal ? '~/.claude/agents/' : '.claude/agents/'
|
|
1412
|
+
// Handle existing agents
|
|
1303
1413
|
const existingAgents = detectExistingAgents(agentsDest)
|
|
1304
1414
|
let shouldOverwrite = forceMode
|
|
1305
1415
|
|
|
1306
1416
|
if (existingAgents.length > 0 && !forceMode) {
|
|
1307
|
-
clack.log.warn(`Existing agents detected in ${agentsLabel} (${existingAgents.length} files)`)
|
|
1308
1417
|
const overwriteChoice = await clack.confirm({
|
|
1309
|
-
message:
|
|
1418
|
+
message: `${existingAgents.length} existing agents found. Overwrite?`,
|
|
1310
1419
|
initialValue: false,
|
|
1311
1420
|
})
|
|
1312
1421
|
if (clack.isCancel(overwriteChoice)) handleCancel()
|
|
@@ -1314,100 +1423,94 @@ async function main() {
|
|
|
1314
1423
|
}
|
|
1315
1424
|
|
|
1316
1425
|
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
|
-
}
|
|
1426
|
+
s.start('Installing agents, skills, and platform configs...')
|
|
1322
1427
|
|
|
1323
1428
|
// 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)
|
|
1429
|
+
if (existsSync(agentsSource)) {
|
|
1430
|
+
if (shouldOverwrite) {
|
|
1431
|
+
copyDir(agentsSource, agentsDest)
|
|
1432
|
+
} else {
|
|
1433
|
+
copyNewOnly(agentsSource, agentsDest)
|
|
1337
1434
|
}
|
|
1338
1435
|
}
|
|
1339
1436
|
|
|
1340
|
-
// Install
|
|
1437
|
+
// Install all agent groups
|
|
1438
|
+
const allAgentNames = []
|
|
1439
|
+
|
|
1440
|
+
if (installStarter) allAgentNames.push('starter')
|
|
1441
|
+
|
|
1341
1442
|
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
|
-
}
|
|
1443
|
+
allAgentNames.push('planner', 'executor', 'tdd', 'debugger', 'pair', 'analyst', 'orchestrator', 'scout', 'memory')
|
|
1351
1444
|
}
|
|
1352
1445
|
|
|
1353
|
-
// Install specialist agents
|
|
1354
1446
|
if (installSpecialists) {
|
|
1355
|
-
|
|
1447
|
+
allAgentNames.push(
|
|
1356
1448
|
'api', 'perf', 'i18n', 'docs', 'refactor', 'deps',
|
|
1357
1449
|
'explorer', 'finance', 'cloud', 'security', 'designer', 'data',
|
|
1358
|
-
'devops', 'tester', 'legal', 'architect', 'ripple'
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1450
|
+
'devops', 'tester', 'legal', 'architect', 'ripple', 'sentry-triage'
|
|
1451
|
+
)
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
if (installBusiness) {
|
|
1455
|
+
allAgentNames.push('marketing', 'product', 'support')
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
for (const name of allAgentNames) {
|
|
1459
|
+
const suffix = mode === 'lite' ? '-lite.md' : '.md'
|
|
1460
|
+
const source = join(ROOT, 'agents', `${name}${suffix}`)
|
|
1461
|
+
const dest = join(agentsDest, `${name}.md`)
|
|
1462
|
+
if (existsSync(source) && (shouldOverwrite || !existsSync(dest))) {
|
|
1463
|
+
cpSync(source, dest)
|
|
1367
1464
|
}
|
|
1368
1465
|
}
|
|
1369
1466
|
|
|
1370
|
-
// Install skills
|
|
1467
|
+
// Install skills
|
|
1371
1468
|
const skillsDest = join(cwd, '.claude', 'skills')
|
|
1372
1469
|
mkdirSync(skillsDest, { recursive: true })
|
|
1373
|
-
let skillCount =
|
|
1374
|
-
|
|
1375
|
-
|
|
1470
|
+
let skillCount = 0
|
|
1471
|
+
if (existsSync(skillsSource)) {
|
|
1472
|
+
skillCount = shouldOverwrite
|
|
1473
|
+
? copyDir(skillsSource, skillsDest)
|
|
1474
|
+
: copyNewOnly(skillsSource, skillsDest)
|
|
1475
|
+
}
|
|
1376
1476
|
|
|
1377
|
-
// Install generic skills
|
|
1378
1477
|
const genericSkillsSource = join(ROOT, 'skills')
|
|
1379
1478
|
if (existsSync(genericSkillsSource)) {
|
|
1380
|
-
|
|
1479
|
+
skillCount += shouldOverwrite
|
|
1381
1480
|
? copyDir(genericSkillsSource, skillsDest)
|
|
1382
1481
|
: copyNewOnly(genericSkillsSource, skillsDest)
|
|
1383
|
-
skillCount += genericSkillCount
|
|
1384
1482
|
}
|
|
1385
1483
|
|
|
1386
|
-
// Install native hooks (
|
|
1484
|
+
// Install native hooks (defaults: security-guard, auto-dispatch, session-context)
|
|
1387
1485
|
let nativeHooksInstalled = 0
|
|
1388
1486
|
if (selectedHooks.length > 0) {
|
|
1389
1487
|
nativeHooksInstalled = setupNativeHooks(cwd, selectedHooks)
|
|
1390
1488
|
}
|
|
1391
1489
|
|
|
1392
|
-
// Install ARCHITECTURE.md
|
|
1490
|
+
// Install ARCHITECTURE.md
|
|
1393
1491
|
const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
|
|
1394
1492
|
let archInstalled = false
|
|
1395
1493
|
if (installArch) {
|
|
1396
1494
|
if (generateCustomArch) {
|
|
1397
|
-
// Generate architecture guide for the selected pattern + framework + variant
|
|
1398
1495
|
const guide = generateArchitectureGuide({
|
|
1399
1496
|
architecture: selectedArchitecture,
|
|
1400
|
-
framework,
|
|
1497
|
+
framework: defaultPack,
|
|
1401
1498
|
variant: selectedArchVariant,
|
|
1402
1499
|
nextjsRouter: archDetection.nextjsRouter,
|
|
1403
1500
|
})
|
|
1404
1501
|
mkdirSync(dirname(archDest), { recursive: true })
|
|
1405
1502
|
writeFileSync(archDest, guide)
|
|
1406
1503
|
archInstalled = true
|
|
1407
|
-
} else if (!existsSync(archDest)
|
|
1408
|
-
//
|
|
1504
|
+
} else if (!existsSync(archDest)) {
|
|
1505
|
+
// Default: generate Modular architecture
|
|
1506
|
+
const guide = generateArchitectureGuide({
|
|
1507
|
+
architecture: 'modular',
|
|
1508
|
+
framework: defaultPack,
|
|
1509
|
+
variant: 'full',
|
|
1510
|
+
nextjsRouter: archDetection.nextjsRouter,
|
|
1511
|
+
})
|
|
1409
1512
|
mkdirSync(dirname(archDest), { recursive: true })
|
|
1410
|
-
|
|
1513
|
+
writeFileSync(archDest, guide)
|
|
1411
1514
|
archInstalled = true
|
|
1412
1515
|
}
|
|
1413
1516
|
}
|
|
@@ -1415,46 +1518,66 @@ async function main() {
|
|
|
1415
1518
|
// Install CLAUDE.md
|
|
1416
1519
|
const claudeDest = join(cwd, 'CLAUDE.md')
|
|
1417
1520
|
let claudeInstalled = false
|
|
1418
|
-
if (!existsSync(claudeDest)
|
|
1419
|
-
|
|
1420
|
-
|
|
1521
|
+
if (!existsSync(claudeDest)) {
|
|
1522
|
+
if (claudeSource && existsSync(claudeSource)) {
|
|
1523
|
+
cpSync(claudeSource, claudeDest)
|
|
1524
|
+
claudeInstalled = true
|
|
1525
|
+
} else {
|
|
1526
|
+
const rootClaude = join(ROOT, 'CLAUDE.md')
|
|
1527
|
+
if (existsSync(rootClaude)) {
|
|
1528
|
+
cpSync(rootClaude, claudeDest)
|
|
1529
|
+
claudeInstalled = true
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1421
1532
|
}
|
|
1422
1533
|
|
|
1534
|
+
// ── Setup platform configs ─────────────────────────
|
|
1535
|
+
|
|
1536
|
+
const extraPlatforms = detectedPlatforms.filter(p => p.id !== 'claude-code')
|
|
1537
|
+
const platformResults = extraPlatforms.length > 0
|
|
1538
|
+
? setupPlatformConfigs(cwd, extraPlatforms, { framework: defaultPack, version: pkg.version })
|
|
1539
|
+
: []
|
|
1540
|
+
|
|
1423
1541
|
s.stop('Installation complete')
|
|
1424
1542
|
|
|
1425
1543
|
// ── Summary ────────────────────────────────────────
|
|
1426
1544
|
|
|
1427
|
-
const
|
|
1428
|
-
const packLabel = packLabels[framework] || framework
|
|
1545
|
+
const installedAgentNames = getAgentNames(agentsDest)
|
|
1546
|
+
const packLabel = isNone ? 'Universal' : (packLabels[framework] || framework)
|
|
1429
1547
|
|
|
1430
1548
|
const summaryLines = []
|
|
1431
|
-
|
|
1432
|
-
if (skillCount > 0) summaryLines.push(
|
|
1433
|
-
if (nativeHooksInstalled > 0) summaryLines.push(
|
|
1549
|
+
summaryLines.push(`${BOLD}${installedAgentNames.length} agents${NC} installed`)
|
|
1550
|
+
if (skillCount > 0) summaryLines.push(`${BOLD}${skillCount} skills${NC} installed`)
|
|
1551
|
+
if (nativeHooksInstalled > 0) summaryLines.push(`${BOLD}${nativeHooksInstalled} native hooks${NC} configured`)
|
|
1434
1552
|
if (archInstalled) {
|
|
1435
1553
|
const archLabel = ARCHITECTURE_PATTERNS[selectedArchitecture]?.name || selectedArchitecture
|
|
1436
1554
|
const varLabel = selectedArchVariant === 'lite' ? ' (Simplified)' : ''
|
|
1437
|
-
summaryLines.push(
|
|
1555
|
+
summaryLines.push(`${GREEN}✓${NC} docs/ARCHITECTURE.md (${archLabel}${varLabel})`)
|
|
1438
1556
|
}
|
|
1439
|
-
if (claudeInstalled) summaryLines.push(
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1557
|
+
if (claudeInstalled) summaryLines.push(`${GREEN}✓${NC} CLAUDE.md`)
|
|
1558
|
+
|
|
1559
|
+
// Platform results
|
|
1560
|
+
summaryLines.push('')
|
|
1561
|
+
summaryLines.push(`${BOLD}Platforms:${NC}`)
|
|
1562
|
+
summaryLines.push(` ${GREEN}✓${NC} Claude Code → .claude/agents/`)
|
|
1563
|
+
for (const result of platformResults) {
|
|
1564
|
+
summaryLines.push(` ${GREEN}✓${NC} ${result.platform} → ${result.path}`)
|
|
1446
1565
|
}
|
|
1447
1566
|
|
|
1448
1567
|
if (existingAgents.length > 0 && !shouldOverwrite) {
|
|
1449
|
-
|
|
1568
|
+
summaryLines.push('')
|
|
1569
|
+
summaryLines.push(`${DIM}${existingAgents.length} existing agent(s) preserved. Use --force to overwrite.${NC}`)
|
|
1450
1570
|
}
|
|
1451
1571
|
|
|
1572
|
+
const scopeLabel = installGlobal ? 'Global' : 'Project'
|
|
1573
|
+
clack.note(summaryLines.join('\n'), `${packLabel} · ${mode === 'full' ? 'Full' : 'Lite'} · ${scopeLabel}`)
|
|
1574
|
+
|
|
1452
1575
|
// Getting started
|
|
1453
1576
|
const installedSkills = existsSync(skillsDest)
|
|
1454
1577
|
? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
|
|
1455
1578
|
: []
|
|
1456
1579
|
|
|
1457
|
-
clack.note(buildGettingStarted(
|
|
1580
|
+
clack.note(buildGettingStarted(installedAgentNames, installedSkills, archInstalled, isNone), 'Getting started')
|
|
1458
1581
|
|
|
1459
1582
|
if (mode === 'lite') {
|
|
1460
1583
|
clack.log.info(`${DIM}Lite mode: agents run on Haiku (lower cost, faster).${NC}`)
|