Skip to main content

Crate gize_generator

Crate gize_generator 

Source
Expand description

Code generation engine for Gize.

Two responsibilities:

  1. Turn gize_core specs into file contents (via gize_templates).
  2. Write those files safely — never clobbering user code without --force, and supporting --dry-run (ADR-012).

Re-exports§

pub use plan::FileOp;
pub use plan::OpKind;
pub use plan::Plan;
pub use plugin::GenContext;
pub use plugin::Generator;
pub use registry::Edit;
pub use registry::register_module;
pub use writer::Options;
pub use writer::Report;
pub use writer::Writer;

Modules§

diff
Model-change migration diffing (ADR-011 revision).
plan
A Plan is the set of file operations a generator wants to perform. Building the plan is pure (no I/O), which makes generators easy to test and makes --dry-run trivial: we simply render the plan instead of applying it.
plugin
Plugin API v0 (ADR-008) — unstable.
registry
Idempotent edits to “registry” files — the ones gize make app must update in place rather than create: src/app/mod.rs (module + route wiring).
scaffold
High-level generators. Each returns a pure Plan; applying it is the [Writer]’s job. This separation keeps generation testable and makes --dry-run free.
sync
Reconciliation for gize sync (ADR-009): compare a desired Plan against the filesystem and classify each file as missing, drifted (present but different), or unchanged. Applying is conservative — missing files are created, but a drifted file is never overwritten without --force, so hand edits are safe (roadmap risk: destructive sync). Directories in the plan are implicit and ignored here.
writer
Applies a Plan to the filesystem, honouring the Gize safety model (ADR-012): never overwrite an existing file unless force is set, and write nothing at all when dry_run is set.