refactor(io): move persistence and import into improvise-io (improvise-8zh)

Relocate the two I/O module trees into the improvise-io sub-crate
scaffolded in the previous commit:

  git mv src/persistence -> crates/improvise-io/src/persistence
  git mv src/import      -> crates/improvise-io/src/import

The grammar file `improv.pest` moves alongside `persistence/mod.rs`;
the `#[grammar = "persistence/improv.pest"]` attribute resolves relative
to the new crate root and keeps working unchanged.

No path edits inside the moved code: the `crate::model::*`,
`crate::view::*`, `crate::workbook::*`, `crate::format::*`, and
`crate::formula::*` imports inside persistence and import all continue
to resolve because improvise-io's lib.rs re-exports those modules from
improvise-core and improvise-formula, mirroring the pattern improvise-core
uses for `formula`. Verified no `crate::ui::*`, `crate::command::*`,
`crate::draw::*` imports exist in the moved code (per improvise-8zh
acceptance criterion #3).

Main-crate `src/lib.rs` now re-exports `import` and `persistence` from
improvise-io, keeping every `crate::persistence::*` and `crate::import::*`
path in the 4 consumer files (ui/app.rs, ui/effect.rs,
ui/import_wizard_ui.rs, main.rs) resolving unchanged — no downstream
edits needed.

`examples/gen-grammar.rs` had `include_str!("../src/persistence/improv.pest")`;
updated the relative path to the new location under
`crates/improvise-io/src/persistence/`.

Verification:
- cargo check --workspace --examples: clean
- cargo test --workspace: 616 passing (219 main + 190 core + 65 formula + 142 io)
- cargo clippy --workspace --tests: clean
- cargo build -p improvise-io: standalone build succeeds, confirming no
  UI/command leakage into the IO crate (improvise-8zh acceptance #2, #3)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Edward Langley
2026-04-15 23:08:00 -07:00
parent bd17aed169
commit 5807464fc7
9 changed files with 7 additions and 5 deletions

View File

@ -9,7 +9,8 @@
//! Re-exports the core modules under their conventional names so code in
//! this crate can keep using `crate::model::*`, `crate::view::*`,
//! `crate::workbook::*`, `crate::format::*`, and `crate::formula::*` paths.
//!
//! Scaffolded empty in this commit; the modules land in the next commit.
pub use improvise_core::{format, model, view, workbook};
pub use improvise_formula as formula;
pub mod import;
pub mod persistence;

View File

@ -21,7 +21,8 @@ use pest_meta::ast::{Expr, RuleType};
use pest_meta::parser;
use std::collections::HashMap;
const GRAMMAR: &str = include_str!("../src/persistence/improv.pest");
const GRAMMAR: &str =
include_str!("../crates/improvise-io/src/persistence/improv.pest");
fn load_grammar() -> HashMap<String, (RuleType, Expr)> {
let pairs = parser::parse(parser::Rule::grammar_rules, GRAMMAR)

View File

@ -2,9 +2,9 @@ pub mod command;
pub mod draw;
pub use improvise_core::format;
pub use improvise_formula as formula;
pub mod import;
pub use improvise_io::import;
pub use improvise_core::model;
pub mod persistence;
pub use improvise_io::persistence;
pub mod ui;
pub use improvise_core::view;
pub use improvise_core::workbook;