specialist-agent 1.2.1 → 1.2.2

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 (2) hide show
  1. package/cli/index.mjs +116 -38
  2. package/package.json +1 -1
package/cli/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { createInterface } from 'readline'
4
- import { existsSync, mkdirSync, cpSync, readdirSync, readFileSync } from 'fs'
4
+ import { existsSync, mkdirSync, cpSync, readdirSync, readFileSync, writeFileSync } from 'fs'
5
5
  import { join, dirname, resolve } from 'path'
6
6
  import { fileURLToPath } from 'url'
7
7
 
@@ -17,24 +17,36 @@ const DIM = '\x1b[2m'
17
17
  const NC = '\x1b[0m'
18
18
 
19
19
  const rl = createInterface({ input: process.stdin, output: process.stdout })
20
+ rl.on('close', () => {
21
+ console.log()
22
+ process.exit(0)
23
+ })
20
24
 
21
25
  function ask(question, options) {
22
26
  return new Promise((resolve) => {
23
- if (options) {
24
- console.log()
25
- options.forEach((opt, i) => {
26
- console.log(` ${BOLD}${i + 1}${NC}) ${opt.label}${opt.hint ? ` ${DIM}${opt.hint}${NC}` : ''}`)
27
- })
28
- console.log()
29
- }
30
- rl.question(`${BLUE}${question}${NC} `, (answer) => {
27
+ const prompt = () => {
31
28
  if (options) {
32
- const idx = parseInt(answer, 10) - 1
33
- resolve(idx >= 0 && idx < options.length ? options[idx].value : options[0].value)
34
- } else {
35
- resolve(answer.trim())
29
+ console.log()
30
+ options.forEach((opt, i) => {
31
+ console.log(` ${BOLD}${i + 1}${NC}) ${opt.label}${opt.hint ? ` ${DIM}${opt.hint}${NC}` : ''}`)
32
+ })
33
+ console.log()
36
34
  }
37
- })
35
+ rl.question(`${BLUE}${question}${NC} `, (answer) => {
36
+ if (options) {
37
+ const idx = parseInt(answer, 10) - 1
38
+ if (idx >= 0 && idx < options.length) {
39
+ resolve(options[idx].value)
40
+ } else {
41
+ console.log(` ${YELLOW}Invalid choice. Please enter a number between 1 and ${options.length}.${NC}`)
42
+ prompt()
43
+ }
44
+ } else {
45
+ resolve(answer.trim())
46
+ }
47
+ })
48
+ }
49
+ prompt()
38
50
  })
39
51
  }
40
52
 
@@ -66,22 +78,34 @@ function getAgentNames(dir) {
66
78
  }
67
79
 
68
80
  async function main() {
81
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
82
+
69
83
  console.log()
70
- console.log(`${BOLD}${BLUE} ╔══════════════════════════════════════╗${NC}`)
71
- console.log(`${BOLD}${BLUE} ║ Specialist Agent — Setup Wizard ║${NC}`)
72
- console.log(`${BOLD}${BLUE} ╚══════════════════════════════════════╝${NC}`)
84
+ console.log(`${BOLD}${BLUE} ╔═══════════════════════════════════════════════╗${NC}`)
85
+ console.log(`${BOLD}${BLUE} ║ Specialist Agent — Setup Wizard ║${NC}`)
86
+ console.log(`${BOLD}${BLUE} ╚═══════════════════════════════════════════════╝${NC}`)
73
87
  console.log()
74
- console.log(` ${DIM}AI agents for Claude Code — any framework, any stack${NC}`)
88
+ console.log(` ${DIM}AI agents for Claude Code — any framework, any stack v${pkg.version}${NC}`)
75
89
  console.log()
76
90
 
77
91
  // Check we're in a project
78
92
  const cwd = process.cwd()
79
93
  if (!existsSync(join(cwd, 'package.json'))) {
80
94
  console.log(`${YELLOW} ⚠ No package.json found in current directory.${NC}`)
81
- console.log(` Run this command from the root of your project.`)
82
95
  console.log()
83
- rl.close()
84
- process.exit(1)
96
+ const createPkg = await ask('Create a package.json to initialize this project?', [
97
+ { label: 'Yes', value: true, hint: '(recommended)' },
98
+ { label: 'No', value: false, hint: '(exit)' },
99
+ ])
100
+ if (!createPkg) {
101
+ console.log(` Run this command from the root of your project.`)
102
+ console.log()
103
+ process.exit(1)
104
+ }
105
+ const dirName = cwd.split(/[\\/]/).pop() || 'my-project'
106
+ writeFileSync(join(cwd, 'package.json'), JSON.stringify({ name: dirName, version: '0.1.0', private: true }, null, 2) + '\n')
107
+ console.log(` ${GREEN}✅${NC} package.json created`)
108
+ console.log()
85
109
  }
86
110
 
87
111
  // 1. Framework
@@ -112,16 +136,17 @@ async function main() {
112
136
  ])
113
137
 
114
138
  // 4. Specialist agents
115
- const installSpecialists = await ask('Install specialist agents? (@finance, @cloud, @security, @designer, @data, @devops, @tester)', [
139
+ const installSpecialists = await ask('Install specialist agents? (@explorer, @finance, @cloud, @security, @designer, @data, @devops, @tester)', [
116
140
  { label: 'Yes', value: true, hint: '(recommended)' },
117
141
  { label: 'No', value: false, hint: '' },
118
142
  ])
119
143
 
120
144
  console.log()
121
- console.log(`${BLUE} ─────────────────────────────────────${NC}`)
145
+ console.log(`${BLUE} ───────────────────────────────────────────────${NC}`)
122
146
  console.log(` ${BOLD}Installing Specialist Agent${NC}`)
123
- console.log(` ${DIM}Pack: ${framework} | Mode: ${mode} | Starter: ${installStarter ? 'yes' : 'no'} | Specialists: ${installSpecialists ? 'yes' : 'no'}${NC}`)
124
- console.log(`${BLUE} ─────────────────────────────────────${NC}`)
147
+ const packLabel = packLabels[framework] || framework
148
+ console.log(` ${DIM}Pack: ${packLabel} | Mode: ${mode} | Starter: ${installStarter ? 'yes' : 'no'} | Specialists: ${installSpecialists ? 'yes' : 'no'}${NC}`)
149
+ console.log(`${BLUE} ───────────────────────────────────────────────${NC}`)
125
150
  console.log()
126
151
 
127
152
  const packDir = join(ROOT, 'packs', framework)
@@ -155,7 +180,7 @@ async function main() {
155
180
 
156
181
  // Install specialist agents
157
182
  if (installSpecialists) {
158
- const specialistNames = ['finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
183
+ const specialistNames = ['explorer', 'finance', 'cloud', 'security', 'designer', 'data', 'devops', 'tester']
159
184
  for (const name of specialistNames) {
160
185
  const suffix = mode === 'lite' ? `-lite.md` : '.md'
161
186
  const source = join(ROOT, 'agents', `${name}${suffix}`)
@@ -173,15 +198,23 @@ async function main() {
173
198
  const skillsDest = join(cwd, '.claude', 'skills')
174
199
  mkdirSync(skillsDest, { recursive: true })
175
200
  const skillCount = copyDir(skillsSource, skillsDest)
176
- console.log(` ${GREEN}${skillCount} skills installed${NC}`)
201
+ if (skillCount > 0) {
202
+ console.log(` ${GREEN}${skillCount} skills installed${NC}`)
203
+ } else {
204
+ console.log(` ${DIM} No skills available for this pack${NC}`)
205
+ }
177
206
 
178
207
  // Install ARCHITECTURE.md
179
208
  console.log()
180
209
  const archDest = join(cwd, 'docs', 'ARCHITECTURE.md')
181
210
  if (!existsSync(archDest)) {
182
- mkdirSync(dirname(archDest), { recursive: true })
183
- cpSync(archSource, archDest)
184
- console.log(` ${GREEN}✅${NC} docs/ARCHITECTURE.md`)
211
+ if (existsSync(archSource)) {
212
+ mkdirSync(dirname(archDest), { recursive: true })
213
+ cpSync(archSource, archDest)
214
+ console.log(` ${GREEN}✅${NC} docs/ARCHITECTURE.md`)
215
+ } else {
216
+ console.log(` ${YELLOW}⚠${NC} ARCHITECTURE.md not found in pack (skipped)`)
217
+ }
185
218
  } else {
186
219
  console.log(` ${YELLOW}⚠${NC} docs/ARCHITECTURE.md already exists (not overwritten)`)
187
220
  }
@@ -189,17 +222,21 @@ async function main() {
189
222
  // Install CLAUDE.md
190
223
  const claudeDest = join(cwd, 'CLAUDE.md')
191
224
  if (!existsSync(claudeDest)) {
192
- cpSync(claudeSource, claudeDest)
193
- console.log(` ${GREEN}✅${NC} CLAUDE.md`)
225
+ if (existsSync(claudeSource)) {
226
+ cpSync(claudeSource, claudeDest)
227
+ console.log(` ${GREEN}✅${NC} CLAUDE.md`)
228
+ } else {
229
+ console.log(` ${YELLOW}⚠${NC} CLAUDE.md not found in pack (skipped)`)
230
+ }
194
231
  } else {
195
232
  console.log(` ${YELLOW}⚠${NC} CLAUDE.md already exists (not overwritten)`)
196
233
  }
197
234
 
198
235
  // Done
199
236
  console.log()
200
- console.log(`${GREEN} ══════════════════════════════════════${NC}`)
237
+ console.log(`${GREEN} ═══════════════════════════════════════════════${NC}`)
201
238
  console.log(`${GREEN} 🎉 Specialist Agent installed successfully!${NC}`)
202
- console.log(`${GREEN} ══════════════════════════════════════${NC}`)
239
+ console.log(`${GREEN} ═══════════════════════════════════════════════${NC}`)
203
240
  console.log()
204
241
 
205
242
  if (mode === 'lite') {
@@ -208,12 +245,21 @@ async function main() {
208
245
  console.log()
209
246
  }
210
247
 
248
+ // Show installed skills as examples
249
+ const installedSkills = existsSync(skillsDest)
250
+ ? readdirSync(skillsDest, { withFileTypes: true }).filter(d => d.isDirectory()).map(d => '/' + d.name)
251
+ : []
252
+
211
253
  console.log(` Open Claude Code and try:`)
212
254
  console.log()
213
255
  console.log(` claude`)
214
256
  console.log(` /agents ${DIM}# list agents${NC}`)
215
- console.log(` /dev-create-module marketplace ${DIM}# scaffold a module${NC}`)
216
- console.log(` /review-check-architecture ${DIM}# validate architecture${NC}`)
257
+ if (installedSkills.length > 0) {
258
+ const examples = installedSkills.slice(0, 2)
259
+ examples.forEach(skill => {
260
+ console.log(` ${skill}`)
261
+ })
262
+ }
217
263
  console.log()
218
264
  console.log(` Or just ask:`)
219
265
  console.log()
@@ -225,8 +271,40 @@ async function main() {
225
271
  rl.close()
226
272
  }
227
273
 
274
+ const args = process.argv.slice(2)
275
+
276
+ const validCommands = ['init']
277
+ const command = args.find(a => !a.startsWith('-'))
278
+ if (command && !validCommands.includes(command)) {
279
+ console.error(` ${YELLOW}Unknown command: ${command}${NC}`)
280
+ console.error(` Run ${BOLD}specialist-agent --help${NC} for usage.`)
281
+ process.exit(1)
282
+ }
283
+
284
+ if (args.includes('--help') || args.includes('-h')) {
285
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
286
+ console.log()
287
+ console.log(` ${BOLD}specialist-agent${NC} v${pkg.version}`)
288
+ console.log()
289
+ console.log(' Usage: specialist-agent [init] [options]')
290
+ console.log()
291
+ console.log(' Options:')
292
+ console.log(' -h, --help Show this help message')
293
+ console.log(' -v, --version Show version number')
294
+ console.log()
295
+ console.log(' Run the setup wizard to install AI agents for Claude Code.')
296
+ console.log(' Can be executed from any directory (creates package.json if needed).')
297
+ console.log()
298
+ process.exit(0)
299
+ }
300
+
301
+ if (args.includes('--version') || args.includes('-v')) {
302
+ const pkg = JSON.parse(readFileSync(join(ROOT, 'package.json'), 'utf-8'))
303
+ console.log(pkg.version)
304
+ process.exit(0)
305
+ }
306
+
228
307
  main().catch((err) => {
229
- console.error(err)
230
- rl.close()
308
+ console.error(` ${YELLOW}Error: ${err.message}${NC}`)
231
309
  process.exit(1)
232
310
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specialist-agent",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "description": "AI agents for Claude Code — any framework, any stack",
6
6
  "bin": {