feat(KB-093): add PR-first merge mode with configurable merge strategies

- Add mergeStrategy setting (fast-forward, squash, merge-commit) to config
- Implement PR-first auto-completion flow that monitors PR merge status
- Wire PR monitoring service to detect merge completion and trigger auto-close
- Add PR status UI to dashboard with merge progress indicator
- Update settings modal with merge strategy selector
- Add changeset for PR-first merge mode feature
This commit is contained in:
gsxdsm
2026-03-29 23:13:24 -07:00
parent 94f599a3df
commit fd9a1b186a
27 changed files with 1715 additions and 109 deletions

View File

@@ -24,8 +24,8 @@ graph TD
R2 -->|rethink| P
end
R2 -->|done| IR["In Review\n<i>ready to merge,\nor auto-merge</i>"]
IR -->|squash merge| D["Done"]
R2 -->|done| IR["In Review\n<i>ready to merge,\nor auto-complete</i>"]
IR -->|direct squash merge\nor merged PR| D["Done"]
style H fill:#161b22,stroke:#8b949e,color:#e6edf3
style T fill:#2d2006,stroke:#d29922,color:#d29922
@@ -235,6 +235,25 @@ kb can create GitHub Pull Requests directly from the dashboard for tasks in the
The dashboard shows real-time PR status (open, closed, merged) with a refresh button to fetch the latest state from GitHub.
### Auto-completion modes
kb supports two completion strategies once a task reaches **In Review**:
- **Direct merge** *(default)* — existing behavior. kb AI-squash-merges the task branch into your current branch locally.
- **Pull request** — kb creates or links a GitHub PR for the task branch, keeps the task in **In Review** while reviews/checks are pending, and auto-merges the PR when required checks succeed and no review is actively blocking it.
`autoMerge` still controls whether kb performs either completion strategy automatically. Turning `autoMerge` off means tasks stay in **In Review** until you merge manually.
### PR-first mode prerequisites and behavior
PR-first automation is designed for repositories that require GitHub-side governance:
- Authenticate GitHub access with `gh auth login` or `GITHUB_TOKEN`
- Ensure the task branch already exists on GitHub using the normal kb branch naming convention: `kb/<task-id-lower>`
- Expect the task to remain in **In Review** while required checks are pending/failing or a review is blocking merge
**Important:** kb does **not** implicitly push task branches before creating a PR. PR-first mode assumes branch publishing is handled by your existing workflow or repository automation.
### Spec Editing & AI Revision
The dashboard includes a **Spec** tab for managing task specifications directly in the UI: