chowbea-axios
Commands

extract

Extract marked TypeScript types into a Type Bus manifest. Runs in your API repo.

Sweeps your API repo for bus-marked types, validates them, and writes chowbea.bus.json.

This is the only command that runs in your API repo rather than your frontend. It's the backend half of the Type Bus.

chowbea-axios extract
✓ done Wrote 14 type(s) to /repo/chowbea.bus.json

Flags

FlagDefaultPurpose
-p, --project <path>nearest tsconfig.jsonUse a specific TypeScript config
-o, --out <path>./chowbea.bus.jsonWrite the manifest elsewhere (parent dirs are created)
--checkoffValidate only, never write. Non-zero exit on violations.
--diff <url|file>Compare against a baseline manifest; reports added / changed / removed
--fail-on-removedoffWith --diff, exit non-zero when types disappeared
--watchoffRe-extract on source change (300ms debounce; ignores build output, node_modules, and .d.ts)

What it does

  1. Loads your tsconfig.json and builds a TypeScript program — it needs real type information to enforce the closed-world rule.
  2. Sweeps both marking channels: *.chowbea.ts barrels and /** @chowbea-export */ tags.
  3. Validates everything — types-only, closed world, duplicate names, reserved keys, rootDir containment.
  4. Slices each declaration's source text verbatim.
  5. Writes the manifest — unless its content hash matches the manifest already on disk, in which case the write is skipped and you get Type bus unchanged — N type(s). A missing or corrupt manifest is always rewritten.

On any violation, nothing is written and every error is reported at once:

src/bus.chowbea.ts:3   "GradeMap" references "Grade" (src/exams/models.ts:12) which is not
                       on the bus — add it to a .chowbea.ts barrel or mark it @chowbea-export.
Type bus extraction failed with 1 error(s).

Common invocations

# dev loop — pairs with busHandler()'s file mode, no server restarts
chowbea-axios extract --watch

# CI: is the bus valid?
chowbea-axios extract --check

# CI: does this PR break a consumer?
chowbea-axios extract --check --diff "$STAGING_BUS_URL" --fail-on-removed

# monorepo with a build-specific config
chowbea-axios extract --project tsconfig.build.json

In your build

The manifest must ship with your deploy — a running server has no TypeScript source to extract from:

package.json
{
  "scripts": {
    "prebuild": "chowbea-axios extract",
    "build": "nest build"
  }
}

Don't commit chowbea.bus.json. It's a build output, regenerated from the source being deployed, which is what makes drift impossible.

See also

On this page