Compare commits

..
8 Commits
Author SHA1 Message Date
Ansho ReiandClaude Opus 5 4502de7ee3 (e7612de) Close the detail overlay on q instead of quitting, and bump to 0.13.5
q set should_quit outright, so a reader who pressed it to put a ticket away
lost the whole board instead. That is not what q means anywhere else that
lays a document over a list, and esc two arms below already did the right
thing.

The rule is Board::dismiss: close what is open, quit when there is nothing
left to close. On Board rather than in the match arm because the dispatch in
main.rs is not reachable from a test, so a rule written there is a rule
nothing can check. q and esc now share one arm, since two arms carrying one
rule is how a later edit changes it for one key and not the other.

The footer is the other half. Its last slot answers the same question in
both states, how to get out, and with a ticket open the honest answer is
ctrl-c: it is the only key left that quits in one press. Going on saying
q quit there would be 1b78a24 in the other direction, a footer describing a
key by what it used to do. The close entry names both keys as enter/q close
rather than repeating close twice.

Criteria 3 and 7 live in a dispatch no test can reach, so
the_dispatch_gives_q_and_esc_one_arm_and_leaves_ctrl_c_quitting scans
main.rs for them, over whitespace-collapsed source so rustfmt cannot fail
it, the way util.rs is already scanned for colour_text callers.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 13:13:58 +02:00
Ansho ReiandClaude Opus 5 a16169ce8c (b8ce18c) Show a blocked marker on the tui card, and bump to 0.13.4
A ticket held up by an open blocker looked exactly like one that is ready,
and the board is where the next thing to pick up is chosen.

The mark is × in brightred, after the short id. Not a fourth Geometric
Shapes glyph: those are the priority meter's, two cells away, and another
circle there reads as part of that ramp. × is Latin-1, like the middle dot
the unset priority draws, so it renders wherever the meter does.

After the id rather than before it, because ahead of it the mark would push
every id in the column out of line whenever one card was blocked. It is
measured before the project label and the due date, so both give way to it:
those are context for a ticket somebody can start, and this is the one thing
on a card that says not to. Dropped whole when the row cannot hold the
identity and the mark together.

No scan of the board per tick was needed after all. collect_ticket_items
also reads the ticket's own uuid and the targets of its blocked by lines,
off the file it is already holding, and mark_blocked walks the four columns
once for a uuid-to-status map and once to answer every card. The flag is on
Card rather than TicketItem: the answer is about two tickets at once, so no
card can reach it alone, and it is settled at reload the way project is.

The merge carries each card's flag from the board it came from. relate
resolves its target inside one .worklane, so a blocker in another project is
not a relation anything can record, and recomputing over the merged columns
would let one project's uuid match another project's ticket.

project_label now takes the width the row has actually spent, measured off
the spans, instead of adding up the widths those spans are supposed to have.
The hand-written sum left out the space after the priority mark, so a cut
label was handed one cell more than the column had.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 13:02:13 +02:00
Ansho ReiandClaude Opus 5 3d6a74bc53 (daa0e79) Validate the due date at parse time, and bump to 0.13.3
A clap value_parser beside priority_level rather than a check inside cmd_add,
so a bad date is a usage error with nothing written at all rather than
written and then rejected.

On set --due as well as add --due, from one definition. The planning skill
sets dates through set and never through add, so validating only the command
that files a ticket would have left the path the validation exists to
protect still accepting "next friday".

The shape is checked before chrono sees it. %Y-%m-%d accepts an unpadded
2026-8-9, which would be stored as typed and sort before 2026-10-01. Strict
on the way in, tolerant on the way out: util::due_date still cuts a datetime
down to its date, since a file written earlier can hold one.

PLAN.md told the planner the value was not validated. That is corrected, and
the guard test that failed on the edit now pins the half of the warning that
is still true: a date cannot be cleared, only replaced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 03:22:04 +02:00
Ansho ReiandClaude Opus 5 7a0dd625ce (1e7b1a9) Colour a tag by its name, and bump to 0.13.2
FNV-1a over the tag bytes into an eight-colour reserved palette, so the same
tag is the same colour on every card and on every board with nothing stored.
The hash is written out rather than taken from std, whose output is not
promised stable across releases.

The index is multiply-shift, not `% len`. The length is a power of two, so a
modulus keeps the low three bits of the hash, and FNV-1a's low bits carry
only the low bits of the input bytes: nothing moves information downwards.
Every pair of tags differing above bit 2 landed in one slot, `bug` and `BUG`
among them. It looked like a good palette, two colliding cards in sixty-four
on this board, because the vocabulary had been folded into a handful of
slots. Using the whole hash gives 14/64, which is the real arithmetic for
eight colours.

The palette is reserved as a list and disjoint from the seven colours that
already mean something: a tag in red reads as a uuid, in green as a title.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 03:13:56 +02:00
Ansho ReiandClaude Opus 5 8d8ae8abfe (822e8a1) Add a worklane-plan skill, and bump to 0.13.1
A third asset on the machinery 16c2bed settled, so the wiring is one entry in
install::SKILLS.

Four jobs, priorities, due dates, tags and campaigns, with propose-then-apply
stated once at the top rather than per section. Every job writes to many
tickets at once and no field can be cleared back to unset, so the document
leans on the two traps that make a sweep destructive rather than merely
wrong: set --tags replaces the whole field, and a due date is neither
validated nor clearable.

feature-planner-agent.md is deliberately not folded in. It decomposes a
request into new tickets, which is intake; this orders the tickets that
already exist, and one document holding both would fit neither.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 02:58:50 +02:00
Ansho ReiandClaude Opus 5 d5fb22cfd8 (16c2bed) Add a worklane-review skill, and bump to 0.13.0
install-skill now writes every document the binary carries, with an optional
name to narrow it. Requiring a name per document would mean a skill added
later never reaches anyone who already knows the invocation, which is the
drift the command exists to prevent. --print is the exception and requires
the name: a diff is against one document.

The review skill is its own document rather than a section of SKILL.md,
because the frontmatter description is the whole of what decides loading and
one description cannot name both "anything touching a ticket" and "only when
a review is asked for".

The reviewer never ticks a criterion and never moves the ticket. A tick is
the implementer's claim and unticking is the review disagreeing; one mark for
both loses the disagreement. mv belongs to whoever does the work.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 02:40:37 +02:00
Ansho ReiandClaude Opus 5 2c0a99f7c4 (e41802b) Record that the board is drawn for a person, not parsed
Scripts and agents drive worklane through the CLI, which is what the skill
teaches and what the integration tests pin. Nothing reads the drawn frame, so a
change to what a card carries breaks no caller and is judged on whether it reads
well. Written down beside the version rule as well, since "changed output" there
means the CLI's output: that is why a new row on every card is a patch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 01:08:54 +02:00
Ansho ReiandClaude Opus 5 91bbc19c32 (e41802b) Show a ticket's tags on its tui card, and bump to 0.12.1
The Tags field was invisible on the board: a card carried the mark, the short id,
the due date, the owner and the criteria count, and nothing said a ticket was
tagged bug without opening it.

TicketItem gains a tags field, filled in collect_ticket_items through parse_tags
where the file is already being read, for the reason the criteria count is: the
board draws them on every card, and asking per card would re-read every ticket
body on every draw. parse_tags splits the comma-separated field into whole
trimmed values, so a caller asking for bug is not answered by bugfix, and reads
absent, _None_ and empty as one answer. That is step one of 2f3796e5, lifted here
because the board cannot read the field before it exists.

The row sits under the title, dimmed like the owner and the count, each tag
prefixed with # so it does not read as a third line of the title. It is dropped
whole when the column will not hold it, the rule a corner follows, and an
untagged ticket spends no row at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 01:07:40 +02:00
16 changed files with 1867 additions and 106 deletions
+37 -4
View File
@@ -8,7 +8,9 @@
- `src/campaign.rs` - the campaign file format, its resolution, its index and its members
- `src/tui.rs` - board state, the change digest, and the ratatui draw
- `src/install.rs` - the embedded agent assets and the compare-and-refuse install
- `assets/SKILL.md` - the agent skill `install-skill` ships, embedded with `include_str!`
- `assets/SKILL.md` - the agent skill for the CLI itself, embedded with `include_str!`
- `assets/REVIEW.md` - the agent skill for reviewing a finished ticket, shipped the same way. Assets are named after the role they teach; `SKILL.md` keeps its name because the role it teaches is the CLI
- `assets/PLAN.md` - the agent skill for grooming the whole board: priorities, due dates, tags and campaigns
- `tests/` - Integration tests using `assert_cmd` and `assert_fs`, one file per command
- Unit tests live beside the code in `#[cfg(test)] mod tests`, in `util.rs`, `handlers.rs` and `tui.rs`
- Ticket files stored as `.md` in `.worklane/<status>/` directories
@@ -51,6 +53,10 @@ and this file is for what someone changing worklane's own code needs.
### CLI Arguments
- The prose arguments carry `allow_hyphen_values`, via the `PROSE` constant in `command.rs`: `add --title`, `--description`, `--acceptance`, `--plan`, and the `comment` body. Ticket text quotes flag names constantly, and without it a criterion reading `--print is supported` is parsed as a flag and the whole ticket is refused with nothing written
- **The trade:** on those five arguments a genuinely mistyped flag now lands as content rather than raising a usage error. That is the right way round for prose and the wrong way round for anything else, which is why `due`, `priority`, `tags`, `owner` and `status` are deliberately left without it. A mistyped flag there is still a usage error, exit 2, and no ticket is written. Do not add `PROSE` to a new argument unless it holds prose
- **`--due` is validated at parse time by `iso_date`, the way `--priority` is by `priority_level`.** A date that is not real is a usage error, exit 2, with nothing written, which is the whole point of leaving the scalars without `PROSE`. One parser serves `add` and `set`: the field has one definition of what it accepts, and validating only `add` would leave `set` open, which is the command a grooming sweep actually uses
- **The shape is checked before chrono is asked.** `%Y-%m-%d` accepts an unpadded `2026-8-9`, which would be stored exactly as typed and sort before `2026-10-01` in any string comparison. Checking the length and the two dashes first is what lets a valid date be stored unchanged instead of normalised on the way in, which is the difference between validating and rewriting
- **Strict on the way in, tolerant on the way out.** `util::due_date` still cuts `2026-12-31T09:30:00Z` down to its date. A file written before the parser existed, or by hand, can hold one and still has to render; refusing to display what is already stored would punish the reader for the writer's mistake
- An empty `--due` keeps `non_empty`'s message about clearing rather than the date message. Somebody typing it is reaching for a way to clear the field, and the useful answer is that clearing is not supported yet
- The ticket positionals (`show <id>`, `mv <ticket>`, `comment <ticket>`) are also left alone, so a search term starting with a hyphen is a usage error. Reachable now that a hyphen-leading title can be stored: use the UUID, or put the flags first and separate with `--`, as in `mv --status committed -- -leading-title`
- A bare `--` is a value when it follows an option (`--title -- ` stores `--`) and clap's end-of-options marker when it sits in a positional. So a `comment` body of exactly `--` needs its own separator, `comment <ticket> -- --`. Without it the body is reported missing and nothing is written, which is a clear failure rather than a silent drop
- `add` has no positionals, so anything after a bare `--` is an unexpected argument and fails
@@ -92,7 +98,7 @@ and this file is for what someone changing worklane's own code needs.
- `ensure_section` inserts against `SECTION_ORDER`, before the first following section that is actually in the file, and adds no blank line that was not already there. A handwritten `## Notes` between the plan and the metadata therefore keeps its place, and Metadata is in that list as an anchor rather than as something anything appends to
- **The blocker check runs on every move**, after the already-in-that-status return and behind `force`. An open blocker is a reason not to start and a reason not to finish, and one rule is easier to hold than a table of which transitions care. A move to the status the ticket is already in is not a move, so it is not refused. `-f` now bypasses three rules, which is the right home for it: each one is a deliberate override of something the board would otherwise keep true
- **A blocker that is not on the board warns and allows the move.** Refusing would wedge the ticket with no way out but `-f`, and a uuid nothing carries is a bookkeeping fault rather than a dependency. The refusal names **every** open blocker, since clearing the one that happened to be printed would leave the ticket blocked
- Left out on purpose: removing a relation, which 4179958 assigns to 74904dc, and a blocked marker on the TUI card, which is its own ticket. Nothing on a card is worth a scan of the board per tick until the card is designed for it
- Left out on purpose: removing a relation, which 4179958 assigns to 74904dc. The blocked marker on the card landed in b8ce18c, and it cost no scan of the board: the blockers ride along on the read that already builds the cards. See The Board View
### Campaigns
@@ -107,11 +113,12 @@ and this file is for what someone changing worklane's own code needs.
- **`Resolved` carries what `content_trim` cannot render from the file.** The relations block and the campaign cell both come from elsewhere on the board. A struct rather than two more parameters, so the next such field is one entry here instead of an edit at every call site
- `campaign show` lists **done** members, unlike `ls`, which leaves the done column out of its listing. What is finished against what is left is the whole question a campaign asks, so hiding half the answer is not an option. `ls --campaign` is the other way round: it is the ordinary board filtered, and keeps every rule `ls` already has
- `campaign ls` scans the status directories **once per campaign** to count members. That is a scan per row rather than one walk reused, and it is deliberate: the map-from-uuid version is worth writing when a board has enough campaigns to notice
- **The TUI gets neither a campaign tab nor a card marker**, for now. The detail view resolves the field because it renders the body, and that is all. A marker on a card would want a campaigns read per reload and the four corners are already spent; same reasoning as the blocked marker, which is also its own ticket
- **The TUI gets neither a campaign tab nor a card marker**, for now. The detail view resolves the field because it renders the body, and that is all. A marker on a card would want a campaigns read per reload, which is more than the blocked mark cost: that one reads the ticket's own Relations section on the pass that already builds the card, and a campaign title is in another directory
- `campaign_body()` builds the file from `DESCRIPTION` and `METADATA_HEADING` rather than its own string literals, so the two file formats cannot drift apart on the spelling of a heading. A campaign has no acceptance criteria (its definition of done is derived), no implementation plan and no Status
- The campaigns directory is created by `init` and **on demand** by `campaign add`, since every board made before campaigns existed has none and a `worklane init` over a live board to get one would be a strange thing to have to do
### The Board View
- **The board is for a person, and only for a person.** Scripts and agents drive worklane through the CLI, which is what `assets/SKILL.md` teaches and what the integration tests pin. Nothing parses the drawn frame, so its layout is free to change: a new row on a card, a moved corner, a different colour or a hidden column breaks no caller. Judge a change here on whether it reads well, not on what it might break, and do not preserve a layout for compatibility's sake. What the CLI prints is the opposite case and is not covered by this
- `worklane` with no subcommand and `worklane tui` both open it, the way a bare `frig` does. `Cli::command` is therefore an `Option`
- The worklane directory is looked for **before** the terminal, so running outside one gives the usual "No .worklane directory found" rather than a complaint about the tty. Both errors stay reachable and both are testable without a pty
- A missing tty is refused with a message naming a subcommand. Raw mode on a pipe fails with a bare "No such device or address (os error 6)", which explains nothing
@@ -128,6 +135,9 @@ and this file is for what someone changing worklane's own code needs.
- The draw aligns the focused column again on its own geometry, so a resize between keypress and frame cannot hide the selection, and caps every column against blank space past its last card. The stored value may go stale after a tick shrinks the column; that is fine, because what is drawn is corrected immediately and the next navigation writes the correction back
- Entering another column follows the selection rather than resetting to its top. The card index carries across columns, so a reset would open the column with the highlight below the fold whenever it was — the opposite of the detail view's reset-on-selection-move, where each ticket genuinely starts at its own top. The index is shared and clamps permanently when a shorter column pulls it down, so a column you return to follows the selection to where it now sits rather than holding your old place
- **The footer names only keys that work.** It read `↑↓ scroll` when nothing scrolled at all, which sends the reader looking for their own mistake. A UI that misdescribes itself is worse than one that is merely incomplete
- **`q` and `esc` are one key: close what is open, quit when there is nothing left to close.** `q` used to set `should_quit` outright, so a reader who pressed it to put a ticket away lost the board instead, which is not what `q` does anywhere else that lays a document over a list. One match arm in `main.rs`, not two: two arms carrying one rule is how a later edit changes it for one key and not the other
- **The rule is `Board::dismiss`, not the match arm.** The dispatch in `main.rs` is not reachable from a test, so anything decided there is undecidable by the suite. The arm is the line that names the keys and nothing else. `the_dispatch_gives_q_and_esc_one_arm_and_leaves_ctrl_c_quitting` scans `main.rs` for what the arm cannot say for itself, over whitespace-collapsed source so rustfmt cannot fail it
- **The footer's last slot always answers how to get out**, and with a ticket open the honest answer is `ctrl-c`, the only key left that quits in one press. Going on saying `q quit` there would be 1b78a24 in the other direction: a footer describing a key by what it used to do
- **The overlay names its ticket on the border, not at the head of the paragraph.** `Board::detail` is a `Detail` carrying the title, the id and the text, because the name has to travel beside the body rather than inside it: `content_trim` drops the `# ` heading on purpose, since `cmd_show` prints it, and anything in the paragraph scrolls away
- `detail_title` cuts the string itself instead of leaving it to ratatui, which truncates an overlong block title at whatever cell it reaches and would take the id with it. Cut against the inner width, so the id survives whole and the name ends in an ellipsis. The id goes first because that is how every other view addresses a ticket
- The detail view renders with colour off. ratatui draws styled spans, so an escape sequence in a paragraph would be printed as literal bytes. `content_trim` and `format_comments_with` take the colour decision for that reason
@@ -137,6 +147,14 @@ and this file is for what someone changing worklane's own code needs.
- **A card's height therefore depends on the column's width**, so `card_lines` and `card_height` both take it. `column_areas` is shared between the draw and `follow_selection` for the same reason: `Ratio` hands the remainder column to whichever slot it likes, and reproducing that arithmetic by hand is how the measurement and the draw come to disagree about where a card starts
- **A corner that will not fit is dropped whole**, never truncated or wrapped: half a date reads as a different date, and a card that reflows in a narrow column changes height, which the scroll would then have to chase. The left corner is the ticket's identity and always stays
- The criteria count is a field on `TicketItem`, filled in `collect_ticket_items` where the file is already being read, and counted through `criteria()` so a checkbox in a description is not counted here or numbered by `show`. Do not count per card: that re-reads every ticket body on every draw instead of on the tick that changed something. `None` rather than `[0/0]` for a ticket with no criteria
- **The tags go under the title, dimmed, each prefixed with `#`.** The field was invisible on the board: nothing said a ticket was tagged `bug` without opening it. The marker is what stops the row reading as a third line of the title, since a tag is an ordinary word and the title sits directly above it. The row is dropped whole when the column will not hold it, the rule a corner follows, and an untagged ticket spends no row at all, the way a short title spends no second one
- `tags` is a field on `TicketItem`, filled in `collect_ticket_items` through `parse_tags`, for the reason the criteria count is. `parse_tags` splits the comma-separated field into whole trimmed values, so a caller asking for `bug` is not answered by `bugfix`, and reads absent, `_None_` and empty as the same answer
- **A held-up card carries `×` after its id, in brightred.** A ticket waiting on an open blocker looked exactly like one that is ready, and the board is where the next thing to pick up is chosen. Not a fourth circle from Geometric Shapes: those belong to the priority meter two cells away and would read as part of that ramp. The multiplication sign is Latin-1, like the middle dot the unset priority draws, so it renders wherever the meter does
- **The mark goes after the id, not before it.** Ahead of the id it would push every id in the column out of line whenever one card was blocked, which costs more than one card's state is worth. It is measured before the project label and the due date, so both give way to it: those are context for a ticket somebody can start, and this is the one thing on a card that says not to. Dropped whole when the row cannot hold the identity and the mark together, the rule a corner follows
- **`blocked` is on `Card`, not on `TicketItem`.** The answer lives on two tickets at once, so no card can reach it alone, and it is settled at reload the way `project` is. What `collect_ticket_items` fills is the ticket's own `uuid` and its `blockers`, both read off the file it is already holding; `mark_blocked` then walks the four columns once for a uuid-to-status map and once to answer every card. No file is read twice and nothing is asked per draw
- **A blocker the board does not hold marks nothing**, the answer `mv` already gives a dangling uuid. A Relations section that cannot be parsed reads as no blockers, the exception `detail_of` makes for the same reason: `show` and `mv` are where a hand-edited file is reported, and a board that will not draw because one ticket is malformed is the worse failure
- **The merge carries the flag rather than recomputing it.** `relate` resolves its target inside one `.worklane`, so a blocker in another project is not a relation anything can record; resolving over the merged columns would let one project's uuid match another project's ticket. That is b8ce18c's fourth plan step and the answer is no
- `project_label` takes the width the row has already spent, measured off the spans, rather than adding up the widths those spans are supposed to have. The hand-written version left out the space after the priority mark, so a cut label was handed one cell more than the column had; `the_project_label_leaves_the_row_inside_the_column` pins it
- `due_date` cuts a due value back to its date only when it has one. The field is not validated (daa0e79), so it can hold a time or free text, and taking the first word regardless would turn "next friday" into "next"
- **Done is hidden until `d` asks for it.** Not a new opinion: `ls` already counts done in its summary and leaves it out of the listing. Done only grows, so a quarter of the width was going to the column least often read. The footer carries its count while it is hidden, which is the board's version of that summary line
- **Hiding is a change to what is drawn, never to what is read.** `reload` still scans the done directory and `digest` still watches it, so the footer count is right and revealing the column needs no rescan. Do not "optimise" that into a conditional scan
@@ -167,7 +185,16 @@ and this file is for what someone changing worklane's own code needs.
- **A modified copy is refused, not overwritten.** Someone may have edited it on purpose, and the message names `--print` so it can be diffed and `--force` so it can be replaced. A read error is not treated as absent either: the write reports the real reason
- Three tests guard the document rather than the mechanism, and they are the ones that earn their keep: the frontmatter has to parse (both agents silently ignore a document without it), every `worklane <x>` the skill shows has to be a real subcommand, and every subcommand outside `NOT_FOR_AGENTS` has to appear in the skill. The last one catches a new command that nothing tells an agent about
- `install-skill` looks for no board. The skill is what teaches an agent worklane, so needing a `.worklane` to install it would put it out of reach exactly when it is wanted
- The assets under `.opencode/` are the user's, not this repo's to ship. Do not embed or install them
- The assets under `.opencode/` are the user's, not this repo's to ship. Do not embed or install them. `reviewing-agent.md` there is the prior art the review skill grew out of and is deliberately **left in place**: its content is now in `assets/REVIEW.md`, but deleting a file under `.opencode/` is not this repo's call. Whether the stale copies there go is b2c5531's question
- **`install-skill` writes every shipped document, and the name narrows it.** One document teaches the CLI and the others teach a job done with it, so a person who learned the invocation before a document existed still receives it. Requiring a name per document would mean a new skill silently never arrives for anyone who does not read the changelog
- **`--print` requires the name.** It exists so a modified copy can be diffed, and a diff is against one document; printing them concatenated would be neither of them. The unnamed case errors with the list of names rather than guessing, the same choice the `comment --` body makes
- The refusal message names the document it is about, `install-skill worklane --print`, since with several installed "compare with --print" does not say compare what
- **A refused document does not stop the ones behind it.** The loop reports an outcome per document and the "pick it up on their next session" line is printed once, and only when something was actually written
- **A role skill is its own document, not a section of `SKILL.md`.** The frontmatter description is the whole of what decides whether a skill loads, and one description cannot name both "anything touching a ticket" and "only when a review is asked for" without fitting neither. It is also why the review document does not restate the CLI: it says to read the `worklane` skill too
- The review skill's own rules are guarded by `the_review_skill_keeps_the_decisions_that_define_it`, because each of them is a line an edit could drop without breaking anything: **the reviewer never ticks a criterion** (a tick is the implementer's claim, unticking is the review disagreeing, and one mark for both loses the disagreement), **never moves the ticket** (`mv` belongs to whoever does the work, the reviewer's half is the recommendation), and **never reviews the working tree when no commit names the ticket** (it says what it searched for and stops, since an untraceable ticket in `reviewing` is itself the finding)
- **The plan skill is the one that can do damage, so its rules are the ones under test.** `set --tags` replaces the whole field, so a sweep that restates a ticket's tags incompletely deletes the rest, and a due date is neither validated nor clearable. `the_plan_skill_keeps_the_rules_that_bound_a_sweep` pins propose-then-apply and those two traps, because a document that loses them still reads like a plan
- `.opencode/agent/feature-planner-agent.md` is **deliberately not folded into `PLAN.md`**. It decomposes a feature request into new tickets, which is intake; `PLAN.md` orders the tickets that already exist. Merging them would give one document two jobs and a frontmatter description that fits neither, which is the same reason the review skill is its own document
- `every_agent_facing_subcommand_is_documented` stays on `SKILL` alone. It owns the CLI surface; a role document uses the handful of commands its job needs, and requiring the rest would fill a review document with `init` and campaigns to satisfy a test. The two checks that do run over every document are the frontmatter and that no document shows a command that does not exist
### Color and Output
- Use `color_text()` for coloured output — it respects `should_use_colors()` (terminal detection), and `paint()` is the same with the decision passed in
@@ -187,6 +214,11 @@ and this file is for what someone changing worklane's own code needs.
- Title → green (32)
- Unknown values (`_None_`, `_Not set_`) → grey (38;5;8)
- Priority ramp → brightred (1), red (2), orange (3), cyan (4), grey (5). Green is deliberately absent: it means title
- **The palette splits in two: seven colours that each mean one thing, and `TAG_COLORS`, the eight a tag may be drawn in.** A tag in red would read as a uuid, in green as a title, in grey as an unset value, so the tag slots are reserved as a list rather than picked at the call site. Do not assign a new meaning to a colour in `TAG_COLORS`, and do not draw a tag in one outside it
- `tag_color()` is a pure function of the tag string, so the same tag is the same colour on every card, in every view and on every board, with nothing stored. Case sensitive, because `Bug` and `bug` are two different tags to the field and to every search
- **The hash is FNV-1a written out here, not `DefaultHasher`.** std does not promise its output is stable across releases, and a board that repaints itself on a toolchain upgrade has lost the only property the mapping is for. `the_tag_mapping_is_pinned` fails on any change to it, so a repaint is a decision rather than a surprise
- **The index is multiply-shift, not `% TAG_COLORS.len()`.** The length is a power of two, so a modulus keeps only the low three bits of the hash, and FNV-1a's low bits carry only the low bits of the input bytes: multiplication cannot move information downwards. Under a modulus every pair of tags differing above bit 2, `bug` and `BUG` among them, landed in one slot regardless of the rest of the string. It looked like a *good* palette on this board, two colliding cards out of sixty-four, because the vocabulary had been folded into a handful of slots. Taking the top bits of a 128-bit product uses the whole hash
- Eight tag colours means roughly one card in five shows two tags alike. That is arithmetic and is accepted: the colour groups a tag across cards, it does not tell two tags apart within one, and the tag text is beside it either way. Do not widen the list to chase the number on one board
- Grey is indexed colour 8 in the 256-colour form, not SGR 90 or 37. Both of those failed on a real palette: 90 leans on the bright-black slot and 37 can sit on top of the default foreground. `\x1b[38;5;8m` is byte for byte what crossterm emits for ratatui's `Color::DarkGray`, the grey frig and pantop use for dimmed rows
### Code Organization
@@ -216,6 +248,7 @@ and this file is for what someone changing worklane's own code needs.
- Before every commit, decide whether the change warrants a version bump in `Cargo.toml`
- Always ask the user to confirm the bump and its kind before making it — never bump silently, and never skip the question because the answer looks obvious
- Pre-1.0, so: patch for fixes and internal changes, minor for a new command, flag or changed output, major only for a deliberate 1.0
- **Changed output means the CLI's output.** That is the surface scripts and agents read, so a changed listing, message or exit code is a minor. A change to what the board draws is a patch however visible it is, since nothing consumes the frame. See The Board View
- No bump for docs-only, tests-only or `--fixup` commits
- When one body of work spans several commits, bump once on the final commit rather than on each
- Bump `Cargo.toml` and the `worklane` entry in `Cargo.lock` together, in the commit that carries the bump
Generated
+1 -1
View File
@@ -1494,7 +1494,7 @@ dependencies = [
[[package]]
name = "worklane"
version = "0.12.0"
version = "0.13.5"
dependencies = [
"anyhow",
"assert_cmd",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "worklane"
version = "0.12.0"
version = "0.13.5"
edition = "2024"
[dependencies]
+2 -2
View File
@@ -7,7 +7,7 @@ Worklane is a local Kanban flow for agentic software development.
|---------|-------------|
| `worklane` or `worklane tui [path...]` | Opens the board: four status columns, redrawn when the tree changes. Read only. Opens on backlog, committed and reviewing; `d` shows or hides done, whose count stays in the footer either way. Arrows or `hjkl` to move, `enter` for detail, `pgup`/`pgdn` to scroll an open ticket, `q` to quit. Each path opens the first `.worklane` at or above it, the working directory by default. Several paths are monitored together, as a tab per project plus an `all` tab that merges them, with `tab` and `shift+tab` between them |
| `worklane init` | Creates `.worklane/` with backlog, committed, reviewing, done directories |
| `worklane add` | Creates a ticket in backlog with `--title`, `--description`, `--acceptance`, `--plan`, `--tags`, `--due`, `--owner`, `--priority` flags |
| `worklane add` | Creates a ticket in backlog with `--title`, `--description`, `--acceptance`, `--plan`, `--tags`, `--due`, `--owner`, `--priority` flags. `--due` takes `YYYY-MM-DD` and refuses anything else at parse time |
| `worklane ls [status]` | Lists tickets, sorted by priority then title. Optional positional status, and `--priority <1-5>` |
| `worklane show <id>` | Shows ticket by UUID prefix (4+ chars), title substring, or filename substring |
| `worklane mv <id> --status <target> [-f]` | Moves ticket between statuses. Default: forward only, one stage at a time. `-f` bypasses both restrictions |
@@ -18,7 +18,7 @@ Worklane is a local Kanban flow for agentic software development.
| `worklane check <ticket> [criterion]` | Ticks one acceptance criterion, by number as shown by `show` or by a substring. Prompts with the numbered list if omitted, or errors with it when there is no terminal |
| `worklane uncheck <ticket> [criterion]` | Unticks one acceptance criterion, addressed the same way |
| `worklane comment <ticket> <body>` | Adds a comment to a ticket by UUID or title |
| `worklane install-skill` | Writes the embedded agent skill to `~/.claude/skills/worklane/SKILL.md`, which Claude Code and opencode both read. Leaves a modified copy alone unless `--force`; `--print` writes it to stdout instead |
| `worklane install-skill [skill]` | Writes the embedded agent skills to `~/.claude/skills/<skill>/SKILL.md`, which Claude Code and opencode both read. Three ship: `worklane` teaches the CLI, `worklane-review` reviews a finished ticket against the code that claims to close it, `worklane-plan` grooms the board as a whole, its priorities, due dates, tags and campaigns. Every document unless one is named. Leaves a modified copy alone unless `--force`; `--print` writes one to stdout instead and needs the name |
## Exit codes
| Code | Meaning |
+183
View File
@@ -0,0 +1,183 @@
---
name: worklane-plan
description: Groom a worklane board as a whole rather than one ticket at a time: review whether the priorities are right relative to each other, plan work by setting due dates, check the tags for consistency, and find the tickets that belong together in a campaign. Use for questions about the backlog as a body of work, what to do next week, what is mis-prioritised or mis-tagged, and what could become one goal. Not for filing or working a single ticket.
---
# Planning a worklane board
For "are the backlog priorities right", "plan in tickets for next week", "check the
tagging", "which of these could be one campaign". The subject is the board, not a
ticket. Filing one, working one and reviewing one are other jobs.
The CLI itself is the `worklane` skill: the statuses, how a ticket is addressed and
which command owns which field. Read it too. This document is the judgement.
## The one rule
**Propose the whole set of edits, wait, then apply exactly what was approved.**
Every job here writes to many tickets at once, and no field can be cleared back to unset
yet, so a date written onto the wrong ticket can only be overwritten, never taken off. A wrong
edit to one ticket is a mistake; a wrong sweep is thirty of them with no undo. So a
proposal is a list, one line per intended edit, each naming the ticket and the command
that would make it:
```
(1b78a24) priority 3 -> 1 worklane set 1b78a24 --priority 1
(4179958) due -> 2026-08-29 worklane set 4179958 --due 2026-08-29
```
Then apply what was approved and nothing else. Not "and a few obvious ones while I was
there": an approval is for the list that was shown.
## Who writes what
Every field has exactly one command that writes it, and a sweep that reaches for any
other way is editing the file by hand:
| Field | Writer |
|-------|--------|
| Priority, Due, Tags | `worklane set <ticket> --priority` / `--due` / `--tags` |
| Relations | `worklane relate <ticket> --blocked-by` / `--regression-of` / `--relates-to` |
| Campaign membership | `worklane assign <campaign> <ticket>` |
| Owner | `worklane chown <user> <ticket>` |
| Status | `worklane mv <ticket> --status <target>` |
**Never edit a ticket file directly.** The filename, the `Status` field and the directory
have to agree, and the commands are what keep them agreeing. A hand-written Relations
line is worse still: it is the one section read back by machine, and a target that does
not resolve to a uuid is an error on every later read of that ticket.
The last two rows are in the table to be recognised, not used. See the closing section.
## Read the board first
```
worklane ls # every status, counts then tickets
worklane ls backlog # one status
worklane ls --priority 1 # the top of the pile
worklane show 1b78a24 # one ticket, with its relations and comments
worklane campaign ls # the goals that already exist
```
`ls` prints the mark, the id, the title, the owner and the due date. It does **not**
print tags, and there is no tag filter yet, so any judgement about tags means reading the
tickets themselves. On a board of a few dozen that is a `show` per ticket and is worth
doing rather than guessing from titles.
Read `done` too when the question is about what to do next. What was finished last is the
best evidence of what this board actually moves at, and a plan that ignores it is a wish.
## Priorities
Priority runs **1 most urgent to 5 least**, and may be unset. `worklane set <ticket>
--priority <n>` is the only writer.
Priority is relative. A ticket is never urgent by itself, it is urgent above something
else, so every proposed change has to name what it now sits above and below. "This looks
important" is not a reason; "this blocks three tickets that are all dated before it" is.
What to look for:
- **A blocker priced below what it blocks.** Read the Relations. A ticket that others are
`blocked by` cannot be less urgent than the most urgent of them, or the board is asking
for work in an order it will not allow.
- **A flat board.** If almost everything is 3, the field is carrying no information and
the answer is not to renumber everything at once. Propose the few that are genuinely 1
and the few that are genuinely 5, and leave the middle alone.
- **Too many 1s.** If everything is urgent, nothing is. Say how many there are before
proposing another.
- **A low priority already in `committed`.** Either the priority is wrong or starting it
was, and which one it is decides whether the fix is a `set` or a conversation.
- **A priority nobody has touched since the ticket was filed.** It is the filer's first
guess, not a decision. That is the pile worth reading.
## Due dates
`worklane set <ticket> --due 2026-08-29`, format `YYYY-MM-DD`.
A value that is not a real calendar date in that exact form is refused before anything
is written, so a typo costs nothing. `2026-8-9` is refused too: the padding is part of
the format. What is still true is that a date, once written, **cannot be cleared**, only
replaced by another date, so a plan applied to the wrong ticket has no undo.
Ask the system what today is rather than assuming it. A plan built on a guessed date is
wrong by however much the guess was wrong.
The rules a dating plan has to keep:
- **Nothing is dated before the ticket it is blocked by.** Read the Relations first and
date blockers ahead of their dependents. A dependent dated before its blocker is a date
`mv` will refuse to honour anyway.
- **A blocker left undated makes its dependent's date a fiction.** Either date both or
neither.
- **Date what fits, not what exists.** Ask how much capacity the week holds, or take the
answer from what `done` shows the board finishing in a comparable stretch. Dating the
whole backlog produces a board where every ticket is late, which is the same as no
dates at all.
- **Do not date `done`.** It is finished; a date on it is noise in every listing.
- Leave the rest unset. An unset due date is honest about what has not been planned.
## Tags
`worklane set <ticket> --tags bug,cli` is the writer, and it **replaces the whole
field**. Restate every tag the ticket should keep, or the ones you left out are gone.
This is the single most destructive thing in this document.
Derive the vocabulary from the board rather than inventing one. Read the tickets, count
what is actually used, and show the count before proposing anything. What to report:
- **Two spellings of one idea.** `bug` and `bugfix`, `tui` and `ui`. Pick the one already
used more and say so.
- **A tag used exactly once.** Either it is the start of a category and should be applied
to its siblings, or it is a private note and should go. Do not leave it as it is without
saying which.
- **A tag that restates a field.** A `p1` tag beside a Priority field, an `open` tag
beside a Status, an owner's name as a tag. The field is the writer; the tag is a copy
that will disagree with it. This board already made that mistake once with priority and
undid it deliberately.
- **An untagged ticket** in a board where everything else is tagged. It is invisible to
every question asked by tag.
Tags are for kind, not for state and not for goal. State is the status directory and the
fields; a goal is a campaign.
## Campaigns
```
worklane campaign ls
worklane campaign show "v1 release"
worklane campaign add --title "..." --description "..."
worklane assign "v1 release" 1b78a24
```
A campaign is the tickets that have to be finished **together** for one outcome. The test
is whether you can name the outcome in a single line without listing the members. "The
tui is usable on a narrow terminal" is a campaign. "The tui tickets" is a tag.
- **Do not group by tag.** Ten tickets tagged `bug` share a kind, not a goal, and putting
them in a container says nothing that the tag did not already say.
- **Check what exists first.** `campaign ls` before proposing a new one, or you will
propose a second container for a goal that already has one.
- **A ticket is in at most one campaign**, and `assign` moves it rather than adding a
second. So two proposed campaigns that overlap are really one proposal to take members
out of the other, and it has to say so.
- **A campaign's state is derived**, open until every member is done. There is nothing to
close and nothing to move. A campaign whose members are all done is finished already.
- `assign` takes the **campaign first and the ticket second**, like `chown`.
Proposing a campaign means naming the goal, the members, and what is deliberately left
out of it. The last part is what makes it a goal rather than a pile.
## What a planner does not touch
- **Descriptions, acceptance criteria and implementation plans.** They are the ticket
author's account of the work, and grooming is about how the work is ordered, not what
it is. Something wrong in there is a comment on that ticket.
- **Status.** `mv` belongs to whoever does the work. A plan that moves tickets between
columns is reporting progress that did not happen.
- **Owner.** `chown` records a commitment a person made. Propose it, do not write it,
unless you were asked to assign the work.
- **New tickets.** Grooming is about what is on the board. Something genuinely missing is
worth filing, by the rules in the `worklane` skill, but say it is a new ticket rather
than folding it into a grooming sweep.
+160
View File
@@ -0,0 +1,160 @@
---
name: worklane-review
description: Review a finished worklane ticket against the code that claims to close it, and record the verdict on the board. Use when asked to review a ticket, to check whether a ticket is really done, or to verify that an implementation matches its acceptance criteria, whether the ticket is named by id, by title or as "the one in reviewing". Covers finding the commits, judging each criterion against the code, and what a reviewer may and may not write back to the board.
---
# Reviewing a worklane ticket
For "review ticket 1b78a24", "is 4179958 actually done", "check the work on the tui
scroll ticket". The subject is one ticket. Reviewing a diff that no ticket claims is
ordinary code review and not this job.
This document is the review only. The CLI itself, the statuses, how a ticket is
addressed and the argument traps, is the `worklane` skill; read that too.
## What a review produces
Three things, in this order, and nothing else:
1. **One comment** on the ticket, in the structure below.
2. **Unticked criteria**, for the ones the code does not actually meet.
3. **Appended criteria**, for work the review found that the ticket never asked for.
You do not tick a criterion, you do not move the ticket, and you do not fix the code.
Each of those has a reason, given where it comes up.
## 1. Read the ticket before the code
```
worklane show 1b78a24
```
All of it, comments included. The description says what was wrong, the criteria say what
"done" was supposed to mean, the plan says what someone intended to do about it, and the
comments are where the intent moved after filing. A criterion that contradicts a comment
is one of the more useful things you can find: it means the ticket was not updated when
the plan changed, and one of the two is now lying to whoever reads the board.
Read the Relations too. A `blocked by` that is not done, or a `regression of`, changes
what the change was allowed to do and what the review has to check twice.
## 2. Find the work
The board stores no branch and no sha, so the link from ticket to code has to be found.
Check the repo's own commit convention first, in its `AGENTS.md`, `CLAUDE.md` or in
`git log`, rather than assuming the id appears in the message at all.
```
git log --all --oneline --grep 1b78a24 # where commits name the ticket
git log --oneline -20 # where they do not, read the recent ones
git branch -a --list '*scroll*' # a branch named after the work
git diff main...HEAD # the whole change, once you have both ends
```
Widen it with the files the description names, since a ticket that names
`src/tui.rs` is reviewable through `git log -p -- src/tui.rs` even when no commit
message mentions it.
**If nothing names the ticket, that is the finding.** Do not review the working tree on
the assumption that whatever is uncommitted must be the work, and do not report a pass
you could not check. Comment what you searched for and stop: a ticket sitting in
`reviewing` with no traceable work is exactly what a reviewer is for.
## 3. Judge each criterion separately
One criterion at a time, by its number from `show`, and each against **the code**. Never
against the implementation plan: the plan is what someone meant to do, and a review that
confirms the plan was followed cannot notice that following it was not enough.
Read the code the criterion is about, not only the lines the diff touched. A criterion
that the diff satisfies and the surrounding code defeats is not met.
Give each one a verdict and its evidence, a file and a line:
- **met** - and where.
- **not met** - and what is missing.
- **cannot tell** - and what would settle it. This is a real verdict. Use it instead of
guessing, and say what you would have to run or read.
Run whatever the repo runs, its test suite and its linter. A suite that fails is not a
criterion, but no criterion is met while it fails.
Then the two questions the criteria cannot ask themselves:
- **What did this change break that no criterion covers?** Silent behaviour changes,
a message or exit code something else reads, an edge case the ticket never named.
- **What did the ticket never think of?** That is what you append in step 5.
## 4. Write one comment
One call, one comment. Not one per criterion: the board renders comments in the order
they were written, and a review split over eight of them cannot be read as a verdict.
```
worklane comment 1b78a24 "**Verdict**: two criteria unmet, the scroll clamp is off by the header
**Work reviewed**: 4edc7fa, 6d327df on master
**Criteria**
1. met - PageUp and PageDown reach detail_scroll, src/tui.rs:412
2. not met - the footer still lists the arrow keys, src/tui.rs:88
3. cannot tell - no test covers a ticket longer than the viewport
**Findings**
- The clamp uses the raw line count, so a wrapped ticket scrolls past its end, src/tui.rs:430
- Unticked criterion 2 accordingly
**Recommendation**: back to committed, the clamp is the ticket's own subject"
```
Keep the structure, drop the sections that have nothing in them. `**Work reviewed**` is
never empty: it holds the shas, the branch, or what you searched for and did not find.
Write for the person who has to act on it, so every finding says where it is.
The comment body takes a leading hyphen without being parsed as a flag, so a finding can
quote `--force` literally. A body of exactly `--` needs its own separator.
## 5. Write the verdict back to the ticket
```
worklane uncheck 1b78a24 2
worklane append 1b78a24 --acceptance "The footer lists only the keys that are bound"
```
Untick every criterion you found unmet, one call each, by the number `show` printed. Do
it after the comment so there is a written reason on the board before the mark changes.
**Never tick a criterion.** A tick is the implementer's claim that something is done, and
unticking is the review disagreeing with that claim. A reviewer that also ticks makes
both the same mark, and the board stops recording that anyone ever disagreed. A criterion
you found met but left unticked is a line in the comment, not a mark for you to fix.
Append a criterion only for work the next commit has to make true, phrased so it can be
ticked off. Advice, praise and anything already covered by an existing criterion belong in
the comment. An appended criterion that restates a finding just makes the ticket longer
without making it clearer.
**Do not move the ticket.** `mv` belongs to whoever does the work, the same way ticking
does. Your half is the recommendation in the comment; acting on it is theirs. A reviewer
that reviews and closes in one breath leaves nobody to disagree with.
## What a reviewer does not touch
- **The description, plan, title, priority and tags.** Rewriting the ticket you are
reviewing destroys the record of what was asked for, which is the only thing your
verdict can be measured against. Say it in the comment.
- **The code.** Even a one-line fix is a finding: whoever wrote it gets to make the
change, and gets to keep the review that asked for it. Fix it only if you are asked to,
and then it is a new piece of work with its own comment.
- **Another ticket's business.** Something you found that is genuinely out of scope gets
its own ticket, filed the way the `worklane` skill says, and
`worklane relate <new> --relates-to <this>` so the two are findable from each other.
## Reviewing what is waiting
```
worklane ls reviewing
```
One ticket at a time, with its own comment. A single comment covering four tickets lands
on one of them and is lost to the other three.
+3
View File
@@ -85,6 +85,9 @@ worklane add \
checked off as true or false.
- **`--plan`** takes one step per flag, numbered for you.
- **`--priority`** runs 1 (most urgent) to 5 (least), and is left unset if omitted.
- **`--due`** takes `YYYY-MM-DD` and nothing else. Anything that is not a real calendar
date in that exact form, `2026-8-9` and `2026-02-30` included, is a usage error with
nothing written. The same parser guards `set --due`.
Editing afterwards, on a ticket in any status:
+52 -3
View File
@@ -2,6 +2,8 @@ use clap::Parser;
use std::sync::LazyLock;
use chrono::NaiveDate;
use crate::util::{PRIORITY_RANGE, RelationKind, priority_legend};
/// clap wants a `&str` with a long enough lifetime, and the legend is built from
@@ -53,6 +55,42 @@ fn non_empty(raw: &str) -> Result<String, String> {
Ok(raw.to_string())
}
/// Reject a due date that is not a real calendar date in the promised form.
///
/// At parse time, like `priority_level`, so a mistyped date is a usage error with
/// nothing written rather than a value the board goes on showing. `--due` is one of the
/// scalars deliberately left without `PROSE`, so this is the same bargain: nothing here
/// holds prose, and a wrong value should stop the command.
///
/// **The shape is checked before chrono sees it.** `%Y-%m-%d` accepts an unpadded
/// `2026-8-9`, which would then be stored exactly as typed and sort before `2026-10-01`
/// in any comparison of the strings. Checking the length and the two dashes first is
/// what lets a valid date be stored unchanged rather than normalised on the way in.
///
/// Strict on the way in, tolerant on the way out: `util::due_date` still cuts a
/// datetime down to its date, because a file written before this existed, or by hand,
/// can hold one and still has to render.
fn iso_date(raw: &str) -> Result<String, String> {
// An empty value keeps the message that explains why it is refused, since somebody
// typing it is reaching for a way to clear the field rather than mistyping a date.
non_empty(raw)?;
let bytes = raw.as_bytes();
let shaped = raw.len() == 10 && bytes[4] == b'-' && bytes[7] == b'-';
if !shaped || NaiveDate::parse_from_str(raw, "%Y-%m-%d").is_err() {
// Not echoing the value: clap has already printed `invalid value '...' for
// '--due <DUE>'` above this line, and `priority_level` says its piece the same
// way.
return Err(
"due date must be a real calendar date written as YYYY-MM-DD, for example 2026-08-29"
.to_string(),
);
}
Ok(raw.to_string())
}
/// Arguments that carry prose, and therefore have to accept a value starting with
/// a hyphen.
///
@@ -185,8 +223,15 @@ pub enum Command {
ticket: String,
},
/// Install the agent skill that teaches an agent to use worklane
/// Install the agent skills that teach an agent to use worklane
///
/// Every shipped document by default. The optional name narrows it to one, and
/// `--print` requires it: a diff is against one document, and printing them all
/// concatenated would only look like one.
InstallSkill {
/// Skill to install or print, all of them if omitted
skill: Option<String>,
/// Overwrite an existing copy that has been modified
#[arg(long)]
force: bool,
@@ -268,7 +313,7 @@ pub struct AddArgs {
pub tags: Vec<String>,
/// Due date (YYYY-MM-DD)
#[arg(long)]
#[arg(long, value_parser = iso_date)]
pub due: Option<String>,
/// Owner
@@ -317,7 +362,11 @@ pub struct SetArgs {
pub tags: Vec<String>,
/// Replace the due date (YYYY-MM-DD)
#[arg(long, value_parser = non_empty)]
///
/// The same parser as `add`: one field, one definition of what a due date is. The
/// planning skill sets dates through `set` rather than `add`, so validating only
/// the one that files a ticket would leave the path that is actually used open.
#[arg(long, value_parser = iso_date)]
pub due: Option<String>,
/// Replace the priority, 1 (most urgent) to 5 (least)
+46 -18
View File
@@ -1191,33 +1191,61 @@ pub fn cmd_check(args: &CheckArgs, checked: bool, start: &Path) -> Result<()> {
Ok(())
}
/// Install the agent skill, or print it so a modified copy can be diffed.
/// Install the agent skills, or print one so a modified copy can be diffed.
///
/// No board is looked for. The document is what teaches an agent worklane, so needing
/// a `.worklane` to install it would put it out of reach exactly when it is wanted.
pub fn cmd_install_skill(force: bool, print: bool) -> Result<()> {
/// No board is looked for. The documents are what teach an agent worklane, so needing
/// a `.worklane` to install them would put them out of reach exactly when they are
/// wanted.
///
/// With no name, every shipped document is installed. Narrowing to one is the
/// exception rather than the rule, so that a document added in a later version reaches
/// anyone who already knows the command.
pub fn cmd_install_skill(skill: Option<&str>, force: bool, print: bool) -> Result<()> {
if print {
print!("{}", install::SKILL.content);
// Printing every document would run them together into something that is not
// any of them, and the point of `--print` is to diff one against its copy.
let name = skill.ok_or_else(|| {
anyhow!(
"name the skill to print, as in `worklane install-skill worklane --print`. This binary ships {}",
install::skill_names()
)
})?;
print!("{}", install::skill_named(name)?.content);
return Ok(());
}
let chosen: Vec<&install::Asset> = match skill {
Some(name) => vec![install::skill_named(name)?],
None => install::SKILLS.iter().collect(),
};
let root = install::skills_root()?;
match install::SKILL.install(&root, force)? {
install::Outcome::Written(path) => {
println!("Installed the worklane {} to: {}", install::SKILL.what, path.display());
println!("Claude Code and opencode pick it up on their next session");
}
install::Outcome::Unchanged(path) => {
println!("Already up to date: {}", path.display());
}
install::Outcome::Refused(path) => {
println!("Differs from the version in this binary: {}", path.display());
println!(
"Compare with `worklane install-skill --print`, or overwrite with --force"
);
let mut written = false;
for asset in chosen {
match asset.install(&root, force)? {
install::Outcome::Written(path) => {
println!("Installed the {} {} to: {}", asset.name, asset.what, path.display());
written = true;
}
install::Outcome::Unchanged(path) => {
println!("Already up to date: {}", path.display());
}
install::Outcome::Refused(path) => {
println!("Differs from the version in this binary: {}", path.display());
println!(
"Compare with `worklane install-skill {} --print`, or overwrite with --force",
asset.name
);
}
}
}
// Once, and only when something arrived: repeating it per document would make the
// instruction look like part of each outcome rather than the one thing to do next.
if written {
println!("Claude Code and opencode pick it up on their next session");
}
Ok(())
}
+179 -37
View File
@@ -1,13 +1,18 @@
//! Shipping the agent assets with the binary.
//!
//! The skill document lives at `assets/SKILL.md` in this repo and is embedded with
//! The skill documents live in `assets/` in this repo and are embedded with
//! `include_str!` rather than copied by an install script, because `cargo install`
//! places binaries and nothing else. Embedding means the document can never be a
//! places binaries and nothing else. Embedding means a document can never be a
//! different version from the binary it describes, and there is no second file to
//! lose track of.
//!
//! The machinery is written once for both assets this repo will ship. The tool file
//! for opencode is executable code needing Bun, so it gets its own command and its
//! `SKILLS` is every skill the binary carries, and `install-skill` writes all of them.
//! One document teaches the CLI and the others teach a job done with it; a person who
//! has learned the invocation should not have to learn a new name for each document
//! added later, or the new one silently never arrives.
//!
//! The machinery is written once for both kinds of asset this repo will ship. The tool
//! file for opencode is executable code needing Bun, so it gets its own command and its
//! own root, but the compare-and-refuse logic is the same and lives here.
use std::io;
@@ -17,6 +22,9 @@ use anyhow::{Result, anyhow};
/// One thing the binary carries and can write into a user's agent configuration.
pub struct Asset {
/// How it is addressed on the command line. For a skill this is also its directory
/// and its frontmatter `name:`, which both agents require to agree.
pub name: &'static str,
/// What it is called in messages, e.g. `skill`.
pub what: &'static str,
/// Where it goes under its root, e.g. `worklane/SKILL.md`.
@@ -24,13 +32,63 @@ pub struct Asset {
pub content: &'static str,
}
/// The skill document, as of the commit this binary was built from.
/// The skill that teaches the CLI, as of the commit this binary was built from.
pub const SKILL: Asset = Asset {
name: "worklane",
what: "skill",
relative: "worklane/SKILL.md",
content: include_str!("../assets/SKILL.md"),
};
/// The skill that reviews a finished ticket against the code that claims to close it.
///
/// A document of its own rather than a section of `SKILL`, because it is loaded for a
/// different job: the CLI skill is wanted for anything touching a ticket, and this is
/// wanted only when a review is asked for. One document holding both would be loaded
/// constantly to say nothing, and the frontmatter description, which is the whole of
/// what decides the loading, cannot describe two jobs without fitting neither.
pub const REVIEW_SKILL: Asset = Asset {
name: "worklane-review",
what: "skill",
relative: "worklane-review/SKILL.md",
content: include_str!("../assets/REVIEW.md"),
};
/// The skill that grooms the board as a whole rather than a ticket at a time.
///
/// Its own document for the reason `REVIEW_SKILL` is: it is wanted for questions about
/// the backlog as a body of work, and loading it for every ticket touched would be a
/// description that fits nothing. It is also the document where the destructive edits
/// live, since every job in it writes to many tickets at once.
pub const PLAN_SKILL: Asset = Asset {
name: "worklane-plan",
what: "skill",
relative: "worklane-plan/SKILL.md",
content: include_str!("../assets/PLAN.md"),
};
/// Every skill this binary carries, in the order they install.
///
/// A `static` rather than a `const` so the slice borrowed from it outlives the
/// statement that took it: a `const` is inlined at each use and the borrow dies there.
pub static SKILLS: [Asset; 3] = [SKILL, REVIEW_SKILL, PLAN_SKILL];
/// The skill a name on the command line asks for.
pub fn skill_named(name: &str) -> Result<&'static Asset> {
SKILLS.iter().find(|asset| asset.name == name).ok_or_else(|| {
anyhow!("no skill named {name:?}. This binary ships {}", skill_names())
})
}
/// The names, for the errors that have to say what there is to choose from.
pub fn skill_names() -> String {
SKILLS
.iter()
.map(|asset| asset.name)
.collect::<Vec<_>>()
.join(", ")
}
/// Where a skill has to sit to be found, for both agents worklane is used from.
///
/// One path serves both. Claude Code reads `~/.claude/skills/<name>/SKILL.md`, and
@@ -157,29 +215,53 @@ mod tests {
}
#[test]
fn the_skill_lands_where_both_agents_look_for_it() {
fn every_skill_lands_where_both_agents_look_for_it() {
let root = skills_root().unwrap();
assert!(root.ends_with(".claude/skills"), "{}", root.display());
assert!(
SKILL.path(&root).ends_with(".claude/skills/worklane/SKILL.md"),
"{}",
SKILL.path(&root).display()
);
for asset in &SKILLS {
let path = asset.path(&root);
assert!(
path.ends_with(format!(".claude/skills/{}/SKILL.md", asset.name)),
"{}",
path.display()
);
}
}
/// Two documents that install to one path means the second silently replaces the
/// first, and only whichever is listed last is ever read. A copy-pasted `relative`
/// is exactly how that happens.
#[test]
fn no_two_shipped_skills_share_a_name_or_a_path() {
for (index, asset) in SKILLS.iter().enumerate() {
for other in &SKILLS[index + 1..] {
assert_ne!(asset.name, other.name);
assert_ne!(asset.relative, other.relative);
}
}
}
#[test]
fn the_embedded_skill_has_usable_frontmatter() {
fn every_embedded_skill_has_usable_frontmatter() {
// Guards the whole shipping mechanism: without frontmatter, or under a name
// that does not match its directory, both agents ignore the document and
// nothing else would notice.
assert_eq!(frontmatter_field(SKILL.content, "name").as_deref(), Some("worklane"));
for asset in &SKILLS {
assert_eq!(
frontmatter_field(asset.content, "name").as_deref(),
Some(asset.name),
"the frontmatter name has to match the directory it installs into"
);
let description =
frontmatter_field(SKILL.content, "description").expect("a description to trigger on");
assert!(
description.len() > 80,
"the description is what decides whether the skill loads at all"
);
let description = frontmatter_field(asset.content, "description")
.unwrap_or_else(|| panic!("{} ships without a description to trigger on", asset.name));
assert!(
description.len() > 80,
"{}: the description is what decides whether the skill loads at all",
asset.name
);
}
}
/// Every code span and fenced-block line, which is where commands live.
@@ -209,7 +291,7 @@ mod tests {
}
#[test]
fn the_embedded_skill_only_names_commands_that_exist() {
fn no_embedded_skill_names_a_command_that_does_not_exist() {
// Taken from clap rather than written out here. A hand-maintained list is the
// very drift this test exists to catch.
use clap::CommandFactory;
@@ -220,25 +302,34 @@ mod tests {
known.push("--help".to_string());
known.push("--version".to_string());
let mut checked = 0;
for snippet in code_snippets(SKILL.content) {
let mut words = snippet.split_whitespace();
// Only a snippet that *starts* with worklane is a command being shown.
if words.next() != Some("worklane") {
continue;
let mut total = 0;
for asset in &SKILLS {
let mut checked = 0;
for snippet in code_snippets(asset.content) {
let mut words = snippet.split_whitespace();
// Only a snippet that *starts* with worklane is a command being shown.
if words.next() != Some("worklane") {
continue;
}
let Some(candidate) = words.next() else { continue };
// A flag before the subcommand, as in the `mv -- -leading-title` example.
if candidate.starts_with("--") && !known.iter().any(|k| k == candidate) {
continue;
}
checked += 1;
assert!(
known.iter().any(|k| k == candidate),
"{} shows `worklane {candidate}`, which is not a subcommand",
asset.name
);
}
let Some(candidate) = words.next() else { continue };
// A flag before the subcommand, as in the `mv -- -leading-title` example.
if candidate.starts_with("--") && !known.iter().any(|k| k == candidate) {
continue;
}
checked += 1;
assert!(
known.iter().any(|k| k == candidate),
"the skill shows `worklane {candidate}`, which is not a subcommand"
);
// A skill that shows no command at all is either not about worklane or has
// had its examples emptied out, and either way the check above passed on
// nothing.
assert!(checked > 0, "{} shows no worklane command at all", asset.name);
total += checked;
}
assert!(checked > 8, "expected the skill to show commands, checked only {checked}");
assert!(total > 8, "expected the skills to show commands, checked only {total}");
}
/// Subcommands the skill has no business teaching: the board is interactive and
@@ -248,6 +339,11 @@ mod tests {
/// The converse, and the one that goes stale on its own: a *new* subcommand absent
/// from the skill is invisible to an agent, and nothing else would notice.
///
/// `SKILL` alone, deliberately. It is the document that owns the CLI surface, and
/// the others teach one job with the handful of commands that job uses. Requiring
/// every subcommand of each of them would fill a review document with campaigns
/// and `init` to satisfy a test.
#[test]
fn every_agent_facing_subcommand_is_documented() {
use clap::CommandFactory;
@@ -279,4 +375,50 @@ mod tests {
);
}
}
/// The rules that keep a grooming sweep from being a silent rewrite of the board.
///
/// Every one of these is a line an edit could drop while leaving a document that
/// still reads like a plan: `set --tags` replacing the whole field is how thirty
/// tickets quietly lose their tags, and propose-then-apply is the only thing
/// standing between a wrong judgement and thirty wrong tickets.
#[test]
fn the_plan_skill_keeps_the_rules_that_bound_a_sweep() {
for required in [
"Propose the whole set of edits",
"replaces the whole\nfield", // `set --tags` is the destructive one
"cannot be cleared", // and a due date cannot be taken back
"blocked by", // ordering constrains any dating plan
"worklane campaign ls",
"does not touch",
] {
assert!(
PLAN_SKILL.content.contains(required),
"the plan skill no longer says {required:?}"
);
}
}
/// The decisions that make the review document a review rather than a rewrite.
///
/// Each of these is a rule an edit would drop without breaking anything else: a
/// reviewer that ticks criteria or moves the ticket still runs, and produces a
/// board where nothing records that anyone disagreed.
#[test]
fn the_review_skill_keeps_the_decisions_that_define_it() {
for required in [
"worklane show", // the ticket is read before the code
"nothing names the ticket", // and the no-work-found case is answered
"Never tick a criterion",
"Do not move the ticket",
"worklane uncheck",
"worklane append",
"cannot tell",
] {
assert!(
REVIEW_SKILL.content.contains(required),
"the review skill no longer says {required:?}"
);
}
}
}
+11 -8
View File
@@ -87,7 +87,9 @@ fn main() -> Result<()> {
Some(Command::Assign { campaign, ticket }) => cmd_assign(&campaign, &ticket, &start),
// No board is looked for: the point of the skill is to teach an agent worklane
// before there is a `.worklane` anywhere.
Some(Command::InstallSkill { force, print }) => cmd_install_skill(force, print),
Some(Command::InstallSkill { skill, force, print }) => {
cmd_install_skill(skill.as_deref(), force, print)
}
}
}
@@ -162,16 +164,17 @@ fn run_tui(paths: &[std::path::PathBuf], start: &std::path::Path) -> Result<()>
}
match key.code {
KeyCode::Char('q') => board.should_quit = true,
// One arm, because the two keys mean one thing: close what is open, and
// quit when there is nothing left to close. Two arms carrying one rule
// is how a later edit changes it for one key and not the other, which is
// what `q` quitting out from under an open ticket already was. The rule
// itself is `Board::dismiss`, where a test can reach it.
KeyCode::Esc | KeyCode::Char('q') => board.dismiss(),
// The only key that leaves the board from an open ticket, which is why
// the footer names it there.
KeyCode::Char('c') if key.modifiers.contains(KeyModifiers::CONTROL) => {
board.should_quit = true
}
// Esc closes the detail view, and only quits when there is nothing
// left to dismiss.
KeyCode::Esc => match board.detail {
Some(_) => board.toggle_detail(),
None => board.should_quit = true,
},
KeyCode::Enter | KeyCode::Char(' ') => board.toggle_detail(),
KeyCode::Left | KeyCode::Char('h') => board.select_column(-1, screen),
KeyCode::Right | KeyCode::Char('l') => board.select_column(1, screen),
+555 -23
View File
@@ -7,6 +7,7 @@
//! **Read only.** Moving a card by keypress is a follow-up. Everything here observes.
use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use std::path::{Path, PathBuf};
use std::time::{Duration, SystemTime};
@@ -100,6 +101,14 @@ fn project_name(dir: &Path) -> String {
pub struct Card {
pub ticket: TicketItem,
pub project: Option<String>,
/// Whether a ticket this one is `blocked by` is on the board and not done.
///
/// Decided at reload like `project`, and for a stronger reason: the answer lives on
/// two tickets at once, so no card can reach it alone and asking per draw would mean
/// reading the tree per frame. Computed on the board the ticket came from and
/// carried into the merge unchanged — `relate` resolves its target against one
/// `.worklane`, so there is no such thing as a blocker in another project.
pub blocked: bool,
}
/// One status and the cards in it.
@@ -462,6 +471,26 @@ impl Board {
};
}
/// Put away what is open, and quit when there is nothing left to put away.
///
/// What `esc` has always done, and now what `q` does too. `q` used to set
/// `should_quit` outright, so a reader who pressed it to close a ticket lost the
/// whole board instead, which is not what `q` means anywhere else that lays a
/// document over a list.
///
/// Here rather than in the match arm in `main.rs`: that dispatch is not reachable
/// from a test, so a rule written into it is a rule nothing can check. The arm is
/// left as the one line that names the keys.
///
/// `ctrl-c` is therefore the only key that leaves the board while a ticket is open,
/// and the footer says so rather than leaving the reader to find out.
pub fn dismiss(&mut self) {
match self.detail {
Some(_) => self.toggle_detail(),
None => self.should_quit = true,
}
}
/// Scroll the open detail view by whole screenfuls, one line kept for overlap.
///
/// Up and down move the selection, so the scroll is on PageUp and PageDown. That is
@@ -534,7 +563,7 @@ fn detail_of(card: &Card) -> Detail {
/// The four columns of one board.
fn columns_of(worklane_dir: &Path) -> Vec<Column> {
status_dirs()
let mut columns: Vec<Column> = status_dirs()
.into_iter()
.map(|status| {
// An absent or unreadable directory is an empty column, not a missing one:
@@ -545,11 +574,47 @@ fn columns_of(worklane_dir: &Path) -> Vec<Column> {
.map(|ticket| Card {
ticket,
project: None,
blocked: false,
})
.collect();
Column { status, cards }
})
.collect()
.collect();
mark_blocked(&mut columns);
columns
}
/// Set `blocked` on every card whose ticket waits on one that is not done.
///
/// Two walks of what `columns_of` has just read, not a lookup per relation: the status
/// of a blocker is on another card, so the pass builds the uuid to status map once and
/// then answers every card from it. Nothing is read from disk here, which is the point
/// — the blockers came off the same read that built the cards.
///
/// A blocker the board does not hold marks nothing, the answer `mv` already gives it: a
/// uuid nothing carries is a bookkeeping fault rather than a dependency. A ticket with
/// no ID field is left out of the map entirely, or every ticket missing one would block
/// every other ticket missing one, which is the guard `RelationIndex::inbound` makes.
fn mark_blocked(columns: &mut [Column]) {
let status_of: HashMap<String, &'static str> = columns
.iter()
.flat_map(|column| {
column
.cards
.iter()
.map(|card| (card.ticket.uuid.clone(), column.status))
})
.filter(|(uuid, _)| !uuid.trim().is_empty() && !is_unknown_value(uuid))
.collect();
for column in columns.iter_mut() {
for card in column.cards.iter_mut() {
card.blocked = card.ticket.blockers.iter().any(|blocker| {
matches!(status_of.get(blocker.as_str()), Some(status) if *status != DONE)
});
}
}
}
/// Every board's columns as one set of four, each card labelled with the project it
@@ -571,6 +636,10 @@ fn merge(per_project: &[Vec<Column>], projects: &[Project]) -> Vec<Column> {
cards.extend(column.cards.iter().map(|card| Card {
ticket: card.ticket.clone(),
project: Some(project.name.clone()),
// Already answered on the board the card came from. Recomputing it
// over the merged columns would let one project's uuid resolve
// against another's ticket, which is a relation nothing can record.
blocked: card.blocked,
}));
}
@@ -824,12 +893,22 @@ fn aligned_offset(offset: u16, start: u16, end: u16, inner: u16, total: u16) ->
offset.min(total.saturating_sub(inner))
}
/// The mark a card carries while it waits on a ticket that is not done.
///
/// Not a fourth circle. The Geometric Shapes glyphs belong to the priority meter, and
/// another one two cells away from it would read as part of that ramp rather than as a
/// different fact. A multiplication sign is Latin-1, like the middle dot the unset
/// priority draws, so it renders wherever the meter already does. That is the same
/// safe-glyph rule that took the quadrant circles out of the ramp.
const BLOCKED_MARK: &str = "\u{d7}";
/// One card as four corners with the title between them:
///
/// ```text
/// ●◐ (1b78a24) 2026-12-31
/// The tui detail view cannot
/// scroll, and the footer says…
/// #cli #tui
/// Ansho Rei [3/9]
/// ```
///
@@ -841,6 +920,13 @@ fn aligned_offset(offset: u16, start: u16, end: u16, inner: u16, total: u16) ->
/// On the All tab the project follows the id in that top left corner, since across
/// several boards the id alone is not an address: two projects can hold the same title,
/// and seven characters do not say where they live.
///
/// The tags sit between the title and the bottom corners, on a row a ticket without
/// them does not spend. See [`tags_line`].
///
/// A held-up ticket carries [`BLOCKED_MARK`] after its id, ahead of the project and the
/// due date, both of which give way to it: those are context for a ticket somebody can
/// start, and this is the one thing on a card that says not to.
fn card_lines(card: &Card, selected: bool, width: u16) -> Vec<Line<'static>> {
let ticket = &card.ticket;
let (glyph, colour) = priority_mark(ticket.priority);
@@ -861,10 +947,25 @@ fn card_lines(card: &Card, selected: bool, width: u16) -> Vec<Line<'static>> {
Style::default().fg(Color::Red.into()).add_modifier(emphasis),
),
];
// After the id, not before it: inserted ahead of the id the mark would push it out
// of line, and a column of ids that do not start at the same cell is harder to read
// than one card's worth of state is worth. Dropped whole when the row cannot hold
// the identity and the mark together, the rule a corner follows, rather than
// wrapping or cutting it.
if card.blocked && spans_width(&left) + 1 + BLOCKED_MARK.chars().count() <= width as usize {
left.push(Span::raw(" "));
left.push(Span::styled(
BLOCKED_MARK.to_string(),
Style::default()
.fg(Color::BrightRed.into())
.add_modifier(emphasis),
));
}
let label = card
.project
.as_deref()
.and_then(|name| project_label(name, width));
.and_then(|name| project_label(name, width, spans_width(&left)));
if let Some(label) = label {
left.push(Span::raw(" "));
// Grey like the owner and the criteria count: the shape carries which project
@@ -884,6 +985,10 @@ fn card_lines(card: &Card, selected: bool, width: u16) -> Vec<Line<'static>> {
))
}));
if let Some(row) = tags_line(&ticket.tags, width) {
lines.push(row);
}
lines.push(corner_line(
vec![Span::styled(
ticket.owner.clone(),
@@ -902,21 +1007,71 @@ fn card_lines(card: &Card, selected: bool, width: u16) -> Vec<Line<'static>> {
lines
}
/// The project name as it fits beside the mark and the id.
/// The ticket's tags under the title, or nothing when it has none.
///
/// The mark and the id are the ticket's identity and never give way, so the label takes
/// what the row has left and ends in an ellipsis where it was cut. It is measured before
/// the due date, which is what gives the project the narrow column: on the All tab the
/// project matters more than the date, and `corner_line` drops the date when what is
/// left will not hold it.
/// Each tag is prefixed with `#` and the row is dimmed like the owner and the criteria
/// count: what a card is for is telling tickets apart at a glance, and colour here
/// accentuates rather than encodes. Without the marker the row reads as a third line of
/// the title, since a tag is an ordinary word and the title sits directly above it.
///
/// A row the column will not hold is dropped whole, the rule `corner_line` applies to a
/// corner: a cut list reads as a shorter one, and `bug` and `bugfix` truncated to the
/// same width say the same thing. An untagged ticket spends no row at all, the way a
/// short title spends no second one.
///
/// Each tag carries its own colour, from `tag_color`, so the same tag is the same
/// colour on every card in every column. The row is spans rather than one string for
/// that reason alone; it is still measured as one string.
fn tags_line(tags: &[String], width: u16) -> Option<Line<'static>> {
if tags.is_empty() {
return None;
}
let row = tags
.iter()
.map(|tag| format!("#{tag}"))
.collect::<Vec<_>>()
.join(" ");
// Measured on the raw row, before anything is styled. What fits must not depend on
// the colour decision, or a card would hold its tags in one render and drop them in
// the other.
if row.chars().count() > width as usize {
return None;
}
let mut spans = Vec::with_capacity(tags.len() * 2);
for (index, tag) in tags.iter().enumerate() {
if index > 0 {
spans.push(Span::raw(" "));
}
spans.push(Span::styled(
format!("#{tag}"),
Style::default().fg(tag_color(tag).into()),
));
}
Some(Line::from(spans))
}
/// The project name as it fits beside whatever the row already carries.
///
/// The mark, the id and the blocked mark are the ticket's identity and its state, and
/// neither gives way, so the label takes what the row has left and ends in an ellipsis
/// where it was cut. It is measured before the due date, which is what gives the project
/// the narrow column: on the All tab the project matters more than the date, and
/// `corner_line` drops the date when what is left will not hold it.
///
/// `used` is measured off the spans already built rather than added up from the widths
/// they are supposed to have. The hand-written version left out the space after the
/// priority mark, so the label was handed one cell more than the row had and a narrow
/// column drew a card one character wider than its column.
///
/// Under three characters there is nothing left to say, and a single letter and a dot
/// would only crowd the corner, so the label goes instead.
fn project_label(name: &str, width: u16) -> Option<String> {
// The mark and the space after it, the id in its brackets, and the space before the
// label.
let used = 2 + SHORT_ID_WIDTH + 2 + 1;
let room = (width as usize).checked_sub(used)?;
fn project_label(name: &str, width: u16, used: usize) -> Option<String> {
// The space between the label and what precedes it.
let room = (width as usize).checked_sub(used + 1)?;
if room < 3 {
return None;
}
@@ -955,7 +1110,7 @@ fn corner_line(
width: u16,
) -> Line<'static> {
let mut spans = left;
let used: usize = spans.iter().map(|span| span.content.chars().count()).sum();
let used = spans_width(&spans);
let Some(right) = right else {
return Line::from(spans);
@@ -972,6 +1127,11 @@ fn corner_line(
Line::from(spans)
}
/// The cells a run of spans takes, counted in characters rather than bytes.
fn spans_width(spans: &[Span<'static>]) -> usize {
spans.iter().map(|span| span.content.chars().count()).sum()
}
/// The title over one row or two, wrapped on spaces, cut with an ellipsis if even two
/// are not enough.
///
@@ -1059,9 +1219,13 @@ fn draw_footer(frame: &mut Frame, board: &Board, area: Rect) {
false => "",
};
// The last slot answers the same question in both states: how to get out of here.
// With a ticket open `q` closes it, so the honest answer there is `ctrl-c`, which is
// the only key left that quits in one press. Naming `q quit` over an open overlay
// would be the fault 1b78a24 was, a footer describing a key by what it used to do.
let keys = match board.detail {
Some(_) => {
format!(" {tabs}←→↑↓ select pgup/pgdn scroll enter close {done} q quit ")
format!(" {tabs}←→↑↓ select pgup/pgdn scroll enter/q close {done} ctrl-c quit ")
}
None => format!(" {tabs}←→ column ↑↓ card enter detail {done} q quit "),
};
@@ -1505,13 +1669,19 @@ mod tests {
/// One ticket in backlog, written by hand so a test can set the fields the shared
/// fixture pins: the due value, and the criteria.
fn write_card(dir: &Path, title: &str, due: &str, criteria: &str) {
write_tagged_card(dir, title, due, criteria, "_None_");
}
/// The same, with the Tags field a test can set. Untagged is `_None_`, which is
/// what `add` writes for a ticket given no tags.
fn write_tagged_card(dir: &Path, title: &str, due: &str, criteria: &str, tags: &str) {
let uuid = "11111111-0000-4000-8000-000000000000";
std::fs::write(
dir.join("backlog").join(format!("{}_{}.md", uuid, slug(title))),
format!(
"# {title}\n\n## Description\nA description.\n\n## Acceptance Criteria\n\
{criteria}\n\n## Metadata\n\n- **ID**: {uuid}\n- **Priority**: 2\n\
- **Tags**: _None_\n- **Due**: {due}\n- **Owner**: alice\n\
- **Tags**: {tags}\n- **Due**: {due}\n- **Owner**: alice\n\
- **Created At**: 2026-08-21 02:00:00\n- **Status**: backlog\n"
),
)
@@ -1529,6 +1699,20 @@ mod tests {
.collect()
}
/// The rows of the only card, laid out in a column of exactly `inner` characters.
///
/// Takes the width directly rather than deriving it from a terminal size, so a test
/// about a narrow column says which width it means instead of solving `card_width`
/// backwards for a screen that produces one.
fn only_card_at(dir: &Path, inner: u16) -> Vec<String> {
let board = one_board(dir);
let ticket = board.selected().expect("no card");
card_lines(ticket, false, inner)
.iter()
.map(|line| line.spans.iter().map(|span| span.content.as_ref()).collect())
.collect()
}
/// The foreground of the span whose text is `needle`, which `render` cannot show:
/// it drops styling on the way out of the buffer.
fn card_colour(dir: &Path, width: u16, needle: &str) -> Option<ratatui::style::Color> {
@@ -1571,6 +1755,68 @@ mod tests {
}
}
/// A tagged ticket says so on the card: the Tags field was invisible on the board,
/// so nothing told you a ticket was tagged bug without opening it.
#[test]
fn a_card_shows_its_tags_under_the_title() {
let dir = board_dir();
write_tagged_card(&dir, "Short", "2026-12-31", "- [ ] One", "cli, tui");
let rows = only_card(&dir, 120, 20);
assert_eq!(rows.len(), 5, "the tag row is missing: {rows:?}");
assert_eq!(rows[1], "Short");
assert_eq!(rows[2], "#cli #tui");
assert!(rows[3].starts_with("alice"), "the owner moved: {rows:?}");
}
/// Each tag carries its own colour, so the row can be scanned for one tag rather
/// than read word by word. The row used to be a single grey span, which is what
/// made a card of three tags one undifferentiated run.
#[test]
fn each_tag_on_a_card_carries_its_own_colour() {
let dir = board_dir();
write_tagged_card(&dir, "Short", "2026-12-31", "- [ ] One", "cli, docs");
let cli = card_colour(&dir, 120, "#cli");
let docs = card_colour(&dir, 120, "#docs");
// Through `tag_color`, not against a literal: the card has to use the mapping,
// and the mapping is pinned by its own test in util.rs.
assert_eq!(cli, Some(tag_color("cli").into()));
assert_eq!(docs, Some(tag_color("docs").into()));
assert_ne!(cli, docs, "two tags rendered in one colour");
assert_ne!(cli, Some(Color::Grey.into()), "the row is still flat grey");
}
/// And an untagged one spends no row on them, the way a short title spends no
/// second row.
#[test]
fn an_untagged_card_spends_no_row_on_tags() {
let dir = board_dir();
write_tagged_card(&dir, "Short", "2026-12-31", "- [ ] One", "_None_");
let rows = only_card(&dir, 120, 20);
assert_eq!(rows.len(), 4, "{rows:?}");
assert!(!rows.iter().any(|row| row.contains('#')), "{rows:?}");
}
/// A row too wide for the column goes whole, the rule a corner follows: a cut list
/// reads as a shorter one, and bug and bugfix cut to the same width say the same
/// thing.
#[test]
fn a_tag_row_too_wide_for_the_column_is_dropped_whole() {
let dir = board_dir();
write_tagged_card(&dir, "Short", "2026-12-31", "- [ ] One", "frontend, operations");
// One character short of "#frontend #operations", and one over it.
let narrow = only_card_at(&dir, 20);
assert_eq!(narrow.len(), 4, "the row was kept: {narrow:?}");
assert!(!narrow.iter().any(|row| row.contains('#')), "{narrow:?}");
let fits = only_card_at(&dir, 21);
assert_eq!(fits[2], "#frontend #operations", "{fits:?}");
}
/// And a title that fits gets one row, or the second is wasted on every short
/// ticket in the column.
#[test]
@@ -2345,6 +2591,73 @@ mod tests {
assert_eq!(board.offset, offset);
}
// ------------------------------------------------------------- close or quit --
/// A reader pressing `q` to put a ticket away lost the whole board instead.
#[test]
fn dismiss_closes_an_open_overlay_and_leaves_the_board_up() {
let dir = board_dir();
write_ticket(&dir, "backlog", "11111111-0000-4000-8000-000000000000", "First one", "");
let mut board = one_board(&dir);
board.toggle_detail();
assert!(board.detail.is_some(), "nothing was open to dismiss");
board.dismiss();
assert!(board.detail.is_none(), "the overlay stayed open");
assert!(!board.should_quit, "closing a ticket took the board with it");
// Still on the ticket it was opened from, so the next `enter` reopens it.
assert_eq!(selected_title(&board).as_deref(), Some("First one"));
}
/// With nothing over the board there is nothing to put away, so the key means what
/// it has always meant.
#[test]
fn dismiss_quits_when_there_is_nothing_left_to_dismiss() {
let dir = board_dir();
write_ticket(&dir, "backlog", "11111111-0000-4000-8000-000000000000", "First one", "");
let mut board = one_board(&dir);
board.dismiss();
assert!(board.should_quit, "the board stayed up with nothing to close");
}
/// The rule is `Board::dismiss`, which the two tests above reach. What is left to
/// guard is the dispatch that cannot be reached: that both keys arrive there from
/// one arm, and that `ctrl-c` still quits outright, since after this it is the only
/// key that leaves the board while a ticket is open.
///
/// Scanned the way `nothing_the_body_renders_asks_the_terminal_for_the_colour_decision`
/// scans, and over whitespace-collapsed source so rustfmt cannot fail it.
#[test]
fn the_dispatch_gives_q_and_esc_one_arm_and_leaves_ctrl_c_quitting() {
let source = include_str!("main.rs")
.split_whitespace()
.collect::<Vec<_>>()
.join(" ");
assert!(
source.contains("KeyCode::Esc | KeyCode::Char('q') => board.dismiss(),"),
"`q` and `esc` mean one thing and have to reach `Board::dismiss` from one \
arm. Two arms carrying one rule is how a later edit changes it for one key \
and not the other, which is what this ticket already was."
);
let at = source
.find("KeyCode::Char('c') if key.modifiers.contains(KeyModifiers::CONTROL)")
.expect("no ctrl-c arm in the dispatch");
// What the arm does, not what is anywhere near it: the arms after this one call
// the board and would answer a whole-file search.
let arm = &source[at..(at + 120).min(source.len())];
assert!(
arm.contains("=> { board.should_quit = true }"),
"`ctrl-c` has to keep quitting outright: with `q` closing an open ticket it \
is the only key that leaves the board in one press, and the footer says so. \
Found instead: {arm}"
);
}
/// The footer is what sent the reporter looking for their own mistake, so it has to
/// name the keys that exist and only those.
#[test]
@@ -2365,11 +2678,32 @@ mod tests {
assert!(closed.contains("enter detail"), "{closed}");
assert!(!closed.contains("scroll"), "a scroll offered with nothing open:\n{closed}");
assert!(closed.contains("q quit"), "nothing says how to leave:\n{closed}");
board.toggle_detail();
let open = render(&board, SCREEN.width, SCREEN.height).join("\n");
assert!(open.contains("pgup/pgdn scroll"), "{open}");
assert!(open.contains("select"), "{open}");
assert!(open.contains("enter close"), "{open}");
assert!(open.contains("enter/q close"), "{open}");
}
/// The other half of giving `q` a second meaning. A footer that goes on saying
/// `q quit` over an open ticket describes the key by what it used to do, which is
/// the fault 1b78a24 was in the other direction.
#[test]
fn the_footer_names_q_as_the_close_key_while_a_ticket_is_open() {
let dir = board_dir();
write_ticket(&dir, "backlog", "11111111-0000-4000-8000-000000000000", "First one", "");
let mut board = one_board(&dir);
board.toggle_detail();
let row = footer(&board, 120, 20);
assert!(row.contains("enter/q close"), "q is not named as the close key:\n{row}");
assert!(!row.contains("q quit"), "q still offered as the quit key:\n{row}");
// And the last slot still answers how to get out, which from here is the one
// key that does it in a single press.
assert!(row.contains("ctrl-c quit"), "nothing says what quits from here:\n{row}");
}
// ------------------------------------------------------- several boards at once --
@@ -2539,13 +2873,211 @@ mod tests {
/// The label takes what the row has left, never the mark or the id, and says it was
/// cut. A column too narrow for even that keeps the identity alone.
///
/// The mark, a space and the id in its brackets, which is what `card_lines` has
/// built by the time it asks.
#[test]
fn the_project_label_gives_way_to_the_mark_and_the_id() {
assert_eq!(project_label("alpha", 38).as_deref(), Some("alpha"));
// Room for four characters of a longer name, the last of them the ellipsis.
assert_eq!(project_label("factry-core", 16).as_deref(), Some("fac…"));
assert_eq!(project_label("factry-core", 13), None);
assert_eq!(project_label("alpha", 4), None);
const IDENTITY: usize = 2 + 1 + SHORT_ID_WIDTH + 2;
assert_eq!(project_label("alpha", 38, IDENTITY).as_deref(), Some("alpha"));
// Room for three characters of a longer name, the last of them the ellipsis.
assert_eq!(
project_label("factry-core", 16, IDENTITY).as_deref(),
Some("fa…")
);
assert_eq!(project_label("factry-core", 13, IDENTITY), None);
assert_eq!(project_label("alpha", 4, IDENTITY), None);
}
/// The label plus everything before it has to fit the column it is drawn in. The
/// arithmetic this replaced left out the space after the priority mark, so the row
/// came out one cell wider than the column at every width the label was cut at.
#[test]
fn the_project_label_leaves_the_row_inside_the_column() {
const IDENTITY: usize = 2 + 1 + SHORT_ID_WIDTH + 2;
for width in 13u16..40 {
let Some(label) = project_label("factry-core", width, IDENTITY) else {
continue;
};
let row = IDENTITY + 1 + label.chars().count();
assert!(row <= width as usize, "row {row} over column {width}");
}
}
// ------------------------------------------------------- the blocked mark --
const BLOCKER: &str = "aaaaaaaa-0000-4000-8000-000000000000";
const WAITER: &str = "bbbbbbbb-0000-4000-8000-000000000000";
const ELSEWHERE: &str = "cccccccc-0000-4000-8000-000000000000";
/// A Relations section as `relate` writes it, for the `extra` a fixture appends.
///
/// It lands after the Metadata rather than in `SECTION_ORDER`'s place for it, which
/// `section_body` reads all the same: these tests are about what the section says,
/// not where the writer puts it.
fn blocked_by(uuid: &str) -> String {
format!("\n## Relations\n\n- blocked by {uuid}\n")
}
/// Whether the board decided the named ticket is held up.
///
/// Over every column, done included: the flag is filled whether or not the column
/// is drawn, the same way `reload` scans done while `d` hides it.
fn marked_blocked(board: &Board, title: &str) -> bool {
board
.current()
.columns
.iter()
.flat_map(|column| &column.cards)
.find(|card| card.ticket.title == title)
.unwrap_or_else(|| panic!("no card titled '{title}'"))
.blocked
}
/// The rows of the named ticket's card, laid out in a column of `inner` characters.
fn card_rows(board: &Board, title: &str, inner: u16) -> Vec<String> {
let card = board
.current()
.columns
.iter()
.flat_map(|column| &column.cards)
.find(|card| card.ticket.title == title)
.unwrap_or_else(|| panic!("no card titled '{title}'"));
card_lines(card, false, inner)
.iter()
.map(|line| line.spans.iter().map(|span| span.content.as_ref()).collect())
.collect()
}
/// The one thing on a card that says do not start this. Without it a ticket whose
/// blocker is still open reads exactly like one that is ready.
#[test]
fn a_card_waiting_on_an_open_ticket_carries_the_blocked_mark() {
let dir = board_dir();
write_ticket(&dir, "committed", BLOCKER, "The blocker", "");
write_ticket(&dir, "backlog", WAITER, "The waiter", &blocked_by(BLOCKER));
let board = one_board(&dir);
assert!(marked_blocked(&board, "The waiter"));
// The far end of the relation is not held up by holding somebody else up.
assert!(!marked_blocked(&board, "The blocker"));
let screen = render(&board, 120, 20).join("\n");
assert!(
screen.contains(&format!("({}) {}", short_id(WAITER), BLOCKED_MARK)),
"no mark after the id:\n{screen}"
);
}
/// The mark is the state of the dependency, not a note that one was ever recorded.
#[test]
fn a_card_whose_blockers_are_all_done_carries_none() {
let dir = board_dir();
write_ticket(&dir, "done", BLOCKER, "The blocker", "");
write_ticket(&dir, "backlog", WAITER, "The waiter", &blocked_by(BLOCKER));
let board = one_board(&dir);
assert!(!marked_blocked(&board, "The waiter"));
let screen = render(&board, 120, 20).join("\n");
assert!(
!screen.contains(BLOCKED_MARK),
"a cleared blocker still marked:\n{screen}"
);
}
/// One open blocker out of two is still a reason not to start, the rule `mv` applies
/// when it names every open blocker rather than the first.
#[test]
fn a_card_is_marked_while_any_one_of_its_blockers_is_open() {
let dir = board_dir();
write_ticket(&dir, "done", BLOCKER, "The blocker", "");
write_ticket(&dir, "reviewing", ELSEWHERE, "The other blocker", "");
write_ticket(
&dir,
"backlog",
WAITER,
"The waiter",
&format!("\n## Relations\n\n- blocked by {BLOCKER}\n- blocked by {ELSEWHERE}\n"),
);
assert!(marked_blocked(&one_board(&dir), "The waiter"));
}
/// The answer `mv` gives a dangling uuid: a bookkeeping fault, not a dependency.
#[test]
fn a_blocker_the_board_does_not_hold_marks_nothing() {
let dir = board_dir();
write_ticket(&dir, "backlog", WAITER, "The waiter", &blocked_by(ELSEWHERE));
assert!(!marked_blocked(&one_board(&dir), "The waiter"));
}
/// Nothing but `relate` writes the section, so a line that is not a relation means a
/// hand-edited file. `show` and `mv` are where that is reported; the board draws the
/// ticket unmarked, the exception `detail_of` already makes for the same reason.
#[test]
fn a_relations_section_that_cannot_be_parsed_leaves_the_board_drawable() {
let dir = board_dir();
write_ticket(
&dir,
"backlog",
WAITER,
"The waiter",
"\n## Relations\n\n- waits for the other one\n",
);
let board = one_board(&dir);
assert!(!marked_blocked(&board, "The waiter"));
let screen = render(&board, 120, 20).join("\n");
assert!(screen.contains("The waiter"), "the board lost the ticket:\n{screen}");
}
/// Dropped whole in a column that cannot hold the identity and the mark together,
/// the rule a corner follows. The id keeps its place either way: a column of ids
/// starting at different cells costs more than one card's state is worth.
#[test]
fn a_column_too_narrow_for_the_mark_drops_it() {
let dir = board_dir();
write_ticket(&dir, "committed", BLOCKER, "The blocker", "");
write_ticket(&dir, "backlog", WAITER, "The waiter", &blocked_by(BLOCKER));
let board = one_board(&dir);
// The mark, a space, the id in its brackets, and the space the mark needs.
let identity = (2 + 1 + SHORT_ID_WIDTH + 2) as u16;
let id = format!("({})", short_id(WAITER));
let wide = card_rows(&board, "The waiter", identity + 2);
assert!(wide[0].contains(BLOCKED_MARK), "no mark with room for it: {:?}", wide[0]);
let narrow = card_rows(&board, "The waiter", identity);
assert!(!narrow[0].contains(BLOCKED_MARK), "mark kept over the column: {:?}", narrow[0]);
assert!(narrow[0].contains(&id), "the identity gave way instead: {:?}", narrow[0]);
assert!(narrow[0].chars().count() <= identity as usize, "row over the column");
}
/// The merge resolves nothing of its own. A relation names a uuid `relate` looked up
/// in one `.worklane`, so a blocker in another project is not a thing that exists,
/// and the flag each card arrives with is the one its own board worked out.
#[test]
fn the_blocked_mark_follows_a_card_onto_the_merge() {
let (first, second) = (board_dir(), board_dir());
write_ticket(&first, "committed", BLOCKER, "The blocker", "");
write_ticket(&first, "backlog", WAITER, "The waiter", &blocked_by(BLOCKER));
write_ticket(&second, "backlog", ELSEWHERE, "Elsewhere", &blocked_by(BLOCKER));
// The merge tab is where the view opens.
let board = boards(&[("alpha", &first), ("beta", &second)]);
assert_eq!(board.current().name, ALL);
assert!(marked_blocked(&board, "The waiter"));
assert!(
!marked_blocked(&board, "Elsewhere"),
"a uuid on another board was read as a blocker"
);
}
/// A change in any monitored board has to redraw, not only one in the first.
+375 -1
View File
@@ -68,6 +68,17 @@ pub enum Color {
Grey,
Magenta,
BrightRed,
// The eight the tag palette draws from. Named as colours rather than as `TagBlue`,
// because the enum is the palette and `TAG_COLORS` is what reserves them: a use
// belongs to the list that claims it, not to the name of the colour it claims.
Blue,
Sky,
Violet,
Pink,
Turquoise,
Olive,
Tan,
Steel,
}
impl Color {
@@ -88,11 +99,23 @@ impl Color {
Color::Magenta => "\x1b[1;35m",
// Indexed, for the same reason grey is: this is the spelling that renders.
Color::BrightRed => "\x1b[38;5;9m",
// The tag palette, indexed throughout. The basic slots are themed by the
// terminal and drift towards each other on a real palette, which is fine
// for seven colours that each mean something and useless for six that have
// to stay apart from those seven and from one another.
Color::Blue => "\x1b[38;5;33m",
Color::Sky => "\x1b[38;5;117m",
Color::Violet => "\x1b[38;5;99m",
Color::Pink => "\x1b[38;5;205m",
Color::Turquoise => "\x1b[38;5;43m",
Color::Olive => "\x1b[38;5;106m",
Color::Tan => "\x1b[38;5;137m",
Color::Steel => "\x1b[38;5;67m",
}
}
/// Every colour in the palette, so a test can walk them without listing them.
pub const ALL: [Color; 7] = [
pub const ALL: [Color; 15] = [
Color::Red,
Color::Cyan,
Color::Orange,
@@ -100,9 +123,95 @@ impl Color {
Color::Grey,
Color::Magenta,
Color::BrightRed,
Color::Blue,
Color::Sky,
Color::Violet,
Color::Pink,
Color::Turquoise,
Color::Olive,
Color::Tan,
Color::Steel,
];
}
/// The colours a tag may be drawn in.
///
/// Deliberately disjoint from the seven that already carry a meaning, per the guideline
/// in AGENTS.md: a tag in red reads as a uuid, in green as a title, in grey as an unset
/// value. Reserving slots here rather than picking at the call site is what keeps the
/// next colour someone assigns from landing on top of the tags.
///
/// Eight, and a real board carries more tags than that, so two tags will share a
/// colour. That is accepted rather than designed around: the colour groups one tag
/// across cards, it does not identify it, and the tag is written out beside it either
/// way. Nothing pure can do better, since a function of the tag alone cannot know what
/// else sits on the card.
///
/// Eight rather than six because two tags on one card collide at roughly `1 / n`, so
/// the only lever is the size of the list. It stops here because these are the slots
/// the assigned meanings leave: red, orange, green, cyan, magenta and grey are spoken
/// for, and a ninth would have to be a shade of one of the eight. Two colours nobody
/// can tell apart are a collision by another name.
///
/// At eight, about a fifth of the cards on this board show two tags in one colour. That
/// is the arithmetic, not a fault to fix: the colour groups one tag *across* cards, so
/// a repeat within a card costs nothing that the tag text beside it does not answer.
///
/// Do not tune this against the tags on one board. The count of collisions on any given
/// board swings either side of the average on the luck of the hash, and picking the
/// length that flatters today's vocabulary would be fitting to noise. An earlier draft
/// scored two collisions in sixty-four here, which looked like a good palette and was
/// really a broken index folding the whole vocabulary into a handful of slots.
pub const TAG_COLORS: [Color; 8] = [
Color::Blue,
Color::Sky,
Color::Violet,
Color::Pink,
Color::Turquoise,
Color::Olive,
Color::Tan,
Color::Steel,
];
/// FNV-1a, 64 bit, over the bytes of the tag.
///
/// Written out rather than taken from `std`: `DefaultHasher` is explicitly not promised
/// to keep its output stable across releases, and a board that repaints itself on a
/// toolchain upgrade has lost the one property this is for. Nine lines and no
/// dependency buys a mapping that is the same on every machine and every version.
fn fnv1a(bytes: &[u8]) -> u64 {
const OFFSET: u64 = 0xcbf2_9ce4_8422_2325;
const PRIME: u64 = 0x0000_0100_0000_01b3;
let mut hash = OFFSET;
for byte in bytes {
hash ^= u64::from(*byte);
hash = hash.wrapping_mul(PRIME);
}
hash
}
/// The colour a tag is drawn in, derived from the tag itself.
///
/// A pure function of the string, so the same tag is the same colour on every card, in
/// every view and on every board, with nothing stored and nothing to keep in step. Two
/// boards that have never met agree about `bug`.
///
/// Case sensitive, because `Bug` and `bug` are two different tags everywhere else in
/// worklane. Colouring them alike would be the display claiming a sameness the filter
/// and the field do not have.
pub fn tag_color(tag: &str) -> Color {
// Multiply-shift, not `% len`. The palette length is a power of two, so a modulus
// would keep the low three bits of the hash, and FNV-1a's low bits carry only the
// low bits of the input bytes: the multiply cannot move information downwards and
// the xor never does. `bug` and `BUG` differ in bit 5 of every letter, so under a
// modulus they landed in the same slot no matter what else the strings held, as did
// every other pair differing only above bit 2. Taking the top bits of the product
// uses the whole hash, which is where the avalanche is.
let index = (u128::from(fnv1a(tag.as_bytes())) * TAG_COLORS.len() as u128) >> 64;
TAG_COLORS[index as usize]
}
/// The same palette as ratatui sees it.
///
/// Chosen to match what crossterm emits for the escape above, so a card in the TUI and
@@ -119,6 +228,16 @@ impl From<Color> for ratatui::style::Color {
Color::Grey => Tui::DarkGray,
Color::Magenta => Tui::Magenta,
Color::BrightRed => Tui::LightRed,
// Indexed on both sides, so the card and the listing are the same colour
// by construction rather than by two guesses that happen to agree.
Color::Blue => Tui::Indexed(33),
Color::Sky => Tui::Indexed(117),
Color::Violet => Tui::Indexed(99),
Color::Pink => Tui::Indexed(205),
Color::Turquoise => Tui::Indexed(43),
Color::Olive => Tui::Indexed(106),
Color::Tan => Tui::Indexed(137),
Color::Steel => Tui::Indexed(67),
}
}
}
@@ -673,9 +792,40 @@ fn metadata_value_cell(name: &str, value: &str, colored: bool, campaign: &str) -
return paint(value, Color::Grey, colored);
}
if name == "Tags" {
return paint_tags(value, colored);
}
value.to_string()
}
/// The stored tag list with each tag in its own colour.
///
/// Painted in place rather than split and rejoined, so whatever separators the file
/// holds come back unchanged. `bug, cli` and `bug,cli` are both written by hand at some
/// point, and a cell that normalised them would be the display quietly disagreeing with
/// the file it is showing.
fn paint_tags(value: &str, colored: bool) -> String {
value
.split(',')
.map(|piece| {
let tag = piece.trim();
if tag.is_empty() {
return piece.to_string();
}
let lead = piece.len() - piece.trim_start().len();
format!(
"{}{}{}",
&piece[..lead],
paint(tag, tag_color(tag), colored),
&piece[lead + tag.len()..]
)
})
.collect::<Vec<_>>()
.join(",")
}
/// Render the Metadata section as two aligned columns.
///
/// Taken as a block rather than a line at a time because the field column cannot be
@@ -902,6 +1052,26 @@ pub fn parse_campaign(content: &str) -> Option<String> {
}
}
/// The tags a ticket carries, from the comma-separated field.
///
/// Whole values, trimmed: the field is written as `bug, frontend` by `add` and as
/// `bug,frontend` by hand, and a caller asking whether a ticket is tagged `bug` must
/// not be answered by a ticket tagged `bugfix`. Absent, unset and empty are one
/// answer, as they are for [`parse_campaign`]: no tags.
pub fn parse_tags(content: &str) -> Vec<String> {
let value = parse_ticket_field(content, "Tags");
if is_unknown_value(&value) {
return Vec::new();
}
value
.split(',')
.map(str::trim)
.filter(|tag| !tag.is_empty())
.map(str::to_string)
.collect()
}
/// The metadata fields in the order `add` writes them, with `Campaign` in its place
/// among them.
///
@@ -1809,6 +1979,34 @@ pub struct TicketItem {
/// Read here for the reason `criteria` is: `ls --campaign` filters on what this
/// pass already produced, rather than reading every ticket a second time to ask.
pub campaign: Option<String>,
/// The tags the ticket carries, split out of the comma-separated field, or empty
/// for an untagged one.
///
/// Read here for the reason `criteria` is: the board draws them on every card, and
/// asking per card would re-read every ticket body on every draw rather than on the
/// tick that changed something.
pub tags: Vec<String>,
/// The full uuid from the ticket's own ID field, as a relation stores it.
///
/// `id` is the seven characters a listing prints; a relation names the whole uuid,
/// so pairing a stored blocker with the ticket it points at needs the whole thing.
/// Absent or unset reads as `_Not set_`, the way every other field does, and the
/// board guards for it rather than matching on it.
pub uuid: String,
/// The uuids of the tickets this one records a `blocked by` against, empty when it
/// records none.
///
/// Read here for the reason `criteria` is: the board marks every held-up card on
/// every tick, and asking per card would re-read every ticket body on every draw.
/// The uuids only, never the answer: whether a blocker is still open is a fact
/// about another ticket, so it belongs to whoever holds the whole board.
///
/// A Relations section that cannot be parsed reads as no blockers rather than as a
/// ticket that cannot be listed. `show` and `mv` still refuse it, which is where a
/// hand-edited file has to be reported; a board or a listing that stops on one
/// malformed ticket is the worse failure, and is the same exception `detail_of`
/// already makes.
pub blockers: Vec<String>,
/// The file this came from. The listing ignores it; the TUI opens it for the
/// detail view rather than resolving the ticket a second time.
pub path: std::path::PathBuf,
@@ -1944,6 +2142,13 @@ pub fn collect_ticket_items(status_path: impl AsRef<Path>) -> Result<Vec<TicketI
let filename = e.path().file_stem()?.to_string_lossy().to_string();
let created_at = parse_ticket_field(&content, "Created At");
let blockers = parse_relations(&content, &title)
.unwrap_or_default()
.into_iter()
.filter(|relation| relation.kind == RelationKind::BlockedBy)
.map(|relation| relation.target)
.collect();
// Through `criteria()`, so the card and the numbers `show` prints cannot
// disagree: a checkbox written into a description is not a criterion there
// and is not counted here.
@@ -1965,6 +2170,9 @@ pub fn collect_ticket_items(status_path: impl AsRef<Path>) -> Result<Vec<TicketI
priority: parse_priority(&content),
criteria: progress,
campaign: parse_campaign(&content),
tags: parse_tags(&content),
uuid: parse_ticket_field(&content, "ID"),
blockers,
path: e.path(),
})
})
@@ -2377,6 +2585,61 @@ mod tests {
fs::remove_dir_all(&dir).unwrap();
}
/// The blockers come off the read that builds the item, so the board pays no second
/// pass for them, and only the `blocked by` kind is one: the other two record no
/// dependency and gate nothing.
///
/// A section that cannot be parsed reads as no blockers rather than as a ticket that
/// cannot be listed. `show` and `mv` are where a hand-edited file is reported; a
/// listing that stops on one malformed ticket is the worse failure.
#[test]
fn collect_ticket_items_reads_the_uuid_and_the_blockers_it_records() {
let dir = std::env::temp_dir().join(format!("worklane-blocked-{}", uuid::Uuid::new_v4()));
fs::create_dir_all(&dir).unwrap();
let uuid = |tail: &str| format!("11111111-0000-4000-8000-00000000000{tail}");
let write = |name: &str, relations: &str| {
fs::write(
dir.join(format!("{}.md", uuid(name))),
format!(
"# T{name}\n\n## Relations\n{relations}\n## Metadata\n\n- **ID**: {}\n",
uuid(name)
),
)
.unwrap();
};
write("1", &format!("\n- blocked by {}\n- relates to {}\n", uuid("2"), uuid("3")));
write("2", "\n- regression of 99999999-0000-4000-8000-000000000000\n");
write("3", "\n- waits for the other one\n");
let items = collect_ticket_items(&dir).unwrap();
let of = |title: &str| items.iter().find(|item| item.title == title).unwrap();
assert_eq!(of("T1").uuid, uuid("1"));
assert_eq!(of("T1").blockers, vec![uuid("2")]);
assert!(of("T2").blockers.is_empty(), "a regression was read as a blocker");
assert!(of("T3").blockers.is_empty(), "an unreadable section was not survived");
fs::remove_dir_all(&dir).unwrap();
}
/// Whole values, so a filter or a card cannot confuse two tags that share a prefix.
#[test]
fn parse_tags_splits_on_commas_and_keeps_whole_values() {
let content = "# T\n\n## Metadata\n\n- **Tags**: bug, frontend,bugfix\n";
assert_eq!(parse_tags(content), vec!["bug", "frontend", "bugfix"]);
}
/// Absent, unset and empty are one answer: no tags.
#[test]
fn parse_tags_reads_an_unset_or_missing_field_as_none() {
assert_eq!(parse_tags("# T\n\n## Metadata\n\n- **Tags**: _None_\n"), Vec::<String>::new());
assert_eq!(parse_tags("# T\n\n## Metadata\n\n- **Tags**:\n"), Vec::<String>::new());
assert_eq!(parse_tags("# T\n\n## Metadata\n\n- **Owner**: alice\n"), Vec::<String>::new());
assert_eq!(parse_tags("# T\n\n## Metadata\n\n- **Tags**: , ,\n"), Vec::<String>::new());
}
#[test]
fn collect_ticket_items_lists_only_md_files() {
let dir = std::env::temp_dir().join(format!("worklane-stray-{}", uuid::Uuid::new_v4()));
@@ -2757,6 +3020,117 @@ mod tests {
assert_eq!(seen.len(), Color::ALL.len());
}
/// The text a cell holds once its colour is taken off, so a test can assert the
/// separators survived without spelling out the escapes around them.
fn strip_escapes(text: &str) -> String {
let mut out = String::with_capacity(text.len());
let mut rest = text;
while let Some(at) = rest.find('\x1b') {
out.push_str(&rest[..at]);
match rest[at..].find('m') {
Some(end) => rest = &rest[at + end + 1..],
None => return out,
}
}
out.push_str(rest);
out
}
#[test]
fn a_tag_keeps_its_colour_and_different_tags_do_not_all_share_one() {
assert_eq!(tag_color("bug"), tag_color("bug"));
assert_eq!(tag_color("frontend"), tag_color("frontend"));
let spread: std::collections::HashSet<Color> =
["bug", "feature", "cli", "tui", "docs", "chore", "output", "skills"]
.iter()
.map(|tag| tag_color(tag))
.collect();
assert!(spread.len() > 3, "the mapping collapses the vocabulary: {spread:?}");
}
/// Case sensitive on purpose: `Bug` and `bug` are two different tags to the field
/// and to every search, so one colour for both would be the display claiming a
/// sameness nothing else has.
///
/// Over a set rather than one pair. Any single pair can land in the same slot by
/// luck, one time in `TAG_COLORS.len()`, and a test that reads that accident as
/// case folding would be asserting the hash rather than the rule.
#[test]
fn tag_colour_does_not_fold_case() {
let folded = ["bug", "cli", "tui", "docs", "chore"]
.iter()
.all(|tag| tag_color(tag) == tag_color(&tag.to_uppercase()));
assert!(!folded, "tag_color lowercases before hashing");
}
/// Pinned so that a change to the hash is a failing test rather than a board that
/// quietly repaints itself. If this fails, the mapping moved: decide whether that
/// was intended before rewriting the expectations.
#[test]
fn the_tag_mapping_is_pinned() {
assert_eq!(tag_color("bug"), Color::Blue);
assert_eq!(tag_color("feature"), Color::Blue);
assert_eq!(tag_color("cli"), Color::Steel);
assert_eq!(tag_color("tui"), Color::Violet);
assert_eq!(tag_color("docs"), Color::Tan);
assert_eq!(tag_color("chore"), Color::Sky);
assert_eq!(tag_color("skills"), Color::Tan);
assert_eq!(tag_color("output"), Color::Blue);
}
/// The whole reason the tag palette is a reserved list rather than a pick at the
/// call site: a tag drawn in red reads as a uuid, in green as a title, in grey as
/// an unset value.
#[test]
fn no_tag_colour_carries_another_meaning() {
for assigned in [
Color::Red,
Color::Orange,
Color::Cyan,
Color::Green,
Color::Grey,
Color::Magenta,
Color::BrightRed,
] {
assert!(
!TAG_COLORS.contains(&assigned),
"{assigned:?} means something else already"
);
}
// The priority ramp is the other list that claims colours, and it is built from
// the assigned seven rather than named here, so ask it directly.
for level in PRIORITY_RANGE {
let ramp = priority_mark(Priority::Level(level)).1;
assert!(!TAG_COLORS.contains(&ramp), "{ramp:?} is a priority colour");
}
}
#[test]
fn the_tags_cell_paints_each_tag_and_leaves_the_separators_alone() {
let plain = metadata_value_cell("Tags", "bug, cli", false, "");
assert_eq!(plain, "bug, cli", "colour off must be the stored value");
let painted = metadata_value_cell("Tags", "bug, cli", true, "");
assert!(painted.contains(&paint("bug", tag_color("bug"), true)));
assert!(painted.contains(&paint("cli", tag_color("cli"), true)));
// The separator the file holds comes back as it went in, spacing and all.
assert_eq!(strip_escapes(&painted), "bug, cli");
assert_eq!(strip_escapes(&metadata_value_cell("Tags", "bug,cli", true, "")), "bug,cli");
assert_eq!(strip_escapes(&metadata_value_cell("Tags", " bug , cli ", true, "")), " bug , cli ");
}
/// An unset value stays grey, since the Tags branch sits behind the unknown check.
#[test]
fn an_unset_tags_cell_is_still_grey() {
assert_eq!(
metadata_value_cell("Tags", "_None_", true, ""),
paint("_None_", Color::Grey, true)
);
}
/// Pinned deliberately. Both SGR spellings of grey failed on a real palette,
/// 90 reading nearly as light as the foreground and 37 sitting on top of it.
/// This is the exact sequence crossterm emits for ratatui's Color::DarkGray,
+104
View File
@@ -457,3 +457,107 @@ fn add_treats_an_all_blank_description_as_none() {
"was {content:?}"
);
}
/// The help, the README and the skill all promise `YYYY-MM-DD`, and until this the
/// value was written to the ticket whatever it said.
#[test]
fn add_stores_a_valid_due_date_unchanged() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
cmd.current_dir(temp.path())
.arg("add")
.args(["--title", "Dated"])
.args(["--due", "2026-08-29"])
.assert()
.success();
let content = read_only_ticket(&worklane.join("backlog"));
assert!(content.contains("- **Due**: 2026-08-29"), "{content}");
}
/// Every one of these is refused at parse time, so the exit code is 2 and nothing is
/// written. A date that cannot happen is as wrong as a word: `2026-02-30` has the shape
/// and is not a day.
#[test]
fn add_refuses_a_due_date_that_is_not_a_real_iso_date() {
for value in ["next friday", "29-08-2026", "2026-13-01", "2026-02-30", "2026/08/29", ""] {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
let out = cmd
.current_dir(temp.path())
.arg("add")
.args(["--title", "Dated"])
.args(["--due", value])
.assert()
.failure()
.get_output()
.clone();
assert_eq!(out.status.code(), Some(2), "{value:?} was not a usage error");
assert_eq!(
fs::read_dir(worklane.join("backlog")).unwrap().count(),
0,
"{value:?} wrote a ticket anyway"
);
}
}
/// An unpadded date parses as a date and would be stored as typed, which sorts before
/// `2026-10-01` and is not the format anything promises.
#[test]
fn add_refuses_an_unpadded_due_date_rather_than_padding_it() {
let temp = TempDir::new().unwrap();
setup_worklane(&temp);
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
let stderr = String::from_utf8_lossy(
&cmd.current_dir(temp.path())
.arg("add")
.args(["--title", "Dated"])
.args(["--due", "2026-8-9"])
.assert()
.failure()
.get_output()
.stderr,
)
.to_string();
assert!(stderr.contains("YYYY-MM-DD"), "the error never names the format: {stderr}");
}
/// An empty value keeps the message about clearing, since that is what somebody typing
/// it is reaching for.
#[test]
fn an_empty_due_date_says_clearing_is_not_supported() {
let temp = TempDir::new().unwrap();
setup_worklane(&temp);
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
let stderr = String::from_utf8_lossy(
&cmd.current_dir(temp.path())
.arg("add")
.args(["--title", "Dated"])
.args(["--due", ""])
.assert()
.failure()
.get_output()
.stderr,
)
.to_string();
assert!(stderr.contains("clearing a field is not supported"), "{stderr}");
}
fn read_only_ticket(dir: &Path) -> String {
let file = fs::read_dir(dir)
.unwrap()
.filter_map(|e| e.ok())
.find(|e| e.path().extension().is_some_and(|ext| ext == "md"))
.expect("no ticket written");
fs::read_to_string(file.path()).unwrap()
}
+111 -8
View File
@@ -3,9 +3,11 @@ use assert_fs::TempDir;
const BIN_NAME: &str = env!("CARGO_BIN_EXE_worklane");
/// The document as this test's binary carries it, so the print path is pinned to the
/// file in the repo rather than to a description of it.
/// The documents as this test's binary carries them, so the print path is pinned to the
/// files in the repo rather than to a description of them.
const SKILL: &str = include_str!("../assets/SKILL.md");
const REVIEW: &str = include_str!("../assets/REVIEW.md");
const PLAN: &str = include_str!("../assets/PLAN.md");
/// `HOME` is redirected, so the suite never writes into the home of whoever runs it.
/// A temp directory rather than the real one is also what makes the already-installed
@@ -20,9 +22,21 @@ fn installed(home: &TempDir) -> std::path::PathBuf {
home.path().join(".claude/skills/worklane/SKILL.md")
}
/// Nothing about the skill needs a board, and it is wanted before there is one.
fn installed_review(home: &TempDir) -> std::path::PathBuf {
home.path().join(".claude/skills/worklane-review/SKILL.md")
}
fn installed_plan(home: &TempDir) -> std::path::PathBuf {
home.path().join(".claude/skills/worklane-plan/SKILL.md")
}
/// Nothing about the skills needs a board, and they are wanted before there is one.
///
/// One invocation writes every document. A person who learned the command before the
/// review skill existed gets it without learning anything new, which is the whole
/// reason there is no name to pass.
#[test]
fn the_skill_installs_outside_a_worklane_directory() {
fn every_skill_installs_outside_a_worklane_directory() {
let home = TempDir::new().unwrap();
let out = run(&home, &["install-skill"]);
@@ -31,7 +45,51 @@ fn the_skill_installs_outside_a_worklane_directory() {
assert_eq!(out.status.code(), Some(0), "{stdout}");
assert!(stdout.contains("Installed the worklane skill"), "{stdout}");
assert!(stdout.contains(".claude/skills/worklane/SKILL.md"), "{stdout}");
assert!(stdout.contains("Installed the worklane-review skill"), "{stdout}");
assert!(stdout.contains(".claude/skills/worklane-review/SKILL.md"), "{stdout}");
assert!(stdout.contains("Installed the worklane-plan skill"), "{stdout}");
assert!(stdout.contains(".claude/skills/worklane-plan/SKILL.md"), "{stdout}");
assert_eq!(std::fs::read_to_string(installed(&home)).unwrap(), SKILL);
assert_eq!(std::fs::read_to_string(installed_review(&home)).unwrap(), REVIEW);
assert_eq!(std::fs::read_to_string(installed_plan(&home)).unwrap(), PLAN);
// Once, not per document: it is the one thing to do next, not part of an outcome.
assert_eq!(
stdout.matches("pick it up on their next session").count(),
1,
"{stdout}"
);
}
/// Narrowing to one document is the exception, and it must leave the others alone.
#[test]
fn a_named_skill_installs_only_that_one() {
let home = TempDir::new().unwrap();
let out = run(&home, &["install-skill", "worklane-review"]);
let stdout = String::from_utf8_lossy(&out.stdout);
assert_eq!(out.status.code(), Some(0), "{stdout}");
assert_eq!(std::fs::read_to_string(installed_review(&home)).unwrap(), REVIEW);
assert!(!installed(&home).exists(), "a named install wrote the other document too");
assert!(!installed_plan(&home).exists(), "a named install wrote the other document too");
}
/// A name nothing ships is a stop, with the choices in the message: guessing at the
/// nearest match would install a document nobody asked for.
#[test]
fn an_unknown_skill_name_is_refused_and_lists_what_there_is() {
let home = TempDir::new().unwrap();
let out = run(&home, &["install-skill", "reviewer"]);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_ne!(out.status.code(), Some(0), "{stderr}");
assert!(stderr.contains("no skill named"), "{stderr}");
assert!(stderr.contains("worklane-review"), "{stderr}");
assert!(!installed(&home).exists());
assert!(!installed_review(&home).exists());
assert!(!installed_plan(&home).exists());
}
#[test]
@@ -73,17 +131,62 @@ fn a_modified_copy_is_reported_and_needs_force() {
assert_eq!(std::fs::read_to_string(installed(&home)).unwrap(), SKILL);
}
/// One refused document must not stop the ones behind it: the message is per document,
/// and the run still reports what it did with each.
#[test]
fn a_modified_copy_does_not_stop_the_other_documents() {
let home = TempDir::new().unwrap();
run(&home, &["install-skill"]);
std::fs::write(installed(&home), "hand written\n").unwrap();
std::fs::remove_file(installed_review(&home)).unwrap();
let out = run(&home, &["install-skill"]);
let stdout = String::from_utf8_lossy(&out.stdout);
assert_eq!(out.status.code(), Some(0), "{stdout}");
assert!(stdout.contains("Differs from the version in this binary"), "{stdout}");
assert!(stdout.contains("install-skill worklane --print"), "{stdout}");
assert_eq!(std::fs::read_to_string(installed(&home)).unwrap(), "hand written\n");
assert_eq!(std::fs::read_to_string(installed_review(&home)).unwrap(), REVIEW);
assert_eq!(std::fs::read_to_string(installed_plan(&home)).unwrap(), PLAN);
}
/// The print path is what makes a modified copy diffable, so it has to be the document
/// byte for byte and it must not install anything on the way past.
#[test]
fn print_writes_the_document_to_stdout_and_installs_nothing() {
fn print_writes_the_named_document_to_stdout_and_installs_nothing() {
let home = TempDir::new().unwrap();
let out = run(&home, &["install-skill", "worklane", "--print"]);
assert_eq!(out.status.code(), Some(0));
assert_eq!(String::from_utf8_lossy(&out.stdout), SKILL);
let out = run(&home, &["install-skill", "worklane-review", "--print"]);
assert_eq!(out.status.code(), Some(0));
assert_eq!(String::from_utf8_lossy(&out.stdout), REVIEW);
let out = run(&home, &["install-skill", "worklane-plan", "--print"]);
assert_eq!(out.status.code(), Some(0));
assert_eq!(String::from_utf8_lossy(&out.stdout), PLAN);
assert!(!installed(&home).exists(), "--print installed the skill anyway");
assert!(!installed_review(&home).exists(), "--print installed the skill anyway");
assert!(!installed_plan(&home).exists(), "--print installed the skill anyway");
}
/// A diff is against one document. Printing them all run together would be neither of
/// them, so an unnamed `--print` says what to type instead of guessing.
#[test]
fn print_without_a_name_says_which_names_there_are() {
let home = TempDir::new().unwrap();
let out = run(&home, &["install-skill", "--print"]);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_eq!(out.status.code(), Some(0));
assert_eq!(String::from_utf8_lossy(&out.stdout), SKILL);
assert!(!installed(&home).exists(), "--print installed the skill anyway");
assert_ne!(out.status.code(), Some(0), "{stderr}");
assert!(stderr.contains("name the skill to print"), "{stderr}");
assert!(stderr.contains("worklane-review"), "{stderr}");
assert!(String::from_utf8_lossy(&out.stdout).is_empty(), "a document was printed anyway");
}
/// The command has to be findable by someone who does not already know it exists.
+47
View File
@@ -415,3 +415,50 @@ fn neither_command_can_write_owner_or_status() {
assert!(content.contains("- **Owner**: alice"));
assert!(content.contains("- **Status**: backlog"));
}
/// The same parser `add` uses, from one definition. Grooming a board sets dates through
/// `set`, so validating only the command that files a ticket would leave the path that
/// is actually used wide open.
#[test]
fn set_refuses_a_due_date_that_is_not_a_real_iso_date() {
for value in ["next friday", "2026-02-30", "2026-8-9"] {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
let filename = create_ticket(&worklane);
let before = fs::read_to_string(worklane.join("backlog").join(&filename)).unwrap();
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
let out = cmd
.current_dir(temp.path())
.args(["set", UUID])
.args(["--due", value])
.assert()
.failure()
.get_output()
.clone();
assert_eq!(out.status.code(), Some(2), "{value:?} was not a usage error");
assert_eq!(
fs::read_to_string(worklane.join("backlog").join(&filename)).unwrap(),
before,
"{value:?} changed the ticket anyway"
);
}
}
#[test]
fn set_stores_a_valid_due_date_unchanged() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
let filename = create_ticket(&worklane);
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
cmd.current_dir(temp.path())
.args(["set", UUID])
.args(["--due", "2026-12-31"])
.assert()
.success();
let content = fs::read_to_string(worklane.join("backlog").join(&filename)).unwrap();
assert!(content.contains("- **Due**: 2026-12-31"), "{content}");
}