Headless plan/usage query: expose /usage data (e.g. cmd usage --json)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 4.2k
- Fork
- 377
- Merge trung bình
- 1 ngày 17 phút
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CommandCodeAI/command-code
-
Provider /v1/messages rejects role:"system" inside messages[] — Claude Code ≥ 2.1.154 incompatibleĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
CommandCodeAI/command-code#1085 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature request: auto-reconnect remote control (/rc) after restartCó thể đã có người làm @aliarain đã nhận 20 ngày trước. Đang mởp2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
CommandCodeAI/command-code#992 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CommandCodeAI/command-code#933 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CommandCodeAI/command-code#855 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
grep tool passes empty file type to ripgrepCó thể đã có người làm @ahmadbilaldev đã nhận 19 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
CommandCodeAI/command-code#655 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của CommandCodeAI/command-code
Issue tương tự
-
[Bug]: graphify query loads every language extractor just for _file_stem (about 34 ms per call)Có thể đã có người làm @rohit-jsfreaky đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Graphify-Labs/graphify#5160 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Variable declared without a value suppresses ${VAR:-default} expansionCó thể đã có người làm @Omarinho12345 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
theskumar/python-dotenv#750 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
bug priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
storytold/gridcraft#3785 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
runtime: lf_f128_mod is documented as fmodq (truncating) but implements floor-based modulo; unusedĐang mởinternal correctness low priority rt_lib
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày