mission control for agent skills
Go agent-skillsagent-toolsai-agentsai-toolsai-workflowclaude-codeclicoding-agentscommand-line-tooldeveloper-toolsgoopencodeproductivity-toolsskill-discoveryskill-managementskillsterminal-appterminal-uituiworkflow-automation
feat: discover native OpenCode project skills
Alvin Unreal4ce98ca91650
diff --git a/internal/agents/agents.go b/internal/agents/agents.goindex 3ab164c..4bdd16e 100644--- a/internal/agents/agents.go+++ b/internal/agents/agents.go@@ -315,6 +315,16 @@ func LocationsWithEnv(cwd string, e Env) []Location {}}for _, a := range registry {+ // OpenCode supports project-local skills in its native directory as+ // well as the shared .agents/skills directory. Put the native location+ // first so per-agent visibility prefers it when both contain a skill.+ if a.Name == "opencode" {+ nativeRoot := filepath.Join(cwd, ".opencode", "skills")+ if !homeIsCwd && !isUnderAnyGlobalRoot(filepath.Clean(nativeRoot), globalRoots) {+ shared := sharedFor(nativeRoot, cwd)+ add(Location{Root: nativeRoot, Scope: model.ScopeProject, AgentName: a.Name, SharedRoot: shared.shared, SharedRootLink: shared.link, SharedRootTarget: shared.target})+ }+ }projectRoot := filepath.Join(cwd, filepath.FromSlash(a.ProjectDir))// Skip project locations that are, or live inside, a global skills root.// Otherwise running from within the global tree (e.g. insidediff --git a/internal/agents/agents_test.go b/internal/agents/agents_test.goindex e9966be..e8a4ca7 100644--- a/internal/agents/agents_test.go+++ b/internal/agents/agents_test.go@@ -182,3 +182,25 @@ func TestLocationsKeepProjectDirsOutsideHome(t *testing.T) {}t.Fatalf("expected project location %q outside home", want)}++func TestOpenCodeHasNativeAndUniversalProjectLocations(t *testing.T) {+ home := "/home/test"+ cwd := "/repo"+ locations := LocationsWithEnv(cwd, testEnv(home))+ want := map[string]bool{+ filepath.Join(cwd, ".opencode", "skills"): false,+ filepath.Join(cwd, ".agents", "skills"): false,+ }+ for _, loc := range locations {+ if loc.Scope == "project" && loc.AgentName == "opencode" {+ if _, ok := want[loc.Root]; ok {+ want[loc.Root] = true+ }+ }+ }+ for root, found := range want {+ if !found {+ t.Errorf("expected OpenCode project location %q", root)+ }+ }+}diff --git a/internal/scan/scan_test.go b/internal/scan/scan_test.goindex 82f500a..8e0ca2c 100644--- a/internal/scan/scan_test.go+++ b/internal/scan/scan_test.go@@ -59,6 +59,55 @@ func TestUniversalProjectVisibilityForUniversalAgents(t *testing.T) {}}+func TestOpenCodeNativeProjectSkillsAndDiagnostics(t *testing.T) {+ withHome(t)+ cwd := t.TempDir()+ nativeRoot := filepath.Join(cwd, ".opencode", "skills")+ sharedRoot := filepath.Join(cwd, ".agents", "skills")+ writeSkill(t, filepath.Join(nativeRoot, "shared-name"), "Shared Name", "native copy")+ writeSkill(t, filepath.Join(sharedRoot, "shared-name"), "Shared Name", "universal copy")+ if err := os.MkdirAll(filepath.Join(nativeRoot, "missing"), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.MkdirAll(filepath.Join(nativeRoot, "invalid"), 0o755); err != nil {+ t.Fatal(err)+ }+ if err := os.WriteFile(filepath.Join(nativeRoot, "invalid", "SKILL.md"), []byte("---\nname: 123\n---\n"), 0o644); err != nil {+ t.Fatal(err)+ }++ res, err := Run(cwd)+ if err != nil {+ t.Fatal(err)+ }+ var shared, missing, invalid *model.Skill+ for i := range res.Skills {+ switch res.Skills[i].Name {+ case "Shared Name":+ shared = res.Skills[i]+ case "missing":+ missing = res.Skills[i]+ case "invalid":+ invalid = res.Skills[i]+ }+ }+ if shared == nil || missing == nil || invalid == nil {+ t.Fatalf("expected native, missing, and invalid skills, got %#v", res.Skills)+ }+ if got, ok := observedForAgent(shared, "opencode"); !ok || got.Path != filepath.Join(nativeRoot, "shared-name") {+ t.Fatalf("expected native path to be preferred for OpenCode, got %#v, %v", got, ok)+ }+ if len(shared.ObservedPaths) < 2 {+ t.Fatalf("expected universal and native observations to be retained, got %#v", shared.ObservedPaths)+ }+ if !hasIssue(missing.HealthIssues, "missing_skill_md") {+ t.Fatalf("expected missing native SKILL.md diagnostic, got %#v", missing.HealthIssues)+ }+ if !hasIssue(invalid.HealthIssues, "invalid_frontmatter") {+ t.Fatalf("expected invalid native SKILL.md diagnostic, got %#v", invalid.HealthIssues)+ }+}+func TestClaudeProjectDir(t *testing.T) {withHome(t)cwd := t.TempDir()