Core Language
KERN is not just UI. It generates typed TypeScript from declarative specs. These are the nodes the AI uses for your domain model.
type
Generates TypeScript type definitions with typed fields.
KERN
type name=User
field name=id type=string
field name=email type=string
field name=role type="admin|editor|viewer"
field name=createdAt type=DateGenerated TypeScript
export type User = {
id: string;
email: string;
role: 'admin' | 'editor' | 'viewer';
createdAt: Date;
};interface
Generates TypeScript interfaces with method signatures.
KERN
interface name=AuthService
fn name=login params="email:string,password:string" returns="Promise<User>"
fn name=logout returns=void
fn name=getSession returns="Promise<Session|null>"Generated TypeScript
export interface AuthService {
login(email: string, password: string): Promise<User>;
logout(): void;
getSession(): Promise<Session | null>;
}fn
Standalone function declarations. Can be children of interface or standalone.
fn name=calculateTotal params="items:CartItem[]" returns=numbermachine
State machines with typed transitions. 12 lines of KERN generate 140+ lines of TypeScript: enum, type guards, transition function, exhaustive checks.
machine name=OrderStatus initial=pending
transition from=pending to=confirmed event=confirm
transition from=confirmed to=processing event=process
transition from=processing to=shipped event=ship
transition from=shipped to=delivered event=deliver
transition from=pending to=cancelled event=cancel
transition from=confirmed to=cancelled event=cancel- enum OrderStatusState with all states
- enum OrderStatusEvent with all events
- Type guard functions (isPending, isConfirmed, ...)
- Typed transition function with exhaustive switch
- State machine class with current state tracking
event
Event type declarations for event-driven architectures.
event name=UserCreated
event name=UserDeleted
event name=OrderPlacedconfig
Configuration objects with typed fields.
config name=AppConfig
field name=apiUrl type=string
field name=debug type=boolean
field name=maxRetries type=numberstore
State store declarations.
store name=AuthStore
field name=user type="User|null"
field name=token type=string
field name=isLoading type=booleanerror
Custom error type declarations.
error name=ValidationError
error name=NotFoundError
error name=AuthenticationErrormodule
Module declarations for organizing exports.
module name=auth
export name=AuthService
export name=User
export name=Sessiontest
Test declarations with describe/it structure.
test name=AuthTests
describe name=login
it name="authenticates valid user"
it name="rejects invalid password"
describe name=logout
it name="clears session"