mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
- Create new workflow command to initialize Gemini CLI configuration - Generates .gemini file with contextfilename set to "CLAUDE.md" - Creates .geminiignore with technology-specific filtering rules - Uses get_modules_by_depth.sh for workspace analysis and tech stack detection - Supports preview mode and custom output paths - Includes backup functionality for existing files - Supports major tech stacks: Node.js, Python, Java, Docker, etc. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
8.1 KiB
8.1 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 | /workflow: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 File
Contains Gemini CLI 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
/workflow:gemini-init
- Analyzes workspace and generates
.geminiand.geminiignorein current directory - Creates backup of existing files if present
- Sets contextfilename to "CLAUDE.md" by default
Preview Mode
/workflow:gemini-init --preview
- Shows what would be generated without creating files
- Displays detected technologies, configuration, and ignore rules
Custom Output Path
/workflow:gemini-init --output=.config/
- Generates files in specified directory
- Creates directories if they don't exist
Implementation Process
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):
- Generate simple JSON config with contextfilename setting
- Set contextfilename to "CLAUDE.md" by default
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 config: Write 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 workflow: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
.geminiignoreexists, create backup as.geminiignore.backup - Include timestamp in backup filename
Integration Points
Workflow Commands
- After
/workflow: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
/workflow:gemini-init
# Preview what would be generated
/workflow:gemini-init --preview
# Generate in subdirectory
/workflow:gemini-init --output=.config/
Technology Migration
# After adding new tech stack (e.g., Docker)
/workflow:gemini-init # Regenerates both config and ignore files with new rules
# Check what changed
/workflow: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