From e58c33fb6eeaca91ac0c3f2c728eec751af40291 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Mon, 19 Jan 2026 12:22:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(cli-history):=20=E8=BD=AC=E4=B9=89=20source?= =?UTF-8?q?Dir=20=E4=BB=A5=E6=94=AF=E6=8C=81=20onclick=20=E5=A4=84?= =?UTF-8?q?=E7=90=86=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/agents/issue-plan-agent.md | 57 ++++++++----------- .../dashboard-js/components/cli-history.js | 5 +- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/.claude/agents/issue-plan-agent.md b/.claude/agents/issue-plan-agent.md index 0aa942d8..b117d92d 100644 --- a/.claude/agents/issue-plan-agent.md +++ b/.claude/agents/issue-plan-agent.md @@ -16,7 +16,7 @@ color: green - 5-phase task lifecycle (analyze → implement → test → optimize → commit) - Conflict-aware planning (isolate file modifications across issues) - Dependency DAG validation -- Auto-bind for single solution, return for selection on multiple +- Execute bind command for single solution, return for selection on multiple **Key Principle**: Generate tasks conforming to schema with quantified acceptance criteria. @@ -111,30 +111,30 @@ Generate multiple candidate solutions when: - Multiple valid implementation approaches exist - Trade-offs between approaches (performance vs simplicity, etc.) -| Condition | Solutions | -|-----------|-----------| -| Low complexity, single approach | 1 solution, auto-bind | -| Medium complexity, clear path | 1-2 solutions | -| High complexity, multiple approaches | 2-3 solutions, user selection | +| Condition | Solutions | Binding Action | +|-----------|-----------|----------------| +| Low complexity, single approach | 1 solution | Execute bind | +| Medium complexity, clear path | 1-2 solutions | Execute bind if 1, return if 2+ | +| High complexity, multiple approaches | 2-3 solutions | Return for selection | + +**Binding Decision** (based SOLELY on final `solutions.length`): +```javascript +// After generating all solutions +if (solutions.length === 1) { + exec(`ccw issue bind ${issueId} ${solutions[0].id}`); // MUST execute +} else { + return { pending_selection: solutions }; // Return for user choice +} +``` **Solution Evaluation** (for each candidate): ```javascript { - analysis: { - risk: "low|medium|high", // Implementation risk - impact: "low|medium|high", // Scope of changes - complexity: "low|medium|high" // Technical complexity - }, - score: 0.0-1.0 // Overall quality score (higher = recommended) + analysis: { risk: "low|medium|high", impact: "low|medium|high", complexity: "low|medium|high" }, + score: 0.0-1.0 // Higher = recommended } ``` -**Selection Flow**: -1. Generate all candidate solutions -2. Evaluate and score each -3. Single solution → auto-bind -4. Multiple solutions → return `pending_selection` for user choice - **Task Decomposition** following schema: ```javascript function decomposeTasks(issue, exploration) { @@ -248,8 +248,8 @@ Write({ file_path: filePath, content: newContent }) ``` **Step 2: Bind decision** -- **Single solution** → Auto-bind: `ccw issue bind ` -- **Multiple solutions** → Return for user selection (no bind) +- 1 solution → Execute `ccw issue bind ` +- 2+ solutions → Return `pending_selection` (no bind) --- @@ -264,14 +264,7 @@ Write({ file_path: filePath, content: newContent }) Each line is a solution JSON containing tasks. Schema: `cat .claude/workflows/cli-templates/schemas/solution-schema.json` -### 2.2 Binding - -| Scenario | Action | -|----------|--------| -| Single solution | `ccw issue bind ` (auto) | -| Multiple solutions | Register only, return for selection | - -### 2.3 Return Summary +### 2.2 Return Summary ```json { @@ -332,9 +325,9 @@ Each line is a solution JSON containing tasks. Schema: `cat .claude/workflows/cl 2. Use vague criteria ("works correctly", "good performance") 3. Create circular dependencies 4. Generate more than 10 tasks per issue -5. **Bind when multiple solutions exist** - MUST check `solutions.length === 1` before calling `ccw issue bind` +5. Skip bind when `solutions.length === 1` (MUST execute bind command) **OUTPUT**: -1. Write solutions to `.workflow/issues/solutions/{issue-id}.jsonl` (JSONL format) -2. Single solution → `ccw issue bind `; Multiple → return only -3. Return JSON with `bound`, `pending_selection` +1. Write solutions to `.workflow/issues/solutions/{issue-id}.jsonl` +2. Execute bind or return `pending_selection` based on solution count +3. Return JSON: `{ bound: [...], pending_selection: [...] }` diff --git a/ccw/src/templates/dashboard-js/components/cli-history.js b/ccw/src/templates/dashboard-js/components/cli-history.js index 7ef70042..130acc16 100644 --- a/ccw/src/templates/dashboard-js/components/cli-history.js +++ b/ccw/src/templates/dashboard-js/components/cli-history.js @@ -239,6 +239,9 @@ async function showExecutionDetail(executionId, sourceDir) { return; } + // Escape sourceDir for use in onclick handlers + const sourceDirEscaped = sourceDir ? sourceDir.replace(/\\/g, '/').replace(/'/g, "\\'") : ''; + // Handle both old (single execution) and new (conversation) formats const isConversation = conversation.turns && Array.isArray(conversation.turns); const turnCount = isConversation ? conversation.turn_count : 1; @@ -368,7 +371,7 @@ async function showExecutionDetail(executionId, sourceDir) { ${hasNativeSession ? `
-