CLI commands

Every gize command: what it generates, when to reach for it, and the flags it takes. The CLI follows the verb–subcommand shape defined in ADR-012.

Global flags

These apply to every generating command (gize new and gize make …). Generation is safe by default: nothing is overwritten unless you ask.

--dry-runPrint the planned file operations (create / skip / update) and write nothing.
--forceOverwrite files that already exist; without it, existing files are skipped.

Commands

gize new <name>Available

Scaffolds a new project into a directory named <name>: a compiling, servable app in seconds.

  • Writes Cargo.toml, gize.toml, .env.example, .gitignore and the full src/ layout (app, config, database, middleware, shared, router.rs, state.rs, main.rs).
  • By default also generates a built-in users resource (model, full CRUD and a migration with an is_admin flag) already wired into app/mod.rs and gize.toml.
  • Pass --no-user to scaffold the bare skeleton without the users resource.
Example $ gize new shop
gize make app <name>Available

Creates an application module and wires it into the project.

  • Generates the nine module files (mod, model, dto, repository, service, handler, routes, error, tests) with a placeholder route.
  • Registers mod <name>; and .merge(<name>::routes()) in src/app/mod.rs and adds the module to gize.toml. All of this is idempotent, so re-running is a no-op.
Example $ gize make app products
gize make model <Name> field:Type …Available

Generates a model struct and its CREATE TABLE migration from inline field definitions.

  • model.rs is an sqlx::FromRow struct; an id: Uuid primary key and created_at / updated_at timestamps are added for you.
  • The table and module name are the pluralized snake_case of the model (User → users).
Example $ gize make model User name:String email:String
gize make crud <Name> field:Type …Available

The headline command: a complete, wired vertical slice for a resource.

  • Generates model, dto, repository (SQLx), service, handler (Axum), routes, a typed error, tests and the migration.
  • Registers the module in app/mod.rs and gize.toml, exposing working GET/POST/PUT/DELETE endpoints backed by the database.
Example $ gize make crud Product name:String price:i32 active:bool
gize make migration [name]Available

Creates a blank, timestamped SQL migration to fill in by hand.

  • The escape hatch for changes the model-driven generator does not cover: indexes, constraints, data backfills, column changes.
  • Model-driven CREATE TABLE files come from make model / make crud instead.
Example $ gize make migration add_index_to_users
gize make admin <Name>Planned

Will generate an admin UI (List / Create / Edit / Show / Delete) for a model.

  • Planned for the Beta phase: not implemented yet; the command reports its planned behaviour.
Example $ gize make admin Product
gize migrate [--status]Available

Applies pending SQL migrations from migrations/*.sql against DATABASE_URL.

  • Uses the SQLx migrator, which records applied versions in _sqlx_migrations, ordered and idempotent. There is no risky runtime auto-migration.
  • Pass --status to list applied [x] versus pending [ ] migrations instead of applying them.
Example $ gize migrate --status
gize serveAvailable

Builds and runs the generated application via cargo run, streaming its logs.

  • Reads DATABASE_URL and PORT (default 8080) from the environment.
Example $ gize serve
gize syncPlanned

Will reconcile the project from gize.toml.

  • Planned for the Alpha phase: idempotent, dry-run first. Not implemented yet.
Example $ gize sync
gize doctorAvailable

Sanity-checks your environment and project.

  • Reports cargo / rustfmt availability, whether you are inside a Gize project (gize.toml), and whether DATABASE_URL is set.
Example $ gize doctor
gize fmtAvailable

Formats the project with rustfmt, a thin wrapper around cargo fmt --all.

  • Runs across the whole workspace so generated and hand-written code stay consistent.
Example $ gize fmt
gize checkAvailable

Lints the project with clippy, denying warnings.

  • Wraps cargo clippy --all-targets -- -D warnings, the same quality gate CI enforces.
Example $ gize check

Safe by default: existing files are skipped unless you pass --force, and --dry-run previews the full plan without writing anything. Registry edits to app/mod.rs and gize.toml are idempotent.