Animated Circular Progress Bar0
Font.Lokio
Get Started

Introduction

Introduction to Lokio - Uniform CLI in action, diverse in idea


Lokio Documentation#

Welcome to the Lokio documentation — a CLI for building code generators from your own templates.


Table of Contents#

Start Here#

New to Lokio? Start with Getting Started →

Already have a template and want to learn how to use variables? → Template Syntax →

Want to see real examples? → Real-World Examples →


Cheat Sheet#

# Setup
lokio init                          # set up in a new project
lokio doctor                        # check all setup & diagnose issues
 
# Template management
lokio add [name]                    # create a new template
lokio edit <name>                   # edit template configuration
lokio remove <name>                 # delete a template
 
# Generate
lokio g [template] [name]           # generate code
lokio g service User                # generate with name directly
lokio g service --batch file.json   # generate many at once
lokio g --update src/file.ts        # update a single file from the latest template
 
# Sync & validation
lokio diff                          # preview changes (without applying)
lokio sync                          # apply template changes to existing files
lokio check                         # validate file structure against templates
lokio ai                            # validate team standards with AI
 
# Run
lokio run --id <id>                 # execute a predefined shell sequence
 
# Enterprise
lokio pull                          # pull templates from Enterprise Hub

File Structure#

project/
├── lokio.yaml              ← project metadata (commit)
├── lokio.local.yaml        ← AI API key — DO NOT commit (auto-gitignored)
├── lokio.lock              ← generation tracking (commit)
└── lokio/
    ├── configs.yaml        ← all config: templates, check, ai, standards (commit)
    └── templates/
        ├── service.lokio   ← template blueprint (commit)
        └── screen/
            ├── view.lokio
            └── viewmodel.lokio

lokio.local.yaml is automatically added to .gitignore during lokio init — it contains API keys that must not be committed.


Anatomy of lokio/configs.yaml#

One file for all Lokio configuration:

# ─── Templates ────────────────────────────────────────────────────
templates:
  - name: service
    description: NestJS service
    path: service.lokio
    output: src/services/<%= pascalCase(name) %>Service.ts
    parameters:
      - name: name
        type: string
        required: true
        prompt: "Service name:"
 
# ─── Lokio Check ──────────────────────────────────────────────────
check:
  danger_mode: block      # block | warn
 
# ─── AI Standards Check ───────────────────────────────────────────
ai:
  provider: gemini
  model: gemini-2.0-flash
 
standards:
  - id: unit-test
    description: "Every service must have a unit test file"
    severity: danger