BRICKS CLI
CLI for BRICKS Workspace API — manage devices, apps, modules, and media.
Scope note: This skill covers cloud API operations (device/app/module/media management) and local-network device interaction (LAN discovery, MCP bridging). The use-desktop-acp rule extends scope further to include bridging with the BRICKS Project Desktop agent, which shares sessions and can execute commands in project context. See the Security section below for details.
Installation (if not yet)
CODEBLOCK0
Authentication
CODEBLOCK1
Global --auth-profile Flag
Use -ap or --auth-profile to override the active profile for any command, without switching the stored profile:
CODEBLOCK2
Priority: --auth-profile flag > BRICKS_PROFILE env > stored current profile.
Device Management
List & Info
CODEBLOCK3
Control
CODEBLOCK4
Screenshot
CODEBLOCK5
Monitor (Interactive-tty needed)
CODEBLOCK6
Device Groups
CODEBLOCK7
Applications
CODEBLOCK8
Modules
CODEBLOCK9
Project Init Options
Both app and module support these flags:
- -
-o, --output <dir> — output directory - INLINECODE9 — skip prompts, use defaults
- INLINECODE10 — skip git initialization
- INLINECODE11 — skip INLINECODE12
- INLINECODE13 — skip GitHub Actions workflow
- INLINECODE14 — skip AGENTS.md
- INLINECODE15 — skip CLAUDE.md
- INLINECODE16 — include GEMINI.md (off by default)
Media Flow
CODEBLOCK10
Config
CODEBLOCK11
Interactive Mode (Interactive-tty needed)
CODEBLOCK12
DevTools (LAN Discovery)
CODEBLOCK13
Devices must have "Enable LAN Discovery" turned on in Advanced Settings (on by default).
MCP Server
CODEBLOCK14
Bridging Device MCP to Local CLI
Use mcporter to bridge a device's MCP endpoint as a local MCP server (STDIO), so tools like Claude Code can connect to it:
CODEBLOCK15
ACP Bridge (BRICKS Project Desktop)
Connect external ACP clients to the running BRICKS Project Desktop (docs).
CODEBLOCK16
The bridge pipes ACP JSON-RPC over stdio ↔ the app's Unix socket (~/.bricks-project-desktop/acp.sock). It shares the app's sessions and MCP state.
Security: Commands executed through the ACP bridge run in the project's working directory. Only enable ACP when actively needed, and prefer --deny-all over --approve-all when automating. See the Security section and rule use-desktop-acp for details.
See rule use-desktop-acp for full usage with acpx and OpenClaw.
Rules
- -
connect-local-device — Deploy the current app to a local LAN device, then monitor status, debug, and run automations via MCP - INLINECODE23 — Connect to the BRICKS Project Desktop agent via ACP for headless prompting, session management, and multi-agent orchestration
Security
- - Auto-approve risk: Running
acpx --approve-all allows the bridged agent to execute bash commands without confirmation. Prefer explicit approval or --deny-all for untrusted prompts. Never combine --approve-all with persistent config in unattended/shared environments. - Persistent config: Creating
~/.acpx/config.json enables future ACP sessions without re-specifying the agent. This is convenient but means any process that invokes acpx bricks can start a session with project file access. Remove the config when not actively needed. - Device passcodes: LAN device MCP bridging (
mcporter) requires passing device passcodes as Bearer tokens. Treat passcodes as secrets — do not log or commit them. - LAN discovery:
bricks devtools scan broadcasts on the local network. Only run on trusted networks.
Tips
- - Use
-j or --json on most commands for JSON output - Device IDs are UUIDs — use
device list to find them - Get workspace token from: https://control.bricks.tools → Workspace Settings → API Token
BRICKS CLI
BRICKS Workspace API的CLI工具——管理设备、应用、模块和媒体。
范围说明: 此技能涵盖云API操作(设备/应用/模块/媒体管理)以及本地网络设备交互(LAN发现、MCP桥接)。use-desktop-acp规则进一步扩展范围,包括与BRICKS Project Desktop代理的桥接,该代理共享会话并可在项目上下文中执行命令。详情请参阅下方安全章节。
安装(如尚未安装)
bash
验证是否已安装
which bricks
npm(由@fugood在npmjs.com发布 — https://www.npmjs.com/package/@fugood/bricks-cli)
npm i -g @fugood/bricks-cli
Bun
bun add -g @fugood/bricks-cli
身份认证
bash
使用一次性密码登录(从 https://control.bricks.tools 获取)
bricks auth login
查看认证状态
bricks auth status
切换配置文件
bricks auth list
bricks auth use
全局 --auth-profile 标志
使用 -ap 或 --auth-profile 可为任何命令覆盖当前激活的配置文件,而无需切换已存储的配置文件:
bash
以特定配置文件运行任何命令
bricks -ap staging device list
bricks --auth-profile production app list
同样适用于登录 — 将令牌保存到指定配置文件
bricks -ap staging auth login
优先级:--auth-profile 标志 > BRICKS_PROFILE 环境变量 > 已存储的当前配置文件。
设备管理
列表与信息
bash
列出所有设备
bricks device list
bricks device list -j # JSON输出
bricks device list -k lobby # 按关键词筛选
获取设备详情
bricks device get
bricks device get -j # JSON输出
控制
bash
刷新设备(重新加载应用)
bricks device refresh
清除设备缓存
bricks device clear-cache
发送控制命令
bricks device control
bricks device control -p {key:value}
截图
bash
截取并保存截图
bricks device screenshot
bricks device screenshot -o /tmp/screen.png
获取已有截图(不重新截取)
bricks device screenshot --no-take
监控(需要交互式终端)
bash
监控所有设备(每60秒轮询)
bricks device monitor
监控特定分组
bricks device monitor -g
自定义间隔
bricks device monitor -i 30
设备分组
bash
列出分组
bricks group list
获取分组详情
bricks group get
列出分组内设备及其状态
bricks group devices
向分组内所有设备发送操作指令
bricks group dispatch
刷新分组内所有设备
bricks group refresh
监控分组
bricks group monitor
应用
bash
创建新应用
bricks app new -n My App
bricks app new -n My App -d Description --layout-width 192 --layout-height 108
bricks app new -n My App --example # 从示例模板创建
bricks app new -n My App --init -y # 创建并初始化本地项目
bricks app new -n My App -j # JSON输出
列出应用
bricks app list
获取应用详情
bricks app get
更新应用
bricks app update
根据BRICKS模式验证配置
bricks app check-config ./config.json
bricks app check-config ./config.json -j # JSON输出
绑定设备到应用
bricks app bind
快速属性编辑
bricks app short-edit
拉取源文件
bricks app project-pull
从应用初始化本地项目
bricks app project-init
bricks app project-init -o ./my-app
bricks app project-init -y # 跳过提示,使用默认值
bricks app project-init --no-git # 跳过git初始化
模块
bash
创建新模块
bricks module new -n My Module
bricks module new -n My Module --public --allow-modify
bricks module new -n My Module --init -y # 创建并初始化本地项目
bricks module new -n My Module -j # JSON输出
bricks module list
bricks module get
bricks module update
bricks module short-edit
bricks module release
从模块初始化本地项目
bricks module project-init
bricks module project-init -o ./my-module -y
项目初始化选项
app 和 module 均支持以下标志:
- - -o, --output — 输出目录
- -y, --yes — 跳过提示,使用默认值
- --no-git — 跳过git初始化
- --no-install — 跳过 bun install
- --no-github-actions — 跳过GitHub Actions工作流
- --no-agents — 跳过AGENTS.md
- --no-claude — 跳过CLAUDE.md
- --gemini — 包含GEMINI.md(默认不包含)
媒体流
bash
bricks media boxes # 列出媒体盒
bricks media box # 媒体盒详情
bricks media files # 媒体盒中的文件(显示就绪状态)
bricks media file # 文件详情(显示就绪状态)
上传文件到媒体盒
bricks media upload ./photo.jpg
bricks media upload ./img1.jpg ./img2.png # 多个文件
bricks media upload ./photos/*.jpg -j # JSON输出
带标签和描述上传
bricks media upload ./file.pdf -t docs -t report -d Monthly report
带图像处理选项上传
bricks media upload ./banner.jpg --image-version 250x250:FILL --image-version 800x600:BOUNDED
bricks media upload ./logo.png --image-version-type png
带AI分析上传
bricks media upload ./photo.jpg --enable-ai-analysis
bricks media upload ./photo.jpg --ai-instruction Describe the scene
控制并发数
bricks media upload ./files/* --concurrency 5
配置
bash
bricks config show # 显示当前配置
bricks config endpoint # 显示API端点
bricks config endpoint beta # 切换到beta端点
交互模式(需要交互式终端)
bash
bricks interactive # 或:bricks i
DevTools(LAN发现)
bash
通过UDP广播扫描LAN中的DevTools服务器
bricks devtools scan
bricks devtools scan -t 5000 # 自定义超时(毫秒)
bricks devtools scan -j # JSON输出
bricks devtools scan --verify # 通过HTTP验证每个服务器
显示设备的连接URL
bricks devtools open
bricks devtools open -p 19853 # 自定义端口
bricks devtools open --verify # 先验证是否可达
设备必须在高级设置中开启启用LAN发现(默认开启)。
MCP服务器
bash
bricks mcp start # 启动MCP服务器(STDIO模式)
桥接设备MCP到本地CLI
使用mcporter将设备的MCP端点桥接为本地MCP服务器(STDIO),使Claude Code等工具可以连接到它:
bash
桥接设备的MCP端点(需要密码作为Bearer令牌)
npx mcporter --url http://:19851/mcp --header Authorization: Bearer