Skip to main content

Catalog

The parsers and generators shipped in v1. Each is a separate @kurotako/* package; you install the ones your pipeline uses and import the exported parser or generator in tako.config.ts.

Parsers​

@kurotako/parser-prisma​

Reads either a Prisma 7 schema (through DMMF) or a Prisma 8 PostgreSQL contract.json, and produces IR entities, fields, enums and relations.

  • Export: prismaParser — the value you pass to use in a sources entry.
  • Name: prisma — its name field, shown in diagnostics.
OptionTypeDefaultNotes
schemastring'./prisma/schema.prisma'path to the schema file, resolved against the config directory. Prisma's multi-file schema folder is supported.
version7 | 8inferredforce the input mode; omitted, it is inferred from a Prisma schema, contract.json, or a directory containing one.
namespacePrefixRecord<string, string>—Prisma 8 only: prepends a prefix to every model from the named Prisma namespace. Ignored with a warning in Prisma 7 mode.
renameRecord<string, string>—overrides an entity name. Keys are Entity in Prisma 7 mode and namespace.Entity in Prisma 8 mode.
hiddenRecord<string, string[]>—fields kept out of the read variant, { User: ['passwordHash'] }. Keys are IR entity names (after rename). An unknown entry is an error. Also settable with /// @kurotako.hidden (Prisma 7 mode). See Read shapes and dates.

Unknown option keys are a hard error (a typo like schemaPath fails rather than being ignored).

sources: {
db: {
use: prismaParser, options
:
{
schema: './prisma/schema.prisma'
}
}
,
}

For Prisma 8, emit the contract with Prisma first, then point the parser at it:

sources: {
db: {
use: prismaParser, options
:
{
schema: './prisma/generated/contract.json', version
:
8, rename
:
{
'public.User'
:
'Account'
}
,
}
,
}
,
}

Prisma 8 support is currently PostgreSQL-first. Unknown PostgreSQL codecs are preserved as unknown IR fields; a foreign database dialect, an unsupported contract version, an invalid contract, a post-rename entity collision, or an ambiguous cross-namespace relation fails with one of the exported Prisma*Error classes.

@kurotako/parser-openapi​

Reads an OpenAPI 3.0 or 3.1 document (local JSON/YAML or an unauthenticated HTTP (S) URL) and produces IR entities, type aliases, enums and typed maps from components.schemas and every reachable inline schema in operations (request bodies, responses, parameters).

  • Export: openapiParser — the value you pass to use in a sources entry.
  • Name: openapi — its name field, shown in diagnostics.
OptionTypeDefaultNotes
documentstring—required; a local path resolved against the config directory, or an http:/https: URL with no credentials.

Unknown option keys are a hard error. References are resolved (not dereferenced) by @apidevtools/json-schema-ref-parser; unsupported schemes, credential-bearing URLs, unresolved references, name collisions, and unsupported JSON Schema keywords each fail with one of the exported OpenApi*Error classes.

sources: {
api: {
use: openapiParser, options
:
{
document: './openapi.yaml',
}
,
}
,
}

Generators​

@kurotako/gen-zod​

Emits Zod schemas from the IR — one file per entity, plus enums.ts, filters.ts and a barrel, under <namespace>/zod/.

  • Export: zodGenerator — the value you pass to use in a generators entry.
  • Name: zod — its name field; it is the key under which a dependent reads its artifact (ctx.dependencies.zod) and the last segment of the private path (<namespace>/<dependent>/zod/).
OptionTypeDefaultNotes
zodVersion3 | 44which Zod API flavor to emit. Explicit — the generator never probes the environment (it must stay pure for tako check).
dateType'date' | 'string' | 'temporal''date'how date fields are modelled: z.coerce.date(), an ISO 8601 string, or a Temporal object. See Date types.
generators: [ { use: zodGenerator, options: { zodVersion: 4 } } ]

Each entity yields six variants (full, create, update, read, where, select) in both relation families; read (UserReadSchema) has its defaulted fields required and its hidden fields removed.

@kurotako/gen-angular​

Emits TypeScript types, typed FormGroups and Validators aligned on the schema constraints, under <namespace>/angular/.

  • Export: angularGenerator — the value you pass to use in a generators entry.
  • Name: angular — its name field.
  • Depends on: a private copy of zod, run by core for this generator alone and emitted under <namespace>/angular/zod/. You do not add zodGenerator to generators for angular to work (keep it only if your code imports <namespace>/zod).
OptionTypeDefaultNotes
forms('reactive' | 'signal')[]['reactive', 'signal']which form surfaces to emit
relations'flat' | 'deep''flat'flat = foreign-key scalars only; deep = nested FormGroup / FormArray
zodVersion3 | 44Zod API flavor of the private Zod copy (forwarded to gen-zod)
generators: [ { use: angularGenerator, options: { forms: [ 'reactive' ], relations: 'deep' } } ]

@kurotako/gen-react-tanstack​

Emits one typed React hook per entity, use<Entity>Form, built on TanStack Form and validated by the Zod schemas kurotako generates from the same IR, under <namespace>/react-tanstack/: one <Entity>.form.ts per entity, a form.runtime.ts (the only file that calls @tanstack/react-form) and a barrel. See the React quick start.

  • Export: reactTanstackGenerator — the value you pass to use in a generators entry.
  • Name: react-tanstack — its name field.
  • Depends on: a private copy of zod, run by core for this generator alone and emitted under <namespace>/react-tanstack/zod/. You do not add zodGenerator to generators (keep it only if your code imports <namespace>/zod).
  • Peer dependency: @tanstack/react-form ^1.17.0 (plus zod, merged from the private copy).
OptionTypeDefaultNotes
zodVersion3 | 44Zod API flavor of the private Zod copy (forwarded to gen-zod)
includestring[]every entityentity names to emit hooks for, in every namespace the entry covers; a name found in none of them is an error
variants('full' | 'create' | 'update')[]['full']which Zod variant a hook is built on; full is the request-body shape, at least one variant
relations'flat' | 'deep''flat'flat = scalar and enum fields; deep = nested objects for to-one relations, arrays for to-many
generators: [
{ use: reactTanstackGenerator, options: { include: ['LoginDto'], variants: ['create'] } },
]

@kurotako/gen-typescript​

Emits pure TypeScript type declarations from the IR — no runtime dependency on generated code. One <Entity>.type.ts file per entity, plus enums.ts, filters.ts, aliases.ts when the source has type aliases, scalars.ts when a JsonValue helper is needed, and a barrel, under <namespace>/typescript/.

  • Export: typescriptGenerator — the value you pass to use in a generators entry.
  • Name: typescript — its name field.
  • Depends on: nothing.
OptionTypeDefaultNotes
dateType'date' | 'string' | 'temporal''date'how date fields are typed: Date, string, or Temporal.*. See Date types.

Each entity yields six variants (full, create, update, read, where, select) in both relation families (flat, deep), named ${Entity}${Variant}${Family}Dto — e.g. User, UserCreateDto, UserReadDto, UserDeepDto.

generators: [ { use: typescriptGenerator, options: { dateType: 'string' } } ]

@kurotako/gen-openapi​

Emits one OpenAPI 3.0/3.1 document (components/schemas only — no paths/operations) per namespace from the IR — entities, type aliases and enums, including relations (rendered nested via $ref, cross-source relations omitted) and a discriminated-union mapping symmetric to @kurotako/parser-openapi. A field marked hidden is left out of its schema, which describes a response (see Read shapes and dates).

  • Export: openapiGenerator — the value you pass to use in a generators entry.
  • Name: openapi — its name field.
  • Depends on: nothing.
OptionTypeDefaultNotes
openapiVersion'3.0' | '3.1''3.1'which OpenAPI version to target.
format'json' | 'yaml''json'output serialization.
titlestringthe namespacedocument info.title.
versionstring'0.0.0'document info.version.
generators: [ { use: openapiGenerator, options: { format: 'yaml', title: 'My API' } } ]

Adding your own​

Parser and generator packages are plain packages whose entry is built with defineParser / defineGenerator from @kurotako/config. The authoring guides ("writing a parser", "writing a generator") are a fast-follow; until then, the @kurotako/config API reference documents the contract.