Skip to content
GitHubDiscord

CLI (lexigram-cli)

Command-line interface for Lexigram Framework — project scaffolding, code generation, and development tools.


The lexigram CLI provides project scaffolding, code generation, development tooling, and administrative commands for every stage of the application lifecycle. It uses a contributor-based plugin system so other packages can extend the CLI with new commands and generators.


Terminal window
uv add lexigram-cli
# or, as a standalone tool:
uv tool install lexigram-cli
from lexigram import Application
from lexigram.di.module import Module, module
from lexigram.cli import CLIModule
from lexigram.cli.config import CLIConfig
@module(imports=[CLIModule.configure(CLIConfig())])
class AppModule(Module):
pass
app = Application(modules=[AppModule])
if __name__ == "__main__":
app.run()

Or use the CLI directly:

Terminal window
# Create a new web API project
lexigram new project my-api --template web-api
# Scaffold a new extension package
lexigram new package my-feature
# Generate a controller
lexigram gen controller UserController --resource User
# Add the database package to an existing project
lexigram add database --driver postgres
# Start the dev server with hot-reload
lexigram dev start

Zero-config usage: Call CLIModule.configure() with no arguments to use all defaults.

application.yaml
cli:
default_template: "web-api"
default_database: "postgres"
color: true
verbose: false
Section titled “Option 2 — Profiles + Environment Variables (recommended)”
Terminal window
export LEX_CLI__DEFAULT_TEMPLATE=web-api
export LEX_CLI__COLOR=true
export LEX_CLI__VERBOSE=false
from lexigram.cli.config import CLIConfig
from lexigram.cli import CLIModule
config = CLIConfig.from_env_profile()
CLIModule.configure(config)
FieldDefaultEnv varDescription
default_template"web-api"LEX_CLI__DEFAULT_TEMPLATETemplate used by lexigram new
default_database"postgres"LEX_CLI__DEFAULT_DATABASEDatabase driver used by scaffolding
colortrueLEX_CLI__COLOREnable coloured terminal output
verbosefalseLEX_CLI__VERBOSEPrint verbose/debug output
  • Project scaffoldingweb-api, api, and full templates
  • Package generation — scaffold new lexigram-* extension packages
  • Code generators — 32+ generators (controller, service, model, provider, event, etc.)
  • Contributor system — extensible plugin architecture for new commands
  • Shell completion — bash, zsh, and fish completion scripts
FileWhat it contains
src/lexigram/cli/config.pyCLIConfig configuration dataclass
src/lexigram/cli/module.pyCLI module assembly
src/lexigram/cli/commands/All CLI command implementations
src/lexigram/cli/generators/Code generation logic
src/lexigram/cli/registry/Registry subsystems
src/lexigram/cli/contributors/Plugin contributor system