CLI and APIs
Use the src CLI
You work in a terminal, and you want the forge there too, with the gh commands that you know. src is the CLI of TanStack Source: it takes the commands and flags of gh, and adds commands for the features that only TanStack Source has.
3 min read
Start here
Install src and log in. You install src with one command, log in once, and git uses the same login.
Find a command
- Use the gh commands that you know: issues, pull requests, repositories, Community, CI and skills.
- Use the commands that gh does not have: your profile, MCP servers, apps, monorepos, architecture and impact, the factory and bans.
- Get JSON and text out of src: only the fields that your script or your agent needs.
Later
- Log in from a script, a CI job or an agent: a token in
SRC_TOKEN, or a token that you approve in the browser. - Bring your gh aliases, and complete commands with Tab.
- Switch between two accounts, for example a work account and a personal account.
- Turn off the crash reports, and see what a report holds.
What every command shares
- Without
-R, a command acts on the repository of your clone. - Without a terminal,
srcnever asks a question. So the commands that delete, archive or rename need--yes. - Most
listandviewcommands have--json, for a script or an agent. src help supportlists each command and flag, and tells you whether it works now.
If a command fails
src prints why, and what to do next. For example:
| You see | Do this |
|---|---|
... Run src auth login. | Your login stopped working. Run src auth login. |
... Use a token that allows it: run src auth login, or src token create. | The token cannot do this. Log in again, or make a token with the action. |
... Try again in 30 seconds. | You sent too many requests. Wait for the time in the message. |
The forge had an error (HTTP 500). Try again in a moment. If it keeps failing, report it with the request id <id>. | Try again. If it fails again, report the request id. |
Could not reach source.tanstack.com: the host name was not found (ENOTFOUND). Check your connection, or the host name with src auth status. | Check your network, and the host in src auth status. |
If the browser login stops with The code expired before you approved it in the browser. or You denied the request in the browser., run src auth login again.