# gitignore-generator A CLI tool that automatically generates `.gitignore` files based on project type, tech stack, and IDE. It detects project structure, supports multiple languages/frameworks, generates IDE-specific ignores, allows customization via config file, and works offline with a curated collection. ## Features - Auto-detects project type from file structure - Multi-language/framework support (Python, JavaScript, TypeScript, Java, Go, Rust, .NET, PHP, Ruby) - Framework-specific templates (Django, Flask, React, Vue, Angular, Rails, Laravel, Spring) - IDE-specific ignore rules (VS Code, JetBrains, Visual Studio Code) - Operating system-specific ignores (Linux, macOS, Windows) - Tool-specific templates (Docker, Gradle, Maven, Jupyter, Terraform) - Interactive wizard mode for guided generation - Configuration file support for customization - Works completely offline - Append or overwrite existing `.gitignore` files ## Installation ```bash pip install gitignore-generator ``` Or install from source: ```bash git clone https://github.com/yourusername/gitignore-generator.git cd gitignore-generator pip install -e . ``` ## Usage ### Auto-detect and generate Automatically detect your project type and generate a `.gitignore`: ```bash gitignore-generator generate ``` ### Specify types manually Generate for specific types: ```bash # Single type gitignore-generator generate --language python # Multiple types gitignore-generator generate --language python --framework django --ide vscode # Using positional arguments gitignore-generator generate python django vscode ``` ### Output options Write to stdout instead of file: ```bash gitignore-generator generate python --stdout ``` Specify output file: ```bash gitignore-generator generate python -o custom.gitignore ``` Overwrite existing file: ```bash gitignore-generator generate python --overwrite ``` ### List available templates ```bash # List all templates gitignore-generator list # List by category gitignore-generator list --category language gitignore-generator list --category framework gitignore-generator list --category ide gitignore-generator list --category os gitignore-generator list --category tools ``` ### Detect project type ```bash gitignore-generator detect ``` ### Interactive wizard Run an interactive wizard for guided generation: ```bash gitignore-generator wizard ``` ### Use configuration file Specify a configuration file: ```bash gitignore-generator --config .gitignorerc generate ``` ## Configuration Create a `.gitignorerc` file in your project root or home directory: ```yaml custom_templates: my_template: | # Custom template content *.custom .custom/ default_types: - python - vscode exclude_patterns: - "*.pyc" include_patterns: python: - "src/" ``` ## Available Templates ### Languages - Python - JavaScript - TypeScript - Java - Go - Rust - .NET - PHP - Ruby ### Frameworks - Django - Flask - React - Vue - Angular - Ruby on Rails - Laravel - Spring ### IDEs - VS Code - JetBrains - Visual Studio Code ### Operating Systems - Linux - macOS - Windows ### Tools - Docker - Gradle - Maven - Jupyter - Terraform ## Development ### Setup ```bash git clone https://github.com/yourusername/gitignore-generator.git cd gitignore-generator pip install -e ".[dev]" ``` ### Running Tests ```bash pytest tests/ -v pytest tests/ --cov=src ``` ### Adding New Templates 1. Create a new `.gitignore` file in the appropriate category directory under `src/templates/` 2. Add the template to the `TEMPLATE_MAP` in `src/generator.py` 3. Add detection patterns to `src/detector.py` if applicable 4. Add tests in the appropriate test file ## License MIT License - see [LICENSE](LICENSE) file for details. ## Contributing Contributions are welcome! Please feel free to submit a Pull Request.