CLI

Use TCalc from the command line

Build the monorepo once, then scan, recommend, map, and report from repeatable local commands.

Last updated 3 sections
EXPECTED OUTCOME

Reproducible token reports and agent-ready artifacts that can run locally or in CI.

Before you begin

  • Node.js 20 or newer
  • pnpm
  • A local clone of the TCalc repository
01

Build the CLI

Install workspace dependencies and build the packages before invoking the repository-local binary. The root pnpm cli script points to the compiled command entry point.

pnpm install
pnpm build
pnpm cli --help
02

Choose the smallest useful command

Use scan when you need workspace size and hot paths, recommend when the decision is model selection, and repo-map when an agent needs a compact structural view. Rules creates goal-aware agent instructions, while report combines the scan and recommendations into Markdown or JSON.

pnpm cli scan ./my-project
pnpm cli recommend ./my-project --goal add-feature
pnpm cli repo-map ./my-project --budget 8000
pnpm cli rules ./my-project --target codex --mode repo-map-first
pnpm cli report ./my-project --include-repo-map --output workspace-model-report.md
03

Use explicit paths in automation

  1. Pass the workspace path instead of relying on the runner's current directory.
  2. Write reports to a dedicated artifact folder such as dist-ci.
  3. Validate a custom catalog before using it with recommendation or report commands.
  4. Upload only generated reports; TCalc does not need source files outside the runner.