worktrust 0.6.2 → 0.6.3

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/package.json +1 -1
  2. package/setup-mcp.mjs +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrust",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Couple this computer to WorkTrust: approve a code in your browser, and every AI app here reports what you built. Metadata only, no dependencies.",
5
5
  "type": "module",
6
6
  "bin": {
package/setup-mcp.mjs CHANGED
@@ -111,7 +111,8 @@ for (const client of CLIENTS) {
111
111
  continue;
112
112
  }
113
113
  const text = existsSync(client.file) ? readFileSync(client.file, "utf8") : "";
114
- const already = text.includes(URL_) || (BRIDGE !== undefined && text.includes(JSON.stringify(BRIDGE).slice(1, -1))) || (REMOVE && /worktrust\.mjs/.test(text));
114
+ // With the bridge, coupled means the bridge is in AND no entry with a key in it is left beside it.
115
+ const already = REMOVE ? text.includes(URL_) || /worktrust\.mjs/.test(text) : BRIDGE !== undefined ? text.includes(JSON.stringify(BRIDGE).slice(1, -1)) && !text.includes(URL_) : text.includes(URL_);
115
116
  // THE WAY OUT, ON THE MACHINE. Uncoupling in the app ends the TOKEN; the config that names the
116
117
  // door stays behind on every client here, so the next person to read this file believes the
117
118
  // machine is coupled. `--remove` takes the entry out; the account side is a separate act and
@@ -132,7 +133,10 @@ for (const client of CLIENTS) {
132
133
  } else if (client.shape === "toml") {
133
134
  const text = readFileSync(client.file, "utf8");
134
135
  // The block and nothing after it: from its own header to the next one, or the end.
135
- const stripped = text.replace(new RegExp(`\\n?\\[mcp_servers\\.${NAME}\\][^\\[]*`, "g"), "\n");
136
+ // Every block that names the door, under any name (a hand-made one too, 2026-10-04), or ours.
137
+ // A block runs to the next table header at the START of a line, never to the next "[" — the
138
+ // bridge's own `args = ["…", "mcp"]` holds one, and cutting there left half a block behind.
139
+ const stripped = text.replace(/\n?\[mcp_servers\.("?)([A-Za-z0-9_.-]+)\1\][\s\S]*?(?=\n\[|$)/g, (block, _q, name) => (name === NAME || block.includes(URL_) || /worktrust\.mjs/.test(block) ? "" : block));
136
140
  console.log(` − ${client.label}: ${WRITE ? "removed from" : "would remove from"} ${client.file}`);
137
141
  if (WRITE) writeFileSync(client.file, stripped);
138
142
  }