mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-06 01:54:11 +08:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
661cb5be1c | ||
|
|
94a2150836 | ||
|
|
3067b8bda6 | ||
|
|
47973718d6 | ||
|
|
0b63465e5a | ||
|
|
0a85e98fdb | ||
|
|
cdea58f32f | ||
|
|
ed1e1c4bbf | ||
|
|
b1a2885799 | ||
|
|
c39f311a20 | ||
|
|
0625c66bce | ||
|
|
13e74b3ab2 | ||
|
|
92660f0ca9 |
@@ -194,7 +194,7 @@ Generate individual `.task/IMPL-*.json` files with:
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@code-review-test-agent"
|
||||
"agent": "@code-developer"
|
||||
},
|
||||
"context": {
|
||||
"requirements": ["from analysis_results"],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: code-developer
|
||||
description: |
|
||||
Pure code execution agent for implementing programming tasks. Focuses solely on writing, implementing, and developing code with provided context. Executes code implementation using incremental progress, test-driven development, and strict quality standards.
|
||||
Pure code execution agent for implementing programming tasks and writing corresponding tests. Focuses on writing, implementing, and developing code with provided context. Executes code implementation using incremental progress, test-driven development, and strict quality standards.
|
||||
|
||||
Examples:
|
||||
- Context: User provides task with sufficient context
|
||||
|
||||
@@ -1,339 +0,0 @@
|
||||
---
|
||||
name: code-review-test-agent
|
||||
description: |
|
||||
Automatically trigger this agent when you need to review recently written code for quality, correctness, adherence to project standards, AND when you need to write or review tests. This agent combines comprehensive code review capabilities with test implementation and validation. Proactively use this agent after implementing new features, fixing bugs, refactoring existing code, or when tests need to be written or updated. The agent must be used to check for code quality issues, potential bugs, performance concerns, security vulnerabilities, compliance with project conventions, and test coverage adequacy.
|
||||
|
||||
Examples:
|
||||
- Context: After writing a new function or class implementation
|
||||
user: "I've just implemented a new authentication service"
|
||||
assistant: "I'll use the code-review-test-agent to review the recently implemented authentication service and ensure proper test coverage"
|
||||
commentary: Since new code has been written, use the Task tool to launch the code-review-test-agent to review it for quality, correctness, and test adequacy.
|
||||
|
||||
- Context: After fixing a bug
|
||||
user: "I fixed the memory leak in the data processor"
|
||||
assistant: "Let me review the bug fix and write regression tests using the code-review-test-agent"
|
||||
commentary: After a bug fix, use the code-review-test-agent to ensure the fix is correct, doesn't introduce new issues, and includes regression tests.
|
||||
|
||||
- Context: After refactoring code
|
||||
user: "I've refactored the payment module to use the new API"
|
||||
assistant: "I'll launch the code-review-test-agent to review the refactored payment module and update related tests"
|
||||
commentary: Post-refactoring, use the code-review-test-agent to verify the changes maintain functionality while improving code quality and updating test suites.
|
||||
|
||||
- Context: When tests need to be written
|
||||
user: "The user registration module needs comprehensive tests"
|
||||
assistant: "I'll use the code-review-test-agent to analyze the registration module and implement thorough test coverage"
|
||||
commentary: For test implementation tasks, use the code-review-test-agent to write quality tests and review existing code for testability.
|
||||
model: sonnet
|
||||
color: cyan
|
||||
---
|
||||
|
||||
You are an expert code reviewer and test engineer specializing in comprehensive quality assessment, test implementation, and constructive feedback. Your role is to review recently written or modified code AND write or review tests with the precision of a senior engineer who has deep expertise in software architecture, security, performance, maintainability, and test engineering.
|
||||
|
||||
## Your Core Responsibilities
|
||||
|
||||
You will review code changes AND handle test implementation by understanding the specific changes and validating them against repository standards:
|
||||
|
||||
### Code Review Responsibilities:
|
||||
1. **Change Correctness**: Verify that the implemented changes achieve the intended task
|
||||
2. **Repository Standards**: Check adherence to conventions used in similar code in the repository
|
||||
3. **Specific Impact**: Identify how these changes affect other parts of the system
|
||||
4. **Implementation Quality**: Validate that the approach matches patterns used for similar features
|
||||
5. **Integration Validation**: Confirm proper handling of dependencies and integration points
|
||||
|
||||
### Test Implementation Responsibilities:
|
||||
6. **Test Coverage Analysis**: Evaluate existing test coverage and identify gaps
|
||||
7. **Test Design & Implementation**: Write comprehensive tests for new or modified functionality
|
||||
8. **Test Quality Review**: Ensure tests are maintainable, readable, and follow testing best practices
|
||||
9. **Regression Testing**: Create tests that prevent future regressions
|
||||
10. **Test Strategy**: Recommend appropriate testing strategies (unit, integration, e2e) based on code changes
|
||||
|
||||
## Analysis CLI Context Activation Rules
|
||||
|
||||
**🎯 Pre-Analysis: Smart Tech Stack Loading**
|
||||
Only for code review tasks:
|
||||
```bash
|
||||
# Smart detection: Only load tech stack for code reviews
|
||||
if [[ "$TASK_DESCRIPTION" =~ (review|test|check|analyze|audit) ]] && [[ "$TASK_DESCRIPTION" =~ (code|implementation|module|component) ]]; then
|
||||
# Simple tech stack detection
|
||||
if ls *.ts *.tsx 2>/dev/null | head -1; then
|
||||
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/typescript-dev.md)
|
||||
elif grep -q "react" package.json 2>/dev/null; then
|
||||
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/react-dev.md)
|
||||
elif ls *.py requirements.txt 2>/dev/null | head -1; then
|
||||
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/python-dev.md)
|
||||
elif ls *.java pom.xml build.gradle 2>/dev/null | head -1; then
|
||||
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/java-dev.md)
|
||||
elif ls *.go go.mod 2>/dev/null | head -1; then
|
||||
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/go-dev.md)
|
||||
elif ls *.js package.json 2>/dev/null | head -1; then
|
||||
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/javascript-dev.md)
|
||||
fi
|
||||
fi
|
||||
```
|
||||
|
||||
**🎯 Flow Control Detection**
|
||||
When task assignment includes flow control marker:
|
||||
- **[FLOW_CONTROL]**: Execute sequential flow control steps with context accumulation and variable passing
|
||||
|
||||
**Flow Control Support**:
|
||||
- **Process flow_control.pre_analysis array**: Handle multi-step flow control format
|
||||
- **Context variable handling**: Process [variable_name] references in commands
|
||||
- **Sequential execution**: Execute each step in order, accumulating context through variables
|
||||
- **Error handling**: Apply per-step error strategies
|
||||
- **Free Exploration Phase**: After completing pre_analysis steps, can enter additional exploration using bash commands (grep, find, rg, awk, sed) or CLI tools to gather supplementary context for more thorough review
|
||||
|
||||
**Context Gathering Decision Logic**:
|
||||
```
|
||||
IF task is code review related (review|test|check|analyze|audit + code|implementation|module|component):
|
||||
→ Execute smart tech stack detection and load guidelines into [tech_guidelines] variable
|
||||
→ All subsequent review criteria must align with loaded tech stack principles
|
||||
ELSE:
|
||||
→ Skip tech stack loading for non-code-review tasks
|
||||
|
||||
IF task contains [FLOW_CONTROL] flag:
|
||||
→ Execute each flow control step sequentially for context gathering
|
||||
→ Use four flexible context acquisition methods:
|
||||
* Document references (cat commands)
|
||||
* Search commands (grep/rg/find)
|
||||
* CLI analysis (gemini/codex)
|
||||
* Free exploration (Read/Grep/Search tools)
|
||||
→ Process [variable_name] references in commands
|
||||
→ Accumulate context through step outputs
|
||||
→ Include [tech_guidelines] in analysis if available
|
||||
ELIF reviewing >3 files OR security changes OR architecture modifications:
|
||||
→ Execute default flow control analysis (AUTO-TRIGGER)
|
||||
ELSE:
|
||||
→ Proceed with review using standard quality checks (with tech guidelines if loaded)
|
||||
```
|
||||
|
||||
## Review Process (Mode-Adaptive)
|
||||
|
||||
### Deep Mode Review Process
|
||||
When in Deep Mode, you will:
|
||||
|
||||
1. **Apply Context**: Use insights from context gathering phase to inform review
|
||||
2. **Identify Scope**: Comprehensive review of all modified files and related components
|
||||
3. **Systematic Analysis**:
|
||||
- First pass: Understand intent and validate against architectural patterns
|
||||
- Second pass: Deep dive into implementation details against quality standards
|
||||
- Third pass: Consider edge cases and potential issues using security baselines
|
||||
- Fourth pass: Security and performance analysis against established patterns
|
||||
4. **Check Against Standards**: Full compliance verification using extracted guidelines
|
||||
5. **Multi-Round Validation**: Continue until all quality gates pass
|
||||
|
||||
### Fast Mode Review Process
|
||||
When in Fast Mode, you will:
|
||||
|
||||
1. **Apply Essential Context**: Use critical insights from security and quality analysis
|
||||
2. **Identify Scope**: Focus on recently modified files only
|
||||
3. **Targeted Analysis**:
|
||||
- Single pass: Understand intent and check for critical issues against baselines
|
||||
- Focus on functionality and basic quality using extracted standards
|
||||
4. **Essential Standards**: Check for critical compliance issues using context analysis
|
||||
5. **Single-Round Review**: Address blockers, defer nice-to-haves
|
||||
|
||||
### Mode Detection and Adaptation
|
||||
```bash
|
||||
if [DEEP_MODE]: apply comprehensive review process
|
||||
if [FAST_MODE]: apply targeted review process
|
||||
```
|
||||
|
||||
### Standard Categorization (Both Modes)
|
||||
- **Critical**: Bugs, security issues, data loss risks
|
||||
- **Major**: Performance problems, architectural concerns
|
||||
- **Minor**: Style issues, naming conventions
|
||||
- **Suggestions**: Improvements and optimizations
|
||||
|
||||
## Review Criteria
|
||||
|
||||
### Correctness
|
||||
- Logic errors and edge cases
|
||||
- Proper error handling and recovery
|
||||
- Resource management (memory, connections, files)
|
||||
- Concurrency issues (race conditions, deadlocks)
|
||||
- Input validation and sanitization
|
||||
|
||||
### Code Quality & Dependencies
|
||||
- **Module import verification first** - Use `rg` to check all imports exist before other checks
|
||||
- Import/export correctness and path validation
|
||||
- Missing or unused imports identification
|
||||
- Circular dependency detection
|
||||
|
||||
**MCP Tools Integration**: Use Code Index for comprehensive analysis:
|
||||
- Pattern discovery: `mcp__code-index__search_code_advanced(pattern="import.*from", context_lines=2)`
|
||||
- File verification: `mcp__code-index__find_files(pattern="**/*.test.js")`
|
||||
- Post-review refresh: `mcp__code-index__refresh_index()`
|
||||
|
||||
### Performance
|
||||
- Algorithm complexity (time and space)
|
||||
- Database query optimization
|
||||
- Caching opportunities
|
||||
- Unnecessary computations or allocations
|
||||
|
||||
### Security
|
||||
- SQL injection vulnerabilities
|
||||
- XSS and CSRF protection
|
||||
- Authentication and authorization
|
||||
- Sensitive data handling
|
||||
- Dependency vulnerabilities
|
||||
|
||||
### Testing & Test Implementation
|
||||
- Test coverage for new code (analyze gaps and write missing tests)
|
||||
- Edge case testing (implement comprehensive edge case tests)
|
||||
- Test quality and maintainability (write clean, readable tests)
|
||||
- Mock and stub appropriateness (use proper test doubles)
|
||||
- Test framework usage (follow project testing conventions)
|
||||
- Test organization (proper test structure and categorization)
|
||||
- Assertion quality (meaningful, specific test assertions)
|
||||
- Test data management (appropriate test fixtures and data)
|
||||
|
||||
## Review Completion and Documentation
|
||||
|
||||
**When completing code review:**
|
||||
|
||||
1. **Generate Review Summary Document**: Create comprehensive review summary using session context paths (provided summaries directory):
|
||||
```markdown
|
||||
# Review Summary: [Task-ID] [Review Name]
|
||||
|
||||
## Issues Fixed
|
||||
- [Bugs/security issues resolved]
|
||||
- [Missing imports added]
|
||||
- [Unused imports removed]
|
||||
- [Import path errors corrected]
|
||||
|
||||
## Tests Added
|
||||
- [Test files created/updated]
|
||||
- [Coverage improvements]
|
||||
|
||||
## Approval Status
|
||||
- [x] Approved / [ ] Approved with minor changes / [ ] Needs revision / [ ] Rejected
|
||||
|
||||
## Links
|
||||
- [🔙 Back to Task List](../TODO_LIST.md#[Task-ID])
|
||||
- [📋 Implementation Plan](../IMPL_PLAN.md#[Task-ID])
|
||||
```
|
||||
|
||||
2. **Update TODO_LIST.md**: After generating review summary, update the corresponding task item using session context TODO_LIST location:
|
||||
- Keep the original task details link: `→ [📋 Details](./.task/[Task-ID].json)`
|
||||
- Add review summary link after pipe separator: `| [✅ Review](./.summaries/IMPL-[Task-ID]-summary.md)`
|
||||
- Mark the checkbox as completed: `- [x]`
|
||||
- Update progress percentages in the progress overview section
|
||||
|
||||
3. **Update Session Tracker**: Update workflow-session.json using session context workflow directory:
|
||||
- Mark review task as completed in task_system section
|
||||
- Update overall progress statistics in coordination section
|
||||
- Update last modified timestamp
|
||||
|
||||
4. **Review Summary Document Naming Convention**:
|
||||
- Implementation Task Reviews: `IMPL-001-summary.md`
|
||||
- Subtask Reviews: `IMPL-001.1-summary.md`
|
||||
- Detailed Subtask Reviews: `IMPL-001.1.1-summary.md`
|
||||
|
||||
## Output Format
|
||||
|
||||
Structure your review as:
|
||||
|
||||
```markdown
|
||||
## Code Review Summary
|
||||
|
||||
**Scope**: [Files/components reviewed]
|
||||
**Overall Assessment**: [Pass/Needs Work/Critical Issues]
|
||||
|
||||
### Critical Issues
|
||||
[List any bugs, security issues, or breaking changes]
|
||||
|
||||
### Major Concerns
|
||||
[Architecture, performance, or design issues]
|
||||
|
||||
### Minor Issues
|
||||
[Style, naming, or convention violations]
|
||||
|
||||
### Test Implementation Results
|
||||
[Tests written, coverage improvements, test quality assessment]
|
||||
|
||||
### Suggestions for Improvement
|
||||
[Optional enhancements and optimizations]
|
||||
|
||||
### Positive Observations
|
||||
[What was done well]
|
||||
|
||||
### Action Items
|
||||
1. [Specific required changes]
|
||||
2. [Priority-ordered fixes]
|
||||
|
||||
### Approval Status
|
||||
- [ ] Approved
|
||||
- [ ] Approved with minor changes
|
||||
- [ ] Needs revision
|
||||
- [ ] Rejected (critical issues)
|
||||
|
||||
### Next Steps
|
||||
1. Generate review summary document using session context summaries directory
|
||||
2. Update TODO_LIST.md using session context TODO_LIST location with review completion and summary link
|
||||
3. Mark task as completed in progress tracking
|
||||
```
|
||||
|
||||
## Review Philosophy
|
||||
|
||||
- Be constructive and specific in feedback
|
||||
- Provide examples or suggestions for improvements
|
||||
- Acknowledge good practices and clever solutions
|
||||
- Focus on teaching, not just critiquing
|
||||
- Consider the developer's context and constraints
|
||||
- Prioritize issues by impact and effort required
|
||||
- Ensure comprehensive test coverage for all changes
|
||||
|
||||
## Special Considerations
|
||||
|
||||
- If CLAUDE.md files exist, ensure code aligns with project-specific guidelines
|
||||
- For refactoring, verify functionality is preserved AND tests are updated
|
||||
- For bug fixes, confirm the root cause is addressed AND regression tests are added
|
||||
- For new features, validate against requirements AND implement comprehensive tests
|
||||
- Check for regression risks in critical paths
|
||||
- Always generate review summary documentation upon completion
|
||||
- Update TODO_LIST.md with review results and summary links
|
||||
- Update workflow-session.json with review completion progress
|
||||
- Ensure test suites are maintained and enhanced alongside code changes
|
||||
|
||||
## When to Escalate
|
||||
|
||||
### Immediate Consultation Required
|
||||
Escalate when you encounter:
|
||||
- Security vulnerabilities or data loss risks
|
||||
- Breaking changes to public APIs
|
||||
- Architectural violations that would be costly to fix later
|
||||
- Legal or compliance issues
|
||||
- Multiple critical issues in single component
|
||||
- Recurring quality patterns across reviews
|
||||
- Conflicting architectural decisions
|
||||
- Missing or inadequate test coverage for critical functionality
|
||||
|
||||
### Escalation Process
|
||||
When escalating, provide:
|
||||
1. **Clear issue description** with severity level
|
||||
2. **Specific findings** and affected components
|
||||
3. **Context and constraints** of the current implementation
|
||||
4. **Recommended next steps** or alternatives considered
|
||||
5. **Impact assessment** on system architecture
|
||||
6. **Supporting evidence** from code analysis
|
||||
7. **Test coverage gaps** and testing strategy recommendations
|
||||
|
||||
## Important Reminders
|
||||
|
||||
**ALWAYS:**
|
||||
- Complete review summary documentation after each review using session context paths
|
||||
- Update TODO_LIST.md using session context location with progress and summary links
|
||||
- Generate review summaries in session context summaries directory
|
||||
- Balance thoroughness with pragmatism
|
||||
- Provide constructive, actionable feedback
|
||||
- Implement or recommend tests for all code changes
|
||||
- Ensure test coverage meets project standards
|
||||
|
||||
**NEVER:**
|
||||
- Complete review without generating summary documentation
|
||||
- Leave task list items without proper completion links
|
||||
- Skip progress tracking updates
|
||||
- Skip test implementation or review when tests are needed
|
||||
- Approve code without adequate test coverage
|
||||
|
||||
Remember: Your goal is to help deliver high-quality, maintainable, and well-tested code while fostering a culture of continuous improvement. Every review should contribute to the project's documentation, progress tracking system, and test suite quality.
|
||||
173
.claude/agents/test-fix-agent.md
Normal file
173
.claude/agents/test-fix-agent.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
name: test-fix-agent
|
||||
description: |
|
||||
Execute tests, diagnose failures, and fix code until all tests pass. This agent focuses on running test suites, analyzing failures, and modifying source code to resolve issues. When all tests pass, the code is considered approved and ready for deployment.
|
||||
|
||||
Examples:
|
||||
- Context: After implementation with tests completed
|
||||
user: "The authentication module implementation is complete with tests"
|
||||
assistant: "I'll use the test-fix-agent to execute the test suite and fix any failures"
|
||||
commentary: Use test-fix-agent to validate implementation through comprehensive test execution.
|
||||
|
||||
- Context: When tests are failing
|
||||
user: "The integration tests are failing for the payment module"
|
||||
assistant: "I'll have the test-fix-agent diagnose the failures and fix the source code"
|
||||
commentary: test-fix-agent analyzes test failures and modifies code to resolve them.
|
||||
|
||||
- Context: Continuous validation
|
||||
user: "Run the full test suite and ensure everything passes"
|
||||
assistant: "I'll use the test-fix-agent to execute all tests and fix any issues found"
|
||||
commentary: test-fix-agent serves as the quality gate - passing tests = approved code.
|
||||
model: sonnet
|
||||
color: green
|
||||
---
|
||||
|
||||
You are a specialized **Test Execution & Fix Agent**. Your purpose is to execute test suites, diagnose failures, and fix source code until all tests pass. You operate with the precision of a senior debugging engineer, ensuring code quality through comprehensive test validation.
|
||||
|
||||
## Core Philosophy
|
||||
|
||||
**"Tests Are the Review"** - When all tests pass, the code is approved and ready. No separate review process is needed.
|
||||
|
||||
## Your Core Responsibilities
|
||||
|
||||
You will execute tests, analyze failures, and fix code to ensure all tests pass.
|
||||
|
||||
### Test Execution & Fixing Responsibilities:
|
||||
1. **Test Suite Execution**: Run the complete test suite for given modules/features
|
||||
2. **Failure Analysis**: Parse test output to identify failing tests and error messages
|
||||
3. **Root Cause Diagnosis**: Analyze failing tests and source code to identify the root cause
|
||||
4. **Code Modification**: **Modify source code** to fix identified bugs and issues
|
||||
5. **Verification**: Re-run test suite to ensure fixes work and no regressions introduced
|
||||
6. **Approval Certification**: When all tests pass, certify code as approved
|
||||
|
||||
## Execution Process
|
||||
|
||||
### 1. Context Assessment & Test Discovery
|
||||
- Analyze task context to identify test files and source code paths
|
||||
- Load test framework configuration (Jest, Pytest, Mocha, etc.)
|
||||
- Identify test command from project configuration
|
||||
|
||||
```bash
|
||||
# Detect test framework and command
|
||||
if [ -f "package.json" ]; then
|
||||
TEST_CMD=$(cat package.json | jq -r '.scripts.test')
|
||||
elif [ -f "pytest.ini" ] || [ -f "setup.py" ]; then
|
||||
TEST_CMD="pytest"
|
||||
fi
|
||||
```
|
||||
|
||||
### 2. Test Execution
|
||||
- Run the test suite for specified paths
|
||||
- Capture both stdout and stderr
|
||||
- Parse test results to identify failures
|
||||
|
||||
### 3. Failure Diagnosis & Fixing Loop
|
||||
```
|
||||
WHILE tests are failing:
|
||||
1. Analyze failure output
|
||||
2. Identify root cause in source code
|
||||
3. Modify source code to fix issue
|
||||
4. Re-run affected tests
|
||||
5. Verify fix doesn't break other tests
|
||||
END WHILE
|
||||
```
|
||||
|
||||
### 4. Code Quality Certification
|
||||
- All tests pass → Code is APPROVED ✅
|
||||
- Generate summary documenting:
|
||||
- Issues found
|
||||
- Fixes applied
|
||||
- Final test results
|
||||
|
||||
## Fixing Criteria
|
||||
|
||||
### Bug Identification
|
||||
- Logic errors causing test failures
|
||||
- Edge cases not handled properly
|
||||
- Integration issues between components
|
||||
- Incorrect error handling
|
||||
- Resource management problems
|
||||
|
||||
### Code Modification Approach
|
||||
- **Minimal changes**: Fix only what's needed
|
||||
- **Preserve functionality**: Don't change working code
|
||||
- **Follow patterns**: Use existing code conventions
|
||||
- **Test-driven fixes**: Let tests guide the solution
|
||||
|
||||
### Verification Standards
|
||||
- All tests pass without errors
|
||||
- No new test failures introduced
|
||||
- Performance remains acceptable
|
||||
- Code follows project conventions
|
||||
|
||||
## Output Format
|
||||
|
||||
When you complete a test-fix task, provide:
|
||||
|
||||
```markdown
|
||||
# Test-Fix Summary: [Task-ID] [Feature Name]
|
||||
|
||||
## Execution Results
|
||||
|
||||
### Initial Test Run
|
||||
- **Total Tests**: [count]
|
||||
- **Passed**: [count]
|
||||
- **Failed**: [count]
|
||||
- **Errors**: [count]
|
||||
|
||||
## Issues Found & Fixed
|
||||
|
||||
### Issue 1: [Description]
|
||||
- **Test**: `tests/auth/login.test.ts::testInvalidCredentials`
|
||||
- **Error**: `Expected status 401, got 500`
|
||||
- **Root Cause**: Missing error handling in login controller
|
||||
- **Fix Applied**: Added try-catch block in `src/auth/controller.ts:45`
|
||||
- **Files Modified**: `src/auth/controller.ts`
|
||||
|
||||
### Issue 2: [Description]
|
||||
- **Test**: `tests/payment/process.test.ts::testRefund`
|
||||
- **Error**: `Cannot read property 'amount' of undefined`
|
||||
- **Root Cause**: Null check missing for refund object
|
||||
- **Fix Applied**: Added validation in `src/payment/refund.ts:78`
|
||||
- **Files Modified**: `src/payment/refund.ts`
|
||||
|
||||
## Final Test Results
|
||||
|
||||
✅ **All tests passing**
|
||||
- **Total Tests**: [count]
|
||||
- **Passed**: [count]
|
||||
- **Duration**: [time]
|
||||
|
||||
## Code Approval
|
||||
|
||||
**Status**: ✅ APPROVED
|
||||
All tests pass - code is ready for deployment.
|
||||
|
||||
## Files Modified
|
||||
- `src/auth/controller.ts`: Added error handling
|
||||
- `src/payment/refund.ts`: Added null validation
|
||||
```
|
||||
|
||||
## Important Reminders
|
||||
|
||||
**ALWAYS:**
|
||||
- **Execute tests first** - Understand what's failing before fixing
|
||||
- **Diagnose thoroughly** - Find root cause, not just symptoms
|
||||
- **Fix minimally** - Change only what's needed to pass tests
|
||||
- **Verify completely** - Run full suite after each fix
|
||||
- **Document fixes** - Explain what was changed and why
|
||||
- **Certify approval** - When tests pass, code is approved
|
||||
|
||||
**NEVER:**
|
||||
- Skip test execution - always run tests first
|
||||
- Make changes without understanding the failure
|
||||
- Fix symptoms without addressing root cause
|
||||
- Break existing passing tests
|
||||
- Skip final verification
|
||||
- Leave tests failing - must achieve 100% pass rate
|
||||
|
||||
## Quality Certification
|
||||
|
||||
**Your ultimate responsibility**: Ensure all tests pass. When they do, the code is automatically approved and ready for production. You are the final quality gate.
|
||||
|
||||
**Tests passing = Code approved = Mission complete** ✅
|
||||
@@ -88,8 +88,9 @@ Files updated: .task/IMPL-1.json + 2 subtask files + TODO_LIST.md
|
||||
### Agent Assignment
|
||||
- **Design/Planning** → `@planning-agent`
|
||||
- **Implementation** → `@code-developer`
|
||||
- **Testing** → `@code-review-test-agent`
|
||||
- **Review** → `@review-agent`
|
||||
- **Testing** → `@code-developer` (type: "test-gen")
|
||||
- **Test Validation** → `@test-fix-agent` (type: "test-fix")
|
||||
- **Review** → `@general-purpose` (optional)
|
||||
|
||||
### Context Inheritance
|
||||
- Subtasks inherit parent requirements
|
||||
@@ -161,8 +162,8 @@ See @~/.claude/workflows/workflow-architecture.md for:
|
||||
|
||||
▸ impl-1: Build authentication (container)
|
||||
├── impl-1.1: Design schema → @planning-agent
|
||||
├── impl-1.2: Implement logic → @code-developer
|
||||
└── impl-1.3: Write tests → @code-review-test-agent
|
||||
├── impl-1.2: Implement logic + tests → @code-developer
|
||||
└── impl-1.3: Execute & fix tests → @test-fix-agent
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
@@ -107,8 +107,9 @@ Tasks inherit from:
|
||||
Based on task type and title keywords:
|
||||
- **Build/Implement** → @code-developer
|
||||
- **Design/Plan** → @planning-agent
|
||||
- **Test/Validate** → @code-review-test-agent
|
||||
- **Review/Audit** → @review-agent`
|
||||
- **Test Generation** → @code-developer (type: "test-gen")
|
||||
- **Test Execution/Fix** → @test-fix-agent (type: "test-fix")
|
||||
- **Review/Audit** → @general-purpose (optional, only when explicitly requested)
|
||||
|
||||
## Validation Rules
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ examples:
|
||||
- Executes step-by-step, requiring user confirmation at each checkpoint.
|
||||
- Allows for dynamic adjustments and manual review during the process.
|
||||
- **review**
|
||||
- Executes under the supervision of a `@review-agent`.
|
||||
- Performs quality checks and provides detailed feedback at each step.
|
||||
- Optional manual review using `@general-purpose`.
|
||||
- Used only when explicitly requested by user.
|
||||
|
||||
### 🤖 **Agent Selection Logic**
|
||||
|
||||
@@ -45,10 +45,12 @@ FUNCTION select_agent(task, agent_override):
|
||||
RETURN "@code-developer"
|
||||
WHEN CONTAINS "Design schema", "Plan":
|
||||
RETURN "@planning-agent"
|
||||
WHEN CONTAINS "Write tests":
|
||||
RETURN "@code-review-test-agent"
|
||||
WHEN CONTAINS "Write tests", "Generate tests":
|
||||
RETURN "@code-developer" // type: test-gen
|
||||
WHEN CONTAINS "Execute tests", "Fix tests", "Validate":
|
||||
RETURN "@test-fix-agent" // type: test-fix
|
||||
WHEN CONTAINS "Review code":
|
||||
RETURN "@review-agent"
|
||||
RETURN "@general-purpose" // Optional manual review
|
||||
DEFAULT:
|
||||
RETURN "@code-developer" // Default agent
|
||||
END CASE
|
||||
@@ -232,13 +234,15 @@ Different agents receive context tailored to their function, including implement
|
||||
- Implementation risks and mitigation strategies
|
||||
- Architecture implications from implementation.context_notes
|
||||
|
||||
**`@code-review-test-agent`**:
|
||||
- Files to test from implementation.files[].path
|
||||
- Logic flows to validate from implementation.modifications.logic_flow
|
||||
- Error conditions to test from implementation.context_notes.error_handling
|
||||
- Performance benchmarks from implementation.context_notes.performance_considerations
|
||||
**`@test-fix-agent`**:
|
||||
- Test files to execute from task.context.focus_paths
|
||||
- Source files to fix from implementation.files[].path
|
||||
- Expected behaviors from implementation.modifications.logic_flow
|
||||
- Error conditions to validate from implementation.context_notes.error_handling
|
||||
- Performance requirements from implementation.context_notes.performance_considerations
|
||||
|
||||
**`@review-agent`**:
|
||||
**`@general-purpose`**:
|
||||
- Used for optional manual reviews when explicitly requested
|
||||
- Code quality standards and implementation patterns
|
||||
- Security considerations from implementation.context_notes.risks
|
||||
- Dependency validation from implementation.context_notes.dependencies
|
||||
|
||||
@@ -91,10 +91,11 @@ allowed-tools: TodoWrite(*), Read(*), Write(*), Bash(*), Glob(*)
|
||||
**Document Structure**:
|
||||
```
|
||||
.workflow/WFS-[topic]/.brainstorming/
|
||||
├── topic-framework.md # ★ STRUCTURED FRAMEWORK DOCUMENT
|
||||
└── workflow-session.json # Framework metadata and role assignments
|
||||
└── topic-framework.md # ★ STRUCTURED FRAMEWORK DOCUMENT
|
||||
```
|
||||
|
||||
**Note**: `workflow-session.json` is located at `.workflow/WFS-[topic]/workflow-session.json` (session root), not inside `.brainstorming/`.
|
||||
|
||||
## Framework Template Structures
|
||||
|
||||
### Dynamic Role-Based Framework
|
||||
|
||||
@@ -149,7 +149,7 @@ Task(subagent_type="conceptual-planning-agent",
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and topic description
|
||||
- Command: bash(cat .workflow/WFS-{topic}/.brainstorming/workflow-session.json 2>/dev/null || echo '{}')
|
||||
- Command: bash(cat .workflow/WFS-{topic}/workflow-session.json 2>/dev/null || echo '{}')
|
||||
- Output: session_metadata
|
||||
|
||||
### Implementation Context
|
||||
@@ -162,7 +162,7 @@ Task(subagent_type="conceptual-planning-agent",
|
||||
### Session Context
|
||||
**Workflow Directory**: .workflow/WFS-{topic}/.brainstorming/
|
||||
**Output Directory**: .workflow/WFS-{topic}/.brainstorming/{role}/
|
||||
**Session JSON**: .workflow/WFS-{topic}/.brainstorming/workflow-session.json
|
||||
**Session JSON**: .workflow/WFS-{topic}/workflow-session.json
|
||||
|
||||
### Dependencies & Context
|
||||
**Topic**: {user-provided-topic}
|
||||
|
||||
@@ -88,7 +88,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/session.json)
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -136,7 +136,7 @@ TodoWrite({
|
||||
activeForm: "Generating structured data-architect analysis"
|
||||
},
|
||||
{
|
||||
content: "Update session.json with data-architect completion status",
|
||||
content: "Update workflow-session.json with data-architect completion status",
|
||||
status: "pending",
|
||||
activeForm: "Updating session metadata"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/session.json)
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -136,7 +136,7 @@ TodoWrite({
|
||||
activeForm: "Generating structured product-manager analysis"
|
||||
},
|
||||
{
|
||||
content: "Update session.json with product-manager completion status",
|
||||
content: "Update workflow-session.json with product-manager completion status",
|
||||
status: "pending",
|
||||
activeForm: "Updating session metadata"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/session.json)
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -136,7 +136,7 @@ TodoWrite({
|
||||
activeForm: "Generating structured product-owner analysis"
|
||||
},
|
||||
{
|
||||
content: "Update session.json with product-owner completion status",
|
||||
content: "Update workflow-session.json with product-owner completion status",
|
||||
status: "pending",
|
||||
activeForm: "Updating session metadata"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/session.json)
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -136,7 +136,7 @@ TodoWrite({
|
||||
activeForm: "Generating structured scrum-master analysis"
|
||||
},
|
||||
{
|
||||
content: "Update session.json with scrum-master completion status",
|
||||
content: "Update workflow-session.json with scrum-master completion status",
|
||||
status: "pending",
|
||||
activeForm: "Updating session metadata"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/session.json)
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -136,7 +136,7 @@ TodoWrite({
|
||||
activeForm: "Generating structured subject-matter-expert analysis"
|
||||
},
|
||||
{
|
||||
content: "Update session.json with subject-matter-expert completion status",
|
||||
content: "Update workflow-session.json with subject-matter-expert completion status",
|
||||
status: "pending",
|
||||
activeForm: "Updating session metadata"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/session.json)
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -136,7 +136,7 @@ TodoWrite({
|
||||
activeForm: "Generating structured ui-designer analysis"
|
||||
},
|
||||
{
|
||||
content: "Update session.json with ui-designer completion status",
|
||||
content: "Update workflow-session.json with ui-designer completion status",
|
||||
status: "pending",
|
||||
activeForm: "Updating session metadata"
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ ANALYSIS_MODE: {framework_mode ? "framework_based" : "standalone"}
|
||||
|
||||
3. **load_session_metadata**
|
||||
- Action: Load session metadata and existing context
|
||||
- Command: Read(.workflow/WFS-{session}/.brainstorming/session.json)
|
||||
- Command: Read(.workflow/WFS-{session}/workflow-session.json)
|
||||
- Output: session_context
|
||||
|
||||
## Analysis Requirements
|
||||
@@ -136,7 +136,7 @@ TodoWrite({
|
||||
activeForm: "Generating structured ux-expert analysis"
|
||||
},
|
||||
{
|
||||
content: "Update session.json with ux-expert completion status",
|
||||
content: "Update workflow-session.json with ux-expert completion status",
|
||||
status: "pending",
|
||||
activeForm: "Updating session metadata"
|
||||
}
|
||||
|
||||
@@ -185,9 +185,9 @@ TodoWrite({
|
||||
activeForm: "Executing IMPL-1.2: Implement auth logic"
|
||||
},
|
||||
{
|
||||
content: "Execute IMPL-2: Review implementations [code-review-agent]",
|
||||
content: "Execute TEST-FIX-1: Validate implementation tests [test-fix-agent]",
|
||||
status: "pending",
|
||||
activeForm: "Executing IMPL-2: Review implementations"
|
||||
activeForm: "Executing TEST-FIX-1: Validate implementation tests"
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -384,8 +384,8 @@ Task(subagent_type="{meta.agent}",
|
||||
"title": "Task title",
|
||||
"status": "pending|active|completed|blocked",
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@planning-agent|@code-review-test-agent"
|
||||
"type": "feature|bugfix|refactor|test-gen|test-fix|docs",
|
||||
"agent": "@code-developer|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
"context": {
|
||||
"requirements": ["req1", "req2"],
|
||||
@@ -451,8 +451,9 @@ Task(subagent_type="{meta.agent}",
|
||||
meta.agent specified → Use specified agent
|
||||
meta.agent missing → Infer from meta.type:
|
||||
- "feature" → @code-developer
|
||||
- "test" → @code-review-test-agent
|
||||
- "review" → @code-review-agent
|
||||
- "test-gen" → @code-developer
|
||||
- "test-fix" → @test-fix-agent
|
||||
- "review" → @general-purpose
|
||||
- "docs" → @doc-generator
|
||||
```
|
||||
|
||||
|
||||
@@ -1,85 +1,272 @@
|
||||
---
|
||||
name: review
|
||||
description: Execute review phase for quality validation
|
||||
usage: /workflow:review
|
||||
argument-hint: none
|
||||
description: Optional specialized review (security, architecture, docs) for completed implementation
|
||||
usage: /workflow:review [--type=<type>] [session-id]
|
||||
argument-hint: "[--type=security|architecture|action-items|quality] [session-id]"
|
||||
examples:
|
||||
- /workflow:review
|
||||
- /workflow:review # Quality review of active session
|
||||
- /workflow:review --type=security # Security audit of active session
|
||||
- /workflow:review --type=architecture WFS-user-auth # Architecture review of specific session
|
||||
- /workflow:review --type=action-items # Pre-deployment verification
|
||||
---
|
||||
|
||||
# Workflow Review Command (/workflow:review)
|
||||
### 🚀 Command Overview: `/workflow:review`
|
||||
|
||||
## Overview
|
||||
Final phase for quality validation, testing, and completion.
|
||||
**Optional specialized review** for completed implementations. In the standard workflow, **passing tests = approved code**. Use this command only when specialized review is required (security, architecture, compliance, docs).
|
||||
|
||||
## Core Principles
|
||||
**Session Management:** @~/.claude/workflows/workflow-architecture.md
|
||||
## Philosophy: "Tests Are the Review"
|
||||
|
||||
## Review Process
|
||||
- ✅ **Default**: All tests pass → Code approved
|
||||
- 🔍 **Optional**: Specialized reviews for:
|
||||
- 🔒 Security audits (vulnerabilities, auth/authz)
|
||||
- 🏗️ Architecture compliance (patterns, technical debt)
|
||||
- 📋 Action items verification (requirements met, acceptance criteria)
|
||||
|
||||
1. **Validation Checks**
|
||||
- All tasks completed
|
||||
- Tests passing
|
||||
- Code quality metrics
|
||||
- Documentation complete
|
||||
## Review Types
|
||||
|
||||
2. **Generate Review Report**
|
||||
| Type | Focus | Use Case |
|
||||
|------|-------|----------|
|
||||
| `quality` | Code quality, best practices, maintainability | Default general review |
|
||||
| `security` | Security vulnerabilities, data handling, access control | Security audits |
|
||||
| `architecture` | Architectural patterns, technical debt, design decisions | Architecture compliance |
|
||||
| `action-items` | Requirements met, acceptance criteria verified, action items completed | Pre-deployment verification |
|
||||
|
||||
**Notes**:
|
||||
- For documentation generation, use `/workflow:tools:docs`
|
||||
- For CLAUDE.md updates, use `/update-memory-related`
|
||||
|
||||
## Execution Template
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Optional specialized review for completed implementation
|
||||
|
||||
# Step 1: Session ID resolution
|
||||
if [ -n "$SESSION_ARG" ]; then
|
||||
sessionId="$SESSION_ARG"
|
||||
else
|
||||
sessionId=$(find .workflow/ -name '.active-*' | head -1 | sed 's/.*active-//')
|
||||
fi
|
||||
|
||||
# Step 2: Validation
|
||||
if [ ! -d ".workflow/${sessionId}" ]; then
|
||||
echo "❌ Session ${sessionId} not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for completed tasks
|
||||
if [ ! -d ".workflow/${sessionId}/.summaries" ] || [ -z "$(ls .workflow/${sessionId}/.summaries/IMPL-*.md 2>/dev/null)" ]; then
|
||||
echo "❌ No completed implementation found. Complete implementation first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Step 3: Determine review type (default: quality)
|
||||
review_type="${TYPE_ARG:-quality}"
|
||||
|
||||
# Redirect docs review to specialized command
|
||||
if [ "$review_type" = "docs" ]; then
|
||||
echo "💡 For documentation generation, please use:"
|
||||
echo " /workflow:tools:docs"
|
||||
echo ""
|
||||
echo "The docs command provides:"
|
||||
echo " - Hierarchical architecture documentation"
|
||||
echo " - API documentation generation"
|
||||
echo " - Documentation structure analysis"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Step 4: Analysis handover → Model takes control
|
||||
# BASH_EXECUTION_STOPS → MODEL_ANALYSIS_BEGINS
|
||||
```
|
||||
|
||||
### 🧠 Model Analysis Phase
|
||||
|
||||
After bash validation, the model takes control to:
|
||||
|
||||
1. **Load Context**: Read completed task summaries and changed files
|
||||
```bash
|
||||
# Load implementation summaries
|
||||
cat .workflow/${sessionId}/.summaries/IMPL-*.md
|
||||
|
||||
# Load test results (if available)
|
||||
cat .workflow/${sessionId}/.summaries/TEST-FIX-*.md 2>/dev/null
|
||||
|
||||
# Get changed files
|
||||
git log --since="$(cat .workflow/${sessionId}/workflow-session.json | jq -r .created_at)" --name-only --pretty=format: | sort -u
|
||||
```
|
||||
|
||||
2. **Perform Specialized Review**: Based on `review_type`
|
||||
|
||||
**Security Review** (`--type=security`):
|
||||
- Use MCP code search for security patterns:
|
||||
```bash
|
||||
mcp__code-index__search_code_advanced(pattern="password|token|secret|auth", file_pattern="*.{ts,js,py}")
|
||||
mcp__code-index__search_code_advanced(pattern="eval|exec|innerHTML|dangerouslySetInnerHTML", file_pattern="*.{ts,js,tsx}")
|
||||
```
|
||||
- Use Gemini for security analysis:
|
||||
```bash
|
||||
cd .workflow/${sessionId} && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Security audit of completed implementation
|
||||
TASK: Review code for security vulnerabilities, insecure patterns, auth/authz issues
|
||||
CONTEXT: @{.summaries/IMPL-*.md,../..,../../CLAUDE.md}
|
||||
EXPECTED: Security findings report with severity levels
|
||||
RULES: Focus on OWASP Top 10, authentication, authorization, data validation, injection risks
|
||||
" --approval-mode yolo
|
||||
```
|
||||
|
||||
**Architecture Review** (`--type=architecture`):
|
||||
- Use Qwen for architecture analysis:
|
||||
```bash
|
||||
cd .workflow/${sessionId} && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: Architecture compliance review
|
||||
TASK: Evaluate adherence to architectural patterns, identify technical debt, review design decisions
|
||||
CONTEXT: @{.summaries/IMPL-*.md,../..,../../CLAUDE.md}
|
||||
EXPECTED: Architecture assessment with recommendations
|
||||
RULES: Check for patterns, separation of concerns, modularity, scalability
|
||||
" --approval-mode yolo
|
||||
```
|
||||
|
||||
**Quality Review** (`--type=quality`):
|
||||
- Use Gemini for code quality:
|
||||
```bash
|
||||
cd .workflow/${sessionId} && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Code quality and best practices review
|
||||
TASK: Assess code readability, maintainability, adherence to best practices
|
||||
CONTEXT: @{.summaries/IMPL-*.md,../..,../../CLAUDE.md}
|
||||
EXPECTED: Quality assessment with improvement suggestions
|
||||
RULES: Check for code smells, duplication, complexity, naming conventions
|
||||
" --approval-mode yolo
|
||||
```
|
||||
|
||||
**Action Items Review** (`--type=action-items`):
|
||||
- Verify all requirements and acceptance criteria met:
|
||||
```bash
|
||||
# Load task requirements and acceptance criteria
|
||||
find .workflow/${sessionId}/.task -name "IMPL-*.json" -exec jq -r '
|
||||
"Task: " + .id + "\n" +
|
||||
"Requirements: " + (.context.requirements | join(", ")) + "\n" +
|
||||
"Acceptance: " + (.context.acceptance | join(", "))
|
||||
' {} \;
|
||||
|
||||
# Check implementation summaries against requirements
|
||||
cd .workflow/${sessionId} && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Verify all requirements and acceptance criteria are met
|
||||
TASK: Cross-check implementation summaries against original requirements
|
||||
CONTEXT: @{.task/IMPL-*.json,.summaries/IMPL-*.md,../..,../../CLAUDE.md}
|
||||
EXPECTED:
|
||||
- Requirements coverage matrix
|
||||
- Acceptance criteria verification
|
||||
- Missing/incomplete action items
|
||||
- Pre-deployment readiness assessment
|
||||
RULES:
|
||||
- Check each requirement has corresponding implementation
|
||||
- Verify all acceptance criteria are met
|
||||
- Flag any incomplete or missing action items
|
||||
- Assess deployment readiness
|
||||
" --approval-mode yolo
|
||||
```
|
||||
|
||||
|
||||
3. **Generate Review Report**: Create structured report
|
||||
```markdown
|
||||
# Review Report
|
||||
|
||||
## Task Completion
|
||||
- Total: 10
|
||||
- Completed: 10
|
||||
- Success Rate: 100%
|
||||
|
||||
## Quality Metrics
|
||||
- Test Coverage: 85%
|
||||
- Code Quality: A
|
||||
- Documentation: Complete
|
||||
|
||||
## Issues Found
|
||||
- Minor: 2
|
||||
- Major: 0
|
||||
- Critical: 0
|
||||
# Review Report: ${review_type}
|
||||
|
||||
**Session**: ${sessionId}
|
||||
**Date**: $(date)
|
||||
**Type**: ${review_type}
|
||||
|
||||
## Summary
|
||||
- Tasks Reviewed: [count IMPL tasks]
|
||||
- Files Changed: [count files]
|
||||
- Severity: [High/Medium/Low]
|
||||
|
||||
## Findings
|
||||
|
||||
### Critical Issues
|
||||
- [Issue 1 with file:line reference]
|
||||
- [Issue 2 with file:line reference]
|
||||
|
||||
### Recommendations
|
||||
- [Recommendation 1]
|
||||
- [Recommendation 2]
|
||||
|
||||
### Positive Observations
|
||||
- [Good pattern observed]
|
||||
|
||||
## Action Items
|
||||
- [ ] [Action 1]
|
||||
- [ ] [Action 2]
|
||||
```
|
||||
|
||||
3. **Update Session**
|
||||
```json
|
||||
{
|
||||
"current_phase": "REVIEW",
|
||||
"phases": {
|
||||
"REVIEW": {
|
||||
"status": "completed",
|
||||
"output": "REVIEW.md",
|
||||
"test_results": {
|
||||
"passed": 45,
|
||||
"failed": 0,
|
||||
"coverage": 85
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
4. **Output Files**:
|
||||
```bash
|
||||
# Save review report
|
||||
Write(.workflow/${sessionId}/REVIEW-${review_type}.md)
|
||||
|
||||
# Update session metadata
|
||||
# (optional) Update workflow-session.json with review status
|
||||
```
|
||||
|
||||
## Auto-fix (Default)
|
||||
Auto-fix is enabled by default:
|
||||
- Automatically fixes minor issues
|
||||
- Runs formatters and linters
|
||||
- Updates documentation
|
||||
- Re-runs tests
|
||||
5. **Optional: Update Memory** (if docs review or significant findings):
|
||||
```bash
|
||||
# If architecture or quality issues found, suggest memory update
|
||||
if [ "$review_type" = "architecture" ] || [ "$review_type" = "quality" ]; then
|
||||
echo "💡 Consider updating project documentation:"
|
||||
echo " /update-memory-related"
|
||||
fi
|
||||
```
|
||||
|
||||
## Completion Criteria
|
||||
- All tasks marked complete
|
||||
- Tests passing (configurable threshold)
|
||||
- No critical issues
|
||||
- Documentation updated
|
||||
## Usage Examples
|
||||
|
||||
## Output Files
|
||||
- `REVIEW.md` - Review report
|
||||
- `workflow-session.json` - Updated with results
|
||||
- `test-results.json` - Detailed test output
|
||||
```bash
|
||||
# General quality review after implementation
|
||||
/workflow:review
|
||||
|
||||
# Security audit before deployment
|
||||
/workflow:review --type=security
|
||||
|
||||
# Architecture review for specific session
|
||||
/workflow:review --type=architecture WFS-payment-integration
|
||||
|
||||
# Documentation review
|
||||
/workflow:review --type=docs
|
||||
```
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- **Simple Validation**: Check session exists and has completed tasks
|
||||
- **No Complex Orchestration**: Direct analysis, no multi-phase pipeline
|
||||
- **Specialized Reviews**: Different prompts and tools for different review types
|
||||
- **MCP Integration**: Fast code search for security and architecture patterns
|
||||
- **CLI Tool Integration**: Gemini for analysis, Qwen for architecture
|
||||
- **Structured Output**: Markdown reports with severity levels and action items
|
||||
- **Optional Memory Update**: Suggests documentation updates for significant findings
|
||||
|
||||
## Integration with Workflow
|
||||
|
||||
```
|
||||
Standard Workflow:
|
||||
plan → execute → test-gen → execute ✅
|
||||
|
||||
Optional Review (when needed):
|
||||
plan → execute → test-gen → execute → review (security/architecture/docs)
|
||||
```
|
||||
|
||||
**When to Use**:
|
||||
- Before production deployment (security review + action-items review)
|
||||
- After major feature (architecture review)
|
||||
- Before code freeze (quality review)
|
||||
- Pre-deployment verification (action-items review)
|
||||
|
||||
**When NOT to Use**:
|
||||
- Regular development (tests are sufficient)
|
||||
- Simple bug fixes (test-fix-agent handles it)
|
||||
- Minor changes (update-memory-related is enough)
|
||||
|
||||
## Related Commands
|
||||
- `/workflow:execute` - Must complete first
|
||||
- `/task:status` - Check task completion
|
||||
- `/workflow:status` - View overall status
|
||||
|
||||
- `/workflow:execute` - Must complete implementation first
|
||||
- `/workflow:test-gen` - Primary quality gate (tests)
|
||||
- `/workflow:tools:docs` - Generate hierarchical documentation (use instead of `--type=docs`)
|
||||
- `/update-memory-related` - Update CLAUDE.md docs after architecture findings
|
||||
- `/workflow:status` - Check session status
|
||||
|
||||
@@ -1,145 +1,365 @@
|
||||
---
|
||||
name: test-gen
|
||||
description: Generate comprehensive test workflow based on completed implementation tasks
|
||||
description: Orchestrate test-fix workflow by analyzing implementation and generating TEST-FIX tasks
|
||||
usage: /workflow:test-gen [session-id]
|
||||
argument-hint: "WFS-session-id"
|
||||
argument-hint: "[session-id]"
|
||||
examples:
|
||||
- /workflow:test-gen
|
||||
- /workflow:test-gen WFS-user-auth
|
||||
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
||||
---
|
||||
|
||||
# Workflow Test Generation Command
|
||||
# Workflow Test Generation Command (/workflow:test-gen)
|
||||
|
||||
## Overview
|
||||
Analyzes completed implementation sessions and generates comprehensive test requirements, then calls workflow:plan to create test workflow.
|
||||
## Coordinator Role
|
||||
|
||||
## Usage
|
||||
```bash
|
||||
/workflow:test-gen # Auto-detect active session
|
||||
/workflow:test-gen WFS-session-id # Analyze specific session
|
||||
**This command is a pure orchestrator**: Analyze completed implementation session, generate test-fix workflow through standardized tool commands, and trigger automated test validation.
|
||||
|
||||
**Execution Flow**:
|
||||
1. Initialize TodoWrite → Execute Phase 1 → Parse output → Update TodoWrite
|
||||
2. Execute Phase 2 with Phase 1 data → Parse output → Update TodoWrite
|
||||
3. Execute Phase 3 with Phase 2 data → Parse output → Update TodoWrite
|
||||
4. Execute Phase 4 with Phase 3 validation → Update TodoWrite → Return summary
|
||||
|
||||
## Core Rules
|
||||
|
||||
1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 session discovery
|
||||
2. **No Preliminary Analysis**: Do not read files or analyze before Phase 1
|
||||
3. **Parse Every Output**: Extract required data from each phase for next phase
|
||||
4. **Sequential Execution**: Each phase depends on previous phase's output
|
||||
5. **Complete All Phases**: Do not return to user until Phase 4 completes
|
||||
6. **Track Progress**: Update TodoWrite after every phase completion
|
||||
7. **Use Standard Tools**: Follow plan.md pattern using context-gather, concept-enhanced, task-generate
|
||||
|
||||
## 4-Phase Execution
|
||||
|
||||
### Phase 1: Session Discovery & Context Gathering
|
||||
**Command**: `SlashCommand(command="/workflow:tools:context-gather --session [sessionId] \"TEST-FIX: Validate implementation for [sessionId]\"")`
|
||||
|
||||
**Session ID Resolution**:
|
||||
- If argument provided → Use directly as `sessionId`
|
||||
- If no argument → Auto-detect from `.workflow/.active-*` marker
|
||||
- Format: `WFS-[session-name]`
|
||||
|
||||
**Task Description Structure**:
|
||||
```
|
||||
GOAL: Execute and validate all tests for completed implementation
|
||||
SCOPE: Test execution, failure diagnosis, code fixing
|
||||
CONTEXT: Implementation session [sessionId] with completed IMPL tasks
|
||||
```
|
||||
|
||||
## Dynamic Session ID Resolution
|
||||
**Parse Output**:
|
||||
- Extract: context package path (store as `contextPath`)
|
||||
- Typical pattern: `.workflow/[sessionId]/.process/context-package-test.json`
|
||||
|
||||
The `${SESSION_ID}` variable is dynamically resolved based on:
|
||||
**Validation**:
|
||||
- Session directory `.workflow/[sessionId]/` exists
|
||||
- Session has completed IMPL tasks (check .summaries/IMPL-*-summary.md)
|
||||
- Context package created successfully
|
||||
|
||||
1. **Command argument**: If session-id provided as argument, use it directly
|
||||
2. **Auto-detection**: If no argument, detect from active session markers
|
||||
3. **Format**: Always in format `WFS-session-name`
|
||||
**TodoWrite**: Mark phase 1 completed, phase 2 in_progress
|
||||
|
||||
```bash
|
||||
# Example resolution logic:
|
||||
# If argument provided: SESSION_ID = "WFS-user-auth"
|
||||
# If no argument: SESSION_ID = $(find .workflow/ -name '.active-*' | head -1 | sed 's/.*active-//')
|
||||
---
|
||||
|
||||
### Phase 2: Implementation Analysis
|
||||
**Command**: `SlashCommand(command="/workflow:tools:concept-enhanced --session [sessionId] --context [contextPath]")`
|
||||
|
||||
**Input**: `sessionId` from Phase 1, `contextPath` from Phase 1
|
||||
|
||||
**Expected Analysis**:
|
||||
- Review completed implementation summaries
|
||||
- Identify test files and coverage gaps
|
||||
- Assess test execution strategy
|
||||
- Determine failure diagnosis approach
|
||||
|
||||
**Parse Output**:
|
||||
- Verify `.workflow/[sessionId]/.process/ANALYSIS_RESULTS.md` created
|
||||
- Extract test execution recommendations
|
||||
- Identify critical test areas
|
||||
|
||||
**Validation**:
|
||||
- File `.workflow/[sessionId]/.process/ANALYSIS_RESULTS.md` exists
|
||||
- Contains test strategy and execution plan
|
||||
- Lists focus test paths and acceptance criteria
|
||||
|
||||
**TodoWrite**: Mark phase 2 completed, phase 3 in_progress
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: TEST-FIX Task Generation
|
||||
**Command**: `SlashCommand(command="/workflow:tools:task-generate --session [sessionId]")`
|
||||
|
||||
**Input**: `sessionId` from Phase 1
|
||||
|
||||
**Expected Behavior**:
|
||||
- Parse ANALYSIS_RESULTS.md for test requirements
|
||||
- Generate TEST-FIX-001.json with:
|
||||
- `meta.type: "test-fix"`
|
||||
- `meta.agent: "@test-fix-agent"`
|
||||
- `context.requirements`: Test execution requirements
|
||||
- `context.focus_paths`: Test files and source files
|
||||
- `context.acceptance`: All tests pass criteria
|
||||
- `flow_control.pre_analysis`: Load implementation summaries
|
||||
- `flow_control.implementation_approach`: Test execution strategy
|
||||
|
||||
**Parse Output**:
|
||||
- Verify `.workflow/[sessionId]/.task/TEST-FIX-001.json` exists
|
||||
- Verify `.workflow/[sessionId]/IMPL_PLAN.md` updated
|
||||
- Verify `.workflow/[sessionId]/TODO_LIST.md` updated
|
||||
|
||||
**Validation**:
|
||||
- Task JSON has correct structure (id, meta.type="test-fix", meta.agent="@test-fix-agent")
|
||||
- IMPL_PLAN.md contains test-fix strategy
|
||||
- TODO_LIST.md shows TEST-FIX-001 task
|
||||
|
||||
**TodoWrite**: Mark phase 3 completed, phase 4 in_progress
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: Execute Test-Fix Workflow
|
||||
**Command**: `SlashCommand(command="/workflow:execute --session [sessionId]")`
|
||||
|
||||
**Input**: `sessionId` from Phase 1
|
||||
|
||||
**Expected Behavior**:
|
||||
- Workflow executor detects TEST-FIX-001 task
|
||||
- Assigns to @test-fix-agent
|
||||
- Agent executes tests using flow_control.pre_analysis
|
||||
- If failures: diagnoses and fixes code
|
||||
- Re-runs tests until all pass
|
||||
- Generates completion summary
|
||||
|
||||
**Validation**:
|
||||
- Workflow execution started successfully
|
||||
- TEST-FIX-001 task status updated to "active" or "completed"
|
||||
|
||||
**TodoWrite**: Mark phase 4 completed
|
||||
|
||||
**Return to User**:
|
||||
```
|
||||
Test-fix workflow initiated for session: [sessionId]
|
||||
- TEST-FIX-001 created and executing
|
||||
- @test-fix-agent validating implementation
|
||||
- Progress: /workflow:status [sessionId]
|
||||
```
|
||||
|
||||
## Implementation Flow
|
||||
---
|
||||
|
||||
### Step 1: Identify Target Session
|
||||
```bash
|
||||
# Auto-detect active session (if no session-id provided)
|
||||
find .workflow/ -name '.active-*' | head -1 | sed 's/.*active-//'
|
||||
## TodoWrite Pattern
|
||||
|
||||
# Use provided session-id or detected session-id
|
||||
# SESSION_ID = provided argument OR detected active session
|
||||
```javascript
|
||||
// Initialize (before Phase 1)
|
||||
TodoWrite({todos: [
|
||||
{"content": "Execute context gathering for test-fix", "status": "in_progress", "activeForm": "Executing context gathering for test-fix"},
|
||||
{"content": "Execute implementation analysis", "status": "pending", "activeForm": "Executing implementation analysis"},
|
||||
{"content": "Execute TEST-FIX task generation", "status": "pending", "activeForm": "Executing TEST-FIX task generation"},
|
||||
{"content": "Execute test-fix workflow", "status": "pending", "activeForm": "Executing test-fix workflow"}
|
||||
]})
|
||||
|
||||
// After Phase 1
|
||||
TodoWrite({todos: [
|
||||
{"content": "Execute context gathering for test-fix", "status": "completed", "activeForm": "Executing context gathering for test-fix"},
|
||||
{"content": "Execute implementation analysis", "status": "in_progress", "activeForm": "Executing implementation analysis"},
|
||||
{"content": "Execute TEST-FIX task generation", "status": "pending", "activeForm": "Executing TEST-FIX task generation"},
|
||||
{"content": "Execute test-fix workflow", "status": "pending", "activeForm": "Executing test-fix workflow"}
|
||||
]})
|
||||
|
||||
// Continue pattern for Phase 2, 3, 4...
|
||||
```
|
||||
|
||||
### Step 2: Get Session Start Time
|
||||
```bash
|
||||
cat .workflow/WFS-${SESSION_ID}/workflow-session.json | jq -r .created_at
|
||||
## Data Flow
|
||||
|
||||
```
|
||||
Session ID (from argument or auto-detect)
|
||||
↓
|
||||
Phase 1: context-gather --session sessionId "test-fix description"
|
||||
↓ Output: contextPath (context-package-test.json)
|
||||
↓
|
||||
Phase 2: concept-enhanced --session sessionId --context contextPath
|
||||
↓ Input: sessionId + contextPath
|
||||
↓ Output: ANALYSIS_RESULTS.md (test execution strategy)
|
||||
↓
|
||||
Phase 3: task-generate --session sessionId
|
||||
↓ Input: sessionId + ANALYSIS_RESULTS.md
|
||||
↓ Output: TEST-FIX-001.json, IMPL_PLAN.md, TODO_LIST.md
|
||||
↓
|
||||
Phase 4: execute --session sessionId
|
||||
↓ Input: sessionId + TEST-FIX-001.json
|
||||
↓ Output: Test execution and fixing
|
||||
↓
|
||||
Return summary to user
|
||||
```
|
||||
|
||||
### Step 3: Git Change Analysis (using session start time)
|
||||
```bash
|
||||
git log --since="$(cat .workflow/WFS-${SESSION_ID}/workflow-session.json | jq -r .created_at)" --name-only --pretty=format: | sort -u | grep -v '^$'
|
||||
## Context Gathering Customization
|
||||
|
||||
context-gather will analyze:
|
||||
- Completed IMPL task summaries
|
||||
- Git changes since session start
|
||||
- Test files in focus_paths
|
||||
- Implementation files to be tested
|
||||
- Test framework configuration
|
||||
|
||||
## Analysis Focus
|
||||
|
||||
concept-enhanced will analyze:
|
||||
- Test coverage gaps
|
||||
- Test execution strategy (unit, integration, e2e)
|
||||
- Failure diagnosis approaches
|
||||
- Code fixing patterns
|
||||
- Test framework best practices
|
||||
|
||||
## Task Generation Output
|
||||
|
||||
task-generate creates TEST-FIX-001.json with:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "TEST-FIX-001",
|
||||
"title": "Execute and validate tests for [sessionId]",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "test-fix",
|
||||
"agent": "@test-fix-agent"
|
||||
},
|
||||
"context": {
|
||||
"requirements": [
|
||||
"Execute complete test suite for all implemented modules",
|
||||
"Diagnose and fix any test failures",
|
||||
"Ensure all tests pass before completion"
|
||||
],
|
||||
"focus_paths": ["src/**/*.test.ts", "src/**/implementation.ts"],
|
||||
"acceptance": [
|
||||
"All tests pass successfully",
|
||||
"No test failures or errors",
|
||||
"Code is approved and ready for deployment"
|
||||
],
|
||||
"depends_on": [],
|
||||
"artifacts": []
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "load_implementation_summaries",
|
||||
"action": "Load completed IMPL task summaries",
|
||||
"commands": [
|
||||
"bash(find .workflow/[sessionId]/.summaries/ -name 'IMPL-*-summary.md' 2>/dev/null)",
|
||||
"Read(.workflow/[sessionId]/.summaries/IMPL-001-summary.md)"
|
||||
],
|
||||
"output_to": "implementation_context",
|
||||
"on_error": "skip_optional"
|
||||
},
|
||||
{
|
||||
"step": "analyze_test_files",
|
||||
"action": "Identify test files and coverage",
|
||||
"commands": [
|
||||
"mcp__code-index__find_files(pattern=\"*.test.*\")",
|
||||
"mcp__code-index__search_code_advanced(pattern=\"test|describe|it\", file_pattern=\"*.test.*\")"
|
||||
],
|
||||
"output_to": "test_inventory",
|
||||
"on_error": "fail"
|
||||
}
|
||||
],
|
||||
"implementation_approach": {
|
||||
"task_description": "Execute tests and fix failures until all pass",
|
||||
"modification_points": [
|
||||
"Run test suite using detected framework",
|
||||
"Parse test output to identify failures",
|
||||
"Diagnose root cause of failures",
|
||||
"Modify source code to fix issues",
|
||||
"Re-run tests to verify fixes"
|
||||
],
|
||||
"logic_flow": [
|
||||
"Load implementation context",
|
||||
"Identify test framework and configuration",
|
||||
"Execute complete test suite",
|
||||
"If failures: analyze error messages",
|
||||
"Fix source code based on diagnosis",
|
||||
"Re-run tests",
|
||||
"Repeat until all tests pass"
|
||||
]
|
||||
},
|
||||
"target_files": ["src/**/*.test.ts", "src/**/implementation.ts"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Step 4: Filter Code Files
|
||||
```bash
|
||||
git log --since="$(cat .workflow/WFS-${SESSION_ID}/workflow-session.json | jq -r .created_at)" --name-only --pretty=format: | sort -u | grep -E '\.(js|ts|jsx|tsx|py|java|go|rs)$'
|
||||
## Error Handling
|
||||
|
||||
### Phase 1 Failures
|
||||
- **No session found**: Return error "No active session detected. Provide session-id or run /workflow:plan first"
|
||||
- **Invalid session**: Return error "Session [sessionId] not found or incomplete"
|
||||
- **No implementation**: Return error "No completed IMPL tasks found. Complete implementation first"
|
||||
|
||||
### Phase 2 Failures
|
||||
- **Analysis failed**: Return error "Implementation analysis failed. Check context package"
|
||||
- **No test strategy**: Return error "Could not determine test execution strategy"
|
||||
|
||||
### Phase 3 Failures
|
||||
- **Task generation failed**: Retry once, then return error with details
|
||||
- **Invalid task structure**: Return error with JSON validation details
|
||||
|
||||
### Phase 4 Failures
|
||||
- **Execution failed**: Return error "Could not start test-fix workflow. Check session state"
|
||||
|
||||
## Workflow Integration
|
||||
|
||||
### Complete Flow Example
|
||||
```
|
||||
1. Implementation Phase (prior to test-gen)
|
||||
/workflow:plan "Build auth system"
|
||||
→ @code-developer implements + writes tests
|
||||
→ Creates IMPL-001-summary.md
|
||||
|
||||
2. Test Generation Phase (test-gen)
|
||||
/workflow:test-gen WFS-auth
|
||||
Phase 1: context-gather → Creates context-package-test.json
|
||||
Phase 2: concept-enhanced → Creates ANALYSIS_RESULTS.md
|
||||
Phase 3: task-generate → Creates TEST-FIX-001.json
|
||||
Phase 4: execute → Triggers @test-fix-agent
|
||||
|
||||
3. Test-Fix Phase (automated)
|
||||
@test-fix-agent picks up TEST-FIX-001
|
||||
→ Runs test suite
|
||||
→ Diagnoses failures (if any)
|
||||
→ Fixes source code
|
||||
→ Re-runs tests
|
||||
→ All pass → Code approved ✅
|
||||
```
|
||||
|
||||
### Step 5: Load Session Context
|
||||
```bash
|
||||
cat .workflow/WFS-${SESSION_ID}/.summaries/IMPL-*-summary.md 2>/dev/null
|
||||
```
|
||||
### Output Files Created
|
||||
- `.workflow/[sessionId]/.process/context-package-test.json` - Test context package
|
||||
- `.workflow/[sessionId]/.process/ANALYSIS_RESULTS.md` - Test execution strategy
|
||||
- `.workflow/[sessionId]/.task/TEST-FIX-001.json` - Task definition
|
||||
- `.workflow/[sessionId]/IMPL_PLAN.md` - Updated with test-fix plan
|
||||
- `.workflow/[sessionId]/TODO_LIST.md` - Updated with TEST-FIX task
|
||||
- `.workflow/[sessionId]/.summaries/TEST-FIX-001-summary.md` - Created by test-fix-agent after completion
|
||||
|
||||
### Step 6: Extract Focus Paths
|
||||
```bash
|
||||
find .workflow/WFS-${SESSION_ID}/.task/ -name '*.json' -exec jq -r '.context.focus_paths[]?' {} \;
|
||||
```
|
||||
## Best Practices
|
||||
|
||||
### Step 7: Gemini Analysis and Planning Document Generation
|
||||
```bash
|
||||
cd project-root && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Analyze implementation and generate comprehensive test planning document
|
||||
TASK: Review changed files and implementation context to create detailed test planning document
|
||||
CONTEXT: Changed files: [changed_files], Implementation summaries: [impl_summaries], Focus paths: [focus_paths]
|
||||
EXPECTED: Complete test planning document including:
|
||||
- Test strategy analysis
|
||||
- Critical test scenarios identification
|
||||
- Edge cases and error conditions
|
||||
- Test priority matrix
|
||||
- Resource requirements
|
||||
- Implementation approach recommendations
|
||||
- Specific test cases with acceptance criteria
|
||||
RULES: Generate structured markdown document suitable for workflow planning. Focus on actionable test requirements based on actual implementation changes.
|
||||
" > .workflow/WFS-${SESSION_ID}/.process/GEMINI_TEST_PLAN.md
|
||||
```
|
||||
1. **Run after implementation complete**: Ensure all IMPL tasks are done before test-gen
|
||||
2. **Check git commits**: Make sure implementation changes are committed
|
||||
3. **Verify test files exist**: Code-developer should have created tests
|
||||
4. **Monitor execution**: Use `/workflow:status` to track test-fix progress
|
||||
5. **Review failures**: If tests fail repeatedly, check test-fix-agent summary for details
|
||||
|
||||
### Step 8: Generate Combined Test Requirements Document
|
||||
```bash
|
||||
mkdir -p .workflow/WFS-${SESSION_ID}/.process
|
||||
```
|
||||
## Coordinator Checklist
|
||||
|
||||
```bash
|
||||
cat > .workflow/WFS-${SESSION_ID}/.process/TEST_REQUIREMENTS.md << 'EOF'
|
||||
# Test Requirements Summary for WFS-${SESSION_ID}
|
||||
|
||||
## Analysis Data Sources
|
||||
- Git change analysis results
|
||||
- Implementation summaries and context
|
||||
- Gemini-generated test planning document
|
||||
|
||||
## Reference Documents
|
||||
- Detailed test plan: GEMINI_TEST_PLAN.md
|
||||
- Implementation context: IMPL-*-summary.md files
|
||||
|
||||
## Integration Note
|
||||
This document combines analysis data with Gemini-generated planning document for comprehensive test workflow generation.
|
||||
EOF
|
||||
```
|
||||
|
||||
### Step 9: Call Workflow Plan with Gemini Planning Document
|
||||
```bash
|
||||
/workflow:plan .workflow/WFS-${SESSION_ID}/.process/GEMINI_TEST_PLAN.md
|
||||
```
|
||||
|
||||
## Simple Bash Commands
|
||||
|
||||
### Basic Operations
|
||||
- **Find active session**: `find .workflow/ -name '.active-*'`
|
||||
- **Get git changes**: `git log --since='date' --name-only`
|
||||
- **Filter code files**: `grep -E '\.(js|ts|py)$'`
|
||||
- **Load summaries**: `cat .workflow/WFS-*/summaries/*.md`
|
||||
- **Extract JSON data**: `jq -r '.context.focus_paths[]'`
|
||||
- **Create directory**: `mkdir -p .workflow/session/.process`
|
||||
- **Write file**: `cat > file << 'EOF'`
|
||||
|
||||
### Gemini CLI Integration
|
||||
- **Planning command**: `~/.claude/scripts/gemini-wrapper -p "prompt" > GEMINI_TEST_PLAN.md`
|
||||
- **Context loading**: Include changed files and implementation context
|
||||
- **Document generation**: Creates comprehensive test planning document
|
||||
- **Direct handoff**: Pass Gemini planning document to workflow:plan
|
||||
|
||||
## No Complex Logic
|
||||
- No variables or functions
|
||||
- No conditional statements
|
||||
- No loops or complex pipes
|
||||
- Direct bash commands only
|
||||
- Gemini CLI for intelligent analysis
|
||||
✅ Initialize TodoWrite before any command
|
||||
✅ Execute Phase 1 immediately with session ID
|
||||
✅ Parse context package path from Phase 1 output
|
||||
✅ Pass session ID and context path to Phase 2 command
|
||||
✅ Verify ANALYSIS_RESULTS.md after Phase 2
|
||||
✅ Pass session ID to Phase 3 command
|
||||
✅ Verify all Phase 3 outputs (task JSON, IMPL_PLAN, TODO_LIST)
|
||||
✅ Pass session ID to Phase 4 command
|
||||
✅ Update TodoWrite after each phase
|
||||
✅ Return summary only after Phase 4 completes
|
||||
|
||||
## Related Commands
|
||||
- `/workflow:plan` - Called to generate test workflow
|
||||
- `/workflow:execute` - Executes generated test tasks
|
||||
- `/workflow:status` - Shows test workflow progress
|
||||
- `/workflow:plan` - Create implementation workflow (run before test-gen)
|
||||
- `/workflow:tools:context-gather` - Phase 1 tool for context collection
|
||||
- `/workflow:tools:concept-enhanced` - Phase 2 tool for analysis
|
||||
- `/workflow:tools:task-generate` - Phase 3 tool for task creation
|
||||
- `/workflow:execute` - Phase 4 workflow execution
|
||||
- `/workflow:status` - Check workflow progress
|
||||
- `@test-fix-agent` - Agent that executes and fixes tests
|
||||
|
||||
@@ -158,7 +158,7 @@ Task(
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@code-review-test-agent"
|
||||
"agent": "@code-developer|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
"context": {
|
||||
"requirements": ["extracted from analysis"],
|
||||
|
||||
@@ -95,6 +95,159 @@ For each feature, generate 3 tasks with ID format:
|
||||
- `meta.agent`: Agent for task execution
|
||||
- `meta.tdd_phase`: "red" | "green" | "refactor"
|
||||
|
||||
#### Task JSON Examples
|
||||
|
||||
**RED Phase - Test Task (TEST-1.1.json)**
|
||||
```json
|
||||
{
|
||||
"id": "TEST-1.1",
|
||||
"title": "Write failing test for user authentication",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "test",
|
||||
"agent": "@code-review-test-agent",
|
||||
"tdd_phase": "red"
|
||||
},
|
||||
"context": {
|
||||
"requirements": [
|
||||
"Write test case for login with valid credentials",
|
||||
"Test should fail with 'AuthService not implemented' error",
|
||||
"Include tests for invalid credentials and edge cases"
|
||||
],
|
||||
"focus_paths": ["tests/auth/login.test.ts"],
|
||||
"acceptance": [
|
||||
"Test file created with at least 3 test cases",
|
||||
"Test runs and fails with clear error message",
|
||||
"Test assertions define expected behavior"
|
||||
],
|
||||
"depends_on": []
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "check_test_framework",
|
||||
"action": "Verify test framework is configured",
|
||||
"command": "bash(npm list jest || npm list vitest)",
|
||||
"output_to": "test_framework_info",
|
||||
"on_error": "warn"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**GREEN Phase - Implementation Task (IMPL-1.1.json)**
|
||||
```json
|
||||
{
|
||||
"id": "IMPL-1.1",
|
||||
"title": "Implement user authentication to pass tests",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "feature",
|
||||
"agent": "@code-developer",
|
||||
"tdd_phase": "green"
|
||||
},
|
||||
"context": {
|
||||
"requirements": [
|
||||
"Implement minimal AuthService to pass TEST-1.1",
|
||||
"Handle valid and invalid credentials",
|
||||
"Return appropriate success/error responses"
|
||||
],
|
||||
"focus_paths": ["src/auth/AuthService.ts", "tests/auth/login.test.ts"],
|
||||
"acceptance": [
|
||||
"All tests in TEST-1.1 pass",
|
||||
"Implementation is minimal and focused",
|
||||
"No over-engineering or premature optimization"
|
||||
],
|
||||
"depends_on": ["TEST-1.1"]
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "load_test_requirements",
|
||||
"action": "Read test specifications from TEST phase",
|
||||
"command": "bash(cat .workflow/WFS-xxx/.summaries/TEST-1.1-summary.md)",
|
||||
"output_to": "test_requirements",
|
||||
"on_error": "fail"
|
||||
},
|
||||
{
|
||||
"step": "verify_tests_failing",
|
||||
"action": "Confirm tests are currently failing",
|
||||
"command": "bash(npm test -- tests/auth/login.test.ts || echo 'Tests failing as expected')",
|
||||
"output_to": "initial_test_status",
|
||||
"on_error": "warn"
|
||||
}
|
||||
],
|
||||
"post_completion": [
|
||||
{
|
||||
"step": "verify_tests_passing",
|
||||
"action": "Confirm all tests now pass",
|
||||
"command": "bash(npm test -- tests/auth/login.test.ts)",
|
||||
"output_to": "final_test_status",
|
||||
"on_error": "fail"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**REFACTOR Phase - Refactoring Task (REFACTOR-1.1.json)**
|
||||
```json
|
||||
{
|
||||
"id": "REFACTOR-1.1",
|
||||
"title": "Refactor authentication implementation",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "refactor",
|
||||
"agent": "@code-developer",
|
||||
"tdd_phase": "refactor"
|
||||
},
|
||||
"context": {
|
||||
"requirements": [
|
||||
"Improve code quality while keeping tests green",
|
||||
"Remove duplication in credential validation",
|
||||
"Improve error handling and logging",
|
||||
"Enhance code readability and maintainability"
|
||||
],
|
||||
"focus_paths": ["src/auth/AuthService.ts", "tests/auth/login.test.ts"],
|
||||
"acceptance": [
|
||||
"Code quality improved (complexity, readability)",
|
||||
"All tests still pass after refactoring",
|
||||
"No new functionality added",
|
||||
"Duplication eliminated"
|
||||
],
|
||||
"depends_on": ["IMPL-1.1"]
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "verify_tests_passing",
|
||||
"action": "Run tests to confirm green state before refactoring",
|
||||
"command": "bash(npm test -- tests/auth/login.test.ts)",
|
||||
"output_to": "test_status",
|
||||
"on_error": "fail"
|
||||
},
|
||||
{
|
||||
"step": "analyze_code_quality",
|
||||
"action": "Run linter and complexity analysis",
|
||||
"command": "bash(npm run lint src/auth/AuthService.ts)",
|
||||
"output_to": "quality_metrics",
|
||||
"on_error": "warn"
|
||||
}
|
||||
],
|
||||
"post_completion": [
|
||||
{
|
||||
"step": "verify_tests_still_passing",
|
||||
"action": "Confirm tests remain green after refactoring",
|
||||
"command": "bash(npm test -- tests/auth/login.test.ts)",
|
||||
"output_to": "final_test_status",
|
||||
"on_error": "fail"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 4: TDD_PLAN.md Generation
|
||||
|
||||
Generate TDD-specific plan with:
|
||||
|
||||
@@ -67,8 +67,8 @@ Generate task JSON files and IMPL_PLAN.md from analysis results with automatic a
|
||||
"title": "Descriptive task name",
|
||||
"status": "pending|active|completed|blocked|container",
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@planning-agent|@code-review-test-agent"
|
||||
"type": "feature|bugfix|refactor|test-gen|test-fix|docs",
|
||||
"agent": "@code-developer|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
"context": {
|
||||
"requirements": ["Clear requirement from analysis"],
|
||||
|
||||
Binary file not shown.
@@ -1,580 +0,0 @@
|
||||
# TDD Workflow Implementation Roadmap
|
||||
|
||||
## Overview
|
||||
This roadmap outlines the implementation steps for the TDD workflow system, organized by priority and dependencies.
|
||||
|
||||
## Phase 1: Core TDD Task Generation (Foundation)
|
||||
|
||||
### Priority: HIGH
|
||||
### Dependencies: None
|
||||
### Estimated Effort: Medium
|
||||
|
||||
#### 1.1 Create task-generate-tdd Command
|
||||
**File**: `.claude/commands/workflow/tools/task-generate-tdd.md`
|
||||
|
||||
**Implementation Steps**:
|
||||
1. Copy structure from `task-generate.md`
|
||||
2. Add TDD-specific Gemini prompt for task breakdown
|
||||
3. Implement Red-Green-Refactor task chain generation logic
|
||||
4. Add `meta.tdd_phase` field to task JSONs
|
||||
5. Implement dependency enforcement (TEST → IMPL → REFACTOR)
|
||||
6. Generate TDD_PLAN.md alongside IMPL_PLAN.md
|
||||
|
||||
**Key Features**:
|
||||
- Gemini-based TDD task analysis
|
||||
- Automatic chain creation for each feature
|
||||
- Validation of TDD structure
|
||||
- Support for both manual and agent modes
|
||||
|
||||
**Testing**:
|
||||
- Test with single feature
|
||||
- Test with multiple features
|
||||
- Verify dependency chains
|
||||
- Validate JSON schema compliance
|
||||
|
||||
---
|
||||
|
||||
## Phase 2: TDD Planning Orchestrator
|
||||
|
||||
### Priority: HIGH
|
||||
### Dependencies: Phase 1
|
||||
### Estimated Effort: Medium
|
||||
|
||||
#### 2.1 Create tdd-plan Command
|
||||
**File**: `.claude/commands/workflow/tdd-plan.md`
|
||||
|
||||
**Implementation Steps**:
|
||||
1. Copy orchestrator pattern from `plan.md`
|
||||
2. Modify Phase 4 to call `task-generate-tdd` instead of `task-generate`
|
||||
3. Add Phase 5 for TDD structure validation
|
||||
4. Update structured input format to include TEST_FOCUS
|
||||
5. Customize TodoWrite pattern for TDD phases
|
||||
6. Design TDD-specific output summary
|
||||
|
||||
**Key Features**:
|
||||
- 5-phase orchestration (adds validation phase)
|
||||
- Reuses existing session:start, context-gather, concept-enhanced
|
||||
- TDD-specific task generation in Phase 4
|
||||
- Structure validation in Phase 5
|
||||
- Clear TDD chain summary in output
|
||||
|
||||
**Testing**:
|
||||
- End-to-end TDD workflow creation
|
||||
- Verify all phases execute correctly
|
||||
- Validate generated task structure
|
||||
- Test with different input formats
|
||||
|
||||
---
|
||||
|
||||
## Phase 3: TDD Coverage Analysis Tool
|
||||
|
||||
### Priority: MEDIUM
|
||||
### Dependencies: Phase 1
|
||||
### Estimated Effort: Small
|
||||
|
||||
#### 3.1 Create tdd-coverage-analysis Command
|
||||
**File**: `.claude/commands/workflow/tools/tdd-coverage-analysis.md`
|
||||
|
||||
**Implementation Steps**:
|
||||
1. Create command specification
|
||||
2. Implement test task extraction logic
|
||||
3. Add test execution wrapper
|
||||
4. Implement coverage data parsing
|
||||
5. Add TDD cycle verification logic
|
||||
6. Generate analysis report
|
||||
|
||||
**Key Features**:
|
||||
- Extract test files from TEST tasks
|
||||
- Run test suite with coverage
|
||||
- Verify Red-Green-Refactor cycle
|
||||
- Generate coverage metrics
|
||||
- Identify gaps in TDD process
|
||||
|
||||
**Testing**:
|
||||
- Test with completed TDD workflow
|
||||
- Verify coverage data accuracy
|
||||
- Test cycle verification logic
|
||||
- Validate report generation
|
||||
|
||||
---
|
||||
|
||||
## Phase 4: TDD Verification Orchestrator
|
||||
|
||||
### Priority: MEDIUM
|
||||
### Dependencies: Phase 1, Phase 3
|
||||
### Estimated Effort: Medium
|
||||
|
||||
#### 4.1 Create tdd-verify Command
|
||||
**File**: `.claude/commands/workflow/tdd-verify.md`
|
||||
|
||||
**Implementation Steps**:
|
||||
1. Create 4-phase orchestrator structure
|
||||
2. Implement session discovery logic
|
||||
3. Add task chain validation
|
||||
4. Integrate tdd-coverage-analysis
|
||||
5. Add Gemini compliance report generation
|
||||
6. Design verification output summary
|
||||
|
||||
**Key Features**:
|
||||
- Automatic session detection
|
||||
- Task chain structure validation
|
||||
- Test execution analysis
|
||||
- Compliance scoring
|
||||
- Detailed quality recommendations
|
||||
- Clear verification summary
|
||||
|
||||
**Testing**:
|
||||
- Test with complete TDD workflow
|
||||
- Test with incomplete workflow
|
||||
- Verify compliance scoring
|
||||
- Test report generation
|
||||
|
||||
---
|
||||
|
||||
## Phase 5: TDD Templates and Documentation
|
||||
|
||||
### Priority: MEDIUM
|
||||
### Dependencies: Phases 1-4
|
||||
### Estimated Effort: Small
|
||||
|
||||
#### 5.1 Create TDD Prompt Templates
|
||||
**Files**:
|
||||
- `.claude/workflows/cli-templates/prompts/development/tdd-test.txt`
|
||||
- `.claude/workflows/cli-templates/prompts/development/tdd-impl.txt`
|
||||
- `.claude/workflows/cli-templates/prompts/development/tdd-refactor.txt`
|
||||
|
||||
**Implementation Steps**:
|
||||
1. Design test-writing template (Red phase)
|
||||
2. Design implementation template (Green phase)
|
||||
3. Design refactoring template (Refactor phase)
|
||||
4. Include TDD best practices
|
||||
5. Add specific acceptance criteria
|
||||
|
||||
**Key Features**:
|
||||
- Phase-specific guidance
|
||||
- TDD best practices embedded
|
||||
- Clear acceptance criteria
|
||||
- Agent-friendly format
|
||||
|
||||
#### 5.2 Update Core Documentation
|
||||
**Files to Update**:
|
||||
- `.claude/workflows/workflow-architecture.md`
|
||||
- `.claude/workflows/task-core.md`
|
||||
- `README.md`
|
||||
|
||||
**Updates Required**:
|
||||
1. Add TDD workflow section to architecture
|
||||
2. Document `meta.tdd_phase` field in task-core
|
||||
3. Add TDD usage examples to README
|
||||
4. Create TDD workflow diagram
|
||||
5. Add troubleshooting guide
|
||||
|
||||
---
|
||||
|
||||
## Phase 6: Integration and Polish
|
||||
|
||||
### Priority: LOW
|
||||
### Dependencies: Phases 1-5
|
||||
### Estimated Effort: Small
|
||||
|
||||
#### 6.1 Command Registry Updates
|
||||
**Files**:
|
||||
- `.claude/commands.json` (if exists)
|
||||
- Slash command documentation
|
||||
|
||||
**Updates**:
|
||||
1. Register new commands
|
||||
2. Update command help text
|
||||
3. Add command shortcuts
|
||||
4. Update command examples
|
||||
|
||||
#### 6.2 Testing and Validation
|
||||
**Activities**:
|
||||
1. End-to-end integration testing
|
||||
2. Performance testing
|
||||
3. Error handling validation
|
||||
4. Documentation review
|
||||
5. User acceptance testing
|
||||
|
||||
---
|
||||
|
||||
## Implementation Priority Matrix
|
||||
|
||||
```
|
||||
Priority | Phase | Component | Effort | Dependencies
|
||||
---------|-------|------------------------------|--------|-------------
|
||||
HIGH | 1 | task-generate-tdd | Medium | None
|
||||
HIGH | 2 | tdd-plan | Medium | Phase 1
|
||||
MEDIUM | 3 | tdd-coverage-analysis | Small | Phase 1
|
||||
MEDIUM | 4 | tdd-verify | Medium | Phase 1, 3
|
||||
MEDIUM | 5 | Templates & Documentation | Small | Phase 1-4
|
||||
LOW | 6 | Integration & Polish | Small | Phase 1-5
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Detailed Component Specifications
|
||||
|
||||
### Component 1: task-generate-tdd
|
||||
|
||||
**Inputs**:
|
||||
- `--session <sessionId>`: Required session identifier
|
||||
- `--agent`: Optional flag for agent mode
|
||||
- ANALYSIS_RESULTS.md from session
|
||||
|
||||
**Outputs**:
|
||||
- `TDD_PLAN.md`: TDD-specific implementation plan
|
||||
- `IMPL_PLAN.md`: Standard implementation plan
|
||||
- `TODO_LIST.md`: Task list with TDD phases
|
||||
- `.task/TEST-*.json`: Test task files
|
||||
- `.task/IMPL-*.json`: Implementation task files
|
||||
- `.task/REFACTOR-*.json`: Refactoring task files
|
||||
|
||||
**Core Logic**:
|
||||
```
|
||||
1. Load ANALYSIS_RESULTS.md
|
||||
2. Call Gemini to identify features and create TDD breakdown
|
||||
3. For each feature:
|
||||
a. Create TEST task (Red phase)
|
||||
b. Create IMPL task with depends_on TEST (Green phase)
|
||||
c. Create REFACTOR task with depends_on IMPL (Refactor phase)
|
||||
4. Validate chain structure
|
||||
5. Generate TDD_PLAN.md
|
||||
6. Generate IMPL_PLAN.md
|
||||
7. Generate TODO_LIST.md
|
||||
8. Return task count and chain summary
|
||||
```
|
||||
|
||||
**Gemini Prompt Structure**:
|
||||
```
|
||||
PURPOSE: Generate TDD task breakdown with Red-Green-Refactor chains
|
||||
TASK: Analyze ANALYSIS_RESULTS.md and create TDD-structured task breakdown
|
||||
CONTEXT: @{.workflow/[sessionId]/ANALYSIS_RESULTS.md}
|
||||
EXPECTED:
|
||||
- Feature list with testable requirements
|
||||
- Test cases for each feature (Red phase)
|
||||
- Implementation requirements (Green phase)
|
||||
- Refactoring opportunities (Refactor phase)
|
||||
- Task dependencies and execution order
|
||||
RULES: Each feature must have TEST → IMPL → REFACTOR chain. Output structured markdown.
|
||||
```
|
||||
|
||||
**Validation Rules**:
|
||||
- Each TEST task must have ID format `TEST-N.M`
|
||||
- Each IMPL task must have `depends_on: ["TEST-N.M"]`
|
||||
- Each REFACTOR task must have `depends_on: ["IMPL-N.M"]`
|
||||
- All tasks must have `meta.tdd_phase` field
|
||||
- Agent must be appropriate for phase
|
||||
|
||||
---
|
||||
|
||||
### Component 2: tdd-plan
|
||||
|
||||
**Inputs**:
|
||||
- `<input>`: Feature description, file path, or issue ID
|
||||
- `--agent`: Optional flag for agent mode
|
||||
|
||||
**Outputs**:
|
||||
- Session summary with TDD chain information
|
||||
- All standard workflow outputs
|
||||
- TDD_PLAN.md
|
||||
|
||||
**Phase Breakdown**:
|
||||
|
||||
**Phase 1: Session Discovery** (Reused)
|
||||
- Command: `/workflow:session:start --auto "TDD: ..."`
|
||||
- Extract: sessionId
|
||||
|
||||
**Phase 2: Context Gathering** (Reused)
|
||||
- Command: `/workflow:tools:context-gather --session sessionId ...`
|
||||
- Extract: contextPath
|
||||
|
||||
**Phase 3: TDD Analysis** (Reused)
|
||||
- Command: `/workflow:tools:concept-enhanced --session sessionId --context contextPath`
|
||||
- Extract: ANALYSIS_RESULTS.md
|
||||
|
||||
**Phase 4: TDD Task Generation** (New)
|
||||
- Command: `/workflow:tools:task-generate-tdd --session sessionId [--agent]`
|
||||
- Extract: Task count, chain count
|
||||
|
||||
**Phase 5: Structure Validation** (New)
|
||||
- Internal validation
|
||||
- Verify chain completeness
|
||||
- Verify dependencies
|
||||
- Extract: Validation status
|
||||
|
||||
**TodoWrite Pattern**:
|
||||
```javascript
|
||||
// Initialize
|
||||
[
|
||||
{content: "Execute session discovery", status: "in_progress", activeForm: "Executing session discovery"},
|
||||
{content: "Execute context gathering", status: "pending", activeForm: "Executing context gathering"},
|
||||
{content: "Execute TDD analysis", status: "pending", activeForm: "Executing TDD analysis"},
|
||||
{content: "Execute TDD task generation", status: "pending", activeForm: "Executing TDD task generation"},
|
||||
{content: "Validate TDD structure", status: "pending", activeForm: "Validating TDD structure"}
|
||||
]
|
||||
|
||||
// After each phase, update one to "completed", next to "in_progress"
|
||||
```
|
||||
|
||||
**Output Template**:
|
||||
```
|
||||
TDD Planning complete for session: {sessionId}
|
||||
|
||||
Features analyzed: {count}
|
||||
TDD chains generated: {count}
|
||||
Total tasks: {count}
|
||||
|
||||
Structure:
|
||||
- {Feature 1}: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1
|
||||
- {Feature 2}: TEST-2.1 → IMPL-2.1 → REFACTOR-2.1
|
||||
|
||||
Plans:
|
||||
- Implementation: .workflow/{sessionId}/IMPL_PLAN.md
|
||||
- TDD Structure: .workflow/{sessionId}/TDD_PLAN.md
|
||||
|
||||
Next: /workflow:execute or /workflow:tdd-verify
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Component 3: tdd-coverage-analysis
|
||||
|
||||
**Inputs**:
|
||||
- `--session <sessionId>`: Required session identifier
|
||||
|
||||
**Outputs**:
|
||||
- `.process/test-results.json`: Test execution results
|
||||
- `.process/coverage-report.json`: Coverage metrics
|
||||
- `.process/tdd-cycle-report.md`: TDD cycle verification
|
||||
|
||||
**Core Logic**:
|
||||
```
|
||||
1. Extract all TEST tasks from session
|
||||
2. Identify test files from focus_paths
|
||||
3. Run test suite with coverage
|
||||
4. Parse coverage data
|
||||
5. For each TDD chain:
|
||||
a. Verify TEST task created tests
|
||||
b. Verify IMPL task made tests pass
|
||||
c. Verify REFACTOR task maintained green tests
|
||||
6. Generate cycle verification report
|
||||
7. Return coverage metrics and cycle status
|
||||
```
|
||||
|
||||
**Test Execution**:
|
||||
```bash
|
||||
npm test -- --coverage --json > .process/test-results.json
|
||||
# or
|
||||
pytest --cov --json-report > .process/test-results.json
|
||||
```
|
||||
|
||||
**Cycle Verification Algorithm**:
|
||||
```
|
||||
For each chain (TEST-N.M, IMPL-N.M, REFACTOR-N.M):
|
||||
1. Read TEST-N.M-summary.md
|
||||
- Check: Tests were created
|
||||
- Check: Tests failed initially
|
||||
|
||||
2. Read IMPL-N.M-summary.md
|
||||
- Check: Implementation was completed
|
||||
- Check: Tests now pass
|
||||
|
||||
3. Read REFACTOR-N.M-summary.md
|
||||
- Check: Refactoring was completed
|
||||
- Check: Tests still pass
|
||||
|
||||
If all checks pass: Chain is valid
|
||||
Else: Report missing steps
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Component 4: tdd-verify
|
||||
|
||||
**Inputs**:
|
||||
- `[session-id]`: Optional session ID (auto-detect if not provided)
|
||||
|
||||
**Outputs**:
|
||||
- Verification summary
|
||||
- TDD_COMPLIANCE_REPORT.md
|
||||
|
||||
**Phase Breakdown**:
|
||||
|
||||
**Phase 1: Session Discovery**
|
||||
```bash
|
||||
# If session-id provided
|
||||
sessionId = argument
|
||||
|
||||
# Else auto-detect
|
||||
sessionId = $(find .workflow/ -name '.active-*' | head -1 | sed 's/.*active-//')
|
||||
```
|
||||
|
||||
**Phase 2: Task Chain Validation**
|
||||
```bash
|
||||
# Load all task JSONs
|
||||
tasks=$(find .workflow/${sessionId}/.task/ -name '*.json')
|
||||
|
||||
# For each TDD chain
|
||||
for feature in features:
|
||||
verify_chain_exists(TEST-N.M, IMPL-N.M, REFACTOR-N.M)
|
||||
verify_dependencies(IMPL depends_on TEST, REFACTOR depends_on IMPL)
|
||||
verify_meta_fields(tdd_phase, agent)
|
||||
```
|
||||
|
||||
**Phase 3: Test Execution Analysis**
|
||||
```bash
|
||||
/workflow:tools:tdd-coverage-analysis --session ${sessionId}
|
||||
```
|
||||
|
||||
**Phase 4: Compliance Report**
|
||||
```bash
|
||||
cd project-root && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Generate TDD compliance report
|
||||
TASK: Analyze TDD workflow execution and generate quality report
|
||||
CONTEXT: @{.workflow/${sessionId}/.task/*.json,.workflow/${sessionId}/.summaries/*}
|
||||
EXPECTED:
|
||||
- TDD compliance score
|
||||
- Chain completeness verification
|
||||
- Test coverage analysis
|
||||
- Quality recommendations
|
||||
- Red-Green-Refactor cycle validation
|
||||
RULES: Focus on TDD best practices and workflow adherence
|
||||
" > .workflow/${sessionId}/TDD_COMPLIANCE_REPORT.md
|
||||
```
|
||||
|
||||
**Output Template**:
|
||||
```
|
||||
TDD Verification Report - Session: {sessionId}
|
||||
|
||||
## Chain Validation
|
||||
{status} Feature 1: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1 ({status})
|
||||
{status} Feature 2: TEST-2.1 → IMPL-2.1 → REFACTOR-2.1 ({status})
|
||||
|
||||
## Test Execution
|
||||
{status} All TEST tasks produced failing tests
|
||||
{status} All IMPL tasks made tests pass
|
||||
{status} All REFACTOR tasks maintained green tests
|
||||
|
||||
## Compliance Score: {score}/100
|
||||
|
||||
Detailed report: .workflow/{sessionId}/TDD_COMPLIANCE_REPORT.md
|
||||
|
||||
Recommendations:
|
||||
{recommendations}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## File Structure Reference
|
||||
|
||||
```
|
||||
.workflow/
|
||||
└── WFS-{session-id}/
|
||||
├── ANALYSIS_RESULTS.md # From concept-enhanced
|
||||
├── IMPL_PLAN.md # Standard plan
|
||||
├── TDD_PLAN.md # TDD-specific plan ⭐ NEW
|
||||
├── TODO_LIST.md # With TDD phase markers
|
||||
├── TDD_COMPLIANCE_REPORT.md # From tdd-verify ⭐ NEW
|
||||
│
|
||||
├── .task/
|
||||
│ ├── TEST-1.1.json # Red phase ⭐ NEW
|
||||
│ ├── IMPL-1.1.json # Green phase (enhanced)
|
||||
│ ├── REFACTOR-1.1.json # Refactor phase ⭐ NEW
|
||||
│ └── ...
|
||||
│
|
||||
├── .summaries/
|
||||
│ ├── TEST-1.1-summary.md # Test task summary
|
||||
│ ├── IMPL-1.1-summary.md # Implementation summary
|
||||
│ ├── REFACTOR-1.1-summary.md # Refactor summary
|
||||
│ └── ...
|
||||
│
|
||||
└── .process/
|
||||
├── TDD_TASK_BREAKDOWN.md # Gemini breakdown ⭐ NEW
|
||||
├── test-results.json # Test execution ⭐ NEW
|
||||
├── coverage-report.json # Coverage data ⭐ NEW
|
||||
└── tdd-cycle-report.md # Cycle verification ⭐ NEW
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Implementation Order
|
||||
|
||||
### Week 1: Foundation
|
||||
1. Create `task-generate-tdd.md` specification
|
||||
2. Implement Gemini TDD breakdown logic
|
||||
3. Implement task JSON generation with TDD chains
|
||||
4. Test with simple single-feature workflow
|
||||
|
||||
### Week 2: Orchestration
|
||||
1. Create `tdd-plan.md` specification
|
||||
2. Implement 5-phase orchestrator
|
||||
3. Integrate with task-generate-tdd
|
||||
4. End-to-end testing
|
||||
|
||||
### Week 3: Verification
|
||||
1. Create `tdd-coverage-analysis.md` specification
|
||||
2. Implement test execution and cycle verification
|
||||
3. Create `tdd-verify.md` specification
|
||||
4. Implement verification orchestrator
|
||||
5. Integration testing
|
||||
|
||||
### Week 4: Polish
|
||||
1. Create TDD prompt templates
|
||||
2. Update documentation
|
||||
3. Create usage examples
|
||||
4. Final integration testing
|
||||
5. User acceptance testing
|
||||
|
||||
---
|
||||
|
||||
## Success Criteria
|
||||
|
||||
### Functional Requirements
|
||||
- [ ] TDD workflows can be created from feature descriptions
|
||||
- [ ] Task chains enforce Red-Green-Refactor order
|
||||
- [ ] Dependencies prevent out-of-order execution
|
||||
- [ ] Verification detects non-compliance
|
||||
- [ ] Coverage analysis integrates with test tools
|
||||
- [ ] Reports provide actionable insights
|
||||
|
||||
### Quality Requirements
|
||||
- [ ] Commands follow existing architectural patterns
|
||||
- [ ] Error handling is robust
|
||||
- [ ] Documentation is complete
|
||||
- [ ] Examples demonstrate common use cases
|
||||
- [ ] Integration with existing workflow is seamless
|
||||
|
||||
### Performance Requirements
|
||||
- [ ] TDD planning completes within 2 minutes
|
||||
- [ ] Verification completes within 1 minute
|
||||
- [ ] Gemini analysis stays within token limits
|
||||
- [ ] Test execution doesn't timeout
|
||||
|
||||
---
|
||||
|
||||
## Risk Mitigation
|
||||
|
||||
### Risk 1: Test Framework Integration
|
||||
**Mitigation**: Support multiple test frameworks (npm test, pytest, etc.) with configurable commands
|
||||
|
||||
### Risk 2: Gemini Token Limits
|
||||
**Mitigation**: Use focused context in prompts, paginate large analysis
|
||||
|
||||
### Risk 3: Complex Dependencies
|
||||
**Mitigation**: Thorough validation logic, clear error messages
|
||||
|
||||
### Risk 4: User Adoption
|
||||
**Mitigation**: Clear documentation, simple examples, gradual rollout
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Review Design**: Get feedback on architecture and specifications
|
||||
2. **Create Prototype**: Implement Phase 1 (task-generate-tdd) as proof of concept
|
||||
3. **Test Prototype**: Validate with real-world TDD workflow
|
||||
4. **Iterate**: Refine based on testing feedback
|
||||
5. **Full Implementation**: Complete remaining phases
|
||||
6. **Documentation**: Create user guides and examples
|
||||
7. **Release**: Roll out to users with migration guide
|
||||
@@ -1,617 +0,0 @@
|
||||
# TDD Workflow Design Specification
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The TDD workflow introduces a specialized planning and verification system that enforces Test-Driven Development principles through the existing workflow architecture. It follows the same orchestrator pattern as `/workflow:plan` but generates TDD-specific task chains.
|
||||
|
||||
## Command Structure
|
||||
|
||||
### Primary Commands (Orchestrators)
|
||||
- `/workflow:tdd-plan` - TDD workflow planning orchestrator
|
||||
- `/workflow:tdd-verify` - TDD compliance verification orchestrator
|
||||
|
||||
### Tool Commands (Executors)
|
||||
- `/workflow:tools:task-generate-tdd` - TDD-specific task generator
|
||||
- `/workflow:tools:tdd-coverage-analysis` - Test coverage analyzer
|
||||
|
||||
---
|
||||
|
||||
## 1. /workflow:tdd-plan Command
|
||||
|
||||
### Purpose
|
||||
Orchestrate TDD-specific workflow planning that generates Red-Green-Refactor task chains with enforced dependencies.
|
||||
|
||||
### Command Specification
|
||||
|
||||
```yaml
|
||||
name: tdd-plan
|
||||
description: Orchestrate TDD workflow planning with Red-Green-Refactor task chains
|
||||
usage: /workflow:tdd-plan [--agent] <input>
|
||||
argument-hint: "[--agent] \"feature description\"|file.md|ISS-001"
|
||||
examples:
|
||||
- /workflow:tdd-plan "Implement user authentication"
|
||||
- /workflow:tdd-plan --agent requirements.md
|
||||
- /workflow:tdd-plan ISS-001
|
||||
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
||||
```
|
||||
|
||||
### Execution Flow (5 Phases)
|
||||
|
||||
**Phase 1: Session Discovery**
|
||||
```bash
|
||||
/workflow:session:start --auto "TDD: [structured-description]"
|
||||
```
|
||||
- Extract: `sessionId` (WFS-xxx)
|
||||
- Validation: Session directory created
|
||||
|
||||
**Phase 2: Context Gathering**
|
||||
```bash
|
||||
/workflow:tools:context-gather --session [sessionId] "TDD: [structured-description]"
|
||||
```
|
||||
- Extract: `contextPath` (context-package.json)
|
||||
- Validation: Context package exists
|
||||
|
||||
**Phase 3: TDD Analysis**
|
||||
```bash
|
||||
/workflow:tools:concept-enhanced --session [sessionId] --context [contextPath]
|
||||
```
|
||||
- Extract: ANALYSIS_RESULTS.md
|
||||
- Validation: Contains TDD-specific recommendations
|
||||
|
||||
**Phase 4: TDD Task Generation**
|
||||
```bash
|
||||
# Manual mode (default)
|
||||
/workflow:tools:task-generate-tdd --session [sessionId]
|
||||
|
||||
# Agent mode
|
||||
/workflow:tools:task-generate-tdd --session [sessionId] --agent
|
||||
```
|
||||
- Extract: Task count, TDD chain count
|
||||
- Validation:
|
||||
- IMPL_PLAN.md exists
|
||||
- TDD_PLAN.md exists (TDD-specific plan)
|
||||
- Task JSONs follow Red-Green-Refactor pattern
|
||||
- Dependencies correctly enforced
|
||||
|
||||
**Phase 5: TDD Structure Validation**
|
||||
```bash
|
||||
# Internal validation step (no separate command call)
|
||||
# Verify task chain structure:
|
||||
# - Each feature has TEST → IMPL → REFACTOR sequence
|
||||
# - Dependencies are correctly set
|
||||
# - Meta.type fields are appropriate
|
||||
```
|
||||
- Extract: Validation report
|
||||
- Validation: All TDD chains valid
|
||||
|
||||
### Structured Input Format
|
||||
|
||||
```
|
||||
TDD: [feature-name]
|
||||
GOAL: [Clear objective]
|
||||
SCOPE: [What to test and implement]
|
||||
CONTEXT: [Relevant background]
|
||||
TEST_FOCUS: [Critical test scenarios]
|
||||
```
|
||||
|
||||
### TDD-Specific TodoWrite Pattern
|
||||
|
||||
```javascript
|
||||
TodoWrite({todos: [
|
||||
{"content": "Execute session discovery", "status": "in_progress", "activeForm": "Executing session discovery"},
|
||||
{"content": "Execute context gathering", "status": "pending", "activeForm": "Executing context gathering"},
|
||||
{"content": "Execute TDD analysis", "status": "pending", "activeForm": "Executing TDD analysis"},
|
||||
{"content": "Execute TDD task generation", "status": "pending", "activeForm": "Executing TDD task generation"},
|
||||
{"content": "Validate TDD structure", "status": "pending", "activeForm": "Validating TDD structure"}
|
||||
]})
|
||||
```
|
||||
|
||||
### Output Structure
|
||||
|
||||
```
|
||||
TDD Planning complete for session: [sessionId]
|
||||
|
||||
Features analyzed: [count]
|
||||
TDD chains generated: [count]
|
||||
Total tasks: [count]
|
||||
|
||||
Structure:
|
||||
- [Feature 1]: TEST-1 → IMPL-1 → REFACTOR-1
|
||||
- [Feature 2]: TEST-2 → IMPL-2 → REFACTOR-2
|
||||
|
||||
Plans:
|
||||
- Implementation: .workflow/[sessionId]/IMPL_PLAN.md
|
||||
- TDD Structure: .workflow/[sessionId]/TDD_PLAN.md
|
||||
|
||||
Next: /workflow:execute or /workflow:tdd-verify
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. /workflow:tools:task-generate-tdd Command
|
||||
|
||||
### Purpose
|
||||
Generate TDD-specific task chains from ANALYSIS_RESULTS.md with enforced Red-Green-Refactor structure.
|
||||
|
||||
### Command Specification
|
||||
|
||||
```yaml
|
||||
name: task-generate-tdd
|
||||
description: Generate TDD task chains with Red-Green-Refactor dependencies
|
||||
usage: /workflow:tools:task-generate-tdd --session <session-id> [--agent]
|
||||
argument-hint: "--session WFS-xxx [--agent]"
|
||||
examples:
|
||||
- /workflow:tools:task-generate-tdd --session WFS-auth
|
||||
- /workflow:tools:task-generate-tdd --session WFS-auth --agent
|
||||
allowed-tools: Read(*), Write(*), Bash(gemini-wrapper:*)
|
||||
```
|
||||
|
||||
### Implementation Flow
|
||||
|
||||
**Step 1: Load Analysis**
|
||||
```bash
|
||||
cat .workflow/[sessionId]/ANALYSIS_RESULTS.md
|
||||
```
|
||||
|
||||
**Step 2: Gemini TDD Task Planning**
|
||||
```bash
|
||||
cd project-root && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Generate TDD task breakdown with Red-Green-Refactor chains
|
||||
TASK: Analyze ANALYSIS_RESULTS.md and create TDD-structured task breakdown
|
||||
CONTEXT: @{.workflow/[sessionId]/ANALYSIS_RESULTS.md}
|
||||
EXPECTED:
|
||||
- Feature list with testable requirements
|
||||
- Test cases for each feature (Red phase)
|
||||
- Implementation requirements (Green phase)
|
||||
- Refactoring opportunities (Refactor phase)
|
||||
- Task dependencies and execution order
|
||||
RULES: Each feature must have TEST → IMPL → REFACTOR chain. Output structured markdown for task generation.
|
||||
" > .workflow/[sessionId]/.process/TDD_TASK_BREAKDOWN.md
|
||||
```
|
||||
|
||||
**Step 3: Generate Task JSONs**
|
||||
|
||||
For each feature identified:
|
||||
|
||||
```json
|
||||
// TEST Phase (Red)
|
||||
{
|
||||
"id": "TEST-1.1",
|
||||
"title": "Write failing test for [feature]",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "test",
|
||||
"agent": "@code-review-test-agent",
|
||||
"tdd_phase": "red"
|
||||
},
|
||||
"context": {
|
||||
"requirements": ["Write test case that fails", "Test should define expected behavior"],
|
||||
"focus_paths": ["tests/[feature]"],
|
||||
"acceptance": ["Test written and fails with clear error message"],
|
||||
"depends_on": []
|
||||
}
|
||||
}
|
||||
|
||||
// IMPL Phase (Green)
|
||||
{
|
||||
"id": "IMPL-1.1",
|
||||
"title": "Implement [feature] to pass tests",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "feature",
|
||||
"agent": "@code-developer",
|
||||
"tdd_phase": "green"
|
||||
},
|
||||
"context": {
|
||||
"requirements": ["Implement minimal code to pass TEST-1.1"],
|
||||
"focus_paths": ["src/[feature]", "tests/[feature]"],
|
||||
"acceptance": ["All tests in TEST-1.1 pass"],
|
||||
"depends_on": ["TEST-1.1"]
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "load_test_requirements",
|
||||
"action": "Read test specifications from TEST phase",
|
||||
"command": "bash(cat .workflow/[sessionId]/.summaries/TEST-1.1-summary.md)",
|
||||
"output_to": "test_requirements",
|
||||
"on_error": "fail"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// REFACTOR Phase
|
||||
{
|
||||
"id": "REFACTOR-1.1",
|
||||
"title": "Refactor [feature] implementation",
|
||||
"status": "pending",
|
||||
"meta": {
|
||||
"type": "refactor",
|
||||
"agent": "@code-developer",
|
||||
"tdd_phase": "refactor"
|
||||
},
|
||||
"context": {
|
||||
"requirements": ["Improve code quality while keeping tests green", "Remove duplication", "Improve readability"],
|
||||
"focus_paths": ["src/[feature]", "tests/[feature]"],
|
||||
"acceptance": ["Code improved", "All tests still pass"],
|
||||
"depends_on": ["IMPL-1.1"]
|
||||
},
|
||||
"flow_control": {
|
||||
"pre_analysis": [
|
||||
{
|
||||
"step": "verify_tests_passing",
|
||||
"action": "Run tests to confirm green state before refactoring",
|
||||
"command": "bash(npm test -- tests/[feature])",
|
||||
"output_to": "test_status",
|
||||
"on_error": "fail"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Step 4: Generate TDD_PLAN.md**
|
||||
|
||||
```markdown
|
||||
# TDD Implementation Plan - [Session ID]
|
||||
|
||||
## Features and Test Chains
|
||||
|
||||
### Feature 1: [Feature Name]
|
||||
**TDD Chain**: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1
|
||||
|
||||
**Red Phase (TEST-1.1)**
|
||||
- Write failing test for [specific behavior]
|
||||
- Test assertions: [list]
|
||||
|
||||
**Green Phase (IMPL-1.1)**
|
||||
- Implement minimal solution
|
||||
- Dependencies: TEST-1.1 must fail first
|
||||
|
||||
**Refactor Phase (REFACTOR-1.1)**
|
||||
- Improve: [specific improvements]
|
||||
- Constraint: All tests must remain green
|
||||
|
||||
[Repeat for each feature]
|
||||
|
||||
## Execution Order
|
||||
1. TEST-1.1 → IMPL-1.1 → REFACTOR-1.1
|
||||
2. TEST-2.1 → IMPL-2.1 → REFACTOR-2.1
|
||||
...
|
||||
|
||||
## TDD Compliance Checkpoints
|
||||
- [ ] Each feature starts with failing test
|
||||
- [ ] Implementation passes all tests
|
||||
- [ ] Refactoring maintains green tests
|
||||
- [ ] No implementation before tests
|
||||
```
|
||||
|
||||
**Step 5: Generate TODO_LIST.md**
|
||||
|
||||
Standard todo list with TDD phase indicators:
|
||||
|
||||
```markdown
|
||||
## Pending Tasks
|
||||
- [ ] TEST-1.1: Write failing test for [feature] (RED)
|
||||
- [ ] IMPL-1.1: Implement [feature] to pass tests (GREEN) [depends: TEST-1.1]
|
||||
- [ ] REFACTOR-1.1: Refactor [feature] implementation (REFACTOR) [depends: IMPL-1.1]
|
||||
```
|
||||
|
||||
### Validation Rules
|
||||
|
||||
1. **Chain Completeness**: Every TEST task must have corresponding IMPL and REFACTOR tasks
|
||||
2. **Dependency Enforcement**:
|
||||
- IMPL depends_on TEST
|
||||
- REFACTOR depends_on IMPL
|
||||
3. **Agent Assignment**:
|
||||
- TEST tasks → `@code-review-test-agent`
|
||||
- IMPL/REFACTOR tasks → `@code-developer`
|
||||
4. **Meta Fields**:
|
||||
- `meta.tdd_phase` must be "red", "green", or "refactor"
|
||||
- `meta.type` must align with phase
|
||||
|
||||
---
|
||||
|
||||
## 3. /workflow:tdd-verify Command
|
||||
|
||||
### Purpose
|
||||
Verify TDD workflow compliance, test coverage, and Red-Green-Refactor cycle execution.
|
||||
|
||||
### Command Specification
|
||||
|
||||
```yaml
|
||||
name: tdd-verify
|
||||
description: Verify TDD workflow compliance and generate quality report
|
||||
usage: /workflow:tdd-verify [session-id]
|
||||
argument-hint: "[WFS-session-id]"
|
||||
examples:
|
||||
- /workflow:tdd-verify
|
||||
- /workflow:tdd-verify WFS-auth
|
||||
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
||||
```
|
||||
|
||||
### Execution Flow (4 Phases)
|
||||
|
||||
**Phase 1: Session Discovery**
|
||||
```bash
|
||||
# Auto-detect or use provided session
|
||||
find .workflow/ -name '.active-*' | head -1 | sed 's/.*active-//'
|
||||
```
|
||||
- Extract: `sessionId`
|
||||
|
||||
**Phase 2: Task Chain Validation**
|
||||
```bash
|
||||
# Bash script to validate TDD structure
|
||||
find .workflow/[sessionId]/.task/ -name '*.json' -exec jq -r '.meta.tdd_phase' {} \;
|
||||
```
|
||||
- Verify: TEST → IMPL → REFACTOR chains exist
|
||||
- Verify: Dependencies are correct
|
||||
- Extract: Chain validation report
|
||||
|
||||
**Phase 3: Test Execution Analysis**
|
||||
```bash
|
||||
/workflow:tools:tdd-coverage-analysis --session [sessionId]
|
||||
```
|
||||
- Run tests from TEST tasks
|
||||
- Verify IMPL tasks made tests pass
|
||||
- Check REFACTOR tasks maintained green tests
|
||||
- Extract: Test execution report
|
||||
|
||||
**Phase 4: Compliance Report Generation**
|
||||
```bash
|
||||
# Gemini analysis
|
||||
cd project-root && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Generate TDD compliance report
|
||||
TASK: Analyze TDD workflow execution and generate quality report
|
||||
CONTEXT: @{.workflow/[sessionId]/.task/*.json,.workflow/[sessionId]/.summaries/*}
|
||||
EXPECTED:
|
||||
- TDD compliance score
|
||||
- Chain completeness verification
|
||||
- Test coverage analysis
|
||||
- Quality recommendations
|
||||
- Red-Green-Refactor cycle validation
|
||||
RULES: Focus on TDD best practices and workflow adherence
|
||||
" > .workflow/[sessionId]/TDD_COMPLIANCE_REPORT.md
|
||||
```
|
||||
|
||||
### TodoWrite Pattern
|
||||
|
||||
```javascript
|
||||
TodoWrite({todos: [
|
||||
{"content": "Identify target session", "status": "in_progress", "activeForm": "Identifying target session"},
|
||||
{"content": "Validate task chain structure", "status": "pending", "activeForm": "Validating task chain structure"},
|
||||
{"content": "Analyze test execution", "status": "pending", "activeForm": "Analyzing test execution"},
|
||||
{"content": "Generate compliance report", "status": "pending", "activeForm": "Generating compliance report"}
|
||||
]})
|
||||
```
|
||||
|
||||
### Output Structure
|
||||
|
||||
```
|
||||
TDD Verification Report - Session: [sessionId]
|
||||
|
||||
## Chain Validation
|
||||
✅ Feature 1: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1 (Complete)
|
||||
✅ Feature 2: TEST-2.1 → IMPL-2.1 → REFACTOR-2.1 (Complete)
|
||||
⚠️ Feature 3: TEST-3.1 → IMPL-3.1 (Missing REFACTOR phase)
|
||||
|
||||
## Test Execution
|
||||
✅ All TEST tasks produced failing tests
|
||||
✅ All IMPL tasks made tests pass
|
||||
✅ All REFACTOR tasks maintained green tests
|
||||
|
||||
## Compliance Score: 95/100
|
||||
|
||||
Detailed report: .workflow/[sessionId]/TDD_COMPLIANCE_REPORT.md
|
||||
|
||||
Recommendations:
|
||||
- Complete missing REFACTOR-3.1 task
|
||||
- Consider additional edge case tests for Feature 2
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. /workflow:tools:tdd-coverage-analysis Command
|
||||
|
||||
### Purpose
|
||||
Analyze test coverage and execution results for TDD workflow validation.
|
||||
|
||||
### Command Specification
|
||||
|
||||
```yaml
|
||||
name: tdd-coverage-analysis
|
||||
description: Analyze test coverage and TDD cycle execution
|
||||
usage: /workflow:tools:tdd-coverage-analysis --session <session-id>
|
||||
argument-hint: "--session WFS-xxx"
|
||||
examples:
|
||||
- /workflow:tools:tdd-coverage-analysis --session WFS-auth
|
||||
allowed-tools: Read(*), Write(*), Bash(*)
|
||||
```
|
||||
|
||||
### Implementation Flow
|
||||
|
||||
**Step 1: Extract Test Tasks**
|
||||
```bash
|
||||
find .workflow/[sessionId]/.task/ -name 'TEST-*.json' -exec jq -r '.context.focus_paths[]' {} \;
|
||||
```
|
||||
|
||||
**Step 2: Run Test Suite**
|
||||
```bash
|
||||
npm test -- --coverage --json > .workflow/[sessionId]/.process/test-results.json
|
||||
```
|
||||
|
||||
**Step 3: Analyze Coverage**
|
||||
```bash
|
||||
jq '.coverage' .workflow/[sessionId]/.process/test-results.json > .workflow/[sessionId]/.process/coverage-report.json
|
||||
```
|
||||
|
||||
**Step 4: Verify TDD Cycle**
|
||||
For each chain:
|
||||
- Check TEST task created test files
|
||||
- Check IMPL task made tests pass
|
||||
- Check REFACTOR task didn't break tests
|
||||
|
||||
**Step 5: Generate Analysis Report**
|
||||
```markdown
|
||||
# Test Coverage Analysis
|
||||
|
||||
## Coverage Metrics
|
||||
- Line Coverage: X%
|
||||
- Branch Coverage: Y%
|
||||
- Function Coverage: Z%
|
||||
|
||||
## TDD Cycle Verification
|
||||
- Red Phase: X tests written and failed initially
|
||||
- Green Phase: Y implementations made tests pass
|
||||
- Refactor Phase: Z refactorings maintained green tests
|
||||
|
||||
## Gaps Identified
|
||||
- [List any missing test coverage]
|
||||
- [List any incomplete TDD cycles]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Integration with Existing System
|
||||
|
||||
### Data Flow Diagram
|
||||
|
||||
```
|
||||
User Input
|
||||
↓
|
||||
/workflow:tdd-plan "feature description"
|
||||
↓
|
||||
Phase 1: /workflow:session:start --auto "TDD: ..."
|
||||
↓ sessionId
|
||||
Phase 2: /workflow:tools:context-gather --session sessionId
|
||||
↓ contextPath
|
||||
Phase 3: /workflow:tools:concept-enhanced --session sessionId --context contextPath
|
||||
↓ ANALYSIS_RESULTS.md
|
||||
Phase 4: /workflow:tools:task-generate-tdd --session sessionId
|
||||
↓ TEST-*.json, IMPL-*.json, REFACTOR-*.json
|
||||
↓ TDD_PLAN.md, IMPL_PLAN.md, TODO_LIST.md
|
||||
Phase 5: Internal validation
|
||||
↓
|
||||
Return summary
|
||||
↓
|
||||
/workflow:execute (user executes tasks)
|
||||
↓
|
||||
/workflow:tdd-verify (user verifies compliance)
|
||||
↓
|
||||
Phase 1: Session discovery
|
||||
↓ sessionId
|
||||
Phase 2: Task chain validation
|
||||
↓ validation report
|
||||
Phase 3: /workflow:tools:tdd-coverage-analysis
|
||||
↓ coverage report
|
||||
Phase 4: Gemini compliance report
|
||||
↓ TDD_COMPLIANCE_REPORT.md
|
||||
Return verification summary
|
||||
```
|
||||
|
||||
### File Structure
|
||||
|
||||
```
|
||||
.workflow/
|
||||
└── WFS-[session-id]/
|
||||
├── ANALYSIS_RESULTS.md # From concept-enhanced
|
||||
├── IMPL_PLAN.md # Standard implementation plan
|
||||
├── TDD_PLAN.md # TDD-specific plan (new)
|
||||
├── TODO_LIST.md # Task list with TDD phases
|
||||
├── TDD_COMPLIANCE_REPORT.md # Verification report (new)
|
||||
├── .task/
|
||||
│ ├── TEST-1.1.json
|
||||
│ ├── IMPL-1.1.json
|
||||
│ ├── REFACTOR-1.1.json
|
||||
│ └── ...
|
||||
├── .summaries/
|
||||
│ ├── TEST-1.1-summary.md
|
||||
│ ├── IMPL-1.1-summary.md
|
||||
│ └── ...
|
||||
└── .process/
|
||||
├── TDD_TASK_BREAKDOWN.md # Gemini TDD breakdown
|
||||
├── test-results.json # Test execution results
|
||||
└── coverage-report.json # Coverage data
|
||||
```
|
||||
|
||||
### Relationship with Existing Commands
|
||||
|
||||
- **Reuses**: `/workflow:session:start`, `/workflow:tools:context-gather`, `/workflow:tools:concept-enhanced`
|
||||
- **Extends**: Adds TDD-specific task generation and verification
|
||||
- **Compatible with**: `/workflow:execute`, `/workflow:status`, `/workflow:resume`
|
||||
- **Complements**: `/workflow:test-gen` (TDD is proactive, test-gen is reactive)
|
||||
|
||||
---
|
||||
|
||||
## Implementation Checklist
|
||||
|
||||
### Command Files to Create
|
||||
- [ ] `.claude/commands/workflow/tdd-plan.md`
|
||||
- [ ] `.claude/commands/workflow/tdd-verify.md`
|
||||
- [ ] `.claude/commands/workflow/tools/task-generate-tdd.md`
|
||||
- [ ] `.claude/commands/workflow/tools/tdd-coverage-analysis.md`
|
||||
|
||||
### Template Files to Create
|
||||
- [ ] `.claude/workflows/cli-templates/prompts/development/tdd-test.txt`
|
||||
- [ ] `.claude/workflows/cli-templates/prompts/development/tdd-impl.txt`
|
||||
- [ ] `.claude/workflows/cli-templates/prompts/development/tdd-refactor.txt`
|
||||
|
||||
### Documentation to Update
|
||||
- [ ] `.claude/workflows/workflow-architecture.md` - Add TDD workflow section
|
||||
- [ ] `.claude/workflows/task-core.md` - Document `meta.tdd_phase` field
|
||||
- [ ] `README.md` - Add TDD workflow usage examples
|
||||
|
||||
### Testing Requirements
|
||||
- [ ] Test tdd-plan with simple feature
|
||||
- [ ] Verify task chain dependencies
|
||||
- [ ] Test tdd-verify compliance checking
|
||||
- [ ] Validate integration with workflow:execute
|
||||
- [ ] Test error handling and validation
|
||||
|
||||
---
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Example 1: Create TDD Workflow
|
||||
```bash
|
||||
# Plan TDD workflow
|
||||
/workflow:tdd-plan "Implement user registration with email validation"
|
||||
|
||||
# Execute tasks in order
|
||||
/workflow:execute
|
||||
|
||||
# Verify TDD compliance
|
||||
/workflow:tdd-verify
|
||||
```
|
||||
|
||||
### Example 2: Agent Mode
|
||||
```bash
|
||||
# Use agent for autonomous TDD planning
|
||||
/workflow:tdd-plan --agent requirements.md
|
||||
|
||||
# Execute with automatic task execution
|
||||
/workflow:execute
|
||||
```
|
||||
|
||||
### Example 3: Issue-Based TDD
|
||||
```bash
|
||||
# Create TDD workflow from issue
|
||||
/workflow:tdd-plan ISS-042
|
||||
|
||||
# Execute and verify
|
||||
/workflow:execute
|
||||
/workflow:tdd-verify WFS-issue-042
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Benefits
|
||||
|
||||
1. **Enforced TDD Discipline**: Dependencies ensure tests come before implementation
|
||||
2. **Clear Structure**: Red-Green-Refactor phases are explicit
|
||||
3. **Quality Verification**: Built-in compliance checking
|
||||
4. **Existing Architecture**: Reuses proven workflow patterns
|
||||
5. **Agent Support**: Can be fully automated or manually controlled
|
||||
6. **Comprehensive Reporting**: Clear visibility into TDD adherence
|
||||
7. **Flexible**: Works with existing workflow commands
|
||||
@@ -41,19 +41,21 @@ type: strategic-guideline
|
||||
|
||||
### Standard Format (REQUIRED)
|
||||
```bash
|
||||
# Gemini Analysis
|
||||
# Gemini Analysis (全权限)
|
||||
cd [directory] && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: [clear analysis goal]
|
||||
TASK: [specific analysis task]
|
||||
MODE: [analysis|write]
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected output]
|
||||
RULES: [template reference and constraints]
|
||||
"
|
||||
|
||||
# Qwen Architecture & Code Generation
|
||||
# Qwen Architecture Analysis (仅分析)
|
||||
cd [directory] && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: [clear architecture/code goal]
|
||||
TASK: [specific architecture/code task]
|
||||
PURPOSE: [clear architecture goal]
|
||||
TASK: [specific analysis task]
|
||||
MODE: analysis
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected deliverables]
|
||||
RULES: [template reference and constraints]
|
||||
@@ -63,6 +65,7 @@ RULES: [template reference and constraints]
|
||||
codex -C [directory] --full-auto exec "
|
||||
PURPOSE: [clear development goal]
|
||||
TASK: [specific development task]
|
||||
MODE: [auto|write]
|
||||
CONTEXT: [file references and memory context]
|
||||
EXPECTED: [expected deliverables]
|
||||
RULES: [template reference and constraints]
|
||||
@@ -72,10 +75,26 @@ RULES: [template reference and constraints]
|
||||
### Template Structure
|
||||
- [ ] **PURPOSE** - Clear goal and intent
|
||||
- [ ] **TASK** - Specific execution task
|
||||
- [ ] **MODE** - Execution mode and permission level
|
||||
- [ ] **CONTEXT** - File references and memory context from previous sessions
|
||||
- [ ] **EXPECTED** - Clear expected results
|
||||
- [ ] **RULES** - Template reference and constraints
|
||||
|
||||
### MODE Field Definition
|
||||
|
||||
The MODE field controls execution behavior and file permissions:
|
||||
|
||||
**For Gemini** (全权限,可读写):
|
||||
- `analysis` (default) - 分析 + 可生成文档
|
||||
- `write` - 创建/修改文件(自动启用 --approval-mode yolo)
|
||||
|
||||
**For Qwen** (仅分析):
|
||||
- `analysis` (default) - 仅架构分析,不生成代码
|
||||
|
||||
**For Codex**:
|
||||
- `auto` (default) - 自主开发,全文件操作
|
||||
- `write` - 测试生成和文件修改
|
||||
|
||||
### Directory Context
|
||||
Tools execute in current working directory:
|
||||
- **Gemini**: `cd path/to/project && ~/.claude/scripts/gemini-wrapper -p "prompt"`
|
||||
@@ -150,80 +169,92 @@ When planning any coding task, **ALWAYS** integrate CLI tools:
|
||||
|
||||
### Common Scenarios
|
||||
```bash
|
||||
# Project Analysis (in current directory)
|
||||
# Gemini - Code Analysis
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Understand codebase architecture
|
||||
TASK: Analyze project structure and identify patterns
|
||||
MODE: analysis
|
||||
CONTEXT: @{src/**/*.ts,CLAUDE.md} Previous analysis of auth system
|
||||
EXPECTED: Architecture overview and integration points
|
||||
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt") | Focus on integration points
|
||||
RULES: $(cat '~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt') | Focus on integration points
|
||||
"
|
||||
|
||||
# Project Analysis (in different directory)
|
||||
cd ../other-project && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Compare authentication patterns
|
||||
TASK: Analyze auth implementation in related project
|
||||
CONTEXT: @{src/auth/**/*} Current project context from session memory
|
||||
EXPECTED: Pattern comparison and recommendations
|
||||
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt") | Focus on architectural differences
|
||||
# Gemini - Generate Documentation
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Generate API documentation
|
||||
TASK: Create comprehensive API reference from code
|
||||
MODE: write
|
||||
CONTEXT: @{src/api/**/*}
|
||||
EXPECTED: API.md with all endpoints documented
|
||||
RULES: Follow project documentation standards
|
||||
"
|
||||
|
||||
# Architecture Design (with Qwen)
|
||||
# Qwen - Architecture Analysis
|
||||
cd src/auth && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: Design authentication system architecture
|
||||
TASK: Create modular JWT-based auth system design
|
||||
PURPOSE: Analyze authentication system architecture
|
||||
TASK: Review JWT-based auth system design
|
||||
MODE: analysis
|
||||
CONTEXT: @{src/auth/**/*} Existing patterns and requirements
|
||||
EXPECTED: Complete architecture with code scaffolding
|
||||
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt") | Focus on modularity and security
|
||||
EXPECTED: Architecture analysis report with recommendations
|
||||
RULES: $(cat '~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt') | Focus on security
|
||||
"
|
||||
|
||||
# Feature Development (in target directory)
|
||||
# Codex - Feature Development
|
||||
codex -C path/to/project --full-auto exec "
|
||||
PURPOSE: Implement user authentication
|
||||
TASK: Create JWT-based authentication system
|
||||
MODE: auto
|
||||
CONTEXT: @{src/auth/**/*} Database schema from session memory
|
||||
EXPECTED: Complete auth module with tests
|
||||
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/development/feature.txt") | Follow security best practices
|
||||
RULES: $(cat '~/.claude/workflows/cli-templates/prompts/development/feature.txt') | Follow security best practices
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
|
||||
# Code Review Preparation
|
||||
~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Prepare comprehensive code review
|
||||
TASK: Analyze code changes and identify potential issues
|
||||
CONTEXT: @{**/*.modified} Recent changes discussed in last session
|
||||
EXPECTED: Review checklist and improvement suggestions
|
||||
RULES: $(cat "~/.claude/workflows/cli-templates/prompts/analysis/quality.txt") | Focus on maintainability
|
||||
"
|
||||
# Codex - Test Generation
|
||||
codex -C src/auth --full-auto exec "
|
||||
PURPOSE: Increase test coverage
|
||||
TASK: Generate comprehensive tests for auth module
|
||||
MODE: write
|
||||
CONTEXT: @{**/*.ts} Exclude existing tests
|
||||
EXPECTED: Complete test suite with 80%+ coverage
|
||||
RULES: Use Jest, follow existing patterns
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
|
||||
## 📋 Planning Checklist
|
||||
|
||||
For every development task:
|
||||
- [ ] **Purpose defined** - Clear goal and intent
|
||||
- [ ] **Mode selected** - Execution mode and permission level determined
|
||||
- [ ] **Context gathered** - File references and session memory documented
|
||||
- [ ] **Gemini analysis** completed for understanding
|
||||
- [ ] **Template selected** - Appropriate template chosen
|
||||
- [ ] **Constraints specified** - File patterns, scope, requirements
|
||||
- [ ] **Implementation approach** - Tool selection and workflow
|
||||
- [ ] **Quality measures** - Testing and validation plan
|
||||
- [ ] **Tool configuration** - Review `.gemini/CLAUDE.md` or `.codex/Agent.md` if needed
|
||||
|
||||
## 🎯 Key Features
|
||||
|
||||
### Gemini
|
||||
### Gemini (全权限)
|
||||
- **Command**: `~/.claude/scripts/gemini-wrapper`
|
||||
- **Strengths**: Large context window, pattern recognition
|
||||
- **Best For**: Analysis, architecture review, code exploration
|
||||
- **Best For**: Analysis, documentation generation, code exploration
|
||||
- **Permissions**: 可读写,MODE=write 时自动启用 --approval-mode yolo
|
||||
- **Default MODE**: `analysis`
|
||||
|
||||
### Qwen
|
||||
### Qwen (仅分析)
|
||||
- **Command**: `~/.claude/scripts/qwen-wrapper`
|
||||
- **Strengths**: Architecture analysis, code generation, implementation patterns
|
||||
- **Best For**: System design, code scaffolding, architectural planning
|
||||
- **Strengths**: Architecture analysis, pattern recognition
|
||||
- **Best For**: System design analysis, architectural review
|
||||
- **Permissions**: 仅分析,不生成代码
|
||||
- **Default MODE**: `analysis`
|
||||
|
||||
### Codex
|
||||
- **Command**: `codex --full-auto exec`
|
||||
- **Strengths**: Autonomous development, mathematical reasoning
|
||||
- **Best For**: Implementation, testing, automation
|
||||
- **Required**: `-s danger-full-access` and `--skip-git-repo-check` for development
|
||||
- **Default MODE**: `auto`
|
||||
|
||||
### File Patterns
|
||||
- All files: `@{**/*}`
|
||||
@@ -250,15 +281,33 @@ For every development task:
|
||||
|
||||
**Example**:
|
||||
```bash
|
||||
# Focused analysis (preferred)
|
||||
cd src/auth && ~/.claude/scripts/gemini-wrapper -p "analyze auth patterns"
|
||||
# Gemini - Focused analysis
|
||||
cd src/auth && ~/.claude/scripts/gemini-wrapper -p "
|
||||
PURPOSE: Understand authentication patterns
|
||||
TASK: Analyze auth implementation
|
||||
MODE: analysis
|
||||
CONTEXT: @{**/*.ts}
|
||||
EXPECTED: Pattern documentation
|
||||
RULES: Focus on security best practices
|
||||
"
|
||||
|
||||
# Focused architecture (Qwen)
|
||||
cd src/auth && ~/.claude/scripts/qwen-wrapper -p "design auth architecture"
|
||||
# Qwen - Architecture analysis
|
||||
cd src/auth && ~/.claude/scripts/qwen-wrapper -p "
|
||||
PURPOSE: Analyze auth architecture
|
||||
TASK: Review auth system design and patterns
|
||||
MODE: analysis
|
||||
CONTEXT: @{**/*}
|
||||
EXPECTED: Architecture analysis report
|
||||
RULES: Focus on modularity and security
|
||||
"
|
||||
|
||||
# Focused implementation (Codex)
|
||||
codex -C src/auth --full-auto exec "analyze auth implementation" --skip-git-repo-check
|
||||
|
||||
# Multi-scope (stay in root)
|
||||
~/.claude/scripts/gemini-wrapper -p "CONTEXT: @{src/auth/**/*,src/api/**/*}"
|
||||
# Codex - Implementation
|
||||
codex -C src/auth --full-auto exec "
|
||||
PURPOSE: Improve auth implementation
|
||||
TASK: Review and enhance auth code
|
||||
MODE: auto
|
||||
CONTEXT: @{**/*.ts}
|
||||
EXPECTED: Code improvements and fixes
|
||||
RULES: Maintain backward compatibility
|
||||
" --skip-git-repo-check -s danger-full-access
|
||||
```
|
||||
@@ -13,8 +13,8 @@ All task files use this simplified 5-field schema (aligned with workflow-archite
|
||||
"status": "pending|active|completed|blocked|container",
|
||||
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "@code-developer|@planning-agent|@code-review-test-agent"
|
||||
"type": "feature|bugfix|refactor|test-gen|test-fix|docs",
|
||||
"agent": "@code-developer|@action-planning-agent|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
|
||||
"context": {
|
||||
@@ -145,17 +145,17 @@ Tasks inherit from:
|
||||
## Agent Mapping
|
||||
|
||||
### Automatic Agent Selection
|
||||
- **@code-developer**: Implementation tasks, coding
|
||||
- **@planning-agent**: Design, architecture planning
|
||||
- **@code-review-test-agent**: Testing, validation
|
||||
- **@review-agent**: Code review, quality checks
|
||||
- **@code-developer**: Implementation tasks, coding, test writing
|
||||
- **@action-planning-agent**: Design, architecture planning
|
||||
- **@test-fix-agent**: Test execution, failure diagnosis, code fixing
|
||||
- **@general-purpose**: Optional manual review (only when explicitly requested)
|
||||
|
||||
### Agent Context Filtering
|
||||
Each agent receives tailored context:
|
||||
- **@code-developer**: Complete implementation details
|
||||
- **@planning-agent**: High-level requirements, risks
|
||||
- **@test-agent**: Files to test, logic flows to validate
|
||||
- **@review-agent**: Quality standards, security considerations
|
||||
- **@code-developer**: Complete implementation details, test requirements
|
||||
- **@action-planning-agent**: High-level requirements, risks, architecture
|
||||
- **@test-fix-agent**: Test execution, failure diagnosis, code fixing
|
||||
- **@general-purpose**: Quality standards, security considerations (when requested)
|
||||
|
||||
## Deprecated Fields
|
||||
|
||||
|
||||
@@ -113,8 +113,8 @@ All task files use this unified 5-field schema with optional artifacts enhanceme
|
||||
"status": "pending|active|completed|blocked|container",
|
||||
|
||||
"meta": {
|
||||
"type": "feature|bugfix|refactor|test|docs",
|
||||
"agent": "code-developer|planning-agent|code-review-test-agent"
|
||||
"type": "feature|bugfix|refactor|test-gen|test-fix|docs",
|
||||
"agent": "@code-developer|@action-planning-agent|@test-fix-agent|@general-purpose"
|
||||
},
|
||||
|
||||
"context": {
|
||||
@@ -420,10 +420,10 @@ fi
|
||||
|
||||
### Agent Assignment
|
||||
Based on task type and title keywords:
|
||||
- **Planning tasks** → @planning-agent
|
||||
- **Implementation** → @code-developer
|
||||
- **Testing** → @code-review-test-agent
|
||||
- **Review** → @review-agent
|
||||
- **Planning tasks** → @action-planning-agent
|
||||
- **Implementation** → @code-developer (code + tests)
|
||||
- **Test execution/fixing** → @test-fix-agent
|
||||
- **Review** → @general-purpose (optional, only when explicitly requested)
|
||||
|
||||
### Execution Context
|
||||
Agents receive complete task JSON plus workflow context:
|
||||
|
||||
215
.codex/AGENTS.md
Normal file
215
.codex/AGENTS.md
Normal file
@@ -0,0 +1,215 @@
|
||||
# Codex Agent Execution Protocol
|
||||
|
||||
## Overview
|
||||
|
||||
**Role**: Codex - autonomous development, implementation, and testing
|
||||
|
||||
## Prompt Structure
|
||||
|
||||
**Receive prompts in this format**:
|
||||
|
||||
```
|
||||
PURPOSE: [development goal]
|
||||
TASK: [specific implementation task]
|
||||
MODE: [auto|write]
|
||||
CONTEXT: [file patterns]
|
||||
EXPECTED: [deliverables]
|
||||
RULES: [constraints and templates]
|
||||
```
|
||||
|
||||
## Execution Requirements
|
||||
|
||||
### ALWAYS
|
||||
|
||||
- **Parse all six fields** - Understand PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES
|
||||
- **Follow MODE strictly** - Respect execution boundaries
|
||||
- **Study CONTEXT files** - Find 3+ similar patterns before implementing
|
||||
- **Apply RULES** - Follow templates and constraints exactly
|
||||
- **Test continuously** - Run tests after every change
|
||||
- **Commit incrementally** - Small, working commits
|
||||
- **Match project style** - Follow existing patterns exactly
|
||||
- **Validate EXPECTED** - Ensure all deliverables are met
|
||||
|
||||
### NEVER
|
||||
|
||||
- **Make assumptions** - Verify with existing code
|
||||
- **Ignore existing patterns** - Study before implementing
|
||||
- **Skip tests** - Tests are mandatory
|
||||
- **Use clever tricks** - Choose boring, obvious solutions
|
||||
- **Over-engineer** - Simple solutions over complex architectures
|
||||
- **Break existing code** - Ensure backward compatibility
|
||||
- **Exceed 3 attempts** - Stop and reassess if blocked 3 times
|
||||
|
||||
## MODE Behavior
|
||||
|
||||
### MODE: auto (default)
|
||||
|
||||
**Permissions**:
|
||||
- Full file operations (create/modify/delete)
|
||||
- Run tests and builds
|
||||
- Commit code incrementally
|
||||
|
||||
**Execute**:
|
||||
1. Parse PURPOSE and TASK
|
||||
2. Analyze CONTEXT files - find 3+ similar patterns
|
||||
3. Plan implementation approach
|
||||
4. Generate code following RULES and project patterns
|
||||
5. Write tests alongside code
|
||||
6. Run tests continuously
|
||||
7. Commit working code incrementally
|
||||
8. Validate all EXPECTED deliverables
|
||||
9. Report results
|
||||
|
||||
**Use For**: Feature implementation, bug fixes, refactoring
|
||||
|
||||
### MODE: write
|
||||
|
||||
**Permissions**:
|
||||
- Focused file operations
|
||||
- Create/modify specific files
|
||||
- Run tests for validation
|
||||
|
||||
**Execute**:
|
||||
1. Analyze CONTEXT files
|
||||
2. Make targeted changes
|
||||
3. Validate tests pass
|
||||
4. Report file changes
|
||||
|
||||
**Use For**: Test generation, documentation updates, targeted fixes
|
||||
|
||||
## RULES Processing
|
||||
|
||||
- **Parse the RULES field** to identify template content and additional constraints
|
||||
- **Recognize `|` as separator** between template and additional constraints
|
||||
- **ALWAYS apply all template guidelines** provided in the prompt
|
||||
- **ALWAYS apply all additional constraints** specified after `|`
|
||||
- **Treat all rules as mandatory** - both template and constraints must be followed
|
||||
- **Failure to follow any rule** constitutes task failure
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Three-Attempt Rule
|
||||
|
||||
**On 3rd failed attempt**:
|
||||
1. **Stop execution**
|
||||
2. **Report status**: What was attempted, what failed, root cause
|
||||
3. **Request guidance**: Ask for clarification, suggest alternatives
|
||||
|
||||
### Recovery Strategies
|
||||
|
||||
**Syntax/Type Errors**:
|
||||
1. Review and fix errors
|
||||
2. Re-run tests
|
||||
3. Validate build succeeds
|
||||
|
||||
**Runtime Errors**:
|
||||
1. Analyze stack trace
|
||||
2. Add error handling
|
||||
3. Add tests for error cases
|
||||
|
||||
**Test Failures**:
|
||||
1. Debug in isolation
|
||||
2. Review test setup
|
||||
3. Fix implementation or test
|
||||
|
||||
**Build Failures**:
|
||||
1. Check error messages
|
||||
2. Fix incrementally
|
||||
3. Validate each fix
|
||||
|
||||
## Progress Reporting
|
||||
|
||||
### During Execution
|
||||
|
||||
```
|
||||
[1/5] Analyzing existing code patterns...
|
||||
[2/5] Planning implementation approach...
|
||||
[3/5] Generating code...
|
||||
[4/5] Writing tests...
|
||||
[5/5] Running validation...
|
||||
```
|
||||
|
||||
### On Success
|
||||
|
||||
```
|
||||
✅ Task completed
|
||||
|
||||
Changes:
|
||||
- Created: [files with line counts]
|
||||
- Modified: [files with changes]
|
||||
|
||||
Validation:
|
||||
✅ Tests: [count] passing
|
||||
✅ Coverage: [percentage]
|
||||
✅ Build: Success
|
||||
|
||||
Next Steps: [recommendations]
|
||||
```
|
||||
|
||||
### On Partial Completion
|
||||
|
||||
```
|
||||
⚠️ Task partially completed
|
||||
|
||||
Completed: [what worked]
|
||||
Blocked: [what failed and why]
|
||||
Required: [what's needed]
|
||||
Recommendation: [next steps]
|
||||
```
|
||||
|
||||
## Quality Standards
|
||||
|
||||
### Code Quality
|
||||
- Follow project's existing patterns
|
||||
- Match import style and naming conventions
|
||||
- Single responsibility per function/class
|
||||
- DRY (Don't Repeat Yourself)
|
||||
- YAGNI (You Aren't Gonna Need It)
|
||||
|
||||
### Testing
|
||||
- Test all public functions
|
||||
- Test edge cases and error conditions
|
||||
- Mock external dependencies
|
||||
- Target 80%+ coverage
|
||||
|
||||
### Error Handling
|
||||
- Proper try-catch blocks
|
||||
- Clear error messages
|
||||
- Graceful degradation
|
||||
- Don't expose sensitive info
|
||||
|
||||
## Philosophy
|
||||
|
||||
- **Incremental progress over big bangs** - Small, testable changes
|
||||
- **Learning from existing code** - Study 3+ patterns before implementing
|
||||
- **Pragmatic over dogmatic** - Adapt to project reality
|
||||
- **Clear intent over clever code** - Boring, obvious solutions
|
||||
- **Simple over complex** - Avoid over-engineering
|
||||
- **Follow existing style** - Match project patterns exactly
|
||||
|
||||
## Execution Checklist
|
||||
|
||||
### Before Implementation
|
||||
- [ ] Understand PURPOSE and TASK clearly
|
||||
- [ ] Review all CONTEXT files
|
||||
- [ ] Find 3+ similar patterns in codebase
|
||||
- [ ] Check RULES templates and constraints
|
||||
- [ ] Plan implementation approach
|
||||
|
||||
### During Implementation
|
||||
- [ ] Follow existing patterns exactly
|
||||
- [ ] Write tests alongside code
|
||||
- [ ] Run tests after every change
|
||||
- [ ] Commit working code incrementally
|
||||
- [ ] Handle errors properly
|
||||
|
||||
### After Implementation
|
||||
- [ ] Run full test suite - all pass
|
||||
- [ ] Check coverage - meets target
|
||||
- [ ] Run build - succeeds
|
||||
- [ ] Review EXPECTED - all deliverables met
|
||||
|
||||
---
|
||||
|
||||
**Version**: 2.0.0
|
||||
**Last Updated**: 2025-10-02
|
||||
143
.gemini/GEMINI.md
Normal file
143
.gemini/GEMINI.md
Normal file
@@ -0,0 +1,143 @@
|
||||
# Gemini Execution Protocol
|
||||
|
||||
## Overview
|
||||
|
||||
**Role**: Gemini - code analysis and documentation generation
|
||||
|
||||
## Prompt Structure
|
||||
|
||||
**Receive prompts in this format**:
|
||||
|
||||
```
|
||||
PURPOSE: [goal statement]
|
||||
TASK: [specific task]
|
||||
MODE: [analysis|write]
|
||||
CONTEXT: [file patterns]
|
||||
EXPECTED: [deliverables]
|
||||
RULES: [constraints and templates]
|
||||
```
|
||||
|
||||
## Execution Requirements
|
||||
|
||||
### ALWAYS
|
||||
|
||||
- **Parse all six fields** - Understand PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES
|
||||
- **Follow MODE strictly** - Respect permission boundaries
|
||||
- **Analyze CONTEXT files** - Read all matching patterns thoroughly
|
||||
- **Apply RULES** - Follow templates and constraints exactly
|
||||
- **Provide evidence** - Quote code with file:line references
|
||||
- **Match EXPECTED** - Deliver exactly what's requested
|
||||
|
||||
### NEVER
|
||||
|
||||
- **Assume behavior** - Verify with actual code
|
||||
- **Ignore CONTEXT** - Stay within specified file patterns
|
||||
- **Skip RULES** - Templates are mandatory when provided
|
||||
- **Make unsubstantiated claims** - Always back with code references
|
||||
- **Deviate from MODE** - Respect read/write boundaries
|
||||
|
||||
## MODE Behavior
|
||||
|
||||
### MODE: analysis (default)
|
||||
|
||||
**Permissions**:
|
||||
- Read all CONTEXT files
|
||||
- Create/modify documentation files
|
||||
|
||||
**Execute**:
|
||||
1. Read and analyze CONTEXT files
|
||||
2. Identify patterns and issues
|
||||
3. Generate insights and recommendations
|
||||
4. Create documentation if needed
|
||||
5. Output structured analysis
|
||||
|
||||
**Constraint**: Do NOT modify source code files
|
||||
|
||||
### MODE: write
|
||||
|
||||
**Permissions**:
|
||||
- Full file operations
|
||||
- Create/modify any files
|
||||
|
||||
**Execute**:
|
||||
1. Read CONTEXT files
|
||||
2. Perform requested file operations
|
||||
3. Create/modify files as specified
|
||||
4. Validate changes
|
||||
5. Report file changes
|
||||
|
||||
## Output Format
|
||||
|
||||
### Standard Analysis Structure
|
||||
|
||||
```markdown
|
||||
# Analysis: [TASK Title]
|
||||
|
||||
## Summary
|
||||
[2-3 sentence overview]
|
||||
|
||||
## Key Findings
|
||||
1. [Finding] - path/to/file:123
|
||||
2. [Finding] - path/to/file:456
|
||||
|
||||
## Detailed Analysis
|
||||
[Evidence-based analysis with code quotes]
|
||||
|
||||
## Recommendations
|
||||
1. [Actionable recommendation]
|
||||
2. [Actionable recommendation]
|
||||
```
|
||||
|
||||
### Code References
|
||||
|
||||
Always use format: `path/to/file:line_number`
|
||||
|
||||
Example: "Authentication logic at `src/auth/jwt.ts:45` uses deprecated algorithm"
|
||||
|
||||
## RULES Processing
|
||||
|
||||
- **Parse the RULES field** to identify template content and additional constraints
|
||||
- **Recognize `|` as separator** between template and additional constraints
|
||||
- **ALWAYS apply all template guidelines** provided in the prompt
|
||||
- **ALWAYS apply all additional constraints** specified after `|`
|
||||
- **Treat all rules as mandatory** - both template and constraints must be followed
|
||||
- **Failure to follow any rule** constitutes task failure
|
||||
|
||||
## Error Handling
|
||||
|
||||
**File Not Found**:
|
||||
- Report missing files
|
||||
- Continue with available files
|
||||
- Note in output
|
||||
|
||||
**Invalid CONTEXT Pattern**:
|
||||
- Report invalid pattern
|
||||
- Request correction
|
||||
- Do not guess
|
||||
|
||||
## Quality Standards
|
||||
|
||||
### Thoroughness
|
||||
- Analyze ALL files in CONTEXT
|
||||
- Check cross-file patterns
|
||||
- Identify edge cases
|
||||
- Quantify when possible
|
||||
|
||||
### Evidence-Based
|
||||
- Quote relevant code
|
||||
- Provide file:line references
|
||||
- Link related patterns
|
||||
|
||||
### Actionable
|
||||
- Clear recommendations
|
||||
- Prioritized by impact
|
||||
- Specific, not vague
|
||||
|
||||
## Philosophy
|
||||
|
||||
- **Incremental over big bangs** - Suggest small, testable changes
|
||||
- **Learn from existing code** - Reference project patterns
|
||||
- **Pragmatic over dogmatic** - Adapt to project reality
|
||||
- **Clear over clever** - Prefer obvious solutions
|
||||
- **Simple over complex** - Avoid over-engineering
|
||||
|
||||
63
CHANGELOG.md
63
CHANGELOG.md
@@ -5,6 +5,69 @@ All notable changes to Claude Code Workflow (CCW) will be documented in this fil
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [3.2.0] - 2025-10-02
|
||||
|
||||
### 🔄 Test-Fix Workflow & Agent Architecture Simplification
|
||||
|
||||
This release simplifies the agent architecture and introduces an automated test-fix workflow based on the principle "Tests Are the Review".
|
||||
|
||||
#### Added
|
||||
|
||||
**New Agent: test-fix-agent**:
|
||||
- **Purpose**: Execute tests, diagnose failures, and fix code until all tests pass
|
||||
- **Philosophy**: When all tests pass, code is automatically approved (no separate review needed)
|
||||
- **Responsibilities**:
|
||||
- Execute complete test suite for implemented modules
|
||||
- Parse test output and identify failures
|
||||
- Diagnose root cause of test failures
|
||||
- Modify source code to fix issues
|
||||
- Re-run tests to verify fixes
|
||||
- Certify code approval when all tests pass
|
||||
|
||||
**Enhanced test-gen Command**:
|
||||
- Transforms from planning tool to workflow orchestrator
|
||||
- Auto-generates TEST-FIX tasks for test-fix-agent
|
||||
- Automatically executes test validation via `/workflow:execute`
|
||||
- Eliminates manual planning document generation
|
||||
|
||||
**New Task Types**:
|
||||
- `test-gen`: Test generation tasks (handled by @code-developer)
|
||||
- `test-fix`: Test execution and fixing tasks (handled by @test-fix-agent)
|
||||
|
||||
#### Changed
|
||||
|
||||
**Agent Architecture Simplification**:
|
||||
- **Removed**: `@code-review-agent` and `@code-review-test-agent`
|
||||
- Testing now serves as the quality gate
|
||||
- Passing tests = approved code
|
||||
- **Enhanced**: `@code-developer` now writes implementation + tests together
|
||||
- Unified generative work (code + tests)
|
||||
- Maintains context continuity
|
||||
- **Added**: `@general-purpose` for optional manual reviews
|
||||
- Used only when explicitly requested
|
||||
- Handles special cases and edge scenarios
|
||||
|
||||
**Task Type Updates**:
|
||||
- `"test"` → `"test-gen"` (clearer distinction from test-fix)
|
||||
- Agent mapping updated across all commands:
|
||||
- `feature|bugfix|refactor|test-gen` → `@code-developer`
|
||||
- `test-fix` → `@test-fix-agent`
|
||||
- `review` → `@general-purpose` (optional)
|
||||
|
||||
**Workflow Changes**:
|
||||
```
|
||||
Old: code-developer → test-agent → code-review-agent
|
||||
New: code-developer (code+tests) → test-fix-agent (execute+fix) → ✅ approved
|
||||
```
|
||||
|
||||
#### Removed
|
||||
|
||||
- `@code-review-agent` - Testing serves as quality gate
|
||||
- `@code-review-test-agent` - Functionality split between code-developer and test-fix-agent
|
||||
- Separate review step - Tests passing = code approved
|
||||
|
||||
---
|
||||
|
||||
## [3.1.0] - 2025-10-02
|
||||
|
||||
### 🧪 TDD Workflow Support
|
||||
|
||||
@@ -156,22 +156,34 @@ function Test-Prerequisites {
|
||||
Write-ColorOutput "Current version: $($PSVersionTable.PSVersion)" $ColorError
|
||||
return $false
|
||||
}
|
||||
|
||||
|
||||
# Test source files exist
|
||||
$sourceDir = $PSScriptRoot
|
||||
$claudeDir = Join-Path $sourceDir ".claude"
|
||||
$claudeMd = Join-Path $sourceDir "CLAUDE.md"
|
||||
|
||||
$codexDir = Join-Path $sourceDir ".codex"
|
||||
$geminiDir = Join-Path $sourceDir ".gemini"
|
||||
|
||||
if (-not (Test-Path $claudeDir)) {
|
||||
Write-ColorOutput "ERROR: .claude directory not found in $sourceDir" $ColorError
|
||||
return $false
|
||||
}
|
||||
|
||||
|
||||
if (-not (Test-Path $claudeMd)) {
|
||||
Write-ColorOutput "ERROR: CLAUDE.md file not found in $sourceDir" $ColorError
|
||||
return $false
|
||||
}
|
||||
|
||||
|
||||
if (-not (Test-Path $codexDir)) {
|
||||
Write-ColorOutput "ERROR: .codex directory not found in $sourceDir" $ColorError
|
||||
return $false
|
||||
}
|
||||
|
||||
if (-not (Test-Path $geminiDir)) {
|
||||
Write-ColorOutput "ERROR: .gemini directory not found in $sourceDir" $ColorError
|
||||
return $false
|
||||
}
|
||||
|
||||
Write-ColorOutput "Prerequisites check passed" $ColorSuccess
|
||||
return $true
|
||||
}
|
||||
@@ -617,6 +629,8 @@ function Install-Global {
|
||||
$userProfile = [Environment]::GetFolderPath("UserProfile")
|
||||
$globalClaudeDir = Join-Path $userProfile ".claude"
|
||||
$globalClaudeMd = Join-Path $globalClaudeDir "CLAUDE.md"
|
||||
$globalCodexDir = Join-Path $userProfile ".codex"
|
||||
$globalGeminiDir = Join-Path $userProfile ".gemini"
|
||||
|
||||
Write-ColorOutput "Global installation path: $userProfile" $ColorInfo
|
||||
|
||||
@@ -624,12 +638,23 @@ function Install-Global {
|
||||
$sourceDir = $PSScriptRoot
|
||||
$sourceClaudeDir = Join-Path $sourceDir ".claude"
|
||||
$sourceClaudeMd = Join-Path $sourceDir "CLAUDE.md"
|
||||
$sourceCodexDir = Join-Path $sourceDir ".codex"
|
||||
$sourceGeminiDir = Join-Path $sourceDir ".gemini"
|
||||
|
||||
# Create backup folder if needed (default behavior unless NoBackup is specified)
|
||||
$backupFolder = $null
|
||||
if (-not $NoBackup) {
|
||||
if (Test-Path $globalClaudeDir) {
|
||||
$existingFiles = Get-ChildItem $globalClaudeDir -Recurse -File -ErrorAction SilentlyContinue
|
||||
if ((Test-Path $globalClaudeDir) -or (Test-Path $globalCodexDir) -or (Test-Path $globalGeminiDir)) {
|
||||
$existingFiles = @()
|
||||
if (Test-Path $globalClaudeDir) {
|
||||
$existingFiles += Get-ChildItem $globalClaudeDir -Recurse -File -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (Test-Path $globalCodexDir) {
|
||||
$existingFiles += Get-ChildItem $globalCodexDir -Recurse -File -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (Test-Path $globalGeminiDir) {
|
||||
$existingFiles += Get-ChildItem $globalGeminiDir -Recurse -File -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (($existingFiles -and ($existingFiles | Measure-Object).Count -gt 0)) {
|
||||
$backupFolder = Get-BackupDirectory -TargetDirectory $userProfile
|
||||
Write-ColorOutput "Backup folder created: $backupFolder" $ColorInfo
|
||||
@@ -649,6 +674,14 @@ function Install-Global {
|
||||
Write-ColorOutput "Installing CLAUDE.md to global .claude directory..." $ColorInfo
|
||||
$claudeMdInstalled = Copy-FileToDestination -Source $sourceClaudeMd -Destination $globalClaudeMd -Description "CLAUDE.md" -BackupFolder $backupFolder
|
||||
|
||||
# Merge .codex directory contents
|
||||
Write-ColorOutput "Merging .codex directory contents..." $ColorInfo
|
||||
$codexMerged = Merge-DirectoryContents -Source $sourceCodexDir -Destination $globalCodexDir -Description ".codex directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Merge .gemini directory contents
|
||||
Write-ColorOutput "Merging .gemini directory contents..." $ColorInfo
|
||||
$geminiMerged = Merge-DirectoryContents -Source $sourceGeminiDir -Destination $globalGeminiDir -Description ".gemini directory contents" -BackupFolder $backupFolder
|
||||
|
||||
if ($backupFolder -and (Test-Path $backupFolder)) {
|
||||
$backupFiles = Get-ChildItem $backupFolder -Recurse -File -ErrorAction SilentlyContinue
|
||||
if (-not $backupFiles -or ($backupFiles | Measure-Object).Count -eq 0) {
|
||||
@@ -679,14 +712,18 @@ function Install-Path {
|
||||
$sourceDir = $PSScriptRoot
|
||||
$sourceClaudeDir = Join-Path $sourceDir ".claude"
|
||||
$sourceClaudeMd = Join-Path $sourceDir "CLAUDE.md"
|
||||
$sourceCodexDir = Join-Path $sourceDir ".codex"
|
||||
$sourceGeminiDir = Join-Path $sourceDir ".gemini"
|
||||
|
||||
# Local paths - only for agents, commands, output-styles
|
||||
# Local paths - for agents, commands, output-styles, .codex, .gemini
|
||||
$localClaudeDir = Join-Path $TargetDirectory ".claude"
|
||||
$localCodexDir = Join-Path $TargetDirectory ".codex"
|
||||
$localGeminiDir = Join-Path $TargetDirectory ".gemini"
|
||||
|
||||
# Create backup folder if needed
|
||||
$backupFolder = $null
|
||||
if (-not $NoBackup) {
|
||||
if ((Test-Path $localClaudeDir) -or (Test-Path $globalClaudeDir)) {
|
||||
if ((Test-Path $localClaudeDir) -or (Test-Path $localCodexDir) -or (Test-Path $localGeminiDir) -or (Test-Path $globalClaudeDir)) {
|
||||
$backupFolder = Get-BackupDirectory -TargetDirectory $TargetDirectory
|
||||
Write-ColorOutput "Backup folder created: $backupFolder" $ColorInfo
|
||||
}
|
||||
@@ -774,6 +811,14 @@ function Install-Path {
|
||||
Write-ColorOutput "Installing CLAUDE.md to global .claude directory..." $ColorInfo
|
||||
Copy-FileToDestination -Source $sourceClaudeMd -Destination $globalClaudeMd -Description "CLAUDE.md" -BackupFolder $backupFolder
|
||||
|
||||
# Merge .codex directory contents to local location
|
||||
Write-ColorOutput "Merging .codex directory contents to local location..." $ColorInfo
|
||||
$codexMerged = Merge-DirectoryContents -Source $sourceCodexDir -Destination $localCodexDir -Description ".codex directory contents" -BackupFolder $backupFolder
|
||||
|
||||
# Merge .gemini directory contents to local location
|
||||
Write-ColorOutput "Merging .gemini directory contents to local location..." $ColorInfo
|
||||
$geminiMerged = Merge-DirectoryContents -Source $sourceGeminiDir -Destination $localGeminiDir -Description ".gemini directory contents" -BackupFolder $backupFolder
|
||||
|
||||
if ($backupFolder -and (Test-Path $backupFolder)) {
|
||||
$backupFiles = Get-ChildItem $backupFolder -Recurse -File -ErrorAction SilentlyContinue
|
||||
if (-not $backupFiles -or ($backupFiles | Measure-Object).Count -eq 0) {
|
||||
@@ -879,10 +924,11 @@ function Show-Summary {
|
||||
if ($Mode -eq "Path") {
|
||||
Write-Host " Local Path: $Path"
|
||||
Write-Host " Global Path: $([Environment]::GetFolderPath('UserProfile'))"
|
||||
Write-Host " Local Components: agents, commands, output-styles"
|
||||
Write-Host " Local Components: agents, commands, output-styles, .codex, .gemini"
|
||||
Write-Host " Global Components: workflows, scripts, python_script, etc."
|
||||
} else {
|
||||
Write-Host " Path: $Path"
|
||||
Write-Host " Global Components: .claude, .codex, .gemini"
|
||||
}
|
||||
|
||||
if ($NoBackup) {
|
||||
@@ -896,10 +942,12 @@ function Show-Summary {
|
||||
Write-Host ""
|
||||
Write-ColorOutput "Next steps:" $ColorInfo
|
||||
Write-Host "1. Review CLAUDE.md - Customize guidelines for your project"
|
||||
Write-Host "2. Configure settings - Edit .claude/settings.local.json as needed"
|
||||
Write-Host "3. Start using Claude Code with Agent workflow coordination!"
|
||||
Write-Host "4. Use /workflow commands for task execution"
|
||||
Write-Host "5. Use /update-memory commands for memory system management"
|
||||
Write-Host "2. Review .codex/Agent.md - Codex agent execution protocol"
|
||||
Write-Host "3. Review .gemini/CLAUDE.md - Gemini agent execution protocol"
|
||||
Write-Host "4. Configure settings - Edit .claude/settings.local.json as needed"
|
||||
Write-Host "5. Start using Claude Code with Agent workflow coordination!"
|
||||
Write-Host "6. Use /workflow commands for task execution"
|
||||
Write-Host "7. Use /update-memory commands for memory system management"
|
||||
|
||||
Write-Host ""
|
||||
Write-ColorOutput "Documentation: https://github.com/catlog22/Claude-CCW" $ColorInfo
|
||||
|
||||
@@ -97,6 +97,8 @@ function test_prerequisites() {
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local claude_dir="$script_dir/.claude"
|
||||
local claude_md="$script_dir/CLAUDE.md"
|
||||
local codex_dir="$script_dir/.codex"
|
||||
local gemini_dir="$script_dir/.gemini"
|
||||
|
||||
if [ ! -d "$claude_dir" ]; then
|
||||
write_color "ERROR: .claude directory not found in $script_dir" "$COLOR_ERROR"
|
||||
@@ -108,6 +110,16 @@ function test_prerequisites() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$codex_dir" ]; then
|
||||
write_color "ERROR: .codex directory not found in $script_dir" "$COLOR_ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$gemini_dir" ]; then
|
||||
write_color "ERROR: .gemini directory not found in $script_dir" "$COLOR_ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
write_color "✓ Prerequisites check passed" "$COLOR_SUCCESS"
|
||||
return 0
|
||||
}
|
||||
@@ -389,6 +401,8 @@ function install_global() {
|
||||
local user_home="$HOME"
|
||||
local global_claude_dir="${user_home}/.claude"
|
||||
local global_claude_md="${global_claude_dir}/CLAUDE.md"
|
||||
local global_codex_dir="${user_home}/.codex"
|
||||
local global_gemini_dir="${user_home}/.gemini"
|
||||
|
||||
write_color "Global installation path: $user_home" "$COLOR_INFO"
|
||||
|
||||
@@ -396,14 +410,25 @@ function install_global() {
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local source_claude_dir="${script_dir}/.claude"
|
||||
local source_claude_md="${script_dir}/CLAUDE.md"
|
||||
local source_codex_dir="${script_dir}/.codex"
|
||||
local source_gemini_dir="${script_dir}/.gemini"
|
||||
|
||||
# Create backup folder if needed
|
||||
local backup_folder=""
|
||||
if [ "$NO_BACKUP" = false ]; then
|
||||
local has_existing_files=false
|
||||
|
||||
if [ -d "$global_claude_dir" ] && [ "$(ls -A "$global_claude_dir" 2>/dev/null)" ]; then
|
||||
backup_folder=$(get_backup_directory "$user_home")
|
||||
write_color "Backup folder created: $backup_folder" "$COLOR_INFO"
|
||||
has_existing_files=true
|
||||
elif [ -d "$global_codex_dir" ] && [ "$(ls -A "$global_codex_dir" 2>/dev/null)" ]; then
|
||||
has_existing_files=true
|
||||
elif [ -d "$global_gemini_dir" ] && [ "$(ls -A "$global_gemini_dir" 2>/dev/null)" ]; then
|
||||
has_existing_files=true
|
||||
elif [ -f "$global_claude_md" ]; then
|
||||
has_existing_files=true
|
||||
fi
|
||||
|
||||
if [ "$has_existing_files" = true ]; then
|
||||
backup_folder=$(get_backup_directory "$user_home")
|
||||
write_color "Backup folder created: $backup_folder" "$COLOR_INFO"
|
||||
fi
|
||||
@@ -417,6 +442,14 @@ function install_global() {
|
||||
write_color "Installing CLAUDE.md to global .claude directory..." "$COLOR_INFO"
|
||||
copy_file_to_destination "$source_claude_md" "$global_claude_md" "CLAUDE.md" "$backup_folder"
|
||||
|
||||
# Merge .codex directory contents
|
||||
write_color "Merging .codex directory contents..." "$COLOR_INFO"
|
||||
merge_directory_contents "$source_codex_dir" "$global_codex_dir" ".codex directory contents" "$backup_folder"
|
||||
|
||||
# Merge .gemini directory contents
|
||||
write_color "Merging .gemini directory contents..." "$COLOR_INFO"
|
||||
merge_directory_contents "$source_gemini_dir" "$global_gemini_dir" ".gemini directory contents" "$backup_folder"
|
||||
|
||||
# Remove empty backup folder
|
||||
if [ -n "$backup_folder" ] && [ -d "$backup_folder" ]; then
|
||||
if [ -z "$(ls -A "$backup_folder" 2>/dev/null)" ]; then
|
||||
@@ -442,14 +475,18 @@ function install_path() {
|
||||
local script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
local source_claude_dir="${script_dir}/.claude"
|
||||
local source_claude_md="${script_dir}/CLAUDE.md"
|
||||
local source_codex_dir="${script_dir}/.codex"
|
||||
local source_gemini_dir="${script_dir}/.gemini"
|
||||
|
||||
# Local paths
|
||||
local local_claude_dir="${target_dir}/.claude"
|
||||
local local_codex_dir="${target_dir}/.codex"
|
||||
local local_gemini_dir="${target_dir}/.gemini"
|
||||
|
||||
# Create backup folder if needed
|
||||
local backup_folder=""
|
||||
if [ "$NO_BACKUP" = false ]; then
|
||||
if [ -d "$local_claude_dir" ] || [ -d "$global_claude_dir" ]; then
|
||||
if [ -d "$local_claude_dir" ] || [ -d "$local_codex_dir" ] || [ -d "$local_gemini_dir" ] || [ -d "$global_claude_dir" ]; then
|
||||
backup_folder=$(get_backup_directory "$target_dir")
|
||||
write_color "Backup folder created: $backup_folder" "$COLOR_INFO"
|
||||
fi
|
||||
@@ -530,6 +567,14 @@ function install_path() {
|
||||
write_color "Installing CLAUDE.md to global .claude directory..." "$COLOR_INFO"
|
||||
copy_file_to_destination "$source_claude_md" "$global_claude_md" "CLAUDE.md" "$backup_folder"
|
||||
|
||||
# Merge .codex directory contents to local location
|
||||
write_color "Merging .codex directory contents to local location..." "$COLOR_INFO"
|
||||
merge_directory_contents "$source_codex_dir" "$local_codex_dir" ".codex directory contents" "$backup_folder"
|
||||
|
||||
# Merge .gemini directory contents to local location
|
||||
write_color "Merging .gemini directory contents to local location..." "$COLOR_INFO"
|
||||
merge_directory_contents "$source_gemini_dir" "$local_gemini_dir" ".gemini directory contents" "$backup_folder"
|
||||
|
||||
# Remove empty backup folder
|
||||
if [ -n "$backup_folder" ] && [ -d "$backup_folder" ]; then
|
||||
if [ -z "$(ls -A "$backup_folder" 2>/dev/null)" ]; then
|
||||
@@ -631,10 +676,11 @@ function show_summary() {
|
||||
if [ "$mode" = "Path" ]; then
|
||||
echo " Local Path: $path"
|
||||
echo " Global Path: $HOME"
|
||||
echo " Local Components: agents, commands, output-styles"
|
||||
echo " Local Components: agents, commands, output-styles, .codex, .gemini"
|
||||
echo " Global Components: workflows, scripts, python_script, etc."
|
||||
else
|
||||
echo " Path: $path"
|
||||
echo " Global Components: .claude, .codex, .gemini"
|
||||
fi
|
||||
|
||||
if [ "$NO_BACKUP" = true ]; then
|
||||
@@ -648,10 +694,12 @@ function show_summary() {
|
||||
echo ""
|
||||
write_color "Next steps:" "$COLOR_INFO"
|
||||
echo "1. Review CLAUDE.md - Customize guidelines for your project"
|
||||
echo "2. Configure settings - Edit .claude/settings.local.json as needed"
|
||||
echo "3. Start using Claude Code with Agent workflow coordination!"
|
||||
echo "4. Use /workflow commands for task execution"
|
||||
echo "5. Use /update-memory commands for memory system management"
|
||||
echo "2. Review .codex/Agent.md - Codex agent execution protocol"
|
||||
echo "3. Review .gemini/CLAUDE.md - Gemini agent execution protocol"
|
||||
echo "4. Configure settings - Edit .claude/settings.local.json as needed"
|
||||
echo "5. Start using Claude Code with Agent workflow coordination!"
|
||||
echo "6. Use /workflow commands for task execution"
|
||||
echo "7. Use /update-memory commands for memory system management"
|
||||
|
||||
echo ""
|
||||
write_color "Documentation: https://github.com/catlog22/Claude-Code-Workflow" "$COLOR_INFO"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 🚀 Claude Code Workflow (CCW): 下一代多智能体软件开发自动化框架
|
||||
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](https://github.com/modelcontextprotocol)
|
||||
[](LICENSE)
|
||||
|
||||
|
||||
80
README.md
80
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](LICENSE)
|
||||
[]()
|
||||
[](https://github.com/modelcontextprotocol)
|
||||
@@ -15,16 +15,20 @@
|
||||
|
||||
**Claude Code Workflow (CCW)** is a next-generation multi-agent automation framework that orchestrates complex software development tasks through intelligent workflow management and autonomous execution.
|
||||
|
||||
> **🎉 Latest: v3.1.0** - TDD Workflow Support with Red-Green-Refactor cycle enforcement. See [CHANGELOG.md](CHANGELOG.md) for details.
|
||||
> **🎉 Latest: v3.2.0** - Simplified agent architecture with "Tests Are the Review" philosophy. See [CHANGELOG.md](CHANGELOG.md) for details.
|
||||
>
|
||||
> **v3.0.0**: Introduced **unified CLI command structure**. The `/cli:*` commands consolidate all tool interactions (Gemini, Qwen, Codex) using a `--tool` flag for selection.
|
||||
> **What's New in v3.2.0**:
|
||||
> - 🔄 Simplified from 3 agents to 2 core agents (`@code-developer`, `@test-fix-agent`)
|
||||
> - ✅ "Tests Are the Review" - Passing tests = approved code
|
||||
> - 🧪 Enhanced test-fix workflow with automatic execution and fixing
|
||||
> - 📦 Interactive installation with version selection menu
|
||||
|
||||
---
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
- **🎯 Context-First Architecture**: Pre-defined context gathering eliminates execution uncertainty and error accumulation.
|
||||
- **🤖 Multi-Agent System**: Specialized agents (`@code-developer`, `@code-review-test-agent`) with tech-stack awareness.
|
||||
- **🤖 Multi-Agent System**: Specialized agents (`@code-developer`, `@test-fix-agent`) with tech-stack awareness and automated test validation.
|
||||
- **🔄 End-to-End Workflow Automation**: From brainstorming to deployment with multi-phase orchestration.
|
||||
- **📋 JSON-First Task Model**: Structured task definitions with `pre_analysis` steps for deterministic execution.
|
||||
- **🧪 TDD Workflow Support**: Complete Test-Driven Development with Red-Green-Refactor cycle enforcement.
|
||||
@@ -49,12 +53,59 @@ Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/cat
|
||||
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh)
|
||||
```
|
||||
|
||||
### **📋 Interactive Version Selection**
|
||||
|
||||
After running the installation command, you'll see an interactive menu with real-time version information:
|
||||
|
||||
```
|
||||
Detecting latest release and commits...
|
||||
Latest stable: v3.2.0 (2025-10-02 04:27 UTC)
|
||||
Latest commit: cdea58f (2025-10-02 08:15 UTC)
|
||||
|
||||
====================================================
|
||||
Version Selection Menu
|
||||
====================================================
|
||||
|
||||
1) Latest Stable Release (Recommended)
|
||||
|-- Version: v3.2.0
|
||||
|-- Released: 2025-10-02 04:27 UTC
|
||||
\-- Production-ready
|
||||
|
||||
2) Latest Development Version
|
||||
|-- Branch: main
|
||||
|-- Commit: cdea58f
|
||||
|-- Updated: 2025-10-02 08:15 UTC
|
||||
|-- Cutting-edge features
|
||||
\-- May contain experimental changes
|
||||
|
||||
3) Specific Release Version
|
||||
|-- Install a specific tagged release
|
||||
\-- Recent: v3.2.0, v3.1.0, v3.0.1
|
||||
|
||||
====================================================
|
||||
|
||||
Select version to install (1-3, default: 1):
|
||||
```
|
||||
|
||||
**Version Options:**
|
||||
- **Option 1 (Recommended)**: Latest stable release with verified production quality
|
||||
- **Option 2**: Latest development version from main branch with newest features
|
||||
- **Option 3**: Specific version tag for controlled deployments
|
||||
|
||||
> 💡 **Pro Tip**: The installer automatically detects and displays the latest version numbers and release dates from GitHub. Just press Enter to select the recommended stable release.
|
||||
|
||||
### **✅ Verify Installation**
|
||||
After installation, run the following command to ensure CCW is working:
|
||||
```bash
|
||||
/workflow:session:list
|
||||
```
|
||||
|
||||
> **📝 Important Notes:**
|
||||
> - The installer will automatically install/update `.codex/` and `.gemini/` directories
|
||||
> - **Global mode**: Installs to `~/.codex` and `~/.gemini`
|
||||
> - **Path mode**: Installs to your specified directory (e.g., `project/.codex`, `project/.gemini`)
|
||||
> - Existing files will be backed up automatically before installation
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Getting Started
|
||||
@@ -97,9 +148,6 @@ After installation, run the following command to ensure CCW is working:
|
||||
|
||||
# OR verify TDD compliance (TDD workflow)
|
||||
/workflow:tdd-verify
|
||||
|
||||
# Final quality review
|
||||
/workflow:review
|
||||
```
|
||||
|
||||
### Quick Start for Simple Tasks
|
||||
@@ -120,6 +168,22 @@ After installation, run the following command to ensure CCW is working:
|
||||
/workflow:execute
|
||||
```
|
||||
|
||||
> **💡 When to Use Which Approach?**
|
||||
>
|
||||
> **Use `/workflow:plan` + `/workflow:execute` for:**
|
||||
> - Complex features requiring multiple modules (>3 modules)
|
||||
> - Tasks with multiple subtasks (>5 subtasks)
|
||||
> - Cross-cutting changes affecting architecture
|
||||
> - Features requiring coordination between components
|
||||
> - When you need structured planning and progress tracking
|
||||
>
|
||||
> **Use Claude Code directly for:**
|
||||
> - Simple, focused changes (single file or module)
|
||||
> - Quick bug fixes with clear solutions
|
||||
> - Documentation updates
|
||||
> - Code refactoring within one component
|
||||
> - Straightforward feature additions
|
||||
|
||||
**Code Analysis:**
|
||||
```bash
|
||||
# Deep codebase analysis
|
||||
@@ -155,7 +219,7 @@ After installation, run the following command to ensure CCW is working:
|
||||
| `/workflow:status` | Display the current status of the workflow. |
|
||||
| `/workflow:test-gen` | Automatically generate a test plan from the implementation. |
|
||||
| `/workflow:tdd-verify` | Verify TDD compliance and generate quality report. |
|
||||
| `/workflow:review` | Initiate a quality assurance review of the completed work. |
|
||||
| `/workflow:review` | **Optional** manual review (only use when explicitly needed - passing tests = approved code). |
|
||||
|
||||
### **Task & Memory Commands**
|
||||
|
||||
|
||||
79
README_CN.md
79
README_CN.md
@@ -2,7 +2,7 @@
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||
[](LICENSE)
|
||||
[]()
|
||||
[](https://github.com/modelcontextprotocol)
|
||||
@@ -15,9 +15,13 @@
|
||||
|
||||
**Claude Code Workflow (CCW)** 是一个新一代的多智能体自动化开发框架,通过智能工作流管理和自主执行来协调复杂的软件开发任务。
|
||||
|
||||
> **🎉 最新版本: v3.1.0** - TDD 工作流支持,包含 Red-Green-Refactor 循环强制执行。详见 [CHANGELOG.md](CHANGELOG.md)。
|
||||
> **🎉 最新版本: v3.2.0** - 采用"测试即审查"理念简化智能体架构。详见 [CHANGELOG.md](CHANGELOG.md)。
|
||||
>
|
||||
> **v3.0.0 版本**: 引入了**统一的 CLI 命令结构**。`/cli:*` 命令通过 `--tool` 标志整合了所有工具(Gemini, Qwen, Codex)的交互。
|
||||
> **v3.2.0 版本新特性**:
|
||||
> - 🔄 从 3 个智能体简化为 2 个核心智能体(`@code-developer`、`@test-fix-agent`)
|
||||
> - ✅ "测试即审查" - 测试通过 = 代码批准
|
||||
> - 🧪 增强的测试修复工作流,支持自动执行和修复
|
||||
> - 📦 交互式安装,包含版本选择菜单
|
||||
|
||||
---
|
||||
|
||||
@@ -49,12 +53,59 @@ Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/cat
|
||||
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh)
|
||||
```
|
||||
|
||||
### **📋 交互式版本选择**
|
||||
|
||||
运行安装命令后,您将看到包含实时版本信息的交互式菜单:
|
||||
|
||||
```
|
||||
正在检测最新版本和提交...
|
||||
最新稳定版: v3.2.0 (2025-10-02 04:27 UTC)
|
||||
最新提交: cdea58f (2025-10-02 08:15 UTC)
|
||||
|
||||
====================================================
|
||||
版本选择菜单
|
||||
====================================================
|
||||
|
||||
1) 最新稳定版(推荐)
|
||||
|-- 版本: v3.2.0
|
||||
|-- 发布时间: 2025-10-02 04:27 UTC
|
||||
\-- 生产就绪
|
||||
|
||||
2) 最新开发版
|
||||
|-- 分支: main
|
||||
|-- 提交: cdea58f
|
||||
|-- 更新时间: 2025-10-02 08:15 UTC
|
||||
|-- 最新功能
|
||||
\-- 可能包含实验性更改
|
||||
|
||||
3) 指定版本
|
||||
|-- 安装特定标签版本
|
||||
\-- 最近版本: v3.2.0, v3.1.0, v3.0.1
|
||||
|
||||
====================================================
|
||||
|
||||
选择要安装的版本 (1-3, 默认: 1):
|
||||
```
|
||||
|
||||
**版本选项:**
|
||||
- **选项 1(推荐)**:经过验证的最新稳定版本,生产环境可用
|
||||
- **选项 2**:来自 main 分支的最新开发版本,包含最新功能
|
||||
- **选项 3**:指定版本标签,用于受控部署
|
||||
|
||||
> 💡 **提示**:安装程序会自动从 GitHub 检测并显示最新的版本号和发布日期。只需按 Enter 键即可选择推荐的稳定版本。
|
||||
|
||||
### **✅ 验证安装**
|
||||
安装后,运行以下命令以确保 CCW 正常工作:
|
||||
```bash
|
||||
/workflow:session:list
|
||||
```
|
||||
|
||||
> **📝 重要说明:**
|
||||
> - 安装程序将自动安装/更新 `.codex/` 和 `.gemini/` 目录
|
||||
> - **全局模式**:安装到 `~/.codex` 和 `~/.gemini`
|
||||
> - **路径模式**:安装到指定目录(例如 `project/.codex`、`project/.gemini`)
|
||||
> - 安装前会自动备份现有文件
|
||||
|
||||
---
|
||||
|
||||
## 🚀 快速入门
|
||||
@@ -98,8 +149,8 @@ bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflo
|
||||
# 或验证 TDD 合规性(TDD 工作流)
|
||||
/workflow:tdd-verify
|
||||
|
||||
# 最终质量审查
|
||||
/workflow:review
|
||||
# 可选:手动审查(仅在明确需要时使用)
|
||||
# /workflow:review # 测试通过 = 代码已批准
|
||||
```
|
||||
|
||||
### 简单任务快速入门
|
||||
@@ -120,6 +171,22 @@ bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflo
|
||||
/workflow:execute
|
||||
```
|
||||
|
||||
> **💡 何时使用哪种方式?**
|
||||
>
|
||||
> **使用 `/workflow:plan` + `/workflow:execute` 适用于:**
|
||||
> - 需要多个模块的复杂功能(>3 个模块)
|
||||
> - 包含多个子任务的任务(>5 个子任务)
|
||||
> - 影响架构的横切变更
|
||||
> - 需要组件间协调的功能
|
||||
> - 需要结构化规划和进度跟踪时
|
||||
>
|
||||
> **直接使用 Claude Code 适用于:**
|
||||
> - 简单、聚焦的变更(单个文件或模块)
|
||||
> - 解决方案明确的快速 bug 修复
|
||||
> - 文档更新
|
||||
> - 单个组件内的代码重构
|
||||
> - 简单直接的功能添加
|
||||
|
||||
**代码分析:**
|
||||
```bash
|
||||
# 深度代码库分析
|
||||
@@ -155,7 +222,7 @@ bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflo
|
||||
| `/workflow:status` | 显示工作流的当前状态。 |
|
||||
| `/workflow:test-gen` | 从实现中自动生成测试计划。 |
|
||||
| `/workflow:tdd-verify` | 验证 TDD 合规性并生成质量报告。 |
|
||||
| `/workflow:review` | 对已完成的工作启动质量保证审查。 |
|
||||
| `/workflow:review` | **可选** 手动审查(仅在明确需要时使用,测试通过即代表代码已批准)。 |
|
||||
|
||||
### **任务与内存命令**
|
||||
|
||||
|
||||
142
RELEASE_NOTES_v3.2.1.md
Normal file
142
RELEASE_NOTES_v3.2.1.md
Normal file
@@ -0,0 +1,142 @@
|
||||
# 🔧 Claude Code Workflow (CCW) v3.2.1 Release Notes
|
||||
|
||||
**Release Date**: October 2, 2025
|
||||
**Release Type**: Patch Release - Documentation Fix
|
||||
**Repository**: https://github.com/catlog22/Claude-Code-Workflow
|
||||
|
||||
---
|
||||
|
||||
## 📋 Overview
|
||||
|
||||
CCW v3.2.1 is a critical documentation fix release that corrects `workflow-session.json` path references throughout the brainstorming workflow documentation. This ensures consistency with the architecture specification defined in `workflow-architecture.md`.
|
||||
|
||||
---
|
||||
|
||||
## 🐛 Bug Fixes
|
||||
|
||||
### **Documentation Path Corrections**
|
||||
|
||||
**Issue**: Documentation incorrectly referenced `workflow-session.json` inside the `.brainstorming/` subdirectory
|
||||
|
||||
**Impact**:
|
||||
- Confusing path references in 9 brainstorming role documentation files
|
||||
- Inconsistency with architectural specifications
|
||||
- Potential runtime errors when commands attempt to read session metadata
|
||||
|
||||
**Fixed Files** (9 total):
|
||||
1. ✅ `data-architect.md`
|
||||
2. ✅ `product-manager.md`
|
||||
3. ✅ `product-owner.md`
|
||||
4. ✅ `scrum-master.md`
|
||||
5. ✅ `subject-matter-expert.md`
|
||||
6. ✅ `ui-designer.md`
|
||||
7. ✅ `ux-expert.md`
|
||||
8. ✅ `auto-parallel.md`
|
||||
9. ✅ `artifacts.md`
|
||||
|
||||
**Corrections Applied**:
|
||||
- ❌ **Incorrect**: `.workflow/WFS-{session}/.brainstorming/workflow-session.json`
|
||||
- ✅ **Correct**: `.workflow/WFS-{session}/workflow-session.json`
|
||||
|
||||
---
|
||||
|
||||
## 📐 Architecture Alignment
|
||||
|
||||
### Confirmed Standard Structure
|
||||
```
|
||||
.workflow/WFS-[topic-slug]/
|
||||
├── workflow-session.json # ✅ Session metadata (root level)
|
||||
├── .brainstorming/ # Brainstorming artifacts subdirectory
|
||||
│ └── topic-framework.md
|
||||
├── IMPL_PLAN.md
|
||||
├── TODO_LIST.md
|
||||
└── .task/
|
||||
└── IMPL-*.json
|
||||
```
|
||||
|
||||
### Key Points
|
||||
- `workflow-session.json` is **always at session root level**
|
||||
- `.brainstorming/` directory contains **only** framework and analysis files
|
||||
- No session metadata files inside subdirectories
|
||||
|
||||
---
|
||||
|
||||
## 📊 Changes Summary
|
||||
|
||||
| Category | Files Changed | Lines Modified |
|
||||
|----------|--------------|----------------|
|
||||
| Documentation Fixes | 9 | 19 insertions, 18 deletions |
|
||||
| Path Corrections | 8 role files | 2 corrections per file |
|
||||
| Structure Clarifications | 1 artifacts file | Added architectural note |
|
||||
|
||||
---
|
||||
|
||||
## ✅ Verification
|
||||
|
||||
**Pre-Release Checks**:
|
||||
- ✅ No incorrect `.brainstorming/workflow-session.json` references
|
||||
- ✅ No legacy `session.json` references
|
||||
- ✅ All brainstorming roles use correct paths
|
||||
- ✅ Architecture consistency verified with Gemini analysis
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Upgrade Instructions
|
||||
|
||||
### For Existing Users
|
||||
|
||||
**No action required** - This is a documentation-only fix.
|
||||
|
||||
1. Pull the latest changes:
|
||||
```bash
|
||||
git pull origin main
|
||||
```
|
||||
|
||||
2. Review updated documentation:
|
||||
- `.claude/commands/workflow/brainstorm/*.md`
|
||||
|
||||
### For New Users
|
||||
|
||||
Simply clone the repository with the correct documentation:
|
||||
```bash
|
||||
git clone https://github.com/catlog22/Claude-Code-Workflow.git
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Related Documentation
|
||||
|
||||
- **Architecture Reference**: `.claude/workflows/workflow-architecture.md`
|
||||
- **Brainstorming Commands**: `.claude/commands/workflow/brainstorm/`
|
||||
- **Session Management**: `.claude/commands/workflow/session/`
|
||||
|
||||
---
|
||||
|
||||
## 🙏 Acknowledgments
|
||||
|
||||
Special thanks to the analysis tools used in this fix:
|
||||
- **Gemini CLI**: Path verification and consistency checking
|
||||
- **Codex**: Initial codebase analysis
|
||||
- **Claude Code**: Documentation review and corrections
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Links
|
||||
|
||||
- **Full Changelog**: [v3.2.0...v3.2.1](https://github.com/catlog22/Claude-Code-Workflow/compare/v3.2.0...v3.2.1)
|
||||
- **Issues Fixed**: Documentation consistency issue
|
||||
- **Previous Release**: [v3.2.0 Release Notes](RELEASE_NOTES_v3.2.0.md)
|
||||
|
||||
---
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
- This is a **non-breaking change** - existing workflows will continue to function
|
||||
- Documentation now correctly reflects the implemented architecture
|
||||
- No code changes were necessary - this was purely a documentation correction
|
||||
|
||||
---
|
||||
|
||||
**Contributors**: Claude Code Development Team
|
||||
**License**: MIT
|
||||
**Support**: [GitHub Issues](https://github.com/catlog22/Claude-Code-Workflow/issues)
|
||||
@@ -1,16 +1,88 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# Claude Code Workflow (CCW) - Remote Installation Script
|
||||
# One-liner remote installation for Claude Code Workflow system
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Claude Code Workflow (CCW) - Remote Installation Script
|
||||
|
||||
.DESCRIPTION
|
||||
One-liner remote installation for Claude Code Workflow system.
|
||||
Downloads and installs CCW from GitHub with flexible version selection.
|
||||
|
||||
.PARAMETER Version
|
||||
Installation version type:
|
||||
- "stable" (default): Latest stable release tag
|
||||
- "latest": Latest main branch (development version)
|
||||
- "branch": Install from specific branch
|
||||
|
||||
.PARAMETER Tag
|
||||
Specific release tag to install (e.g., "v3.2.0")
|
||||
Only used when Version is "stable"
|
||||
|
||||
.PARAMETER Branch
|
||||
Branch name to install from (default: "main")
|
||||
Only used when Version is "branch"
|
||||
|
||||
.PARAMETER Global
|
||||
Install to global user directory (~/.claude)
|
||||
|
||||
.PARAMETER Directory
|
||||
Install to custom directory
|
||||
|
||||
.PARAMETER Force
|
||||
Skip confirmation prompts
|
||||
|
||||
.PARAMETER NoBackup
|
||||
Skip backup of existing installation
|
||||
|
||||
.PARAMETER NonInteractive
|
||||
Run in non-interactive mode
|
||||
|
||||
.PARAMETER BackupAll
|
||||
Backup all files including git-ignored files
|
||||
|
||||
.EXAMPLE
|
||||
# Install latest stable release (recommended)
|
||||
.\install-remote.ps1
|
||||
|
||||
.EXAMPLE
|
||||
# Install specific stable version
|
||||
.\install-remote.ps1 -Version stable -Tag "v3.2.0"
|
||||
|
||||
.EXAMPLE
|
||||
# Install latest development version
|
||||
.\install-remote.ps1 -Version latest
|
||||
|
||||
.EXAMPLE
|
||||
# Install from specific branch
|
||||
.\install-remote.ps1 -Version branch -Branch "feature/new-feature"
|
||||
|
||||
.EXAMPLE
|
||||
# Install to global directory without prompts
|
||||
.\install-remote.ps1 -Global -Force
|
||||
|
||||
.LINK
|
||||
https://github.com/catlog22/Claude-Code-Workflow
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet("stable", "latest", "branch")]
|
||||
[string]$Version = "stable",
|
||||
|
||||
[string]$Tag = "",
|
||||
|
||||
[string]$Branch = "main",
|
||||
|
||||
[switch]$Global,
|
||||
|
||||
[string]$Directory = "",
|
||||
|
||||
[switch]$Force,
|
||||
|
||||
[switch]$NoBackup,
|
||||
|
||||
[switch]$NonInteractive,
|
||||
[switch]$BackupAll,
|
||||
[string]$Branch = "main"
|
||||
|
||||
[switch]$BackupAll
|
||||
)
|
||||
|
||||
# Set encoding for proper Unicode support
|
||||
@@ -26,7 +98,7 @@ if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||
|
||||
# Script metadata
|
||||
$ScriptName = "Claude Code Workflow (CCW) Remote Installer"
|
||||
$Version = "2.1.1"
|
||||
$InstallerVersion = "2.2.0"
|
||||
|
||||
# Colors for output
|
||||
$ColorSuccess = "Green"
|
||||
@@ -43,7 +115,7 @@ function Write-ColorOutput {
|
||||
}
|
||||
|
||||
function Show-Header {
|
||||
Write-ColorOutput "==== $ScriptName v$Version ====" $ColorInfo
|
||||
Write-ColorOutput "==== $ScriptName v$InstallerVersion ====" $ColorInfo
|
||||
Write-ColorOutput "========================================================" $ColorInfo
|
||||
Write-Host ""
|
||||
}
|
||||
@@ -78,29 +150,70 @@ function Get-TempDirectory {
|
||||
return $tempDir
|
||||
}
|
||||
|
||||
function Get-LatestRelease {
|
||||
try {
|
||||
$apiUrl = "https://api.github.com/repos/catlog22/Claude-Code-Workflow/releases/latest"
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -UseBasicParsing
|
||||
return $response.tag_name
|
||||
} catch {
|
||||
Write-ColorOutput "WARNING: Failed to fetch latest release, using 'main' branch" $ColorWarning
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
function Download-Repository {
|
||||
param(
|
||||
[string]$TempDir,
|
||||
[string]$Branch = "main"
|
||||
[string]$Version = "stable",
|
||||
[string]$Branch = "main",
|
||||
[string]$Tag = ""
|
||||
)
|
||||
|
||||
|
||||
$repoUrl = "https://github.com/catlog22/Claude-Code-Workflow"
|
||||
$zipUrl = "$repoUrl/archive/refs/heads/$Branch.zip"
|
||||
|
||||
# Determine download URL based on version type
|
||||
if ($Version -eq "stable") {
|
||||
# Download latest stable release
|
||||
if ([string]::IsNullOrEmpty($Tag)) {
|
||||
$latestTag = Get-LatestRelease
|
||||
if ($latestTag) {
|
||||
$Tag = $latestTag
|
||||
} else {
|
||||
# Fallback to main branch if API fails
|
||||
$zipUrl = "$repoUrl/archive/refs/heads/main.zip"
|
||||
$downloadType = "main branch (fallback)"
|
||||
}
|
||||
}
|
||||
|
||||
if (-not [string]::IsNullOrEmpty($Tag)) {
|
||||
$zipUrl = "$repoUrl/archive/refs/tags/$Tag.zip"
|
||||
$downloadType = "stable release $Tag"
|
||||
}
|
||||
} elseif ($Version -eq "latest") {
|
||||
# Download latest main branch
|
||||
$zipUrl = "$repoUrl/archive/refs/heads/main.zip"
|
||||
$downloadType = "latest main branch"
|
||||
} else {
|
||||
# Download specific branch
|
||||
$zipUrl = "$repoUrl/archive/refs/heads/$Branch.zip"
|
||||
$downloadType = "branch $Branch"
|
||||
}
|
||||
|
||||
$zipPath = Join-Path $TempDir "repo.zip"
|
||||
|
||||
|
||||
Write-ColorOutput "Downloading from GitHub..." $ColorInfo
|
||||
Write-ColorOutput "Source: $repoUrl" $ColorInfo
|
||||
Write-ColorOutput "Branch: $Branch" $ColorInfo
|
||||
|
||||
Write-ColorOutput "Type: $downloadType" $ColorInfo
|
||||
|
||||
try {
|
||||
# Download with progress
|
||||
$progressPreference = $ProgressPreference
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
|
||||
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath -UseBasicParsing
|
||||
|
||||
|
||||
$ProgressPreference = $progressPreference
|
||||
|
||||
|
||||
if (Test-Path $zipPath) {
|
||||
$fileSize = (Get-Item $zipPath).Length
|
||||
Write-ColorOutput "Download complete ($([math]::Round($fileSize/1024/1024, 2)) MB)" $ColorSuccess
|
||||
@@ -225,29 +338,200 @@ function Wait-ForUserConfirmation {
|
||||
}
|
||||
}
|
||||
|
||||
function Show-VersionMenu {
|
||||
param(
|
||||
[string]$LatestStableVersion = "Detecting...",
|
||||
[string]$LatestStableDate = "",
|
||||
[string]$LatestCommitId = "",
|
||||
[string]$LatestCommitDate = ""
|
||||
)
|
||||
|
||||
Write-Host ""
|
||||
Write-ColorOutput "====================================================" $ColorInfo
|
||||
Write-ColorOutput " Version Selection Menu" $ColorInfo
|
||||
Write-ColorOutput "====================================================" $ColorInfo
|
||||
Write-Host ""
|
||||
|
||||
# Option 1: Latest Stable
|
||||
Write-ColorOutput "1) Latest Stable Release (Recommended)" $ColorSuccess
|
||||
if ($LatestStableVersion -ne "Detecting..." -and $LatestStableVersion -ne "Unknown") {
|
||||
Write-Host " |-- Version: $LatestStableVersion"
|
||||
if ($LatestStableDate) {
|
||||
Write-Host " |-- Released: $LatestStableDate"
|
||||
}
|
||||
Write-Host " \-- Production-ready"
|
||||
} else {
|
||||
Write-Host " |-- Version: Auto-detected from GitHub"
|
||||
Write-Host " \-- Production-ready"
|
||||
}
|
||||
Write-Host ""
|
||||
|
||||
# Option 2: Latest Development
|
||||
Write-ColorOutput "2) Latest Development Version" $ColorWarning
|
||||
Write-Host " |-- Branch: main"
|
||||
if ($LatestCommitId -and $LatestCommitDate) {
|
||||
Write-Host " |-- Commit: $LatestCommitId"
|
||||
Write-Host " |-- Updated: $LatestCommitDate"
|
||||
}
|
||||
Write-Host " |-- Cutting-edge features"
|
||||
Write-Host " \-- May contain experimental changes"
|
||||
Write-Host ""
|
||||
|
||||
# Option 3: Specific Version
|
||||
Write-ColorOutput "3) Specific Release Version" $ColorInfo
|
||||
Write-Host " |-- Install a specific tagged release"
|
||||
Write-Host " \-- Recent: v3.2.0, v3.1.0, v3.0.1"
|
||||
Write-Host ""
|
||||
|
||||
Write-ColorOutput "====================================================" $ColorInfo
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
function Get-UserVersionChoice {
|
||||
if ($NonInteractive -or $Force) {
|
||||
# Non-interactive mode: use default stable version
|
||||
return @{
|
||||
Type = "stable"
|
||||
Tag = $Tag
|
||||
Branch = $Branch
|
||||
}
|
||||
}
|
||||
|
||||
# Detect latest stable version and commit info
|
||||
Write-ColorOutput "Detecting latest release and commits..." $ColorInfo
|
||||
$latestVersion = "Unknown"
|
||||
$latestStableDate = ""
|
||||
$latestCommitId = ""
|
||||
$latestCommitDate = ""
|
||||
|
||||
try {
|
||||
# Get latest release info
|
||||
$apiUrl = "https://api.github.com/repos/catlog22/Claude-Code-Workflow/releases/latest"
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -UseBasicParsing -TimeoutSec 5
|
||||
$latestVersion = $response.tag_name
|
||||
|
||||
# Parse and format release date
|
||||
if ($response.published_at) {
|
||||
$publishDate = [DateTime]::Parse($response.published_at)
|
||||
$latestStableDate = $publishDate.ToString("yyyy-MM-dd HH:mm UTC")
|
||||
}
|
||||
|
||||
Write-ColorOutput "Latest stable: $latestVersion ($latestStableDate)" $ColorSuccess
|
||||
} catch {
|
||||
Write-ColorOutput "Could not detect latest release" $ColorWarning
|
||||
}
|
||||
|
||||
try {
|
||||
# Get latest commit info from main branch
|
||||
$commitUrl = "https://api.github.com/repos/catlog22/Claude-Code-Workflow/commits/main"
|
||||
$commitResponse = Invoke-RestMethod -Uri $commitUrl -UseBasicParsing -TimeoutSec 5
|
||||
$latestCommitId = $commitResponse.sha.Substring(0, 7)
|
||||
|
||||
# Parse and format commit date
|
||||
if ($commitResponse.commit.committer.date) {
|
||||
$commitDate = [DateTime]::Parse($commitResponse.commit.committer.date)
|
||||
$latestCommitDate = $commitDate.ToString("yyyy-MM-dd HH:mm UTC")
|
||||
}
|
||||
|
||||
Write-ColorOutput "Latest commit: $latestCommitId ($latestCommitDate)" $ColorSuccess
|
||||
} catch {
|
||||
Write-ColorOutput "Could not detect latest commit" $ColorWarning
|
||||
}
|
||||
|
||||
Show-VersionMenu -LatestStableVersion $latestVersion -LatestStableDate $latestStableDate -LatestCommitId $latestCommitId -LatestCommitDate $latestCommitDate
|
||||
|
||||
$choice = Read-Host "Select version to install (1-3, default: 1)"
|
||||
|
||||
switch ($choice) {
|
||||
"2" {
|
||||
Write-Host ""
|
||||
Write-ColorOutput "✓ Selected: Latest Development Version (main branch)" $ColorSuccess
|
||||
return @{
|
||||
Type = "latest"
|
||||
Tag = ""
|
||||
Branch = "main"
|
||||
}
|
||||
}
|
||||
"3" {
|
||||
Write-Host ""
|
||||
Write-ColorOutput "Available recent releases:" $ColorInfo
|
||||
Write-Host " v3.2.0, v3.1.0, v3.0.1, v3.0.0"
|
||||
Write-Host ""
|
||||
$tagInput = Read-Host "Enter version tag (e.g., v3.2.0)"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($tagInput)) {
|
||||
Write-ColorOutput "No tag specified, using latest stable" $ColorWarning
|
||||
return @{
|
||||
Type = "stable"
|
||||
Tag = ""
|
||||
Branch = "main"
|
||||
}
|
||||
}
|
||||
|
||||
Write-ColorOutput "✓ Selected: Specific Version $tagInput" $ColorSuccess
|
||||
return @{
|
||||
Type = "stable"
|
||||
Tag = $tagInput
|
||||
Branch = "main"
|
||||
}
|
||||
}
|
||||
default {
|
||||
Write-Host ""
|
||||
if ($latestVersion -ne "Unknown") {
|
||||
Write-ColorOutput "✓ Selected: Latest Stable Release ($latestVersion)" $ColorSuccess
|
||||
} else {
|
||||
Write-ColorOutput "✓ Selected: Latest Stable Release (auto-detect)" $ColorSuccess
|
||||
}
|
||||
return @{
|
||||
Type = "stable"
|
||||
Tag = ""
|
||||
Branch = "main"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Main {
|
||||
Show-Header
|
||||
|
||||
|
||||
Write-ColorOutput "This will download and install Claude Code Workflow System from GitHub." $ColorInfo
|
||||
Write-Host ""
|
||||
|
||||
|
||||
# Test prerequisites
|
||||
Write-ColorOutput "Checking system requirements..." $ColorInfo
|
||||
if (-not (Test-Prerequisites)) {
|
||||
Wait-ForUserConfirmation "System check failed! Press any key to exit..." -ExitAfter
|
||||
}
|
||||
|
||||
|
||||
# Get version choice from user (interactive menu)
|
||||
$versionChoice = Get-UserVersionChoice
|
||||
$script:Version = $versionChoice.Type
|
||||
$script:Tag = $versionChoice.Tag
|
||||
$script:Branch = $versionChoice.Branch
|
||||
|
||||
# Determine version information for display
|
||||
$versionInfo = switch ($Version) {
|
||||
"stable" {
|
||||
if ($Tag) { "Stable release: $Tag" }
|
||||
else { "Latest stable release (auto-detected)" }
|
||||
}
|
||||
"latest" { "Latest main branch (development)" }
|
||||
"branch" { "Custom branch: $Branch" }
|
||||
}
|
||||
|
||||
# Confirm installation
|
||||
if (-not $NonInteractive -and -not $Force) {
|
||||
Write-Host ""
|
||||
Write-ColorOutput "SECURITY NOTE:" $ColorWarning
|
||||
Write-Host "- This script will download and execute Claude Code Workflow from GitHub"
|
||||
Write-Host "- Repository: https://github.com/catlog22/Claude-Code-Workflow"
|
||||
Write-Host "- Branch: $Branch (latest stable version)"
|
||||
Write-ColorOutput "INSTALLATION DETAILS:" $ColorInfo
|
||||
Write-Host "- Repository: https://github.com/catlog22/Claude-Code-Workflow"
|
||||
Write-Host "- Version: $versionInfo"
|
||||
Write-Host "- Features: Intelligent workflow orchestration with multi-agent coordination"
|
||||
Write-Host ""
|
||||
Write-ColorOutput "SECURITY NOTE:" $ColorWarning
|
||||
Write-Host "- This script will download and execute code from GitHub"
|
||||
Write-Host "- Please ensure you trust this source"
|
||||
Write-Host ""
|
||||
|
||||
|
||||
$choice = Read-Host "Continue with installation? (y/N)"
|
||||
if ($choice -notmatch '^[Yy]') {
|
||||
Write-ColorOutput "Installation cancelled" $ColorWarning
|
||||
@@ -261,7 +545,7 @@ function Main {
|
||||
|
||||
try {
|
||||
# Download repository
|
||||
$zipPath = Download-Repository $tempDir $Branch
|
||||
$zipPath = Download-Repository -TempDir $tempDir -Version $Version -Branch $Branch -Tag $Tag
|
||||
if (-not $zipPath) {
|
||||
throw "Download failed"
|
||||
}
|
||||
|
||||
@@ -6,9 +6,13 @@ set -e # Exit on error
|
||||
|
||||
# Script metadata
|
||||
SCRIPT_NAME="Claude Code Workflow (CCW) Remote Installer"
|
||||
VERSION="2.1.1"
|
||||
INSTALLER_VERSION="2.2.0"
|
||||
BRANCH="${BRANCH:-main}"
|
||||
|
||||
# Version control
|
||||
VERSION_TYPE="${VERSION_TYPE:-stable}" # stable, latest, branch
|
||||
TAG_VERSION=""
|
||||
|
||||
# Colors for output
|
||||
COLOR_RESET='\033[0m'
|
||||
COLOR_SUCCESS='\033[0;32m'
|
||||
@@ -32,7 +36,7 @@ function write_color() {
|
||||
}
|
||||
|
||||
function show_header() {
|
||||
write_color "==== $SCRIPT_NAME v$VERSION ====" "$COLOR_INFO"
|
||||
write_color "==== $SCRIPT_NAME v$INSTALLER_VERSION ====" "$COLOR_INFO"
|
||||
write_color "========================================================" "$COLOR_INFO"
|
||||
echo ""
|
||||
}
|
||||
@@ -72,17 +76,80 @@ function get_temp_directory() {
|
||||
echo "$temp_dir"
|
||||
}
|
||||
|
||||
function get_latest_release() {
|
||||
local api_url="https://api.github.com/repos/catlog22/Claude-Code-Workflow/releases/latest"
|
||||
|
||||
if command -v jq &> /dev/null; then
|
||||
# Use jq if available
|
||||
local tag
|
||||
tag=$(curl -fsSL "$api_url" 2>/dev/null | jq -r '.tag_name' 2>/dev/null)
|
||||
if [ -n "$tag" ] && [ "$tag" != "null" ]; then
|
||||
echo "$tag"
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
# Fallback: parse JSON with grep/sed
|
||||
local tag
|
||||
tag=$(curl -fsSL "$api_url" 2>/dev/null | grep -o '"tag_name":\s*"[^"]*"' | sed 's/"tag_name":\s*"\([^"]*\)"/\1/')
|
||||
if [ -n "$tag" ]; then
|
||||
echo "$tag"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
write_color "WARNING: Failed to fetch latest release, using 'main' branch" "$COLOR_WARNING" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
function download_repository() {
|
||||
local temp_dir="$1"
|
||||
local branch="${2:-main}"
|
||||
local version_type="${2:-stable}"
|
||||
local branch="${3:-main}"
|
||||
local tag="${4:-}"
|
||||
local repo_url="https://github.com/catlog22/Claude-Code-Workflow"
|
||||
local zip_url="${repo_url}/archive/refs/heads/${branch}.zip"
|
||||
local zip_url=""
|
||||
local download_type=""
|
||||
|
||||
# Determine download URL based on version type
|
||||
case "$version_type" in
|
||||
stable)
|
||||
# Download latest stable release
|
||||
if [ -z "$tag" ]; then
|
||||
tag=$(get_latest_release)
|
||||
if [ -z "$tag" ]; then
|
||||
# Fallback to main branch if API fails
|
||||
zip_url="${repo_url}/archive/refs/heads/main.zip"
|
||||
download_type="main branch (fallback)"
|
||||
else
|
||||
zip_url="${repo_url}/archive/refs/tags/${tag}.zip"
|
||||
download_type="stable release $tag"
|
||||
fi
|
||||
else
|
||||
zip_url="${repo_url}/archive/refs/tags/${tag}.zip"
|
||||
download_type="stable release $tag"
|
||||
fi
|
||||
;;
|
||||
latest)
|
||||
# Download latest main branch
|
||||
zip_url="${repo_url}/archive/refs/heads/main.zip"
|
||||
download_type="latest main branch"
|
||||
;;
|
||||
branch)
|
||||
# Download specific branch
|
||||
zip_url="${repo_url}/archive/refs/heads/${branch}.zip"
|
||||
download_type="branch $branch"
|
||||
;;
|
||||
*)
|
||||
write_color "ERROR: Invalid version type: $version_type" "$COLOR_ERROR" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
local zip_path="${temp_dir}/repo.zip"
|
||||
|
||||
write_color "Downloading from GitHub..." "$COLOR_INFO" >&2
|
||||
write_color "Source: $repo_url" "$COLOR_INFO" >&2
|
||||
write_color "Branch: $branch" "$COLOR_INFO" >&2
|
||||
write_color "URL: $zip_url" "$COLOR_INFO" >&2
|
||||
write_color "Type: $download_type" "$COLOR_INFO" >&2
|
||||
|
||||
# Download with curl
|
||||
if curl -fsSL -o "$zip_path" "$zip_url" 2>&1 >&2; then
|
||||
@@ -217,6 +284,23 @@ function wait_for_user() {
|
||||
function parse_arguments() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--version)
|
||||
VERSION_TYPE="$2"
|
||||
if [[ ! "$VERSION_TYPE" =~ ^(stable|latest|branch)$ ]]; then
|
||||
write_color "ERROR: Invalid version type: $VERSION_TYPE" "$COLOR_ERROR"
|
||||
write_color "Valid options: stable, latest, branch" "$COLOR_ERROR"
|
||||
exit 1
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--tag)
|
||||
TAG_VERSION="$2"
|
||||
shift 2
|
||||
;;
|
||||
--branch)
|
||||
BRANCH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--global)
|
||||
INSTALL_GLOBAL=true
|
||||
shift
|
||||
@@ -241,10 +325,6 @@ function parse_arguments() {
|
||||
BACKUP_ALL=true
|
||||
shift
|
||||
;;
|
||||
--branch)
|
||||
BRANCH="$2"
|
||||
shift 2
|
||||
;;
|
||||
--help)
|
||||
show_help
|
||||
exit 0
|
||||
@@ -260,33 +340,208 @@ function parse_arguments() {
|
||||
|
||||
function show_help() {
|
||||
cat << EOF
|
||||
$SCRIPT_NAME v$VERSION
|
||||
$SCRIPT_NAME v$INSTALLER_VERSION
|
||||
|
||||
Usage: $0 [OPTIONS]
|
||||
|
||||
Options:
|
||||
Version Options:
|
||||
--version TYPE Version type: stable (default), latest, or branch
|
||||
--tag TAG Specific release tag (e.g., v3.2.0) - for stable version
|
||||
--branch BRANCH Branch name (default: main) - for branch version
|
||||
|
||||
Installation Options:
|
||||
--global Install to global user directory (~/.claude)
|
||||
--directory DIR Install to custom directory
|
||||
--force Force installation without prompts
|
||||
--no-backup Skip backup creation
|
||||
--non-interactive Non-interactive mode (no prompts)
|
||||
--backup-all Backup all files before installation
|
||||
--branch BRANCH Specify GitHub branch (default: main)
|
||||
--help Show this help message
|
||||
|
||||
Examples:
|
||||
# Interactive installation
|
||||
# Install latest stable release (recommended)
|
||||
$0
|
||||
|
||||
# Install specific stable version
|
||||
$0 --version stable --tag v3.2.0
|
||||
|
||||
# Install latest development version
|
||||
$0 --version latest
|
||||
|
||||
# Install from specific branch
|
||||
$0 --version branch --branch feature/new-feature
|
||||
|
||||
# Global installation without prompts
|
||||
$0 --global --non-interactive
|
||||
|
||||
# Custom directory installation
|
||||
$0 --directory /opt/claude-code-workflow
|
||||
|
||||
Repository: https://github.com/catlog22/Claude-Code-Workflow
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
function show_version_menu() {
|
||||
local latest_version="$1"
|
||||
local latest_date="$2"
|
||||
local commit_id="$3"
|
||||
local commit_date="$4"
|
||||
|
||||
echo ""
|
||||
write_color "====================================================" "$COLOR_INFO"
|
||||
write_color " Version Selection Menu" "$COLOR_INFO"
|
||||
write_color "====================================================" "$COLOR_INFO"
|
||||
echo ""
|
||||
|
||||
# Option 1: Latest Stable
|
||||
write_color "1) Latest Stable Release (Recommended)" "$COLOR_SUCCESS"
|
||||
if [ -n "$latest_version" ] && [ "$latest_version" != "Unknown" ]; then
|
||||
echo " |-- Version: $latest_version"
|
||||
if [ -n "$latest_date" ]; then
|
||||
echo " |-- Released: $latest_date"
|
||||
fi
|
||||
echo " \-- Production-ready"
|
||||
else
|
||||
echo " |-- Version: Auto-detected from GitHub"
|
||||
echo " \-- Production-ready"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# Option 2: Latest Development
|
||||
write_color "2) Latest Development Version" "$COLOR_WARNING"
|
||||
echo " |-- Branch: main"
|
||||
if [ -n "$commit_id" ] && [ -n "$commit_date" ]; then
|
||||
echo " |-- Commit: $commit_id"
|
||||
echo " |-- Updated: $commit_date"
|
||||
fi
|
||||
echo " |-- Cutting-edge features"
|
||||
echo " \-- May contain experimental changes"
|
||||
echo ""
|
||||
|
||||
# Option 3: Specific Version
|
||||
write_color "3) Specific Release Version" "$COLOR_INFO"
|
||||
echo " |-- Install a specific tagged release"
|
||||
echo " \-- Recent: v3.2.0, v3.1.0, v3.0.1"
|
||||
echo ""
|
||||
|
||||
write_color "====================================================" "$COLOR_INFO"
|
||||
echo ""
|
||||
}
|
||||
|
||||
function get_user_version_choice() {
|
||||
if [ "$NON_INTERACTIVE" = true ] || [ "$FORCE" = true ]; then
|
||||
# Non-interactive mode: use default stable version
|
||||
echo "stable"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Detect latest stable version and commit info
|
||||
write_color "Detecting latest release and commits..." "$COLOR_INFO"
|
||||
local latest_version="Unknown"
|
||||
local latest_date=""
|
||||
local commit_id=""
|
||||
local commit_date=""
|
||||
|
||||
# Get latest release info
|
||||
local release_data
|
||||
release_data=$(curl -fsSL --connect-timeout 5 "https://api.github.com/repos/catlog22/Claude-Code-Workflow/releases/latest" 2>/dev/null)
|
||||
|
||||
if [ -n "$release_data" ]; then
|
||||
if command -v jq &> /dev/null; then
|
||||
latest_version=$(echo "$release_data" | jq -r '.tag_name' 2>/dev/null)
|
||||
local published_at=$(echo "$release_data" | jq -r '.published_at' 2>/dev/null)
|
||||
if [ -n "$published_at" ] && [ "$published_at" != "null" ]; then
|
||||
# Format: 2025-10-02T04:27:21Z -> 2025-10-02 04:27 UTC
|
||||
latest_date=$(echo "$published_at" | sed 's/T/ /' | sed 's/Z/ UTC/' | cut -d'.' -f1)
|
||||
fi
|
||||
else
|
||||
latest_version=$(echo "$release_data" | grep -o '"tag_name":\s*"[^"]*"' | sed 's/"tag_name":\s*"\([^"]*\)"/\1/')
|
||||
local published_at=$(echo "$release_data" | grep -o '"published_at":\s*"[^"]*"' | sed 's/"published_at":\s*"\([^"]*\)"/\1/')
|
||||
if [ -n "$published_at" ]; then
|
||||
latest_date=$(echo "$published_at" | sed 's/T/ /' | sed 's/Z/ UTC/' | cut -d'.' -f1)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$latest_version" ] && [ "$latest_version" != "null" ] && [ "$latest_version" != "Unknown" ]; then
|
||||
write_color "Latest stable: $latest_version ($latest_date)" "$COLOR_SUCCESS"
|
||||
else
|
||||
latest_version="Unknown"
|
||||
write_color "Could not detect latest release" "$COLOR_WARNING"
|
||||
fi
|
||||
|
||||
# Get latest commit info
|
||||
local commit_data
|
||||
commit_data=$(curl -fsSL --connect-timeout 5 "https://api.github.com/repos/catlog22/Claude-Code-Workflow/commits/main" 2>/dev/null)
|
||||
|
||||
if [ -n "$commit_data" ]; then
|
||||
if command -v jq &> /dev/null; then
|
||||
commit_id=$(echo "$commit_data" | jq -r '.sha' 2>/dev/null | cut -c1-7)
|
||||
local committer_date=$(echo "$commit_data" | jq -r '.commit.committer.date' 2>/dev/null)
|
||||
if [ -n "$committer_date" ] && [ "$committer_date" != "null" ]; then
|
||||
commit_date=$(echo "$committer_date" | sed 's/T/ /' | sed 's/Z/ UTC/' | cut -d'.' -f1)
|
||||
fi
|
||||
else
|
||||
commit_id=$(echo "$commit_data" | grep -o '"sha":\s*"[^"]*"' | head -1 | sed 's/"sha":\s*"\([^"]*\)"/\1/' | cut -c1-7)
|
||||
local committer_date=$(echo "$commit_data" | grep -o '"date":\s*"[^"]*"' | head -1 | sed 's/"date":\s*"\([^"]*\)"/\1/')
|
||||
if [ -n "$committer_date" ]; then
|
||||
commit_date=$(echo "$committer_date" | sed 's/T/ /' | sed 's/Z/ UTC/' | cut -d'.' -f1)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$commit_id" ] && [ -n "$commit_date" ]; then
|
||||
write_color "Latest commit: $commit_id ($commit_date)" "$COLOR_SUCCESS"
|
||||
else
|
||||
write_color "Could not detect latest commit" "$COLOR_WARNING"
|
||||
fi
|
||||
|
||||
show_version_menu "$latest_version" "$latest_date" "$commit_id" "$commit_date"
|
||||
|
||||
read -p "Select version to install (1-3, default: 1): " choice
|
||||
|
||||
case "$choice" in
|
||||
2)
|
||||
echo ""
|
||||
write_color "✓ Selected: Latest Development Version (main branch)" "$COLOR_SUCCESS"
|
||||
VERSION_TYPE="latest"
|
||||
TAG_VERSION=""
|
||||
BRANCH="main"
|
||||
;;
|
||||
3)
|
||||
echo ""
|
||||
write_color "Available recent releases:" "$COLOR_INFO"
|
||||
echo " v3.2.0, v3.1.0, v3.0.1, v3.0.0"
|
||||
echo ""
|
||||
read -p "Enter version tag (e.g., v3.2.0): " tag_input
|
||||
|
||||
if [ -z "$tag_input" ]; then
|
||||
write_color "⚠ No tag specified, using latest stable" "$COLOR_WARNING"
|
||||
VERSION_TYPE="stable"
|
||||
TAG_VERSION=""
|
||||
else
|
||||
echo ""
|
||||
write_color "✓ Selected: Specific Version $tag_input" "$COLOR_SUCCESS"
|
||||
VERSION_TYPE="stable"
|
||||
TAG_VERSION="$tag_input"
|
||||
fi
|
||||
BRANCH="main"
|
||||
;;
|
||||
*)
|
||||
echo ""
|
||||
if [ "$latest_version" != "Unknown" ]; then
|
||||
write_color "✓ Selected: Latest Stable Release ($latest_version)" "$COLOR_SUCCESS"
|
||||
else
|
||||
write_color "✓ Selected: Latest Stable Release (auto-detect)" "$COLOR_SUCCESS"
|
||||
fi
|
||||
VERSION_TYPE="stable"
|
||||
TAG_VERSION=""
|
||||
BRANCH="main"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function main() {
|
||||
show_header
|
||||
|
||||
@@ -300,14 +555,37 @@ function main() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get version choice from user (interactive menu)
|
||||
get_user_version_choice
|
||||
|
||||
# Determine version information for display
|
||||
local version_info=""
|
||||
case "$VERSION_TYPE" in
|
||||
stable)
|
||||
if [ -n "$TAG_VERSION" ]; then
|
||||
version_info="Stable release: $TAG_VERSION"
|
||||
else
|
||||
version_info="Latest stable release (auto-detected)"
|
||||
fi
|
||||
;;
|
||||
latest)
|
||||
version_info="Latest main branch (development)"
|
||||
;;
|
||||
branch)
|
||||
version_info="Custom branch: $BRANCH"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Confirm installation
|
||||
if [ "$NON_INTERACTIVE" != true ] && [ "$FORCE" != true ]; then
|
||||
echo ""
|
||||
write_color "SECURITY NOTE:" "$COLOR_WARNING"
|
||||
echo "- This script will download and execute Claude Code Workflow from GitHub"
|
||||
write_color "INSTALLATION DETAILS:" "$COLOR_INFO"
|
||||
echo "- Repository: https://github.com/catlog22/Claude-Code-Workflow"
|
||||
echo "- Branch: $BRANCH (latest stable version)"
|
||||
echo "- Version: $version_info"
|
||||
echo "- Features: Intelligent workflow orchestration with multi-agent coordination"
|
||||
echo ""
|
||||
write_color "SECURITY NOTE:" "$COLOR_WARNING"
|
||||
echo "- This script will download and execute code from GitHub"
|
||||
echo "- Please ensure you trust this source"
|
||||
echo ""
|
||||
|
||||
@@ -328,7 +606,7 @@ function main() {
|
||||
# Download repository
|
||||
local zip_path
|
||||
write_color "Starting download process..." "$COLOR_INFO"
|
||||
zip_path=$(download_repository "$temp_dir" "$BRANCH")
|
||||
zip_path=$(download_repository "$temp_dir" "$VERSION_TYPE" "$BRANCH" "$TAG_VERSION")
|
||||
local download_status=$?
|
||||
|
||||
if [ $download_status -eq 0 ] && [ -n "$zip_path" ] && [ -f "$zip_path" ]; then
|
||||
|
||||
Reference in New Issue
Block a user