CLI

CLI

Inspect operations, execute calls, and automate smoke checks or schedule creation from a schema-aligned command line.

Install

Pick the install mode that matches the job

Zero install

npx @tsfm-ai/tsfm-cli@latest list --base-url https://api.tsfm.ai

Best for first use, troubleshooting, and docs-driven exploration.

Global install

npm i -g @tsfm-ai/tsfm-cli

Best for operators who rely on the CLI every day on secured workstations.

Pinned dependency

pnpm add -D @tsfm-ai/tsfm-cli

Best for CI and repo-local workflows that should be lockfile stable.

When to use it

The CLI is the shortest path between the reference docs and a real request. It is ideal for smoke checks, on-call debugging, and schema inspection when you do not want to write a temporary script.

If you are still feeling out the surface area, the CLI is usually a better starting point than an SDK. If you are building a long-lived service integration, move to the SDKs.

Workflow

A reliable terminal path from discovery to execution

  1. 1Start with `tsfm list` to confirm schema reachability and discover operation ids.
  2. 2Run `tsfm inspect <operationId>` before you call anything with a body or path params.
  3. 3Move stable payloads into files and use `--json` once a workflow becomes part of automation.
cli-workflow.sh
# discover operations from live schema
tsfm list --base-url https://api.tsfm.ai

# inspect one operation contract
tsfm inspect forecast --base-url https://api.tsfm.ai

# execute one operation
tsfm call forecast \
  --base-url https://api.tsfm.ai \
  --api-key "$TSFM_API_KEY" \
  --body-file ./payloads/forecast.json \
  --json

Automation

Use the CLI as a release-confidence tool

The CLI exits non-zero on non-2xx responses, which makes it a good fit for deployment gates and smoke tests. Keep the checks cheap: a health probe plus one representative forecast is usually enough to catch drift.

Pair CLI checks with the API reference so failures map cleanly to a known runbook.

cli-ci-check.sh
# CI-friendly smoke check
set -euo pipefail

tsfm list --base-url "$TSFM_API_BASE_URL" --json > /tmp/ops.json
tsfm call getHealth --base-url "$TSFM_API_BASE_URL" --json

tsfm call forecast \
  --base-url "$TSFM_API_BASE_URL" \
  --api-key "$TSFM_API_KEY" \
  --body-file ./payloads/forecast-smoke.json \
  --json | jq '.status == 200'

Operational guidance

The flags and behaviors that matter in real environments

Command reference

FieldTypeRequiredDescription
listreadNoPrint operation ids discovered from OpenAPI schema.
inspect <operationId>readYesShow method/path/required params for one operation.
call <operationId>executeYesExecute an API operation with --path, --query, and --body inputs.

Credential precedence

Flags override environment variables so scripts can stay explicit.

FieldTypeRequiredDescription
1. --tokenflagNoHighest priority; useful for session-scoped account actions.
2. --api-keyflagNoRecommended for CI and server-side forecasting automation.
3. TSFM_API_TOKENenvNoFallback token env var.
4. TSFM_API_KEYenvNoFallback API key env var for unattended jobs.
  • Prefer `--json` whenever another process needs to parse the output.
  • Use `--token` for user-scoped account calls and `--api-key` for unattended automation.
  • Log the operation id and HTTP status in CI so failures map back to the API contract quickly.
  • Keep representative payload fixtures in version control once a workflow is production-facing.