Katal CLI (Artisan Developer Tooling)¶
The katal CLI brings Laravel Artisan-style developer ergonomics to Bun and TypeScript with zero external dependencies.
1. Installation & Binary Configuration¶
The CLI is packaged directly with katal under the bin/katal.ts entry point. When installed globally or via your project dependencies:
# Run via bun
$ bunx katal <command>
# Or add to scripts in package.json
"scripts": {
"katal": "katal"
}
2. Available Commands¶
Katal Developer CLI v3.2.0
Usage:
$ katal <command> [options]
Commands:
make:controller <Name> Scaffold a single-action Controller
Options: --route=<path>, --method=<GET|POST|...>, --schema, --no-route
make:middleware <Name> Scaffold an Onion Middleware
make:provider <Name> Scaffold a Service Provider
make:job <Name> Scaffold a background Queue Job
make:schema <Name> Scaffold a reusable Standard Schema validation object
routes:list Display all application routes with performance tiers
config:cache Compile all configuration files into a fast production cache (.katal/cache/config.json)
config:clear Purge compiled configuration cache
config:show [key] Inspect configuration values (masks secrets unless --show-secrets is passed)
queue:work Start background queue worker supervision
dev Start development server with hot-reloading
3. Code Scaffolding Generators¶
A. Single-Action Controllers (make:controller)¶
Scaffold a single-action controller in src/controllers/ with optional route auto-wiring:
# 1. Basic controller
$ bunx katal make:controller CreateUser
# 2. With static schema and automatic route injection
$ bunx katal make:controller CreateArticle --route=/articles --method=POST --schema
When --route is provided, Katal automatically injects the import and route registration into src/routes.ts:
// Auto-wired into src/routes.ts:
import { CreateArticleController } from "./controllers/CreateArticleController";
app.post("/articles", CreateArticleController);
B. Standard Schema Objects (make:schema)¶
Generate a standalone, reusable Standard Schema v1 validator in src/schemas/:
$ bunx katal make:schema UserRegistration
Output: src/schemas/UserRegistrationSchema.ts
import { toStandardSchema } from "katal";
export const UserRegistrationSchema = toStandardSchema({
email: { type: "string", required: true },
password: { type: "string", required: true, minLength: 8 },
});
C. Onion Middleware (make:middleware)¶
$ bunx katal make:middleware VerifySignature
D. Service Providers (make:provider)¶
$ bunx katal make:provider StripePayments
E. Queue Jobs (make:job)¶
$ bunx katal make:job SendWebhookNotification
4. Production Configuration Caching (config:*)¶
Optimize serverless cold starts and container boot times:
# 1. Compile configuration into atomic .katal/cache/config.json (<1ms boot)
$ bunx katal config:cache
# 2. Clear configuration cache
$ bunx katal config:clear
# 3. Inspect configuration safely (passwords and secrets masked as ********)
$ bunx katal config:show database.connections.mysql
# 4. View plaintext secrets when diagnosing issues
$ bunx katal config:show database.connections.mysql --show-secrets
5. Route Inspection with Performance Tiers (routes:list)¶
Inspect your entire route registry with HTTP methods, route paths, middleware, schemas, and routing tiers:
$ bunx katal routes:list
Sample Output:
KATAL ROUTE TABLE
=================
┌─────────┬──────────────────┬──────────────────────────┬────────┬───────────────┐
│ Method │ URI │ Controller │ Schema │ Tier │
├─────────┼──────────────────┼──────────────────────────┼────────┼───────────────┤
│ GET │ /api/health │ HealthController │ — │ Static (O(1)) │
│ GET │ /api/users/:id │ GetUserController │ — │ Radix Trie │
│ POST │ /api/users │ CreateUserController │ Yes │ Static (O(1)) │
│ GET │ /docs │ ScalarDocsController │ — │ Static (O(1)) │
└─────────┴──────────────────┴──────────────────────────┴────────┴───────────────┘
6. Development Server (katal dev)¶
Start Bun with hot reloading against your main entry point:
$ bunx katal dev