Requirements
Section titled “Requirements”| Package | Required | Purpose |
|---|---|---|
oridecon | Yes | Core framework |
oridecon-contracts | Yes | Protocol definitions |
oridecon-web | Yes | Web UI support |
The Problem oridecon-cli Solves
Section titled “The Problem oridecon-cli Solves”Building a Oridecon application involves repeated setup: project scaffolding, code generation, database migrations, and runtime inspection. oridecon-cli automates these tasks through a single oridecon command, using a contributor-based plugin system where packages extend the CLI via oridecon.cli.contributors entry points.
Mental model: Think of oridecon-cli as the framework’s toolbox — one command to create, build, run, and introspect your application.
Core Concepts
Section titled “Core Concepts”- Command groups — commands are organized as sub-Typer apps (
new,run,dev,db,gen,inspect,shell, etc.) - Contributors — packages advertise commands, generators, health checks, shell context, and hooks via
oridecon.cli.contributors; discovered at import with automatic conflict resolution - CLIContext — per-invocation shared state holding config, output mode (Rich/JSON/Quiet), and flags
OutputManager— centralized output with support for Rich formatting, JSON serialization, and debug modes
Full Command Walkthrough
Section titled “Full Command Walkthrough”Scaffolding (new, add)
Section titled “Scaffolding (new, add)”# Create a new project from a templateoridecon new project my-app --template web-api -d ./projects
# Create a project interactivelyoridecon new project my-app -i
# Scaffold a new oridecon-* extension packageoridecon new package my-feature
# Add a provider to an existing projectoridecon add weboridecon add sqlAvailable templates: web-api, full, api.
Dev Server (run, dev)
Section titled “Dev Server (run, dev)”# Auto-detect create_app() and start the serveroridecon run
# Explicit entry pointoridecon run my_app.app:create_app --port 9000 --no-reload
# Development server with hot-reloadoridecon dev --entry src/main.py --port 8000 --env development
# Use a specific server backendoridecon run --server granian
# Run with an MCP SSE server alongsideoridecon run --mcp-port 8080The CLI auto-detects the server backend, preferring Granian → Uvicorn → Hypercorn based on availability.
Database Management (db)
Section titled “Database Management (db)”# Create/upgrade a database and generate an initial migrationoridecon db init
# Auto-generate a migration from schema changesoridecon db migrate -m "add email to users"
# Apply pending migrationsoridecon db upgrade
# Rollback the last migrationoridecon db rollback
# View migration statusoridecon db status
# Seed test dataoridecon db seed
# View migration historyoridecon db listDatabase commands require oridecon-sql to be installed:
uv add oridecon-sqlCode Generation (gen)
Section titled “Code Generation (gen)”# List all available generatorsoridecon gen list
# Generate codeoridecon gen model Useroridecon gen service UserServiceoridecon gen repository UserRepositoryoridecon gen controller UserControllerGenerators are contributed by installed packages. Each generator creates files in the current project’s source tree.
Runtime Inspection (inspect)
Section titled “Runtime Inspection (inspect)”# List registered container providersoridecon inspect providers
# Show HTTP routesoridecon inspect routes
# Display container bindingsoridecon inspect container
# Run health checksoridecon inspect health
# View service listoridecon inspect servicesInteractive Shell (shell)
Section titled “Interactive Shell (shell)”# Start a REPL with the application context pre-loadedoridecon shell
# Plain Python REPL without app bootstraporidecon shell --no-app
# Use IPython if availableoridecon shell --ipythonThe shell provides app, container, config, db, cache, and events as pre-loaded objects.
Other Commands
Section titled “Other Commands”# System informationoridecon system infooridecon version
# Configuration managementoridecon config showoridecon config set default_template=full
# Contributor discoveryoridecon contrib checkoridecon contrib list
# Meta commandsoridecon list # list all commandsoridecon completion # generate shell completionoridecon test # run project testsoridecon lint # run project lintersIntegration with the DI Container
Section titled “Integration with the DI Container”from oridecon import Applicationfrom oridecon.cli import CLIModule, CLIConfigfrom oridecon.cli.di.provider import CLIProvider
# Via module (recommended)app = Application(name="my-app")app.add_module(CLIModule.configure(CLIConfig(default_template="full")))
# Via provider directlyprovider = CLIProvider(config=CLIConfig(verbose=True))app.add_provider(provider)The CLIProvider has priority APPLICATION (40) — it boots after infrastructure but before domain services.
Best Practices
Section titled “Best Practices”- ✅ Run
oridecon gen listto see all available generators from installed packages - ✅ Use
oridecon project test/lintas a pre-commit gate - ✅ Run
oridecon contrib checkto verify contributors load cleanly after adding packages - ✅ Use
--jsonflag for machine-readable output (useful in CI scripts) - ❌ Don’t manually edit generated file headers — re-run the generator instead
- ❌ Don’t use
oridecon runin production — deploy through your ASGI server directly