@moberg_hr/work-tree 2.0.11 → 2.0.12
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/dist/{answer-6UVHVEGQ.js → answer-IL5AQHRO.js} +4 -4
- package/dist/{attach-6Q6HGPCM.js → attach-M2UXWUMO.js} +3 -3
- package/dist/bin.js +2 -2
- package/dist/{block-46DPS75I.js → block-OXGEQ2PZ.js} +4 -4
- package/dist/{broadcast-OGOEQX4Z.js → broadcast-UJURJNEK.js} +2 -2
- package/dist/{catchup-TTAC3GMX.js → catchup-HN4VL5XK.js} +4 -4
- package/dist/chunk-4U52S7AZ.js +9 -0
- package/dist/{chunk-Y6VPABC3.js → chunk-5LZZ73MS.js} +28 -28
- package/dist/{chunk-AFV5S6UV.js → chunk-7UU5LPDM.js} +2 -2
- package/dist/{chunk-7HGABVGR.js → chunk-E3Y4ZACK.js} +18 -1
- package/dist/chunk-E3Y4ZACK.js.map +1 -0
- package/dist/{chunk-WG3BMHKU.js → chunk-EU3BS5A6.js} +2 -2
- package/dist/{chunk-4PP27RI7.js → chunk-GWJVU4AS.js} +3 -3
- package/dist/{chunk-D4FUDMMX.js → chunk-HBCL77AR.js} +3 -3
- package/dist/{chunk-RG63ACAK.js → chunk-PVN5IGDZ.js} +11 -10
- package/dist/chunk-PVN5IGDZ.js.map +1 -0
- package/dist/{chunk-AVRDRZ4D.js → chunk-TVMZ4NYY.js} +61 -7
- package/dist/chunk-TVMZ4NYY.js.map +1 -0
- package/dist/{chunk-RMICESXA.js → chunk-TZWXQ4YZ.js} +2 -2
- package/dist/{cleanup-OO3DCPGC.js → cleanup-MHPHSM5I.js} +6 -6
- package/dist/{cli-I6N4U4GN.js → cli-QF7GRSWT.js} +3 -3
- package/dist/{fork-WTNAUILU.js → fork-CISFOOAQ.js} +4 -4
- package/dist/{hook-OTPVWY52.js → hook-CA5X3VKU.js} +3 -3
- package/dist/{note-2JHWK6CV.js → note-JOR53JP4.js} +4 -4
- package/dist/{pin-UOW5VW42.js → pin-DAWKCVB2.js} +4 -4
- package/dist/{pr-74X5MOPX.js → pr-RKOVRSHC.js} +3 -3
- package/dist/{prune-L3VXZUIE.js → prune-DS73W7LT.js} +5 -5
- package/dist/{read-G7CVQRH6.js → read-IKDSIDJD.js} +4 -4
- package/dist/{remove-NVQ2JNMA.js → remove-DEDH57GP.js} +4 -4
- package/dist/{screen-XSBZHJNW.js → screen-KUXSDDLB.js} +4 -4
- package/dist/{section-BWZW3E2I.js → section-QLUIAYAV.js} +4 -4
- package/dist/{send-4E7CD6PL.js → send-V6LL6YR6.js} +4 -4
- package/dist/{sessions-4LFKWTBZ.js → sessions-AGFO7W5U.js} +4 -4
- package/dist/{snooze-SSSA656T.js → snooze-JXI7VZJ4.js} +4 -4
- package/dist/{start-5LODG4WG.js → start-5XFUYT6I.js} +4 -4
- package/dist/{stop-OFQFHRXD.js → stop-PFI7J2CS.js} +4 -4
- package/dist/{sync-FDXM5EFD.js → sync-S4IJT2WR.js} +5 -5
- package/dist/{time-IIAXBSE7.js → time-VDRCEIYQ.js} +4 -4
- package/dist/{update-7ZE4CG7T.js → update-DXIY6BEX.js} +4 -4
- package/dist/{wait-TGQLNTE7.js → wait-KPH5BQUD.js} +4 -4
- package/dist/wd-bin.js +2 -2
- package/dist/web/assets/{PtyView-CAaXDb9_.js → PtyView-CKEfBQ3-.js} +2 -2
- package/dist/web/assets/{PtyView-CAaXDb9_.js.map → PtyView-CKEfBQ3-.js.map} +1 -1
- package/dist/web/assets/index-CHA-bad8.js +118 -0
- package/dist/web/assets/index-CHA-bad8.js.map +1 -0
- package/dist/web/assets/index-DJsnmqYW.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-NFKTIH4M.js → web-ISGYHCTC.js} +105 -87
- package/dist/web-ISGYHCTC.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-7HGABVGR.js.map +0 -1
- package/dist/chunk-AVRDRZ4D.js.map +0 -1
- package/dist/chunk-RG63ACAK.js.map +0 -1
- package/dist/chunk-W5B4NLBI.js +0 -9
- package/dist/web/assets/index-3r-glBYq.js +0 -118
- package/dist/web/assets/index-3r-glBYq.js.map +0 -1
- package/dist/web/assets/index-Dk0Q1Qib.css +0 -1
- package/dist/web-NFKTIH4M.js.map +0 -1
- /package/dist/{answer-6UVHVEGQ.js.map → answer-IL5AQHRO.js.map} +0 -0
- /package/dist/{attach-6Q6HGPCM.js.map → attach-M2UXWUMO.js.map} +0 -0
- /package/dist/{block-46DPS75I.js.map → block-OXGEQ2PZ.js.map} +0 -0
- /package/dist/{broadcast-OGOEQX4Z.js.map → broadcast-UJURJNEK.js.map} +0 -0
- /package/dist/{catchup-TTAC3GMX.js.map → catchup-HN4VL5XK.js.map} +0 -0
- /package/dist/{chunk-W5B4NLBI.js.map → chunk-4U52S7AZ.js.map} +0 -0
- /package/dist/{chunk-Y6VPABC3.js.map → chunk-5LZZ73MS.js.map} +0 -0
- /package/dist/{chunk-AFV5S6UV.js.map → chunk-7UU5LPDM.js.map} +0 -0
- /package/dist/{chunk-WG3BMHKU.js.map → chunk-EU3BS5A6.js.map} +0 -0
- /package/dist/{chunk-4PP27RI7.js.map → chunk-GWJVU4AS.js.map} +0 -0
- /package/dist/{chunk-D4FUDMMX.js.map → chunk-HBCL77AR.js.map} +0 -0
- /package/dist/{chunk-RMICESXA.js.map → chunk-TZWXQ4YZ.js.map} +0 -0
- /package/dist/{cleanup-OO3DCPGC.js.map → cleanup-MHPHSM5I.js.map} +0 -0
- /package/dist/{cli-I6N4U4GN.js.map → cli-QF7GRSWT.js.map} +0 -0
- /package/dist/{fork-WTNAUILU.js.map → fork-CISFOOAQ.js.map} +0 -0
- /package/dist/{hook-OTPVWY52.js.map → hook-CA5X3VKU.js.map} +0 -0
- /package/dist/{note-2JHWK6CV.js.map → note-JOR53JP4.js.map} +0 -0
- /package/dist/{pin-UOW5VW42.js.map → pin-DAWKCVB2.js.map} +0 -0
- /package/dist/{pr-74X5MOPX.js.map → pr-RKOVRSHC.js.map} +0 -0
- /package/dist/{prune-L3VXZUIE.js.map → prune-DS73W7LT.js.map} +0 -0
- /package/dist/{read-G7CVQRH6.js.map → read-IKDSIDJD.js.map} +0 -0
- /package/dist/{remove-NVQ2JNMA.js.map → remove-DEDH57GP.js.map} +0 -0
- /package/dist/{screen-XSBZHJNW.js.map → screen-KUXSDDLB.js.map} +0 -0
- /package/dist/{section-BWZW3E2I.js.map → section-QLUIAYAV.js.map} +0 -0
- /package/dist/{send-4E7CD6PL.js.map → send-V6LL6YR6.js.map} +0 -0
- /package/dist/{sessions-4LFKWTBZ.js.map → sessions-AGFO7W5U.js.map} +0 -0
- /package/dist/{snooze-SSSA656T.js.map → snooze-JXI7VZJ4.js.map} +0 -0
- /package/dist/{start-5LODG4WG.js.map → start-5XFUYT6I.js.map} +0 -0
- /package/dist/{stop-OFQFHRXD.js.map → stop-PFI7J2CS.js.map} +0 -0
- /package/dist/{sync-FDXM5EFD.js.map → sync-S4IJT2WR.js.map} +0 -0
- /package/dist/{time-IIAXBSE7.js.map → time-VDRCEIYQ.js.map} +0 -0
- /package/dist/{update-7ZE4CG7T.js.map → update-DXIY6BEX.js.map} +0 -0
- /package/dist/{wait-TGQLNTE7.js.map → wait-KPH5BQUD.js.map} +0 -0
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
sessionFromArgs,
|
|
7
7
|
sessionPositionals
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EU3BS5A6.js";
|
|
9
9
|
import "./chunk-6AQRYLOB.js";
|
|
10
10
|
import {
|
|
11
11
|
callWorkWeb
|
|
12
12
|
} from "./chunk-QX4LFFNS.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-PVN5IGDZ.js";
|
|
14
14
|
import "./chunk-ZSHWP2VS.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-E3Y4ZACK.js";
|
|
16
16
|
import "./chunk-HUXS3VAI.js";
|
|
17
17
|
import {
|
|
18
18
|
readStatus
|
|
@@ -61,4 +61,4 @@ var answerCommand = {
|
|
|
61
61
|
export {
|
|
62
62
|
answerCommand
|
|
63
63
|
};
|
|
64
|
-
//# sourceMappingURL=answer-
|
|
64
|
+
//# sourceMappingURL=answer-IL5AQHRO.js.map
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
import "./chunk-3XY76XBD.js";
|
|
13
13
|
import {
|
|
14
14
|
findSessionForCwd
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PVN5IGDZ.js";
|
|
16
16
|
import "./chunk-ZSHWP2VS.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-E3Y4ZACK.js";
|
|
18
18
|
import "./chunk-HUXS3VAI.js";
|
|
19
19
|
import {
|
|
20
20
|
findSession,
|
|
@@ -57,4 +57,4 @@ export {
|
|
|
57
57
|
attachCommand,
|
|
58
58
|
baseCheckoutSession
|
|
59
59
|
};
|
|
60
|
-
//# sourceMappingURL=attach-
|
|
60
|
+
//# sourceMappingURL=attach-M2UXWUMO.js.map
|
package/dist/bin.js
CHANGED
|
@@ -41,12 +41,12 @@ process.on("uncaughtException", handleFatalError);
|
|
|
41
41
|
process.on("unhandledRejection", handleFatalError);
|
|
42
42
|
var args = process.argv.slice(2);
|
|
43
43
|
if (args[0] === "hook") {
|
|
44
|
-
const { runHookEvent } = await import("./hook-
|
|
44
|
+
const { runHookEvent } = await import("./hook-CA5X3VKU.js");
|
|
45
45
|
await runHookEvent(args[1], args.slice(2));
|
|
46
46
|
} else {
|
|
47
47
|
const { default: chalk } = await import("chalk");
|
|
48
48
|
if (!process.env.NO_COLOR && chalk.level === 0) chalk.level = 1;
|
|
49
|
-
const { run } = await import("./cli-
|
|
49
|
+
const { run } = await import("./cli-QF7GRSWT.js");
|
|
50
50
|
const { withReporter } = await import("./report-335HKCCY.js");
|
|
51
51
|
const { consoleReporter, reportStreamFor } = await import("./console-reporter-XU6VFUZE.js");
|
|
52
52
|
await withReporter(consoleReporter(reportStreamFor(args)), () => run(args));
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
sessionFromArgs,
|
|
11
11
|
sessionPositionals
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EU3BS5A6.js";
|
|
13
13
|
import "./chunk-6AQRYLOB.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-PVN5IGDZ.js";
|
|
15
15
|
import "./chunk-ZSHWP2VS.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-E3Y4ZACK.js";
|
|
17
17
|
import "./chunk-HUXS3VAI.js";
|
|
18
18
|
import {
|
|
19
19
|
findSession,
|
|
@@ -82,4 +82,4 @@ var blockCommand = {
|
|
|
82
82
|
export {
|
|
83
83
|
blockCommand
|
|
84
84
|
};
|
|
85
|
-
//# sourceMappingURL=block-
|
|
85
|
+
//# sourceMappingURL=block-OXGEQ2PZ.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-WMJIU3YW.js";
|
|
5
5
|
import {
|
|
6
6
|
getCommentFileStore
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-E3Y4ZACK.js";
|
|
8
8
|
import "./chunk-HUXS3VAI.js";
|
|
9
9
|
import {
|
|
10
10
|
loadHistory
|
|
@@ -102,4 +102,4 @@ var broadcastCommand = {
|
|
|
102
102
|
export {
|
|
103
103
|
broadcastCommand
|
|
104
104
|
};
|
|
105
|
-
//# sourceMappingURL=broadcast-
|
|
105
|
+
//# sourceMappingURL=broadcast-UJURJNEK.js.map
|
|
@@ -9,11 +9,11 @@ import "./chunk-6O6765M7.js";
|
|
|
9
9
|
import {
|
|
10
10
|
sessionFromArgs,
|
|
11
11
|
sessionPositionals
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-EU3BS5A6.js";
|
|
13
13
|
import "./chunk-6AQRYLOB.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-PVN5IGDZ.js";
|
|
15
15
|
import "./chunk-ZSHWP2VS.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-E3Y4ZACK.js";
|
|
17
17
|
import "./chunk-HUXS3VAI.js";
|
|
18
18
|
import "./chunk-RKEY4573.js";
|
|
19
19
|
import "./chunk-OQAQMCHF.js";
|
|
@@ -49,4 +49,4 @@ var catchupCommand = {
|
|
|
49
49
|
export {
|
|
50
50
|
catchupCommand
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=catchup-
|
|
52
|
+
//# sourceMappingURL=catchup-HN4VL5XK.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4U52S7AZ.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveProjectTarget
|
|
7
7
|
} from "./chunk-JTHILJFB.js";
|
|
@@ -165,44 +165,44 @@ var COMMANDS = [
|
|
|
165
165
|
{ names: ["init"], load: async () => (await import("./init-AT3BQLXM.js")).initCommand },
|
|
166
166
|
{ names: ["config"], load: async () => (await import("./config-SSWYCX4C.js")).configCommand },
|
|
167
167
|
{ names: ["tree", "t"], load: async () => (await import("./tree-7S4DUZRZ.js")).treeCommand },
|
|
168
|
-
{ names: ["remove"], load: async () => (await import("./remove-
|
|
169
|
-
{ names: ["fork"], load: async () => (await import("./fork-
|
|
170
|
-
{ names: ["update"], load: async () => (await import("./update-
|
|
171
|
-
{ names: ["catchup"], load: async () => (await import("./catchup-
|
|
172
|
-
{ names: ["snooze"], load: async () => (await import("./snooze-
|
|
173
|
-
{ names: ["pin"], load: async () => (await import("./pin-
|
|
174
|
-
{ names: ["section"], load: async () => (await import("./section-
|
|
175
|
-
{ names: ["note"], load: async () => (await import("./note-
|
|
176
|
-
{ names: ["block"], load: async () => (await import("./block-
|
|
177
|
-
{ names: ["time"], load: async () => (await import("./time-
|
|
178
|
-
{ names: ["read"], load: async () => (await import("./read-
|
|
179
|
-
{ names: ["screen"], load: async () => (await import("./screen-
|
|
180
|
-
{ names: ["send"], load: async () => (await import("./send-
|
|
181
|
-
{ names: ["wait"], load: async () => (await import("./wait-
|
|
182
|
-
{ names: ["start"], load: async () => (await import("./start-
|
|
183
|
-
{ names: ["stop"], load: async () => (await import("./stop-
|
|
184
|
-
{ names: ["answer"], load: async () => (await import("./answer-
|
|
168
|
+
{ names: ["remove"], load: async () => (await import("./remove-DEDH57GP.js")).removeCommand },
|
|
169
|
+
{ names: ["fork"], load: async () => (await import("./fork-CISFOOAQ.js")).forkCommand },
|
|
170
|
+
{ names: ["update"], load: async () => (await import("./update-DXIY6BEX.js")).updateCommand },
|
|
171
|
+
{ names: ["catchup"], load: async () => (await import("./catchup-HN4VL5XK.js")).catchupCommand },
|
|
172
|
+
{ names: ["snooze"], load: async () => (await import("./snooze-JXI7VZJ4.js")).snoozeCommand },
|
|
173
|
+
{ names: ["pin"], load: async () => (await import("./pin-DAWKCVB2.js")).pinCommand },
|
|
174
|
+
{ names: ["section"], load: async () => (await import("./section-QLUIAYAV.js")).sectionCommand },
|
|
175
|
+
{ names: ["note"], load: async () => (await import("./note-JOR53JP4.js")).noteCommand },
|
|
176
|
+
{ names: ["block"], load: async () => (await import("./block-OXGEQ2PZ.js")).blockCommand },
|
|
177
|
+
{ names: ["time"], load: async () => (await import("./time-VDRCEIYQ.js")).timeCommand },
|
|
178
|
+
{ names: ["read"], load: async () => (await import("./read-IKDSIDJD.js")).readCommand },
|
|
179
|
+
{ names: ["screen"], load: async () => (await import("./screen-KUXSDDLB.js")).screenCommand },
|
|
180
|
+
{ names: ["send"], load: async () => (await import("./send-V6LL6YR6.js")).sendCommand },
|
|
181
|
+
{ names: ["wait"], load: async () => (await import("./wait-KPH5BQUD.js")).waitCommand },
|
|
182
|
+
{ names: ["start"], load: async () => (await import("./start-5XFUYT6I.js")).startCommand },
|
|
183
|
+
{ names: ["stop"], load: async () => (await import("./stop-PFI7J2CS.js")).stopCommand },
|
|
184
|
+
{ names: ["answer"], load: async () => (await import("./answer-IL5AQHRO.js")).answerCommand },
|
|
185
185
|
{ names: ["list"], load: async () => (await import("./list-YTK2GLND.js")).listCommand },
|
|
186
186
|
{ names: ["status"], load: async () => (await import("./status-U5HKQ7MY.js")).statusCommand },
|
|
187
187
|
{ names: ["recent"], load: async () => (await import("./recent-2LM44HN2.js")).recentCommand },
|
|
188
188
|
{ names: ["resume"], load: async () => (await import("./resume-VA34T7ZR.js")).resumeCommand },
|
|
189
|
-
{ names: ["sessions"], load: async () => (await import("./sessions-
|
|
189
|
+
{ names: ["sessions"], load: async () => (await import("./sessions-AGFO7W5U.js")).sessionsCommand },
|
|
190
190
|
{ names: ["digest"], load: async () => (await import("./digest-WCZD6N7M.js")).digestCommand },
|
|
191
|
-
{ names: ["cleanup"], load: async () => (await import("./cleanup-
|
|
191
|
+
{ names: ["cleanup"], load: async () => (await import("./cleanup-MHPHSM5I.js")).cleanupCommand },
|
|
192
192
|
{ names: ["overlaps"], load: async () => (await import("./overlaps-GXSEH2LG.js")).overlapsCommand },
|
|
193
193
|
{ names: ["search"], load: async () => (await import("./search-FJUZPI3P.js")).searchCommand },
|
|
194
|
-
{ names: ["pr"], load: async () => (await import("./pr-
|
|
194
|
+
{ names: ["pr"], load: async () => (await import("./pr-RKOVRSHC.js")).prCommand },
|
|
195
195
|
{ names: ["timesheet"], load: async () => (await import("./timesheet-LSRRWV7Z.js")).timesheetCommand },
|
|
196
|
-
{ names: ["prune"], load: async () => (await import("./prune-
|
|
197
|
-
{ names: ["sync"], load: async () => (await import("./sync-
|
|
196
|
+
{ names: ["prune"], load: async () => (await import("./prune-DS73W7LT.js")).pruneCommand },
|
|
197
|
+
{ names: ["sync"], load: async () => (await import("./sync-S4IJT2WR.js")).syncCommand },
|
|
198
198
|
{ names: ["todo"], load: async () => (await import("./todo-2GKRUO4D.js")).todoCommand },
|
|
199
199
|
{ names: ["hydrate"], load: async () => (await import("./hydrate-Q4FWUQRC.js")).hydrateCommand },
|
|
200
200
|
{ names: ["diff"], load: async () => (await import("./diff-JBCBQM4I.js")).diffCommand },
|
|
201
|
-
{ names: ["web"], load: async () => (await import("./web-
|
|
202
|
-
{ names: ["hook"], load: async () => (await import("./hook-
|
|
201
|
+
{ names: ["web"], load: async () => (await import("./web-ISGYHCTC.js")).webCommand },
|
|
202
|
+
{ names: ["hook"], load: async () => (await import("./hook-CA5X3VKU.js")).hookCommand },
|
|
203
203
|
{ names: ["run"], load: async () => (await import("./run-E2WZPHHK.js")).runCommand },
|
|
204
|
-
{ names: ["broadcast"], load: async () => (await import("./broadcast-
|
|
205
|
-
{ names: ["attach", "a"], load: async () => (await import("./attach-
|
|
204
|
+
{ names: ["broadcast"], load: async () => (await import("./broadcast-UJURJNEK.js")).broadcastCommand },
|
|
205
|
+
{ names: ["attach", "a"], load: async () => (await import("./attach-M2UXWUMO.js")).attachCommand },
|
|
206
206
|
{ names: ["pty-host"], load: async () => (await import("./pty-host-5Z3GYXTW.js")).ptyHostCommand },
|
|
207
207
|
{ names: ["state"], load: async () => (await import("./state-S776FFV5.js")).stateCommand },
|
|
208
208
|
{ names: ["move"], load: async () => (await import("./move-CE5NIZKL.js")).moveCommand },
|
|
@@ -306,4 +306,4 @@ export {
|
|
|
306
306
|
commandsFor,
|
|
307
307
|
run
|
|
308
308
|
};
|
|
309
|
-
//# sourceMappingURL=chunk-
|
|
309
|
+
//# sourceMappingURL=chunk-5LZZ73MS.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
defaultArchiveDeps
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TZWXQ4YZ.js";
|
|
5
5
|
import {
|
|
6
6
|
normPath
|
|
7
7
|
} from "./chunk-AKMPF72Y.js";
|
|
@@ -159,4 +159,4 @@ function defaultCleanupDeps(opts = {}) {
|
|
|
159
159
|
export {
|
|
160
160
|
defaultCleanupDeps
|
|
161
161
|
};
|
|
162
|
-
//# sourceMappingURL=chunk-
|
|
162
|
+
//# sourceMappingURL=chunk-7UU5LPDM.js.map
|
|
@@ -24,6 +24,22 @@ function writeRows(d, store, comments) {
|
|
|
24
24
|
function readStoreComments(store) {
|
|
25
25
|
return withDb((d) => readRows(d, store));
|
|
26
26
|
}
|
|
27
|
+
function readStoresComments(stores) {
|
|
28
|
+
const out = /* @__PURE__ */ new Map();
|
|
29
|
+
if (stores.length === 0) return out;
|
|
30
|
+
const marks = stores.map(() => "?").join(", ");
|
|
31
|
+
const rows = withDb(
|
|
32
|
+
(d) => d.prepare(`SELECT store, data FROM comments WHERE store IN (${marks}) ORDER BY rowid`).all(...stores)
|
|
33
|
+
);
|
|
34
|
+
for (const r of rows) {
|
|
35
|
+
const c = json.parse(r.data);
|
|
36
|
+
if (!isComment(c)) continue;
|
|
37
|
+
const list = out.get(r.store) ?? [];
|
|
38
|
+
list.push(c);
|
|
39
|
+
out.set(r.store, list);
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
27
43
|
var cache = /* @__PURE__ */ new Map();
|
|
28
44
|
function getCommentFileStore(sessionId) {
|
|
29
45
|
const existing = cache.get(sessionId);
|
|
@@ -107,6 +123,7 @@ function getCommentFileStore(sessionId) {
|
|
|
107
123
|
|
|
108
124
|
export {
|
|
109
125
|
readStoreComments,
|
|
126
|
+
readStoresComments,
|
|
110
127
|
getCommentFileStore
|
|
111
128
|
};
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-E3Y4ZACK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/comments/comment-file-store.ts"],"sourcesContent":["import { createCommentStore, type CommentInput, type CommentStore } from './comment-store.js';\nimport { json, tx, withDb, type Db } from '../platform/db.js';\nimport type { Comment } from './comment-types.js';\n\n/**\n * Persistent comment store: the pure in-memory model (comment-store.ts)\n * over state.db's `comments` table, one \"store\" per session id (or\n * `scope-<hash>` for a `wd` review). Every mutation runs in a write\n * transaction that first reloads the store from the database, so\n * concurrent writers in other processes (`work broadcast`, the hook, a\n * second work web tab) are never lost.\n *\n * (The name is historical: this used to be one JSON file per store.)\n */\nexport interface CommentFileStore extends CommentStore {\n /** Drop the cached in-memory store and reload from disk. */\n reload(): void;\n /** Remove every comment (memory + disk). Returns how many were removed.\n * Used when a finished scope review is re-registered — the new run\n * starts from a clean slate instead of replaying the old comments. */\n clearAll(): number;\n}\n\nfunction isComment(x: unknown): x is Comment {\n const c = x as Comment | null;\n return !!c && typeof c === 'object' && typeof c.id === 'string' && typeof c.body === 'string';\n}\n\nfunction readRows(d: Db, store: string): Comment[] {\n return (d.prepare('SELECT data FROM comments WHERE store = ? ORDER BY rowid').all(store) as Array<{ data: string }>)\n .map((r) => json.parse(r.data))\n .filter(isComment);\n}\n\n/** Replace a store's rows with `comments` (in their order). */\nfunction writeRows(d: Db, store: string, comments: Comment[]): void {\n d.prepare('DELETE FROM comments WHERE store = ?').run(store);\n const ins = d.prepare('INSERT OR REPLACE INTO comments (store, id, data) VALUES (?, ?, ?)');\n for (const c of comments) ins.run(store, c.id, JSON.stringify(c));\n}\n\n/** A store's comments straight from the database: current even when\n * another process wrote since this process cached the store. */\nexport function readStoreComments(store: string): Comment[] {\n return withDb((d) => readRows(d, store));\n}\n\n/** Several stores' comments in one query, each in its order; a store with none isn't in the map. Caches nothing\n * (getCommentFileStore keeps every store it's asked for). */\nexport function readStoresComments(stores: string[]): Map<string, Comment[]> {\n const out = new Map<string, Comment[]>();\n if (stores.length === 0) return out;\n const marks = stores.map(() => '?').join(', ');\n const rows = withDb(\n (d) =>\n d.prepare(`SELECT store, data FROM comments WHERE store IN (${marks}) ORDER BY rowid`).all(...stores) as Array<{\n store: string;\n data: string;\n }>,\n );\n for (const r of rows) {\n const c = json.parse(r.data);\n if (!isComment(c)) continue;\n const list = out.get(r.store) ?? [];\n list.push(c);\n out.set(r.store, list);\n }\n return out;\n}\n\nconst cache = new Map<string, CommentFileStore>();\n\nexport function getCommentFileStore(sessionId: string): CommentFileStore {\n const existing = cache.get(sessionId);\n if (existing) return existing;\n\n const inner = createCommentStore();\n\n /** Replace the in-memory contents with the current on-disk contents.\n * Used to reconcile before a mutation so concurrent writers (e.g. a\n * `work broadcast` process appending under the same lock) aren't lost. */\n function reloadFrom(rows: Comment[]): void {\n const list = inner.list() as Comment[];\n list.length = 0;\n for (const c of rows) list.push(c);\n }\n function reloadInner(): void {\n reloadFrom(withDb((d) => readRows(d, sessionId)));\n }\n\n // Seed from the database.\n reloadInner();\n\n /**\n * A read-modify-write of this store in one write transaction: reload the\n * in-memory model from the database (so it reflects other processes'\n * writes), apply `mutate`, persist. `persisted` reports whether anything\n * changed, so a no-op (e.g. removing a missing id) skips the write.\n */\n function lockedMutate<T>(mutate: () => { value: T; persisted: boolean }): T {\n return tx((d) => {\n reloadFrom(readRows(d, sessionId));\n const { value, persisted } = mutate();\n if (persisted) writeRows(d, sessionId, inner.snapshot());\n return value;\n });\n }\n\n const store: CommentFileStore = {\n // Reads reload first (one indexed query): `work broadcast` and the\n // hooks write to the same store from other processes, and a list\n // served from this process's memory didn't show them until something\n // here mutated. The in-memory model is for mutations, not a cache.\n list: () => {\n reloadInner();\n return inner.list();\n },\n snapshot: () => {\n reloadInner();\n return inner.snapshot();\n },\n post(input: CommentInput) {\n return lockedMutate(() => {\n const c = inner.post(input);\n return { value: c, persisted: true };\n });\n },\n remove(id: string) {\n return lockedMutate(() => {\n const r = inner.remove(id);\n return { value: r, persisted: r };\n });\n },\n setResolved(id: string, resolved: boolean) {\n return lockedMutate(() => {\n const c = inner.setResolved(id, resolved);\n return { value: c, persisted: c !== null };\n });\n },\n submit(summary: string | undefined) {\n return lockedMutate(() => {\n const result = inner.submit(summary);\n return { value: result, persisted: true };\n });\n },\n discardDrafts() {\n return lockedMutate(() => {\n const n = inner.discardDrafts();\n return { value: n, persisted: n > 0 };\n });\n },\n reload() {\n reloadInner();\n },\n clearAll() {\n return lockedMutate(() => {\n const list = inner.list() as Comment[];\n const n = list.length;\n list.length = 0;\n return { value: n, persisted: n > 0 };\n });\n },\n };\n cache.set(sessionId, store);\n return store;\n}\n\n/** Clear the in-memory cache. Test/server-shutdown hook. */\nexport function clearCommentStoreCache(): void {\n cache.clear();\n}\n"],"mappings":";;;;;;;;;;;AAuBA,SAAS,UAAU,GAA0B;AAC3C,QAAM,IAAI;AACV,SAAO,CAAC,CAAC,KAAK,OAAO,MAAM,YAAY,OAAO,EAAE,OAAO,YAAY,OAAO,EAAE,SAAS;AACvF;AAEA,SAAS,SAAS,GAAO,OAA0B;AACjD,SAAQ,EAAE,QAAQ,0DAA0D,EAAE,IAAI,KAAK,EACpF,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,IAAI,CAAC,EAC7B,OAAO,SAAS;AACrB;AAGA,SAAS,UAAU,GAAO,OAAe,UAA2B;AAClE,IAAE,QAAQ,sCAAsC,EAAE,IAAI,KAAK;AAC3D,QAAM,MAAM,EAAE,QAAQ,oEAAoE;AAC1F,aAAW,KAAK,SAAU,KAAI,IAAI,OAAO,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC;AAClE;AAIO,SAAS,kBAAkB,OAA0B;AAC1D,SAAO,OAAO,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AACzC;AAIO,SAAS,mBAAmB,QAA0C;AAC3E,QAAM,MAAM,oBAAI,IAAuB;AACvC,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,QAAM,QAAQ,OAAO,IAAI,MAAM,GAAG,EAAE,KAAK,IAAI;AAC7C,QAAM,OAAO;AAAA,IACX,CAAC,MACC,EAAE,QAAQ,oDAAoD,KAAK,kBAAkB,EAAE,IAAI,GAAG,MAAM;AAAA,EAIxG;AACA,aAAW,KAAK,MAAM;AACpB,UAAM,IAAI,KAAK,MAAM,EAAE,IAA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EAAE,OAAO,GAAG,WAAW,EAAE;AAAA,MAClC,CAAC;AAAA,IACH;AAAA,IACA,YAAY,IAAY,UAAmB;AACzC,aAAO,aAAa,MAAM;AACxB,cAAM,IAAI,MAAM,YAAY,IAAI,QAAQ;AACxC,eAAO,EAAE,OAAO,GAAG,WAAW,MAAM,KAAK;AAAA,MAC3C,CAAC;AAAA,IACH;AAAA,IACA,OAAO,SAA6B;AAClC,aAAO,aAAa,MAAM;AACxB,cAAM,SAAS,MAAM,OAAO,OAAO;AACnC,eAAO,EAAE,OAAO,QAAQ,WAAW,KAAK;AAAA,MAC1C,CAAC;AAAA,IACH;AAAA,IACA,gBAAgB;AACd,aAAO,aAAa,MAAM;AACxB,cAAM,IAAI,MAAM,cAAc;AAC9B,eAAO,EAAE,OAAO,GAAG,WAAW,IAAI,EAAE;AAAA,MACtC,CAAC;AAAA,IACH;AAAA,IACA,SAAS;AACP,kBAAY;AAAA,IACd;AAAA,IACA,WAAW;AACT,aAAO,aAAa,MAAM;AACxB,cAAM,OAAO,MAAM,KAAK;AACxB,cAAM,IAAI,KAAK;AACf,aAAK,SAAS;AACd,eAAO,EAAE,OAAO,GAAG,WAAW,IAAI,EAAE;AAAA,MACtC,CAAC;AAAA,IACH;AAAA,EACF;AACA,QAAM,IAAI,WAAW,KAAK;AAC1B,SAAO;AACT;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-6AQRYLOB.js";
|
|
5
5
|
import {
|
|
6
6
|
findSessionForCwd
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PVN5IGDZ.js";
|
|
8
8
|
import {
|
|
9
9
|
findSession,
|
|
10
10
|
loadHistory
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
sessionPositionals,
|
|
39
39
|
sessionFromArgs
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
41
|
+
//# sourceMappingURL=chunk-EU3BS5A6.js.map
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
} from "./chunk-JTHILJFB.js";
|
|
12
12
|
import {
|
|
13
13
|
checkedOutBranch
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PVN5IGDZ.js";
|
|
15
15
|
import {
|
|
16
16
|
getCommentFileStore
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-E3Y4ZACK.js";
|
|
18
18
|
import {
|
|
19
19
|
getStatusChecked,
|
|
20
20
|
git
|
|
@@ -148,4 +148,4 @@ export {
|
|
|
148
148
|
uncommittedFiles,
|
|
149
149
|
defaultForkDeps
|
|
150
150
|
};
|
|
151
|
-
//# sourceMappingURL=chunk-
|
|
151
|
+
//# sourceMappingURL=chunk-GWJVU4AS.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
defaultCleanupDeps
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7UU5LPDM.js";
|
|
5
5
|
import {
|
|
6
6
|
normPath
|
|
7
7
|
} from "./chunk-AKMPF72Y.js";
|
|
8
8
|
import {
|
|
9
9
|
findSessionForCwd
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PVN5IGDZ.js";
|
|
11
11
|
import {
|
|
12
12
|
buildFoldersOf,
|
|
13
13
|
clearBuildFolders
|
|
@@ -292,4 +292,4 @@ export {
|
|
|
292
292
|
deleteMergedBranches,
|
|
293
293
|
defaultBranchTidyDeps
|
|
294
294
|
};
|
|
295
|
-
//# sourceMappingURL=chunk-
|
|
295
|
+
//# sourceMappingURL=chunk-HBCL77AR.js.map
|
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
} from "./chunk-ZSHWP2VS.js";
|
|
5
5
|
import {
|
|
6
6
|
getCommentFileStore,
|
|
7
|
-
readStoreComments
|
|
8
|
-
|
|
7
|
+
readStoreComments,
|
|
8
|
+
readStoresComments
|
|
9
|
+
} from "./chunk-E3Y4ZACK.js";
|
|
9
10
|
import {
|
|
10
11
|
loadHistory
|
|
11
12
|
} from "./chunk-OQAQMCHF.js";
|
|
@@ -95,21 +96,20 @@ function scopeStoreIdsForPaths(paths) {
|
|
|
95
96
|
for (const p of resolved) ids.add(`scope-${scopeHashFor([p])}`);
|
|
96
97
|
return [...ids];
|
|
97
98
|
}
|
|
98
|
-
function readPendingForWorktree(session) {
|
|
99
|
-
const sessionId = sessionIdFor(session);
|
|
99
|
+
function readPendingForWorktree(session, sessionId = sessionIdFor(session)) {
|
|
100
100
|
const delivered = withDb((d) => deliveredIds(d, sessionId));
|
|
101
101
|
const pending = isPendingFor(delivered);
|
|
102
|
+
const storeIds = [sessionId, ...scopeStoreIdsForPaths(session.paths)];
|
|
103
|
+
const rows = readStoresComments(storeIds);
|
|
102
104
|
const seen = /* @__PURE__ */ new Set();
|
|
103
105
|
const out = [];
|
|
104
|
-
const
|
|
105
|
-
for (const c of
|
|
106
|
+
for (const storeId of storeIds) {
|
|
107
|
+
for (const c of rows.get(storeId) ?? []) {
|
|
106
108
|
if (seen.has(c.id) || !pending(c)) continue;
|
|
107
109
|
seen.add(c.id);
|
|
108
110
|
out.push(c);
|
|
109
111
|
}
|
|
110
|
-
}
|
|
111
|
-
collect(sessionId);
|
|
112
|
-
for (const storeId of scopeStoreIdsForPaths(session.paths)) collect(storeId);
|
|
112
|
+
}
|
|
113
113
|
return out;
|
|
114
114
|
}
|
|
115
115
|
function resolveAddressed(session) {
|
|
@@ -200,9 +200,10 @@ export {
|
|
|
200
200
|
findSessionForCwd,
|
|
201
201
|
NOTE_NUDGE,
|
|
202
202
|
readPendingForSession,
|
|
203
|
+
scopeStoreIdsForPaths,
|
|
203
204
|
readPendingForWorktree,
|
|
204
205
|
resolveAddressed,
|
|
205
206
|
claimForDelivery,
|
|
206
207
|
formatPendingForPrompt
|
|
207
208
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
209
|
+
//# sourceMappingURL=chunk-PVN5IGDZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/git/git-head.ts","../src/core/comments/pending-delivery.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\n/**\n * The branch checked out in a checkout, read from its HEAD file — no `git`\n * process, so the session list can ask for every session on every request.\n * A worktree's `.git` is a file (`gitdir: <repo>/.git/worktrees/<name>`)\n * whose HEAD names the branch; a base checkout's `.git` is the folder.\n *\n * null: detached HEAD, not a checkout, or unreadable.\n */\nexport function checkedOutBranch(checkout: string): string | null {\n try {\n const dotGit = path.join(checkout, '.git');\n let gitDir = dotGit;\n if (fs.statSync(dotGit).isFile()) {\n const m = /^gitdir:\\s*(.+?)\\s*$/m.exec(fs.readFileSync(dotGit, 'utf8'));\n if (!m) return null;\n gitDir = path.resolve(checkout, m[1]);\n }\n return branchFromHead(fs.readFileSync(path.join(gitDir, 'HEAD'), 'utf8'));\n } catch {\n return null;\n }\n}\n\n/** `ref: refs/heads/fix/x` → `fix/x`; a commit sha (detached) → null. */\nexport function branchFromHead(head: string): string | null {\n const m = /^ref:\\s*refs\\/heads\\/(.+?)\\s*$/m.exec(head);\n return m ? m[1] : null;\n}\n","/**\n * Bridge between `work web` review comments and any live Claude session\n * running in the same worktree. Storage (state.db, see db.ts):\n *\n * comments the comment stores (comment-file-store.ts)\n * comment_deliveries (session, comment id) pairs surfaced to Claude\n *\n * \"Pending\" = published, user-authored, not in the delivered list. Replies\n * authored by Claude (author === 'claude') are excluded — Claude wrote\n * them; we don't need to echo them back.\n *\n * Delivery is lazy: when a Claude in the matching worktree submits a\n * prompt, the hook reads pending comments via this module, prints them as\n * a system-reminder block to stdout (which Claude Code injects into the\n * conversation), and marks them delivered.\n */\n\nimport { checkedOutBranch } from '../git/git-head.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { loadHistory, type WorktreeSession } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { getCommentFileStore, readStoreComments, readStoresComments } from './comment-file-store.js';\nimport { scopeHashFor } from '../diff/repo-spec.js';\nimport { tx, withDb, type Db } from '../platform/db.js';\nimport type { Comment } from './comment-types.js';\n\nfunction deliveredIds(d: Db, sessionId: string): Set<string> {\n return new Set(\n (d.prepare('SELECT comment_id FROM comment_deliveries WHERE session_id = ?').all(sessionId) as Array<{ comment_id: string }>).map(\n (r) => r.comment_id,\n ),\n );\n}\n\n/** Norm-path comparison that mirrors what we do server-side. */\nfunction normalize(p: string): string {\n return path.resolve(p).replace(/\\\\/g, '/').toLowerCase();\n}\n\n/** Map a Claude cwd back to a session. Tries direct-match against any\n * session's path first, then ancestor match (so cwd inside a subdir of a\n * worktree still resolves to the worktree's session). */\n/**\n * Two sessions on one folder (an old entry and a newer one, a typo'd target\n * re-added): which of them a Claude there is. Not an archived one when the\n * other isn't; then the one whose branch is checked out there; then the one\n * entered last. The oldest used to win, so status and comments went to an\n * entry nobody looks at.\n */\nfunction owns(candidate: WorktreeSession, current: WorktreeSession, root: string): boolean {\n if (!!candidate.archivedAt !== !!current.archivedAt) return !candidate.archivedAt;\n const onBranch = checkedOutBranch(root);\n const a = candidate.branch === onBranch;\n const b = current.branch === onBranch;\n if (a !== b) return a;\n return (Date.parse(candidate.lastAccessedAt) || 0) > (Date.parse(current.lastAccessedAt) || 0);\n}\n\nexport function findSessionForCwd(cwd: string, sessions: WorktreeSession[] = loadHistory()): WorktreeSession | null {\n const here = normalize(cwd);\n // Deepest root containing cwd wins, so nested worktrees disambiguate. A\n // group's roots include the group root (the sub-repos' parent) — that's\n // where `work tree` launches Claude for a group, so hooks fire from there.\n let best: { session: WorktreeSession; root: string; len: number } | null = null;\n for (const s of sessions) {\n const roots = s.isGroup && s.paths[0] ? [...s.paths, path.dirname(s.paths[0])] : s.paths;\n for (const root of roots) {\n const r = normalize(root);\n if (!(here === r || here.startsWith(r + '/'))) continue;\n if (!best || r.length > best.len || (r.length === best.len && owns(s, best.session, root))) {\n best = { session: s, root, len: r.length };\n }\n }\n }\n if (!best) return null;\n // A separate checkout nested INSIDE the session's tree (a git worktree at\n // <repo>/.claude/worktrees/x, a vendored repo) is not this session: its\n // Claude must not report status, take checkpoints or receive comments as\n // if it were the parent. Any `.git` between cwd and the matched root —\n // other than the session's own repos — marks a different checkout.\n // (Plain fs checks: this runs on every hook.)\n const own = new Set(best.session.paths.map(normalize));\n const top = normalize(best.root);\n for (let dir = path.resolve(cwd); normalize(dir) !== top && normalize(dir).startsWith(top + '/'); dir = path.dirname(dir)) {\n if (!own.has(normalize(dir)) && fs.existsSync(path.join(dir, '.git'))) return null;\n if (path.dirname(dir) === dir) break;\n }\n return best.session;\n}\n\nfunction isPendingFor(delivered: Set<string>) {\n return (c: Comment) => c.status === 'published' && c.author === 'user' && !delivered.has(c.id);\n}\n\n/** Returns published user comments that haven't been delivered yet.\n * Reads through the file-store cache so we see in-flight writes\n * (`session-meta.ts` and other readers couldn't, when they re-read the\n * disk directly). */\n/**\n * The line typed into an idle Claude (or given as the first prompt of one\n * work starts) so its UserPromptSubmit hook attaches the pending comments.\n * Short on purpose: a long typed note got mangled by Claude Code's paste\n * handling. It says where the content is, so it reads right in the\n * transcript.\n */\nexport const NOTE_NUDGE =\n 'work has new notes for you (review feedback, CI results or comments); they are attached to this message. Work through them now.';\n\nexport function readPendingForSession(sessionId: string): Comment[] {\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n return readStoreComments(sessionId).filter(isPendingFor(delivered));\n}\n\n/** Comment-store ids for every `wd` scope that could cover this worktree.\n * A scope is keyed by `sha1` of its sorted repo roots (see\n * `repo-spec.scopeHashFor`), so from a session's paths we can rebuild the\n * exact ids without consulting `work web`'s in-memory scope registry:\n * - the whole-set hash → a group `wd` opened at the group root, or the\n * single-repo `wd` (one path);\n * - each individual path's hash → a `wd` opened inside one sub-repo of a\n * group worktree.\n * `registerScope` hashes `path.resolve()`d roots, so we resolve here too or\n * the hashes won't line up. Mirrors `scope-manager.commentStoreIdForScope`\n * (`scope-<hash>`). */\nexport function scopeStoreIdsForPaths(paths: string[]): string[] {\n const resolved = paths.map((p) => path.resolve(p));\n const ids = new Set<string>();\n ids.add(`scope-${scopeHashFor(resolved)}`);\n for (const p of resolved) ids.add(`scope-${scopeHashFor([p])}`);\n return [...ids];\n}\n\n/**\n * Pending comments for a whole worktree: the session's own comment store\n * PLUS any `wd` / `wd -c` scope review store covering the same paths.\n *\n * `wd` registers its review under a scope-hash comment store, not the\n * session store the hook reads — without this merge, comments left in the\n * `wd` review UI would never reach the Claude running in that worktree.\n * Delivered-tracking stays per-session (one `<sessionId>.delivered.json`),\n * so a comment surfaced here won't be re-delivered regardless of which\n * store it came from.\n */\nexport function readPendingForWorktree(session: WorktreeSession, sessionId: string = sessionIdFor(session)): Comment[] {\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n const pending = isPendingFor(delivered);\n const storeIds = [sessionId, ...scopeStoreIdsForPaths(session.paths)];\n const rows = readStoresComments(storeIds); // one query: this runs for every row of /api/sessions\n const seen = new Set<string>();\n const out: Comment[] = [];\n for (const storeId of storeIds) {\n for (const c of rows.get(storeId) ?? []) {\n if (seen.has(c.id) || !pending(c)) continue;\n seen.add(c.id);\n out.push(c);\n }\n }\n return out;\n}\n\n/**\n * What was handed to Claude is done once its turn really ends: your review\n * comments and work's notes to it (PR feedback, CI, a prompt you sent) —\n * every top-level comment of yours it was given, in the session's store and\n * any `wd` scope store over its paths — are marked resolved. Left open, they\n * piled up on the Diff tab's badge (three PR-watch notes read as \"3\"), to\n * resolve or delete by hand. Resolved threads stay listed (dimmed) and can\n * be reopened. Claude's own replies are left as they are. Returns the ids\n * resolved.\n */\nexport function resolveAddressed(session: WorktreeSession): string[] {\n const sessionId = sessionIdFor(session);\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n if (delivered.size === 0) return [];\n const done: string[] = [];\n for (const storeId of [sessionId, ...scopeStoreIdsForPaths(session.paths)]) {\n const open = readStoreComments(storeId).filter(\n (c) => delivered.has(c.id) && c.author === 'user' && c.status === 'published' && !c.parentId && !c.resolved,\n );\n if (open.length === 0) continue;\n const store = getCommentFileStore(storeId);\n for (const c of open) if (store.setResolved(c.id, true)) done.push(c.id);\n }\n return done;\n}\n\n/** Persist a delivery batch, so these ids are never surfaced again. */\nexport function markDelivered(sessionId: string, ids: string[]): void {\n if (ids.length === 0) return;\n tx((d) => {\n const ins = d.prepare('INSERT OR IGNORE INTO comment_deliveries (session_id, comment_id) VALUES (?, ?)');\n for (const id of ids) ins.run(sessionId, id);\n });\n}\n\n/**\n * Claim comments for delivery: of `ids`, return the ones nobody has\n * delivered yet, and mark them delivered — atomically. Two deliverers\n * racing (a Stop hook and the PTY push for the same comment) then can't\n * both send it: only the one that claimed it does. A deliverer whose send\n * fails gives the ids back with `releaseClaim`.\n */\nexport function claimForDelivery(sessionId: string, ids: string[]): string[] {\n if (ids.length === 0) return [];\n // INSERT OR IGNORE in one write transaction: a row inserted here is our\n // claim; one that already existed was someone else's.\n return tx((d) => {\n const ins = d.prepare('INSERT OR IGNORE INTO comment_deliveries (session_id, comment_id) VALUES (?, ?)');\n return ids.filter((id) => ins.run(sessionId, id).changes > 0);\n });\n}\n\n/** Undo a claim whose delivery failed, so the next hook picks them up. */\nexport function releaseClaim(sessionId: string, ids: string[]): void {\n if (ids.length === 0) return;\n tx((d) => {\n const del = d.prepare('DELETE FROM comment_deliveries WHERE session_id = ? AND comment_id = ?');\n for (const id of ids) del.run(sessionId, id);\n });\n}\n\n/** Cap the size of one comment body we surface to Claude. A pathologically\n * long comment shouldn't blow out Claude's context — we truncate, then\n * hint at the rest via \"(truncated)\". 4 KB is generous for a code-review\n * note while leaving headroom for batches. */\nconst MAX_BODY_BYTES = 4 * 1024;\n/** A general note: a prompt, or work's own note (a PR review round quotes\n * every thread, then a bot's overview). 4 KB once cut such a note before\n * the line telling Claude how to draft its replies. */\nconst MAX_NOTE_BYTES = 16 * 1024;\n/** Overall cap on the whole system-reminder payload. Multiple long\n * comments at once still get bounded — but room for four whole notes, since\n * the cut falls on the newest one's end: its instructions. */\nconst MAX_TOTAL_BYTES = 4 * MAX_NOTE_BYTES;\n\n/**\n * Format pending comments as a system-reminder block suitable for stdout.\n * Returns empty string when there's nothing pending — the caller (the\n * `work hook` CLI) just exits silently in that case.\n *\n * Truncates pathologically long bodies and caps the overall payload so\n * one runaway comment can't displace the rest of Claude's context.\n */\nexport function formatPendingForPrompt(pending: Comment[]): string {\n if (pending.length === 0) return '';\n\n const sorted = [...pending].sort((a, b) => a.createdAt.localeCompare(b.createdAt));\n\n const general = sorted.filter((c) => c.side === 'general' && !c.parentId);\n const inline = sorted.filter((c) => c.side !== 'general' && !c.parentId);\n const replies = sorted.filter((c) => c.parentId);\n\n const lines: string[] = [];\n lines.push('<system-reminder>');\n lines.push(`New review comments from \\`work web\\` (${pending.length} item${pending.length === 1 ? '' : 's'}):`);\n lines.push('');\n\n if (general.length > 0) {\n lines.push('## General notes');\n for (const c of general) {\n // General notes (this is where `work broadcast` lands) may be multi-line\n // prompts — deliver the whole body, not just line 1. Only the byte cap\n // applies. Inline/reply comments still use the one-line `formatBody`.\n lines.push(formatFullBody('-', c));\n }\n lines.push('');\n }\n\n if (inline.length > 0) {\n lines.push('## Inline comments');\n for (const c of inline) {\n const where = `${c.repo}/${c.file}:${c.line} (${c.side})`;\n lines.push(formatBody(`- ${where}`, c));\n }\n lines.push('');\n }\n\n if (replies.length > 0) {\n lines.push('## Replies');\n for (const c of replies) {\n lines.push(formatBody(`- (reply to ${c.parentId})`, c));\n }\n lines.push('');\n }\n\n lines.push(\n 'Address them as part of your next response. You can reply via the same review UI by posting back to the latest review URL at `~/.work/web.url` + `/api/sessions/<id>/comments` with `author: \"claude\"`.',\n );\n lines.push('</system-reminder>');\n const out = lines.join('\\n');\n if (out.length <= MAX_TOTAL_BYTES) return out;\n const trimmed = out.slice(0, MAX_TOTAL_BYTES - 200);\n return (\n trimmed +\n '\\n\\n(…review payload truncated for context-window safety; ' +\n `${pending.length} comment(s) total — open work web for the full list.)\\n` +\n '</system-reminder>'\n );\n}\n\nfunction formatBody(prefix: string, c: Comment): string {\n const lead = c.body.split('\\n')[0].trim();\n const capped = lead.length > MAX_BODY_BYTES ? `${lead.slice(0, MAX_BODY_BYTES)}…` : lead;\n return `${prefix}: ${capped}${c.body.includes('\\n') ? ' …' : ''}`;\n}\n\n/** Like `formatBody` but preserves the full multi-line body (only the note\n * cap applies). Multi-line bodies are emitted under the bullet, indented, so\n * a broadcast prompt arrives intact rather than truncated to its first line. */\nfunction formatFullBody(prefix: string, c: Comment): string {\n const body = c.body.trim();\n const capped = body.length > MAX_NOTE_BYTES ? `${body.slice(0, MAX_NOTE_BYTES)}…` : body;\n const bodyLines = capped.split('\\n');\n if (bodyLines.length === 1) return `${prefix}: ${bodyLines[0]}`;\n const [first, ...rest] = bodyLines;\n return [`${prefix}: ${first}`, ...rest.map((l) => ` ${l}`)].join('\\n');\n}\n\n/** Re-export so consumers don't have to know which module owns it. */\nexport { sessionIdFor };\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAUV,SAAS,iBAAiB,UAAiC;AAChE,MAAI;AACF,UAAM,SAAS,KAAK,KAAK,UAAU,MAAM;AACzC,QAAI,SAAS;AACb,QAAI,GAAG,SAAS,MAAM,EAAE,OAAO,GAAG;AAChC,YAAM,IAAI,wBAAwB,KAAK,GAAG,aAAa,QAAQ,MAAM,CAAC;AACtE,UAAI,CAAC,EAAG,QAAO;AACf,eAAS,KAAK,QAAQ,UAAU,EAAE,CAAC,CAAC;AAAA,IACtC;AACA,WAAO,eAAe,GAAG,aAAa,KAAK,KAAK,QAAQ,MAAM,GAAG,MAAM,CAAC;AAAA,EAC1E,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,eAAe,MAA6B;AAC1D,QAAM,IAAI,kCAAkC,KAAK,IAAI;AACrD,SAAO,IAAI,EAAE,CAAC,IAAI;AACpB;;;ACZA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AAQjB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QAAM,KAAK,oBAAoB;AAC/B,QAAM,MAAM,MAAM,KAAK,IAAI;AAC3B,MAAI,IAAI,UAAU,gBAAiB,QAAO;AAC1C,QAAM,UAAU,IAAI,MAAM,GAAG,kBAAkB,GAAG;AAClD,SACE,UACA;AAAA;AAAA,6DACG,QAAQ,MAAM;AAAA;AAGrB;AAEA,SAAS,WAAW,QAAgB,GAAoB;AACtD,QAAM,OAAO,EAAE,KAAK,MAAM,IAAI,EAAE,CAAC,EAAE,KAAK;AACxC,QAAM,SAAS,KAAK,SAAS,iBAAiB,GAAG,KAAK,MAAM,GAAG,cAAc,CAAC,WAAM;AACpF,SAAO,GAAG,MAAM,KAAK,MAAM,GAAG,EAAE,KAAK,SAAS,IAAI,IAAI,YAAO,EAAE;AACjE;AAKA,SAAS,eAAe,QAAgB,GAAoB;AAC1D,QAAM,OAAO,EAAE,KAAK,KAAK;AACzB,QAAM,SAAS,KAAK,SAAS,iBAAiB,GAAG,KAAK,MAAM,GAAG,cAAc,CAAC,WAAM;AACpF,QAAM,YAAY,OAAO,MAAM,IAAI;AACnC,MAAI,UAAU,WAAW,EAAG,QAAO,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC;AAC7D,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AACzB,SAAO,CAAC,GAAG,MAAM,KAAK,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,IAAI;AACxE;","names":["fs","path","path","fs"]}
|
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
} from "./chunk-427RB7E4.js";
|
|
11
11
|
import {
|
|
12
12
|
checkedOutBranch,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
readPendingForWorktree,
|
|
14
|
+
scopeStoreIdsForPaths
|
|
15
|
+
} from "./chunk-PVN5IGDZ.js";
|
|
15
16
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
readStoresComments
|
|
18
|
+
} from "./chunk-E3Y4ZACK.js";
|
|
18
19
|
import {
|
|
19
20
|
STAGE_WANTS_YOU,
|
|
20
21
|
archiveDirFor,
|
|
@@ -41,9 +42,56 @@ import {
|
|
|
41
42
|
import fs2 from "fs";
|
|
42
43
|
import path from "path";
|
|
43
44
|
|
|
45
|
+
// src/core/comments/linked-stores.ts
|
|
46
|
+
var linkedSession = (s) => ({ id: sessionIdFor(s), paths: s.paths });
|
|
47
|
+
function sessionLinkedStoreIds(session) {
|
|
48
|
+
return [session.id, ...scopeStoreIdsForPaths(session.paths)];
|
|
49
|
+
}
|
|
50
|
+
function scopeLinkedStoreIds(hash, sessions) {
|
|
51
|
+
const own = `scope-${hash}`;
|
|
52
|
+
return [own, ...new Set(sessions.filter((s) => scopeStoreIdsForPaths(s.paths).includes(own)).map((s) => s.id))];
|
|
53
|
+
}
|
|
54
|
+
function readerFor(storeIds) {
|
|
55
|
+
const rows = readStoresComments(storeIds);
|
|
56
|
+
return (id) => rows.get(id) ?? [];
|
|
57
|
+
}
|
|
58
|
+
function linkedComments(storeIds, read = readerFor(storeIds)) {
|
|
59
|
+
const seen = /* @__PURE__ */ new Set();
|
|
60
|
+
const out = [];
|
|
61
|
+
storeIds.forEach((id, i) => {
|
|
62
|
+
for (const c of read(id)) {
|
|
63
|
+
if (seen.has(c.id) || i > 0 && c.status === "draft") continue;
|
|
64
|
+
seen.add(c.id);
|
|
65
|
+
out.push(c);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return out.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
69
|
+
}
|
|
70
|
+
function storeHolding(storeIds, commentId, read = readerFor(storeIds)) {
|
|
71
|
+
return storeIds.find((id) => read(id).some((c) => c.id === commentId)) ?? null;
|
|
72
|
+
}
|
|
73
|
+
function viewersOf(storeId, sessions) {
|
|
74
|
+
if (storeId.startsWith("scope-")) {
|
|
75
|
+
return {
|
|
76
|
+
sessionIds: [...new Set(sessions.filter((s) => scopeStoreIdsForPaths(s.paths).includes(storeId)).map((s) => s.id))],
|
|
77
|
+
scopeHashes: [storeId.slice("scope-".length)]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const session = sessions.find((s) => s.id === storeId);
|
|
81
|
+
return {
|
|
82
|
+
sessionIds: [storeId],
|
|
83
|
+
scopeHashes: session ? scopeStoreIdsForPaths(session.paths).map((id) => id.slice("scope-".length)) : []
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function announceChange(storeId, sessions, tell, data) {
|
|
87
|
+
const { sessionIds, scopeHashes } = viewersOf(storeId, sessions);
|
|
88
|
+
for (const sessionId of sessionIds) tell.session(sessionId, { ...data, sessionId });
|
|
89
|
+
for (const scopeHash of scopeHashes) tell.scope(scopeHash, { ...data, scopeHash });
|
|
90
|
+
}
|
|
91
|
+
|
|
44
92
|
// src/core/sessions/session-meta.ts
|
|
45
93
|
function readSessionMeta(sessionId, session) {
|
|
46
|
-
const comments =
|
|
94
|
+
const comments = linkedComments(sessionLinkedStoreIds({ id: sessionId, paths: session.paths }));
|
|
47
95
|
let drafts = 0;
|
|
48
96
|
let claude = 0;
|
|
49
97
|
let open = 0;
|
|
@@ -53,7 +101,7 @@ function readSessionMeta(sessionId, session) {
|
|
|
53
101
|
if (!c.parentId && !c.resolved) open++;
|
|
54
102
|
}
|
|
55
103
|
const activity = readSessionActivity(session);
|
|
56
|
-
const pending =
|
|
104
|
+
const pending = readPendingForWorktree(session, sessionId).length;
|
|
57
105
|
const status = readStatus(sessionId);
|
|
58
106
|
return {
|
|
59
107
|
draftCount: drafts,
|
|
@@ -283,6 +331,12 @@ function createArchivedRows(archiveFile = (id) => path.join(archiveDirFor(id), "
|
|
|
283
331
|
}
|
|
284
332
|
|
|
285
333
|
export {
|
|
334
|
+
linkedSession,
|
|
335
|
+
sessionLinkedStoreIds,
|
|
336
|
+
scopeLinkedStoreIds,
|
|
337
|
+
linkedComments,
|
|
338
|
+
storeHolding,
|
|
339
|
+
announceChange,
|
|
286
340
|
readContextUsage,
|
|
287
341
|
sessionWire,
|
|
288
342
|
reviewThreadsOf,
|
|
@@ -291,4 +345,4 @@ export {
|
|
|
291
345
|
lastActiveMs,
|
|
292
346
|
createArchivedRows
|
|
293
347
|
};
|
|
294
|
-
//# sourceMappingURL=chunk-
|
|
348
|
+
//# sourceMappingURL=chunk-TVMZ4NYY.js.map
|