@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
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### One terminal. Every branch. Every repo. Every Claude session.
|
|
6
6
|
|
|
7
|
-
**A cross-platform TypeScript CLI that turns git worktrees into a parallel-development cockpit. Spin up isolated workspaces per branch across one or many repos, auto-launch Claude Code (or any AI CLI), and orchestrate everything — PRs, Jira issues, local tasks, diffs, and reviews — from a
|
|
7
|
+
**A cross-platform TypeScript CLI that turns git worktrees into a parallel-development cockpit. Spin up isolated workspaces per branch across one or many repos, auto-launch Claude Code (or any AI CLI), and orchestrate everything — PRs, Jira issues, local tasks, diffs, and reviews — from a single browser tab, with a real terminal attached whenever you want one.**
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@moberg_hr/work-tree)
|
|
10
10
|
[](https://moberghr.github.io/cli-work-tree-manager/)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
**[moberghr.github.io/cli-work-tree-manager](https://moberghr.github.io/cli-work-tree-manager/)** — the Work website.
|
|
15
15
|
|
|
16
|
-
[Quick Start](#quick-start) · [Why Work](#why-work) · [Commands](#commands) · [Dashboard
|
|
16
|
+
[Quick Start](#quick-start) · [Why Work](#why-work) · [Commands](#commands) · [Dashboard (`work web`)](#browser-dashboard-work-web) · [Fleet](#fleet-commands-run--broadcast) · [Groups](#groups-multi-repo-worktrees) · [Diff review (`wd`)](#diff-review-wd) · [Architecture](#architecture) · [FAQ](#faq)
|
|
17
17
|
|
|
18
18
|
</div>
|
|
19
19
|
|
|
@@ -28,11 +28,11 @@ Work is the missing layer between `git worktree` and your AI assistant. Every br
|
|
|
28
28
|
| Without Work | With Work |
|
|
29
29
|
|:---|:---|
|
|
30
30
|
| `cd ../some/path && git checkout -b feature/x && cp .env.local .` every time | `work tree api feature/x` — worktree created, dev settings copied, Claude launched |
|
|
31
|
-
| Three terminals, three editors, three lost contexts | One
|
|
31
|
+
| Three terminals, three editors, three lost contexts | One browser tab: sessions, PRs, Jira, tasks, an attention inbox — and `work attach` for a real terminal on any session |
|
|
32
32
|
| "Which directory was that branch in again?" | `work resume` — recent sessions sorted by last access, one keystroke to re-enter |
|
|
33
33
|
| Multi-repo features = multiple `git worktree add` invocations and a hand-merged CLAUDE.md | `work tree mygroup feature/x` — every repo cloned in lockstep, combined CLAUDE.md generated automatically |
|
|
34
34
|
| Stale worktrees pile up after PRs merge | `work prune` (interactive) / `work sync` (one-shot) — remove worktrees whose branches landed on main |
|
|
35
|
-
| Jira ticket → branch name → worktree → Claude prompt = manual every time |
|
|
35
|
+
| Jira ticket → branch name → worktree → Claude prompt = manual every time | Pick a Jira issue in `work web` → worktree created with a branch for it |
|
|
36
36
|
| Same chore (`npm test`, rebase) in five worktrees, one terminal at a time | `work run --all npm test` / `work broadcast --all "rebase onto main"` — fan out across the fleet |
|
|
37
37
|
| Diffs and reviews scattered across terminals and editor tabs | `wd` / `work web` — every diff and review in one browser, comments routed back to the live AI session |
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ Work is the missing layer between `git worktree` and your AI assistant. Every br
|
|
|
41
41
|
## Quick Start
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
# 1. Install (Node 22+, Git required)
|
|
44
|
+
# 1. Install (Node 22.13+, Git required)
|
|
45
45
|
|
|
46
46
|
# Option A — Homebrew (macOS / Linux)
|
|
47
47
|
brew install moberghr/work-tree/work # provides `work` and `wd`
|
|
@@ -59,8 +59,8 @@ work init
|
|
|
59
59
|
# 3. Create a worktree and launch your AI tool
|
|
60
60
|
work tree api feature/login
|
|
61
61
|
|
|
62
|
-
# 4. Open the dashboard
|
|
63
|
-
work
|
|
62
|
+
# 4. Open the dashboard in your browser
|
|
63
|
+
work web
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
`work init` walks you through the worktrees root, your repo aliases, your AI command, and tab-completion installation. Everything else is one keystroke away from the dashboard.
|
|
@@ -69,7 +69,7 @@ work dash
|
|
|
69
69
|
|
|
70
70
|
| Tool | Required | Used for |
|
|
71
71
|
|:---|:---|:---|
|
|
72
|
-
| **Node.js 22+** | yes | Runtime |
|
|
72
|
+
| **Node.js 22.13+** | yes | Runtime |
|
|
73
73
|
| **Git** | yes | Worktree operations |
|
|
74
74
|
| **[Claude Code CLI](https://claude.ai/code)** | recommended | Default AI tool auto-launched on `work tree`; group CLAUDE.md generation. Any other CLI works too — set `aiCommand` in config. |
|
|
75
75
|
| **[GitHub CLI (`gh`)](https://cli.github.com/)** | optional | PR pane in the dashboard / `work web` |
|
|
@@ -89,7 +89,7 @@ work list [target] # List worktrees
|
|
|
89
89
|
work status [target] [branch] [--prune] # Show worktree merge/dirty status
|
|
90
90
|
work recent [count] # List recent sessions
|
|
91
91
|
work resume [--unsafe] # Resume a recent session
|
|
92
|
-
work
|
|
92
|
+
work attach [target] [branch] # Attach this terminal to a session's Claude (Ctrl+] detaches)
|
|
93
93
|
work web [--stop] [--no-open] # Browser dashboard (singleton; all sessions in one tab)
|
|
94
94
|
work prune [--force] # Remove merged worktrees (interactive)
|
|
95
95
|
work sync [--dry-run] [--force] [--include-squash] # Fetch all repos + prune merged worktrees (non-interactive)
|
|
@@ -135,64 +135,7 @@ Branch directories normalize `/` → `-`, so `feature/login` lives at `<worktree
|
|
|
135
135
|
|
|
136
136
|
---
|
|
137
137
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
work dash
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
A keyboard-driven terminal UI built with [Ink](https://github.com/vadimdemedes/ink) and an embedded `node-pty` + `@xterm/headless` Claude Code session per worktree. Five panes, one focus model, zero context switching.
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
┌──────────────────────────────┬─────────────────────────────────────────────────┐
|
|
148
|
-
│ Sessions ▸ │ api · feature/login │
|
|
149
|
-
│ ▸ api · feature/login ● │ │
|
|
150
|
-
│ api · main │ > Implement the login page using the existing │
|
|
151
|
-
│ web · feat/dark-mode ● │ auth helpers... │
|
|
152
|
-
│ ──────────────────────────── │ │
|
|
153
|
-
│ Pull Requests │ ✓ Reading src/auth/AuthContext.tsx │
|
|
154
|
-
│ ★ #142 · feature/login ✓ │ ✓ Writing src/pages/login.tsx │
|
|
155
|
-
│ ✎ #138 · feat/dark-mode ✗ │ ✓ dotnet build (0 warnings, 0 errors) │
|
|
156
|
-
│ ──────────────────────────── │ │
|
|
157
|
-
│ Jira │ ⏵ │
|
|
158
|
-
│ In Progress │ │
|
|
159
|
-
│ PROJ-204 · Add 2FA │ │
|
|
160
|
-
│ ──────────────────────────── │ │
|
|
161
|
-
│ Tasks │ │
|
|
162
|
-
│ [ ] Refactor auth module │ │
|
|
163
|
-
│ [x] Document new endpoints │ │
|
|
164
|
-
└──────────────────────────────┴─────────────────────────────────────────────────┘
|
|
165
|
-
tab cycles · n new · d remove · g sync pane · G sync all · enter open · w worktree
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### What the dashboard does
|
|
169
|
-
|
|
170
|
-
- **Session pane** — every worktree as a row with a status indicator (`●` running, `○` idle, `▸` currently focused). Reactive to external `work tree` invocations via `fs.watch` on `history.json`.
|
|
171
|
-
- **PR pane** — open PRs across every configured repo via `gh pr list`. Decorated with check status (`✓` / `✗` / `●`), merge-conflict detection, your review state (`✔` approved, `✎` reviewed), draft dimming, and ownership (`★` your PR). Selecting a PR creates or resumes its worktree.
|
|
172
|
-
- **Jira pane** — issues assigned to you, grouped by status, fetched via `acli`. Selecting an issue prompts for project, generates a branch slug via Claude Haiku, creates the worktree, and sends a structured planning prompt to Claude. `o` opens the issue in your browser.
|
|
173
|
-
- **Tasks pane** — local tasks from `~/.work/tasks.json`. Press `a` to add, `e` to edit, `enter`/`x` to toggle, `d` to remove, `w` to spin up a `todo/<slug>` worktree.
|
|
174
|
-
- **Terminal pane** — the live Claude Code PTY for the focused session. Resumes prior conversations via `--continue`. Mouse scroll, Shift+drag for text selection.
|
|
175
|
-
- **Auto-sync on startup** — every repo remote fetched in parallel; PRs and Jira issues loaded immediately. `g` syncs the focused pane, `G` syncs everything.
|
|
176
|
-
- **Hook integration** — a local HTTP server (`tui/hooks.ts`) receives Claude Code lifecycle events (Stop, Notification, UserPromptSubmit) so session activity is reflected in real time. Hooks are auto-injected into `~/.claude/settings.json` on launch and cleaned up on exit.
|
|
177
|
-
- **Context-sensitive status bar** — keybinding hints change based on the focused pane.
|
|
178
|
-
|
|
179
|
-
### Keyboard reference
|
|
180
|
-
|
|
181
|
-
| Key | Action |
|
|
182
|
-
|:---|:---|
|
|
183
|
-
| `tab` | Cycle focus: sessions → PRs → Jira → tasks → terminal |
|
|
184
|
-
| `j` / `k` | Navigate within the focused pane |
|
|
185
|
-
| `enter` | Open / resume the selected item |
|
|
186
|
-
| `n` | New worktree (project + branch picker) |
|
|
187
|
-
| `d` | Remove the selected worktree |
|
|
188
|
-
| `w` | Create worktree from selected task / PR / Jira issue |
|
|
189
|
-
| `a` / `e` | Add or edit task (tasks pane) |
|
|
190
|
-
| `g` / `G` | Sync focused pane / sync everything |
|
|
191
|
-
| `u` | Rebase current worktree onto its base |
|
|
192
|
-
| `.` | Open worktree in editor |
|
|
193
|
-
| `o` | Open Jira issue in browser |
|
|
194
|
-
|
|
195
|
-
---
|
|
138
|
+
> **`work dash` was removed in 2.0** — use `work web` (the browser dashboard) and `work attach` (a real terminal on any session; the same Claude the browser shows).
|
|
196
139
|
|
|
197
140
|
## Browser Dashboard (`work web`)
|
|
198
141
|
|
|
@@ -206,13 +149,31 @@ work web --stop # shut the dashboard down
|
|
|
206
149
|
|
|
207
150
|
- **Singleton** — one process per user, tracked by `~/.work/web.pid` + `~/.work/web.url`. A second `work web` re-uses the running one instead of spawning a duplicate; the port is chosen deterministically from the configured `portRange` (default `3000–3099`) with a liveness probe so it survives restarts and avoids collisions.
|
|
208
151
|
- **Every session in one place** — the sidebar lists all worktree sessions with activity badges (active / idle / stale) and per-session comment/draft counts, reactive to `work tree` / `work remove` anywhere on the machine.
|
|
209
|
-
- **Per-session tabs** — a **Diff** tab (Uncommitted vs HEAD,
|
|
152
|
+
- **Per-session tabs** — a **Diff** tab (Uncommitted vs HEAD, "Since branch", and **Last turn** — only what Claude's most recent instruction changed, with a picker for earlier turns). On the Uncommitted diff, **↶ Revert** on a file or hunk undoes it back to HEAD and leaves Claude a note not to reintroduce it; **Start review** batches comments as drafts and **Submit review** sends them to Claude as one message (pushed straight into an idle Claude in the Terminal tab); **]** / **[** jump between comment threads, a **Comments** review tab, and a live **Terminal** tab (the session's Claude in the PTY host — `work attach` opens the same one in a real terminal).
|
|
210
153
|
- **Top panes** — PRs (via `gh`), Jira (via `acli`), and Tasks — with create / sync / rebase / open-in-editor actions wired to `POST /api/worktrees` and friends.
|
|
211
154
|
- **One server, every `wd` scope** — every `wd` and `wd -c` invocation registers as a *scope* on this server (addressable at `/diff/<hash>` and `/review/<hash>`) instead of spawning its own port. A dozen reviews share one process and one set of tabs.
|
|
212
155
|
- **Hook bridge to live Claude** — on startup `work web` installs `UserPromptSubmit` and `Stop` command hooks in `~/.claude/settings.json` (removed on shutdown). Drop a comment on a line and any Claude running in that worktree picks it up on its next turn — no copy-paste.
|
|
213
156
|
|
|
214
157
|
---
|
|
215
158
|
|
|
159
|
+
### Demo mode
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
work web --demo # or: npm run demo
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Opens the real dashboard against a simulated world — example repos, agents that finish and ask for permission while you watch, PRs, Jira and tasks — with nothing real behind it: no repos, agents or `~/.work` are touched, and it runs beside your real `work web`. Use it for screenshots, UI work and showing the tool to someone. Everything you do has a simulated effect: answer a blocked agent in its terminal, leave a review comment (Claude replies), ship a group in parts.
|
|
166
|
+
|
|
167
|
+
### Attention inbox
|
|
168
|
+
|
|
169
|
+
With ten agents running, the question is which one needs you next. The **Inbox** tab (`g i`) answers it, using Claude Code's own hooks — `work web` installs them, so it covers every Claude in any terminal:
|
|
170
|
+
|
|
171
|
+
- **Needs your input** — blocked on a permission prompt, longest-waiting first. Opens on the terminal so you can answer.
|
|
172
|
+
- **Done — not looked at yet** — finished a turn since you last opened it. Opens on the diff to review.
|
|
173
|
+
- **Working** — mid-turn, with the prompt it's working on.
|
|
174
|
+
|
|
175
|
+
Each row carries one line of context (the permission request, Claude's last message, or your prompt). The sidebar sorts the same way, the Inbox tab shows a count, and so does the browser tab title (`(3) work`). Press **`n`** anywhere to jump to the next session that wants you. With `notifications: true`, you also get a desktop notification when a session blocks or finishes — and your `statusHooks` run.
|
|
176
|
+
|
|
216
177
|
## Fleet Commands (`run` / `broadcast`)
|
|
217
178
|
|
|
218
179
|
Once you have several worktrees open, you often want to do *one thing* to *all of them*. Two commands fan out across the fleet.
|
|
@@ -364,6 +325,7 @@ Stored at `~/.work/config.json`:
|
|
|
364
325
|
"aiCommand": "claude",
|
|
365
326
|
"editor": "code",
|
|
366
327
|
"portRange": { "start": 3000, "end": 3099 },
|
|
328
|
+
"devCommands": { "web": "npm run dev -- --port $PORT" },
|
|
367
329
|
"notifications": false,
|
|
368
330
|
"statusHooks": [
|
|
369
331
|
{ "on": "needs_input", "command": "afplay /System/Library/Sounds/Glass.aiff" }
|
|
@@ -380,82 +342,54 @@ Stored at `~/.work/config.json`:
|
|
|
380
342
|
| `aiCommand` | The AI CLI to auto-launch (default `claude`). Set it to any other tool; per-tool flag names live under `aiCommandFlags`. |
|
|
381
343
|
| `editor` | Editor command for `--open` / "open in editor" (default `code`). |
|
|
382
344
|
| `portRange` | Port window `work web` allocates from (default `3000`–`3099`). |
|
|
345
|
+
| `prWatch` | `{ "autoArchive": true, "fixCi": true, "reviewComments": true }` (all default on). **Review comments:** new feedback on an open PR (unresolved review threads, reviews and comments by others — never your own) is handed to that session's Claude to address; threads still open when watching starts count too, old conversation doesn't. Claude doesn't post on GitHub; if a comment needs your call it starts its reply with `DECISION NEEDED:` and the session lands in the Inbox as *needs input* with a notification. The header shows the number of open review threads. `work web` checks recent sessions' PRs every 3 minutes: a session whose PRs have all merged (with nothing since) archives itself — in a group only once every repo is done — and when a PR's checks fail, that session's Claude is told which ones (once per pushed commit) and asked to fix them, or to ask you if it needs a decision. The session header shows failing checks with **Ask Claude to fix**. |
|
|
346
|
+
| `devCommands` | Dev-server command per repo alias, e.g. `{ "web": "npm run dev -- --port $PORT" }`. The session header shows the worktree's `$PORT`, whether anything serves on it (with a **Preview ↗** link), and **▶ Start dev** / **■ Stop** / **Log** for this command. In a group, the first repo with a command gets the port. |
|
|
383
347
|
| `notifications` | Opt-in desktop notification when a session goes idle or needs input. |
|
|
384
348
|
| `statusHooks` | Run your own shell command on a session status change — see below. |
|
|
349
|
+
| `launchViaHost` | Default `true`: `work tree` runs the AI session in the background PTY host and attaches your terminal to it, so it survives closing the tab, `work web` shows the very same screen, and it comes back after a reboot. Detach with Ctrl+]; `work attach` reconnects. Set `false` to launch directly in the terminal (invisible to the dashboard); per call: `--host` / `--no-host`. |
|
|
385
350
|
|
|
386
351
|
Edit via `work config edit`, or manage repos/groups via the `work config …` subcommands.
|
|
387
352
|
|
|
388
353
|
### Notifications & status hooks
|
|
389
354
|
|
|
390
|
-
When a background AI session finishes its turn (`idle`) or blocks waiting on you (`needs_input`), Work can let you know:
|
|
355
|
+
When a background AI session finishes its turn (`idle`) or blocks waiting on you (`needs_input`), Work can let you know — `work web` does it via its Claude hooks, for any Claude on the machine:
|
|
391
356
|
|
|
357
|
+
- **Only when you're not looking.** Nothing fires for a session a focused dashboard tab is showing. Click **Enable notifications** on the Inbox tab and the dashboard raises browser notifications instead — clicking one jumps to that session (the terminal if it's asking you something, the diff if it finished). The desktop toast below is the fallback for when no dashboard tab can notify.
|
|
392
358
|
- **`notifications: true`** — fires a native desktop notification (macOS `osascript`, Linux `notify-send`, Windows BurntToast/balloon best-effort). Repeated alerts within one idle period are de-duplicated; submitting a new prompt re-arms it.
|
|
393
359
|
- **`statusHooks`** — the general form. Each entry is `{ "on": "idle" | "needs_input", "command": "..." }`. The command runs (with the session directory as cwd) on that transition, with `WORK_SESSION` and `WORK_STATUS` in its environment — use it for sounds, Slack pings, or anything scriptable.
|
|
394
360
|
|
|
395
361
|
### Session tracking
|
|
396
362
|
|
|
397
|
-
Every `work tree` invocation upserts a row into `~/.work/
|
|
363
|
+
Every `work tree` invocation upserts a row into `~/.work/state.db` (SQLite) keyed by `target + branch`. This powers:
|
|
398
364
|
|
|
399
365
|
- **`work status`** — joins history with live `git status` to show merge state, dirty trees, unpushed commits, and last-access timestamps.
|
|
400
366
|
- **`work recent`** — sessions sorted by last touched.
|
|
401
367
|
- **`work resume`** — interactive picker; one keystroke to re-enter the worktree and continue the prior AI conversation.
|
|
402
368
|
- **`work prune` / `work sync`** — `prune` interactively removes worktrees whose branches landed on `main`/`master`; `work sync` does the same non-interactively after fetching every repo in parallel (`--dry-run` to preview, `--force` to include dirty/unpushed trees, `--include-squash` to also catch squash-merged branches).
|
|
403
|
-
- **Dashboard reactivity** —
|
|
369
|
+
- **Dashboard reactivity** — every write bumps a change counter the running `work web` polls, so a `work tree` in another terminal shows up in the dashboard within a second.
|
|
370
|
+
|
|
371
|
+
All session state (history, status, review comments, restore list, tasks) lives in that one database, so the CLI, Claude's hooks, `work web` and the PTY host can all write at once without losing updates. Upgrading from a version with JSON files imports them on first run and keeps the originals as `*.migrated`. `work state` shows what's stored; `work state --export <dir>` writes it back out as the old JSON files.
|
|
404
372
|
|
|
405
373
|
---
|
|
406
374
|
|
|
407
375
|
## Architecture
|
|
408
376
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
├── core/tasks.ts ← local task persistence
|
|
420
|
-
├── core/pr.ts ← GitHub PR fetching (gh)
|
|
421
|
-
├── core/jira.ts ← Jira issue fetching (acli)
|
|
422
|
-
├── core/fleet.ts ← run/broadcast session selection
|
|
423
|
-
├── core/broadcast.ts ← queue a prompt to live sessions
|
|
424
|
-
├── core/notifier.ts ← desktop notifications
|
|
425
|
-
├── core/status-hooks.ts ← user shell hooks on status change
|
|
426
|
-
└── core/port-allocator.ts← deterministic free-port pick
|
|
427
|
-
|
|
428
|
-
Diff / review stack ← `wd` + `work web`
|
|
429
|
-
├── diff-pipeline.ts ← computeDiff(): git diff + untracked + lcov
|
|
430
|
-
├── diff-parse.ts ← unified-diff parser
|
|
431
|
-
├── checkpoint.ts ← per-scope working-tree snapshots
|
|
432
|
-
├── lcov.ts ← coverage parsing (cached)
|
|
433
|
-
├── diff-server.ts ← shared Hono server (chokidar + SSE)
|
|
434
|
-
├── comment-*.ts ← review comment model + file store
|
|
435
|
-
├── scope-manager.ts ← in-memory scope registry
|
|
436
|
-
└── static-renderer.ts ← self-contained HTML (`wd --static`)
|
|
437
|
-
|
|
438
|
-
web/src/ ← React SPA (Vite → dist/web/)
|
|
439
|
-
├── apps/ReviewApp.tsx ← single-scope view (wd / wd -c)
|
|
440
|
-
├── apps/DashboardApp.tsx ← multi-session view (work web)
|
|
441
|
-
└── components/ ← Diff/, Review/, Sidebar/, Terminal/
|
|
442
|
-
|
|
443
|
-
core/web-server.ts ← `work web` dashboard (Hono + SSE + WS)
|
|
444
|
-
├── scope-routes / panes-routes / worktree-routes / *-comment-routes
|
|
445
|
-
├── pty-pool.ts ← per-session Claude PTY pool
|
|
446
|
-
└── command-hook-installer.ts ← UserPromptSubmit/Stop hooks
|
|
447
|
-
|
|
448
|
-
tui-ink/ ← Ink/React TUI (`work dash`)
|
|
449
|
-
└── App / Sidebar / TerminalPane / StatusBar
|
|
450
|
-
|
|
451
|
-
tui/session.ts ← node-pty + @xterm/headless (shared)
|
|
452
|
-
```
|
|
377
|
+
Three kinds of process: the `work` CLI, the `work web` dashboard server (one
|
|
378
|
+
per user), and the PTY host that owns every agent's terminal, so agents
|
|
379
|
+
survive dashboard restarts and reboots. All logic lives in `src/core/`,
|
|
380
|
+
grouped by feature; the CLI (`src/commands/`) and the HTTP server
|
|
381
|
+
(`src/server/`) are thin front-ends over it. Session state is one SQLite
|
|
382
|
+
database, `~/.work/state.db`.
|
|
383
|
+
|
|
384
|
+
**[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)** has the overview: processes,
|
|
385
|
+
source layout, state, the agent interface, one turn end to end, the security
|
|
386
|
+
model. The decisions behind it are in [docs/adr/](docs/adr/README.md).
|
|
453
387
|
|
|
454
388
|
### Design principles
|
|
455
389
|
|
|
456
390
|
| Principle | What it means |
|
|
457
391
|
|:---|:---|
|
|
458
|
-
| **Atomic worktree operations** | `setupWorktree()` and `teardownWorktree()` are the high-level entry points used by both the CLI and
|
|
392
|
+
| **Atomic worktree operations** | `setupWorktree()` and `teardownWorktree()` are the high-level entry points used by both the CLI and `work web`. Low-level `createSingleWorktree()` rolls back on partial failure. |
|
|
459
393
|
| **Resolver pattern** | One name (`api`, `fullstack`) is dispatched through `resolveProjectTarget()` to either a group or a single repo. Commands branch on `isGroup` once and delegate. |
|
|
460
394
|
| **Branch resolution priority** | Local exists → remote exists (tracking branch) → neither (new branch from base). |
|
|
461
395
|
| **Path normalisation** | `feature/login` → `feature-login` directory. Always. |
|
|
@@ -487,39 +421,19 @@ Completions are dynamic — branch names come from the worktree directory listin
|
|
|
487
421
|
## Development
|
|
488
422
|
|
|
489
423
|
```bash
|
|
490
|
-
npm run build
|
|
491
|
-
npm run
|
|
492
|
-
npm test # Run all tests with vitest
|
|
493
|
-
npm run test:watch # Watch mode
|
|
494
|
-
npx vitest run tests/core/resolve.test.ts # Single test file
|
|
424
|
+
npm ci && npm run build && npm link # `work` and `wd` from this checkout
|
|
425
|
+
npm run typecheck && npm run lint && npm test
|
|
495
426
|
```
|
|
496
427
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
```
|
|
502
|
-
work-tree/
|
|
503
|
-
├── src/
|
|
504
|
-
│ ├── bin.ts # Entry point (chalk forcing, shebang)
|
|
505
|
-
│ ├── cli.ts # yargs router
|
|
506
|
-
│ ├── commands/ # CLI command handlers
|
|
507
|
-
│ ├── core/ # Shared operations (worktree, git, history, diff, web, …)
|
|
508
|
-
│ ├── web/ # React SPA — diff/review UI + work web dashboard (Vite → dist/web/)
|
|
509
|
-
│ ├── tui-ink/ # Ink/React TUI dashboard
|
|
510
|
-
│ ├── tui/ # PTY sessions and hook server
|
|
511
|
-
│ ├── completions/ # Dynamic tab-completion handler
|
|
512
|
-
│ └── utils/
|
|
513
|
-
├── tests/ # vitest suites
|
|
514
|
-
├── tsup.config.ts
|
|
515
|
-
└── package.json
|
|
516
|
-
```
|
|
428
|
+
See **[CONTRIBUTING.md](CONTRIBUTING.md)** for the checks, where code goes, and
|
|
429
|
+
how releases work; [CHANGELOG.md](CHANGELOG.md) for what changed;
|
|
430
|
+
[SECURITY.md](SECURITY.md) to report a vulnerability.
|
|
517
431
|
|
|
518
432
|
---
|
|
519
433
|
|
|
520
434
|
## Unsafe Mode & Debug Logging
|
|
521
435
|
|
|
522
|
-
`--unsafe` on `work tree
|
|
436
|
+
`--unsafe` on `work tree` or `work resume` passes the AI tool's skip-permissions flag (`--dangerously-skip-permissions` for Claude Code; configurable per tool via `aiCommandFlags`) — useful in trusted, sandboxed worktrees, dangerous everywhere else. Use deliberately.
|
|
523
437
|
|
|
524
438
|
All CLI output and internal debug messages stream to `~/.work/debug.log` with timestamps. Auto-rotates at 5 MB. The first place to look when worktree creation, group CLAUDE.md generation, or hook delivery misbehaves.
|
|
525
439
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
pendingRequest
|
|
4
|
+
} from "./chunk-RYNBBSLY.js";
|
|
5
|
+
import {
|
|
6
|
+
sessionFromArgs,
|
|
7
|
+
sessionPositionals
|
|
8
|
+
} from "./chunk-HSICXDMZ.js";
|
|
9
|
+
import "./chunk-6AQRYLOB.js";
|
|
10
|
+
import {
|
|
11
|
+
callWorkWeb
|
|
12
|
+
} from "./chunk-3JWTO5VZ.js";
|
|
13
|
+
import "./chunk-WF5SBVPZ.js";
|
|
14
|
+
import "./chunk-ZSHWP2VS.js";
|
|
15
|
+
import "./chunk-5QK7GB5K.js";
|
|
16
|
+
import "./chunk-HUXS3VAI.js";
|
|
17
|
+
import {
|
|
18
|
+
readStatus
|
|
19
|
+
} from "./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/answer.ts
|
|
30
|
+
import chalk from "chalk";
|
|
31
|
+
var answerCommand = {
|
|
32
|
+
command: "answer [target] [branch]",
|
|
33
|
+
describe: "Show the permission prompt a session's agent waits on; --allow or --deny answers it",
|
|
34
|
+
builder: (yargs) => sessionPositionals(yargs).option("allow", { type: "boolean", default: false, describe: "Approve the tool call it asks about" }).option("deny", { type: "boolean", default: false, describe: "Refuse it (the agent stops and waits for you)" }).check((a) => !(a.allow && a.deny) || "Either --allow or --deny, not both"),
|
|
35
|
+
handler: async (argv) => {
|
|
36
|
+
const s = sessionFromArgs(argv);
|
|
37
|
+
if (!s) return;
|
|
38
|
+
const id = sessionIdFor(s);
|
|
39
|
+
const request = pendingRequest(readStatus(id));
|
|
40
|
+
if (!request) {
|
|
41
|
+
console.error(chalk.yellow(`${s.target} \xB7 ${s.branch} isn't waiting on a permission prompt.`));
|
|
42
|
+
process.exitCode = 1;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const what = `${request.tool}: ${request.detail}`;
|
|
46
|
+
if (!argv.allow && !argv.deny) {
|
|
47
|
+
console.log(what);
|
|
48
|
+
console.error(chalk.gray("Answer with --allow or --deny."));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const r = await callWorkWeb("POST", `/api/sessions/${id}/answer`, { answer: argv.allow ? "allow" : "deny", request });
|
|
52
|
+
if (!r.ok) {
|
|
53
|
+
console.error(chalk.red(r.error));
|
|
54
|
+
process.exitCode = 1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
console.log(`${argv.allow ? "Allowed" : "Denied"}: ${what}`);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
answerCommand
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=answer-2J4XLIP7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/answer.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { callWorkWeb } from '../core/platform/web-discovery.js';\nimport { sessionIdFor } from '../core/sessions/session-id.js';\nimport { readStatus } from '../core/status/session-status.js';\nimport { pendingRequest } from '../core/sessions/session-control.js';\nimport { sessionFromArgs, sessionPositionals } from './shared/session-arg.js';\n\n/**\n * `work answer` — the permission prompt a session's agent is waiting on:\n * shows it, and with --allow / --deny answers it (the inbox's Allow / Deny:\n * POST …/answer, which first checks the dialog on its screen is that very\n * request). Never put this on an allow list: approving another agent's tool\n * call is yours to say, so Claude Code should ask you every time.\n */\nexport const answerCommand: CommandModule = {\n command: 'answer [target] [branch]',\n describe: \"Show the permission prompt a session's agent waits on; --allow or --deny answers it\",\n builder: (yargs) =>\n sessionPositionals(yargs)\n .option('allow', { type: 'boolean', default: false, describe: 'Approve the tool call it asks about' })\n .option('deny', { type: 'boolean', default: false, describe: 'Refuse it (the agent stops and waits for you)' })\n .check((a) => !(a.allow && a.deny) || 'Either --allow or --deny, not both'),\n handler: async (argv) => {\n const s = sessionFromArgs(argv);\n if (!s) return;\n const id = sessionIdFor(s);\n const request = pendingRequest(readStatus(id));\n if (!request) {\n console.error(chalk.yellow(`${s.target} · ${s.branch} isn't waiting on a permission prompt.`));\n process.exitCode = 1;\n return;\n }\n const what = `${request.tool}: ${request.detail}`;\n if (!argv.allow && !argv.deny) {\n console.log(what);\n console.error(chalk.gray('Answer with --allow or --deny.'));\n return;\n }\n // The request it was shown goes along: the route refuses if the prompt changed meanwhile.\n const r = await callWorkWeb<{ ok: true }>('POST', `/api/sessions/${id}/answer`, { answer: argv.allow ? 'allow' : 'deny', request });\n if (!r.ok) {\n console.error(chalk.red(r.error));\n process.exitCode = 1;\n return;\n }\n console.log(`${argv.allow ? 'Allowed' : 'Denied'}: ${what}`);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAeX,IAAM,gBAA+B;AAAA,EAC1C,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UACR,mBAAmB,KAAK,EACrB,OAAO,SAAS,EAAE,MAAM,WAAW,SAAS,OAAO,UAAU,sCAAsC,CAAC,EACpG,OAAO,QAAQ,EAAE,MAAM,WAAW,SAAS,OAAO,UAAU,gDAAgD,CAAC,EAC7G,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,SAAS,oCAAoC;AAAA,EAC9E,SAAS,OAAO,SAAS;AACvB,UAAM,IAAI,gBAAgB,IAAI;AAC9B,QAAI,CAAC,EAAG;AACR,UAAM,KAAK,aAAa,CAAC;AACzB,UAAM,UAAU,eAAe,WAAW,EAAE,CAAC;AAC7C,QAAI,CAAC,SAAS;AACZ,cAAQ,MAAM,MAAM,OAAO,GAAG,EAAE,MAAM,SAAM,EAAE,MAAM,wCAAwC,CAAC;AAC7F,cAAQ,WAAW;AACnB;AAAA,IACF;AACA,UAAM,OAAO,GAAG,QAAQ,IAAI,KAAK,QAAQ,MAAM;AAC/C,QAAI,CAAC,KAAK,SAAS,CAAC,KAAK,MAAM;AAC7B,cAAQ,IAAI,IAAI;AAChB,cAAQ,MAAM,MAAM,KAAK,gCAAgC,CAAC;AAC1D;AAAA,IACF;AAEA,UAAM,IAAI,MAAM,YAA0B,QAAQ,iBAAiB,EAAE,WAAW,EAAE,QAAQ,KAAK,QAAQ,UAAU,QAAQ,QAAQ,CAAC;AAClI,QAAI,CAAC,EAAE,IAAI;AACT,cAAQ,MAAM,MAAM,IAAI,EAAE,KAAK,CAAC;AAChC,cAAQ,WAAW;AACnB;AAAA,IACF;AACA,YAAQ,IAAI,GAAG,KAAK,QAAQ,YAAY,QAAQ,KAAK,IAAI,EAAE;AAAA,EAC7D;AACF;","names":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
attachSession
|
|
4
|
+
} from "./chunk-6FTIY5M6.js";
|
|
5
|
+
import "./chunk-AH5TM3NB.js";
|
|
6
|
+
import "./chunk-O3QTWVSK.js";
|
|
7
|
+
import "./chunk-ZJN5RWZD.js";
|
|
8
|
+
import "./chunk-QBAZG4CY.js";
|
|
9
|
+
import {
|
|
10
|
+
baseCheckoutSession
|
|
11
|
+
} from "./chunk-6AQRYLOB.js";
|
|
12
|
+
import "./chunk-SOCPIHCS.js";
|
|
13
|
+
import {
|
|
14
|
+
findSessionForCwd
|
|
15
|
+
} from "./chunk-WF5SBVPZ.js";
|
|
16
|
+
import "./chunk-ZSHWP2VS.js";
|
|
17
|
+
import "./chunk-5QK7GB5K.js";
|
|
18
|
+
import "./chunk-HUXS3VAI.js";
|
|
19
|
+
import {
|
|
20
|
+
findSession,
|
|
21
|
+
loadHistory
|
|
22
|
+
} from "./chunk-M4FVCAT6.js";
|
|
23
|
+
import "./chunk-7NCW3LUT.js";
|
|
24
|
+
import "./chunk-PN44M5EE.js";
|
|
25
|
+
import "./chunk-RCYI7SRA.js";
|
|
26
|
+
import "./chunk-DW4JPVXB.js";
|
|
27
|
+
import "./chunk-N4EYQKSM.js";
|
|
28
|
+
import {
|
|
29
|
+
loadConfig
|
|
30
|
+
} from "./chunk-7HEB6SQS.js";
|
|
31
|
+
|
|
32
|
+
// src/commands/attach.ts
|
|
33
|
+
import chalk from "chalk";
|
|
34
|
+
var attachCommand = {
|
|
35
|
+
command: "attach [target] [branch]",
|
|
36
|
+
aliases: ["a"],
|
|
37
|
+
describe: "Attach this terminal to a session's Claude in the PTY host (Ctrl+] detaches; Claude keeps running)",
|
|
38
|
+
builder: (yargs) => yargs.positional("target", { type: "string", describe: "Repo alias or group (default: session for the current directory)" }).positional("branch", { type: "string", describe: "Branch (default: the target's base checkout)" }),
|
|
39
|
+
handler: async (argv) => {
|
|
40
|
+
const sessions = loadHistory();
|
|
41
|
+
const target = argv.target;
|
|
42
|
+
const branch = argv.branch;
|
|
43
|
+
const session = target ? branch ? findSession(sessions, target, branch) ?? null : baseCheckoutSession(sessions, target, loadConfig()) : findSessionForCwd(process.cwd(), sessions);
|
|
44
|
+
if (!session) {
|
|
45
|
+
console.error(
|
|
46
|
+
chalk.red(
|
|
47
|
+
target ? `No session for ${target}${branch ? ` ${branch}` : " (base checkout)"}. Create it with \`work tree ${target}${branch ? ` ${branch}` : ""}\`.` : "The current directory is not inside a work session. Pass <target> [branch]."
|
|
48
|
+
)
|
|
49
|
+
);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
process.exitCode = await attachSession(session, { forwardEnv: true });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
attachCommand,
|
|
57
|
+
baseCheckoutSession
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=attach-CZKRNPAJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/attach.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { findSession, loadHistory } from '../core/sessions/history.js';\nimport { attachSession } from './shared/attach-session.js';\nimport { loadConfig } from '../core/platform/config.js';\nimport { findSessionForCwd } from '../core/comments/pending-delivery.js';\n\nexport { baseCheckoutSession } from '../core/sessions/session-resolve.js';\nimport { baseCheckoutSession } from '../core/sessions/session-resolve.js';\n\nexport const attachCommand: CommandModule = {\n command: 'attach [target] [branch]',\n aliases: ['a'],\n describe: \"Attach this terminal to a session's Claude in the PTY host (Ctrl+] detaches; Claude keeps running)\",\n builder: (yargs) =>\n yargs\n .positional('target', { type: 'string', describe: 'Repo alias or group (default: session for the current directory)' })\n .positional('branch', { type: 'string', describe: \"Branch (default: the target's base checkout)\" }),\n handler: async (argv) => {\n const sessions = loadHistory();\n const target = argv.target as string | undefined;\n const branch = argv.branch as string | undefined;\n const session = target\n ? branch\n ? (findSession(sessions, target, branch) ?? null)\n : baseCheckoutSession(sessions, target, loadConfig())\n : findSessionForCwd(process.cwd(), sessions);\n if (!session) {\n console.error(\n chalk.red(\n target\n ? `No session for ${target}${branch ? ` ${branch}` : ' (base checkout)'}. Create it with \\`work tree ${target}${branch ? ` ${branch}` : ''}\\`.`\n : 'The current directory is not inside a work session. Pass <target> [branch].',\n ),\n );\n process.exit(1);\n }\n // Spawning here too (session not running yet) uses this shell's env.\n process.exitCode = await attachSession(session, { forwardEnv: true });\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAUX,IAAM,gBAA+B;AAAA,EAC1C,SAAS;AAAA,EACT,SAAS,CAAC,GAAG;AAAA,EACb,UAAU;AAAA,EACV,SAAS,CAAC,UACR,MACG,WAAW,UAAU,EAAE,MAAM,UAAU,UAAU,mEAAmE,CAAC,EACrH,WAAW,UAAU,EAAE,MAAM,UAAU,UAAU,+CAA+C,CAAC;AAAA,EACtG,SAAS,OAAO,SAAS;AACvB,UAAM,WAAW,YAAY;AAC7B,UAAM,SAAS,KAAK;AACpB,UAAM,SAAS,KAAK;AACpB,UAAM,UAAU,SACZ,SACG,YAAY,UAAU,QAAQ,MAAM,KAAK,OAC1C,oBAAoB,UAAU,QAAQ,WAAW,CAAC,IACpD,kBAAkB,QAAQ,IAAI,GAAG,QAAQ;AAC7C,QAAI,CAAC,SAAS;AACZ,cAAQ;AAAA,QACN,MAAM;AAAA,UACJ,SACI,kBAAkB,MAAM,GAAG,SAAS,IAAI,MAAM,KAAK,kBAAkB,gCAAgC,MAAM,GAAG,SAAS,IAAI,MAAM,KAAK,EAAE,QACxI;AAAA,QACN;AAAA,MACF;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,YAAQ,WAAW,MAAM,cAAc,SAAS,EAAE,YAAY,KAAK,CAAC;AAAA,EACtE;AACF;","names":[]}
|