pace-gene/ghee

Buttery tools for GitHub

β˜… 0Forks 0PythonGitHub β†—Compare

README

🧈 ghee

Buttery-smooth tools for GitHub. See what you've shipped, never miss a review comment, and let AI write your standup for you.

Python License Powered by gh uv AI

ghee is a tiny, friendly CLI that turns your scattered GitHub (and Linear) activity into a clean, readable summary. Point it at a date range and it tells you what you worked on. Point it at a PR and it tells you what reviewers said. Optionally, let Google Gemini turn it all into a tidy narrative.

πŸ” Analyzing GitHub activity for user: octocat
πŸ“‘ Fetching activity data...
πŸ“‹ Fetching Linear issues...

============================================================
πŸ€– AI-Powered Summary
============================================================
This sprint you focused on the auth refactor (3 PRs merged),
fixed two flaky tests, and unblocked the billing migration…

πŸ€” Why ghee?

  • "What did I do again?" β€” Generate a standup, weekly update, or self-review in seconds instead of scrolling through GitHub.
  • Never drop a review comment β€” ghee pr surfaces every unresolved comment in the repo you're standing in.
  • Understand a review at a glance β€” ghee pr-rounds reconstructs a PR's review history into clean, chronological rounds.
  • Zero hardcoding β€” user, repo, and auth all come from your gh login and local git remote. Nothing company- or environment-specific baked in.
  • Scriptable β€” --json everywhere it matters, so you can pipe into jq and build your own dashboards.

✨ Features

  • πŸ“ Commits β€” everything you pushed in a date range, grouped by repo
  • πŸ”€ Pull requests β€” what you opened, with status at a glance
  • πŸ’¬ PR comments β€” list every unresolved review comment in the current repo
  • πŸ” Review rounds β€” reconstruct a PR's review history, round by round
  • πŸ“‹ Linear issues β€” fold in the tickets you actually worked on (optional)
  • πŸ€– AI summaries β€” a human-readable recap via Google Gemini (optional)
  • 🧰 Plays nice with scripts β€” --json on the comment commands for jq pipelines

πŸ“¦ Installation

You'll need:

  • Python 3.11+
  • GitHub CLI (gh), installed and authenticated
  • uv (recommended)

Clone and sync:

uv sync

That's it β€” ghee is now runnable via uv run ghee.


πŸ”‘ Authentication & configuration

GitHub (required)

ghee talks to GitHub through the gh CLI, so just log in once:

gh auth login

The default user, current repo, and all API access are inferred from gh and your local git remote β€” nothing is hardcoded.

Linear (optional)

Want your Linear tickets in the mix? Provide an API key in any of these (highest precedence first):

  1. LINEAR_KEY environment variable
  2. ~/.config/ghee/config.ini β†’ [api_keys] β†’ linear = lin_api_…
  3. An existing ~/.config/lnr.cfg (first organization's key is reused automatically)

AI summaries (optional)

Drop in a Google Gemini key to unlock AI recaps:

  1. GEMINI_KEY environment variable
  2. ~/.config/ghee/config.ini β†’ [api_keys] β†’ gemini = …

πŸ’‘ Environment variables always win over the config file. The config file is created for you on first run at ~/.config/ghee/config.ini (location follows your OS config dir).


πŸš€ Usage

ghee has three commands. activity is the default β€” running ghee with no command is the same as ghee activity.

<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
Usage: ghee [OPTIONS] COMMAND [ARGS]...

  GitHub Activity Analyzer CLI.

Options:
  --from TEXT      Start date (YYYY-MM-DD format, default: Monday 2 weeks ago)
  --to TEXT        End date (YYYY-MM-DD format, default: now)
  --no-ai-summary  Disable AI-powered summary (by default, uses Gemini if
                   GEMINI_KEY is available)
  -u, --user TEXT  GitHub login to analyze  [default: (logged-in user)]
  --help           Show this message and exit.

Commands:
  activity   Analyze GitHub activity between dates.
  pr         Fetch and list all unresolved PR comments for the current...
  pr-rounds  Fetch review rounds (submitted reviews + their inline...

<!-- OUTPUT:END -->

1. activity β€” what did I work on?

Summarize your commits, PRs, and Linear issues across a date range.

# Default: from Monday two weeks ago β†’ now
uv run ghee activity

# …and because activity is the default command:
uv run ghee

# Pick a date range (YYYY-MM-DD)
uv run ghee activity --from 2024-01-01 --to 2024-01-15

# Analyze someone else's public activity
uv run ghee activity --user octocat

# Skip the AI summary even if a Gemini key is set
uv run ghee activity --no-ai-summary

What gets counted:

  • PRs: Only PRs authored by the specified user (via --user/-u), created in the date range. Reviewed or commented-on PRs are deliberately excluded β€” the count reflects "PRs I opened", not "PRs I touched".
  • --user / -u: Expects a GitHub login (e.g. octocat, pace-gene), not an email address. Passing an invalid login will produce silently zeroed activity β€” use gh api users/{login} to verify a login exists.
CLI reference
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
Usage: ghee activity [OPTIONS]

  Analyze GitHub activity between dates.

Options:
  --from TEXT      Start date (YYYY-MM-DD format, default: Monday 2 weeks ago)
  --to TEXT        End date (YYYY-MM-DD format, default: now)
  --no-ai-summary  Disable AI-powered summary (by default, uses Gemini if
                   GEMINI_KEY is available)
  -u, --user TEXT  GitHub login to analyze  [default: (logged-in user)]
  --help           Show this message and exit.

<!-- OUTPUT:END -->

2. pr β€” what review comments are still open?

List every unresolved review comment on PRs in the current repository (detected from your git origin).

# Human-readable
uv run ghee pr

# Machine-readable for scripts
uv run ghee pr --json

Run this from inside a cloned repo with an origin remote.

CLI reference
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
Usage: ghee pr [OPTIONS]

  Fetch and list all unresolved PR comments for the current repository.

Options:
  --json  Output as JSON instead of human-readable format
  --help  Show this message and exit.

<!-- OUTPUT:END -->

3. pr-rounds β€” how did the review go?

Reconstruct a PR's review history as rounds. Each round captures the review state (APPROVED / CHANGES_REQUESTED / COMMENTED / DISMISSED), the reviewer, their top-level body, and the inline comments left in that round.

# By full PR URL β€” works from anywhere
uv run ghee pr-rounds https://github.com/owner/repo/pull/123

# By number, using the current git repo
uv run ghee pr-rounds 123

# By number, with an explicit repo
uv run ghee pr-rounds 123 --repo owner/repo

# JSON output
uv run ghee pr-rounds 123 --json
CLI reference
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
Usage: ghee pr-rounds [OPTIONS] PR_REF

  Fetch review rounds (submitted reviews + their inline comments) for a PR.

  PR_REF can be a PR number (e.g. 123) or a full PR URL.

Options:
  --repo TEXT  Repository in OWNER/REPO format (overrides current git repo
               when PR_REF is a bare number).
  --json       Output as JSON instead of human-readable format
  --help       Show this message and exit.

<!-- OUTPUT:END -->

Notes:

  • Pending (unsubmitted) reviews are excluded.
  • Pagination is capped at 100 reviews/PR and 100 inline comments/review; exceeding either prints a warning to stderr.
  • In human output, resolved comments are prefixed with βœ….

Per-comment JSON fields (in addition to identity/location):

Field Meaning
thread_id GraphQL node ID of the parent review thread (e.g. PRRT_kwDO…), stable for the comment's lifetime
is_resolved Whether the parent thread is currently resolved
in_reply_to_id Short ID of the comment this replies to, or null for thread roots
commit_id / original_commit_id SHA the comment currently / originally points at; either may be null after a force-push

Filter out resolved comments with jq:

uv run ghee pr-rounds 123 --json \
  | jq '[.[] | .comments |= map(select(.is_resolved | not))]'

πŸ€– Agent skill (Claude Code / Cursor)

ghee ships with an agent skill that teaches AI coding agents when and how to use the CLI (e.g. "what did I work on this week?", "what review comments are still open?"). It lives at skills/ghee/SKILL.md.

Install it by copying the skill folder into your agent's skills directory:

# Claude Code β€” make it available in every project (user-level)
mkdir -p ~/.claude/skills
cp -r skills/ghee ~/.claude/skills/ghee

# …or scope it to a single project (project-level)
mkdir -p .claude/skills
cp -r skills/ghee .claude/skills/ghee

# Cursor uses the same SKILL.md format under .cursor/skills
mkdir -p ~/.cursor/skills
cp -r skills/ghee ~/.cursor/skills/ghee

Once installed, the agent will reach for ghee automatically when you ask about GitHub activity, PR comments, or review rounds.

ghee vs. the GitHub MCP server

If your agent already has the GitHub MCP server, ghee is a complement, not a replacement. Reach for the right tool:

ghee shines when you want:

  • Cross-repo, date-ranged digests β€” ghee activity assembles a standup / retro / self-review across all your repos in a single call. Doing this over MCP means fanning out across many search/list calls and aggregating by hand.
  • Linear in the mix β€” the GitHub MCP doesn't touch Linear; ghee folds those issues in.
  • A ready-made AI narrative β€” ghee activity can return a written summary directly.
  • Context efficiency β€” one compact CLI result instead of many MCP round-trips that fill up the agent's context window.
  • Portability β€” it's just a binary, so it works in a plain shell, cron, or CI with jq pipelines, no MCP host required.
  • Opinionated shapes β€” pr-rounds groups reviews into rounds and emits a stable, compact JSON schema built for downstream tooling.

ghee pr-rounds is specifically better at review history. On a large PR (e.g. astral-sh/uv#19884, 42 review rounds) ghee pr-rounds returns the whole thing in one call β€” each round's state, reviewer, timestamp, the top-level review body, and every inline comment correlated to its round with file:line, author, resolved status, and a permalink. The GitHub MCP needs two separate methods for the same picture (get_reviews + get_review_comments), both paginated, and they don't line up: review comments come back grouped by thread, not by round, so they have to be correlated by hand β€” and get_reviews doesn't return the review body text at all. That gap is exactly why an agent tends to bounce between calls (or fall back to raw gh) when reconstructing a PR's review history.

Prefer the GitHub MCP server when you want:

  • One-off reads or rich navigation of a single PR / issue.
  • Write actions β€” creating PRs, submitting reviews, resolving threads. ghee is read-only by design.

πŸ“Š What you get

  • Commits grouped by repository
  • Pull requests with their status
  • Linear issues you actually worked on (if configured)
  • An AI-powered analysis of your focus areas (if configured)
  • Totals for each activity type

πŸ—‚οΈ Project structure

github_tools/
β”œβ”€β”€ __init__.py      # Package exports
β”œβ”€β”€ __main__.py      # CLI entry point (Click commands)
β”œβ”€β”€ ai.py            # AI / Gemini integration
β”œβ”€β”€ config.py        # Config file management (~/.config/ghee/config.ini)
β”œβ”€β”€ formatters.py    # Output formatting (human + JSON)
β”œβ”€β”€ github_api.py    # GitHub interactions (via gh)
β”œβ”€β”€ linear_api.py    # Linear GraphQL interactions
β”œβ”€β”€ prompt.j2        # Jinja2 template for the LLM prompt
└── utils.py         # Dates, git repo / PR-ref parsing

πŸ› οΈ Development

Run the tests:

uv run pytest tests

Lint & format (ruff + mypy via pre-commit):

uv run pre-commit run -a

The CLI help blocks above are kept in sync with markdown-code-runner: uv run --no-sync markdown-code-runner README.md


πŸ“„ License

BSD-2-Clause. See LICENSE.

Contributors

pace-gene

Issues