Ignoring files

Control which files Bob Shell can access by creating a `.bobignore` file in your project.

Overview

FeatureDescriptionBenefit
Path exclusionPrevent Bob Shell from accessing specific files or directoriesProtect sensitive information
Pattern matchingUse glob patterns to match multiple filesEfficiently exclude file types
Negation supportOverride exclusions for specific filesFine-grained control
Project-specificEach project can have its own exclusion rulesCustomized to project needs

Why use .bobignore?

  • Privacy protection: Keep sensitive files like API keys and credentials private
  • Performance improvement: Exclude large binary files or directories that slow down operations
  • Noise reduction: Remove irrelevant files from Bob Shell's context
  • Focus control: Direct Bob Shell's attention to the most relevant parts of your codebase

How .bobignore works

When you add paths to your .bobignore file, Bob Shell tools that respect this file will automatically exclude matching files and directories from their operations. For example, when using the read_many_files command, any paths in your .bobignore file will be skipped.

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│                 │     │                 │     │                 │
│  Your project   │────▶│  .bobignore     │────▶│  Files Bob Shell │
│  files          │     │  filter         │     │  can access     │
│                 │     │                 │     │                 │
└─────────────────┘     └─────────────────┘     └─────────────────┘

Changes to your .bobignore file require restarting your Bob Shell session to take effect.

Pattern syntax

The .bobignore file follows the same pattern syntax as .gitignore:

PatternDescriptionExample
file.txtMatches a specific fileapikeys.txt
*.extMatches all files with the extension*.log
/dir/Matches a directory/node_modules/
/path/to/fileAnchors the path to the root/src/config/secrets.json
!patternNegates a previous pattern!important.md
#Comment line# API credentials

Getting started

Creating a .bobignore file

  1. Create a file named .bobignore in the root of your project directory
  2. Add patterns for files and directories you want to exclude
  3. Save the file and restart your Bob Shell session
# From your project root
touch .bobignore
echo "# Files to ignore" > .bobignore
echo "secrets/" >> .bobignore

Common exclusion patterns

Here are some common patterns you might want to add to your .bobignore file:

# Sensitive information
.env
secrets/
*password*
*credential*
*apikey*

# Large directories
node_modules/
.git/
dist/
build/

# Binary and media files
*.zip
*.tar.gz
*.mp4
*.jpg
*.png

# Log files
*.log
logs/

Pattern examples

Excluding specific directories

To exclude entire directories and their contents:

# Exclude the packages directory and all its contents
/packages/

# Exclude all node_modules directories anywhere in the project
**/node_modules/

# Exclude the dist directory but only at the root level
/dist/

Using wildcards

Wildcards let you match multiple files with similar patterns:

# Exclude all markdown files
*.md

# Exclude all JavaScript files in the src directory
/src/**/*.js

# Exclude all files with "test" in their name
*test*

Using negation

You can override exclusions for specific files:

# Exclude all markdown files
*.md

# But include README.md
!README.md

# And include all markdown files in the docs directory
!docs/*.md

Advanced usage

Combining patterns

You can create sophisticated exclusion rules by combining patterns:

# Exclude all JavaScript files
*.js

# But include all files in the src directory
!src/**/*.js

# Except for test files in the src directory
src/**/*.test.js

Debugging your .bobignore file

If Bob Shell seems to be ignoring files you want it to access, or accessing files you want it to ignore:

  1. Check your .bobignore file for conflicting patterns
  2. Remember that more specific patterns (like negations) should come after general patterns
  3. Restart your Bob Shell session after making changes
  4. Use absolute paths if relative paths aren't working as expected

Best practices

  • Start simple: Begin with a few essential patterns and add more as needed
  • Comment your patterns: Add comments to explain why certain files are excluded
  • Be specific: Use precise patterns to avoid accidentally excluding important files
  • Consider security: Always exclude files containing sensitive information
  • Maintain regularly: Update your .bobignore file as your project evolves
How is this topic?