From a293a01d8590870151b7f7110960008a92d50a38 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Sat, 24 Jan 2026 09:23:24 +0800 Subject: [PATCH] feat: add --yes flag for auto-confirmation across multiple workflows - Enhanced lite-execute, lite-fix, lite-lite-lite, lite-plan, multi-cli-plan, plan, replan, session complete, session solidify, and various UI design commands to support a --yes or -y flag for skipping user confirmations and auto-selecting defaults. - Updated argument hints and examples to reflect new auto mode functionality. - Implemented auto mode defaults for confirmation, execution methods, and code review options. - Improved error handling and validation in command parsing and execution processes. --- .claude/commands/issue/discover-by-prompt.md | 6 +- .claude/commands/issue/discover.md | 6 +- .claude/commands/issue/execute.md | 6 +- .claude/commands/issue/new.md | 6 +- .claude/commands/issue/plan.md | 6 +- .claude/commands/issue/queue.md | 6 +- .claude/commands/task/breakdown.md | 6 +- .claude/commands/task/replan.md | 6 +- .../commands/workflow/brainstorm/artifacts.md | 6 +- .../workflow/brainstorm/auto-parallel.md | 6 +- .../commands/workflow/brainstorm/synthesis.md | 6 +- .claude/commands/workflow/clean.md | 102 +++++++++----- .claude/commands/workflow/debug-with-file.md | 6 +- .claude/commands/workflow/debug.md | 6 +- .../commands/workflow/develop-with-file.md | 6 +- .claude/commands/workflow/execute.md | 116 +++++++++++----- .claude/commands/workflow/lite-execute.md | 70 ++++++---- .claude/commands/workflow/lite-fix.md | 126 ++++++++++++------ .claude/commands/workflow/lite-lite-lite.md | 6 +- .claude/commands/workflow/lite-plan.md | 126 ++++++++++++------ .claude/commands/workflow/multi-cli-plan.md | 6 +- .claude/commands/workflow/plan.md | 6 +- .claude/commands/workflow/replan.md | 67 +++++++++- .claude/commands/workflow/review-fix.md | 4 +- .claude/commands/workflow/session/complete.md | 47 +++++-- .claude/commands/workflow/session/solidify.md | 8 +- .../workflow/tools/conflict-resolution.md | 36 +++-- .../workflow/tools/task-generate-agent.md | 32 ++++- .../workflow/tools/task-generate-tdd.md | 7 +- .../workflow/ui-design/animation-extract.md | 6 +- .../workflow/ui-design/layout-extract.md | 6 +- .../workflow/ui-design/style-extract.md | 6 +- .claude/skills/ccw-coordinator/SKILL.md | 1 + .../phases/actions/action-command-execute.md | 4 +- .../ccw-coordinator/tools/chain-validate.cjs | 26 +++- .../tools/command-registry.cjs | 51 +++++-- 36 files changed, 693 insertions(+), 250 deletions(-) diff --git a/.claude/commands/issue/discover-by-prompt.md b/.claude/commands/issue/discover-by-prompt.md index 9efd308b..cb3b54fe 100644 --- a/.claude/commands/issue/discover-by-prompt.md +++ b/.claude/commands/issue/discover-by-prompt.md @@ -1,10 +1,14 @@ --- name: issue:discover-by-prompt description: Discover issues from user prompt with Gemini-planned iterative multi-agent exploration. Uses ACE semantic search for context gathering and supports cross-module comparison (e.g., frontend vs backend API contracts). -argument-hint: " [--scope=src/**] [--depth=standard|deep] [--max-iterations=5]" +argument-hint: "[-y|--yes] [--scope=src/**] [--depth=standard|deep] [--max-iterations=5]" allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*), Task(*), AskUserQuestion(*), Glob(*), Grep(*), mcp__ace-tool__search_context(*), mcp__exa__search(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-continue all iterations, skip confirmations. + # Issue Discovery by Prompt ## Quick Start diff --git a/.claude/commands/issue/discover.md b/.claude/commands/issue/discover.md index 1dfc07b6..0b3fb1cd 100644 --- a/.claude/commands/issue/discover.md +++ b/.claude/commands/issue/discover.md @@ -1,10 +1,14 @@ --- name: issue:discover 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. -argument-hint: " [--perspectives=bug,ux,...] [--external]" +argument-hint: "[-y|--yes] [--perspectives=bug,ux,...] [--external]" allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*), Task(*), AskUserQuestion(*), Glob(*), Grep(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-select all perspectives, skip confirmations. + # Issue Discovery Command ## Quick Start diff --git a/.claude/commands/issue/execute.md b/.claude/commands/issue/execute.md index e7ee1055..82e1bf9e 100644 --- a/.claude/commands/issue/execute.md +++ b/.claude/commands/issue/execute.md @@ -1,10 +1,14 @@ --- name: execute description: Execute queue with DAG-based parallel orchestration (one commit per solution) -argument-hint: "--queue [--worktree []]" +argument-hint: "[-y|--yes] --queue [--worktree []]" allowed-tools: TodoWrite(*), Bash(*), Read(*), AskUserQuestion(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-confirm execution, use recommended settings. + # Issue Execute Command (/issue:execute) ## Overview diff --git a/.claude/commands/issue/new.md b/.claude/commands/issue/new.md index cd45c5ac..f429ca1e 100644 --- a/.claude/commands/issue/new.md +++ b/.claude/commands/issue/new.md @@ -1,10 +1,14 @@ --- name: new description: Create structured issue from GitHub URL or text description -argument-hint: " [--priority 1-5]" +argument-hint: "[-y|--yes] [--priority 1-5]" allowed-tools: TodoWrite(*), Bash(*), Read(*), AskUserQuestion(*), mcp__ace-tool__search_context(*) --- +## Auto Mode + +When `--yes` or `-y`: Skip clarification questions, create issue with inferred details. + # Issue New Command (/issue:new) ## Core Principle diff --git a/.claude/commands/issue/plan.md b/.claude/commands/issue/plan.md index fa3d76cf..a56ac2af 100644 --- a/.claude/commands/issue/plan.md +++ b/.claude/commands/issue/plan.md @@ -1,10 +1,14 @@ --- name: plan description: Batch plan issue resolution using issue-plan-agent (explore + plan closed-loop) -argument-hint: "--all-pending [,,...] [--batch-size 3] " +argument-hint: "[-y|--yes] --all-pending [,,...] [--batch-size 3]" allowed-tools: TodoWrite(*), Task(*), SlashCommand(*), AskUserQuestion(*), Bash(*), Read(*), Write(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-bind solutions without confirmation, use recommended settings. + # Issue Plan Command (/issue:plan) ## Overview diff --git a/.claude/commands/issue/queue.md b/.claude/commands/issue/queue.md index 0df575f2..d94f19a2 100644 --- a/.claude/commands/issue/queue.md +++ b/.claude/commands/issue/queue.md @@ -1,10 +1,14 @@ --- name: queue description: Form execution queue from bound solutions using issue-queue-agent (solution-level) -argument-hint: "[--queues ] [--issue ]" +argument-hint: "[-y|--yes] [--queues ] [--issue ]" allowed-tools: TodoWrite(*), Task(*), Bash(*), Read(*), Write(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-confirm queue formation, use recommended conflict resolutions. + # Issue Queue Command (/issue:queue) ## Overview diff --git a/.claude/commands/task/breakdown.md b/.claude/commands/task/breakdown.md index d5bb31cf..e0412201 100644 --- a/.claude/commands/task/breakdown.md +++ b/.claude/commands/task/breakdown.md @@ -1,9 +1,13 @@ --- name: breakdown description: Decompose complex task into subtasks with dependency mapping, creates child task JSONs with parent references and execution order -argument-hint: "task-id" +argument-hint: "[-y|--yes] task-id" --- +## Auto Mode + +When `--yes` or `-y`: Auto-confirm breakdown, use recommended subtask structure. + # Task Breakdown Command (/task:breakdown) ## Overview diff --git a/.claude/commands/task/replan.md b/.claude/commands/task/replan.md index 8cb2c2d5..28c9e5e7 100644 --- a/.claude/commands/task/replan.md +++ b/.claude/commands/task/replan.md @@ -1,10 +1,14 @@ --- name: replan description: Update task JSON with new requirements or batch-update multiple tasks from verification report, tracks changes in task-changes.json -argument-hint: "task-id [\"text\"|file.md] | --batch [verification-report.md]" +argument-hint: "[-y|--yes] task-id [\"text\"|file.md] | --batch [verification-report.md]" allowed-tools: Read(*), Write(*), Edit(*), TodoWrite(*), Glob(*), Bash(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-confirm updates, use recommended changes. + # Task Replan Command (/task:replan) > **⚠️ DEPRECATION NOTICE**: This command is maintained for backward compatibility. For new workflows, use `/workflow:replan` which provides: diff --git a/.claude/commands/workflow/brainstorm/artifacts.md b/.claude/commands/workflow/brainstorm/artifacts.md index 2f798435..98ef51ae 100644 --- a/.claude/commands/workflow/brainstorm/artifacts.md +++ b/.claude/commands/workflow/brainstorm/artifacts.md @@ -1,10 +1,14 @@ --- name: artifacts description: Interactive clarification generating confirmed guidance specification through role-based analysis and synthesis -argument-hint: "topic or challenge description [--count N]" +argument-hint: "[-y|--yes] topic or challenge description [--count N]" allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), AskUserQuestion(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-select recommended roles, skip all clarification questions, use default answers. + ## Overview Seven-phase workflow: **Context collection** → **Topic analysis** → **Role selection** → **Role questions** → **Conflict resolution** → **Final check** → **Generate specification** diff --git a/.claude/commands/workflow/brainstorm/auto-parallel.md b/.claude/commands/workflow/brainstorm/auto-parallel.md index fd315509..e84437c4 100644 --- a/.claude/commands/workflow/brainstorm/auto-parallel.md +++ b/.claude/commands/workflow/brainstorm/auto-parallel.md @@ -1,10 +1,14 @@ --- name: auto-parallel description: Parallel brainstorming automation with dynamic role selection and concurrent execution across multiple perspectives -argument-hint: "topic or challenge description" [--count N] +argument-hint: "[-y|--yes] topic or challenge description [--count N]" allowed-tools: SlashCommand(*), Task(*), TodoWrite(*), Read(*), Write(*), Bash(*), Glob(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-select recommended roles, skip all clarification questions, use default answers. + # Workflow Brainstorm Parallel Auto Command ## Coordinator Role diff --git a/.claude/commands/workflow/brainstorm/synthesis.md b/.claude/commands/workflow/brainstorm/synthesis.md index 93c00de6..1be86c07 100644 --- a/.claude/commands/workflow/brainstorm/synthesis.md +++ b/.claude/commands/workflow/brainstorm/synthesis.md @@ -1,10 +1,14 @@ --- name: synthesis description: Clarify and refine role analyses through intelligent Q&A and targeted updates with synthesis agent -argument-hint: "[optional: --session session-id]" +argument-hint: "[-y|--yes] [optional: --session session-id]" allowed-tools: Task(conceptual-planning-agent), TodoWrite(*), Read(*), Write(*), Edit(*), Glob(*), AskUserQuestion(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-select all enhancements, skip clarification questions, use default answers. + ## Overview Six-phase workflow to eliminate ambiguities and enhance conceptual depth in role analyses: diff --git a/.claude/commands/workflow/clean.md b/.claude/commands/workflow/clean.md index 6aa72a12..3f6a5b9d 100644 --- a/.claude/commands/workflow/clean.md +++ b/.claude/commands/workflow/clean.md @@ -1,7 +1,7 @@ --- name: clean description: Intelligent code cleanup with mainline detection, stale artifact discovery, and safe execution -argument-hint: "[--dry-run] [\"focus area\"]" +argument-hint: "[-y|--yes] [--dry-run] [\"focus area\"]" allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Glob(*), Bash(*), Write(*) --- @@ -21,8 +21,22 @@ Intelligent cleanup command that explores the codebase to identify the developme ```bash /workflow:clean # Full intelligent cleanup (explore → analyze → confirm → execute) +/workflow:clean --yes # Auto mode (use safe defaults, no confirmation) /workflow:clean --dry-run # Explore and analyze only, no execution -/workflow:clean "auth module" # Focus cleanup on specific area +/workflow:clean -y "auth module" # Auto mode with focus area +``` + +## Auto Mode Defaults + +When `--yes` or `-y` flag is used: +- **Categories to Clean**: Auto-selects `["Sessions"]` only (safest - only workflow sessions) +- **Risk Level**: Auto-selects `"Low only"` (only low-risk items) +- All confirmations skipped, proceeds directly to execution + +**Flag Parsing**: +```javascript +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +const dryRun = $ARGUMENTS.includes('--dry-run') ``` ## Execution Process @@ -329,39 +343,57 @@ To execute cleanup: /workflow:clean **Step 3.3: User Confirmation** ```javascript -AskUserQuestion({ - questions: [ - { - question: "Which categories to clean?", - header: "Categories", - multiSelect: true, - options: [ - { - label: "Sessions", - description: `${manifest.summary.by_category.stale_sessions} stale workflow sessions` - }, - { - label: "Documents", - description: `${manifest.summary.by_category.drifted_documents} drifted documents` - }, - { - label: "Dead Code", - description: `${manifest.summary.by_category.dead_code} unused code files` - } - ] - }, - { - question: "Risk level to include?", - header: "Risk", - multiSelect: false, - options: [ - { label: "Low only", description: "Safest - only obviously stale items" }, - { label: "Low + Medium", description: "Recommended - includes likely unused items" }, - { label: "All", description: "Aggressive - includes high-risk items" } - ] - } - ] -}) +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +let userSelection + +if (autoYes) { + // Auto mode: Use safe defaults + console.log(`[--yes] Auto-selecting safe cleanup defaults:`) + console.log(` - Categories: Sessions only`) + console.log(` - Risk level: Low only`) + + userSelection = { + categories: ["Sessions"], + risk: "Low only" + } +} else { + // Interactive mode: Ask user + userSelection = AskUserQuestion({ + questions: [ + { + question: "Which categories to clean?", + header: "Categories", + multiSelect: true, + options: [ + { + label: "Sessions", + description: `${manifest.summary.by_category.stale_sessions} stale workflow sessions` + }, + { + label: "Documents", + description: `${manifest.summary.by_category.drifted_documents} drifted documents` + }, + { + label: "Dead Code", + description: `${manifest.summary.by_category.dead_code} unused code files` + } + ] + }, + { + question: "Risk level to include?", + header: "Risk", + multiSelect: false, + options: [ + { label: "Low only", description: "Safest - only obviously stale items" }, + { label: "Low + Medium", description: "Recommended - includes likely unused items" }, + { label: "All", description: "Aggressive - includes high-risk items" } + ] + } + ] + }) +} ``` --- diff --git a/.claude/commands/workflow/debug-with-file.md b/.claude/commands/workflow/debug-with-file.md index 7a8e1009..6fc1016a 100644 --- a/.claude/commands/workflow/debug-with-file.md +++ b/.claude/commands/workflow/debug-with-file.md @@ -1,10 +1,14 @@ --- name: debug-with-file description: Interactive hypothesis-driven debugging with documented exploration, understanding evolution, and Gemini-assisted correction -argument-hint: "\"bug description or error message\"" +argument-hint: "[-y|--yes] \"bug description or error message\"" allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-confirm all decisions (hypotheses, fixes, iteration), use recommended settings. + # Workflow Debug-With-File Command (/workflow:debug-with-file) ## Overview diff --git a/.claude/commands/workflow/debug.md b/.claude/commands/workflow/debug.md index 230829c6..58f17f41 100644 --- a/.claude/commands/workflow/debug.md +++ b/.claude/commands/workflow/debug.md @@ -1,10 +1,14 @@ --- name: debug description: Interactive hypothesis-driven debugging with NDJSON logging, iterative until resolved -argument-hint: "\"bug description or error message\"" +argument-hint: "[-y|--yes] \"bug description or error message\"" allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-confirm all decisions (hypotheses, fixes, iteration), use recommended settings. + # Workflow Debug Command (/workflow:debug) ## Overview diff --git a/.claude/commands/workflow/develop-with-file.md b/.claude/commands/workflow/develop-with-file.md index 80a091b4..3ce55643 100644 --- a/.claude/commands/workflow/develop-with-file.md +++ b/.claude/commands/workflow/develop-with-file.md @@ -1,10 +1,14 @@ --- name: develop-with-file description: Multi-agent development workflow with documented progress, Gemini-guided planning, and incremental iteration support -argument-hint: "\"feature description or task file.md\"" +argument-hint: "[-y|--yes] \"feature description or task file.md\"" allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-confirm all decisions (exploration, planning, execution, verification), use recommended settings. + # Workflow Develop-With-File Command (/workflow:develop-with-file) ## Overview diff --git a/.claude/commands/workflow/execute.md b/.claude/commands/workflow/execute.md index febee6ef..ce890fe8 100644 --- a/.claude/commands/workflow/execute.md +++ b/.claude/commands/workflow/execute.md @@ -1,7 +1,7 @@ --- name: execute description: Coordinate agent execution for workflow tasks with automatic session discovery, parallel task processing, and status tracking -argument-hint: "[--resume-session=\"session-id\"]" +argument-hint: "[-y|--yes] [--resume-session=\"session-id\"]" --- # Workflow Execute Command @@ -11,6 +11,30 @@ Orchestrates autonomous workflow execution through systematic task discovery, ag **Resume Mode**: When called with `--resume-session` flag, skips discovery phase and directly enters TodoWrite generation and agent execution for the specified session. +## Usage + +```bash +# Interactive mode (with confirmations) +/workflow:execute +/workflow:execute --resume-session="WFS-auth" + +# Auto mode (skip confirmations, use defaults) +/workflow:execute --yes +/workflow:execute -y +/workflow:execute -y --resume-session="WFS-auth" +``` + +## Auto Mode Defaults + +When `--yes` or `-y` flag is used: +- **Session Selection**: Automatically selects the first (most recent) active session +- **Completion Choice**: Automatically completes session (runs `/workflow:session:complete --yes`) + +**Flag Parsing**: +```javascript +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +``` + ## Performance Optimization Strategy **Lazy Loading**: Task JSONs read **on-demand** during execution, not upfront. TODO_LIST.md + IMPL_PLAN.md provide metadata for planning. @@ -122,24 +146,38 @@ List sessions with metadata and prompt user selection: bash(for dir in .workflow/active/WFS-*/; do [ -d "$dir" ] || continue; session=$(basename "$dir"); project=$(jq -r '.project // "Unknown"' "${dir}workflow-session.json" 2>/dev/null || echo "Unknown"); total=$(grep -c '^\- \[' "${dir}TODO_LIST.md" 2>/dev/null || echo 0); completed=$(grep -c '^\- \[x\]' "${dir}TODO_LIST.md" 2>/dev/null || echo 0); if [ "$total" -gt 0 ]; then progress=$((completed * 100 / total)); else progress=0; fi; echo "$session | $project | $completed/$total tasks ($progress%)"; done) ``` -Use AskUserQuestion to present formatted options (max 4 options shown): +**Parse --yes flag**: ```javascript -// If more than 4 sessions, show most recent 4 with "Other" option for manual input -const sessions = getActiveSessions() // sorted by last modified -const displaySessions = sessions.slice(0, 4) +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +``` -AskUserQuestion({ - questions: [{ - question: "Multiple active sessions detected. Select one:", - header: "Session", - multiSelect: false, - options: displaySessions.map(s => ({ - label: s.id, - description: `${s.project} | ${s.progress}` - })) - // Note: User can select "Other" to manually enter session ID - }] -}) +**Conditional Selection**: +```javascript +if (autoYes) { + // Auto mode: Select first session (most recent) + const firstSession = sessions[0] + console.log(`[--yes] Auto-selecting session: ${firstSession.id}`) + selectedSessionId = firstSession.id + // Continue to Phase 2 +} else { + // Interactive mode: Use AskUserQuestion to present formatted options (max 4 options shown) + // If more than 4 sessions, show most recent 4 with "Other" option for manual input + const sessions = getActiveSessions() // sorted by last modified + const displaySessions = sessions.slice(0, 4) + + AskUserQuestion({ + questions: [{ + question: "Multiple active sessions detected. Select one:", + header: "Session", + multiSelect: false, + options: displaySessions.map(s => ({ + label: s.id, + description: `${s.project} | ${s.progress}` + })) + // Note: User can select "Other" to manually enter session ID + }] + }) +} ``` **Input Validation**: @@ -252,23 +290,33 @@ while (TODO_LIST.md has pending tasks) { 6. **User Choice**: When all tasks finished, ask user to choose next step: ```javascript -AskUserQuestion({ - questions: [{ - question: "All tasks completed. What would you like to do next?", - header: "Next Step", - multiSelect: false, - options: [ - { - label: "Enter Review", - description: "Run specialized review (security/architecture/quality/action-items)" - }, - { - label: "Complete Session", - description: "Archive session and update manifest" - } - ] - }] -}) +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +if (autoYes) { + // Auto mode: Complete session automatically + console.log(`[--yes] Auto-selecting: Complete Session`) + SlashCommand("/workflow:session:complete --yes") +} else { + // Interactive mode: Ask user + AskUserQuestion({ + questions: [{ + question: "All tasks completed. What would you like to do next?", + header: "Next Step", + multiSelect: false, + options: [ + { + label: "Enter Review", + description: "Run specialized review (security/architecture/quality/action-items)" + }, + { + label: "Complete Session", + description: "Archive session and update manifest" + } + ] + }] + }) +} ``` **Based on user selection**: diff --git a/.claude/commands/workflow/lite-execute.md b/.claude/commands/workflow/lite-execute.md index 6b143457..e878f2d4 100644 --- a/.claude/commands/workflow/lite-execute.md +++ b/.claude/commands/workflow/lite-execute.md @@ -1,7 +1,7 @@ --- name: lite-execute description: Execute tasks based on in-memory plan, prompt description, or file content -argument-hint: "[--in-memory] [\"task description\"|file-path]" +argument-hint: "[-y|--yes] [--in-memory] [\"task description\"|file-path]" allowed-tools: TodoWrite(*), Task(*), Bash(*) --- @@ -62,31 +62,49 @@ Flexible task execution command supporting three input modes: in-memory plan (fr **User Interaction**: ```javascript -AskUserQuestion({ - questions: [ - { - question: "Select execution method:", - header: "Execution", - multiSelect: false, - options: [ - { label: "Agent", description: "@code-developer agent" }, - { label: "Codex", description: "codex CLI tool" }, - { label: "Auto", description: "Auto-select based on complexity" } - ] - }, - { - question: "Enable code review after execution?", - header: "Code Review", - multiSelect: false, - options: [ - { label: "Skip", description: "No review" }, - { label: "Gemini Review", description: "Gemini CLI tool" }, - { label: "Codex Review", description: "Git-aware review (prompt OR --uncommitted)" }, - { label: "Agent Review", description: "Current agent review" } - ] - } - ] -}) +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +let userSelection + +if (autoYes) { + // Auto mode: Use defaults + console.log(`[--yes] Auto-confirming execution:`) + console.log(` - Execution method: Auto`) + console.log(` - Code review: Skip`) + + userSelection = { + execution_method: "Auto", + code_review_tool: "Skip" + } +} else { + // Interactive mode: Ask user + userSelection = AskUserQuestion({ + questions: [ + { + question: "Select execution method:", + header: "Execution", + multiSelect: false, + options: [ + { label: "Agent", description: "@code-developer agent" }, + { label: "Codex", description: "codex CLI tool" }, + { label: "Auto", description: "Auto-select based on complexity" } + ] + }, + { + question: "Enable code review after execution?", + header: "Code Review", + multiSelect: false, + options: [ + { label: "Skip", description: "No review" }, + { label: "Gemini Review", description: "Gemini CLI tool" }, + { label: "Codex Review", description: "Git-aware review (prompt OR --uncommitted)" }, + { label: "Agent Review", description: "Current agent review" } + ] + } + ] + }) +} ``` ### Mode 3: File Content diff --git a/.claude/commands/workflow/lite-fix.md b/.claude/commands/workflow/lite-fix.md index 7794081c..c95ebf92 100644 --- a/.claude/commands/workflow/lite-fix.md +++ b/.claude/commands/workflow/lite-fix.md @@ -1,7 +1,7 @@ --- name: lite-fix description: Lightweight bug diagnosis and fix workflow with intelligent severity assessment and optional hotfix mode for production incidents -argument-hint: "[--hotfix] \"bug description or issue reference\"" +argument-hint: "[-y|--yes] [--hotfix] \"bug description or issue reference\"" allowed-tools: TodoWrite(*), Task(*), SlashCommand(*), AskUserQuestion(*) --- @@ -25,10 +25,32 @@ Intelligent lightweight bug fixing command with dynamic workflow adaptation base /workflow:lite-fix [FLAGS] # Flags +-y, --yes Skip all confirmations (auto mode) --hotfix, -h Production hotfix mode (minimal diagnosis, fast fix) # Arguments Bug description, error message, or path to .md file (required) + +# Examples +/workflow:lite-fix "用户登录失败" # Interactive mode +/workflow:lite-fix --yes "用户登录失败" # Auto mode (no confirmations) +/workflow:lite-fix -y --hotfix "生产环境数据库连接失败" # Auto + hotfix mode +``` + +## Auto Mode Defaults + +When `--yes` or `-y` flag is used: +- **Clarification Questions**: Skipped (no clarification phase) +- **Fix Plan Confirmation**: Auto-selected "Allow" +- **Execution Method**: Auto-selected "Auto" +- **Code Review**: Auto-selected "Skip" +- **Severity**: Uses auto-detected severity (no manual override) +- **Hotfix Mode**: Respects --hotfix flag if present, otherwise normal mode + +**Flag Parsing**: +```javascript +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +const hotfixMode = $ARGUMENTS.includes('--hotfix') || $ARGUMENTS.includes('-h') ``` ## Execution Process @@ -332,9 +354,17 @@ function deduplicateClarifications(clarifications) { const uniqueClarifications = deduplicateClarifications(allClarifications) -// Multi-round clarification: batch questions (max 4 per round) -// ⚠️ MUST execute ALL rounds until uniqueClarifications exhausted -if (uniqueClarifications.length > 0) { +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +if (autoYes) { + // Auto mode: Skip clarification phase + console.log(`[--yes] Skipping ${uniqueClarifications.length} clarification questions`) + console.log(`Proceeding to fix planning with diagnosis results...`) + // Continue to Phase 3 +} else if (uniqueClarifications.length > 0) { + // Interactive mode: Multi-round clarification + // ⚠️ MUST execute ALL rounds until uniqueClarifications exhausted const BATCH_SIZE = 4 const totalRounds = Math.ceil(uniqueClarifications.length / BATCH_SIZE) @@ -600,40 +630,60 @@ ${fixPlan.tasks.map((t, i) => `${i+1}. ${t.title} (${t.scope})`).join('\n')} **Step 4.2: Collect Confirmation** ```javascript -AskUserQuestion({ - questions: [ - { - question: `Confirm fix plan? (${fixPlan.tasks.length} tasks, ${fixPlan.severity} severity)`, - header: "Confirm", - multiSelect: true, - options: [ - { label: "Allow", description: "Proceed as-is" }, - { label: "Modify", description: "Adjust before execution" }, - { label: "Cancel", description: "Abort workflow" } - ] - }, - { - question: "Execution method:", - header: "Execution", - multiSelect: false, - options: [ - { label: "Agent", description: "@code-developer agent" }, - { label: "Codex", description: "codex CLI tool" }, - { label: "Auto", description: `Auto: ${fixPlan.severity === 'Low' ? 'Agent' : 'Codex'}` } - ] - }, - { - question: "Code review after fix?", - header: "Review", - multiSelect: false, - options: [ - { label: "Gemini Review", description: "Gemini CLI" }, - { label: "Agent Review", description: "@code-reviewer" }, - { label: "Skip", description: "No review" } - ] - } - ] -}) +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +let userSelection + +if (autoYes) { + // Auto mode: Use defaults + console.log(`[--yes] Auto-confirming fix plan:`) + console.log(` - Confirmation: Allow`) + console.log(` - Execution: Auto`) + console.log(` - Review: Skip`) + + userSelection = { + confirmation: "Allow", + execution_method: "Auto", + code_review_tool: "Skip" + } +} else { + // Interactive mode: Ask user + userSelection = AskUserQuestion({ + questions: [ + { + question: `Confirm fix plan? (${fixPlan.tasks.length} tasks, ${fixPlan.severity} severity)`, + header: "Confirm", + multiSelect: false, + options: [ + { label: "Allow", description: "Proceed as-is" }, + { label: "Modify", description: "Adjust before execution" }, + { label: "Cancel", description: "Abort workflow" } + ] + }, + { + question: "Execution method:", + header: "Execution", + multiSelect: false, + options: [ + { label: "Agent", description: "@code-developer agent" }, + { label: "Codex", description: "codex CLI tool" }, + { label: "Auto", description: `Auto: ${fixPlan.severity === 'Low' ? 'Agent' : 'Codex'}` } + ] + }, + { + question: "Code review after fix?", + header: "Review", + multiSelect: false, + options: [ + { label: "Gemini Review", description: "Gemini CLI" }, + { label: "Agent Review", description: "@code-reviewer" }, + { label: "Skip", description: "No review" } + ] + } + ] + }) +} ``` --- diff --git a/.claude/commands/workflow/lite-lite-lite.md b/.claude/commands/workflow/lite-lite-lite.md index e7de5238..6467a986 100644 --- a/.claude/commands/workflow/lite-lite-lite.md +++ b/.claude/commands/workflow/lite-lite-lite.md @@ -1,10 +1,14 @@ --- name: workflow:lite-lite-lite description: Ultra-lightweight multi-tool analysis and direct execution. No artifacts for simple tasks; auto-creates planning docs in .workflow/.scratchpad/ for complex tasks. Auto tool selection based on task analysis, user-driven iteration via AskUser. -argument-hint: "" +argument-hint: "[-y|--yes] " allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Bash(*), Write(*), mcp__ace-tool__search_context(*), mcp__ccw-tools__write_file(*) --- +## Auto Mode + +When `--yes` or `-y`: Skip clarification questions, auto-select tools, execute directly with recommended settings. + # Ultra-Lite Multi-Tool Workflow ## Quick Start diff --git a/.claude/commands/workflow/lite-plan.md b/.claude/commands/workflow/lite-plan.md index 7388c41e..156e958a 100644 --- a/.claude/commands/workflow/lite-plan.md +++ b/.claude/commands/workflow/lite-plan.md @@ -1,7 +1,7 @@ --- name: lite-plan description: Lightweight interactive planning workflow with in-memory planning, code exploration, and execution execute to lite-execute after user confirmation -argument-hint: "[-e|--explore] \"task description\"|file.md" +argument-hint: "[-y|--yes] [-e|--explore] \"task description\"|file.md" allowed-tools: TodoWrite(*), Task(*), SlashCommand(*), AskUserQuestion(*) --- @@ -25,10 +25,30 @@ Intelligent lightweight planning command with dynamic workflow adaptation based /workflow:lite-plan [FLAGS] # Flags +-y, --yes Skip all confirmations (auto mode) -e, --explore Force code exploration phase (overrides auto-detection) # Arguments Task description or path to .md file (required) + +# Examples +/workflow:lite-plan "实现JWT认证" # Interactive mode +/workflow:lite-plan --yes "实现JWT认证" # Auto mode (no confirmations) +/workflow:lite-plan -y -e "优化数据库查询性能" # Auto mode + force exploration +``` + +## Auto Mode Defaults + +When `--yes` or `-y` flag is used: +- **Clarification Questions**: Skipped (no clarification phase) +- **Plan Confirmation**: Auto-selected "Allow" +- **Execution Method**: Auto-selected "Auto" +- **Code Review**: Auto-selected "Skip" + +**Flag Parsing**: +```javascript +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +const forceExplore = $ARGUMENTS.includes('--explore') || $ARGUMENTS.includes('-e') ``` ## Execution Process @@ -323,8 +343,16 @@ explorations.forEach(exp => { // - Produce dedupedClarifications with unique intents only const dedupedClarifications = intelligentMerge(allClarifications) -// Multi-round clarification: batch questions (max 4 per round) -if (dedupedClarifications.length > 0) { +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +if (autoYes) { + // Auto mode: Skip clarification phase + console.log(`[--yes] Skipping ${dedupedClarifications.length} clarification questions`) + console.log(`Proceeding to planning with exploration results...`) + // Continue to Phase 3 +} else if (dedupedClarifications.length > 0) { + // Interactive mode: Multi-round clarification const BATCH_SIZE = 4 const totalRounds = Math.ceil(dedupedClarifications.length / BATCH_SIZE) @@ -497,42 +525,62 @@ ${plan.tasks.map((t, i) => `${i+1}. ${t.title} (${t.file})`).join('\n')} **Step 4.2: Collect Confirmation** ```javascript -// Note: Execution "Other" option allows specifying CLI tools from ~/.claude/cli-tools.json -AskUserQuestion({ - questions: [ - { - question: `Confirm plan? (${plan.tasks.length} tasks, ${plan.complexity})`, - header: "Confirm", - multiSelect: true, - options: [ - { label: "Allow", description: "Proceed as-is" }, - { label: "Modify", description: "Adjust before execution" }, - { label: "Cancel", description: "Abort workflow" } - ] - }, - { - question: "Execution method:", - header: "Execution", - multiSelect: false, - options: [ - { label: "Agent", description: "@code-developer agent" }, - { label: "Codex", description: "codex CLI tool" }, - { label: "Auto", description: `Auto: ${plan.complexity === 'Low' ? 'Agent' : 'Codex'}` } - ] - }, - { - question: "Code review after execution?", - header: "Review", - multiSelect: false, - options: [ - { label: "Gemini Review", description: "Gemini CLI review" }, - { label: "Codex Review", description: "Git-aware review (prompt OR --uncommitted)" }, - { label: "Agent Review", description: "@code-reviewer agent" }, - { label: "Skip", description: "No review" } - ] - } - ] -}) +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +let userSelection + +if (autoYes) { + // Auto mode: Use defaults + console.log(`[--yes] Auto-confirming plan:`) + console.log(` - Confirmation: Allow`) + console.log(` - Execution: Auto`) + console.log(` - Review: Skip`) + + userSelection = { + confirmation: "Allow", + execution_method: "Auto", + code_review_tool: "Skip" + } +} else { + // Interactive mode: Ask user + // Note: Execution "Other" option allows specifying CLI tools from ~/.claude/cli-tools.json + userSelection = AskUserQuestion({ + questions: [ + { + question: `Confirm plan? (${plan.tasks.length} tasks, ${plan.complexity})`, + header: "Confirm", + multiSelect: false, + options: [ + { label: "Allow", description: "Proceed as-is" }, + { label: "Modify", description: "Adjust before execution" }, + { label: "Cancel", description: "Abort workflow" } + ] + }, + { + question: "Execution method:", + header: "Execution", + multiSelect: false, + options: [ + { label: "Agent", description: "@code-developer agent" }, + { label: "Codex", description: "codex CLI tool" }, + { label: "Auto", description: `Auto: ${plan.complexity === 'Low' ? 'Agent' : 'Codex'}` } + ] + }, + { + question: "Code review after execution?", + header: "Review", + multiSelect: false, + options: [ + { label: "Gemini Review", description: "Gemini CLI review" }, + { label: "Codex Review", description: "Git-aware review (prompt OR --uncommitted)" }, + { label: "Agent Review", description: "@code-reviewer agent" }, + { label: "Skip", description: "No review" } + ] + } + ] + }) +} ``` --- diff --git a/.claude/commands/workflow/multi-cli-plan.md b/.claude/commands/workflow/multi-cli-plan.md index a3437272..e3f2d157 100644 --- a/.claude/commands/workflow/multi-cli-plan.md +++ b/.claude/commands/workflow/multi-cli-plan.md @@ -1,10 +1,14 @@ --- name: workflow:multi-cli-plan description: Multi-CLI collaborative planning workflow with ACE context gathering and iterative cross-verification. Uses cli-discuss-agent for Gemini+Codex+Claude analysis to converge on optimal execution plan. -argument-hint: " [--max-rounds=3] [--tools=gemini,codex] [--mode=parallel|serial]" +argument-hint: "[-y|--yes] [--max-rounds=3] [--tools=gemini,codex] [--mode=parallel|serial]" allowed-tools: TodoWrite(*), Task(*), AskUserQuestion(*), Read(*), Bash(*), Write(*), mcp__ace-tool__search_context(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-approve plan, use recommended solution and execution method (Agent, Skip review). + # Multi-CLI Collaborative Planning Command ## Quick Start diff --git a/.claude/commands/workflow/plan.md b/.claude/commands/workflow/plan.md index 819b8ed8..f51259d0 100644 --- a/.claude/commands/workflow/plan.md +++ b/.claude/commands/workflow/plan.md @@ -1,10 +1,14 @@ --- name: plan description: 5-phase planning workflow with action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs -argument-hint: "\"text description\"|file.md" +argument-hint: "[-y|--yes] \"text description\"|file.md" allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*) --- +## Auto Mode + +When `--yes` or `-y`: Auto-continue all phases (skip confirmations), use recommended conflict resolutions. + # Workflow Plan Command (/workflow:plan) ## Coordinator Role diff --git a/.claude/commands/workflow/replan.md b/.claude/commands/workflow/replan.md index 8b71b604..1a0cd2f0 100644 --- a/.claude/commands/workflow/replan.md +++ b/.claude/commands/workflow/replan.md @@ -1,7 +1,7 @@ --- name: replan description: Interactive workflow replanning with session-level artifact updates and boundary clarification through guided questioning -argument-hint: "[--session session-id] [task-id] \"requirements\"|file.md [--interactive]" +argument-hint: "[-y|--yes] [--session session-id] [task-id] \"requirements\"|file.md [--interactive]" allowed-tools: Read(*), Write(*), Edit(*), TodoWrite(*), Glob(*), Bash(*) --- @@ -117,10 +117,48 @@ const taskId = taskIdMatch?.[1] --- +### Auto Mode Support + +When `--yes` or `-y` flag is used, the command skips interactive clarification and uses safe defaults: + +```javascript +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +``` + +**Auto Mode Defaults**: +- **Modification Scope**: `tasks_only` (safest - only update task details) +- **Affected Modules**: All modules related to the task +- **Task Changes**: `update_only` (no structural changes) +- **Dependency Changes**: `no` (preserve existing dependencies) +- **User Confirmation**: Auto-confirm execution + +**Note**: `--interactive` flag overrides `--yes` flag (forces interactive mode). + +--- + ### Phase 2: Interactive Requirement Clarification **Purpose**: Define modification scope through guided questioning +**Auto Mode Check**: +```javascript +if (autoYes && !interactive) { + // Use defaults and skip to Phase 3 + console.log(`[--yes] Using safe defaults for replan:`) + console.log(` - Scope: tasks_only`) + console.log(` - Changes: update_only`) + console.log(` - Dependencies: preserve existing`) + + userSelections = { + scope: 'tasks_only', + modules: 'all_affected', + task_changes: 'update_only', + dependency_changes: false + } + // Proceed to Phase 3 +} +``` + #### Session Mode Questions **Q1: Modification Scope** @@ -228,10 +266,29 @@ interface ImpactAnalysis { **Step 3.3: User Confirmation** ```javascript -Options: -- 确认执行: 开始应用所有修改 -- 调整计划: 重新回答问题调整范围 -- 取消操作: 放弃本次重规划 +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +if (autoYes) { + // Auto mode: Auto-confirm execution + console.log(`[--yes] Auto-confirming replan execution`) + userConfirmation = '确认执行' + // Proceed to Phase 4 +} else { + // Interactive mode: Ask user + AskUserQuestion({ + questions: [{ + question: "修改计划已生成,请确认操作:", + header: "Confirm", + options: [ + { label: "确认执行", description: "开始应用所有修改" }, + { label: "调整计划", description: "重新回答问题调整范围" }, + { label: "取消操作", description: "放弃本次重规划" } + ], + multiSelect: false + }] + }) +} ``` **Output**: Modification plan confirmed or adjusted diff --git a/.claude/commands/workflow/review-fix.md b/.claude/commands/workflow/review-fix.md index eb2ca9c9..8d8f6e8a 100644 --- a/.claude/commands/workflow/review-fix.md +++ b/.claude/commands/workflow/review-fix.md @@ -605,6 +605,4 @@ Use `ccw view` to open the workflow dashboard in browser: ```bash ccw view -``` - - +``` \ No newline at end of file diff --git a/.claude/commands/workflow/session/complete.md b/.claude/commands/workflow/session/complete.md index e91b07a1..7519e67e 100644 --- a/.claude/commands/workflow/session/complete.md +++ b/.claude/commands/workflow/session/complete.md @@ -1,8 +1,10 @@ --- name: complete description: Mark active workflow session as complete, archive with lessons learned, update manifest, remove active flag +argument-hint: "[-y|--yes] [--detailed]" examples: - /workflow:session:complete + - /workflow:session:complete --yes - /workflow:session:complete --detailed --- @@ -139,20 +141,41 @@ test -f .workflow/project-tech.json || echo "SKIP" After successful archival, prompt user to capture learnings: ```javascript -AskUserQuestion({ - questions: [{ - question: "Would you like to solidify learnings from this session into project guidelines?", - header: "Solidify", - options: [ - { label: "Yes, solidify now", description: "Extract learnings and update project-guidelines.json" }, - { label: "Skip", description: "Archive complete, no learnings to capture" } - ], - multiSelect: false - }] -}) +// Parse --yes flag +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +if (autoYes) { + // Auto mode: Skip solidify + console.log(`[--yes] Auto-selecting: Skip solidify`) + console.log(`Session archived successfully.`) + // Done - no solidify +} else { + // Interactive mode: Ask user + AskUserQuestion({ + questions: [{ + question: "Would you like to solidify learnings from this session into project guidelines?", + header: "Solidify", + options: [ + { label: "Yes, solidify now", description: "Extract learnings and update project-guidelines.json" }, + { label: "Skip", description: "Archive complete, no learnings to capture" } + ], + multiSelect: false + }] + }) + + // **If "Yes, solidify now"**: Execute `/workflow:session:solidify` with the archived session ID. +} ``` -**If "Yes, solidify now"**: Execute `/workflow:session:solidify` with the archived session ID. +## Auto Mode Defaults + +When `--yes` or `-y` flag is used: +- **Solidify Learnings**: Auto-selected "Skip" (archive only, no solidify) + +**Flag Parsing**: +```javascript +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +``` **Output**: ``` diff --git a/.claude/commands/workflow/session/solidify.md b/.claude/commands/workflow/session/solidify.md index dc1f004c..fe2f831f 100644 --- a/.claude/commands/workflow/session/solidify.md +++ b/.claude/commands/workflow/session/solidify.md @@ -1,14 +1,18 @@ --- name: solidify description: Crystallize session learnings and user-defined constraints into permanent project guidelines -argument-hint: "[--type ] [--category ] \"rule or insight\"" +argument-hint: "[-y|--yes] [--type ] [--category ] \"rule or insight\"" examples: - /workflow:session:solidify "Use functional components for all React code" --type convention - - /workflow:session:solidify "No direct DB access from controllers" --type constraint --category architecture + - /workflow:session:solidify -y "No direct DB access from controllers" --type constraint --category architecture - /workflow:session:solidify "Cache invalidation requires event sourcing" --type learning --category architecture - /workflow:session:solidify --interactive --- +## Auto Mode + +When `--yes` or `-y`: Auto-categorize and add guideline without confirmation. + # Session Solidify Command (/workflow:session:solidify) ## Overview diff --git a/.claude/commands/workflow/tools/conflict-resolution.md b/.claude/commands/workflow/tools/conflict-resolution.md index ac10b9a3..ffe73aed 100644 --- a/.claude/commands/workflow/tools/conflict-resolution.md +++ b/.claude/commands/workflow/tools/conflict-resolution.md @@ -1,12 +1,16 @@ --- name: conflict-resolution description: Detect and resolve conflicts between plan and existing codebase using CLI-powered analysis with Gemini/Qwen -argument-hint: "--session WFS-session-id --context path/to/context-package.json" +argument-hint: "[-y|--yes] --session WFS-session-id --context path/to/context-package.json" examples: - /workflow:tools:conflict-resolution --session WFS-auth --context .workflow/active/WFS-auth/.process/context-package.json - - /workflow:tools:conflict-resolution --session WFS-payment --context .workflow/active/WFS-payment/.process/context-package.json + - /workflow:tools:conflict-resolution -y --session WFS-payment --context .workflow/active/WFS-payment/.process/context-package.json --- +## Auto Mode + +When `--yes` or `-y`: Auto-select recommended strategy for each conflict, skip clarification questions. + # Conflict Resolution Command ## Purpose @@ -209,6 +213,8 @@ Task(subagent_type="cli-execution-agent", run_in_background=false, prompt=` ### Phase 3: User Interaction Loop ```javascript +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + FOR each conflict: round = 0, clarified = false, userClarifications = [] @@ -216,8 +222,13 @@ FOR each conflict: // 1. Display conflict info (text output for context) displayConflictSummary(conflict) // id, brief, severity, overlap_analysis if ModuleOverlap - // 2. Strategy selection via AskUserQuestion - AskUserQuestion({ + // 2. Strategy selection + if (autoYes) { + console.log(`[--yes] Auto-selecting recommended strategy`) + selectedStrategy = conflict.strategies[conflict.recommended || 0] + clarified = true // Skip clarification loop + } else { + AskUserQuestion({ questions: [{ question: formatStrategiesForDisplay(conflict.strategies), header: "策略选择", @@ -230,18 +241,19 @@ FOR each conflict: { label: "自定义修改", description: `建议: ${conflict.modification_suggestions?.slice(0,2).join('; ')}` } ] }] - }) + }) - // 3. Handle selection - if (userChoice === "自定义修改") { - customConflicts.push({ id, brief, category, suggestions, overlap_analysis }) - break + // 3. Handle selection + if (userChoice === "自定义修改") { + customConflicts.push({ id, brief, category, suggestions, overlap_analysis }) + break + } + + selectedStrategy = findStrategyByName(userChoice) } - selectedStrategy = findStrategyByName(userChoice) - // 4. Clarification (if needed) - batched max 4 per call - if (selectedStrategy.clarification_needed?.length > 0) { + if (!autoYes && selectedStrategy.clarification_needed?.length > 0) { for (batch of chunk(selectedStrategy.clarification_needed, 4)) { AskUserQuestion({ questions: batch.map((q, i) => ({ diff --git a/.claude/commands/workflow/tools/task-generate-agent.md b/.claude/commands/workflow/tools/task-generate-agent.md index 77193e1b..f35c62c4 100644 --- a/.claude/commands/workflow/tools/task-generate-agent.md +++ b/.claude/commands/workflow/tools/task-generate-agent.md @@ -1,11 +1,16 @@ --- name: task-generate-agent description: Generate implementation plan documents (IMPL_PLAN.md, task JSONs, TODO_LIST.md) using action-planning-agent - produces planning artifacts, does NOT execute code implementation -argument-hint: "--session WFS-session-id" +argument-hint: "[-y|--yes] --session WFS-session-id" examples: - /workflow:tools:task-generate-agent --session WFS-auth + - /workflow:tools:task-generate-agent -y --session WFS-auth --- +## Auto Mode + +When `--yes` or `-y`: Skip user questions, use defaults (no materials, Agent executor, Codex CLI tool). + # Generate Implementation Plan Command ## Overview @@ -67,9 +72,25 @@ Phase 3: Integration (+1 Coordinator, Multi-Module Only) **Purpose**: Collect user preferences before task generation to ensure generated tasks match execution expectations. -**User Questions**: +**Auto Mode Check**: ```javascript -AskUserQuestion({ +const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') + +if (autoYes) { + console.log(`[--yes] Using defaults: No materials, Agent executor, Codex CLI`) + userConfig = { + supplementaryMaterials: { type: "none", content: [] }, + executionMethod: "agent", + preferredCliTool: "codex", + enableResume: true + } + // Skip to Phase 1 +} +``` + +**User Questions** (skipped if autoYes): +```javascript +if (!autoYes) AskUserQuestion({ questions: [ { question: "Do you have supplementary materials or guidelines to include?", @@ -104,11 +125,10 @@ AskUserQuestion({ } ] }) -``` -**Handle Materials Response**: +**Handle Materials Response** (skipped if autoYes): ```javascript -if (userConfig.materials === "Provide file paths") { +if (!autoYes && userConfig.materials === "Provide file paths") { // Follow-up question for file paths const pathsResponse = AskUserQuestion({ questions: [{ diff --git a/.claude/commands/workflow/tools/task-generate-tdd.md b/.claude/commands/workflow/tools/task-generate-tdd.md index 86badc61..fc869da8 100644 --- a/.claude/commands/workflow/tools/task-generate-tdd.md +++ b/.claude/commands/workflow/tools/task-generate-tdd.md @@ -1,11 +1,16 @@ --- name: task-generate-tdd description: Autonomous TDD task generation using action-planning-agent with Red-Green-Refactor cycles, test-first structure, and cycle validation -argument-hint: "--session WFS-session-id" +argument-hint: "[-y|--yes] --session WFS-session-id" examples: - /workflow:tools:task-generate-tdd --session WFS-auth + - /workflow:tools:task-generate-tdd -y --session WFS-auth --- +## Auto Mode + +When `--yes` or `-y`: Skip user questions, use defaults (no materials, Agent executor). + # Autonomous TDD Task Generation Command ## Overview diff --git a/.claude/commands/workflow/ui-design/animation-extract.md b/.claude/commands/workflow/ui-design/animation-extract.md index dc4347f5..aa78b479 100644 --- a/.claude/commands/workflow/ui-design/animation-extract.md +++ b/.claude/commands/workflow/ui-design/animation-extract.md @@ -1,10 +1,14 @@ --- name: animation-extract description: Extract animation and transition patterns from prompt inference and image references for design system documentation -argument-hint: "[--design-id ] [--session ] [--images ""] [--focus ""] [--interactive] [--refine]" +argument-hint: "[-y|--yes] [--design-id ] [--session ] [--images ""] [--focus ""] [--interactive] [--refine]" allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), Bash(*), AskUserQuestion(*), Task(ui-design-agent) --- +## Auto Mode + +When `--yes` or `-y`: Skip all clarification questions, use AI-inferred animation decisions. + # Animation Extraction Command ## Overview diff --git a/.claude/commands/workflow/ui-design/layout-extract.md b/.claude/commands/workflow/ui-design/layout-extract.md index 58fb0f60..8df4aeb4 100644 --- a/.claude/commands/workflow/ui-design/layout-extract.md +++ b/.claude/commands/workflow/ui-design/layout-extract.md @@ -1,10 +1,14 @@ --- name: layout-extract description: Extract structural layout information from reference images or text prompts using Claude analysis with variant generation or refinement mode -argument-hint: [--design-id ] [--session ] [--images ""] [--prompt ""] [--targets ""] [--variants ] [--device-type ] [--interactive] [--refine] +argument-hint: "[-y|--yes] [--design-id ] [--session ] [--images ""] [--prompt ""] [--targets ""] [--variants ] [--device-type ] [--interactive] [--refine]" allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), Bash(*), AskUserQuestion(*), Task(ui-design-agent), mcp__exa__web_search_exa(*) --- +## Auto Mode + +When `--yes` or `-y`: Skip all clarification questions, use AI-inferred layout decisions. + # Layout Extraction Command ## Overview diff --git a/.claude/commands/workflow/ui-design/style-extract.md b/.claude/commands/workflow/ui-design/style-extract.md index 7230e0c2..5d5dee21 100644 --- a/.claude/commands/workflow/ui-design/style-extract.md +++ b/.claude/commands/workflow/ui-design/style-extract.md @@ -1,10 +1,14 @@ --- name: style-extract description: Extract design style from reference images or text prompts using Claude analysis with variant generation or refinement mode -argument-hint: "[--design-id ] [--session ] [--images ""] [--prompt ""] [--variants ] [--interactive] [--refine]" +argument-hint: "[-y|--yes] [--design-id ] [--session ] [--images ""] [--prompt ""] [--variants ] [--interactive] [--refine]" allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), AskUserQuestion(*) --- +## Auto Mode + +When `--yes` or `-y`: Skip all clarification questions, use AI-inferred design decisions. + # Style Extraction Command ## Overview diff --git a/.claude/skills/ccw-coordinator/SKILL.md b/.claude/skills/ccw-coordinator/SKILL.md index 9da64e18..cec008c3 100644 --- a/.claude/skills/ccw-coordinator/SKILL.md +++ b/.claude/skills/ccw-coordinator/SKILL.md @@ -45,6 +45,7 @@ allowed-tools: Task, AskUserQuestion, Read, Write, Bash, Glob, Grep 5. **执行透明性**: 展示执行进度、结果和可能的错误 6. **会话持久化**: 保存编排会话,支持中途暂停和恢复 7. **智能提示词生成**: 根据任务上下文和前序产物自动生成 ccw cli 提示词 +8. **自动确认**: 所有命令自动添加 `-y` 参数,跳过交互式确认,实现无人值守执行 ## Intelligent Prompt Generation diff --git a/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md b/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md index ec4f0203..855c020f 100644 --- a/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md +++ b/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md @@ -66,8 +66,8 @@ for (let i = current_command_index; i < command_chain.length; i++) { const prompt = generatePrompt(cmd, state, commandMeta); try { - // 使用 ccw cli 执行 - const result = Bash(`ccw cli -p "${prompt.replace(/"/g, '\\"')}" ${cmd.command}`, { + // 使用 ccw cli 执行(添加 -y 参数跳过确认) + const result = Bash(`ccw cli -p "${prompt.replace(/"/g, '\\"')}" ${cmd.command} -y`, { run_in_background: true }); diff --git a/.claude/skills/ccw-coordinator/tools/chain-validate.cjs b/.claude/skills/ccw-coordinator/tools/chain-validate.cjs index 9c84594a..28c1edeb 100644 --- a/.claude/skills/ccw-coordinator/tools/chain-validate.cjs +++ b/.claude/skills/ccw-coordinator/tools/chain-validate.cjs @@ -254,8 +254,30 @@ function main() { chain = args[1].split(',').map(s => s.trim()); } else if (args[0] === '--file') { const filePath = args[1]; - const fileContent = JSON.parse(fs.readFileSync(filePath, 'utf8')); - chain = fileContent.chain || fileContent.steps.map(s => s.command); + + // SEC-001: 路径遍历验证 - 只允许访问工作目录下的文件 + const resolvedPath = path.resolve(filePath); + const workDir = path.resolve('.'); + if (!resolvedPath.startsWith(workDir)) { + console.error('Error: File path must be within current working directory'); + process.exit(1); + } + + // CORR-001: JSON 解析错误处理 + let fileContent; + try { + fileContent = JSON.parse(fs.readFileSync(resolvedPath, 'utf8')); + } catch (error) { + console.error(`Error: Failed to parse JSON file ${filePath}: ${error.message}`); + process.exit(1); + } + + // CORR-002: 嵌套属性 null 检查 + chain = fileContent.chain || fileContent.steps?.map(s => s.command) || []; + if (chain.length === 0) { + console.error('Error: No valid chain found in file (expected "chain" array or "steps" with "command" fields)'); + process.exit(1); + } } else { chain = args; } diff --git a/.claude/skills/ccw-coordinator/tools/command-registry.cjs b/.claude/skills/ccw-coordinator/tools/command-registry.cjs index 4409f0a4..8bf54774 100644 --- a/.claude/skills/ccw-coordinator/tools/command-registry.cjs +++ b/.claude/skills/ccw-coordinator/tools/command-registry.cjs @@ -48,7 +48,19 @@ class CommandRegistry { } /** - * 解析 YAML 头 + * 解析 YAML 头 (简化版本) + * + * 限制: + * - 只支持简单的 key: value 对 (单行值) + * - 不支持多行值、嵌套对象、复杂列表 + * - allowed-tools 字段支持逗号分隔的字符串,自动转为数组 + * + * 示例: + * --- + * name: lite-plan + * description: "Lightweight planning workflow" + * allowed-tools: Read, Write, Bash + * --- */ parseYamlHeader(content) { // 处理 Windows 行结尾 (\r\n) @@ -58,23 +70,36 @@ class CommandRegistry { const yamlContent = match[1]; const result = {}; - const lines = yamlContent.split(/[\r\n]+/); - for (const line of lines) { - if (!line.trim()) continue; + try { + const lines = yamlContent.split(/[\r\n]+/); + for (const line of lines) { + const trimmed = line.trim(); + if (!trimmed || trimmed.startsWith('#')) continue; // 跳过空行和注释 - const colonIndex = line.indexOf(':'); - if (colonIndex === -1) continue; + const colonIndex = trimmed.indexOf(':'); + if (colonIndex === -1) continue; - const key = line.substring(0, colonIndex).trim(); - const value = line.substring(colonIndex + 1).trim(); + const key = trimmed.substring(0, colonIndex).trim(); + const value = trimmed.substring(colonIndex + 1).trim(); - let cleanValue = value.replace(/^["']|["']$/g, ''); + if (!key) continue; // 跳过无效行 - if (key === 'allowed-tools') { - cleanValue = cleanValue.split(',').map(t => t.trim()); + // 去除引号 (单引号或双引号) + let cleanValue = value.replace(/^["']|["']$/g, ''); + + // allowed-tools 字段特殊处理:转为数组 + // 支持格式: "Read, Write, Bash" 或 "Read,Write,Bash" + if (key === 'allowed-tools') { + cleanValue = Array.isArray(cleanValue) + ? cleanValue + : cleanValue.split(',').map(t => t.trim()).filter(t => t); + } + + result[key] = cleanValue; } - - result[key] = cleanValue; + } catch (error) { + console.error('YAML parsing error:', error.message); + return null; } return result;