worktrust 0.0.0-stage → 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 +21 -0
- package/README.md +99 -2
- package/SECURITY.md +42 -0
- package/count-behaviour.mjs +1430 -0
- package/log-session.mjs +858 -0
- package/package.json +41 -4
- package/setup-mcp.mjs +140 -0
- package/worktrust.mjs +470 -0
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
|
@@ -1,3 +1,100 @@
|
|
|
1
|
-
#
|
|
1
|
+
# worktrust
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Couple a computer to [WorkTrust](https://worktrust.io) in one command. WorkTrust keeps a verified
|
|
4
|
+
record of the work you do with AI without anyone reading that work: it receives metadata only.
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
npx worktrust
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
**The only official package** is `worktrust`, published by the npm account **worktrustio** with
|
|
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. Without npm, the same script runs
|
|
13
|
+
from WorkTrust's own site:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
curl -fsSO https://app.worktrust.io/counter/worktrust.mjs && node worktrust.mjs
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## What happens
|
|
20
|
+
|
|
21
|
+
1. **A plan, then a question.** The command lists every AI app it found on this computer and the
|
|
22
|
+
file each one gets changed, then asks `Continue? [Y/n]`. Nothing is written or sent before you
|
|
23
|
+
answer. `--dry-run` shows the plan and stops.
|
|
24
|
+
2. **Approve this computer in your browser.** WorkTrust opens; you see this computer's name, its
|
|
25
|
+
system and the AI apps that will get the WorkTrust door, and approve it, signed in with your own account and second factor. That decides which
|
|
26
|
+
WorkTrust account the computer belongs to: the terminal never sees a password and cannot choose
|
|
27
|
+
an account. Nothing is typed: the browser is sent back to this computer (127.0.0.1), where the
|
|
28
|
+
terminal waits for one answer and exchanges it with a secret only it holds (PKCE). A link
|
|
29
|
+
forwarded to someone else approves nothing they can collect.
|
|
30
|
+
Without a browser (over SSH, or `--device`), the terminal shows a code that you type yourself at
|
|
31
|
+
app.worktrust.io/connect/computer on another device.
|
|
32
|
+
3. **The terminal finishes by itself.** It keeps the key in its private file and gives every
|
|
33
|
+
AI app here the WorkTrust door, then installs the session hook. Quit your AI apps and open them
|
|
34
|
+
again.
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
npx worktrust status what is coupled here
|
|
38
|
+
npx worktrust disconnect take it out again (shows the plan, asks first)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Where the key lives, and why it only works here
|
|
42
|
+
|
|
43
|
+
The key is kept in **one file only you can read**: `~/.worktrust/key.json` (mode 600, in a folder of
|
|
44
|
+
mode 700). No keychain is touched: a keychain tool can offer to "reset" a keychain it cannot find,
|
|
45
|
+
which would delete every password on the computer, and many people rightly keep tools out of it.
|
|
46
|
+
|
|
47
|
+
- **No AI app holds the key.** Each runs a small local bridge, `node ~/.worktrust/worktrust.mjs mcp`,
|
|
48
|
+
which reads the file and speaks to WorkTrust for it; the session hook runs through
|
|
49
|
+
`worktrust.mjs hook` the same way. A config file you share, a dotfiles repository or a screenshot
|
|
50
|
+
of an app's settings carries no key.
|
|
51
|
+
- **The key only works on this computer.** `connect` makes an Ed25519 key pair; WorkTrust keeps the
|
|
52
|
+
public half, the private half stays in the key file. Every call is signed (method, path, time, a
|
|
53
|
+
one-time nonce, the body's hash) and WorkTrust refuses a call through this key without a fresh
|
|
54
|
+
signature. A key that leaks without the file, from a log, a proxy or a config, is worth nothing.
|
|
55
|
+
- **The key renews itself every week.** A new secret is made here, only its hash is sent, signed,
|
|
56
|
+
and last week's key stops working.
|
|
57
|
+
- `npx worktrust --direct` writes a plain key into the apps' settings instead, for an app
|
|
58
|
+
that cannot run a local command. Such a key is not bound to the computer and does not renew.
|
|
59
|
+
|
|
60
|
+
## What it reads, writes and sends
|
|
61
|
+
|
|
62
|
+
| | |
|
|
63
|
+
|---|---|
|
|
64
|
+
| **Reads** | Which AI apps are installed (the settings folders of Claude Code, Codex, Cursor, Gemini CLI, VS Code, Windsurf). Afterwards, the session hook reads Claude Code's and Codex's own session files on this computer to measure durations and token counts. |
|
|
65
|
+
| **Writes** | The key file (above). In each AI app's MCP settings (`~/.claude.json` through `claude mcp`, `~/.cursor/mcp.json`, `~/.codex/config.toml`, `~/.gemini/settings.json`, VS Code's `mcp.json`, Windsurf's `mcp_config.json`) a WorkTrust entry that runs the local bridge, with no key in it; three hooks in `~/.claude/settings.json`; the bridge, the hook and the counter in `~/.worktrust/`. |
|
|
66
|
+
| **Sends, to pair** | This computer's system (macOS, Windows, Linux) and host name. Not its network address. |
|
|
67
|
+
| **Sends, afterwards** | Durations, token counts, model names, one layer keyword (frontend, backend …), counts of how you work. |
|
|
68
|
+
| **Never sends** | Prompts, answers, code, file names or paths, commit messages, branch or project names. The door has no field for them and refuses a submission that carries them. |
|
|
69
|
+
|
|
70
|
+
## Why you can check it
|
|
71
|
+
|
|
72
|
+
- **No dependencies and no install scripts.** Four plain files, about 2,600 lines in total, readable
|
|
73
|
+
in an afternoon: `worktrust.mjs` (this command), `setup-mcp.mjs` (writes the MCP entries),
|
|
74
|
+
`log-session.mjs` (the session hook) and `count-behaviour.mjs` (the local counter).
|
|
75
|
+
- **Nothing is downloaded at run time.** Everything that runs is in the package. The counter is
|
|
76
|
+
pinned: it is not replaced from the network; a new one comes with a new version of this package.
|
|
77
|
+
- **Provenance.** Every version is built and published from a public repository by GitHub Actions
|
|
78
|
+
with npm provenance: the npm page links each version to the exact commit it was built from,
|
|
79
|
+
signed through Sigstore. `npm audit signatures` checks it on your machine.
|
|
80
|
+
- **Read it before you run it:** `npm pack worktrust` downloads the package as a file without
|
|
81
|
+
running anything.
|
|
82
|
+
- **The key** never appears on a command line a process list could show: it is written to its file
|
|
83
|
+
and reaches the bridge and the hook only in their environment.
|
|
84
|
+
|
|
85
|
+
## Undo
|
|
86
|
+
|
|
87
|
+
`npx worktrust disconnect` removes the WorkTrust entries, the hook and the key file, and empties
|
|
88
|
+
`~/.worktrust`.
|
|
89
|
+
Then revoke the key in WorkTrust: Sources → Devices → this computer → Revoke.
|
|
90
|
+
|
|
91
|
+
## Requirements
|
|
92
|
+
|
|
93
|
+
Node 18 or later. macOS, Linux or Windows.
|
|
94
|
+
|
|
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/SECURITY.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Reporting a problem
|
|
4
|
+
|
|
5
|
+
Write to **hello@worktrust.io** with "security" in the subject. Please do not open a public issue
|
|
6
|
+
for a vulnerability. You will get an answer within three working days.
|
|
7
|
+
|
|
8
|
+
## What this package can and cannot do
|
|
9
|
+
|
|
10
|
+
- It writes only the files listed in the README, after showing them and asking. `--dry-run` writes
|
|
11
|
+
nothing and sends nothing.
|
|
12
|
+
- It contacts one host: the WorkTrust app (`https://app.worktrust.io` unless you pass `--origin`).
|
|
13
|
+
It downloads nothing when run from npm.
|
|
14
|
+
- The key it receives is a WorkTrust coupling for this computer: it can submit work metadata to your
|
|
15
|
+
record and cannot read your record back. Revoke it in WorkTrust at any time.
|
|
16
|
+
- Approving requires your WorkTrust session and second factor. A pairing expires after ten minutes
|
|
17
|
+
and gives out its key once.
|
|
18
|
+
- By default the key can only reach the terminal on the computer whose browser approved it: the
|
|
19
|
+
browser returns a one-time code to 127.0.0.1, and the key is issued only to the terminal holding
|
|
20
|
+
the matching PKCE verifier (S256). The terminal listens on 127.0.0.1 only, for one answer that
|
|
21
|
+
carries the state it chose.
|
|
22
|
+
- The typed-code way (no browser, `--device`) is the one a stranger could try to abuse by asking you
|
|
23
|
+
to type their code. The code is never put in a link; type only a code your own terminal shows.
|
|
24
|
+
|
|
25
|
+
## Where the key is, and how long it lives
|
|
26
|
+
|
|
27
|
+
- In `~/.worktrust/key.json`, readable by you alone (600 in a 700 folder). No keychain is used. Not
|
|
28
|
+
in any AI app's settings, unless you chose `--direct`.
|
|
29
|
+
- Bound to this computer: every call carries an Ed25519 signature made with a private key that is in
|
|
30
|
+
that file only. WorkTrust refuses a bound key without a fresh signature (two minutes, a nonce that
|
|
31
|
+
is spent once), so a key leaked from a log or a config is useless on its own. Someone who can read
|
|
32
|
+
your home folder can read the file: revoke the computer in WorkTrust if that happens.
|
|
33
|
+
- Renewed every week by the computer itself: only the new key's hash is sent, signed, and the old
|
|
34
|
+
key stops working.
|
|
35
|
+
- The key can submit metadata to your record and cannot read it back. It ends when you revoke it,
|
|
36
|
+
and by itself 90 days after its last use.
|
|
37
|
+
|
|
38
|
+
## Verifying a version
|
|
39
|
+
|
|
40
|
+
Each version is published from the public repository by GitHub Actions with npm provenance.
|
|
41
|
+
On npmjs.com the version shows where and from which commit it was built; locally,
|
|
42
|
+
`npm audit signatures` checks the signatures of what you installed.
|