zenmux-statusline

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

zenmux-statusline

zenmux-statusline

You are installing a Claude Code status line that displays real-time ZenMux account information alongside standard session data.
The status line script is bundled at
scripts/zenmux-statusline.sh
relative to this skill. It produces a two-line display:
Line 1: [model-slug] 📁 dir | 🌿 branch | █████░░░░░ 58% ctx | 💾 r72.0k w5.0k
Line 2: ⚡ Ultra | 🔑 Sub sk-ss-...6e6 | 5h █░░░░ 19% · 7d █░░░░ 24% | 💳 Bal $492.74
If
ZENMUX_MANAGEMENT_KEY
is not set, Line 2 shows a setup hint instead:
Line 2: ⚙ Set ZENMUX_MANAGEMENT_KEY to display account data → zenmux.ai/platform/management
Follow these steps in order.

您将安装一个Claude Code状态栏,它会在显示标准会话数据的同时展示实时ZenMux账户信息。
状态栏脚本捆绑在本Skill的
scripts/zenmux-statusline.sh
路径下。它会生成两行显示内容:
Line 1: [model-slug] 📁 dir | 🌿 branch | █████░░░░░ 58% ctx | 💾 r72.0k w5.0k
Line 2: ⚡ Ultra | 🔑 Sub sk-ss-...6e6 | 5h █░░░░ 19% · 7d █░░░░ 24% | 💳 Bal $492.74
如果未设置
ZENMUX_MANAGEMENT_KEY
,第二行将显示设置提示:
Line 2: ⚙ Set ZENMUX_MANAGEMENT_KEY to display account data → zenmux.ai/platform/management
请按以下顺序执行步骤。

Step 1 — Verify prerequisites

步骤1 — 验证先决条件

1a. Check that
curl
and
jq
are available

1a. 检查
curl
jq
是否可用

bash
command -v curl && command -v jq
If either is missing, tell the user to install it (
brew install jq
on macOS, or the appropriate package manager).
bash
command -v curl && command -v jq
如果其中任意一个缺失,请告知用户进行安装(macOS系统使用
brew install jq
,其他系统使用对应的包管理器)。

1b. Check the Management API Key

1b. 检查管理API密钥

bash
echo "${ZENMUX_MANAGEMENT_KEY:+set}"
  • If the output is
    set
    — proceed to Step 2.
  • If empty — inform the user:
    The status line needs
    ZENMUX_MANAGEMENT_KEY
    to fetch account data. Create one at https://zenmux.ai/platform/management, then add to your shell profile:
    export ZENMUX_MANAGEMENT_KEY="sk-mg-v1-..."
    Without the key, the status line will still show session info (model, git, context remaining) and display a setup hint on Line 2.
    The user can proceed without the key — the script degrades gracefully and shows a hint on how to configure it.

bash
echo "${ZENMUX_MANAGEMENT_KEY:+set}"
  • 如果输出为
    set
    — 继续步骤2。
  • 如果输出为空 — 告知用户:
    状态栏需要
    ZENMUX_MANAGEMENT_KEY
    来获取账户数据。 请访问https://zenmux.ai/platform/management创建密钥,然后添加到您的shell配置文件中:
    export ZENMUX_MANAGEMENT_KEY="sk-mg-v1-..."
    若无该密钥,状态栏仍会显示会话信息(模型、git、剩余上下文),并在第二行显示设置提示。
    用户可以无需密钥继续操作 — 脚本会优雅降级,并显示配置提示。

Step 2 — Install the status line script

步骤2 — 安装状态栏脚本

Determine the absolute path to the bundled script. It lives next to this SKILL.md:
bash
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
确定捆绑脚本的绝对路径。它位于本SKILL.md的同级目录:
bash
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"

Falls back to the skill directory path from the skills install location

从Skill安装位置回退到Skill目录路径


Copy it to the Claude Code config directory:

```bash
cp "SKILL_SCRIPTS_DIR/zenmux-statusline.sh" ~/.claude/zenmux-statusline.sh
chmod +x ~/.claude/zenmux-statusline.sh
Where
SKILL_SCRIPTS_DIR
is the
scripts/
directory inside this skill. Use the actual resolved path.
If the user already has a
~/.claude/statusline*.sh
file, inform them that it will be replaced and confirm before overwriting.


将其复制到Claude Code配置目录:

```bash
cp "SKILL_SCRIPTS_DIR/zenmux-statusline.sh" ~/.claude/zenmux-statusline.sh
chmod +x ~/.claude/zenmux-statusline.sh
其中
SKILL_SCRIPTS_DIR
是本Skill内的
scripts/
目录。请使用实际解析路径。
如果用户已存在
~/.claude/statusline*.sh
文件,请告知用户该文件将被替换,并在覆盖前确认。

Step 3 — Configure Claude Code settings

步骤3 — 配置Claude Code设置

Read the user's current settings:
bash
cat ~/.claude/settings.json
Update the
statusLine
field to point to the new script. Preserve all other settings. The target configuration:
json
{
  "statusLine": {
    "type": "command",
    "command": "sh ~/.claude/zenmux-statusline.sh",
    "refreshInterval": 120
  }
}
The
refreshInterval: 120
re-runs the script every 120 seconds so the ZenMux data refreshes even during idle periods, matching the cache TTL.
Use the Edit tool to update the settings file. Be careful to preserve the existing JSON structure.

读取用户当前设置:
bash
cat ~/.claude/settings.json
更新
statusLine
字段以指向新脚本。保留所有其他设置。目标配置如下:
json
{
  "statusLine": {
    "type": "command",
    "command": "sh ~/.claude/zenmux-statusline.sh",
    "refreshInterval": 120
  }
}
refreshInterval: 120
表示每120秒重新运行一次脚本,以便即使在空闲期间ZenMux数据也能刷新,与缓存TTL匹配。
使用编辑工具更新设置文件。注意保留现有JSON结构。

Step 4 — Verify the installation

步骤4 — 验证安装

Test the script with mock input to confirm it runs without errors:
bash
echo '{"model":{"id":"test-model"},"workspace":{"current_dir":"'$(pwd)'"},"context_window":{"used_percentage":0},"session_id":"verify-install"}' | sh ~/.claude/zenmux-statusline.sh
If output appears (at least one line), the installation is successful.
Tell the user:
Status line installed. It will appear at the bottom of Claude Code on your next interaction.
What it shows:
  • Line 1: Model slug, directory, git branch, context used bar, last-call prompt cache read/write
  • Line 2: ZenMux plan tier, API key type + masked key, 5-hour and 7-day quota usage with color-coded bars, PAYG wallet balance
Colors:
  • Context used: Green (<70%), yellow (70–89%), red (90%+)
  • Quota usage: Green (<70%), yellow (70–89%), red (90%+)
Caching: ZenMux API data is cached for 120 seconds to keep the status line fast. Git data is cached for 5 seconds.
To remove it later, delete the
statusLine
field from
~/.claude/settings.json
.

使用模拟输入测试脚本,确认其无错误运行:
bash
echo '{"model":{"id":"test-model"},"workspace":{"current_dir":"'$(pwd)'"},"context_window":{"used_percentage":0},"session_id":"verify-install"}' | sh ~/.claude/zenmux-statusline.sh
如果出现输出(至少一行),则安装成功。
告知用户:
状态栏已安装。下次交互时,它将显示在Claude Code底部。
显示内容:
  • 第一行:模型标识、目录、git分支、上下文使用进度条、上次调用提示缓存读写量
  • 第二行:ZenMux计划等级、API密钥类型+掩码密钥、带颜色编码进度条的5小时和7天配额使用情况、PAYG钱包余额
颜色规则:
  • 上下文使用量:绿色(<70%)、黄色(70–89%)、红色(90%+)
  • 配额使用量:绿色(<70%)、黄色(70–89%)、红色(90%+)
缓存机制:ZenMux API数据缓存120秒以保证状态栏响应速度。Git数据缓存5秒。
后续如需移除,请从
~/.claude/settings.json
中删除
statusLine
字段。

Communication guidelines

沟通指南

  • Respond in the same language the user writes in (Chinese → Chinese, English → English).
  • If any step fails, diagnose the error clearly and suggest a fix before moving on.
  • Do not make changes to
    ~/.claude/settings.json
    without showing the user what will change.
  • 使用用户书写的语言回复(中文→中文,英文→英文)。
  • 如果任何步骤失败,请清晰诊断错误并建议修复方案后再继续。
  • 在未向用户展示更改内容前,请勿修改
    ~/.claude/settings.json