Skip to Content
Commands

Commands

The command reference of the Trajectonomics CLI.

traj has 14 top-level commands. Six are groups with their own subcommands — account, baseline, projection, report, scenario and tx — and the other eight are single commands. traj help lists them and traj help <command> shows one command’s usage; both are generated from the same definitions that validate input, so the two cannot drift (ADR 0015).

The command tree

CommandWhat it does
accountManage the chart of accounts
balanceShow every account’s balance and net worth at a date
baselineShow the Baseline a Projection starts from
exportWrite the stored rows into a new directory
fiReport the financial independence date under a Scenario
helpShow usage for traj or for one command
initCreate the data directory and an empty database
inspectShow the stored rows of one table, or of every table
projectionProject the future under a Scenario, and compare two of them
reportReport on the ledger over a period or at a date
scenarioManage Scenarios, the named what-ifs
schemaDescribe the commands and the error registry
txManage ledger transactions
versionPrint the CLI version

A group needs a subcommand: traj tx on its own is invalid input (exit code 2), and the message names the command that lists its subcommands, traj help tx.

Global options

Every command accepts:

  • --json — print JSON; errors become a JSON envelope on stderr.
  • -h, --help — show usage.
  • -v, --version — print the version.

A bare -- ends flag parsing: nothing after it counts as a flag.

Exit codes

0 ok, 1 unexpected, 2 invalid input, 3 domain rejection, 4 not found, 5 conflict (ADR 0010).

Errors

In JSON mode a failure is a JSON envelope on stderr, where code names the failure and exitCode names its class; both come from one registry that traj schema prints (ADR 0013):

{"error":{"code":"not_found","exitCode":4,"message":"The requested resource was not found."}}

Outside JSON mode the same failure is text on stderr with the same exit code. Commands never prompt.

Document input

Some commands take a JSON document beside the flag form — --postings on tx add and tx amend, --file on scenario apply — named by a path, or - to read it from stdin (ADR 0020). The transaction document those --postings flags read is on the tx page.

Decisions

Source: trajectonomics/cli.