kanban-core
Foundation crate providing core abstractions, error handling, and result types for the kanban workspace.
Installation
Add to your Cargo.toml:
[]
= { = "../kanban-core" }
API Reference
Result Type
pub type KanbanResult<T> = ;
Standard result type used throughout the workspace for consistent error handling.
Errors
KanbanError enum with variants:
Connection(String)- Connection/network errorsNotFound(String)- Resource not foundValidation(String)- Input validation failuresIo(std::io::Error)- File system and I/O errorsSerialization(String)- JSON/serde errorsInternal(String)- Unexpected internal errorsConflictDetected { path, source }- File modified by another instanceCycleDetected- Adding an edge would create a circular dependencySelfReference- Self-referencing edge not allowedEdgeNotFound- Graph edge not found
Configuration
AppConfig - Cross-platform application configuration:
Loads from platform-specific paths:
- macOS/Linux:
~/.config/kanban/config.toml - Windows:
%APPDATA%\kanban\config.toml
Logging
Loggable trait for entities to maintain audit logs:
Traits
Editable Pattern - Safe entity modification via DTOs:
Consuming crates implement Editable<Card>, Editable<Board>, etc. to provide type-safe updates with validation.
Repository Pattern - Generic async data access:
Service Pattern - Business logic abstraction:
Graph
Generic directed graph (Graph<E>) for modeling relationships between entities. Used by kanban-domain for card dependencies. Edge types implement the Edge trait, which declares whether cycles are allowed — the graph enforces DAG constraints automatically for acyclic edge types.
State Primitives
UI-agnostic building blocks used by the TUI and available to any consumer:
InputState— Text input buffer with cursor tracking and multi-byte UTF-8 supportSelectionState— Single-item selection for navigable lists (next/prev, jump to first/last, clamp to bounds)Page/PageInfo— Viewport pagination that calculates visible items, scroll offset, and above/below counts
Architecture
Foundation layer with no workspace dependencies. All other crates depend on kanban-core for shared abstractions and error types.
kanban-core (foundation)
↑
└── kanban-domain, kanban-tui, kanban-cli
Examples
Error Handling
use ;
async
Configuration
use AppConfig;
let config = load.await?;
let prefix = config.default_card_prefix.unwrap_or;
Implementing Editable
use Editable;
Dependencies
thiserror- Ergonomic error handling macrosanyhow- Context-aware error handlingserde,serde_json- Serialization frameworkuuid- UUID generation for IDschrono- Date and time typesasync-trait- Async trait method supporttoml- Configuration file parsingdirs- Cross-platform directory paths
License
Apache 2.0 - See LICENSE.md for details