lightspeed/tooling/generator

Deterministic project and resource scaffold generator for M25.

Types

Supported CLI-like generator commands.

pub type Command {
  New(app_name: String)
  GenLive(app_name: String, resource: String)
  GenHtml(app_name: String, resource: String)
  GenJson(app_name: String, resource: String)
  GenAuth(app_name: String)
}

Constructors

  • New(app_name: String)
  • GenLive(app_name: String, resource: String)
  • GenHtml(app_name: String, resource: String)
  • GenJson(app_name: String, resource: String)
  • GenAuth(app_name: String)

One generated file entry.

pub type File {
  File(path: String, content: String)
}

Constructors

  • File(path: String, content: String)

Parse errors for CLI-like command shapes.

pub type ParseError {
  MissingArguments(command: String)
  UnsupportedCommand(command: String)
}

Constructors

  • MissingArguments(command: String)
  • UnsupportedCommand(command: String)

Project

opaque

Project scaffold output.

pub opaque type Project

Values

pub fn app_name(project: Project) -> String

Generated app name.

pub fn auth_contract(project: Project) -> Bool

Validate auth scaffold defaults from M25.

pub fn boot_ci_contract(project: Project) -> Bool

Validate that generated project satisfies baseline boot/CI constraints.

pub fn features(project: Project) -> List(String)

Generated feature labels in stable order.

pub fn file_content(
  project: Project,
  path: String,
) -> option.Option(String)

Read generated file content when present.

pub fn files(project: Project) -> List(File)

Generated files in stable order.

pub fn fixture_signature(project: Project) -> String

Stable fixture signature for reproducible generator outputs.

pub fn fixture_snapshots() -> List(#(String, String))

Deterministic fixture snapshots used by drift guards.

pub const fixture_version: Int
pub fn generate_auth(project: Project) -> Project

Generate a phx.gen.auth-style auth scaffold.

pub fn generate_html(
  project: Project,
  resource: String,
) -> Project

Generate a phx.gen.html-style resource scaffold.

pub fn generate_json(
  project: Project,
  resource: String,
) -> Project

Generate a phx.gen.json-style resource scaffold.

pub fn generate_live(
  project: Project,
  resource: String,
) -> Project

Generate a phx.gen.live-style resource scaffold.

pub fn has_file(project: Project, path: String) -> Bool

Check for a generated file.

pub fn module_name(project: Project) -> String

Generated module name.

pub fn new(app_name: String) -> Project

Build a new project scaffold comparable to phx.new.

M25 baseline deepens output toward production defaults:

  • data scope contracts
  • migration-ready directory layout
  • integration-test scaffolds
  • governance/testing defaults
pub fn parse(args: List(String)) -> Result(Command, ParseError)

Parse CLI-like command args.

Supported shapes:

  • ["new", "<app>"]
  • ["gen.live", "<app>", "<resource>"]
  • ["gen.html", "<app>", "<resource>"]
  • ["gen.json", "<app>", "<resource>"]
  • ["gen.auth", "<app>"]
pub fn parse_error_label(error: ParseError) -> String

Stable parse-error label for fixtures.

pub fn production_contract(project: Project) -> Bool

Validate production-ready scaffold defaults from M25.

pub fn resource_contract(
  project: Project,
  resource: String,
) -> Bool

Validate that generated resource files include migration/integration scaffolds.

pub fn scaffold(command: Command) -> Project

Execute one command into a generated project tree.

pub fn snapshot_signature() -> String

Deterministic snapshot signature over M25 generator fixtures.

Search Document