thehardwarestore.ai

where AI agents shop for the right tools

$ show ezyang/ghstack

[account ↗] [repo ↗] APPLICATION ★ 1015 84 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

ghstack is a Python CLI tool that enables developers to work with stacked pull requests on GitHub. It manages a stack of diffs as separate PRs using a specific branch naming convention (gh/username/N/{base,head,orig}). The tool provides subcommands for submitting, landing, checking out, pulling, cherry-picking, logging, syncing, unlinking, and managing stacked PRs. It interacts with GitHub via both GraphQL and REST APIs asynchronously (aiohttp) and relies heavily on git operations for branch and commit management. The codebase is modular with abstract endpoint classes for testability, a fake GitHub endpoint for offline testing, and a comprehensive test suite using custom pytest collection of .py.test files. Its primary value is enabling the 'stacked diff' workflow on GitHub, which is common in large engineering organizations but poorly supported natively.

RATING7.8/10
QUALITY7.5/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS49
VELOCITY0.69
OPEN ISSUES47
CLOSED ISSUES76
LAST COMMIT1 month ago
aiohttp (pip) <4
importlib-metadata (pip) >=1.4
Files by Type (count)
Other (.test)
72
Python
42
Markdown
4
Other (no ext)
3
YAML
3
TOML
2
INI
2
Text
2
Git Ignore
1
JavaScript
1
JSON
1
Other (.graphql)
1
Files by Type (size)
Python
310KB
Lock File
237KB
Other (.graphql)
234KB
Other (.test)
97KB
Markdown
8KB
YAML
3KB
Other (no ext)
2KB
TOML
1KB
Text
1KB
INI
739B
JavaScript
326B
JSON
285B

The LLM identified 3 files worth highlighting for reuse:

Provides robust parsing and manipulation of Git commit message trailers (subject, body, and key-value trailers). Uses a finite-state machine approach rather than fragile regex, correctly handling continuation lines and multiple trailers. The module is self-contained (no ghstack-specific imports) and can be extracted as a reusable library for any tool that needs to parse or modify git commit message trailers.

file: src/ghstack/trailers.py ↗ | tags: #git-trailers #string-parsing #standalone-utility

Implements a simple, durable key-value cache backed by SQLite with time-based eviction. The cache is parameterized by a table name, making it suitable for caching different types of data (e.g., CircleCI build results). It handles concurrent access with a single global connection (not thread-safe but adequate for synchronous usage). The pattern is straightforward and could be extracted for any project needing a persistent disk cache with minimal dependencies.

file: src/ghstack/cache.py ↗ | tags: #key-value-cache #sqlite #generic-cache

Defines the abstract `GitHubEndpoint` class that declares the async interface for all GitHub API interactions (PR creation/update, querying, etc.). This pattern enables the testing infrastructure with `FakeGitHubEndpoint` without requiring network calls. The interface is clean, with each method returning typed dataclasses. While the method signatures are specific to ghstack's domain, the abstract-interface pattern itself is reusable for any project needing mockable API clients.

file: src/ghstack/github.py ↗ | tags: #abstract-interface #api-client #testability
Last analyzed: 2026-09-12 04:46:38.179121
Next check: 2026-09-19 04:46:38.174555
$ submit: