|
Entropic 2.3.8
Local-first agentic inference engine
|
gitignore-style path matcher (#15, v2.1.4). More...
#include <entropic/mcp/servers/ignore_matcher.h>
Classes | |
| struct | Rule |
| One compiled gitignore rule (public so internal helpers in the .cpp can construct Rules without friend declarations). More... | |
Public Member Functions | |
| IgnoreMatcher ()=default | |
| Construct an empty matcher (no rules). | |
| void | load (const std::filesystem::path &root) |
| Load gitignore + explorerignore from a workspace root. | |
| void | add_pattern (const std::string &pattern, const std::filesystem::path &base={}) |
| Add a single pattern programmatically (test surface). | |
| bool | is_ignored (const std::string &rel_path, bool is_dir) const |
| Test whether a path is ignored. | |
| std::size_t | rule_count () const |
| Number of compiled rules (test surface). | |
gitignore-style path matcher (#15, v2.1.4).
Single instance owns a compiled rule set. is_ignored is O(rules) per call; rules are evaluated in source order, last-match-wins so that negation patterns (!keep.log) can re-include paths that earlier patterns excluded.
Definition at line 56 of file ignore_matcher.h.
|
default |
Construct an empty matcher (no rules).
| void entropic::IgnoreMatcher::add_pattern | ( | const std::string & | pattern, |
| const std::filesystem::path & | base = {} |
||
| ) |
Add a single pattern programmatically (test surface).
Add a pattern programmatically.
| pattern | Gitignore-syntax pattern. |
| base | Anchor directory (relative to root). Empty means "anchored at root." |
Definition at line 337 of file ignore_matcher.cpp.
| bool entropic::IgnoreMatcher::is_ignored | ( | const std::string & | rel_path, |
| bool | is_dir | ||
| ) | const |
Test whether a path is ignored.
Test a path against the rule set (last-match-wins for negation).
| rel_path | Forward-slash, relative-to-root path. Must NOT start with /. Trailing slash optional. |
| is_dir | True if the path refers to a directory. |
Definition at line 424 of file ignore_matcher.cpp.
| void entropic::IgnoreMatcher::load | ( | const std::filesystem::path & | root | ) |
Load gitignore + explorerignore from a workspace root.
Load all .gitignore files (recursive) + .explorerignore.
Walks root recursively for .gitignore files and loads them with their per-directory anchoring. Then loads <root>/.explorerignore (if present) anchored at root. Existing rules are cleared first.
Safe to call repeatedly when the working directory changes.
| root | Workspace root directory (must exist; non-canonical paths are accepted). |
Definition at line 371 of file ignore_matcher.cpp.
|
inline |
Number of compiled rules (test surface).
Definition at line 110 of file ignore_matcher.h.