CLI (lexigram-cli)
Command-line interface for Lexigram Framework — project scaffolding, code generation, and development tools.
Overview
Section titled “Overview”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.
Install
Section titled “Install”uv add lexigram-cli# or, as a standalone tool:uv tool install lexigram-cliQuick Start
Section titled “Quick Start”from lexigram import Applicationfrom lexigram.di.module import Module, module
from lexigram.cli import CLIModulefrom 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:
# Create a new web API projectlexigram new project my-api --template web-api
# Scaffold a new extension packagelexigram new package my-feature
# Generate a controllerlexigram gen controller UserController --resource User
# Add the database package to an existing projectlexigram add database --driver postgres
# Start the dev server with hot-reloadlexigram dev startConfiguration
Section titled “Configuration”Zero-config usage: Call
CLIModule.configure()with no arguments to use all defaults.
Option 1 — YAML file
Section titled “Option 1 — YAML file”cli: default_template: "web-api" default_database: "postgres" color: true verbose: falseOption 2 — Profiles + Environment Variables (recommended)
Section titled “Option 2 — Profiles + Environment Variables (recommended)”export LEX_CLI__DEFAULT_TEMPLATE=web-apiexport LEX_CLI__COLOR=trueexport LEX_CLI__VERBOSE=falseOption 3 — Python
Section titled “Option 3 — Python”from lexigram.cli.config import CLIConfigfrom lexigram.cli import CLIModule
config = CLIConfig.from_env_profile()CLIModule.configure(config)Config reference
Section titled “Config reference”| Field | Default | Env var | Description |
|---|---|---|---|
default_template | "web-api" | LEX_CLI__DEFAULT_TEMPLATE | Template used by lexigram new |
default_database | "postgres" | LEX_CLI__DEFAULT_DATABASE | Database driver used by scaffolding |
color | true | LEX_CLI__COLOR | Enable coloured terminal output |
verbose | false | LEX_CLI__VERBOSE | Print verbose/debug output |
Key Features
Section titled “Key Features”- Project scaffolding —
web-api,api, andfulltemplates - 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
Key Source Files
Section titled “Key Source Files”| File | What it contains |
|---|---|
src/lexigram/cli/config.py | CLIConfig configuration dataclass |
src/lexigram/cli/module.py | CLI 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 |