@unhuman/wsync-cli 0.1.0 → 0.1.1
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 +9 -6
- package/dist/wsync.mjs +35 -6
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -16,16 +16,19 @@ still prints `{}` and exits `0`.
|
|
|
16
16
|
2. Inside the repository you want captured:
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
|
|
20
|
-
node apps/wsync-cli/dist/wsync.mjs link wsp_your_key_here
|
|
19
|
+
npx @unhuman/wsync-cli link wsp_your_key_here
|
|
21
20
|
```
|
|
22
21
|
|
|
23
22
|
The server defaults to `https://unhuman.unbs.cloud/api`. Against a dev stack, pass
|
|
24
23
|
`--server http://localhost:3000` (or set `WSYNC_SERVER`).
|
|
25
24
|
|
|
26
|
-
> **
|
|
27
|
-
>
|
|
28
|
-
|
|
25
|
+
> **Mind the scope.** Plain `npx wsync` is an unrelated package by someone else; it has to be
|
|
26
|
+
> `@unhuman/wsync-cli`.
|
|
27
|
+
|
|
28
|
+
> **From a checkout**, run the working copy instead: `pnpm --filter @unhuman/wsync-cli build`
|
|
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.
|
|
29
32
|
|
|
30
33
|
`link` does everything in one step: it checks the key against the server, records the link in
|
|
31
34
|
`~/.wsync/config.json`, installs the Claude Code hooks (see below), and registers the wsync MCP
|
|
@@ -78,7 +81,7 @@ In production, requests go through the reverse proxy, which strips `/api` before
|
|
|
78
81
|
backend. So the server value you pass there is the site origin **plus** `/api`:
|
|
79
82
|
|
|
80
83
|
```sh
|
|
81
|
-
|
|
84
|
+
npx @unhuman/wsync-cli link wsp_your_key_here --server https://unhuman.unbs.cloud/api
|
|
82
85
|
```
|
|
83
86
|
|
|
84
87
|
Every API call is a plain concatenation of the configured server and a `/wsync/...` path (see
|
package/dist/wsync.mjs
CHANGED
|
@@ -6165,7 +6165,7 @@ var init_package = __esm({
|
|
|
6165
6165
|
"package.json"() {
|
|
6166
6166
|
package_default = {
|
|
6167
6167
|
name: "@unhuman/wsync-cli",
|
|
6168
|
-
version: "0.1.
|
|
6168
|
+
version: "0.1.1",
|
|
6169
6169
|
description: "Capture Claude Code sessions to an Unhuman Work Context project: link a checkout, install the hooks, drain the spool.",
|
|
6170
6170
|
license: "UNLICENSED",
|
|
6171
6171
|
repository: {
|
|
@@ -6196,13 +6196,15 @@ var init_package = __esm({
|
|
|
6196
6196
|
scripts: {
|
|
6197
6197
|
build: `esbuild --bundle --platform=node --format=esm --packages=bundle --banner:js="import{createRequire as __wsyncCreateRequire}from'module';const require=__wsyncCreateRequire(import.meta.url);" --outfile=dist/wsync.mjs src/bin.ts`,
|
|
6198
6198
|
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
6199
|
-
prepublishOnly: "pnpm run build"
|
|
6199
|
+
prepublishOnly: "pnpm run build",
|
|
6200
|
+
test: "vitest run"
|
|
6200
6201
|
},
|
|
6201
6202
|
devDependencies: {
|
|
6202
6203
|
"@types/node": "^22.10.0",
|
|
6203
6204
|
esbuild: "^0.24.0",
|
|
6204
6205
|
typescript: "^5.7.0",
|
|
6205
|
-
"@unhuman/wsync-core": "workspace:*"
|
|
6206
|
+
"@unhuman/wsync-core": "workspace:*",
|
|
6207
|
+
vitest: "^3.2.0"
|
|
6206
6208
|
}
|
|
6207
6209
|
};
|
|
6208
6210
|
}
|
|
@@ -6224,10 +6226,21 @@ import { join as join7, resolve as resolve2, dirname } from "node:path";
|
|
|
6224
6226
|
import { homedir as homedir2 } from "node:os";
|
|
6225
6227
|
import { fileURLToPath } from "node:url";
|
|
6226
6228
|
function cliPath() {
|
|
6227
|
-
const running = process.argv[1];
|
|
6228
|
-
if (running && running.endsWith(".mjs") && existsSync7(running)) return resolve2(running);
|
|
6229
6229
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
6230
|
-
|
|
6230
|
+
const candidates = [
|
|
6231
|
+
process.argv[1] && process.argv[1].endsWith(".mjs") ? resolve2(process.argv[1]) : null,
|
|
6232
|
+
resolve2(here, "wsync.mjs"),
|
|
6233
|
+
// bundled: this file *is* dist/wsync.mjs
|
|
6234
|
+
resolve2(here, "../../dist/wsync.mjs"),
|
|
6235
|
+
// from source: src/commands → package root
|
|
6236
|
+
resolve2(here, "../dist/wsync.mjs")
|
|
6237
|
+
].filter((p) => Boolean(p));
|
|
6238
|
+
for (const candidate of candidates) {
|
|
6239
|
+
if (existsSync7(candidate)) return candidate;
|
|
6240
|
+
}
|
|
6241
|
+
throw new Error(
|
|
6242
|
+
`Cannot find the wsync bundle to install hooks for (looked in: ${candidates.join(", ")}). Reinstall @unhuman/wsync-cli, or run install-hooks with \`node <path>/dist/wsync.mjs\`.`
|
|
6243
|
+
);
|
|
6231
6244
|
}
|
|
6232
6245
|
function ourEntry(event, matcher, isAsync) {
|
|
6233
6246
|
const cmd2 = `node ${cliPath()} hook ${event}`;
|
|
@@ -6243,6 +6256,7 @@ function ourEntry(event, matcher, isAsync) {
|
|
|
6243
6256
|
};
|
|
6244
6257
|
}
|
|
6245
6258
|
async function installHooks(opts = {}) {
|
|
6259
|
+
cliPath();
|
|
6246
6260
|
const settings = readSettings();
|
|
6247
6261
|
const hooks = settings["hooks"] ?? {};
|
|
6248
6262
|
let added = 0;
|
|
@@ -6269,6 +6283,12 @@ async function installHooks(opts = {}) {
|
|
|
6269
6283
|
}
|
|
6270
6284
|
return { added };
|
|
6271
6285
|
}
|
|
6286
|
+
function hookHealth() {
|
|
6287
|
+
const hooks = readSettings()["hooks"] ?? {};
|
|
6288
|
+
const commands = Object.values(hooks).flatMap((list) => list ?? []).flatMap((matcher) => matcher.hooks ?? []).map((hook) => hook.command ?? "").filter((command) => command.includes(MARKER));
|
|
6289
|
+
const target = commands[0]?.match(/node\s+(\S+wsync\.mjs)/)?.[1] ?? null;
|
|
6290
|
+
return { installed: commands.length, target, targetExists: Boolean(target && existsSync7(target)) };
|
|
6291
|
+
}
|
|
6272
6292
|
async function uninstallHooks() {
|
|
6273
6293
|
const settings = readSettings();
|
|
6274
6294
|
const hooks = settings["hooks"] ?? {};
|
|
@@ -7255,6 +7275,15 @@ try {
|
|
|
7255
7275
|
const links = Object.entries(cfg.links);
|
|
7256
7276
|
console.log(`home ${WSYNC_HOME}`);
|
|
7257
7277
|
console.log(`server ${cfg.server}`);
|
|
7278
|
+
const health = hookHealth();
|
|
7279
|
+
if (health.installed === 0) {
|
|
7280
|
+
console.log("hooks NOT INSTALLED \u2014 run: wsync install-hooks");
|
|
7281
|
+
} else if (!health.targetExists) {
|
|
7282
|
+
console.log(`hooks ${health.installed} installed but BROKEN \u2014 ${health.target} does not exist`);
|
|
7283
|
+
console.log(" nothing is being captured. Re-run: wsync install-hooks");
|
|
7284
|
+
} else {
|
|
7285
|
+
console.log(`hooks ${health.installed} installed -> ${health.target}`);
|
|
7286
|
+
}
|
|
7258
7287
|
console.log(`links ${links.length}`);
|
|
7259
7288
|
for (const [path, key] of links) console.log(` - ${path} -> ${key}`);
|
|
7260
7289
|
console.log(`spool ${spool.length} pending`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhuman/wsync-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Capture Claude Code sessions to an Unhuman Work Context project: link a checkout, install the hooks, drain the spool.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -31,12 +31,14 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "esbuild --bundle --platform=node --format=esm --packages=bundle --banner:js=\"import{createRequire as __wsyncCreateRequire}from'module';const require=__wsyncCreateRequire(import.meta.url);\" --outfile=dist/wsync.mjs src/bin.ts",
|
|
33
33
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
34
|
-
"prepublishOnly": "pnpm run build"
|
|
34
|
+
"prepublishOnly": "pnpm run build",
|
|
35
|
+
"test": "vitest run"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/node": "^22.10.0",
|
|
38
39
|
"esbuild": "^0.24.0",
|
|
39
40
|
"typescript": "^5.7.0",
|
|
40
|
-
"@unhuman/wsync-core": "workspace:*"
|
|
41
|
+
"@unhuman/wsync-core": "workspace:*",
|
|
42
|
+
"vitest": "^3.2.0"
|
|
41
43
|
}
|
|
42
44
|
}
|