Machine-Readable Docs
TypoKit provides multiple machine-readable interfaces so AI agents can discover the API surface, understand schemas, and navigate the codebase without parsing HTML. This page documents every structured output format available.
llms.txt — LLM-Friendly Documentation Index
Section titled “llms.txt — LLM-Friendly Documentation Index”TypoKit publishes two files following the llmstxt.org convention:
| File | URL | Purpose |
|---|---|---|
llms.txt | /typokit/llms.txt | Concise summary with links to key docs pages |
llms-full.txt | /typokit/llms-full.txt | Expanded content suitable for LLM context windows |
llms.txt Format
Section titled “llms.txt Format”The llms.txt file contains:
- H1 — Project name
- Blockquote — One-sentence summary
- Overview — Key concepts and architecture summary
- H2 sections — Categorized links to documentation pages
AI agents can fetch /llms.txt to discover the documentation structure, then follow links to specific pages for detail.
llms-full.txt Format
Section titled “llms-full.txt Format”The llms-full.txt file expands on llms.txt with inline content for each section — package descriptions, CLI command summaries, and architecture highlights — so an agent can load a single file into its context window and get a comprehensive understanding of TypoKit without making additional HTTP requests.
The --json Flag — Structured CLI Output
Section titled “The --json Flag — Structured CLI Output”Every typokit inspect subcommand supports a --json flag that outputs structured JSON instead of human-readable text. This is the primary interface for AI agents doing live project introspection.
# All inspect commands accept --jsontypokit inspect routes --jsontypokit inspect route "GET /users/:id" --jsontypokit inspect middleware --jsontypokit inspect dependencies --jsontypokit inspect schema --jsontypokit inspect errors --jsontypokit inspect performance --jsontypokit inspect server --jsontypokit inspect build-pipeline --jsonExample: Route Inspection
Section titled “Example: Route Inspection”typokit inspect routes --json{ "routes": [ { "method": "GET", "path": "/users/:id", "handler": "src/handlers/users.ts:getUser", "middleware": ["auth", "validate"], "params": { "id": "string" }, "requestSchema": null, "responseSchema": "User" } ], "count": 1}Example: Schema Inspection
Section titled “Example: Schema Inspection”typokit inspect schema --json{ "schemas": { "User": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string", "format": "email" } }, "required": ["id", "name", "email"] } }}Example: Error Inspection
Section titled “Example: Error Inspection”typokit inspect errors --json{ "errors": [ { "type": "VALIDATION_ERROR", "schemaName": "CreateUserInput", "failures": [ { "path": "$.email", "expected": "string (email format)", "received": "number", "suggestion": "Change field 'email' from number to a valid email string" } ], "sourceFile": "src/types/user.ts", "line": 12 } ]}OpenAPI Spec — Machine-Readable API Description
Section titled “OpenAPI Spec — Machine-Readable API Description”The typokit generate:openapi command produces a complete OpenAPI 3.1 specification from your route contracts and type definitions.
# Generate the OpenAPI spectypokit generate:openapi
# Output location (default)cat .typokit/openapi.jsonThe generated spec includes:
- All routes with method, path, and operation IDs
- Request/response schemas derived from TypeScript types via Typia
- Parameter definitions for path, query, and header params
- Error responses with structured error schemas
- Component schemas for all shared types
Using the OpenAPI Spec
Section titled “Using the OpenAPI Spec”AI agents can use the OpenAPI spec to:
- Discover endpoints — Parse
pathsto enumerate all available API routes - Understand request shapes — Read
requestBodyschemas to construct valid payloads - Validate responses — Compare actual responses against
responsesschemas - Generate clients — Feed the spec to code generators like
openapi-typescript
# Generate and pipe to a tooltypokit generate:openapi && cat .typokit/openapi.json | jq '.paths | keys'Debug Sidecar — Runtime JSON Endpoints
Section titled “Debug Sidecar — Runtime JSON Endpoints”When running with @typokit/plugin-debug, a sidecar HTTP server exposes structured JSON endpoints on port 9800 (configurable via --debug-port).
| Endpoint | Method | Description |
|---|---|---|
/_debug/routes | GET | Compiled route table with handler metadata |
/_debug/middleware | GET | Middleware stack with priority ordering |
/_debug/errors | GET | Recent errors with structured context |
/_debug/performance | GET | Request timing percentiles and route-level stats |
/_debug/health | GET | Server health status and uptime |
/_debug/dependencies | GET | Package dependency graph |
/_debug/traces | GET | Recent OpenTelemetry trace spans |
/_debug/logs | GET | Recent structured log entries |
All endpoints return JSON. Example:
# Query routes from the debug sidecarcurl http://localhost:9800/_debug/routes | jq .
# Get recent errors with structured contextcurl http://localhost:9800/_debug/errors | jq '.errors[] | {type, schemaName, failures}'Generated File Artifacts
Section titled “Generated File Artifacts”The build pipeline writes machine-readable artifacts to .typokit/:
| File | Format | Contents |
|---|---|---|
.typokit/routes.json | JSON | Compiled route table |
.typokit/schemas.json | JSON | All extracted type schemas |
.typokit/openapi.json | JSON | OpenAPI 3.1 specification |
.typokit/validators.ts | TypeScript | Generated Typia validators |
.typokit/db-schema.ts | TypeScript | Generated database schema (Drizzle/Kysely/Prisma) |
.typokit/tests/*.test.ts | TypeScript | Auto-generated contract tests |
Agents can read these files directly from disk without running any commands:
# Read the route tablecat .typokit/routes.json | jq '.routes[] | {method, path}'
# Read all type schemascat .typokit/schemas.json | jq 'keys'
# Get the OpenAPI spec version and infocat .typokit/openapi.json | jq '{openapi: .openapi, title: .info.title, version: .info.version}'Agent Workflow with Machine-Readable Outputs
Section titled “Agent Workflow with Machine-Readable Outputs”A typical AI agent session combining these interfaces:
# 1. Discover project structuretypokit inspect routes --json > /tmp/routes.jsontypokit inspect schema --json > /tmp/schemas.json
# 2. Understand a specific routetypokit inspect route "POST /users" --json
# 3. Make a type change# ... edit src/types/user.ts ...
# 4. Rebuild and checktypokit buildtypokit inspect errors --json
# 5. If errors, read structured failure context# The JSON includes path, expected, received, and suggestion fields# for each validation failure — enabling targeted self-correction
# 6. Run teststypokit test --json
# 7. Generate updated OpenAPI spectypokit generate:openapi