figmanage 0.2.0 → 0.2.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/README.md CHANGED
@@ -26,9 +26,15 @@ Extracts your Chrome cookie, prompts for a PAT, registers with Claude Code autom
26
26
 
27
27
  Use `--no-prompt --pat figd_xxx` for non-interactive setup.
28
28
 
29
- ### Claude Desktop
29
+ ### Claude Desktop / Cowork
30
30
 
31
- Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
31
+ Full setup with cookie extraction:
32
+
33
+ ```bash
34
+ npx -y figmanage --setup --desktop
35
+ ```
36
+
37
+ Or manually add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
32
38
 
33
39
  ```json
34
40
  {
package/dist/setup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { execSync, execFileSync } from 'child_process';
3
3
  import { createDecipheriv, pbkdf2Sync } from 'crypto';
4
- import { copyFileSync, unlinkSync, mkdtempSync, existsSync, rmdirSync, readFileSync } from 'fs';
4
+ import { copyFileSync, unlinkSync, mkdtempSync, mkdirSync, existsSync, rmdirSync, readFileSync, writeFileSync } from 'fs';
5
5
  import { join } from 'path';
6
6
  import { tmpdir, homedir, platform } from 'os';
7
7
  import axios from 'axios';
@@ -294,8 +294,32 @@ function registerWithClaude(envVars) {
294
294
  return false;
295
295
  }
296
296
  }
297
+ function registerWithDesktop(envVars) {
298
+ const configPath = platform() === 'win32'
299
+ ? join(process.env.APPDATA || join(homedir(), 'AppData/Roaming'), 'Claude/claude_desktop_config.json')
300
+ : join(homedir(), 'Library/Application Support/Claude/claude_desktop_config.json');
301
+ try {
302
+ let config = {};
303
+ if (existsSync(configPath)) {
304
+ config = JSON.parse(readFileSync(configPath, 'utf-8'));
305
+ }
306
+ if (!config.mcpServers)
307
+ config.mcpServers = {};
308
+ config.mcpServers.figmanage = {
309
+ command: 'npx',
310
+ args: ['-y', 'figmanage'],
311
+ env: envVars,
312
+ };
313
+ mkdirSync(join(configPath, '..'), { recursive: true });
314
+ writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
315
+ return true;
316
+ }
317
+ catch {
318
+ return false;
319
+ }
320
+ }
297
321
  function printManualConfig(envVars) {
298
- console.log('\nClaude CLI not found. Configure your MCP client manually.\n');
322
+ console.log('\nConfigure your MCP client manually.\n');
299
323
  console.log('Environment variables:');
300
324
  for (const [k, v] of Object.entries(envVars)) {
301
325
  const display = (k === 'FIGMA_AUTH_COOKIE' || k === 'FIGMA_PAT') ? '******' : v;
@@ -315,21 +339,25 @@ function printManualConfig(envVars) {
315
339
  function parseArgs() {
316
340
  const args = process.argv.slice(2);
317
341
  let noPrompt = false;
342
+ let desktop = false;
318
343
  let pat;
319
344
  for (let i = 0; i < args.length; i++) {
320
345
  if (args[i] === '--no-prompt') {
321
346
  noPrompt = true;
322
347
  }
348
+ else if (args[i] === '--desktop') {
349
+ desktop = true;
350
+ }
323
351
  else if (args[i] === '--pat' && i + 1 < args.length) {
324
352
  pat = args[++i];
325
353
  }
326
354
  }
327
- return { noPrompt, pat };
355
+ return { noPrompt, desktop, pat };
328
356
  }
329
357
  // --- Main ---
330
358
  async function setup() {
331
359
  console.log('figmanage setup\n');
332
- const { noPrompt, pat: patArg } = parseArgs();
360
+ const { noPrompt, desktop, pat: patArg } = parseArgs();
333
361
  const os = platform();
334
362
  // Build env vars to register
335
363
  const envVars = {};
@@ -351,8 +379,18 @@ async function setup() {
351
379
  process.exit(1);
352
380
  }
353
381
  // Register with whatever client is available
354
- if (claudeCliAvailable()) {
355
- console.log('\nRegistering with Claude...');
382
+ if (desktop) {
383
+ console.log('\nRegistering with Claude Desktop...');
384
+ if (registerWithDesktop(envVars)) {
385
+ console.log(' Credentials written to claude_desktop_config.json');
386
+ console.log(' Done. Restart Claude Desktop to use figmanage.');
387
+ }
388
+ else {
389
+ printManualConfig(envVars);
390
+ }
391
+ }
392
+ else if (claudeCliAvailable()) {
393
+ console.log('\nRegistering with Claude Code...');
356
394
  if (registerWithClaude(envVars)) {
357
395
  console.log(' PAT stored in MCP server config');
358
396
  console.log(' Done. Restart Claude Code to use figmanage.');
@@ -542,8 +580,19 @@ async function setup() {
542
580
  console.log(`FIGMA_ORG_ID=${orgId}`);
543
581
  if (pat)
544
582
  console.log('FIGMA_PAT=****** (stored in MCP server config)');
545
- if (claudeCliAvailable()) {
546
- console.log('\nRegistering with Claude...');
583
+ if (desktop) {
584
+ console.log('\nRegistering with Claude Desktop...');
585
+ if (registerWithDesktop(envVars)) {
586
+ console.log(' Credentials written to claude_desktop_config.json');
587
+ console.log(' Done. Restart Claude Desktop to use figmanage.');
588
+ }
589
+ else {
590
+ console.log(' Could not write config automatically.');
591
+ printManualConfig(envVars);
592
+ }
593
+ }
594
+ else if (claudeCliAvailable()) {
595
+ console.log('\nRegistering with Claude Code...');
547
596
  if (registerWithClaude(envVars)) {
548
597
  if (pat)
549
598
  console.log(' PAT stored in MCP server config');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "figmanage",
3
3
  "mcpName": "io.github.dannykeane/figmanage",
4
- "version": "0.2.0",
4
+ "version": "0.2.1",
5
5
  "description": "MCP server for managing your Figma workspace from the terminal.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",