trpc-cli transforms a tRPC (or oRPC) router into a type-safe, documented CLI with zero boilerplate. Current stable version is 0.14.0, released frequently (multiple releases per month). It automatically generates positional arguments, options, help text, and shell completions from Zod/Valibot/Arktype schemas. Unlike general-purpose CLI frameworks like Commander or yargs, trpc-cli leverages tRPC's type system for end-to-end type safety and reuse of router logic across CLI, HTTP server, and programmatic APIs. It depends only on Commander as a runtime dependency (peer deps for validation libraries). Supports tRPC v10/v11, oRPC, and experimental standalone mode. ESM-only since v0.12.0.
npm install trpc-cliVerified import paths — ran on the pinned version, not inferred.
Creates a tRPC router with a 'greet' procedure and maps it to a CLI using trpc-cli. Run with 'node cli.js greet --name World' to see output.
Convert your project to ESM (type: 'module' in package.json) or use dynamic import: const { cli } = await import('trpc-cli').Install peer dependencies: @trpc/server, @valibot/to-json-schema, effect, valibot, zod as needed.
Avoid relying on standalone mode for production; use with @trpc/server or @orpc/server.
Switch to ESM (type: 'module' in package.json) or use dynamic import: const { cli } = await import('trpc-cli').Run 'npm install @trpc/server' (v10.45.2+ or v11.0.1+).
Use named import: import { cli } from 'trpc-cli'.