worktrust 0.6.6 → 0.6.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/package.json +1 -1
- package/worktrust.mjs +30 -1
package/package.json
CHANGED
package/worktrust.mjs
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
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
13
|
* npx worktrust import import earlier Claude or ChatGPT conversations (copies the prompt, opens a chat)
|
|
14
|
+
* npx worktrust sources connect GitHub, Vercel, Supabase or Hugging Face (opens each approval page)
|
|
14
15
|
* npx worktrust disconnect show what comes out, ask, take it out again
|
|
15
16
|
* npx worktrust status what is coupled here
|
|
16
17
|
*
|
|
@@ -64,6 +65,8 @@ const VALUED = ["--name", "--origin", "--url"];
|
|
|
64
65
|
const command = args.find((arg, at) => !arg.startsWith("--") && !(at > 0 && VALUED.includes(args[at - 1]))) ?? (args.includes("--help") ? "help" : "default");
|
|
65
66
|
const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
|
|
66
67
|
const has = (name) => args.includes(`--${name}`);
|
|
68
|
+
/** This CLI's version, said to the door so the app can tell which computer runs an old one (check-cli-package holds it equal to package.json). */
|
|
69
|
+
const CLI_VERSION = "0.6.7";
|
|
67
70
|
const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.worktrust.io").replace(/\/$/, "");
|
|
68
71
|
const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
|
|
69
72
|
const HOME_DIR = join(homedir(), ".worktrust");
|
|
@@ -325,7 +328,7 @@ async function bridge() {
|
|
|
325
328
|
if (!line.trim()) continue;
|
|
326
329
|
let message;
|
|
327
330
|
try { message = JSON.parse(line); } catch { continue; }
|
|
328
|
-
if (message.method === "initialize" && message.params?.clientInfo?.name) agent = `${message.params.clientInfo.name}/${message.params.clientInfo.version ?? "0"} (worktrust-bridge)`;
|
|
331
|
+
if (message.method === "initialize" && message.params?.clientInfo?.name) agent = `${message.params.clientInfo.name}/${message.params.clientInfo.version ?? "0"} (worktrust-bridge) worktrust-cli/${CLI_VERSION}`;
|
|
329
332
|
if (!key) { if (message.id !== undefined) answer(message.id, "WorkTrust is not connected on this computer: run `npx worktrust connect`."); continue; }
|
|
330
333
|
try {
|
|
331
334
|
const response = await fetch(key.url, { method: "POST", headers: { "content-type": "application/json", accept: "application/json, text/event-stream", authorization: `Bearer ${key.token}`, "user-agent": agent, ...(session ? { "mcp-session-id": session } : {}), ...proof(key.device, key.url, line) }, body: line });
|
|
@@ -404,6 +407,7 @@ async function connect() {
|
|
|
404
407
|
if ((await run(paths["log-session.mjs"], hookArgs, token)).code !== 0) fail("installing the session hook failed; the output above says where.");
|
|
405
408
|
await offerHistory(paths, token, device ? device.privateKey.export({ format: "pem", type: "pkcs8" }) : null);
|
|
406
409
|
await offerWeb();
|
|
410
|
+
await offerSources();
|
|
407
411
|
say();
|
|
408
412
|
say(" Done. Quit your AI apps completely and open them again. This computer appears in WorkTrust");
|
|
409
413
|
say(" under Sources → Devices once one of them has spoken.");
|
|
@@ -476,6 +480,29 @@ async function handOverPrompt(web) {
|
|
|
476
480
|
openBrowser(web.chat);
|
|
477
481
|
}
|
|
478
482
|
|
|
483
|
+
/**
|
|
484
|
+
* THE OTHER SOURCES, FROM HERE (owner, 2026-10-04): GitHub, Vercel, Supabase and Hugging Face couple
|
|
485
|
+
* in the browser, through the same doors as the buttons under Sources — each opens its own approval
|
|
486
|
+
* page where the person is already signed in to WorkTrust. One [y/N] per source; Enter means No.
|
|
487
|
+
*/
|
|
488
|
+
const CLOUD = [
|
|
489
|
+
{ name: "GitHub", path: "/api/connect/github", what: "commits, checks and deployments, as counts" },
|
|
490
|
+
{ name: "Vercel", path: "/api/connect/vercel", what: "deployments and their outcomes" },
|
|
491
|
+
{ name: "Supabase", path: "/api/connect/supabase", what: "database projects and migrations, as counts" },
|
|
492
|
+
{ name: "Hugging Face", path: "/api/connect/huggingface", what: "models, datasets and spaces you published" },
|
|
493
|
+
];
|
|
494
|
+
async function offerSources() {
|
|
495
|
+
if (has("dry-run")) return;
|
|
496
|
+
say();
|
|
497
|
+
for (const source of CLOUD) {
|
|
498
|
+
if (!(await ask(`Also connect ${source.name} (${source.what})?`, false))) continue;
|
|
499
|
+
const page = new URL(source.path, ORIGIN).toString();
|
|
500
|
+
say(` Opening ${page}: approve there, signed in to WorkTrust.`);
|
|
501
|
+
openBrowser(page);
|
|
502
|
+
if (process.stdin.isTTY) { const prompt = createInterface({ input: process.stdin, output: process.stdout }); await prompt.question(" Press Enter when it is approved (or to skip). "); prompt.close(); }
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
479
506
|
/**
|
|
480
507
|
* `npx worktrust import` (owner, 2026-10-04): the earlier conversations, later. For whoever skipped
|
|
481
508
|
* the question after connecting, or connected on the web without this computer. Each product asks.
|
|
@@ -546,6 +573,7 @@ function help() {
|
|
|
546
573
|
say(" worktrust history send this computer's earlier sessions as history (asks first)");
|
|
547
574
|
say(" worktrust web connect Claude or ChatGPT on the web: copies the address, opens the page");
|
|
548
575
|
say(" worktrust import import your earlier Claude or ChatGPT conversations: copies the prompt, opens a chat");
|
|
576
|
+
say(" worktrust sources connect GitHub, Vercel, Supabase or Hugging Face: opens each approval page");
|
|
549
577
|
say(" worktrust disconnect take WorkTrust out of every AI app here (asks first)");
|
|
550
578
|
say(" worktrust status what is coupled here");
|
|
551
579
|
}
|
|
@@ -560,6 +588,7 @@ else if (command === "connect") await connect();
|
|
|
560
588
|
else if (command === "history") await history();
|
|
561
589
|
else if (command === "web") await offerWeb();
|
|
562
590
|
else if (command === "import") await importConversations();
|
|
591
|
+
else if (command === "sources") await offerSources();
|
|
563
592
|
else if (command === "disconnect") await disconnect();
|
|
564
593
|
else if (command === "status") status();
|
|
565
594
|
else help();
|