Commit Graph

6 Commits

Author SHA1 Message Date
Claude (agent-hier) 195f3b44b8 feat(import): a date column imports as one hierarchical category, the flat split a choice (improvise-8jk6.3)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
2026-09-24 22:15:14 -07:00
Edward Langley 1a2952058d Import asks what to do with records that share every coordinate (improvise-cgqt)
When source records collide on every coordinate, the import wizard now asks:
sum them, keep them separate with a generated occurrence category, or go
back. Collisions are found before the build by the same placement pass the
build uses, and are carried to the TUI as structured data (WizardCache) and
listed in full, scrollable. At the 12-category cap, "keep separate" is shown
disabled with its reason and remedy.

Every wizard warning and message now wraps to the panel instead of being
truncated, and long lists scroll.

Headless paths no longer sum silently: `import --no-wizard` takes
`--on-duplicate refuse|sum|separate` (default refuse), and `:import-json`
refuses and points at `:import`.

Reasoning: context/code/formula-and-io.md, "Colliding records are a
question, not a default"; context/code/tui.md; context/code/cli.md §11.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
2026-09-24 18:43:19 -07:00
Edward Langley c43932ad79 style: cargo fmt after the module-doc rewrites
Nine stray blank lines left where a multi-paragraph //! became two lines.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 10:28:03 -07:00
Edward Langley 17ad0f1d1d docs(command): move command/keymap.rs and cmd/** arguments to context/
keymap.rs: the dispatch/registry-vs-table split (this file stays the authority
on it) and the improvise-0hb Sequence-flattening decline, with its three
findings.

cmd/**: the two CommitAndAdvance orderings, CommitSave's mode-change-first,
add_category's deliberate no-coordinate-write, EditOrDrill's mode-agnostic
message choice, the SaveAndQuit and CreateAndSwitchView declines, and fit.rs's
whole module doc including the measured wasm bundle cost.

crates/improvise-command now reports no comment run over two lines.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 10:28:02 -07:00
Edward Langley 6d687a9c19 fix: rework the import wizard step machine (improvise-907)
Three interlocking defects in one mechanism, superseding improvise-gfq,
improvise-o1c and improvise-c6j.

Validate where the user can act. build_model raised "At least one category
must be accepted" only on Enter at NameModel, so an import whose fields all
classify as Measure walked through DefineFormulas and NameModel before
refusing. Preconditions now live in validation_error(), consulted by
advance() on the step that can fix them — joining the category-limit
pre-check improvise-mzv already put there.

Allow going back. No step bound a back key, so reaching a later step and
wanting to change a field kind meant Esc, discarding every proposal toggle,
formula and name. advance() now pushes the step it leaves onto a history
stack and previous() pops it, which retraces the path actually taken through
the conditional transitions instead of re-deriving their reverse. Left is
bound on every step: Backspace is taken by the name and formula buffers, and
h is a printable character NameModel needs.

Make the terminal step real. advance() mapped NameModel -> Done, but nothing
ever called it there, so Done was reachable only from tests that forced it.
Enter at NameModel now builds into the wizard and parks on Done, which shows
the model summary and any import warnings in the panel rather than crammed
into a one-line status bar. Enter accepts, Left and Esc go back, and going
back drops the built workbook so a later accept cannot install stale field
decisions. BuildWizardModel becomes AcceptWizardModel, since it now installs
an already-built workbook rather than building one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V69PGQfMJuGRmtSWpfVAqn
2026-08-29 10:48:48 -07:00
Edward Langley 8e59f1c91b refactor(wizard): move import-wizard key decisions into the command layer (improvise-2wm)
WizardKey::apply was a 126-line step machine: it matched on wizard.step,
mutated wizard state, and swapped view_state.mode, all inside an effect.

The step/key decision is pure, so it moves to a new command/cmd/wizard.rs
as one small key table per step (with the shared j/k/arrow/Esc fallback
factored out). CmdContext gains a read-only `wizard` so the command can
see the step. What is left on the effect side is three discrete
mutations: WizardApply(WizardOp) runs one wizard verb, CloseWizard
dismisses, BuildWizardModel commits the import.

HandleWizardKey also leaves text_buffer.rs, which had no reason to own it.

Behavior is unchanged — the 10 handle_key characterization tests from the
previous commit pass untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 00:21:17 -07:00