@astralbeam/cli

中文文档
0.30.1发布于 2026/11/07MITES Module零依赖构建来源已验证近 30 天下载 3118

Command-line interface for AstralBeam organization admins and their coding agents

原始使用文档
文档目录5 节
  1. Install
  2. Sign in
  3. Commands
  4. Output and exit codes
  5. Coding agents

@astralbeam/cli

Manage an AstralBeam organization's Tenants and TenantUsers, mint short-lived tokens, and test its agents from the terminal. Use --json for scripts and coding agents.

Install

Run it with npm on Node 22.12 or later, with no install step:

npx @astralbeam/cli --help

Or install it globally as astralbeam:

npm install --global @astralbeam/cli

Each GitHub release also attaches standalone binaries that need no Node, named astralbeam-<platform> for linux-x86_64, linux-arm64, macos-x86_64, macos-arm64, and windows-x86_64.exe. The releases/latest/download URL always serves the newest release, so rerunning the download upgrades the CLI.

curl -fsSLo astralbeam https://github.com/AstralBeamAI/astralbeam/releases/latest/download/astralbeam-macos-arm64
chmod +x astralbeam
mv astralbeam /usr/local/bin/astralbeam

NOTE: The binaries are not signed. On macOS, a binary downloaded through a browser needs xattr -d com.apple.quarantine <file> before its first run.

Sign in

Create an API key in the dashboard under API keys, then log in from the directory where you work on that organization. The prompt hides the pasted key, and piped stdin works too:

cd ~/work/acme
astralbeam auth login

login reads the organization's name and slug from the API, which also proves the key works, then binds the key to that directory and everything below it. Bindings live in ~/.config/astralbeam/config.json (%APPDATA%\astralbeam on Windows) with owner-only permissions, never in the directory itself. To manage another organization, log in again from its own directory. For a self-hosted deployment, pass its /api base:

cd ~/work/globex
astralbeam auth login --api-url https://beam.example.com/api

Every command then uses the nearest bound directory at or above where it runs, and prints that organization to stderr first, so stdout stays parseable:

▸ Acme (acme) · org 01990a5d-… · bound at ~/work/acme

A directory with no bound ancestor fails with exit code 1 instead of guessing an organization. For CI and agents, set ASTRALBEAM_API_KEY, which overrides any binding, and ASTRALBEAM_API_URL when self-hosting. The URL also overrides a bound key's saved URL. ASTRALBEAM_CONFIG_DIR selects the directory containing config.json. API URLs require HTTPS, except for HTTP on loopback hosts (localhost, IPv4 127.0.0.0/8, or [::1]).

Check the binding commands will use, or list them all:

astralbeam auth status
astralbeam auth list

Commands

CommandDoes
auth login, auth logout, auth status, auth listBind, unbind, verify, and list directory logins
tenants list, get, create, updateManage Tenants
tenant-users list, get, create, updateManage a Tenant's users
tenant-users usage getRead users' usage in USD over a time range
threads, organizationRead thread directory data and organization details
tenants threads messages listRead a saved conversation's messages
token chatMint a chat JWT for a Tenant's user, as your token endpoint would
token organizationMint an organization-management JWT for a member
chatChat with an agent as a Tenant's user
skill, skill installPrint or install the bundled Agent Skill

Run astralbeam <command> --help for every flag. Tenant lists take --external-id, -q / --search, --page-size, --page-after, and --page-before. TenantUser lists also take --admin true|false. Writes also accept --body '<json>' or --body @file.json. Clear a name with --body '{"name":null}'.

Forge's --dry-run prints a local JSON request preview without sending HTTP or validating with the server. It reads configuration and supplied @file contents.

astralbeam tenants create --external-id customer-42 --name "Acme Logistics" --metadata '{"plan":"pro"}'
astralbeam tenants list --external-id customer-42 --json
astralbeam tenant-users create <tenant-id> --external-id user-7 --name "Alex Morgan"
astralbeam chat --tenant customer-42 --user user-7 "What can you do?"

Output and exit codes

Human-readable tables and records go to stdout. With --json, records and pages stay in API format, and non-interactive operations write one stderr object: {"context": {...}} on success or {"error": {...}, "context": {...}} on failure. API failures retain their problem details, while runtime and usage errors provide error.detail. Help and version output remain plain text. Commands exit with 0 on success, 1 when the API, generated input handling, or runtime fails, and 2 for parser usage errors.

For unexpected failures, use --debug to log HTTP methods, URLs, status, duration, and stack traces to stderr, without headers. It adds lines beyond the JSON object. After a failed write, check whether it succeeded before retrying.

Coding agents

The CLI ships an Agent Skill for app integration and CLI usage. Let's install it in the current project's .agents/skills directory:

astralbeam skill install

Commit .agents/skills/astralbeam/SKILL.md to share it with the team and make it available in fresh checkouts. For Claude Code, pass --dir .claude/skills. Use --dir <path> for another project or a user-level directory. Then give the agent credentials by logging in from the project directory or through ASTRALBEAM_API_KEY, never in the prompt.

The full guide is at astralbeam.ai/docs/cli/getting-started.

版本与发布记录

@astralbeam/cli 共发布 51 个版本,首次发布于 2026/09/24;过去 12 个月发布了 51 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.30.1latest2026/11/07今天
0.30.32026/11/07今天
0.30.42026/11/07今天
0.30.02026/11/07今天
0.29.62026/11/07今天
0.29.52026/11/071 天前

关于 @astralbeam/cli 的常见问题

@astralbeam/cli 是什么?

Command-line interface for AstralBeam organization admins and their coding agents

如何安装 @astralbeam/cli?

在项目目录运行 npm install @astralbeam/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 astralbeam,可以用 npx astralbeam 直接运行。

@astralbeam/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/astralbeam__cli 是否存在。

@astralbeam/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@astralbeam/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@astralbeam/cli 可以商用吗?

@astralbeam/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@astralbeam/cli 的下载量有多少?

根据 npm 官方下载统计,@astralbeam/cli 在 2026/10/07 – 2026/11/05 这 30 天内被下载 3,118 次,日均约 104 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@astralbeam/cli 还在维护吗?

最新版本 0.30.1 发布于 2026/11/07(今天);至今共发布 51 个版本,其中过去 12 个月发布了 51 个;首次发布于 2026/09/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。