feat(discover): two-speed scan engine with discovery index (#213) - #214
Draft
Theosakamg wants to merge 1 commit into
Draft
feat(discover): two-speed scan engine with discovery index (#213)#214Theosakamg wants to merge 1 commit into
Theosakamg wants to merge 1 commit into
Conversation
Introduce ScanMode discriminant (ScanModeIndex / ScanModeFull) in
ScanOptions to serve latency-sensitive commands (status, info) from a
persisted JSON index while keeping the full FS walk for compliance
commands (audit, init --import-all).
Fast-path (ScanModeIndex):
- Load ~/.cache/gaal/gaal/discovery-index.json and validate each entry
via parent-directory mtime check (same technique as Git UNTRACKED_CACHE).
- Entries with unchanged parent mtime are served directly; stale entries
trigger a partial re-walk of that one directory only.
- Falls back to ScanModeFull when the index is missing or empty.
Compliance walk (ScanModeFull):
- scanGlobal and scanWorkspace now run concurrently via goroutines.
- No arbitrary timeout applied.
- skipDirs extended: Library, .local, .steam, .wine, .gem, __pycache__
Index lifecycle:
- discover.RebuildIndex() called by engine after RunOnce() and Prune().
- ops.Collect() / ops.Status() pass ScanModeIndex + cacheRoot.
Unification:
- ops/audit.go collectAuditSkills / collectAuditMCPs / scanDeduped
removed; Audit() delegates to discover.Scan(ScanModeFull).
- ops/init_build.go BuildImportCandidates uses discover.Scan(ScanModeFull).
- Resource.Meta now carries 'source' and 'desc' keys for skill entries,
so audit conversion is lossless.
Option B (MCP scope alignment):
- AuditMCPEntry gains a Scope field ('project' or 'global').
- mcpGroups renderer groups by scope: 'mcps (project)' / 'mcps (global)'
mirroring the existing skill grouping by source.
Closes #213
Contributor
Author
|
strict mode for remove, vs keep and inform. |
Contributor
|
Need another name than strict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduce a two-speed scan engine to serve
gaal status/infofrom afast-path discovery index while keeping a full compliance walk for
gaal auditandinit --import-all.Fast-path (
ScanModeIndex) — used bystatus,infoAfter every write operation (
sync,prune), the discovered resourcelist is serialised into
~/.cache/gaal/gaal/discovery-index.jsonatomically(temp file +
os.Rename). On read-only commands each entry is validatedvia a single
stat()on its parent directory — unchanged mtime means theentry is still valid; a changed mtime triggers a partial re-walk of that
one directory only. Falls back to
ScanModeFullwhen the index is missing.Compliance walk (
ScanModeFull) — used byaudit,init --import-allscanGlobalandscanWorkspacerun concurrently via goroutines.skipDirsextended with:Library,.local,.steam,.wine,.gem,__pycache__Unification
ops/audit.gocollectAuditSkills/collectAuditMCPs/scanDedupedremoved.
Audit()andBuildImportCandidates()now delegate todiscover.Scan(ScanModeFull).Option B — MCP scope alignment
AuditMCPEntrygains aScopefield ("project"or"global").The audit renderer groups MCPs by scope: "mcps (project)" / "mcps (global)",
mirroring the existing skill grouping.
Type of Change
Related Issues
Closes #213
Checklist
make lintpasses —gofmtformatting +go vetcleanmake buildpasses on Linux and macOSmake testpasses — unit tests with race detectorslog.Debug/slog.DebugContextcalldocs/discover.md,docs/architecture.md)