ReadMatcher splits on "\n" and parseRule/Compile only trimmed " \t", so a
.skillignore saved with CRLF line endings compiled every rule with a
trailing \r that could never equal a path segment. status still reported
the patterns as loaded, so the file silently ignored nothing. The same
trim in write.go made HasPattern miss existing entries, AddPattern
duplicate them and RemovePattern fail to find them.
The pre-Matcher ReadPatterns used TrimSpace and handled CRLF; this
regressed in 4214cb10 (v0.17.4). Trim \r alongside the existing
whitespace, matching how git reads CRLF .gitignore files.
Refs #275
Repeated ** segments caused O(N^K) recursive backtracking where K is
the number of consecutive globstars. Convert to index-based recursion
with (patternIndex, pathIndex) memoization, reducing to O(P*N).
The change is intended to preserve existing matching behavior while
avoiding repeated evaluation of the same (patternIndex, pathIndex)
states. Existing tests pass, and additional globstar semantics tests
were added to guard the core behavior.
Fixes exponential hang on patterns like **/**/**/**/0 with 150+ segment
paths (previously >2s, now ~60ms).
Add ReadAgentIgnoreMatcher() in skillignore package to read .agentignore
and .agentignore.local files using the same gitignore-style pattern
format as .skillignore.
Integrate .agentignore filtering into AgentKind.Discover() with both
directory-level CanSkipDir() and file-level Match() checks.
Add agent validation in internal/validate/:
- AgentFile(): extension check, filename restrictions (no spaces/special
chars), file size warning (>100KB), existence and type checks
- AgentName(): name format validation (alphanumeric + hyphens/underscores)
9 new tests across resource and validate packages.
- AddPattern returns (bool, error) — single file read, no TOCTOU
- Remove external HasPattern guard in CLI (AddPattern handles it)
- Merge handleDisableSkill/handleEnableSkill into handleToggleSkill
- Fix locking: RLock for discovery, Lock only for file write
- Handle errors from AddPattern/RemovePattern in TUI toggle
- Only write oplog when changes actually occurred
- Inline capitalizeFirst with strings.ToUpper
Unify ~160 lines of duplicated walk logic from DiscoverSourceSkills and
DiscoverSourceSkillsLite into a single discoverSourceSkillsInternal
function controlled by discoverOptions (parseFrontmatter, collectIgnored,
collectTracked).
Add DiscoverSourceSkillsWithStats which returns IgnoreStats populated
with root/repo .skillignore file paths, active patterns, and ignored
skill relPaths. When collectIgnored is true, CanSkipDir is bypassed so
the file-level Match check can record every ignored SKILL.md path.
Add Patterns() method to skillignore.Matcher to expose the original
pattern strings stored during Compile().
Replace the naive string matcher (~40 lines) with a proper gitignore
implementation (~200 lines, no external deps) supporting **, ?, [abc],
!negation, /anchored, pattern/ (dir-only), and \#/\! escapes.
New Matcher API (Compile, ReadMatcher, Match, CanSkipDir, HasRules)
replaces the old Match/ReadPatterns functions (kept as deprecated
wrappers). Call sites in sync.go and install_discovery.go updated.
Also fixes isDir=true for install discovery (skill paths are dirs).
100% test coverage on skillignore package (~150 table-driven cases).
Added 7 sync discovery tests and 5 install integration tests covering
**, !negation, pattern/, [Tt] char class, and combined patterns.
Patterns like "demo/" failed to match because Match() compared
"demo" == "demo/" (false) and HasPrefix("demo", "demo//") (false).
Now ReadPatterns strips trailing slashes at parse time.
Fixes#83
- Extract duplicate .skillignore filtering block into isSkillIgnored()
- Use utils.IsTrackedRepoDir consistently in DiscoverSourceSkillsLite
- Fix unchecked os.WriteFile in skillignore test
DiscoverSourceSkills and DiscoverSourceSkillsLite now load .skillignore
from tracked repos and skip matching paths during walk. This prevents
false warnings in doctor/status/list for vendored SKILL.md files
(e.g. .venv/ inside a tracked repo).
Extract shared skillignore package from internal/install so both
install-time and source discovery use the same filtering logic.