Skip to content

Commit d46406d

Browse files
author
catlog22
committed
feat: Add CodexLens Manager Page with tabbed interface for managing CodexLens features
feat: Implement ConflictTab component to display conflict resolution decisions in session detail feat: Create ImplPlanTab component to show implementation plan with modal viewer in session detail feat: Develop ReviewTab component to display review findings by dimension in session detail test: Add end-to-end tests for CodexLens Manager functionality including navigation, tab switching, and settings validation
1 parent 8dc115a commit d46406d

79 files changed

Lines changed: 11834 additions & 2470 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/ccw-debug.md

Lines changed: 95 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ User Input → Quick Context Gather → ccw cli (Gemini/Qwen/Codex)
148148
// - Read error file if path provided
149149
// - Extract error patterns from description
150150
// - Identify likely affected files (basic grep)
151+
152+
// Note: CLI mode does not generate status.json (lightweight)
151153
```
152154

153155
2. **Execute CLI Analysis** (Phase 3)
@@ -299,6 +301,27 @@ User Input → Session Init → /workflow:debug-with-file
299301
flags: { hotfix, autoYes }
300302
}
301303
Write(`${sessionFolder}/mode-config.json`, JSON.stringify(modeConfig, null, 2))
304+
305+
// Initialize status.json for hook tracking
306+
const state = {
307+
session_id: sessionId,
308+
mode: "debug",
309+
status: "running",
310+
created_at: new Date().toISOString(),
311+
updated_at: new Date().toISOString(),
312+
bug_description: bug_description,
313+
command_chain: [
314+
{ index: 0, command: "Phase 1: Debug & Analysis", status: "running" },
315+
{ index: 1, command: "Phase 2: Apply Fix from Debug Findings", status: "pending" },
316+
{ index: 2, command: "Phase 3: Generate & Execute Tests", status: "pending" },
317+
{ index: 3, command: "Phase 4: Generate Report", status: "pending" }
318+
],
319+
current_index: 0
320+
}
321+
Write(`${sessionFolder}/status.json`, JSON.stringify(state, null, 2))
322+
323+
// Output session ID for hook matching
324+
console.log(`📋 Session Started: ${sessionId}`)
302325
```
303326

304327
2. **Start Debug** (Phase 3)
@@ -373,12 +396,38 @@ User Input → Session Init → /workflow:test-fix-gen
373396

374397
1. **Session Initialization** (Phase 2)
375398
```javascript
399+
const sessionId = `CCWD-${bugSlug}-${dateStr}`
400+
const sessionFolder = `.workflow/.ccw-debug/${sessionId}`
401+
bash(`mkdir -p ${sessionFolder}`)
402+
376403
const modeConfig = {
377404
mode: "test",
378405
original_input: bug_description,
379406
timestamp: getUtc8ISOString(),
380407
flags: { hotfix, autoYes }
381408
}
409+
Write(`${sessionFolder}/mode-config.json`, JSON.stringify(modeConfig, null, 2))
410+
411+
// Initialize status.json for hook tracking
412+
const state = {
413+
session_id: sessionId,
414+
mode: "test",
415+
status: "running",
416+
created_at: new Date().toISOString(),
417+
updated_at: new Date().toISOString(),
418+
bug_description: bug_description,
419+
command_chain: [
420+
{ index: 0, command: "Phase 1: Generate Tests", status: "running" },
421+
{ index: 1, command: "Phase 2: Execute & Fix Tests", status: "pending" },
422+
{ index: 2, command: "Phase 3: Final Validation", status: "pending" },
423+
{ index: 3, command: "Phase 4: Generate Report", status: "pending" }
424+
],
425+
current_index: 0
426+
}
427+
Write(`${sessionFolder}/status.json`, JSON.stringify(state, null, 2))
428+
429+
// Output session ID for hook matching
430+
console.log(`📋 Session Started: ${sessionId}`)
382431
```
383432

384433
2. **Generate Tests** (Phase 3)
@@ -439,8 +488,32 @@ User Input → Session Init → Parallel execution:
439488

440489
**Execution Steps**:
441490

442-
1. **Parallel Execution** (Phase 3)
491+
1. **Session Initialization & Parallel Execution** (Phase 2-3)
443492
```javascript
493+
const sessionId = `CCWD-${bugSlug}-${dateStr}`
494+
const sessionFolder = `.workflow/.ccw-debug/${sessionId}`
495+
bash(`mkdir -p ${sessionFolder}`)
496+
497+
// Initialize status.json for hook tracking
498+
const state = {
499+
session_id: sessionId,
500+
mode: "bidirectional",
501+
status: "running",
502+
created_at: new Date().toISOString(),
503+
updated_at: new Date().toISOString(),
504+
bug_description: bug_description,
505+
command_chain: [
506+
{ index: 0, command: "Phase 1: Parallel Debug & Test", status: "running" },
507+
{ index: 1, command: "Phase 2: Merge Findings", status: "pending" },
508+
{ index: 2, command: "Phase 3: Generate Report", status: "pending" }
509+
],
510+
current_index: 0
511+
}
512+
Write(`${sessionFolder}/status.json`, JSON.stringify(state, null, 2))
513+
514+
// Output session ID for hook matching
515+
console.log(`📋 Session Started: ${sessionId}`)
516+
444517
// Start debug
445518
const debugTask = Skill(skill="workflow:debug-with-file", args=`"${bug_description}"`)
446519

@@ -579,18 +652,24 @@ Arguments:
579652
580653
### Session State Management
581654
655+
**Status JSON Location**: `.workflow/.ccw-debug/{session_id}/status.json`
656+
657+
**Status JSON Structure**:
582658
```json
583659
{
584660
"session_id": "CCWD-login-timeout-2025-01-27",
585-
"mode": "debug|test|bidirectional",
661+
"mode": "debug|test|bidirectional|cli",
586662
"status": "running|completed|failed|paused",
587-
"phases": {
588-
"phase_1": { "status": "completed", "timestamp": "..." },
589-
"phase_2": { "status": "in_progress", "timestamp": "..." },
590-
"phase_3": { "status": "pending" },
591-
"phase_4": { "status": "pending" },
592-
"phase_5": { "status": "pending" }
593-
},
663+
"created_at": "2025-01-27T10:30:00Z",
664+
"updated_at": "2025-01-27T10:35:00Z",
665+
"bug_description": "User login timeout after 30 seconds",
666+
"command_chain": [
667+
{ "index": 0, "command": "Phase 1: Debug & Analysis", "status": "completed" },
668+
{ "index": 1, "command": "Phase 2: Apply Fix from Debug Findings", "status": "in_progress" },
669+
{ "index": 2, "command": "Phase 3: Generate & Execute Tests", "status": "pending" },
670+
{ "index": 3, "command": "Phase 4: Generate Report", "status": "pending" }
671+
],
672+
"current_index": 1,
594673
"sub_sessions": {
595674
"debug_session": "DBG-...",
596675
"test_session": "WFS-test-..."
@@ -603,6 +682,13 @@ Arguments:
603682
}
604683
```
605684
685+
**Session ID Output**: When session starts, ccw-debug outputs:
686+
```
687+
📋 Session Started: CCWD-login-timeout-2025-01-27
688+
```
689+
690+
This output is captured by hooks for status.json path matching.
691+
606692
---
607693
608694
## Mode Selection Logic

.claude/commands/ccw.md

Lines changed: 123 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -327,49 +327,107 @@ async function getUserConfirmation(chain) {
327327
328328
---
329329
330-
### Phase 4: Setup TODO Tracking
330+
### Phase 4: Setup TODO Tracking & Status File
331331
332332
```javascript
333-
function setupTodoTracking(chain, workflow) {
333+
function setupTodoTracking(chain, workflow, analysis) {
334+
const sessionId = `ccw-${Date.now()}`;
335+
const stateDir = `.workflow/.ccw/${sessionId}`;
336+
Bash(`mkdir -p "${stateDir}"`);
337+
334338
const todos = chain.map((step, i) => ({
335339
content: `CCW:${workflow}: [${i + 1}/${chain.length}] ${step.cmd}`,
336340
status: i === 0 ? 'in_progress' : 'pending',
337341
activeForm: `Executing ${step.cmd}`
338342
}));
339343
TodoWrite({ todos });
344+
345+
// Initialize status.json for hook tracking
346+
const state = {
347+
session_id: sessionId,
348+
workflow: workflow,
349+
status: 'running',
350+
created_at: new Date().toISOString(),
351+
updated_at: new Date().toISOString(),
352+
analysis: analysis,
353+
command_chain: chain.map((step, idx) => ({
354+
index: idx,
355+
command: step.cmd,
356+
status: idx === 0 ? 'running' : 'pending'
357+
})),
358+
current_index: 0
359+
};
360+
361+
Write(`${stateDir}/status.json`, JSON.stringify(state, null, 2));
362+
363+
return { sessionId, stateDir, state };
340364
}
341365
```
342366
343-
**Output**: `-> CCW:rapid: [1/3] /workflow:lite-plan | CCW:rapid: [2/3] /workflow:lite-execute | ...`
367+
**Output**:
368+
- TODO: `-> CCW:rapid: [1/3] /workflow:lite-plan | CCW:rapid: [2/3] /workflow:lite-execute | ...`
369+
- Status File: `.workflow/.ccw/{session_id}/status.json`
344370
345371
---
346372
347373
### Phase 5: Execute Command Chain
348374
349375
```javascript
350-
async function executeCommandChain(chain, workflow) {
376+
async function executeCommandChain(chain, workflow, trackingState) {
351377
let previousResult = null;
378+
const { sessionId, stateDir, state } = trackingState;
352379

353380
for (let i = 0; i < chain.length; i++) {
354381
try {
382+
// Update status: mark current as running
383+
state.command_chain[i].status = 'running';
384+
state.current_index = i;
385+
state.updated_at = new Date().toISOString();
386+
Write(`${stateDir}/status.json`, JSON.stringify(state, null, 2));
387+
355388
const fullCommand = assembleCommand(chain[i], previousResult);
356389
const result = await Skill({ skill: fullCommand });
357390

358391
previousResult = { ...result, success: true };
392+
393+
// Update status: mark current as completed, next as running
394+
state.command_chain[i].status = 'completed';
395+
if (i + 1 < chain.length) {
396+
state.command_chain[i + 1].status = 'running';
397+
}
398+
state.updated_at = new Date().toISOString();
399+
Write(`${stateDir}/status.json`, JSON.stringify(state, null, 2));
400+
359401
updateTodoStatus(i, chain.length, workflow, 'completed');
360402

361403
} catch (error) {
404+
// Update status on error
405+
state.command_chain[i].status = 'failed';
406+
state.status = 'error';
407+
state.updated_at = new Date().toISOString();
408+
Write(`${stateDir}/status.json`, JSON.stringify(state, null, 2));
409+
362410
const action = await handleError(chain[i], error, i);
363411
if (action === 'retry') {
412+
state.command_chain[i].status = 'pending';
413+
state.status = 'running';
364414
i--; // Retry
365415
} else if (action === 'abort') {
416+
state.status = 'failed';
417+
Write(`${stateDir}/status.json`, JSON.stringify(state, null, 2));
366418
return { success: false, error: error.message };
367419
}
368420
// 'skip' - continue
421+
state.status = 'running';
369422
}
370423
}
371424

372-
return { success: true, completed: chain.length };
425+
// Mark workflow as completed
426+
state.status = 'completed';
427+
state.updated_at = new Date().toISOString();
428+
Write(`${stateDir}/status.json`, JSON.stringify(state, null, 2));
429+
430+
return { success: true, completed: chain.length, sessionId };
373431
}
374432

375433
// Assemble full command with session/plan parameters
@@ -434,16 +492,19 @@ Phase 3: User Confirmation (optional)
434492
|-- Show pipeline visualization
435493
+-- Allow adjustment
436494
|
437-
Phase 4: Setup TODO Tracking
438-
+-- Create todos with CCW prefix
495+
Phase 4: Setup TODO Tracking & Status File
496+
|-- Create todos with CCW prefix
497+
+-- Initialize .workflow/.ccw/{session_id}/status.json
439498
|
440499
Phase 5: Execute Command Chain
441500
|-- For each command:
501+
| |-- Update status.json (current=running)
442502
| |-- Assemble full command
443503
| |-- Execute via Skill
504+
| |-- Update status.json (current=completed, next=running)
444505
| |-- Update TODO status
445506
| +-- Handle errors (retry/skip/abort)
446-
+-- Return workflow result
507+
+-- Mark status.json as completed
447508
```
448509
449510
---
@@ -482,7 +543,9 @@ Phase 5: Execute Command Chain
482543
483544
## State Management
484545
485-
**TodoWrite-Based Tracking**: All execution state tracked via TodoWrite with `CCW:` prefix.
546+
### Dual Tracking System
547+
548+
**1. TodoWrite-Based Tracking** (UI Display): All execution state tracked via TodoWrite with `CCW:` prefix.
486549
487550
```javascript
488551
// Initial state
@@ -500,7 +563,57 @@ todos = [
500563
];
501564
```
502565
503-
**vs ccw-coordinator**: Extensive state.json with task_id, status transitions, hook callbacks.
566+
**2. Status.json Tracking**: Persistent state file for workflow monitoring.
567+
568+
**Location**: `.workflow/.ccw/{session_id}/status.json`
569+
570+
**Structure**:
571+
```json
572+
{
573+
"session_id": "ccw-1706123456789",
574+
"workflow": "rapid",
575+
"status": "running|completed|failed|error",
576+
"created_at": "2025-02-01T10:30:00Z",
577+
"updated_at": "2025-02-01T10:35:00Z",
578+
"analysis": {
579+
"goal": "Add user authentication",
580+
"scope": ["auth"],
581+
"constraints": [],
582+
"task_type": "feature",
583+
"complexity": "medium"
584+
},
585+
"command_chain": [
586+
{
587+
"index": 0,
588+
"command": "/workflow:lite-plan",
589+
"status": "completed"
590+
},
591+
{
592+
"index": 1,
593+
"command": "/workflow:lite-execute",
594+
"status": "running"
595+
},
596+
{
597+
"index": 2,
598+
"command": "/workflow:test-cycle-execute",
599+
"status": "pending"
600+
}
601+
],
602+
"current_index": 1
603+
}
604+
```
605+
606+
**Status Values**:
607+
- `running`: Workflow executing commands
608+
- `completed`: All commands finished
609+
- `failed`: User aborted or unrecoverable error
610+
- `error`: Command execution failed (during error handling)
611+
612+
**Command Status Values**:
613+
- `pending`: Not started
614+
- `running`: Currently executing
615+
- `completed`: Successfully finished
616+
- `failed`: Execution failed
504617
505618
---
506619
@@ -527,20 +640,6 @@ todos = [
527640
528641
---
529642
530-
## Type Comparison: ccw vs ccw-coordinator
531-
532-
| Aspect | ccw | ccw-coordinator |
533-
|--------|-----|-----------------|
534-
| **Type** | Main process (Skill) | External CLI (ccw cli + hook callbacks) |
535-
| **Execution** | Synchronous blocking | Async background with hook completion |
536-
| **Workflow** | Auto intent-based selection | Manual chain building |
537-
| **Intent Analysis** | 5-phase clarity check | 3-phase requirement analysis |
538-
| **State** | TodoWrite only (in-memory) | state.json + checkpoint/resume |
539-
| **Error Handling** | Retry/skip/abort (interactive) | Retry/skip/abort (via AskUser) |
540-
| **Use Case** | Auto workflow for any task | Manual orchestration, large chains |
541-
542-
---
543-
544643
## Usage
545644
546645
```bash

0 commit comments

Comments
 (0)