Skip to content
TypeWire

@tahanabavi/typewire-cli

documents v0.0.0

Command-line tools for TypeWire contracts — contract test runner, scaffolding, and reports.

Commands

CommandPurpose
typewire initRead the project, ask what it needs, wire it up
typewire testRun the contract tests declared on your endpoints (default)
typewire listPrint every route in the contract, with its transport
typewire release-doc <version>Scaffold a release note in docs/releases

init

bash
npx typewire init

It reads the project first — framework, TypeScript, package manager, src/, monorepo, and which @tahanabavi/* packages are already installed — then asks one question: what does this project need?

txt
  project    acme-shop
framework Next.js
language TypeScript
installer pnpm
source src/

What does this project need?
[] typefetch — typed HTTP client
1 [] Query layer — caching, dedup, declared invalidation
2 [ ] typesocket — typed WebSocket contracts
3 [] Devtools panel — request timeline and cache inspector
4 [ ] GraphQL transport
5 [ ] gRPC transport
...

Everything detected is a default, shown and overridable — never a silent decision. Options that cannot apply are not offered: the devtools panel does not appear in an Express project, and the NestJS adapter appears only in a NestJS one.

It then writes a typewire/ folder wired for what you picked — client, contracts, query cache, provider, devtools bridge, permissions — prints the install command for your package manager, and lists what to do next. Files that already exist are skipped unless --force.

FlagMeaning
--yesTake every detected default, ask nothing
--features <a,b>Skip the question — reproducible in CI
--contracts-path <path>Use contracts you already have
--output <dir>Scaffold somewhere other than the project root
--dry-runPrint the plan, write nothing
--forceReplace existing files instead of skipping them

The framework changes what is generated, not just where: a Next.js scaffold marks the provider and devtools "use client", and reads process.env.NEXT_PUBLIC_API_URL where a Vite project reads import.meta.env.VITE_API_URL.

Without a TTY — a CI shell, a piped run — it takes the defaults and prints what it chose rather than blocking on a prompt nobody can answer.

test

bash
npx typewire test --base-url https://staging.example.com --mode smoke
FlagMeaning
-c, --config <path>Config file (default: discovered in cwd)
-m, --mode <mode>Test mode
--base-url <url>Override the client's base URL
--token <token>Auth token
--timeout <ms>Per-case timeout
--include-tags / --exclude-tagsFilter by tag
--include-destructiveInclude cases marked destructive
--stop-on-failHalt at the first failure
-o, --output <path>Report output path
-f, --format <fmt>md, html, or json

list prints every route through the transport's own describe(), so a gRPC route shows gRPC unary user.v1.UserService/GetUser rather than an empty method/path — the CLI never reads transport-specific fields directly.