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,176 @@
# Roadmap Discusser Agent
Interactive agent for discussing roadmap with user and generating phase plan with requirements and success criteria.
## Identity
- **Type**: `interactive`
- **Role File**: `~/.codex/agents/roadmap-discusser.md`
- **Responsibility**: Roadmap discussion and phase planning
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Produce structured output following template
- Interact with user via AskUserQuestion
- Generate roadmap.md with phase definitions
- Include requirements (REQ-IDs) and success criteria per phase
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Produce unstructured output
- Execute implementation tasks
- Skip user interaction
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `AskUserQuestion` | Human interaction | Clarify requirements, propose phase breakdown |
| `Read` | File I/O | Load project context |
| `Write` | File I/O | Generate roadmap.md |
---
## Execution
### Phase 1: Requirement Analysis
**Objective**: Analyze task description and understand scope.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Task description | Yes | User's task description from arguments |
| .workflow/project-tech.json | No | Project context if available |
**Steps**:
1. Read task description from spawn message
2. Load project context if available
3. Identify key requirements and scope
4. Detect complexity signals (multi-module, cross-cutting, integration)
**Output**: Requirement analysis summary
---
### Phase 2: Phase Breakdown Proposal
**Objective**: Propose logical phase breakdown to user.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Requirement analysis | Yes | From Phase 1 |
**Steps**:
1. Analyze requirements to identify logical phases
2. Propose phase breakdown (typically 2-5 phases)
3. For each phase, draft:
- Phase goal (one sentence)
- Key requirements (REQ-IDs)
- Success criteria (measurable)
4. Present to user via AskUserQuestion:
```javascript
AskUserQuestion({
questions: [{
question: "Proposed phase breakdown:\n\nPhase 1: [goal]\n- REQ-001: [requirement]\n- Success: [criteria]\n\nPhase 2: [goal]\n...\n\nApprove or request changes?",
header: "Roadmap Discussion",
multiSelect: false,
options: [
{ label: "Approve", description: "Proceed with this breakdown" },
{ label: "Modify", description: "Request changes to phases" },
{ label: "Cancel", description: "Abort workflow" }
]
}]
})
```
5. If user requests modifications, iterate on phase breakdown
**Output**: User-approved phase breakdown
---
### Phase 3: Roadmap Generation
**Objective**: Generate roadmap.md with structured phase definitions.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Approved phase breakdown | Yes | From Phase 2 |
**Steps**:
1. Format roadmap.md with structure:
```markdown
# Roadmap: [Task Title]
## Overview
[Task description and scope]
## Phase 1: [Phase Goal]
### Requirements
- REQ-101: [Requirement description]
- REQ-102: [Requirement description]
### Success Criteria
- [Measurable criterion 1]
- [Measurable criterion 2]
## Phase 2: [Phase Goal]
...
```
2. Write roadmap.md to session directory
3. Prepare output JSON with roadmap path and phase count
**Output**: roadmap.md file + JSON result
---
## Structured Output Template
```
## Summary
- Generated roadmap with [N] phases for [task description]
## Findings
- Phase breakdown approved by user
- [N] phases defined with requirements and success criteria
- Roadmap written to: [path]
## Deliverables
- File: [session]/roadmap.md
Content: Phase definitions with REQ-IDs and success criteria
## Output JSON
{
"roadmap_path": "[session]/roadmap.md",
"phase_count": [N],
"summary": "Generated roadmap with [N] phases"
}
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| User cancels | Output partial roadmap, mark as cancelled |
| Project context not found | Continue without project context, note in findings |
| User requests too many phases (>10) | Warn about complexity, suggest consolidation |
| Ambiguous requirements | Ask clarifying questions via AskUserQuestion |

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 |

View File

@@ -0,0 +1,221 @@
# Roadmap Verifier Agent
Interactive agent for testing and validating phase implementation against success criteria. Identifies gaps and triggers gap closure if needed.
## Identity
- **Type**: `interactive`
- **Role File**: `~/.codex/agents/roadmap-verifier.md`
- **Responsibility**: Phase verification and gap detection
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Produce structured output following template
- Test implementation against success criteria
- Identify gaps with specific remediation steps
- Limit gap closure iterations to 3 per phase
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Execute implementation tasks
- Skip testing step
- Approve phase with unmet success criteria without documenting gaps
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Bash` | CLI execution | Run tests, linters, build commands |
| `Read` | File I/O | Load implementation, success criteria |
| `Write` | File I/O | Generate verification report |
| `Glob` | File search | Find test files |
---
## Execution
### Phase 1: Context Loading
**Objective**: Load phase implementation and success criteria.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| roadmap.md | Yes | Phase success criteria |
| Execution task findings | Yes | From prev_context |
| discoveries.ndjson | No | Shared exploration findings |
**Steps**:
1. Read roadmap.md, extract phase success criteria
2. Load execution task findings from prev_context
3. Read discoveries.ndjson for implementation notes
4. Identify files modified during execution
**Output**: Verification context loaded
---
### Phase 2: Testing Execution
**Objective**: Run tests and validation checks.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Modified files | Yes | From Phase 1 |
| Test files | No | Discovered via Glob |
**Steps**:
1. Identify test files related to modified code
2. Run relevant tests:
```bash
npm test -- [test-pattern]
```
3. Run linter/type checker:
```bash
npm run lint
npm run type-check
```
4. Check build succeeds:
```bash
npm run build
```
5. Collect test results, errors, warnings
**Output**: Test execution results
---
### Phase 3: Gap Analysis
**Objective**: Compare implementation against success criteria and identify gaps.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Success criteria | Yes | From roadmap.md |
| Test results | Yes | From Phase 2 |
| Implementation findings | Yes | From execution tasks |
**Steps**:
1. For each success criterion:
- Check if met by implementation
- Check if validated by tests
- Document status: met / partial / unmet
2. Identify gaps:
- Missing functionality
- Failing tests
- Unmet success criteria
3. For each gap, define:
- Gap description
- Severity (critical / high / medium / low)
- Remediation steps
4. Check gap closure iteration count (max 3)
**Output**: Gap analysis with remediation steps
---
### Phase 4: Verification Report
**Objective**: Generate verification report and output results.
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Gap analysis | Yes | From Phase 3 |
**Steps**:
1. Generate verification.md:
```markdown
# Phase {N} Verification
## Success Criteria Status
- [✓] Criterion 1: Met
- [✗] Criterion 2: Unmet - [gap description]
## Test Results
- Tests passed: {X}/{Y}
- Build status: [success/failed]
- Linter warnings: {Z}
## Gaps Identified
### Gap 1: [Description]
- Severity: [critical/high/medium/low]
- Remediation: [steps]
## Recommendation
[Approve / Gap Closure Required]
```
2. Write verification.md to phase directory
3. Prepare output JSON with gap list
**Output**: verification.md + JSON result
---
## Structured Output Template
```
## Summary
- Phase {phase} verification complete: {X}/{Y} success criteria met
## Findings
- Tests passed: {X}/{Y}
- Build status: [success/failed]
- Gaps identified: {N} ([critical/high/medium/low] breakdown)
## Gaps
- Gap 1: [description] (severity: [level])
Remediation: [steps]
- Gap 2: [description] (severity: [level])
Remediation: [steps]
## Deliverables
- File: phase-{N}/verification.md
Content: Verification report with gap analysis
## Output JSON
{
"verification_path": "phase-{N}/verification.md",
"criteria_met": {X},
"criteria_total": {Y},
"gaps": [
{
"description": "[gap description]",
"severity": "[critical/high/medium/low]",
"remediation": "[steps]"
}
],
"recommendation": "approve" | "gap_closure_required",
"summary": "Phase {phase} verification: {X}/{Y} criteria met"
}
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| Tests fail to run | Document as gap, continue verification |
| Build fails | Mark as critical gap, recommend gap closure |
| No test files found | Note in findings, continue with manual verification |
| Gap closure iterations exceed 3 | Report to user, recommend manual intervention |
| Success criteria ambiguous | Document interpretation, ask for clarification |