@moberg_hr/work-tree 1.16.0 → 2.0.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 +56 -142
- package/dist/answer-2J4XLIP7.js +63 -0
- package/dist/answer-2J4XLIP7.js.map +1 -0
- package/dist/attach-CZKRNPAJ.js +59 -0
- package/dist/attach-CZKRNPAJ.js.map +1 -0
- package/dist/bin.js +26 -11924
- package/dist/bin.js.map +1 -1
- package/dist/block-RAIDCJ4F.js +84 -0
- package/dist/block-RAIDCJ4F.js.map +1 -0
- package/dist/broadcast-BSI5NDDB.js +104 -0
- package/dist/broadcast-BSI5NDDB.js.map +1 -0
- package/dist/catchup-VVOPL2S5.js +51 -0
- package/dist/catchup-VVOPL2S5.js.map +1 -0
- package/dist/chunk-3JWTO5VZ.js +135 -0
- package/dist/chunk-3JWTO5VZ.js.map +1 -0
- package/dist/chunk-4BOK2GXL.js +210 -0
- package/dist/chunk-4BOK2GXL.js.map +1 -0
- package/dist/chunk-5QK7GB5K.js +112 -0
- package/dist/chunk-5QK7GB5K.js.map +1 -0
- package/dist/chunk-6AQRYLOB.js +16 -0
- package/dist/chunk-6AQRYLOB.js.map +1 -0
- package/dist/chunk-6FTIY5M6.js +120 -0
- package/dist/chunk-6FTIY5M6.js.map +1 -0
- package/dist/chunk-6H3MLDGG.js +48 -0
- package/dist/chunk-6H3MLDGG.js.map +1 -0
- package/dist/chunk-77XFJQGC.js +103 -0
- package/dist/chunk-77XFJQGC.js.map +1 -0
- package/dist/chunk-7H4BJ2YA.js +308 -0
- package/dist/chunk-7H4BJ2YA.js.map +1 -0
- package/dist/chunk-7HEB6SQS.js +257 -0
- package/dist/chunk-7HEB6SQS.js.map +1 -0
- package/dist/chunk-7NAXFBFI.js +206 -0
- package/dist/chunk-7NAXFBFI.js.map +1 -0
- package/dist/chunk-7NCW3LUT.js +358 -0
- package/dist/chunk-7NCW3LUT.js.map +1 -0
- package/dist/chunk-7OLPI334.js +537 -0
- package/dist/chunk-7OLPI334.js.map +1 -0
- package/dist/chunk-ABQYKTG4.js +38 -0
- package/dist/chunk-ABQYKTG4.js.map +1 -0
- package/dist/chunk-AH5TM3NB.js +21 -0
- package/dist/chunk-AH5TM3NB.js.map +1 -0
- package/dist/chunk-AKMPF72Y.js +274 -0
- package/dist/chunk-AKMPF72Y.js.map +1 -0
- package/dist/chunk-C2BK6EBN.js +162 -0
- package/dist/chunk-C2BK6EBN.js.map +1 -0
- package/dist/chunk-C2THFSXA.js +37 -0
- package/dist/chunk-C2THFSXA.js.map +1 -0
- package/dist/chunk-CLGVSX36.js +668 -0
- package/dist/chunk-CLGVSX36.js.map +1 -0
- package/dist/chunk-CXEC5W5V.js +267 -0
- package/dist/chunk-CXEC5W5V.js.map +1 -0
- package/dist/chunk-DW4JPVXB.js +41 -0
- package/dist/chunk-DW4JPVXB.js.map +1 -0
- package/dist/chunk-FR3EWVXI.js +188 -0
- package/dist/chunk-FR3EWVXI.js.map +1 -0
- package/dist/chunk-H5LKMR45.js +117 -0
- package/dist/chunk-H5LKMR45.js.map +1 -0
- package/dist/chunk-HSICXDMZ.js +41 -0
- package/dist/chunk-HSICXDMZ.js.map +1 -0
- package/dist/chunk-HUXS3VAI.js +90 -0
- package/dist/chunk-HUXS3VAI.js.map +1 -0
- package/dist/chunk-HWUINPIL.js +151 -0
- package/dist/chunk-HWUINPIL.js.map +1 -0
- package/dist/chunk-IXKVCR4Y.js +487 -0
- package/dist/chunk-IXKVCR4Y.js.map +1 -0
- package/dist/chunk-JNBYNRFS.js +54 -0
- package/dist/chunk-JNBYNRFS.js.map +1 -0
- package/dist/chunk-JYTMT5DF.js +421 -0
- package/dist/chunk-JYTMT5DF.js.map +1 -0
- package/dist/chunk-KA4JVX5U.js +295 -0
- package/dist/chunk-KA4JVX5U.js.map +1 -0
- package/dist/chunk-KGZ6OZ2T.js +102 -0
- package/dist/chunk-KGZ6OZ2T.js.map +1 -0
- package/dist/chunk-LNHSBM4L.js +26 -0
- package/dist/chunk-LNHSBM4L.js.map +1 -0
- package/dist/chunk-M4FVCAT6.js +2406 -0
- package/dist/chunk-M4FVCAT6.js.map +1 -0
- package/dist/chunk-MAGGGRSB.js +9 -0
- package/dist/chunk-MAGGGRSB.js.map +1 -0
- package/dist/chunk-N4EYQKSM.js +104 -0
- package/dist/chunk-N4EYQKSM.js.map +1 -0
- package/dist/chunk-NDWSLQPB.js +112 -0
- package/dist/chunk-NDWSLQPB.js.map +1 -0
- package/dist/chunk-O3QTWVSK.js +323 -0
- package/dist/chunk-O3QTWVSK.js.map +1 -0
- package/dist/chunk-P3BL4EOP.js +37 -0
- package/dist/chunk-P3BL4EOP.js.map +1 -0
- package/dist/chunk-PN44M5EE.js +887 -0
- package/dist/chunk-PN44M5EE.js.map +1 -0
- package/dist/chunk-PZ4RG6EW.js +132 -0
- package/dist/chunk-PZ4RG6EW.js.map +1 -0
- package/dist/chunk-Q6WZCO45.js +47 -0
- package/dist/chunk-Q6WZCO45.js.map +1 -0
- package/dist/chunk-QBAZG4CY.js +230 -0
- package/dist/chunk-QBAZG4CY.js.map +1 -0
- package/dist/chunk-R2LN3JJJ.js +132 -0
- package/dist/chunk-R2LN3JJJ.js.map +1 -0
- package/dist/chunk-RCYI7SRA.js +15 -0
- package/dist/chunk-RCYI7SRA.js.map +1 -0
- package/dist/chunk-RYNBBSLY.js +67 -0
- package/dist/chunk-RYNBBSLY.js.map +1 -0
- package/dist/chunk-S5HJT7CM.js +30 -0
- package/dist/chunk-S5HJT7CM.js.map +1 -0
- package/dist/chunk-SNAQOHNL.js +285 -0
- package/dist/chunk-SNAQOHNL.js.map +1 -0
- package/dist/chunk-SOCPIHCS.js +181 -0
- package/dist/chunk-SOCPIHCS.js.map +1 -0
- package/dist/chunk-TUC4QY4O.js +147 -0
- package/dist/chunk-TUC4QY4O.js.map +1 -0
- package/dist/chunk-TUFQJXXO.js +19 -0
- package/dist/chunk-TUFQJXXO.js.map +1 -0
- package/dist/chunk-UFY7C5PP.js +90 -0
- package/dist/chunk-UFY7C5PP.js.map +1 -0
- package/dist/chunk-UQ35KLHH.js +34 -0
- package/dist/chunk-UQ35KLHH.js.map +1 -0
- package/dist/chunk-VJ7SVDED.js +177 -0
- package/dist/chunk-VJ7SVDED.js.map +1 -0
- package/dist/chunk-VJNSIDOA.js +23 -0
- package/dist/chunk-VJNSIDOA.js.map +1 -0
- package/dist/chunk-WF5SBVPZ.js +190 -0
- package/dist/chunk-WF5SBVPZ.js.map +1 -0
- package/dist/chunk-WMJIU3YW.js +29 -0
- package/dist/chunk-WMJIU3YW.js.map +1 -0
- package/dist/chunk-XJDEROHY.js +19 -0
- package/dist/chunk-XJDEROHY.js.map +1 -0
- package/dist/chunk-YKODIG22.js +221 -0
- package/dist/chunk-YKODIG22.js.map +1 -0
- package/dist/chunk-YLG6DO5Y.js +162 -0
- package/dist/chunk-YLG6DO5Y.js.map +1 -0
- package/dist/chunk-YNKWLC45.js +122 -0
- package/dist/chunk-YNKWLC45.js.map +1 -0
- package/dist/chunk-YZDD5YGE.js +165 -0
- package/dist/chunk-YZDD5YGE.js.map +1 -0
- package/dist/chunk-YZWADOEW.js +151 -0
- package/dist/chunk-YZWADOEW.js.map +1 -0
- package/dist/chunk-ZJN5RWZD.js +76 -0
- package/dist/chunk-ZJN5RWZD.js.map +1 -0
- package/dist/chunk-ZSHWP2VS.js +22 -0
- package/dist/chunk-ZSHWP2VS.js.map +1 -0
- package/dist/chunk-ZXPYWZL5.js +307 -0
- package/dist/chunk-ZXPYWZL5.js.map +1 -0
- package/dist/cleanup-X45MA74G.js +192 -0
- package/dist/cleanup-X45MA74G.js.map +1 -0
- package/dist/cli-52VWEHIQ.js +18 -0
- package/dist/cli-52VWEHIQ.js.map +1 -0
- package/dist/command-hook-installer-SGEJTZ2Y.js +204 -0
- package/dist/command-hook-installer-SGEJTZ2Y.js.map +1 -0
- package/dist/completion-MXX5TRIV.js +118 -0
- package/dist/completion-MXX5TRIV.js.map +1 -0
- package/dist/config-IEIU7A66.js +410 -0
- package/dist/config-IEIU7A66.js.map +1 -0
- package/dist/console-reporter-XU6VFUZE.js +10 -0
- package/dist/console-reporter-XU6VFUZE.js.map +1 -0
- package/dist/diff-K47HB6SA.js +582 -0
- package/dist/diff-K47HB6SA.js.map +1 -0
- package/dist/digest-FBZTBXQO.js +100 -0
- package/dist/digest-FBZTBXQO.js.map +1 -0
- package/dist/fork-BKI5UNNS.js +120 -0
- package/dist/fork-BKI5UNNS.js.map +1 -0
- package/dist/hook-SLMZT5OV.js +220 -0
- package/dist/hook-SLMZT5OV.js.map +1 -0
- package/dist/hydrate-Y2AAMZTA.js +121 -0
- package/dist/hydrate-Y2AAMZTA.js.map +1 -0
- package/dist/init-7ESFTYZC.js +187 -0
- package/dist/init-7ESFTYZC.js.map +1 -0
- package/dist/install-skills-O34BHFHD.js +14 -0
- package/dist/install-skills-O34BHFHD.js.map +1 -0
- package/dist/install-skills-bin.js +12 -0
- package/dist/install-skills-bin.js.map +1 -0
- package/dist/list-KEF73NLQ.js +126 -0
- package/dist/list-KEF73NLQ.js.map +1 -0
- package/dist/move-FKT2P5LY.js +313 -0
- package/dist/move-FKT2P5LY.js.map +1 -0
- package/dist/note-WGM6LCP2.js +78 -0
- package/dist/note-WGM6LCP2.js.map +1 -0
- package/dist/overlaps-FRLMMIGC.js +56 -0
- package/dist/overlaps-FRLMMIGC.js.map +1 -0
- package/dist/pin-MQ5ZE37R.js +45 -0
- package/dist/pin-MQ5ZE37R.js.map +1 -0
- package/dist/pr-YU3NOW6G.js +118 -0
- package/dist/pr-YU3NOW6G.js.map +1 -0
- package/dist/prune-26FYYFTO.js +92 -0
- package/dist/prune-26FYYFTO.js.map +1 -0
- package/dist/pty-host-RWIS55N4.js +826 -0
- package/dist/pty-host-RWIS55N4.js.map +1 -0
- package/dist/read-AP6T3ZGN.js +57 -0
- package/dist/read-AP6T3ZGN.js.map +1 -0
- package/dist/recent-IE3LYQ65.js +111 -0
- package/dist/recent-IE3LYQ65.js.map +1 -0
- package/dist/remove-2UHJQ4DY.js +108 -0
- package/dist/remove-2UHJQ4DY.js.map +1 -0
- package/dist/report-KM4OZCZB.js +16 -0
- package/dist/report-KM4OZCZB.js.map +1 -0
- package/dist/resume-UUP6R2IE.js +81 -0
- package/dist/resume-UUP6R2IE.js.map +1 -0
- package/dist/run-V4755W7C.js +263 -0
- package/dist/run-V4755W7C.js.map +1 -0
- package/dist/screen-DNX4K23V.js +58 -0
- package/dist/screen-DNX4K23V.js.map +1 -0
- package/dist/search-3JZXLCR2.js +46 -0
- package/dist/search-3JZXLCR2.js.map +1 -0
- package/dist/section-TXLC5XO3.js +79 -0
- package/dist/section-TXLC5XO3.js.map +1 -0
- package/dist/send-6X46WZLC.js +87 -0
- package/dist/send-6X46WZLC.js.map +1 -0
- package/dist/sessions-T3QDTNP7.js +135 -0
- package/dist/sessions-T3QDTNP7.js.map +1 -0
- package/dist/snooze-KYSFXLPY.js +65 -0
- package/dist/snooze-KYSFXLPY.js.map +1 -0
- package/dist/start-SQSDQK4F.js +56 -0
- package/dist/start-SQSDQK4F.js.map +1 -0
- package/dist/state-4DFV6SHG.js +147 -0
- package/dist/state-4DFV6SHG.js.map +1 -0
- package/dist/status-H5OW4LYE.js +118 -0
- package/dist/status-H5OW4LYE.js.map +1 -0
- package/dist/stop-HC7XPSSP.js +45 -0
- package/dist/stop-HC7XPSSP.js.map +1 -0
- package/dist/sync-3CTAXM6J.js +96 -0
- package/dist/sync-3CTAXM6J.js.map +1 -0
- package/dist/time-GN6B4QD6.js +111 -0
- package/dist/time-GN6B4QD6.js.map +1 -0
- package/dist/todo-LWMQY6XW.js +152 -0
- package/dist/todo-LWMQY6XW.js.map +1 -0
- package/dist/tree-7BMORJ6J.js +235 -0
- package/dist/tree-7BMORJ6J.js.map +1 -0
- package/dist/update-6LQNLRA4.js +57 -0
- package/dist/update-6LQNLRA4.js.map +1 -0
- package/dist/wait-MZOZQ3CI.js +57 -0
- package/dist/wait-MZOZQ3CI.js.map +1 -0
- package/dist/wd-bin.js +21 -11912
- package/dist/wd-bin.js.map +1 -1
- package/dist/web/assets/PtyView-BrP-ENHg.css +1 -0
- package/dist/web/assets/PtyView-M4b0GFVs.js +90 -0
- package/dist/web/assets/PtyView-M4b0GFVs.js.map +1 -0
- package/dist/web/assets/index-5hi1kMKy.js +116 -0
- package/dist/web/assets/index-5hi1kMKy.js.map +1 -0
- package/dist/web/assets/index-L8mjakHP.css +1 -0
- package/dist/web/index.html +3 -5
- package/dist/web-BI3MRQEM.js +7662 -0
- package/dist/web-BI3MRQEM.js.map +1 -0
- package/npm-shrinkwrap.json +6947 -0
- package/package.json +52 -34
- package/plugins/work-tree/.claude-plugin/plugin.json +1 -1
- package/plugins/work-tree/skills/wd-review/SKILL.md +4 -4
- package/plugins/work-tree/skills/work-sessions/SKILL.md +62 -0
- package/scripts/postinstall.mjs +15 -45
- package/dist/web/assets/index-B9H3vCtL.js +0 -107
- package/dist/web/assets/index-B9H3vCtL.js.map +0 -1
- package/dist/web/assets/index-BseMpW5i.css +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
listReplies,
|
|
4
|
+
postDrafts,
|
|
5
|
+
saveDraft
|
|
6
|
+
} from "./chunk-PZ4RG6EW.js";
|
|
7
|
+
import {
|
|
8
|
+
readWebUrl
|
|
9
|
+
} from "./chunk-3JWTO5VZ.js";
|
|
10
|
+
import {
|
|
11
|
+
findSessionForCwd
|
|
12
|
+
} from "./chunk-WF5SBVPZ.js";
|
|
13
|
+
import "./chunk-ZSHWP2VS.js";
|
|
14
|
+
import "./chunk-5QK7GB5K.js";
|
|
15
|
+
import "./chunk-HUXS3VAI.js";
|
|
16
|
+
import {
|
|
17
|
+
defaultRunner
|
|
18
|
+
} from "./chunk-ZXPYWZL5.js";
|
|
19
|
+
import "./chunk-M4FVCAT6.js";
|
|
20
|
+
import {
|
|
21
|
+
sessionIdFor
|
|
22
|
+
} from "./chunk-7NCW3LUT.js";
|
|
23
|
+
import "./chunk-PN44M5EE.js";
|
|
24
|
+
import "./chunk-RCYI7SRA.js";
|
|
25
|
+
import "./chunk-DW4JPVXB.js";
|
|
26
|
+
import "./chunk-N4EYQKSM.js";
|
|
27
|
+
import "./chunk-7HEB6SQS.js";
|
|
28
|
+
|
|
29
|
+
// src/commands/pr.ts
|
|
30
|
+
import fs from "fs";
|
|
31
|
+
import chalk from "chalk";
|
|
32
|
+
async function nudgeWeb(sessionId) {
|
|
33
|
+
const base = readWebUrl();
|
|
34
|
+
if (!base) return;
|
|
35
|
+
await fetch(`${base}api/replies-changed`, {
|
|
36
|
+
method: "POST",
|
|
37
|
+
headers: { "Content-Type": "application/json" },
|
|
38
|
+
body: JSON.stringify({ sessionId }),
|
|
39
|
+
signal: AbortSignal.timeout(3e3)
|
|
40
|
+
}).catch(() => {
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function sessionHere() {
|
|
44
|
+
const s = findSessionForCwd(process.cwd());
|
|
45
|
+
if (!s) {
|
|
46
|
+
console.error(chalk.red("Not inside a work session (run this from the worktree)."));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
return s;
|
|
50
|
+
}
|
|
51
|
+
var prCommand = {
|
|
52
|
+
command: "pr <action>",
|
|
53
|
+
describe: "Review threads handed to this session: draft replies, and post them once the user says yes",
|
|
54
|
+
builder: (y) => y.command(
|
|
55
|
+
"reply <thread> [text..]",
|
|
56
|
+
"Draft the reply to a review thread (shown in the dashboard; posted only on the user's yes)",
|
|
57
|
+
(b) => b.positional("thread", { type: "string", demandOption: true, describe: "The thread id from the feedback note (PRRT_\u2026)" }).positional("text", { type: "string", array: true, describe: "The reply" }).option("body-file", { type: "string", describe: "Read the reply from this file instead" }),
|
|
58
|
+
async (argv) => {
|
|
59
|
+
const s = sessionHere();
|
|
60
|
+
const text = argv["body-file"] ? fs.readFileSync(String(argv["body-file"]), "utf8") : (argv.text ?? []).join(" ");
|
|
61
|
+
const id = sessionIdFor(s);
|
|
62
|
+
const r = saveDraft(id, String(argv.thread), text);
|
|
63
|
+
if (!r.ok) {
|
|
64
|
+
console.error(chalk.red(r.error));
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
await nudgeWeb(id);
|
|
68
|
+
console.log(
|
|
69
|
+
`Draft saved for ${r.reply.reviewer}'s thread on PR #${r.reply.prNumber}. Show it to the user; post it (work pr post ${r.reply.threadId}) only once they say yes.`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
).command(
|
|
73
|
+
"post [threads..]",
|
|
74
|
+
"Post drafted replies from your GitHub account \u2014 for Claude, only once the user has said yes to them",
|
|
75
|
+
(b) => b.positional("threads", { type: "string", array: true, describe: "Thread ids (PRRT_\u2026) whose drafts to post" }).option("all", { type: "boolean", default: false, describe: "Every draft of this session" }).option("resolve", { type: "boolean", default: false, describe: "Also resolve each thread (for comments you fixed)" }),
|
|
76
|
+
async (argv) => {
|
|
77
|
+
const s = sessionHere();
|
|
78
|
+
const id = sessionIdFor(s);
|
|
79
|
+
const asked = argv.threads ?? [];
|
|
80
|
+
const drafts = listReplies(id).filter((r2) => r2.status === "draft" && (argv.all || asked.includes(r2.threadId)));
|
|
81
|
+
const unknown = argv.all ? [] : asked.filter((t) => !drafts.some((r2) => r2.threadId === t));
|
|
82
|
+
for (const t of unknown)
|
|
83
|
+
console.error(chalk.red(`${t}: no draft to post for this session (draft it with \`work pr reply\` first)`));
|
|
84
|
+
if (drafts.length === 0) {
|
|
85
|
+
if (!unknown.length) console.error(chalk.red("Nothing to post: name the threads, or --all."));
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
const r = await postDrafts(s, drafts, argv.resolve === true, defaultRunner);
|
|
89
|
+
await nudgeWeb(id);
|
|
90
|
+
for (const p of r.posted)
|
|
91
|
+
console.log(`Posted to @${p.reviewer}'s thread on PR #${p.prNumber}${p.resolved ? " (resolved)" : ""}: ${p.url}`);
|
|
92
|
+
for (const f of r.failed) console.error(chalk.red(`${f.threadId}: ${f.error}`));
|
|
93
|
+
if (r.failed.length || unknown.length) process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
).command(
|
|
96
|
+
"replies",
|
|
97
|
+
"List the review threads handed to this session and their drafts",
|
|
98
|
+
(b) => b.option("json", { type: "boolean", default: false }),
|
|
99
|
+
(argv) => {
|
|
100
|
+
const list = listReplies(sessionIdFor(sessionHere()));
|
|
101
|
+
if (argv.json) {
|
|
102
|
+
process.stdout.write(JSON.stringify(list, null, 2) + "\n");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (list.length === 0) console.log(chalk.gray("No review threads handed to this session."));
|
|
106
|
+
for (const r of list) {
|
|
107
|
+
console.log(`${r.threadId} PR #${r.prNumber} ${r.where ?? ""} @${r.reviewer} ${chalk.gray(r.status)}`);
|
|
108
|
+
if (r.draft) console.log(chalk.gray(` ${r.draft.replace(/\s+/g, " ").slice(0, 160)}`));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
).demandCommand(1),
|
|
112
|
+
handler: () => {
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
export {
|
|
116
|
+
prCommand
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=pr-YU3NOW6G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/pr.ts"],"sourcesContent":["import fs from 'node:fs';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { findSessionForCwd } from '../core/comments/pending-delivery.js';\nimport { sessionIdFor } from '../core/sessions/session-id.js';\nimport { listReplies, postDrafts, saveDraft } from '../core/pr/pr-replies.js';\nimport { defaultRunner } from '../core/pr/ship.js';\nimport { readWebUrl } from '../core/platform/web-discovery.js';\n\n/** Tell a running work web a draft changed, so the session header shows it. Best effort. */\nasync function nudgeWeb(sessionId: string): Promise<void> {\n const base = readWebUrl();\n if (!base) return;\n await fetch(`${base}api/replies-changed`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ sessionId }),\n signal: AbortSignal.timeout(3000),\n }).catch(() => {});\n}\n\nfunction sessionHere() {\n const s = findSessionForCwd(process.cwd());\n if (!s) {\n console.error(chalk.red('Not inside a work session (run this from the worktree).'));\n process.exit(1);\n }\n return s;\n}\n\n/**\n * `work pr reply <thread> \"<text>\"` — for the session's Claude: draft the\n * answer to a review thread it was handed (the PR feedback note names each\n * thread). The dashboard shows the draft to you, editable.\n * `work pr post <thread…> [--all] [--resolve]` — posts the drafts as they\n * stand, which Claude runs only after you said yes to them.\n * `work pr replies [--json]` lists the threads and drafts.\n */\nexport const prCommand: CommandModule = {\n command: 'pr <action>',\n describe: 'Review threads handed to this session: draft replies, and post them once the user says yes',\n builder: (y) =>\n y\n .command(\n 'reply <thread> [text..]',\n \"Draft the reply to a review thread (shown in the dashboard; posted only on the user's yes)\",\n (b) =>\n b\n .positional('thread', { type: 'string', demandOption: true, describe: 'The thread id from the feedback note (PRRT_…)' })\n .positional('text', { type: 'string', array: true, describe: 'The reply' })\n .option('body-file', { type: 'string', describe: 'Read the reply from this file instead' }),\n async (argv) => {\n const s = sessionHere();\n const text = argv['body-file']\n ? fs.readFileSync(String(argv['body-file']), 'utf8')\n : ((argv.text as string[] | undefined) ?? []).join(' ');\n const id = sessionIdFor(s);\n const r = saveDraft(id, String(argv.thread), text);\n if (!r.ok) {\n console.error(chalk.red(r.error));\n process.exit(1);\n }\n await nudgeWeb(id);\n console.log(\n `Draft saved for ${r.reply.reviewer}'s thread on PR #${r.reply.prNumber}. Show it to the user; post it (work pr post ${r.reply.threadId}) only once they say yes.`,\n );\n },\n )\n .command(\n 'post [threads..]',\n 'Post drafted replies from your GitHub account — for Claude, only once the user has said yes to them',\n (b) =>\n b\n .positional('threads', { type: 'string', array: true, describe: 'Thread ids (PRRT_…) whose drafts to post' })\n .option('all', { type: 'boolean', default: false, describe: 'Every draft of this session' })\n .option('resolve', { type: 'boolean', default: false, describe: 'Also resolve each thread (for comments you fixed)' }),\n async (argv) => {\n const s = sessionHere();\n const id = sessionIdFor(s);\n const asked = (argv.threads as string[] | undefined) ?? [];\n const drafts = listReplies(id).filter((r) => r.status === 'draft' && (argv.all || asked.includes(r.threadId)));\n const unknown = argv.all ? [] : asked.filter((t) => !drafts.some((r) => r.threadId === t));\n for (const t of unknown)\n console.error(chalk.red(`${t}: no draft to post for this session (draft it with \\`work pr reply\\` first)`));\n if (drafts.length === 0) {\n if (!unknown.length) console.error(chalk.red('Nothing to post: name the threads, or --all.'));\n process.exit(1);\n }\n const r = await postDrafts(s, drafts, argv.resolve === true, defaultRunner);\n await nudgeWeb(id);\n for (const p of r.posted)\n console.log(`Posted to @${p.reviewer}'s thread on PR #${p.prNumber}${p.resolved ? ' (resolved)' : ''}: ${p.url}`);\n for (const f of r.failed) console.error(chalk.red(`${f.threadId}: ${f.error}`));\n if (r.failed.length || unknown.length) process.exit(1);\n },\n )\n .command(\n 'replies',\n 'List the review threads handed to this session and their drafts',\n (b) => b.option('json', { type: 'boolean', default: false }),\n (argv) => {\n const list = listReplies(sessionIdFor(sessionHere()));\n if (argv.json) {\n process.stdout.write(JSON.stringify(list, null, 2) + '\\n');\n return;\n }\n if (list.length === 0) console.log(chalk.gray('No review threads handed to this session.'));\n for (const r of list) {\n console.log(`${r.threadId} PR #${r.prNumber} ${r.where ?? ''} @${r.reviewer} ${chalk.gray(r.status)}`);\n if (r.draft) console.log(chalk.gray(` ${r.draft.replace(/\\s+/g, ' ').slice(0, 160)}`));\n }\n },\n )\n .demandCommand(1),\n handler: () => {},\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,WAAW;AASlB,eAAe,SAAS,WAAkC;AACxD,QAAM,OAAO,WAAW;AACxB,MAAI,CAAC,KAAM;AACX,QAAM,MAAM,GAAG,IAAI,uBAAuB;AAAA,IACxC,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,m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EACF,EACC;AAAA,IACC;AAAA,IACA;AAAA,IACA,CAAC,MAAM,EAAE,OAAO,QAAQ,EAAE,MAAM,WAAW,SAAS,MAAM,CAAC;AAAA,IAC3D,CAAC,SAAS;AACR,YAAM,OAAO,YAAY,aAAa,YAAY,CAAC,CAAC;AACpD,UAAI,KAAK,MAAM;AACb,gBAAQ,OAAO,MAAM,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,IAAI;AACzD;AAAA,MACF;AACA,UAAI,KAAK,WAAW,EAAG,SAAQ,IAAI,MAAM,KAAK,2CAA2C,CAAC;AAC1F,iBAAW,KAAK,MAAM;AACpB,gBAAQ,IAAI,GAAG,EAAE,QAAQ,SAAS,EAAE,QAAQ,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,KAAK,MAAM,KAAK,EAAE,MAAM,CAAC,EAAE;AACxG,YAAI,EAAE,MAAO,SAAQ,IAAI,MAAM,KAAK,KAAK,EAAE,MAAM,QAAQ,QAAQ,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,EAAE,CAAC;AAAA,MACxF;AAAA,IACF;AAAA,EACF,EACC,cAAc,CAAC;AAAA,EACpB,SAAS,MAAM;AAAA,EAAC;AAClB;","names":["r"]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
printCleanupResults,
|
|
4
|
+
removable
|
|
5
|
+
} from "./chunk-ABQYKTG4.js";
|
|
6
|
+
import {
|
|
7
|
+
defaultCleanupDeps
|
|
8
|
+
} from "./chunk-YLG6DO5Y.js";
|
|
9
|
+
import "./chunk-CXEC5W5V.js";
|
|
10
|
+
import "./chunk-PZ4RG6EW.js";
|
|
11
|
+
import {
|
|
12
|
+
applyCleanup,
|
|
13
|
+
scanCleanup
|
|
14
|
+
} from "./chunk-AKMPF72Y.js";
|
|
15
|
+
import "./chunk-CLGVSX36.js";
|
|
16
|
+
import "./chunk-O3QTWVSK.js";
|
|
17
|
+
import "./chunk-ZJN5RWZD.js";
|
|
18
|
+
import "./chunk-QBAZG4CY.js";
|
|
19
|
+
import "./chunk-6H3MLDGG.js";
|
|
20
|
+
import "./chunk-FR3EWVXI.js";
|
|
21
|
+
import "./chunk-7OLPI334.js";
|
|
22
|
+
import "./chunk-H5LKMR45.js";
|
|
23
|
+
import "./chunk-SOCPIHCS.js";
|
|
24
|
+
import "./chunk-WF5SBVPZ.js";
|
|
25
|
+
import "./chunk-ZSHWP2VS.js";
|
|
26
|
+
import "./chunk-5QK7GB5K.js";
|
|
27
|
+
import "./chunk-HUXS3VAI.js";
|
|
28
|
+
import "./chunk-7NAXFBFI.js";
|
|
29
|
+
import "./chunk-NDWSLQPB.js";
|
|
30
|
+
import "./chunk-ZXPYWZL5.js";
|
|
31
|
+
import "./chunk-M4FVCAT6.js";
|
|
32
|
+
import "./chunk-7NCW3LUT.js";
|
|
33
|
+
import "./chunk-PN44M5EE.js";
|
|
34
|
+
import "./chunk-RCYI7SRA.js";
|
|
35
|
+
import "./chunk-DW4JPVXB.js";
|
|
36
|
+
import "./chunk-N4EYQKSM.js";
|
|
37
|
+
import {
|
|
38
|
+
ensureConfig
|
|
39
|
+
} from "./chunk-7HEB6SQS.js";
|
|
40
|
+
|
|
41
|
+
// src/commands/prune.ts
|
|
42
|
+
import chalk from "chalk";
|
|
43
|
+
import { checkbox } from "@inquirer/prompts";
|
|
44
|
+
var pruneCommand = {
|
|
45
|
+
command: "prune",
|
|
46
|
+
describe: "Remove worktrees that are merged (or never committed to), picking from a list",
|
|
47
|
+
builder: (yargs) => yargs.option("force", {
|
|
48
|
+
describe: "Skip the picker and remove every one that is safe to remove",
|
|
49
|
+
type: "boolean",
|
|
50
|
+
default: false
|
|
51
|
+
}),
|
|
52
|
+
handler: async (argv) => {
|
|
53
|
+
const force = argv.force;
|
|
54
|
+
ensureConfig();
|
|
55
|
+
const deps = defaultCleanupDeps();
|
|
56
|
+
console.log(chalk.gray("Fetching and checking worktrees\u2026\n"));
|
|
57
|
+
const scan = await scanCleanup(deps);
|
|
58
|
+
for (const f of scan.fetchFailed) console.log(chalk.yellow(` Could not fetch ${f.alias}; its worktrees were not checked: ${f.error}`));
|
|
59
|
+
const candidates = removable(scan.candidates, { includeSquash: true });
|
|
60
|
+
if (candidates.length === 0) {
|
|
61
|
+
console.log(chalk.green("Nothing to prune: no worktree is merged, clean and unused for a day."));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const label = (c) => `${c.target}: ${c.branch}${c.isGroup ? " [group]" : ""} \u2014 ${c.reason}`;
|
|
65
|
+
let selected;
|
|
66
|
+
if (force) {
|
|
67
|
+
selected = candidates;
|
|
68
|
+
console.log(chalk.cyan(`Removing ${selected.length} worktree(s):`));
|
|
69
|
+
for (const c of selected) console.log(` ${label(c)}`);
|
|
70
|
+
} else {
|
|
71
|
+
selected = await checkbox({
|
|
72
|
+
message: "Select worktrees to remove (the branches are kept)",
|
|
73
|
+
choices: candidates.map((c) => ({ name: label(c), value: c, checked: true })),
|
|
74
|
+
pageSize: Math.min(candidates.length, 25)
|
|
75
|
+
});
|
|
76
|
+
if (selected.length === 0) {
|
|
77
|
+
console.log(chalk.yellow("Nothing selected."));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
console.log("");
|
|
82
|
+
const results = await applyCleanup(
|
|
83
|
+
deps,
|
|
84
|
+
selected.map((c) => ({ sessionId: c.sessionId, action: c.verdict === "gone" ? "forget" : "delete" }))
|
|
85
|
+
);
|
|
86
|
+
printCleanupResults(selected, results);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
export {
|
|
90
|
+
pruneCommand
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=prune-26FYYFTO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/prune.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { checkbox } from '@inquirer/prompts';\nimport type { CommandModule } from 'yargs';\nimport { ensureConfig } from '../core/platform/config.js';\nimport { applyCleanup, scanCleanup } from '../core/cleanup/cleanup.js';\nimport { defaultCleanupDeps } from '../core/cleanup/cleanup-deps.js';\nimport type { CleanupCandidate } from '../core/api-types.js';\nimport { printCleanupResults, removable } from './shared/cleanup-print.js';\n\nexport const pruneCommand: CommandModule = {\n command: 'prune',\n describe: 'Remove worktrees that are merged (or never committed to), picking from a list',\n builder: (yargs) =>\n yargs.option('force', {\n describe: 'Skip the picker and remove every one that is safe to remove',\n type: 'boolean',\n default: false,\n }),\n handler: async (argv) => {\n const force = argv.force as boolean;\n ensureConfig();\n const deps = defaultCleanupDeps();\n console.log(chalk.gray('Fetching and checking worktrees…\\n'));\n const scan = await scanCleanup(deps);\n for (const f of scan.fetchFailed) console.log(chalk.yellow(` Could not fetch ${f.alias}; its worktrees were not checked: ${f.error}`));\n // Interactive prune is human-confirmed (you see the list and pick), so\n // squash-merged branches are offered too.\n const candidates = removable(scan.candidates, { includeSquash: true });\n if (candidates.length === 0) {\n console.log(chalk.green('Nothing to prune: no worktree is merged, clean and unused for a day.'));\n return;\n }\n const label = (c: CleanupCandidate) => `${c.target}: ${c.branch}${c.isGroup ? ' [group]' : ''} — ${c.reason}`;\n let selected: CleanupCandidate[];\n if (force) {\n selected = candidates;\n console.log(chalk.cyan(`Removing ${selected.length} worktree(s):`));\n for (const c of selected) console.log(` ${label(c)}`);\n } else {\n selected = await checkbox({\n message: 'Select worktrees to remove (the branches are kept)',\n choices: candidates.map((c) => ({ name: label(c), value: c, checked: true })),\n pageSize: Math.min(candidates.length, 25),\n });\n if (selected.length === 0) {\n console.log(chalk.yellow('Nothing selected.'));\n return;\n }\n }\n console.log('');\n const results = await applyCleanup(\n deps,\n selected.map((c) => ({ sessionId: c.sessionId, action: c.verdict === 'gone' ? 'forget' : 'delete' })),\n );\n printCleanupResults(selected, results);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AACl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