Headless plan/usage query: expose /usage data (e.g. cmd usage --json)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
The payload names no source files. Start by finding where the /usage slash command gets its window and credit data in the interactive TUI, and where the existing status subcommand is defined. Confirm whether a server endpoint for this data is already in use, since the issue rules out probing undocumented ones. Done means cmd usage and cmd usage --json print the proposed shape, with exit code 0 on success and the existing auth and network error codes preserved.
索引モデルが issue の本文から書いたものです。
説明
Summary
/usage shows the 5-hour and weekly usage windows (percent used, reset time) plus the credit balance, but it is only available in the interactive TUI. There is no headless/scriptable way to read the same data.
Problem
cmd -p "/usage"does not run the slash command (it is treated as a prompt).cmd statusreports authentication only.- Automation (status bars, desktop widgets, dashboards) therefore has to approximate window usage from local transcripts (
~/.commandcode/projects/**/*.jsonlviacostUsd+ timestamps, simulating the anchored windows). That cannot match server-side credit accounting, especially on plans where credits are not exactly $1 of usage.
Proposal
Add a headless command with the same content as /usage:
cmd usage # human-readable
cmd usage --json # machine-readable
Suggested JSON shape:
{
"plan": "GOAT",
"credits": { "monthly_cap": 100.0, "remaining": 74.5 },
"windows": {
"5h": { "used": 4.2, "cap": 20.0, "percent": 21, "resets_at": "2026-10-31T17:20:00Z" },
"7d": { "used": 8.8, "cap": 50.0, "percent": 18, "resets_at": "2026-11-04T21:00:00Z" }
}
}
Exit code 0 on success; keep the existing exit-code conventions for auth/network errors.
Alternatives considered
- Parsing an internal endpoint: undocumented and brittle; the docs advise against probing endpoints/auth.
- Local transcript approximation: cannot reproduce server-side credit accounting or window anchoring reliably.
Additional context
Use case: a Wayland bar / desktop widget polling usage every minute so the user sees the same meters as /usage without opening the TUI.
- 主要言語
- 言語のデータがありません
- スター
- 4.2k
- フォーク
- 377
- 平均マージ
- 1日 17分
- マージ済み PR(30日)
- 7
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CommandCodeAI/command-code のほかの issue
-
Provider /v1/messages rejects role:"system" inside messages[] — Claude Code ≥ 2.1.154 incompatibleオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
CommandCodeAI/command-code#1085 ·
メンテナーはふだん 1 日以内に返信
-
Feature request: auto-reconnect remote control (/rc) after restart対応中かも @aliarain が 20 日前に担当しました。 オープンp2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
CommandCodeAI/command-code#992 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#933 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#855 ·
メンテナーはふだん 1 日以内に返信
-
grep tool passes empty file type to ripgrep対応中かも @ahmadbilaldev が 19 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
CommandCodeAI/command-code#655 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
CommandCodeAI/command-code の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
UKGovernmentBEIS/inspect_ai#6512 ·
メンテナーはふだん 1 日以内に返信
-
area/c++ area/core kind/bug-report
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
tensorflow/quantum#1140 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
Kav-K/GPTDiscord#501 ·
メンテナーはふだん 1 日以内に返信