Skip to content

Commit 4b1d82d

Browse files
fix: linter skipping skills-only plugins (#216)
Branch-Creation-Time: 2026-05-13T13:12:22+0000
1 parent 67844bc commit 4b1d82d

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

pkg/codingcontext/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,7 @@ func (cc *Context) loadSkillEntry(skillFile string, lenient bool) error {
10541054

10551055
if cc.lintCollector != nil {
10561056
cc.lintCollector.recordFile(skillFile, LoadedFileKindSkill)
1057+
cc.lintCollector.recordFrontmatterValues(frontmatter.BaseFrontMatter)
10571058
}
10581059

10591060
matches, reason := cc.includes.MatchesIncludes(frontmatter.BaseFrontMatter, cc.includeByDefault)

pkg/codingcontext/lint_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,34 @@ func TestLint_Command_Tracked(t *testing.T) {
269269
t.Errorf("expected command file in LoadedFiles, got %+v", result.LoadedFiles)
270270
}
271271
}
272+
273+
// TestLint_SelectorMatched_FromSkillFrontmatter verifies that frontmatter keys
274+
// declared in SKILL.md files contribute to the selector-coverage 'seen' map.
275+
// Regression test: previously loadSkillEntry recorded the file but not its
276+
// frontmatter values, so a selector key declared only in skill frontmatter
277+
// (e.g. a plugin whose only converted output is a SKILL.md) would falsely
278+
// trigger 'selector matched no discovered files'.
279+
func TestLint_SelectorMatched_FromSkillFrontmatter(t *testing.T) {
280+
t.Parallel()
281+
dir := lintTestDir(t)
282+
283+
createTask(t, dir, "task1", "", "Do stuff.")
284+
createSkill(t, dir, ".agents/skills/myskill",
285+
"---\nname: myskill\ndescription: A skill that declares a custom selector key.\ncategory: alpha\n---\nbody")
286+
287+
cc := New(
288+
WithSearchPaths(dir),
289+
WithSelectors(map[string]map[string]bool{
290+
"category": {"alpha": true},
291+
}),
292+
)
293+
294+
result, err := cc.Lint(context.Background(), "task1")
295+
if err != nil {
296+
t.Fatalf("Lint() returned error: %v", err)
297+
}
298+
299+
if hasLintError(result, LintErrorKindSelectorNoMatch, "category=alpha") {
300+
t.Errorf("skill frontmatter should satisfy selector coverage, got errors: %+v", result.Errors)
301+
}
302+
}

0 commit comments

Comments
 (0)