You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.6 KiB
Markdown

+++
title = "nbd ready command"
priority = 7
status = "done"
ticket_type = "feature"
dependencies = []
+++
Add `nbd ready` subcommand that lists tickets which are actionable right now: not yet done and with all dependencies completed.
## Motivation
Agent workflows need to know which tickets are unblocked. `nbd list` shows everything; `nbd ready` narrows to what can actually be started immediately.
## Approach
1. Add `Ready` variant to `Commands` enum in `main.rs`.
2. Implement `cmd_ready(json: bool)`:
a. `list_tickets(root)` to fetch all tickets.
b. Build a set of IDs for tickets with `status == Status::Done`.
c. Filter to tickets where:
- `ticket.status != Status::Done` (not already finished)
- All IDs in `ticket.dependencies` are in the done-set (or the dep doesn't exist — treat missing deps as unresolved, not ready).
d. Print the filtered slice using existing `display::print_list` / `print_list_json`.
3. No new store or display functions needed — reuse existing.
## Edge cases
- A ticket with no dependencies and status `todo` → ready.
- A ticket whose dep is `in_progress` → NOT ready.
- Missing dep ID → NOT ready (treat conservatively).
- Empty store → returns empty list (not an error).
## Tests
Unit-style integration tests:
- Three tickets: A (no deps, todo), B (dep A, todo), C (no deps, done). `nbd ready` should return only A.
- After marking A done, `nbd ready` should return B.
- `nbd ready --json` returns a JSON array of the ready tickets.
## Files touched
- `src/main.rs` — new `Ready` variant and `cmd_ready` handler
- `tests/integration.rs` — new integration tests