Compare commits

...
7 Commits
Author SHA1 Message Date
Ansho ReiandClaude Opus 5 6178d7bd3d (dd36e97) Add install-skill, shipping the agent skill in the binary, and bump to 0.8.0
worklane's agent instructions only existed for someone with the repo checked
out. Anyone who installed the binary with cargo install got no document at
all, because cargo install places binaries and nothing else.

The skill now lives at assets/SKILL.md and is embedded with include_str, so an
installed copy can never be a different version from the binary that describes
it. `worklane install-skill` writes it, `--print` sends it to stdout so a
modified copy can be diffed, and a copy that was edited is reported and left
alone unless --force: it may have been changed on purpose, and silently
discarding that is worse than stopping.

One path serves both agents, ~/.claude/skills/worklane/SKILL.md. That was
settled empirically rather than from documentation: opencode 1.15.10 loads
~/.claude/skills as an external skill source alongside its own
~/.config/opencode/skill, and with HOME pointed at a temp directory holding
only what install-skill wrote, `opencode debug skill` lists the document under
the name worklane. Writing opencode's own path as well would be two copies of
one document, free to drift, for no gain.

The document is new rather than the one under .opencode, which is the user's
and not this repo's to ship. The ticket-workflow prose moved out of AGENTS.md
into it, so how to use worklane has one writer, and AGENTS.md points there.

The mechanism is in install.rs rather than skill.rs, and install() takes its
root as an argument: install-tool is coming, it needs a different root and the
same compare-and-refuse logic, and passing the root is what lets the tests
install into a temp directory instead of the home of whoever runs the suite.

Three tests guard the document itself, which is the part that goes stale
quietly: the frontmatter has to parse, every `worklane <x>` it shows has to be
a real subcommand, and every subcommand outside NOT_FOR_AGENTS has to appear in
it, so a new command cannot ship invisible to an agent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 15:25:31 +02:00
Ansho Rei f740e42d1c Improvements to AGENTS.md file 2026-08-21 15:00:00 +02:00
Ansho Rei 220789efea (6b8f4d13) Scroll the tui board columns with the selection, and bump to 0.7.2 2026-08-21 14:24:19 +02:00
Ansho ReiandClaude Opus 5 c1137f29cf (1b78a24) Scroll the tui detail view on pgup and pgdn, and bump to 0.7.1
The detail view had no scrolling at all: no offset on Board, nothing passed
to Paragraph::scroll, so anything past the height of the overlay was
unreachable. Every ticket in this repo is longer than that. The footer read
"↑↓ scroll" while up and down moved the selection, so it named a key that did
nothing and sent the reader looking for their own mistake.

The scroll goes on pgup and pgdn rather than taking up and down. Up and down
stay on the selection with the modal open, so a whole column can be read
without closing it and the modal follows the selection. That is worth more
than the two keys.

The offset is clamped against the wrapped line count from
Paragraph::line_count, which is why ratatui now carries the
unstable-rendered-line-info feature. The paragraph wraps on words, so a clamp
on the raw lines would stop short of the end or run past it into blank space,
and counting the wrapping by hand would only agree with the widget until one
of the two changed. The clamp runs on the keypress and again in the draw,
since the terminal can be resized between them and a tick can shorten the
ticket under a reader who is already at the end.

The offset resets when the selection moves and when the modal is closed, so a
ticket opens at its top. It deliberately does not reset on a tick: an edit
elsewhere in the tree must not throw the reader back to the top of what they
are reading.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 12:38:54 +02:00
Ansho ReiandClaude Opus 5 77bf2d9e2a Say when to move a ticket, not just how
Both AGENTS.md and the kanban skill listed the statuses and the mv command
without ever saying at what point to run it, so a ticket could sit in backlog
until the work was finished and the board said nothing while it was in progress.
That is what happened to f6af387.

The rule is now in both places, and in both for a reason: the skill is what an
agent loads to work tickets in any repo, and AGENTS.md is what an agent working
on worklane itself reads, possibly without ever loading the skill. The skill's
Workflow section also becomes a sequence for working one ticket rather than an
unordered list of commands, with the command list kept separately.

Worth stating because it is self-enforcing: only one stage forward is allowed at
a time, so a ticket left in backlog cannot go straight to reviewing and has to
be walked through committed regardless. Moving it up front is the same two
commands in a more useful order.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 11:54:23 +02:00
Ansho ReiandClaude Opus 5 78831f1a39 (f6af387) Add the board view, and bump to 0.7.0
worklane was one-shot commands only, so reading the board meant running ls again
and again and nothing ever showed the four statuses side by side, which is the
one view a kanban flow is for.

Four columns, a card per ticket carrying the priority mark, short id, title,
owner and due. Arrows or hjkl to move, enter for the detail view, q to quit.
Read only: moving a card by keypress is a follow-up, kept out until the watch
and render loop were solid.

Modelled on frig throughout, same crates and same shape: event poll on a 250ms
timeout so the tick runs when nobody is typing, a panic hook that leaves the
alternate screen before the backtrace, and the terminal restored on the error
path as well as on quit. A bare worklane opens it, as a bare frig does, so
Cli::command is now an Option.

The watch looks at files, not directories. A directory's mtime only moves on
create and rename, so a ticket edited in place would be missed; the digest
hashes every ticket and comment file's path, length and mtime. Comment files
are in it because a comment added elsewhere has to reach the detail view. It
guards the rescan rather than the draw, since ratatui diffs its buffer but
reading the tree every frame would not be free. notify is deliberately not a
dependency, and the reason is on the ticket.

Two orderings are deliberate. The worklane directory is looked for before the
terminal, so running outside one gives the usual message rather than a complaint
about the tty, and both errors stay testable without a pty. And a missing tty is
refused by name, since raw mode on a pipe fails with a bare "No such device or
address" that explains nothing.

The palette is now a Color enum rather than a string, so the escape the CLI
writes and the ratatui colour the board draws come from one definition and a
colour missing from either is a compile error. That retires the test which
existed only to catch a name with no entry, the failure that once left magenta
undefined.

Cards come from collect_ticket_items, so there is no second parser;
TicketItem gained the path the detail view opens. content_trim and
format_comments_with take the colour decision, because ratatui draws spans and
would print an escape as literal bytes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 11:44:37 +02:00
Ansho ReiandClaude Opus 5 bbb1568a0f (eadaca9) Add check and uncheck for one acceptance criterion, and bump to 0.6.0
Criteria are stored as - [ ] lines and nothing could tick one, so marking
progress meant replacing the whole list through set, losing the state of every
other item.

check and uncheck are separate commands rather than one verb with a flag,
sharing CheckArgs and cmd_check. The criterion is an index first and a substring
second, so a criterion whose text is literally "2" is reachable only by
substring. A number out of range is reported as a bad index rather than as a
substring that missed.

Only the character between the brackets is spliced, so the text keeps whatever
indentation and spacing it had. Criteria are counted inside the Acceptance
Criteria section only, so a checkbox written into a description is not a
criterion and a handwritten line in the section takes no number.

With the criterion omitted, the criteria are listed and the number asked for
when stdin is a terminal. Where it is not, the same list comes back as an error
instead. Prompting regardless would leave the opencode wrapper blocked on a
stdin that never closes, and that is the choice resolve_ticket already makes for
an ambiguous match, for the same reason: the wrapper keeps stderr and throws on
the code, so a list printed to stdout would be discarded.

Any listing of a subset keeps the real numbers. Renumbering the matches from one
would contradict the advice to use the number and point at the wrong criterion.

show now numbers the criteria as "1. [x] text", so the index is visible where
the ticket is read. That also drops a manual prefix strip, so clippy is one
warning below where it started.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-21 10:46:07 +02:00
16 changed files with 3399 additions and 108 deletions
+45 -7
View File
@@ -138,6 +138,26 @@ worklane append a1b2c3d4 -a "One more criterium"
worklane append a1b2c3d4 -p "A later step"
```
### `worklane check` and `worklane uncheck`
Tick or untick a single acceptance criterion. Every other criterion keeps its state,
and handwritten lines in the section are left alone.
**Positional arguments:**
- `<ticket>`: Ticket UUID prefix (4+ characters) or title
- `[criterion]`: The number as shown by `worklane show`, or a substring of its text
Omit the criterion and the numbered criteria are listed and the number asked for. With
no terminal, as when driving the CLI from a tool, the same list comes back as an error
instead, so re-run with the number. A substring matching more than one criterion is an
error listing the matches with their real numbers.
```bash
worklane check a1b2c3d4 2
worklane check a1b2c3d4 "renames the file"
worklane uncheck a1b2c3d4 2
```
### `worklane comment`
Add a comment to a ticket.
@@ -156,11 +176,29 @@ worklane comment "My Ticket" "Needs changes to the UI"
worklane comment a1b2c3d4 "LGTM, approved"
```
## Workflow
## Working a ticket
1. Use `worklane add` to create tickets with all relevant details
2. Use `worklane ls [status]` to view tickets by status
3. Use `worklane show <id>` to view full ticket details
4. Use `worklane mv <id> --status <target>` to move tickets through the workflow
5. Use `worklane set <ticket>` to correct a field, or `worklane append <ticket>` to add to a section
6. Use `worklane comment <ticket> <body>` to add notes to tickets
Move the ticket as you work it, not afterwards. The board should say what is happening
now, not only what already landed.
1. `worklane show <id>` to read it
2. **`worklane mv <id> --status committed` before writing any code.** This is what marks
the ticket as being worked on, so it belongs at the start
3. Do the work. `worklane check <id> <n>` as each criterion is met
4. `worklane comment <id> <body>` with anything worth recording: a decision, a rejected
acceptance criterion, something the ticket got wrong
5. **`worklane mv <id> --status reviewing` once it is done and the tests pass**
Only one stage forward is allowed at a time, so a ticket left in `backlog` until the end
cannot go straight to `reviewing`. It has to be walked through `committed` anyway, which
makes moving it up front the same two commands in a more useful order.
## Commands
- `worklane add` creates tickets with all relevant details
- `worklane ls [status]` views tickets by status
- `worklane show <id>` views full ticket details
- `worklane mv <id> --status <target>` moves tickets through the workflow
- `worklane set <ticket>` corrects a field, `worklane append <ticket>` adds to a section
- `worklane check <ticket> <n>` ticks a criterion as it is met
- `worklane comment <ticket> <body>` adds notes to tickets
+46
View File
@@ -394,3 +394,49 @@ export const append = tool({
}
},
});
/**
* check and uncheck differ only in the verb, so the tool is built once.
*
* The criterion is required here even though the CLI makes it optional: without it the
* CLI prompts, and there is no terminal on this side of the pipe. The CLI answers a
* missing criterion with the numbered list on stderr, which run() relays, so the model
* sees the options and can retry with a number.
*/
function checkboxTool(verb: "check" | "uncheck") {
const past = verb === "check" ? "Checked" : "Unchecked";
return tool({
description:
`${past === "Checked" ? "Tick" : "Untick"} one acceptance criterion on a worklane ticket. ` +
"Every other criterion keeps its state. Identify the criterion by its number as shown by show, " +
"or by a substring of its text; a substring matching more than one is an error listing them.",
args: {
ticket: tool.schema
.string()
.describe("Ticket UUID prefix (4+ chars) or title substring (required)"),
criterion: tool.schema
.string()
.describe(
"Criterion number as shown by show, or a substring of its text (required)",
),
},
async execute(args: Record<string, any>, context: ToolContext) {
if (!args.ticket) {
return `Error running ${verb}: ticket is required`;
}
if (!args.criterion) {
return `Error running ${verb}: criterion is required, give the number or a substring`;
}
try {
return await run([verb, args.ticket, String(args.criterion)], context);
} catch (err: any) {
return `Error running ${verb}: ${err.message}`;
}
},
});
}
export const check = checkboxTool("check");
export const uncheck = checkboxTool("uncheck");
+57 -4
View File
@@ -1,13 +1,20 @@
# AGENTS.md
## Project Structure
- `src/main.rs` - All application logic
- `src/main.rs` - dispatch, the SIGPIPE reset, and the TUI event loop
- `src/command.rs` - CLI argument definitions using clap derive
- `tests/` - Integration tests using `assert_cmd` and `assert_fs`
- `src/handlers.rs` - one `cmd_*` per subcommand
- `src/util.rs` - the ticket format, resolution, rendering and the palette
- `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!`
- `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
## Ticket File Format
- Filenames: `<uuid_v4>_<slug>.md`
- The slug is the title through `slug()`: lowercased, alphanumerics plus `-` and `_` kept, spaces turned into dashes. `Ticket 06` lands as `<uuid>_ticket-06.md`. Derive fixture filenames through `slug()`, never by hand
- Metadata fields parsed by `parse_ticket_field()`: `ID`, `Priority`, `Tags`, `Due`, `Owner`, `Created At`, `Status`
- Format: `**Field Name**: value`
- Ticket structure: `# Title` → `## Description` → `## Acceptance Criteria` → `## Implementation Plan` → `## Metadata`
@@ -16,6 +23,12 @@
## Status Workflow
`backlog` → `committed` → `reviewing` → `done`
**How to use worklane is in `assets/SKILL.md`, not here.** That document is what
`worklane install-skill` ships, so it is the one place the flow, the move-as-you-work
rule and the argument traps are written down. Read it before working a ticket in this
repo. Do not restate any of it in this file: a second copy is a copy that goes stale,
and this file is for what someone changing worklane's own code needs.
## Testing
- Run: `cargo test`
- Tests use `assert_cmd` and `assert_fs` for CLI testing
@@ -52,9 +65,49 @@
- `find_ticket_file()` matches on the uuid, never the title. Duplicate titles are allowed, so a title scan can land on a different ticket than the one resolved: `mv <uuid-of-second>` used to move the first ticket sharing its title
- `write_then_replace()` is the only way a ticket file is written. Content first, rename second, so a failure leaves a correct ticket under a stale name rather than a half-written one
### Checking Off a Criterion
- `check` and `uncheck` are separate commands, not one verb with a flag. They share `CheckArgs` and `cmd_check(args, checked)`
- `criteria()` is scoped to the Acceptance Criteria section and counts only checkbox lines, so a checkbox written into a description is not a criterion and a handwritten line inside the section takes no number
- `set_criterion()` splices only the character between the brackets. Rebuilding the line would normalise its indentation and whatever spacing followed the checkbox
- The criterion argument is an index first, a substring second, so a criterion whose text is literally `2` is reachable only by substring
- **A number out of range is a bad index, not a failed substring search**, and says so. `is_index()` makes that distinction
- Any listing of a subset must keep the real numbers, via `numbered_criteria()`. Renumbering the matches from one contradicts the advice to use the number and points at the wrong criterion
- With the criterion omitted: prompt when stdin is a terminal, otherwise return the numbered list as an error. Never prompt unconditionally, the opencode wrapper has no tty and would block on a stdin that never closes. This is the same choice `resolve_ticket` makes for an ambiguous match, and for the same reason
- `show` numbers the criteria as `1. [x] text`, so the index is visible where the ticket is read. The number replaces the list marker rather than joining it
### The Board View
- `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
- **The watch looks at files, not directories.** A directory's mtime only moves on create and rename, so a ticket edited in place would be missed. `digest()` hashes every ticket and comment file's path, length and mtime. Comment files are in it because a comment added elsewhere has to reach the detail view
- The digest guards the *rescan*, not the draw. ratatui diffs its buffer, so drawing every iteration is free; reading the tree every iteration is not
- `notify` is deliberately not a dependency. Polling a tree of tens of small files on the 250ms tick is enough, and the reason is recorded on f6af387
- Cards come from `collect_ticket_items`, the same source `ls` uses, so there is no second parser. `TicketItem::path` exists for the detail view
- **The detail view scrolls on `pgup` and `pgdn`, not on up and down.** Up and down stay on the selection with the modal open, so a whole column can be read without closing it, and the modal follows. That is worth more than the two keys, which is why the scroll went elsewhere rather than taking them
- The scroll offset is clamped against the *wrapped* line count, from `Paragraph::line_count`, which is why `ratatui` carries the `unstable-rendered-line-info` feature. The paragraph wraps on words, so a clamp on the raw lines would stop short of the end or scroll past it into blank space. Counting the wrapping by hand would only agree with the widget until one of the two changed
- The clamp runs on the keypress and again in the draw. The terminal can be resized between the two, and a tick can shorten the ticket under a reader who is already at the end
- The offset resets when the selection moves and when the modal is closed, so a ticket opens at its top. It deliberately does *not* reset on a tick: an edit elsewhere in the tree must not throw the reader back to the top of what they are reading
- **Columns scroll to keep the selected card in view.** `Board::offsets` holds one offset per column, parallel to `columns` and resized in step by `reload`, so a column you leave stays where it was. The keypress aligns the focused column via `follow_selection(screen)`, taking the screen size for the same reason `scroll_detail` does: the visible height belongs to the terminal, which only the caller measures between draws
- Card heights are measured on `card_lines`, never assumed, on both the keypress and the draw side (`card_height`, and the `starts` vec as the cards are built). An alignment that trusted a fixed card height would drift from the renderer the first time the card changed shape
- 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
- 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
- Read only. Moving a card by keypress is a follow-up, deliberately kept out until the watch and render loop were solid
### Shipping the Agent Assets
- The skill is embedded with `include_str!` from `assets/SKILL.md`, not copied by an install script. `cargo install` places binaries and nothing else, so an installed document that is not in the binary is a document that drifts from it
- **One install path serves both agents:** `~/.claude/skills/worklane/SKILL.md`. Claude Code reads it, and opencode loads that directory as an external skill source alongside its own `~/.config/opencode/skill/`. Verified against opencode 1.15.10, whose built-in `customize-opencode` skill documents the table and whose `opencode debug skill` lists what it found there. Do not add the second path: it is two copies of one document, free to drift, for no gain
- `Asset` carries the content, the path under its root and the word used in messages, so `install-tool` adds an entry and its own root rather than a second copy of the compare-and-refuse logic. That is why the module is `install.rs` and not `skill.rs`
- `install()` takes the root as an argument. That is what lets the tests install into a temp directory instead of the home of whoever runs the suite, and the integration test redirects `HOME` for the same reason
- **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
### Color and Output
- Use `color_text()` helper for colored output — it respects `should_use_colors()` (terminal detection)
- Color codes are defined in `get_color()`: red (31), cyan (36), orange (33), green (32), grey (38;5;8), magenta (1;35), brightred (38;5;9)
- Use `color_text()` for coloured output — it respects `should_use_colors()` (terminal detection), and `paint()` is the same with the decision passed in
- **The palette is the `Color` enum, not a string.** `Color::ansi()` gives the CLI its SGR sequence and `From<Color> for ratatui::style::Color` gives the TUI its equivalent, so a colour that exists for one renderer and not the other is a compile error. The stringly-typed version needed a test for exactly that, and a missing entry silently produced an empty prefix, which is how `magenta` came to be undefined
- Reset color with `\x1b[0m` after colored text
- Bold uses `\x1b[1;35m` (magenta bold)
- Always test color output works correctly in both terminal and pipe modes
Generated
+484 -17
View File
@@ -11,6 +11,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "allocator-api2"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
[[package]]
name = "android_system_properties"
version = "0.1.5"
@@ -56,7 +62,7 @@ version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
dependencies = [
"windows-sys",
"windows-sys 0.61.2",
]
[[package]]
@@ -67,7 +73,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
dependencies = [
"anstyle",
"once_cell_polyfill",
"windows-sys",
"windows-sys 0.61.2",
]
[[package]]
@@ -135,6 +141,21 @@ version = "3.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
[[package]]
name = "cassowary"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
name = "castaway"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"
dependencies = [
"rustversion",
]
[[package]]
name = "cc"
version = "1.2.62"
@@ -196,7 +217,7 @@ dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
"syn 2.0.117",
]
[[package]]
@@ -211,6 +232,20 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
[[package]]
name = "compact_str"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fd622ebbb56a5b2ccb651b32b911cdeb2a9b4b11776b2473bf26a26a286244e"
dependencies = [
"castaway",
"cfg-if",
"itoa",
"rustversion",
"ryu",
"static_assertions",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
@@ -242,6 +277,65 @@ version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "crossterm"
version = "0.28.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6"
dependencies = [
"bitflags",
"crossterm_winapi",
"mio",
"parking_lot",
"rustix 0.38.44",
"signal-hook",
"signal-hook-mio",
"winapi",
]
[[package]]
name = "crossterm_winapi"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
dependencies = [
"winapi",
]
[[package]]
name = "darling"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff"
dependencies = [
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 3.0.3",
]
[[package]]
name = "darling_macro"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785"
dependencies = [
"darling_core",
"quote",
"syn 3.0.3",
]
[[package]]
name = "difflib"
version = "0.4.0"
@@ -254,6 +348,12 @@ version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9"
[[package]]
name = "either"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
[[package]]
name = "equivalent"
version = "1.0.2"
@@ -267,7 +367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys",
"windows-sys 0.61.2",
]
[[package]]
@@ -355,6 +455,8 @@ version = "0.15.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
dependencies = [
"allocator-api2",
"equivalent",
"foldhash",
]
@@ -400,6 +502,12 @@ version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "ignore"
version = "0.4.25"
@@ -428,12 +536,43 @@ dependencies = [
"serde_core",
]
[[package]]
name = "indoc"
version = "2.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
dependencies = [
"rustversion",
]
[[package]]
name = "instability"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf84e73fa6f27f299dec58e13223cf70db80da872eb921d4f6138342a0eabc8"
dependencies = [
"darling",
"indoc",
"proc-macro2",
"quote",
"syn 3.0.3",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "1.0.18"
@@ -464,24 +603,60 @@ version = "0.2.186"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
[[package]]
name = "linux-raw-sys"
version = "0.4.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]]
name = "linux-raw-sys"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
[[package]]
name = "lock_api"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"
dependencies = [
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
[[package]]
name = "lru"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
dependencies = [
"hashbrown 0.15.5",
]
[[package]]
name = "memchr"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
[[package]]
name = "mio"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427"
dependencies = [
"libc",
"log",
"wasi",
"windows-sys 0.61.2",
]
[[package]]
name = "num-traits"
version = "0.2.19"
@@ -503,6 +678,35 @@ version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "parking_lot"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-link",
]
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pin-project-lite"
version = "0.2.17"
@@ -543,7 +747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
dependencies = [
"proc-macro2",
"syn",
"syn 2.0.117",
]
[[package]]
@@ -570,6 +774,36 @@ version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]]
name = "ratatui"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eabd94c2f37801c20583fc49dd5cd6b0ba68c716787c2dd6ed18571e1e63117b"
dependencies = [
"bitflags",
"cassowary",
"compact_str",
"crossterm",
"indoc",
"instability",
"itertools",
"lru",
"paste",
"strum",
"unicode-segmentation",
"unicode-truncate",
"unicode-width 0.2.0",
]
[[package]]
name = "redox_syscall"
version = "0.5.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
dependencies = [
"bitflags",
]
[[package]]
name = "regex-automata"
version = "0.4.14"
@@ -587,6 +821,19 @@ version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
[[package]]
name = "rustix"
version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys 0.4.15",
"windows-sys 0.59.0",
]
[[package]]
name = "rustix"
version = "1.1.4"
@@ -596,8 +843,8 @@ dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys",
"linux-raw-sys 0.12.1",
"windows-sys 0.61.2",
]
[[package]]
@@ -606,6 +853,12 @@ version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "ryu"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
[[package]]
name = "same-file"
version = "1.0.6"
@@ -615,6 +868,12 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "1.0.28"
@@ -647,7 +906,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.117",
]
[[package]]
@@ -669,18 +928,83 @@ version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "signal-hook"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-mio"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc"
dependencies = [
"libc",
"mio",
"signal-hook",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"
dependencies = [
"errno",
"libc",
]
[[package]]
name = "slab"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "smallvec"
version = "1.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
dependencies = [
"heck",
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.117",
]
[[package]]
name = "syn"
version = "2.0.117"
@@ -692,6 +1016,17 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "syn"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tempfile"
version = "3.27.0"
@@ -701,8 +1036,8 @@ dependencies = [
"fastrand",
"getrandom",
"once_cell",
"rustix",
"windows-sys",
"rustix 1.1.4",
"windows-sys 0.61.2",
]
[[package]]
@@ -717,6 +1052,35 @@ version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]]
name = "unicode-segmentation"
version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8"
[[package]]
name = "unicode-truncate"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf"
dependencies = [
"itertools",
"unicode-segmentation",
"unicode-width 0.1.14",
]
[[package]]
name = "unicode-width"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
[[package]]
name = "unicode-width"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
[[package]]
name = "unicode-xid"
version = "0.2.6"
@@ -759,6 +1123,12 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
[[package]]
name = "wasip2"
version = "1.0.3+wasi-0.2.9"
@@ -809,7 +1179,7 @@ dependencies = [
"bumpalo",
"proc-macro2",
"quote",
"syn",
"syn 2.0.117",
"wasm-bindgen-shared",
]
@@ -856,15 +1226,37 @@ dependencies = [
"semver",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys",
"windows-sys 0.61.2",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
version = "0.62.2"
@@ -886,7 +1278,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.117",
]
[[package]]
@@ -897,7 +1289,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.117",
]
[[package]]
@@ -924,6 +1316,15 @@ dependencies = [
"windows-link",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-sys"
version = "0.61.2"
@@ -933,6 +1334,70 @@ dependencies = [
"windows-link",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "wit-bindgen"
version = "0.51.0"
@@ -969,7 +1434,7 @@ dependencies = [
"heck",
"indexmap",
"prettyplease",
"syn",
"syn 2.0.117",
"wasm-metadata",
"wit-bindgen-core",
"wit-component",
@@ -985,7 +1450,7 @@ dependencies = [
"prettyplease",
"proc-macro2",
"quote",
"syn",
"syn 2.0.117",
"wit-bindgen-core",
"wit-bindgen-rust",
]
@@ -1029,14 +1494,16 @@ dependencies = [
[[package]]
name = "worklane"
version = "0.5.0"
version = "0.8.0"
dependencies = [
"anyhow",
"assert_cmd",
"assert_fs",
"chrono",
"clap",
"crossterm",
"libc",
"ratatui",
"tempfile",
"uuid",
]
+6 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "worklane"
version = "0.5.0"
version = "0.8.0"
edition = "2024"
[dependencies]
@@ -9,6 +9,11 @@ anyhow = "1"
uuid = { version = "1", features = ["v4"] }
chrono = { version = "0.4", features = ["serde"] }
libc = "0.2"
# unstable-rendered-line-info for Paragraph::line_count, which is how the detail view
# knows where its text ends. Counting the wrapping by hand would only agree with the
# widget until one of us changed.
ratatui = { version = "0.29", features = ["unstable-rendered-line-info"] }
crossterm = "0.28"
[dev-dependencies]
assert_cmd = "2"
+4
View File
@@ -5,6 +5,7 @@ Worklane is a local Kanban flow for agentic software development.
## Commands
| Command | Description |
|---------|-------------|
| `worklane` or `worklane tui` | Opens the board: four status columns, redrawn when the tree changes. Read only. Arrows or `hjkl` to move, `enter` for detail, `pgup`/`pgdn` to scroll an open ticket, `q` to quit |
| `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 ls [status]` | Lists tickets, sorted by priority then title. Optional positional status, and `--priority <1-5>` |
@@ -12,7 +13,10 @@ Worklane is a local Kanban flow for agentic software development.
| `worklane mv <id> --status <target> [-f]` | Moves ticket between statuses. Default: forward only, one stage at a time. `-f` bypasses both restrictions |
| `worklane set <ticket>` | Replaces fields with `--title`, `--description`, `--acceptance`, `--plan`, `--tags`, `--due`, `--priority`. At least one required. Changing the title renames the file, keeping the UUID |
| `worklane append <ticket>` | Adds to a section with `--description`, `--acceptance`, `--plan`. At least one required. The description gains a paragraph; list items go on the end, steps numbered on from the last |
| `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 |
## Exit codes
| Code | Meaning |
+143
View File
@@ -0,0 +1,143 @@
---
name: worklane
description: Manage tickets on a local worklane kanban board with the `worklane` CLI, backed by markdown files in a `.worklane/` directory. Use whenever you need to file, find, read, update, comment on or move a ticket, when asked what is on the board or what to pick up next, and when reporting work you are not going to do in the change at hand. Covers the four statuses, how a ticket is addressed, what belongs in each section, and the argument traps that silently swallow a flag.
---
# worklane
A kanban board as files. Every ticket is one markdown file in `.worklane/<status>/`,
named `<uuid>_<slug>.md`, and comments live in `.worklane/comments/<uuid>/`. The CLI is
the only thing that writes there: do not hand-edit or hand-place a file, because the
filename, the `Status` field and the directory have to agree and the commands are what
keep them agreeing.
Commands walk up from the working directory to find the nearest `.worklane`, so **run
`worklane` inside the repo the ticket belongs to**. Which directory you run it in is
what decides which board the ticket lands on.
`worklane` with no subcommand opens an interactive board and needs a terminal. It is for
a person, not for you: it takes over the screen and does not return until quit.
## The flow
`backlog` → `committed` → `reviewing` → `done`
**Move the ticket as you work it, not afterwards.** `worklane mv <id> --status committed`
before writing any code, and `--status reviewing` once it is done and the tests pass. The
board is then true while the work is in progress, not only after it lands, which is the
whole point of having a `committed` column.
Only one stage at a time is allowed, so a ticket left in `backlog` until the end cannot
go straight to `reviewing` and has to be walked through `committed` anyway. Doing it up
front is the same two commands in a more useful order. `-f` allows a backward or
skipping move, for correcting a mistake.
## Reading the board
```
worklane ls # every status, counts then tickets
worklane ls backlog # one status
worklane ls --priority 1 # only the most urgent
worklane show 1b78a24 # one ticket, body and comments
```
`ls` prints a seven-character id per ticket. That is what you address it by.
## Working a ticket
```
worklane mv 1b78a24 --status committed
worklane check 1b78a24 3 # tick acceptance criterion 3
worklane check 1b78a24 "the footer describes" # or a substring of it
worklane uncheck 1b78a24 3
worklane comment 1b78a24 "Found the cause: the offset was never passed to the widget."
worklane mv 1b78a24 --status reviewing
```
Criteria are numbered by `show`. With the criterion omitted, `check` prompts when there
is a terminal and otherwise fails with the numbered list, so **always pass the criterion
when you are not sitting at a prompt**.
## Filing a ticket
```
worklane add \
--title "The tui detail view cannot scroll" \
--description "Opening a ticket and pressing down moves to the next one instead." \
--description "" \
--description "Up and down are bound to select_card unconditionally, src/main.rs." \
--acceptance "PageUp and PageDown scroll the detail view" \
--acceptance "The footer describes the keys that exist" \
--plan "Add a scroll offset to Board and pass it to Paragraph::scroll" \
--plan "Clamp against the wrapped line count, not the raw line count" \
--priority 2 --tags bug,tui
```
`add` always lands in `backlog`. Nothing is created without `--title`.
- **`--description`** is the case for the ticket: the symptom, then what is actually
wrong, naming the files, functions and settings involved. Repeat the flag for more
lines; an empty `--description ""` between two values is a paragraph break.
- **`--acceptance`** takes one criterion per flag, each a statement that can be
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.
Editing afterwards, on a ticket in any status:
```
worklane set 1b78a24 --priority 1 # replace a field
worklane set 1b78a24 --title "A better title" # renames the file, keeps the uuid
worklane append 1b78a24 --acceptance "One more criterion"
worklane append 1b78a24 --description "What was learned since."
```
`set` replaces, `append` adds. Neither has `--owner` or `--status`: owner is its own
command's, and status is `mv`'s. A field set to the value it already holds is reported
unchanged and nothing is written.
`worklane init` creates `.worklane/` with the four status directories, for a repo that
has no board yet.
## Search the backlog before filing
Run `worklane ls` in the directory the ticket would land in and look for the same issue,
including tickets already committed, in review or done. Search by the symptom and by the
name of the function or setting involved, not only by your own phrasing of the title: an
existing ticket will have been written from a different angle.
- Already there and still open: add what you learned as a comment, not a second ticket.
- Already there and closed, but the issue is back: file a **new** ticket naming the old
id, and say it is a regression. There is no way to reopen one, and moving a done
ticket back would destroy the record of the original fix.
- Related but not the same: file it and reference the neighbour by id.
## Addressing a ticket
Every command that takes a ticket accepts, in this order of precedence:
1. a UUID prefix, from four characters up
2. a substring of the title
3. a substring of the filename
The first tier that matches anything wins outright; the later tiers are not consulted.
This matters because ticket titles quote other tickets' ids, and a flat search reported
an exact id as ambiguous against whichever title mentioned it. An ambiguous match prints
the candidates and exits 1 rather than guessing.
## Traps
- **Prose arguments accept a leading hyphen**: `--title`, `--description`,
`--acceptance`, `--plan` and the `comment` body. A criterion reading
`--print is supported` is stored, not parsed as a flag. The cost is that a genuinely
mistyped flag there lands as content instead of failing, so read back what you wrote
with `worklane show`.
- `--due`, `--priority`, `--tags`, `--owner` and `--status` do *not* accept one, so a
mistyped flag on those is a usage error and nothing is written.
- A ticket argument that starts with a hyphen needs the flags first and a separator:
`worklane mv --status committed -- -leading-title`.
- A comment body of exactly `--` needs its own separator:
`worklane comment 1b78a24 -- --`.
- An empty value for a scalar is a usage error. Clearing a field back to unset is not
supported yet.
- Piping is safe: `worklane ls | head -3` exits on the closed pipe instead of panicking.
+38 -1
View File
@@ -33,8 +33,9 @@ const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " (", env!("WORKLANE_GI
#[command(version = VERSION)]
#[command(propagate_version = true)]
pub struct Cli {
/// Absent opens the board view, the way a bare `frig` does.
#[command(subcommand)]
pub command: Command,
pub command: Option<Command>,
}
/// Reject an empty value at parse time, so it lands as a usage error rather than a
@@ -140,6 +141,15 @@ pub enum Command {
/// Add to a section of an existing ticket
Append(AppendArgs),
/// Open the board view
Tui,
/// Tick an acceptance criterion
Check(CheckArgs),
/// Untick an acceptance criterion
Uncheck(CheckArgs),
/// Add a comment to a ticket
Comment {
/// Ticket UUID or title
@@ -153,6 +163,17 @@ pub enum Command {
#[arg(short, long)]
owner: Option<String>,
},
/// Install the agent skill that teaches an agent to use worklane
InstallSkill {
/// Overwrite an existing copy that has been modified
#[arg(long)]
force: bool,
/// Write it to stdout instead of installing it
#[arg(long)]
print: bool,
},
}
/// `set` replaces a field outright. Owner is deliberately absent: `chown` owns that
@@ -225,3 +246,19 @@ pub struct AppendArgs {
#[arg(short, long, allow_hyphen_values = PROSE)]
pub plan: Vec<String>,
}
/// `check` and `uncheck` are separate commands rather than one verb with a flag,
/// because the two read as opposites at the call site and neither needs the other's
/// name to make sense.
///
/// The criterion is optional: without it the criteria are listed and the index asked
/// for, or, where there is no terminal to ask at, returned as an error carrying the
/// same list.
#[derive(clap::Args)]
pub struct CheckArgs {
/// Ticket UUID or title
pub ticket: String,
/// Criterion index as shown by `show`, or a substring of its text. Prompts if omitted
pub criterion: Option<String>,
}
+163 -13
View File
@@ -1,10 +1,11 @@
use anyhow::{Result, anyhow};
use chrono::Local;
use std::fs;
use std::io::Write;
use std::io::{BufRead, IsTerminal, Write};
use std::path::Path;
use crate::command::{AppendArgs, SetArgs};
use crate::command::{AppendArgs, CheckArgs, SetArgs};
use crate::install;
use crate::util::*;
pub fn cmd_init(start: &Path) -> Result<()> {
@@ -84,7 +85,7 @@ pub fn cmd_ls(
if items.is_empty() {
continue;
}
let status_header = color_text(&format!("[{}]", status.to_uppercase()), "orange");
let status_header = color_text(&format!("[{}]", status.to_uppercase()), Color::Orange);
println!("\n{}", status_header);
display_ticket_items(&items);
}
@@ -210,7 +211,8 @@ pub fn cmd_add(
Ok(())
}
fn read_comments(comments_dir: &Path) -> Result<Vec<(String, String, String, String)>> {
/// Public for the TUI's detail view, which shows the same comments `show` does.
pub fn read_comments(comments_dir: &Path) -> Result<Vec<(String, String, String, String)>> {
if !comments_dir.exists() {
return Ok(vec![]);
}
@@ -301,7 +303,7 @@ pub fn cmd_show(search: &str, worklane_dir: &Path) -> Result<()> {
// The only title in the output: content_trim_colored used to print it a second
// time from the file content. Green per the colour guideline, and the rule is
// measured in characters so a non-ASCII title is not over-drawn.
println!("{}", color_text(&title, "green"));
println!("{}", color_text(&title, Color::Green));
println!("{}", "─".repeat(title.chars().count()));
println!("\n{}", content_trim_colored(&content));
@@ -456,8 +458,8 @@ pub fn cmd_mv(ticket_id: &str, target_status: &str, force: bool, start: &Path) -
if !force && target_idx < current_idx {
return Err(anyhow!(
"Cannot move backward from {} to {}. Use --force (-f) to allow.",
color_text(&current_status, "orange"),
color_text(target_status, "orange"),
color_text(&current_status, Color::Orange),
color_text(target_status, Color::Orange),
));
}
@@ -470,7 +472,7 @@ pub fn cmd_mv(ticket_id: &str, target_status: &str, force: bool, start: &Path) -
if current_status == target_status {
println!(
"Ticket is already in '{}' status.",
color_text(&target_status, "orange")
color_text(&target_status, Color::Orange)
);
return Ok(());
}
@@ -496,9 +498,9 @@ pub fn cmd_mv(ticket_id: &str, target_status: &str, force: bool, start: &Path) -
println!(
"Moved ticket '{}' from {} to {}",
color_text(&title, "green"),
color_text(&current_status, "orange"),
color_text(target_status, "orange"),
color_text(&title, Color::Green),
color_text(&current_status, Color::Orange),
color_text(target_status, Color::Orange),
);
Ok(())
@@ -640,7 +642,7 @@ fn save_ticket(
fn report(fields: &[&str], title: &str, verb: &str) {
if fields.is_empty() {
println!("No changes to '{}'", color_text(title, "green"));
println!("No changes to '{}'", color_text(title, Color::Green));
return;
}
@@ -648,7 +650,7 @@ fn report(fields: &[&str], title: &str, verb: &str) {
"{} {} on '{}'",
verb,
fields.join(", "),
color_text(title, "green")
color_text(title, Color::Green)
);
}
@@ -749,3 +751,151 @@ pub fn cmd_append(args: &AppendArgs, start: &Path) -> Result<()> {
report(&changed, &title, "Appended to");
Ok(())
}
/// Which criterion to act on, asked for when the caller did not say.
///
/// A terminal gets the list and a prompt. Anything else gets the same list as an
/// error, which is what `resolve_ticket` does for an ambiguous match and for the same
/// reason: the opencode wrapper throws on the exit code and keeps stderr, so a list
/// printed to stdout would be discarded and an agent would learn nothing. Prompting
/// regardless would leave it blocked on a stdin that never closes.
fn ask_which_criterion(criteria: &[Criterion], title: &str) -> Result<usize> {
let listing = criteria_list(criteria);
if !std::io::stdin().is_terminal() {
return Err(anyhow!(
"Which criterion of '{}'?\n{}\n\nRe-run with the number, or a substring of the text.",
title,
listing
));
}
println!("Acceptance criteria of '{}':", color_text(title, Color::Green));
println!("{}", listing);
// Either form, since find_criteria takes both.
print!("Number or text: ");
std::io::stdout().flush()?;
let mut answer = String::new();
std::io::stdin().lock().read_line(&mut answer)?;
// An empty needle matches every criterion, so it would otherwise be reported as
// ambiguous rather than as nothing having been chosen.
if answer.trim().is_empty() {
return Err(anyhow!("No criterion chosen"));
}
let chosen = find_criteria(criteria, &answer);
match chosen.len() {
1 => Ok(chosen[0]),
0 => Err(anyhow!(
"'{}' matches none of the {} criteria",
answer.trim(),
criteria.len()
)),
_ => Err(anyhow!(
"'{}' matches more than one criterion, use the number",
answer.trim()
)),
}
}
pub fn cmd_check(args: &CheckArgs, checked: bool, start: &Path) -> Result<()> {
let worklane_dir = find_worklane_dir(start)?;
let (status, title, content) = resolve_ticket(&args.ticket, &worklane_dir)?;
let criteria = criteria(&content);
if criteria.is_empty() {
return Err(anyhow!("Ticket '{}' has no acceptance criteria", title));
}
let chosen = match &args.criterion {
None => ask_which_criterion(&criteria, &title)?,
Some(search) => {
let found = find_criteria(&criteria, search);
match found.len() {
1 => found[0],
0 if is_index(search) => {
return Err(anyhow!(
"'{}' is not one of the {} criteria of '{}':\n{}",
search.trim(),
criteria.len(),
title,
criteria_list(&criteria)
));
}
0 => {
return Err(anyhow!(
"No criterion of '{}' matches '{}'. Its criteria are:\n{}",
title,
search,
criteria_list(&criteria)
));
}
_ => {
return Err(anyhow!(
"'{}' matches {} criteria of '{}':\n{}\n\nUse the number instead.",
search,
found.len(),
title,
numbered_criteria(&criteria, &found)
));
}
}
}
};
let criterion = &criteria[chosen];
let verb = if checked { "checked" } else { "unchecked" };
if criterion.checked == checked {
println!(
"Already {}: {}",
verb,
color_text(&criterion.text, Color::Green)
);
return Ok(());
}
let updated = set_criterion(&content, criterion.line, checked);
let uuid = parse_ticket_field(&content, "ID");
save_ticket(&worklane_dir, &status, &uuid, &title, None, &updated)?;
println!(
"{} {}: {}",
if checked { "Checked" } else { "Unchecked" },
chosen + 1,
color_text(&criterion.text, Color::Green)
);
Ok(())
}
/// Install the agent skill, or print it 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<()> {
if print {
print!("{}", install::SKILL.content);
return Ok(());
}
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"
);
}
}
Ok(())
}
+282
View File
@@ -0,0 +1,282 @@
//! Shipping the agent assets with the binary.
//!
//! The skill document lives at `assets/SKILL.md` in this repo and is 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
//! 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
//! own root, but the compare-and-refuse logic is the same and lives here.
use std::io;
use std::path::{Path, PathBuf};
use anyhow::{Result, anyhow};
/// One thing the binary carries and can write into a user's agent configuration.
pub struct Asset {
/// What it is called in messages, e.g. `skill`.
pub what: &'static str,
/// Where it goes under its root, e.g. `worklane/SKILL.md`.
pub relative: &'static str,
pub content: &'static str,
}
/// The skill document, as of the commit this binary was built from.
pub const SKILL: Asset = Asset {
what: "skill",
relative: "worklane/SKILL.md",
content: include_str!("../assets/SKILL.md"),
};
/// 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
/// opencode loads that same directory as an external skill source, alongside its own
/// `~/.config/opencode/skill/`. Checked against opencode 1.15.10, whose built-in
/// `customize-opencode` skill documents it and whose `opencode debug skill` lists the
/// documents found there. Writing both paths would be two copies of one document, free
/// to drift apart, for no gain.
pub fn skills_root() -> Result<PathBuf> {
let home = std::env::var_os("HOME").ok_or_else(|| {
anyhow!("cannot tell where your skills live because HOME is not set in the environment")
})?;
Ok(Path::new(&home).join(".claude/skills"))
}
#[derive(Debug, PartialEq, Eq)]
pub enum Outcome {
Written(PathBuf),
/// Already byte-identical, so writing it again would be a no-op.
Unchanged(PathBuf),
/// Present but different, and no `--force`. Refused rather than overwritten: it
/// may have been edited on purpose, and silently discarding that is worse than
/// stopping.
Refused(PathBuf),
}
impl Asset {
pub fn path(&self, root: &Path) -> PathBuf {
root.join(self.relative)
}
/// Write the asset under `root`, unless what is there is the same or was changed.
///
/// The root is passed in rather than looked up, so a test can install into a
/// temporary directory instead of the home of whoever runs the suite.
pub fn install(&self, root: &Path, force: bool) -> io::Result<Outcome> {
let path = self.path(root);
// A read error is not treated as "absent": the write below reports it, with
// the real reason, rather than this guessing that the file is missing.
match std::fs::read_to_string(&path) {
Ok(existing) if existing == self.content => return Ok(Outcome::Unchanged(path)),
Ok(_) if !force => return Ok(Outcome::Refused(path)),
_ => {}
}
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}
std::fs::write(&path, self.content)?;
Ok(Outcome::Written(path))
}
}
/// The `name:` and `description:` from the YAML frontmatter.
///
/// Used by the tests that guard the shipping mechanism, which is the only thing that
/// needs it: both agents decide whether to load a document from these two fields, and
/// a document missing them is ignored in silence.
#[cfg_attr(not(test), allow(dead_code))]
fn frontmatter_field(text: &str, key: &str) -> Option<String> {
let body = text.strip_prefix("---\n")?;
let end = body.find("\n---")?;
body[..end]
.lines()
.find_map(|line| line.strip_prefix(&format!("{key}:")))
.map(|value| value.trim().to_string())
}
#[cfg(test)]
mod tests {
use super::*;
fn root() -> tempfile::TempDir {
tempfile::tempdir().unwrap()
}
#[test]
fn the_skill_installs_into_a_directory_that_does_not_exist_yet() {
let root = root();
let path = SKILL.path(root.path());
assert_eq!(
SKILL.install(root.path(), false).unwrap(),
Outcome::Written(path.clone())
);
assert_eq!(std::fs::read_to_string(&path).unwrap(), SKILL.content);
}
/// Installing twice is a no-op rather than a rewrite, so the mtime of an
/// up-to-date copy does not move.
#[test]
fn a_second_install_reports_the_copy_unchanged() {
let root = root();
SKILL.install(root.path(), false).unwrap();
assert_eq!(
SKILL.install(root.path(), false).unwrap(),
Outcome::Unchanged(SKILL.path(root.path()))
);
}
/// The case worth being careful about: an edited copy is someone's work.
#[test]
fn a_modified_copy_is_refused_and_left_alone() {
let root = root();
let path = SKILL.path(root.path());
SKILL.install(root.path(), false).unwrap();
std::fs::write(&path, "hand written\n").unwrap();
assert_eq!(
SKILL.install(root.path(), false).unwrap(),
Outcome::Refused(path.clone())
);
assert_eq!(std::fs::read_to_string(&path).unwrap(), "hand written\n");
assert_eq!(
SKILL.install(root.path(), true).unwrap(),
Outcome::Written(path.clone())
);
assert_eq!(std::fs::read_to_string(&path).unwrap(), SKILL.content);
}
#[test]
fn the_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()
);
}
#[test]
fn the_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"));
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"
);
}
/// Every code span and fenced-block line, which is where commands live.
///
/// Prose has to be excluded: the document opens by calling worklane a kanban
/// board, and treating that sentence as a command makes the check useless.
fn code_snippets(text: &str) -> Vec<String> {
let mut snippets = Vec::new();
let mut fenced = false;
for line in text.lines() {
if line.trim_start().starts_with("```") {
fenced = !fenced;
continue;
}
if fenced {
snippets.push(line.to_string());
continue;
}
// Inline spans: the odd-numbered pieces between backticks.
for (index, piece) in line.split('`').enumerate() {
if index % 2 == 1 {
snippets.push(piece.to_string());
}
}
}
snippets
}
#[test]
fn the_embedded_skill_only_names_commands_that_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;
let mut known: Vec<String> = crate::Cli::command()
.get_subcommands()
.map(|c| c.get_name().to_string())
.collect();
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 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"
);
}
assert!(checked > 8, "expected the skill to show commands, checked only {checked}");
}
/// Subcommands the skill has no business teaching: the board is interactive and
/// belongs to a person, `install-skill` is how the document arrived, and `help`
/// is clap's own.
const NOT_FOR_AGENTS: [&str; 3] = ["tui", "install-skill", "help"];
/// 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.
#[test]
fn every_agent_facing_subcommand_is_documented() {
use clap::CommandFactory;
for command in crate::Cli::command().get_subcommands() {
let name = command.get_name();
if NOT_FOR_AGENTS.contains(&name) {
continue;
}
assert!(
SKILL.content.contains(&format!("worklane {name}")),
"the skill never mentions `worklane {name}`, so an agent will not know it exists"
);
}
}
/// The facts an agent cannot infer from the help output and would get wrong.
#[test]
fn the_embedded_skill_documents_what_the_help_does_not() {
for required in [
"committed",
"as you work it",
"UUID prefix",
"leading hyphen",
"Search the backlog before filing",
] {
assert!(
SKILL.content.contains(required),
"the skill no longer mentions {required:?}"
);
}
}
}
+126 -10
View File
@@ -3,6 +3,8 @@ use clap::Parser;
mod command;
mod handlers;
mod install;
mod tui;
mod util;
use command::*;
@@ -36,8 +38,10 @@ fn main() -> Result<()> {
let start = std::env::current_dir()?;
match cli.command {
Command::Init => cmd_init(&start),
Command::Add {
// No subcommand opens the board, the way a bare `frig` does.
None | Some(Command::Tui) => run_tui(&start),
Some(Command::Init) => cmd_init(&start),
Some(Command::Add {
title,
description,
acceptance,
@@ -46,7 +50,7 @@ fn main() -> Result<()> {
due,
owner,
priority,
} => cmd_add(
}) => cmd_add(
&title,
&description,
&acceptance,
@@ -57,21 +61,133 @@ fn main() -> Result<()> {
priority,
&start,
),
Command::Ls { status, priority } => {
Some(Command::Ls { status, priority }) => {
let worklane_dir = find_worklane_dir(&start)?;
cmd_ls(&status, priority, &worklane_dir)
}
Command::Show { id } => {
Some(Command::Show { id }) => {
let worklane_dir = find_worklane_dir(&start)?;
cmd_show(&id, &worklane_dir)
}
Command::Mv {
Some(Command::Mv {
ticket,
status,
force,
} => cmd_mv(&ticket, &status, force, &start),
Command::Set(args) => cmd_set(&args, &start),
Command::Append(args) => cmd_append(&args, &start),
Command::Comment { ticket, body, owner } => cmd_comment(&ticket, &body, &owner, &start),
}) => cmd_mv(&ticket, &status, force, &start),
Some(Command::Set(args)) => cmd_set(&args, &start),
Some(Command::Append(args)) => cmd_append(&args, &start),
Some(Command::Check(args)) => cmd_check(&args, true, &start),
Some(Command::Uncheck(args)) => cmd_check(&args, false, &start),
Some(Command::Comment {
ticket,
body,
owner,
}) => cmd_comment(&ticket, &body, &owner, &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),
}
}
// ---------------------------------------------------------------------- tui --
/// Restore the terminal whatever happens.
///
/// A panic inside the draw loop with raw mode still on leaves the shell unusable and
/// the backtrace unreadable, so the hook runs before the default one.
fn install_panic_hook() {
let previous = std::panic::take_hook();
std::panic::set_hook(Box::new(move |info| {
let _ = restore_terminal();
previous(info);
}));
}
fn restore_terminal() -> std::io::Result<()> {
crossterm::terminal::disable_raw_mode()?;
crossterm::execute!(
std::io::stdout(),
crossterm::terminal::LeaveAlternateScreen
)
}
fn run_tui(start: &std::path::Path) -> Result<()> {
use crossterm::event::{self, Event, KeyCode, KeyEventKind, KeyModifiers};
use std::io::IsTerminal;
// The board is looked for before the terminal is, so running this outside a
// worklane directory gives the same message every other command gives rather than
// a complaint about the terminal.
let worklane_dir = find_worklane_dir(start)?;
// Without this, entering raw mode on a pipe fails with a bare "No such device or
// address (os error 6)", which says nothing about the actual mistake. A bare
// `worklane` is how the board is opened, so a script that reaches it by accident
// has to be pointed at a subcommand.
if !std::io::stdin().is_terminal() {
return Err(anyhow::anyhow!(
"`worklane` with no subcommand opens the board, which needs a terminal.\n\
For scripted use try `worklane ls` or `worklane show`; `worklane --help` \
lists everything."
));
}
let mut board = tui::Board::new(&worklane_dir)?;
install_panic_hook();
crossterm::terminal::enable_raw_mode()?;
crossterm::execute!(std::io::stdout(), crossterm::terminal::EnterAlternateScreen)?;
let mut terminal =
ratatui::Terminal::new(ratatui::backend::CrosstermBackend::new(std::io::stdout()))?;
let result = (|| -> Result<()> {
while !board.should_quit {
board.tick()?;
terminal.draw(|frame| tui::draw(frame, &board))?;
// Taken after the draw, so a scroll measures the overlay that is on screen.
let screen = terminal.size()?;
// Bounded, so the tick still runs when nobody is typing.
if !event::poll(tui::POLL)? {
continue;
}
let Event::Key(key) = event::read()? else {
continue;
};
if key.kind != KeyEventKind::Press {
continue;
}
match key.code {
KeyCode::Char('q') => board.should_quit = true,
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),
// Up and down stay on the selection, open detail view or not, so a
// column can be read through without closing the modal. Scrolling the
// open ticket is a page at a time.
KeyCode::Up | KeyCode::Char('k') => board.select_card(-1, screen),
KeyCode::Down | KeyCode::Char('j') => board.select_card(1, screen),
KeyCode::PageUp => board.scroll_detail(-1, screen),
KeyCode::PageDown => board.scroll_detail(1, screen),
_ => {}
}
}
Ok(())
})();
// Before the error surfaces, so a failure does not leave the shell in raw mode.
restore_terminal()?;
result
}
+1247
View File
File diff suppressed because it is too large Load Diff
+293 -55
View File
@@ -52,24 +52,74 @@ pub fn should_use_colors() -> bool {
})
}
pub fn get_color(color: &str) -> &'static str {
match color {
"red" => "\x1b[31m",
"cyan" => "\x1b[36m",
"orange" => "\x1b[33m",
"green" => "\x1b[32m",
// Indexed colour 8 in the 256-colour form, which is byte for byte what
// crossterm emits for ratatui's Color::DarkGray, the grey frig and pantop
// use for dimmed rows. Neither SGR 90 nor 37 renders as grey on every
// palette: 90 leans on the bright-black slot and 37 can sit right on top
// of the default foreground.
"grey" => "\x1b[38;5;8m",
// Bold, per the guideline in AGENTS.md. Its absence meant colorize_line
// asked for a colour that did not exist and got an empty prefix.
"magenta" => "\x1b[1;35m",
// Indexed, for the same reason grey is: this is the spelling that renders.
"brightred" => "\x1b[38;5;9m",
_ => "",
/// The palette, as a type rather than a set of strings.
///
/// One definition for both renderers. The CLI needs an escape sequence and the TUI
/// needs a `ratatui::style::Color`, and an enum makes a colour that exists for one and
/// not the other a compile error instead of something a test has to go looking for.
/// The stringly-typed version needed exactly such a test, and a missing entry silently
/// produced an empty prefix, which is how `magenta` came to be undefined.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Color {
Red,
Cyan,
Orange,
Green,
Grey,
Magenta,
BrightRed,
}
impl Color {
/// The SGR sequence the CLI writes.
pub fn ansi(self) -> &'static str {
match self {
Color::Red => "\x1b[31m",
Color::Cyan => "\x1b[36m",
Color::Orange => "\x1b[33m",
Color::Green => "\x1b[32m",
// Indexed colour 8 in the 256-colour form, which is byte for byte what
// crossterm emits for ratatui's Color::DarkGray, the grey frig and pantop
// use for dimmed rows. Neither SGR 90 nor 37 renders as grey on every
// palette: 90 leans on the bright-black slot and 37 can sit right on top
// of the default foreground.
Color::Grey => "\x1b[38;5;8m",
// Bold, per the guideline in AGENTS.md.
Color::Magenta => "\x1b[1;35m",
// Indexed, for the same reason grey is: this is the spelling that renders.
Color::BrightRed => "\x1b[38;5;9m",
}
}
/// Every colour in the palette, so a test can walk them without listing them.
pub const ALL: [Color; 7] = [
Color::Red,
Color::Cyan,
Color::Orange,
Color::Green,
Color::Grey,
Color::Magenta,
Color::BrightRed,
];
}
/// The same palette as ratatui sees it.
///
/// Chosen to match what crossterm emits for the escape above, so a card in the TUI and
/// a row in the listing are the same colour rather than two guesses at it.
impl From<Color> for ratatui::style::Color {
fn from(color: Color) -> Self {
use ratatui::style::Color as Tui;
match color {
Color::Red => Tui::Red,
Color::Cyan => Tui::Cyan,
Color::Orange => Tui::Yellow,
Color::Green => Tui::Green,
Color::Grey => Tui::DarkGray,
Color::Magenta => Tui::Magenta,
Color::BrightRed => Tui::LightRed,
}
}
}
@@ -77,15 +127,15 @@ pub fn get_color(color: &str) -> &'static str {
///
/// The seam matters for anything that aligns columns: a caller has to be able to
/// render both ways in one process to prove the padding does not depend on it.
pub fn paint(text: &str, color: &str, enabled: bool) -> String {
pub fn paint(text: &str, color: Color, enabled: bool) -> String {
if enabled {
format!("{}{}{}", get_color(color), text, "\x1b[0m")
format!("{}{}{}", color.ansi(), text, "\x1b[0m")
} else {
text.to_string()
}
}
pub fn color_text(text: &str, color: &str) -> String {
pub fn color_text(text: &str, color: Color) -> String {
paint(text, color, should_use_colors())
}
@@ -167,9 +217,9 @@ fn ambiguous(search: &str, matches: &[(String, String, String, String)]) -> anyh
message.push_str(&format!(
" {}. ({}) {} [{}]\n",
i + 1,
color_text(short_id(id), "red"),
color_text(short_id(id), Color::Red),
title,
color_text(status, "orange"),
color_text(status, Color::Orange),
));
}
@@ -263,18 +313,26 @@ pub fn resolve_ticket(search: &str, worklane_dir: &Path) -> Result<(String, Stri
Ok((status, title, content))
}
pub fn format_comments(comments: &[(String, String, String, String)]) -> String {
format_comments_with(comments, should_use_colors())
}
/// As above, with the colour decision passed in for the TUI.
pub fn format_comments_with(
comments: &[(String, String, String, String)],
colored: bool,
) -> String {
if comments.is_empty() {
return color_text("No comments yet.", "grey");
return paint("No comments yet.", Color::Grey, colored);
}
let mut result = String::new();
result.push_str("\n");
result.push_str(&color_text("COMMENTS", "orange"));
result.push_str(&paint("COMMENTS", Color::Orange, colored));
result.push_str(&format!("\n{}\n", "─".repeat(20)));
for (_filename, author, time, body) in comments {
result.push_str("\n");
result.push_str(&color_text(&format!("From {} ({})", author, time), "cyan"));
result.push_str(&paint(&format!("From {} ({})", author, time), Color::Cyan, colored));
result.push_str("\n");
if !body.is_empty() {
result.push_str(&" ".to_string());
@@ -286,10 +344,18 @@ pub fn format_comments(comments: &[(String, String, String, String)]) -> String
result
}
pub fn content_trim_colored(content: &str) -> String {
content_trim(content, should_use_colors())
}
/// The ticket body rendered for display, with the colour decision passed in.
///
/// The TUI needs the plain form: ratatui draws styled spans, and an escape sequence
/// embedded in a paragraph would be printed as literal bytes.
pub fn content_trim(content: &str, colored: bool) -> String {
let lines: Vec<&str> = content.trim().lines().collect();
let colored = should_use_colors();
let mut result = String::new();
let mut current_section = "";
let mut criterion = 0;
let mut i = 0;
while i < lines.len() {
@@ -298,7 +364,7 @@ pub fn content_trim_colored(content: &str) -> String {
// Track current section
if let Some(section_name) = line.strip_prefix("## ") {
current_section = line;
result.push_str(&paint(section_name, "orange", colored));
result.push_str(&paint(section_name, Color::Orange, colored));
result.push('\n');
// Measured on the name as displayed, in characters. The rule used to span
// the raw line, so it ran three past the heading for the "## ", and byte
@@ -342,10 +408,22 @@ pub fn content_trim_colored(content: &str) -> String {
continue;
}
// Acceptance Criteria checkboxes
if line.starts_with("- [ ]") {
result.push_str(&paint("- [ ]", "grey", colored));
result.push_str(&line[5..]);
// Acceptance Criteria checkboxes, numbered so the index `check` takes is
// visible where the ticket is read. The number replaces the list marker
// rather than joining it, and is cyan like the numbers in the plan section.
if current_section == ACCEPTANCE.heading
&& let Some((checked, text)) = checkbox(line)
{
criterion += 1;
result.push_str(&paint(&format!("{}.", criterion), Color::Cyan, colored));
result.push(' ');
result.push_str(&paint(
if checked { "[x]" } else { "[ ]" },
Color::Grey,
colored,
));
result.push(' ');
result.push_str(&colorize_bold(text, colored));
result.push('\n');
continue;
}
@@ -358,7 +436,7 @@ pub fn content_trim_colored(content: &str) -> String {
let link_start = start + end_bracket + 1;
if let Some(end) = line[link_start..].find(']') {
let absolute_end = link_start + end + 1;
result.push_str(&color_text(&line[start..absolute_end], "cyan"));
result.push_str(&paint(&line[start..absolute_end], Color::Cyan, colored));
result.push('\n');
continue;
}
@@ -367,7 +445,7 @@ pub fn content_trim_colored(content: &str) -> String {
}
// Regular content - colorize **bold** in magenta
result.push_str(&colorize_line(line));
result.push_str(&colorize_bold(line, colored));
result.push('\n');
}
@@ -388,7 +466,7 @@ pub fn colorize_ordered(line: &str) -> String {
// still scanning digits
} else if *c == '.' && i + 1 < chars.len() && chars[i + 1] == ' ' {
let number = &line[..i + 1];
result.push_str(&color_text(number, "cyan"));
result.push_str(&color_text(number, Color::Cyan));
result.push_str(&line[i + 1..]);
return result;
} else {
@@ -437,7 +515,7 @@ fn metadata_value_cell(name: &str, value: &str, colored: bool) -> String {
}
if is_unknown_value(value) {
return paint(value, "grey", colored);
return paint(value, Color::Grey, colored);
}
value.to_string()
@@ -473,7 +551,7 @@ fn render_metadata_table(lines: &[&str], colored: bool) -> String {
for row in &rows {
match row {
MetadataRow::Field { name, value } => {
result.push_str(&paint(name, "red", colored));
result.push_str(&paint(name, Color::Red, colored));
result.push_str(&" ".repeat(field_width - name.chars().count()));
result.push_str(METADATA_GUTTER);
result.push_str(&metadata_value_cell(name, value, colored));
@@ -520,7 +598,7 @@ fn colorize_bold(line: &str, enabled: bool) -> String {
match (i + 2..chars.len()).find(|&at| is_delimiter(&chars, at)) {
Some(close) => {
let bold: String = chars[i + 2..close].iter().collect();
result.push_str(&color_text(&bold, "magenta"));
result.push_str(&color_text(&bold, Color::Magenta));
i = close + 2;
}
// Unterminated: the rest is literal. The old scan walked off the end
@@ -849,6 +927,150 @@ pub fn append_section_body(content: &str, section: &Section, items: &[String]) -
Ok(join_lines(&out))
}
/// One acceptance criterion as it sits in the file.
pub struct Criterion {
/// Index into `content.lines()`, so the one line can be rewritten in place.
pub line: usize,
pub checked: bool,
pub text: String,
}
/// A checkbox line's state and text, or `None` when the line is not one.
///
/// Both `[x]` and `[X]` count as ticked. Anything else between the brackets is not a
/// criterion, so a handwritten line in the section is left out of the numbering.
pub fn checkbox(line: &str) -> Option<(bool, &str)> {
let rest = line.trim_start().strip_prefix("- [")?;
let mut chars = rest.char_indices();
let (_, mark) = chars.next()?;
let (closes_at, close) = chars.next()?;
if close != ']' {
return None;
}
let checked = match mark {
' ' => false,
'x' | 'X' => true,
_ => return None,
};
Some((checked, rest[closes_at + 1..].trim()))
}
/// The acceptance criteria, numbered in the order they appear.
///
/// Scoped to the section, so a checkbox written into a description is not a criterion,
/// and non-checkbox lines inside the section are skipped rather than numbered.
pub fn criteria(content: &str) -> Vec<Criterion> {
let lines: Vec<&str> = content.lines().collect();
let Some(body) = section_body(&lines, ACCEPTANCE.heading) else {
return Vec::new();
};
lines[body.clone()]
.iter()
.enumerate()
.filter_map(|(offset, line)| {
checkbox(line).map(|(checked, text)| Criterion {
line: body.start + offset,
checked,
text: text.to_string(),
})
})
.collect()
}
/// The criteria at `shown`, numbered by their real position in the list.
///
/// The position matters: a subset renumbered from one would contradict the advice to
/// use the number, pointing at whichever criterion happens to sit there instead.
pub fn numbered_criteria(criteria: &[Criterion], shown: &[usize]) -> String {
let colored = should_use_colors();
shown
.iter()
.filter_map(|offset| criteria.get(*offset).map(|criterion| (offset, criterion)))
.map(|(offset, criterion)| {
format!(
" {} {} {}",
paint(&format!("{}.", offset + 1), Color::Cyan, colored),
paint(
if criterion.checked { "[x]" } else { "[ ]" },
Color::Grey,
colored
),
criterion.text
)
})
.collect::<Vec<_>>()
.join("\n")
}
/// The whole list, numbered as `show` numbers it.
pub fn criteria_list(criteria: &[Criterion]) -> String {
numbered_criteria(criteria, &(0..criteria.len()).collect::<Vec<_>>())
}
/// Whether `search` is a number rather than a substring, so a value out of range can
/// be reported as a bad index instead of a fruitless text search.
pub fn is_index(search: &str) -> bool {
search.trim().parse::<usize>().is_ok()
}
/// Which criterion `search` names: a one-based index as `show` prints, or a
/// case-insensitive substring of the text.
///
/// The index is tried first, so a criterion whose text is literally "2" is reachable
/// only by substring. Returns every match, leaving the caller to refuse more than one.
pub fn find_criteria(criteria: &[Criterion], search: &str) -> Vec<usize> {
if let Ok(index) = search.trim().parse::<usize>() {
if index >= 1 && index <= criteria.len() {
return vec![index - 1];
}
// A number outside the range is a bad index, not a substring to hunt for.
return Vec::new();
}
// Trimmed, like the index path: an answer typed at the prompt arrives with its
// newline attached, and no criterion text contains one.
let needle = search.trim().to_lowercase();
criteria
.iter()
.enumerate()
.filter(|(_, criterion)| criterion.text.to_lowercase().contains(&needle))
.map(|(offset, _)| offset)
.collect()
}
/// Tick or untick the criterion on `line`, leaving every other byte alone.
///
/// Only the character between the brackets is spliced. Rebuilding the line would
/// normalise its indentation and whatever spacing it carried after the checkbox.
pub fn set_criterion(content: &str, line: usize, checked: bool) -> String {
let mark = if checked { 'x' } else { ' ' };
let mut out = String::with_capacity(content.len());
for (index, current) in content.lines().enumerate() {
match (index == line, current.find("- [")) {
(true, Some(at)) => {
let opens = at + "- [".len();
out.push_str(&current[..opens]);
out.push(mark);
// Past the one character the brackets hold. Nothing follows on a line
// that ends mid-checkbox, which is why this is not unconditional.
if let Some((offset, _)) = current[opens..].char_indices().nth(1) {
out.push_str(&current[opens + offset..]);
}
}
_ => out.push_str(current),
}
out.push('\n');
}
out
}
/// The slice with blank values trimmed from both ends, interior ones kept.
///
/// Description values are joined with a single newline, so an empty value is how a
@@ -926,6 +1148,9 @@ pub struct TicketItem {
pub id: String,
pub created: String,
pub priority: Priority,
/// 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,
}
/// Grey for a value that is not set, per the colour guideline.
@@ -934,7 +1159,7 @@ pub struct TicketItem {
/// place that ignored the rule.
fn dim_if_unset(value: &str, colored: bool) -> String {
if is_unknown_value(value) {
paint(value, "grey", colored)
paint(value, Color::Grey, colored)
} else {
value.to_string()
}
@@ -955,17 +1180,17 @@ fn dim_if_unset(value: &str, colored: bool) -> String {
/// The number counts up while the mark empties out, because 1 is the most urgent.
/// That is the convention every tracker uses and what the p1 tags this replaced
/// already meant.
pub fn priority_mark(priority: Priority) -> (&'static str, &'static str) {
pub fn priority_mark(priority: Priority) -> (&'static str, Color) {
match priority {
Priority::Level(1) => ("\u{25cf}\u{25cf}", "brightred"),
Priority::Level(2) => ("\u{25cf}\u{25d0}", "red"),
Priority::Level(3) => ("\u{25cf}\u{25cb}", "orange"),
Priority::Level(4) => ("\u{25d0}\u{25cb}", "cyan"),
Priority::Level(5) => ("\u{25cb}\u{25cb}", "grey"),
Priority::Level(1) => ("\u{25cf}\u{25cf}", Color::BrightRed),
Priority::Level(2) => ("\u{25cf}\u{25d0}", Color::Red),
Priority::Level(3) => ("\u{25cf}\u{25cb}", Color::Orange),
Priority::Level(4) => ("\u{25d0}\u{25cb}", Color::Cyan),
Priority::Level(5) => ("\u{25cb}\u{25cb}", Color::Grey),
// Unreachable while Level is only built by parse_priority, which checks
// the range, but a level added later should not silently render blank.
Priority::Level(_) | Priority::Invalid => ("??", "brightred"),
Priority::Unset => ("\u{b7}\u{b7}", "grey"),
Priority::Level(_) | Priority::Invalid => ("??", Color::BrightRed),
Priority::Unset => ("\u{b7}\u{b7}", Color::Grey),
}
}
@@ -992,7 +1217,7 @@ pub fn display_ticket_items(items: &[TicketItem]) {
let colored = should_use_colors();
for item in items {
let id = paint(&item.id, "red", colored);
let id = paint(&item.id, Color::Red, colored);
let owner = dim_if_unset(&item.owner, colored);
let due = dim_if_unset(&item.due, colored);
let priority = show_priority(item.priority, colored);
@@ -1003,7 +1228,7 @@ pub fn display_ticket_items(items: &[TicketItem]) {
priority, id, item.title, owner, due
);
} else {
let created = paint(&item.created, "cyan", colored);
let created = paint(&item.created, Color::Cyan, colored);
println!(
" {} {} ({}) {} | Owner: {} | Due: {}",
priority, created, id, item.title, owner, due
@@ -1036,6 +1261,7 @@ pub fn collect_ticket_items(status_path: impl AsRef<Path>) -> Result<Vec<TicketI
id: short_id(&filename).to_string(),
created: format_created_at(&created_at),
priority: parse_priority(&content),
path: e.path(),
})
})
.collect();
@@ -1090,7 +1316,7 @@ mod tests {
for unset in ["_Not set_", "_None_"] {
assert!(is_unknown_value(unset), "{unset} should count as unset");
assert_eq!(dim_if_unset(unset, false), unset);
assert_eq!(dim_if_unset(unset, true), paint(unset, "grey", true));
assert_eq!(dim_if_unset(unset, true), paint(unset, Color::Grey, true));
}
for set in ["alice", "2026-12-31", "bug,frontend"] {
@@ -1533,15 +1759,27 @@ mod tests {
#[test]
fn the_ramp_avoids_green() {
for level in PRIORITY_RANGE {
assert_ne!(priority_mark(Priority::Level(level)).1, "green");
assert_ne!(priority_mark(Priority::Level(level)).1, Color::Green);
}
}
#[test]
fn every_colour_the_code_asks_for_exists() {
for colour in ["red", "cyan", "orange", "green", "grey", "magenta", "brightred"] {
assert!(!get_color(colour).is_empty(), "{colour} is not defined");
fn every_colour_has_an_escape_and_a_ratatui_equivalent() {
// The old version of this test guarded against a name with no entry, which the
// enum now makes a compile error. What is left worth asserting is that no
// variant renders as nothing, and that the two renderers agree on the set.
let mut seen = std::collections::HashSet::new();
for colour in Color::ALL {
assert!(!colour.ansi().is_empty(), "{colour:?} has no escape");
assert!(
colour.ansi().starts_with("\x1b["),
"{colour:?} is not an SGR sequence"
);
assert!(seen.insert(ratatui::style::Color::from(colour)), "{colour:?} shares its ratatui colour");
}
assert_eq!(seen.len(), Color::ALL.len());
}
/// Pinned deliberately. Both SGR spellings of grey failed on a real palette,
@@ -1550,7 +1788,7 @@ mod tests {
/// so worklane's grey is the one frig and pantop already render.
#[test]
fn grey_matches_the_indexed_colour_frig_uses() {
assert_eq!(get_color("grey"), "\x1b[38;5;8m");
assert_eq!(Color::Grey.ansi(), "\x1b[38;5;8m");
}
/// With no colour to carry the emphasis, the markers are the emphasis.
+287
View File
@@ -0,0 +1,287 @@
use assert_cmd::Command;
use assert_fs::TempDir;
use assert_fs::fixture::{PathChild, PathCreateDir};
use std::fs;
use std::path::PathBuf;
const BIN_NAME: &str = env!("CARGO_BIN_EXE_worklane");
const UUID: &str = "475534a3-8a0d-45cb-9a97-39c251dd8e39";
fn setup_worklane(temp: &TempDir) -> PathBuf {
let worklane = temp.child(".worklane");
worklane.create_dir_all().unwrap();
for dir in ["backlog", "committed", "reviewing", "done"] {
worklane.child(dir).create_dir_all().unwrap();
}
worklane.path().to_path_buf()
}
/// One criterion already ticked, one handwritten line inside the section, and a
/// checkbox in the description that must not be counted as a criterion.
fn create_ticket(worklane: &PathBuf) {
// Written without line continuations on purpose: a trailing `\` strips the next
// line's leading whitespace, so the indented line would arrive unindented and the
// test would prove nothing about preserving it.
let lines = [
"# Check me",
"",
"## Description",
"- [ ] A checkbox in the description, which is not a criterion.",
"",
"## Acceptance Criteria",
"- [ ] alpha shared",
"- [x] beta alone",
" A handwritten line inside the section.",
"- [ ] gamma shared",
"",
"## Implementation Plan",
"1. Step one",
"",
"## Metadata",
"",
&format!("- **ID**: {}", UUID),
"- **Status**: backlog",
"",
];
fs::write(
worklane.join("backlog").join(format!("{}_check-me.md", UUID)),
lines.join("\n"),
)
.unwrap();
}
fn run(temp: &TempDir, args: &[&str]) -> std::process::Output {
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
cmd.current_dir(&temp.path()).args(args);
cmd.assert().get_output().clone()
}
fn ticket(worklane: &PathBuf) -> String {
fs::read_to_string(worklane.join("backlog").join(format!("{}_check-me.md", UUID))).unwrap()
}
/// The whole point: one line changes and every other keeps its state.
#[test]
fn check_ticks_one_criterion_by_index() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
let out = run(&temp, &["check", UUID, "1"]);
assert!(out.status.success(), "{:?}", String::from_utf8_lossy(&out.stderr));
let content = ticket(&worklane);
assert!(content.contains("- [x] alpha shared\n"), "{content}");
assert!(content.contains("- [x] beta alone\n"), "beta lost its tick: {content}");
assert!(content.contains("- [ ] gamma shared\n"), "{content}");
}
#[test]
fn check_ticks_one_criterion_by_substring() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
run(&temp, &["check", UUID, "GAMMA"]);
assert!(ticket(&worklane).contains("- [x] gamma shared\n"));
}
#[test]
fn uncheck_unticks_one_criterion() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
run(&temp, &["uncheck", UUID, "2"]);
let content = ticket(&worklane);
assert!(content.contains("- [ ] beta alone\n"), "{content}");
assert!(content.contains("- [ ] alpha shared\n"), "{content}");
}
/// The handwritten line sits between two criteria, so it is the thing most likely to
/// be lost by a rewrite, and it must not take a number either.
#[test]
fn a_handwritten_line_in_the_section_survives_and_is_not_numbered() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
// gamma is the third criterion even though it is the fourth line of the section
run(&temp, &["check", UUID, "3"]);
let content = ticket(&worklane);
assert!(content.contains("- [x] gamma shared\n"), "{content}");
assert!(
content.contains(" A handwritten line inside the section.\n"),
"the handwritten line was lost or reindented: {content}"
);
}
/// A checkbox outside the section is not a criterion, so the numbering starts inside it.
#[test]
fn a_checkbox_in_the_description_is_not_a_criterion() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
run(&temp, &["check", UUID, "1"]);
let content = ticket(&worklane);
assert!(
content.contains("- [ ] A checkbox in the description, which is not a criterion.\n"),
"the description checkbox was ticked: {content}"
);
}
#[test]
fn checking_an_already_checked_criterion_changes_nothing() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
let before = ticket(&worklane);
let out = run(&temp, &["check", UUID, "2"]);
assert!(out.status.success());
assert!(
String::from_utf8_lossy(&out.stdout).contains("Already checked"),
"{:?}",
String::from_utf8_lossy(&out.stdout)
);
assert_eq!(ticket(&worklane), before, "the file was rewritten anyway");
}
/// The listed numbers have to be the real ones, or the advice to use the number points
/// at the wrong criterion. alpha and gamma are 1 and 3, never 1 and 2.
#[test]
fn an_ambiguous_substring_lists_the_matches_with_their_real_numbers() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
let before = ticket(&worklane);
let out = run(&temp, &["check", UUID, "shared"]);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_eq!(out.status.code(), Some(1));
assert!(stderr.contains("matches 2 criteria"), "{stderr:?}");
assert!(stderr.contains("1. [ ] alpha shared"), "{stderr:?}");
assert!(stderr.contains("3. [ ] gamma shared"), "{stderr:?}");
assert!(!stderr.contains("2. [ ] gamma"), "renumbered: {stderr:?}");
assert_eq!(ticket(&worklane), before);
}
#[test]
fn a_substring_matching_nothing_is_an_error_listing_the_criteria() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
let out = run(&temp, &["check", UUID, "nowhere"]);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_eq!(out.status.code(), Some(1));
assert!(stderr.contains("No criterion"), "{stderr:?}");
assert!(stderr.contains("1. [ ] alpha shared"), "{stderr:?}");
}
/// A number out of range is a bad index, not a substring that happened to miss.
#[test]
fn an_index_out_of_range_says_so() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
let out = run(&temp, &["check", UUID, "9"]);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_eq!(out.status.code(), Some(1));
assert!(stderr.contains("is not one of the 3 criteria"), "{stderr:?}");
}
/// No terminal to prompt at, so the list comes back as an error instead. This is the
/// path the opencode wrapper takes, and it must not block on stdin.
#[test]
fn omitting_the_criterion_without_a_terminal_returns_the_list_as_an_error() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
let before = ticket(&worklane);
let out = run(&temp, &["check", UUID]);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_eq!(out.status.code(), Some(1));
assert!(stderr.contains("Which criterion"), "{stderr:?}");
assert!(stderr.contains("1. [ ] alpha shared"), "{stderr:?}");
assert!(stderr.contains("2. [x] beta alone"), "{stderr:?}");
assert!(stderr.contains("3. [ ] gamma shared"), "{stderr:?}");
assert_eq!(ticket(&worklane), before);
}
#[test]
fn a_ticket_with_no_criteria_says_so() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
fs::write(
worklane.join("backlog").join("aaaaaaaa-0000-4000-8000-000000000000_bare.md"),
"# Bare\n\n## Acceptance Criteria\n_No acceptance criteria provided._\n\n## Metadata\n\n- **ID**: aaaaaaaa-0000-4000-8000-000000000000\n- **Status**: backlog\n",
)
.unwrap();
let out = run(&temp, &["check", "aaaaaaaa", "1"]);
assert_eq!(out.status.code(), Some(1));
assert!(
String::from_utf8_lossy(&out.stderr).contains("no acceptance criteria"),
"{:?}",
String::from_utf8_lossy(&out.stderr)
);
}
/// show numbers the criteria, so the index check takes is visible where it is read.
#[test]
fn show_numbers_the_criteria() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
let out = run(&temp, &["show", UUID]);
let stdout = String::from_utf8_lossy(&out.stdout);
assert!(stdout.contains("1. [ ] alpha shared"), "{stdout:?}");
assert!(stdout.contains("2. [x] beta alone"), "{stdout:?}");
assert!(stdout.contains("3. [ ] gamma shared"), "{stdout:?}");
// The handwritten line is shown but takes no number
assert!(stdout.contains(" A handwritten line inside the section."), "{stdout:?}");
assert!(!stdout.contains("4. ["), "the handwritten line was numbered: {stdout:?}");
// And the description checkbox is left as it is, outside the numbering
assert!(
stdout.contains("- [ ] A checkbox in the description"),
"{stdout:?}"
);
}
#[test]
fn check_leaves_nothing_behind() {
let temp = TempDir::new().unwrap();
let worklane = setup_worklane(&temp);
create_ticket(&worklane);
run(&temp, &["check", UUID, "1"]);
let strays: Vec<String> = fs::read_dir(&worklane)
.unwrap()
.filter_map(|e| e.ok())
.map(|e| e.file_name().into_string().unwrap())
.filter(|name| {
!["backlog", "committed", "reviewing", "done", "comments"].contains(&name.as_str())
})
.collect();
assert_eq!(strays, Vec::<String>::new());
}
+96
View File
@@ -0,0 +1,96 @@
use assert_cmd::Command;
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.
const SKILL: &str = include_str!("../assets/SKILL.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
/// and the modified cases reachable at all.
fn run(home: &TempDir, args: &[&str]) -> std::process::Output {
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
cmd.env("HOME", home.path()).args(args);
cmd.assert().get_output().clone()
}
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.
#[test]
fn the_skill_installs_outside_a_worklane_directory() {
let home = TempDir::new().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("Installed the worklane skill"), "{stdout}");
assert!(stdout.contains(".claude/skills/worklane/SKILL.md"), "{stdout}");
assert_eq!(std::fs::read_to_string(installed(&home)).unwrap(), SKILL);
}
#[test]
fn a_second_install_says_it_is_already_up_to_date() {
let home = TempDir::new().unwrap();
run(&home, &["install-skill"]);
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("Already up to date"), "{stdout}");
}
/// A copy someone edited is theirs. The command says what to do next rather than
/// discarding it, and only `--force` overwrites.
#[test]
fn a_modified_copy_is_reported_and_needs_force() {
let home = TempDir::new().unwrap();
run(&home, &["install-skill"]);
std::fs::write(installed(&home), "hand written\n").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("--force"), "{stdout}");
assert!(stdout.contains("--print"), "the message never says how to compare: {stdout}");
assert_eq!(
std::fs::read_to_string(installed(&home)).unwrap(),
"hand written\n",
"the modified copy was overwritten anyway"
);
let out = run(&home, &["install-skill", "--force"]);
let stdout = String::from_utf8_lossy(&out.stdout);
assert!(stdout.contains("Installed the worklane skill"), "{stdout}");
assert_eq!(std::fs::read_to_string(installed(&home)).unwrap(), SKILL);
}
/// 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() {
let home = TempDir::new().unwrap();
let out = run(&home, &["install-skill", "--print"]);
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");
}
/// The command has to be findable by someone who does not already know it exists.
#[test]
fn the_help_lists_the_install_skill_command() {
let home = TempDir::new().unwrap();
let stdout = String::from_utf8_lossy(&run(&home, &["--help"]).stdout).to_string();
assert!(stdout.contains("install-skill"), "{stdout}");
}
+82
View File
@@ -0,0 +1,82 @@
use assert_cmd::Command;
use assert_fs::TempDir;
use assert_fs::fixture::{PathChild, PathCreateDir};
const BIN_NAME: &str = env!("CARGO_BIN_EXE_worklane");
fn setup_worklane(temp: &TempDir) {
let worklane = temp.child(".worklane");
worklane.create_dir_all().unwrap();
for dir in ["backlog", "committed", "reviewing", "done"] {
worklane.child(dir).create_dir_all().unwrap();
}
}
fn run(temp: &TempDir, args: &[&str]) -> std::process::Output {
let mut cmd = Command::cargo_bin(BIN_NAME).unwrap();
cmd.current_dir(&temp.path()).args(args);
cmd.assert().get_output().clone()
}
/// Same message every other command gives. Checked before the terminal is, so the
/// missing board is what gets reported rather than the missing tty.
#[test]
fn the_tui_outside_a_worklane_directory_gives_the_usual_message() {
let temp = TempDir::new().unwrap();
for args in [vec!["tui"], vec![]] {
let out = run(&temp, &args);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_eq!(out.status.code(), Some(1), "{args:?}");
assert!(
stderr.contains("No .worklane directory found"),
"{args:?}: {stderr:?}"
);
}
}
/// Raw mode on a pipe fails with a bare "No such device or address", which says nothing
/// about the mistake. A bare `worklane` is how the board opens, so a script that lands
/// here by accident has to be pointed at a subcommand.
#[test]
fn the_tui_without_a_terminal_says_so_and_names_an_alternative() {
let temp = TempDir::new().unwrap();
setup_worklane(&temp);
for args in [vec!["tui"], vec![]] {
let out = run(&temp, &args);
let stderr = String::from_utf8_lossy(&out.stderr);
assert_eq!(out.status.code(), Some(1), "{args:?}");
assert!(stderr.contains("needs a terminal"), "{args:?}: {stderr:?}");
assert!(stderr.contains("worklane ls"), "{args:?}: {stderr:?}");
assert!(
!stderr.contains("os error"),
"the raw mode error leaked: {stderr:?}"
);
}
}
/// The subcommands must keep working now that the subcommand is optional.
#[test]
fn an_unknown_subcommand_is_still_a_usage_error() {
let temp = TempDir::new().unwrap();
setup_worklane(&temp);
assert_eq!(run(&temp, &["nonsense"]).status.code(), Some(2));
assert_eq!(run(&temp, &["--bogus"]).status.code(), Some(2));
}
/// `tui` has to appear in the help, or nothing points at it.
#[test]
fn the_help_lists_the_tui_command() {
let temp = TempDir::new().unwrap();
let out = run(&temp, &["--help"]);
let stdout = String::from_utf8_lossy(&out.stdout);
assert!(out.status.success());
assert!(stdout.contains("tui"), "{stdout:?}");
}