@eliya-oss/agent-diff 0.1.0-alpha.1 → 0.1.0-alpha.100

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 (112) hide show
  1. package/.agents/adr/README.md +3 -0
  2. package/.agents/prd/README.md +2 -2
  3. package/CHANGELOG.md +666 -0
  4. package/README.md +37 -79
  5. package/bin/adiff.js +80 -2
  6. package/dist/main.js +17611 -0
  7. package/package.json +14 -10
  8. package/skills/adiff/SKILL.md +140 -26
  9. package/src/cli/catalog.ts +0 -178
  10. package/src/cli/commands.ts +0 -335
  11. package/src/cli/error.ts +0 -44
  12. package/src/cli/index.ts +0 -24
  13. package/src/cli/parse.ts +0 -31
  14. package/src/cli/report.ts +0 -96
  15. package/src/cli/story.ts +0 -223
  16. package/src/domain/narrative/coverage.ts +0 -54
  17. package/src/domain/narrative/index.ts +0 -4
  18. package/src/domain/narrative/model.ts +0 -46
  19. package/src/domain/narrative/version.ts +0 -63
  20. package/src/domain/patch/anchor.ts +0 -40
  21. package/src/domain/patch/index.ts +0 -7
  22. package/src/domain/patch/model.ts +0 -54
  23. package/src/domain/patch/parse.ts +0 -106
  24. package/src/domain/patch/render.ts +0 -48
  25. package/src/domain/patch/sticky.ts +0 -39
  26. package/src/domain/review/index.ts +0 -4
  27. package/src/domain/review/lifecycle.ts +0 -45
  28. package/src/domain/review/model.ts +0 -23
  29. package/src/domain/review/vouch.ts +0 -15
  30. package/src/main.ts +0 -186
  31. package/src/service/git/error.ts +0 -16
  32. package/src/service/git/index.ts +0 -3
  33. package/src/service/git/model.ts +0 -13
  34. package/src/service/git/run.ts +0 -27
  35. package/src/service/git/service.ts +0 -133
  36. package/src/service/store/error.ts +0 -11
  37. package/src/service/store/index.ts +0 -5
  38. package/src/service/store/model.ts +0 -33
  39. package/src/service/store/paths.ts +0 -25
  40. package/src/service/store/service.ts +0 -154
  41. package/src/testing/agent-surface.test.ts +0 -92
  42. package/src/testing/batch.test.ts +0 -93
  43. package/src/testing/branch-state.test.ts +0 -99
  44. package/src/testing/chrome-tone.test.ts +0 -57
  45. package/src/testing/comment-block.test.ts +0 -84
  46. package/src/testing/comment-walk.test.ts +0 -96
  47. package/src/testing/compose-box.test.ts +0 -97
  48. package/src/testing/compose.test.ts +0 -67
  49. package/src/testing/context.test.ts +0 -77
  50. package/src/testing/cursor.test.ts +0 -49
  51. package/src/testing/delivery.test.ts +0 -94
  52. package/src/testing/domains/agent/driver.ts +0 -50
  53. package/src/testing/domains/agent/index.ts +0 -2
  54. package/src/testing/domains/app/driver.ts +0 -168
  55. package/src/testing/domains/app/index.ts +0 -2
  56. package/src/testing/domains/branch/driver.ts +0 -51
  57. package/src/testing/domains/branch/index.ts +0 -3
  58. package/src/testing/domains/branch/model.ts +0 -39
  59. package/src/testing/domains/screen/driver.ts +0 -241
  60. package/src/testing/domains/screen/index.ts +0 -2
  61. package/src/testing/driver.ts +0 -31
  62. package/src/testing/escape.test.ts +0 -56
  63. package/src/testing/focus.test.ts +0 -104
  64. package/src/testing/footer-chips.test.ts +0 -65
  65. package/src/testing/footer.test.ts +0 -64
  66. package/src/testing/gaps.test.ts +0 -47
  67. package/src/testing/highlight.test.ts +0 -49
  68. package/src/testing/home-screen.test.ts +0 -51
  69. package/src/testing/index.ts +0 -4
  70. package/src/testing/inline-comments.test.ts +0 -131
  71. package/src/testing/marks.test.ts +0 -49
  72. package/src/testing/mouse.test.ts +0 -87
  73. package/src/testing/navigate.test.ts +0 -73
  74. package/src/testing/palette.test.ts +0 -68
  75. package/src/testing/pending.test.ts +0 -70
  76. package/src/testing/pin-align.test.ts +0 -37
  77. package/src/testing/progress.test.ts +0 -88
  78. package/src/testing/report.test.ts +0 -83
  79. package/src/testing/resume.test.ts +0 -39
  80. package/src/testing/review.test.ts +0 -181
  81. package/src/testing/roundtrip.test.ts +0 -70
  82. package/src/testing/scale.test.ts +0 -55
  83. package/src/testing/scroll-feel.test.ts +0 -81
  84. package/src/testing/sent-comments.test.ts +0 -106
  85. package/src/testing/state.ts +0 -55
  86. package/src/testing/sticky-removed.test.ts +0 -67
  87. package/src/testing/sticky.test.ts +0 -90
  88. package/src/testing/story-rail.test.ts +0 -122
  89. package/src/testing/story.test.ts +0 -183
  90. package/src/testing/stress.test.ts +0 -74
  91. package/src/testing/tree-collapse.test.ts +0 -108
  92. package/src/testing/tree-rows.test.ts +0 -66
  93. package/src/testing/tree.test.ts +0 -91
  94. package/src/testing/tui.test.ts +0 -73
  95. package/src/testing/typing.test.ts +0 -65
  96. package/src/testing/vouch-next.test.ts +0 -65
  97. package/src/testing/vouch-tui.test.ts +0 -77
  98. package/src/testing/wash.test.ts +0 -32
  99. package/src/testing/width.test.ts +0 -62
  100. package/src/tui/app.ts +0 -467
  101. package/src/tui/command.ts +0 -390
  102. package/src/tui/diffview.ts +0 -333
  103. package/src/tui/index.ts +0 -9
  104. package/src/tui/marks.ts +0 -102
  105. package/src/tui/match.ts +0 -34
  106. package/src/tui/model.ts +0 -310
  107. package/src/tui/reduce.ts +0 -305
  108. package/src/tui/render.ts +0 -897
  109. package/src/tui/report.ts +0 -74
  110. package/src/tui/session.ts +0 -32
  111. package/src/tui/theme.ts +0 -61
  112. package/src/tui/tree.ts +0 -149
package/package.json CHANGED
@@ -2,26 +2,29 @@
2
2
  "name": "@eliya-oss/agent-diff",
3
3
  "type": "module",
4
4
  "devDependencies": {
5
- "@effect/vitest": "^4.0.0-beta.102",
5
+ "@effect/tsgo": "^0.31.0",
6
+ "@effect/vitest": "^4.0.0-rc.110",
6
7
  "@types/node": "^26.1.2",
7
- "oxlint": "^1.76.0",
8
+ "effect": "^4.0.0-rc.110",
9
+ "oxlint": "1.77.0",
10
+ "oxlint-tsgolint": "^7.0.2001",
11
+ "rolldown": "^1.2.1",
8
12
  "vitest": "^4.1.10"
9
13
  },
10
14
  "peerDependencies": {
11
15
  "typescript": "^7.0.2"
12
16
  },
13
17
  "dependencies": {
14
- "@opentui/core": "^0.4.5",
15
- "effect": "^4.0.0-beta.102"
18
+ "@opentui/core": "^0.4.5"
16
19
  },
17
20
  "engines": {
18
- "node": ">=26"
21
+ "node": ">=22"
19
22
  },
20
23
  "bin": {
21
24
  "adiff": "./bin/adiff.js"
22
25
  },
23
- "version": "0.1.0-alpha.1",
24
- "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
26
+ "version": "0.1.0-alpha.100",
27
+ "description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
25
28
  "license": "MIT",
26
29
  "repository": {
27
30
  "type": "git",
@@ -29,7 +32,7 @@
29
32
  },
30
33
  "files": [
31
34
  "bin",
32
- "src",
35
+ "dist",
33
36
  "skills",
34
37
  "README.md"
35
38
  ],
@@ -37,9 +40,10 @@
37
40
  "access": "public"
38
41
  },
39
42
  "scripts": {
40
- "check": "pnpm run typecheck && pnpm run lint && pnpm test",
43
+ "check": "pnpm run typecheck && pnpm run lint && pnpm run build && pnpm test",
44
+ "build": "rolldown -c rolldown.config.ts",
41
45
  "typecheck": "tsc --noEmit",
42
- "lint": "oxlint && node scripts/check-style.ts",
46
+ "lint": "oxlint && node scripts/check-rules.ts",
43
47
  "test": "NODE_OPTIONS=--experimental-ffi vitest run",
44
48
  "test:watch": "NODE_OPTIONS=--experimental-ffi vitest",
45
49
  "dev": "node --experimental-ffi --disable-warning=ExperimentalWarning src/main.ts",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: adiff
3
- description: Pick up review comments left on this worktree's diff in the adiff terminal, act on them, and write the story that explains the diff. Use when the user says they left comments, asks you to check adiff, asks you to watch for review feedback, or asks you to hand work over for review.
3
+ description: Pick up review comments left on this worktree's diff in the adiff terminal, act on them, and answer them by id. Use when the user says they left comments, asks you to check adiff, asks you to watch for review feedback, or asks you to hand work over for review.
4
4
  ---
5
5
 
6
6
  # adiff
@@ -24,7 +24,9 @@ Each comment carries the code it is about. `snippet` is the exact text the revie
24
24
  `side` says whether the line numbers are in the new file (`new`) or the version being replaced
25
25
  (`old`), and `head` is the commit the diff was read at.
26
26
 
27
- A comment is handed over exactly once. A second `take` returns only what was written since.
27
+ A comment keeps coming back until it is answered. A second `take` returns it again, so answer what
28
+ you take. Settling or removing it also retires it: those are the reviewer saying they no longer
29
+ need one.
28
30
 
29
31
  ## Wait for the next one
30
32
 
@@ -35,6 +37,59 @@ adiff comment take --worktree . --wait 300
35
37
  Blocks until a comment arrives or the timeout in seconds elapses, then returns the same envelope.
36
38
  An empty `comments` array means the wait expired with nothing new — that is not an error.
37
39
 
40
+ Run the wait in the background, not in the foreground. A foreground wait holds the turn, so you
41
+ cannot do anything else and the person you are working with cannot talk to you. Backgrounded, the
42
+ harness brings you back the moment a comment lands.
43
+
44
+ Keep one wait per worktree. A second wait returns the same comments as the first, so two of them
45
+ running at once is two of you answering the same comment. Before starting one, check whether one is
46
+ already running.
47
+
48
+ Re-arm it after each comment you handle, and keep it running while you work. A reviewer reads at
49
+ their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
50
+ events rather than by you asking. When you finish a piece of work, say you are still listening.
51
+
52
+ ## Answering a comment
53
+
54
+ Say what you did, against the comment you were handed:
55
+
56
+ ```bash
57
+ adiff comment answer --worktree . --id <id> --body "Dropped it, and the import with it."
58
+ ```
59
+
60
+ The id comes from `comment take`. The reviewer sees the answer under their own words the next time
61
+ they read the branch, so this is how they learn a point was addressed rather than ignored.
62
+
63
+ Answer when the change alone does not carry the reasoning: what you did instead of what was asked,
64
+ what you found while doing it, or why the comment does not apply. A comment that asked a question
65
+ deserves an answer even when nothing changed.
66
+
67
+ Add `--question` when you need the reviewer to decide before you continue:
68
+
69
+ ```bash
70
+ adiff comment answer --worktree . --id <id> --question --body "Drop it, or keep it and map the error?"
71
+ ```
72
+
73
+ That marks the thread as waiting on them rather than on you. Do not use it to check in; use it when
74
+ the work genuinely stops without an answer.
75
+
76
+ ## When the reviewer writes back
77
+
78
+ A reviewer can reply to an answer, and the reply arrives through `comment take` like any other
79
+ comment — with an `id` of its own that you answer against, and a `thread` carrying what was said
80
+ before it, oldest first:
81
+
82
+ ```json
83
+ {"body":"the imports","replyTo":"c1","thread":[{"voice":"reviewer","body":"why two of these"},{"voice":"agent","body":"which two did you mean"}]}
84
+ ```
85
+
86
+ Read the thread before answering. A reply is usually short because it is the rest of a sentence you
87
+ already have: "the imports" only means something next to the question it answers. Answer it against
88
+ its own id, not the id of the comment that started the thread.
89
+
90
+ Settling a thread is the reviewer's to do, not yours. They raised the point, so they decide it is
91
+ closed.
92
+
38
93
  ## Acting on a comment
39
94
 
40
95
  Read `snippet` before opening the file: the reviewer commented on the diff, and the file may have
@@ -54,25 +109,75 @@ Failures go to **stderr**, never stdout, so stdout is always safe to parse. The
54
109
  what kind of problem it is: `2` the request was malformed, `3` the branch or file does not exist,
55
110
  `1` something unexpected.
56
111
 
112
+ Every command that acts on a review takes either `--worktree <path>` or `--repo <path>` with
113
+ `--branch <name>`. Standing in the worktree, `--worktree .` is always enough.
114
+
57
115
  Read `suggestion` before doing anything else — it names the command that resolves the failure.
58
116
  Retry only when `retriable` is true. `UnknownBranch` means this worktree is not one adiff knows
59
117
  about, because the reviewer has not opened it; report that rather than looping.
60
118
 
61
- ## Handing work over: write the story
119
+ ## Handing work over
120
+
121
+ Finishing is not a reason to publish anything. Say the work is ready, put the review in front of
122
+ them if they asked for one, and say how to read it. That is the whole handover. A reading order is
123
+ extra work you do on request, and it has its own section further down.
124
+
125
+ ## Put the review in front of them
126
+
127
+ When someone asks you for a review, open it rather than describing how:
128
+
129
+ ```bash
130
+ adiff review pane --repo <repo> --branch <branch>
131
+ ```
132
+
133
+ It splits the pane they are already looking at, so their next move is to look right rather than to
134
+ type. The answer says what happened:
135
+
136
+ ```json
137
+ {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api --branch cdr-1"}
138
+ ```
62
139
 
63
- You know the order the change was built in. The reviewer does not, and rebuilding it by reading
64
- every file is the most expensive way to learn something you already have. When you finish a piece
65
- of work, write a **story**: an ordered set of steps over the diff, each one a claim about a span of
140
+ `opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
141
+ WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
142
+ line and let them run it.
143
+
144
+ Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over
145
+ someone's screen uninvited is worse than a line they have to copy.
146
+
147
+ ## Tell the reviewer how to read it
148
+
149
+ Whether or not a pane opened, say what to do with it. Name the repository they should point at,
150
+ which is the repository the worktree belongs to:
151
+
152
+ > Open it with `adiff review open --repo <repo> --branch <branch>`, which lands on this branch's
153
+ > diff. The sidebar lists the files; `j` and `k` move down the diff, `]` and `[` walk between
154
+ > files, `}` and `{` jump to the next and previous change, `G` goes to the end. Select lines with
155
+ > `v`, write a comment with `c`, and send it with `ctrl+s`. Press `?` for the rest.
156
+
157
+ Fill the repository path and the branch in yourself, so nobody has to compose the command or find
158
+ the branch in a list. `--branch` takes the name `branch list` reports; without it the review opens
159
+ on the worktree list.
160
+
161
+ Say what you want looked at hardest, and where you are unsure. A reviewer who knows which part you
162
+ doubt spends their attention there. Offer a reading order rather than writing one: if the change is
163
+ long enough that the order matters, say you can publish one and let them decide.
164
+
165
+ ## Publishing a reading order, when you are asked for one
166
+
167
+ Only when the reviewer asks. A reading order is a real piece of work, it can be wrong, and one
168
+ nobody wanted spends their attention on your summary rather than on the code.
169
+
170
+ When they do ask, write **layers**: an ordered set over the diff, each one a claim about a span of
66
171
  code. The reviewer then walks the argument instead of the filesystem.
67
172
 
68
173
  ```bash
69
- adiff story set --worktree . --json - <<'JSON'
174
+ adiff layers set --worktree . --json - <<'JSON'
70
175
  {
71
176
  "summary": "Team invitations, end to end",
72
- "steps": [
177
+ "layers": [
73
178
  {
74
179
  "title": "Add the invitation data model",
75
- "note": "The record every later step leans on",
180
+ "note": "The record every later layer leans on",
76
181
  "spans": [{ "path": "src/db/invites.ts", "start": 1, "end": 48 }]
77
182
  },
78
183
  {
@@ -91,35 +196,43 @@ adiff story set --worktree . --json - <<'JSON'
91
196
  JSON
92
197
  ```
93
198
 
94
- Rules that make a story worth reading:
199
+ Rules that make a layers worth reading:
95
200
 
96
- - **Order is the point.** Step 1 is what the reader must understand before step 2 makes sense.
201
+ - **Order is the point.** Layer 1 is what the reader must understand before layer 2 makes sense.
97
202
  Data model, then the code that uses it, then the surface, then the mechanical bits last.
98
203
  - **A title is a claim, not a file name.** "Add the invitation API", never "changes to
99
204
  src/api/invites.ts".
100
205
  - **Line numbers are the new side of the diff**, the same numbers `adiff comment take` reports.
101
- - **Cover everything.** adiff computes coverage itself and answers with the hunks no step claims;
102
- those show up for the reviewer under "not in any step" whatever you do. A story that quietly
103
- skips a third of the diff is worse than no story, so put the leftovers in a final step and say
104
- they are mechanical.
206
+ - **Cover everything.** adiff computes coverage itself and answers with the changed lines no layer
207
+ claims; those show up for the reviewer under "not in any layer" whatever you do. A layer set that
208
+ quietly skips a third of the diff is worse than none, so put the leftovers in a final layer and
209
+ say they are mechanical. Claim the lines you actually read: a span reaching past them counts only
210
+ the changed lines inside it, so padding the range buys nothing.
105
211
 
106
- The answer to `story set` is the honest report — check it before you claim to be done:
212
+ The answer to `layers set` is the honest report — check it before you claim to be done:
107
213
 
108
214
  ```json
109
- {"ok":true,"story":{"version":1,"stale":false,"covered":7,"total":9,"uncovered":[{"path":"src/api/router.ts","start":40,"end":52}],"vanished":[],"steps":[{"title":"Add the invitation data model","files":["src/db/invites.ts"]}]}}
215
+ {"ok":true,"layers":{"version":1,"stale":false,"covered":7,"partial":1,"total":9,"uncovered":[{"path":"src/api/router.ts","start":40,"end":52}],"vanished":[],"layers":[{"title":"Add the invitation data model","files":["src/db/invites.ts"]}]}}
110
216
  ```
111
217
 
112
- `covered`/`total` count hunks. `uncovered` names the ones no step claims — claim them and set the
113
- story again. `vanished` names paths a step points at that this branch does not change, which
114
- usually means a typo in a path. Read it back at any time with:
218
+ `total` counts hunks. `covered` counts the ones where every changed line sits inside a layer, and
219
+ `partial` the ones a layer explains only some of. `uncovered` names the runs of changed lines no
220
+ layer claims, so it reads as line numbers a reviewer would otherwise have to find alone: claim them
221
+ and set the layers again. Done means `uncovered` is empty. `vanished` names paths a layer points at
222
+ that this branch does not change, which usually means a typo in a path. Read it back at any time
223
+ with:
115
224
 
116
225
  ```bash
117
- adiff story show --worktree . --fields covered,total,uncovered
226
+ adiff layers show --worktree . --fields covered,partial,total,uncovered
118
227
  ```
119
228
 
120
- Setting a story again supersedes the previous one and bumps `version`; the story records the commit
121
- it was written for, and adiff reports it as `stale` once the branch moves past that commit. After
122
- you address a review, write the story again.
229
+ Setting layers again supersedes the previous set and bumps `version`; the set records the commit it
230
+ was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a
231
+ reviewer has a reading order, keep it true: write it again after you address their comments.
232
+
233
+ When you have published one, tell them the sidebar now holds it: `s` swaps between the layers and
234
+ the files, `j` and `k` move between layers with the diff following, and `]` and `[` walk the files
235
+ inside a layer.
123
236
 
124
237
  ## Discovering the rest
125
238
 
@@ -127,8 +240,9 @@ you address a review, write the story again.
127
240
  adiff describe
128
241
  ```
129
242
 
130
- Returns every command with its options, which are required, and where its payload sits. Use it
131
- instead of guessing, and use `--fields` to keep answers small:
243
+ Returns every command with its options, which are required, which part of the loop it belongs to,
244
+ and where its payload sits. `adiff <command> --help` says the same for one command in plain text.
245
+ Use either instead of guessing, and use `--fields` to keep answers small:
132
246
 
133
247
  ```bash
134
248
  adiff branch list --repo . --fields branch,files
@@ -1,178 +0,0 @@
1
- export type OptionSpec = {
2
- readonly name: string
3
- readonly required: boolean
4
- readonly value: string
5
- readonly about: string
6
- }
7
-
8
- export type CommandSpec = {
9
- readonly name: string
10
- readonly about: string
11
- readonly safety: "read" | "write"
12
- readonly options: ReadonlyArray<OptionSpec>
13
- readonly dataKey: string
14
- readonly example: string
15
- }
16
-
17
- const repo: OptionSpec = {
18
- name: "repo",
19
- required: true,
20
- value: "path",
21
- about: "Repository whose worktrees are reviewed",
22
- }
23
-
24
- const branch: OptionSpec = {
25
- name: "branch",
26
- required: true,
27
- value: "name",
28
- about: "Branch to act on, as reported by `branch list`",
29
- }
30
-
31
- const file: OptionSpec = {
32
- name: "file",
33
- required: true,
34
- value: "path",
35
- about: "File path as it appears in the diff",
36
- }
37
-
38
- export const catalog: ReadonlyArray<CommandSpec> = [
39
- {
40
- name: "branch list",
41
- about: "Branches with changes against their merge base, and how large each is",
42
- safety: "read",
43
- options: [repo],
44
- dataKey: "branches",
45
- example: "adiff branch list --repo . --fields branch,files",
46
- },
47
- {
48
- name: "comment add",
49
- about: "File a comment against a line range, for the agent in that worktree",
50
- safety: "write",
51
- options: [
52
- repo,
53
- branch,
54
- file,
55
- { name: "start", required: true, value: "line", about: "First line of the range" },
56
- { name: "end", required: true, value: "line", about: "Last line of the range" },
57
- { name: "body", required: true, value: "text", about: "What to tell the agent" },
58
- {
59
- name: "side",
60
- required: false,
61
- value: "new|old",
62
- about: "Which version the lines are on. Defaults to new",
63
- },
64
- ],
65
- dataKey: "batch",
66
- example: 'adiff comment add --repo . --branch cdr-1 --file src/api.ts --start 4 --end 5 --body "why"',
67
- },
68
- {
69
- name: "comment stage",
70
- about: "Add a comment to the review without sending it yet",
71
- safety: "write",
72
- options: [
73
- repo,
74
- branch,
75
- file,
76
- { name: "start", required: true, value: "line", about: "First line of the range" },
77
- { name: "end", required: true, value: "line", about: "Last line of the range" },
78
- { name: "body", required: true, value: "text", about: "What to tell the agent" },
79
- {
80
- name: "side",
81
- required: false,
82
- value: "new|old",
83
- about: "Which version the lines are on. Defaults to new",
84
- },
85
- ],
86
- dataKey: "pending",
87
- example: 'adiff comment stage --repo . --branch cdr-1 --file src/api.ts --start 4 --end 4 --body "why"',
88
- },
89
- {
90
- name: "comment take",
91
- about: "Collect the comments this worktree has not been handed yet. Exactly-once",
92
- safety: "write",
93
- options: [
94
- { name: "worktree", required: true, value: "path", about: "The worktree to collect for" },
95
- {
96
- name: "wait",
97
- required: false,
98
- value: "seconds",
99
- about: "Block until a comment arrives or the timeout elapses",
100
- },
101
- ],
102
- dataKey: "comments",
103
- example: "adiff comment take --worktree . --wait 300",
104
- },
105
- {
106
- name: "file vouch",
107
- about: "Toggle a file as reviewed. Lapses on its own when the file changes",
108
- safety: "write",
109
- options: [repo, branch, file],
110
- dataKey: "vouched",
111
- example: "adiff file vouch --repo . --branch cdr-1 --file src/api.ts",
112
- },
113
- {
114
- name: "review submit",
115
- about: "Send every staged comment as one review, so the agent wakes once",
116
- safety: "write",
117
- options: [repo, branch],
118
- dataKey: "submitted",
119
- example: "adiff review submit --repo . --branch cdr-1",
120
- },
121
- {
122
- name: "review progress",
123
- about: "Which files of a branch are still vouched, and how many there are",
124
- safety: "read",
125
- options: [repo, branch],
126
- dataKey: "vouched",
127
- example: "adiff review progress --repo . --branch cdr-1",
128
- },
129
- {
130
- name: "story set",
131
- about: "Write the reading order for this worktree's diff: ordered steps over spans of files",
132
- safety: "write",
133
- options: [
134
- { name: "worktree", required: true, value: "path", about: "The worktree the story is about" },
135
- {
136
- name: "json",
137
- required: true,
138
- value: "file|-",
139
- about: "The story document, as a file path or - to read stdin",
140
- },
141
- ],
142
- dataKey: "story",
143
- example: "adiff story set --worktree . --json -",
144
- },
145
- {
146
- name: "story show",
147
- about: "The story of a worktree, with the hunks no step claims",
148
- safety: "read",
149
- options: [
150
- { name: "worktree", required: true, value: "path", about: "The worktree to read" },
151
- ],
152
- dataKey: "story",
153
- example: "adiff story show --worktree . --fields steps,uncovered",
154
- },
155
- {
156
- name: "review open",
157
- about: "Open the review terminal. The only command that does not answer in JSON",
158
- safety: "read",
159
- options: [repo],
160
- dataKey: "",
161
- example: "adiff review open --repo .",
162
- },
163
- {
164
- name: "describe",
165
- about: "This catalog, as JSON",
166
- safety: "read",
167
- options: [
168
- { name: "command", required: false, value: "name", about: "Describe one command only" },
169
- ],
170
- dataKey: "commands",
171
- example: "adiff describe --command 'comment add'",
172
- },
173
- ]
174
-
175
- export const commandNames: ReadonlyArray<string> = catalog.map((command) => command.name)
176
-
177
- export const findCommand = (name: string): CommandSpec | undefined =>
178
- catalog.find((command) => command.name === name)