Skip to content

Add agent analytics commands over /v1/analytics/*#27

Merged
hbrooks merged 2 commits into
mainfrom
hbrooks/analytics-commands
Jul 6, 2026
Merged

Add agent analytics commands over /v1/analytics/*#27
hbrooks merged 2 commits into
mainfrom
hbrooks/analytics-commands

Conversation

@ellipsis-dev

@ellipsis-dev ellipsis-dev Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Adds an agent analytics command group so agents (and humans) can query the org's GitHub PR + review analytics — the data behind the /analytics dashboard — from the terminal.

Requested by @hbrooks in Slack. Backend PR (adds the token-auth /v1/analytics/* endpoints): ellipsis-dev/ellipsis#5625 — merge that first.

Commands

agent analytics reviewers --account-type bot   # which apps review the most PRs
agent analytics reviewers --sort comments -l 5 --repo owner/name
agent analytics prs --days 30                  # PR volume + human/bot split
agent analytics reviews --repo my-service      # review totals + top reviewers
  • All subcommands take --days N (server default: last 30 days) or --start/--end, and --json for the raw API response (agent/script friendly).
  • reviewers reads the reviewers leaderboard from GET /v1/analytics/metrics (--account-type, --repo owner/name, --sort reviews|approved|changes-requested|comments|lines, --limit).
  • prs wraps GET /v1/analytics/pull-requests (maps --account-type user|bot to the endpoint's raw User/Bot filter; --status repeatable).
  • reviews wraps GET /v1/analytics/reviews (--repo bare name, --author reviewer login, --review-state, top-reviewers table from the facets).

Also: typed mirrors of the three response models in src/lib/types.ts, three ApiClient methods, README usage block.

Verification

  • npm run typecheck and npm run build green.
  • --help output smoke-checked for the group and each subcommand from the built bundle.

@hbrooks hbrooks merged commit 9f98655 into main Jul 6, 2026
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