Summary
Respect .gitignore patterns when listing files, loading context, and showing file picker.
Why It's Needed
- Context Quality: Don't waste tokens on node_modules, build artifacts
- File Picker UX: Don't show irrelevant files in @ picker
- Search Quality: Grep/glob results exclude ignored files
- Performance: Skip large ignored directories
Current Problem
@ file picker shows:
├── node_modules/ # 50,000+ files
├── dist/ # Build artifacts
├── .git/ # Git internals
├── coverage/ # Test coverage
└── src/ # Actual source
Proposed Behavior
@ file picker shows:
└── src/ # Only relevant files
├── index.ts
├── services/
└── utils/
Implementation
import ignore from "ignore"
async function loadIgnorePatterns(cwd: string): Promise<Ignore> {
const ig = ignore()
// Load .gitignore
const gitignore = await readFile(path.join(cwd, ".gitignore"), "utf-8").catch(() => "")
ig.add(gitignore)
// Load .codetyperignore (custom ignore)
const codetyperignore = await readFile(path.join(cwd, ".codetyperignore"), "utf-8").catch(() => "")
ig.add(codetyperignore)
// Always ignore these
ig.add([
"node_modules",
".git",
"dist",
"build",
"coverage",
".codetyper-backup",
])
return ig
}
function filterFiles(files: string[], ig: Ignore): string[] {
return files.filter(f => !ig.ignores(f))
}
Apply To
Configuration
{
"ignore": {
"useGitignore": true,
"useCodyterignore": true,
"additional": ["*.log", "tmp/"]
}
}
Acceptance Criteria
Effort Estimate
0.5 days
Summary
Respect .gitignore patterns when listing files, loading context, and showing file picker.
Why It's Needed
Current Problem
Proposed Behavior
Implementation
Apply To
@mentions)Configuration
{ "ignore": { "useGitignore": true, "useCodyterignore": true, "additional": ["*.log", "tmp/"] } }Acceptance Criteria
Effort Estimate
0.5 days