Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
995 changes: 995 additions & 0 deletions internal/skills/coverage_test.go

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions internal/skills/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package skills

import "errors"

var (
// ErrSkillNotFound indicates registry cannot find a skill by id.
ErrSkillNotFound = errors.New("skills: skill not found")
// ErrEmptyContent indicates parsed skill content has no usable instruction.
ErrEmptyContent = errors.New("skills: content is empty")
// ErrSkillRootNotFound indicates configured local root does not exist.
ErrSkillRootNotFound = errors.New("skills: root directory not found")
)
33 changes: 33 additions & 0 deletions internal/skills/filter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package skills

import "strings"

func allowBySource(input ListInput, descriptor Descriptor) bool {
if len(input.SourceKinds) == 0 {
return true
}
for _, kind := range input.SourceKinds {
if descriptor.Source.Kind == kind {
return true
}
}
return false
}

func allowByScope(input ListInput, descriptor Descriptor) bool {
if len(input.Scopes) > 0 {
for _, scope := range input.Scopes {
if descriptor.Scope == scope {
return true
}
}
return false
}

switch descriptor.Scope {
case ScopeWorkspace:
return strings.TrimSpace(input.Workspace) != ""
default:
return true
}
}
Loading
Loading