feat: implement auto-merge for approved PRs and update workflow documentation

This commit is contained in:
Lauren ten Hoor
2026-02-16 14:34:08 +08:00
parent f7aa47102f
commit 25ce06e14f
15 changed files with 208 additions and 163 deletions

View File

@@ -39,6 +39,7 @@ export type TransitionAction = string;
export const Action = {
GIT_PULL: "gitPull",
DETECT_PR: "detectPr",
MERGE_PR: "mergePr",
CLOSE_ISSUE: "closeIssue",
REOPEN_ISSUE: "reopenIssue",
} as const;
@@ -56,6 +57,7 @@ export const WorkflowEvent = {
COMPLETE: "COMPLETE",
REVIEW: "REVIEW",
APPROVED: "APPROVED",
MERGE_FAILED: "MERGE_FAILED",
PASS: "PASS",
FAIL: "FAIL",
REFINE: "REFINE",
@@ -98,6 +100,7 @@ export type CompletionRule = {
export const DEFAULT_WORKFLOW: WorkflowConfig = {
initial: "planning",
states: {
// ── Main pipeline (happy path) ──────────────────────────────
planning: {
type: StateType.HOLD,
label: "Planning",
@@ -123,6 +126,17 @@ export const DEFAULT_WORKFLOW: WorkflowConfig = {
[WorkflowEvent.BLOCKED]: "refining",
},
},
reviewing: {
type: StateType.REVIEW,
label: "In Review",
color: "#c5def5",
check: ReviewCheck.PR_APPROVED,
on: {
[WorkflowEvent.APPROVED]: { target: "toTest", actions: [Action.MERGE_PR, Action.GIT_PULL] },
[WorkflowEvent.MERGE_FAILED]: "toImprove",
[WorkflowEvent.BLOCKED]: "refining",
},
},
toTest: {
type: StateType.QUEUE,
role: "tester",
@@ -143,6 +157,13 @@ export const DEFAULT_WORKFLOW: WorkflowConfig = {
[WorkflowEvent.BLOCKED]: "refining",
},
},
done: {
type: StateType.TERMINAL,
label: "Done",
color: "#5cb85c",
},
// ── Side paths (loops back into main pipeline) ──────────────
toImprove: {
type: StateType.QUEUE,
role: "developer",
@@ -157,21 +178,8 @@ export const DEFAULT_WORKFLOW: WorkflowConfig = {
color: "#f39c12",
on: { [WorkflowEvent.APPROVE]: "todo" },
},
reviewing: {
type: StateType.REVIEW,
label: "In Review",
color: "#c5def5",
check: ReviewCheck.PR_MERGED,
on: {
[WorkflowEvent.APPROVED]: { target: "toTest", actions: [Action.GIT_PULL] },
[WorkflowEvent.BLOCKED]: "refining",
},
},
done: {
type: StateType.TERMINAL,
label: "Done",
color: "#5cb85c",
},
// ── Architect track ─────────────────────────────────────────
toDesign: {
type: StateType.QUEUE,
role: "architect",