-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Problem
Context-please automatically applies ignore rules from all .xxxignore files (.dockerignore, .gitignore, .npmignore, etc.) with no mechanism to selectively disable them. This prevents indexing of critical development files needed by AI agents.
Reference Issue
This is based on upstream issue: zilliztech/claude-context#222
Core Issue
The current implementation in packages/core/src/context.ts (lines 1206-1229) automatically discovers and loads all ignore files:
private async findIgnoreFiles(codebasePath: string): Promise<string[]> {
const entries = await fs.promises.readdir(codebasePath, { withFileTypes: true })
const ignoreFiles: string[] = []
for (const entry of entries) {
if (entry.isFile()
&& entry.name.startsWith('.')
&& entry.name.endsWith('ignore')) {
ignoreFiles.push(path.join(codebasePath, entry.name))
}
}
return ignoreFiles
}This approach is inappropriate for code indexing because:
-
.dockerignoreis designed for container optimization, not code analysis- Production containers often use patterns like
*with!out/to exclude everything except build artifacts - This excludes all source code from indexing
- Production containers often use patterns like
-
.npmignoreprevents files from npm packages, not from AI analysis- May exclude documentation, examples, or type definitions needed for understanding code
-
No override mechanism exists
- Configuration system is purely additive
- Cannot selectively disable problematic ignore files
- No way to prioritize code analysis needs over deployment needs
Real-World Impact
Quality: F (Complete Failure) - For projects with aggressive .dockerignore patterns, the system cannot index any files.
Current Limitation: "In its current form, the project is only useful for scripting languages" (projects without complex deployment configurations)
Steps to Reproduce
-
Create a project with a
.dockerignorefile containing:* !out/ !dist/ -
Attempt to index the codebase using context-please MCP:
{ "path": "/path/to/project" } -
Observe that no source files are indexed
Expected Behavior
Users should be able to:
- Selectively choose which ignore files to respect (e.g.,
.gitignoreyes,.dockerignoreno) - Override ignore patterns on a per-file or per-pattern basis
- Specify that code indexing should prioritize completeness over deployment optimization
Proposed Solutions
-
Whitelist Approach: Only respect
.gitignoreand.contextignoreby default- Add configuration option to enable other ignore files explicitly
-
Configurable Ignore File Discovery:
interface IndexOptions { respectIgnoreFiles?: string[] // Default: ['.gitignore', '.contextignore'] ignoreIgnoreFiles?: string[] // Blacklist certain ignore files }
-
Priority System: Allow MCP
ignorePatternsparameter to override file-based patterns -
Negative Patterns: Support
!patternsyntax to explicitly include files even if ignored elsewhere
Workaround
As documented in the upstream issue, mounting /dev/null over .dockerignore in Docker configurations:
{
"mounts": [
{
"source": "/dev/null",
"target": "${workspaceFolder}/.dockerignore",
"type": "bind"
}
]
}However, this is a hacky solution that shouldn't be necessary.
Related Code
packages/core/src/context.ts:1206-1229- Automatic ignore file discoverypackages/core/src/context.ts:1171-1194-loadIgnorePatterns()methodpackages/mcp/src/index.ts- MCPindex_codebasetool (acceptsignorePatternsbut can't disable file-based patterns)
Labels
type: bug- Current behavior breaks legitimate use casesp1- High priority - Blocks usage for many production projectsarea: core- Core indexing functionality affected