Skip to content

Commit 615674f

Browse files
committed
chore: condense core and domain README API sections
Replace verbose impl blocks and function signatures with concise narrative descriptions. Remove implementation details (bounded sizes, dispatch strategy, internal lifecycle functions) from developer-facing docs while preserving the types and traits consumers need.
1 parent e24b194 commit 615674f

File tree

2 files changed

+11
-113
lines changed

2 files changed

+11
-113
lines changed

crates/kanban-core/README.md

Lines changed: 6 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -110,81 +110,15 @@ pub trait Service<T, Id>: Send + Sync {
110110

111111
### Graph
112112

113-
`Graph<E>` — Generic directed graph data structure used for card dependencies:
113+
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.
114114

115-
```rust
116-
pub struct Graph<E: Edge> {
117-
// ...
118-
}
119-
120-
pub trait Edge: Clone + PartialEq {
121-
fn is_acyclic(&self) -> bool;
122-
}
123-
124-
pub trait GraphNode {
125-
fn node_id(&self) -> Uuid;
126-
}
127-
```
128-
129-
- Add/remove edges between nodes
130-
- Automatic cycle detection for acyclic edge types
131-
- Query neighbors, parents, and children by edge type
132-
- Edge direction filtering (`Outgoing`, `Incoming`, `Both`)
133-
134-
### InputState
135-
136-
Cursor-aware text input buffer with correct multi-byte UTF-8 handling:
137-
138-
```rust
139-
pub struct InputState { /* private fields */ }
140-
141-
impl InputState {
142-
pub fn new() -> Self
143-
pub fn insert_char(&mut self, c: char)
144-
pub fn backspace(&mut self)
145-
pub fn move_left(&mut self)
146-
pub fn move_right(&mut self)
147-
pub fn value(&self) -> &str
148-
pub fn cursor_byte_offset(&self) -> usize
149-
}
150-
```
151-
152-
### SelectionState
153-
154-
Generic single-item selection for list navigation:
155-
156-
```rust
157-
pub struct SelectionState { /* private fields */ }
158-
159-
impl SelectionState {
160-
pub fn new() -> Self
161-
pub fn select(&mut self, index: usize)
162-
pub fn selected(&self) -> Option<usize>
163-
pub fn next(&mut self, total: usize)
164-
pub fn prev(&mut self)
165-
pub fn jump_to_first(&mut self)
166-
pub fn jump_to_last(&mut self, total: usize)
167-
pub fn clamp(&mut self, total: usize)
168-
}
169-
```
115+
### State Primitives
170116

171-
### Pagination
117+
UI-agnostic building blocks used by the TUI and available to any consumer:
172118

173-
Viewport pagination with scroll position management:
174-
175-
```rust
176-
pub struct PageInfo {
177-
pub visible_indices: Vec<usize>,
178-
pub items_above: usize,
179-
pub items_below: usize,
180-
}
181-
182-
impl Page {
183-
pub fn new(viewport_height: usize) -> Self
184-
pub fn calculate(&self, total_items: usize, selected: usize) -> PageInfo
185-
pub fn scroll_to_visible(&mut self, index: usize)
186-
}
187-
```
119+
- **`InputState`** — Text input buffer with cursor tracking and multi-byte UTF-8 support
120+
- **`SelectionState`** — Single-item selection for navigable lists (next/prev, jump to first/last, clamp to bounds)
121+
- **`Page` / `PageInfo`** — Viewport pagination that calculates visible items, scroll offset, and above/below counts
188122

189123
## Architecture
190124

crates/kanban-domain/README.md

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -156,30 +156,14 @@ pub trait DependencyGraph {
156156
- Edges referencing a deleted or archived card are automatically cleaned up
157157
- Integrated into board persistence (import/export)
158158

159-
### Card Lifecycle
160-
161-
Pure domain functions for card state transitions:
162-
163-
```rust
164-
pub fn compute_completion_toggle(card: &Card, board: &Board) -> ToggleResult;
165-
pub fn compute_move_to_column(card: &Card, target_column_id: ColumnId, board: &Board) -> MoveResult;
166-
pub fn compute_auto_completion_on_create(column_id: ColumnId, board: &Board) -> CardStatus;
167-
pub fn compact_positions(cards: &mut [Card]);
168-
pub fn next_position_in_column(cards: &[Card], column_id: ColumnId) -> u32;
169-
```
170-
171159
### Sorting & Filtering
172160

173-
**SortBy** — Enum dispatch for card sorting (no dyn dispatch):
161+
**SortBy** — Enum dispatch for card sorting:
174162

175163
```rust
176164
pub enum SortBy {
177165
Points, Priority, CreatedAt, UpdatedAt, Status, Position, CardNumber
178166
}
179-
180-
impl SortBy {
181-
pub fn sort_by(&self, cards: &mut [Card]);
182-
}
183167
```
184168

185169
**CardFilter** trait + concrete filters:
@@ -208,40 +192,20 @@ let cards = CardQueryBuilder::new(&all_cards)
208192
### History & Snapshots
209193

210194
```rust
211-
pub struct HistoryManager { /* bounded undo/redo stacks, max 100 entries */ }
195+
pub struct HistoryManager { /* undo/redo stacks */ }
212196
pub struct Snapshot { /* point-in-time state of all kanban data */ }
213-
214-
impl HistoryManager {
215-
pub fn push_undo(&mut self, snapshot: Snapshot);
216-
pub fn undo(&mut self) -> Option<Snapshot>;
217-
pub fn redo(&mut self) -> Option<Snapshot>;
218-
pub fn can_undo(&self) -> bool;
219-
pub fn can_redo(&self) -> bool;
220-
}
221-
222-
impl Snapshot {
223-
pub fn to_json_bytes(&self) -> KanbanResult<Vec<u8>>;
224-
pub fn from_json_bytes(bytes: &[u8]) -> KanbanResult<Self>;
225-
}
226197
```
227198

199+
`HistoryManager` maintains undo and redo stacks of `Snapshot` values. Each snapshot captures the full board state and can be serialized to/from JSON bytes.
200+
228201
### Export / Import
229202

230203
```rust
231204
pub struct BoardExporter;
232205
pub struct BoardImporter;
233-
234-
impl BoardExporter {
235-
pub fn export_board(board: &Board, ...) -> BoardExport;
236-
pub fn export_all_boards(...) -> AllBoardsExport;
237-
}
238-
239-
impl BoardImporter {
240-
pub fn import(data: &str) -> KanbanResult<ImportedEntities>;
241-
}
242206
```
243207

244-
Supports V1 and V2 format detection with automatic migration.
208+
`BoardExporter` produces single-board or all-boards JSON exports. `BoardImporter` reads JSON with automatic V1/V2 format detection and migration.
245209

246210
## Architecture
247211

0 commit comments

Comments
 (0)