Refactor code structure for improved readability and maintainability

This commit is contained in:
catlog22
2026-02-07 23:44:22 +08:00
parent 80ae4baea8
commit 41cff28799
175 changed files with 691 additions and 1479 deletions

View File

@@ -186,7 +186,7 @@ if (contextPackage.brainstorm_artifacts?.role_analyses?.length > 0) {
- Add quantified requirements and measurable acceptance criteria
3. Create IMPL_PLAN.md
- Load template: Read(~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)
- Load template: Read(~/.ccw/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)
- Follow template structure and validation checklist
- Populate all 8 sections with synthesized context
- Document CCW workflow phase progression
@@ -661,7 +661,7 @@ The `implementation_approach` defines sequential implementation steps. Execution
**Template-Based Generation**:
```
1. Load template: Read(~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)
1. Load template: Read(~/.ccw/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)
2. Populate all sections following template structure
3. Complete template validation checklist
4. Generate at .workflow/active/{session_id}/IMPL_PLAN.md
@@ -852,7 +852,7 @@ Use `analysis_results.complexity` or task count to determine structure:
- **Record N+1 Context**: Update `## N+1 Context` section with key decisions and deferred items
- **Search Tool Priority**: ACE (`mcp__ace-tool__search_context`) → CCW (`mcp__ccw-tools__smart_search`) / Built-in (`Grep`, `Glob`, `Read`)
- Apply Quantification Requirements to all requirements, acceptance criteria, and modification points
- Load IMPL_PLAN template: `Read(~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)` before generating IMPL_PLAN.md
- Load IMPL_PLAN template: `Read(~/.ccw/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)` before generating IMPL_PLAN.md
- Use provided context package: Extract all information from structured context
- Respect memory-first rule: Use provided content (already loaded from memory/file)
- Follow 6-field schema: All task JSONs must have id, title, status, context_package_path, meta, context, flow_control

View File

@@ -14,13 +14,13 @@ You are an intelligent CLI execution specialist that autonomously orchestrates c
2. **Qwen (Fallback)** - Same capabilities as Gemini, use when unavailable
3. **Codex (Alternative)** - Development, implementation & automation
**Templates**: `~/.claude/workflows/cli-templates/prompts/`
**Templates**: `~/.ccw/workflows/cli-templates/prompts/`
- `analysis/` - pattern.txt, architecture.txt, code-execution-tracing.txt, security.txt, quality.txt
- `development/` - feature.txt, refactor.txt, testing.txt, bug-diagnosis.txt
- `planning/` - task-breakdown.txt, architecture-planning.txt
- `memory/` - claude-module-unified.txt
**Reference**: See `~/.claude/workflows/intelligent-tools-strategy.md` for complete usage guide
**Reference**: See `~/.ccw/workflows/intelligent-tools-strategy.md` for complete usage guide
## 5-Phase Execution Workflow
@@ -129,7 +129,7 @@ CONTEXT: @CLAUDE.md @src/**/* @*.ts
CONTEXT: @**/* @../shared/**/* @../types/**/*
```
**2. Template Selection** (`~/.claude/workflows/cli-templates/prompts/`):
**2. Template Selection** (`~/.ccw/workflows/cli-templates/prompts/`):
```
analyze → analysis/code-execution-tracing.txt | analysis/pattern.txt
execute → development/feature.txt
@@ -308,7 +308,7 @@ Codex unavailable → Gemini/Qwen write mode
## Templates Reference
**Location**: `~/.claude/workflows/cli-templates/prompts/`
**Location**: `~/.ccw/workflows/cli-templates/prompts/`
**Analysis** (`analysis/`):
- `pattern.txt` - Code pattern analysis

View File

@@ -77,24 +77,24 @@ if [[ -n "$TASK_JSON_TECH_STACK" ]]; then
# Map tech stack names to guideline files
# e.g., ["FastAPI", "SQLAlchemy"] → python-dev.md
case "$TASK_JSON_TECH_STACK" in
*FastAPI*|*Django*|*SQLAlchemy*) TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/python-dev.md) ;;
*React*|*Next*) TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/react-dev.md) ;;
*TypeScript*) TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/typescript-dev.md) ;;
*FastAPI*|*Django*|*SQLAlchemy*) TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/python-dev.md) ;;
*React*|*Next*) TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/react-dev.md) ;;
*TypeScript*) TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/typescript-dev.md) ;;
esac
# Priority 2: Auto-detect from file extensions (fallback)
elif [[ "$TASK_DESCRIPTION" =~ (implement|create|build|develop|code|write|add|fix|refactor) ]]; then
if ls *.ts *.tsx 2>/dev/null | head -1; then
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/typescript-dev.md)
TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/typescript-dev.md)
elif grep -q "react" package.json 2>/dev/null; then
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/react-dev.md)
TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/react-dev.md)
elif ls *.py requirements.txt 2>/dev/null | head -1; then
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/python-dev.md)
TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/python-dev.md)
elif ls *.java pom.xml build.gradle 2>/dev/null | head -1; then
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/java-dev.md)
TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/java-dev.md)
elif ls *.go go.mod 2>/dev/null | head -1; then
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/go-dev.md)
TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/go-dev.md)
elif ls *.js package.json 2>/dev/null | head -1; then
TECH_GUIDELINES=$(cat ~/.claude/workflows/cli-templates/tech-stacks/javascript-dev.md)
TECH_GUIDELINES=$(cat ~/.ccw/workflows/cli-templates/tech-stacks/javascript-dev.md)
fi
fi
```

View File

@@ -70,7 +70,7 @@ def handle_brainstorm_assignment(prompt):
# Execute role template loading via $(cat template)
if step_name == "load_role_template":
processed_command = f"bash($(cat ~/.claude/workflows/cli-templates/planning-roles/{role}.md))"
processed_command = f"bash($(cat ~/.ccw/workflows/cli-templates/planning-roles/{role}.md))"
else:
processed_command = process_context_variables(command, context_vars)
@@ -106,7 +106,7 @@ This agent processes **simplified inline [FLOW_CONTROL]** format from brainstorm
2. **load_role_template**
- Action: Load role-specific planning template
- Command: bash($(cat "~/.claude/workflows/cli-templates/planning-roles/{role}.md"))
- Command: bash($(cat "~/.ccw/workflows/cli-templates/planning-roles/{role}.md"))
- Output: role_template
3. **load_session_metadata**
@@ -165,7 +165,7 @@ When called, you receive:
**Auto Brainstorm Integration**: Role assignment comes from auto.md workflow:
1. **Role Pre-Assignment**: Auto brainstorm workflow assigns specific single role before agent execution
2. **Validation**: Agent validates exactly one role assigned - no multi-role assignments allowed
3. **Template Loading**: Use `$(cat ~/.claude/workflows/cli-templates/planning-roles/<assigned-role>.md)` for role template
3. **Template Loading**: Use `$(cat ~/.ccw/workflows/cli-templates/planning-roles/<assigned-role>.md)` for role template
4. **Output Directory**: Use designated `.brainstorming/[role]/` directory for role-specific outputs
### Role Options Include:
@@ -190,7 +190,7 @@ When called, you receive:
### Role Template Integration
Documentation formats and structures are defined in role-specific templates loaded via:
```bash
$(cat ~/.claude/workflows/cli-templates/planning-roles/<assigned-role>.md)
$(cat ~/.ccw/workflows/cli-templates/planning-roles/<assigned-role>.md)
```
Each planning role template contains:

View File

@@ -320,7 +320,7 @@ You execute 6 distinct task types organized into 3 patterns. Each task includes
### design-tokens.json
**Template Reference**: `~/.claude/workflows/cli-templates/ui-design/systems/design-tokens.json`
**Template Reference**: `~/.ccw/workflows/cli-templates/ui-design/systems/design-tokens.json`
**Format**: W3C Design Tokens Community Group Specification
@@ -385,7 +385,7 @@ You execute 6 distinct task types organized into 3 patterns. Each task includes
### layout-templates.json
**Template Reference**: `~/.claude/workflows/cli-templates/ui-design/systems/layout-templates.json`
**Template Reference**: `~/.ccw/workflows/cli-templates/ui-design/systems/layout-templates.json`
**Optimization**: Unified structure combining DOM and styling into single hierarchy
@@ -426,7 +426,7 @@ You execute 6 distinct task types organized into 3 patterns. Each task includes
### animation-tokens.json
**Template Reference**: `~/.claude/workflows/cli-templates/ui-design/systems/animation-tokens.json`
**Template Reference**: `~/.ccw/workflows/cli-templates/ui-design/systems/animation-tokens.json`
**Structure Overview**:
- **duration**: instant (0ms), fast (150ms), normal (300ms), slow (500ms), slower (1000ms)