@super-hands/connect 0.1.5 → 0.1.7
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/client.mjs +58 -30
- package/package.json +1 -1
package/client.mjs
CHANGED
|
@@ -37,7 +37,7 @@ function codexConfigBlock(args) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// lib/connect-skill.ts
|
|
40
|
-
var CONNECT_SKILL_VERSION =
|
|
40
|
+
var CONNECT_SKILL_VERSION = 3;
|
|
41
41
|
var CONNECT_SKILL_DIR = MCP_SERVER_KEY;
|
|
42
42
|
var CONNECT_SKILL_FILENAME = "SKILL.md";
|
|
43
43
|
var VERSION_MARKER = `[//]: # (superhands-skill-version: ${CONNECT_SKILL_VERSION})`;
|
|
@@ -60,8 +60,10 @@ Before you build, change, or restyle any UI:
|
|
|
60
60
|
|
|
61
61
|
1. Call the \`superhands_get_guidance\` MCP tool with \`intent\` set to what
|
|
62
62
|
you have been asked to build, in plain language \u2014 for example "a sign-in
|
|
63
|
-
page with email and password and an error state"
|
|
64
|
-
|
|
63
|
+
page with email and password and an error state", and
|
|
64
|
+
\`skill_version: ${CONNECT_SKILL_VERSION}\` \u2014 the version of this file, so
|
|
65
|
+
the server can tell you when this file is out of date. The decisions that
|
|
66
|
+
govern that work come back in full, ahead of the rest.
|
|
65
67
|
2. Build to what comes back. Where a decision names a case it deliberately
|
|
66
68
|
does not govern, your own judgment resumes there.
|
|
67
69
|
3. When you have finished \u2014 not part-way through \u2014 send the files you wrote or
|
|
@@ -94,6 +96,12 @@ function stop(message) {
|
|
|
94
96
|
`);
|
|
95
97
|
process.exit(1);
|
|
96
98
|
}
|
|
99
|
+
function cursorServerEntry(args) {
|
|
100
|
+
return {
|
|
101
|
+
url: args.endpoint,
|
|
102
|
+
headers: { Authorization: mcpAuthorizationHeader(args.token) }
|
|
103
|
+
};
|
|
104
|
+
}
|
|
97
105
|
function mergedCursorConfig(existing, args) {
|
|
98
106
|
let config = {};
|
|
99
107
|
if (existing !== null && existing.trim() !== "") {
|
|
@@ -111,10 +119,7 @@ function mergedCursorConfig(existing, args) {
|
|
|
111
119
|
const serversRaw = config.mcpServers;
|
|
112
120
|
const servers = typeof serversRaw === "object" && serversRaw !== null && !Array.isArray(serversRaw) ? serversRaw : {};
|
|
113
121
|
const replaced = MCP_SERVER_KEY in servers;
|
|
114
|
-
servers[MCP_SERVER_KEY] =
|
|
115
|
-
url: args.endpoint,
|
|
116
|
-
headers: { Authorization: mcpAuthorizationHeader(args.token) }
|
|
117
|
-
};
|
|
122
|
+
servers[MCP_SERVER_KEY] = cursorServerEntry(args);
|
|
118
123
|
config.mcpServers = servers;
|
|
119
124
|
return { text: `${JSON.stringify(config, null, 2)}
|
|
120
125
|
`, replaced };
|
|
@@ -198,26 +203,40 @@ async function main() {
|
|
|
198
203
|
} catch {
|
|
199
204
|
existing = null;
|
|
200
205
|
}
|
|
206
|
+
let merged = null;
|
|
201
207
|
try {
|
|
202
|
-
|
|
203
|
-
mkdirSync(dirname(configPath), { recursive: true });
|
|
204
|
-
writeFileSync(configPath, merged.text);
|
|
205
|
-
say(
|
|
206
|
-
merged.replaced ? `Cursor \u2014 updated the ${MCP_SERVER_KEY} server in ${configPath}.` : `Cursor \u2014 added the ${MCP_SERVER_KEY} server to ${configPath}.`
|
|
207
|
-
);
|
|
208
|
-
if (openCursor()) {
|
|
209
|
-
say(
|
|
210
|
-
` Cursor is opening \u2014 enable ${MCP_SERVER_KEY} under Settings \u2192 MCP. If it was already running, restart it first.`
|
|
211
|
-
);
|
|
212
|
-
} else {
|
|
213
|
-
say(` Open Cursor (restart it if it was running), then enable ${MCP_SERVER_KEY} under Settings \u2192 MCP.`);
|
|
214
|
-
}
|
|
215
|
-
writeSkill(cursorDir);
|
|
216
|
-
connected += 1;
|
|
208
|
+
merged = mergedCursorConfig(existing, { endpoint, token });
|
|
217
209
|
} catch {
|
|
218
210
|
say(`Cursor \u2014 ${configPath} is not valid JSON, so it was left untouched.`);
|
|
219
211
|
say(" Fix or remove that file, then run this command again.");
|
|
220
212
|
}
|
|
213
|
+
if (merged) {
|
|
214
|
+
try {
|
|
215
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
216
|
+
writeFileSync(configPath, merged.text);
|
|
217
|
+
say(
|
|
218
|
+
merged.replaced ? `Cursor \u2014 updated the ${MCP_SERVER_KEY} server in ${configPath}.` : `Cursor \u2014 added the ${MCP_SERVER_KEY} server to ${configPath}.`
|
|
219
|
+
);
|
|
220
|
+
if (openCursor()) {
|
|
221
|
+
say(
|
|
222
|
+
` Cursor is opening \u2014 enable ${MCP_SERVER_KEY} under Settings \u2192 MCP. If it was already running, restart it first.`
|
|
223
|
+
);
|
|
224
|
+
} else {
|
|
225
|
+
say(` Open Cursor (restart it if it was running), then enable ${MCP_SERVER_KEY} under Settings \u2192 MCP.`);
|
|
226
|
+
}
|
|
227
|
+
writeSkill(cursorDir);
|
|
228
|
+
connected += 1;
|
|
229
|
+
} catch {
|
|
230
|
+
say(`Cursor \u2014 ${configPath} could not be written, so it was left as it was.`);
|
|
231
|
+
say(
|
|
232
|
+
' A sandboxed agent usually cannot write outside its workspace. Run this same command in a regular terminal, or add this under "mcpServers" in that file (or in .cursor/mcp.json inside the project, which connects this project alone):'
|
|
233
|
+
);
|
|
234
|
+
process.stdout.write(
|
|
235
|
+
`${JSON.stringify({ [MCP_SERVER_KEY]: cursorServerEntry({ endpoint, token }) }, null, 2)}
|
|
236
|
+
`
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
221
240
|
}
|
|
222
241
|
if (onlyClaude || autodetect && hasCli("claude")) {
|
|
223
242
|
attempted += 1;
|
|
@@ -269,14 +288,23 @@ async function main() {
|
|
|
269
288
|
writeSkill(codexDir);
|
|
270
289
|
connected += 1;
|
|
271
290
|
} else {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
291
|
+
try {
|
|
292
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
293
|
+
writeFileSync(configPath, result.text);
|
|
294
|
+
say(
|
|
295
|
+
result.repaired ? `Codex \u2014 replaced the ${MCP_SERVER_KEY} entry in ${configPath}: its old bearer_token spelling makes current Codex reject the whole config.` : `Codex \u2014 added the ${MCP_SERVER_KEY} server to ${configPath}.`
|
|
296
|
+
);
|
|
297
|
+
say(" The app and the CLI both read this config \u2014 open either and it connects when a session starts.");
|
|
298
|
+
writeSkill(codexDir);
|
|
299
|
+
connected += 1;
|
|
300
|
+
} catch {
|
|
301
|
+
say(`Codex \u2014 ${configPath} could not be written, so it was left as it was.`);
|
|
302
|
+
say(
|
|
303
|
+
" A sandboxed agent usually cannot write outside its workspace. Run this same command in a regular terminal, or append this block to that file yourself:"
|
|
304
|
+
);
|
|
305
|
+
process.stdout.write(`${codexConfigBlock({ endpoint, token })}
|
|
306
|
+
`);
|
|
307
|
+
}
|
|
280
308
|
}
|
|
281
309
|
}
|
|
282
310
|
if (connected === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@super-hands/connect",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
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
6
|
"superhands-connect": "client.mjs"
|