018 — Labels as columns in tp issue list

Status: ready

Why

tp issue list prints #N title, and nothing else. Since story 017 the labels are what say what an issue is — roadmap, story, a fix — so a list without them is a list of titles with no way to tell an epic from a bug, or to scan for the stories. The forge already returns the labels and forge.Issue already carries them; the list just drops them.

Labels of varying length written inline would make the titles ragged and the list unscannable, which is the one thing a list is for.

What changes

  • tp issue list prints each issue as #N [state] LABELS title: the number padded to the widest in the listing, the state (only when the list is not of open issues, as today) likewise, then a label prefix of exactly 20 characters, then the title.

  • The prefix is laid out after the fetch, from the most labels any listed issue has, capped at three. Each slot is a label padded to its width, the last character of each slot a space; a label too long for its slot is cut and ends in ..:

    Labels in the listing Slots Label fits Else cut to
    0 none: #N title, as today
    1 one of 20 19 17 + ..
    2 two of 10 9 7 + ..
    3 or more 8, 7, then 5 7, 6, 4 5 + .., 4 + .., 2 + ..
  • An issue with fewer labels than slots leaves the rest blank; a fourth label and beyond are not shown. Labels appear in the order the forge returns them.

  • docs/issue.md shows the new shape.

Acceptance

Command State Outcome
tp issue list no issue has a label #N title per line, number padded to the widest
tp issue list every labelled issue has one label, e.g. roadmap #5 roadmap Title: one 20-wide slot; blank for an unlabelled issue
tp issue list one label of 25 characters, one slot first 17 characters then .., then a space
tp issue list #46 has roadmap, story; #5 has roadmap #46 roadmap story Title / #5 roadmap Title: two 10-wide slots
tp issue list two slots, a label of 12 characters 7 characters + .., padded to 10
tp issue list an issue has roadmap, story, fix, urgent roadmap story fix — slots of 8, 7, 5; urgent dropped
tp issue list three slots, labels documentation, enhancement, question docum.. enha.. qu..
tp issue list all mixed states and labels #N [state] LABELS title, state padded to the widest
tp issue list labels b, a as returned by the forge b then a — forge order, not sorted

Out of scope

  • Choosing which three labels: a --label filter or a preference for roadmap/story over the rest. Forge order is enough for now.
  • Colour, or a prefix wider than 20 when labels are long: the budget is fixed so titles start in the same column on every run.
  • The alternative layout: one coloured character per label and a space, with a legend below (blue R for roadmap, ...). Worth a look if the 20-character prefix feels wrong in use.
  • tp issue show, which prints no labels in text form today (only -json carries them): a separate story if wanted.

Decisions

none

Done when

  • tests express the acceptance table and pass
  • spec updated (docs/issue.md)
  • changelog entry
  • issue closed with a link to the release