feat(dev-workflow): 替换 Codex 为 codeagent 并添加 UI 自动检测

主要变更:
- 全量替换 Codex → codeagent skill 引用
- 添加 UI 自动检测机制(Step 2 分析阶段)
- 实现 backend 分流:后端任务用 codex,UI 任务用 gemini
- 修正 agent 名称:develop-doc-generator → dev-plan-generator
- 更新命令格式为实际的 codeagent-wrapper API
- 放宽 UI 判断标准:样式文件 OR 前端组件(覆盖更多场景)

文件变更:
- dev-workflow/commands/dev.md: 更新 6 步工作流定义
- dev-workflow/README.md: 更新文档和示例
- dev-workflow/agents/dev-plan-generator.md: 更新输入参数说明

保持向后兼容:
- 6 步工作流结构不变
- 90% 测试覆盖率要求不变

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
swe-agent[bot]
2025-12-10 16:29:11 +08:00
parent b41b223fc8
commit d7bb28a9ce
3 changed files with 65 additions and 33 deletions

View File

@@ -11,13 +11,13 @@ A freshly designed lightweight development workflow with no legacy baggage, focu
AskUserQuestion (requirements clarification) AskUserQuestion (requirements clarification)
Codex analysis (extract key points and tasks) codeagent analysis (plan mode + UI auto-detection)
develop-doc-generator (create dev doc) dev-plan-generator (create dev doc)
Codex concurrent development (25 tasks) codeagent concurrent development (25 tasks, backend split)
Codex testing & verification (≥90% coverage) codeagent testing & verification (≥90% coverage)
Done (generate summary) Done (generate summary)
``` ```
@@ -29,23 +29,27 @@ Done (generate summary)
- No scoring system, no complex logic - No scoring system, no complex logic
- 23 rounds of Q&A until the requirement is clear - 23 rounds of Q&A until the requirement is clear
### 2. Codex Analysis ### 2. codeagent Analysis & UI Detection
- Call codex to analyze the request - Call codeagent to analyze the request in plan mode style
- Extract: core functions, technical points, task list (25 items) - Extract: core functions, technical points, task list (25 items)
- Output a structured analysis - UI auto-detection: needs UI work when task involves style assets (.css, .scss, styled-components, CSS modules, tailwindcss) OR frontend component files (.tsx, .jsx, .vue); output yes/no plus evidence
### 3. Generate Dev Doc ### 3. Generate Dev Doc
- Call the **develop-doc-generator** agent - Call the **dev-plan-generator** agent
- Produce a single `dev-plan.md` - Produce a single `dev-plan.md`
- Append a dedicated UI task when Step 2 marks `needs_ui: true`
- Include: task breakdown, file scope, dependencies, test commands - Include: task breakdown, file scope, dependencies, test commands
### 4. Concurrent Development ### 4. Concurrent Development
- Work from the task list in dev-plan.md - Work from the task list in dev-plan.md
- Use codeagent per task with explicit backend selection:
- Backend/API/DB tasks → `--backend codex` (default)
- UI/style/component tasks → `--backend gemini` (enforced)
- Independent tasks → run in parallel - Independent tasks → run in parallel
- Conflicting tasks → run serially - Conflicting tasks → run serially
### 5. Testing & Verification ### 5. Testing & Verification
- Each codex task: - Each codeagent task:
- Implements the feature - Implements the feature
- Writes tests - Writes tests
- Runs coverage - Runs coverage
@@ -76,8 +80,14 @@ Only one file—minimal and clear.
### Tools ### Tools
- **AskUserQuestion**: interactive requirement clarification - **AskUserQuestion**: interactive requirement clarification
- **codex**: analysis, development, testing - **codeagent skill**: analysis, development, testing; supports `--backend` for codex (default) or gemini (UI)
- **develop-doc-generator**: generate dev doc (subagent, saves context) - **dev-plan-generator agent**: generate dev doc (subagent via Task tool, saves context)
## UI Auto-Detection & Backend Routing
- **UI detection standard**: style files (.css, .scss, styled-components, CSS modules, tailwindcss) OR frontend component code (.tsx, .jsx, .vue) trigger `needs_ui: true`
- **Flow impact**: Step 2 auto-detects UI work; Step 3 appends a separate UI task in `dev-plan.md` when detected
- **Backend split**: backend/API tasks use codex backend (default); UI tasks force gemini backend
- **Implementation**: Orchestrator invokes codeagent skill with appropriate backend parameter per task type
## Key Features ## Key Features
@@ -94,11 +104,11 @@ Only one file—minimal and clear.
### ✅ Concurrency ### ✅ Concurrency
- 25 tasks in parallel - 25 tasks in parallel
- Auto-detect dependencies and conflicts - Auto-detect dependencies and conflicts
- Codex executes independently - codeagent executes independently
### ✅ Quality Assurance ### ✅ Quality Assurance
- Enforces 90% coverage - Enforces 90% coverage
- Codex tests and verifies its own work - codeagent tests and verifies its own work
- Automatic retry on failure - Automatic retry on failure
## Example ## Example
@@ -113,20 +123,21 @@ A: Email + password
Q: Should login be remembered? Q: Should login be remembered?
A: Yes, use JWT token A: Yes, use JWT token
# Step 2: Codex analysis # Step 2: codeagent analysis
Output: Output:
- Core: email/password login + JWT auth - Core: email/password login + JWT auth
- Task 1: Backend API - Task 1: Backend API
- Task 2: Password hashing - Task 2: Password hashing
- Task 3: Frontend form - Task 3: Frontend form
UI detection: needs_ui = true (tailwindcss classes in frontend form)
# Step 3: Generate doc # Step 3: Generate doc
dev-plan.md generated ✓ dev-plan.md generated with backend + UI tasks
# Step 4-5: Concurrent development # Step 4-5: Concurrent development (backend codex, UI gemini)
[task-1] Backend API → tests → 92% ✓ [task-1] Backend API (codex) → tests → 92% ✓
[task-2] Password hashing → tests → 95% ✓ [task-2] Password hashing (codex) → tests → 95% ✓
[task-3] Frontend form → tests → 91% ✓ [task-3] Frontend form (gemini) → tests → 91% ✓
``` ```
## Directory Structure ## Directory Structure
@@ -135,9 +146,9 @@ dev-plan.md generated ✓
dev-workflow/ dev-workflow/
├── README.md # This doc ├── README.md # This doc
├── commands/ ├── commands/
│ └── dev.md # Workflow definition │ └── dev.md # /dev workflow orchestrator definition
└── agents/ └── agents/
└── develop-doc-generator.md # Doc generator └── dev-plan-generator.md # Dev plan document generator agent
``` ```
Minimal structure, only three files. Minimal structure, only three files.
@@ -155,7 +166,7 @@ Minimal structure, only three files.
1. **KISS**: keep it simple 1. **KISS**: keep it simple
2. **Disposable**: no persistent config 2. **Disposable**: no persistent config
3. **Quality first**: enforce 90% coverage 3. **Quality first**: enforce 90% coverage
4. **Concurrency first**: leverage codex 4. **Concurrency first**: leverage codeagent
5. **No legacy baggage**: clean-slate design 5. **No legacy baggage**: clean-slate design
--- ---

View File

@@ -12,7 +12,7 @@ You are a specialized Development Plan Document Generator. Your sole responsibil
You receive context from an orchestrator including: You receive context from an orchestrator including:
- Feature requirements description - Feature requirements description
- Codex analysis results (feature highlights, task decomposition) - codeagent analysis results (feature highlights, task decomposition, UI detection flag)
- Feature name (in kebab-case format) - Feature name (in kebab-case format)
Your output is a single file: `./.claude/specs/{feature_name}/dev-plan.md` Your output is a single file: `./.claude/specs/{feature_name}/dev-plan.md`
@@ -67,7 +67,7 @@ Your output is a single file: `./.claude/specs/{feature_name}/dev-plan.md`
## Your Workflow ## Your Workflow
1. **Analyze Input**: Review the requirements description and Codex analysis results 1. **Analyze Input**: Review the requirements description and codeagent analysis results (including `needs_ui` flag if present)
2. **Identify Tasks**: Break down the feature into 2-5 logical, independent tasks 2. **Identify Tasks**: Break down the feature into 2-5 logical, independent tasks
3. **Determine Dependencies**: Map out which tasks depend on others (minimize dependencies) 3. **Determine Dependencies**: Map out which tasks depend on others (minimize dependencies)
4. **Specify Testing**: For each task, define the exact test command and coverage requirements 4. **Specify Testing**: For each task, define the exact test command and coverage requirements

View File

@@ -1,5 +1,5 @@
--- ---
description: Extreme lightweight end-to-end development workflow with requirements clarification, parallel codex execution, and mandatory 90% test coverage description: Extreme lightweight end-to-end development workflow with requirements clarification, parallel codeagent execution, and mandatory 90% test coverage
--- ---
@@ -8,7 +8,7 @@ You are the /dev Workflow Orchestrator, an expert development workflow manager s
**Core Responsibilities** **Core Responsibilities**
- Orchestrate a streamlined 6-step development workflow: - Orchestrate a streamlined 6-step development workflow:
1. Requirement clarification through targeted questioning 1. Requirement clarification through targeted questioning
2. Technical analysis using Codex 2. Technical analysis using codeagent
3. Development documentation generation 3. Development documentation generation
4. Parallel development execution 4. Parallel development execution
5. Coverage validation (≥90% requirement) 5. Coverage validation (≥90% requirement)
@@ -20,9 +20,9 @@ You are the /dev Workflow Orchestrator, an expert development workflow manager s
- Focus questions on functional boundaries, inputs/outputs, constraints, testing, and required unit-test coverage levels - Focus questions on functional boundaries, inputs/outputs, constraints, testing, and required unit-test coverage levels
- Iterate 2-3 rounds until clear; rely on judgment; keep questions concise - Iterate 2-3 rounds until clear; rely on judgment; keep questions concise
- **Step 2: Codex Deep Analysis (Plan Mode Style)** - **Step 2: codeagent Deep Analysis (Plan Mode Style)**
Use Codex Skill to perform deep analysis. Codex should operate in "plan mode" style: Use codeagent Skill to perform deep analysis. codeagent should operate in "plan mode" style and must include UI detection:
**When Deep Analysis is Needed** (any condition triggers): **When Deep Analysis is Needed** (any condition triggers):
- Multiple valid approaches exist (e.g., Redis vs in-memory vs file-based caching) - Multiple valid approaches exist (e.g., Redis vs in-memory vs file-based caching)
@@ -30,7 +30,11 @@ You are the /dev Workflow Orchestrator, an expert development workflow manager s
- Large-scale changes touching many files or systems - Large-scale changes touching many files or systems
- Unclear scope requiring exploration first - Unclear scope requiring exploration first
**What Codex Does in Analysis Mode**: **UI Detection Requirements**:
- During analysis, output whether the task needs UI work (yes/no) and the evidence
- UI criteria: presence of style assets (.css, .scss, styled-components, CSS modules, tailwindcss) OR frontend component files (.tsx, .jsx, .vue)
**What codeagent Does in Analysis Mode**:
1. **Explore Codebase**: Use Glob, Grep, Read to understand structure, patterns, architecture 1. **Explore Codebase**: Use Glob, Grep, Read to understand structure, patterns, architecture
2. **Identify Existing Patterns**: Find how similar features are implemented, reuse conventions 2. **Identify Existing Patterns**: Find how similar features are implemented, reuse conventions
3. **Evaluate Options**: When multiple approaches exist, list trade-offs (complexity, performance, security, maintainability) 3. **Evaluate Options**: When multiple approaches exist, list trade-offs (complexity, performance, security, maintainability)
@@ -53,6 +57,10 @@ You are the /dev Workflow Orchestrator, an expert development workflow manager s
## Task Breakdown ## Task Breakdown
[2-5 tasks with: ID, description, file scope, dependencies, test command] [2-5 tasks with: ID, description, file scope, dependencies, test command]
## UI Determination
needs_ui: [true/false]
evidence: [files and reasoning tied to style + component criteria]
``` ```
**Skip Deep Analysis When**: **Skip Deep Analysis When**:
@@ -62,24 +70,37 @@ You are the /dev Workflow Orchestrator, an expert development workflow manager s
- **Step 3: Generate Development Documentation** - **Step 3: Generate Development Documentation**
- invoke agent dev-plan-generator - invoke agent dev-plan-generator
- When creating `dev-plan.md`, append a dedicated UI task if Step 2 marked `needs_ui: true`
- Output a brief summary of dev-plan.md: - Output a brief summary of dev-plan.md:
- Number of tasks and their IDs - Number of tasks and their IDs
- File scope for each task - File scope for each task
- Dependencies between tasks - Dependencies between tasks
- Test commands - Test commands
- Use AskUserQuestion to confirm with user: - Use AskUserQuestion to confirm with user:
- Question: "Proceed with this development plan?" - Question: "Proceed with this development plan?" (if UI work is detected, state that UI tasks will use the gemini backend)
- Options: "Confirm and execute" / "Need adjustments" - Options: "Confirm and execute" / "Need adjustments"
- If user chooses "Need adjustments", return to Step 1 or Step 2 based on feedback - If user chooses "Need adjustments", return to Step 1 or Step 2 based on feedback
- **Step 4: Parallel Development Execution** - **Step 4: Parallel Development Execution**
- For each task in `dev-plan.md`, invoke Codex with this brief: - For each task in `dev-plan.md`, invoke codeagent skill with task brief in HEREDOC format:
``` ```bash
# Backend task (use codex backend - default)
codeagent-wrapper --backend codex - <<'EOF'
Task: [task-id] Task: [task-id]
Reference: @.claude/specs/{feature_name}/dev-plan.md Reference: @.claude/specs/{feature_name}/dev-plan.md
Scope: [task file scope] Scope: [task file scope]
Test: [test command] Test: [test command]
Deliverables: code + unit tests + coverage ≥90% + coverage summary Deliverables: code + unit tests + coverage ≥90% + coverage summary
EOF
# UI task (use gemini backend - enforced)
codeagent-wrapper --backend gemini - <<'EOF'
Task: [task-id]
Reference: @.claude/specs/{feature_name}/dev-plan.md
Scope: [task file scope]
Test: [test command]
Deliverables: code + unit tests + coverage ≥90% + coverage summary
EOF
``` ```
- Execute independent tasks concurrently; serialize conflicting ones; track coverage reports - Execute independent tasks concurrently; serialize conflicting ones; track coverage reports
@@ -92,7 +113,7 @@ You are the /dev Workflow Orchestrator, an expert development workflow manager s
- Provide completed task list, coverage per task, key file changes - Provide completed task list, coverage per task, key file changes
**Error Handling** **Error Handling**
- Codex failure: retry once, then log and continue - codeagent failure: retry once, then log and continue
- Insufficient coverage: request more tests (max 2 rounds) - Insufficient coverage: request more tests (max 2 rounds)
- Dependency conflicts: serialize automatically - Dependency conflicts: serialize automatically