Tartan NetworksStart free

Docs / Reference

Reading the CLI's answers

For tartan 0.9.36

Every tartan command answers in one JSON shape and a fixed exit code, so a script or an AI reads the result without parsing words.

For your AI: tartannetworks.com/docs/cli-answers.md

Every tartan command answers in one JSON shape and a fixed exit code, so a script or an AI reads the result without parsing words.

The answer

Add --json to any command. The answer goes to stdout as one object; the words for people go to stderr.

tartan device list --org acme --json
{"ok": true, "result": [ ... ]}
{"ok": false, "error": "…", "code": "refused"}

ok says whether it worked. result holds the data, error says what stopped it, and code names the kind of answer. Fields with nothing in them are left out.

Exit codes

Exit Means code
0 ok
1 other, or a usage error
2 refused: the passkey step was refused, the session or device is over, or a check stopped it refused, step_up, session_expired, session_idle, session_revoked, device_revoked, …
3 pending: an approval holds it pending
4 not found, or this CLI is older than control, Tartan's control plane not_found, cli_outdated
5 conflict conflict, name_taken

Pending is not a failure

Exit 3 means the change waits for someone's approval, and result names the approval. See what waits:

tartan approval list --org acme

An approval that needs an Owner is theirs: tartan approval approve --org acme --id <approval id>. An Admin approves a tech's computer or an over-limit connection: tartan tech approve --org acme --approval <approval id>.

Then finish the command with --approval <id> where it takes one, for example tartan org zone-ds --org acme --approval <approval id>.

Passkey prompts

A write that steps up asks the person for their passkey, bound to that exact change; steps_up in tartan help --json says which commands can. The CLI prints what the prompt approves first. tartan batch run --file changes.txt puts 2 to 20 writes, one per line, under one prompt.

Try before you write

--dry-run checks a write and shows the change without making it. A command that has effects outside Tartan's database has no dry run, and refuses the flag.

tartan rule add --org acme --id web --ports 443 --proto tcp --dry-run --json

Retry safely

--idempotency-key makes a write safe to retry. The same key, from the same person, in the same organization, with the same arguments, returns the first answer instead of running the write again.

tartan group create --org acme --name finance --idempotency-key 7f3c-finance --json

What the CLI knows

tartan help --json
tartan help --json --schema tartan.help.v1
tartan rule add --help --json
tartan docs --out ./tartan-reference

help --json lists every command with its role, whether it writes, whether it asks for a passkey (steps_up), whether it has a dry run, its flags and what the person does by hand (person_acts). With --schema tartan.help.v1 it adds the exit codes. tartan docs writes the same reference as Markdown, one file per noun. Neither sends anything.

Is this CLI current?

tartan version --json
tartan version --server --json

--server compares this CLI's commands with your control's. A command in missing_here means: update the CLI. A command or flag your control has and this CLI lacks answers cli_outdated (exit 4).

--profile <file> picks the sign-in a command uses; setting TARTAN_PROFILE does the same for every command.

Next