feat(skills): spec-2.2 skill discovery (fs scan + precedence + isolation)#93
Merged
Conversation
added 2 commits
June 5, 2026 18:48
spec-2.2 T-3 实现。SKILL.md 文件系统 discovery 消费 spec-2.1 纯函数,
2.1 纯文件零改。watcher defer,invocation 留 spec-2.3。
- roots.go: SkillRoot/RootSpec + AssignPrecedence(total injective:bands+
sorted index → 跨 root 无平局;同 root 同名 → Unresolvable)
- scan.go: scanRoot — Lstat 拒 symlink root / 缺省 root 不存在=空(Required
才报)/ flat *.md + dir-form <name>/SKILL.md / entry symlink 跳过 /
MaxFilesPerRoot=1000 截断 / 确定序
- discovery.go: Discover — stat size cap 在 ReadFile 前(防 OOM)/ Parse /
Validate(warnings 即使 fatal 也收)/ disabled→Ignored / Resolve
- result.go: DiscoveryResult{Active,Shadowed,Conflicts,Warnings,Ignored,
Errors} + 成员契约(Active XOR unresolvable;conflict 不进 Errors)+
ClassifyError(asErrcode 归一)
- summary.go: SummarizeDiscovery(stdlib-only,守 leaf)
- errors.go: 3 新码 ROOT_UNREADABLE/FILE_UNREADABLE/ROOT_TOO_MANY_FILES
- config: PluginsConfig{SkillSearchPaths,DisabledSkills} + validatePlugins
(拒 .. 路径穿越 + max=10)
- bootstrap: BuildSkillRoots 从 HomeDir+cwd 直接派生(非 SourcePaths)+
DiscoverSkills/Summary;entrypoints relay → plugin list 跑真 discovery
覆盖率 88.7%;0 新依赖;make gate 全绿(race+golangci+manifest+import-rules+
suppression)。app/skills 仍叶子(不引 config/logger/diagnose/render)。
Spec: spec-2.2-skill-discovery.md
三路 post-impl review absorb(code-reviewer + go-reviewer APPROVE-WITH-FIXES + codex REQUEST-CHANGES;trace docs/reviews/spec-2.2-postimpl-review.md)。重点 fs 安全 + result contract,HIGH 多路命中: - HIGH(三路): flat-form .md 非常规文件(symlink/FIFO/device)在 DT_UNKNOWN 文件系统漏过 d_type 检查 → 跟随读 OOM/越界。修:classifyEntry flat 加 isRegularFile + loadSkill 重写(Lstat-IsRegular → Open → f.Stat-IsRegular → io.LimitReader(maxSkillSize+1) 有界读)解 symlink+TOCTOU+无界读 - HIGH(codex): ReadDir cap 前 materialize 全部 entry → 流式 d.ReadDir(256)+ 早停 maxFiles(memory 有界) - HIGH(codex): plugin precedence 用入参序非 sorted PluginID(违锁定 Q8)→ BuildSkillRoots sort PluginDirs by (ID,Dir) - MED: AssignPrecedence dedup by Dir(防自我 shadow)+ 修 godoc - SkillSearchPaths full realpath 含容文档化 defer spec-3.9 企业(词法 .. + symlink-root reject 已护,单用户 v1) - 补测: WarningsAndFatalSameFile / LoadSkill symlink+missing / Summarize AllSections / Plugins sorted by ID / dedup。覆盖率 88.7%→96.1% make gate 全绿(race+golangci+manifest+import-rules+suppression);0 新依赖。 Spec: spec-2.2-skill-discovery.md
This was referenced Jun 5, 2026
sqlrush
added a commit
that referenced
this pull request
Jun 6, 2026
Why: PR #95 (spec-2.3 impl) omitted the git-hooks/spec-registry.txt fallback-copy row that prior spec PRs carried (e.g. #93 for 2.2). The pre-push hook prefers the sibling opendbrb registry (already updated @ opendbrb 5bb091e) so tagging was unblocked; this restores the fallback copy's sync. Tag v0.53.0-stage2.53 already pushed dual-repo. Spec: spec-2.3-skill-invocation.md Co-authored-by: sqlrush <sqlrush@sqlrushdeMacBook-Pro.local>
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.
spec-2.2-skill-discovery T-3 实现。SKILL.md 文件系统 discovery 消费 spec-2.1 纯函数(2.1 纯文件零改)。watcher defer,invocation 留 spec-2.3。
实现(D-1..D-9)
plugin list跑真 discovery质量
调用方(规则 21)
新 discovery 文件无下游生产消费者(2.3 是后继);改既有件:Config 加 Plugins 字段 + gen-error-codes(已含 blank-import)+ 中心 manifest append 3 码 + plugin list 接线。
Spec: spec-2.2-skill-discovery.md