Manage projects from the command line
The `@@CLI@@ project` command lists, creates, shows and archives projects.
The heybug project command lists, creates, shows and archives projects. Use it from a terminal or a script when you do not want to open the web app. Every command talks to the same server as the web app, so it shows the same projects for the same workspace.
What it is for
A project is one website you test, with its address, its test plan and its runs. Use the command to:
- see which projects exist, and their IDs;
- add a site before you start a run on it;
- check one project's address, plan and case count;
- archive a project you no longer test.
Before you start
Set two environment variables. The command never prompts for them.
| Variable | What to set it to |
|---|---|
HEYBUG_TOKEN | An API token. Create one in Settings > API tokens. |
HEYBUG_SERVER | Your server's address. If you leave it out, the command uses http://localhost:8080. |
To save the token for later sessions, pipe it into heybug auth login --token-stdin. Check the saved sign-in with heybug auth status. Browser sign-in with heybug login is not in this build, so use a token.
The steps
- List your projects to find an ID:
heybug project list. - Create a project for a new site:
heybug project create --url <address>. Add--nameto set a display name; without it, the host name is used. - Look at one project:
heybug project get <id>. The ID can come before or after the flags. - Archive a project you no longer test:
heybug project archive <id>. An archived project leaves the list.
For scripts, add --output json to any command. The output is then JSON, which you can read with jq.
Example
The output below is a real run of the command against a test server, with made-up data. Your IDs and counts will differ.
export HEYBUG_SERVER=https://opentest.nagara.cloud
export HEYBUG_TOKEN=<your token>
heybug project create --url https://shop.example.com --name Shop
heybug project list
heybug project get prj_9f2c
heybug project archive prj_9f2cCreated project Shop (prj_new1)
ID NAME URL CASES STATE
prj_9f2c Shop https://shop.example.com 12 active
Shop active
id: prj_9f2c
url: https://shop.example.com
plan: plan_41
cases: 12
description:
Archived project prj_9f2cFor a script, pass --output json. Archive prints this:
{
"archived": true,
"id": "prj_9f2c"
}Exit codes
| Code | When it happens |
|---|---|
| 0 | The command worked. |
| 2 | A flag or argument is missing, or --output is not text or json. Nothing is sent to the server. |
| 3 | HEYBUG_TOKEN is not set, or the server rejected the token. |
| 4 | No project has that ID. |
| 5 | The server rejected the input, for example an address it does not accept. |
| 6 | The server could not be reached, or it failed. |
Every code is listed in CLI exit codes.
The same actions in MCP
Your coding agent can use the same actions through MCP. heybug_list_projects lists projects, and heybug_create_project adds one. Getting and archiving a project are CLI commands only for now.
When it fails
| Message | What it means | What to do |
|---|---|---|
project create needs --url | The site address is missing. | Add --url https://.... |
project get needs a project id | No ID was given. | Pass the ID as an argument or with --id. Get it from heybug project list. |
--output must be text or json | The output value is wrong. | Use --output text or --output json. |
HEYBUG_TOKEN is not set (exit 3) | The command has no token. | Create a token and export it. |
| Exit 3 with a rejected token | The token is wrong, expired or revoked. | Create a new token and export it again. |
| A "not found" message (exit 4) | The ID is wrong, or the project belongs to another workspace. | Run heybug project list and copy the ID again. |
| Exit 5 | The server did not accept a value, such as an address it refuses. | Read the message, fix the value and run the command again. |
| Exit 6 | The server is not reachable, or it failed. | Check HEYBUG_SERVER, then run heybug doctor. |
Related guides
- CLI: the full command list and signing in.
- CLI exit codes: what each code means in scripts.
- MCP: the tools your coding agent can call.
- Getting started: your first project and run.
- Troubleshooting: common problems and their fixes.