claude-code-workflow 6.3.37 → 6.3.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/workflow/lite-execute.md +2 -0
- package/.codex/agents/action-planning-agent.md +885 -0
- package/.codex/agents/ccw-loop-executor.md +260 -0
- package/.codex/agents/cli-discuss-agent.md +391 -0
- package/.codex/agents/cli-execution-agent.md +333 -0
- package/.codex/agents/cli-explore-agent.md +186 -0
- package/.codex/agents/cli-lite-planning-agent.md +736 -0
- package/.codex/agents/cli-planning-agent.md +562 -0
- package/.codex/agents/code-developer.md +408 -0
- package/.codex/agents/conceptual-planning-agent.md +321 -0
- package/.codex/agents/context-search-agent.md +585 -0
- package/.codex/agents/debug-explore-agent.md +436 -0
- package/.codex/agents/doc-generator.md +334 -0
- package/.codex/agents/issue-plan-agent.md +417 -0
- package/.codex/agents/issue-queue-agent.md +311 -0
- package/.codex/agents/memory-bridge.md +96 -0
- package/.codex/agents/test-context-search-agent.md +402 -0
- package/.codex/agents/test-fix-agent.md +359 -0
- package/.codex/agents/ui-design-agent.md +595 -0
- package/.codex/agents/universal-executor.md +135 -0
- package/.codex/prompts/issue-discover-by-prompt.md +364 -0
- package/.codex/prompts/issue-discover.md +261 -0
- package/.codex/prompts/issue-execute.md +10 -0
- package/.codex/prompts/issue-new.md +285 -0
- package/.codex/prompts/issue-plan.md +161 -63
- package/.codex/prompts/issue-queue.md +298 -288
- package/.codex/prompts/lite-execute.md +627 -133
- package/.codex/prompts/lite-fix.md +670 -0
- package/.codex/prompts/lite-plan-a.md +337 -0
- package/.codex/prompts/lite-plan-b.md +485 -0
- package/.codex/prompts/{lite-plan.md → lite-plan-c.md} +601 -469
- package/.codex/skills/ccw-loop/README.md +171 -0
- package/.codex/skills/ccw-loop/SKILL.md +349 -0
- package/.codex/skills/ccw-loop/phases/actions/action-complete.md +269 -0
- package/.codex/skills/ccw-loop/phases/actions/action-debug.md +286 -0
- package/.codex/skills/ccw-loop/phases/actions/action-develop.md +183 -0
- package/.codex/skills/ccw-loop/phases/actions/action-init.md +164 -0
- package/.codex/skills/ccw-loop/phases/actions/action-menu.md +205 -0
- package/.codex/skills/ccw-loop/phases/actions/action-validate.md +250 -0
- package/.codex/skills/ccw-loop/phases/orchestrator.md +416 -0
- package/.codex/skills/ccw-loop/phases/state-schema.md +388 -0
- package/.codex/skills/ccw-loop/specs/action-catalog.md +182 -0
- package/.codex/skills/ccw-loop-b/README.md +102 -0
- package/.codex/skills/ccw-loop-b/SKILL.md +322 -0
- package/.codex/skills/ccw-loop-b/phases/orchestrator.md +257 -0
- package/.codex/skills/ccw-loop-b/phases/state-schema.md +181 -0
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +4 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/install.d.ts.map +1 -1
- package/ccw/dist/commands/install.js +38 -7
- package/ccw/dist/commands/install.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +3 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +107 -0
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/commands/upgrade.js +1 -1
- package/ccw/dist/commands/upgrade.js.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.js +3 -2
- package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
- package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -1
- package/ccw/dist/core/memory-embedder-bridge.js +2 -5
- package/ccw/dist/core/memory-embedder-bridge.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +7 -6
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js +2 -2
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -1
- package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/graph-routes.js +17 -2
- package/ccw/dist/core/routes/graph-routes.js.map +1 -1
- package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/issue-routes.js +280 -33
- package/ccw/dist/core/routes/issue-routes.js.map +1 -1
- package/ccw/dist/core/routes/loop-v2-routes.d.ts +9 -0
- package/ccw/dist/core/routes/loop-v2-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/loop-v2-routes.js +56 -4
- package/ccw/dist/core/routes/loop-v2-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +3 -2
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +5 -3
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/tools/codex-lens-lsp.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens-lsp.js +2 -5
- package/ccw/dist/tools/codex-lens-lsp.js.map +1 -1
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +22 -32
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/dist/tools/litellm-client.d.ts +6 -0
- package/ccw/dist/tools/litellm-client.d.ts.map +1 -1
- package/ccw/dist/tools/litellm-client.js +15 -2
- package/ccw/dist/tools/litellm-client.js.map +1 -1
- package/ccw/dist/tools/loop-task-manager.d.ts +13 -2
- package/ccw/dist/tools/loop-task-manager.d.ts.map +1 -1
- package/ccw/dist/tools/loop-task-manager.js.map +1 -1
- package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -1
- package/ccw/dist/tools/native-session-discovery.js +35 -7
- package/ccw/dist/tools/native-session-discovery.js.map +1 -1
- package/ccw/dist/utils/codexlens-path.d.ts +36 -0
- package/ccw/dist/utils/codexlens-path.d.ts.map +1 -0
- package/ccw/dist/utils/codexlens-path.js +56 -0
- package/ccw/dist/utils/codexlens-path.js.map +1 -0
- package/ccw/dist/utils/uv-manager.d.ts.map +1 -1
- package/ccw/dist/utils/uv-manager.js +3 -2
- package/ccw/dist/utils/uv-manager.js.map +1 -1
- package/ccw/src/cli.ts +4 -0
- package/ccw/src/commands/install.ts +50 -7
- package/ccw/src/commands/issue.ts +119 -0
- package/ccw/src/commands/upgrade.ts +1 -1
- package/ccw/src/config/litellm-api-config-manager.ts +3 -2
- package/ccw/src/core/memory-embedder-bridge.ts +2 -6
- package/ccw/src/core/routes/cli-routes.ts +1 -1
- package/ccw/src/core/routes/codexlens/config-handlers.ts +7 -6
- package/ccw/src/core/routes/codexlens/semantic-handlers.ts +2 -2
- package/ccw/src/core/routes/graph-routes.ts +18 -2
- package/ccw/src/core/routes/issue-routes.ts +308 -33
- package/ccw/src/core/routes/loop-v2-routes.ts +64 -6
- package/ccw/src/core/routes/system-routes.ts +3 -2
- package/ccw/src/core/server.ts +6 -3
- package/ccw/src/templates/dashboard-css/02-session.css +2 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +103 -1
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +32 -0
- package/ccw/src/templates/dashboard-js/components/cli-history.js +48 -48
- package/ccw/src/templates/dashboard-js/components/navigation.js +6 -0
- package/ccw/src/templates/dashboard-js/components/notifications.js +6 -0
- package/ccw/src/templates/dashboard-js/components/version-check.js +38 -0
- package/ccw/src/templates/dashboard-js/i18n.js +126 -0
- package/ccw/src/templates/dashboard-js/state.js +2 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +1 -1
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +183 -1
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +55 -11
- package/ccw/src/templates/dashboard-js/views/loop-monitor.js +112 -11
- package/ccw/src/templates/dashboard.html +48 -2
- package/ccw/src/tools/codex-lens-lsp.ts +2 -5
- package/ccw/src/tools/codex-lens.ts +27 -38
- package/ccw/src/tools/litellm-client.ts +16 -2
- package/ccw/src/tools/loop-task-manager.ts +13 -2
- package/ccw/src/tools/native-session-discovery.ts +38 -7
- package/ccw/src/utils/codexlens-path.ts +60 -0
- package/ccw/src/utils/uv-manager.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: universal-executor
|
|
3
|
+
description: |
|
|
4
|
+
Versatile execution agent for implementing any task efficiently. Adapts to any domain while maintaining quality standards and systematic execution. Can handle analysis, implementation, documentation, research, and complex multi-step workflows.
|
|
5
|
+
|
|
6
|
+
Examples:
|
|
7
|
+
- Context: User provides task with sufficient context
|
|
8
|
+
user: "Analyze market trends and create presentation following these guidelines: [context]"
|
|
9
|
+
assistant: "I'll analyze the market trends and create the presentation using the provided guidelines"
|
|
10
|
+
commentary: Execute task directly with user-provided context
|
|
11
|
+
|
|
12
|
+
- Context: User provides insufficient context
|
|
13
|
+
user: "Organize project documentation"
|
|
14
|
+
assistant: "I need to understand the current documentation structure first"
|
|
15
|
+
commentary: Gather context about existing documentation, then execute
|
|
16
|
+
color: green
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
You are a versatile execution specialist focused on completing high-quality tasks efficiently across any domain. You receive tasks with context and execute them systematically using proven methodologies.
|
|
20
|
+
|
|
21
|
+
## Core Execution Philosophy
|
|
22
|
+
|
|
23
|
+
- **Incremental progress** - Break down complex tasks into manageable steps
|
|
24
|
+
- **Context-driven** - Use provided context and existing patterns
|
|
25
|
+
- **Quality over speed** - Deliver reliable, well-executed results
|
|
26
|
+
- **Adaptability** - Adjust approach based on task domain and requirements
|
|
27
|
+
|
|
28
|
+
## Execution Process
|
|
29
|
+
|
|
30
|
+
### 1. Context Assessment
|
|
31
|
+
**Input Sources**:
|
|
32
|
+
- User-provided task description and context
|
|
33
|
+
- **MCP Tools Selection**: Choose appropriate tools based on task type (Code Index for codebase, Exa for research)
|
|
34
|
+
- Existing documentation and examples
|
|
35
|
+
- Project CLAUDE.md standards
|
|
36
|
+
- Domain-specific requirements
|
|
37
|
+
|
|
38
|
+
**Context Evaluation**:
|
|
39
|
+
```
|
|
40
|
+
IF context sufficient for execution:
|
|
41
|
+
→ Proceed with task execution
|
|
42
|
+
ELIF context insufficient OR task has flow control marker:
|
|
43
|
+
→ Check for [FLOW_CONTROL] marker:
|
|
44
|
+
- Execute flow_control.pre_analysis steps sequentially for context gathering
|
|
45
|
+
- Use four flexible context acquisition methods:
|
|
46
|
+
* Document references (cat commands)
|
|
47
|
+
* Search commands (grep/rg/find)
|
|
48
|
+
* CLI analysis (gemini/codex)
|
|
49
|
+
* Free exploration (Read/Grep/Search tools)
|
|
50
|
+
- Pass context between steps via [variable_name] references
|
|
51
|
+
→ Extract patterns and conventions from accumulated context
|
|
52
|
+
→ Proceed with execution
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 2. Execution Standards
|
|
56
|
+
|
|
57
|
+
**Systematic Approach**:
|
|
58
|
+
- Break complex tasks into clear, manageable steps
|
|
59
|
+
- Validate assumptions and requirements before proceeding
|
|
60
|
+
- Document decisions and reasoning throughout the process
|
|
61
|
+
- Ensure each step builds logically on previous work
|
|
62
|
+
|
|
63
|
+
**Quality Standards**:
|
|
64
|
+
- Single responsibility per task/subtask
|
|
65
|
+
- Clear, descriptive naming and organization
|
|
66
|
+
- Explicit handling of edge cases and errors
|
|
67
|
+
- No unnecessary complexity
|
|
68
|
+
- Follow established patterns and conventions
|
|
69
|
+
|
|
70
|
+
**Verification Guidelines**:
|
|
71
|
+
- Before referencing existing resources, verify their existence and relevance
|
|
72
|
+
- Test intermediate results before proceeding to next steps
|
|
73
|
+
- Ensure outputs meet specified requirements
|
|
74
|
+
- Validate final deliverables against original task goals
|
|
75
|
+
|
|
76
|
+
### 3. Quality Gates
|
|
77
|
+
**Before Task Completion**:
|
|
78
|
+
- All deliverables meet specified requirements
|
|
79
|
+
- Work functions/operates as intended
|
|
80
|
+
- Follows discovered patterns and conventions
|
|
81
|
+
- Clear organization and documentation
|
|
82
|
+
- Proper handling of edge cases
|
|
83
|
+
|
|
84
|
+
### 4. Task Completion
|
|
85
|
+
|
|
86
|
+
**Upon completing any task:**
|
|
87
|
+
|
|
88
|
+
1. **Verify Implementation**:
|
|
89
|
+
- Deliverables meet all requirements
|
|
90
|
+
- Work functions as specified
|
|
91
|
+
- Quality standards maintained
|
|
92
|
+
|
|
93
|
+
### 5. Problem-Solving
|
|
94
|
+
|
|
95
|
+
**When facing challenges** (max 3 attempts):
|
|
96
|
+
1. Document specific obstacles and constraints
|
|
97
|
+
2. Try 2-3 alternative approaches
|
|
98
|
+
3. Consider simpler or alternative solutions
|
|
99
|
+
4. After 3 attempts, escalate for consultation
|
|
100
|
+
|
|
101
|
+
## Quality Checklist
|
|
102
|
+
|
|
103
|
+
Before completing any task, verify:
|
|
104
|
+
- [ ] **Resource verification complete** - All referenced resources/dependencies exist
|
|
105
|
+
- [ ] Deliverables meet all specified requirements
|
|
106
|
+
- [ ] Work functions/operates as intended
|
|
107
|
+
- [ ] Follows established patterns and conventions
|
|
108
|
+
- [ ] Clear organization and documentation
|
|
109
|
+
- [ ] No unnecessary complexity
|
|
110
|
+
- [ ] Proper handling of edge cases
|
|
111
|
+
- [ ] TODO list updated
|
|
112
|
+
- [ ] Comprehensive summary document generated with all deliverables listed
|
|
113
|
+
|
|
114
|
+
## Key Reminders
|
|
115
|
+
|
|
116
|
+
**NEVER:**
|
|
117
|
+
- Reference resources without verifying existence first
|
|
118
|
+
- Create deliverables that don't meet requirements
|
|
119
|
+
- Add unnecessary complexity
|
|
120
|
+
- Make assumptions - verify with existing materials
|
|
121
|
+
- Skip quality verification steps
|
|
122
|
+
|
|
123
|
+
**Bash Tool**:
|
|
124
|
+
- Use `run_in_background=false` for all Bash/CLI calls to ensure foreground execution
|
|
125
|
+
|
|
126
|
+
**ALWAYS:**
|
|
127
|
+
- **Search Tool Priority**: ACE (`mcp__ace-tool__search_context`) → CCW (`mcp__ccw-tools__smart_search`) / Built-in (`Grep`, `Glob`, `Read`)
|
|
128
|
+
- Verify resource/dependency existence before referencing
|
|
129
|
+
- Execute tasks systematically and incrementally
|
|
130
|
+
- Test and validate work thoroughly
|
|
131
|
+
- Follow established patterns and conventions
|
|
132
|
+
- Handle edge cases appropriately
|
|
133
|
+
- Keep tasks focused and manageable
|
|
134
|
+
- Generate detailed summary documents with complete deliverable listings
|
|
135
|
+
- Document all key outputs and integration points for dependent tasks
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Discover issues from user prompt with iterative multi-agent exploration and cross-module comparison
|
|
3
|
+
argument-hint: "<prompt> [--scope=src/**] [--depth=standard|deep] [--max-iterations=5]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Issue Discovery by Prompt (Codex Version)
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
|
|
10
|
+
Prompt-driven issue discovery with intelligent planning. Instead of fixed perspectives, this command:
|
|
11
|
+
|
|
12
|
+
1. **Analyzes user intent** to understand what to find
|
|
13
|
+
2. **Plans exploration strategy** dynamically based on codebase structure
|
|
14
|
+
3. **Executes iterative exploration** with feedback loops
|
|
15
|
+
4. **Performs cross-module comparison** when detecting comparison intent
|
|
16
|
+
|
|
17
|
+
**Core Difference from `issue-discover.md`**:
|
|
18
|
+
- `issue-discover`: Pre-defined perspectives (bug, security, etc.), parallel execution
|
|
19
|
+
- `issue-discover-by-prompt`: User-driven prompt, planned strategy, iterative exploration
|
|
20
|
+
|
|
21
|
+
## Inputs
|
|
22
|
+
|
|
23
|
+
- **Prompt**: Natural language description of what to find
|
|
24
|
+
- **Scope**: `--scope=src/**` - File pattern to explore (default: `**/*`)
|
|
25
|
+
- **Depth**: `--depth=standard|deep` - standard (3 iterations) or deep (5+ iterations)
|
|
26
|
+
- **Max Iterations**: `--max-iterations=N` (default: 5)
|
|
27
|
+
|
|
28
|
+
## Output Requirements
|
|
29
|
+
|
|
30
|
+
**Generate Files:**
|
|
31
|
+
1. `.workflow/issues/discoveries/{discovery-id}/discovery-state.json` - Session state with iteration tracking
|
|
32
|
+
2. `.workflow/issues/discoveries/{discovery-id}/iterations/{N}/{dimension}.json` - Per-iteration findings
|
|
33
|
+
3. `.workflow/issues/discoveries/{discovery-id}/comparison-analysis.json` - Cross-dimension comparison (if applicable)
|
|
34
|
+
4. `.workflow/issues/discoveries/{discovery-id}/discovery-issues.jsonl` - Generated issue candidates
|
|
35
|
+
|
|
36
|
+
**Return Summary:**
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"discovery_id": "DBP-YYYYMMDD-HHmmss",
|
|
40
|
+
"prompt": "Check if frontend API calls match backend implementations",
|
|
41
|
+
"intent_type": "comparison",
|
|
42
|
+
"dimensions": ["frontend-calls", "backend-handlers"],
|
|
43
|
+
"total_iterations": 3,
|
|
44
|
+
"total_findings": 24,
|
|
45
|
+
"issues_generated": 12,
|
|
46
|
+
"comparison_match_rate": 0.75
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Workflow
|
|
51
|
+
|
|
52
|
+
### Step 1: Initialize Discovery Session
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Generate discovery ID
|
|
56
|
+
DISCOVERY_ID="DBP-$(date -u +%Y%m%d-%H%M%S)"
|
|
57
|
+
OUTPUT_DIR=".workflow/issues/discoveries/${DISCOVERY_ID}"
|
|
58
|
+
|
|
59
|
+
# Create directory structure
|
|
60
|
+
mkdir -p "${OUTPUT_DIR}/iterations"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Detect intent type from prompt:
|
|
64
|
+
- `comparison`: Contains "match", "compare", "versus", "vs", "between"
|
|
65
|
+
- `search`: Contains "find", "locate", "where"
|
|
66
|
+
- `verification`: Contains "verify", "check", "ensure"
|
|
67
|
+
- `audit`: Contains "audit", "review", "analyze"
|
|
68
|
+
|
|
69
|
+
### Step 2: Gather Context
|
|
70
|
+
|
|
71
|
+
Use `rg` and file exploration to understand codebase structure:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Find relevant modules based on prompt keywords
|
|
75
|
+
rg -l "<keyword1>" --type ts | head -10
|
|
76
|
+
rg -l "<keyword2>" --type ts | head -10
|
|
77
|
+
|
|
78
|
+
# Understand project structure
|
|
79
|
+
ls -la src/
|
|
80
|
+
cat .workflow/project-tech.json 2>/dev/null || echo "No project-tech.json"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Build context package:
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"prompt_keywords": ["frontend", "API", "backend"],
|
|
87
|
+
"codebase_structure": { "modules": [...], "patterns": [...] },
|
|
88
|
+
"relevant_modules": ["src/api/", "src/services/"]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Step 3: Plan Exploration Strategy
|
|
93
|
+
|
|
94
|
+
Analyze the prompt and context to design exploration strategy.
|
|
95
|
+
|
|
96
|
+
**Output exploration plan:**
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"intent_analysis": {
|
|
100
|
+
"type": "comparison",
|
|
101
|
+
"primary_question": "Do frontend API calls match backend implementations?",
|
|
102
|
+
"sub_questions": ["Are endpoints aligned?", "Are payloads compatible?"]
|
|
103
|
+
},
|
|
104
|
+
"dimensions": [
|
|
105
|
+
{
|
|
106
|
+
"name": "frontend-calls",
|
|
107
|
+
"description": "Client-side API calls and error handling",
|
|
108
|
+
"search_targets": ["src/api/**", "src/hooks/**"],
|
|
109
|
+
"focus_areas": ["fetch calls", "error boundaries", "response parsing"]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "backend-handlers",
|
|
113
|
+
"description": "Server-side API implementations",
|
|
114
|
+
"search_targets": ["src/server/**", "src/routes/**"],
|
|
115
|
+
"focus_areas": ["endpoint handlers", "response schemas", "error responses"]
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"comparison_matrix": {
|
|
119
|
+
"dimension_a": "frontend-calls",
|
|
120
|
+
"dimension_b": "backend-handlers",
|
|
121
|
+
"comparison_points": [
|
|
122
|
+
{"aspect": "endpoints", "frontend_check": "fetch URLs", "backend_check": "route paths"},
|
|
123
|
+
{"aspect": "methods", "frontend_check": "HTTP methods used", "backend_check": "methods accepted"},
|
|
124
|
+
{"aspect": "payloads", "frontend_check": "request body structure", "backend_check": "expected schema"},
|
|
125
|
+
{"aspect": "responses", "frontend_check": "response parsing", "backend_check": "response format"}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"estimated_iterations": 3,
|
|
129
|
+
"termination_conditions": ["All comparison points verified", "No new findings in last iteration"]
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 4: Iterative Exploration
|
|
134
|
+
|
|
135
|
+
Execute iterations until termination conditions are met:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
WHILE iteration < max_iterations AND shouldContinue:
|
|
139
|
+
1. Plan iteration focus based on previous findings
|
|
140
|
+
2. Explore each dimension
|
|
141
|
+
3. Collect and analyze findings
|
|
142
|
+
4. Cross-reference between dimensions
|
|
143
|
+
5. Check convergence
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**For each iteration:**
|
|
147
|
+
|
|
148
|
+
1. **Search for relevant code** using `rg`:
|
|
149
|
+
```bash
|
|
150
|
+
# Based on dimension focus areas
|
|
151
|
+
rg "fetch\s*\(" --type ts -C 3 | head -50
|
|
152
|
+
rg "app\.(get|post|put|delete)" --type ts -C 3 | head -50
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
2. **Analyze and record findings**:
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"dimension": "frontend-calls",
|
|
159
|
+
"iteration": 1,
|
|
160
|
+
"findings": [
|
|
161
|
+
{
|
|
162
|
+
"id": "F-001",
|
|
163
|
+
"title": "Undefined endpoint in UserService",
|
|
164
|
+
"category": "endpoint-mismatch",
|
|
165
|
+
"file": "src/api/userService.ts",
|
|
166
|
+
"line": 42,
|
|
167
|
+
"snippet": "fetch('/api/users/profile')",
|
|
168
|
+
"related_dimension": "backend-handlers",
|
|
169
|
+
"confidence": 0.85
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"coverage": {
|
|
173
|
+
"files_explored": 15,
|
|
174
|
+
"areas_covered": ["fetch calls", "axios instances"],
|
|
175
|
+
"areas_remaining": ["graphql queries"]
|
|
176
|
+
},
|
|
177
|
+
"leads": [
|
|
178
|
+
{"description": "Check GraphQL mutations", "suggested_search": "mutation.*User"}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
3. **Cross-reference findings** between dimensions:
|
|
184
|
+
```javascript
|
|
185
|
+
// For each finding in dimension A, look for related code in dimension B
|
|
186
|
+
if (finding.related_dimension) {
|
|
187
|
+
searchForRelatedCode(finding, otherDimension);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
4. **Check convergence**:
|
|
192
|
+
```javascript
|
|
193
|
+
const convergence = {
|
|
194
|
+
newDiscoveries: newFindings.length,
|
|
195
|
+
confidence: calculateConfidence(cumulativeFindings),
|
|
196
|
+
converged: newFindings.length === 0 || confidence > 0.9
|
|
197
|
+
};
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Step 5: Cross-Analysis (for comparison intent)
|
|
201
|
+
|
|
202
|
+
If intent is comparison, analyze findings across dimensions:
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
for (const point of comparisonMatrix.comparison_points) {
|
|
206
|
+
const aFindings = findings.filter(f =>
|
|
207
|
+
f.related_dimension === dimension_a && f.category.includes(point.aspect)
|
|
208
|
+
);
|
|
209
|
+
const bFindings = findings.filter(f =>
|
|
210
|
+
f.related_dimension === dimension_b && f.category.includes(point.aspect)
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
// Find discrepancies
|
|
214
|
+
const discrepancies = compareFindings(aFindings, bFindings, point);
|
|
215
|
+
|
|
216
|
+
// Calculate match rate
|
|
217
|
+
const matchRate = calculateMatchRate(aFindings, bFindings);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Write to `comparison-analysis.json`:
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"matrix": { "dimension_a": "...", "dimension_b": "...", "comparison_points": [...] },
|
|
225
|
+
"results": [
|
|
226
|
+
{
|
|
227
|
+
"aspect": "endpoints",
|
|
228
|
+
"dimension_a_count": 15,
|
|
229
|
+
"dimension_b_count": 12,
|
|
230
|
+
"discrepancies": [
|
|
231
|
+
{"frontend": "/api/users/profile", "backend": "NOT_FOUND", "type": "missing_endpoint"}
|
|
232
|
+
],
|
|
233
|
+
"match_rate": 0.80
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"summary": {
|
|
237
|
+
"total_discrepancies": 5,
|
|
238
|
+
"overall_match_rate": 0.75,
|
|
239
|
+
"critical_mismatches": ["endpoints", "payloads"]
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Step 6: Generate Issues
|
|
245
|
+
|
|
246
|
+
Convert high-confidence findings to issues:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# For each finding with confidence >= 0.7 or priority critical/high
|
|
250
|
+
echo '{"id":"ISS-DBP-001","title":"Missing backend endpoint for /api/users/profile",...}' >> ${OUTPUT_DIR}/discovery-issues.jsonl
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Step 7: Update Final State
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
{
|
|
257
|
+
"discovery_id": "DBP-...",
|
|
258
|
+
"type": "prompt-driven",
|
|
259
|
+
"prompt": "...",
|
|
260
|
+
"intent_type": "comparison",
|
|
261
|
+
"phase": "complete",
|
|
262
|
+
"created_at": "...",
|
|
263
|
+
"updated_at": "...",
|
|
264
|
+
"iterations": [
|
|
265
|
+
{"number": 1, "findings_count": 10, "new_discoveries": 10, "confidence": 0.6},
|
|
266
|
+
{"number": 2, "findings_count": 18, "new_discoveries": 8, "confidence": 0.75},
|
|
267
|
+
{"number": 3, "findings_count": 24, "new_discoveries": 6, "confidence": 0.85}
|
|
268
|
+
],
|
|
269
|
+
"results": {
|
|
270
|
+
"total_iterations": 3,
|
|
271
|
+
"total_findings": 24,
|
|
272
|
+
"issues_generated": 12,
|
|
273
|
+
"comparison_match_rate": 0.75
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Step 8: Output Summary
|
|
279
|
+
|
|
280
|
+
```markdown
|
|
281
|
+
## Discovery Complete: DBP-...
|
|
282
|
+
|
|
283
|
+
**Prompt**: Check if frontend API calls match backend implementations
|
|
284
|
+
**Intent**: comparison
|
|
285
|
+
**Dimensions**: frontend-calls, backend-handlers
|
|
286
|
+
|
|
287
|
+
### Iteration Summary
|
|
288
|
+
| # | Findings | New | Confidence |
|
|
289
|
+
|---|----------|-----|------------|
|
|
290
|
+
| 1 | 10 | 10 | 60% |
|
|
291
|
+
| 2 | 18 | 8 | 75% |
|
|
292
|
+
| 3 | 24 | 6 | 85% |
|
|
293
|
+
|
|
294
|
+
### Comparison Results
|
|
295
|
+
- **Overall Match Rate**: 75%
|
|
296
|
+
- **Total Discrepancies**: 5
|
|
297
|
+
- **Critical Mismatches**: endpoints, payloads
|
|
298
|
+
|
|
299
|
+
### Issues Generated: 12
|
|
300
|
+
- 2 Critical
|
|
301
|
+
- 4 High
|
|
302
|
+
- 6 Medium
|
|
303
|
+
|
|
304
|
+
### Next Steps
|
|
305
|
+
- `/issue:plan DBP-001,DBP-002,...` to plan solutions
|
|
306
|
+
- `ccw view` to review findings in dashboard
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Quality Checklist
|
|
310
|
+
|
|
311
|
+
Before completing, verify:
|
|
312
|
+
|
|
313
|
+
- [ ] Intent type correctly detected from prompt
|
|
314
|
+
- [ ] Dimensions dynamically generated based on prompt
|
|
315
|
+
- [ ] Iterations executed until convergence or max limit
|
|
316
|
+
- [ ] Cross-reference analysis performed (for comparison intent)
|
|
317
|
+
- [ ] High-confidence findings converted to issues
|
|
318
|
+
- [ ] Discovery state shows `phase: complete`
|
|
319
|
+
|
|
320
|
+
## Error Handling
|
|
321
|
+
|
|
322
|
+
| Situation | Action |
|
|
323
|
+
|-----------|--------|
|
|
324
|
+
| No relevant code found | Report empty result, suggest broader scope |
|
|
325
|
+
| Max iterations without convergence | Complete with current findings, note in summary |
|
|
326
|
+
| Comparison dimension mismatch | Report which dimension has fewer findings |
|
|
327
|
+
| No comparison points matched | Report as "No direct matches found" |
|
|
328
|
+
|
|
329
|
+
## Use Cases
|
|
330
|
+
|
|
331
|
+
| Scenario | Example Prompt |
|
|
332
|
+
|----------|----------------|
|
|
333
|
+
| API Contract | "Check if frontend calls match backend endpoints" |
|
|
334
|
+
| Error Handling | "Find inconsistent error handling patterns" |
|
|
335
|
+
| Migration Gap | "Compare old auth with new auth implementation" |
|
|
336
|
+
| Feature Parity | "Verify mobile has all web features" |
|
|
337
|
+
| Schema Drift | "Check if TypeScript types match API responses" |
|
|
338
|
+
| Integration | "Find mismatches between service A and service B" |
|
|
339
|
+
|
|
340
|
+
## Start Discovery
|
|
341
|
+
|
|
342
|
+
Parse prompt and detect intent:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
PROMPT="${1}"
|
|
346
|
+
SCOPE="${2:-**/*}"
|
|
347
|
+
DEPTH="${3:-standard}"
|
|
348
|
+
|
|
349
|
+
# Detect intent keywords
|
|
350
|
+
if echo "${PROMPT}" | grep -qiE '(match|compare|versus|vs|between)'; then
|
|
351
|
+
INTENT="comparison"
|
|
352
|
+
elif echo "${PROMPT}" | grep -qiE '(find|locate|where)'; then
|
|
353
|
+
INTENT="search"
|
|
354
|
+
elif echo "${PROMPT}" | grep -qiE '(verify|check|ensure)'; then
|
|
355
|
+
INTENT="verification"
|
|
356
|
+
else
|
|
357
|
+
INTENT="audit"
|
|
358
|
+
fi
|
|
359
|
+
|
|
360
|
+
echo "Intent detected: ${INTENT}"
|
|
361
|
+
echo "Starting discovery with scope: ${SCOPE}"
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Then follow the workflow to explore and discover issues.
|