Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
ignore_matcher.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
37#pragma once
38
39#include <filesystem>
40#include <regex>
41#include <string>
42#include <vector>
43
44namespace entropic {
45
57public:
62 IgnoreMatcher() = default;
63
78 void load(const std::filesystem::path& root);
79
88 void add_pattern(const std::string& pattern,
89 const std::filesystem::path& base = {});
90
101 bool is_ignored(const std::string& rel_path,
102 bool is_dir) const;
103
110 std::size_t rule_count() const { return rules_.size(); }
111
126 struct Rule {
127 std::regex re_exact;
128 std::regex re_under;
129 bool negate = false;
130 bool dir_only = false;
131 std::string original;
132 std::string base;
133 };
134
135private:
136
145 static Rule compile_pattern(const std::string& pattern,
146 const std::string& base);
147
159 static std::string pattern_to_regex(const std::string& pattern);
160
168 void load_file(const std::filesystem::path& path,
169 const std::string& base);
170
182 void load_nested_gitignores(const std::filesystem::path& canonical_root,
183 const std::filesystem::path& root_gi);
184
185 std::vector<Rule> rules_;
186};
187
188} // namespace entropic
gitignore-style path matcher (#15, v2.1.4).
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.
IgnoreMatcher()=default
Construct an empty matcher (no rules).
std::size_t rule_count() const
Number of compiled rules (test surface).
Activate model on GPU (WARM → ACTIVE).
One compiled gitignore rule (public so internal helpers in the .cpp can construct Rules without frien...
std::regex re_under
Path is strictly below target.
std::string base
Anchor base, "" means root.
bool dir_only
Trailing / (directory match)
std::string original
Raw pattern for diagnostics.
std::regex re_exact
Path equals pattern target.