Bot-Hosting CLI
Keep your editor, push what changed. One way, from your folder to your deployment.
Updated Dec 1, 2026The Bot-Hosting CLI keeps a folder on your computer linked to a deployment and pushes what changed. You keep your editor, your extensions and your git history. Save a file, it lands on the deployment, the app restarts.
bh deploy --watch
How it works, in short
- One way only. The CLI uploads files whose content changed, removes the files you deleted, and restarts. It never pulls server files back on its own.
- It never touches what it did not put there. Files your app writes on the server (a JSON store, a SQLite database, logs) stay where they are, on every deploy.
- Nothing runs on the server between deploys. No agent, no watcher, no RAM taken from your plan.
Before you start
- A deployment, in any runtime. The CLI only moves files.
- Node.js 20 or newer on your computer, for the CLI itself.
- Your code in a folder. An empty folder works too, the CLI can download the deployment's files into it.
Install
npm i -g bot-hosting
This gives you two commands, bot-hosting and the short bh. Without installing anything, npx bot-hosting <command> does the same.
Step 1. Create a key for the CLI
- Open your deployment and go to the Files tab.
- Click Open in IDE in the toolbar. The Open in your IDE guide shows the three commands you need.
- Under the first command, click Create a key for the CLI, then Copy key.
The key is shown once. It is a regular API key, limited to deployments, files and environment variables, and you can revoke it from Settings, then Developer. You can also create one yourself with the scopes account:read, deployments:read, deployments:power, files:read, files:write, env:read and env:write.
Step 2. Sign in
bh login
Paste the key when asked. The CLI checks it against your account and stores it in your home folder, readable by you only. Keys are stored per computer.
Step 3. Link your folder
cd my-bot
bh link
Without an id, the CLI lists your deployments and asks which one to link. Linking writes a small .bothosting/ folder that remembers the deployment, already ignored by git. Nothing is uploaded or downloaded at this point.
If the folder is empty, the CLI offers to download the deployment's files into it. You can also run bh pull at any time.
Step 4. Deploy
Look first with a dry run.
bh deploy --dry-run
It lists what would be uploaded and removed. The CLI compares every local file with the deployment by content hash, so only real changes travel. Then deploy for real.
bh deploy
bh logs -f
bh logs -f follows the console until you press Ctrl+C. bh logs -n 200 prints the last 200 lines.
Step 5. Deploy on every save
bh deploy --watch
Every save is deployed. Several saves in a row leave together in one deploy. A deleted file is removed from the deployment.
For a site served straight from disk, or when you save often and want a single restart at the end, use bh deploy --watch --no-restart, then bh restart when you are ready.
What gets deployed
Everything in the folder, except the following.
- What your
.gitignoreexcludes, sonode_modules,.envand build output stay home. .git, caches and editor folders.- Local databases (
*.sqlite,*.db,*.rdb). - What you list in
.bothostingignore(same syntax as.gitignore).
Later rules win. To deploy a folder your .gitignore excludes, such as a compiled dist/, re-include it.
# .bothostingignore
!dist/
Dependencies never travel. The deployment installs its own dependencies (for example from your package.json) at startup.
The rule about deleting
The CLI keeps a list of the files it has deployed or pulled. When you delete one of those locally, the next deploy removes it from the deployment. A file it never handled is never touched.
bh pull never deletes anything on your computer. It restores missing files, leaves identical ones alone, and replaces a file you changed locally only with --force.
Environment variables
bh env ls
bh env add TOKEN xxxxxxxx --secret
bh env rm OLD_FLAG
bh env pull
bh env pull writes a .env file from the deployment's variables, leaving secret values for you to fill in. Changes apply on the next restart.
Every command
| Command | Does |
|---|---|
bh login, bh logout, bh whoami |
Sign in with a key, sign out, show who you are |
bh link [id], bh unlink |
Link this folder to a deployment, or forget it |
bh deploy (also bh up, or just bh) |
Upload what changed, remove what you deleted, restart |
bh deploy --watch |
The same, after every save |
bh deploy --dry-run, bh status |
See what a deploy would change |
bh pull [--force] |
Download the deployment's files into this folder |
bh logs [-n 100] [-f] |
Console log, optionally followed |
bh restart |
Restart the deployment |
bh ls, bh open |
List your deployments, open this one in the dashboard |
bh env ls, add, rm, pull |
Environment variables |
Troubleshooting
| Message | What to do |
|---|---|
Not signed in |
Run bh login on this computer. |
Invalid or revoked API key |
The key was revoked. Create a new one and run bh login again. |
differs from the deployment (on pull) |
You changed a file locally that also changed on the server. Choose which one wins, then run bh pull --force or bh deploy. |
The process did not come up within 30 seconds |
The app crashed on start. Run bh logs to see why, usually a missing file or a syntax error. |
| Too many files to index | The deployment holds a huge folder, often dependencies uploaded by hand. Add it to .bothostingignore and try again. |
The CLI is on npm as bot-hosting. The full story is on the blog, deploy from your own editor with the Bot-Hosting CLI.
Prefer to let the AI in your editor deploy for you? Connect it through the MCP server.