feat: add ghafi overview — org Actions minute-quota audit#10
Conversation
Read-only verb that answers "why is the org near its included-minutes
limit". Joins the enhanced-billing usage report
(/organizations/{org}/settings/billing/usage) against repo privacy and
weights by runner-OS multiplier (Linux x1, Windows x2, macOS x10) — only
private repos draw down the quota, and a small macOS matrix leg can
outrank a busy Linux repo. `--repo NAME` drills into one repo's
workflow-run counts by trigger event.
- ghafi/cli/_commands/overview.py: the command (read-only, no --apply)
- register in cli/__init__.py; explain entry + root verb list
- tests/test_cli_overview.py: table, JSON, macOS-weighting, public
exclusion, drill-down, bad-month, 403->admin:org hint (6 tests)
- CLAUDE.md: project shape, run example, admin:org scope note for the
billing endpoint (read:org returns 403; legacy endpoint is 410)
- .claude/skills/actions-usage/: gh/jq shell companion for the same audit
- bump 0.0.2 -> 0.1.0
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR Summary by QodoAdd Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
10 rules 1. actions-usage.sh shells out to gh
|
Adds a read-only
overviewverb that answers "why is the org near its included-minutes limit?" — born out of an audit where agentculture sat near its 3000-minute quota.What it does
ghafi overview <org>joins the enhanced-billing usage report (GET /organizations/{org}/settings/billing/usage) against each repo's private/public flag, keeps only the private repos (public repos get unlimited free minutes and never touch the quota), and weights each by runner-OS multiplier — Linux ×1, Windows ×2, macOS ×10. A small macOS matrix leg can outrank a busy Linux repo; surfacing that is the point.--repo NAMEdrills into one repo: workflow-run counts grouped by trigger event (most recent 100 runs) + the month's total.--month YYYY-MMdefaults to the current calendar month;--jsonemits a structured envelope.Verified live against agentculture: the org table reproduces a hand-rolled
gh/jqaudit to the minute (4,659 quota-weighted private minutes for June).Surface & safety
MUTATING_VERBS; a test asserts it issues no writes in any mode.admin:org(read:orgreturns 403; the legacy/settings/billing/actionsendpoint is retired, HTTP 410). The repo + runs reads are covered byrepo. Documented in CLAUDE.md, theexplainentry, and an enriched 403 remediation hint.gh/jqneeded.Changes
ghafi/cli/_commands/overview.pyghafi/cli/__init__.pyghafi/explain/catalog.pyghafi explain overview+ root verb listtests/test_cli_overview.pyadmin:org)CLAUDE.mdadmin:orgbilling-scope note.claude/skills/actions-usage/gh/jqshell companion for the same auditpyproject.toml/CHANGELOG.mdKnown limitation
Multiplier is classified by SKU substring (
macos→10,windows→2, else 1) — exact for standard runners but does not model larger runners (e.g.macOS 12-core), which bill differently and do not draw from included minutes. None are in use across the org today.Verification
pytest55 passed ·black/isort/flake8/banditclean ·markdownlint-cli20 errors · portability lint clean ·doc-test-alignno drift.