Skip to main content

CLI configuration

The CLI needs to know three things: the host (your team's API address), the workspace and project, and a credential (who you are). This page says where they come from.

Sign in​

tmspec auth login --host https://tmspec.acme.com

The CLI prints an address and a code (on stderr). Open the address in a browser on any machine, even when you are on SSH, check that the code matches, sign in and agree. There is nothing to type into the terminal. --web opens the browser on this machine (do not use it over SSH).

CommandWhat it does
tmspec auth loginSign in
tmspec auth statusHost, account, credential kind, credential source, token expiry and the sign-in's expiry date
tmspec auth logoutRevoke the sign-in on the server and delete the local copy

The sign-in is stored in the operating system's keychain, or in a file only you can read (~/.config/tmspec/credentials/<host>.json) when the machine has no keychain. TMSPEC_CREDENTIAL_STORE changes how it is stored: auto (default), file or keychain. The CLI stores only the refresh token, never the access token. When the sign-in is close to expiring (under 7 days left), auth status and other commands remind you to run auth login again.

Workspace and project​

tmspec workspace list
tmspec workspace use ACME # by name or id
tmspec project list
tmspec project use PAY # the project key

workspace use and project use save into the profile in use. For one project folder, tmspec init -p PAY writes a .tmspec.toml file holding that folder's host, workspace and project for the whole team to share; the file holds no secret, so it can be shared. This file is looked up from the current folder going upwards.

Profiles and config files​

PlaceContains
The user file ~/.config/tmspec/config.toml (or $XDG_CONFIG_HOME/tmspec/config.toml; TMSPEC_CONFIG_DIR changes the folder)Profiles: host, workspace, project, web_url
The .tmspec.toml file in a project folderThe host, workspace and project of that project
Cache ~/.cache/tmspecTemporary data; delete freely

No file holds a secret; a key that looks like a credential (token, api_key, password...) is refused. The commands tmspec config list --show-origin, config get <key> and config set <key> <value> let you view and change them. --profile <name> or TMSPEC_PROFILE chooses another profile.

Order of precedence​

Each value is taken from the first source that is present:

flag → environment variable → nearest .tmspec.toml → profile
ValueFlagEnvironment variable
Host--hostTMSPEC_HOST
Project--project, -pTMSPEC_PROJECT
WorkspacenoneTMSPEC_WORKSPACE (id)
Profile--profileTMSPEC_PROFILE
Web address (to open the Review page)--web-urlTMSPEC_WEB_URL

The workspace and project in a file are used only for the exact host that file names, because an id from one host means nothing on another. A folder's .tmspec.toml can name any host, so the CLI warns once when it meets a host with no profile, and never sends a credential from an environment variable to a host that only that file chose.

Use a key or token instead of signing in​

For scripts, CI and agents, you do not sign in with a browser but use environment variables. The source is chosen in this order (an empty variable counts as not set):

OrderVariableMeaning
1TMSPEC_API_KEYAn API key tms_... created on the web at Account settings, API keys
2TMSPEC_API_KEY_FILEPath to a file holding the key; the file must be readable only by its owner (0600)
3TMSPEC_TOKENAn access token from elsewhere, used as is and never refreshed
4The stored sign-inThe result of auth login

A key is the credential of the person who created it, narrowed by scopes (Roles and permissions). The CLI exchanges the key for an access token that lives 15 minutes, kept in memory, and never writes the key to a file or log. tmspec auth status tells which kind of credential is in use (login, api_key or token).

For keys and tokens, always set the host explicitly (--host or TMSPEC_HOST) and, for a key, set TMSPEC_ISSUER to the sign-in service's address. The CLI compares that address with the one the server declares before sending the key; on a mismatch it stops with code 3 and sends nothing. A key is never sent to a host that only a .tmspec.toml file chose.

Output format​

Stdout holds only data; progress, warnings and errors go to stderr, so tmspec ... --json | jq never breaks. --json prints exactly what the API returns. --all walks through all pages of a list. Colour is turned off with --no-color, the NO_COLOR variable, or when the output is not a terminal. --verbose writes requests to stderr (tokens are always masked) and --quiet hides progress messages. Each request takes at most 30 seconds (--timeout changes this).

Call an endpoint that has no command yet​

tmspec api GET /v1/workspaces
tmspec api POST /v1/workspaces/<id>/projects/<id>/areas --input area.json

See API.