CLI Reference
Complete reference for all kythia-core command-line tools — database migrations, i18n, and developer utilities.
Kythia Core ships with a powerful CLI built on commander. Every command is accessible via npx kythia.
npx kythia --help # List all available commands
npx kythia --version # Show installed version
npx kythia about # Show full package info and links
Database Commands
migrate
Runs all pending database migrations across every enabled addon.
npx kythia migrate [options]
| Flag | Description |
|---|---|
-f, --fresh |
[DESTRUCTIVE] Drop all tables and re-run everything |
-r, --rollback |
Rollback the last batch of migrations only |
flowchart TD
A([npx kythia migrate]) --> B[Load kythia.config.js from CWD]
B --> C[Scan addons/*/database/migrations\nskip disabled addons]
C --> D[Sort migration files\nby timestamp in filename]
D --> E{--fresh flag?}
E -- Yes --> F[DROP all tables\nWARNING: destroys data]
F --> G[Run all migrations up\nin sorted order]
E -- No --> H{--rollback flag?}
H -- Yes --> I[Run last batch down\nvia umzug storage]
H -- No --> J[Compare with migrations table\nfind pending]
J --> G
G --> K[Record batch number\nfor future rollback]
K --> L([Done])
style F fill:#c0392b,color:#fff
style I fill:#e67e22,color:#fff
style L fill:#27ae60,color:#fff
--fresh destroys all data. Never use in production without a complete database backup.make:migration
npx kythia make:migration --name <name> --addon <addon>
Creates a timestamped migration file in addons/{addon}/database/migrations/. Always implement the down method for safe rollbacks.
make:model
npx kythia make:model --name <ModelName> --addon <addon>
Scaffolds a new KythiaModel class with hybrid-caching static methods already included.
make:seeder / db:seed
npx kythia make:seeder <name> --addon <addon>
npx kythia db:seed [--class <SeederName>] [--addon <addon>]
cache:clear
Flushes the Redis cache. If REDIS_URLS contains multiple instances, prompts you to choose which to clear.
npx kythia cache:clear
Localization Commands
lang:translate
AI-translates your en.json into another language using Google Gemini.
flowchart LR
A[Read en.json\nsource file] --> B[Connect to Gemini API\nvia GEMINI_API_KEYS]
B --> C[Translate all keys\npreserving JSON structure]
C --> D[Write to lang/target.json]
D --> E([Done])
npx kythia lang:translate --target id # Indonesian
npx kythia lang:translate --target ja # Japanese
npx kythia lang:translate --target zh # Chinese
lang:check
Static-analysis linter using Babel AST parsing — finds all t('key') calls in your codebase and checks them against your locale JSON.
npx kythia lang:check
Reports missing keys (used in code, absent from JSON) and unused keys (in JSON, never called).
lang:sync
Syncs all locale files against en.json. Adds [placeholder] stubs for missing keys, removes keys no longer in en.json.
npx kythia lang:sync
Development Commands
di:generate
Generates TypeScript type definitions for the DI container — full IntelliSense for container.models.* and container.helpers.*.
npx kythia di:generate
# Outputs: types/auto-di.d.ts
Run this any time you add a new model or helper.
docs:generate
Auto-generates markdown documentation for all registered Discord commands.
npx kythia docs:generate [-p docs/commands]
Other Dev Commands
| Command | Description |
|---|---|
dev:namespace |
Add/update JSDoc @namespace headers across all source files |
gen:structure |
Generate a full markdown project structure tree (useful for AI context sharing) |
version:up |
Sync all @version JSDoc tags with package.json version |
Full Command Table
| Command | Category | Description |
|---|---|---|
migrate |
Database | Run pending migrations |
migrate --fresh |
Database | Drop all tables and re-run |
migrate --rollback |
Database | Undo last migration batch |
make:migration |
Database | Scaffold a migration file |
make:model |
Database | Scaffold a KythiaModel class |
make:seeder |
Database | Scaffold a seeder class |
db:seed |
Database | Run database seeders |
cache:clear |
Database | Flush Redis cache |
lang:check |
i18n | Lint translation key usage |
lang:translate |
i18n | AI-translate via Gemini |
lang:sync |
i18n | Sync locale files with en.json |
docs:generate |
Dev | Generate command documentation |
di:generate |
Dev | Generate DI type definitions |
dev:namespace |
Dev | Add/update JSDoc headers |
gen:structure |
Dev | Generate project structure tree |
version:up |
Dev | Sync @version tags |
about |
Info | Show package info and links |