specialist-agent 1.6.0 → 2.0.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.
Files changed (176) hide show
  1. package/.claude-plugin/marketplace.json +77 -0
  2. package/.claude-plugin/plugin.json +43 -0
  3. package/.codex/INSTALL.md +113 -0
  4. package/.cursor-plugin/marketplace.json +9 -0
  5. package/.cursor-plugin/plugin.json +35 -0
  6. package/.opencode/INSTALL.md +123 -0
  7. package/README.md +204 -263
  8. package/agents/analyst-lite.md +48 -0
  9. package/agents/analyst.md +391 -0
  10. package/agents/api-lite.md +43 -0
  11. package/agents/api.md +145 -0
  12. package/agents/cloud-lite.md +1 -1
  13. package/agents/cloud.md +1 -1
  14. package/agents/data-lite.md +1 -1
  15. package/agents/data.md +1 -1
  16. package/agents/debugger-lite.md +46 -0
  17. package/agents/debugger.md +406 -0
  18. package/agents/deps-lite.md +41 -0
  19. package/agents/deps.md +206 -0
  20. package/agents/designer-lite.md +1 -1
  21. package/agents/designer.md +1 -1
  22. package/agents/devops-lite.md +1 -1
  23. package/agents/devops.md +1 -1
  24. package/agents/docs-lite.md +42 -0
  25. package/agents/docs.md +197 -0
  26. package/agents/executor-lite.md +61 -0
  27. package/agents/executor.md +456 -0
  28. package/agents/explorer-lite.md +1 -1
  29. package/agents/explorer.md +1 -1
  30. package/agents/finance-lite.md +1 -1
  31. package/agents/finance.md +1 -1
  32. package/agents/i18n-lite.md +44 -0
  33. package/agents/i18n.md +198 -0
  34. package/agents/legal-lite.md +1 -1
  35. package/agents/legal.md +1 -1
  36. package/agents/memory.md +240 -0
  37. package/agents/orchestrator-lite.md +40 -0
  38. package/agents/orchestrator.md +387 -0
  39. package/agents/pair-lite.md +38 -0
  40. package/agents/pair.md +308 -0
  41. package/agents/perf-lite.md +42 -0
  42. package/agents/perf.md +141 -0
  43. package/agents/planner-lite.md +59 -0
  44. package/agents/planner.md +265 -0
  45. package/agents/refactor-lite.md +42 -0
  46. package/agents/refactor.md +178 -0
  47. package/agents/scout-lite.md +37 -0
  48. package/agents/scout.md +222 -0
  49. package/agents/security-lite.md +1 -1
  50. package/agents/security.md +1 -1
  51. package/agents/starter-lite.md +1 -1
  52. package/agents/starter.md +1 -1
  53. package/agents/tdd-lite.md +43 -0
  54. package/agents/tdd.md +317 -0
  55. package/agents/tester-lite.md +1 -1
  56. package/agents/tester.md +1 -1
  57. package/cli/index.mjs +636 -15
  58. package/hooks/after-review.mjs +130 -0
  59. package/hooks/after-task.mjs +117 -0
  60. package/hooks/before-plan.mjs +155 -0
  61. package/hooks/before-review.mjs +139 -0
  62. package/hooks/hooks.json +81 -0
  63. package/hooks/native/auto-dispatch.mjs +197 -0
  64. package/hooks/native/auto-format.mjs +193 -0
  65. package/hooks/native/security-config.json +31 -0
  66. package/hooks/native/security-guard.mjs +267 -0
  67. package/hooks/native/session-context.mjs +136 -0
  68. package/hooks/native/settings-template.json +50 -0
  69. package/hooks/native/utils.mjs +62 -0
  70. package/hooks/on-error.mjs +129 -0
  71. package/hooks/session-end.mjs +185 -0
  72. package/hooks/session-start.mjs +154 -0
  73. package/package.json +16 -3
  74. package/packs/nextjs/agents/builder.md +24 -1
  75. package/packs/nextjs/agents/doctor.md +70 -4
  76. package/packs/nextjs/agents/migrator.md +24 -1
  77. package/packs/nextjs/agents/reviewer.md +93 -3
  78. package/packs/nextjs/agents-lite/builder.md +1 -1
  79. package/packs/nextjs/agents-lite/doctor.md +1 -1
  80. package/packs/nextjs/agents-lite/migrator.md +1 -1
  81. package/packs/nextjs/agents-lite/reviewer.md +1 -1
  82. package/packs/nextjs/skills/dev-create-component/SKILL.md +1 -1
  83. package/packs/nextjs/skills/dev-create-hook/SKILL.md +1 -1
  84. package/packs/nextjs/skills/dev-create-module/SKILL.md +1 -1
  85. package/packs/nextjs/skills/dev-create-service/SKILL.md +1 -1
  86. package/packs/nextjs/skills/dev-create-test/SKILL.md +1 -1
  87. package/packs/nextjs/skills/dev-generate-types/SKILL.md +1 -1
  88. package/packs/nextjs/skills/docs-onboard/SKILL.md +1 -1
  89. package/packs/nextjs/skills/migration-migrate-component/SKILL.md +1 -1
  90. package/packs/nextjs/skills/migration-migrate-module/SKILL.md +1 -1
  91. package/packs/nextjs/skills/review-check-architecture/SKILL.md +1 -1
  92. package/packs/nextjs/skills/review-fix-violations/SKILL.md +1 -1
  93. package/packs/nextjs/skills/review-review/SKILL.md +1 -1
  94. package/packs/react/agents/builder.md +24 -1
  95. package/packs/react/agents/doctor.md +107 -13
  96. package/packs/react/agents/migrator.md +24 -1
  97. package/packs/react/agents/reviewer.md +113 -9
  98. package/packs/react/agents-lite/builder.md +1 -1
  99. package/packs/react/agents-lite/doctor.md +1 -1
  100. package/packs/react/agents-lite/migrator.md +1 -1
  101. package/packs/react/agents-lite/reviewer.md +1 -1
  102. package/packs/react/skills/dev-create-component/SKILL.md +1 -1
  103. package/packs/react/skills/dev-create-hook/SKILL.md +1 -1
  104. package/packs/react/skills/dev-create-module/SKILL.md +1 -1
  105. package/packs/react/skills/dev-create-service/SKILL.md +1 -1
  106. package/packs/react/skills/dev-create-test/SKILL.md +1 -1
  107. package/packs/react/skills/dev-generate-types/SKILL.md +1 -1
  108. package/packs/react/skills/docs-onboard/SKILL.md +1 -1
  109. package/packs/react/skills/migration-migrate-component/SKILL.md +1 -1
  110. package/packs/react/skills/migration-migrate-module/SKILL.md +1 -1
  111. package/packs/react/skills/review-check-architecture/SKILL.md +1 -1
  112. package/packs/react/skills/review-fix-violations/SKILL.md +1 -1
  113. package/packs/react/skills/review-review/SKILL.md +1 -1
  114. package/packs/svelte/agents/builder.md +24 -1
  115. package/packs/svelte/agents/doctor.md +70 -4
  116. package/packs/svelte/agents/migrator.md +24 -1
  117. package/packs/svelte/agents/reviewer.md +93 -3
  118. package/packs/svelte/agents-lite/builder.md +1 -1
  119. package/packs/svelte/agents-lite/doctor.md +1 -1
  120. package/packs/svelte/agents-lite/migrator.md +1 -1
  121. package/packs/svelte/agents-lite/reviewer.md +1 -1
  122. package/packs/svelte/skills/dev-create-component/SKILL.md +1 -1
  123. package/packs/svelte/skills/dev-create-module/SKILL.md +1 -1
  124. package/packs/svelte/skills/dev-create-service/SKILL.md +1 -1
  125. package/packs/svelte/skills/dev-create-store/SKILL.md +1 -1
  126. package/packs/svelte/skills/dev-create-test/SKILL.md +1 -1
  127. package/packs/svelte/skills/dev-generate-types/SKILL.md +1 -1
  128. package/packs/svelte/skills/docs-onboard/SKILL.md +1 -1
  129. package/packs/svelte/skills/migration-migrate-component/SKILL.md +1 -1
  130. package/packs/svelte/skills/migration-migrate-module/SKILL.md +1 -1
  131. package/packs/svelte/skills/review-check-architecture/SKILL.md +1 -1
  132. package/packs/svelte/skills/review-fix-violations/SKILL.md +1 -1
  133. package/packs/svelte/skills/review-review/SKILL.md +1 -1
  134. package/packs/vue/agents/builder.md +24 -1
  135. package/packs/vue/agents/doctor.md +107 -13
  136. package/packs/vue/agents/migrator.md +24 -1
  137. package/packs/vue/agents/reviewer.md +113 -9
  138. package/packs/vue/agents-lite/builder.md +1 -1
  139. package/packs/vue/agents-lite/doctor.md +1 -1
  140. package/packs/vue/agents-lite/migrator.md +1 -1
  141. package/packs/vue/agents-lite/reviewer.md +1 -1
  142. package/packs/vue/skills/dev-create-component/SKILL.md +1 -1
  143. package/packs/vue/skills/dev-create-composable/SKILL.md +1 -1
  144. package/packs/vue/skills/dev-create-module/SKILL.md +1 -1
  145. package/packs/vue/skills/dev-create-service/SKILL.md +1 -1
  146. package/packs/vue/skills/dev-create-test/SKILL.md +1 -1
  147. package/packs/vue/skills/dev-generate-types/SKILL.md +1 -1
  148. package/packs/vue/skills/docs-onboard/SKILL.md +1 -1
  149. package/packs/vue/skills/migration-migrate-component/SKILL.md +1 -1
  150. package/packs/vue/skills/migration-migrate-module/SKILL.md +1 -1
  151. package/packs/vue/skills/review-check-architecture/SKILL.md +1 -1
  152. package/packs/vue/skills/review-fix-violations/SKILL.md +1 -1
  153. package/packs/vue/skills/review-review/SKILL.md +1 -1
  154. package/skills/audit/SKILL.md +169 -0
  155. package/skills/brainstorm/SKILL.md +245 -0
  156. package/skills/checkpoint/SKILL.md +209 -0
  157. package/skills/debug/SKILL.md +210 -0
  158. package/skills/estimate/SKILL.md +145 -0
  159. package/skills/finish/SKILL.md +211 -0
  160. package/skills/health/SKILL.md +242 -0
  161. package/skills/learn/SKILL.md +260 -0
  162. package/skills/migrate-framework/SKILL.md +172 -0
  163. package/skills/onboard/SKILL.md +168 -0
  164. package/skills/plan/SKILL.md +132 -0
  165. package/skills/recall/SKILL.md +150 -0
  166. package/skills/remember/SKILL.md +158 -0
  167. package/skills/tdd/SKILL.md +156 -0
  168. package/skills/tutorial/SKILL.md +346 -0
  169. package/skills/verify/SKILL.md +168 -0
  170. package/skills/worktree/SKILL.md +168 -0
  171. package/skills/write-skill/SKILL.md +213 -0
  172. package/templates/industry/ecommerce.md +127 -0
  173. package/templates/industry/fintech.md +161 -0
  174. package/templates/industry/saas.md +134 -0
  175. package/templates/session-memory.json +48 -0
  176. package/templates/skill-template/SKILL.md +90 -0
package/cli/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import * as clack from '@clack/prompts'
4
- import { existsSync, mkdirSync, cpSync, readdirSync, readFileSync, writeFileSync } from 'fs'
4
+ import { existsSync, mkdirSync, cpSync, rmSync, readdirSync, readFileSync, writeFileSync } from 'fs'
5
+ import { execSync } from 'child_process'
5
6
  import { join, dirname, resolve } from 'path'
6
7
  import { fileURLToPath } from 'url'
7
8
  import { homedir } from 'os'
@@ -11,6 +12,8 @@ const __dirname = dirname(__filename)
11
12
  const ROOT = resolve(__dirname, '..')
12
13
 
13
14
  const YELLOW = '\x1b[33m'
15
+ const RED = '\x1b[31m'
16
+ const GREEN = '\x1b[32m'
14
17
  const BOLD = '\x1b[1m'
15
18
  const DIM = '\x1b[2m'
16
19
  const NC = '\x1b[0m'
@@ -71,6 +74,89 @@ function handleCancel() {
71
74
  process.exit(0)
72
75
  }
73
76
 
77
+ // ── Native Hooks Setup ──────────────────────────────────
78
+
79
+ const HOOK_EVENT_MAP = {
80
+ 'security-guard': 'PreToolUse',
81
+ 'auto-dispatch': 'UserPromptSubmit',
82
+ 'session-context': 'SessionStart',
83
+ 'auto-format': 'PostToolUse',
84
+ }
85
+
86
+ function setupNativeHooks(cwd, selectedHooks) {
87
+ // 1. Copy hook scripts to project
88
+ const nativeSource = join(ROOT, 'hooks', 'native')
89
+ const nativeDest = join(cwd, 'hooks', 'native')
90
+ mkdirSync(nativeDest, { recursive: true })
91
+
92
+ const filesToCopy = [
93
+ 'utils.mjs',
94
+ 'security-guard.mjs',
95
+ 'security-config.json',
96
+ 'auto-dispatch.mjs',
97
+ 'session-context.mjs',
98
+ 'auto-format.mjs',
99
+ ]
100
+ for (const file of filesToCopy) {
101
+ const src = join(nativeSource, file)
102
+ if (existsSync(src)) cpSync(src, join(nativeDest, file))
103
+ }
104
+
105
+ // 2. Load settings template
106
+ const templatePath = join(nativeSource, 'settings-template.json')
107
+ const template = JSON.parse(readFileSync(templatePath, 'utf-8'))
108
+
109
+ // 3. Filter template to only selected hooks
110
+ const filteredHooks = {}
111
+ for (const hookName of selectedHooks) {
112
+ const eventName = HOOK_EVENT_MAP[hookName]
113
+ if (eventName && template.hooks[eventName]) {
114
+ filteredHooks[eventName] = template.hooks[eventName]
115
+ }
116
+ }
117
+
118
+ // 4. Read existing settings or start fresh
119
+ const settingsDir = join(cwd, '.claude')
120
+ mkdirSync(settingsDir, { recursive: true })
121
+ const settingsPath = join(settingsDir, 'settings.json')
122
+
123
+ let existing = {}
124
+ if (existsSync(settingsPath)) {
125
+ try {
126
+ existing = JSON.parse(readFileSync(settingsPath, 'utf-8'))
127
+ // Create backup
128
+ writeFileSync(settingsPath + '.bak', JSON.stringify(existing, null, 2))
129
+ } catch {
130
+ existing = {}
131
+ }
132
+ }
133
+
134
+ // 5. Deep-merge hooks (idempotent — skip if command already exists)
135
+ if (!existing.hooks) existing.hooks = {}
136
+
137
+ for (const [eventName, entries] of Object.entries(filteredHooks)) {
138
+ if (!existing.hooks[eventName]) {
139
+ existing.hooks[eventName] = entries
140
+ } else {
141
+ // Check for duplicates by command
142
+ for (const newEntry of entries) {
143
+ const newCommand = newEntry.hooks?.[0]?.command || ''
144
+ const isDuplicate = existing.hooks[eventName].some(existingEntry =>
145
+ existingEntry.hooks?.some(h => h.command === newCommand)
146
+ )
147
+ if (!isDuplicate) {
148
+ existing.hooks[eventName].push(newEntry)
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ // 6. Write merged settings
155
+ writeFileSync(settingsPath, JSON.stringify(existing, null, 2))
156
+
157
+ return selectedHooks.length
158
+ }
159
+
74
160
  async function checkForUpdates(currentVersion) {
75
161
  try {
76
162
  const res = await fetch('https://registry.npmjs.org/specialist-agent/latest', {
@@ -145,7 +231,7 @@ function buildGettingStarted(agentNames, installedSkills) {
145
231
 
146
232
  const args = process.argv.slice(2)
147
233
 
148
- const validCommands = ['init']
234
+ const validCommands = ['init', 'create-agent', 'list', 'profiles', 'community']
149
235
  const command = args.find(a => !a.startsWith('-'))
150
236
  if (command && !validCommands.includes(command)) {
151
237
  console.error(` ${YELLOW}Unknown command: ${command}${NC}`)
@@ -158,15 +244,24 @@ if (args.includes('--help') || args.includes('-h')) {
158
244
  console.log()
159
245
  console.log(` ${BOLD}specialist-agent${NC} ${DIM}v${pkg.version}${NC}`)
160
246
  console.log()
161
- console.log(' Usage: specialist-agent [init] [options]')
247
+ console.log(' Usage: specialist-agent <command> [options]')
248
+ console.log()
249
+ console.log(' Commands:')
250
+ console.log(` init ${DIM}Install agents and skills in your project${NC}`)
251
+ console.log(` create-agent <name> ${DIM}Create a custom agent from template${NC}`)
252
+ console.log(` list ${DIM}List installed agents and skills${NC}`)
253
+ console.log(` profiles ${DIM}Manage AI team profiles${NC}`)
254
+ console.log(` community ${DIM}Manage community skills${NC}`)
162
255
  console.log()
163
256
  console.log(' Options:')
164
257
  console.log(` -h, --help ${DIM}Show this help message${NC}`)
165
258
  console.log(` -v, --version ${DIM}Show version number${NC}`)
166
259
  console.log(` -f, --force ${DIM}Overwrite existing agents without asking${NC}`)
167
260
  console.log()
168
- console.log(` ${DIM}Run the setup wizard to install AI agents for Claude Code.${NC}`)
169
- console.log(` ${DIM}Can be executed from any directory (creates package.json if needed).${NC}`)
261
+ console.log(' Examples:')
262
+ console.log(` ${DIM}$ specialist-agent init${NC}`)
263
+ console.log(` ${DIM}$ specialist-agent create-agent @my-custom-agent${NC}`)
264
+ console.log(` ${DIM}$ specialist-agent profiles set startup-fast${NC}`)
170
265
  console.log()
171
266
  process.exit(0)
172
267
  }
@@ -179,6 +274,470 @@ if (args.includes('--version') || args.includes('-v')) {
179
274
 
180
275
  const forceMode = args.includes('--force') || args.includes('-f')
181
276
 
277
+ // ── Agent Template ───────────────────────────────────
278
+
279
+ const AGENT_TEMPLATE = `---
280
+ name: {{name}}
281
+ description: "{{description}}"
282
+ model: {{model}}
283
+ tools: Read, Write, Edit, Bash, Glob, Grep
284
+ ---
285
+
286
+ # @{{name}} — {{title}}
287
+
288
+ ## Mission
289
+
290
+ {{mission}}
291
+
292
+ ## Workflow
293
+
294
+ ### Step 1: Understand Context
295
+ 1. Read relevant files
296
+ 2. Understand existing patterns
297
+ 3. Plan approach
298
+
299
+ ### Step 2: Execute
300
+ 1. Implement changes
301
+ 2. Validate results
302
+ 3. Report completion
303
+
304
+ ## Output
305
+
306
+ After completing work, provide:
307
+ - What was done
308
+ - Files created/modified
309
+ - Validation results
310
+ - Next steps
311
+
312
+ ## Rules
313
+
314
+ 1. Follow ARCHITECTURE.md patterns
315
+ 2. Write clean, readable code
316
+ 3. Add appropriate tests
317
+ 4. Document changes
318
+
319
+ ## Handoff Protocol
320
+
321
+ - If code review needed → suggest @reviewer
322
+ - If bugs found → suggest @doctor
323
+ - If tests needed → suggest @tester
324
+ `
325
+
326
+ // ── Create Agent Command ─────────────────────────────
327
+
328
+ async function createAgent() {
329
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
330
+ clack.intro(`Create Custom Agent ${DIM}v${pkg.version}${NC}`)
331
+
332
+ // Get agent name from args or prompt
333
+ let agentName = args.find(a => a.startsWith('@'))?.replace('@', '') || args[args.indexOf('create-agent') + 1]
334
+
335
+ if (!agentName || agentName.startsWith('-')) {
336
+ const nameInput = await clack.text({
337
+ message: 'Agent name (without @):',
338
+ placeholder: 'my-agent',
339
+ validate: (value) => {
340
+ if (!value) return 'Name is required'
341
+ if (!/^[a-z][a-z0-9-]*$/.test(value)) return 'Use lowercase letters, numbers, and hyphens'
342
+ }
343
+ })
344
+ if (clack.isCancel(nameInput)) handleCancel()
345
+ agentName = nameInput
346
+ }
347
+
348
+ agentName = agentName.replace('@', '')
349
+
350
+ const description = await clack.text({
351
+ message: 'What does this agent do?',
352
+ placeholder: 'Handles X when Y happens',
353
+ validate: (value) => !value ? 'Description is required' : undefined
354
+ })
355
+ if (clack.isCancel(description)) handleCancel()
356
+
357
+ const title = await clack.text({
358
+ message: 'Agent title (short):',
359
+ placeholder: 'Custom Agent',
360
+ initialValue: agentName.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')
361
+ })
362
+ if (clack.isCancel(title)) handleCancel()
363
+
364
+ const mission = await clack.text({
365
+ message: 'Mission statement (one sentence):',
366
+ placeholder: 'Help developers with X by doing Y.'
367
+ })
368
+ if (clack.isCancel(mission)) handleCancel()
369
+
370
+ const model = await clack.select({
371
+ message: 'Default model:',
372
+ options: [
373
+ { value: 'sonnet', label: 'Sonnet', hint: 'Balanced (default)' },
374
+ { value: 'haiku', label: 'Haiku', hint: 'Faster, cheaper' },
375
+ { value: 'opus', label: 'Opus', hint: 'Most capable' },
376
+ ]
377
+ })
378
+ if (clack.isCancel(model)) handleCancel()
379
+
380
+ const installScope = await clack.select({
381
+ message: 'Where to create?',
382
+ options: [
383
+ { value: 'project', label: 'This project', hint: '.claude/agents/' },
384
+ { value: 'global', label: 'Global', hint: '~/.claude/agents/' },
385
+ ]
386
+ })
387
+ if (clack.isCancel(installScope)) handleCancel()
388
+
389
+ // Generate agent content
390
+ const content = AGENT_TEMPLATE
391
+ .replace(/\{\{name\}\}/g, agentName)
392
+ .replace(/\{\{description\}\}/g, description)
393
+ .replace(/\{\{title\}\}/g, title)
394
+ .replace(/\{\{mission\}\}/g, mission || 'Help with specific tasks.')
395
+ .replace(/\{\{model\}\}/g, model === 'sonnet' ? '' : `\nmodel: ${model}`)
396
+ .replace(/\nmodel: \n/, '\n')
397
+
398
+ // Determine destination
399
+ const agentsDest = installScope === 'global'
400
+ ? join(homedir(), '.claude', 'agents')
401
+ : join(process.cwd(), '.claude', 'agents')
402
+
403
+ mkdirSync(agentsDest, { recursive: true })
404
+
405
+ const filePath = join(agentsDest, `${agentName}.md`)
406
+
407
+ if (existsSync(filePath) && !forceMode) {
408
+ const overwrite = await clack.confirm({
409
+ message: `Agent @${agentName} already exists. Overwrite?`,
410
+ initialValue: false
411
+ })
412
+ if (clack.isCancel(overwrite)) handleCancel()
413
+ if (!overwrite) {
414
+ clack.cancel('Agent creation cancelled.')
415
+ process.exit(0)
416
+ }
417
+ }
418
+
419
+ writeFileSync(filePath, content)
420
+
421
+ clack.note([
422
+ `File: ${filePath}`,
423
+ '',
424
+ 'Next steps:',
425
+ `1. Edit the agent file to customize behavior`,
426
+ `2. Use in Claude Code: "Use @${agentName} to..."`,
427
+ ].join('\n'), `@${agentName} created!`)
428
+
429
+ clack.outro('Agent ready to use!')
430
+ }
431
+
432
+ // ── List Command ─────────────────────────────────────
433
+
434
+ async function listAgents() {
435
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
436
+ console.log()
437
+ console.log(` ${BOLD}Specialist Agent${NC} ${DIM}v${pkg.version}${NC}`)
438
+ console.log()
439
+
440
+ const cwd = process.cwd()
441
+ const projectAgents = join(cwd, '.claude', 'agents')
442
+ const globalAgents = join(homedir(), '.claude', 'agents')
443
+ const projectSkills = join(cwd, '.claude', 'skills')
444
+
445
+ console.log(` ${BOLD}Agents${NC}`)
446
+ console.log()
447
+
448
+ // Project agents
449
+ if (existsSync(projectAgents)) {
450
+ const agents = getAgentNames(projectAgents)
451
+ if (agents.length > 0) {
452
+ console.log(` ${DIM}Project (.claude/agents/):${NC}`)
453
+ agents.forEach(a => console.log(` @${a}`))
454
+ console.log()
455
+ }
456
+ }
457
+
458
+ // Global agents
459
+ if (existsSync(globalAgents)) {
460
+ const agents = getAgentNames(globalAgents)
461
+ if (agents.length > 0) {
462
+ console.log(` ${DIM}Global (~/.claude/agents/):${NC}`)
463
+ agents.forEach(a => console.log(` @${a}`))
464
+ console.log()
465
+ }
466
+ }
467
+
468
+ // Skills
469
+ if (existsSync(projectSkills)) {
470
+ const skills = readdirSync(projectSkills, { withFileTypes: true })
471
+ .filter(d => d.isDirectory())
472
+ .map(d => d.name)
473
+
474
+ if (skills.length > 0) {
475
+ console.log(` ${BOLD}Skills${NC}`)
476
+ console.log()
477
+ console.log(` ${DIM}Project (.claude/skills/):${NC}`)
478
+ skills.forEach(s => console.log(` /${s}`))
479
+ console.log()
480
+ }
481
+ }
482
+
483
+ // Check for session memory
484
+ const memoryFile = join(cwd, '.claude', 'session-memory.json')
485
+ if (existsSync(memoryFile)) {
486
+ console.log(` ${BOLD}Session Memory${NC}`)
487
+ console.log(` ${DIM}Active: .claude/session-memory.json${NC}`)
488
+ console.log()
489
+ }
490
+
491
+ // Check for profile
492
+ const configFile = join(cwd, '.claude', 'config.json')
493
+ if (existsSync(configFile)) {
494
+ try {
495
+ const config = JSON.parse(readFileSync(configFile, 'utf-8'))
496
+ if (config.profile) {
497
+ console.log(` ${BOLD}Profile${NC}`)
498
+ console.log(` ${DIM}Active: ${config.profile}${NC}`)
499
+ console.log()
500
+ }
501
+ } catch {}
502
+ }
503
+ }
504
+
505
+ // ── Profiles Command ─────────────────────────────────
506
+
507
+ async function manageProfiles() {
508
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
509
+ clack.intro(`AI Team Profiles ${DIM}v${pkg.version}${NC}`)
510
+
511
+ const profiles = {
512
+ 'startup-fast': {
513
+ description: 'Move fast, ship quickly. Minimal validation, Haiku model.',
514
+ settings: { model: 'haiku', validation: 'minimal', checkpoints: false }
515
+ },
516
+ 'enterprise-strict': {
517
+ description: 'Strict quality gates. Full validation, detailed reviews.',
518
+ settings: { model: 'sonnet', validation: 'full', checkpoints: true }
519
+ },
520
+ 'learning-mode': {
521
+ description: 'Explain everything. Learning-focused, verbose output.',
522
+ settings: { model: 'sonnet', validation: 'full', explain: true }
523
+ },
524
+ 'cost-optimized': {
525
+ description: 'Minimize token usage. Haiku where possible, skip extras.',
526
+ settings: { model: 'haiku', validation: 'minimal', checkpoints: false }
527
+ }
528
+ }
529
+
530
+ const subcommand = args[args.indexOf('profiles') + 1]
531
+
532
+ if (subcommand === 'list' || !subcommand) {
533
+ console.log()
534
+ console.log(` ${BOLD}Available Profiles${NC}`)
535
+ console.log()
536
+ Object.entries(profiles).forEach(([name, info]) => {
537
+ console.log(` ${BOLD}${name}${NC}`)
538
+ console.log(` ${DIM}${info.description}${NC}`)
539
+ console.log()
540
+ })
541
+
542
+ const configFile = join(process.cwd(), '.claude', 'config.json')
543
+ if (existsSync(configFile)) {
544
+ try {
545
+ const config = JSON.parse(readFileSync(configFile, 'utf-8'))
546
+ if (config.profile) {
547
+ console.log(` ${BOLD}Current:${NC} ${config.profile}`)
548
+ }
549
+ } catch {}
550
+ }
551
+ return
552
+ }
553
+
554
+ if (subcommand === 'set') {
555
+ const profileName = args[args.indexOf('set') + 1]
556
+
557
+ if (!profileName || !profiles[profileName]) {
558
+ const selected = await clack.select({
559
+ message: 'Select profile:',
560
+ options: Object.entries(profiles).map(([name, info]) => ({
561
+ value: name,
562
+ label: name,
563
+ hint: info.description.substring(0, 50)
564
+ }))
565
+ })
566
+ if (clack.isCancel(selected)) handleCancel()
567
+
568
+ const configDir = join(process.cwd(), '.claude')
569
+ mkdirSync(configDir, { recursive: true })
570
+
571
+ const configFile = join(configDir, 'config.json')
572
+ let config = {}
573
+ if (existsSync(configFile)) {
574
+ try { config = JSON.parse(readFileSync(configFile, 'utf-8')) } catch {}
575
+ }
576
+
577
+ config.profile = selected
578
+ config.profileSettings = profiles[selected].settings
579
+
580
+ writeFileSync(configFile, JSON.stringify(config, null, 2))
581
+ clack.outro(`Profile set to: ${selected}`)
582
+ } else {
583
+ const configDir = join(process.cwd(), '.claude')
584
+ mkdirSync(configDir, { recursive: true })
585
+
586
+ const configFile = join(configDir, 'config.json')
587
+ let config = {}
588
+ if (existsSync(configFile)) {
589
+ try { config = JSON.parse(readFileSync(configFile, 'utf-8')) } catch {}
590
+ }
591
+
592
+ config.profile = profileName
593
+ config.profileSettings = profiles[profileName].settings
594
+
595
+ writeFileSync(configFile, JSON.stringify(config, null, 2))
596
+ console.log(` Profile set to: ${profileName}`)
597
+ }
598
+ }
599
+ }
600
+
601
+ // ── Community Skills ─────────────────────────────────
602
+
603
+ async function manageCommunity() {
604
+ const subCmd = args[1] || 'list'
605
+ const homeDir = homedir()
606
+ const communityDir = join(homeDir, '.claude', 'community-skills')
607
+
608
+ if (subCmd === 'list') {
609
+ console.log()
610
+ console.log(` ${BOLD}Community Skills${NC}`)
611
+ console.log()
612
+
613
+ if (!existsSync(communityDir)) {
614
+ console.log(` ${DIM}No community skills installed.${NC}`)
615
+ console.log(` ${DIM}Install with: specialist-agent community install <git-url>${NC}`)
616
+ return
617
+ }
618
+
619
+ const entries = readdirSync(communityDir, { withFileTypes: true })
620
+ let count = 0
621
+ for (const entry of entries) {
622
+ if (!entry.isDirectory()) continue
623
+ const skillFile = join(communityDir, entry.name, 'SKILL.md')
624
+ if (existsSync(skillFile)) {
625
+ const content = readFileSync(skillFile, 'utf-8')
626
+ const nameMatch = content.match(/^name:\s*(.+)$/m)
627
+ const descMatch = content.match(/^description:\s*"?([^"]*)"?$/m)
628
+ const name = nameMatch ? nameMatch[1].trim() : entry.name
629
+ const desc = descMatch ? descMatch[1].trim() : ''
630
+ console.log(` ${GREEN}/${name}${NC} ${DIM}— ${desc}${NC}`)
631
+ count++
632
+ }
633
+ }
634
+
635
+ if (count === 0) {
636
+ console.log(` ${DIM}No community skills found in ${communityDir}${NC}`)
637
+ } else {
638
+ console.log()
639
+ console.log(` ${DIM}${count} community skill(s) installed${NC}`)
640
+ }
641
+ console.log()
642
+
643
+ } else if (subCmd === 'install') {
644
+ const source = args[2]
645
+ if (!source) {
646
+ console.error(` ${RED}Usage: specialist-agent community install <git-url|path>${NC}`)
647
+ process.exit(1)
648
+ }
649
+
650
+ if (!existsSync(join(homeDir, '.claude'))) {
651
+ mkdirSync(join(homeDir, '.claude'), { recursive: true })
652
+ }
653
+ if (!existsSync(communityDir)) {
654
+ mkdirSync(communityDir, { recursive: true })
655
+ }
656
+
657
+ if (source.startsWith('http') || source.startsWith('git@')) {
658
+ // Git clone
659
+ const repoName = source.split('/').pop().replace('.git', '')
660
+ const targetDir = join(communityDir, repoName)
661
+
662
+ if (existsSync(targetDir)) {
663
+ console.error(` ${YELLOW}Skill "${repoName}" already installed. Use --force to overwrite.${NC}`)
664
+ if (!args.includes('--force')) process.exit(1)
665
+ rmSync(targetDir, { recursive: true })
666
+ }
667
+
668
+ console.log(` Cloning ${source}...`)
669
+ try {
670
+ execSync(`git clone --depth 1 "${source}" "${targetDir}"`, { stdio: 'pipe' })
671
+ console.log(` ${GREEN}✓${NC} Installed "${repoName}" to community skills`)
672
+ } catch (err) {
673
+ console.error(` ${RED}Failed to clone: ${err.message}${NC}`)
674
+ process.exit(1)
675
+ }
676
+ } else {
677
+ // Local path copy
678
+ const skillName = source.split('/').pop().split('\\').pop()
679
+ const targetDir = join(communityDir, skillName)
680
+
681
+ if (!existsSync(source)) {
682
+ console.error(` ${RED}Source not found: ${source}${NC}`)
683
+ process.exit(1)
684
+ }
685
+
686
+ if (existsSync(targetDir)) {
687
+ console.error(` ${YELLOW}Skill "${skillName}" already installed. Use --force to overwrite.${NC}`)
688
+ if (!args.includes('--force')) process.exit(1)
689
+ rmSync(targetDir, { recursive: true })
690
+ }
691
+
692
+ cpSync(source, targetDir, { recursive: true })
693
+ console.log(` ${GREEN}✓${NC} Installed "${skillName}" to community skills`)
694
+ }
695
+
696
+ } else if (subCmd === 'remove') {
697
+ const skillName = args[2]
698
+ if (!skillName) {
699
+ console.error(` ${RED}Usage: specialist-agent community remove <skill-name>${NC}`)
700
+ process.exit(1)
701
+ }
702
+
703
+ const targetDir = join(communityDir, skillName)
704
+ if (!existsSync(targetDir)) {
705
+ console.error(` ${RED}Skill "${skillName}" not found in community skills${NC}`)
706
+ process.exit(1)
707
+ }
708
+
709
+ rmSync(targetDir, { recursive: true })
710
+ console.log(` ${GREEN}✓${NC} Removed "${skillName}" from community skills`)
711
+
712
+ } else {
713
+ console.error(` ${YELLOW}Unknown subcommand: ${subCmd}${NC}`)
714
+ console.log(` Usage: specialist-agent community [list|install|remove]`)
715
+ process.exit(1)
716
+ }
717
+ }
718
+
719
+ // ── Command Router ───────────────────────────────────
720
+
721
+ if (command === 'create-agent') {
722
+ createAgent().catch(err => {
723
+ clack.log.error(err.message)
724
+ process.exit(1)
725
+ })
726
+ } else if (command === 'list') {
727
+ listAgents()
728
+ } else if (command === 'profiles') {
729
+ manageProfiles().catch(err => {
730
+ clack.log.error(err.message)
731
+ process.exit(1)
732
+ })
733
+ } else if (command === 'community') {
734
+ manageCommunity().catch(err => {
735
+ clack.log.error(err.message)
736
+ process.exit(1)
737
+ })
738
+ } else {
739
+ // Default to init
740
+
182
741
  // ── Main ─────────────────────────────────────────────
183
742
 
184
743
  async function main() {
@@ -282,15 +841,23 @@ async function main() {
282
841
 
283
842
  if (clack.isCancel(installStarter)) handleCancel()
284
843
 
285
- // 4. Specialist agents
844
+ // 4. Workflow agents
845
+ const installWorkflow = await clack.confirm({
846
+ message: `Install workflow agents? ${DIM}(@planner, @executor, @tdd, @debugger, @pair)${NC}`,
847
+ initialValue: true,
848
+ })
849
+
850
+ if (clack.isCancel(installWorkflow)) handleCancel()
851
+
852
+ // 5. Specialist agents
286
853
  const installSpecialists = await clack.confirm({
287
- message: `Install specialist agents? ${DIM}(@finance, @cloud, @security, @designer, @data, @devops, @tester, @explorer)${NC}`,
854
+ message: `Install specialist agents? ${DIM}(@api, @perf, @security, @finance, @data, @i18n, @docs, @deps, @legal, ...)${NC}`,
288
855
  initialValue: true,
289
856
  })
290
857
 
291
858
  if (clack.isCancel(installSpecialists)) handleCancel()
292
859
 
293
- // 5. Install scope
860
+ // 6. Install scope
294
861
  const installScope = await clack.select({
295
862
  message: 'Where to install agents?',
296
863
  options: [
@@ -352,9 +919,25 @@ async function main() {
352
919
  }
353
920
  }
354
921
 
922
+ // Install workflow agents
923
+ if (installWorkflow) {
924
+ const workflowNames = ['planner', 'executor', 'tdd', 'debugger', 'pair', 'analyst', 'orchestrator', 'scout', 'memory']
925
+ for (const name of workflowNames) {
926
+ const suffix = mode === 'lite' ? '-lite.md' : '.md'
927
+ const source = join(ROOT, 'agents', `${name}${suffix}`)
928
+ const dest = join(agentsDest, `${name}.md`)
929
+ if (existsSync(source) && (shouldOverwrite || !existsSync(dest))) {
930
+ cpSync(source, dest)
931
+ }
932
+ }
933
+ }
934
+
355
935
  // Install specialist agents
356
936
  if (installSpecialists) {
357
- const specialistNames = ['explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
937
+ const specialistNames = [
938
+ 'api', 'perf', 'i18n', 'docs', 'refactor', 'deps', // New agents
939
+ 'explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester', 'legal' // Existing
940
+ ]
358
941
  for (const name of specialistNames) {
359
942
  const suffix = mode === 'lite' ? '-lite.md' : '.md'
360
943
  const source = join(ROOT, 'agents', `${name}${suffix}`)
@@ -365,13 +948,49 @@ async function main() {
365
948
  }
366
949
  }
367
950
 
368
- // Install skills
951
+ // Install skills (pack-specific)
369
952
  const skillsDest = join(cwd, '.claude', 'skills')
370
953
  mkdirSync(skillsDest, { recursive: true })
371
- const skillCount = shouldOverwrite
954
+ let skillCount = shouldOverwrite
372
955
  ? copyDir(skillsSource, skillsDest)
373
956
  : copyNewOnly(skillsSource, skillsDest)
374
957
 
958
+ // Install generic skills
959
+ const genericSkillsSource = join(ROOT, 'skills')
960
+ if (existsSync(genericSkillsSource)) {
961
+ const genericSkillCount = shouldOverwrite
962
+ ? copyDir(genericSkillsSource, skillsDest)
963
+ : copyNewOnly(genericSkillsSource, skillsDest)
964
+ skillCount += genericSkillCount
965
+ }
966
+
967
+ // ── Native Claude Code Hooks ───────────────────────
968
+ let nativeHooksInstalled = 0
969
+
970
+ const installNativeHooks = await clack.confirm({
971
+ message: `Install native Claude Code hooks? ${DIM}(security guard, auto-dispatch, session context, auto-format)${NC}`,
972
+ initialValue: true,
973
+ })
974
+
975
+ if (clack.isCancel(installNativeHooks)) handleCancel()
976
+
977
+ if (installNativeHooks) {
978
+ const hookChoices = await clack.multiselect({
979
+ message: 'Which hooks to enable?',
980
+ options: [
981
+ { value: 'security-guard', label: 'Security Guard', hint: 'Block dangerous commands (recommended)', selected: true },
982
+ { value: 'auto-dispatch', label: 'Auto-Dispatch', hint: 'Suggest agents based on your prompt', selected: true },
983
+ { value: 'session-context', label: 'Session Context', hint: 'Inject project state on session start', selected: true },
984
+ { value: 'auto-format', label: 'Auto-Format', hint: 'Format files after Write/Edit', selected: false },
985
+ ],
986
+ required: false,
987
+ })
988
+
989
+ if (!clack.isCancel(hookChoices) && hookChoices.length > 0) {
990
+ nativeHooksInstalled = setupNativeHooks(cwd, hookChoices)
991
+ }
992
+ }
993
+
375
994
  // Install ARCHITECTURE.md
376
995
  const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
377
996
  let archInstalled = false
@@ -399,6 +1018,7 @@ async function main() {
399
1018
  const summaryLines = []
400
1019
  agentNames.forEach(name => summaryLines.push(`\u2713 @${name}`))
401
1020
  if (skillCount > 0) summaryLines.push(`\u2713 ${skillCount} skills`)
1021
+ if (nativeHooksInstalled > 0) summaryLines.push(`\u2713 ${nativeHooksInstalled} native hooks`)
402
1022
  if (archInstalled) summaryLines.push('\u2713 docs/ARCHITECTURE.md')
403
1023
  if (claudeInstalled) summaryLines.push('\u2713 CLAUDE.md')
404
1024
 
@@ -428,7 +1048,8 @@ async function main() {
428
1048
  clack.outro('Setup complete! Run claude to get started.')
429
1049
  }
430
1050
 
431
- main().catch((err) => {
432
- clack.log.error(err.message)
433
- process.exit(1)
434
- })
1051
+ main().catch((err) => {
1052
+ clack.log.error(err.message)
1053
+ process.exit(1)
1054
+ })
1055
+ }