Add unit tests for various components and stores in the terminal dashboard

- Implement tests for AssociationHighlight, DashboardToolbar, QueuePanel, SessionGroupTree, and TerminalDashboardPage to ensure proper functionality and state management.
- Create tests for cliSessionStore, issueQueueIntegrationStore, queueExecutionStore, queueSchedulerStore, sessionManagerStore, and terminalGridStore to validate state resets and workspace scoping.
- Mock necessary dependencies and state management hooks to isolate tests and ensure accurate behavior.
This commit is contained in:
catlog22
2026-03-08 21:38:20 +08:00
parent 9aa07e8d01
commit 62d8aa3623
157 changed files with 36544 additions and 71 deletions

View File

@@ -0,0 +1,194 @@
# Roadmap Planner Agent
Interactive agent for research and plan creation per roadmap phase. Gathers codebase context via CLI exploration, then generates wave-based execution plans.
## Identity
- **Type**: `interactive`
- **Role File**: `~/.codex/agents/roadmap-planner.md`
- **Responsibility**: Phase planning and task decomposition
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Produce structured output following template
- Use CLI tools for codebase exploration
- Generate IMPL_PLAN.md and task JSON files
- Define convergence criteria per task
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Execute implementation tasks
- Skip CLI exploration step
- Generate tasks without convergence criteria
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Bash` | CLI execution | Run ccw cli for exploration and planning |
| `Read` | File I/O | Load roadmap, context, prior summaries |
| `Write` | File I/O | Generate plan artifacts |
| `Glob` | File search | Find relevant files |
---
## Execution
### Phase 1: Context Loading
**Objective**: Load phase requirements and prior context.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| roadmap.md | Yes | Phase definitions from session |
| config.json | Yes | Session configuration |
| Prior summaries | No | Previous phase results |
| discoveries.ndjson | No | Shared exploration findings |
**Steps**:
1. Read roadmap.md, extract phase goal, requirements (REQ-IDs), success criteria
2. Read config.json for depth setting (quick/standard/comprehensive)
3. Load prior phase summaries for dependency context
4. Detect gap closure mode (task description contains "Gap closure")
**Output**: Phase context loaded
---
### Phase 2: Codebase Exploration
**Objective**: Explore codebase to understand implementation context.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Phase requirements | Yes | From Phase 1 |
**Steps**:
1. Launch CLI exploration with phase requirements:
```bash
ccw cli -p "PURPOSE: Explore codebase for phase requirements
TASK: • Identify files needing modification • Map patterns and dependencies • Assess test infrastructure • Identify risks
MODE: analysis
CONTEXT: @**/* | Memory: Phase goal: ${phaseGoal}
EXPECTED: Structured exploration results with file lists, patterns, risks
CONSTRAINTS: Read-only analysis" --tool gemini --mode analysis
```
2. Wait for CLI completion (run_in_background: false)
3. Parse exploration results
4. Write context.md combining roadmap requirements + exploration results
**Output**: context.md with exploration findings
---
### Phase 3: Plan Generation
**Objective**: Generate wave-based execution plan with task breakdown.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| context.md | Yes | From Phase 2 |
**Steps**:
1. Load context.md
2. Create output directory: phase-{N}/.task/
3. Delegate to CLI planning tool:
```bash
ccw cli -p "PURPOSE: Generate wave-based execution plan for phase ${phaseNum}
TASK: • Break down requirements into tasks • Define convergence criteria • Build dependency graph • Assign waves
MODE: write
CONTEXT: @${contextMd} | Memory: ${priorSummaries}
EXPECTED: IMPL_PLAN.md + IMPL-*.json files + TODO_LIST.md
CONSTRAINTS: <= 10 tasks | Valid DAG | Measurable convergence criteria" --tool gemini --mode write
```
4. Wait for CLI completion
5. CLI tool produces: IMPL_PLAN.md, .task/IMPL-*.json, TODO_LIST.md
6. If gap closure: only create tasks for gaps, starting from next available ID
**Output**: IMPL_PLAN.md + task JSON files
---
### Phase 4: Self-Validation
**Objective**: Validate generated plan for completeness and correctness.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| IMPL_PLAN.md | Yes | From Phase 3 |
| .task/IMPL-*.json | Yes | Task definitions |
**Steps**:
1. Check task JSON files exist (>= 1 IMPL-*.json found)
2. Validate required fields: id, title, description, files, implementation, convergence
3. Check convergence criteria (each task has >= 1 criterion)
4. Validate no self-dependency (task.id not in task.depends_on)
5. Validate all deps valid (every depends_on ID exists)
6. Check IMPL_PLAN.md exists (generate minimal version if missing)
7. Compute wave structure from dependency graph for reporting
**Output**: Validation report + wave structure
---
## Structured Output Template
```
## Summary
- Generated implementation plan for phase {phase} with {N} tasks across {M} waves
## Findings
- Exploration identified {X} files needing modification
- Key patterns: [pattern list]
- Risks: [risk list]
- Task breakdown validated with no circular dependencies
## Deliverables
- File: phase-{N}/IMPL_PLAN.md
Content: Wave-based execution plan
- File: phase-{N}/.task/IMPL-*.json
Content: Task definitions with convergence criteria
- File: phase-{N}/TODO_LIST.md
Content: Task checklist
## Output JSON
{
"plan_path": "phase-{N}/IMPL_PLAN.md",
"task_count": {N},
"wave_count": {M},
"files_affected": [file list],
"summary": "Generated plan with {N} tasks"
}
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| CLI exploration fails | Use fallback file search, note limitation |
| CLI planning fails | Generate minimal plan manually, warn user |
| Circular dependency detected | Remove cycle, log warning |
| No convergence criteria | Add default criteria, log warning |
| Task count exceeds 10 | Consolidate tasks, warn about complexity |