ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 AsyrafHussin

statusline-band

Claude Code 提示列上方的面板,顯示速率限制及其消耗速度、context、費用與權杖、Git 狀態與開關、操作,以及附有 Clawd 與 Beatbot 的 Spotify 卡片

AsyrafHussin@AsyrafHussin

AsyrafHussin/claude-code-statusline/tree/main/mod/statusline-band

已翻譯

關於這個 mod

statusline-band

Claude Code 提示列上方的面板,旁邊站著 Claude Code 吉祥物 Clawd,下方還有一張附有 Spotify 吉祥物 Beatbot 的 Spotify 卡片。

  • 頂端: 儲存庫名稱、分支、模型及其 effort,還有你的 Claude 方案(Max 5x、Pro...)。右側是本次工作階段的費用與權杖,接著是今天和最近 30 天的費用與權杖。
  • 中段: 以填滿的圓環顯示 5 小時與 7 天速率限制,同時顯示重設倒數與本地重設時間。當目前速度會在重設前用完某個限制時,會顯示 ▲ out ~7h。下方是 context 使用量列。
  • 底端: 執行中的子代理、未提交的檔案與行數、未推送的提交及其行數、落後的提交、儲藏,以及距離上次提交的時間。右側是上一則回覆的輸入權杖(含快取佔比)與輸出權杖、工作階段長度和時間。
  • Clawd: Claude 工作時會奔跑。其他時候,速率限制達到 95% 或更高就會流汗;安靜 10 分鐘後會睡著;你的提交推送完成時會歡呼。
  • 操作: 卡片下方的一列按鈕會像你輸入一樣送出提示:push(提交並推送)、find bugs、run tests 和 summarize。quick commit 會讓 Haiku 根據差異寫出提交訊息,並讓你選擇提交、提交並推送或自行輸入;接著它會自行提交,不佔用主模型的一輪。點選一個,或按 ctrl+x tab 聚焦面板,移到按鈕後按 Enter。
  • Git 開關: 每個儲存庫分別保存 commit auto · push ask。設為 ask 時,Claude 的 git add、commit 或 push 都會等待你的確認。設為 auto 時,Claude 也會自行執行:每次完成變更就提交,接著立即推送。免提示執行只適用於使用 -C 指定儲存庫的簡單形式:git -C '/abs/path' add <files>、git -C '/abs/path' commit -m '…' 和 git -C '/abs/path' push [remote] [branch],以 && 連接。任何其他形式都會依照開關設定詢問,包括不帶 -C 的步驟(Bash 工具會在呼叫之間保留自己的資料夾)、強制推送、heredoc、$(…)、cd、管線、env 或 xargs 之類的包裝器,或會提交、推送的別名。計畫模式不允許任何操作。只有讀取的步驟(status、log、diff、show,以及只調整輸出形式的參數)可以一併執行。某一步需要確認時,對話框下方會說明它會帶上哪些內容。系統提示會告訴 Claude 這個簡單形式,以及每個開關的狀態。點選 commit 或 push 即可切換。
  • Spotify(macOS): 在你點選 Git 開關旁的 spotify 前,它都處於關閉狀態(spotify off,接著是 on,並跨工作階段保留)。關閉時不會向 Spotify 詢問任何內容。開啟且 Spotify 正在執行時,面板下方會顯示一張以 Spotify 綠色框起的卡片,包含狀態與曲目、◀◀ ❚❚ ▶▶、帶有時間的進度、隨機播放、重複和音量 − +,以及之前聽過的曲目(跨工作階段保留)。開啟 lyrics on(在 spotify 旁,預設開啟)後,卡片還會隨歌曲顯示正在唱的歌詞行(明亮)與下一行(變暗);歌詞來自 LRCLIB(lrclib.net),沒有同步歌詞的曲目不會顯示歌詞。search(或 /spotify-search)會開啟搜尋 Spotify 的面板並播放你選取的曲目;設定好 spotifyClientId 與客戶端密鑰後,終端機仍保持在前景。像素繪製的 Spotify 小吉祥物 Beatbot 會在播放時跳舞在 Clawd 下方;曲目暫停 10 分鐘後,它會伴著 Z 字睡著。它每 5 秒透過 AppleScript 向 Spotify 詢問一次,從不啟動 Spotify。正在播放的播放清單不會顯示:Spotify 只透過需要登入的 Web API 提供它。
  • 最小化: 任一卡片底端邊緣的 minimize 會把它從面板左邊緣縮成一行。主卡片保留儲存庫與分支、模型、以百分比顯示的限制與 context、第一個 Git 資訊以及工作階段費用;Spotify 卡片保留控制項、曲目和時間。expand 會還原它。每張卡片都會跨工作階段記住選擇。
  • 其他: 將滑鼠停在速率限制上可查看其速度。點選 30d 或執行 /usage-history,可開啟顯示每天費用與權杖的面板。限制超過 80% 與 95% 時,以及目前速度會在重設前用完限制時,都會跳出通知。

需要 Claude Code v2.1.287 或更新版本。

安裝

/plugin marketplace add AsyrafHussin/claude-code-statusline
/plugin install statusline-band@claude-code-statusline

設定

每項都是 /config 中的一列,也可以執行 /plugin configure statusline-band@claude-code-statusline。

| 設定 | 預設值 | 用途 | |---------|---------|--------------| | initials | empty | Clawd 衣服上顯示最多兩個字母 | | cardColor | #0a0a0a | 面板背景;留空("")表示不設定,讓終端機使用自己的背景 | | padRows | 1 | 統計資料上下方的空列數,範圍為 0 到 2 | | historyDays | 30 | 滾動費用與歷史面板涵蓋的天數,範圍為 7 到 62 | | noAttribution | false | 從提交與 pull request 中移除 Co-Authored-By、Claude-Session 和 Claude Code 頁尾 | | gitStrict | true | 開啟:Git 開關設為 auto 時,只有使用 -C 指定儲存庫的簡單命令會免提示執行。關閉:儲存庫的開關設為 auto 時,任何 Git 命令都會免提示執行 | | spotify | true | Spotify 執行時,在面板下顯示它正在播放的內容,並顯示跳舞的 Beatbot、進度列與控制項(macOS) | | plan | empty | 依顯示結果顯示你的 Claude 方案,例如 Max 20x;留空則從 Claude Code 自己的 ~/.claude.json 讀取(Claude Code 啟動或登入時更新) | | spotifyClientId | empty | 你在 developer.spotify.com/dashboard 的應用程式客戶端 ID,用於搜尋 Spotify | | spotifyClientSecret | empty | 該應用程式的客戶端密鑰。/config 不會顯示密鑰設定,因此請將它保存在 macOS 鑰匙圈中:security add-generic-password -U -s statusline-band-spotify -a client-secret -w(它會隱藏輸入並要求你提供密鑰) |

它執行、讀取、保留與傳送的內容

它執行的程式

它會執行下列程式,從不透過 shell。參數都是固定的,例外是資料夾(每條 git 命令都在儲存庫資料夾中執行,也就是 git -C <folder>)、你核准的快速提交訊息,以及搜尋曲目的 Spotify URI(會檢查格式為 spotify:track: 且只含字母和數字)。

  • git,唯讀,用來顯示分支與其變更(每次都在儲存庫資料夾中執行,也就是 git -C <folder>)。它會執行:

    • rev-parse --show-toplevel 取得儲存庫根目錄,每個資料夾執行一次
    • status --porcelain=v2 --branch --show-stash 取得分支、上游、領先與落後的提交、未提交檔案及儲藏
    • diff --shortstat HEAD 和 diff --shortstat @{upstream}...HEAD 取得未提交與未推送的行數
    • log -1 --format=%ct 取得上次提交的時間

    這些命令每 30 秒執行一次,也會在每次工具呼叫後執行。

  • Claude 的 Git 步驟需要確認時執行的 git: 在對話框下方說明它會帶上哪些內容:同樣的唯讀命令,以及 config --get alias.<name>,用來查看 Git 別名代表什麼。

  • 你按下快速提交時執行的 git: 先執行 status --porcelain、diff HEAD 和 log -5 --format=%s 來寫出訊息;你核准後再執行 add -A、commit -q -m <message>,以及在你選擇時執行 push。這些是它唯一會改變內容的 Git 命令。

  • Spotify 使用的 osascript: 只有在 spotify 開關開啟且 Spotify 正在執行時,每 5 秒讀取曲目;按下控制項時讀取或執行播放、暫停、跳過、隨機播放、重複與音量操作;選取搜尋結果後播放曲目,並將你原先使用的應用程式帶回前景。

  • 搜尋使用的 security find-generic-password -s statusline-band-spotify -w: 當你開啟或使用搜尋且設定為空時,讀取 macOS 鑰匙圈中的 Spotify 客戶端密鑰;找到後一直保留到外掛重新載入。

  • date,讀取本地日期與時間(+%Y-%m-%d,以及 +%Y-%m-%d|%I:%M %p|%H|%M|%S)。它也會格式化時區中的速率限制重設時刻(date -r <epoch>)。

它讀取的內容

  • 來自工作階段: Claude Code 回報的用量(費用、context、速率限制及其重設時間)、模型名稱、工作階段 ID 和工作資料夾、正在執行的子代理,以及每一輪結束時的權杖數量。
  • 來自 Claude Code 自己的 ~/.claude.json: 每次載入時只讀取你帳戶的方案類型和速率限制層級,用來顯示方案。
  • 來自執行中的 Spotify: 正在播放的曲目名稱、演出者、專輯、長度、位置和 ID,以及隨機播放、重複和音量設定。
  • 來自 macOS 鑰匙圈: 只有搜尋時才讀取 statusline-band-spotify 項目和 Spotify 客戶端密鑰。
  • 它從不讀取的內容: 你的提示或 Claude 回覆文字。它只從工具呼叫讀取 Bash 命令,用來找出開關涵蓋的 Git 步驟。

它保留的內容

所有內容都留在外掛自己的本機儲存中,不會去別處:

  • 每個儲存庫根目錄對應的 Git 開關
  • 最近聽過的 3 首 Spotify 曲目
  • spotify 和 lyrics 開關的開啟或關閉狀態
  • 每張卡片是否最小化
  • 最近 62 天每天的費用與權杖
  • 最近 100 個工作階段每個工作階段的最後一次讀取結果
  • 最近 3 小時的速率限制讀數,用來計算近期速度
  • 已經顯示過的通知

它傳送的內容

  • 只在你按下操作按鈕時傳送給 Claude 的提示。 每一則都是 Actions 下列出的固定文字,會像你輸入一樣傳送到本次工作階段。推送仍會經過你自己的權限規則。
  • 只在你按下快速提交時傳送給 Haiku 的差異。 最多 24k 個差異字元、新檔案名稱與最近 5 個提交主旨會透過 Claude Code 自己的模型呼叫傳給 Claude 的小模型,方式與 Claude Code 自己和模型通訊相同,用來寫出訊息。
  • 只在你於快速提交中選擇「Commit and push」時執行的推送。 它會使用你現有的 Git 憑證,將 git push 自行執行到分支的上游。
  • 只在你搜尋時執行的 Spotify 搜尋。 使用你自己的應用程式客戶端 ID 與密鑰,外掛會向 accounts.spotify.com 要求應用程式權杖,向 api.spotify.com 要求最多 10 首符合你輸入的曲目;選取一首後,會透過 AppleScript 在 Spotify 應用程式中播放。
  • 當 spotify 與 lyrics 開啟時傳送給 LRCLIB 的目前曲目。 每首新曲目傳送一次,將名稱、演出者、專輯與長度傳到 lrclib.net 這個免費開放歌詞服務,以取得同步歌詞。不需要帳戶或金鑰。關閉 lyrics 後不會傳送任何內容。
  • 其他都不會傳送。 它從不向 Git fetch,不會進行其他網路呼叫,沒有遙測,也不會傳送到任何其他服務。落後提交數是以你上次 fetch 或 pull 時遠端的狀態計算。

Hooks

  • tool.call: 只記錄時間,並在呼叫後重新整理面板。它讓每次呼叫原樣執行,從不封鎖或改寫。
  • prompt.submit: 啟動 Clawd 的奔跑動畫。提示原樣通過。
  • turn.complete: 停止動畫,並把本輪的權杖數量加到總數。
  • session.start: 啟動面板計時器,並註冊 /usage-history;開啟 spotify 時也註冊 /spotify-search。
  • command.run: 只處理自己的 /usage-history 和 /spotify-search 命令,方法是開啟對應面板。
  • attribution.text: 開啟 noAttribution 時,回傳空的提交尾註與 PR 頁尾。
  • prompt.compose: 在系統提示中加入一節,說明 Git 簡單形式、每個開關的狀態,以及(開啟 noAttribution 時)不加入署名列。
  • 操作按鈕: 按下按鈕會用固定提示呼叫 $.prompt.submit;沒有按下按鈕就不會傳送任何內容。quick commit 則會透過 Claude Code 自己的模型呼叫,把差異(最多 24k 個字元)和最近 5 個提交主旨傳給 Haiku,然後自行執行 git add -A、git commit -m,以及在你選擇時執行 git push。
  • classic.UserPromptSubmit、classic.PostToolUse: 讀取權限模式和 effort;它們不會改變任何內容。
  • **classic.PreToolUse

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add AsyrafHussin/claude-code-statusline
claude plugin install statusline-band
原文 / README

statusline-band

A panel above the Claude Code prompt, with Clawd, the Claude Code mascot, standing beside it, and a Spotify card under it with Beatbot, a Spotify mascot.

  • Top edge: the repo name, branch, and the model with its effort and your Claude plan (Max 5x, Pro...). On the right: the session's cost and tokens, then today's and the last 30 days'.
  • Middle: the 5-hour and 7-day rate limits as filling rings, with the reset countdown and the local reset time. ▲ out ~7h appears when the pace would use a limit up before it resets. Then context usage as a bar.
  • Bottom edge: running subagents, uncommitted files and lines, unpushed commits and their lines, commits behind, stashes and the time since the last commit. On the right: the last reply's input (with its cached share) and output tokens, the session length and the time.
  • Clawd: runs while Claude works. Otherwise it sweats while a rate limit is at 95% or more, falls asleep after 10 quiet minutes, and cheers when your commits are pushed.
  • Actions: a row under the card sends a prompt as if you typed it: push (commit and push), find bugs, run tests and summarize. quick commit has Haiku write a message from the diff and shows it: commit, commit and push, or type your own; it then commits itself, without a turn of the main model. Click one, or focus the band with ctrl+x tab, move to it and press Enter.
  • Git switches: commit auto · push ask, kept per repo. On ask, Claude's git add or commit, or push, waits for your OK. On auto Claude also does it on its own: it commits each finished change, and pushes right after. It runs without a prompt, but only in its plain form, naming its repo with -C: git -C '/abs/path' add <files>, git -C '/abs/path' commit -m '…' and git -C '/abs/path' push [remote] [branch], joined by &&. Any other shape asks whatever the switch says: a step without -C (the Bash tool keeps its own folder between calls), a force push, a heredoc, $(…), a cd, a pipe, a wrapper such as env or xargs, or an alias that commits or pushes. Nothing is allowed in plan mode. Steps that only read (status, log, diff, show, with flags that only shape their output) may ride along. When a step asks, a line under the dialog says what it takes with it. The system prompt tells Claude the plain form and where each switch stands. Click commit or push to flip it.
  • Spotify (macOS): off until you click spotify beside the git switches (spotify off, then on, kept across sessions). While it is off, nothing asks Spotify anything. When it is on and Spotify runs, a card framed in Spotify green under the band shows the state and the track, ◀◀ ❚❚ ▶▶, progress with the time, shuffle, repeat and volume − +, and the track heard before it (kept across sessions). With lyrics on (beside spotify, on by default), the card also shows the line being sung, bright, and the next one dim, in time with the song; they come from LRCLIB (lrclib.net), and a track it has no synced lyrics for shows none. search (or /spotify-search) opens a pane that searches Spotify and plays the track you pick, keeping the terminal in front, once spotifyClientId and the client secret are set. Beatbot, a little Spotify mascot drawn in pixels, dances under Clawd while a track plays, and falls asleep with Z's once a track has been paused 10 minutes. It asks Spotify through AppleScript every 5 seconds and never launches it. The playing playlist is not shown: Spotify gives it only through its Web API, which needs a sign-in.
  • Minimize: minimize on the bottom edge of either card shrinks it to one line from the band's left edge. The main card keeps the repo and branch, model, limits and context as percents, the first git fact and the session cost; the Spotify card keeps the controls, the track and the time. expand brings it back. Each card remembers its choice across sessions.
  • Extras: hover a rate limit for its pace. Click 30d, or run /usage-history, for a pane with each day's cost and tokens. Toasts fire when a limit passes 80% and 95%, and when its pace would run it out before the reset.

Needs Claude Code v2.1.287 or later.

Install

/plugin marketplace add AsyrafHussin/claude-code-statusline
/plugin install statusline-band@claude-code-statusline

Settings

Each is a row in /config, or run /plugin configure statusline-band@claude-code-statusline.

| Setting | Default | What it does | |---------|---------|--------------| | initials | empty | Up to two letters on Clawd's shirt | | cardColor | #0a0a0a | Background of the band; empty ("") for none, so it takes the terminal's own | | padRows | 1 | Empty rows above and below the stats, 0 to 2 | | historyDays | 30 | Days the rolling cost and the history pane cover, 7 to 62 | | noAttribution | false | Leave Co-Authored-By, Claude-Session and the Claude Code footer out of commits and pull requests | | gitStrict | true | On: with a git switch on auto, only plain commands naming their repo with -C run without a prompt. Off: any git command runs without a prompt while the repo's switch is on auto | | spotify | true | While Spotify runs, show what it plays under the band, with Beatbot dancing, a progress bar and controls (macOS) | | plan | empty | Your Claude plan as shown, such as Max 20x; empty reads it from Claude Code's own ~/.claude.json (updated when Claude Code starts or signs in) | | spotifyClientId | empty | Client ID of your own app at developer.spotify.com/dashboard, for searching Spotify | | spotifyClientSecret | empty | Client secret of that app. /config leaves secret settings out, so keep it in the macOS Keychain instead: security add-generic-password -U -s statusline-band-spotify -a client-secret -w (it asks for the secret, hidden) |

What it runs, reads, keeps and sends

Programs it runs

It runs these programs, never through a shell. The arguments are fixed except the folder (each git command runs in the repo's folder, git -C <folder>), for quick commit the commit message you approved, and for a searched track its Spotify URI (checked to be spotify:track: and letters and digits only).

  • git, read-only, to show the branch and its changes (each in the repo's folder, git -C <folder>). It runs:

    • rev-parse --show-toplevel for the repo's root, once per folder
    • status --porcelain=v2 --branch --show-stash for the branch, its upstream, commits ahead and behind, uncommitted files and stashes
    • diff --shortstat HEAD and diff --shortstat @{upstream}...HEAD for the lines uncommitted and unpushed
    • log -1 --format=%ct for the time of the last commit

    These run every 30 seconds and after each tool call.

  • git, when a git step of Claude's asks, to say under the dialog what it takes with it: the same read-only commands, and config --get alias.<name> to see what a git alias in the command stands for.

  • git, when you press quick commit: status --porcelain, diff HEAD and log -5 --format=%s to write the message; then, once you approve it, add -A, commit -q -m <message> and, if you chose it, push. These are the only git commands it runs that change anything.

  • osascript, for Spotify: every 5 seconds, only while the spotify switch is on and Spotify runs, to read the track; on a press of a control (play, pause, skip, shuffle, repeat, volume); and when you pick a searched track, to play it and bring the app you were in back to the front.

  • security find-generic-password -s statusline-band-spotify -w, for search: when you open or use the search and the setting is empty, to read the Spotify client secret from your macOS Keychain; once it is found, it is kept until the mod reloads.

  • date, to read the local date and time (+%Y-%m-%d, and +%Y-%m-%d|%I:%M %p|%H|%M|%S). It also formats a rate limit's reset moment in your timezone (date -r <epoch>).

What it reads

  • From the session: the usage Claude Code reports (cost, context, rate limits and when they reset), the model's name, the session id and working folder, the subagents that are running, and the token counts at the end of each turn.
  • From Claude Code's own ~/.claude.json: only your account's plan type and rate-limit tier, once per load, to show the plan.
  • From Spotify, while it runs: the playing track's name, artist, album, length, position and id, and the shuffle, repeat and volume settings.
  • From your macOS Keychain: only the item statusline-band-spotify, the Spotify client secret, when you search.
  • What it never reads: the text of your prompts or Claude's replies. Of tool calls it reads only Bash commands, to find the git steps the switches cover.

What it keeps

All of it stays in the plugin's own store on your machine, nothing else:

  • each repo's git switches, by the repo's root
  • the last three Spotify tracks heard
  • the spotify and lyrics switches, on or off
  • whether each card is minimized
  • each day's cost and tokens, for the last 62 days
  • each session's last reading, for the last 100 sessions
  • rate-limit readings from the last 3 hours, used for the recent pace
  • which toasts it has already shown

What it sends

  • Prompts to Claude, only when you press an action. Each is the fixed text listed under Actions, sent to this session as if you typed it. A push still goes through your own permission rules.
  • The diff to Haiku, only when you press quick commit. Up to 24k characters of the diff, the names of new files and the last five commit subjects go to Claude's small model through Claude Code's own model call, the same way Claude Code itself talks to the model, to write the message.
  • A push, only when you choose "Commit and push" in quick commit. It runs git push itself, to the branch's upstream, with the git credentials you already have.
  • A Spotify search, only when you search. With your own app's client ID and secret, the mod asks accounts.spotify.com for an app token and api.spotify.com for up to 10 tracks matching what you typed; picking one plays it in the Spotify app through AppleScript.
  • The playing track to LRCLIB, while spotify and lyrics are on. Once per new track, its name, artist, album and length go to lrclib.net, a free open lyrics service, to get its synced lyrics. No account or key is involved. Turn lyrics off and nothing is sent.
  • Nothing else. It never fetches from git, makes no other network calls, has no telemetry, and sends nothing to any other service. Commits behind are counted against the remote as of your own last fetch or pull.

Hooks

  • tool.call: only notes the time and refreshes the panel after the call. It lets every call run unchanged and never blocks or rewrites one.
  • prompt.submit: starts Clawd's running animation. The prompt passes through unchanged.
  • turn.complete: stops the animation and adds the turn's token counts to the totals.
  • session.start: starts the panel's timers and registers /usage-history and, with spotify on, /spotify-search.
  • command.run: answers only its own /usage-history and /spotify-search commands, by opening their panes.
  • attribution.text: with noAttribution on, answers an empty commit trailer and PR footer.
  • prompt.compose: adds one section to the system prompt: the git plain form, where each switch stands, and (with noAttribution) no credit lines.
  • Action buttons: pressing one calls $.prompt.submit with its fixed prompt; nothing is sent without a press. quick commit instead sends the diff (up to 24k characters) and the last five commit subjects to Haiku through Claude Code's own model call, then runs git add -A, git commit -m and, if you choose it, git push itself.
  • classic.UserPromptSubmit, classic.PostToolUse: read the permission mode and effort; they change nothing.
  • classic.PreToolUse (Bash only): runs the hooks beneath it first (your own settings hooks among them; their ask or deny stands), then reads the command as it will run for git add, commit and push, and answers ask or allow by the repo's switches. Any other command passes on to your usual permissions untouched.
  • ui.render: draws the panel above the prompt (AbovePrompt), and the history and Spotify search panes (Pane).

其他同名作品

更多類似作品