docs: Wrap all CLI commands with bash() in agents and workflows

Updated all CLI command examples across agent documentation and workflow
guides to use bash() wrapper for proper tool execution:

- Modified action-planning-agent.md CLI usage standards
- Updated code-developer.md analysis CLI commands
- Enhanced conceptual-planning-agent.md execution logic
- Revised code-review-test-agent.md CLI commands
- Wrapped all gemini-wrapper calls in gemini-unified.md
- Updated all codex commands in codex-unified.md

This ensures consistent tool execution patterns across all documentation
and provides clear guidance for proper CLI tool invocation.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-09-14 00:11:04 +08:00
parent 4af6a59092
commit fc8a0e69f8
6 changed files with 101 additions and 84 deletions

View File

@@ -42,8 +42,8 @@ You are a pure execution agent specialized in creating actionable implementation
``` ```
**Analysis CLI Usage Standards**: **Analysis CLI Usage Standards**:
- **Gemini CLI**: Use task-specific paths: `~/.claude/scripts/gemini-wrapper -p "$(.claude/scripts/read-task-paths.sh [task-json-file]) @{CLAUDE.md}" ` - **Gemini CLI**: Use task-specific paths: `bash(~/.claude/scripts/gemini-wrapper -p "$(.claude/scripts/read-task-paths.sh [task-json-file]) @{CLAUDE.md}")`
- **Codex CLI**: Use task-specific paths: `codex --full-auto exec "$(.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]"` - **Codex CLI**: Use task-specific paths: `bash(codex --full-auto exec "$(.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]")`
- **Follow Guidelines**: @~/.claude/workflows/gemini-unified.md and @~/.claude/workflows/codex-unified.md - **Follow Guidelines**: @~/.claude/workflows/gemini-unified.md and @~/.claude/workflows/codex-unified.md
### Deep Analysis Execution ### Deep Analysis Execution

View File

@@ -56,8 +56,8 @@ ELIF context insufficient OR task has analysis marker:
- **Purpose**: Enables autonomous development with intelligent file discovery and code generation - **Purpose**: Enables autonomous development with intelligent file discovery and code generation
**Analysis CLI Usage Standards**: **Analysis CLI Usage Standards**:
- **Gemini CLI**: Use task-specific paths from JSON: `~/.claude/scripts/gemini-wrapper -p "$(~/.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]" ` - **Gemini CLI**: Use task-specific paths from JSON: `bash(~/.claude/scripts/gemini-wrapper -p "$(~/.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]")`
- **Codex CLI**: Use task-specific paths from JSON: `codex --full-auto exec "$(~/.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]"` - **Codex CLI**: Use task-specific paths from JSON: `bash(codex --full-auto exec "$(~/.claude/scripts/read-task-paths.sh [task-json-file]) [prompt]")`
- **Follow Guidelines**: @~/.claude/workflows/gemini-unified.md and @~/.claude/workflows/codex-unified.md - **Follow Guidelines**: @~/.claude/workflows/gemini-unified.md and @~/.claude/workflows/codex-unified.md

View File

@@ -78,7 +78,7 @@ Use the targeted review context template:
**Gemini CLI Command**: **Gemini CLI Command**:
```bash ```bash
~/.claude/scripts/gemini-wrapper -p "$(.claude/scripts/read-task-paths.sh [task-json-file]) @{CLAUDE.md} [review-analysis-prompt]" bash(~/.claude/scripts/gemini-wrapper -p "$(.claude/scripts/read-task-paths.sh [task-json-file]) @{CLAUDE.md} [review-analysis-prompt]")
``` ```
This executes a change-specific Gemini CLI command that identifies: This executes a change-specific Gemini CLI command that identifies:
@@ -96,7 +96,7 @@ Use the autonomous development context template:
**Codex CLI Command**: **Codex CLI Command**:
```bash ```bash
codex --full-auto exec "$(.claude/scripts/read-task-paths.sh [task-json-file]) [autonomous-review-prompt]" bash(codex --full-auto exec "$(.claude/scripts/read-task-paths.sh [task-json-file]) [autonomous-review-prompt]")
``` ```
This executes autonomous Codex CLI analysis that provides: This executes autonomous Codex CLI analysis that provides:

View File

@@ -53,7 +53,7 @@ def handle_analysis_markers(prompt):
if "[GEMINI_CLI_REQUIRED]" in prompt: if "[GEMINI_CLI_REQUIRED]" in prompt:
for dimension in dimensions: for dimension in dimensions:
result = execute_gemini_cli( result = execute_gemini_cli(
command=f"~/.claude/scripts/gemini-wrapper -p \"$(.claude/scripts/read-task-paths.sh [task-json-file]) @{{CLAUDE.md}} {dimension}\"", command=f"bash(~/.claude/scripts/gemini-wrapper -p \"$(.claude/scripts/read-task-paths.sh [task-json-file]) @{{CLAUDE.md}} {dimension}\")",
dimension=dimension, dimension=dimension,
role_context=role, role_context=role,
topic=topic topic=topic
@@ -62,7 +62,7 @@ def handle_analysis_markers(prompt):
elif "[CODEX_CLI_REQUIRED]" in prompt: elif "[CODEX_CLI_REQUIRED]" in prompt:
result = execute_codex_cli( result = execute_codex_cli(
command=f"codex --full-auto exec \"$(.claude/scripts/read-task-paths.sh [task-json-file]) {topic}\"", command=f"bash(codex --full-auto exec \"$(.claude/scripts/read-task-paths.sh [task-json-file]) {topic}\")",
autonomous_analysis=True, autonomous_analysis=True,
role_context=role, role_context=role,
topic=topic topic=topic

View File

@@ -8,7 +8,7 @@ type: technical-guideline
- **Purpose**: An AI-powered CLI tool for automated codebase analysis, intelligent code generation, and autonomous development workflows. - **Purpose**: An AI-powered CLI tool for automated codebase analysis, intelligent code generation, and autonomous development workflows.
- **Key Characteristic**: **No `--all-files` flag** - requires explicit `@` pattern references for file inclusion. - **Key Characteristic**: **No `--all-files` flag** - requires explicit `@` pattern references for file inclusion.
- **Directory Analysis Rule**: When user intends to analyze specific directory (cd XXX), use: `codex --cd XXX --full-auto exec "prompt"` or `cd XXX && codex --full-auto exec "@{**/*} prompt"` - **Directory Analysis Rule**: When user intends to analyze specific directory (cd XXX), use: `bash(codex --cd XXX --full-auto exec "prompt")` or `bash(cd XXX && codex --full-auto exec "@{**/*} prompt")`
- **Default Mode**: `--full-auto exec` autonomous development mode (RECOMMENDED for all tasks). - **Default Mode**: `--full-auto exec` autonomous development mode (RECOMMENDED for all tasks).
- **Primary Triggers**: - **Primary Triggers**:
- When user needs automated code generation or refactoring. - When user needs automated code generation or refactoring.
@@ -22,16 +22,16 @@ type: technical-guideline
### ⭐ **CRITICAL: Default to `--full-auto` Mode** ### ⭐ **CRITICAL: Default to `--full-auto` Mode**
> **🎯 Golden Rule**: Always start with `codex --full-auto exec "your task description"` for maximum autonomous capabilities. This is the recommended approach for 90% of development tasks. > **🎯 Golden Rule**: Always start with `bash(codex --full-auto exec "your task description")` for maximum autonomous capabilities. This is the recommended approach for 90% of development tasks.
**Why `--full-auto` Should Be Your Default:** **Why `bash(codex --full-auto)` Should Be Your Default:**
- **🧠 Intelligent File Discovery**: Codex automatically identifies relevant files without manual `@` patterns - **🧠 Intelligent File Discovery**: Codex automatically identifies relevant files without manual `@` patterns
- **🎯 Context-Aware Execution**: Understands project structure and dependencies autonomously - **🎯 Context-Aware Execution**: Understands project structure and dependencies autonomously
- **⚡ Streamlined Workflow**: No need to specify file patterns - just describe what you want - **⚡ Streamlined Workflow**: No need to specify file patterns - just describe what you want
- **🚀 Maximum Automation**: Leverages full autonomous development capabilities - **🚀 Maximum Automation**: Leverages full autonomous development capabilities
- **📚 Smart Documentation**: Automatically includes relevant CLAUDE.md files and project context - **📚 Smart Documentation**: Automatically includes relevant CLAUDE.md files and project context
**When to Use `codex --full-auto exec` with Explicit Patterns:** **When to Use `bash(codex --full-auto exec)` with Explicit Patterns:**
- ✅ When you need precise control over which files are included - ✅ When you need precise control over which files are included
- ✅ When working with specific file patterns that require manual specification - ✅ When working with specific file patterns that require manual specification
- ✅ When debugging issues with file discovery in `--full-auto` mode - ✅ When debugging issues with file discovery in `--full-auto` mode
@@ -41,30 +41,30 @@ type: technical-guideline
- **Basic Structure** (Priority Order): - **Basic Structure** (Priority Order):
```bash ```bash
codex --full-auto exec "autonomous development task" # DEFAULT & RECOMMENDED bash(codex --full-auto exec "autonomous development task") # DEFAULT & RECOMMENDED
codex --full-auto exec "prompt with @{patterns}" # For specific control needs bash(codex --full-auto exec "prompt with @{patterns}") # For specific control needs
``` ```
- **Key Commands** (In Order of Preference): - **Key Commands** (In Order of Preference):
- `codex --full-auto exec "..."` ⭐ **PRIMARY MODE** - Full autonomous development - `bash(codex --full-auto exec "...")` ⭐ **PRIMARY MODE** - Full autonomous development
- `codex --full-auto exec "..."` - Controlled execution when you need specific patterns - `bash(codex --full-auto exec "...")` - Controlled execution when you need specific patterns
- `codex --cd /path --full-auto exec "..."` - Directory-specific autonomous development - `bash(codex --cd /path --full-auto exec "...")` - Directory-specific autonomous development
- `codex --cd /path --full-auto exec "@{patterns} ..."` - Directory-specific execution with patterns - `bash(codex --cd /path --full-auto exec "@{patterns} ...")` - Directory-specific execution with patterns
- **Template Usage** (Preferred Approaches): - **Template Usage** (Preferred Approaches):
```bash ```bash
# RECOMMENDED: Full autonomous mode (let Codex handle file discovery) # RECOMMENDED: Full autonomous mode (let Codex handle file discovery)
codex --full-auto exec "Refactor authentication system using best practices" bash(codex --full-auto exec "Refactor authentication system using best practices")
# Alternative: Direct execution with explicit patterns # Alternative: Direct execution with explicit patterns
codex --full-auto exec "@{src/**/*} @{CLAUDE.md} Refactor authentication system" bash(codex --full-auto exec "@{src/**/*} @{CLAUDE.md} Refactor authentication system")
# Advanced: Template injection with autonomous mode # Advanced: Template injection with autonomous mode
codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt) bash(codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt)
## Task: Authentication System Refactoring ## Task: Authentication System Refactoring
- Apply modern security patterns - Apply modern security patterns
- Improve code organization - Improve code organization
- Add comprehensive tests" - Add comprehensive tests")
``` ```
### 📂 File Pattern Rules - **CRITICAL FOR CODEX** ### 📂 File Pattern Rules - **CRITICAL FOR CODEX**
@@ -111,62 +111,62 @@ type: technical-guideline
- **Module-Specific Development** - **Module-Specific Development**
```bash ```bash
# RECOMMENDED: Full autonomous mode with directory context # RECOMMENDED: Full autonomous mode with directory context
codex --cd src/auth --full-auto exec "Refactor authentication module using latest patterns" bash(codex --cd src/auth --full-auto exec "Refactor authentication module using latest patterns")
# Alternative: Full autonomous mode with explicit task description # Alternative: Full autonomous mode with explicit task description
codex --full-auto exec "Refactor the authentication module in src/auth/ using latest security patterns" bash(codex --full-auto exec "Refactor the authentication module in src/auth/ using latest security patterns")
# Fallback: Explicit patterns when autonomous mode needs guidance # Fallback: Explicit patterns when autonomous mode needs guidance
codex --full-auto exec "@{src/auth/**/*,CLAUDE.md} Refactor authentication module using latest patterns" bash(codex --full-auto exec "@{src/auth/**/*,CLAUDE.md} Refactor authentication module using latest patterns")
# Alternative: Directory-specific execution with explicit patterns # Alternative: Directory-specific execution with explicit patterns
codex --cd src/auth --full-auto exec "@{**/*,../../CLAUDE.md} Refactor authentication module using latest patterns" bash(codex --cd src/auth --full-auto exec "@{**/*,../../CLAUDE.md} Refactor authentication module using latest patterns")
``` ```
- **Basic Development Task** - **Basic Development Task**
```bash ```bash
# RECOMMENDED: Let Codex handle everything autonomously # RECOMMENDED: Let Codex handle everything autonomously
codex --full-auto exec "Implement user authentication with JWT tokens" bash(codex --full-auto exec "Implement user authentication with JWT tokens")
# Alternative: Explicit file patterns if needed # Alternative: Explicit file patterns if needed
codex --full-auto exec "@{src/**/*,*.json,CLAUDE.md} Implement user authentication with JWT" bash(codex --full-auto exec "@{src/**/*,*.json,CLAUDE.md} Implement user authentication with JWT")
``` ```
- **Template-Enhanced Development** - **Template-Enhanced Development**
```bash ```bash
# RECOMMENDED: Autonomous mode with template guidance # RECOMMENDED: Autonomous mode with template guidance
codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt) bash(codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt)
## Task: User Authentication System ## Task: User Authentication System
- JWT token management - JWT token management
- Role-based access control - Role-based access control
- Password reset functionality" - Password reset functionality")
# Alternative: Explicit patterns with templates # Alternative: Explicit patterns with templates
codex --full-auto exec "@{src/**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt)" bash(codex --full-auto exec "@{src/**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt)")
``` ```
- **Full Auto Mode (PRIMARY RECOMMENDATION)** - **Full Auto Mode (PRIMARY RECOMMENDATION)**
```bash ```bash
# OPTIMAL: Let Codex discover files and handle everything # OPTIMAL: Let Codex discover files and handle everything
codex --full-auto exec "Create a complete todo application with React and TypeScript" bash(codex --full-auto exec "Create a complete todo application with React and TypeScript")
# Alternative: Explicit patterns if you want to control file scope # Alternative: Explicit patterns if you want to control file scope
codex --full-auto exec "@{**/*} Create a complete todo application with React and TypeScript" bash(codex --full-auto exec "@{**/*} Create a complete todo application with React and TypeScript")
``` ```
- **Debugging & Analysis** - **Debugging & Analysis**
```bash ```bash
# RECOMMENDED: Autonomous debugging mode # RECOMMENDED: Autonomous debugging mode
codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/debugging.txt) bash(codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/debugging.txt)
## Issue: Performance degradation in user dashboard ## Issue: Performance degradation in user dashboard
- Identify bottlenecks in the codebase - Identify bottlenecks in the codebase
- Propose and implement optimizations - Propose and implement optimizations
- Add performance monitoring" - Add performance monitoring")
# Alternative: Explicit patterns for controlled analysis # Alternative: Explicit patterns for controlled analysis
codex --full-auto exec "@{src/**/*,package.json,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/debugging.txt)" bash(codex --full-auto exec "@{src/**/*,package.json,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/debugging.txt)")
``` ```
### ⭐ Best Practices & Rules ### ⭐ Best Practices & Rules
@@ -180,10 +180,10 @@ type: technical-guideline
- **Be selective**: Use specific patterns like `@{src/**/*.ts}` for targeted analysis - **Be selective**: Use specific patterns like `@{src/**/*.ts}` for targeted analysis
**Default Automation Mode (CRITICAL GUIDANCE):** **Default Automation Mode (CRITICAL GUIDANCE):**
- **`--full-auto exec` is the PRIMARY choice**: Use for 90% of all tasks - maximizes autonomous capabilities - **`bash(codex --full-auto exec)` is the PRIMARY choice**: Use for 90% of all tasks - maximizes autonomous capabilities
- **`codex --full-auto exec` with explicit patterns only when necessary**: Reserve for cases where you need explicit file pattern control - **`bash(codex --full-auto exec)` with explicit patterns only when necessary**: Reserve for cases where you need explicit file pattern control
- **Trust the autonomous intelligence**: Codex excels at file discovery, context gathering, and architectural decisions - **Trust the autonomous intelligence**: Codex excels at file discovery, context gathering, and architectural decisions
- **Start with `--full-auto exec` always**: If it doesn't meet needs, then consider explicit patterns with `exec` mode - **Start with `bash(codex --full-auto exec)` always**: If it doesn't meet needs, then consider explicit patterns with `exec` mode
#### 📋 CLAUDE.md Loading Rules #### 📋 CLAUDE.md Loading Rules
@@ -231,38 +231,38 @@ type: technical-guideline
**Pre-Development Analysis:** **Pre-Development Analysis:**
```bash ```bash
# RECOMMENDED: Autonomous pattern analysis # RECOMMENDED: Autonomous pattern analysis
codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt) bash(codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)
Analyze the existing codebase patterns and conventions before implementing new features." Analyze the existing codebase patterns and conventions before implementing new features.")
# Alternative: Explicit patterns if needed # Alternative: Explicit patterns if needed
codex --full-auto exec "@{src/**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)" bash(codex --full-auto exec "@{src/**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)")
``` ```
**Feature Development:** **Feature Development:**
```bash ```bash
# RECOMMENDED: Full autonomous feature development # RECOMMENDED: Full autonomous feature development
codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt) bash(codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt)
## Feature: Advanced Search Functionality ## Feature: Advanced Search Functionality
- Full-text search capabilities - Full-text search capabilities
- Filter and sort options - Filter and sort options
- Performance optimization - Performance optimization
- Integration with existing UI components" - Integration with existing UI components")
# Alternative: Explicit patterns when needed # Alternative: Explicit patterns when needed
codex --full-auto exec "@{**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt)" bash(codex --full-auto exec "@{**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/feature.txt)")
``` ```
**Quality Assurance:** **Quality Assurance:**
```bash ```bash
# RECOMMENDED: Autonomous testing and validation # RECOMMENDED: Autonomous testing and validation
codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/testing.txt) bash(codex --full-auto exec "$(cat ~/.claude/workflows/cli-templates/prompts/development/testing.txt)
Generate comprehensive tests and perform validation for the entire codebase." Generate comprehensive tests and perform validation for the entire codebase.")
# Alternative: Specific test scope control # Alternative: Specific test scope control
codex --full-auto exec "@{src/**/*,test/**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/testing.txt)" bash(codex --full-auto exec "@{src/**/*,test/**/*,CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/development/testing.txt)")
``` ```
### 🎨 Advanced Usage Patterns ### 🎨 Advanced Usage Patterns
@@ -270,25 +270,25 @@ codex --full-auto exec "@{src/**/*,test/**/*,CLAUDE.md} $(cat ~/.claude/workflow
**Multi-Phase Development (Full Autonomous Workflow):** **Multi-Phase Development (Full Autonomous Workflow):**
```bash ```bash
# Phase 1: Autonomous Analysis # Phase 1: Autonomous Analysis
codex --full-auto exec "Analyze current architecture for payment system integration" bash(codex --full-auto exec "Analyze current architecture for payment system integration")
# Phase 2: Autonomous Implementation (RECOMMENDED APPROACH) # Phase 2: Autonomous Implementation (RECOMMENDED APPROACH)
codex --full-auto exec "Implement Stripe payment integration based on the analyzed architecture" bash(codex --full-auto exec "Implement Stripe payment integration based on the analyzed architecture")
# Phase 3: Autonomous Testing # Phase 3: Autonomous Testing
codex --full-auto exec "Generate comprehensive tests for the payment system implementation" bash(codex --full-auto exec "Generate comprehensive tests for the payment system implementation")
# Alternative: Explicit control when needed # Alternative: Explicit control when needed
codex --full-auto exec "@{**/*,CLAUDE.md} Analyze current architecture for payment system integration" bash(codex --full-auto exec "@{**/*,CLAUDE.md} Analyze current architecture for payment system integration")
``` ```
**Cross-Project Learning:** **Cross-Project Learning:**
```bash ```bash
# RECOMMENDED: Autonomous cross-project pattern learning # RECOMMENDED: Autonomous cross-project pattern learning
codex --full-auto exec "Implement feature X by learning patterns from ../other-project/ and applying them to the current codebase" bash(codex --full-auto exec "Implement feature X by learning patterns from ../other-project/ and applying them to the current codebase")
# Alternative: Explicit pattern specification # Alternative: Explicit pattern specification
codex --full-auto exec "@{../other-project/src/**/*,src/**/*,CLAUDE.md} Implement feature X using patterns from other-project" bash(codex --full-auto exec "@{../other-project/src/**/*,src/**/*,CLAUDE.md} Implement feature X using patterns from other-project")
``` ```
Remember: **Codex excels at autonomous development** - `--full-auto exec` mode should be your default choice. Trust its intelligence for file discovery, context gathering, and implementation decisions. Use explicit `@` patterns with `--full-auto exec` only when you need precise control over file scope. Remember: **Codex excels at autonomous development** - `bash(codex --full-auto exec)` mode should be your default choice. Trust its intelligence for file discovery, context gathering, and implementation decisions. Use explicit `@` patterns with `bash(codex --full-auto exec)` only when you need precise control over file scope.

View File

@@ -17,7 +17,11 @@ type: technical-guideline
- Architectural analysis and pattern detection. - Architectural analysis and pattern detection.
- Identification of coding standards and conventions. - Identification of coding standards and conventions.
### 🎯 Intelligent Wrapper: `gemini-wrapper` ## ⭐ **RECOMMENDED: Use `gemini-wrapper` as Primary Method**
> **🎯 Core Recommendation**: Always use `gemini-wrapper` instead of direct `gemini` commands. This intelligent wrapper handles token limits, approval modes, and error management automatically.
### 🎯 Intelligent Wrapper: `gemini-wrapper` (PRIMARY METHOD)
- **Purpose**: Smart wrapper that automatically manages `--all-files` flag and approval modes based on project analysis - **Purpose**: Smart wrapper that automatically manages `--all-files` flag and approval modes based on project analysis
- **Location**: `~/.claude/scripts/gemini-wrapper` (auto-installed) - **Location**: `~/.claude/scripts/gemini-wrapper` (auto-installed)
@@ -33,6 +37,21 @@ type: technical-guideline
- **Benefits**: Prevents token limits, optimizes approval workflow, provides error tracking - **Benefits**: Prevents token limits, optimizes approval workflow, provides error tracking
- **Setup**: Script auto-installs to `~/.claude/scripts/` location - **Setup**: Script auto-installs to `~/.claude/scripts/` location
**⚡ Quick Start Examples:**
```bash
# RECOMMENDED: Let wrapper handle everything automatically
bash(~/.claude/scripts/gemini-wrapper -p "Analyze authentication patterns")
# Analysis task - wrapper auto-detects and uses --approval-mode default
bash(~/.claude/scripts/gemini-wrapper -p "Review code quality and conventions")
# Development task - wrapper auto-detects and uses --approval-mode yolo
bash(~/.claude/scripts/gemini-wrapper -p "Implement user dashboard feature")
# Directory-specific analysis
bash(cd src/auth && ~/.claude/scripts/gemini-wrapper -p "Analyze module patterns")
```
### ⚙️ Command Syntax & Arguments ### ⚙️ Command Syntax & Arguments
- **Basic Structure**: - **Basic Structure**:
@@ -50,19 +69,19 @@ type: technical-guideline
- **Template Usage**: - **Template Usage**:
```bash ```bash
# Without template (manual prompt) # Without template (manual prompt)
gemini --all-files -p "@{src/**/*} @{CLAUDE.md} Analyze code patterns and conventions" bash(gemini --all-files -p "@{src/**/*} @{CLAUDE.md} Analyze code patterns and conventions")
# With template (recommended) # With template (recommended)
gemini --all-files -p "@{src/**/*} @{CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)" bash(gemini --all-files -p "@{src/**/*} @{CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)")
# Multi-template composition # Multi-template composition
gemini --all-files -p "@{src/**/*} @{CLAUDE.md} $(cat <<'EOF' bash(gemini --all-files -p "@{src/**/*} @{CLAUDE.md} $(cat <<'EOF'
$(cat ~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt) $(cat ~/.claude/workflows/cli-templates/prompts/analysis/architecture.txt)
Additional Security Focus: Additional Security Focus:
$(cat ~/.claude/workflows/cli-templates/prompts/analysis/security.txt) $(cat ~/.claude/workflows/cli-templates/prompts/analysis/security.txt)
EOF EOF
)" )")
``` ```
@@ -105,54 +124,54 @@ type: technical-guideline
### 📦 Standard Command Structures ### 📦 Standard Command Structures
These are recommended command templates for common scenarios. > **⚠️ IMPORTANT**: Use `gemini-wrapper` for 90% of all tasks. Only use direct `gemini` commands when you need explicit manual control.
#### 🎯 Using Intelligent Wrapper (Recommended) #### 🎯 Using Intelligent Wrapper (PRIMARY CHOICE - 90% of tasks)
- **Automatic Token & Approval Management** - **Automatic Token & Approval Management**
```bash ```bash
# Analysis task - auto adds --approval-mode default # Analysis task - auto adds --approval-mode default
~/.claude/scripts/gemini-wrapper -p "Analyze authentication module patterns and implementation" bash(~/.claude/scripts/gemini-wrapper -p "Analyze authentication module patterns and implementation")
# Execution task - auto adds --approval-mode yolo # Execution task - auto adds --approval-mode yolo
~/.claude/scripts/gemini-wrapper -p "Implement user login feature with JWT tokens" bash(~/.claude/scripts/gemini-wrapper -p "Implement user login feature with JWT tokens")
# Navigate to specific directory with wrapper # Navigate to specific directory with wrapper
cd src/auth && ~/.claude/scripts/gemini-wrapper -p "Review authentication patterns" bash(cd src/auth && ~/.claude/scripts/gemini-wrapper -p "Review authentication patterns")
# Override token threshold if needed # Override token threshold if needed
GEMINI_TOKEN_LIMIT=500000 ~/.claude/scripts/gemini-wrapper -p "Custom threshold analysis" bash(GEMINI_TOKEN_LIMIT=500000 ~/.claude/scripts/gemini-wrapper -p "Custom threshold analysis")
# Multi-directory support with wrapper # Multi-directory support with wrapper
~/.claude/scripts/gemini-wrapper --include-directories /path/to/other/project -p "Cross-project analysis" bash(~/.claude/scripts/gemini-wrapper --include-directories /path/to/other/project -p "Cross-project analysis")
``` ```
- **Module-Specific Analysis (Quick Module Analysis)** - **Module-Specific Analysis (Quick Module Analysis)**
```bash ```bash
# Navigate to module directory for focused analysis # Navigate to module directory for focused analysis
cd src/auth && ~/.claude/scripts/gemini-wrapper -p "Analyze authentication module patterns and implementation" bash(cd src/auth && ~/.claude/scripts/gemini-wrapper -p "Analyze authentication module patterns and implementation")
# Or specify module from root directory # Or specify module from root directory
cd backend/services && ~/.claude/scripts/gemini-wrapper -p "Review service architecture and dependencies" bash(cd backend/services && ~/.claude/scripts/gemini-wrapper -p "Review service architecture and dependencies")
# Template-enhanced module analysis with wrapper # Template-enhanced module analysis with wrapper
cd frontend/components && ~/.claude/scripts/gemini-wrapper -p "$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)" bash(cd frontend/components && ~/.claude/scripts/gemini-wrapper -p "$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)")
``` ```
#### 📝 Direct Gemini Usage (Manual Control) #### 📝 Direct Gemini Usage (Manual Control - Use Only When Needed)
- **Manual Token Management** - **Manual Token Management**
```bash ```bash
# Direct gemini usage when you want explicit control # Direct gemini usage when you want explicit control
gemini --all-files -p "Analyze authentication module patterns and implementation" bash(gemini --all-files -p "Analyze authentication module patterns and implementation")
# Fallback when wrapper suggests pattern usage # Fallback when wrapper suggests pattern usage
gemini -p "@{src/auth/**/*} @{CLAUDE.md} Analyze authentication patterns" bash(gemini -p "@{src/auth/**/*} @{CLAUDE.md} Analyze authentication patterns")
``` ```
- **Basic Structure (Manual Prompt)** - **Basic Structure (Manual Prompt)**
```bash ```bash
gemini --all-files -p "@{target_patterns} @{CLAUDE.md,**/*CLAUDE.md} bash(gemini --all-files -p "@{target_patterns} @{CLAUDE.md,**/*CLAUDE.md}
Context: [Analysis type] targeting @{target_patterns} Context: [Analysis type] targeting @{target_patterns}
Guidelines: Include CLAUDE.md standards Guidelines: Include CLAUDE.md standards
@@ -163,13 +182,13 @@ These are recommended command templates for common scenarios.
## Output: ## Output:
- File:line references - File:line references
- Code examples" - Code examples")
``` ```
- **Template-Enhanced (Recommended)** - **Template-Enhanced (Recommended)**
```bash ```bash
# Using a predefined template for consistent, high-quality analysis # Using a predefined template for consistent, high-quality analysis
gemini --all-files -p "@{target_patterns} @{CLAUDE.md,**/*CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt) bash(gemini --all-files -p "@{target_patterns} @{CLAUDE.md,**/*CLAUDE.md} $(cat ~/.claude/workflows/cli-templates/prompts/[category]/[template].txt)
## Analysis: ## Analysis:
1. [Point 1] 1. [Point 1]
@@ -177,13 +196,12 @@ These are recommended command templates for common scenarios.
## Output: ## Output:
- File:line references - File:line references
- Code examples" - Code examples")
"
``` ```
- **Multi-Template Composition** - **Multi-Template Composition**
```bash ```bash
gemini --all-files -p "@{src/**/*} @{CLAUDE.md} bash(gemini --all-files -p "@{src/**/*} @{CLAUDE.md}
$(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt) $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)
Additional Security Focus: Additional Security Focus:
@@ -195,8 +213,7 @@ These are recommended command templates for common scenarios.
## Output: ## Output:
- File:line references - File:line references
- Code examples" - Code examples")
"
``` ```
- **Token Limit Fallback** - **Token Limit Fallback**
@@ -204,13 +221,13 @@ These are recommended command templates for common scenarios.
# If --all-files exceeds token limits, immediately retry with targeted patterns: # If --all-files exceeds token limits, immediately retry with targeted patterns:
# Original command that failed: # Original command that failed:
gemini --all-files -p "Analyze authentication patterns" bash(gemini --all-files -p "Analyze authentication patterns")
# Fallback with specific patterns: # Fallback with specific patterns:
gemini -p "@{src/auth/**/*} @{src/middleware/**/*} @{CLAUDE.md} Analyze authentication patterns" bash(gemini -p "@{src/auth/**/*} @{src/middleware/**/*} @{CLAUDE.md} Analyze authentication patterns")
# Or focus on specific file types: # Or focus on specific file types:
gemini -p "@{**/*.ts} @{**/*.js} @{CLAUDE.md} Analyze authentication patterns" bash(gemini -p "@{**/*.ts} @{**/*.js} @{CLAUDE.md} Analyze authentication patterns")
``` ```
### ⭐ Best Practices & Rules ### ⭐ Best Practices & Rules