Files
Claude-Code-Workflow/.claude/commands/cli/analyze.md
catlog22 bc959b1a0f refactor(cli): remove --agent flag and enhance agent execution context
- Remove --agent parameter from all CLI commands (now default behavior)
- Restore and enhance Task() invocation context for cli-execution-agent
- Add detailed execution phases and context discovery strategies
- Simplify documentation by removing redundant CLI command templates
- Consolidate output documentation to unified format

Modified commands:
- /cli:analyze, /cli:chat, /cli:execute
- /cli:mode:plan, /cli:mode:code-analysis, /cli:mode:bug-diagnosis

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 16:12:04 +08:00

2.5 KiB

name, description, argument-hint, allowed-tools
name description argument-hint allowed-tools
analyze Read-only codebase analysis using Gemini (default), Qwen, or Codex with auto-pattern detection and template selection [--tool codex|gemini|qwen] [--enhance] analysis target SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*), Task(*)

CLI Analyze Command (/cli:analyze)

Purpose

Quick codebase analysis using CLI tools. Read-only - does NOT modify code.

Tool Selection:

  • gemini (default) - Best for code analysis
  • qwen - Fallback when Gemini unavailable
  • codex - Alternative for deep analysis

Parameters

  • --tool <gemini|qwen|codex> - Tool selection (default: gemini)
  • --enhance - Use /enhance-prompt for context-aware enhancement
  • <analysis-target> - Description of what to analyze

Tool Usage

Gemini (Primary):

--tool gemini  # or omit (default)

Qwen (Fallback):

--tool qwen

Codex (Alternative):

--tool codex

Execution Flow

Uses cli-execution-agent (default) for automated analysis:

Task(
  subagent_type="cli-execution-agent",
  description="Codebase analysis with pattern detection",
  prompt=`
    Task: ${analysis_target}
    Mode: analyze
    Tool: ${tool_flag || 'gemini'}
    Enhance: ${enhance_flag}

    Execute codebase analysis with auto-pattern detection:

    1. Context Discovery:
       - Extract keywords from analysis target
       - Auto-detect file patterns (auth→auth files, component→components, etc.)
       - Discover additional relevant files using MCP
       - Build comprehensive file context

    2. Template Selection:
       - Auto-select analysis template based on keywords
       - Apply appropriate analysis methodology
       - Include @CLAUDE.md for project context

    3. CLI Command Construction:
       - Tool: ${tool_flag || 'gemini'} (qwen fallback, codex for deep analysis)
       - Context: @CLAUDE.md + auto-detected patterns + discovered files
       - Mode: analysis (read-only)
       - Expected: Insights, recommendations, pattern analysis

    4. Execution & Output:
       - Execute CLI tool with assembled context
       - Generate comprehensive analysis report
       - Save to .workflow/WFS-[id]/.chat/analyze-[timestamp].md (or .scratchpad/)
  `
)

Core Rules

  • Read-only: Analyzes code, does NOT modify files
  • Auto-pattern: Detects file patterns from keywords (auth→auth files, component→components, API→api/routes, test→test files)
  • Output: .workflow/WFS-[id]/.chat/analyze-[timestamp].md (or .scratchpad/ if no session)