Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:37:27 +08:00
commit 37774aa937
131 changed files with 31137 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
---
name: ln-330-story-executor
description: Orchestrates Story tasks. Prioritizes To Review -> To Rework -> Todo, delegates to ln-331/ln-333/ln-334, hands Story quality to ln-340. Metadata-only loading up front.
---
# Story Execution Orchestrator
Executes a Story end-to-end by looping through its tasks in priority order and delegating quality gates to ln-340-story-quality-gate.
## Purpose & Scope
- Load Story + task metadata (no descriptions) and drive execution.
- Process tasks in order: To Review -> To Rework -> Todo (foundation-first order preserved from ln-310).
- Delegate per task type: ln-332-task-reviewer, ln-333-task-rework, ln-331-task-executor, ln-334-test-executor.
- Delegate Story quality to ln-340-story-quality-gate (Pass 1/Pass 2) and loop if new tasks are created.
## When to Use
- Story is Todo or In Progress and has implementation/refactor/test tasks to finish.
- Need automated orchestration through To Review and quality gates.
## Workflow (concise)
- **Phase 1 Discovery:** Auto-discover Team ID/config from kanban_board.md + CLAUDE.md.
- **Phase 2 Load:** Fetch Story metadata and all child task metadata via `list_issues(parentId=Story.id)` (ID/title/status/labels only). Summarize counts; do not call `get_issue` yet.
- **Phase 3 Loop (priority, review-after-each-task):**
1) To Review -> ln-332-task-reviewer (one task). Reload metadata after worker.
2) To Rework -> ln-333-task-rework (one task). After worker, verify status = To Review, then immediately call ln-332-task-reviewer on that same task. Reload metadata.
3) Todo -> pick first Todo; if label "tests" use ln-334-test-executor else ln-331-task-executor. After worker, verify status = To Review (not Done/In Progress), then immediately call ln-332-task-reviewer on that same task. Reload metadata. Repeat loop; never queue multiple tasks in To Review—review right after each execution/rework.
- **Phase 4 Quality Delegation:** Ensure all implementation tasks Done, then call ln-340-story-quality-gate Pass 1. If it creates tasks (test/refactor/fix), auto-validate (ln-320) and return to Phase 3. When test task is Done, set Story In Progress -> To Review and call ln-340 Pass 2. If Pass 2 fails and creates tasks, loop to Phase 3; if Pass 2 passes, Story goes To Review -> Done via ln-340.
## Critical Rules
- Metadata first: never load task descriptions in Phase 2; only workers load full text.
- Single-task operations: each worker handles only the passed task ID; ln-330 never bulk-updates tasks.
- Status discipline: after ln-331/ln-333/ln-334, task must be To Review; immediately invoke ln-332 on that task. Only ln-332 may set Done. Stop and report if any worker leaves task Done or In Progress.
- Source of truth: trust Linear metadata, not kanban_board.md, for orchestration decisions.
- Story status ownership: ln-330 moves Todo -> In Progress (first execution) and In Progress -> To Review (all tasks Done); ln-340 handles To Review -> Done.
## Definition of Done
- Story metadata and task metadata loaded via list_issues (no get_issue in Phase 2); counts shown.
- Loop executed: all To Review via ln-332; all To Rework via ln-333 then immediate ln-332 on the same task; all Todo via ln-331/ln-334 then immediate ln-332 on the same task (validated To Review after each worker).
- If tasks were created by ln-340: validated via ln-320 and executed through the loop.
- ln-340 Pass 1 invoked when impl tasks Done; Pass 2 invoked when test task Done or not needed. Result handled (pass/fail -> loop).
- Story status transitions applied (Todo -> In Progress -> To Review) and kanban updated by workers/ln-340.
- Final report with task counts and next step (if any).
## Reference Files
- Quality orchestration: `../ln-340-story-quality-gate/SKILL.md`
- Executors: `../ln-331-task-executor/SKILL.md`, `../ln-333-task-rework/SKILL.md`, `../ln-334-test-executor/SKILL.md`, `../ln-332-task-reviewer/SKILL.md`
- Auto-discovery: `CLAUDE.md`, `docs/tasks/kanban_board.md`
---
Version: 8.1.0 (Condensed orchestration, kept priority loop and quality delegation rules)
Last Updated: 2025-11-26

View File

@@ -0,0 +1,189 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ln-330-story-executor - State Diagram</title>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<link rel="stylesheet" href="../shared/css/diagram.css">
</head>
<body>
<div class="container">
<header>
<h1>🔄 ln-330-story-executor</h1>
<p class="subtitle">Story Execution Orchestrator - State Diagram</p>
</header>
<div class="info-box">
<h3>📋 Workflow Overview</h3>
<ul>
<li><strong>Purpose:</strong> Orchestrate complete Story execution from tasks through quality gates to Story Done (FULL AUTOMATION)</li>
<li><strong>Priority Order:</strong> 🔴 To Review → 🟡 To Rework → 🟢 Todo (Phase 3 loop)</li>
<li><strong>Loop Control:</strong> Explicit LoopEntry/ReturnToLoop points with thick arrows (==>) for cycle clarity</li>
<li><strong>Phase 4 Delegation:</strong> ln-340-story-quality-gate Pass 1 (auto-verifies new tasks) → Pass 2 (auto-invoked after test task Done) → Story Done</li>
<li><strong>Key Feature:</strong> Lazy loading (metadata only in Phase 2, saves 10,000+ tokens)</li>
<li><strong>Self-Healing:</strong> Pass 1 creates fix/refactor/test task → auto-verifies (Backlog → Todo) → loops back to Phase 3</li>
<li><strong>Full Automation:</strong> Todo → In Progress → To Review → Done (no manual intervention)</li>
</ul>
</div>
<div class="legend">
<div class="legend-item">
<div class="legend-color color-discovery"></div>
<span>Discovery/Preparation</span>
</div>
<div class="legend-item">
<div class="legend-color color-loop"></div>
<span>Loop/Processing</span>
</div>
<div class="legend-item">
<div class="legend-color" style="background-color: #E1BEE7; border-color: #7B1FA2;"></div>
<span>Loop Control (Entry/Return)</span>
</div>
<div class="legend-item">
<div class="legend-color color-decision"></div>
<span>Decision Point</span>
</div>
<div class="legend-item">
<div class="legend-color color-action"></div>
<span>Action/Update</span>
</div>
<div class="legend-item">
<div class="legend-color color-critical"></div>
<span>Critical (Stop Condition)</span>
</div>
</div>
<div class="diagram-container">
<div class="mermaid">
graph TD
Start((Start:<br/>Execute Story)) --> Phase1[Phase 1: Discovery<br/>Auto-discover Team ID]
Phase1 --> Phase2[Phase 2: Story + Tasks Overview<br/>Load Story FULL description<br/>❌ Tasks metadata ONLY from kanban_board.md]
Phase2 --> KanbanCheck{kanban_board.md<br/>exists?}
KanbanCheck -->|No| SyncLinear[Fallback: Sync with Linear<br/>Fetch tasks metadata ONLY<br/>NO descriptions!]
SyncLinear --> LoopEntry
KanbanCheck -->|Yes| LoopEntry
%% Phase 3: Task Orchestration Loop
subgraph Phase3_Loop [⚙️ Phase 3: Task Orchestration Loop - Priority-Based (3 levels)]
direction TB
LoopEntry((Loop<br/>Entry)) --> Phase3
Phase3[Read kanban_board.md<br/>Count tasks by status]
Phase3 --> Priority0{🔴 PRIORITY 0<br/>Has To Review?}
Priority0 -->|Yes| InvokeReviewer[[ln-332-task-reviewer<br/>via Skill tool]]
InvokeReviewer -->|Task reviewed| ReloadAfterReview[Reload state]
ReloadAfterReview ==> LoopEntry
Priority0 -->|No| Priority1{🟡 PRIORITY 1<br/>Has To Rework?}
Priority1 -->|Yes| InvokeRework[[ln-333-task-rework<br/>via Skill tool]]
InvokeRework -->|Task fixed| ReloadAfterRework[Reload state]
ReloadAfterRework ==> LoopEntry
Priority1 -->|No| Priority2{🟢 PRIORITY 2<br/>Has Todo?}
Priority2 -->|Yes| InvokeExecutor[[ln-331-task-executor<br/>or ln-334-test-executor<br/>via Skill tool]]
InvokeExecutor -->|Task executed| ReloadAfterExec[Reload state]
ReloadAfterExec ==> LoopEntry
Priority2 -->|No| StopCondition{{Stop Condition:<br/>All Tasks Done}}
end
%% Phase 4: Story Review & Finalization (Delegation Pattern)
subgraph Phase4_Review [✅ Phase 4: Story Quality Delegation - Pass 1 & Pass 2]
direction TB
Phase4Start[All implementation tasks Done]
Phase4Start --> InvokePass1[Invoke ln-340-story-quality-gate Pass 1<br/>via Skill tool]
InvokePass1 --> Pass1Execution[Pass 1 executes:<br/>Code Quality → Regression → Manual Testing]
Pass1Execution --> Pass1Verdict{Pass 1 Verdict?}
Pass1Verdict -->|Test task created| AutoVerifyTest[Auto-verify via ln-320-story-validator<br/>Backlog → Todo]
Pass1Verdict -->|Fix/refactor task created| AutoVerifyFix[Auto-verify via ln-320-story-validator<br/>Backlog → Todo]
AutoVerifyTest --> LoopBackTest[GOTO Phase 3<br/>Execute test task]
AutoVerifyFix --> LoopBackFix[GOTO Phase 3<br/>Execute fix/refactor task]
LoopBackTest -.->|Test task Done| InvokePass2
LoopBackFix -.->|Fix Done| InvokePass1
InvokePass2[Update Story: In Progress → To Review<br/>Invoke ln-340-story-quality-gate Pass 2<br/>via Skill tool]
InvokePass2 --> Pass2Execution[Pass 2 executes:<br/>Test verification Priority ≥15]
Pass2Execution --> Pass2Verdict{Pass 2 Verdict?}
Pass2Verdict -->|PASS| StoryDone[Story status: To Review → Done<br/>Delete temp script<br/>Workflow complete]
Pass2Verdict -->|FAIL| CreatePass2Fix[Create fix tasks in Backlog<br/>Auto-verify → GOTO Phase 3]
end
StopCondition -.->|Trigger| Phase4Start
%% Self-healing: Return points
LoopBackTest -.-> ReturnToLoop
LoopBackFix -.-> ReturnToLoop
CreatePass2Fix -.-> ReturnToLoop
ReturnToLoop((Return to<br/>Orchestration)) ==> LoopEntry
StoryDone --> End((End))
%% Styling
classDef discovery fill:#E3F2FD,stroke:#1976D2,stroke-width:2px
classDef loop fill:#FFF9C4,stroke:#F57C00,stroke-width:2px
classDef decision fill:#FFE0B2,stroke:#E64A19,stroke-width:2px
classDef action fill:#C8E6C9,stroke:#388E3C,stroke-width:2px
classDef critical fill:#FFCDD2,stroke:#C62828,stroke-width:3px
classDef loopControl fill:#E1BEE7,stroke:#7B1FA2,stroke-width:2px
class Phase1,Phase2 discovery
class Phase3,InvokeReviewer,InvokeRework,InvokeExecutor,ReloadAfterReview,ReloadAfterRework,ReloadAfterExec loop
class Priority0,Priority1,Priority2,KanbanCheck,Pass1Verdict,Pass2Verdict decision
class Phase4Start,InvokePass1,Pass1Execution,InvokePass2,Pass2Execution,AutoVerifyTest,AutoVerifyFix,LoopBackTest,LoopBackFix,CreatePass2Fix,StoryDone action
class StopCondition critical
class LoopEntry,ReturnToLoop loopControl
</div>
</div>
<div class="info-box">
<h3>⚠️ Critical Rules</h3>
<ul>
<li><strong>Phase 2 - ABSOLUTE PROHIBITION:</strong> NEVER load full Task descriptions (saves 10,000+ tokens)</li>
<li><strong>Loop Mechanism:</strong> Reload kanban_board.md after every skill invocation to get fresh state</li>
<li><strong>Priority Enforcement:</strong> Priority 0 (To Review) → Priority 1 (To Rework) → Priority 2 (Todo)</li>
<li><strong>Phase 4 Automation:</strong> Full Story lifecycle executes automatically (Pass 1 → auto-verify new tasks → Pass 2 → Done)</li>
</ul>
</div>
<div class="info-box">
<h3>🔍 Phase 4: Story Quality Delegation (Orchestrator-Worker Pattern)</h3>
<ul>
<li><strong>Pass 1 Invocation:</strong> ln-330-story-executor delegates to ln-340-story-quality-gate Pass 1 (Code Quality → Regression → Manual Testing with Early Exit)</li>
<li><strong>Auto-Verification:</strong> New tasks (test/fix/refactor) created in Backlog are automatically verified by ln-320-story-validator (invoked via Skill tool)</li>
<li><strong>Loop Back:</strong> After auto-verification moves tasks to Todo, orchestration loop continues via Priority 2 (Todo execution)</li>
<li><strong>Pass 2 Invocation:</strong> When test task Done, Story status updates to To Review and ln-340-story-quality-gate Pass 2 is invoked automatically</li>
<li><strong>Story Done:</strong> Pass 2 verifies tests (Priority ≥15, 10-28 total), updates Story status to Done, workflow complete</li>
<li><strong>Self-Healing:</strong> Pass 2 failures create fix tasks in Backlog → ln-320-story-validator auto-verification → loop back to Phase 3</li>
</ul>
</div>
<footer>
<p>ln-330-story-executor v6.0.0 | Full automation: Todo → In Progress → To Review → Done (no manual intervention)</p>
<p>Diagram format: Mermaid.js | Orchestrator-Worker Pattern | Last updated: 2025-11-14</p>
</footer>
</div>
<script>
mermaid.initialize({
startOnLoad: true,
theme: 'default',
flowchart: {
useMaxWidth: true,
htmlLabels: true,
curve: 'stepBefore'
}
});
</script>
</body>
</html>