mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
- Removed deprecated `gemini-init.md` command and migrated its functionality to a new structure under `.claude/commands/gemini/`. - Introduced `auto-parallel.md` for parallel brainstorming automation with dynamic role selection and concurrent execution. - Added `auto-squeeze.md` for sequential command coordination in brainstorming workflows, ensuring structured execution from framework generation to synthesis. - Updated `plan.md` to improve clarity on project structure analysis and command execution strategies. - Enhanced error handling and session management across all commands to ensure robustness and user guidance. - Improved documentation for generated files and command options to facilitate user understanding and usage.
9.3 KiB
9.3 KiB
name, description, usage, argument-hint, examples
| name | description | usage | argument-hint | examples | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| gemini-init | Initialize Gemini CLI configuration with .gemini config and .geminiignore based on workspace analysis | /gemini:gemini-init [--output=<path>] [--preview] |
|
|
Gemini Initialization Command
Overview
Initializes Gemini CLI configuration for the workspace by:
- Analyzing current workspace using
get_modules_by_depth.shto identify technology stacks - Generating
.geminiignorefile with filtering rules optimized for detected technologies - Creating
.geminiconfiguration file with contextfilename and other settings
Core Functionality
Configuration Generation
- Workspace Analysis: Runs
get_modules_by_depth.shto analyze project structure - Technology Stack Detection: Identifies tech stacks based on file extensions, directories, and configuration files
- Gemini Config Creation: Generates
.geminifile with contextfilename and workspace-specific settings - Ignore Rules Generation: Creates
.geminiignorefile with filtering patterns for detected technologies
Generated Files
.gemini Configuration Directory
Creates .gemini/ directory containing configuration files:
.gemini/settings.json- Main configuration with contextfilename setting:
{
"contextfilename": "CLAUDE.md"
}
.geminiignore Filter File
Uses gitignore syntax to filter files from Gemini CLI analysis
Supported Technology Stacks
Frontend Technologies
- React/Next.js: Ignores build artifacts, .next/, node_modules
- Vue/Nuxt: Ignores .nuxt/, dist/, .cache/
- Angular: Ignores dist/, .angular/, node_modules
- Webpack/Vite: Ignores build outputs, cache directories
Backend Technologies
- Node.js: Ignores node_modules, package-lock.json, npm-debug.log
- Python: Ignores pycache, .venv, *.pyc, .pytest_cache
- Java: Ignores target/, .gradle/, *.class, .mvn/
- Go: Ignores vendor/, *.exe, go.sum (when appropriate)
- C#/.NET: Ignores bin/, obj/, *.dll, *.pdb
Database & Infrastructure
- Docker: Ignores .dockerignore, docker-compose.override.yml
- Kubernetes: Ignores *.secret.yaml, helm charts temp files
- Database: Ignores *.db, *.sqlite, database dumps
Generated Rules Structure
Base Rules (Always Included)
# Version Control
.git/
.svn/
.hg/
# OS Files
.DS_Store
Thumbs.db
*.tmp
*.swp
# IDE Files
.vscode/
.idea/
.vs/
# Logs
*.log
logs/
Technology-Specific Rules
Rules are added based on detected technologies:
Node.js Projects (package.json detected):
# Node.js
node_modules/
npm-debug.log*
.npm/
.yarn/
package-lock.json
yarn.lock
.pnpm-store/
Python Projects (requirements.txt, setup.py, pyproject.toml detected):
# Python
__pycache__/
*.py[cod]
.venv/
venv/
.pytest_cache/
.coverage
htmlcov/
Java Projects (pom.xml, build.gradle detected):
# Java
target/
.gradle/
*.class
*.jar
*.war
.mvn/
Command Options
Basic Usage
/gemini:gemini-init
- Analyzes workspace and generates
.gemini/directory withsettings.jsonand.geminiignorein current directory - Creates backup of existing files if present
- Sets contextfilename to "CLAUDE.md" by default
Preview Mode
/gemini:gemini-init --preview
- Shows what would be generated without creating files
- Displays detected technologies, configuration, and ignore rules
Custom Output Path
/gemini:gemini-init --output=.config/
- Generates files in specified directory
- Creates directories if they don't exist
EXECUTION INSTRUCTIONS ⚡ START HERE
When this command is triggered, follow these exact steps:
Step 1: Workspace Analysis (MANDATORY FIRST)
# Analyze workspace structure
bash(~/.claude/scripts/get_modules_by_depth.sh json)
Step 2: Technology Detection
# Check for common tech stack indicators
bash(find . -name "package.json" -not -path "*/node_modules/*" | head -1)
bash(find . -name "requirements.txt" -o -name "setup.py" -o -name "pyproject.toml" | head -1)
bash(find . -name "pom.xml" -o -name "build.gradle" | head -1)
bash(find . -name "Dockerfile" | head -1)
Step 3: Generate Configuration Files
# Create .gemini/ directory and settings.json config file
# Create .geminiignore file with detected technology rules
# Backup existing files if present
Step 4: Validation
# Verify generated files are valid
bash(ls -la .gemini* 2>/dev/null || echo "Configuration files created")
Implementation Process (Technical Details)
Phase 1: Workspace Analysis
- Execute
get_modules_by_depth.sh jsonto get structured project data - Parse JSON output to identify directories and files
- Scan for technology indicators:
- Configuration files (package.json, requirements.txt, etc.)
- Directory patterns (src/, tests/, etc.)
- File extensions (.js, .py, .java, etc.)
- Detect project name from directory name or package.json
Phase 2: Technology Detection
# Technology detection logic
detect_nodejs() {
[ -f "package.json" ] || find . -name "package.json" -not -path "*/node_modules/*" | head -1
}
detect_python() {
[ -f "requirements.txt" ] || [ -f "setup.py" ] || [ -f "pyproject.toml" ] || \
find . -name "*.py" -not -path "*/__pycache__/*" | head -1
}
detect_java() {
[ -f "pom.xml" ] || [ -f "build.gradle" ] || \
find . -name "*.java" | head -1
}
Phase 3: Configuration Generation
- Gemini Config (.gemini/ directory):
- Create
.gemini/directory if it doesn't exist - Generate
settings.jsonwith contextfilename setting - Set contextfilename to "CLAUDE.md" by default
- Create
Phase 4: Ignore Rules Generation
- Start with base rules (always included)
- Add technology-specific rules based on detection
- Add workspace-specific patterns if found
- Sort and deduplicate rules
Phase 5: File Creation
- Generate .gemini/ directory and settings.json: Create directory structure and JSON configuration file
- Generate .geminiignore: Create organized ignore file with sections
- Create backups: Backup existing files if present
- Validate: Check generated files are valid
Generated File Format
# .geminiignore
# Generated by Claude Code gemini:gemini-ignore command
# Creation date: 2024-01-15 10:30:00
# Detected technologies: Node.js, Python, Docker
#
# This file uses gitignore syntax to filter files for Gemini CLI analysis
# Edit this file to customize filtering rules for your project
# ============================================================================
# Base Rules (Always Applied)
# ============================================================================
# Version Control
.git/
.svn/
.hg/
# ============================================================================
# Node.js (Detected: package.json found)
# ============================================================================
node_modules/
npm-debug.log*
.npm/
yarn-error.log
package-lock.json
# ============================================================================
# Python (Detected: requirements.txt, *.py files found)
# ============================================================================
__pycache__/
*.py[cod]
.venv/
.pytest_cache/
.coverage
# ============================================================================
# Docker (Detected: Dockerfile found)
# ============================================================================
.dockerignore
docker-compose.override.yml
# ============================================================================
# Custom Rules (Add your project-specific rules below)
# ============================================================================
Error Handling
Missing Dependencies
- If
get_modules_by_depth.shnot found, show error with path to script - Gracefully handle cases where script fails
Write Permissions
- Check write permissions before attempting file creation
- Show clear error message if cannot write to target location
Backup Existing Files
- If
.gemini/directory exists, create backup as.gemini.backup/ - If
.geminiignoreexists, create backup as.geminiignore.backup - Include timestamp in backup filename
Integration Points
Workflow Commands
- After
/gemini:plan: Suggest running gemini-ignore for better analysis - Before analysis: Recommend updating ignore patterns for cleaner results
CLI Tool Integration
- Automatically update when new technologies detected
- Integrate with
intelligent-tools-strategy.mdrecommendations
Usage Examples
Basic Project Setup
# New project - initialize Gemini configuration
/gemini:gemini-init
# Preview what would be generated
/gemini:gemini-init --preview
# Generate in subdirectory
/gemini:gemini-init --output=.config/
Technology Migration
# After adding new tech stack (e.g., Docker)
/gemini:gemini-init # Regenerates both config and ignore files with new rules
# Check what changed
/gemini:gemini-init --preview # Compare with existing configuration
Key Benefits
- Automatic Detection: No manual configuration needed
- Technology Aware: Rules adapted to actual project stack
- Maintainable: Clear sections for easy customization
- Consistent: Follows gitignore syntax standards
- Safe: Creates backups of existing files