@super-hands/connect 0.1.2 → 0.1.4

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 (3) hide show
  1. package/README.md +5 -1
  2. package/client.mjs +73 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,9 +6,13 @@ Connect the coding agents on this machine to your team's
6
6
  Superhands setup generates the command for you, credential included:
7
7
 
8
8
  ```
9
- SUPERHANDS_MCP_TOKEN="…" SUPERHANDS_MCP_URL="…" npx -y @super-hands/connect@latest
9
+ SUPERHANDS_MCP_TOKEN="…" npx -y @super-hands/connect@latest
10
10
  ```
11
11
 
12
+ It connects to `https://app.superhands.ai/api/mcp` unless `SUPERHANDS_MCP_URL`
13
+ says otherwise — a command from a preview or local deployment carries that
14
+ variable too.
15
+
12
16
  ## What it does
13
17
 
14
18
  - **Cursor** — merges the `superhands` server into `~/.cursor/mcp.json`.
package/client.mjs CHANGED
@@ -21,6 +21,7 @@ var MCP_ACCESS_TOKEN_TTL_SECONDS = 30 * 24 * 60 * 60;
21
21
  // lib/mcp-clients.ts
22
22
  var CONNECT_TOKEN_ENV = "SUPERHANDS_MCP_TOKEN";
23
23
  var CONNECT_URL_ENV = "SUPERHANDS_MCP_URL";
24
+ var CONNECT_DEFAULT_MCP_URL = "https://app.superhands.ai/api/mcp";
24
25
  var CONNECT_CLIENT_PACKAGE = "@super-hands/connect";
25
26
  var CONNECT_CLIENT_SPEC = `${CONNECT_CLIENT_PACKAGE}@latest`;
26
27
  var MCP_SERVER_KEY = "superhands";
@@ -35,6 +36,54 @@ function codexConfigBlock(args) {
35
36
  ].join("\n");
36
37
  }
37
38
 
39
+ // lib/connect-skill.ts
40
+ var CONNECT_SKILL_VERSION = 2;
41
+ var CONNECT_SKILL_DIR = MCP_SERVER_KEY;
42
+ var CONNECT_SKILL_FILENAME = "SKILL.md";
43
+ var VERSION_MARKER = `[//]: # (superhands-skill-version: ${CONNECT_SKILL_VERSION})`;
44
+ var CONNECT_SKILL_DESCRIPTION = `Build UI the way this team has decided it should be built. Use BEFORE building, changing, or restyling any page, screen, view, form, or component \u2014 "build a page", "add a screen", "create a form", "make a dashboard", "redesign this", "new landing page" \u2014 and when asked how this product should look or behave. Reads the team's written product decisions from their Superhands MCP server.`;
45
+ var CONNECT_SKILL_CONTENT = `---
46
+ name: ${CONNECT_SKILL_DIR}
47
+ description: ${CONNECT_SKILL_DESCRIPTION}
48
+ ---
49
+
50
+ ${VERSION_MARKER}
51
+
52
+ # Superhands
53
+
54
+ This machine is connected to the team's Superhands server over MCP (server
55
+ key \`${MCP_SERVER_KEY}\`). It holds the decisions the team has written down
56
+ about how their product should look and behave \u2014 the same decisions their
57
+ engineers' pull requests are reviewed against.
58
+
59
+ Before you build, change, or restyle any UI:
60
+
61
+ 1. Call the \`superhands_get_guidance\` MCP tool with \`intent\` set to what
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". The decisions that govern
64
+ that work come back in full, ahead of the rest.
65
+ 2. Build to what comes back. Where a decision names a case it deliberately
66
+ does not govern, your own judgment resumes there.
67
+ 3. When you have finished \u2014 not part-way through \u2014 send the files you wrote or
68
+ changed with \`superhands_report_completed_build\`, naming the \`route\` if
69
+ you know it. The team looks at what their agents build there; it records
70
+ and does not review, so a failed report costs the work nothing.
71
+ 4. When you finish, say you followed the team's guidance \u2014 never that your
72
+ work passes it or was checked. Reading guidance is not a review, reporting
73
+ a build is not a review, and nothing has looked at what you built.
74
+
75
+ If the tool answers \`no-guidance\`, carry on with what you were asked for and
76
+ mention that the team writes its guidance on the Superhands Guidance page.
77
+
78
+ If the \`${MCP_SERVER_KEY}\` MCP server is not reachable in this session, say
79
+ so rather than guessing at the team's decisions \u2014 it is configured on this
80
+ machine, so a missing connection is worth telling the person about.
81
+ `;
82
+ function installedSkillVersion(contents) {
83
+ const match = contents.match(/superhands-skill-version:\s*(\d+)/);
84
+ return match ? Number.parseInt(match[1], 10) : 0;
85
+ }
86
+
38
87
  // lib/connect-client-entry.ts
39
88
  function say(line) {
40
89
  process.stdout.write(`superhands: ${line}
@@ -78,6 +127,23 @@ function appendedCodexConfig(existing, args) {
78
127
  return { text: `${existing}${sep}${codexConfigBlock(args)}
79
128
  `, alreadyPresent: false };
80
129
  }
130
+ function writeSkill(clientDir) {
131
+ const skillPath = join(clientDir, "skills", CONNECT_SKILL_DIR, CONNECT_SKILL_FILENAME);
132
+ try {
133
+ let existing = "";
134
+ try {
135
+ existing = readFileSync(skillPath, "utf8");
136
+ } catch {
137
+ existing = "";
138
+ }
139
+ if (existing !== "" && installedSkillVersion(existing) >= CONNECT_SKILL_VERSION) return;
140
+ mkdirSync(dirname(skillPath), { recursive: true });
141
+ writeFileSync(skillPath, CONNECT_SKILL_CONTENT);
142
+ say(` Wrote the ${CONNECT_SKILL_DIR} skill to ${skillPath} \u2014 it routes UI work through the team's guidance.`);
143
+ } catch {
144
+ say(` Could not write the ${CONNECT_SKILL_DIR} skill at ${skillPath}. The connection works without it.`);
145
+ }
146
+ }
81
147
  function hasCli(bin) {
82
148
  try {
83
149
  execFileSync(bin, ["--version"], { stdio: "ignore" });
@@ -99,10 +165,10 @@ function openCursor() {
99
165
  }
100
166
  async function main() {
101
167
  const token = process.env[CONNECT_TOKEN_ENV]?.trim();
102
- const endpoint = process.env[CONNECT_URL_ENV]?.trim();
103
- if (!token || !endpoint) {
168
+ const endpoint = process.env[CONNECT_URL_ENV]?.trim() || CONNECT_DEFAULT_MCP_URL;
169
+ if (!token) {
104
170
  stop(
105
- `this command needs ${CONNECT_TOKEN_ENV} and ${CONNECT_URL_ENV} set on the same line. Copy the whole command from Superhands setup and run it unchanged.`
171
+ `this command needs ${CONNECT_TOKEN_ENV} set on the same line. Copy the whole command from Superhands setup and run it unchanged.`
106
172
  );
107
173
  }
108
174
  const flags = new Set(process.argv.slice(2));
@@ -136,6 +202,7 @@ async function main() {
136
202
  } else {
137
203
  say(` Open Cursor (restart it if it was running), then enable ${MCP_SERVER_KEY} under Settings \u2192 MCP.`);
138
204
  }
205
+ writeSkill(cursorDir);
139
206
  connected += 1;
140
207
  } catch {
141
208
  say(`Cursor \u2014 ${configPath} is not valid JSON, so it was left untouched.`);
@@ -169,6 +236,7 @@ async function main() {
169
236
  );
170
237
  say(`Claude Code \u2014 added the ${MCP_SERVER_KEY} server (user scope).`);
171
238
  say(" Open a new claude session and it connects on start.");
239
+ writeSkill(join(homedir(), ".claude"));
172
240
  connected += 1;
173
241
  } catch {
174
242
  say("Claude Code \u2014 `claude mcp add` failed. Run it by hand from the Superhands MCP page.");
@@ -188,12 +256,14 @@ async function main() {
188
256
  if (result.alreadyPresent) {
189
257
  say(`Codex \u2014 ${configPath} already names a ${MCP_SERVER_KEY} server, so it was left as it is.`);
190
258
  say(" If that connection is stale, update bearer_token there by hand.");
259
+ writeSkill(codexDir);
191
260
  connected += 1;
192
261
  } else {
193
262
  mkdirSync(dirname(configPath), { recursive: true });
194
263
  writeFileSync(configPath, result.text);
195
264
  say(`Codex \u2014 added the ${MCP_SERVER_KEY} server to ${configPath}.`);
196
265
  say(" The app and the CLI both read this config \u2014 open either and it connects when a session starts.");
266
+ writeSkill(codexDir);
197
267
  connected += 1;
198
268
  }
199
269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-hands/connect",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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"