Skip to content

馃摝 NEW: Command Code Usage - read the plan quota windows - #22

Open
Jovan1666 wants to merge 1 commit into
CommandCodeAI:mainfrom
Jovan1666:jovan1666/command-code-usage
Open

Jovan1666 wants to merge 1 commit into
CommandCodeAI:mainfrom
Jovan1666:jovan1666/command-code-usage

Conversation

@Jovan1666

Copy link
Copy Markdown

Adds a command-code-usage skill: how much of the plan is left, read from the Command Code API with the credential already on the machine.

What it does

One script, no dependencies, Node 18+:

node skills/command-code-usage/scripts/cc-usage.mjs
GOAT / alex
  5h    鈻屸枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒   5%  $13.32 left of $14.00          resets 09-22 04:16 (in 3h35m)
  week  鈻堚枅鈻堚枈鈻戔枒鈻戔枒鈻戔枒  37%  $22.00 left of $35.00          resets 09-27 23:29 (in 5d22h)
  month 鈻堚枆鈻戔枒鈻戔枒鈻戔枒鈻戔枒  19%  $57.00 left of $70.00          resets 10-20 23:25 (in 28d22h)
  period 2891 requests / $10.22 spent / avg $0.0035 each
         the month has room for about 16120 more at that price

--json prints the same numbers normalized (used, cap, percent, remaining, resetAt, resetsInMs) for scripts and status lines.

Use cases

  • "How much of my Command Code plan is left?" mid-task, without opening a dashboard.
  • "Can I finish this refactor on the current 5-hour window?" - the reset countdown is what answers it.
  • "Am I going to run out before Friday?" - the weekly and monthly windows side by side.
  • Explaining a refusal: whether a window is spent, and when it comes back.

Testing

  • Ran against a live GOAT account on this machine (Node 22, Windows): panel, --json, --help, NO_COLOR, and --json with all three windows present. Output in the example above is one of those runs.
  • Error paths: no credential -> exit 2 with instructions; a rejected key -> exit 1 listing the four failing endpoints plus a re-auth hint; one endpoint failing -> the other rows still print, with a note: line.
  • Cross-checked against a second implementation. The same account read through an independent reader (commandcode-usage) gives the same window values, which is how the field names (summary.totalCount, not totalRequests) and the monthly pool arithmetic were confirmed.
  • Not covered: a plan whose windowLimits.limited is false (no rolling windows) and a team account with a non-empty orgId. Both paths are implemented; neither was reachable from an individual GOAT account.

Breaking changes

None - new skill, new directory, one README line. It reads only: no files written, no telemetry, no data anywhere except the Command Code API.

Related issues

About

I am the author of the multi-host plugin the script was extracted from, so I would rather say that plainly than have it discovered later. The script was rewritten for this repository: vendor-neutral (no host-specific config paths, no slash-command assumptions), English throughout, and around 300 lines instead of the plugin's shared core.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant