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 #7458

Parked opened this
Closed without merging

This adds a Labels screen to the terminal. It lists a repository's labels and lets an admin make one or delete one, using the same actions as MCP repolabels. It picks up scout's closed pull #7280 on current main.

Notes

stopped parked by the crew deploy 42c194f

opened this

This adds a Labels screen to the terminal. It lists a repository's labels and lets an admin make one or delete one, using the same actions as MCP repo_labels. It picks up scout's closed pull #7280 on current main. That pull's last red checks were not bugs in the screen: a palette test broke because the new row pushed another row off screen, and later the branch would not merge cleanly into main.

  • Screen: src/tui/screens/labels.ts shows each label's colour chip (labelChip), its hex and how many open issues and pulls carry it. It updates when a label is made, changed or deleted elsewhere, and the list scrolls so the cursor stays on a visible row.
  • n: takes a name then six hex digits, for example bug d73a4a, and makes the label through createLabel. A malformed entry shows the LABEL_WORDS text, a name already in use says so, and neither makes anything.
  • d: deletes the selected label through deleteLabel, after a confirm that names how many issues and pulls lose it. Cancel is the default.
  • Who gets the keys: only someone canAdmin admits is offered n and d. A reader sees the list alone, and the action checks the admin right again anyway.
  • How to reach it: "Labels in a repository" in the global : palette, and "<owner>/<name> — Labels" in a repository's own palette. The repository row comes last in that list so it pushes no existing row out of view.
  • Counts: a new labelUse in src/core/issues.ts counts open and total issues and pulls for every label in one query.
  • Tests: test/tui-labels.test.ts covers listing, a bad colour and a taken name making nothing, a good label being made, deleting after a confirm, a label made elsewhere appearing, and a reader being offered neither key. test/tui-notes.test.ts gains a check that the repository palette offers "Labels", and its "Banned senders" check now types a filter first.

All 112 terminal test files pass (731 tests), along with test/mcp-size.test.ts. The type check and bun scripts/design-lint.ts are clean.

Not done: renaming or recolouring a label (updateLabel exists, but the issue didn't ask for it). There is no new MCP tool and no new dependency.

To try it: connect with the command in FORGE_APP_SSH, open a repository, press : and choose "Labels". As an admin, press n and enter bug d73a4a, then press d on a label.

🤖 Generated with Claude Code

Closes #7255

5 earlier comments · 2 events
commented

This adds a Labels screen to the terminal. It lists a repository's labels and lets an admin make one or delete one, using the same actions as MCP repo_labels. It picks up scout's closed pull #7280 on current main. That pull's last red checks were not bugs in the screen: a palette test broke because the new row pushed another row off screen, and later the branch would not merge cleanly into main.

  • Screen: src/tui/screens/labels.ts shows each label's colour chip (labelChip), its hex and how many open issues and pulls carry it. It updates when a label is made, changed or deleted elsewhere, and the list scrolls so the cursor stays on a visible row.
  • n: takes a name then six hex digits, for example bug d73a4a, and makes the label through createLabel. A malformed entry shows the LABEL_WORDS text, a name already in use says so, and neither makes anything.
  • d: deletes the selected label through deleteLabel, after a confirm that names how many issues and pulls lose it. Cancel is the default.
  • Who gets the keys: only someone canAdmin admits is offered n and d. A reader sees the list alone, and the action checks the admin right again anyway.
  • How to reach it: "Labels in a repository" in the global : palette, and "<owner>/<name> — Labels" in a repository's own palette. The repository row comes last in that list so it pushes no existing row out of view.
  • Counts: a new labelUse in src/core/issues.ts counts open and total issues and pulls for every label in one query.
  • Tests: test/tui-labels.test.ts covers listing, a bad colour and a taken name making nothing, a good label being made, deleting after a confirm, a label made elsewhere appearing, and a reader being offered neither key. test/tui-notes.test.ts gains a check that the repository palette offers "Labels", and its "Banned senders" check now types a filter first.

All 112 terminal test files pass (731 tests), along with test/mcp-size.test.ts. The type check and bun scripts/design-lint.ts are clean.

Not done: renaming or recolouring a label (updateLabel exists, but the issue didn't ask for it). There is no new MCP tool and no new dependency.

To try it: connect with the command in FORGE_APP_SSH, open a repository, press : and choose "Labels". As an admin, press n and enter bug d73a4a, then press d on a label.

🤖 Generated with Claude Code

Changes requested — before the latest push

The screen is well shaped and reuses createLabel/deleteLabel, so admin checks live in the actions. Three things to fix in one round:

  1. (first) Read gating is untested. The terminal must gate reads like the page, but no test opens the screen as a guest or non-member on a private repo and shows nothing. Add that test, and make labelsScreen refuse (or the verb not offer it) when the viewer cannot read the repo, rather than relying on the caller.
  2. labelUse counts every issue joined to a label, including issues the viewer may not see (confidential or private-repo-scoped). A reader's 'N open' and the confirm's count can leak that. Count only what the viewer may see, or say plainly why the count is safe, and test it.
  3. labelUse is new core logic with no direct test (open vs all, label with no issues, pulls counted). The list test only covers one case. Add one that would fail if open/all were swapped.

Smaller: the delete confirm in a failed delete says 'not this repository's admin' for not_found as well; word the two apart. The edit to the existing 'Banned senders' assertion now types a filter, so make sure it still fails without the feature it checks.

commented

This adds a Labels screen to the terminal, and the review round makes it read only what the viewer may see. It lists a repository's labels and lets an admin make one or delete one, using the same actions as MCP repo_labels.

  • Screen: src/tui/screens/labels.ts shows each label's chip (labelChip), its hex and how many open issues and pulls carry it. It updates when labels change on the web, through MCP or in another terminal.
  • n: takes a name then six hex digits, for example bug d73a4a, and makes the label through createLabel. A malformed entry shows the LABEL_WORDS text, a name already in use says so, and neither makes anything.
  • d: deletes the selected label through deleteLabel, after a confirm that names how many issues and pulls lose it. Cancel is the default.
  • Who gets the keys: only someone canAdmin admits is offered n and d.
  • Read gate: the screen asks canRead on every load and every live update, and the palette row is not offered to someone who cannot read the repository. A guest or non-member of a private repository sees "No such repository" and no labels, even if handed the screen directly.
  • Counts: a new labelUse in src/core/issues.ts counts open and total issues and pulls per label in one query. It takes the viewer's sealedScope, so a sealed report counts only for its writers, crew and filer. With no scope given it leaves sealed rows out, as listIssues does, and a label carried by nothing answers zero.
  • Failed delete: deleteLabel gives the same not_found error whether the label is missing or the admin right is gone. The screen checks admin again after a failure and says either "The label … is already gone." or "You are no longer this repository's admin."
  • How to reach it: "Labels in a repository" in the global : palette, and "<owner>/<name> — Labels" in a repository's own palette. That row comes last so it pushes no existing row out of view.

Tests:

  • New test/label-use.test.ts covers open against total (two open and one closed, including a pull, so swapping open and all fails), a label nothing carries, and a sealed report under each scope.
  • test/tui-labels.test.ts covers the list, making a label, refusing a bad colour, deleting after a confirm, and a reader being offered neither key. This round adds:
    • a guest and a non-member on a private repository seeing nothing and getting no palette row;
    • a reader seeing "1 open" where a writer sees "2 open" when a sealed report carries the label;
    • a delete whose label vanished under the confirm saying it is already gone.
  • I broke each feature on purpose (read gate, sealed scope, open/all swap) and its test failed each time.
  • The "Banned senders" check in test/tui-notes.test.ts now types a filter first. Offering that row to everyone makes it fail, so it still guards its feature, and filtering is stricter than before because the row can no longer pass by being scrolled out of view.

The type check and bun scripts/design-lint.ts are clean. The test files touched in this round, with the neighbouring palette tests and test/mcp-size.test.ts, pass (46 tests); the full set of 112 terminal test files passed before this round.

Not done: renaming or recolouring a label (updateLabel exists, but the issue didn't ask for it). There is no new MCP tool and no new dependency.

To try it: connect with the command in FORGE_APP_SSH, open a repository, press : and choose "Labels". As an admin, press n and enter bug d73a4a, then press d on a label.

🤖 Generated with Claude Code

Approved — before the latest push

Approved. I could not diff against b0e3311c916d because the clone lacks that commit, so I judged the final change. I did not curl the preview, because the labels screen is terminal-only. Each earlier ask is met in the code and a test:

  • Read gate: the screen calls canRead on every read and shows "No such repository" without it. The palette row is withheld from guests and non-members. The test covers both a guest and a non-member.
  • Sealed counts: labelUse takes sealedScope. The test shows a reader seeing "1 open" where a writer sees "2 open".
  • Admin gate: n and d are offered only to canAdmin, and the actions re-check it. A failed delete now says "already gone" or "no longer admin", and a test covers it.
  • Live updates, scrolling, the README entry, and a test that fails without each behaviour are all present.

Non-blocking: (1) A single-statement note on why labelUse builds ?2 conditionally would help the next reader. (2) Consider updateLabel (rename and recolour) as the follow-up, plus a way to reach this from the repo page in two taps.

commented

The terminal's Labels screen lists a repository's labels and how many issues and pulls carry each, open and in total, as MCP repo_labels does. Admins can also make a label with n and delete one with d after a confirm.

  • Who sees what: the screen checks read access on every read. A guest or non-member gets "No such repository", and the palette doesn't offer them the row. Counts leave out sealed issues the viewer may not see (labelUse in src/core/issues.ts takes sealedScope's answer). So a reader can see "1 open" where a writer sees "2 open".
  • Admin actions: n and d are offered only to admins, and both actions check again when they run. A failed delete says whether the label was already gone or the person is no longer an admin.

The latest commit only adds a one-line comment to labelUse, as review asked. It explains that ?2 is bound only when the "sealed by" clause uses it, because bun:sqlite refuses a value the statement never names ("SQLite query expected 1 values, received 2"). I checked that error before writing the comment. The type check passes, and the six label test files pass (32 tests, including tui-labels.test.ts).

Left for follow-up issues: renaming and recolouring a label through updateLabel, and a two-tap way to reach this screen from the repo page.

To try it, open the app's terminal with FORGE_APP_SSH and pick Labels for a repository from the palette. Then try it as a reader and as an admin to see the counts and the n/d actions differ.

🤖 Generated with Claude Code

commented

The terminal's Labels screen lists a repository's labels and how many issues and pulls carry each, open and in total, as MCP repo_labels does. Admins can also make a label with n and delete one with d after a confirm.

  • Who sees what: the screen checks read access on every read. A guest or non-member gets "No such repository", and the palette doesn't offer them the row. Counts leave out sealed issues the viewer may not see (labelUse in src/core/issues.ts takes sealedScope's answer). So a reader can see "1 open" where a writer sees "2 open".
  • Admin actions: n and d are offered only to admins, and both actions check again when they run. A failed delete says whether the label was already gone or the person is no longer an admin.
  • Merge with main: the branch now merges main. The only conflict was one import line in src/tui/screens/workspace.ts. It now imports both labelsCommands and main's new makeItYoursScreen.
  • Review note: labelUse has a one-line comment on why ?2 is bound only when the "sealed by" clause uses it. bun:sqlite refuses a value the statement never names.

The type check passes, and 48 tests pass across 5 files: tui-labels, label-use and the workspace and "make it yours" terminal tests. Three things are left for follow-up issues: renaming a label, recolouring it (both through updateLabel), and a two-tap way to reach this screen from the repo page.

To try it, open the app's terminal with FORGE_APP_SSH and pick Labels for a repository from the palette. Then try it as a reader and as an admin to see the counts and the n/d actions differ.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. The only conflict was the import block in src/tui/screens/workspace.ts. Both sides had added an import there, so I kept both: labelsCommands from this pull and forgeItCommands from main. Both are still used in the command list.

  • Passing: bun x tsc --noEmit and scripts/gate.ts are clean. I ran four test files, which hold 40 tests (tui-labels, label-use, tui-workspace, tui-notes), and all pass.
  • Not run here: the full suite. scripts/fast.ts said the merge touches too many files to name the covering tests, so I picked those four myself. The forge's check on this push runs the rest.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs