Dokumentasi Lokio#
Selamat datang di dokumentasi Lokio — CLI untuk membuat code generator dari template kamu sendiri.
Daftar Isi#
| # | Halaman | Isi |
|---|---|---|
| 1 | Getting Started | Instalasi, inisialisasi, template pertama, generate pertama |
| 2 | Template Syntax | Variabel, casing, kondisi (if/else), loop, komentar |
| 3 | Parameters | Tipe input: text, boolean, number, pilihan dari daftar |
| 4 | Commands | Referensi semua perintah CLI |
| 5 | Run | Definisikan dan jalankan urutan perintah shell dari config |
| 6 | Fitur Lanjutan | Multi-file, hooks, sync, diff, check, AI, lock file |
| 7 | Contoh Nyata | React, NestJS, Go, Flutter, batch generate |
Mulai dari Sini#
Baru pertama kali? Mulai dari Getting Started →
Sudah punya template dan ingin tahu cara pakai variabel? → Template Syntax →
Ingin lihat contoh langsung? → Contoh Nyata →
Cheat Sheet#
# Setup
lokio init # setup di project baru
lokio doctor # cek semua setup & diagnosa masalah
# Template management
lokio add [nama] # buat template baru
lokio edit <nama> # edit konfigurasi template
lokio remove <nama> # hapus template
# Generate
lokio g [template] [name] # generate kode
lokio g service User # generate dengan nama langsung
lokio g service --batch file.json # generate banyak sekaligus
lokio g --update src/file.ts # update satu file dari template terbaru
# Sync & validasi
lokio diff # preview perubahan (tanpa apply)
lokio sync # terapkan perubahan template ke file lama
lokio check # validasi struktur file sesuai template
lokio ai # validasi standar tim dengan AI
# Run
lokio run --id <id> # jalankan urutan perintah shell yang sudah didefinisikan
# Enterprise
lokio pull # tarik template dari Enterprise HubStruktur File#
project/
├── lokio.yaml ← metadata project (commit)
├── lokio.local.yaml ← API key AI — JANGAN commit (auto-gitignored)
├── lokio.lock ← tracking generate (commit)
└── lokio/
├── configs.yaml ← semua config: templates, check, ai, standards (commit)
└── templates/
├── service.lokio ← blueprint template (commit)
└── screen/
├── view.lokio
└── viewmodel.lokio
lokio.local.yamlotomatis ditambahkan ke.gitignoresaatlokio init— berisi API key yang tidak boleh di-commit.
Anatomi lokio/configs.yaml#
Satu file untuk semua konfigurasi Lokio:
# ─── 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: "Nama service:"
# ─── Lokio Check ──────────────────────────────────────────────────
check:
danger_mode: block # block | warn
# ─── AI Standards Check ───────────────────────────────────────────
ai:
provider: gemini
model: gemini-2.0-flash
standards:
- id: unit-test
description: "Setiap service harus punya file unit test"
severity: danger