Choose files
Directory discovery respects .gitignore, .ignore, and common and
language-specific exclusions for dependencies, caches, lockfiles, and build
output. Hidden files are included by default, while symlinks are skipped.
Choose a directory or explicit files
With no paths, ContextCraft scans the current directory. Supply one directory to scan elsewhere, or several repository-relative files to select inputs directly:
contextcraft ../service --budget 8000 -o context.md
contextcraft src/main.py src/auth.py --budget 4000
Explicit files are relative to the current directory and must stay within it. They bypass discovery exclusions. Directories cannot be mixed with files, and symlinks and special files cannot be explicit inputs.
Exclude paths
Repeat --exclude with repository-relative .gitignore patterns:
contextcraft . --exclude 'tests/fixtures/' --exclude '*.generated.py' -o context.md
Each option accepts one pattern, without negation or embedded newlines. Patterns
from the CLI extend exclude_patterns in the configuration file.
Change discovery defaults
| Option | Effect |
|---|---|
--no-default-excludes | Disable common and language-specific defaults |
--no-gitignore | Ignore .gitignore and .ignore rules |
--no-hidden | Exclude hidden paths |
--default-excludes, --gitignore, --hidden | Re-enable a setting disabled in configuration |
Gradle, Maven, and C# build output can also be filtered beside their project
manifests. --no-default-excludes disables that filtering along with the common
rules, while explicit file inputs bypass discovery exclusions entirely.
Bound source loading
The default source limit is 16 MiB per file:
contextcraft . --max-file-size 1MiB -o context.md
KB, MB, and GB use powers of 1000, while KiB, MiB, and GiB use powers of 1024. Units are case-insensitive and take integer values. A zero limit keeps non-empty files path-only, as do binary, invalid UTF-8, and oversized inputs.
Missing or unreadable inputs fail the CLI, including read failures during a directory scan. Library scanner callers can inspect individual omissions when partial results are useful.
Output paths
An output inside the scanned directory is excluded by exact path even when default exclusions are disabled, with glob characters treated literally. Output cannot replace an explicitly selected input file, and failed generation or writes preserve the previous artifact.