worktrust 0.4.1 → 0.5.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WorkTrust
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -4,16 +4,16 @@ Couple a computer to [WorkTrust](https://worktrust.io) in one command. WorkTrust
4
4
  record of the work you do with AI without anyone reading that work: it receives metadata only.
5
5
 
6
6
  ```
7
- npx worktrust connect
7
+ npx worktrust
8
8
  ```
9
9
 
10
10
  **The only official package** is `worktrust`, published by the npm account **worktrustio** with
11
11
  provenance from this repository (github.com/fhomey/worktrust-cli). Check it on npmjs.com before you run
12
- it; a package of another name or from another publisher is not ours. Until the first version is on npm,
13
- use the same script from WorkTrust's own site:
12
+ it; a package of another name or from another publisher is not ours. Without npm, the same script runs
13
+ from WorkTrust's own site:
14
14
 
15
15
  ```
16
- curl -fsSO https://app.worktrust.io/counter/worktrust.mjs && node worktrust.mjs connect
16
+ curl -fsSO https://app.worktrust.io/counter/worktrust.mjs && node worktrust.mjs
17
17
  ```
18
18
 
19
19
  ## What happens
@@ -54,7 +54,7 @@ which would delete every password on the computer, and many people rightly keep
54
54
  signature. A key that leaks without the file, from a log, a proxy or a config, is worth nothing.
55
55
  - **The key renews itself every week.** A new secret is made here, only its hash is sent, signed,
56
56
  and last week's key stops working.
57
- - `npx worktrust connect --direct` writes a plain key into the apps' settings instead, for an app
57
+ - `npx worktrust --direct` writes a plain key into the apps' settings instead, for an app
58
58
  that cannot run a local command. Such a key is not bound to the computer and does not renew.
59
59
 
60
60
  ## What it reads, writes and sends
@@ -93,3 +93,8 @@ Then revoke the key in WorkTrust: Sources → Devices → this computer → Revo
93
93
  Node 18 or later. macOS, Linux or Windows.
94
94
 
95
95
  Security reports: see [SECURITY.md](SECURITY.md).
96
+
97
+ ## Licence
98
+
99
+ MIT, for this command-line tool only (see LICENSE). The WorkTrust service it couples to is not
100
+ open source.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrust",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
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": {
@@ -12,12 +12,13 @@
12
12
  "log-session.mjs",
13
13
  "count-behaviour.mjs",
14
14
  "README.md",
15
- "SECURITY.md"
15
+ "SECURITY.md",
16
+ "LICENSE"
16
17
  ],
17
18
  "engines": {
18
19
  "node": ">=18"
19
20
  },
20
- "license": "UNLICENSED",
21
+ "license": "MIT",
21
22
  "homepage": "https://worktrust.io",
22
23
  "keywords": [
23
24
  "worktrust",
package/worktrust.mjs CHANGED
@@ -2,10 +2,12 @@
2
2
  /**
3
3
  * WorkTrust on a computer, in one command — like `gh auth login` (2026-10-03).
4
4
  *
5
- * npx worktrust connect show the plan, ask, approve a code in the app, couple
6
- * npx worktrust connect --dry-run show the plan only; nothing is written, nothing is sent
7
- * npx worktrust connect --yes no question (for scripts); the computer is still approved in the app
8
- * npx worktrust connect --device a computer without a browser (SSH): type a code on another device
5
+ * npx worktrust show the plan, ask, approve this computer in the app, couple;
6
+ * on a computer already coupled: what is coupled here
7
+ * npx worktrust --dry-run show the plan only; nothing is written, nothing is sent
8
+ * npx worktrust --yes no question (for scripts); the computer is still approved in the app
9
+ * npx worktrust --device a computer without a browser (SSH): type a code on another device
10
+ * npx worktrust connect couple again, also on a computer already coupled
9
11
  * npx worktrust disconnect show what comes out, ask, take it out again
10
12
  * npx worktrust status what is coupled here
11
13
  *
@@ -56,7 +58,7 @@ import { fileURLToPath } from "node:url";
56
58
 
57
59
  const args = process.argv.slice(2);
58
60
  const VALUED = ["--name", "--origin", "--url"];
59
- const command = args.find((arg, at) => !arg.startsWith("--") && !(at > 0 && VALUED.includes(args[at - 1]))) ?? "help";
61
+ const command = args.find((arg, at) => !arg.startsWith("--") && !(at > 0 && VALUED.includes(args[at - 1]))) ?? (args.includes("--help") ? "help" : "default");
60
62
  const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
61
63
  const has = (name) => args.includes(`--${name}`);
62
64
  const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.worktrust.io").replace(/\/$/, "");
@@ -432,7 +434,7 @@ function status() {
432
434
  for (const project of Object.values(config.projects ?? {})) Object.assign(servers, project.mcpServers ?? {});
433
435
  } catch { /* no Claude Code here */ }
434
436
  const door = Object.entries(servers).find(([name, server]) => /worktrust/i.test(`${name} ${server?.url ?? ""} ${(server?.args ?? []).join(" ")}`));
435
- say(door ? ` Claude Code: coupled (${door[1].url ?? "through the local bridge"})` : " Claude Code: not coupled. Run `worktrust connect`.");
437
+ say(door ? ` Claude Code: coupled (${door[1].url ?? "through the local bridge"})` : " Claude Code: not coupled. Run `npx worktrust connect`.");
436
438
  const key = keyStore.load();
437
439
  say(key ? ` Key: in ${KEY_PLACE}, ${key.device ? "bound to this computer, " : ""}last renewed ${String(key.renewedAt ?? "").slice(0, 10) || "never"}` : " Key: not on this computer (or written into the apps' settings with --direct)");
438
440
  let hook = false;
@@ -444,17 +446,23 @@ function status() {
444
446
  function help() {
445
447
  say("WorkTrust: couple this computer to your record. Metadata only.");
446
448
  say();
447
- say(" worktrust connect show the plan, ask, approve a code in your browser, couple");
449
+ say(" worktrust couple this computer: show the plan, ask, approve in your browser");
450
+ say(" (already coupled: shows what is coupled here)");
448
451
  say(" --dry-run the plan only: nothing is written, nothing is sent");
449
452
  say(" --yes no question (the computer is still approved in the browser)");
450
453
  say(" --device no browser here (SSH): type a code on another device");
451
454
  say(" --name <name> the name this computer gets (default: its host name)");
452
455
  say(" --direct put the key in each app's settings instead of the key file");
456
+ say(" worktrust connect couple again, also when this computer is already coupled");
453
457
  say(" worktrust disconnect take WorkTrust out of every AI app here (asks first)");
454
458
  say(" worktrust status what is coupled here");
455
459
  }
456
460
 
457
- if (command === "mcp") await bridge();
461
+ // THE BARE COMMAND COUPLES (owner, 2026-10-03: "zo kort mogelijk"). `npx worktrust` on a computer
462
+ // without a key here shows the plan and asks, exactly as `connect` does; with one it says what is
463
+ // coupled, so running it twice never re-pairs by surprise.
464
+ if (command === "default") { if (keyStore.load()) { status(); say(); say(" This computer is coupled. `npx worktrust connect` couples it again; `npx worktrust disconnect` takes it out."); } else await connect(); }
465
+ else if (command === "mcp") await bridge();
458
466
  else if (command === "hook") await hook();
459
467
  else if (command === "connect") await connect();
460
468
  else if (command === "disconnect") await disconnect();