@super-hands/connect 0.1.0 → 0.1.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/client.mjs +20 -3
  2. package/package.json +2 -2
package/client.mjs CHANGED
@@ -10,7 +10,7 @@
10
10
  // carries arrived in its own environment. Read on — it is not minified.
11
11
 
12
12
  // lib/connect-client-entry.ts
13
- import { execFileSync } from "node:child_process";
13
+ import { execFileSync, spawnSync } from "node:child_process";
14
14
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
15
15
  import { homedir } from "node:os";
16
16
  import { dirname, join } from "node:path";
@@ -86,6 +86,17 @@ function hasCli(bin) {
86
86
  return false;
87
87
  }
88
88
  }
89
+ function openCursor() {
90
+ const attempts = process.platform === "darwin" ? [
91
+ ["cursor", []],
92
+ ["open", ["-a", "Cursor"]]
93
+ ] : [["cursor", []]];
94
+ for (const [bin, args] of attempts) {
95
+ const result = spawnSync(bin, args, { stdio: "ignore" });
96
+ if (!result.error && result.status === 0) return true;
97
+ }
98
+ return false;
99
+ }
89
100
  async function main() {
90
101
  const token = process.env[CONNECT_TOKEN_ENV]?.trim();
91
102
  const endpoint = process.env[CONNECT_URL_ENV]?.trim();
@@ -118,7 +129,13 @@ async function main() {
118
129
  say(
119
130
  merged.replaced ? `Cursor \u2014 updated the ${MCP_SERVER_KEY} server in ${configPath}.` : `Cursor \u2014 added the ${MCP_SERVER_KEY} server to ${configPath}.`
120
131
  );
121
- say(" Restart Cursor, then enable superhands under Settings \u2192 MCP.");
132
+ if (openCursor()) {
133
+ say(
134
+ ` Cursor is opening \u2014 enable ${MCP_SERVER_KEY} under Settings \u2192 MCP. If it was already running, restart it first.`
135
+ );
136
+ } else {
137
+ say(` Open Cursor (restart it if it was running), then enable ${MCP_SERVER_KEY} under Settings \u2192 MCP.`);
138
+ }
122
139
  connected += 1;
123
140
  } catch {
124
141
  say(`Cursor \u2014 ${configPath} is not valid JSON, so it was left untouched.`);
@@ -176,7 +193,7 @@ async function main() {
176
193
  mkdirSync(dirname(configPath), { recursive: true });
177
194
  writeFileSync(configPath, result.text);
178
195
  say(`Codex \u2014 added the ${MCP_SERVER_KEY} server to ${configPath}.`);
179
- say(" Start a new codex session and it connects on start.");
196
+ say(" The app and the CLI both read this config \u2014 open either and it connects when a session starts.");
180
197
  connected += 1;
181
198
  }
182
199
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@super-hands/connect",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Connect the coding agents on this machine to your team's Superhands MCP server. Writes each client's own config; reads no repository, uploads nothing.",
5
5
  "bin": {
6
- "superhands-connect": "./client.mjs"
6
+ "superhands-connect": "client.mjs"
7
7
  },
8
8
  "files": [
9
9
  "client.mjs",