Using bool-cli
CLI tool for managing projects on Bool.com. Requires Node.js >=18.
Prerequisites
- 1. Install: INLINECODE0
- Authenticate: Set
BOOL_API_KEY env var, or run bool auth login interactively - Verify: Run
bool auth status to confirm the connection
The API key is saved to ~/.config/bool-cli/config.json. The BOOL_API_KEY environment variable takes precedence over the saved config.
Important: Non-Interactive Commands
The bool auth login and bool bools delete <slug> commands are interactive (they prompt for input). When using them from an agent:
- - Auth: Set the
BOOL_API_KEY environment variable instead of running INLINECODE9 - Delete: Always pass
-y / --yes to skip the confirmation prompt: INLINECODE12
Commands Reference
Authentication
CODEBLOCK0
Managing Bools
CODEBLOCK1
Visibility options: private, team, unlisted, INLINECODE16
Versions & Deployment
CODEBLOCK2
Quick Ship (Anonymous Bools)
Ship a project without needing an API key:
CODEBLOCK3
The shipit command stores the slug and secret in .bool/config so subsequent runs in the same directory automatically update the same Bool.
JSON Output
All commands support --json for machine-readable output. Always use --json when you need to parse output programmatically.
CODEBLOCK4
Project Config (.bool/config)
When you deploy, pull, or shipit in a directory, bool-cli stores project metadata in .bool/config:
CODEBLOCK5
This allows you to omit the [slug] argument on subsequent commands when working in the same directory. For example:
CODEBLOCK6
Add .bool/ to your .gitignore to keep secrets local.
Common Workflows
Create and deploy a new Bool (Option A: explicit)
CODEBLOCK7
Create and deploy a new Bool (Option B: auto-create)
CODEBLOCK8
This creates a Bool named after the directory and displays the live URL.
Quick anonymous ship (no API key needed)
CODEBLOCK9
Pull, edit, and redeploy
CODEBLOCK10
Check what's deployed
CODEBLOCK11
Manage visibility
CODEBLOCK12
Deploy a specific subdirectory with exclusions
CODEBLOCK13
Deploy Behavior
- -
bool deploy recursively reads the directory and uploads all text files - Auto-create Bool: If no slug is provided (and no
.bool/config exists), a new Bool is created automatically, named after the directory - Live URL: The live deployment URL is displayed in the output after successful deployment
- Binary files (images, PDFs, archives, fonts, etc.) are automatically skipped
- Default excludes:
.git, node_modules, __pycache__, .DS_Store, INLINECODE32 - Custom excludes: Use
--exclude <pattern> (repeatable) for additional patterns .boolignore: If a .boolignore file exists in the deploy directory, it is respected (gitignore syntax)- File paths in the payload are relative to the deploy directory
Pull Behavior
- -
bool pull <slug> downloads files to ./<slug>/ by default - Specify a custom output directory: INLINECODE38
- Pull a specific version: INLINECODE39
- Creates subdirectories as needed
Environment Variables
| Variable | Purpose | Default |
|---|
| INLINECODE40 | API key (overrides saved config) | — |
| INLINECODE41 |
API base URL |
https://bool.com/api |
|
BOOL_BASE_URL | Base URL for shipit |
https://bool.com |
Error Handling
- - All errors print to stderr with a non-zero exit code
- API errors surface the server's error message (e.g.,
"Bool not found") - If no API key is configured, commands fail with: INLINECODE46
Tips
- - Use
bool bools list --json | jq '.[].slug' to get all slugs for scripting - The Bool slug (not name) is the identifier used in all commands
- After
bool bools create, the slug is derived from the name (e.g., "My Project" -> my-project) - Use
bool bools info <slug> --json to get the latest version number programmatically - The live URL for any Bool is INLINECODE51
使用 bool-cli
用于管理 Bool.com 上项目的 CLI 工具。需要 Node.js >=18。
前提条件
- 1. 安装:npm install -g bool-cli
- 认证:设置 BOOLAPIKEY 环境变量,或交互式运行 bool auth login
- 验证:运行 bool auth status 确认连接
API 密钥保存到 ~/.config/bool-cli/config.json。BOOLAPIKEY 环境变量优先级高于已保存的配置。
重要提示:非交互式命令
bool auth login 和 bool bools delete 命令是交互式的(会提示输入)。当从代理中使用时:
- - 认证:设置 BOOLAPIKEY 环境变量,而不是运行 bool auth login
- 删除:始终传递 -y / --yes 跳过确认提示:bool bools delete -y
命令参考
认证
bash
bool auth login # 交互式:提示输入 API 密钥
bool auth status # 检查认证 + API 健康状态(非交互式)
管理 Bools
bash
bool bools list [count] # 列出 Bools(默认:5)
bool bools create # 创建新的 Bool
bool bools info [slug] # 显示 Bool 详情 + 最新版本信息
bool bools update [slug] --name 新名称 --description 描述 --visibility public
bool bools delete [slug] -y # 删除 Bool(始终使用 -y 跳过提示)
bool bools open [slug] # 在浏览器中打开 Bool
bool bools visibility [slug] # 显示当前可见性
bool bools visibility [slug] --set private # 更改可见性
可见性选项:private、team、unlisted、public
版本与部署
bash
bool versions [slug] # 列出版本历史
bool deploy [slug] [dir] -m 提交信息 # 部署本地文件(如有需要自动创建 Bool)
bool pull [slug] [dir] --version N # 本地下载文件
快速发布(匿名 Bools)
无需 API 密钥即可发布项目:
bash
bool shipit [directory] # 创建匿名 Bool + 部署
bool shipit --slug -m 更新信息 # 更新现有匿名 Bool
bool shipit --name 我的项目 # 设置自定义名称
shipit 命令将 slug 和密钥存储在 .bool/config 中,因此在同一目录下后续运行会自动更新同一个 Bool。
JSON 输出
所有命令支持 --json 以输出机器可读格式。当需要以编程方式解析输出时,始终使用 --json。
bash
bool bools list --json
bool bools info my-project --json
bool versions my-project --json
项目配置(.bool/config)
当在目录中部署、拉取或发布时,bool-cli 将项目元数据存储在 .bool/config 中:
json
{
slug: my-project,
name: 我的项目,
secret: 可选的匿名密钥
}
这允许你在同一目录下工作时,在后续命令中省略 [slug] 参数。例如:
bash
第一次:显式指定 slug
bool deploy my-project ./src -m 初始部署
之后,从同一目录运行,slug 从 .bool/config 读取
bool deploy -m 另一次部署
bool versions
bool bools info
将 .bool/ 添加到 .gitignore 以保持密钥本地化。
常见工作流程
创建并部署新的 Bool(选项 A:显式)
bash
bool bools create 我的项目
从输出中记下 slug,例如 my-project
bool deploy my-project ./src -m 初始部署
创建并部署新的 Bool(选项 B:自动创建)
bash
不带 slug 部署——自动创建新的 Bool
bool deploy ./src -m 初始部署
这会创建一个以目录命名的 Bool,并显示实时 URL。
快速匿名发布(无需 API 密钥)
bash
bool shipit ./my-project
输出:https://.bool01.com
从同一目录后续更新:
bool shipit ./my-project -m 更新版本
拉取、编辑并重新部署
bash
bool pull my-project ./my-project
... 对 ./my-project/ 中的文件进行修改 ...
bool deploy my-project ./my-project -m 更新文件
检查已部署内容
bash
bool bools info my-project # 查看最新版本摘要
bool versions my-project # 查看完整版本历史
bool pull my-project ./tmp # 下载当前文件进行检查
管理可见性
bash
bool bools visibility my-project # 显示当前可见性
bool bools visibility my-project --set private # 设为私有
bool bools visibility my-project --set public # 设为公开
部署带有排除项的特定子目录
bash
bool deploy my-project ./src --exclude .test.js --exclude .spec.js -m 生产构建
部署行为
- - bool deploy 递归读取目录并上传所有文本文件
- 自动创建 Bool:如果未提供 slug(且不存在 .bool/config),则自动创建新的 Bool,以目录命名
- 实时 URL:成功部署后,实时部署 URL 会显示在输出中
- 二进制文件(图片、PDF、压缩包、字体等)会自动跳过
- 默认排除项:.git、nodemodules、pycache、.DSStore、.bool
- 自定义排除项:使用 --exclude (可重复)添加额外模式
- .boolignore:如果部署目录中存在 .boolignore 文件,则会遵循该文件(gitignore 语法)
- 负载中的文件路径相对于部署目录
拉取行为
- - bool pull 默认下载文件到 .//
- 指定自定义输出目录:bool pull ./my-dir
- 拉取特定版本:bool pull --version 3
- 根据需要创建子目录
环境变量
| 变量 | 用途 | 默认值 |
|---|
| BOOLAPIKEY | API 密钥(覆盖已保存的配置) | — |
| BOOLAPIURL |
API 基础 URL | https://bool.com/api |
| BOOL
BASEURL | 发布的基础 URL | https://bool.com |
错误处理
- - 所有错误输出到 stderr,并返回非零退出码
- API 错误会显示服务器的错误消息(例如 Bool not found)
- 如果未配置 API 密钥,命令会失败并显示:未配置 API 密钥。运行:bool auth login
提示
- - 使用 bool bools list --json | jq .[].slug 获取所有 slug 用于脚本编写
- Bool 的 slug(而非名称)是所有命令中使用的标识符
- 执行 bool bools create 后,slug 从名称派生(例如 我的项目 -> my-project)
- 使用 bool bools info --json 以编程方式获取最新版本号
- 任何 Bool 的实时 URL 为 https://.bool01.com