ignore
A pure JavaScript manager, filter, and parser for .gitignore-style rules, built exactly to the gitignore spec.
Repository Health
Technical Analysis
ignore is a standalone library that implements the .gitignore matching spec in pure JavaScript, with no dependency on the filesystem or on git itself. You feed it a set of pattern strings — the same syntax used in .gitignore files, including negation, directory-only rules, and glob wildcards — and it tells you which of an array of pathnames should be excluded, matching git check-ignore output.
Because it never touches the disk or shells out to git, ignore works identically in Node.js scripts, bundlers, and any environment where you already have a list of candidate paths (for example, from glob) and need to filter them the way git, ESLint, or npm’s .npmignore-adjacent tooling would. It is the pattern-matching engine underneath several well-known JavaScript dev tools.
What You Get
- An
Ignoremanager built withignore()that accepts one or many patterns via.add(), including the full text of a.gitignorefile at once .filter(paths)and.createFilter()to filter an array of pathnames or produce anArray.prototype.filter-compatible predicate.ignores(pathname)for a simple boolean check and.test(pathname)for a detailed{ignored, unignored, rule}result.checkIgnore(pathname), agit check-ignore -v-equivalent debug method that reports which specific rule matched- Correct handling of Windows-style backslash paths, case-insensitive matching options, and pattern
markmetadata for tracing a rule back to its source line - Bundled TypeScript type definitions (
index.d.ts) with no separate@typespackage needed
Common Use Cases
- Filtering a file list produced by
globorfast-globdown to only the files a tool should actually process, honoring the project’s.gitignore - Implementing
.eslintignore/.prettierignore-style ignore-file support inside a custom linter, formatter, or build tool - Re-implementing
git check-ignorebehavior in JavaScript for editors, file watchers, or CI tooling that needs to explain why a path is excluded - Building higher-level utilities (like
glob-gitignore) that combine glob matching with gitignore-aware filtering
Under The Hood
Architecture — The whole library lives in a single index.js (~790 lines, no runtime dependencies) built around three classes: IgnoreRule compiles one gitignore pattern into a lazily-built RegExp (separate regexes for plain ignores() checks versus checkIgnore() debug checks), RuleManager accumulates IgnoreRule instances and exposes .test(path), and Ignore is the public-facing manager returned by the ignore() factory, wrapping a RuleManager per case-sensitivity mode. Pattern compilation walks the raw string character-by-character (makeRegexPrefix) to translate gitignore glob syntax — **, single *, character ranges, escaped !/# — into an equivalent regex fragment, so matching at query time is just a regex test rather than repeated string parsing.
Tech Stack — Pure JavaScript (95% JS, 5% TypeScript in the bundled index.d.ts) with zero production dependencies. The build pipeline uses Babel (@babel/cli/@babel/preset-env) to emit a legacy.js for pre-ES6 Node targets, ESLint (eslint-config-ostai) for linting, and tap for the test runner. TypeScript consumers get types directly from the shipped .d.ts file — no separate @types/ignore package exists or is needed.
Code Quality — The test suite spans three files (ignore.test.js, others.test.js, git-check-ignore.test.js, ~560 lines) plus a fixtures/ directory, and CI (.github/workflows/nodejs.yml) runs the full suite across Ubuntu, Windows, and macOS on Node 20, plus dedicated test:ts and test:16 jobs for module-resolution edge cases (CJS/ESM/Node16). The README states results are cross-checked against real git check-ignore output for correctness, and the project maintains its own CHANGELOG.md with explicit upgrade guides between major versions (4.x→5.x, etc.).
API Design — The API is deliberately minimal: ignore().add(patterns) returns this for chaining, and querying is a choice between .ignores() (boolean), .filter()/.createFilter() (array/predicate), .test() (structured result), and .checkIgnore() (git-parity debug result with the matching rule). Getting started requires no configuration — ignore().add(['*.log']).ignores('debug.log') is a complete example — though the strict path.relative()-only pathname convention (throwing on ./foo or absolute paths unless allowRelativePaths is set) is a sharp edge documented prominently in the README to head off the most common misuse.
Used by 29 apps in this directory
Dyad
AI Assistants · AI Code Assistants · AI Development
Build AI-powered apps locally with your own keys, your own models, and zero cloud lock-in.
GitNexus
AI Code Assistants · Developer Tools · Mcp
Index any codebase into an interactive knowledge graph and give your AI agents deep architectural context via MCP — with zero servers required.
HyperFrames
AI Design Tools · AI Development
Turn plain HTML and CSS into deterministic, pixel-perfect MP4 videos — authored by humans or AI agents, rendered by headless Chrome and FFmpeg.
Kibana
Analytics · Monitoring
Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.
Kimi Code CLI
AI Agents · AI Code Assistants · Developer Tools
A single-binary, terminal-native coding agent that reads, edits, and runs code end to end, built by Moonshot AI for Kimi models but pluggable with Anthropic, OpenAI, and Google providers too.
LobeHub
AI Assistants · Automation · Productivity
Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.
Magnitude
AI Development · Developer Tools
An open source inference engine that profiles your hardware, recommends the best local models, and tunes them for the coding agent you already use.
Mastra Code
AI Code Assistants
"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.
melty
AI Code Assistants · Code Editors · Developer Tools
The AI code editor where every chat message is a git commit you can revert, branch, or squash