<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title id="root">jtd-codegen — README</title>
  <status stage="doc" state="work" audience="user,dev"/>
  <p p="1">The README of `org.vibevm.ai-native/jtd-codegen@1.0.0`, as the package ships it.</p>
  <section id="tool-jtd-codegen-the-vendored-wire-type-generator-root" title="tool: jtd-codegen — the vendored wire-type generator {#root}">
    <p p="2">&lt;status stage="impl" state="done"/&gt;</p>
    <p p="3">@fact:WHAT-IT-IS `jtd-codegen` generates strictly-typed, language-specific code from JTD ([JSON Type Definition, RFC 8927](https://www.rfc-editor.org/rfc/rfc8927)) schemas. A consuming project derives its wire types from committed `*.jtd.json` schemas through this binary — schema-first codegen instead of hand-maintained duplicates on either side of a contract. @status:impl/done</p>
    <p p="4">@fact:THIS-PACKAGE-IS-THE-RECIPE-NOT-THE-BINARY **This package ships the provisioning recipe, never the binary.** The binary is fetched from the upstream release page into the consuming project's local `tools/jtd-codegen/` directory, which the consumer keeps gitignored — only the recipe (this document) and the version pin travel with source trees. That is the same posture the binary's first consumer records in its own `tools/.gitignore`: toolchain binaries are vendored per machine, never committed. @status:impl/done</p>
    <p p="5">@fact:UPSTREAM Upstream: &lt;https://github.com/jsontypedef/json-typedef-codegen&gt;. @status:impl/done</p>
  </section>
  <section id="pinned-version-pin" title="Pinned version {#pin}">
    <p p="6">@fact:PINNED-VERSION **`jtd-codegen 0.4.1`** — the most recent stable release at the time of pinning. This README is the pin's single home: bump by editing this line (a new package version), never by restating the number in a consumer tree. CI asserts that schemas do not drift from generated code; it does not enforce a particular generator build. @status:impl/done</p>
  </section>
  <section id="install-install" title="Install {#install}">
    <p p="7">@fact:INSTALL-TARGET Drop the platform binary at `tools/jtd-codegen/jtd-codegen` (or `jtd-codegen.exe` on Windows) inside the consuming project, and keep that directory gitignored. @status:impl/done</p>
  </section>
  <section id="windows-install-windows" title="Windows {#install-windows}">
    <p p="8">@fact:INSTALL-WINDOWS From the project root, in PowerShell or Git Bash: @status:impl/done</p>
    <fence lang="sh" p="9">curl -LO https://github.com/jsontypedef/json-typedef-codegen/releases/download/v0.4.1/x86_64-pc-windows-gnu.zip
unzip -d tools/jtd-codegen x86_64-pc-windows-gnu.zip
rm x86_64-pc-windows-gnu.zip</fence>
    <p p="10">@fact:WINDOWS-GNU-BUILD Upstream ships a `gnu` build, not `msvc` — the static binary works on the Windows hosts the projects target. @status:impl/done</p>
  </section>
  <section id="macos-install-macos" title="macOS {#install-macos}">
    <p p="11">@fact:INSTALL-MACOS Apple Silicon (Intel: swap in `x86_64-apple-darwin.tar.gz`): @status:impl/done</p>
    <fence lang="sh" p="12">curl -L https://github.com/jsontypedef/json-typedef-codegen/releases/download/v0.4.1/aarch64-apple-darwin.tar.gz \
  | tar -xz -C tools/jtd-codegen</fence>
  </section>
  <section id="linux-install-linux" title="Linux {#install-linux}">
    <p p="13">@fact:INSTALL-LINUX One command: @status:impl/done</p>
    <fence lang="sh" p="14">curl -L https://github.com/jsontypedef/json-typedef-codegen/releases/download/v0.4.1/x86_64-unknown-linux-gnu.tar.gz \
  | tar -xz -C tools/jtd-codegen</fence>
  </section>
  <section id="verify-verify" title="Verify {#verify}">
    <p p="15">@fact:VERIFY-VERSION The installed binary answers with the pinned version: @status:impl/done</p>
    <fence lang="sh" p="16">tools/jtd-codegen/jtd-codegen --version    # prints "jtd-codegen 0.4.1"</fence>
  </section>
  <section id="use-use" title="Use {#use}">
    <p p="17">@fact:CONSUMER-WIRES-ITS-OWN-TASK The consumer wires the binary into its own regeneration task and drift check — generate, then byte-compare in CI. The first consumer (the vibevm host) runs it as `cargo xtask codegen` / `cargo xtask check-codegen`, preferring the project-local binary and falling back to PATH; its task preflights the binary and errors actionably, pointing at this recipe, when both are missing. @status:impl/done</p>
  </section>
</spec>
