ingresseflow-bridge 1.0.0 → 1.0.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/dist/install.js CHANGED
@@ -1,36 +1,24 @@
1
1
  import { writeFileSync, mkdirSync, existsSync, unlinkSync } from 'fs';
2
2
  import { homedir } from 'os';
3
- import { join } from 'path';
3
+ import { join, dirname } from 'path';
4
4
  import { execSync } from 'child_process';
5
5
  const SERVICE_ID = 'com.ingresse.flow.bridge';
6
6
  const PLIST_DIR = join(homedir(), 'Library', 'LaunchAgents');
7
7
  const PLIST_PATH = join(PLIST_DIR, `${SERVICE_ID}.plist`);
8
- function nodeBin() {
9
- try {
10
- return execSync('which node', { encoding: 'utf8' }).trim();
11
- }
12
- catch {
13
- return process.execPath;
14
- }
15
- }
16
- function npmBin() {
17
- try {
18
- return execSync('which npx', { encoding: 'utf8' }).trim();
19
- }
20
- catch {
21
- return 'npx';
22
- }
23
- }
24
8
  export function install() {
25
9
  if (process.platform !== 'darwin') {
26
10
  console.error('Auto-instalação de serviço só é suportada no macOS.');
27
11
  process.exit(1);
28
12
  }
29
- mkdirSync(PLIST_DIR, { recursive: true });
30
- // Resolve the bridge entry point (same file that runs the server)
31
- const bridgeEntry = new URL('../index.js', import.meta.url).pathname;
32
- const node = nodeBin();
13
+ const node = process.execPath;
14
+ const nodeDir = dirname(node);
15
+ // Install globally so the path is stable (not an ephemeral npx cache)
16
+ console.log('Instalando ingresseflow-bridge globalmente...');
17
+ execSync('npm install -g ingresseflow-bridge', { stdio: 'inherit' });
18
+ const globalRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
19
+ const bridgeEntry = join(globalRoot, 'ingresseflow-bridge', 'dist', 'index.js');
33
20
  const logDir = join(homedir(), 'Library', 'Logs', 'IngresseFlow');
21
+ mkdirSync(PLIST_DIR, { recursive: true });
34
22
  mkdirSync(logDir, { recursive: true });
35
23
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
36
24
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -54,23 +42,30 @@ export function install() {
54
42
  <key>EnvironmentVariables</key>
55
43
  <dict>
56
44
  <key>PATH</key>
57
- <string>/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin</string>
45
+ <string>${nodeDir}:/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin</string>
58
46
  </dict>
59
47
  </dict>
60
48
  </plist>`;
61
49
  writeFileSync(PLIST_PATH, plist, 'utf8');
62
50
  console.log(`✓ Serviço criado em ${PLIST_PATH}`);
51
+ // Unload first in case it was already running (handles re-installs)
52
+ try {
53
+ execSync(`launchctl unload -w "${PLIST_PATH}"`, { stdio: 'pipe' });
54
+ }
55
+ catch { /* ok */ }
63
56
  try {
64
57
  execSync(`launchctl load -w "${PLIST_PATH}"`, { stdio: 'inherit' });
65
- console.log('✓ Serviço iniciado. O bridge vai rodar automaticamente no login.');
58
+ console.log('✓ Bridge iniciada e configurada para iniciar automaticamente no login.');
66
59
  }
67
60
  catch {
68
- console.log('⚠ Execute manualmente para iniciar agora:');
61
+ console.log('⚠ Inicie manualmente com:');
69
62
  console.log(` launchctl load -w "${PLIST_PATH}"`);
70
63
  }
71
- console.log('\nAgora configure o Claude Code (uma única vez):');
72
- console.log(` claude mcp add ingresseflow -- ${node} ${bridgeEntry}`);
73
- console.log('\nDepois disso, abra o plugin IngresseFlow no Figma.');
64
+ console.log('\n─────────────────────────────────────────');
65
+ console.log('Rode este comando no Claude Code (uma única vez):');
66
+ console.log(`\n claude mcp add ingresseflow -- ${node} ${bridgeEntry}\n`);
67
+ console.log('─────────────────────────────────────────');
68
+ console.log('Depois disso, só abra o plugin IngresseFlow no Figma.\n');
74
69
  }
75
70
  export function uninstall() {
76
71
  if (!existsSync(PLIST_PATH)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ingresseflow-bridge",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Bridge MCP server for IngresseFlow — connects Claude Code to FigJam via Figma Desktop plugin",
5
5
  "type": "module",
6
6
  "bin": {
package/src/install.ts CHANGED
@@ -1,21 +1,11 @@
1
1
  import { writeFileSync, mkdirSync, existsSync, unlinkSync } from 'fs';
2
2
  import { homedir } from 'os';
3
- import { join } from 'path';
3
+ import { join, dirname } from 'path';
4
4
  import { execSync } from 'child_process';
5
5
 
6
- const SERVICE_ID = 'com.ingresse.flow.bridge';
7
- const PLIST_DIR = join(homedir(), 'Library', 'LaunchAgents');
8
- const PLIST_PATH = join(PLIST_DIR, `${SERVICE_ID}.plist`);
9
-
10
- function nodeBin(): string {
11
- try { return execSync('which node', { encoding: 'utf8' }).trim(); }
12
- catch { return process.execPath; }
13
- }
14
-
15
- function npmBin(): string {
16
- try { return execSync('which npx', { encoding: 'utf8' }).trim(); }
17
- catch { return 'npx'; }
18
- }
6
+ const SERVICE_ID = 'com.ingresse.flow.bridge';
7
+ const PLIST_DIR = join(homedir(), 'Library', 'LaunchAgents');
8
+ const PLIST_PATH = join(PLIST_DIR, `${SERVICE_ID}.plist`);
19
9
 
20
10
  export function install() {
21
11
  if (process.platform !== 'darwin') {
@@ -23,13 +13,19 @@ export function install() {
23
13
  process.exit(1);
24
14
  }
25
15
 
26
- mkdirSync(PLIST_DIR, { recursive: true });
16
+ const node = process.execPath;
17
+ const nodeDir = dirname(node);
27
18
 
28
- // Resolve the bridge entry point (same file that runs the server)
29
- const bridgeEntry = new URL('../index.js', import.meta.url).pathname;
30
- const node = nodeBin();
31
- const logDir = join(homedir(), 'Library', 'Logs', 'IngresseFlow');
32
- mkdirSync(logDir, { recursive: true });
19
+ // Install globally so the path is stable (not an ephemeral npx cache)
20
+ console.log('Instalando ingresseflow-bridge globalmente...');
21
+ execSync('npm install -g ingresseflow-bridge', { stdio: 'inherit' });
22
+
23
+ const globalRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
24
+ const bridgeEntry = join(globalRoot, 'ingresseflow-bridge', 'dist', 'index.js');
25
+
26
+ const logDir = join(homedir(), 'Library', 'Logs', 'IngresseFlow');
27
+ mkdirSync(PLIST_DIR, { recursive: true });
28
+ mkdirSync(logDir, { recursive: true });
33
29
 
34
30
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
35
31
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -53,7 +49,7 @@ export function install() {
53
49
  <key>EnvironmentVariables</key>
54
50
  <dict>
55
51
  <key>PATH</key>
56
- <string>/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin</string>
52
+ <string>${nodeDir}:/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin</string>
57
53
  </dict>
58
54
  </dict>
59
55
  </plist>`;
@@ -61,17 +57,22 @@ export function install() {
61
57
  writeFileSync(PLIST_PATH, plist, 'utf8');
62
58
  console.log(`✓ Serviço criado em ${PLIST_PATH}`);
63
59
 
60
+ // Unload first in case it was already running (handles re-installs)
61
+ try { execSync(`launchctl unload -w "${PLIST_PATH}"`, { stdio: 'pipe' }); } catch { /* ok */ }
62
+
64
63
  try {
65
64
  execSync(`launchctl load -w "${PLIST_PATH}"`, { stdio: 'inherit' });
66
- console.log('✓ Serviço iniciado. O bridge vai rodar automaticamente no login.');
65
+ console.log('✓ Bridge iniciada e configurada para iniciar automaticamente no login.');
67
66
  } catch {
68
- console.log('⚠ Execute manualmente para iniciar agora:');
67
+ console.log('⚠ Inicie manualmente com:');
69
68
  console.log(` launchctl load -w "${PLIST_PATH}"`);
70
69
  }
71
70
 
72
- console.log('\nAgora configure o Claude Code (uma única vez):');
73
- console.log(` claude mcp add ingresseflow -- ${node} ${bridgeEntry}`);
74
- console.log('\nDepois disso, abra o plugin IngresseFlow no Figma.');
71
+ console.log('\n─────────────────────────────────────────');
72
+ console.log('Rode este comando no Claude Code (uma única vez):');
73
+ console.log(`\n claude mcp add ingresseflow -- ${node} ${bridgeEntry}\n`);
74
+ console.log('─────────────────────────────────────────');
75
+ console.log('Depois disso, só abra o plugin IngresseFlow no Figma.\n');
75
76
  }
76
77
 
77
78
  export function uninstall() {