claude-code-workflow 6.3.43 → 6.3.44

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.
Files changed (77) hide show
  1. package/.claude/agents/tdd-developer.md +530 -0
  2. package/.claude/commands/issue/discover-by-prompt.md +5 -1
  3. package/.claude/commands/issue/discover.md +472 -468
  4. package/.claude/commands/issue/execute.md +580 -581
  5. package/.claude/commands/issue/new.md +417 -413
  6. package/.claude/commands/issue/plan.md +5 -1
  7. package/.claude/commands/issue/queue.md +445 -441
  8. package/.claude/commands/task/breakdown.md +207 -203
  9. package/.claude/commands/task/replan.md +440 -436
  10. package/.claude/commands/workflow/action-plan-verify.md +485 -447
  11. package/.claude/commands/workflow/brainstorm/artifacts.md +457 -453
  12. package/.claude/commands/workflow/brainstorm/auto-parallel.md +5 -1
  13. package/.claude/commands/workflow/brainstorm/synthesis.md +402 -398
  14. package/.claude/commands/workflow/clean.md +67 -35
  15. package/.claude/commands/workflow/debug-with-file.md +670 -666
  16. package/.claude/commands/workflow/debug.md +331 -327
  17. package/.claude/commands/workflow/develop-with-file.md +5 -1
  18. package/.claude/commands/workflow/execute.md +546 -498
  19. package/.claude/commands/workflow/lite-execute.md +44 -26
  20. package/.claude/commands/workflow/lite-fix.md +780 -730
  21. package/.claude/commands/workflow/lite-lite-lite.md +5 -1
  22. package/.claude/commands/workflow/lite-plan.md +87 -39
  23. package/.claude/commands/workflow/multi-cli-plan.md +572 -568
  24. package/.claude/commands/workflow/plan-verify.md +527 -0
  25. package/.claude/commands/workflow/plan.md +555 -551
  26. package/.claude/commands/workflow/replan.md +572 -515
  27. package/.claude/commands/workflow/review-fix.md +608 -610
  28. package/.claude/commands/workflow/session/complete.md +37 -14
  29. package/.claude/commands/workflow/session/solidify.md +303 -299
  30. package/.claude/commands/workflow/tdd-plan.md +630 -597
  31. package/.claude/commands/workflow/tdd-verify.md +391 -206
  32. package/.claude/commands/workflow/tools/conflict-resolution.md +24 -12
  33. package/.claude/commands/workflow/tools/task-generate-agent.md +583 -563
  34. package/.claude/commands/workflow/tools/task-generate-tdd.md +749 -517
  35. package/.claude/commands/workflow/ui-design/animation-extract.md +1154 -1150
  36. package/.claude/commands/workflow/ui-design/layout-extract.md +792 -788
  37. package/.claude/commands/workflow/ui-design/style-extract.md +777 -773
  38. package/.claude/skills/ccw/command.json +4 -4
  39. package/.claude/skills/ccw-coordinator/README.md +45 -0
  40. package/.claude/skills/ccw-coordinator/SKILL.md +320 -0
  41. package/.claude/skills/ccw-coordinator/phases/actions/action-abort.md +9 -0
  42. package/.claude/skills/ccw-coordinator/phases/actions/action-command-build.md +40 -0
  43. package/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md +124 -0
  44. package/.claude/skills/ccw-coordinator/phases/actions/action-command-selection.md +48 -0
  45. package/.claude/skills/ccw-coordinator/phases/actions/action-complete.md +25 -0
  46. package/.claude/skills/ccw-coordinator/phases/actions/action-init.md +26 -0
  47. package/.claude/skills/ccw-coordinator/phases/orchestrator.md +59 -0
  48. package/.claude/skills/ccw-coordinator/phases/state-schema.md +66 -0
  49. package/.claude/skills/ccw-coordinator/skill-config.json +66 -0
  50. package/.claude/skills/ccw-coordinator/specs/command-library.md +169 -0
  51. package/.claude/skills/ccw-coordinator/specs/specs.md +362 -0
  52. package/.claude/skills/ccw-coordinator/tools/README.md +95 -0
  53. package/.claude/skills/ccw-coordinator/tools/chain-validate.cjs +320 -0
  54. package/.claude/skills/ccw-coordinator/tools/command-registry.cjs +255 -0
  55. package/.claude/skills/ccw-help/command.json +5 -5
  56. package/.claude/skills/ccw-help/scripts/analyze_commands.py +337 -337
  57. package/.claude/workflows/cli-templates/prompts/workflow-impl-plan-template.txt +1 -1
  58. package/ccw/dist/commands/issue.d.ts +4 -0
  59. package/ccw/dist/commands/issue.d.ts.map +1 -1
  60. package/ccw/dist/commands/issue.js +73 -6
  61. package/ccw/dist/commands/issue.js.map +1 -1
  62. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  63. package/ccw/dist/core/routes/cli-routes.js +32 -28
  64. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  65. package/ccw/dist/tools/claude-cli-tools.d.ts +10 -0
  66. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  67. package/ccw/dist/tools/claude-cli-tools.js +45 -0
  68. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  69. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  70. package/ccw/dist/tools/codex-lens.js +38 -11
  71. package/ccw/dist/tools/codex-lens.js.map +1 -1
  72. package/ccw/src/commands/issue.ts +84 -6
  73. package/ccw/src/core/routes/cli-routes.ts +30 -25
  74. package/ccw/src/templates/dashboard-js/views/help.js +1 -1
  75. package/ccw/src/tools/claude-cli-tools.ts +50 -0
  76. package/ccw/src/tools/codex-lens.ts +40 -11
  77. package/package.json +1 -1
@@ -1,468 +1,472 @@
1
- ---
2
- name: issue:discover
3
- description: Discover potential issues from multiple perspectives (bug, UX, test, quality, security, performance, maintainability, best-practices) using CLI explore. Supports Exa external research for security and best-practices perspectives.
4
- argument-hint: "<path-pattern> [--perspectives=bug,ux,...] [--external]"
5
- allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*), Task(*), AskUserQuestion(*), Glob(*), Grep(*)
6
- ---
7
-
8
- # Issue Discovery Command
9
-
10
- ## Quick Start
11
-
12
- ```bash
13
- # Discover issues in specific module (interactive perspective selection)
14
- /issue:discover src/auth/**
15
-
16
- # Discover with specific perspectives
17
- /issue:discover src/payment/** --perspectives=bug,security,test
18
-
19
- # Discover with external research for all perspectives
20
- /issue:discover src/api/** --external
21
-
22
- # Discover in multiple modules
23
- /issue:discover src/auth/**,src/payment/**
24
- ```
25
-
26
- **Discovery Scope**: Specified modules/files only
27
- **Output Directory**: `.workflow/issues/discoveries/{discovery-id}/`
28
- **Available Perspectives**: bug, ux, test, quality, security, performance, maintainability, best-practices
29
- **Exa Integration**: Auto-enabled for security and best-practices perspectives
30
- **CLI Tools**: Gemini Qwen → Codex (fallback chain)
31
-
32
- ## What & Why
33
-
34
- ### Core Concept
35
- Multi-perspective issue discovery orchestrator that explores code from different angles to identify potential bugs, UX improvements, test gaps, and other actionable items. Unlike code review (which assesses existing code quality), discovery focuses on **finding opportunities for improvement and potential problems**.
36
-
37
- **vs Code Review**:
38
- - **Code Review** (`review-module-cycle`): Evaluates code quality against standards
39
- - **Issue Discovery** (`issue:discover`): Finds actionable issues, bugs, and improvement opportunities
40
-
41
- ### Value Proposition
42
- 1. **Proactive Issue Detection**: Find problems before they become bugs
43
- 2. **Multi-Perspective Analysis**: Each perspective surfaces different types of issues
44
- 3. **External Benchmarking**: Compare against industry best practices via Exa
45
- 4. **Direct Issue Integration**: Discoveries can be exported to issue tracker
46
- 5. **Dashboard Management**: View, filter, and export discoveries via CCW dashboard
47
-
48
- ## How It Works
49
-
50
- ### Execution Flow
51
-
52
- ```
53
- Phase 1: Discovery & Initialization
54
- └─ Parse target pattern, create session, initialize output structure
55
-
56
- Phase 2: Interactive Perspective Selection
57
- └─ AskUserQuestion for perspective selection (or use --perspectives)
58
-
59
- Phase 3: Parallel Perspective Analysis
60
- ├─ Launch N @cli-explore-agent instances (one per perspective)
61
- ├─ Security & Best-Practices auto-trigger Exa research
62
- ├─ Agent writes perspective JSON, returns summary
63
- └─ Update discovery-progress.json
64
-
65
- Phase 4: Aggregation & Prioritization
66
- ├─ Collect agent return summaries
67
- ├─ Load perspective JSON files
68
- ├─ Merge findings, deduplicate by file+line
69
- └─ Calculate priority scores
70
-
71
- Phase 5: Issue Generation & Summary
72
- ├─ Convert high-priority discoveries to issue format
73
- ├─ Write to discovery-issues.jsonl
74
- ├─ Generate single summary.md from agent returns
75
- └─ Update discovery-state.json to complete
76
-
77
- Phase 6: User Action Prompt
78
- └─ AskUserQuestion for next step (export/dashboard/skip)
79
- ```
80
-
81
- ## Perspectives
82
-
83
- ### Available Perspectives
84
-
85
- | Perspective | Focus | Categories | Exa |
86
- |-------------|-------|------------|-----|
87
- | **bug** | Potential Bugs | edge-case, null-check, resource-leak, race-condition, boundary, exception-handling | - |
88
- | **ux** | User Experience | error-message, loading-state, feedback, accessibility, interaction, consistency | - |
89
- | **test** | Test Coverage | missing-test, edge-case-test, integration-gap, coverage-hole, assertion-quality | - |
90
- | **quality** | Code Quality | complexity, duplication, naming, documentation, code-smell, readability | - |
91
- | **security** | Security Issues | injection, auth, encryption, input-validation, data-exposure, access-control | |
92
- | **performance** | Performance | n-plus-one, memory-usage, caching, algorithm, blocking-operation, resource | - |
93
- | **maintainability** | Maintainability | coupling, cohesion, tech-debt, extensibility, module-boundary, interface-design | - |
94
- | **best-practices** | Best Practices | convention, pattern, framework-usage, anti-pattern, industry-standard | |
95
-
96
- ### Interactive Perspective Selection
97
-
98
- When no `--perspectives` flag is provided, the command uses AskUserQuestion:
99
-
100
- ```javascript
101
- AskUserQuestion({
102
- questions: [{
103
- question: "Select primary discovery focus:",
104
- header: "Focus",
105
- multiSelect: false,
106
- options: [
107
- { label: "Bug + Test + Quality", description: "Quick scan: potential bugs, test gaps, code quality (Recommended)" },
108
- { label: "Security + Performance", description: "System audit: security issues, performance bottlenecks" },
109
- { label: "Maintainability + Best-practices", description: "Long-term health: coupling, tech debt, conventions" },
110
- { label: "Full analysis", description: "All 7 perspectives (comprehensive, takes longer)" }
111
- ]
112
- }]
113
- })
114
- ```
115
-
116
- **Recommended Combinations**:
117
- - Quick scan: bug, test, quality
118
- - Full analysis: all perspectives
119
- - Security audit: security, bug, quality
120
-
121
- ## Core Responsibilities
122
-
123
- ### Orchestrator
124
-
125
- **Phase 1: Discovery & Initialization**
126
-
127
- ```javascript
128
- // Step 1: Parse target pattern and resolve files
129
- const resolvedFiles = await expandGlobPattern(targetPattern);
130
- if (resolvedFiles.length === 0) {
131
- throw new Error(`No files matched pattern: ${targetPattern}`);
132
- }
133
-
134
- // Step 2: Generate discovery ID
135
- const discoveryId = `DSC-${formatDate(new Date(), 'YYYYMMDD-HHmmss')}`;
136
-
137
- // Step 3: Create output directory
138
- const outputDir = `.workflow/issues/discoveries/${discoveryId}`;
139
- await mkdir(outputDir, { recursive: true });
140
- await mkdir(`${outputDir}/perspectives`, { recursive: true });
141
-
142
- // Step 4: Initialize unified discovery state (merged state+progress)
143
- await writeJson(`${outputDir}/discovery-state.json`, {
144
- discovery_id: discoveryId,
145
- target_pattern: targetPattern,
146
- phase: "initialization",
147
- created_at: new Date().toISOString(),
148
- updated_at: new Date().toISOString(),
149
- target: { files_count: { total: resolvedFiles.length }, project: {} },
150
- perspectives: [], // filled after selection: [{name, status, findings}]
151
- external_research: { enabled: false, completed: false },
152
- results: { total_findings: 0, issues_generated: 0, priority_distribution: {} }
153
- });
154
- ```
155
-
156
- **Phase 2: Perspective Selection**
157
-
158
- ```javascript
159
- // Check for --perspectives flag
160
- let selectedPerspectives = [];
161
-
162
- if (args.perspectives) {
163
- selectedPerspectives = args.perspectives.split(',').map(p => p.trim());
164
- } else {
165
- // Interactive selection via AskUserQuestion
166
- const response = await AskUserQuestion({...});
167
- selectedPerspectives = parseSelectedPerspectives(response);
168
- }
169
-
170
- // Validate and update state
171
- await updateDiscoveryState(outputDir, {
172
- 'metadata.perspectives': selectedPerspectives,
173
- phase: 'parallel'
174
- });
175
- ```
176
-
177
- **Phase 3: Parallel Perspective Analysis**
178
-
179
- Launch N agents in parallel (one per selected perspective):
180
-
181
- ```javascript
182
- // Launch agents in parallel - agents write JSON and return summary
183
- const agentPromises = selectedPerspectives.map(perspective =>
184
- Task({
185
- subagent_type: "cli-explore-agent",
186
- run_in_background: false,
187
- description: `Discover ${perspective} issues`,
188
- prompt: buildPerspectivePrompt(perspective, discoveryId, resolvedFiles, outputDir)
189
- })
190
- );
191
-
192
- // Wait for all agents - collect their return summaries
193
- const results = await Promise.all(agentPromises);
194
- // results contain agent summaries for final report
195
- ```
196
-
197
- **Phase 4: Aggregation & Prioritization**
198
-
199
- ```javascript
200
- // Load all perspective JSON files written by agents
201
- const allFindings = [];
202
- for (const perspective of selectedPerspectives) {
203
- const jsonPath = `${outputDir}/perspectives/${perspective}.json`;
204
- if (await fileExists(jsonPath)) {
205
- const data = await readJson(jsonPath);
206
- allFindings.push(...data.findings.map(f => ({ ...f, perspective })));
207
- }
208
- }
209
-
210
- // Deduplicate and prioritize
211
- const prioritizedFindings = deduplicateAndPrioritize(allFindings);
212
-
213
- // Update unified state
214
- await updateDiscoveryState(outputDir, {
215
- phase: 'aggregation',
216
- 'results.total_findings': prioritizedFindings.length,
217
- 'results.priority_distribution': countByPriority(prioritizedFindings)
218
- });
219
- ```
220
-
221
- **Phase 5: Issue Generation & Summary**
222
-
223
- ```javascript
224
- // Convert high-priority findings to issues
225
- const issueWorthy = prioritizedFindings.filter(f =>
226
- f.priority === 'critical' || f.priority === 'high' || f.priority_score >= 0.7
227
- );
228
-
229
- // Write discovery-issues.jsonl
230
- await writeJsonl(`${outputDir}/discovery-issues.jsonl`, issues);
231
-
232
- // Generate single summary.md from agent return summaries
233
- // Orchestrator briefly summarizes what agents returned (NO detailed reports)
234
- await writeSummaryFromAgentReturns(outputDir, results, prioritizedFindings, issues);
235
-
236
- // Update final state
237
- await updateDiscoveryState(outputDir, {
238
- phase: 'complete',
239
- updated_at: new Date().toISOString(),
240
- 'results.issues_generated': issues.length
241
- });
242
- ```
243
-
244
- **Phase 6: User Action Prompt**
245
-
246
- ```javascript
247
- // Prompt user for next action based on discovery results
248
- const hasHighPriority = issues.some(i => i.priority === 'critical' || i.priority === 'high');
249
- const hasMediumFindings = prioritizedFindings.some(f => f.priority === 'medium');
250
-
251
- await AskUserQuestion({
252
- questions: [{
253
- question: `Discovery complete: ${issues.length} issues generated, ${prioritizedFindings.length} total findings. What would you like to do next?`,
254
- header: "Next Step",
255
- multiSelect: false,
256
- options: hasHighPriority ? [
257
- { label: "Export to Issues (Recommended)", description: `${issues.length} high-priority issues found - export to issue tracker for planning` },
258
- { label: "Open Dashboard", description: "Review findings in ccw view before exporting" },
259
- { label: "Skip", description: "Complete discovery without exporting" }
260
- ] : hasMediumFindings ? [
261
- { label: "Open Dashboard (Recommended)", description: "Review medium-priority findings in ccw view to decide which to export" },
262
- { label: "Export to Issues", description: `Export ${issues.length} issues to tracker` },
263
- { label: "Skip", description: "Complete discovery without exporting" }
264
- ] : [
265
- { label: "Skip (Recommended)", description: "No significant issues found - complete discovery" },
266
- { label: "Open Dashboard", description: "Review all findings in ccw view" },
267
- { label: "Export to Issues", description: `Export ${issues.length} issues anyway` }
268
- ]
269
- }]
270
- });
271
-
272
- // Handle response
273
- if (response === "Export to Issues") {
274
- // Append to issues.jsonl
275
- await appendJsonl('.workflow/issues/issues.jsonl', issues);
276
- console.log(`Exported ${issues.length} issues. Run /issue:plan to continue.`);
277
- } else if (response === "Open Dashboard") {
278
- console.log('Run `ccw view` and navigate to Issues > Discovery to manage findings.');
279
- }
280
- ```
281
-
282
- ### Output File Structure
283
-
284
- ```
285
- .workflow/issues/discoveries/
286
- ├── index.json # Discovery session index
287
- └── {discovery-id}/
288
- ├── discovery-state.json # Unified state (merged state+progress)
289
- ├── perspectives/
290
- │ └── {perspective}.json # Per-perspective findings
291
- ├── external-research.json # Exa research results (if enabled)
292
- ├── discovery-issues.jsonl # Generated candidate issues
293
- └── summary.md # Single summary (from agent returns)
294
- ```
295
-
296
- ### Schema References
297
-
298
- **External Schema Files** (agent MUST read and follow exactly):
299
-
300
- | Schema | Path | Purpose |
301
- |--------|------|---------|
302
- | **Discovery State** | `~/.claude/workflows/cli-templates/schemas/discovery-state-schema.json` | Session state machine |
303
- | **Discovery Finding** | `~/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json` | Perspective analysis results |
304
-
305
- ### Agent Invocation Template
306
-
307
- **Perspective Analysis Agent**:
308
-
309
- ```javascript
310
- Task({
311
- subagent_type: "cli-explore-agent",
312
- run_in_background: false,
313
- description: `Discover ${perspective} issues`,
314
- prompt: `
315
- ## Task Objective
316
- Discover potential ${perspective} issues in specified module files.
317
-
318
- ## Discovery Context
319
- - Discovery ID: ${discoveryId}
320
- - Perspective: ${perspective}
321
- - Target Pattern: ${targetPattern}
322
- - Resolved Files: ${resolvedFiles.length} files
323
- - Output Directory: ${outputDir}
324
-
325
- ## MANDATORY FIRST STEPS
326
- 1. Read discovery state: ${outputDir}/discovery-state.json
327
- 2. Read schema: ~/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json
328
- 3. Analyze target files for ${perspective} concerns
329
-
330
- ## Output Requirements
331
-
332
- **1. Write JSON file**: ${outputDir}/perspectives/${perspective}.json
333
- - Follow discovery-finding-schema.json exactly
334
- - Each finding: id, title, priority, category, description, file, line, snippet, suggested_issue, confidence
335
-
336
- **2. Return summary** (DO NOT write report file):
337
- - Return a brief text summary of findings
338
- - Include: total findings, priority breakdown, key issues
339
- - This summary will be used by orchestrator for final report
340
-
341
- ## Perspective-Specific Guidance
342
- ${getPerspectiveGuidance(perspective)}
343
-
344
- ## Success Criteria
345
- - [ ] JSON written to ${outputDir}/perspectives/${perspective}.json
346
- - [ ] Summary returned with findings count and key issues
347
- - [ ] Each finding includes actionable suggested_issue
348
- - [ ] Priority uses lowercase enum: critical/high/medium/low
349
- `
350
- })
351
- ```
352
-
353
- **Exa Research Agent** (for security and best-practices):
354
-
355
- ```javascript
356
- Task({
357
- subagent_type: "cli-explore-agent",
358
- run_in_background: false,
359
- description: `External research for ${perspective} via Exa`,
360
- prompt: `
361
- ## Task Objective
362
- Research industry best practices for ${perspective} using Exa search
363
-
364
- ## Research Steps
365
- 1. Read project tech stack: .workflow/project-tech.json
366
- 2. Use Exa to search for best practices
367
- 3. Synthesize findings relevant to this project
368
-
369
- ## Output Requirements
370
-
371
- **1. Write JSON file**: ${outputDir}/external-research.json
372
- - Include sources, key_findings, gap_analysis, recommendations
373
-
374
- **2. Return summary** (DO NOT write report file):
375
- - Brief summary of external research findings
376
- - Key recommendations for the project
377
-
378
- ## Success Criteria
379
- - [ ] JSON written to ${outputDir}/external-research.json
380
- - [ ] Summary returned with key recommendations
381
- - [ ] Findings are relevant to project's tech stack
382
- `
383
- })
384
- ```
385
-
386
- ### Perspective Guidance Reference
387
-
388
- ```javascript
389
- function getPerspectiveGuidance(perspective) {
390
- const guidance = {
391
- bug: `
392
- Focus: Null checks, edge cases, resource leaks, race conditions, boundary conditions, exception handling
393
- Priority: Critical=data corruption/crash, High=malfunction, Medium=edge case issues, Low=minor
394
- `,
395
- ux: `
396
- Focus: Error messages, loading states, feedback, accessibility, interaction patterns, form validation
397
- Priority: Critical=inaccessible, High=confusing, Medium=inconsistent, Low=cosmetic
398
- `,
399
- test: `
400
- Focus: Missing unit tests, edge case coverage, integration gaps, assertion quality, test isolation
401
- Priority: Critical=no security tests, High=no core logic tests, Medium=weak coverage, Low=minor gaps
402
- `,
403
- quality: `
404
- Focus: Complexity, duplication, naming, documentation, code smells, readability
405
- Priority: Critical=unmaintainable, High=significant issues, Medium=naming/docs, Low=minor refactoring
406
- `,
407
- security: `
408
- Focus: Input validation, auth/authz, injection, XSS/CSRF, data exposure, access control
409
- Priority: Critical=auth bypass/injection, High=missing authz, Medium=weak validation, Low=headers
410
- `,
411
- performance: `
412
- Focus: N+1 queries, memory leaks, caching, algorithm efficiency, blocking operations
413
- Priority: Critical=memory leaks, High=N+1/inefficient, Medium=missing cache, Low=minor optimization
414
- `,
415
- maintainability: `
416
- Focus: Coupling, interface design, tech debt, extensibility, module boundaries, configuration
417
- Priority: Critical=unrelated code changes, High=unclear boundaries, Medium=coupling, Low=refactoring
418
- `,
419
- 'best-practices': `
420
- Focus: Framework conventions, language patterns, anti-patterns, deprecated APIs, coding standards
421
- Priority: Critical=anti-patterns causing bugs, High=convention violations, Medium=style, Low=cosmetic
422
- `
423
- };
424
- return guidance[perspective] || 'General code discovery analysis';
425
- }
426
- ```
427
-
428
- ## Dashboard Integration
429
-
430
- ### Viewing Discoveries
431
-
432
- Open CCW dashboard to manage discoveries:
433
-
434
- ```bash
435
- ccw view
436
- ```
437
-
438
- Navigate to **Issues > Discovery** to:
439
- - View all discovery sessions
440
- - Filter findings by perspective and priority
441
- - Preview finding details
442
- - Select and export findings as issues
443
-
444
- ### Exporting to Issues
445
-
446
- From the dashboard, select findings and click "Export as Issues" to:
447
- 1. Convert discoveries to standard issue format
448
- 2. Append to `.workflow/issues/issues.jsonl`
449
- 3. Set status to `registered`
450
- 4. Continue with `/issue:plan` workflow
451
-
452
- ## Related Commands
453
-
454
- ```bash
455
- # After discovery, plan solutions for exported issues
456
- /issue:plan DSC-001,DSC-002,DSC-003
457
-
458
- # Or use interactive management
459
- /issue:manage
460
- ```
461
-
462
- ## Best Practices
463
-
464
- 1. **Start Focused**: Begin with specific modules rather than entire codebase
465
- 2. **Use Quick Scan First**: Start with bug, test, quality for fast results
466
- 3. **Review Before Export**: Not all discoveries warrant issues - use dashboard to filter
467
- 4. **Combine Perspectives**: Run related perspectives together (e.g., security + bug)
468
- 5. **Enable Exa for New Tech**: When using unfamiliar frameworks, enable external research
1
+ ---
2
+ name: issue:discover
3
+ description: Discover potential issues from multiple perspectives (bug, UX, test, quality, security, performance, maintainability, best-practices) using CLI explore. Supports Exa external research for security and best-practices perspectives.
4
+ argument-hint: "[-y|--yes] <path-pattern> [--perspectives=bug,ux,...] [--external]"
5
+ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*), Task(*), AskUserQuestion(*), Glob(*), Grep(*)
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `--yes` or `-y`: Auto-select all perspectives, skip confirmations.
11
+
12
+ # Issue Discovery Command
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ # Discover issues in specific module (interactive perspective selection)
18
+ /issue:discover src/auth/**
19
+
20
+ # Discover with specific perspectives
21
+ /issue:discover src/payment/** --perspectives=bug,security,test
22
+
23
+ # Discover with external research for all perspectives
24
+ /issue:discover src/api/** --external
25
+
26
+ # Discover in multiple modules
27
+ /issue:discover src/auth/**,src/payment/**
28
+ ```
29
+
30
+ **Discovery Scope**: Specified modules/files only
31
+ **Output Directory**: `.workflow/issues/discoveries/{discovery-id}/`
32
+ **Available Perspectives**: bug, ux, test, quality, security, performance, maintainability, best-practices
33
+ **Exa Integration**: Auto-enabled for security and best-practices perspectives
34
+ **CLI Tools**: Gemini → Qwen → Codex (fallback chain)
35
+
36
+ ## What & Why
37
+
38
+ ### Core Concept
39
+ Multi-perspective issue discovery orchestrator that explores code from different angles to identify potential bugs, UX improvements, test gaps, and other actionable items. Unlike code review (which assesses existing code quality), discovery focuses on **finding opportunities for improvement and potential problems**.
40
+
41
+ **vs Code Review**:
42
+ - **Code Review** (`review-module-cycle`): Evaluates code quality against standards
43
+ - **Issue Discovery** (`issue:discover`): Finds actionable issues, bugs, and improvement opportunities
44
+
45
+ ### Value Proposition
46
+ 1. **Proactive Issue Detection**: Find problems before they become bugs
47
+ 2. **Multi-Perspective Analysis**: Each perspective surfaces different types of issues
48
+ 3. **External Benchmarking**: Compare against industry best practices via Exa
49
+ 4. **Direct Issue Integration**: Discoveries can be exported to issue tracker
50
+ 5. **Dashboard Management**: View, filter, and export discoveries via CCW dashboard
51
+
52
+ ## How It Works
53
+
54
+ ### Execution Flow
55
+
56
+ ```
57
+ Phase 1: Discovery & Initialization
58
+ └─ Parse target pattern, create session, initialize output structure
59
+
60
+ Phase 2: Interactive Perspective Selection
61
+ └─ AskUserQuestion for perspective selection (or use --perspectives)
62
+
63
+ Phase 3: Parallel Perspective Analysis
64
+ ├─ Launch N @cli-explore-agent instances (one per perspective)
65
+ ├─ Security & Best-Practices auto-trigger Exa research
66
+ ├─ Agent writes perspective JSON, returns summary
67
+ └─ Update discovery-progress.json
68
+
69
+ Phase 4: Aggregation & Prioritization
70
+ ├─ Collect agent return summaries
71
+ ├─ Load perspective JSON files
72
+ ├─ Merge findings, deduplicate by file+line
73
+ └─ Calculate priority scores
74
+
75
+ Phase 5: Issue Generation & Summary
76
+ ├─ Convert high-priority discoveries to issue format
77
+ ├─ Write to discovery-issues.jsonl
78
+ ├─ Generate single summary.md from agent returns
79
+ └─ Update discovery-state.json to complete
80
+
81
+ Phase 6: User Action Prompt
82
+ └─ AskUserQuestion for next step (export/dashboard/skip)
83
+ ```
84
+
85
+ ## Perspectives
86
+
87
+ ### Available Perspectives
88
+
89
+ | Perspective | Focus | Categories | Exa |
90
+ |-------------|-------|------------|-----|
91
+ | **bug** | Potential Bugs | edge-case, null-check, resource-leak, race-condition, boundary, exception-handling | - |
92
+ | **ux** | User Experience | error-message, loading-state, feedback, accessibility, interaction, consistency | - |
93
+ | **test** | Test Coverage | missing-test, edge-case-test, integration-gap, coverage-hole, assertion-quality | - |
94
+ | **quality** | Code Quality | complexity, duplication, naming, documentation, code-smell, readability | - |
95
+ | **security** | Security Issues | injection, auth, encryption, input-validation, data-exposure, access-control | ✓ |
96
+ | **performance** | Performance | n-plus-one, memory-usage, caching, algorithm, blocking-operation, resource | - |
97
+ | **maintainability** | Maintainability | coupling, cohesion, tech-debt, extensibility, module-boundary, interface-design | - |
98
+ | **best-practices** | Best Practices | convention, pattern, framework-usage, anti-pattern, industry-standard | ✓ |
99
+
100
+ ### Interactive Perspective Selection
101
+
102
+ When no `--perspectives` flag is provided, the command uses AskUserQuestion:
103
+
104
+ ```javascript
105
+ AskUserQuestion({
106
+ questions: [{
107
+ question: "Select primary discovery focus:",
108
+ header: "Focus",
109
+ multiSelect: false,
110
+ options: [
111
+ { label: "Bug + Test + Quality", description: "Quick scan: potential bugs, test gaps, code quality (Recommended)" },
112
+ { label: "Security + Performance", description: "System audit: security issues, performance bottlenecks" },
113
+ { label: "Maintainability + Best-practices", description: "Long-term health: coupling, tech debt, conventions" },
114
+ { label: "Full analysis", description: "All 7 perspectives (comprehensive, takes longer)" }
115
+ ]
116
+ }]
117
+ })
118
+ ```
119
+
120
+ **Recommended Combinations**:
121
+ - Quick scan: bug, test, quality
122
+ - Full analysis: all perspectives
123
+ - Security audit: security, bug, quality
124
+
125
+ ## Core Responsibilities
126
+
127
+ ### Orchestrator
128
+
129
+ **Phase 1: Discovery & Initialization**
130
+
131
+ ```javascript
132
+ // Step 1: Parse target pattern and resolve files
133
+ const resolvedFiles = await expandGlobPattern(targetPattern);
134
+ if (resolvedFiles.length === 0) {
135
+ throw new Error(`No files matched pattern: ${targetPattern}`);
136
+ }
137
+
138
+ // Step 2: Generate discovery ID
139
+ const discoveryId = `DSC-${formatDate(new Date(), 'YYYYMMDD-HHmmss')}`;
140
+
141
+ // Step 3: Create output directory
142
+ const outputDir = `.workflow/issues/discoveries/${discoveryId}`;
143
+ await mkdir(outputDir, { recursive: true });
144
+ await mkdir(`${outputDir}/perspectives`, { recursive: true });
145
+
146
+ // Step 4: Initialize unified discovery state (merged state+progress)
147
+ await writeJson(`${outputDir}/discovery-state.json`, {
148
+ discovery_id: discoveryId,
149
+ target_pattern: targetPattern,
150
+ phase: "initialization",
151
+ created_at: new Date().toISOString(),
152
+ updated_at: new Date().toISOString(),
153
+ target: { files_count: { total: resolvedFiles.length }, project: {} },
154
+ perspectives: [], // filled after selection: [{name, status, findings}]
155
+ external_research: { enabled: false, completed: false },
156
+ results: { total_findings: 0, issues_generated: 0, priority_distribution: {} }
157
+ });
158
+ ```
159
+
160
+ **Phase 2: Perspective Selection**
161
+
162
+ ```javascript
163
+ // Check for --perspectives flag
164
+ let selectedPerspectives = [];
165
+
166
+ if (args.perspectives) {
167
+ selectedPerspectives = args.perspectives.split(',').map(p => p.trim());
168
+ } else {
169
+ // Interactive selection via AskUserQuestion
170
+ const response = await AskUserQuestion({...});
171
+ selectedPerspectives = parseSelectedPerspectives(response);
172
+ }
173
+
174
+ // Validate and update state
175
+ await updateDiscoveryState(outputDir, {
176
+ 'metadata.perspectives': selectedPerspectives,
177
+ phase: 'parallel'
178
+ });
179
+ ```
180
+
181
+ **Phase 3: Parallel Perspective Analysis**
182
+
183
+ Launch N agents in parallel (one per selected perspective):
184
+
185
+ ```javascript
186
+ // Launch agents in parallel - agents write JSON and return summary
187
+ const agentPromises = selectedPerspectives.map(perspective =>
188
+ Task({
189
+ subagent_type: "cli-explore-agent",
190
+ run_in_background: false,
191
+ description: `Discover ${perspective} issues`,
192
+ prompt: buildPerspectivePrompt(perspective, discoveryId, resolvedFiles, outputDir)
193
+ })
194
+ );
195
+
196
+ // Wait for all agents - collect their return summaries
197
+ const results = await Promise.all(agentPromises);
198
+ // results contain agent summaries for final report
199
+ ```
200
+
201
+ **Phase 4: Aggregation & Prioritization**
202
+
203
+ ```javascript
204
+ // Load all perspective JSON files written by agents
205
+ const allFindings = [];
206
+ for (const perspective of selectedPerspectives) {
207
+ const jsonPath = `${outputDir}/perspectives/${perspective}.json`;
208
+ if (await fileExists(jsonPath)) {
209
+ const data = await readJson(jsonPath);
210
+ allFindings.push(...data.findings.map(f => ({ ...f, perspective })));
211
+ }
212
+ }
213
+
214
+ // Deduplicate and prioritize
215
+ const prioritizedFindings = deduplicateAndPrioritize(allFindings);
216
+
217
+ // Update unified state
218
+ await updateDiscoveryState(outputDir, {
219
+ phase: 'aggregation',
220
+ 'results.total_findings': prioritizedFindings.length,
221
+ 'results.priority_distribution': countByPriority(prioritizedFindings)
222
+ });
223
+ ```
224
+
225
+ **Phase 5: Issue Generation & Summary**
226
+
227
+ ```javascript
228
+ // Convert high-priority findings to issues
229
+ const issueWorthy = prioritizedFindings.filter(f =>
230
+ f.priority === 'critical' || f.priority === 'high' || f.priority_score >= 0.7
231
+ );
232
+
233
+ // Write discovery-issues.jsonl
234
+ await writeJsonl(`${outputDir}/discovery-issues.jsonl`, issues);
235
+
236
+ // Generate single summary.md from agent return summaries
237
+ // Orchestrator briefly summarizes what agents returned (NO detailed reports)
238
+ await writeSummaryFromAgentReturns(outputDir, results, prioritizedFindings, issues);
239
+
240
+ // Update final state
241
+ await updateDiscoveryState(outputDir, {
242
+ phase: 'complete',
243
+ updated_at: new Date().toISOString(),
244
+ 'results.issues_generated': issues.length
245
+ });
246
+ ```
247
+
248
+ **Phase 6: User Action Prompt**
249
+
250
+ ```javascript
251
+ // Prompt user for next action based on discovery results
252
+ const hasHighPriority = issues.some(i => i.priority === 'critical' || i.priority === 'high');
253
+ const hasMediumFindings = prioritizedFindings.some(f => f.priority === 'medium');
254
+
255
+ await AskUserQuestion({
256
+ questions: [{
257
+ question: `Discovery complete: ${issues.length} issues generated, ${prioritizedFindings.length} total findings. What would you like to do next?`,
258
+ header: "Next Step",
259
+ multiSelect: false,
260
+ options: hasHighPriority ? [
261
+ { label: "Export to Issues (Recommended)", description: `${issues.length} high-priority issues found - export to issue tracker for planning` },
262
+ { label: "Open Dashboard", description: "Review findings in ccw view before exporting" },
263
+ { label: "Skip", description: "Complete discovery without exporting" }
264
+ ] : hasMediumFindings ? [
265
+ { label: "Open Dashboard (Recommended)", description: "Review medium-priority findings in ccw view to decide which to export" },
266
+ { label: "Export to Issues", description: `Export ${issues.length} issues to tracker` },
267
+ { label: "Skip", description: "Complete discovery without exporting" }
268
+ ] : [
269
+ { label: "Skip (Recommended)", description: "No significant issues found - complete discovery" },
270
+ { label: "Open Dashboard", description: "Review all findings in ccw view" },
271
+ { label: "Export to Issues", description: `Export ${issues.length} issues anyway` }
272
+ ]
273
+ }]
274
+ });
275
+
276
+ // Handle response
277
+ if (response === "Export to Issues") {
278
+ // Append to issues.jsonl
279
+ await appendJsonl('.workflow/issues/issues.jsonl', issues);
280
+ console.log(`Exported ${issues.length} issues. Run /issue:plan to continue.`);
281
+ } else if (response === "Open Dashboard") {
282
+ console.log('Run `ccw view` and navigate to Issues > Discovery to manage findings.');
283
+ }
284
+ ```
285
+
286
+ ### Output File Structure
287
+
288
+ ```
289
+ .workflow/issues/discoveries/
290
+ ├── index.json # Discovery session index
291
+ └── {discovery-id}/
292
+ ├── discovery-state.json # Unified state (merged state+progress)
293
+ ├── perspectives/
294
+ │ └── {perspective}.json # Per-perspective findings
295
+ ├── external-research.json # Exa research results (if enabled)
296
+ ├── discovery-issues.jsonl # Generated candidate issues
297
+ └── summary.md # Single summary (from agent returns)
298
+ ```
299
+
300
+ ### Schema References
301
+
302
+ **External Schema Files** (agent MUST read and follow exactly):
303
+
304
+ | Schema | Path | Purpose |
305
+ |--------|------|---------|
306
+ | **Discovery State** | `~/.claude/workflows/cli-templates/schemas/discovery-state-schema.json` | Session state machine |
307
+ | **Discovery Finding** | `~/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json` | Perspective analysis results |
308
+
309
+ ### Agent Invocation Template
310
+
311
+ **Perspective Analysis Agent**:
312
+
313
+ ```javascript
314
+ Task({
315
+ subagent_type: "cli-explore-agent",
316
+ run_in_background: false,
317
+ description: `Discover ${perspective} issues`,
318
+ prompt: `
319
+ ## Task Objective
320
+ Discover potential ${perspective} issues in specified module files.
321
+
322
+ ## Discovery Context
323
+ - Discovery ID: ${discoveryId}
324
+ - Perspective: ${perspective}
325
+ - Target Pattern: ${targetPattern}
326
+ - Resolved Files: ${resolvedFiles.length} files
327
+ - Output Directory: ${outputDir}
328
+
329
+ ## MANDATORY FIRST STEPS
330
+ 1. Read discovery state: ${outputDir}/discovery-state.json
331
+ 2. Read schema: ~/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json
332
+ 3. Analyze target files for ${perspective} concerns
333
+
334
+ ## Output Requirements
335
+
336
+ **1. Write JSON file**: ${outputDir}/perspectives/${perspective}.json
337
+ - Follow discovery-finding-schema.json exactly
338
+ - Each finding: id, title, priority, category, description, file, line, snippet, suggested_issue, confidence
339
+
340
+ **2. Return summary** (DO NOT write report file):
341
+ - Return a brief text summary of findings
342
+ - Include: total findings, priority breakdown, key issues
343
+ - This summary will be used by orchestrator for final report
344
+
345
+ ## Perspective-Specific Guidance
346
+ ${getPerspectiveGuidance(perspective)}
347
+
348
+ ## Success Criteria
349
+ - [ ] JSON written to ${outputDir}/perspectives/${perspective}.json
350
+ - [ ] Summary returned with findings count and key issues
351
+ - [ ] Each finding includes actionable suggested_issue
352
+ - [ ] Priority uses lowercase enum: critical/high/medium/low
353
+ `
354
+ })
355
+ ```
356
+
357
+ **Exa Research Agent** (for security and best-practices):
358
+
359
+ ```javascript
360
+ Task({
361
+ subagent_type: "cli-explore-agent",
362
+ run_in_background: false,
363
+ description: `External research for ${perspective} via Exa`,
364
+ prompt: `
365
+ ## Task Objective
366
+ Research industry best practices for ${perspective} using Exa search
367
+
368
+ ## Research Steps
369
+ 1. Read project tech stack: .workflow/project-tech.json
370
+ 2. Use Exa to search for best practices
371
+ 3. Synthesize findings relevant to this project
372
+
373
+ ## Output Requirements
374
+
375
+ **1. Write JSON file**: ${outputDir}/external-research.json
376
+ - Include sources, key_findings, gap_analysis, recommendations
377
+
378
+ **2. Return summary** (DO NOT write report file):
379
+ - Brief summary of external research findings
380
+ - Key recommendations for the project
381
+
382
+ ## Success Criteria
383
+ - [ ] JSON written to ${outputDir}/external-research.json
384
+ - [ ] Summary returned with key recommendations
385
+ - [ ] Findings are relevant to project's tech stack
386
+ `
387
+ })
388
+ ```
389
+
390
+ ### Perspective Guidance Reference
391
+
392
+ ```javascript
393
+ function getPerspectiveGuidance(perspective) {
394
+ const guidance = {
395
+ bug: `
396
+ Focus: Null checks, edge cases, resource leaks, race conditions, boundary conditions, exception handling
397
+ Priority: Critical=data corruption/crash, High=malfunction, Medium=edge case issues, Low=minor
398
+ `,
399
+ ux: `
400
+ Focus: Error messages, loading states, feedback, accessibility, interaction patterns, form validation
401
+ Priority: Critical=inaccessible, High=confusing, Medium=inconsistent, Low=cosmetic
402
+ `,
403
+ test: `
404
+ Focus: Missing unit tests, edge case coverage, integration gaps, assertion quality, test isolation
405
+ Priority: Critical=no security tests, High=no core logic tests, Medium=weak coverage, Low=minor gaps
406
+ `,
407
+ quality: `
408
+ Focus: Complexity, duplication, naming, documentation, code smells, readability
409
+ Priority: Critical=unmaintainable, High=significant issues, Medium=naming/docs, Low=minor refactoring
410
+ `,
411
+ security: `
412
+ Focus: Input validation, auth/authz, injection, XSS/CSRF, data exposure, access control
413
+ Priority: Critical=auth bypass/injection, High=missing authz, Medium=weak validation, Low=headers
414
+ `,
415
+ performance: `
416
+ Focus: N+1 queries, memory leaks, caching, algorithm efficiency, blocking operations
417
+ Priority: Critical=memory leaks, High=N+1/inefficient, Medium=missing cache, Low=minor optimization
418
+ `,
419
+ maintainability: `
420
+ Focus: Coupling, interface design, tech debt, extensibility, module boundaries, configuration
421
+ Priority: Critical=unrelated code changes, High=unclear boundaries, Medium=coupling, Low=refactoring
422
+ `,
423
+ 'best-practices': `
424
+ Focus: Framework conventions, language patterns, anti-patterns, deprecated APIs, coding standards
425
+ Priority: Critical=anti-patterns causing bugs, High=convention violations, Medium=style, Low=cosmetic
426
+ `
427
+ };
428
+ return guidance[perspective] || 'General code discovery analysis';
429
+ }
430
+ ```
431
+
432
+ ## Dashboard Integration
433
+
434
+ ### Viewing Discoveries
435
+
436
+ Open CCW dashboard to manage discoveries:
437
+
438
+ ```bash
439
+ ccw view
440
+ ```
441
+
442
+ Navigate to **Issues > Discovery** to:
443
+ - View all discovery sessions
444
+ - Filter findings by perspective and priority
445
+ - Preview finding details
446
+ - Select and export findings as issues
447
+
448
+ ### Exporting to Issues
449
+
450
+ From the dashboard, select findings and click "Export as Issues" to:
451
+ 1. Convert discoveries to standard issue format
452
+ 2. Append to `.workflow/issues/issues.jsonl`
453
+ 3. Set status to `registered`
454
+ 4. Continue with `/issue:plan` workflow
455
+
456
+ ## Related Commands
457
+
458
+ ```bash
459
+ # After discovery, plan solutions for exported issues
460
+ /issue:plan DSC-001,DSC-002,DSC-003
461
+
462
+ # Or use interactive management
463
+ /issue:manage
464
+ ```
465
+
466
+ ## Best Practices
467
+
468
+ 1. **Start Focused**: Begin with specific modules rather than entire codebase
469
+ 2. **Use Quick Scan First**: Start with bug, test, quality for fast results
470
+ 3. **Review Before Export**: Not all discoveries warrant issues - use dashboard to filter
471
+ 4. **Combine Perspectives**: Run related perspectives together (e.g., security + bug)
472
+ 5. **Enable Exa for New Tech**: When using unfamiliar frameworks, enable external research