@eliya-oss/agent-diff 0.1.0-alpha.14 → 0.1.0-alpha.140

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.
@@ -15,6 +15,9 @@ the way it is, why it is tested the way it is. ADRs explain choices that outlive
15
15
  | [ADR-002](ADR-002-effect-v4-and-module-boundaries.md) | Effect v4, and modules sealed behind `index.ts` |
16
16
  | [ADR-003](ADR-003-blackbox-testdriver.md) | Black-box tests through a TestDriver, and no unit tests |
17
17
  | [ADR-004](ADR-004-pnpm-native-releases.md) | pnpm's own release tooling instead of Changesets |
18
+ | [ADR-005](ADR-005-a-mechanical-style-contract.md) | Style is a lint rule, not a document |
19
+ | [ADR-006](ADR-006-the-terminal-runs-on-effect.md) | The terminal runs on Effect |
20
+ | [ADR-007](ADR-007-model-with-effect-not-only-run-on-it.md) | Model with Effect, not only run on it |
18
21
 
19
22
  ## Writing one
20
23
 
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: create-pr
3
+ description: Open or update an adiff pull request — a short body, a change intent, and a recording of every test the branch adds, embedded inline via GitHub user-attachments. Use when asked to create, update or fix up a PR in this repository.
4
+ ---
5
+
6
+ # Create an adiff PR
7
+
8
+ Load `release-notes` first and apply every rule in it: the change intent shape, the `kind(area):`
9
+ sentence, the no-gerund rule, and what never goes in a body. Everything here is additive.
10
+
11
+ A reviewer of an adiff PR wants two things: one line saying what changed, and a moving picture of it
12
+ working. The body carries the first. `pnpm record` carries the second.
13
+
14
+ ## One command
15
+
16
+ ```bash
17
+ pnpm record
18
+ ```
19
+
20
+ It reads the test files this branch changed against `origin/main`, runs them with tracing on, and for
21
+ each test builds its world into a real repository, boots adiff in a real terminal, replays the keys
22
+ the test pressed, encodes an mp4 and uploads it. It prints a finished `## Recorded tests` section.
23
+ Paste that under the body.
24
+
25
+ `pnpm record --test <path>` records one file instead of the whole branch. `pnpm record --base
26
+ <branch>` reads the branch against something other than `origin/main`, which is what a PR stacked on
27
+ another PR needs so it records only its own tests.
28
+
29
+ A recording narrates itself, so somebody who has never opened adiff can follow it:
30
+
31
+ - it opens on a title card carrying the test's `when` and `then`
32
+ - each step is held for a second, with a band naming it in plain words — `open the branch`,
33
+ `leave a comment saying "worth a second look"` — and a key cap in the corner showing the key as it
34
+ is pressed, so the caption, the key and what happens on screen line up
35
+ - every `expect` stops the screen, rings the pane it is about, and says the claim as a sentence:
36
+ `the review panel contains worth a second look`
37
+
38
+ The sentence names its own subject, which is why it needs no label. Assertions running one after
39
+ another with nothing in between share a beat and the band lists them; assertions separated by
40
+ something the reviewer does each get their own. `--pace <ms>` and `--hold <ms>` change the timings.
41
+
42
+ The ring comes from the view accessor the assertion read — `reviewPanel()` rings the review panel,
43
+ `focus()` rings whichever pane the keys reach. An assertion about no single region, such as which
44
+ panes are on screen, gets the sentence and no ring.
45
+
46
+ For the caption to appear, the test must take `expect` from the testing barrel rather than from
47
+ vitest directly. A test that does not still records; it just has no captions.
48
+
49
+ The recording is driven by the test's own trace, so it cannot show something the test does not do. If
50
+ a test fails, nothing is recorded — a green run is the precondition, not a claim to make in prose.
51
+
52
+ ## What gets recorded
53
+
54
+ Every test the branch adds, one recording each, not a representative sample. Skip only when the
55
+ branch changes nothing a reviewer could see: a refactor, a type, a script, a document.
56
+
57
+ A test that presses no keys produces no recording, which is the right answer for a pure CLI or store
58
+ test. Do not invent keystrokes to make one.
59
+
60
+ ## The section it prints
61
+
62
+ ```markdown
63
+ ## Recorded tests
64
+
65
+ - when the review panel is opened
66
+
67
+ <details>
68
+ <summary><code>then the keys are already on the comments</code></summary>
69
+
70
+ <bare user-attachments URL>
71
+
72
+ </details>
73
+ ```
74
+
75
+ The `describe` is the plain-text list item and the `test` is the summary of a `<details>` nested
76
+ under it, indented two spaces so it stays inside the item. Two tests under one `when` share the list
77
+ item.
78
+
79
+ Leave the URL bare. GitHub wraps a player around a user-attachments URL on its own line; image
80
+ markdown (`![…](…)`) around a video renders nothing. The summary is the test title only — no
81
+ duration, no dimensions, no file size.
82
+
83
+ ## Where it goes
84
+
85
+ After the prose and after `## What changed`, before anything else. A reviewer reads what changed,
86
+ then watches it.
87
+
88
+ ## Nothing private, ever
89
+
90
+ This repository is public and so is every attachment. `pnpm record` is safe by construction: it
91
+ builds each world from the test's own fixture, which is invented code in an invented repository, and
92
+ it never opens a real one. Keep it that way — never point a capture at a real checkout, and never
93
+ paste a branch name, path, ticket id or line of source from private work into a body.
94
+
95
+ An attachment cannot be deleted once uploaded.
96
+
97
+ ## Before it will work
98
+
99
+ ```bash
100
+ cargo install --locked terminal-control # once
101
+ gh extension install drogers0/gh-image # once, then `gh image check-token`
102
+ ```
103
+
104
+ `termctrl` lives in `~/.cargo/bin`, which is not always on the PATH of a non-interactive shell.
@@ -0,0 +1,276 @@
1
+ ---
2
+ name: release-notes
3
+ description: Write the change intent, the PR description and the release note for a change to adiff. Use when opening a PR here, when adding or editing a file in .changeset/, when asked to fix up a PR body or a release note, or when deciding whether a change is worth a release at all.
4
+ ---
5
+
6
+ # Release notes for adiff
7
+
8
+ Every release note in this repo comes from one place: a change intent file in `.changeset/`.
9
+ `scripts/changelog.ts` reads those files, groups them, and writes `CHANGELOG.md` and the text on
10
+ the GitHub release page. Nothing else is edited by hand — do not edit `CHANGELOG.md` yourself.
11
+
12
+ A reader of a release note wants two things in this order: **which part of adiff changed**, and
13
+ **what it does now**. Give them that in one sentence. Everything else goes behind a fold.
14
+
15
+ ## Does this change deserve a release at all?
16
+
17
+ Only four kinds of change ship a note:
18
+
19
+ | Kind | Write it as | Lands under |
20
+ | --- | --- | --- |
21
+ | Something adiff could not do before | `feat(area): …` | `### Added` |
22
+ | Something adiff did wrong | `fix(area): …` | `### Fixed` |
23
+ | Something measurably faster or smaller | `perf(area): …` | `### Performance` |
24
+ | Something that changes what an existing command or key means | `breaking(area): …` | `### Breaking` |
25
+
26
+ **A refactor, a test, a doc, a CI change or a rename gets no change intent file.** No file, no
27
+ version bump, no note. If the change is invisible to a reviewer using adiff, it is invisible in the
28
+ changelog too. Say so in the PR body instead. A PR that touches only `src/testing/`, `.agents/`,
29
+ `.github/`, `README.md` or `ARCHITECTURE.md` almost never needs one.
30
+
31
+ If you are unsure, ask: would someone who upgraded notice? If no, no file.
32
+
33
+ ## The shape of a change intent
34
+
35
+ `.changeset/<name>.md`. Name it the way you would name the test: the sentence, kebab-cased, no
36
+ gerund — `a-file-with-an-accent.md`, not `keeping-a-file-with-an-accent.md`. The bump is `patch`
37
+ until this reaches 1.0, whatever the kind says.
38
+
39
+ `.changeset/` holds only what has not shipped yet, so it is usually empty or nearly so. A release
40
+ collects the intents it consumed and deletes them — their words live on in `CHANGELOG.md`, and
41
+ `.changeset/ledger.yaml` records which release took which. Do not go looking for a neighbouring
42
+ file to copy; follow this page.
43
+
44
+ ```markdown
45
+ ---
46
+ "@eliya-oss/agent-diff": patch
47
+ ---
48
+
49
+ fix(layers rail): the cursor stays on the rail when you collapse the layer you are reading.
50
+
51
+ <details><summary>What was wrong</summary>
52
+
53
+ Collapsing took the cursor off the whole rail — nothing said where you were, and the layer read
54
+ like one you had not started.
55
+
56
+ </details>
57
+ ```
58
+
59
+ which renders as:
60
+
61
+ ```markdown
62
+ ## 0.1.0-alpha.132
63
+
64
+ ### Fixed
65
+
66
+ - **Layers rail** — the cursor stays on the rail when you collapse the layer you are reading.
67
+
68
+ <details><summary>What was wrong</summary>
69
+ …
70
+ </details>
71
+ ```
72
+
73
+ Rules the generator and `a-changelog-that-says-what-kind-of-change.test.ts` enforce:
74
+
75
+ - The first line of every entry is `kind(area): one sentence.` — a full stop at the end, no
76
+ capital at the start, no line break inside it.
77
+ - `kind` is exactly one of `feat`, `fix`, `perf`, `breaking`.
78
+ - `area` is lowercase, and is capitalised for you when it is rendered. Write `CLI` and `README` in
79
+ the case you want them.
80
+ - Anything between one entry and the next belongs to the entry above it, and is indented under its
81
+ bullet.
82
+
83
+ ## One entry per thing that changed
84
+
85
+ A PR that fixes five things writes **five entries in one file**, not one paragraph covering five.
86
+ This is the single biggest difference from how this repo used to write notes.
87
+
88
+ ```markdown
89
+ fix(layers rail): the cursor stays on the rail when you collapse the layer you are reading.
90
+
91
+ <details>…</details>
92
+
93
+ fix(reading order): a first layer naming no file in the diff opens at the first file, not the last.
94
+
95
+ <details>…</details>
96
+ ```
97
+
98
+ Each one gets its own bullet, under the right heading, and can be found by someone searching for
99
+ the part of adiff it names.
100
+
101
+ ## Naming the area
102
+
103
+ Use the name a reviewer would use for the thing on screen. The ones already in use:
104
+
105
+ `diff` · `file tree` · `layers` · `layers rail` · `reading order` · `review panel` · `footer` ·
106
+ `marks` · `keys` · `search` · `key sheet` · `command palette` · `home screen` · `comment delivery` ·
107
+ `store` · `preferences` · `upgrade` · `CLI` · `changelog`
108
+
109
+ Reuse one before inventing another, and check `.agents/prd/CONTEXT.md` — never invent a word the
110
+ glossary already has.
111
+
112
+ ## The sentence
113
+
114
+ Write what is true **now**, in the present tense, from the reviewer's side of the screen.
115
+
116
+ - `fix(diff): a binary file says it is binary instead of drawing an empty pane.`
117
+ - `feat(search): typing narrows the matches as you type.`
118
+ - `perf(review): opening a 131-file branch takes 1.5s, down from 2.85s.`
119
+
120
+ Not:
121
+
122
+ - ~~`fix(diff): fixed the binary file handling`~~ — says nothing about what a reader will see.
123
+ - ~~`fix(diff): refactored patch parsing so binary blobs short-circuit`~~ — describes the code.
124
+ - ~~`fix(diff): a binary file that adiff cannot show`~~ — a title, not a statement.
125
+
126
+ **No gerund titles.** "Saying what is not there", "Opening onto one branch", "Asking before
127
+ leaving" are all wrong. Write a statement with a verb in it: "a file with no newline says so".
128
+ This holds for the sentence, the branch name, the changeset filename, the PR title and the test
129
+ filename.
130
+
131
+ For `perf`, give both numbers and what they were measured on. A speed claim with no measurement is
132
+ not a release note.
133
+
134
+ ## What goes behind the fold
135
+
136
+ The `<details>` block is for the reader who hits the bug and wants to know it is the one they hit.
137
+ Put the symptom there, in the words someone would use to describe what they saw. Keep it to a
138
+ paragraph or two.
139
+
140
+ Leave it out entirely when the sentence is the whole story — most `feat` entries need nothing.
141
+
142
+ Do not put in it: the file you changed, the function you added, the test you wrote, a count of
143
+ tests, or how long it took you. Those belong in the PR.
144
+
145
+ ## The PR description
146
+
147
+ ### The template
148
+
149
+ ```markdown
150
+ One paragraph. What this changes, and what prompted it. Two or three sentences.
151
+
152
+ ## What changed
153
+
154
+ ### Fixed
155
+
156
+ - **Layers rail** — the cursor stays on the rail when you collapse the layer you are reading.
157
+ - **Reading order** — a first layer naming no file in the diff opens at the first file, not the last.
158
+
159
+ ### Added
160
+
161
+ - **Search** — typing narrows the matches as you type.
162
+
163
+ ## The rail lost the cursor when you folded the layer you were in
164
+
165
+ The repro, as keys to press. Then what the fix was.
166
+
167
+ <table>
168
+ <tr><th>Before</th><th>After</th></tr>
169
+ <tr>
170
+ <td><img src="https://github.com/user-attachments/assets/…" alt="before"></td>
171
+ <td><img src="https://github.com/user-attachments/assets/…" alt="after"></td>
172
+ </tr>
173
+ </table>
174
+
175
+ ## Reading order opened at the end
176
+
177
+ The repro. Then what the fix was.
178
+ ```
179
+
180
+ - The **title** is the entry sentence without the `kind(area):` prefix, and follows the same
181
+ no-gerund rule.
182
+ - **`## What changed` is generated, never typed.** `node scripts/pr-summary.ts` prints it from the
183
+ change intents on this branch. The PR and the changelog then cannot drift apart. Commit the
184
+ intent first — the summary is read from the diff against `origin/main`, so an uncommitted file
185
+ is not on the branch yet and the script will say there is nothing to paste.
186
+ - **One `##` section per thing changed**, in the order the bullets list them, titled with the
187
+ symptom rather than the fix. That is what a reader searching their own bug will match on.
188
+ - A PR with **one entry and nothing to reproduce** is a title and a sentence. The template starts
189
+ earning its keep at two. This is about the `##` sections, not about the pictures: a single-entry
190
+ PR that changes a screen still owes a before and an after.
191
+ - A PR with **no change intent** — a refactor, a test, a doc — writes prose. `pnpm pr-summary`
192
+ will tell you there is nothing to paste, and that is the correct answer, not a problem to fix.
193
+
194
+ ### What never goes in a PR body
195
+
196
+ - **Raw command output.** No `ls` listings, no shell transcripts, no stack traces pasted whole.
197
+ Quote the one line that matters.
198
+ - **Backticks around anything a shell would run.** Writing a body in a heredoc executes
199
+ `` `l` `` and pastes its output into your prose. Write the body to a file, then
200
+ `gh pr create --body-file`.
201
+ - **Test counts, timings, or self-assessment.** No "full suite green", no "740 tests", no
202
+ "verified twice". CI says whether the tests pass.
203
+ - **Anything from a private repository.** See below.
204
+
205
+ ### Nothing private, ever
206
+
207
+ This repository is public, and so is every PR body, screenshot and recording attached to it. Before
208
+ you open or edit a PR, read what you wrote and confirm none of it carries:
209
+
210
+ - an employer's or a customer's name, or a private repository's name
211
+ - a ticket id, an internal URL, a dashboard link, or an internal hostname
212
+ - a real branch name, file path, or line of source from private work
213
+ - a colleague's name or address, or any credential, token or key
214
+
215
+ A screenshot leaks all of this faster than prose does, which is why **every capture runs against the
216
+ synthetic demo repository** — `scripts/simulate.ts` builds a repo of invented invitation code with
217
+ invented branch names. Never screenshot a review of real work. If you cannot reproduce a bug on the
218
+ synthetic repo, describe it instead, or seed what you need in `scripts/simulation/seed.ts`.
219
+
220
+ An attachment cannot be deleted once uploaded. There is no public deletion API for
221
+ user-attachments, so a leak is permanent.
222
+
223
+ ### Showing a screen
224
+
225
+ adiff is a terminal, so a screenshot is a real PNG of a real terminal, captured with
226
+ [terminal-control](https://github.com/anomalyco/terminal-control) and uploaded to GitHub's
227
+ attachment store.
228
+
229
+ ```bash
230
+ cargo install --locked terminal-control # once
231
+ gh extension install drogers0/gh-image # once, then `gh image check-token`
232
+ ```
233
+
234
+ **Something new** gets one image:
235
+
236
+ ```bash
237
+ pnpm shot --keys "enter text:l" --label "a layer opened"
238
+ ```
239
+
240
+ **Something that changed** gets a before and an after, in a one-row table so the two sit side by
241
+ side rather than a screen apart:
242
+
243
+ ```bash
244
+ pnpm shot --keys "enter text:l" --label "the layers rail" --against origin/main
245
+ ```
246
+
247
+ `--against` builds a worktree at the merge base, captures the same keystrokes on the code as it was,
248
+ and prints the finished `<table>` with both images uploaded. Paste it under the section it belongs
249
+ to. If the two frames come out identical the script says so and stops — those keys do not reach the
250
+ screen you changed.
251
+
252
+ **Something about motion** — scroll feel, focus moving, a gap opening ten lines at a time — gets a
253
+ recording, because a still frame cannot show it:
254
+
255
+ ```bash
256
+ pnpm shot --keys "enter text:l text:l text:l" --label "the gap opening" --video
257
+ ```
258
+
259
+ That prints a bare URL. Leave it bare: GitHub wraps a player around a user-attachments URL on its
260
+ own line, and `![…](…)` image markdown around a video renders nothing.
261
+
262
+ Keys are termctrl's: `enter`, `escape`, `tab`, `up`, `down`, `page-up`, `ctrl-a` through `ctrl-z`,
263
+ and `text:<value>` for anything typed, including single letters like `text:l`. Add `--keep` to leave
264
+ the files in `shots/` instead of deleting them after upload.
265
+
266
+ ## Before you open the PR
267
+
268
+ ```bash
269
+ node scripts/changelog.ts # rewrites CHANGELOG.md from every change intent
270
+ node scripts/changelog.ts 0.1.0-alpha.133 # prints one release's note, as the release page shows it
271
+ node scripts/pr-summary.ts # prints the `## What changed` block for this branch
272
+ ```
273
+
274
+ `CHANGELOG.md` is regenerated by the release workflow, so it does not need to be committed with the
275
+ change intent — but run the generator and read the output. If your entry looks wrong there, it will
276
+ look wrong on the release page.