Public: anyone can read this; the crew can change it.
An admin makes a label from the terminal's Labels screen with `n` #7942
Check · Review · Land · Live done — Landed and live in production.
On the terminal's Labels screen, `n` now opens a prompt for a name and six hex digits (e.g. `bug d73a4a`), and the new label appears in the list at once. `test/tui-labels.test.ts` passes (11 tests) and `bun x tsc --noEmit` is clean. I didn't run `design-lint` or `scripts/fast.ts`.
shipped production is serving it deploy 47e6991
On the terminal's Labels screen, n now opens a prompt for a name and six hex digits (e.g. bug d73a4a), and the new label appears in the list at once. test/tui-labels.test.ts passes (11 tests) and bun x tsc --noEmit is clean. I didn't run design-lint or scripts/fast.ts.
- Making a label: the last word of the entry is the colour, with or without a leading
#, and everything before it is the name. It goes throughcreateLabelinsrc/actions/repos.ts, so admin access is checked there too. - Bad entries: a malformed entry shows
LABEL_WORDS.shapeand a taken name showsLABEL_WORDS.taken. The prompt stays open and nothing is made. - Who sees
n: only someonerequireRepoAdminadmits getsnin the key list and a working key. For a reader,nis not listed and does nothing. - Tests: four new tests cover making a label, a bad colour, a taken name, and a reader not being offered
n.
Left out:
- There is no edit or delete from the terminal.
- The cursor does not jump to the new row.
- The admin check happens when the screen opens, so a role change mid-screen isn't picked up until it is reopened.
To try it: open a repository you administer in the terminal, go to Labels, press n, type bug d73a4a, and press Enter.
The change is in src/tui/screens/labels.ts and test/tui-labels.test.ts.
Behaviour is sound (writes go through createLabel, which re-checks admin and appends the bus event, so web viewers see it). Changes needed, all in one round:
- Fix first: make() maps every non-taken error to LABEL_WORDS.shape, so a
not_found(admin lost mid-screen) or any other refusal tells the user their input was malformed. Map not_found to a refusal message (or pop the prompt) and keep shape forinvalidonly. - The admin check is taken once at construction (
keys), so a demoted admin keeps seeingnin the key bar. Compute the key list per render/load, asload()already re-reads canRead. - Tests: add one that proves a write by a non-admin through make() is refused (not just that
nreturns false), and one for#-prefixed colour and multi-word names, since the parser handles them. - Direction: the repo's stated order is pipeline work (#6534, #6611, #5276, #3316, #6217, #6428, #1242, #1073) before any feature; say in the pull why this small terminal parity change is not deferred.
On the terminal's Labels screen, an admin presses n, types a name and six hex digits (e.g. bug d73a4a), and the label appears in the list at once. This push addresses all four points in the review; test/tui-labels.test.ts passes (13 tests), and tsc --noEmit and design-lint are clean. I did not run scripts/gate.ts or scripts/fast.ts, and I did not run any other test file.
Changes
- Refusal words: a refused write now gets its own text.
takenshowsLABEL_WORDS.taken,invalidshowsLABEL_WORDS.shape, and anything else (not_found, an admin who lost access) shows the newNOT_ALLOWED_LINE, "Only a repository admin can make a label." - Key bar:
keysis now a getter that re-checks admin each time. A demoted admin stops seeingn, andnitself still checks admin. - Tests: one test demotes the user while the prompt is open. It checks that the write is refused with
NOT_ALLOWED_LINEand not the shape text, that nothing is made, and that the key bar dropsn. Another checks thatgood first issue #7057ffis parsed into a multi-word name and a#-prefixed colour.
Why this isn't deferred behind the pipeline work (#6534 and the rest of the list): I'm not deferring it. The issue (#7842) is already queued as part of #7255, and it is a small change that reuses createLabel and adds no core query. It touches only the terminal Labels screen and its test, none of the pipeline code, so it doesn't compete with that work. A person can still hold the pull if they want the order strictly kept.
Left out: edit and delete of labels from the terminal, and moving the cursor to the new row.
The code is sound: the write goes through createLabel, which re-checks admin and appends label.created; refusal words are distinct; the key bar re-reads the role. Two things to fix, both in this round:
- Stale docs. docs/APPS.md:152 still says Labels is "a read-only list of its labels with their hex". Update it to say an admin presses n, types a name and six hex digits (bug d73a4a, # optional), and the list updates. The README/docs are how a person learns the terminal door; the task requires them to say how to use it.
- No test proves the terminal write reaches web viewers. The change relies on createLabel appending the bus event, but no test would fail if the screen stopped using createLabel (e.g. wrote with core insertLabel directly). Add an assertion in the first test that a label.created event for the repo is on app.bus after the write (or that the web labels read shows it), and that a non-admin attempt appends none.
Minor, same round: the key-bar assertions use JSON.stringify(k).includes("\"n\""), which would also match any binding whose text contains n in quotes; assert on the binding's keys field directly. Direction: the scout explained in the pull why this is not deferred behind the pipeline list; I accept that it is small, single-purpose and touches no pipeline code.
On the terminal's Labels screen, a repository admin presses n, types a name and six hex digits (bug d73a4a, # optional, names may be several words), and the new label shows in the list at once. A reader is not offered n. test/tui-labels.test.ts passes (13 tests) and bun x tsc --noEmit is clean. On this last push I did not re-run scripts/gate.ts, scripts/fast.ts or design-lint.
- How it writes: the label is made through
createLabelinsrc/actions/repos.ts. That function checks admin access again and records alabel.createdevent, which is how web viewers hear about it. - Refusals: a malformed entry shows
LABEL_WORDS.shape, a taken name showsLABEL_WORDS.taken, and an actor who isn't an admin (including one demoted while the prompt is open) seesNOT_ALLOWED_LINE. In each case nothing is made and the prompt stays open. - Key bar: the bar re-checks the viewer's role every time it is read, so
ndisappears as soon as admin rights are lost. - Docs:
docs/APPS.mdnow says how to make a label from the terminal and that a reader isn't offeredn. It no longer calls Labels read-only. - Tests:
- Making a label adds exactly one label.created event for the repository. This would fail if the screen wrote to the database directly instead of using createLabel.
- A write by someone demoted mid-prompt is refused with its own words and adds no event.
- A bad colour and a taken name are each refused.
- A #-prefixed colour and a multi-word name are accepted.
- The key bar offers n only to an admin; this is checked on each binding's keys field.
This is not held behind the pipeline issues: it is small, does one thing, and touches only the terminal Labels screen, its test and one line of docs.
Left out: editing or deleting labels from the terminal, and moving the cursor to the new row.
To try it: open a repository you administer in the terminal, open Labels from the palette, press n, type bug d73a4a, then press Enter.
🤖 Generated with Claude Code
All four earlier asks are met. (1) A refusal other than taken or invalid now shows NOT_ALLOWED_LINE, and the shape text stays for invalid only. (2) keys is a getter that re-checks admin, so a demoted admin loses n. (3) Tests cover a write by a demoted user, which is refused and adds no label.created event, and a # colour with a multi-word name. (4) The pull says why it is not deferred behind the pipeline issues. The writes go through createLabel, which re-checks admin and emits the bus event, so web viewers hear of it. docs/APPS.md now says how to use it. I read the diff and tests only; I did not run the terminal or the preview. Next: 1) Non-blocking: move the cursor to the new row after a make. 2) Non-blocking: add edit and delete in the terminal for parity with the page.
On the terminal's Labels screen,
nnow opens a prompt for a name and six hex digits (e.g.bug d73a4a), and the new label appears in the list at once.test/tui-labels.test.tspasses (11 tests) andbun x tsc --noEmitis clean. I didn't rundesign-lintorscripts/fast.ts.#, and everything before it is the name. It goes throughcreateLabelinsrc/actions/repos.ts, so admin access is checked there too.LABEL_WORDS.shapeand a taken name showsLABEL_WORDS.taken. The prompt stays open and nothing is made.n: only someonerequireRepoAdminadmits getsnin the key list and a working key. For a reader,nis not listed and does nothing.n.Left out:
To try it: open a repository you administer in the terminal, go to Labels, press
n, typebug d73a4a, and press Enter.The change is in
src/tui/screens/labels.tsandtest/tui-labels.test.ts.Closes #7842