kanban-cli
CLI entry point for the kanban workspace. Parses commands with clap, loads a CliContext wrapping KanbanContext, and emits JSON to stdout.
Usage
File selection priority (TUI launches the choose-storage dialog when none of these is set):
- Positional
FILEargument KANBAN_FILEenvironment variable- Config file
storage_location
Successful commands write a CliResponse JSON envelope to stdout. Every failure after argument parsing, whether it happened during startup or inside a command handler, writes exactly one CliResponse envelope with success: false to stderr. Argument-parsing errors are reported by clap as plain text with exit code 2, and --help / --version print to stdout with exit code 0.
Command Reference
board
column
--board is required when the column is given by name, because column names
are not unique across boards; it is ignored when the column is a UUID.
card
# CRUD
|||done
--column by name requires --board, for the same reason as column get
above; it is ignored when --column is a UUID. --sprint by name or number
requires --board, for the same reason as sprint get below; it is ignored
when --sprint is a UUID.
# Movement & archiving
# Sprint
# Git
# Bulk operations
Card identifier resolution: <ID_OR_IDENTIFIER> accepts:
- A full UUID:
550e8400-e29b-41d4-a716-446655440000 - A prefix+number identifier:
KAN-5 - If ambiguous, the command prints all matching cards and exits with error
sprint
--board is required whenever the sprint is given by name or number rather
than UUID; it scopes --from on carry-over (--to resolves on the same
board as --from).
relation
Manage parent / child relationships between cards. All four subcommands
accept UUIDs or short identifiers (e.g. KAN-5). Cross-board parent /
child relations are permitted.
add and remove are atomic: the entire multi-child batch is committed
or rolled back as a single transaction. A mid-list failure (cycle,
self-reference, duplicate, unknown card) leaves both in-memory and
on-disk state unchanged. Error messages name the offending parent and
child via the shared messages::* helpers (e.g.
"cycle detected: making KAN-5 a parent of KAN-7 would create a cycle").
--sort accepts card-number / priority / points / created-at / updated-at / status / position. --order accepts asc / desc. Default:
--sort card-number --order asc.
init
Create a board file and an initial board, then exit without opening the TUI.
FILE— target file path (default: uses KANBAN_FILE env var, then config storage_location, then boards.json)--board— name of the first board to create. Omit to create an empty file.
Examples:
KANBAN_FILE=work.json
Top-level commands
|||
migrate moves all data from one storage backend to another:
SOURCE— path to the source fileBACKEND— target backend:jsonorsqlite-o, --output— output path (default: source filename with the new backend's extension)--source-backend— override auto-detection of the source format
# JSON → SQLite
# SQLite → JSON with explicit output path
# Source format cannot be detected from extension
Output Format
All commands emit JSON to stdout:
[
{
}
{
}
Bulk operations emit a BatchOperationResult:
Shell Completions
Environment Variables
| Variable | Description |
|---|---|
KANBAN_FILE |
Default data file path |
EDITOR |
External editor for description editing (TUI) |
Position in the workspace
graph TD
PER[kanban-persistence]
BE[kanban-backend] --> PER
JSON[kanban-persistence-json] --> BE
SQL[kanban-persistence-sqlite] --> BE
SVC[kanban-service] --> PER
SVC --> BE
TUI[kanban-tui] --> SVC
CLI[kanban-cli] --> PER
CLI --> BE
CLI --> SVC
CLI -.->|feature: json, default-on| JSON
CLI -.->|feature: sqlite, default-on| SQL
CLI -.->|feature: tui, default-on| TUI
Solid arrows are normal ([dependencies]) edges; dotted arrows are
feature-gated (all three optional features are on by default, so a plain
cargo build/cargo install kanban-cli pulls all of them — --no-default-features --features sqlite builds a JSON-less, TUI-less binary). This is the
KAN-1027 shape: kanban-cli, not kanban-service, registers the concrete
backends (kanban-persistence-json, kanban-persistence-sqlite) it ships
with. See the root README for the full workspace
dependency graph.
Dependencies
| Crate | Purpose |
|---|---|
kanban-service |
KanbanContext, all domain operations |
kanban-core |
Shared types, config |
kanban-domain |
Domain models |
kanban-persistence |
PersistenceStore, StoreRegistry |
kanban-backend |
KanbanBackend, KanbanBackendRegistry |
kanban-persistence-json (optional, feature json, default-on) |
JSON backend, registered at startup |
kanban-persistence-sqlite (optional, feature sqlite, default-on) |
SQLite backend, registered at startup |
kanban-tui (optional, feature tui, default-on) |
TUI launch |
clap + clap_complete |
CLI argument parsing, shell completions |
tokio |
Async runtime |
serde + serde_json |
JSON output formatting |
tracing + tracing-subscriber |
Structured logging |
anyhow + thiserror |
Error handling |
Related crates
Used by: none — kanban-cli is a binary entry point, not a library dependency of any other workspace crate.