diff --git a/context/repo-map.md b/context/repo-map.md index 98befb9..1b43c03 100644 --- a/context/repo-map.md +++ b/context/repo-map.md @@ -2,8 +2,9 @@ Terminal pivot-table modeling app. Rust, Ratatui TUI, command/effect architecture. Cargo workspace, Apache-2.0, edition 2024. Root package `improvise` v0.1.0-rc2. -Library + binary crate: `src/lib.rs` exports public modules, `src/main.rs` is the CLI entry. +Library + binary crate: `src/lib.rs` re-exports public modules (many from sub-crates), `src/main.rs` is the CLI entry. Sub-crates live under `crates/`: +- `crates/improvise-core/` — pure-data core: `Model`, `View`, `Workbook`, and number formatting. Depends on `improvise-formula`. Re-exported from the main crate so `crate::model`, `crate::view`, `crate::workbook`, `crate::format` still resolve everywhere. Has no awareness of UI, I/O, or commands — builds standalone via `cargo build -p improvise-core`. - `crates/improvise-formula/` — formula parser, AST (`Expr`, `BinOp`, `AggFunc`, `Formula`, `Filter`), `parse_formula`. Re-exported as `crate::formula` from the main crate via `pub use improvise_formula as formula;`. --- @@ -376,30 +377,44 @@ Import flags: `--category`, `--measure`, `--time`, `--skip`, `--extract`, `--axi Lines / tests / path — grouped by layer. -### Model layer +### Core crate layers (sub-crate `improvise-core` under `crates/`) +All of `model/`, `view/`, `workbook.rs`, `format.rs` now live under +`crates/improvise-core/src/`. Paths below are relative to that root. +The main crate re-exports each as `crate::model`, `crate::view`, +`crate::workbook`, `crate::format` via `src/lib.rs`, so every +consumer path stays unchanged. + +#### Model layer ``` -1692 / 66t model/types.rs Model struct, formula eval, CRUD, MAX_CATEGORIES=12 - 621 / 28t model/cell.rs CellKey (canonical sort), CellValue, DataStore (interned) - 216 / 6t model/category.rs Category, Item, Group, CategoryKind +2062 / 70t model/types.rs Model struct, formula eval, CRUD, MAX_CATEGORIES=12 + 650 / 28t model/cell.rs CellKey (canonical sort), CellValue, DataStore (interned, sort_by_key) + 222 / 6t model/category.rs Category, Item, Group, CategoryKind 79 / 3t model/symbol.rs Symbol interning (SymbolTable) 6 / 0t model/mod.rs ``` -### Formula layer (sub-crate `improvise-formula` under `crates/`) +#### View layer ``` - 776 / 35t crates/improvise-formula/src/parser.rs Recursive descent parser → Formula AST - 77 / 0t crates/improvise-formula/src/ast.rs Expr, BinOp, AggFunc, Formula, Filter (data only) - 5 / 0t crates/improvise-formula/src/lib.rs -``` - -### View layer -``` -1013 / 23t view/layout.rs GridLayout (pure fn of Model+View), records mode, drill - 521 / 28t view/types.rs View config (axes, pages, hidden, collapsed, format) +1140 / 24t view/layout.rs GridLayout (pure fn of Model+View), records mode, drill + 531 / 28t view/types.rs View config (axes, pages, hidden, collapsed, format), none_cats() 21 / 0t view/axis.rs Axis enum {Row, Column, Page, None} 7 / 0t view/mod.rs ``` +#### Workbook + format (top-level in improvise-core) +``` + 259 / 11t workbook.rs Workbook wraps Model + views; cross-slice category/view ops + 229 / 29t format.rs format_f64, parse_number_format (display-only rounding) + 12 / 0t lib.rs Module declarations + `pub use improvise_formula as formula;` +``` + +### Formula layer (sub-crate `improvise-formula` under `crates/`) +``` + 776 / 65t crates/improvise-formula/src/parser.rs PEG parser (pest) → Formula AST + 77 / 0t crates/improvise-formula/src/ast.rs Expr, BinOp, AggFunc, Formula, Filter (data only) + 5 / 0t crates/improvise-formula/src/lib.rs +``` + ### Command layer ``` command/cmd/ Cmd trait, CmdContext, CmdRegistry, 40+ commands