Skip to content
Development
Command

/setup

配置 claude-mini-hud 作为 Claude Code 的状态栏 (支持中/英文选择)

From plugin
claude-mini-hud
101 skill1 command
Install
> /plugin marketplace add zander-zyx/claude-mini-hud
> /plugin install claude-mini-hud@claude-mini-hud

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/setup

Context preview

What this command does when you run it.

配置 claude-mini-hud 作为 Claude Code 的状态栏 (支持中/英文选择)

Command definition

setup.md
description: 配置 claude-mini-hud 作为 Claude Code 的状态栏 (支持中/英文选择)
allowed-tools: Bash, Read, Edit, AskUserQuestion

claude-mini-hud Setup

把 `claude-mini-hud` 配成 Claude Code 的 statusline, 让 `~/.claude/settings.json` 里的 `statusLine.command` 指向本插件的 `dist/index.js`。

Step 1: 选择语言 / Select Language

**必须先调用 AskUserQuestion 弹出语言选择菜单**, 根据用户选择决定后续步骤里的提示文案 + 写入 settings.json 的环境变量:

Use AskUserQuestion:
  header: "Language"
  question: "请选择显示模式 / Select display mode"
  options:
    - label: "中文 (Chinese)"
      description: "上下文 + Token + 当前任务 全部中文"
    - label: "English"
      description: "Context + Token + Todos 全部英文"
    - label: "简约 (Minimal)"
      description: "英中混搭, 无前缀符号, 最紧凑布局"
    - label: "极简 (Ultra-Minimal)"
      description: "只显示 Context + Token 两行, 其余全部隐藏"

把用户选择存到 `{LANG}` 变量 (zh / en / minimal / ultra-minimal), 后续步骤用它: 1. 决定 Step 6 输出提示的语种 2. 写入 `statusLine.command` 的 `CLAUDE_MINI_HUD_LANG={LANG}` 环境变量

**4 种模式输出示例** (支持 emoji 的终端会自动显示 emoji 图标, 不支持的终端显示 ASCII 符号):

# 中文 (zh) — emoji 终端
📊 上下文 ███░░░░░░░░░░░░░░░░░ 13%  100k / 1M  剩余 900k
🪙 Token 23k (in 22k · out 342 · cache 768)
▶ 当前任务 调研充电行业政策  (2/5)

# 中文 (zh) — 无 emoji 终端
# 上下文 ███░░░░░░░░░░░░░░░░░ 13%  100k / 1M  剩余 900k
$ Token 23k (in 22k · out 342 · cache 768)
> 当前任务 调研充电行业政策  (2/5)

# English (en) — emoji 终端
📊 Context ███░░░░░░░░░░░░░░░░░ 13%  100k / 1M  left 900k
🪙 Token 23k (in 22k · out 342 · cache 768)
▶ Todos Research charging industry policy  (2/5)

# 简约 (minimal) — 无 emoji, 无前缀
 Context ███░░░░░░░░░░░░░░░░░ 13%  100k / 1M  剩余 900k
 Token 23k (in 22k · out 342 · cache 768)
 当前任务 调研充电行业政策  (2/5)

# 极简 (ultra-minimal) — 只显示两行
 Context ███░░░░░░░░░░░░░░░░░ 13%  100k / 1M  剩余 900k
 Token 23k (in 22k · out 342 · cache 768)

Step 1.5: 选择主题风格 (可选)

**调用 AskUserQuestion 弹出主题选择菜单**:

Use AskUserQuestion:
  header: "Theme"
  question: "选择进度条风格 / Select progress bar theme"
  options:
    - label: "经典 Classic (默认)"
      description: "███░░░░░░░░  经典实心方块"
    - label: "霓虹 Neon"
      description: "⟦ CTX: ▓▓▓▓░░░░ ⟧  霓虹矩阵风"
    - label: "点阵 Braille"
      description: "⣿⣷⣯⣟░░░░  Braille 点阵"
    - label: "硬核 Hardcore"
      description: "[■■■□□□□□] CTX │  硬核风"

**再调用 AskUserQuestion 弹出标记选择菜单**:

Use AskUserQuestion:
  header: "Marks"
  question: "选择工具标记风格 / Select tool indicator marks"
  options:
    - label: "经典 Classic (默认)"
      description: "◐ 运行中  ✓ 已完成"
    - label: "硬核 Hardcore"
      description: "● 运行中  ■ 已完成"
    - label: "钻石 Diamond"
      description: "◈ 运行中  ◆ 已完成"
    - label: "心形 Heart"
      description: "🖤🖤🤍🤍  心形风 (💗 🖤)"
    - label: "爱心 Love"
      description: "❤️❤️🤍🤍  爱心风 (💗 ❤️)"

把选择存到 `{THEME}` 和 `{MARKS}` 变量 (默认都是 `default`)。

**主题风格预览**:

| 主题 | THEME 值 | 进度条 | MARKS 值 | 运行/完成 | |------|---------|--------|---------|----------| | 经典 | `default` | `██████░░░░` | `default` | `◐ ✓` | | 霓虹 | `neon` | `⟦▓▓▓▓░░⟧` | `neon` | `◈ ✦` | | 点阵 | `braille` | `⣿⣷⣯░░` | `braille` | `⣷ ⣿` | | 硬核 | `hardcore` | `[■■□□] CTX │` | `hardcore` | `● ■` | | 简约 | `minimal` | `◈ % ┃` | `minimal` | `· •` | | 像素 | `pixel` | `⣿⣿⣀⣀` | `pixel` | `▣ ■` | | 钻石 | `diamond` | `◆◆◇◇` | `diamond` | `◈ ◆` | | 箭头 | `arrow` | `▸▸▹▹` | `arrow` | `▸ ✓` | | 波浪 | `wave` | `≋≋∿∿` | `wave` | `≋ ≈` | | 潮汐 | `tide` | `∿∿╌╌` | `tide` | `∿ ≈` | | 圆点 | `dot` | `●●○○` | `dot` | `◉ ●` | | 靶心 | `target` | `◎◎⊙⊙` | `target` | `◎ ⊙` | | 渐变 | `gradient` | `▓▓▒▒░░` | `gradient` | `▒ ▓` | | 阴影 | `shades` | `█▓▒░` | `shades` | `▒ █` | | 复古 | `retro` | `══▸──` | `retro` | `► ■` | | ASCII | `ascii` | `##..` | `ascii` | `@ #` | | 铁轨 | `rail` | `══╌╌` | `rail` | `╌ ═` | | 星光 | `star` | `★★☆☆` | `star` | `☆ ★` | | 火花 | `spark` | `✦✦✧✧` | `spark` | `✦ ✧` | | 心形 | `heart` | `🖤🖤🤍🤍` | `heart` | `💗 🖤` | | 爱心 | `love` | `❤️❤️🤍🤍` | `love` | `💗 ❤️` |

Step 2: 检测环境

**macOS/Linux**:

CLAUDE_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
# 找插件目录
PLUGIN_DIR=$(ls -d "$CLAUDE_DIR/plugins/cache"/*/claude-mini-hud/*/ 2>/dev/null | sort -V | tail -1)
echo "PLUGIN_DIR=$PLUGIN_DIR"
echo "EXISTS_DIST=$([ -f "$PLUGIN_DIR/dist/index.js" ] && echo YES || echo NO)"

**Windows (PowerShell)**:

$claudeDir = if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { Join-Path $HOME ".claude" }
$pluginDir = Get-ChildItem (Join-Path $claudeDir "plugins\cache") -Directory | ForEach-Object {
  Get-ChildItem $_.FullName -Directory | Where-Object { $_.Name -like "*claude-mini-hud*" } | Get-ChildItem -Directory | Sort-Object Name -Descending | Select-Object -First 1
} | Select-Object -First 1 -ExpandProperty FullName
Write-Host "PLUGIN_DIR=$pluginDir"

Step 3: 编译插件 (如果 dist 不存在)

**macOS/Linux**:

cd "$PLUGIN_DIR"
npm install
npm run build

**Windows (PowerShell)**:

Set-Location $pluginDir
npm install
npm run build

Step 4: 检查现有 statusLine 配置

读取 `~/.claude/settings.json`:

**macOS/Linux**:

EXISTING=$(jq -r '.statusLine // empty' "$CLAUDE_DIR/settings.json" 2>/dev/null)

**Windows (PowerShell)**:

$existing = (Get-Content (Join-Path $claudeDir "settings.json") -Raw | ConvertFrom-Json).statusLine

如果已有 statusLine

弹 AskUserQuestion 询问:

Use AskUserQuestion:
  header: "Existing statusline"
  question: "Found an existing statusLine in settings.json: {EXISTING_PREVIEW}. What would you like to do?"
  options:
    - label: "替换为 claude-mini-hud (会备份原配置)"
      description: "原 statusLine 会被改名为 statusLine.bak.YYYYMMDD-HHMMSS"
    - label: "保留原 statusLine, 退出 setup"
      description: "不改 settings.json, 仅完成编译步骤"
    - label: "取消 setup"
      description: "不做任何更改"

如果用户选"保留"或"取消" → 跳到 Step 6 (提示重启 + 验证)。

Step 5: 写入 statusLine 配置

**macOS/Linux**:

# 1) 找编译产物路径
RUNTIME_PATH="$PLUGIN_DIR/dist/index.js"

# 2) 备份原配置
if [ -n "$EXISTING" ]; then
  TS=$(date +%Y%m%d-%H%M%S)
  jq '.statusLine' "$CLAUDE_DIR/settings.json" > "$CLAUDE_DIR/statusLine.bak.$TS.json"
fi

# 3) 拼接环境变量
ENV_VARS="CLAUDE_MINI_HUD_LANG=$LANG"
if [ "$THEME" != "defaul
Read more
Ships withclaude-mini-hud

Claude Code 状态栏 — 上下文 / Token / 任务 / 工具活动 / Agent 追踪 + 深度适配国产大模型用量查询

Get the whole plugin
Stats
10
Stars
2
Forks
Active
Maintenance
TypeScript
Language
MIT
License
23d ago
Last commit
3mo ago
Created

Repo: zander-zyx/claude-mini-hud