mirror of https://github.com/garrytan/gstack.git
feat(ship): add Step 1.5 pr-prep gate before merge + tests
`/ship` now invokes `/pr-prep --base $BASE_BRANCH --json` with `GSTACK_FROM_SHIP=1` before any of: merge base branch, run tests, version bump, push. If pr-prep returns EXACT_DUP (exit 1), ship aborts with a pinpoint message naming the upstream PR + resolution paths (close mine / cherry-pick unique parts / coordinate + retry with `--skip-pr-prep`). Skip conditions: - No upstream remote configured (solo-repo case) - `--skip-pr-prep` flag (override) - pr-prep skill not installed (older gstack — stderr warn + continue) SIBLING / OVERLAP / CLEAN buckets do NOT block. The JSON report is written to `/tmp/ship-pr-prep.json` so Step 19 (PR body assembly) can render upstream context as a collapsed section. Helps reviewers triage faster. Catches the real bug class motivating the new skill: contributor pushes branch with N commits, M of N duplicate already-open upstream work, reviewer closes the dups, branch cleanup churn. /ship now fails fast before any test run wastes time on a doomed branch.
This commit is contained in:
parent
aa8ba4d43c
commit
d67e0bd168
|
|
@ -916,7 +916,55 @@ If CEO Review is missing, mention as informational ("CEO Review not run — reco
|
|||
|
||||
For Design Review: run `source <(~/.claude/skills/gstack/bin/gstack-diff-scope <base> 2>/dev/null)`. If `SCOPE_FRONTEND=true` and no design review (plan-design-review or design-review-lite) exists in the dashboard, mention: "Design Review not run — this PR changes frontend code. The lite design check will run automatically in Step 9, but consider running /design-review for a full visual audit post-implementation." Still never block.
|
||||
|
||||
Continue to Step 2 — do NOT block or ask. Ship runs its own review in Step 9.
|
||||
Continue to Step 1.5 — do NOT block or ask. Ship runs its own review in Step 9.
|
||||
|
||||
---
|
||||
|
||||
## Step 1.5: Upstream duplicate audit (pr-prep gate)
|
||||
|
||||
Catches the case where a contributor's branch would file a PR that
|
||||
duplicates an already-open upstream PR or issue. Without this gate
|
||||
the duplicate gets filed and is closed days later, costing reviewer
|
||||
time + contributor goodwill.
|
||||
|
||||
Skip on:
|
||||
- Forks that don't have a tracked upstream remote
|
||||
- Branches where the base is the user's own fork (no upstream to dup)
|
||||
- Explicit `--skip-pr-prep` flag
|
||||
|
||||
Otherwise run `/pr-prep` inline with `GSTACK_FROM_SHIP=1`:
|
||||
|
||||
```bash
|
||||
# Skip if no upstream remote configured (solo-repo case)
|
||||
if ! gh repo view --json nameWithOwner -q .nameWithOwner >/dev/null 2>&1; then
|
||||
echo "[ship] no upstream repo detected, skipping pr-prep audit"
|
||||
else
|
||||
GSTACK_FROM_SHIP=1 ~/.claude/skills/gstack/bin/gstack-skill pr-prep --base "$BASE_BRANCH" --json > /tmp/ship-pr-prep.json 2>&1
|
||||
PR_PREP_EXIT=$?
|
||||
if [ "$PR_PREP_EXIT" -eq 1 ]; then
|
||||
# EXACT_DUP found
|
||||
cat /tmp/ship-pr-prep.json
|
||||
echo ""
|
||||
echo "✗ Ship aborted: pr-prep found exact duplicate upstream work."
|
||||
echo " Resolution paths:"
|
||||
echo " 1. Close your version, comment on the upstream PR with your angle"
|
||||
echo " 2. Cherry-pick unique parts to a new branch + file separately"
|
||||
echo " 3. Override with /ship --skip-pr-prep if coordinated with the upstream PR author"
|
||||
exit 1
|
||||
fi
|
||||
# CLEAN / OVERLAP / SIBLING — render summary, continue
|
||||
jq -r '.summary' /tmp/ship-pr-prep.json 2>/dev/null || true
|
||||
fi
|
||||
```
|
||||
|
||||
Note: the JSON report path (`/tmp/ship-pr-prep.json`) is read again in
|
||||
Step 19 (PR body assembly) to surface SIBLING / OVERLAP findings as a
|
||||
collapsed "Upstream context" section in the PR body. SIBLING context
|
||||
helps reviewers triage faster; it does NOT block ship.
|
||||
|
||||
If the pr-prep skill is not installed (older gstack install), fall
|
||||
through with a stderr warn and continue. Don't hard-fail ship on a
|
||||
missing skill.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,55 @@ If CEO Review is missing, mention as informational ("CEO Review not run — reco
|
|||
|
||||
For Design Review: run `source <(~/.claude/skills/gstack/bin/gstack-diff-scope <base> 2>/dev/null)`. If `SCOPE_FRONTEND=true` and no design review (plan-design-review or design-review-lite) exists in the dashboard, mention: "Design Review not run — this PR changes frontend code. The lite design check will run automatically in Step 9, but consider running /design-review for a full visual audit post-implementation." Still never block.
|
||||
|
||||
Continue to Step 2 — do NOT block or ask. Ship runs its own review in Step 9.
|
||||
Continue to Step 1.5 — do NOT block or ask. Ship runs its own review in Step 9.
|
||||
|
||||
---
|
||||
|
||||
## Step 1.5: Upstream duplicate audit (pr-prep gate)
|
||||
|
||||
Catches the case where a contributor's branch would file a PR that
|
||||
duplicates an already-open upstream PR or issue. Without this gate
|
||||
the duplicate gets filed and is closed days later, costing reviewer
|
||||
time + contributor goodwill.
|
||||
|
||||
Skip on:
|
||||
- Forks that don't have a tracked upstream remote
|
||||
- Branches where the base is the user's own fork (no upstream to dup)
|
||||
- Explicit `--skip-pr-prep` flag
|
||||
|
||||
Otherwise run `/pr-prep` inline with `GSTACK_FROM_SHIP=1`:
|
||||
|
||||
```bash
|
||||
# Skip if no upstream remote configured (solo-repo case)
|
||||
if ! gh repo view --json nameWithOwner -q .nameWithOwner >/dev/null 2>&1; then
|
||||
echo "[ship] no upstream repo detected, skipping pr-prep audit"
|
||||
else
|
||||
GSTACK_FROM_SHIP=1 ~/.claude/skills/gstack/bin/gstack-skill pr-prep --base "$BASE_BRANCH" --json > /tmp/ship-pr-prep.json 2>&1
|
||||
PR_PREP_EXIT=$?
|
||||
if [ "$PR_PREP_EXIT" -eq 1 ]; then
|
||||
# EXACT_DUP found
|
||||
cat /tmp/ship-pr-prep.json
|
||||
echo ""
|
||||
echo "✗ Ship aborted: pr-prep found exact duplicate upstream work."
|
||||
echo " Resolution paths:"
|
||||
echo " 1. Close your version, comment on the upstream PR with your angle"
|
||||
echo " 2. Cherry-pick unique parts to a new branch + file separately"
|
||||
echo " 3. Override with /ship --skip-pr-prep if coordinated with the upstream PR author"
|
||||
exit 1
|
||||
fi
|
||||
# CLEAN / OVERLAP / SIBLING — render summary, continue
|
||||
jq -r '.summary' /tmp/ship-pr-prep.json 2>/dev/null || true
|
||||
fi
|
||||
```
|
||||
|
||||
Note: the JSON report path (`/tmp/ship-pr-prep.json`) is read again in
|
||||
Step 19 (PR body assembly) to surface SIBLING / OVERLAP findings as a
|
||||
collapsed "Upstream context" section in the PR body. SIBLING context
|
||||
helps reviewers triage faster; it does NOT block ship.
|
||||
|
||||
If the pr-prep skill is not installed (older gstack install), fall
|
||||
through with a stderr warn and continue. Don't hard-fail ship on a
|
||||
missing skill.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue