@mehuljatiya/troupe 0.1.15 → 0.1.16

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/bin/design.js CHANGED
@@ -23,5 +23,5 @@ try {
23
23
  console.log('Run: ' + chalk.cyan('npx @mehuljatiya/troupe setup'))
24
24
  process.exit(1)
25
25
  }
26
- // normal exit or Ctrl+C — ignore
26
+ // all other exits (Ctrl+C, non-interactive shell errors) — ignore silently
27
27
  }
@@ -28,15 +28,17 @@ These apply to every run. No exceptions.
28
28
 
29
29
  Call `mcp__claude_ai_Figma__whoami`. If it fails or returns an auth error:
30
30
 
31
- > **Setup required before this skill can run:**
31
+ > **Figma not connected. Fix it in 30 seconds:**
32
32
  >
33
- > 1. Open the **Claude desktop app**
34
- > 2. Go to **Settings → Integrations** (or Extensions)
35
- > 3. Find **Figma** and click **Enable**
36
- > 4. **Quit and relaunch** Claude Code the MCP won't load until you restart
37
- > 5. Then re-run `/document-component` with your Figma URL
38
- >
39
- > If you've already done this and it still fails, run `claude mcp add --transport http figma https://mcp.figma.com/mcp --scope user` in your terminal, then restart.
33
+ > 1. Press `Ctrl+C` to exit Claude
34
+ > 2. In your terminal, run:
35
+ > ```
36
+ > claude mcp add --transport http figma https://mcp.figma.com/mcp --scope user
37
+ > ```
38
+ > 3. Type `claude` to reopen Claude Code
39
+ > 4. Type `/mcp` select **figma** select **Authenticate**
40
+ > 5. Log in to Figma in the browser that opens, then come back here
41
+ > 6. Re-run `/document-component` with your Figma URL
40
42
 
41
43
  Stop here — do not proceed until Figma MCP is confirmed working.
42
44
 
package/commands/figma.md CHANGED
@@ -6,15 +6,17 @@ Help me turn a Figma design into working code.
6
6
 
7
7
  Before doing anything, call `mcp__claude_ai_Figma__whoami`. If it fails or returns an auth error, stop and tell the user:
8
8
 
9
- > **Setup required before this command can run:**
9
+ > **Figma not connected. Fix it in 30 seconds:**
10
10
  >
11
- > 1. Open the **Claude desktop app**
12
- > 2. Go to **Settings → Integrations**
13
- > 3. Find **Figma** and click **Enable**
14
- > 4. **Quit and relaunch** Claude Code the MCP won't load until you restart
15
- > 5. Then re-run `/figma` with your Figma URL
16
- >
17
- > If you've already done this and it still fails, run `claude mcp add --transport http figma https://mcp.figma.com/mcp --scope user` in your terminal, then restart.
11
+ > 1. Press `Ctrl+C` to exit Claude
12
+ > 2. In your terminal, run:
13
+ > ```
14
+ > claude mcp add --transport http figma https://mcp.figma.com/mcp --scope user
15
+ > ```
16
+ > 3. Type `claude` to reopen Claude Code
17
+ > 4. Type `/mcp` select **figma** select **Authenticate**
18
+ > 5. Log in to Figma in the browser that opens, then come back here
19
+ > 6. Re-run `/figma` with your Figma URL
18
20
 
19
21
  Do not proceed until Figma MCP is confirmed working.
20
22
 
package/commands/qa.md CHANGED
@@ -6,12 +6,19 @@ If the user hasn't shared a Figma URL, ask for one. Also ask which component or
6
6
 
7
7
  ## Step 1 — Read the design
8
8
 
9
- Call `mcp__claude_ai_Figma__whoami` first. If it fails, tell the user:
10
-
11
- > **Setup required:**
12
- > 1. Open Claude desktop app → Settings → Integrations → Enable Figma
13
- > 2. Quit and relaunch Claude Code
14
- > 3. Re-run `/qa` with your Figma URL
9
+ Call `mcp__claude_ai_Figma__whoami` first. If it fails or returns an auth error, tell the user:
10
+
11
+ > **Figma not connected. Fix it in 30 seconds:**
12
+ >
13
+ > 1. Press `Ctrl+C` to exit Claude
14
+ > 2. In your terminal, run:
15
+ > ```
16
+ > claude mcp add --transport http figma https://mcp.figma.com/mcp --scope user
17
+ > ```
18
+ > 3. Type `claude` to reopen Claude Code
19
+ > 4. Type `/mcp` → select **figma** → select **Authenticate**
20
+ > 5. Log in to Figma in the browser that opens, then come back here
21
+ > 6. Re-run `/qa` with your Figma URL
15
22
 
16
23
  Call `get_design_context` on the provided URL. Call `get_screenshot` to get a visual reference of every variant and state.
17
24
 
package/commands/spec.md CHANGED
@@ -6,12 +6,19 @@ If the user hasn't shared a Figma URL, ask for one before proceeding.
6
6
 
7
7
  ## Step 1 — Read the design
8
8
 
9
- Call `mcp__claude_ai_Figma__whoami` first. If it fails, tell the user:
10
-
11
- > **Setup required:**
12
- > 1. Open Claude desktop app → Settings → Integrations → Enable Figma
13
- > 2. Quit and relaunch Claude Code
14
- > 3. Re-run `/spec` with your Figma URL
9
+ Call `mcp__claude_ai_Figma__whoami` first. If it fails or returns an auth error, tell the user:
10
+
11
+ > **Figma not connected. Fix it in 30 seconds:**
12
+ >
13
+ > 1. Press `Ctrl+C` to exit Claude
14
+ > 2. In your terminal, run:
15
+ > ```
16
+ > claude mcp add --transport http figma https://mcp.figma.com/mcp --scope user
17
+ > ```
18
+ > 3. Type `claude` to reopen Claude Code
19
+ > 4. Type `/mcp` → select **figma** → select **Authenticate**
20
+ > 5. Log in to Figma in the browser that opens, then come back here
21
+ > 6. Re-run `/spec` with your Figma URL
15
22
 
16
23
  Call `get_design_context` on the provided URL. Also call `get_screenshot` to visually verify all variants and states.
17
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mehuljatiya/troupe",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "AI-powered workflow toolkit for designers, developers, and PMs — 9 slash commands for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
package/src/setup.js CHANGED
@@ -66,12 +66,15 @@ export async function runSetup() {
66
66
 
67
67
  const { installed, skipped } = installSlashCommands()
68
68
 
69
- if (skipped.length > 0) {
70
- console.log(chalk.yellow(` ${skipped.length} workflow(s) already exist — skipping to avoid overwriting`))
69
+ if (installed.length > 0 && skipped.length > 0) {
70
+ console.log(chalk.green(` ✓ Installed ${installed.length} command(s)`))
71
+ console.log(chalk.yellow(` ${skipped.length} already existed — skipped to avoid overwriting`))
72
+ console.log(chalk.dim(' (delete them from ~/.claude/commands/ and re-run to reset)'))
73
+ } else if (installed.length > 0) {
74
+ console.log(chalk.green(` ✓ Installed ${installed.length} slash commands`))
75
+ } else if (skipped.length > 0) {
76
+ console.log(chalk.green(` ✓ All ${skipped.length} commands already installed`))
71
77
  console.log(chalk.dim(' (delete them from ~/.claude/commands/ and re-run to reset)'))
72
- }
73
- if (installed.length > 0) {
74
- console.log(chalk.green(` ✓ Installed ${installed.length} design workflow(s)`))
75
78
  }
76
79
  console.log()
77
80
 
@@ -116,7 +119,7 @@ export async function runSetup() {
116
119
  console.log(' 1. Type ' + chalk.cyan('/mcp') + ' and press Enter')
117
120
  console.log(' 2. Select ' + chalk.cyan('figma') + ' → ' + chalk.cyan('Authenticate'))
118
121
  console.log(' 3. Log in to Figma in the browser that opens, then come back here')
119
- console.log(' 4. Type ' + chalk.cyan('/exit') + ' to return to setup\n')
122
+ console.log(' 4. Press ' + chalk.cyan('Ctrl+C') + ' (or type /quit) to return here\n')
120
123
 
121
124
  const doAuth = await confirm({
122
125
  message: 'Open Claude to authenticate Figma now?',
@@ -142,30 +145,35 @@ export async function runSetup() {
142
145
  }
143
146
 
144
147
  // ── Step 4: Browser & Figma plugins ─────────────────────────────────────
145
- console.log(chalk.bold('Step 4/5') + ' — Browser tools')
146
- console.log(chalk.dim(' Enables /document-component to open a browser preview and push docs into Figma.\n'))
148
+ console.log(chalk.bold('Step 4/5') + ' — Browser tools ' + chalk.dim('(optional)'))
149
+ console.log(chalk.dim(' Only needed for /document-component\'s push-to-Figma feature.\n'))
147
150
 
148
- installPlugin('chrome-devtools-mcp', 'chrome-devtools-plugins', 'Chrome DevTools')
149
- installPlugin('figma-friend', 'figma-friend-marketplace', 'Figma Friend')
151
+ const chromeOk = installPlugin('chrome-devtools-mcp', 'chrome-devtools-plugins', 'Chrome DevTools')
152
+ const figmaFriendOk = installPlugin('figma-friend', 'figma-friend-marketplace', 'Figma Friend')
153
+ const browserToolsOk = chromeOk && figmaFriendOk
150
154
 
151
155
  // ── Step 5: API key ──────────────────────────────────────────────────────
152
156
  console.log(chalk.bold('Step 5/5') + ' — API key')
153
-
154
- if (!claudeInstalled) {
155
- console.log(' You\'ll need a free Anthropic API key.')
156
- console.log(' Get one at: ' + chalk.cyan('https://console.anthropic.com'))
157
- console.log(' Claude will ask for it when you first run ' + chalk.cyan('claude') + '.\n')
158
- } else {
159
- console.log(chalk.green(' ✓ Already configured\n'))
160
- }
157
+ console.log(' You\'ll need an Anthropic API key to use Claude.')
158
+ console.log(' Get one free at: ' + chalk.cyan('https://console.anthropic.com'))
159
+ console.log(chalk.dim(' Claude will ask for it on first launch if it\'s not set yet.\n'))
161
160
 
162
161
  // ── Register design command globally ────────────────────────────────────
162
+ console.log(chalk.dim(' Installing design command globally...'))
163
163
  try {
164
164
  npmInstallGlobal('@mehuljatiya/troupe')
165
- } catch { /* non-critical — claude still works without design command */ }
165
+ console.log(chalk.green(' design command ready\n'))
166
+ } catch {
167
+ console.log(chalk.dim(' (Could not install design command — you can still use claude directly)\n'))
168
+ }
166
169
 
167
170
  // ── Done ─────────────────────────────────────────────────────────────────
168
- showNextSteps(figmaConnected, figmaAuthNeeded)
171
+ showNextSteps({
172
+ figmaConnected,
173
+ figmaAuthNeeded,
174
+ browserToolsOk,
175
+ commandCount: installed.length + skipped.length,
176
+ })
169
177
  }
170
178
 
171
179
  function npmInstallGlobal(pkg) {
@@ -293,19 +301,22 @@ function installPlugin(pluginName, marketplace, label) {
293
301
  if (result.toLowerCase().includes(pluginName.toLowerCase())) {
294
302
  console.log(chalk.green(` ✓ ${label} already installed`))
295
303
  console.log()
296
- return
304
+ return true
297
305
  }
298
306
  } catch { /* continue */ }
299
307
 
300
308
  try {
301
309
  execSync(`claude plugin install ${pluginName}@${marketplace} --scope user`, { stdio: 'pipe' })
302
310
  console.log(chalk.green(` ✓ ${label} installed`))
311
+ console.log()
312
+ return true
303
313
  } catch {
304
314
  console.log(chalk.yellow(` Could not install ${label} automatically.`))
305
315
  console.log(' Run this manually:')
306
- console.log(' ' + chalk.cyan(`claude plugin install ${pluginName}@${marketplace}`))
316
+ console.log(' ' + chalk.cyan(`claude plugin install ${pluginName}@${marketplace} --scope user`))
317
+ console.log()
318
+ return false
307
319
  }
308
- console.log()
309
320
  }
310
321
 
311
322
  function isClaudeInstalled() {
@@ -320,7 +331,7 @@ function isClaudeInstalled() {
320
331
  function isFigmaMcpConfigured() {
321
332
  try {
322
333
  const result = execSync('claude mcp list', { encoding: 'utf8', stdio: 'pipe' })
323
- return result.toLowerCase().includes('figma')
334
+ return result.includes('mcp.figma.com')
324
335
  } catch {
325
336
  return false
326
337
  }
@@ -368,22 +379,44 @@ function installSlashCommands() {
368
379
  return { installed, skipped }
369
380
  }
370
381
 
371
- function showNextSteps(figmaConnected, figmaAuthNeeded) {
382
+ function showNextSteps({ figmaConnected, figmaAuthNeeded, browserToolsOk, commandCount }) {
372
383
  console.log('─'.repeat(50))
373
384
  console.log(chalk.bold('\nYou\'re all set!\n'))
374
385
  console.log(chalk.yellow(' Open a new terminal tab first') + ' so PATH updates take effect.\n')
375
386
  console.log('To start:')
376
387
  console.log(' 1. Open a new terminal tab in your project folder')
377
388
  console.log(' 2. Type ' + chalk.cyan('claude') + ' (or ' + chalk.cyan('design') + ' for a command cheat sheet)')
389
+ console.log()
378
390
 
379
- if (figmaAuthNeeded) {
380
- console.log(' 3. Inside Claude, type ' + chalk.cyan('/mcp') + ' → figma → Authenticate')
381
- console.log(' (one-time step to connect your Figma account)\n')
391
+ // ── Setup summary ────────────────────────────────────────────────────────
392
+ console.log(chalk.bold('Setup summary:'))
393
+ console.log(chalk.green(` ✓ ${commandCount} slash commands installed`))
394
+ console.log(chalk.green(' ✓ Claude Code ready'))
395
+
396
+ if (figmaConnected && !figmaAuthNeeded) {
397
+ console.log(chalk.green(' ✓ Figma connected') + chalk.dim(' → /figma, /spec, /qa, /document-component ready'))
398
+ } else if (figmaConnected && figmaAuthNeeded) {
399
+ console.log(chalk.yellow(' ⚠ Figma configured — authentication still needed'))
400
+ console.log(chalk.dim(' Inside Claude: type /mcp → figma → Authenticate'))
401
+ console.log(chalk.dim(' (/figma, /spec, /qa, /document-component won\'t work until authenticated)'))
382
402
  } else {
383
- console.log()
403
+ console.log(chalk.yellow(' ⚠ Figma not connected'))
404
+ console.log(chalk.dim(' /figma, /spec, /qa, /document-component need Figma to work'))
405
+ console.log(chalk.dim(' To add it: claude mcp add --transport http figma https://mcp.figma.com/mcp --scope user'))
406
+ console.log(chalk.dim(' Then in Claude: /mcp → figma → Authenticate'))
384
407
  }
385
408
 
386
- console.log('Available workflows (type inside Claude):')
409
+ if (browserToolsOk) {
410
+ console.log(chalk.green(' ✓ Browser tools ready') + chalk.dim(' → /document-component push-to-Figma available'))
411
+ } else {
412
+ console.log(chalk.yellow(' ⚠ Browser tools not installed'))
413
+ console.log(chalk.dim(' /document-component will generate docs but won\'t push to Figma'))
414
+ console.log(chalk.dim(' To add: claude plugin install chrome-devtools-mcp@chrome-devtools-plugins --scope user'))
415
+ console.log(chalk.dim(' claude plugin install figma-friend@figma-friend-marketplace --scope user'))
416
+ }
417
+
418
+ console.log()
419
+ console.log('All commands (type inside Claude):')
387
420
  console.log(' ' + chalk.cyan('/figma') + ' [url] Pull a Figma design and build it')
388
421
  console.log(' ' + chalk.cyan('/document-component') + ' [url] Generate full component docs from Figma')
389
422
  console.log(' ' + chalk.cyan('/spec') + ' [url] Ticket-ready spec with acceptance criteria')