Configure file filtering with .contextfiles
mainJinni uses .contextfiles to include or exclude files and directories during context generation. These files use .gitignore-style (gitwildmatch) syntax.
Key Rules:
- Inclusion: By default, files are included unless matched by an exclusion pattern.
- Exclusion: Use
!at the start of a pattern to exclude a file or directory (e.g.,!*.tmp). - Anchoring: A leading
/anchors the pattern to the directory containing the.contextfiles. - Directories: A trailing
/indicates the pattern applies only to directories (e.g.,build/). - Recursion:
**matches zero or more directories (e.g.,src/**/*.py). - Comments: Lines starting with
#are ignored.
Rules are applied dynamically: Jinni searches for .contextfiles and .gitignore files from the project root down to the current directory being processed. Rules from higher-level directories are applied before rules in the current directory.
# Include all Python files in the src directory and subdirectories
src/**/*.py
# Include all Markdown files anywhere
*.md
# Exclude temporary files anywhere, even if they are .py or .md
!*.tmp
# Include the specific config file at the root of this context
/config.yaml
# Exclude the entire build directory relative to this file
build/