[smart-log] feat: add stack discovery API #35
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add stack discovery API for finding PR stacks by walking base/head branch chains.
This enables
gh-stackto find related PRs without requiring identifier patterns in titles - a key foundation for making thelogcommand's identifier optional.Changes
New file:
src/api/stack.rs- Stack discovery module with:fetch_pr_by_head()- Find PR by head branch namefetch_prs_by_base()- Find all PRs targeting a base branchfetch_all_open_prs()- Get all open PRs in a repodiscover_stack()- Walk up/down to find full connected stackdiscover_all_stacks()- Group all PRs into separate stacksModified:
src/api/mod.rs- Export newstackmoduleAlgorithm
discover_stackworks by:Tests
9 new tests including mockito-based API tests:
test_fetch_pr_by_head_found/not_found/rate_limitedtest_fetch_prs_by_base_multiple/emptytest_fetch_all_open_prstest_sort_stack_linear/single/emptyStacked PR Chain: smart-log