zenmux-statusline
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesezenmux-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 relative to this skill. It produces a two-line display:
scripts/zenmux-statusline.shLine 1: [model-slug] 📁 dir | 🌿 branch | █████░░░░░ 58% ctx | 💾 r72.0k w5.0k
Line 2: ⚡ Ultra | 🔑 Sub sk-ss-...6e6 | 5h █░░░░ 19% · 7d █░░░░ 24% | 💳 Bal $492.74If is not set, Line 2 shows a setup hint instead:
ZENMUX_MANAGEMENT_KEYLine 2: ⚙ Set ZENMUX_MANAGEMENT_KEY to display account data → zenmux.ai/platform/managementFollow these steps in order.
您将安装一个Claude Code状态栏,它会在显示标准会话数据的同时展示实时ZenMux账户信息。
状态栏脚本捆绑在本Skill的路径下。它会生成两行显示内容:
scripts/zenmux-statusline.shLine 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_KEYLine 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
curljq1a. 检查curl
和jq
是否可用
curljqbash
command -v curl && command -v jqIf either is missing, tell the user to install it ( on macOS, or the appropriate package manager).
brew install jqbash
command -v curl && command -v jq如果其中任意一个缺失,请告知用户进行安装(macOS系统使用,其他系统使用对应的包管理器)。
brew install jq1b. Check the Management API Key
1b. 检查管理API密钥
bash
echo "${ZENMUX_MANAGEMENT_KEY:+set}"-
If the output is— proceed to Step 2.
set -
If empty — inform the user:The status line needsto fetch account data. Create one at https://zenmux.ai/platform/management, then add to your shell profile:
ZENMUX_MANAGEMENT_KEYexport 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}"-
如果输出为— 继续步骤2。
set -
如果输出为空 — 告知用户:状态栏需要来获取账户数据。 请访问https://zenmux.ai/platform/management创建密钥,然后添加到您的shell配置文件中:
ZENMUX_MANAGEMENT_KEYexport 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.shWhere is the directory inside this skill. Use the actual resolved path.
SKILL_SCRIPTS_DIRscripts/If the user already has a file, inform them that it will be replaced and confirm before overwriting.
~/.claude/statusline*.sh
将其复制到Claude Code配置目录:
```bash
cp "SKILL_SCRIPTS_DIR/zenmux-statusline.sh" ~/.claude/zenmux-statusline.sh
chmod +x ~/.claude/zenmux-statusline.sh其中是本Skill内的目录。请使用实际解析路径。
SKILL_SCRIPTS_DIRscripts/如果用户已存在文件,请告知用户该文件将被替换,并在覆盖前确认。
~/.claude/statusline*.shStep 3 — Configure Claude Code settings
步骤3 — 配置Claude Code设置
Read the user's current settings:
bash
cat ~/.claude/settings.jsonUpdate the field to point to the new script. Preserve all other settings. The target configuration:
statusLinejson
{
"statusLine": {
"type": "command",
"command": "sh ~/.claude/zenmux-statusline.sh",
"refreshInterval": 120
}
}The re-runs the script every 120 seconds so the ZenMux data refreshes even during idle periods, matching the cache TTL.
refreshInterval: 120Use the Edit tool to update the settings file. Be careful to preserve the existing JSON structure.
读取用户当前设置:
bash
cat ~/.claude/settings.json更新字段以指向新脚本。保留所有其他设置。目标配置如下:
statusLinejson
{
"statusLine": {
"type": "command",
"command": "sh ~/.claude/zenmux-statusline.sh",
"refreshInterval": 120
}
}refreshInterval: 120使用编辑工具更新设置文件。注意保留现有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.shIf 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 thefield fromstatusLine.~/.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 without showing the user what will change.
~/.claude/settings.json
- 使用用户书写的语言回复(中文→中文,英文→英文)。
- 如果任何步骤失败,请清晰诊断错误并建议修复方案后再继续。
- 在未向用户展示更改内容前,请勿修改。
~/.claude/settings.json