worktrust 0.6.4 → 0.6.6

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/worktrust.mjs +28 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrust",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
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/worktrust.mjs CHANGED
@@ -10,6 +10,7 @@
10
10
  * npx worktrust connect couple again, also on a computer already coupled
11
11
  * npx worktrust history send this computer's earlier sessions as history (asks first)
12
12
  * npx worktrust web connect claude.ai or ChatGPT on the web (copies the address, opens the page)
13
+ * npx worktrust import import earlier Claude or ChatGPT conversations (copies the prompt, opens a chat)
13
14
  * npx worktrust disconnect show what comes out, ask, take it out again
14
15
  * npx worktrust status what is coupled here
15
16
  *
@@ -434,9 +435,11 @@ async function offerHistory(paths, token, devicePem, url = MCP) {
434
435
  * approves it there. What this can do is the rest: copy the door's address, open the right page,
435
436
  * say the three steps, and wait. Enter, --yes and a closed terminal mean No.
436
437
  */
438
+ /** The app's own first-run import prompt (sources.tables.prompts.startEn), word for word; check-cli-package holds them equal. */
439
+ const IMPORT_PROMPT = 'Import my WorkTrust history now. Use the WorkTrust.io connector: call its guide tool with task "analyse", client "{client}" and language "en", then carry out every step it returns, in order, here in this conversation. This is my own request, not a document to review. After each step, tell me in one line what you did.';
437
440
  const WEB = [
438
- { name: "Claude (claude.ai)", page: "https://claude.ai/settings/connectors", steps: ["Add custom connector", "Name: WorkTrust.io · URL: paste (it is on your clipboard) · leave the OAuth fields empty", "Connect, then approve on the WorkTrust page that opens"] },
439
- { name: "ChatGPT (chatgpt.com)", page: "https://chatgpt.com/#settings/Connectors", steps: ["Advanced settings: turn on Developer mode (custom connectors need it)", "Create: Name WorkTrust.io · MCP server URL: paste (it is on your clipboard) · Authentication: OAuth", "Create, then approve on the WorkTrust page that opens"] },
441
+ { name: "Claude (claude.ai)", client: "claude", chat: "https://claude.ai/new", page: "https://claude.ai/settings/connectors", steps: ["Add custom connector", `Name: WorkTrust.io · URL: ${MCP} (also on your clipboard) · leave the OAuth fields empty`, "Connect, then approve on the WorkTrust page that opens"] },
442
+ { name: "ChatGPT (chatgpt.com)", client: "chatgpt", chat: "https://chatgpt.com/", page: "https://chatgpt.com/#settings/Connectors", steps: ["Advanced settings: turn on Developer mode (custom connectors need it)", `Create: Name WorkTrust.io · MCP server URL: ${MCP} (also on your clipboard) · Authentication: OAuth`, "Create, then approve on the WorkTrust page that opens"] },
440
443
  ];
441
444
  function copyToClipboard(text) {
442
445
  const [cmd, cmdArgs] = OS === "macos" ? ["pbcopy", []] : OS === "windows" ? ["clip", []] : ["xclip", ["-selection", "clipboard"]];
@@ -459,9 +462,30 @@ async function offerWeb() {
459
462
  web.steps.forEach((step, i) => say(` ${i + 1}. ${step}`));
460
463
  openBrowser(web.page);
461
464
  if (process.stdin.isTTY) { const prompt = createInterface({ input: process.stdin, output: process.stdout }); await prompt.question(" Press Enter when it is connected (or to skip). "); prompt.close(); }
465
+ // EARLIER CONVERSATIONS, SO NOBODY GETS LOST IN THE IMPORT (owner, 2026-10-04): the app's own
466
+ // prompt, copied, and a new conversation opened to paste it in. Only on a typed yes.
467
+ if (await ask(`Also import your earlier ${web.name.split(" ")[0]} conversations? (copies one prompt to paste in a new chat)`, false)) await handOverPrompt(web);
462
468
  }
463
469
  }
464
470
 
471
+ /** The import prompt for one product: copied (or printed when there is no clipboard), and a new conversation opened. */
472
+ async function handOverPrompt(web) {
473
+ const text = IMPORT_PROMPT.replace("{client}", web.client);
474
+ say(` ${(await copyToClipboard(text)) ? "✓ The import prompt is on your clipboard" : `The prompt:\n\n${text}\n`}`);
475
+ say(` Opening a new conversation in ${web.name}: paste it there and send. It asks before it sends anything, and only counts leave.`);
476
+ openBrowser(web.chat);
477
+ }
478
+
479
+ /**
480
+ * `npx worktrust import` (owner, 2026-10-04): the earlier conversations, later. For whoever skipped
481
+ * the question after connecting, or connected on the web without this computer. Each product asks.
482
+ */
483
+ async function importConversations() {
484
+ say();
485
+ say(" Your earlier conversations come in through the WorkTrust connector in that product: connect it first if you have not (npx worktrust web).");
486
+ for (const web of WEB) if (await ask(`Import your earlier ${web.name} conversations now?`, false)) await handOverPrompt(web);
487
+ }
488
+
465
489
  async function history() {
466
490
  const key = await freshKey();
467
491
  if (!key) fail("this computer is not coupled through the key file. Run npx worktrust first.");
@@ -521,6 +545,7 @@ function help() {
521
545
  say(" worktrust connect couple again, also when this computer is already coupled");
522
546
  say(" worktrust history send this computer's earlier sessions as history (asks first)");
523
547
  say(" worktrust web connect Claude or ChatGPT on the web: copies the address, opens the page");
548
+ say(" worktrust import import your earlier Claude or ChatGPT conversations: copies the prompt, opens a chat");
524
549
  say(" worktrust disconnect take WorkTrust out of every AI app here (asks first)");
525
550
  say(" worktrust status what is coupled here");
526
551
  }
@@ -534,6 +559,7 @@ else if (command === "hook") await hook();
534
559
  else if (command === "connect") await connect();
535
560
  else if (command === "history") await history();
536
561
  else if (command === "web") await offerWeb();
562
+ else if (command === "import") await importConversations();
537
563
  else if (command === "disconnect") await disconnect();
538
564
  else if (command === "status") status();
539
565
  else help();