@moberg_hr/work-tree 1.16.0 β†’ 2.0.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.
Files changed (249) hide show
  1. package/README.md +56 -142
  2. package/dist/answer-2J4XLIP7.js +63 -0
  3. package/dist/answer-2J4XLIP7.js.map +1 -0
  4. package/dist/attach-CZKRNPAJ.js +59 -0
  5. package/dist/attach-CZKRNPAJ.js.map +1 -0
  6. package/dist/bin.js +26 -11924
  7. package/dist/bin.js.map +1 -1
  8. package/dist/block-RAIDCJ4F.js +84 -0
  9. package/dist/block-RAIDCJ4F.js.map +1 -0
  10. package/dist/broadcast-BSI5NDDB.js +104 -0
  11. package/dist/broadcast-BSI5NDDB.js.map +1 -0
  12. package/dist/catchup-VVOPL2S5.js +51 -0
  13. package/dist/catchup-VVOPL2S5.js.map +1 -0
  14. package/dist/chunk-3JWTO5VZ.js +135 -0
  15. package/dist/chunk-3JWTO5VZ.js.map +1 -0
  16. package/dist/chunk-4BOK2GXL.js +210 -0
  17. package/dist/chunk-4BOK2GXL.js.map +1 -0
  18. package/dist/chunk-5QK7GB5K.js +112 -0
  19. package/dist/chunk-5QK7GB5K.js.map +1 -0
  20. package/dist/chunk-6AQRYLOB.js +16 -0
  21. package/dist/chunk-6AQRYLOB.js.map +1 -0
  22. package/dist/chunk-6FTIY5M6.js +120 -0
  23. package/dist/chunk-6FTIY5M6.js.map +1 -0
  24. package/dist/chunk-6H3MLDGG.js +48 -0
  25. package/dist/chunk-6H3MLDGG.js.map +1 -0
  26. package/dist/chunk-77XFJQGC.js +103 -0
  27. package/dist/chunk-77XFJQGC.js.map +1 -0
  28. package/dist/chunk-7HEB6SQS.js +257 -0
  29. package/dist/chunk-7HEB6SQS.js.map +1 -0
  30. package/dist/chunk-7NAXFBFI.js +206 -0
  31. package/dist/chunk-7NAXFBFI.js.map +1 -0
  32. package/dist/chunk-7NCW3LUT.js +358 -0
  33. package/dist/chunk-7NCW3LUT.js.map +1 -0
  34. package/dist/chunk-7OLPI334.js +537 -0
  35. package/dist/chunk-7OLPI334.js.map +1 -0
  36. package/dist/chunk-ABQYKTG4.js +38 -0
  37. package/dist/chunk-ABQYKTG4.js.map +1 -0
  38. package/dist/chunk-AH5TM3NB.js +21 -0
  39. package/dist/chunk-AH5TM3NB.js.map +1 -0
  40. package/dist/chunk-AKMPF72Y.js +274 -0
  41. package/dist/chunk-AKMPF72Y.js.map +1 -0
  42. package/dist/chunk-BR6OPEE4.js +162 -0
  43. package/dist/chunk-BR6OPEE4.js.map +1 -0
  44. package/dist/chunk-C2BK6EBN.js +162 -0
  45. package/dist/chunk-C2BK6EBN.js.map +1 -0
  46. package/dist/chunk-C2THFSXA.js +37 -0
  47. package/dist/chunk-C2THFSXA.js.map +1 -0
  48. package/dist/chunk-C7W5TMFB.js +308 -0
  49. package/dist/chunk-C7W5TMFB.js.map +1 -0
  50. package/dist/chunk-CLGVSX36.js +668 -0
  51. package/dist/chunk-CLGVSX36.js.map +1 -0
  52. package/dist/chunk-CVAVYDXO.js +295 -0
  53. package/dist/chunk-CVAVYDXO.js.map +1 -0
  54. package/dist/chunk-DW4JPVXB.js +41 -0
  55. package/dist/chunk-DW4JPVXB.js.map +1 -0
  56. package/dist/chunk-FPKERDK7.js +142 -0
  57. package/dist/chunk-FPKERDK7.js.map +1 -0
  58. package/dist/chunk-FR3EWVXI.js +188 -0
  59. package/dist/chunk-FR3EWVXI.js.map +1 -0
  60. package/dist/chunk-H5LKMR45.js +117 -0
  61. package/dist/chunk-H5LKMR45.js.map +1 -0
  62. package/dist/chunk-HIZBWYPL.js +267 -0
  63. package/dist/chunk-HIZBWYPL.js.map +1 -0
  64. package/dist/chunk-HSICXDMZ.js +41 -0
  65. package/dist/chunk-HSICXDMZ.js.map +1 -0
  66. package/dist/chunk-HUXS3VAI.js +90 -0
  67. package/dist/chunk-HUXS3VAI.js.map +1 -0
  68. package/dist/chunk-HWUINPIL.js +151 -0
  69. package/dist/chunk-HWUINPIL.js.map +1 -0
  70. package/dist/chunk-IXKVCR4Y.js +487 -0
  71. package/dist/chunk-IXKVCR4Y.js.map +1 -0
  72. package/dist/chunk-JNBYNRFS.js +54 -0
  73. package/dist/chunk-JNBYNRFS.js.map +1 -0
  74. package/dist/chunk-JYTMT5DF.js +421 -0
  75. package/dist/chunk-JYTMT5DF.js.map +1 -0
  76. package/dist/chunk-KGZ6OZ2T.js +102 -0
  77. package/dist/chunk-KGZ6OZ2T.js.map +1 -0
  78. package/dist/chunk-LMIEEDDC.js +9 -0
  79. package/dist/chunk-LMIEEDDC.js.map +1 -0
  80. package/dist/chunk-LNHSBM4L.js +26 -0
  81. package/dist/chunk-LNHSBM4L.js.map +1 -0
  82. package/dist/chunk-M4FVCAT6.js +2406 -0
  83. package/dist/chunk-M4FVCAT6.js.map +1 -0
  84. package/dist/chunk-N4EYQKSM.js +104 -0
  85. package/dist/chunk-N4EYQKSM.js.map +1 -0
  86. package/dist/chunk-NDWSLQPB.js +112 -0
  87. package/dist/chunk-NDWSLQPB.js.map +1 -0
  88. package/dist/chunk-O3QTWVSK.js +323 -0
  89. package/dist/chunk-O3QTWVSK.js.map +1 -0
  90. package/dist/chunk-P3BL4EOP.js +37 -0
  91. package/dist/chunk-P3BL4EOP.js.map +1 -0
  92. package/dist/chunk-PN44M5EE.js +887 -0
  93. package/dist/chunk-PN44M5EE.js.map +1 -0
  94. package/dist/chunk-Q6WZCO45.js +47 -0
  95. package/dist/chunk-Q6WZCO45.js.map +1 -0
  96. package/dist/chunk-QBAZG4CY.js +230 -0
  97. package/dist/chunk-QBAZG4CY.js.map +1 -0
  98. package/dist/chunk-R2LN3JJJ.js +132 -0
  99. package/dist/chunk-R2LN3JJJ.js.map +1 -0
  100. package/dist/chunk-RCYI7SRA.js +15 -0
  101. package/dist/chunk-RCYI7SRA.js.map +1 -0
  102. package/dist/chunk-RYNBBSLY.js +67 -0
  103. package/dist/chunk-RYNBBSLY.js.map +1 -0
  104. package/dist/chunk-S5HJT7CM.js +30 -0
  105. package/dist/chunk-S5HJT7CM.js.map +1 -0
  106. package/dist/chunk-SNAQOHNL.js +285 -0
  107. package/dist/chunk-SNAQOHNL.js.map +1 -0
  108. package/dist/chunk-SOCPIHCS.js +181 -0
  109. package/dist/chunk-SOCPIHCS.js.map +1 -0
  110. package/dist/chunk-TUC4QY4O.js +147 -0
  111. package/dist/chunk-TUC4QY4O.js.map +1 -0
  112. package/dist/chunk-TUFQJXXO.js +19 -0
  113. package/dist/chunk-TUFQJXXO.js.map +1 -0
  114. package/dist/chunk-UFY7C5PP.js +90 -0
  115. package/dist/chunk-UFY7C5PP.js.map +1 -0
  116. package/dist/chunk-UQ35KLHH.js +34 -0
  117. package/dist/chunk-UQ35KLHH.js.map +1 -0
  118. package/dist/chunk-VJ7SVDED.js +177 -0
  119. package/dist/chunk-VJ7SVDED.js.map +1 -0
  120. package/dist/chunk-VJNSIDOA.js +23 -0
  121. package/dist/chunk-VJNSIDOA.js.map +1 -0
  122. package/dist/chunk-WF5SBVPZ.js +190 -0
  123. package/dist/chunk-WF5SBVPZ.js.map +1 -0
  124. package/dist/chunk-WMJIU3YW.js +29 -0
  125. package/dist/chunk-WMJIU3YW.js.map +1 -0
  126. package/dist/chunk-XJDEROHY.js +19 -0
  127. package/dist/chunk-XJDEROHY.js.map +1 -0
  128. package/dist/chunk-YKODIG22.js +221 -0
  129. package/dist/chunk-YKODIG22.js.map +1 -0
  130. package/dist/chunk-YNKWLC45.js +122 -0
  131. package/dist/chunk-YNKWLC45.js.map +1 -0
  132. package/dist/chunk-YZDD5YGE.js +165 -0
  133. package/dist/chunk-YZDD5YGE.js.map +1 -0
  134. package/dist/chunk-YZWADOEW.js +151 -0
  135. package/dist/chunk-YZWADOEW.js.map +1 -0
  136. package/dist/chunk-ZJN5RWZD.js +76 -0
  137. package/dist/chunk-ZJN5RWZD.js.map +1 -0
  138. package/dist/chunk-ZSHWP2VS.js +22 -0
  139. package/dist/chunk-ZSHWP2VS.js.map +1 -0
  140. package/dist/chunk-ZXPYWZL5.js +307 -0
  141. package/dist/chunk-ZXPYWZL5.js.map +1 -0
  142. package/dist/cleanup-LDBGWEKZ.js +192 -0
  143. package/dist/cleanup-LDBGWEKZ.js.map +1 -0
  144. package/dist/cli-UATB4RM2.js +18 -0
  145. package/dist/cli-UATB4RM2.js.map +1 -0
  146. package/dist/command-hook-installer-SGEJTZ2Y.js +204 -0
  147. package/dist/command-hook-installer-SGEJTZ2Y.js.map +1 -0
  148. package/dist/completion-MXX5TRIV.js +118 -0
  149. package/dist/completion-MXX5TRIV.js.map +1 -0
  150. package/dist/config-IEIU7A66.js +410 -0
  151. package/dist/config-IEIU7A66.js.map +1 -0
  152. package/dist/console-reporter-XU6VFUZE.js +10 -0
  153. package/dist/console-reporter-XU6VFUZE.js.map +1 -0
  154. package/dist/diff-K47HB6SA.js +582 -0
  155. package/dist/diff-K47HB6SA.js.map +1 -0
  156. package/dist/digest-FBZTBXQO.js +100 -0
  157. package/dist/digest-FBZTBXQO.js.map +1 -0
  158. package/dist/fork-BKI5UNNS.js +120 -0
  159. package/dist/fork-BKI5UNNS.js.map +1 -0
  160. package/dist/hook-SLMZT5OV.js +220 -0
  161. package/dist/hook-SLMZT5OV.js.map +1 -0
  162. package/dist/hydrate-Y2AAMZTA.js +121 -0
  163. package/dist/hydrate-Y2AAMZTA.js.map +1 -0
  164. package/dist/init-7ESFTYZC.js +187 -0
  165. package/dist/init-7ESFTYZC.js.map +1 -0
  166. package/dist/install-skills-O34BHFHD.js +14 -0
  167. package/dist/install-skills-O34BHFHD.js.map +1 -0
  168. package/dist/install-skills-bin.js +12 -0
  169. package/dist/install-skills-bin.js.map +1 -0
  170. package/dist/list-KEF73NLQ.js +126 -0
  171. package/dist/list-KEF73NLQ.js.map +1 -0
  172. package/dist/move-FKT2P5LY.js +313 -0
  173. package/dist/move-FKT2P5LY.js.map +1 -0
  174. package/dist/note-WGM6LCP2.js +78 -0
  175. package/dist/note-WGM6LCP2.js.map +1 -0
  176. package/dist/overlaps-FRLMMIGC.js +56 -0
  177. package/dist/overlaps-FRLMMIGC.js.map +1 -0
  178. package/dist/pin-MQ5ZE37R.js +45 -0
  179. package/dist/pin-MQ5ZE37R.js.map +1 -0
  180. package/dist/pr-527S5HXB.js +122 -0
  181. package/dist/pr-527S5HXB.js.map +1 -0
  182. package/dist/prune-AIS5YEXP.js +92 -0
  183. package/dist/prune-AIS5YEXP.js.map +1 -0
  184. package/dist/pty-host-RWIS55N4.js +826 -0
  185. package/dist/pty-host-RWIS55N4.js.map +1 -0
  186. package/dist/read-AP6T3ZGN.js +57 -0
  187. package/dist/read-AP6T3ZGN.js.map +1 -0
  188. package/dist/recent-IE3LYQ65.js +111 -0
  189. package/dist/recent-IE3LYQ65.js.map +1 -0
  190. package/dist/remove-YGUTSKZP.js +108 -0
  191. package/dist/remove-YGUTSKZP.js.map +1 -0
  192. package/dist/report-KM4OZCZB.js +16 -0
  193. package/dist/report-KM4OZCZB.js.map +1 -0
  194. package/dist/resume-UUP6R2IE.js +81 -0
  195. package/dist/resume-UUP6R2IE.js.map +1 -0
  196. package/dist/run-V4755W7C.js +263 -0
  197. package/dist/run-V4755W7C.js.map +1 -0
  198. package/dist/screen-DNX4K23V.js +58 -0
  199. package/dist/screen-DNX4K23V.js.map +1 -0
  200. package/dist/search-3JZXLCR2.js +46 -0
  201. package/dist/search-3JZXLCR2.js.map +1 -0
  202. package/dist/section-TXLC5XO3.js +79 -0
  203. package/dist/section-TXLC5XO3.js.map +1 -0
  204. package/dist/send-6X46WZLC.js +87 -0
  205. package/dist/send-6X46WZLC.js.map +1 -0
  206. package/dist/sessions-T3QDTNP7.js +135 -0
  207. package/dist/sessions-T3QDTNP7.js.map +1 -0
  208. package/dist/snooze-KYSFXLPY.js +65 -0
  209. package/dist/snooze-KYSFXLPY.js.map +1 -0
  210. package/dist/start-SQSDQK4F.js +56 -0
  211. package/dist/start-SQSDQK4F.js.map +1 -0
  212. package/dist/state-4DFV6SHG.js +147 -0
  213. package/dist/state-4DFV6SHG.js.map +1 -0
  214. package/dist/status-H5OW4LYE.js +118 -0
  215. package/dist/status-H5OW4LYE.js.map +1 -0
  216. package/dist/stop-HC7XPSSP.js +45 -0
  217. package/dist/stop-HC7XPSSP.js.map +1 -0
  218. package/dist/sync-ITK5UYGM.js +96 -0
  219. package/dist/sync-ITK5UYGM.js.map +1 -0
  220. package/dist/time-GN6B4QD6.js +111 -0
  221. package/dist/time-GN6B4QD6.js.map +1 -0
  222. package/dist/todo-LWMQY6XW.js +152 -0
  223. package/dist/todo-LWMQY6XW.js.map +1 -0
  224. package/dist/tree-7BMORJ6J.js +235 -0
  225. package/dist/tree-7BMORJ6J.js.map +1 -0
  226. package/dist/update-6LQNLRA4.js +57 -0
  227. package/dist/update-6LQNLRA4.js.map +1 -0
  228. package/dist/wait-MZOZQ3CI.js +57 -0
  229. package/dist/wait-MZOZQ3CI.js.map +1 -0
  230. package/dist/wd-bin.js +21 -11912
  231. package/dist/wd-bin.js.map +1 -1
  232. package/dist/web/assets/PtyView-BrP-ENHg.css +1 -0
  233. package/dist/web/assets/PtyView-DYvawzWb.js +90 -0
  234. package/dist/web/assets/PtyView-DYvawzWb.js.map +1 -0
  235. package/dist/web/assets/index-C5lJhIwK.js +116 -0
  236. package/dist/web/assets/index-C5lJhIwK.js.map +1 -0
  237. package/dist/web/assets/index-L8mjakHP.css +1 -0
  238. package/dist/web/index.html +3 -5
  239. package/dist/web-IC3P7EHZ.js +7689 -0
  240. package/dist/web-IC3P7EHZ.js.map +1 -0
  241. package/npm-shrinkwrap.json +6947 -0
  242. package/package.json +52 -34
  243. package/plugins/work-tree/.claude-plugin/plugin.json +1 -1
  244. package/plugins/work-tree/skills/wd-review/SKILL.md +4 -4
  245. package/plugins/work-tree/skills/work-sessions/SKILL.md +62 -0
  246. package/scripts/postinstall.mjs +15 -45
  247. package/dist/web/assets/index-B9H3vCtL.js +0 -107
  248. package/dist/web/assets/index-B9H3vCtL.js.map +0 -1
  249. package/dist/web/assets/index-BseMpW5i.css +0 -1
@@ -0,0 +1,313 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createInProcess
4
+ } from "./chunk-C2BK6EBN.js";
5
+ import "./chunk-CLGVSX36.js";
6
+ import {
7
+ findHost
8
+ } from "./chunk-QBAZG4CY.js";
9
+ import "./chunk-H5LKMR45.js";
10
+ import {
11
+ readWebUrl,
12
+ webServerResponds
13
+ } from "./chunk-3JWTO5VZ.js";
14
+ import "./chunk-7NAXFBFI.js";
15
+ import {
16
+ originUrl
17
+ } from "./chunk-R2LN3JJJ.js";
18
+ import "./chunk-NDWSLQPB.js";
19
+ import {
20
+ defaultRunner
21
+ } from "./chunk-ZXPYWZL5.js";
22
+ import {
23
+ loadHistory,
24
+ saveHistory
25
+ } from "./chunk-M4FVCAT6.js";
26
+ import {
27
+ replaceDb,
28
+ sessionIdFor,
29
+ snapshotDb,
30
+ withDb
31
+ } from "./chunk-7NCW3LUT.js";
32
+ import {
33
+ agentOf
34
+ } from "./chunk-PN44M5EE.js";
35
+ import "./chunk-RCYI7SRA.js";
36
+ import "./chunk-DW4JPVXB.js";
37
+ import "./chunk-N4EYQKSM.js";
38
+ import {
39
+ atomicWriteFile,
40
+ getConfigDir,
41
+ getConfigPath,
42
+ loadConfig
43
+ } from "./chunk-7HEB6SQS.js";
44
+
45
+ // src/commands/move.ts
46
+ import path2 from "path";
47
+ import chalk from "chalk";
48
+
49
+ // src/core/move/move.ts
50
+ import fs from "fs";
51
+ import os from "os";
52
+ import path from "path";
53
+ var BUNDLE_VERSION = 1;
54
+ var MoveError = class extends Error {
55
+ };
56
+ var exists = (p) => fs.existsSync(p);
57
+ async function unsavedWork(sessions, run = defaultRunner) {
58
+ const out = [];
59
+ for (const s of sessions) {
60
+ if (s.archivedAt) continue;
61
+ for (const p of s.paths) {
62
+ if (!exists(p)) continue;
63
+ const at = { session: `${s.target} \xB7 ${s.branch || "(its checkout)"}`, repo: s.isGroup ? path.basename(p) : s.target, path: p };
64
+ const status = await run("git", ["status", "--porcelain"], p);
65
+ const dirty = status.code === 0 ? status.stdout.split("\n").filter((l) => l.trim()).length : 0;
66
+ if (dirty) out.push({ ...at, what: `${dirty} uncommitted file${dirty === 1 ? "" : "s"}` });
67
+ const branch = (await run("git", ["rev-parse", "--abbrev-ref", "HEAD"], p)).stdout.trim();
68
+ if (!branch || branch === "HEAD") continue;
69
+ const onOrigin = (await run("git", ["rev-parse", "--verify", "--quiet", `refs/remotes/origin/${branch}`], p)).code === 0;
70
+ const against = onOrigin ? `origin/${branch}` : "origin/HEAD";
71
+ const ahead = Number((await run("git", ["rev-list", "--count", `${against}..HEAD`], p)).stdout.trim()) || 0;
72
+ if (ahead)
73
+ out.push({ ...at, what: `${ahead} commit${ahead === 1 ? "" : "s"} not pushed${onOrigin ? "" : ` (${branch} isn't on origin)`}` });
74
+ }
75
+ }
76
+ return out;
77
+ }
78
+ function exportBundle(dest, now = /* @__PURE__ */ new Date()) {
79
+ if (exists(dest) && fs.readdirSync(dest).length) throw new MoveError(`${dest} isn't empty: give a new folder`);
80
+ const home = getConfigDir();
81
+ const config = loadConfig();
82
+ if (!config) throw new MoveError("nothing to move: work has no config here");
83
+ fs.mkdirSync(dest, { recursive: true });
84
+ snapshotDb(path.join(dest, "state.db"));
85
+ fs.copyFileSync(getConfigPath(), path.join(dest, "config.json"));
86
+ for (const dir of ["conversations", "archive"]) {
87
+ if (exists(path.join(home, dir))) fs.cpSync(path.join(home, dir), path.join(dest, dir), { recursive: true });
88
+ }
89
+ for (const f of fs.readdirSync(home).filter((n) => n.endsWith(".claude.md"))) {
90
+ fs.mkdirSync(path.join(dest, "instructions"), { recursive: true });
91
+ fs.copyFileSync(path.join(home, f), path.join(dest, "instructions", f));
92
+ }
93
+ const history = loadHistory();
94
+ let transcripts = 0;
95
+ const sessions = [];
96
+ for (const s of history) {
97
+ const id = sessionIdFor(s);
98
+ const files = s.archivedAt ? [] : agentOf(s).conversation?.files(s) ?? [];
99
+ for (const f of files) {
100
+ fs.mkdirSync(path.join(dest, "transcripts", id), { recursive: true });
101
+ fs.copyFileSync(f.file, path.join(dest, "transcripts", id, path.basename(f.file)));
102
+ }
103
+ transcripts += files.length;
104
+ sessions.push({ id, target: s.target, branch: s.branch, archived: !!s.archivedAt, transcripts: files.length });
105
+ }
106
+ const repos = {};
107
+ for (const [alias, p] of Object.entries(config.repos)) {
108
+ let origin = null;
109
+ try {
110
+ origin = originUrl(fs.readFileSync(path.join(p, ".git", "config"), "utf-8"));
111
+ } catch {
112
+ }
113
+ repos[alias] = { path: p, origin };
114
+ }
115
+ const manifest = {
116
+ version: BUNDLE_VERSION,
117
+ exportedAt: now.toISOString(),
118
+ from: { home: os.homedir(), platform: process.platform, worktreesRoot: config.worktreesRoot },
119
+ repos,
120
+ sessions
121
+ };
122
+ fs.writeFileSync(path.join(dest, "manifest.json"), JSON.stringify(manifest, null, 2));
123
+ return { dir: dest, sessions: history.length, transcripts };
124
+ }
125
+ var norm = (p, caseless) => {
126
+ const n = p.replace(/\\/g, "/").replace(/\/+$/, "");
127
+ return caseless ? n.toLowerCase() : n;
128
+ };
129
+ function remapRules(m, opts, newHome, join = path.join) {
130
+ const caseless = m.from.platform === "win32";
131
+ const homeSwap = (p) => remapPath(p, [{ from: m.from.home, to: newHome }], caseless, join);
132
+ const base = (p) => p.replace(/[\\/]+$/, "").split(/[\\/]/).pop() ?? p;
133
+ const rules = [
134
+ { from: m.from.worktreesRoot, to: opts.worktreesRoot ?? homeSwap(m.from.worktreesRoot) },
135
+ ...Object.values(m.repos).map((r) => ({ from: r.path, to: opts.reposRoot ? join(opts.reposRoot, base(r.path)) : homeSwap(r.path) })),
136
+ { from: m.from.home, to: newHome }
137
+ ];
138
+ return rules.sort((a, b) => b.from.length - a.from.length);
139
+ }
140
+ function remapPath(p, rules, caseless, join = path.join) {
141
+ const key = norm(p, caseless);
142
+ for (const r of rules) {
143
+ const from = norm(r.from, caseless);
144
+ if (key !== from && !key.startsWith(`${from}/`)) continue;
145
+ const rest = p.replace(/\\/g, "/").slice(from.length).split("/").filter(Boolean);
146
+ return rest.length ? join(r.to, ...rest) : r.to;
147
+ }
148
+ return p;
149
+ }
150
+ function remapSession(s, move) {
151
+ const out = { ...s, paths: s.paths.map(move) };
152
+ if (s.baseBranches) out.baseBranches = Object.fromEntries(Object.entries(s.baseBranches).map(([p, b]) => [move(p), b]));
153
+ return out;
154
+ }
155
+ async function runningHere() {
156
+ const out = [];
157
+ const url = readWebUrl();
158
+ if (url && await webServerResponds(url)) out.push("work web (`work web --stop`)");
159
+ try {
160
+ if (await findHost()) out.push("the PTY host (`work pty-host --stop`)");
161
+ } catch {
162
+ out.push("the PTY host (`work pty-host --stop`)");
163
+ }
164
+ return out;
165
+ }
166
+ function readManifest(dir) {
167
+ let raw;
168
+ try {
169
+ raw = JSON.parse(fs.readFileSync(path.join(dir, "manifest.json"), "utf-8"));
170
+ } catch {
171
+ throw new MoveError(`${dir} isn't a work bundle (no manifest.json): make one with \`work move export\``);
172
+ }
173
+ const m = raw;
174
+ if (!m || typeof m !== "object" || typeof m.from?.home !== "string" || typeof m.repos !== "object")
175
+ throw new MoveError(`${dir}/manifest.json isn't one work can read`);
176
+ if (m.version > BUNDLE_VERSION) throw new MoveError(`this bundle is from a newer work (v${m.version}): update work first`);
177
+ if (!exists(path.join(dir, "state.db")) || !exists(path.join(dir, "config.json")))
178
+ throw new MoveError(`${dir} is missing state.db or config.json`);
179
+ return m;
180
+ }
181
+ var defaultImportDeps = () => ({
182
+ run: defaultRunner,
183
+ create: createInProcess,
184
+ restoreDir: (s) => agentOf(s).conversation?.restoreDir?.(s) ?? null
185
+ });
186
+ async function importBundle(dir, opts = {}, deps = defaultImportDeps()) {
187
+ const m = readManifest(dir);
188
+ if (!opts.force && exists(getConfigPath()) && loadHistory().length)
189
+ throw new MoveError("work here has sessions already; importing replaces them (--force to do it anyway)");
190
+ const caseless = m.from.platform === "win32";
191
+ const rules = remapRules(m, opts, os.homedir());
192
+ const move = (p) => remapPath(p, rules, caseless);
193
+ const raw = JSON.parse(fs.readFileSync(path.join(dir, "config.json"), "utf-8"));
194
+ if (typeof raw.worktreesRoot === "string") raw.worktreesRoot = move(raw.worktreesRoot);
195
+ if (raw.repos && typeof raw.repos === "object")
196
+ raw.repos = Object.fromEntries(
197
+ Object.entries(raw.repos).map(([a, p]) => [a, typeof p === "string" ? move(p) : p])
198
+ );
199
+ for (const key of ["scanRoots", "ignoredRepos"])
200
+ if (Array.isArray(raw[key])) raw[key] = raw[key].map((p) => typeof p === "string" ? move(p) : p);
201
+ fs.mkdirSync(getConfigDir(), { recursive: true });
202
+ atomicWriteFile(getConfigPath(), JSON.stringify(raw, null, 2));
203
+ replaceDb(path.join(dir, "state.db"));
204
+ const history = loadHistory().map((s) => remapSession(s, move));
205
+ saveHistory(history);
206
+ withDb((d) => d.prepare("DELETE FROM pty_sessions").run());
207
+ for (const sub of ["conversations", "archive"])
208
+ if (exists(path.join(dir, sub))) fs.cpSync(path.join(dir, sub), path.join(getConfigDir(), sub), { recursive: true, force: false });
209
+ if (exists(path.join(dir, "instructions")))
210
+ for (const f of fs.readdirSync(path.join(dir, "instructions")))
211
+ fs.copyFileSync(path.join(dir, "instructions", f), path.join(getConfigDir(), f));
212
+ const report = {
213
+ sessions: history.length,
214
+ repos: { cloned: [], missing: [] },
215
+ worktrees: { created: [], failed: [] },
216
+ transcripts: 0
217
+ };
218
+ const config = loadConfig();
219
+ for (const [alias, p] of Object.entries(config.repos)) {
220
+ if (exists(p)) continue;
221
+ const origin = m.repos[alias]?.origin;
222
+ if (opts.clone && origin) {
223
+ fs.mkdirSync(path.dirname(p), { recursive: true });
224
+ const r = await deps.run("git", ["clone", origin, p], path.dirname(p));
225
+ if (r.code === 0) {
226
+ report.repos.cloned.push(alias);
227
+ continue;
228
+ }
229
+ }
230
+ report.repos.missing.push(alias);
231
+ }
232
+ const missing = new Set(report.repos.missing);
233
+ for (const s of history) {
234
+ if (s.archivedAt || !s.branch || s.paths.every(exists)) continue;
235
+ const label = `${s.target} \xB7 ${s.branch}`;
236
+ const repos = s.isGroup ? config.groups[s.target] ?? [] : [s.target];
237
+ if (repos.some((r2) => missing.has(r2))) {
238
+ report.worktrees.failed.push({ session: label, error: `its repo isn't here (${repos.filter((r2) => missing.has(r2)).join(", ")})` });
239
+ continue;
240
+ }
241
+ if (!s.isGroup && config.repos[s.target] && s.paths[0] === config.repos[s.target]) continue;
242
+ const r = await deps.create({ target: s.target, branch: s.branch }, config);
243
+ if (r.ok) report.worktrees.created.push(label);
244
+ else report.worktrees.failed.push({ session: label, error: r.error });
245
+ }
246
+ for (const s of loadHistory()) {
247
+ const from = path.join(dir, "transcripts", sessionIdFor(s));
248
+ const to = exists(from) ? deps.restoreDir(s) : null;
249
+ if (!to) continue;
250
+ fs.mkdirSync(to, { recursive: true });
251
+ for (const f of fs.readdirSync(from)) {
252
+ if (exists(path.join(to, f))) continue;
253
+ fs.copyFileSync(path.join(from, f), path.join(to, f));
254
+ report.transcripts++;
255
+ }
256
+ }
257
+ return report;
258
+ }
259
+
260
+ // src/commands/move.ts
261
+ var moveCommand = {
262
+ command: "move <action> <dir>",
263
+ describe: "Move work to another computer: export a bundle here, import it there",
264
+ builder: (y) => y.positional("action", { choices: ["export", "import"], describe: "export a bundle here, or import one" }).positional("dir", { type: "string", describe: "The bundle folder (new for export)" }).option("force", { type: "boolean", describe: "export: even with work not pushed; import: replace the sessions here" }).option("repos-root", { type: "string", describe: "import: where the repos are on this computer (each in its folder name)" }).option("worktrees-root", { type: "string", describe: "import: where worktrees go on this computer" }).option("clone", { type: "boolean", describe: "import: clone repos that aren't here from their origin" }),
265
+ handler: async (argv) => {
266
+ const dir = path2.resolve(argv.dir);
267
+ try {
268
+ if (argv.action === "export") {
269
+ const unsaved = await unsavedWork(loadHistory());
270
+ if (unsaved.length) {
271
+ console.log(chalk.yellow("Work that's only on this computer (the other one gets worktrees from origin):"));
272
+ for (const u of unsaved) console.log(` ${u.session}: ${u.what} ${chalk.gray(u.path)}`);
273
+ if (!argv.force) {
274
+ console.log(chalk.gray("Commit and push it (or ask its Claude), then export again \u2014 or --force to leave it behind."));
275
+ process.exitCode = 1;
276
+ return;
277
+ }
278
+ }
279
+ const r2 = exportBundle(dir);
280
+ console.log(chalk.green(`Exported ${r2.sessions} session(s) and ${r2.transcripts} conversation file(s) to ${r2.dir}`));
281
+ console.log(chalk.gray("Copy the folder to the other computer and run `work move import <folder>` there (with work web stopped)."));
282
+ return;
283
+ }
284
+ const running = await runningHere();
285
+ if (running.length) {
286
+ console.error(chalk.red(`Stop ${running.join(" and ")} first: an import replaces the database they hold.`));
287
+ process.exitCode = 1;
288
+ return;
289
+ }
290
+ const r = await importBundle(dir, {
291
+ force: argv.force === true,
292
+ clone: argv.clone === true,
293
+ reposRoot: typeof argv["repos-root"] === "string" ? path2.resolve(argv["repos-root"]) : void 0,
294
+ worktreesRoot: typeof argv["worktrees-root"] === "string" ? path2.resolve(argv["worktrees-root"]) : void 0
295
+ });
296
+ console.log(chalk.green(`Imported ${r.sessions} session(s); ${r.transcripts} conversation file(s) put back for Claude.`));
297
+ if (r.repos.cloned.length) console.log(`Cloned: ${r.repos.cloned.join(", ")}`);
298
+ if (r.repos.missing.length)
299
+ console.log(chalk.yellow(`Not on this computer: ${r.repos.missing.join(", ")} \u2014 clone them (or run again with --clone).`));
300
+ if (r.worktrees.created.length) console.log(`Worktrees recreated: ${r.worktrees.created.join(", ")}`);
301
+ for (const f of r.worktrees.failed) console.log(chalk.yellow(` ${f.session}: ${f.error}`));
302
+ console.log(chalk.gray("Start `work web`: sessions resume their conversations when you open them."));
303
+ } catch (err) {
304
+ if (!(err instanceof MoveError)) throw err;
305
+ console.error(chalk.red(err.message));
306
+ process.exitCode = 1;
307
+ }
308
+ }
309
+ };
310
+ export {
311
+ moveCommand
312
+ };
313
+ //# sourceMappingURL=move-FKT2P5LY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/move.ts","../src/core/move/move.ts"],"sourcesContent":["import path from 'node:path';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { exportBundle, importBundle, MoveError, runningHere, unsavedWork } from '../core/move/move.js';\nimport { loadHistory } from '../core/sessions/history.js';\n\n/**\n * `work move export <dir>` / `work move import <dir>` β€” take your sessions,\n * conversations and setup to another computer (core/move/move.ts).\n */\nexport const moveCommand: CommandModule = {\n command: 'move <action> <dir>',\n describe: 'Move work to another computer: export a bundle here, import it there',\n builder: (y) =>\n y\n .positional('action', { choices: ['export', 'import'] as const, describe: 'export a bundle here, or import one' })\n .positional('dir', { type: 'string', describe: 'The bundle folder (new for export)' })\n .option('force', { type: 'boolean', describe: 'export: even with work not pushed; import: replace the sessions here' })\n .option('repos-root', { type: 'string', describe: 'import: where the repos are on this computer (each in its folder name)' })\n .option('worktrees-root', { type: 'string', describe: 'import: where worktrees go on this computer' })\n .option('clone', { type: 'boolean', describe: \"import: clone repos that aren't here from their origin\" }),\n handler: async (argv) => {\n const dir = path.resolve(argv.dir as string);\n try {\n if (argv.action === 'export') {\n const unsaved = await unsavedWork(loadHistory());\n if (unsaved.length) {\n console.log(chalk.yellow(\"Work that's only on this computer (the other one gets worktrees from origin):\"));\n for (const u of unsaved) console.log(` ${u.session}: ${u.what} ${chalk.gray(u.path)}`);\n if (!argv.force) {\n console.log(chalk.gray('Commit and push it (or ask its Claude), then export again β€” or --force to leave it behind.'));\n process.exitCode = 1;\n return;\n }\n }\n const r = exportBundle(dir);\n console.log(chalk.green(`Exported ${r.sessions} session(s) and ${r.transcripts} conversation file(s) to ${r.dir}`));\n console.log(chalk.gray('Copy the folder to the other computer and run `work move import <folder>` there (with work web stopped).'));\n return;\n }\n const running = await runningHere();\n if (running.length) {\n console.error(chalk.red(`Stop ${running.join(' and ')} first: an import replaces the database they hold.`));\n process.exitCode = 1;\n return;\n }\n const r = await importBundle(dir, {\n force: argv.force === true,\n clone: argv.clone === true,\n reposRoot: typeof argv['repos-root'] === 'string' ? path.resolve(argv['repos-root']) : undefined,\n worktreesRoot: typeof argv['worktrees-root'] === 'string' ? path.resolve(argv['worktrees-root']) : undefined,\n });\n console.log(chalk.green(`Imported ${r.sessions} session(s); ${r.transcripts} conversation file(s) put back for Claude.`));\n if (r.repos.cloned.length) console.log(`Cloned: ${r.repos.cloned.join(', ')}`);\n if (r.repos.missing.length)\n console.log(chalk.yellow(`Not on this computer: ${r.repos.missing.join(', ')} β€” clone them (or run again with --clone).`));\n if (r.worktrees.created.length) console.log(`Worktrees recreated: ${r.worktrees.created.join(', ')}`);\n for (const f of r.worktrees.failed) console.log(chalk.yellow(` ${f.session}: ${f.error}`));\n console.log(chalk.gray('Start `work web`: sessions resume their conversations when you open them.'));\n } catch (err) {\n if (!(err instanceof MoveError)) throw err;\n console.error(chalk.red(err.message));\n process.exitCode = 1;\n }\n },\n};\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { getConfigDir, getConfigPath, loadConfig } from '../platform/config.js';\nimport { replaceDb, snapshotDb, withDb } from '../platform/db.js';\nimport { atomicWriteFile } from '../platform/fs-safe.js';\nimport { loadHistory, saveHistory, type WorktreeSession } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { agentOf } from '../agents/index.js';\nimport { originUrl } from '../worktree/repo-scan.js';\nimport { defaultRunner, type CommandRunner } from '../pr/ship.js';\nimport { createInProcess, type CreateWorktree } from '../worktree/setup-child.js';\nimport { readWebUrl, webServerResponds } from '../platform/web-discovery.js';\nimport { findHost } from '../pty/pty-host-client.js';\n\n/**\n * Moving work to another computer (`work move export` / `import`). A bundle\n * is a folder you carry over (OneDrive, a USB stick): a snapshot of\n * state.db, config.json, work's own conversation copies and archives, the\n * groups' instruction files, every live session's agent transcripts, and a\n * manifest with each repo's origin. Never `~/.work` itself live in a synced\n * folder: syncing a database corrupts it, and two computers would both run\n * the PR and Jira watches.\n *\n * Import writes it all back with paths moved to the new computer (another\n * home folder, or other repo / worktree roots), clones repos that aren't\n * there (`--clone`), recreates live sessions' worktrees from their branches\n * on origin β€” so export first checks nothing is uncommitted or unpushed β€”\n * and puts the transcripts back where the agent looks, so conversations\n * resume. Checkpoint refs and wd's own review scopes stay behind (they live\n * in the old repos, keyed by old paths).\n */\n\nexport const BUNDLE_VERSION = 1;\n\nexport interface MoveManifest {\n version: number;\n exportedAt: string;\n from: { home: string; platform: string; worktreesRoot: string };\n /** Each repo's folder and origin URL, so a missing one can be cloned. */\n repos: Record<string, { path: string; origin: string | null }>;\n sessions: Array<{ id: string; target: string; branch: string; archived: boolean; transcripts: number }>;\n}\n\n/** A refusal, in words for the CLI. */\nexport class MoveError extends Error {}\n\nconst exists = (p: string) => fs.existsSync(p);\n\n// ---- before export: what wouldn't survive the move -------------------------------\n\nexport interface Unsaved {\n session: string;\n repo: string;\n path: string;\n what: string;\n}\n\n/**\n * Work only this computer has, per live session's repo: uncommitted files,\n * commits not on origin. Import recreates worktrees from origin, so these\n * would stay behind.\n */\nexport async function unsavedWork(sessions: WorktreeSession[], run: CommandRunner = defaultRunner): Promise<Unsaved[]> {\n const out: Unsaved[] = [];\n for (const s of sessions) {\n if (s.archivedAt) continue;\n for (const p of s.paths) {\n if (!exists(p)) continue;\n const at = { session: `${s.target} Β· ${s.branch || '(its checkout)'}`, repo: s.isGroup ? path.basename(p) : s.target, path: p };\n const status = await run('git', ['status', '--porcelain'], p);\n const dirty = status.code === 0 ? status.stdout.split('\\n').filter((l) => l.trim()).length : 0;\n if (dirty) out.push({ ...at, what: `${dirty} uncommitted file${dirty === 1 ? '' : 's'}` });\n const branch = (await run('git', ['rev-parse', '--abbrev-ref', 'HEAD'], p)).stdout.trim();\n if (!branch || branch === 'HEAD') continue;\n const onOrigin = (await run('git', ['rev-parse', '--verify', '--quiet', `refs/remotes/origin/${branch}`], p)).code === 0;\n const against = onOrigin ? `origin/${branch}` : 'origin/HEAD';\n const ahead = Number((await run('git', ['rev-list', '--count', `${against}..HEAD`], p)).stdout.trim()) || 0;\n if (ahead)\n out.push({ ...at, what: `${ahead} commit${ahead === 1 ? '' : 's'} not pushed${onOrigin ? '' : ` (${branch} isn't on origin)`}` });\n }\n }\n return out;\n}\n\n// ---- export ------------------------------------------------------------------------\n\nexport interface ExportResult {\n dir: string;\n sessions: number;\n transcripts: number;\n}\n\n/** Write the bundle into `dest` (a new or empty folder). */\nexport function exportBundle(dest: string, now = new Date()): ExportResult {\n if (exists(dest) && fs.readdirSync(dest).length) throw new MoveError(`${dest} isn't empty: give a new folder`);\n const home = getConfigDir();\n const config = loadConfig();\n if (!config) throw new MoveError('nothing to move: work has no config here');\n fs.mkdirSync(dest, { recursive: true });\n snapshotDb(path.join(dest, 'state.db'));\n fs.copyFileSync(getConfigPath(), path.join(dest, 'config.json'));\n for (const dir of ['conversations', 'archive']) {\n if (exists(path.join(home, dir))) fs.cpSync(path.join(home, dir), path.join(dest, dir), { recursive: true });\n }\n for (const f of fs.readdirSync(home).filter((n) => n.endsWith('.claude.md'))) {\n fs.mkdirSync(path.join(dest, 'instructions'), { recursive: true });\n fs.copyFileSync(path.join(home, f), path.join(dest, 'instructions', f));\n }\n\n const history = loadHistory();\n let transcripts = 0;\n const sessions: MoveManifest['sessions'] = [];\n for (const s of history) {\n const id = sessionIdFor(s);\n // An archived session's conversation is in its archive already.\n const files = s.archivedAt ? [] : (agentOf(s).conversation?.files(s) ?? []);\n for (const f of files) {\n fs.mkdirSync(path.join(dest, 'transcripts', id), { recursive: true });\n fs.copyFileSync(f.file, path.join(dest, 'transcripts', id, path.basename(f.file)));\n }\n transcripts += files.length;\n sessions.push({ id, target: s.target, branch: s.branch, archived: !!s.archivedAt, transcripts: files.length });\n }\n const repos: MoveManifest['repos'] = {};\n for (const [alias, p] of Object.entries(config.repos)) {\n let origin: string | null = null;\n try {\n origin = originUrl(fs.readFileSync(path.join(p, '.git', 'config'), 'utf-8'));\n } catch {\n /* not there, or not a plain repo */\n }\n repos[alias] = { path: p, origin };\n }\n const manifest: MoveManifest = {\n version: BUNDLE_VERSION,\n exportedAt: now.toISOString(),\n from: { home: os.homedir(), platform: process.platform, worktreesRoot: config.worktreesRoot },\n repos,\n sessions,\n };\n fs.writeFileSync(path.join(dest, 'manifest.json'), JSON.stringify(manifest, null, 2));\n return { dir: dest, sessions: history.length, transcripts };\n}\n\n// ---- paths on the new computer (pure) ---------------------------------------------\n\nexport interface PathRule {\n from: string;\n to: string;\n}\n\nconst norm = (p: string, caseless: boolean) => {\n const n = p.replace(/\\\\/g, '/').replace(/\\/+$/, '');\n return caseless ? n.toLowerCase() : n;\n};\n\n/**\n * Where things go: the worktrees root and each repo to the folders given\n * (`--worktrees-root`, `--repos-root` + its folder name), else the same\n * place under the new home folder; anything else under the old home moves\n * with it. Longest first, so the most specific rule wins. Pure.\n */\nexport function remapRules(\n m: Pick<MoveManifest, 'from' | 'repos'>,\n opts: { reposRoot?: string; worktreesRoot?: string },\n newHome: string,\n join: (...parts: string[]) => string = path.join,\n): PathRule[] {\n const caseless = m.from.platform === 'win32';\n const homeSwap = (p: string) => remapPath(p, [{ from: m.from.home, to: newHome }], caseless, join);\n const base = (p: string) =>\n p\n .replace(/[\\\\/]+$/, '')\n .split(/[\\\\/]/)\n .pop() ?? p;\n const rules: PathRule[] = [\n { from: m.from.worktreesRoot, to: opts.worktreesRoot ?? homeSwap(m.from.worktreesRoot) },\n ...Object.values(m.repos).map((r) => ({ from: r.path, to: opts.reposRoot ? join(opts.reposRoot, base(r.path)) : homeSwap(r.path) })),\n { from: m.from.home, to: newHome },\n ];\n return rules.sort((a, b) => b.from.length - a.from.length);\n}\n\n/** `p` under the first rule whose folder holds it, written for this computer; unchanged when none does. Pure. */\nexport function remapPath(p: string, rules: PathRule[], caseless: boolean, join: (...parts: string[]) => string = path.join): string {\n const key = norm(p, caseless);\n for (const r of rules) {\n const from = norm(r.from, caseless);\n if (key !== from && !key.startsWith(`${from}/`)) continue;\n const rest = p.replace(/\\\\/g, '/').slice(from.length).split('/').filter(Boolean);\n return rest.length ? join(r.to, ...rest) : r.to;\n }\n return p;\n}\n\n/** A session with its paths (and per-repo bases, keyed by path) moved. Pure. */\nexport function remapSession(s: WorktreeSession, move: (p: string) => string): WorktreeSession {\n const out: WorktreeSession = { ...s, paths: s.paths.map(move) };\n if (s.baseBranches) out.baseBranches = Object.fromEntries(Object.entries(s.baseBranches).map(([p, b]) => [move(p), b]));\n return out;\n}\n\n// ---- import ------------------------------------------------------------------------\n\n/**\n * What holds the database open here and must stop before an import replaces\n * it: work web, the PTY host. A host that doesn't answer counts as running.\n */\nexport async function runningHere(): Promise<string[]> {\n const out: string[] = [];\n const url = readWebUrl();\n if (url && (await webServerResponds(url))) out.push('work web (`work web --stop`)');\n try {\n if (await findHost()) out.push('the PTY host (`work pty-host --stop`)');\n } catch {\n out.push('the PTY host (`work pty-host --stop`)');\n }\n return out;\n}\n\nexport function readManifest(dir: string): MoveManifest {\n let raw: unknown;\n try {\n raw = JSON.parse(fs.readFileSync(path.join(dir, 'manifest.json'), 'utf-8'));\n } catch {\n throw new MoveError(`${dir} isn't a work bundle (no manifest.json): make one with \\`work move export\\``);\n }\n const m = raw as MoveManifest;\n if (!m || typeof m !== 'object' || typeof m.from?.home !== 'string' || typeof m.repos !== 'object')\n throw new MoveError(`${dir}/manifest.json isn't one work can read`);\n if (m.version > BUNDLE_VERSION) throw new MoveError(`this bundle is from a newer work (v${m.version}): update work first`);\n if (!exists(path.join(dir, 'state.db')) || !exists(path.join(dir, 'config.json')))\n throw new MoveError(`${dir} is missing state.db or config.json`);\n return m;\n}\n\nexport interface ImportOptions {\n reposRoot?: string;\n worktreesRoot?: string;\n /** Clone repos that aren't on this computer, from their origin. */\n clone?: boolean;\n /** Replace what this computer has already. */\n force?: boolean;\n}\n\nexport interface ImportReport {\n sessions: number;\n repos: { cloned: string[]; missing: string[] };\n worktrees: { created: string[]; failed: Array<{ session: string; error: string }> };\n transcripts: number;\n}\n\nexport interface ImportDeps {\n run: CommandRunner;\n create: CreateWorktree;\n /** Where a session's agent looks for its conversations (null: it starts fresh). */\n restoreDir: (s: WorktreeSession) => string | null;\n}\n\nconst defaultImportDeps = (): ImportDeps => ({\n run: defaultRunner,\n create: createInProcess,\n restoreDir: (s) => agentOf(s).conversation?.restoreDir?.(s) ?? null,\n});\n\n/** Bring a bundle in. The caller makes sure no work web or PTY host runs (they hold the database). */\nexport async function importBundle(dir: string, opts: ImportOptions = {}, deps: ImportDeps = defaultImportDeps()): Promise<ImportReport> {\n const m = readManifest(dir);\n if (!opts.force && exists(getConfigPath()) && loadHistory().length)\n throw new MoveError('work here has sessions already; importing replaces them (--force to do it anyway)');\n const caseless = m.from.platform === 'win32';\n const rules = remapRules(m, opts, os.homedir());\n const move = (p: string) => remapPath(p, rules, caseless);\n\n // config.json, as JSON: keys this version doesn't know come along.\n const raw = JSON.parse(fs.readFileSync(path.join(dir, 'config.json'), 'utf-8')) as Record<string, unknown>;\n if (typeof raw.worktreesRoot === 'string') raw.worktreesRoot = move(raw.worktreesRoot);\n if (raw.repos && typeof raw.repos === 'object')\n raw.repos = Object.fromEntries(\n Object.entries(raw.repos as Record<string, unknown>).map(([a, p]) => [a, typeof p === 'string' ? move(p) : p]),\n );\n for (const key of ['scanRoots', 'ignoredRepos'])\n if (Array.isArray(raw[key])) raw[key] = (raw[key] as unknown[]).map((p) => (typeof p === 'string' ? move(p) : p));\n fs.mkdirSync(getConfigDir(), { recursive: true });\n atomicWriteFile(getConfigPath(), JSON.stringify(raw, null, 2));\n\n // The database, then its sessions' paths. Its Claudes start when you open them here.\n replaceDb(path.join(dir, 'state.db'));\n const history = loadHistory().map((s) => remapSession(s, move));\n saveHistory(history);\n withDb((d) => d.prepare('DELETE FROM pty_sessions').run());\n\n // work's own files.\n for (const sub of ['conversations', 'archive'])\n if (exists(path.join(dir, sub))) fs.cpSync(path.join(dir, sub), path.join(getConfigDir(), sub), { recursive: true, force: false });\n if (exists(path.join(dir, 'instructions')))\n for (const f of fs.readdirSync(path.join(dir, 'instructions')))\n fs.copyFileSync(path.join(dir, 'instructions', f), path.join(getConfigDir(), f));\n\n const report: ImportReport = {\n sessions: history.length,\n repos: { cloned: [], missing: [] },\n worktrees: { created: [], failed: [] },\n transcripts: 0,\n };\n const config = loadConfig()!;\n for (const [alias, p] of Object.entries(config.repos)) {\n if (exists(p)) continue;\n const origin = m.repos[alias]?.origin;\n if (opts.clone && origin) {\n fs.mkdirSync(path.dirname(p), { recursive: true });\n const r = await deps.run('git', ['clone', origin, p], path.dirname(p));\n if (r.code === 0) {\n report.repos.cloned.push(alias);\n continue;\n }\n }\n report.repos.missing.push(alias);\n }\n\n // Live sessions get their worktrees back, from their branches on origin.\n const missing = new Set(report.repos.missing);\n for (const s of history) {\n if (s.archivedAt || !s.branch || s.paths.every(exists)) continue;\n const label = `${s.target} Β· ${s.branch}`;\n const repos = s.isGroup ? (config.groups[s.target] ?? []) : [s.target];\n if (repos.some((r) => missing.has(r))) {\n report.worktrees.failed.push({ session: label, error: `its repo isn't here (${repos.filter((r) => missing.has(r)).join(', ')})` });\n continue;\n }\n // A repo's own checkout (`work tree <repo>`) comes with the repo.\n if (!s.isGroup && config.repos[s.target] && s.paths[0] === config.repos[s.target]) continue;\n const r = await deps.create({ target: s.target, branch: s.branch }, config);\n if (r.ok) report.worktrees.created.push(label);\n else report.worktrees.failed.push({ session: label, error: r.error });\n }\n\n // Conversations back where the agent looks, so they resume.\n for (const s of loadHistory()) {\n const from = path.join(dir, 'transcripts', sessionIdFor(s));\n const to = exists(from) ? deps.restoreDir(s) : null;\n if (!to) continue;\n fs.mkdirSync(to, { recursive: true });\n for (const f of fs.readdirSync(from)) {\n if (exists(path.join(to, f))) continue;\n fs.copyFileSync(path.join(from, f), path.join(to, f));\n report.transcripts++;\n }\n }\n return report;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,WAAU;AACjB,OAAO,WAAW;;;ACDlB,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AA+BV,IAAM,iBAAiB;AAYvB,IAAM,YAAN,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AAM,WAAWD,MAAK,QAAQ,KAAK,YAAY,CAAC,IAAI;AAAA,QACvF,eAAe,OAAO,KAAK,gBAAgB,MAAM,WAAWA,MAAK,QAAQ,KAAK,gBAAgB,CAAC,IAAI;AAAA,MACrG,CAAC;AACD,cAAQ,IAAI,MAAM,MAAM,YAAY,EAAE,QAAQ,gBAAgB,EAAE,WAAW,4CAA4C,CAAC;AACxH,UAAI,EAAE,MAAM,OAAO,OAAQ,SAAQ,IAAI,WAAW,EAAE,MAAM,OAAO,KAAK,IAAI,CAAC,EAAE;AAC7E,UAAI,EAAE,MAAM,QAAQ;AAClB,gBAAQ,IAAI,MAAM,OAAO,yBAAyB,EAAE,MAAM,QAAQ,KAAK,IAAI,CAAC,iDAA4C,CAAC;AAC3H,UAAI,EAAE,UAAU,QAAQ,OAAQ,SAAQ,IAAI,wBAAwB,EAAE,UAAU,QAAQ,KAAK,IAAI,CAAC,EAAE;AACpG,iBAAW,KAAK,EAAE,UAAU,OAAQ,SAAQ,IAAI,MAAM,OAAO,KAAK,EAAE,OAAO,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1F,cAAQ,IAAI,MAAM,KAAK,2EAA2E,CAAC;AAAA,IACrG,SAAS,KAAK;AACZ,UAAI,EAAE,eAAe,WAAY,OAAM;AACvC,cAAQ,MAAM,MAAM,IAAI,IAAI,OAAO,CAAC;AACpC,cAAQ,WAAW;AAAA,IACrB;AAAA,EACF;AACF;","names":["path","r","path","r"]}
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ MAX_NOTE_CHARS,
4
+ appendNote,
5
+ readNote,
6
+ saveNote
7
+ } from "./chunk-JNBYNRFS.js";
8
+ import {
9
+ sessionFromArgs,
10
+ sessionPositionals
11
+ } from "./chunk-HSICXDMZ.js";
12
+ import "./chunk-6AQRYLOB.js";
13
+ import "./chunk-WF5SBVPZ.js";
14
+ import "./chunk-ZSHWP2VS.js";
15
+ import "./chunk-5QK7GB5K.js";
16
+ import "./chunk-HUXS3VAI.js";
17
+ import "./chunk-M4FVCAT6.js";
18
+ import {
19
+ sessionIdFor
20
+ } from "./chunk-7NCW3LUT.js";
21
+ import "./chunk-PN44M5EE.js";
22
+ import "./chunk-RCYI7SRA.js";
23
+ import "./chunk-DW4JPVXB.js";
24
+ import "./chunk-N4EYQKSM.js";
25
+ import "./chunk-7HEB6SQS.js";
26
+
27
+ // src/commands/note.ts
28
+ import fs from "fs";
29
+ import chalk from "chalk";
30
+ var noteCommand = {
31
+ command: "note [target] [branch]",
32
+ describe: "Your notes on a session: print them, --set, --append a line, or --clear (default: the session for this folder)",
33
+ builder: (yargs) => sessionPositionals(yargs).option("set", { type: "string", describe: "Replace the notes with this text" }).option("set-file", { type: "string", describe: "Replace the notes with this file" }).option("append", { alias: "a", type: "string", describe: "Add a line at the end" }).option("clear", { type: "boolean", describe: "Remove them" }).conflicts("set", ["append", "clear", "set-file"]).conflicts("append", ["clear", "set-file"]).conflicts("clear", "set-file"),
34
+ handler: (argv) => {
35
+ const s = sessionFromArgs(argv);
36
+ if (!s) return;
37
+ const id = sessionIdFor(s);
38
+ const name = `${s.target} \xB7 ${s.branch}`;
39
+ let text = typeof argv.set === "string" ? argv.set : void 0;
40
+ if (typeof argv["set-file"] === "string") {
41
+ try {
42
+ text = fs.readFileSync(argv["set-file"], "utf8");
43
+ } catch (err) {
44
+ console.error(chalk.red(`Can't read ${argv["set-file"]}: ${err.message}`));
45
+ process.exitCode = 1;
46
+ return;
47
+ }
48
+ }
49
+ if (text !== void 0 && text.length > MAX_NOTE_CHARS) {
50
+ console.error(chalk.red(`At most ${MAX_NOTE_CHARS} characters.`));
51
+ process.exitCode = 1;
52
+ return;
53
+ }
54
+ if (argv.clear) {
55
+ saveNote(id, "");
56
+ console.log(chalk.green(`Cleared the notes on ${name}.`));
57
+ } else if (text !== void 0) {
58
+ saveNote(id, text);
59
+ console.log(chalk.green(`Saved the notes on ${name}.`));
60
+ } else if (typeof argv.append === "string") {
61
+ if ((readNote(id)?.text.length ?? 0) + argv.append.length + 1 > MAX_NOTE_CHARS) {
62
+ console.error(chalk.red(`At most ${MAX_NOTE_CHARS} characters in all: that would make it longer.`));
63
+ process.exitCode = 1;
64
+ return;
65
+ }
66
+ appendNote(id, argv.append);
67
+ console.log(chalk.green(`Added to the notes on ${name}.`));
68
+ } else {
69
+ const note = readNote(id);
70
+ if (note) console.log(note.text);
71
+ else console.error(chalk.gray(`No notes on ${name} (work note --append "\u2026" adds one).`));
72
+ }
73
+ }
74
+ };
75
+ export {
76
+ noteCommand
77
+ };
78
+ //# sourceMappingURL=note-WGM6LCP2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/note.ts"],"sourcesContent":["import fs from 'node:fs';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { appendNote, readNote, saveNote, MAX_NOTE_CHARS } from '../core/rail/session-notes.js';\nimport { sessionIdFor } from '../core/sessions/session-id.js';\nimport { sessionFromArgs, sessionPositionals } from './shared/session-arg.js';\n\n/** `work note` β€” your notes on a session (session-notes.ts), the dashboard's πŸ“ Notes: print, set, add a line, clear. */\nexport const noteCommand: CommandModule = {\n command: 'note [target] [branch]',\n describe: 'Your notes on a session: print them, --set, --append a line, or --clear (default: the session for this folder)',\n builder: (yargs) =>\n sessionPositionals(yargs)\n .option('set', { type: 'string', describe: 'Replace the notes with this text' })\n .option('set-file', { type: 'string', describe: 'Replace the notes with this file' })\n .option('append', { alias: 'a', type: 'string', describe: 'Add a line at the end' })\n .option('clear', { type: 'boolean', describe: 'Remove them' })\n .conflicts('set', ['append', 'clear', 'set-file'])\n .conflicts('append', ['clear', 'set-file'])\n .conflicts('clear', 'set-file'),\n handler: (argv) => {\n const s = sessionFromArgs(argv);\n if (!s) return;\n const id = sessionIdFor(s);\n const name = `${s.target} Β· ${s.branch}`;\n let text: string | undefined = typeof argv.set === 'string' ? argv.set : undefined;\n if (typeof argv['set-file'] === 'string') {\n try {\n text = fs.readFileSync(argv['set-file'], 'utf8');\n } catch (err) {\n console.error(chalk.red(`Can't read ${argv['set-file']}: ${(err as Error).message}`));\n process.exitCode = 1;\n return;\n }\n }\n if (text !== undefined && text.length > MAX_NOTE_CHARS) {\n console.error(chalk.red(`At most ${MAX_NOTE_CHARS} characters.`));\n process.exitCode = 1;\n return;\n }\n if (argv.clear) {\n saveNote(id, '');\n console.log(chalk.green(`Cleared the notes on ${name}.`));\n } else if (text !== undefined) {\n saveNote(id, text);\n console.log(chalk.green(`Saved the notes on ${name}.`));\n } else if (typeof argv.append === 'string') {\n if ((readNote(id)?.text.length ?? 0) + argv.append.length + 1 > MAX_NOTE_CHARS) {\n console.error(chalk.red(`At most ${MAX_NOTE_CHARS} characters in all: that would make it longer.`));\n process.exitCode = 1;\n return;\n }\n appendNote(id, argv.append);\n console.log(chalk.green(`Added to the notes on ${name}.`));\n } else {\n const note = readNote(id);\n if (note) console.log(note.text);\n else console.error(chalk.gray(`No notes on ${name} (work note --append \"…\" adds one).`));\n }\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,WAAW;AAOX,IAAM,cAA6B;AAAA,EACxC,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UACR,mBAAmB,KAAK,EACrB,OAAO,OAAO,EAAE,MAAM,UAAU,UAAU,mCAAmC,CAAC,EAC9E,OAAO,YAAY,EAAE,MAAM,UAAU,UAAU,mCAAmC,CAAC,EACnF,OAAO,UAAU,EAAE,OAAO,KAAK,MAAM,UAAU,UAAU,wBAAwB,CAAC,EAClF,OAAO,SAAS,EAAE,MAAM,WAAW,UAAU,cAAc,CAAC,EAC5D,UAAU,OAAO,CAAC,UAAU,SAAS,UAAU,CAAC,EAChD,UAAU,UAAU,CAAC,SAAS,UAAU,CAAC,EACzC,UAAU,SAAS,UAAU;AAAA,EAClC,SAAS,CAAC,SAAS;AACjB,UAAM,IAAI,gBAAgB,IAAI;AAC9B,QAAI,CAAC,EAAG;A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A,EACF;AACF;","names":[]}
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ scanChanges
4
+ } from "./chunk-C2THFSXA.js";
5
+ import "./chunk-4BOK2GXL.js";
6
+ import "./chunk-AKMPF72Y.js";
7
+ import "./chunk-ZXPYWZL5.js";
8
+ import {
9
+ loadHistory
10
+ } from "./chunk-M4FVCAT6.js";
11
+ import {
12
+ sessionIdFor
13
+ } from "./chunk-7NCW3LUT.js";
14
+ import "./chunk-PN44M5EE.js";
15
+ import "./chunk-RCYI7SRA.js";
16
+ import "./chunk-DW4JPVXB.js";
17
+ import "./chunk-N4EYQKSM.js";
18
+ import "./chunk-7HEB6SQS.js";
19
+
20
+ // src/commands/overlaps.ts
21
+ import chalk from "chalk";
22
+ var overlapsCommand = {
23
+ command: "overlaps",
24
+ describe: "Live sessions that change the same files of a repo (they will conflict on merge); --json",
25
+ builder: (yargs) => yargs.option("json", { type: "boolean", default: false, describe: "As JSON: session id \u2192 overlaps" }),
26
+ handler: async (argv) => {
27
+ const history = loadHistory();
28
+ const { overlaps } = await scanChanges(history);
29
+ if (argv.json) {
30
+ process.stdout.write(JSON.stringify(Object.fromEntries(overlaps), null, 2) + "\n");
31
+ return;
32
+ }
33
+ if (overlaps.size === 0) {
34
+ console.log(chalk.green("No two live sessions change the same file."));
35
+ return;
36
+ }
37
+ const seen = /* @__PURE__ */ new Set();
38
+ for (const s of history) {
39
+ const id = sessionIdFor(s);
40
+ for (const o of overlaps.get(id) ?? []) {
41
+ const pair = [id, o.sessionId].sort().join("|");
42
+ if (seen.has(pair)) continue;
43
+ seen.add(pair);
44
+ console.log(
45
+ chalk.yellow(`\u26A0 ${s.target} \xB7 ${s.branch} \u2194 ${o.target} \xB7 ${o.branch} (${o.count} file${o.count === 1 ? "" : "s"})`)
46
+ );
47
+ for (const f of o.files) console.log(chalk.gray(` ${f.repo}/${f.path}`));
48
+ if (o.count > o.files.length) console.log(chalk.gray(` \u2026and ${o.count - o.files.length} more`));
49
+ }
50
+ }
51
+ }
52
+ };
53
+ export {
54
+ overlapsCommand
55
+ };
56
+ //# sourceMappingURL=overlaps-FRLMMIGC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/overlaps.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { loadHistory } from '../core/sessions/history.js';\nimport { sessionIdFor } from '../core/sessions/session-id.js';\nimport { scanChanges } from '../core/diff/overlap-scan.js';\n\nexport const overlapsCommand: CommandModule = {\n command: 'overlaps',\n describe: 'Live sessions that change the same files of a repo (they will conflict on merge); --json',\n builder: (yargs) => yargs.option('json', { type: 'boolean', default: false, describe: 'As JSON: session id β†’ overlaps' }),\n handler: async (argv) => {\n const history = loadHistory();\n const { overlaps } = await scanChanges(history);\n if (argv.json) {\n process.stdout.write(JSON.stringify(Object.fromEntries(overlaps), null, 2) + '\\n');\n return;\n }\n if (overlaps.size === 0) {\n console.log(chalk.green('No two live sessions change the same file.'));\n return;\n }\n // Each pair once.\n const seen = new Set<string>();\n for (const s of history) {\n const id = sessionIdFor(s);\n for (const o of overlaps.get(id) ?? []) {\n const pair = [id, o.sessionId].sort().join('|');\n if (seen.has(pair)) continue;\n seen.add(pair);\n console.log(\n chalk.yellow(`⚠ ${s.target} Β· ${s.branch} ↔ ${o.target} Β· ${o.branch} (${o.count} file${o.count === 1 ? '' : 's'})`),\n );\n for (const f of o.files) console.log(chalk.gray(` ${f.repo}/${f.path}`));\n if (o.count > o.files.length) console.log(chalk.gray(` …and ${o.count - o.files.length} more`));\n }\n }\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAMX,IAAM,kBAAiC;AAAA,EAC5C,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UAAU,MAAM,OAAO,QAAQ,EAAE,MAAM,WAAW,SAAS,OAAO,UAAU,sCAAiC,CAAC;AAAA,EACxH,SAAS,OAAO,SAAS;AACvB,UAAM,UAAU,YAAY;AAC5B,UAAM,EAAE,SAAS,IAAI,MAAM,YAAY,OAAO;AAC9C,QAAI,KAAK,MAAM;AACb,cAAQ,OAAO,MAAM,KAAK,UAAU,OAAO,YAAY,QAAQ,GAAG,MAAM,CAAC,IAAI,IAAI;AACjF;AAAA,IACF;AACA,QAAI,SAAS,SAAS,GAAG;AACvB,cAAQ,IAAI,MAAM,MAAM,4CAA4C,CAAC;AACrE;AAAA,IACF;AAEA,UAAM,OAAO,oBAAI,IAAY;AAC7B,eAAW,KAAK,SAAS;AACvB,YAAM,KAAK,aAAa,CAAC;AACzB,iBAAW,KAAK,SAAS,IAAI,EAAE,KAAK,CAAC,GAAG;AACtC,cAAM,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAG;AAC9C,YAAI,KAAK,IAAI,IAAI,EAAG;AACpB,aAAK,IAAI,IAAI;AACb,gBAAQ;AAAA,UACN,MAAM,OAAO,UAAK,EAAE,MAAM,SAAM,EAAE,MAAM,aAAQ,EAAE,MAAM,SAAM,EAAE,MAAM,MAAM,EAAE,KAAK,QAAQ,EAAE,UAAU,IAAI,KAAK,GAAG,GAAG;AAAA,QACxH;AACA,mBAAW,KAAK,EAAE,MAAO,SAAQ,IAAI,MAAM,KAAK,OAAO,EAAE,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC;AAC1E,YAAI,EAAE,QAAQ,EAAE,MAAM,OAAQ,SAAQ,IAAI,MAAM,KAAK,iBAAY,EAAE,QAAQ,EAAE,MAAM,MAAM,OAAO,CAAC;AAAA,MACnG;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ placeSession
4
+ } from "./chunk-TUC4QY4O.js";
5
+ import {
6
+ sessionFromArgs,
7
+ sessionPositionals
8
+ } from "./chunk-HSICXDMZ.js";
9
+ import "./chunk-6AQRYLOB.js";
10
+ import "./chunk-WF5SBVPZ.js";
11
+ import "./chunk-ZSHWP2VS.js";
12
+ import "./chunk-5QK7GB5K.js";
13
+ import "./chunk-HUXS3VAI.js";
14
+ import "./chunk-M4FVCAT6.js";
15
+ import {
16
+ sessionIdFor
17
+ } from "./chunk-7NCW3LUT.js";
18
+ import "./chunk-PN44M5EE.js";
19
+ import "./chunk-RCYI7SRA.js";
20
+ import "./chunk-DW4JPVXB.js";
21
+ import "./chunk-N4EYQKSM.js";
22
+ import "./chunk-7HEB6SQS.js";
23
+
24
+ // src/commands/pin.ts
25
+ import chalk from "chalk";
26
+ var pinCommand = {
27
+ command: "pin [target] [branch]",
28
+ describe: "Pin a session to the top of the dashboard's rail (default: the session for this folder)",
29
+ builder: (yargs) => sessionPositionals(yargs).option("off", { type: "boolean", describe: "Unpin it" }),
30
+ handler: (argv) => {
31
+ const s = sessionFromArgs(argv);
32
+ if (!s) return;
33
+ const r = placeSession(sessionIdFor(s), { pinned: !argv.off });
34
+ if (!r.ok) {
35
+ console.error(chalk.red(r.error));
36
+ process.exitCode = 1;
37
+ return;
38
+ }
39
+ console.log(chalk.green(`${argv.off ? "Unpinned" : "Pinned"} ${s.target} \xB7 ${s.branch}.`));
40
+ }
41
+ };
42
+ export {
43
+ pinCommand
44
+ };
45
+ //# sourceMappingURL=pin-MQ5ZE37R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/pin.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { placeSession } from '../core/rail/rail-store.js';\nimport { sessionIdFor } from '../core/sessions/session-id.js';\nimport { sessionFromArgs, sessionPositionals } from './shared/session-arg.js';\n\n/** `work pin` β€” pin a session to the top of the dashboard's rail (rail-layout.ts), or `--off`. */\nexport const pinCommand: CommandModule = {\n command: 'pin [target] [branch]',\n describe: \"Pin a session to the top of the dashboard's rail (default: the session for this folder)\",\n builder: (yargs) => sessionPositionals(yargs).option('off', { type: 'boolean', describe: 'Unpin it' }),\n handler: (argv) => {\n const s = sessionFromArgs(argv);\n if (!s) return;\n const r = placeSession(sessionIdFor(s), { pinned: !argv.off });\n if (!r.ok) {\n console.error(chalk.red(r.error));\n process.exitCode = 1;\n return;\n }\n console.log(chalk.green(`${argv.off ? 'Unpinned' : 'Pinned'} ${s.target} Β· ${s.branch}.`));\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAOX,IAAM,aAA4B;AAAA,EACvC,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UAAU,mBAAmB,KAAK,EAAE,OAAO,OAAO,EAAE,MAAM,WAAW,UAAU,WAAW,CAAC;AAAA,EACrG,SAAS,CAAC,SAAS;AACjB,UAAM,IAAI,gBAAgB,IAAI;AAC9B,QAAI,CAAC,EAAG;AACR,UAAM,IAAI,aAAa,aAAa,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,IAAI,CAAC;AAC7D,QAAI,CAAC,EAAE,IAAI;AACT,cAAQ,MAAM,MAAM,IAAI,EAAE,KAAK,CAAC;AAChC,cAAQ,WAAW;AACnB;AAAA,IACF;AACA,YAAQ,IAAI,MAAM,MAAM,GAAG,KAAK,MAAM,aAAa,QAAQ,IAAI,EAAE,MAAM,SAAM,EAAE,MAAM,GAAG,CAAC;AAAA,EAC3F;AACF;","names":[]}