Commit Graph

81 Commits

Author SHA1 Message Date
3c561adf05 chore: clippy send + sync warnings, drop warnings 2026-04-04 10:01:27 -07:00
0db89b1e3a chore: clippy + fmt 2026-04-04 09:59:01 -07:00
d8f7d9a501 feat(commands): add panel cursor and tile selection commands
Add comprehensive command implementations for managing panel cursors
(formula_cursor, cat_panel_cursor, view_panel_cursor), tile selection,
text buffers, and search functionality.

Update EnterEditMode to use SetBuffer effect before changing mode.
Update EnterTileSelect to use SetTileCatIdx effect before changing mode.

Add keymap bindings for all new modes with navigation (arrows/hjkl),
editing actions (Enter, Backspace, Char), and mode transitions (Esc, Tab).

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
2026-04-04 09:58:31 -07:00
ebe8df89ee refactor(app): wire up keymap dispatch and remove old handlers
Update handle_key to pass key code and modifiers to cmd_context.
Update keymap_set.dispatch to pass search_mode from App state.

Remove old-style panel handlers (handle_edit_key, handle_formula_edit_key,
handle_formula_panel_key, etc.) - approximately 500 lines.

Update handle_command_mode_key to use buffers map for command execution.
All other modes now handled via keymap dispatch.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
2026-04-04 09:58:31 -07:00
5cd3cf3c18 feat(app): add tile_cat_idx and buffers to App state
Add tile_cat_idx field to track selected tile category index.
Add buffers HashMap for named text buffers used in text-entry modes.

Update AppMode::TileSelect to remove nested cat_idx struct.
Update cmd_context to accept key and modifiers parameters.
Update cmd_context to populate new fields from App state.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
2026-04-04 09:58:31 -07:00
e976b3c49a feat(keymap): add AnyChar pattern and new mode variants
Add AnyChar key pattern for text-entry modes that matches any Char key.

Add new mode variants to ModeKey: FormulaPanel, CategoryPanel, ViewPanel,
TileSelect, Editing, FormulaEdit, CategoryAdd, ItemAdd, ExportPrompt,
CommandMode, and SearchMode.

Update Keymap::lookup to fall back to AnyChar for Char keys.
Update KeymapSet::get to accept search_mode parameter.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
2026-04-04 09:58:31 -07:00
b7e4316cef feat(command): add CmdContext extensions and new effects
Add new fields to CmdContext for tracking search mode, panel cursors,
tile category index, named text buffers, and key information.

Add SetBuffer and SetTileCatIdx effects for managing application state.
Update TileBar to accept tile_cat_idx parameter for rendering.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
2026-04-04 09:58:30 -07:00
56839b81d2 fix transient keymap consumption bug
- Fixed transient keymap consumption logic: the transient keymap is now only
  consumed when a match is found.
- Updated handle_key to retain transient keymap if no command matches, allowing
  subsequent key presses to be processed by the main keymap set.
- Added issue noting the previous unintended consumption.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:49 -07:00
67fca18200 tidy method calls
- Reformatted method calls in RemoveFormula and SetAxis for consistency.
- Minor formatting changes to improve readability.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:49 -07:00
387190c9f7 overhaul keymap handling and remove pending key
- Updated imports to include Arc and removed KeyModifiers.
- Replaced pending_key with transient_keymap and keymap_set.
- Added KeymapSet for mode-specific keymaps.
- Removed legacy pending key logic and many helper methods.
- Updated tests to use new command execution pattern.
- Adjusted App struct and methods to align with new keymap system.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:49 -07:00
dfae4a882d tidy apply_config_to_pipeline signature
- Combined function signature into a single line for readability.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:49 -07:00
9afa13f78a improve error formatting
- Added missing comma in error message for set-cell command.
- Reformatted error messages for consistency.
- Minor formatting changes to improve readability.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:49 -07:00
bfc30cb7b2 overhaul keymap API and add Debug
- Replaced ModeKey with direct KeyPattern keys.
- Stored bindings as Arc<dyn Cmd> for cheap sharing.
- Added Debug implementation for Keymap.
- Updated bind, bind_cmd, bind_prefix, lookup, and dispatch signatures.
- Introduced PrefixKey command and SetTransientKeymap effect.
- Added KeymapSet for mode-specific keymaps.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:49 -07:00
c188ce3f9d add panel toggling and new command implementations
- Implemented a suite of new commands for panel visibility, editing, export
  prompts, search navigation, page cycling, and grid operations.
- Updated tests to cover new command behavior.
- Adjusted command context usage accordingly.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:48 -07:00
f2bb8ec2a7 update CmdContext and imports
- Updated imports to include Panel and Axis.
- Added new fields to CmdContext: formula_panel_open, category_panel_open,
  view_panel_open.
- Reformatted effect vectors for consistency.
- Minor formatting changes to improve readability.

Co-Authored-By: fiddlerwoaroof/git-smart-commit (gpt-oss:20b)
2026-04-04 09:31:48 -07:00
f7436e73ba refactor: add Keymap with default bindings and wire into handle_key
Create keymap.rs with Keymap struct mapping (mode, key) to Cmd trait
objects. Wire into App::handle_key — keymap dispatch is tried first,
falling through to old handlers for unmigrated bindings. Normal mode
navigation, cell ops, mode switches, and Help mode are keymap-driven.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:40:36 -07:00
0c751b7b8b refactor: add Cmd trait with CmdContext and first command implementations
Define Cmd trait (execute returns Vec<Box<dyn Effect>>) and CmdContext
(read-only state snapshot). Implement navigation commands (MoveSelection,
JumpTo*, ScrollRows), mode commands (EnterMode, Quit, SaveAndQuit),
cell operations (ClearSelectedCell, YankCell, PasteCell), and view
commands (TransposeAxes, Save, EnterSearchMode).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:38:56 -07:00
9421d01da5 refactor: add Effect trait and apply_effects infrastructure
Define Effect trait in ui/effect.rs with concrete effect structs for
all model mutations, view changes, navigation, and app state updates.
Each effect implements apply(&self, &mut App). Add App::apply_effects
to apply a sequence of effects. No behavior change yet — existing
key handlers still work as before.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:36:44 -07:00
567ca341f7 feat: Forth-style prefix command parser
Replace JSON command syntax with prefix notation: `word arg1 arg2`.
Multiple commands per line separated by `.`. Coordinate pairs use
`Category/Item`. Quoted strings for multi-word values. set-cell
uses value-first: `set-cell 100 Region/East Measure/Revenue`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 22:14:37 -07:00
6647be30fa refactor: switch to clap with subcommands for CLI parsing
Replace hand-rolled arg parser with clap derive. Restructure as
subcommands: import, cmd, script. Import subcommand supports
--category, --measure, --time, --skip, --extract, --axis, --formula,
--name, --no-wizard, and --output flags for configurable imports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 21:43:16 -07:00
ac0c538c98 feat: adjust arg processing so script+command modes are exclusive 2026-04-03 20:32:55 -07:00
4233d3fbf4 feat: wizard UI for date config and formula steps
Add key handling for ConfigureDates (space toggle components) and
DefineFormulas (n new, d delete, text input mode) wizard steps.
Render date component toggles, formula list with input area, and
sample formulas derived from detected measures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 13:41:18 -07:00
a73fe160c7 feat: date parsing, component extraction, and wizard formulas
Extend FieldProposal with chrono-based date format detection and
configurable component extraction (Year, Month, Quarter). Add
ConfigureDates and DefineFormulas wizard steps to ImportPipeline.
build_model injects derived date categories and parses formula strings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 13:41:05 -07:00
5a251a1cbe feat: add Axis::None for hidden dimensions with implicit aggregation
Categories on the None axis are excluded from the grid and cell keys.
When evaluating cells, values across hidden dimensions are aggregated
using a per-measure function (default SUM). Adds evaluate_aggregated
to Model, none_cats to GridLayout, and 'n' shortcut in TileSelect.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 16:38:35 -07:00
dd728ccac8 feat: multiple-CSV import 2026-04-02 16:21:45 -07:00
edd6431444 refactor: use data_col_to_visual via group_for helpers, add column group toggle
Add row_group_for/col_group_for to GridLayout, replacing inline
backward-search logic. Refactor grid renderer to use col_group_for
instead of pre-filtering col_items. Add gz keybinding for column
group collapse toggle, symmetric with z for rows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 10:22:00 -07:00
5136aadd86 fix: remove tests for top_level_groups 2026-04-02 10:18:32 -07:00
b9da06c55f fix: csv_parser tests 2026-04-02 10:18:01 -07:00
edd33d6dee chore: cleanup dead code in category.rs 2026-04-02 10:07:49 -07:00
2c9d9c7de7 chore: move csv_path_p, restructure modules 2026-04-02 10:01:51 -07:00
fe74cc5fcb chore: clippy + fmt 2026-04-02 09:35:02 -07:00
1d5edd2c09 fix: handle PathBuf correctly 2026-04-01 22:16:56 -07:00
da93145de5 refactor: introduce draw module 2026-04-01 08:54:22 -07:00
fcfdc09732 chore: cargo fmt 2026-04-01 01:37:40 -07:00
23e26f0e06 Add CSV import functionality
- Use csv crate for robust CSV parsing (handles quoted fields, empty values, \r\n)
- Extend --import command to auto-detect format by file extension (.csv or .json)
- Reuse existing ImportPipeline and analyzer for field type detection
- Categories detected automatically (string fields), measures for numeric fields
- Updated help text and welcome screen to mention CSV support

All 201 tests pass.
2026-04-01 01:37:04 -07:00
2cf1123bcb refactor: cleanup main.rs 2026-04-01 01:35:43 -07:00
bbfd2dc163 refactor: TuiGuard -> TuiContext 2026-03-31 22:05:02 -07:00
85eabebd88 refactor: extract terminal setup/teardown 2026-03-31 21:27:40 -07:00
22ea265b63 refactor: inline print_usage 2026-03-31 20:59:39 -07:00
dda5571faf refactor: inline run_headless 2026-03-31 20:58:43 -07:00
c32e800128 refactor: split main code paths for clarity. 2026-03-31 20:52:28 -07:00
aae8392f46 refactor: continue simplifying entrypoint 2026-03-31 20:15:20 -07:00
183b2350f7 chore: reformat
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 00:07:22 -07:00
37584670eb feat: group-aware grid rendering and hide/show item
Builds out two half-finished view features:

Group collapse:
- AxisEntry enum distinguishes GroupHeader from DataItem on grid axes
- expand_category() emits group headers and filters collapsed items
- Grid renders inline group header rows with ▼/▶ indicator
- `z` keybinding toggles collapse of nearest group above cursor

Hide/show item:
- Restore show_item() (was commented out alongside hide_item)
- Add HideItem / ShowItem commands and dispatch
- `H` keybinding hides the current row item
- `:show-item <cat> <item>` command to restore hidden items
- Restore silenced test assertions for hide/show round-trip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 00:07:11 -07:00
866a6ff589 chore: more cleaning 2026-03-30 23:55:08 -07:00
af0b2c6fdd refactor: more entrypoint simplifications
initial model calculated in its own function
2026-03-30 23:37:04 -07:00
3e3ac05b05 refactor: cleanup entry point 2026-03-30 23:30:57 -07:00
4fb97c89ed fix(tests): restore coverage for toggle_group_collapse, item group, and insertion order
Rewrites three commented-out tests to access public fields directly
instead of the removed item_by_name/item_index/is_group_collapsed methods:
- add_item_in_group_sets_group: uses items.get()
- item_index_reflects_insertion_order: uses items.get_index_of()
- toggle_group_collapse_toggles_twice + involutive proptest: inspect collapsed_groups directly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 23:08:06 -07:00
226029bc68 fix(tests): restore persistence round-trip assertions using items.get()
The two tests were previously silenced when item_by_name was removed.
Rewrites them using category.items.get() directly, restoring coverage
of item-name and item-group serialization round-trips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 23:02:48 -07:00
a1b17dc9af refactor: remove dead code, replace sum_matching tests with evaluate()
Removes unused methods (sum_matching, get_mut, item_by_name, item_index,
top_level_groups, is_group_collapsed, show_item) and unused constants
(LABEL_THRESHOLD, MIN_COL_WIDTH).

The sum_matching tests in model.rs were bypassing the formula evaluator
entirely. Replaced them with equivalent tests that call evaluate() against
the existing Total = SUM(Revenue) formula, exercising the real aggregation
code path.

Also fixes a compile error in view.rs prop_tests where View/Axis imports
and a doc comment were incorrectly commented out.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 22:56:04 -07:00