@unhuman/wsync-cli 0.3.0 → 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/README.md +38 -107
- package/dist/wsync.mjs +203 -7316
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,138 +1,69 @@
|
|
|
1
1
|
# @unhuman/wsync-cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Connects Claude Code to a **Work Context** workstream's memories over MCP, so every session — on this
|
|
4
|
+
machine or another — reads and writes the same Markdown notes: how to build, conventions, gotchas,
|
|
5
|
+
decisions, where a piece of work stands.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
still prints `{}` and exits `0`.
|
|
7
|
+
The CLI records nothing. It writes a link for a directory, registers the MCP server for it
|
|
8
|
+
(`claude mcp add … unhuman …`), and then gets out of the way.
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
1. In Unhuman, open **Work Context**, pick (or create) a project in the rail, and mint a capture key
|
|
14
|
-
(`wsp_…`) from its **Capture keys** action. (The in-app **How to connect** guide on that page walks
|
|
15
|
-
through both this and the MCP side.)
|
|
16
|
-
2. Inside the repository you want captured:
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
npx @unhuman/wsync-cli link wsp_your_key_here
|
|
20
|
-
```
|
|
10
|
+
The server is registered as **`unhuman`** (it was `wsync` before 0.5.0). `link` and `connect` remove an
|
|
11
|
+
old `wsync` registration for the directory, so Claude never sees the same server twice.
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
`--server http://localhost:3000` (or set `WSYNC_SERVER`).
|
|
13
|
+
## What a device key reaches
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
A device key reaches **Work Context memories only** by default. To let Claude on that device also work
|
|
16
|
+
with flows, scenarios, runs and the rest as you, either tick **Full platform access** in **Connect a
|
|
17
|
+
device**, or widen the device later on the workstream's **Devices** tab. Narrow it again there at any time.
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
> then `node apps/wsync-cli/dist/wsync.mjs …`. Do not `npm i` inside this repo — npm cannot read
|
|
30
|
-
> the `workspace:*` protocol pnpm uses here, and fails with `EUNSUPPORTEDPROTOCOL` before it ever
|
|
31
|
-
> reaches the registry.
|
|
19
|
+
## Quick start
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
at session start.
|
|
37
|
-
3. Start Claude Code. Nothing else to do — captures happen automatically from here.
|
|
21
|
+
1. In Unhuman, open **Work Context**, pick a workstream and press **Connect a device**. You get a
|
|
22
|
+
one-time code that works once, for 15 minutes.
|
|
23
|
+
2. Inside the repository:
|
|
38
24
|
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
```sh
|
|
26
|
+
npx @unhuman/wsync-cli connect K7PQ-4QX2
|
|
27
|
+
```
|
|
41
28
|
|
|
42
|
-
|
|
29
|
+
The server defaults to `https://unhuman.unbs.cloud/api`; pass `--server URL` (or set
|
|
30
|
+
`WSYNC_SERVER`) for another.
|
|
43
31
|
|
|
44
|
-
|
|
32
|
+
> **Mind the scope.** Plain `npx wsync` is an unrelated package; it has to be `@unhuman/wsync-cli`.
|
|
45
33
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| `SessionStart` | Injects a rendered summary of prior work on this project back into context (from a local cache — never blocks on the network). |
|
|
49
|
-
| `UserPromptSubmit`, `PostToolUse`, `PostToolUseFailure`, `Stop` | Spool a lightweight event (prompt text, tool name/response, assistant reply) for the activity timeline. |
|
|
50
|
-
| `PreCompact`, `SessionEnd` | Spool a **checkpoint**: a pointer at the transcript segment since the last checkpoint. A detached `wsync flush` then distills it (extracts prompts, files touched, tickets, git identity — all locally, no LLM call), redacts secrets, and uploads both the structured distillation and a gzip'd raw archive of that segment. |
|
|
34
|
+
> **From a checkout**, run the working copy: `pnpm --filter @unhuman/wsync-cli build` then
|
|
35
|
+
> `node apps/wsync-cli/dist/wsync.mjs …`.
|
|
51
36
|
|
|
52
|
-
|
|
53
|
-
(again, belt-and-braces with the server's own redaction pass) before upload. An unlinked directory
|
|
54
|
-
captures nothing — `SessionStart` tells you so, once, so you're never silently uncaptured.
|
|
37
|
+
3. Start Claude Code. Nothing else to do.
|
|
55
38
|
|
|
56
39
|
## Commands
|
|
57
40
|
|
|
58
41
|
```
|
|
59
|
-
wsync
|
|
60
|
-
wsync
|
|
61
|
-
|
|
62
|
-
wsync
|
|
63
|
-
wsync status show config, links (keys by prefix) and pending spool
|
|
64
|
-
wsync install-hooks [--dry-run] register hooks in ~/.claude/settings.json
|
|
65
|
-
wsync uninstall-hooks remove them again
|
|
66
|
-
wsync refresh-context --cwd PATH refresh the local context cache
|
|
67
|
-
wsync hook <sub> invoked by Claude Code itself; reads stdin
|
|
42
|
+
wsync connect <code> [--server URL] connect this directory with a one-time code
|
|
43
|
+
wsync link <key> [--server URL] link this directory with a device key
|
|
44
|
+
wsync status server, links (keys by prefix), MCP registration, leftover hooks
|
|
45
|
+
wsync uninstall-hooks remove old capture hooks from ~/.claude/settings.json
|
|
68
46
|
```
|
|
69
47
|
|
|
70
|
-
|
|
71
|
-
haven't been capturing since the start — entirely over HTTP, using whichever linked ancestor
|
|
72
|
-
directory owns each transcript's working directory, or `--key` as a fallback for anything with no
|
|
73
|
-
linked ancestor. Sessions that match neither are skipped and counted, never silently dropped.
|
|
74
|
-
|
|
75
|
-
**Where a session is filed** depends on which command captured it:
|
|
48
|
+
## Old capture hooks are removed
|
|
76
49
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
projects that already exist in your workspace (by slug, by a remote the workspace has seen before,
|
|
82
|
-
or by an unambiguous bare name). A transcript whose remote matches nothing lands in the app's
|
|
83
|
-
**Needs filing** queue with the remote named, for a person to file. Neither mode invents a project;
|
|
84
|
-
one key can import a whole machine without funnelling twenty repositories into one project.
|
|
50
|
+
Earlier versions recorded sessions through seven Claude Code hooks and a spool in `~/.wsync/spool`.
|
|
51
|
+
That is gone. `connect` and `link` remove any such hooks from `~/.claude/settings.json` and
|
|
52
|
+
delete the spool, so a machine that ran an older install stops recording as soon as it is connected.
|
|
53
|
+
`wsync status` warns if any hooks remain; `wsync uninstall-hooks` removes them on their own.
|
|
85
54
|
|
|
86
55
|
**Re-linking a directory moves it.** `link` on a directory that already has a key verifies the new
|
|
87
|
-
key, writes it,
|
|
88
|
-
has one live key at a time and `status` never lists ghosts. A retire the server refuses is reported
|
|
89
|
-
and does not undo the link; revoke the old key from the app's Keys list in that case.
|
|
90
|
-
|
|
91
|
-
**`.wsync.json`** in a repository root is an optional marker (`{ "project": "<slug>", "ticket":
|
|
92
|
-
"<KEY>" }`) the identity layer reads ahead of the git remote. It does not change where live capture
|
|
93
|
-
files a session — the key does that — but it names the project `backfill` should look for and the
|
|
94
|
-
ticket to prefer. It lives in the repository, so committing it shares the choice with everyone who
|
|
95
|
-
clones; whether a project name belongs in a public repository is the owner's call. `link` never
|
|
96
|
-
writes it.
|
|
97
|
-
|
|
98
|
-
## Production server
|
|
99
|
-
|
|
100
|
-
The default server (used when you pass no `--server` and have none configured) is
|
|
101
|
-
`http://localhost:3000` — a local backend with nothing in front of it.
|
|
102
|
-
|
|
103
|
-
In production, requests go through the reverse proxy, which strips `/api` before they reach the
|
|
104
|
-
backend. So the server value you pass there is the site origin **plus** `/api`:
|
|
105
|
-
|
|
106
|
-
```sh
|
|
107
|
-
npx @unhuman/wsync-cli link wsp_your_key_here --server https://unhuman.unbs.cloud/api
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Every API call is a plain concatenation of the configured server and a `/wsync/...` path (see
|
|
111
|
-
`apiUrl` in `src/config.ts`), so this is the only place the `/api` prefix needs to be spelled out —
|
|
112
|
-
nothing else in the CLI knows or cares which environment it's talking to.
|
|
56
|
+
key, writes it, then retires the previous one on the server, so a directory has one live key.
|
|
113
57
|
|
|
114
58
|
## On-disk layout
|
|
115
59
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
~/.wsync/
|
|
120
|
-
config.json server + per-directory links, mode 0600
|
|
121
|
-
spool/ pending checkpoints and events, drained by `flush`
|
|
122
|
-
cache/ rendered context per linked directory + per-session segment bookmarks
|
|
123
|
-
wsync.log best-effort diagnostics from the hooks themselves
|
|
124
|
-
flush.lock single-holder lock so a hook-spawned flush and a manual one never race
|
|
125
|
-
```
|
|
60
|
+
Under `~/.wsync` (override with `WSYNC_HOME`): `config.json` — the server and per-directory links,
|
|
61
|
+
mode 0600.
|
|
126
62
|
|
|
127
63
|
## Development
|
|
128
64
|
|
|
129
65
|
```sh
|
|
130
|
-
pnpm --filter @unhuman/wsync-cli typecheck
|
|
66
|
+
pnpm --filter @unhuman/wsync-cli typecheck
|
|
67
|
+
pnpm --filter @unhuman/wsync-cli test
|
|
131
68
|
pnpm --filter @unhuman/wsync-cli build # esbuild bundle -> dist/wsync.mjs
|
|
132
69
|
```
|
|
133
|
-
|
|
134
|
-
This package reuses `@unhuman/wsync-core` for everything content-shaped — mechanical transcript
|
|
135
|
-
distillation, git/ticket identity resolution, and redaction — rather than reimplementing any of
|
|
136
|
-
it. It has no test suite of its own; correctness here is verified by the backend's wsync specs and
|
|
137
|
-
by live end-to-end use (linking a real directory, running Claude Code against it, checking
|
|
138
|
-
`wsync status` and the server's session view).
|