Appearance
Quick Start
Installation
TODO
Initialization
Run loci init in your project root to initialize Loci and prepare the generator structure.
bash
loci initThis creates the following layout:
text
.generators.yml # Generators configuration
loci/
├─ generators/ # Main generators directory
├─ types/ # Custom input types
└─ utils/ # Shared utility classesAll directories under loci/ are automatically loaded via Zeitwerk, so no manual require statements are needed.
Adding Your First Generator
Create a new generator using the loci add command:
bash
loci add backend:controllerThis generates the following structure:
text
loci/
├─ generators/
│ └─ backend/
│ └─ controller/
│ ├─ templates/
│ ├─ controller_generator.rb
│ └─ README.mdGenerators are grouped by their top-level namespace (backend in this example). Namespaces are optional. Generators can also live in the global namespace:
bash
loci add controllerEach generator has its own namespace, so you are free to split its logic across multiple files if needed. Related templates live in the templates/ directory.
The README.md file serves as the detailed generator's documentation. It is used by:
- The CLI help output
loci g backend:controller --help - AI agents
Running a Generator
Run the generator using the loci g command:
bash
loci g backend:controller arg1 arg2 --flag --val fooThis invokes the generator's call method and populates the params object with the parsed inputs. From there, your generator logic executes with validated, structured data.