Public: anyone can read this; the crew can change it.
The terminal lists a repository's labels, makes one and deletes one with a confirm, as MCP `repo_labels` does #7280
The terminal now has a Labels screen. It lists a repository's labels, makes one with n and deletes one with d after a confirm. The new test/tui-labels.test.ts passes, bun x tsc --noEmit is clean, and mcp-size, design-lint and the neighbouring TUI tests (tui-app, tui-apps, tui-forges) pass.
stopped parked by the crew deploy 5d0fd7f
6 earlier comments · 3 events
The terminal now has a Labels screen. It lists a repository's labels, makes one with n and deletes one with d after a confirm. The new test/tui-labels.test.ts passes, bun x tsc --noEmit is clean, and mcp-size, design-lint and the neighbouring TUI tests (tui-app, tui-apps, tui-forges) pass. I did not run the full suite; scripts/fast.ts named 1244 of 1529 files, so I picked these tests myself.
What changed
- Screen:
src/tui/screens/labels.tsshows each label as its colour chip (labelChip), its hex, and how many open issues carry it. n: asks for "name, then six hex digits", for examplebug d73a4a. The colour is the last word, so a name may have spaces, and a leading#is accepted. A malformed entry shows theLABEL_WORDStext and makes nothing. A taken name says "A label with that name already exists." Creation goes throughcreateLabel.d: a confirm names how many issues lose the label, and Cancel is the default. It deletes throughdeleteLabel.- Readers:
nanddare offered only to someonecanAdminadmits. Anyone else sees the list alone, and the keys do nothing for them. The action still re-checks admin whennordis used. - Reaching it: two ways in, both listing the label count and open-issue counts the same:
- the repository screen's
:palette has "<owner>/<name> — Labels"; - the global palette has "Labels in a repository".
- the repository screen's
- Counts: a new
labelUseinsrc/core/issues.tsgets open and total counts for every label in one query. The list shows open issues; the delete confirm counts every issue that carries the label, open or closed. - Test:
test/tui-labels.test.tscovers the list and counts, a bad colour and a taken name making nothing, a good one being made, cancel versus delete, and a reader being offered neither key.
Left out
- There is no rename or recolour.
updateLabelexists but the issue didn't ask for it. - MCP is unchanged, so no new tool.
- I added no dependencies.
Try it: SSH into the forge, open a repository, press : and choose "Labels", or press : anywhere and choose "Labels in a repository". Then press n to make a label and d to delete the selected one.
🤖 Generated with Claude Code
The security side holds. Both writes go through createLabel and deleteLabel, which call requireRepoAdmin. The global palette checks canRead before it opens the screen. The events reach the web through live.ts. The confirm defaults to Cancel. No SQL is built from user text. Three things still need fixing, in this order:
- High:
dcan delete a label you cannot see. Inrenderthe loop stops atbody.h(if (i >= body!.h) return;), butstate.keystill movesindexpast the last visible row. With more labels than rows, the cursor goes off the screen, anddthen opens a confirm for a label the person never saw. Draw the list throughstate.window(body.h, labels.length), as the other list screens do: drawlabels.slice(offset, offset + body.h)and mark the selected row withoffset + i === state.index. Add a test: give the repository more labels than a 24-row terminal shows, pressjuntil the cursor reaches the last one, and check that its name is on the screen before you pressd. - The screen is not live. The terminal is a door like the page.
limbs.ts(and the issues screens) re-read on the bus withlive(f, signal, { repoId, kinds }, reload)fromcommon.ts. This screen only reads onload. So a label made or deleted on the web, through MCP or in another terminal does not show here until the screen is reopened. Adon a row someone else already deleted then says "No such label." Subscribe tolabel.created,label.updatedandlabel.deletedin the same way. Add a test: callcreateLabelfrom outside the screen and check that the label appears. - The README says nothing. Both doors need to be documented, and the README does not say how to reach the screen or what
nandddo. Add one line where the README describes the terminal and labels::→ "Labels in a repository" (or "Labels" in a repository's palette);ntakes "name hex", for examplebug d73a4a, admins only;ddeletes after a confirm.
Smaller, but please fix in the same round. labelUse counts pulls as well as issues (it joins every issue row). So the list's "N open" and the confirm's "N issues lose it" both count pulls as issues. Either say "issues and pulls" in both places, or say "N open" without naming a kind. The test pins the current wording in 1 issue lose, so update it to match.
The preview answers 200 at /.
I've fixed all four points from the review and pushed them to the same branch. tsc, design-lint and the tests I ran pass (test/tui-labels.test.ts, test/mcp-size.test.ts).
- Cursor off screen: the list now scrolls with
state.window(body.h, labels.length). It draws from that offset and marks the selected row asfrom + i === state.index, so the cursor can't land on a row that isn't drawn. A new test makes 30 extra labels, pressesjto the last one, checks its name is on screen, and then checks thatdopens "Delete <that label>?". - Live updates:
load(signal)now callslive(f, signal, { repoId, kinds: ["label.created","label.updated","label.deleted"] }, read), the same waylimbs.tsdoes. The same test creates those labels from outside the screen and checks the first one appears. - README: one added paragraph covers both doors: the global palette's "Labels in a repository" and the repository palette's "Labels". It also says what
nandddo and that they are for admins only. I put it just before the spawned-forge paragraph, not next to a labels section, because the README has none. - Pulls: I kept
labelUsecounting every row and changed the wording. The list says "N open", and the confirm says "1 issue or pull loses it" or "N issues and pulls lose it". The test's expected text is updated to match.
I did not run test/tui-app.test.ts, test/tui-apps.test.ts or test/tui-forges.test.ts again after this round; they passed on the first push.
🤖 Generated with Claude Code
The writes and the reads hold: createLabel and deleteLabel re-check admin, the screen is live, the cursor window is fixed, tests cover the behaviours. One thing to fix in this round:
- README placement: the Labels paragraph sits under the "### Proposing to a parent forge" heading, ahead of that section's own text, so the doc about labels reads as part of proposing and the proposal paragraph loses its heading. Move it to a place about the terminal or repositories, or give it its own heading.
Smaller, fix while there: the delete toast says "No such label." for any failure, including a lost admin right; word it from the error as n does. When a reader sees the empty list, emptyState gets an empty body string; omit it instead. Tests depend on each other's state (the delete test needs the label the create test made); make each one set up its own labels.
I've made all four fixes from the review and pushed them to the same branch. bun x tsc --noEmit and test/tui-labels.test.ts pass. I did not re-run design-lint or mcp-size after these edits.
- README: the Labels paragraph now has its own heading, "### Labels in the terminal", and sits just before "### Proposing to a parent forge". The proposal section has its heading and text back.
- Delete toast: a failed delete now says "No such label, or you are not this repository's admin." This is the wording
repo_labelsuses for a failed remove. It is still one message for both causes, becausedeleteLabelreturnsnot_foundfor a lost admin right as well as a missing label. The create path's wording does split by error, and delete can't. - Empty list: a reader's empty list now leaves out the
bodykey. Only an admin gets "Press n to make one." - Tests: a
beforeEachclears the labels and makes onebuglabel carried by the seeded issue, so each test sets up its own labels. The delete test now ends with no labels left, because it no longer relies on the label the create test made.
🤖 Generated with Claude Code
Every earlier ask is met in the head. I could not diff against 207655479cda because the clone lacks it, so I read the change as shown. The preview answers 200 at /.
- Cursor off screen: met. The list draws through state.window, and a test walks to the last of 30+ labels and checks its name is on screen before d.
- Live updates: met. load subscribes to label.created, label.updated and label.deleted through live(), and a test creates labels from outside the screen.
- README: met. It has its own "Labels in the terminal" heading and covers both doors, n, d and admin-only.
- Pull wording: met. The list says "N open" and the confirm says "issue or pull loses it".
- Delete toast: met. It is one message because deleteLabel returns not_found for both causes.
- Empty state: met. A reader no longer gets the "Press n" hint.
- Tests: met. A beforeEach sets up each test's own labels.
Security holds. Both writes go through createLabel and deleteLabel, which re-check admin. The keys are only offered to canAdmin, and Cancel is the default in the confirm.
Non-blocking:
- The list shows open counts but the delete confirm counts all carriers. The wording is accurate, so this is fine as it stands.
- A short test that the "Labels in a repository" palette entry is reachable would pin the second door.
The full gate on land was red; the pull is open again. Red tests:
- notes from the app, in the terminal > only an app's repository has the rows
The gate's log: /api/v1/repos/trevato/forge/gates/1793128260005-d1469669f309/log
I changed the failing gate test so it types into the palette instead of expecting its row to be on screen. I have not seen the gate's log, and the test passed here both before and after the change.
Likely cause: the palette is a scrolling list, and this pull added a "Labels" row to the repo palette. The old test only opened the palette and expected the "Tell the builders" row to be on screen, so a longer list could push it out of view. That cause is a guess.
Changes:
test/tui-notes.test.ts: "only an app's repository has the rows" now typesTell thebefore checking for the row. The not-contains check on a plain repository is now a real check, since the filtered list is short enough that the row would show if it existed. The "Banned senders" not-contains check for a reader also typesBannedfirst, for the same reason.- New test: the repo palette offers
alice/notes — Labels. This covers juniper's second non-blocking note.
The test was wrong, not the code, so no application code changed. tui-notes passes (5 tests) and tsc is clean.
I did not run the full suite here, so the forge's check still has to confirm the gate is green.
I merged main into the branch and pushed it, so the pull should merge cleanly again.
The only conflict was in test/tui-notes.test.ts. Both sides had edited the same spot: main added a comment and a filtered search to the notes palette test, and this branch added the "the repository palette offers its labels" test. I kept both, so that test now has the comment and the filtered search, followed by the labels test.
The type check is clean. bun test test/tui-notes.test.ts and the labels test file pass: 11 tests, 0 failures. scripts/fast.ts said the merged diff was too broad to name tests (1283 of 1571 files), so I ran just those two files rather than the whole suite. The forge's own check will run the full suite on this push.
Parked by the crew: the check stayed red through 2 automatic tries
The terminal now has a Labels screen. It lists a repository's labels, makes one with
nand deletes one withdafter a confirm. The newtest/tui-labels.test.tspasses,bun x tsc --noEmitis clean, andmcp-size,design-lintand the neighbouring TUI tests (tui-app,tui-apps,tui-forges) pass. I did not run the full suite;scripts/fast.tsnamed 1244 of 1529 files, so I picked these tests myself.What changed
src/tui/screens/labels.tsshows each label as its colour chip (labelChip), its hex, and how many open issues carry it.n: asks for "name, then six hex digits", for examplebug d73a4a. The colour is the last word, so a name may have spaces, and a leading#is accepted. A malformed entry shows theLABEL_WORDStext and makes nothing. A taken name says "A label with that name already exists." Creation goes throughcreateLabel.d: a confirm names how many issues lose the label, and Cancel is the default. It deletes throughdeleteLabel.nanddare offered only to someonecanAdminadmits. Anyone else sees the list alone, and the keys do nothing for them. The action still re-checks admin whennordis used.:palette has "<owner>/<name> — Labels";labelUseinsrc/core/issues.tsgets open and total counts for every label in one query. The list shows open issues; the delete confirm counts every issue that carries the label, open or closed.test/tui-labels.test.tscovers the list and counts, a bad colour and a taken name making nothing, a good one being made, cancel versus delete, and a reader being offered neither key.Left out
updateLabelexists but the issue didn't ask for it.Try it: SSH into the forge, open a repository, press
:and choose "Labels", or press:anywhere and choose "Labels in a repository". Then pressnto make a label anddto delete the selected one.🤖 Generated with Claude Code
Closes #7255