{"_id":"opencode-ignore","_rev":"7-97442d0e90a1f91e2e010bf31e9f5f19","name":"opencode-ignore","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"opencode-ignore","version":"1.0.0","keywords":["opencode","plugin"],"author":{"name":"Łukasz Gładysz"},"license":"MIT","_id":"opencode-ignore@1.0.0","maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"homepage":"https://github.com/lgladysz/opencode-ignore#readme","bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"dist":{"shasum":"1dd5cf9d61f7fffd5d5074578121e173c123658d","tarball":"https://registry.npmjs.org/opencode-ignore/-/opencode-ignore-1.0.0.tgz","fileCount":4,"integrity":"sha512-smZozwvhG+EDLwzDxdHx2i0xIor8ee4SIAfISLHwEB1SgCpQyZ+t7ylKSEk2T4mNPcAJDw73QB2yODl3nB6log==","signatures":[{"sig":"MEUCIQDeZe8llxmoWNScFIFvXbCu/G8luCZZ6yE8J8EStSBPRAIgGpWOf5vbqEf0vDu/1gyRnexje0ADZFdON9JuauB2LVE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30082},"type":"module","module":"index.ts","$schema":"https://json.schemastore.org/package.json","gitHead":"1743b2f83dbc1bf93d275970a95322424ae6ab19","scripts":{"test":"bun test","build":"bun build ./index.ts --outdir ./dist","prepublishOnly":"bun build ./index.ts --outdir ./dist"},"_npmUser":{"name":"luigie","email":"white9g@gmail.com"},"repository":{"url":"git+https://github.com/lgladysz/opencode-ignore.git","type":"git"},"_npmVersion":"10.9.2","description":"Ignore plugin for OpenCode","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ignore":"^7.0.5"},"_hasShrinkwrap":false,"packageManager":"bun@1.3.1","devDependencies":{"bun-types":"^1.3.1","@types/bun":"^1.3.1","@tsconfig/bun":"^1.0.9","@opencode-ai/plugin":"^1.0.7"},"peerDependencies":{"typescript":"^5.9.3","@opencode-ai/plugin":"^1.0.7"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ignore_1.0.0_1762015245750_0.5409157333417227","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"opencode-ignore","version":"1.0.1","keywords":["opencode","plugin"],"author":{"name":"Łukasz Gładysz"},"license":"MIT","_id":"opencode-ignore@1.0.1","maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"homepage":"https://github.com/lgladysz/opencode-ignore#readme","bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"dist":{"shasum":"16bf2c4cd755e079b155b37735806bc1a72a3ace","tarball":"https://registry.npmjs.org/opencode-ignore/-/opencode-ignore-1.0.1.tgz","fileCount":4,"integrity":"sha512-KNcLxyLF5m+oLOO1rphf3WuSiLrgzJahCThJEaJqTzs27ZHS2aAn6aNkGtOHFjbxlybvruBUEcztMXmvDi0wGA==","signatures":[{"sig":"MEYCIQCztGPVYkT6o9pDAfLIbldw7JGIIJIzs2s89Yy9JmFNbQIhAMnxWrd4rcmzp2sTkB+986iWtc0PyG1lyXSFm4xFe6Cm","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30028},"type":"module","module":"index.ts","$schema":"https://json.schemastore.org/package.json","gitHead":"914a996cc7d66ed7515e9fefa63f9d0f9b213f46","scripts":{"test":"bun test","build":"bun build ./index.ts --outdir ./dist","prepublishOnly":"bun build ./index.ts --outdir ./dist"},"_npmUser":{"name":"luigie","email":"white9g@gmail.com"},"repository":{"url":"git+https://github.com/lgladysz/opencode-ignore.git","type":"git"},"_npmVersion":"10.9.2","description":"Ignore plugin for OpenCode","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ignore":"^7.0.5"},"_hasShrinkwrap":false,"packageManager":"bun@1.3.1","devDependencies":{"bun-types":"^1.3.1","@types/bun":"^1.3.1","@tsconfig/bun":"^1.0.9","@opencode-ai/plugin":"^1.0.7"},"peerDependencies":{"typescript":"^5.9.3","@opencode-ai/plugin":"^1.0.7"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ignore_1.0.1_1762015445343_0.5709187495578527","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"opencode-ignore","version":"1.0.2","keywords":["opencode","plugin"],"author":{"name":"Łukasz Gładysz"},"license":"MIT","_id":"opencode-ignore@1.0.2","maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"homepage":"https://github.com/lgladysz/opencode-ignore#readme","bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"dist":{"shasum":"725f4a4df4b9022394fed933075c40b6e526a1b1","tarball":"https://registry.npmjs.org/opencode-ignore/-/opencode-ignore-1.0.2.tgz","fileCount":4,"integrity":"sha512-wXNNboPV6q5mdrNli3CXdaLgnkWoeVE2dU0YgkrtW9ydt/W6TfidMxOHURJPTBpLQb95fj+RgW47AWadOLbnjg==","signatures":[{"sig":"MEQCIGo9MoRHezD7bz1MNhtTylPGyHjPcZWBodRwOzF8hU1hAiB1hYxqOgSWz+7EG3lf5SBhSuRAR6SdDMVy5Alp17zYYw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30030},"type":"module","module":"index.ts","$schema":"https://json.schemastore.org/package.json","gitHead":"21428aa21d28bc566c2a2d22ef0005333efde24a","scripts":{"test":"bun test","build":"bun build ./index.ts --outdir ./dist","prepublishOnly":"bun build ./index.ts --outdir ./dist"},"_npmUser":{"name":"luigie","email":"white9g@gmail.com"},"repository":{"url":"git+https://github.com/lgladysz/opencode-ignore.git","type":"git"},"_npmVersion":"10.9.2","description":"Ignore plugin for OpenCode","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ignore":"^7.0.5"},"_hasShrinkwrap":false,"packageManager":"bun@1.3.1","devDependencies":{"bun-types":"^1.3.1","@types/bun":"^1.3.1","@tsconfig/bun":"^1.0.9","@opencode-ai/plugin":"^0.13.9"},"peerDependencies":{"typescript":"^5.9.3","@opencode-ai/plugin":"^0.13.9"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ignore_1.0.2_1762016197325_0.23869719254348376","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"opencode-ignore","version":"1.0.3","keywords":["opencode","plugin"],"author":{"name":"Łukasz Gładysz"},"license":"MIT","_id":"opencode-ignore@1.0.3","maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"homepage":"https://github.com/lgladysz/opencode-ignore#readme","bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"dist":{"shasum":"1a117ece86d5d86e8fb8c29df152e79671bbbde8","tarball":"https://registry.npmjs.org/opencode-ignore/-/opencode-ignore-1.0.3.tgz","fileCount":4,"integrity":"sha512-KNllclAMzbyqN1C2UqxSv9CdiNkRtroaVBnRDILLFNIFhFXr/QJ9sseVsVv7QYsXeyohrPTBhbkQ4wIxSOg9KA==","signatures":[{"sig":"MEUCIGx7M2aU+7v9FqsQKCc020xNlaxU2UdF/mamU2WtbjxYAiEAoAFWQwUeJLgrwYaICkcsMYOrWOHyJyjlL3cwJk5fcpw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30032},"type":"module","module":"index.ts","$schema":"https://json.schemastore.org/package.json","gitHead":"fd3b7d8d5b43e381ae9139be371f9a22239d3d18","scripts":{"test":"bun test","build":"bun build ./index.ts --outdir ./dist","prepublishOnly":"bun build ./index.ts --outdir ./dist"},"_npmUser":{"name":"luigie","email":"white9g@gmail.com"},"repository":{"url":"git+https://github.com/lgladysz/opencode-ignore.git","type":"git"},"_npmVersion":"10.9.2","description":"Ignore plugin for OpenCode","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ignore":"^7.0.5"},"_hasShrinkwrap":false,"packageManager":"bun@1.3.1","devDependencies":{"bun-types":"^1.3.1","@types/bun":"^1.3.1","@tsconfig/bun":"^1.0.9","@opencode-ai/plugin":"^0.13.7"},"peerDependencies":{"typescript":"^5.9.3","@opencode-ai/plugin":"^0.13.7"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ignore_1.0.3_1762016781402_0.8780021047053519","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"opencode-ignore","version":"1.0.4","keywords":["opencode","plugin"],"author":{"name":"Łukasz Gładysz"},"license":"MIT","_id":"opencode-ignore@1.0.4","maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"homepage":"https://github.com/lgladysz/opencode-ignore#readme","bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"dist":{"shasum":"163e682bf8d11773bca26f25bcd1e9e9a4abedb9","tarball":"https://registry.npmjs.org/opencode-ignore/-/opencode-ignore-1.0.4.tgz","fileCount":4,"integrity":"sha512-3tCOHKkU4doVFc86ZUThTA21WEg5WBVMhPkZvpW44OqwTdF38DolW6T6+M1hNZEE2bzfyrNbif5cYxjYn8M+QQ==","signatures":[{"sig":"MEQCIFqOBN3Ufiaby6DrrXKN9xFCH5Wqea9qDUCAmPGX+O04AiBUcX638xQPjOv5BfNjLvLg2xABtfkb3453PMYKza6qmA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20172},"main":"dist/index.js","type":"module","module":"dist/index.js","$schema":"https://json.schemastore.org/package.json","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"fd3b7d8d5b43e381ae9139be371f9a22239d3d18","scripts":{"test":"bun test","build":"bun build ./index.ts --outdir ./dist --target node","prepublishOnly":"bun run build"},"_npmUser":{"name":"luigie","email":"white9g@gmail.com"},"repository":{"url":"git+https://github.com/lgladysz/opencode-ignore.git","type":"git"},"_npmVersion":"10.9.2","description":"Ignore plugin for OpenCode","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ignore":"^7.0.5"},"_hasShrinkwrap":false,"packageManager":"bun@1.3.1","devDependencies":{"bun-types":"^1.3.1","@types/bun":"^1.3.1","@tsconfig/bun":"^1.0.9","@opencode-ai/plugin":"^0.13.7"},"peerDependencies":{"typescript":"^5.9.3","@opencode-ai/plugin":"^0.13.7"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ignore_1.0.4_1762017080339_0.36788195286103953","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"opencode-ignore","version":"1.0.5","keywords":["opencode","plugin"],"author":{"name":"Łukasz Gładysz"},"license":"MIT","_id":"opencode-ignore@1.0.5","maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"homepage":"https://github.com/lgladysz/opencode-ignore#readme","bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"dist":{"shasum":"3b5f2c34e7d99b5b38a820de721afac16a7fe965","tarball":"https://registry.npmjs.org/opencode-ignore/-/opencode-ignore-1.0.5.tgz","fileCount":4,"integrity":"sha512-POQEc+RheEhUWaivkqEli1f6lPxeZTqr80IWQW4CTEW2fFrBd9A5sPVPGZ1lF2pQ2/nCMYudcB9YwR5o6E2k5A==","signatures":[{"sig":"MEQCIEkj68PPYJecvJJ4TXNdXRZoUUFo/3n3apa49FwAzTayAiAlLy8iqP1iJsdfn9wI80s8B0Myur5XJt5YUi3Nm2QH9w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20208},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","$schema":"https://json.schemastore.org/package.json","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"fd3b7d8d5b43e381ae9139be371f9a22239d3d18","scripts":{"test":"bun test","build":"bun build ./index.ts --outdir ./dist --target node","prepublishOnly":"bun run build"},"_npmUser":{"name":"luigie","email":"white9g@gmail.com"},"repository":{"url":"git+https://github.com/lgladysz/opencode-ignore.git","type":"git"},"_npmVersion":"10.9.2","description":"Ignore plugin for OpenCode","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ignore":"^7.0.5"},"_hasShrinkwrap":false,"packageManager":"bun@1.3.1","devDependencies":{"bun-types":"^1.3.1","@types/bun":"^1.3.1","@tsconfig/bun":"^1.0.9","@opencode-ai/plugin":"^0.13.7"},"peerDependencies":{"typescript":"^5.9.3","@opencode-ai/plugin":"^0.13.7"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ignore_1.0.5_1762017346455_0.7150790927620789","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"$schema":"https://json.schemastore.org/package.json","name":"opencode-ignore","version":"1.1.0","description":"Ignore plugin for OpenCode","type":"module","license":"MIT","author":{"name":"Łukasz Gładysz"},"packageManager":"bun@1.3.1","repository":{"type":"git","url":"git+https://github.com/lgladysz/opencode-ignore.git"},"keywords":["opencode","plugin","ignore","aiignore","aiexclude"],"homepage":"https://github.com/lgladysz/opencode-ignore#readme","bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"scripts":{"build":"bun build ./index.ts --outdir ./dist --target node","prepublishOnly":"bun run build","test":"bun test"},"module":"./dist/index.js","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"devDependencies":{"@tsconfig/bun":"^1.0.9","@types/bun":"^1.3.1","bun-types":"^1.3.1","@opencode-ai/plugin":"^0.15.0"},"peerDependencies":{"typescript":"^5.9.3","@opencode-ai/plugin":"^0.15.0"},"dependencies":{"ignore":"^7.0.5"},"_id":"opencode-ignore@1.1.0","gitHead":"45c21b7a0712888a99011484ca633e5d346e4b53","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-MBA9L0R+rS1vfLNyOnL5Py3AGJVYkcaB3duWy8gyQKdQdRxcKtAj5eeoSHL4RuA1eyTBdQMboaI57jVMjlMPqw==","shasum":"1715f794ad4892dfb6ed480445e38cbcee6a5435","tarball":"https://registry.npmjs.org/opencode-ignore/-/opencode-ignore-1.1.0.tgz","fileCount":4,"unpackedSize":22767,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCmZ+qP1glaR7fBj4+HFxlvdjPqt5hmPb1Mzbh7S6z1nwIhAIx10u/jVBryEZBArRpo1FVKWcmPB94rhea63hwx0hxN"}]},"_npmUser":{"name":"luigie","email":"white9g@gmail.com"},"directories":{},"maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-ignore_1.1.0_1762036276056_0.5801104109739761"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-01T16:40:45.608Z","modified":"2025-11-01T22:31:16.451Z","1.0.0":"2025-11-01T16:40:45.972Z","1.0.1":"2025-11-01T16:44:05.571Z","1.0.2":"2025-11-01T16:56:37.529Z","1.0.3":"2025-11-01T17:06:21.623Z","1.0.4":"2025-11-01T17:11:20.571Z","1.0.5":"2025-11-01T17:15:46.662Z","1.1.0":"2025-11-01T22:31:16.263Z"},"bugs":{"url":"https://github.com/lgladysz/opencode-ignore/issues"},"author":{"name":"Łukasz Gładysz"},"license":"MIT","homepage":"https://github.com/lgladysz/opencode-ignore#readme","keywords":["opencode","plugin","ignore","aiignore","aiexclude"],"repository":{"type":"git","url":"git+https://github.com/lgladysz/opencode-ignore.git"},"description":"Ignore plugin for OpenCode","maintainers":[{"name":"luigie","email":"white9g@gmail.com"}],"readme":"# opencode-ignore\n\nOpenCode plugin to restrict AI access to files and directories using `.ignore` patterns (gitignore-style).\n\n## Usage\n\nAdd to your OpenCode configuration (`~/.config/opencode/opencode.json`):\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"plugin\": [\n    \"opencode-ignore\"\n  ]\n}\n```\n\nCreate a `.ignore` file in your project root with patterns to block:\n\n```gitignore\n# Block specific directory\n/secrets/**\n\n# Block all certificate files\n*.crt\n*.key\n*.pem\n\n# Block environment files\n.env*\n\n# Allow exception with negation\n!config.local.json\n```\n\n## `.ignore` Format\n\nThe `.ignore` file follows gitignore-style syntax powered by the [`ignore`](https://github.com/kaelzhang/node-ignore) package.\n\n### Pattern Types\n\n#### Absolute Paths\nBlock specific paths from project root:\n```gitignore\n/to/ignore\n/somedir/toignore/**\n```\n\n#### Glob Patterns\nBlock files matching patterns anywhere in project:\n```gitignore\n**/node_modules/**\n**/dist/**\n**/build/**\n**/.cache/**\n```\n\n#### Wildcards\nBlock files by extension or name pattern:\n```gitignore\n*.crt              # All certificate files\n*.key              # All private keys\n*.pem              # All PEM files\n*-secret.json      # Files ending with \"-secret.json\"\ntemp*.log          # Temp log files\n```\n\n#### Negation Patterns\nAllow exceptions to blocked patterns:\n```gitignore\n*.json              # Block all JSON files\n!*.local.json       # But allow *.local.json files\n\n**/target/**        # Block target directory\n!**/target/**       # Re-allow it (negation)\n```\n\n### Directory vs File Matching\n\nThe `ignore` library automatically detects whether paths are files or directories:\n\n```gitignore\nfoo      # Blocks file \"foo\" OR directory \"foo/\"\nfoo/     # Only blocks directory \"foo/\"\n```\n\n**Important**: Pattern `**/node_modules/**` blocks files *inside* the directory, not the directory itself.\n\n## Example Patterns\n\nSee `example/.ignore` for comprehensive examples:\n\n```gitignore\n# Block specific paths\n/secrets/**\n/private/**\n!/private/public-config.json\n\n# Block directories anywhere\n**/node_modules/**\n**/dist/**\n**/build/**\n**/.cache/**\n\n# Block sensitive files\n*-secret.json\ntemp*.log\n*.crt\n*.key\n*.pem\n.env*\n.env\n*.env\nid_rsa\nid_ed25519\nsecrets.json\ncredentials.json\napi-keys.json\n\n# Allow build artifacts in specific cases (negation)\n!**/dist/public/**\n\n# Allow local development files\n!*.local.json\n!*.dev.json\n!config.development.json\n!/.local/\n```\n\n## Supported Tools\n\nThe plugin protects the following OpenCode native tools:\n\n### File Operations (Pre-execution blocking)\n- `read` - Blocks reading blocked files\n- `write` - Blocks writing to blocked paths\n- `edit` - Blocks editing blocked files\n\n### Search Operations (Pre-execution + Post-execution filtering)\n- `glob` - Blocks searching in blocked directories, filters blocked files from results\n- `grep` - Blocks searching in blocked directories, filters matches from blocked files\n\n### List Operations (Pre-execution blocking)\n- `list` - Blocks listing blocked directories\n\n**Protection Levels**:\n- **Pre-execution**: Prevents tool from accessing blocked paths entirely (read, write, edit, list)\n- **Post-execution**: Allows search but filters blocked files from results (glob, grep)\n- This two-phase approach prevents both direct access and information disclosure\n\n**Note**: Project root (`.`) is always accessible to prevent blocking entire project.\n\n## How It Works\n\n### Pre-execution Protection\n1. Plugin loads `.ignore` file from project root before tool execution\n2. Tool paths are normalized to relative paths from project root\n3. Paths are checked against ignore patterns using the `ignore` library\n4. If matched, tool execution is blocked with clear error message\n\n### Post-execution Filtering (glob/grep)\nFor `glob` and `grep` tools, additional protection filters results:\n1. Tool executes normally (searching allowed directories)\n2. Results are filtered to remove any files matching `.ignore` patterns\n3. Blocked files are completely removed from output (no partial data leakage)\n4. Empty results returned if all matches are filtered\n\n### Graceful Degradation\n- If `.ignore` missing, all access is allowed\n- Project root (`.`) is always accessible\n\n### Error Messages\n\nWhen a path is blocked:\n```\nAccess denied: path/to/file blocked by ignore file. Do NOT try to read this. Access restricted.\n```\n\n## Path Normalization\n\nThe plugin handles various path formats:\n\n- **Absolute paths**: Converted to relative from project root\n- **Relative paths**: Used directly\n- **Paths with `./`**: Prefix removed (ignore library requirement)\n- **Win32 backslashes**: Auto-converted to forward slashes\n- **Directory paths**: Trailing `/` added when needed\n\n## Testing\n\nRun tests with:\n```bash\nbun test\n```\n\nTests cover:\n- Absolute path patterns\n- Glob patterns\n- Negation patterns\n- Wildcard patterns\n- Directory vs file matching\n- Path normalization edge cases\n- All supported native tools\n- Missing `.ignore` graceful degradation\n\n## Development\n\n```bash\n# Install dependencies\nbun install\n\n# Run tests\nbun test\n\n# Build (if needed)\nbun build index.ts\n```\n\n## License\n\nMIT\n\n## Related\n\n- [`ignore`](https://github.com/kaelzhang/node-ignore) - The underlying pattern matching library\n- [OpenCode Plugin Documentation](https://opencode.ai/docs/plugins)\n","readmeFilename":"README.md"}