Compare commits

...

13 Commits

Author SHA1 Message Date
catlog22
2efd45b0ed feat: Redesign test-gen workflow with independent session and cross-session context
Major redesign of test-gen workflow based on simplified architecture:

Core Changes:
- Creates independent test session (WFS-test-[source]) instead of modifying existing session
- Implements 4-phase execution with concept-enhanced analysis integration
- Reuses IMPL-*.json format with meta.type="test-fix" (no new task type)
- Auto-detects cross-session context via workflow-session.json metadata

4-Phase Workflow:
1. Phase 1: Create test session with workflow_type and source_session_id metadata
2. Phase 2: Auto-detect and gather cross-session context (summaries, git changes, tests)
3. Phase 3: Analyze implementation with concept-enhanced (parallel Gemini + Codex)
4. Phase 4: Generate IMPL-001.json task with test strategy from ANALYSIS_RESULTS.md

Key Features:
- Session isolation: Test session separate from implementation session
- Parameter simplification: context-gather auto-detects via metadata (no --source-session param)
- Format reuse: IMPL-*.json with meta.type field (zero changes to execute/status tools)
- Analysis integration: concept-enhanced provides comprehensive test strategy and code targets
- Automatic cross-session: Collects source session artifacts automatically

Tool Modifications Required:
- session-start: Support test session metadata (workflow_type, source_session_id)
- context-gather: Auto-detect test session and gather from source session
- task-generate: Extract test strategy from ANALYSIS_RESULTS.md
- concept-enhanced: No changes (already supports analysis)
- execute: No changes (already dispatches by meta.agent)

Data Flow:
User → session-start (creates test session) → context-gather (auto cross-session)
→ concept-enhanced (analyzes + generates strategy) → task-generate (creates task)
→ Returns summary → User triggers /workflow:execute separately

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 12:04:00 +08:00
catlog22
ae77e698db docs: Add prerequisites section with required tools installation guide
Added comprehensive prerequisites section to both English and Chinese README files:
- Core CLI tools: Gemini CLI, Codex CLI, Qwen Code with GitHub links
- System utilities: ripgrep, jq with download links
- Platform-specific quick install commands (macOS, Ubuntu/Debian, Windows)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 09:36:47 +08:00
catlog22
b945e2de55 docs: Enhance target_files documentation and fix cross-platform command compatibility
## Target Files Enhancement
- Add support for new file creation in target_files format
- Update task-generate.md with comprehensive target_files generation guide
- Update concept-enhanced.md to output code modification targets
- Add examples showing both modification (file:function:lines) and creation (file) formats

## Cross-Platform Command Fixes
- Replace ls with find commands for better Windows Git Bash compatibility
- Update workflow commands: execute.md, status.md, review.md
- Update session commands: list.md, complete.md
- Add Bash environment guidelines to context-search-strategy.md
- Document forbidden Windows commands (findstr, dir, where, etc.)

## Files Updated
- Core workflows: workflow-architecture.md, task-core.md
- Command docs: 9 workflow command files
- Agent docs: action-planning-agent.md, task-generate-agent.md
- Strategy docs: context-search-strategy.md

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 22:40:37 +08:00
catlog22
661cb5be1c chore: Bump version to v3.2.1
- Update version badges in README.md, README_CN.md, PROJECT_INTRODUCTION.md
- Add RELEASE_NOTES_v3.2.1.md with detailed documentation fix changelog
- Document workflow-session.json path corrections

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 22:10:01 +08:00
catlog22
94a2150836 fix: Correct workflow-session.json path references in brainstorming docs
- Fix incorrect path: .brainstorming/workflow-session.json → /workflow-session.json
- Update 8 role files: data-architect, product-manager, product-owner, scrum-master,
  subject-matter-expert, ui-designer, ux-expert, auto-parallel
- Update artifacts.md to clarify correct session file location
- Align all paths with workflow-architecture.md standard structure

Fixes session file path confusion issue. workflow-session.json should be at
session root (.workflow/WFS-{session}/), not in .brainstorming/ subdirectory.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 22:08:56 +08:00
catlog22
3067b8bda6 feat: Add .codex and .gemini agent configuration support
- Add .codex/Agent.md: Codex agent execution protocol
- Add .gemini/CLAUDE.md: Gemini agent execution protocol
- Update Install-Claude.ps1: Install .codex/.gemini to user profile (global) or target dir (path mode)
- Update Install-Claude.sh: Same installation support for bash
- Update intelligent-tools-strategy.md: Add MODE field definitions for Gemini/Qwen/Codex
- Update README.md: Add installation notes and workflow selection guide
- Update README_CN.md: Add Chinese version of installation notes and workflow guide

Installation behavior:
- Global mode: .codex and .gemini install to ~/.codex and ~/.gemini
- Path mode: .codex and .gemini install to <target-dir>/.codex and <target-dir>/.gemini
- Automatic backup of existing files before installation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 15:24:33 +08:00
catlog22
47973718d6 docs: Update version badges and highlights to v3.2.0
Updated version information across README files:

Version Badge Updates:
- Changed version badge from v3.1.0 to v3.2.0
- Updated both English and Chinese README files

Highlights Section Refresh:
- Updated "Latest" section to highlight v3.2.0 features
- Replaced TDD workflow announcement with agent architecture simplification
- Added "What's New in v3.2.0" bullet points

New v3.2.0 Highlights:
- 🔄 Simplified from 3 agents to 2 core agents
-  "Tests Are the Review" philosophy
- 🧪 Enhanced test-fix workflow
- 📦 Interactive installation with version selection

English (README.md):
> Latest: v3.2.0 - Simplified agent architecture with "Tests Are the Review" philosophy
> What's New in v3.2.0:
> - Simplified from 3 agents to 2 core agents
> - "Tests Are the Review" - Passing tests = approved code
> - Enhanced test-fix workflow with automatic execution and fixing
> - Interactive installation with version selection menu

Chinese (README_CN.md):
> 最新版本: v3.2.0 - 采用"测试即审查"理念简化智能体架构
> v3.2.0 版本新特性:
> - 从 3 个智能体简化为 2 个核心智能体
> - "测试即审查" - 测试通过 = 代码批准
> - 增强的测试修复工作流,支持自动执行和修复
> - 交互式安装,包含版本选择菜单

Removed References:
- Removed v3.0.0 and v3.1.0 highlights (moved to CHANGELOG)
- Cleaned up outdated version announcements

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:56:20 +08:00
catlog22
0b63465e5a docs: Update README with detailed interactive version selection menu
Enhanced installation documentation with complete menu examples:

Added Sections:
- Interactive Version Selection section with full menu display
- Real-time version detection explanation
- Detailed version options descriptions
- Pro tips for users

Menu Example Included:
- Shows actual menu layout with version numbers
- Displays release dates and commit information
- Shows all three version options with descriptions
- Includes recent version list for reference

Documentation Improvements:
- Moved from simple bullet points to full interactive example
- Added ASCII menu visualization
- Explained automatic version detection from GitHub API
- Provided clear guidance on each version option
- Added Pro Tip about default selection

Both English and Chinese Versions:
- README.md: Complete English documentation
- README_CN.md: Complete Chinese translation
- Consistent formatting and examples

Key Information Displayed:
1. Latest Stable Release
   - Version number (e.g., v3.2.0)
   - Release date with UTC timezone
   - Production-ready indicator

2. Latest Development Version
   - Branch name (main)
   - 7-character commit SHA
   - Last update timestamp
   - Feature and stability warnings

3. Specific Release Version
   - Manual version selection
   - List of recent versions
   - Use case for controlled deployments

User Benefits:
- Clear understanding of version selection process
- Visual preview of installation menu
- Informed decision making about version choice
- Reduced installation confusion

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:53:33 +08:00
catlog22
0a85e98fdb chore: 删除未使用的图像文件 2025-10-02 12:49:34 +08:00
catlog22
cdea58f32f fix: Fix Unicode display and add detailed version info to menu
Fixed Issues:
- Unicode tree characters causing display corruption
- Replaced Unicode symbols (└─) with ASCII alternatives (|-- and \--)
- Now uses ASCII-safe characters that display correctly in all terminals

Enhanced Version Information:
- Stable Release: Now shows release date
  * Version: v3.2.0
  * Released: 2025-10-02 04:27 UTC

- Development Version: Now shows commit details
  * Branch: main
  * Commit: ed1e1c4 (7-char SHA)
  * Updated: 2025-10-02 08:15 UTC

Technical Improvements:
- Query both releases and commits APIs in parallel
- Parse and format ISO 8601 timestamps
- Display dates in readable format (YYYY-MM-DD HH:MM UTC)
- Show 7-character commit SHA for brevity
- Wider separator lines for better visibility

Menu Display Format:
===================================================
           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: ed1e1c4
   |-- 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

===================================================

Implementation Details:
- PowerShell: DateTime.Parse() for timestamp formatting
- Bash: sed/cut pipeline for date parsing (jq optional)
- Graceful degradation if API calls fail
- 5-second timeout for quick response

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:48:09 +08:00
catlog22
ed1e1c4bbf feat: Add dynamic version detection to installation menu
Enhanced version selection menu with real-time version detection:

New Features:
- Auto-detect and display latest stable version in menu
- Show branch name for development version (main)
- Display recent release versions for reference
- Improved menu layout with tree-style formatting
- Real-time GitHub API query for latest release

Menu Improvements:
- Wider separator lines for better visibility
- Tree-style indicators (└─) for sub-items
- Color-coded options (Green=Stable, Yellow=Dev, Cyan=Custom)
- Version information displayed directly in menu
- Fallback handling if API request fails

User Experience:
Before:
  1) Latest Stable Release (Recommended)
     - Production-ready version

After:
  1) Latest Stable Release (Recommended)
     └─ Version: v3.2.0
     └─ Production-ready

Implementation:
- PowerShell: Invoke-RestMethod with 5s timeout
- Bash: curl with jq (preferred) or grep/sed fallback
- Graceful degradation if network unavailable
- "Detecting latest release..." status message
- Confirmation message shows selected version

Example Output:
  Detecting latest release...
  Latest stable release: v3.2.0

  ============================================
           Version Selection Menu
  ============================================

  1) Latest Stable Release (Recommended)
     └─ Version: v3.2.0
     └─ Production-ready

  2) Latest Development Version
     └─ Branch: main
     └─ Cutting-edge features

  3) Specific Release Version
     └─ Recent releases: v3.2.0, v3.1.0, v3.0.1

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:43:03 +08:00
catlog22
b1a2885799 feat: Add interactive version selection menu to installation scripts
Enhanced installation experience with interactive version selection:

New Features:
- Interactive menu during installation (no CLI parameters needed)
- 3 options presented to users:
  1. Latest Stable Release (Recommended) - Auto-detected from GitHub
  2. Latest Development Version - Cutting-edge features
  3. Specific Release Version - User enters desired tag
- Clear descriptions for each option
- Visual feedback with colored output
- Default to stable release on Enter

User Experience Improvements:
- Simplified one-liner installation commands
- Version selection happens during installation, not via parameters
- Non-interactive mode still supported via --non-interactive flag
- CLI parameters retained for advanced users (backward compatible)

Installation Scripts:
- install-remote.ps1: Added Show-VersionMenu() and Get-UserVersionChoice()
- install-remote.sh: Added show_version_menu() and get_user_version_choice()

Documentation Updates:
- README.md: Simplified to single installation command with menu note
- README_CN.md: Chinese version with menu explanation
- Removed complex multi-section installation examples

Example Flow:
1. User runs one-liner installation command
2. System checks prerequisites
3. Interactive menu appears with 3 choices
4. User selects version (or presses Enter for default)
5. Installation proceeds with selected version

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:40:33 +08:00
catlog22
c39f311a20 feat: Add version selection support to installation scripts
Enhanced both Windows and Linux/macOS installation scripts with flexible version selection:

New Features:
- Version selection: stable (default), latest, or branch
- Specific release tag installation (e.g., v3.2.0)
- Auto-detection of latest stable release via GitHub API
- Clear version information displayed during installation

Installation Script Updates:
- install-remote.ps1: Added -Version, -Tag parameters
- install-remote.sh: Added --version, --tag flags
- Updated help documentation with examples
- Improved user prompts with version information

Documentation Updates:
- README.md: Added installation examples for all version types
- README_CN.md: Added Chinese installation examples
- Clear distinction between stable, latest, and specific versions

Examples:
- Stable (recommended): Default one-liner installation
- Latest: --version latest flag
- Specific: --version stable --tag v3.2.0

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 12:37:29 +08:00
33 changed files with 1939 additions and 326 deletions

View File

@@ -228,7 +228,7 @@ Generate individual `.task/IMPL-*.json` files with:
"modification_points": ["Apply requirements"],
"logic_flow": ["Load spec", "Analyze", "Implement", "Validate"]
},
"target_files": ["file:function:lines"]
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
}
}
```

View File

@@ -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

View File

@@ -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}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -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"
}

View File

@@ -356,8 +356,8 @@ Task(subagent_type="{meta.agent}",
**WORKFLOW COMPLETION CHECK**:
After updating task status, check if workflow is complete:
total_tasks=\$(ls .workflow/*/\.task/*.json | wc -l)
completed_tasks=\$(ls .workflow/*/\.summaries/*.md 2>/dev/null | wc -l)
total_tasks=\$(find .workflow/*/\.task/ -name "*.json" -type f 2>/dev/null | wc -l)
completed_tasks=\$(find .workflow/*/\.summaries/ -name "*.md" -type f 2>/dev/null | wc -l)
if [ \$total_tasks -eq \$completed_tasks ]; then
SlashCommand(command=\"/workflow:session:complete\")
fi"),
@@ -433,7 +433,7 @@ Task(subagent_type="{meta.agent}",
"task_description": "Implement following consolidated synthesis specification...",
"modification_points": ["Apply synthesis specification requirements..."]
},
"target_files": ["file:function:lines"]
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
}
}
```

View File

@@ -55,7 +55,7 @@ if [ ! -d ".workflow/${sessionId}" ]; then
fi
# Check for completed tasks
if [ ! -d ".workflow/${sessionId}/.summaries" ] || [ -z "$(ls .workflow/${sessionId}/.summaries/IMPL-*.md 2>/dev/null)" ]; then
if [ ! -d ".workflow/${sessionId}/.summaries" ] || [ -z "$(find .workflow/${sessionId}/.summaries/ -name "IMPL-*.md" -type f 2>/dev/null)" ]; then
echo "❌ No completed implementation found. Complete implementation first"
exit 1
fi

View File

@@ -44,8 +44,8 @@ mv temp.json .workflow/WFS-session/workflow-session.json
### Step 5: Count Final Statistics
```bash
ls .workflow/WFS-session/.task/*.json 2>/dev/null | wc -l
ls .workflow/WFS-session/.summaries/*.md 2>/dev/null | wc -l
find .workflow/WFS-session/.task/ -name "*.json" -type f 2>/dev/null | wc -l
find .workflow/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l
```
### Step 6: Remove Active Marker
@@ -56,12 +56,12 @@ rm .workflow/.active-WFS-session-name
## Simple Bash Commands
### Basic Operations
- **Find active session**: `ls .workflow/.active-*`
- **Find active session**: `find .workflow/ -name ".active-*" -type f`
- **Get session name**: `basename marker | sed 's/^\.active-//'`
- **Update status**: `jq '.status = "completed"' session.json > temp.json`
- **Add timestamp**: `jq '.completed_at = "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"'`
- **Count tasks**: `ls .task/*.json | wc -l`
- **Count completed**: `ls .summaries/*.md | wc -l`
- **Count tasks**: `find .task/ -name "*.json" -type f | wc -l`
- **Count completed**: `find .summaries/ -name "*.md" -type f 2>/dev/null | wc -l`
- **Remove marker**: `rm .workflow/.active-session`
### Completion Result
@@ -92,11 +92,11 @@ Session Completion Summary:
### Error Handling
```bash
# No active session
ls .workflow/.active-* 2>/dev/null || echo "No active session found"
find .workflow/ -name ".active-*" -type f 2>/dev/null || echo "No active session found"
# Incomplete tasks
task_count=$(ls .task/*.json | wc -l)
summary_count=$(ls .summaries/*.md 2>/dev/null | wc -l)
task_count=$(find .task/ -name "*.json" -type f | wc -l)
summary_count=$(find .summaries/ -name "*.md" -type f 2>/dev/null | wc -l)
test $task_count -eq $summary_count || echo "Warning: Not all tasks completed"
```

View File

@@ -35,8 +35,8 @@ jq -r '.session_id, .status, .project' .workflow/WFS-session/workflow-session.js
### Step 4: Count Task Progress
```bash
ls .workflow/WFS-session/.task/*.json 2>/dev/null | wc -l
ls .workflow/WFS-session/.summaries/*.md 2>/dev/null | wc -l
find .workflow/WFS-session/.task/ -name "*.json" -type f 2>/dev/null | wc -l
find .workflow/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l
```
### Step 5: Get Creation Time
@@ -47,11 +47,11 @@ jq -r '.created_at // "unknown"' .workflow/WFS-session/workflow-session.json
## Simple Bash Commands
### Basic Operations
- **List sessions**: `ls .workflow/WFS-*`
- **Find active**: `ls .workflow/.active-*`
- **List sessions**: `find .workflow/ -maxdepth 1 -type d -name "WFS-*"`
- **Find active**: `find .workflow/ -name ".active-*" -type f`
- **Read session data**: `jq -r '.session_id, .status' session.json`
- **Count tasks**: `ls .task/*.json | wc -l`
- **Count completed**: `ls .summaries/*.md | wc -l`
- **Count tasks**: `find .task/ -name "*.json" -type f | wc -l`
- **Count completed**: `find .summaries/ -name "*.md" -type f 2>/dev/null | wc -l`
- **Get timestamp**: `jq -r '.created_at' session.json`
## Simple Output Format

View File

@@ -25,7 +25,7 @@ Generates on-demand views from JSON task data. No synchronization needed - all v
### Step 1: Find Active Session
```bash
ls .workflow/.active-* 2>/dev/null | head -1
find .workflow/ -name ".active-*" -type f 2>/dev/null | head -1
```
### Step 2: Load Session Data
@@ -35,7 +35,7 @@ cat .workflow/WFS-session/workflow-session.json
### Step 3: Scan Task Files
```bash
ls .workflow/WFS-session/.task/*.json 2>/dev/null
find .workflow/WFS-session/.task/ -name "*.json" -type f 2>/dev/null
```
### Step 4: Generate Task Status
@@ -45,8 +45,8 @@ cat .workflow/WFS-session/.task/impl-1.json | jq -r '.status'
### Step 5: Count Task Progress
```bash
ls .workflow/WFS-session/.task/*.json | wc -l
ls .workflow/WFS-session/.summaries/*.md 2>/dev/null | wc -l
find .workflow/WFS-session/.task/ -name "*.json" -type f | wc -l
find .workflow/WFS-session/.summaries/ -name "*.md" -type f 2>/dev/null | wc -l
```
### Step 6: Display Overview
@@ -66,11 +66,11 @@ ls .workflow/WFS-session/.summaries/*.md 2>/dev/null | wc -l
## Simple Bash Commands
### Basic Operations
- **Find active session**: `ls .workflow/.active-*`
- **Find active session**: `find .workflow/ -name ".active-*" -type f`
- **Read session info**: `cat .workflow/session/workflow-session.json`
- **List tasks**: `ls .workflow/session/.task/*.json`
- **List tasks**: `find .workflow/session/.task/ -name "*.json" -type f`
- **Check task status**: `cat task.json | jq -r '.status'`
- **Count completed**: `ls .summaries/*.md | wc -l`
- **Count completed**: `find .summaries/ -name "*.md" -type f | wc -l`
### Task Status Check
- **pending**: Not started yet
@@ -87,8 +87,8 @@ test -f .workflow/.active-* && echo "Session active"
for f in .workflow/session/.task/*.json; do jq empty "$f" && echo "Valid: $f"; done
# Check summaries match
ls .task/*.json | wc -l
ls .summaries/*.md | wc -l
find .task/ -name "*.json" -type f | wc -l
find .summaries/ -name "*.md" -type f 2>/dev/null | wc -l
```
## Simple Output Format

View File

@@ -1,11 +1,11 @@
---
name: test-gen
description: Orchestrate test-fix workflow by analyzing implementation and generating TEST-FIX tasks
usage: /workflow:test-gen [session-id]
argument-hint: "[session-id]"
description: Create independent test-fix workflow session by analyzing completed implementation
usage: /workflow:test-gen <source-session-id>
argument-hint: "<source-session-id>"
examples:
- /workflow:test-gen
- /workflow:test-gen WFS-user-auth
- /workflow:test-gen WFS-api-refactor
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
---
@@ -13,134 +13,177 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
## Coordinator Role
**This command is a pure orchestrator**: Analyze completed implementation session, generate test-fix workflow through standardized tool commands, and trigger automated test validation.
**This command is a pure orchestrator**: Creates an independent test-fix workflow session for validating a completed implementation. It reuses the standard planning toolchain with automatic cross-session context gathering.
**Core Principles**:
- **Session Isolation**: Creates new `WFS-test-[source]` session to keep verification separate from implementation
- **Context-First**: Prioritizes gathering code changes and summaries from source session
- **Format Reuse**: Creates standard `IMPL-*.json` task, using `meta.type: "test-fix"` for agent assignment
- **Parameter Simplification**: Tools auto-detect test session type via metadata, no manual cross-session parameters needed
**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
1. Initialize TodoWrite → Create test session → Parse session ID
2. Gather cross-session context (automatic) → Parse context path
3. Analyze implementation with concept-enhanced → Parse ANALYSIS_RESULTS.md
4. Generate test task from analysis → Return summary
## Core Rules
1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 session discovery
1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 test session creation
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
5. **Complete All Phases**: Do not return to user until Phase 4 completes (execution triggered separately)
6. **Track Progress**: Update TodoWrite after every phase completion
7. **Use Standard Tools**: Follow plan.md pattern using context-gather, concept-enhanced, task-generate
7. **Automatic Detection**: context-gather auto-detects test session and gathers source session context
## 4-Phase Execution
### Phase 1: Session Discovery & Context Gathering
**Command**: `SlashCommand(command="/workflow:tools:context-gather --session [sessionId] \"TEST-FIX: Validate implementation for [sessionId]\"")`
### Phase 1: Create Test Session
**Command**: `SlashCommand(command="/workflow:session:start --new \"Test validation for [sourceSessionId]\"")`
**Session ID Resolution**:
- If argument provided → Use directly as `sessionId`
- If no argument → Auto-detect from `.workflow/.active-*` marker
- Format: `WFS-[session-name]`
**Input**: `sourceSessionId` from user argument (e.g., `WFS-user-auth`)
**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
```
**Expected Behavior**:
- Creates new session with pattern `WFS-test-[source-slug]` (e.g., `WFS-test-user-auth`)
- Writes metadata to `workflow-session.json`:
- `workflow_type: "test_session"`
- `source_session_id: "[sourceSessionId]"`
- Returns new session ID for subsequent phases
**Parse Output**:
- Extract: context package path (store as `contextPath`)
- Typical pattern: `.workflow/[sessionId]/.process/context-package-test.json`
- Extract: new test session ID (store as `testSessionId`)
- Pattern: `WFS-test-[slug]`
**Validation**:
- Session directory `.workflow/[sessionId]/` exists
- Session has completed IMPL tasks (check .summaries/IMPL-*-summary.md)
- Context package created successfully
- Source session `.workflow/[sourceSessionId]/` exists
- Source session has completed IMPL tasks (`.summaries/IMPL-*-summary.md`)
- New test session directory created
- Metadata includes `workflow_type` and `source_session_id`
**TodoWrite**: Mark phase 1 completed, phase 2 in_progress
---
### Phase 2: Implementation Analysis
**Command**: `SlashCommand(command="/workflow:tools:concept-enhanced --session [sessionId] --context [contextPath]")`
### Phase 2: Gather Cross-Session Context
**Command**: `SlashCommand(command="/workflow:tools:context-gather --session [testSessionId]")`
**Input**: `sessionId` from Phase 1, `contextPath` from Phase 1
**Input**: `testSessionId` from Phase 1 (e.g., `WFS-test-user-auth`)
**Expected Analysis**:
- Review completed implementation summaries
- Identify test files and coverage gaps
- Assess test execution strategy
- Determine failure diagnosis approach
**Automatic Detection**:
- context-gather reads `.workflow/[testSessionId]/workflow-session.json`
- Detects `workflow_type: "test_session"`
- Automatically uses `source_session_id` to gather source session context
- No need for manual `--source-session` parameter
**Cross-Session Context Collection** (Automatic):
- Implementation summaries: `.workflow/[sourceSessionId]/.summaries/IMPL-*-summary.md`
- Code changes: `git log --since=[source_session_created_at]` for changed files
- Original plan: `.workflow/[sourceSessionId]/IMPL_PLAN.md`
- Test files: Discovered via MCP code-index tools
**Parse Output**:
- Verify `.workflow/[sessionId]/.process/ANALYSIS_RESULTS.md` created
- Extract test execution recommendations
- Identify critical test areas
- Extract: context package path (store as `contextPath`)
- Pattern: `.workflow/[testSessionId]/.process/context-package.json`
**Validation**:
- File `.workflow/[sessionId]/.process/ANALYSIS_RESULTS.md` exists
- Contains test strategy and execution plan
- Lists focus test paths and acceptance criteria
- Context package created in test session directory
- Contains source session artifacts (summaries, changed files)
- Includes test file inventory
**TodoWrite**: Mark phase 2 completed, phase 3 in_progress
---
### Phase 3: TEST-FIX Task Generation
**Command**: `SlashCommand(command="/workflow:tools:task-generate --session [sessionId]")`
### Phase 3: Implementation Analysis
**Command**: `SlashCommand(command="/workflow:tools:concept-enhanced --session [testSessionId] --context [contextPath]")`
**Input**: `sessionId` from Phase 1
**Input**:
- `testSessionId` from Phase 1 (e.g., `WFS-test-user-auth`)
- `contextPath` from Phase 2 (e.g., `.workflow/WFS-test-user-auth/.process/context-package.json`)
**Analysis Focus**:
- Review implementation summaries from source session
- Identify test files and coverage gaps
- Assess test execution strategy (unit, integration, e2e)
- Determine failure diagnosis approach
- Recommend code quality improvements
**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
- Reads context-package.json with cross-session artifacts
- Executes parallel analysis (Gemini for test strategy, optional Codex for validation)
- Generates comprehensive test execution strategy
- Identifies code modification targets for test fixes
- Provides feasibility assessment for test validation
**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
- Verify `.workflow/[testSessionId]/.process/ANALYSIS_RESULTS.md` created
- Contains test strategy and execution plan
- Lists code modification targets (format: `file:function:lines` or `file`)
- Includes risk assessment and optimization recommendations
**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
- File `.workflow/[testSessionId]/.process/ANALYSIS_RESULTS.md` exists
- Contains complete analysis sections:
- Current State Analysis (test coverage, existing tests)
- Proposed Solution Design (test execution strategy)
- Implementation Strategy (code targets, feasibility)
- Solution Optimization (performance, quality)
- Critical Success Factors (acceptance criteria)
**TodoWrite**: Mark phase 3 completed, phase 4 in_progress
---
### Phase 4: Execute Test-Fix Workflow
**Command**: `SlashCommand(command="/workflow:execute --session [sessionId]")`
### Phase 4: Generate Test Task
**Command**: `SlashCommand(command="/workflow:tools:task-generate --session [testSessionId]")`
**Input**: `sessionId` from Phase 1
**Input**: `testSessionId` 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
- Reads ANALYSIS_RESULTS.md from Phase 3
- Extracts test strategy and code modification targets
- Generates `IMPL-001.json` (reusing standard format) with:
- `meta.type: "test-fix"` (enables @test-fix-agent assignment)
- `meta.agent: "@test-fix-agent"`
- `context.requirements`: Test execution requirements from analysis
- `context.focus_paths`: Test files and source files from analysis
- `context.acceptance`: All tests pass criteria
- `flow_control.pre_analysis`: Load source session summaries
- `flow_control.implementation_approach`: Test execution strategy from ANALYSIS_RESULTS.md
- `flow_control.target_files`: Code modification targets from analysis
**Parse Output**:
- Verify `.workflow/[testSessionId]/.task/IMPL-001.json` exists
- Verify `.workflow/[testSessionId]/IMPL_PLAN.md` created
- Verify `.workflow/[testSessionId]/TODO_LIST.md` created
**Validation**:
- Workflow execution started successfully
- TEST-FIX-001 task status updated to "active" or "completed"
- Task JSON has `id: "IMPL-001"` and `meta.type: "test-fix"`
- IMPL_PLAN.md contains test validation strategy from ANALYSIS_RESULTS.md
- TODO_LIST.md shows IMPL-001 task
- flow_control includes code targets and test strategy
- Task is ready for /workflow:execute
**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]
Independent test-fix workflow created successfully!
Source Session: [sourceSessionId]
Test Session: [testSessionId]
Task Created: IMPL-001 (test-fix)
Next Steps:
1. Review test plan: .workflow/[testSessionId]/IMPL_PLAN.md
2. Execute validation: /workflow:execute
3. Monitor progress: /workflow:status
The @test-fix-agent will:
- Execute all tests
- Diagnose any failures
- Fix code until tests pass
```
---
@@ -150,72 +193,112 @@ Test-fix workflow initiated for session: [sessionId]
```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"}
{"content": "Create independent test session", "status": "in_progress", "activeForm": "Creating test session"},
{"content": "Gather cross-session context", "status": "pending", "activeForm": "Gathering cross-session context"},
{"content": "Analyze implementation for test strategy", "status": "pending", "activeForm": "Analyzing implementation"},
{"content": "Generate test validation task", "status": "pending", "activeForm": "Generating test validation task"}
]})
// 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"}
{"content": "Create independent test session", "status": "completed", "activeForm": "Creating test session"},
{"content": "Gather cross-session context", "status": "in_progress", "activeForm": "Gathering cross-session context"},
{"content": "Analyze implementation for test strategy", "status": "pending", "activeForm": "Analyzing implementation"},
{"content": "Generate test validation task", "status": "pending", "activeForm": "Generating test validation task"}
]})
// Continue pattern for Phase 2, 3, 4...
// After Phase 2
TodoWrite({todos: [
{"content": "Create independent test session", "status": "completed", "activeForm": "Creating test session"},
{"content": "Gather cross-session context", "status": "completed", "activeForm": "Gathering cross-session context"},
{"content": "Analyze implementation for test strategy", "status": "in_progress", "activeForm": "Analyzing implementation"},
{"content": "Generate test validation task", "status": "pending", "activeForm": "Generating test validation task"}
]})
// After Phase 3
TodoWrite({todos: [
{"content": "Create independent test session", "status": "completed", "activeForm": "Creating test session"},
{"content": "Gather cross-session context", "status": "completed", "activeForm": "Gathering cross-session context"},
{"content": "Analyze implementation for test strategy", "status": "completed", "activeForm": "Analyzing implementation"},
{"content": "Generate test validation task", "status": "in_progress", "activeForm": "Generating test validation task"}
]})
// After Phase 4
TodoWrite({todos: [
{"content": "Create independent test session", "status": "completed", "activeForm": "Creating test session"},
{"content": "Gather cross-session context", "status": "completed", "activeForm": "Gathering cross-session context"},
{"content": "Analyze implementation for test strategy", "status": "completed", "activeForm": "Analyzing implementation"},
{"content": "Generate test validation task", "status": "completed", "activeForm": "Generating test validation task"}
]})
```
## Data Flow
```
Session ID (from argument or auto-detect)
User: /workflow:test-gen WFS-user-auth
Phase 1: context-gather --session sessionId "test-fix description"
Output: contextPath (context-package-test.json)
Phase 1: session-start --new "Test validation for WFS-user-auth"
Creates: WFS-test-user-auth session
↓ Writes: workflow-session.json with workflow_type="test_session", source_session_id="WFS-user-auth"
↓ Output: testSessionId = "WFS-test-user-auth"
Phase 2: concept-enhanced --session sessionId --context contextPath
Input: sessionId + contextPath
Output: ANALYSIS_RESULTS.md (test execution strategy)
Phase 2: context-gather --session WFS-test-user-auth
Auto-detects: test session type from workflow-session.json
Auto-reads: source_session_id = "WFS-user-auth"
↓ Gathers: Cross-session context (summaries, code changes, tests)
↓ Output: .workflow/WFS-test-user-auth/.process/context-package.json
Phase 3: task-generate --session sessionId
Input: sessionId + ANALYSIS_RESULTS.md
Output: TEST-FIX-001.json, IMPL_PLAN.md, TODO_LIST.md
Phase 3: concept-enhanced --session WFS-test-user-auth --context context-package.json
Reads: context-package.json with cross-session artifacts
Executes: Parallel analysis (Gemini test strategy + optional Codex validation)
↓ Analyzes: Test coverage, execution strategy, code targets
↓ Output: .workflow/WFS-test-user-auth/.process/ANALYSIS_RESULTS.md
Phase 4: execute --session sessionId
Input: sessionId + TEST-FIX-001.json
Output: Test execution and fixing
Phase 4: task-generate --session WFS-test-user-auth
Reads: ANALYSIS_RESULTS.md with test strategy and code targets
Generates: IMPL-001.json with meta.type="test-fix"
↓ Output: Task, plan, and todo files in test session
Return summary to user
Return: Summary with next steps (user triggers /workflow:execute separately)
```
## Context Gathering Customization
## Session Metadata Design
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
**Test Session (`WFS-test-user-auth/workflow-session.json`)**:
```json
{
"session_id": "WFS-test-user-auth",
"project": "Test validation for user authentication implementation",
"status": "planning",
"created_at": "2025-10-03T12:00:00Z",
"workflow_type": "test_session",
"source_session_id": "WFS-user-auth"
}
```
## Analysis Focus
## Automatic Cross-Session Context Collection
concept-enhanced will analyze:
- Test coverage gaps
- Test execution strategy (unit, integration, e2e)
- Failure diagnosis approaches
- Code fixing patterns
- Test framework best practices
When `context-gather` detects `workflow_type: "test_session"`:
**Collected from Source Session** (`.workflow/WFS-user-auth/`):
- Implementation summaries: `.summaries/IMPL-*-summary.md`
- Code changes: `git log --since=[source_created_at] --name-only`
- Original plan: `IMPL_PLAN.md`
- Task definitions: `.task/IMPL-*.json`
**Collected from Current Project**:
- Test files: `mcp__code-index__find_files(pattern="*.test.*")`
- Test configuration: `package.json`, `jest.config.js`, etc.
- Source files: Based on changed files from git log
## Task Generation Output
task-generate creates TEST-FIX-001.json with:
task-generate creates `IMPL-001.json` (reusing standard format) with:
```json
{
"id": "TEST-FIX-001",
"title": "Execute and validate tests for [sessionId]",
"id": "IMPL-001",
"title": "Execute and validate tests for [sourceSessionId]",
"status": "pending",
"meta": {
"type": "test-fix",
@@ -239,11 +322,11 @@ task-generate creates TEST-FIX-001.json with:
"flow_control": {
"pre_analysis": [
{
"step": "load_implementation_summaries",
"action": "Load completed IMPL task summaries",
"step": "load_source_session_summaries",
"action": "Load implementation summaries from source session",
"commands": [
"bash(find .workflow/[sessionId]/.summaries/ -name 'IMPL-*-summary.md' 2>/dev/null)",
"Read(.workflow/[sessionId]/.summaries/IMPL-001-summary.md)"
"bash(find .workflow/[sourceSessionId]/.summaries/ -name 'IMPL-*-summary.md' 2>/dev/null)",
"Read(.workflow/[sourceSessionId]/.summaries/IMPL-001-summary.md)"
],
"output_to": "implementation_context",
"on_error": "skip_optional"
@@ -286,20 +369,22 @@ task-generate creates TEST-FIX-001.json with:
## 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"
- **Source session not found**: Return error "Source session [sourceSessionId] not found in .workflow/"
- **Invalid source session**: Return error "Source session [sourceSessionId] has no completed IMPL tasks"
- **Session creation failed**: Return error "Could not create test session. Check /workflow:session:start"
### Phase 2 Failures
- **Analysis failed**: Return error "Implementation analysis failed. Check context package"
- **No test strategy**: Return error "Could not determine test execution strategy"
- **Context gathering failed**: Return error "Could not gather cross-session context. Check source session artifacts"
- **No source artifacts**: Return error "Source session has no implementation summaries or git history"
### Phase 3 Failures
- **Task generation failed**: Retry once, then return error with details
- **Invalid task structure**: Return error with JSON validation details
- **Analysis failed**: Return error "Implementation analysis failed. Check context package and ANALYSIS_RESULTS.md"
- **No test strategy**: Return error "Could not determine test execution strategy from analysis"
- **Missing code targets**: Warning only, proceed with general test task
### Phase 4 Failures
- **Execution failed**: Return error "Could not start test-fix workflow. Check session state"
- **Task generation failed**: Retry once, then return error with details
- **Invalid task structure**: Return error with JSON validation details
## Workflow Integration
@@ -307,18 +392,22 @@ task-generate creates TEST-FIX-001.json with:
```
1. Implementation Phase (prior to test-gen)
/workflow:plan "Build auth system"
→ Creates WFS-auth session
→ @code-developer implements + writes tests
→ Creates IMPL-001-summary.md
→ Creates IMPL-001-summary.md in WFS-auth
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
Phase 1: session-start → Creates WFS-test-auth session
Phase 2: context-gather → Gathers from WFS-auth, creates context-package.json
Phase 3: concept-enhanced → Analyzes implementation, creates ANALYSIS_RESULTS.md
Phase 4: task-generate → Creates IMPL-001.json with meta.type="test-fix"
Returns: Summary with next steps
3. Test-Fix Phase (automated)
@test-fix-agent picks up TEST-FIX-001
3. Test Execution Phase (user-triggered)
/workflow:execute
→ Detects active session: WFS-test-auth
→ @test-fix-agent picks up IMPL-001 (test-fix type)
→ Runs test suite
→ Diagnoses failures (if any)
→ Fixes source code
@@ -327,39 +416,72 @@ task-generate creates TEST-FIX-001.json with:
```
### 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
**In Test Session** (`.workflow/WFS-test-auth/`):
- `workflow-session.json` - Contains workflow_type and source_session_id
- `.process/context-package.json` - Cross-session context from WFS-auth
- `.process/ANALYSIS_RESULTS.md` - Test strategy and code targets from concept-enhanced
- `.task/IMPL-001.json` - Test-fix task definition
- `IMPL_PLAN.md` - Test validation plan (from ANALYSIS_RESULTS.md)
- `TODO_LIST.md` - Task checklist
- `.summaries/IMPL-001-summary.md` - Created by @test-fix-agent after completion
## Best Practices
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
1. **Run after implementation complete**: Ensure source session has completed IMPL tasks and summaries
2. **Check git commits**: Implementation changes should be committed for accurate git log analysis
3. **Verify test files exist**: Source implementation should include test files
4. **Independent sessions**: Test session is separate from implementation session for clean separation
5. **Monitor execution**: Use `/workflow:status` to track test-fix progress after /workflow:execute
## Coordinator Checklist
✅ 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
✅ Initialize TodoWrite before any command (4 phases)
Phase 1: Create test session with source session ID
✅ Parse new test session ID from Phase 1 output
✅ Phase 2: Run context-gather (auto-detects test session, no extra params)
✅ Verify context-package.json contains cross-session artifacts
✅ Phase 3: Run concept-enhanced with session and context path
✅ Verify ANALYSIS_RESULTS.md contains test strategy and code targets
✅ Phase 4: Run task-generate to create IMPL-001.json
✅ Verify task has meta.type="test-fix" and meta.agent="@test-fix-agent"
✅ Verify flow_control includes analysis insights and code targets
✅ Update TodoWrite after each phase
✅ Return summary only after Phase 4 completes
✅ Return summary after Phase 4 (execution is separate user action)
## Required Tool Modifications
### `/workflow:session:start`
- Support `--new` flag for test session creation
- Auto-detect test session pattern from task description
- Write `workflow_type: "test_session"` and `source_session_id` to metadata
### `/workflow:tools:context-gather`
- Read session metadata to detect `workflow_type: "test_session"`
- Auto-extract `source_session_id` from metadata
- Gather cross-session context from source session artifacts
- Include git log analysis from source session creation time
### `/workflow:tools:concept-enhanced`
- No changes required (already supports cross-session context analysis)
- Will automatically analyze test strategy based on context-package.json
- Generates ANALYSIS_RESULTS.md with code targets and test execution plan
### `/workflow:tools:task-generate`
- Recognize test session context and generate appropriate task
- Create `IMPL-001.json` with `meta.type: "test-fix"`
- Extract test strategy from ANALYSIS_RESULTS.md
- Include code targets and cross-session references in flow_control
### `/workflow:execute`
- No changes required (already dispatches by meta.agent)
## Related Commands
- `/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:session:start` - Phase 1 tool for test session creation
- `/workflow:tools:context-gather` - Phase 2 tool for cross-session context collection
- `/workflow:tools:concept-enhanced` - Phase 3 tool for implementation analysis and test strategy
- `/workflow:tools:task-generate` - Phase 4 tool for test task creation
- `/workflow:execute` - Execute test-fix workflow (user-triggered after test-gen)
- `/workflow:status` - Check workflow progress
- `@test-fix-agent` - Agent that executes and fixes tests

View File

@@ -141,6 +141,9 @@ Advanced solution design and feasibility analysis engine with parallel CLI execu
RULES:
- Focus on SOLUTION IMPROVEMENTS and KEY DESIGN DECISIONS, NOT task planning
- Provide architectural rationale, evaluate alternatives, assess tradeoffs
- **CRITICAL**: Identify code targets - existing files as "file:function:lines", new files as "file"
- For modifications: specify exact files/functions/line ranges
- For new files: specify file path only (no function or lines)
- Do NOT create task lists, implementation steps, or code examples
- Do NOT generate any code snippets or implementation details
- **MUST write output to .workflow/{session_id}/.process/gemini-solution-design.md**
@@ -172,6 +175,8 @@ Advanced solution design and feasibility analysis engine with parallel CLI execu
RULES:
- Focus on TECHNICAL FEASIBILITY and RISK ASSESSMENT, NOT implementation planning
- Validate architectural decisions, identify potential issues, recommend optimizations
- **CRITICAL**: Verify code targets - existing files "file:function:lines", new files "file"
- Confirm exact locations for modifications, identify additional new files if needed
- Do NOT create task breakdowns, step-by-step guides, or code examples
- Do NOT generate any code snippets or implementation details
- **MUST write output to .workflow/{session_id}/.process/codex-feasibility-validation.md**
@@ -301,6 +306,39 @@ Generated ANALYSIS_RESULTS.md focuses on **solution improvements, key design dec
- **Module Dependencies**: {dependency_graph_and_order}
- **Quality Assurance**: {qa_approach_and_validation}
### Code Modification Targets
**Purpose**: Specific code locations for modification AND new files to create
**Format**:
- Existing files: `file:function:lines` (with line numbers)
- New files: `file` (no function or lines)
**Identified Targets**:
1. **Target**: `src/auth/AuthService.ts:login:45-52`
- **Type**: Modify existing
- **Modification**: Enhance error handling
- **Rationale**: Current logic lacks validation for edge cases
2. **Target**: `src/auth/PasswordReset.ts`
- **Type**: Create new file
- **Purpose**: Password reset functionality
- **Rationale**: New feature requirement
3. **Target**: `src/middleware/auth.ts:validateToken:30-45`
- **Type**: Modify existing
- **Modification**: Add token expiry check
- **Rationale**: Security requirement for JWT validation
4. **Target**: `tests/auth/PasswordReset.test.ts`
- **Type**: Create new file
- **Purpose**: Test coverage for password reset
- **Rationale**: Test requirement for new feature
**Note**:
- For new files, only specify the file path (no function or lines)
- For existing files without line numbers, use `file:function:*` format
- Task generation will refine these during the `analyze_task_patterns` step
### Feasibility Assessment
- **Technical Complexity**: {complexity_rating_and_analysis}
- **Performance Impact**: {expected_performance_characteristics}

View File

@@ -212,7 +212,7 @@ Task(
"Validate against acceptance criteria"
]
},
"target_files": ["file:function:lines"]
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
}
}
\`\`\`

View File

@@ -142,12 +142,12 @@ Generate task JSON files and IMPL_PLAN.md from analysis results with automatic a
},
{
"step": "analyze_task_patterns",
"action": "Analyze existing code patterns",
"action": "Analyze existing code patterns and identify modification targets",
"commands": [
"bash(cd \"[focus_paths]\")",
"bash(~/.claude/scripts/gemini-wrapper -p \"PURPOSE: Analyze patterns TASK: Review '[title]' CONTEXT: [synthesis_specification] [individual_artifacts] EXPECTED: Pattern analysis RULES: Prioritize synthesis-specification.md\")"
"bash(~/.claude/scripts/gemini-wrapper -p \"PURPOSE: Identify modification targets TASK: Analyze '[title]' and locate specific files/functions/lines to modify CONTEXT: [synthesis_specification] [individual_artifacts] EXPECTED: Code locations in format 'file:function:lines' RULES: Prioritize synthesis-specification.md, identify exact modification points\")"
],
"output_to": "task_context",
"output_to": "task_context_with_targets",
"on_error": "fail"
}
],
@@ -175,8 +175,40 @@ Generate task JSON files and IMPL_PLAN.md from analysis results with automatic a
1. Parse analysis results and extract task definitions
2. Detect brainstorming artifacts with priority scoring
3. Generate task context (requirements, focus_paths, acceptance)
4. Build flow_control with artifact loading steps
5. Create individual task JSON files in `.task/`
4. **Determine modification targets**: Extract specific code locations from analysis
5. Build flow_control with artifact loading steps and target_files
6. Create individual task JSON files in `.task/`
#### Target Files Generation (Critical)
**Purpose**: Identify specific code locations for modification AND new files to create
**Source Data Priority**:
1. **ANALYSIS_RESULTS.md** - Should contain identified code locations
2. **Gemini/MCP Analysis** - From `analyze_task_patterns` step
3. **Context Package** - File references from `focus_paths`
**Format**: `["file:function:lines"]` or `["file"]` (for new files)
- `file`: Relative path from project root (e.g., `src/auth/AuthService.ts`)
- `function`: Function/method name to modify (e.g., `login`, `validateToken`) - **omit for new files**
- `lines`: Approximate line range (e.g., `45-52`, `120-135`) - **omit for new files**
**Examples**:
```json
"target_files": [
"src/auth/AuthService.ts:login:45-52",
"src/middleware/auth.ts:validateToken:30-45",
"src/auth/PasswordReset.ts",
"tests/auth/PasswordReset.test.ts",
"tests/auth.test.ts:testLogin:15-20"
]
```
**Generation Strategy**:
- **New files to create** → Use `["path/to/NewFile.ts"]` (no function or lines)
- **Existing files with specific locations** → Use `["file:function:lines"]`
- **Existing files with function only** → Search lines using MCP/grep `["file:function:*"]`
- **Existing files (explore entire)** → Mark as `["file.ts:*:*"]`
- **No specific targets** → Leave empty `[]` (agent explores focus_paths)
### Phase 3: Artifact Detection & Integration

View File

@@ -6,6 +6,12 @@ type: search-guideline
# Context Search Strategy
## ⚡ Execution Environment
**CRITICAL**: All commands execute in **Bash environment** (Git Bash on Windows, Bash on Linux/macOS)
**❌ Forbidden**: Windows-specific commands (`findstr`, `dir`, `where`, `type`, `copy`, `del`) - Use Bash equivalents (`grep`, `find`, `which`, `cat`, `cp`, `rm`)
## ⚡ Core Search Tools
**rg (ripgrep)**: Fast content search with regex support
@@ -18,6 +24,7 @@ type: search-guideline
- **Use find for files** - Locate files/directories by name
- **Use grep sparingly** - Only when rg unavailable
- **Use get_modules_by_depth.sh first** - MANDATORY for program architecture analysis before planning
- **Always use Bash commands** - NEVER use Windows cmd/PowerShell commands
### Quick Command Reference
```bash

View File

@@ -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
```

View File

@@ -49,7 +49,8 @@ All task files use this simplified 5-field schema (aligned with workflow-archite
},
"target_files": [
"src/auth/login.ts:handleLogin:75-120",
"src/middleware/auth.ts:validateToken"
"src/middleware/auth.ts:validateToken",
"src/auth/PasswordReset.ts"
]
}
}
@@ -81,7 +82,7 @@ All task files use this simplified 5-field schema (aligned with workflow-archite
**Components**:
- **pre_analysis**: Array of sequential process steps
- **implementation_approach**: Task execution strategy
- **target_files**: Specific files to modify in "file:function:lines" format
- **target_files**: Files to modify/create - existing files in `file:function:lines` format, new files as `file` only
**Step Structure**:
```json

View File

@@ -175,7 +175,8 @@ All task files use this unified 5-field schema with optional artifacts enhanceme
},
"target_files": [
"src/auth/login.ts:handleLogin:75-120",
"src/middleware/auth.ts:validateToken"
"src/middleware/auth.ts:validateToken",
"src/auth/PasswordReset.ts"
]
}
}
@@ -219,7 +220,7 @@ The **flow_control** field manages task execution with two main components:
- **task_description**: Comprehensive implementation description
- **modification_points**: Specific code modification targets
- **logic_flow**: Business logic execution sequence
- **target_files**: Target file list in `file:function:lines` format
- **target_files**: Target file list - existing files in `file:function:lines` format, new files as `file` only
#### Tool Reference
**Command Types Available**:

215
.codex/AGENTS.md Normal file
View 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
View 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

View File

@@ -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

View File

@@ -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"

View File

@@ -1,6 +1,6 @@
# 🚀 Claude Code Workflow (CCW): 下一代多智能体软件开发自动化框架
[![Version](https://img.shields.io/badge/version-v2.1.0--experimental-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![Version](https://img.shields.io/badge/version-v3.2.1-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![MCP工具](https://img.shields.io/badge/🔧_MCP工具-实验性-orange.svg)](https://github.com/modelcontextprotocol)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

108
README.md
View File

@@ -2,7 +2,7 @@
<div align="center">
[![Version](https://img.shields.io/badge/version-v3.1.0-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![Version](https://img.shields.io/badge/version-v3.2.1-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)]()
[![MCP Tools](https://img.shields.io/badge/🔧_MCP_Tools-Experimental-orange.svg)](https://github.com/modelcontextprotocol)
@@ -15,9 +15,13 @@
**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
---
@@ -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
@@ -117,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
@@ -166,6 +233,41 @@ After installation, run the following command to ensure CCW is working:
## ⚙️ Configuration
### **Prerequisites: Required Tools**
Before using CCW, install the following command-line tools:
#### **Core CLI Tools**
| Tool | Purpose | Installation |
|------|---------|--------------|
| **Gemini CLI** | AI analysis & documentation | `npm install -g @google/gemini-cli` ([GitHub](https://github.com/google-gemini/gemini-cli)) |
| **Codex CLI** | AI development & implementation | `npm install -g @openai/codex` ([GitHub](https://github.com/openai/codex)) |
| **Qwen Code** | AI architecture & code generation | `npm install -g @qwen-code/qwen-code` ([Docs](https://github.com/QwenLM/qwen-code)) |
#### **System Utilities**
| Tool | Purpose | Installation |
|------|---------|--------------|
| **ripgrep (rg)** | Fast code search | [Download](https://github.com/BurntSushi/ripgrep/releases) or `brew install ripgrep` (macOS), `apt install ripgrep` (Ubuntu) |
| **jq** | JSON processing | [Download](https://jqlang.github.io/jq/download/) or `brew install jq` (macOS), `apt install jq` (Ubuntu) |
**Quick Install (All Tools):**
```bash
# macOS
brew install ripgrep jq
npm install -g @google/gemini-cli @openai/codex @qwen-code/qwen-code
# Ubuntu/Debian
sudo apt install ripgrep jq
npm install -g @google/gemini-cli @openai/codex @qwen-code/qwen-code
# Windows (Chocolatey)
choco install ripgrep jq
npm install -g @google/gemini-cli @openai/codex @qwen-code/qwen-code
```
### **Essential: Gemini CLI Setup**
Configure Gemini CLI for optimal integration:

View File

@@ -2,7 +2,7 @@
<div align="center">
[![Version](https://img.shields.io/badge/version-v3.1.0-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![Version](https://img.shields.io/badge/version-v3.2.1-blue.svg)](https://github.com/catlog22/Claude-Code-Workflow/releases)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)]()
[![MCP工具](https://img.shields.io/badge/🔧_MCP工具-实验性-orange.svg)](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`
> - 安装前会自动备份现有文件
---
## 🚀 快速入门
@@ -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
# 深度代码库分析
@@ -169,6 +236,41 @@ bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflo
## ⚙️ 配置
### **前置要求:必需工具**
在使用 CCW 之前,请安装以下命令行工具:
#### **核心 CLI 工具**
| 工具 | 用途 | 安装方式 |
|------|------|----------|
| **Gemini CLI** | AI 分析与文档生成 | `npm install -g @google/gemini-cli` ([GitHub](https://github.com/google-gemini/gemini-cli)) |
| **Codex CLI** | AI 开发与实现 | `npm install -g @openai/codex` ([GitHub](https://github.com/openai/codex)) |
| **Qwen Code** | AI 架构与代码生成 | `npm install -g @qwen-code/qwen-code` ([文档](https://github.com/QwenLM/qwen-code)) |
#### **系统实用工具**
| 工具 | 用途 | 安装方式 |
|------|------|----------|
| **ripgrep (rg)** | 快速代码搜索 | [下载](https://github.com/BurntSushi/ripgrep/releases) 或 `brew install ripgrep` (macOS), `apt install ripgrep` (Ubuntu) |
| **jq** | JSON 处理 | [下载](https://jqlang.github.io/jq/download/) 或 `brew install jq` (macOS), `apt install jq` (Ubuntu) |
**快速安装(所有工具):**
```bash
# macOS
brew install ripgrep jq
npm install -g @google/gemini-cli @openai/codex @qwen-code/qwen-code
# Ubuntu/Debian
sudo apt install ripgrep jq
npm install -g @google/gemini-cli @openai/codex @qwen-code/qwen-code
# Windows (Chocolatey)
choco install ripgrep jq
npm install -g @google/gemini-cli @openai/codex @qwen-code/qwen-code
```
### **必需: Gemini CLI 设置**
配置 Gemini CLI 以实现最佳集成:

142
RELEASE_NOTES_v3.2.1.md Normal file
View 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)

View File

@@ -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"
}

View File

@@ -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