CLI quickstart#
Install tdx, sign in to your gateway and read its workspaces, in about five minutes.
You need a supported Node.js LTS release (see engines in package.json), a running gateway and an account on its dashboard. The Gateway quickstart starts a gateway at http://127.0.0.1:4000.
Install the CLI#
npm install --global @tokedex/cli
tdx --versionInstall from source#
To build the CLI from a checkout, use pnpm 10.34.9. Open your Tokedex checkout or clone the repository.
git clone https://github.com/ArtificialAnalysis/Tokedex.git
cd TokedexFrom the checkout, build and install the CLI.
pnpm -C typescript install --frozen-lockfile
pnpm -C typescript build:refs
npm install --global --install-links ./typescript/packages/cli
tdx --versionSign in#
tdx auth login --host http://127.0.0.1:4000Open http://127.0.0.1:4000/cli-sign-in
Enter this code in the browser: SFBB-ZWBT
Only enter a code that your own terminal shows you. The code expires in 10 minutes.
Opened your browser. Waiting for approval… (Ctrl-C to cancel)The page is on the gateway's public URL (TOKEDEX_PUBLIC_URL) when it has one, even if --host is another address for it, so signing in through your identity provider brings you back to it. The exception is a public URL and --host on this machine with different ports, such as a port-forward on another port: the page is then on --host, and you sign in there with your email and password.
In the browser page that opens:
- Sign in to the dashboard, if it asks.
- Enter the code from your terminal and choose Continue.
- Check the request: the CLI's name, the network it asked from and how long its token lasts. Choose Approve. If you signed in more than 10 minutes ago, confirm it's you first.
The page says Request approved. Return to your terminal to confirm that sign-in completed. The terminal prints the saved profile when sign-in completes.
{
"schemaVersion": "tokedex.cli.v1",
"command": "auth login",
"data": {
"profile": {
"name": "default",
"origin": "http://127.0.0.1:4000"
},
"principal": {
"kind": "user",
"id": "usr_01M83XDKHP308B8X1770RJZ9PQ",
"name": "Ada Lovelace"
},
"breakGlass": false,
"expiresAt": "2026-12-23T09:59:27.105Z",
"warning": null,
"preview": null
}
}tdx auth login saved a personal access token, with the gateway's address, in a file only your user can read under ~/.config/tokedex/. The token can do what your role lets you do, except what only the dashboard does, and lasts 30 days; ask for less with --expires-in 7d. It is listed under Account → Access tokens, where you can revoke it.
Approve only a code your own terminal shows you. Anyone who sends you a code and a link is asking for your access.
On a machine without a browser, including SSH without a terminal, select browser sign-in explicitly. Replace the host with your gateway's address.
tdx auth login --host https://gateway.example.com --method browser --no-browserOpen the printed address on a device that can reach the gateway and approve the code there.
Check the connection#
tdx auth status --json=principal,expiresAt,source{
"schemaVersion": "tokedex.cli.v1",
"command": "auth status",
"data": {
"principal": {
"kind": "user",
"id": "usr_01M83XDKHP308B8X1770RJZ9PQ",
"name": "Ada Lovelace"
},
"expiresAt": "2026-12-23T09:59:27.105Z",
"source": {
"profile": "default",
"profileSource": "default",
"origin": "http://127.0.0.1:4000",
"hostSource": "profile",
"credential": "profile",
"ephemeral": false,
"browserSignIn": true
}
}
}expiresAt is when the token stops working; run tdx auth login again before then. browserSignIn shows the token came from browser sign-in, and plain tdx auth status also lists your permissions.
Diagnose a proxy connection#
Run tdx doctor when you connect through an HTTPS proxy. If it reports TRANSPORT_FAILED, test the proxy tunnel and TLS handshake against the same gateway URL. This health check needs no gateway credentials.
export TOKEDEX_URL='https://gateway.example.com'
curl --silent --show-error --output /dev/null \
--write-out 'Proxy CONNECT status %{http_connect}\n' "$TOKEDEX_URL/healthz"| Result | What to check |
|---|---|
Proxy CONNECT returns 407 | Check the credentials for your proxy. Set the proxy URL in HTTPS_PROXY or its lowercase equivalent. |
Proxy CONNECT returns 200 and curl reports a certificate trust error | Ask your network administrator for the trusted CA certificate. For tdx, set NODE_EXTRA_CA_CERTS to the path of its PEM file, then run tdx doctor again. |
Proxy CONNECT returns 000 and you expected a proxy | Check for a matching NO_PROXY entry and check the lowercase proxy variables. The CLI gives lowercase settings precedence. |
If the connection passes and the login check reports AUTHENTICATION_FAILED, sign in to the gateway again. See the CLI environment variables.
List workspaces#
tdx workspaces list --json --jq '.data.workspaces[] | {slug, name, status}'{
"slug": "default",
"name": "Default",
"status": "active"
}It lists the workspaces your role lets you read, as the dashboard's workspace switcher does. Without --jq, the command prints every field of each workspace, wrapped in the same object as auth status. --jq runs your installed jq on that object.
Connect another gateway#
Each profile holds one gateway. Sign in to another under a name, then pass that name to choose it:
tdx auth login --host https://gateway.example.com --profile staging
tdx workspaces list --profile stagingtdx auth logout --profile staging revokes that profile's token on the gateway and deletes the profile, so sign out of a machine you no longer use. A CI job or agent should not use your sign-in: give it an admin key through TOKEDEX_TOKEN and TOKEDEX_HOST, as Scripts and agents describes.
Next: Scripts and agents, the Command reference or API keys in the gateway docs.