@moberg_hr/work-tree 1.9.0 → 1.9.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.
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "work-tree",
3
+ "description": "Claude Code skills shipped with the work-tree CLI (work / wd)",
4
+ "owner": {
5
+ "name": "Moberg HR",
6
+ "url": "https://github.com/moberghr"
7
+ },
8
+ "plugins": [
9
+ {
10
+ "name": "work-tree",
11
+ "description": "Skills for the work-tree CLI — wd-review drives interactive `wd -c` browser diff reviews",
12
+ "version": "1.9.1",
13
+ "source": "./plugins/work-tree",
14
+ "category": "productivity",
15
+ "tags": ["git", "worktree", "diff", "review"]
16
+ }
17
+ ]
18
+ }
package/README.md CHANGED
@@ -316,7 +316,7 @@ Other features in review mode:
316
316
  - **General comments** — a top-of-page composer for review notes that aren't tied to any line.
317
317
  - **Stable scope hash** — keep one tab open across repeated `wd` / `wd -c` invocations for the same worktree.
318
318
 
319
- When running standalone (no `work web`), the live URL is published to `~/.work/diffs/latest-review.url` so any local tool can find it without scraping stdout. A ready-made Claude Code skill ships with the repo at `.claude/skills/wd-review/SKILL.md` — drop it into `~/.claude/skills/` and say *"review my changes with wd"* in any Claude session to drive the loop.
319
+ When running standalone (no `work web`), the live URL is published to `~/.work/diffs/latest-review.url` so any local tool can find it without scraping stdout. A ready-made Claude Code skill ships as the `work-tree` plugin (`plugins/work-tree/skills/wd-review/SKILL.md`) — installing the npm package auto-registers the plugin marketplace and installs the plugin when the `claude` CLI is present. To add it manually: `claude plugin marketplace add moberghr/cli-work-tree-manager && claude plugin install work-tree@work-tree`. Then say *"review my changes with wd"* in any Claude session to drive the loop.
320
320
 
321
321
  ---
322
322
 
package/dist/bin.js CHANGED
@@ -8984,6 +8984,14 @@ function getCommentFileStore(sessionId) {
8984
8984
  },
8985
8985
  reload() {
8986
8986
  reloadInner();
8987
+ },
8988
+ clearAll() {
8989
+ return lockedMutate(() => {
8990
+ const list = inner.list();
8991
+ const n = list.length;
8992
+ list.length = 0;
8993
+ return { value: n, persisted: n > 0 };
8994
+ });
8987
8995
  }
8988
8996
  };
8989
8997
  cache.set(sessionId, store);
@@ -9882,6 +9890,12 @@ function markScopeEnded(hash) {
9882
9890
  entry.scope.ended = true;
9883
9891
  return true;
9884
9892
  }
9893
+ function reviveScope(hash) {
9894
+ const entry = scopes.get(hash);
9895
+ if (!entry || !entry.scope.ended) return false;
9896
+ entry.scope.ended = false;
9897
+ return true;
9898
+ }
9885
9899
  function getScope(hash) {
9886
9900
  return scopes.get(hash)?.scope ?? null;
9887
9901
  }
@@ -9970,6 +9984,10 @@ function mountScopeRoutes(app, opts) {
9970
9984
  }
9971
9985
  const scopeBus = new EventEmitter();
9972
9986
  scopeBus.setMaxListeners(0);
9987
+ function emitCommentsChanged(payload) {
9988
+ opts.broadcast("comments-changed", payload);
9989
+ scopeBus.emit("comments-changed", payload);
9990
+ }
9973
9991
  function scopeRepos(scopePaths) {
9974
9992
  return scopePaths.map((p) => ({ name: p, root: p }));
9975
9993
  }
@@ -9986,6 +10004,12 @@ function mountScopeRoutes(app, opts) {
9986
10004
  const { paths, label: label2 } = c.req.valid("json");
9987
10005
  try {
9988
10006
  const scope = registerScope(paths, label2);
10007
+ if (reviveScope(scope.hash)) {
10008
+ const cleared = commentStore(scope.hash).clearAll();
10009
+ if (cleared > 0) {
10010
+ emitCommentsChanged({ scopeHash: scope.hash });
10011
+ }
10012
+ }
9989
10013
  opts.broadcast("scopes-changed", { hash: scope.hash });
9990
10014
  const announceCheckpoint = (entry) => {
9991
10015
  const payload = { scopeHash: scope.hash, id: entry.id };
@@ -10224,7 +10248,7 @@ function mountScopeRoutes(app, opts) {
10224
10248
  const store = commentStore(scope.hash);
10225
10249
  try {
10226
10250
  const comment = store.post(c.req.valid("json"));
10227
- opts.broadcast("comments-changed", {
10251
+ emitCommentsChanged({
10228
10252
  scopeHash: scope.hash,
10229
10253
  id: comment.id
10230
10254
  });
@@ -10240,7 +10264,7 @@ function mountScopeRoutes(app, opts) {
10240
10264
  const store = commentStore(scope.hash);
10241
10265
  const removed = store.remove(c.req.param("cid"));
10242
10266
  if (removed) {
10243
- opts.broadcast("comments-changed", {
10267
+ emitCommentsChanged({
10244
10268
  scopeHash: scope.hash,
10245
10269
  deleted: c.req.param("cid")
10246
10270
  });
@@ -10259,7 +10283,7 @@ function mountScopeRoutes(app, opts) {
10259
10283
  c.req.valid("json").resolved
10260
10284
  );
10261
10285
  if (updated) {
10262
- opts.broadcast("comments-changed", {
10286
+ emitCommentsChanged({
10263
10287
  scopeHash: scope.hash,
10264
10288
  id: updated.id
10265
10289
  });
@@ -10275,7 +10299,7 @@ function mountScopeRoutes(app, opts) {
10275
10299
  if (!scope) return c.json({ error: "unknown scope" }, 404);
10276
10300
  const store = commentStore(scope.hash);
10277
10301
  const result = store.submit(c.req.valid("json").summary);
10278
- opts.broadcast("comments-changed", {
10302
+ emitCommentsChanged({
10279
10303
  scopeHash: scope.hash,
10280
10304
  submittedCount: result.drafts.length
10281
10305
  });
@@ -10291,7 +10315,7 @@ function mountScopeRoutes(app, opts) {
10291
10315
  const store = commentStore(scope.hash);
10292
10316
  const discarded = store.discardDrafts();
10293
10317
  if (discarded > 0) {
10294
- opts.broadcast("comments-changed", { scopeHash: scope.hash });
10318
+ emitCommentsChanged({ scopeHash: scope.hash });
10295
10319
  }
10296
10320
  return c.json({ discarded, comments: store.snapshot() });
10297
10321
  });
@@ -10301,7 +10325,9 @@ function mountScopeRoutes(app, opts) {
10301
10325
  const store = commentStore(scope.hash);
10302
10326
  const count = store.list().length;
10303
10327
  markScopeEnded(scope.hash);
10304
- opts.broadcast("review-done", { scopeHash: scope.hash, count });
10328
+ const payload = { scopeHash: scope.hash, count };
10329
+ opts.broadcast("review-done", payload);
10330
+ scopeBus.emit("review-done", payload);
10305
10331
  return c.json({ ok: true, count });
10306
10332
  });
10307
10333
  app.get("/api/scopes/:hash/events", (c) => {
@@ -10324,11 +10350,31 @@ function mountScopeRoutes(app, opts) {
10324
10350
  });
10325
10351
  };
10326
10352
  scopeBus.on("checkpoints-changed", onCheckpoint);
10353
+ const onComments = (payload) => {
10354
+ if (payload.scopeHash !== scope.hash) return;
10355
+ stream.writeSSE({
10356
+ event: "comments-changed",
10357
+ data: JSON.stringify(payload)
10358
+ }).catch(() => {
10359
+ });
10360
+ };
10361
+ scopeBus.on("comments-changed", onComments);
10362
+ const onDone = (payload) => {
10363
+ if (payload.scopeHash !== scope.hash) return;
10364
+ stream.writeSSE({
10365
+ event: "review-done",
10366
+ data: JSON.stringify(payload)
10367
+ }).catch(() => {
10368
+ });
10369
+ };
10370
+ scopeBus.on("review-done", onDone);
10327
10371
  await stream.writeSSE({ event: "connected", data: "" });
10328
10372
  await new Promise((resolve) => {
10329
10373
  stream.onAbort(() => {
10330
10374
  unsubscribe?.();
10331
10375
  scopeBus.off("checkpoints-changed", onCheckpoint);
10376
+ scopeBus.off("comments-changed", onComments);
10377
+ scopeBus.off("review-done", onDone);
10332
10378
  resolve();
10333
10379
  });
10334
10380
  });
@@ -11460,7 +11506,7 @@ function completeGroupBranches(groupName, repoAliases, current, config, done) {
11460
11506
  }
11461
11507
 
11462
11508
  // src/version.ts
11463
- var VERSION = true ? "1.9.0" : "dev";
11509
+ var VERSION = true ? "1.9.1" : "dev";
11464
11510
 
11465
11511
  // src/cli.ts
11466
11512
  function showHelp() {