Compare commits

...
3 Commits
Author SHA1 Message Date
Ansho ReiandClaude Opus 5 37dbd722e0 (3b16540) Open a search with / in the tui, and bump to 0.13.6
Finding a ticket meant scrolling four columns and reading, which is what the
id and the title are for.

The real work was the input mode: every key in the dispatch was a single-shot
action, and a query needs one that swallows the keys bound to them. That is
Board::search_key, offered every key ahead of the action arms and reporting
what it took. With no prompt open it takes nothing, so every other state's
dispatch is unchanged. On Board for the reason dismiss is: the arm is not
reachable from a test.

ctrl-c is the one key the prompt declines, since a terminal application
always honours it. Every other control combination is swallowed and does
nothing: it must not type its letter, and it must not fall through either,
because the action arms match on the code alone and ctrl-d would reach the
arm bound to d.

first_match runs over every card in the visible columns, in reading order,
not the rows on screen: a query that answered differently on a tall terminal
and a short one is not a search, and the jump scrolls the match into view. A
hidden done column stays out, or the highlight would land on a ticket that is
not on the board. Id and title only, both lowercased.

The jump goes through select_at, extracted as the tail select_card already
used, so follow_selection scrolls the match's own column and refresh_detail
keeps an open overlay on it. Nothing calculates either a second way.

A hit closes the prompt; a miss keeps it open, marked in brightred beside the
query it is about, with the selection untouched, so the query can be
corrected in place rather than retyped from /. The mark clears on the next
edit. An empty query matches nothing rather than everything.

The prompt takes the whole footer row, since the key list it replaces
describes nothing that works while every key goes into the buffer. The real
terminal cursor sits after the query: ratatui shows it only for a frame that
asked, so it is also what says "you are typing" on an empty query. Both
closed footers now name / search.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-22 13:29:30 +02:00
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
6 changed files with 1097 additions and 37 deletions
+25 -2
View File
@@ -98,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
@@ -113,7 +113,7 @@ 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
@@ -135,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
@@ -146,6 +149,12 @@ and this file is for what someone changing worklane's own code needs.
- 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
@@ -154,6 +163,20 @@ and this file is for what someone changing worklane's own code needs.
- The choice is not remembered between runs. worklane has no config file and one flag is not a reason to start one; if it should persist, that is its own ticket
- **Assert a column heading against the top border row, not the whole screen.** The footer names done too, so `screen.contains("done (0)")` passes on the footer whether the column is drawn or not. Three tests went vacuous that way the moment done was hidden; `headings()` and `footer()` exist so the next one does not. `headings()` locates the row through `board_area()` rather than taking row zero, since the tab row sits above it when more than one board is monitored
### The Search Prompt
- **`search: Option<Search>` is the whole mode**, the shape `detail` uses: "the prompt is open" and "what is in it" cannot disagree, and closing it leaves nothing to reset. `Search` also carries `missed`, set when enter found nothing and cleared by the next edit, since the message is about the query that missed
- **The prompt swallows every key it is given.** `Board::search_key` runs ahead of the action arms in `main.rs` and reports what it took, rather than every arm below asking whether a search is open. Typing `d` into a query must not toggle done and `q` must not quit; with no prompt open it takes nothing, so the dispatch is unchanged for every other state. The rule is on `Board` for the reason `dismiss` is: the arm is not reachable from a test
- **`ctrl-c` is the one key it declines**, because a terminal application always honours it and a prompt that ate it would leave no way off the board. Every *other* control combination is swallowed and does nothing: it must not type its letter, and it must not fall through either, since the action arms match on the code alone and `ctrl-d` would reach the one bound to `d`
- **Esc is consumed by the search before it can mean anything else**, which is the collision e7612de left behind: `esc` and `q` close the overlay, and both have to lose to an open prompt. It falls out of the pre-branch rather than being ordered by hand
- **`first_match` searches the *visible columns*, every card in them, not the rows on screen.** A query that answered differently on a tall terminal and a short one is not a search, and the jump scrolls the match into view anyway. Hidden columns stay out: with done hidden, a match there would put the highlight on a ticket that is not on the board. Reading order is column by column, then top to bottom
- Id and title only, per 3b16540, both lowercased. The title has to be case insensitive to be worth typing, and giving the id the same treatment lets a pasted id match whatever case it was copied in. An empty or all-space query matches **nothing** rather than everything
- **The jump goes through `select_at`, the tail `select_card` already used.** `follow_selection` scrolls the column the card is in, and the offsets are per column and on the `Tab`, so a jump across columns moves the right one; `refresh_detail` keeps an open overlay on the ticket the selection names. A second version of either is how a jump comes to scroll differently from the arrow keys
- **A hit closes the prompt and a miss keeps it open**, marked, with the selection untouched. The query can then be corrected in place instead of retyped from `/`. Doing nothing visible is what makes a reader retype a query that was already right
- **The prompt takes the whole footer row**, because the key list it replaces describes nothing that currently works while every key is going into the buffer. The typed query is drawn in the default foreground and the keys in grey: one is content, the other is chrome. `no match` is brightred beside the query it is about, since grey chrome is what a reader skips
- **The real terminal cursor goes after the query**, not a glyph standing in for one. ratatui shows the cursor only for a frame that asked for it, so `set_cursor_position` is also what says "you are typing" while the query is still empty. Clamped to the row, so a query longer than the terminal leaves it on the last cell
- Both closed footers name `/`, since the jump works with a ticket open as well: it moves the selection and the overlay follows
- Out of scope on purpose, each its own ticket once the input mode exists: `n` and `N` for the next and previous match, searching the description, tags or owner, regex, and filtering the board down to matches rather than selecting one
### Monitoring Several Boards
- `worklane tui <path>...` takes any number of paths, each resolved through `find_worklane_dir` the way the working directory is: the first `.worklane` at or above it. No path is the working directory, so a bare `worklane` and `worklane tui` are unchanged
- The failure **names the path** that had no board, since with several arguments "No .worklane directory found" does not say which one was wrong. Only when a path was given: a bare `worklane` has no path to name and keeps the message every other command gives, which is what its integration test asserts
Generated
+1 -1
View File
@@ -1494,7 +1494,7 @@ dependencies = [
[[package]]
name = "worklane"
version = "0.13.3"
version = "0.13.6"
dependencies = [
"anyhow",
"assert_cmd",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "worklane"
version = "0.13.3"
version = "0.13.6"
edition = "2024"
[dependencies]
+22 -7
View File
@@ -163,17 +163,27 @@ fn run_tui(paths: &[std::path::PathBuf], start: &std::path::Path) -> Result<()>
continue;
}
// Ahead of the arms, because a prompt has to swallow every key it is
// given: typing `d` into a query must not toggle the done column and `q`
// must not quit. It reports what it took, so the arms below stay a plain
// match on the keys it did not, and it takes nothing when no prompt is open.
// The rule is `Board::search_key`, where a test can reach it.
if board.search_key(key, screen) {
continue;
}
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),
@@ -191,6 +201,11 @@ fn run_tui(paths: &[std::path::PathBuf], start: &std::path::Path) -> Result<()>
KeyCode::BackTab => board.select_tab(-1, screen),
// Free of the other bindings, and the footer names it in both states.
KeyCode::Char('d') => board.toggle_done(screen),
// An ordinary single-shot action like the rest: it opens the prompt, and
// from the next keypress on `search_key` above has the keyboard. A `/`
// typed into an open prompt is taken there as a character, so this arm
// is only ever the way in.
KeyCode::Char('/') => board.open_search(),
_ => {}
}
}
+979 -26
View File
File diff suppressed because it is too large Load Diff
+69
View File
@@ -1986,6 +1986,27 @@ pub struct TicketItem {
/// 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,
@@ -2121,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.
@@ -2143,6 +2171,8 @@ pub fn collect_ticket_items(status_path: impl AsRef<Path>) -> Result<Vec<TicketI
criteria: progress,
campaign: parse_campaign(&content),
tags: parse_tags(&content),
uuid: parse_ticket_field(&content, "ID"),
blockers,
path: e.path(),
})
})
@@ -2555,6 +2585,45 @@ 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() {