mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
* docs(proposals): propose agent-specific skill variants Tracked repositories can ship different files for the same skill across agents. Counting and syncing each copy independently sends incompatible instructions to every target unless users maintain routing filters. Propose repository-scoped logical identity and exact variant routing while preserving source files, explicit controls, and existing naming behavior. Leave activation and compatibility decisions for maintainer review. Refs #648 * docs(proposals): clarify variant routing compatibility Explain how recognition affects universal-only targets and how existing per-variant overrides preserve the desired routing. Fix the precedence between variant identity and generic host-style path inference. Include analyze, move, and catalog consumers while preserving physical identifiers and actual context-cost accounting. Refs #648 * docs(proposals): clarify activation assumptions and scope Make acceptance cases conditional on maintainer-approved recognition being enabled for the tracked source. Separate the provisional implementation estimate from this proposal-only PR so its size is clear. Refs #648 * docs(proposals): qualify naming and opt-in assumptions State that the reproduced routing behavior uses default flat target naming. Leave any opt-in surface with the maintainer's activation decision without ruling out future CLI or config fields. Refs #648 * feat: recognize and route tracked agent skill variants Count tracked variants as logical skills in source and repository summaries, while preserving physical paths, sync operations, and context costs. Select matching canonical agent variants, including account targets, through shared discovery and selection with existing explicit routing precedence. Refs #648 * fix: count logical skills in sync inventory summaries Use shared logical and physical inventory counts in global and project sync closing lines while preserving each target's operation totals. Refs #648 * fix: preserve variant routing diagnostics across previews Resolve target selections once so CLI and server previews keep ambiguity reasons and physical skip counts. Explain managed variants removed by automatic agent routing, and report logical inventory in doctor. Keep warning rows read-only, document upgrade recovery in translated filtering references, and remove the optional README-only addition. Refs #648 * fix: align sync matrix previews with shared variant selection Classify the full source selection once per target so matrix previews honor canonical aliases, account identity, exact-agent routing, and ambiguous variant skips. Preserve each rejected physical path's existing diagnostic and draft filter disambiguation; skipped preview rows remain read-only. Refs #648 * test: expect singular skill wording in doctor source checks Keep the undiscovered-link count assertion aligned with logical source inventory formatting for one skill in global and project mode. Refs #648 * fix: retain selection diagnostics in catalog and diff verdicts Report warning-only diff targets as requiring attention while preserving local-only folder semantics. Reuse shared per-path selection diagnostics in target-scoped catalogs without applying target naming to served paths. Compute source counts once in summary callers and require variant counts in the source status formatter. Refs #648 * test: tighten tracked variant preview fixtures Use a real committed tracked repository for status counts, verify sync preview banners retain server warnings, and use emitted ambiguity reason text in target preview fixtures. Refs #648 * fix(sync): keep agent variants in shared target folders Compatible targets sharing a skills folder need a combined selection so Codex and universal do not prune one another in merge or copy mode. Carry every shared reader through selection, pruning and previews, including project targets, account identities and path aliases. Require a matching skill suffix under two distinct agents before inferring variants, keeping ordinary agent-named categories unrestricted. Separate naming warnings from ambiguous selection in diff and explain ambiguous removals. Add global/project regression coverage for repeated sync, target-only sync, status JSON, diff and API consumers. * fix(variants): align consumer counts, hints and diagnostics Use logical source counts in list, tracked install and init summaries while matching audit caches against physical variants. Restore localized dashboard skip hints and explain symlink routing limits in status and doctor, including project and JSON output. Document paired-agent detection and compatible shared-folder selection in the proposal, built-in skill and English plus translated command pages. Add focused regressions for the affected consumers. * fix(sync): cover initial sync and ignored variant diagnostics Init syncs a fresh in-memory config, so resolve shared target identities before its first sync as well as when loading saved configuration. A whole-directory symlink exposes ignored skills too. Diagnose agent variants using physical inventory when active discovery has none, while keeping logical counts and merge/copy selection restricted to enabled skills. Cover global/project JSON status and doctor with regressions. Reuse sourcewalk directory and canonical-path helpers so traversal guards remain enforced and path resolution has a single existing owner. * fix(variants): address conversion, counts and selection diagnostics Ignore runtime agent identities when comparing convertible project targets and count logical skills during init. Keep selection warnings separate from naming warnings and preserve agent-named parent skills as ordinary skills. Cover account sync/prune, project ambiguity and overrides in merge/copy modes, and init/status agreement. Focused verification ran in an isolated Linux Codex container, not the devcontainer, as authorized. * refactor(variants): remove obsolete selection helpers Remove the unused FilterSkillsByTarget wrapper and prune agent parameter, cache canonical target aliases once, and restore catalog skip ordering to avoid an unrelated behavior change. Completes the optional cleanup from PR 649 review. * fix(ui): expose localized variant selection diagnostics Show target warnings with source paths, localize ambiguity across preview and detail consumers, and let skipped preview rows add a physical exclude pattern. Show tracked repository variant counts alongside logical skills. Drop display-only rendered cases while retaining mutation protection and plain TypeScript logic coverage. Inspect target states in Clean/Playful light/dark and Traditional Chinese. * docs(variants): explain diagnostics and add sync runbook Document doctor variant_routing and logical/physical counts, diff selection skips, and the nested parent-skill boundary. Keep all four command translations aligned and add isolated account/project E2E scenarios. Both runbook steps passed in the authorized Linux Codex container with separate HOME/XDG/TMPDIR fixtures. Website typecheck and all five locale builds passed. * test(config): use native paths in project conversion fixture The shared-agent regression fixture appended slash-separated suffixes to Windows temporary paths, so project path matching returned no candidates. Build each path with filepath.Join and preserve all conversion assertions. Focused project configuration tests passed in the authorized isolated Linux Codex container, not the devcontainer. Windows CI verifies the platform-specific fixture correction. * fix(ui): recompute shared skill routing for filter previews Evaluate edited include/exclude settings in the complete target map before classifying the draft, so a formerly shared folder no longer keeps its old union when the filters differ. Preserve the saved target configuration. * fix(mcp): keep parent skills when peer variants route elsewhere Do not treat an otherwise eligible variant for another agent as an unserved nested skill. Continue blocking parent publication for explicitly filtered, disabled, ambiguous, or invalid children so filters still hide their files. * fix(ui): distinguish agent selection from naming skips Expose separate naming and selection skip counts on target summaries. Show each applicable remedy in target details and sync previews so ambiguity keeps its filter/override guidance alongside naming and collision hints. * fix(list): include disabled rows in tracked repository counts Count the complete inventory that list displays, including ignored skills and physical variants, without changing the enabled counts used by status, install, or sync. Clone rows before counting to preserve disabled state. * docs: align variant counts and routing recovery guidance Show logical skill and physical variant counts in list/install documentation and keep the four translations aligned with the filtering examples. Explain that agent-named skill parents keep ordinary nested skills and retain the devcontainer-only runbook environment. Removal warnings now recommend a source-local override, since include filters cannot undo agent routing. * fix(mcp): preserve explicit target restrictions on nested variants Limit the differently routed child exemption to automatic layout inference. Frontmatter targets and dashboard source-local overrides must still prevent a parent from publishing files explicitly restricted to another target. * fix(ui): fill target name in naming warning guidance Pass the current target name when rendering localized warning hints so the same naming guidance shown beside the controls does not expose a placeholder in the warning banner. Verified in the populated target preview. --------- Co-authored-by: Willie <egg358358@gmail.com>
393 lines
14 KiB
Go
393 lines
14 KiB
Go
package sync
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"skillshare/internal/config"
|
|
"skillshare/internal/install"
|
|
)
|
|
|
|
func TestTrackedAgentCategoriesRemainOrdinarySkills(t *testing.T) {
|
|
src := t.TempDir()
|
|
for _, category := range []string{"agents", "continue", "pi", "warp", "factory", "copilot"} {
|
|
writeSkillMD(t, filepath.Join(src, "_repo/skills", category, category+"-planner"), "# Instructions")
|
|
}
|
|
for _, lite := range []bool{false, true} {
|
|
var skills []DiscoveredSkill
|
|
var err error
|
|
if lite {
|
|
skills, _, err = DiscoverSourceSkillsLite(src)
|
|
} else {
|
|
skills, err = DiscoverSourceSkills(src)
|
|
}
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, sk := range skills {
|
|
if sk.LogicalID != "" || sk.VariantAgent != "" {
|
|
t.Fatalf("category inferred as variant: %+v", sk)
|
|
}
|
|
}
|
|
if !lite {
|
|
selected, err := SelectTargetSkills(skills, "claude", config.ResourceTargetConfig{})
|
|
if err != nil || len(selected) != 6 {
|
|
t.Fatalf("category selection = %d, %v", len(selected), err)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantsSharedFolder(t *testing.T) {
|
|
for _, mode := range []string{"merge", "copy"} {
|
|
t.Run(mode, func(t *testing.T) {
|
|
src, dest := t.TempDir(), t.TempDir()
|
|
for _, agent := range []string{"claude", "codex"} {
|
|
writeSkillMD(t, filepath.Join(src, "_repo/skills", agent, "fix"), "# Instructions for "+agent)
|
|
}
|
|
skills, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
targets := map[string]config.TargetConfig{
|
|
"codex": {Path: dest}, "universal": {Path: dest},
|
|
}
|
|
cfg := &config.Config{Source: src, Mode: mode, Targets: targets}
|
|
for i := 0; i < 2; i++ {
|
|
result, err := ExecuteTargets(context.Background(), cfg, targets, ExecuteOptions{Kinds: []string{"skill"}, Discovery: TargetDiscovery{Skills: skills}})
|
|
if err != nil || len(result.Failed) != 0 {
|
|
t.Fatalf("sync: %+v, %v", result, err)
|
|
}
|
|
for _, r := range result.Results {
|
|
if len(r.Pruned) != 0 {
|
|
t.Fatalf("shared variant pruned: %+v", r)
|
|
}
|
|
}
|
|
got, err := os.ReadFile(filepath.Join(dest, "_repo__skills__codex__fix", "SKILL.md"))
|
|
if err != nil || string(got) != "# Instructions for codex" {
|
|
t.Fatalf("Codex lost variant: %q, %v", got, err)
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantsRouteAndPreserveBytes(t *testing.T) {
|
|
src := t.TempDir()
|
|
for _, agent := range []string{"claude-code", "codex"} {
|
|
for _, name := range []string{"fix", "review/fix"} {
|
|
writeSkillMD(t, filepath.Join(src, "_repo/internal/skills", agent, name), "---\nname: fix\ndescription: Review changes\n---\nInstructions for "+agent+"\n")
|
|
}
|
|
}
|
|
skills, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(skills) != 4 {
|
|
t.Fatalf("physical entries = %d, want 4", len(skills))
|
|
}
|
|
for _, tc := range []struct {
|
|
name, agent string
|
|
want int
|
|
}{
|
|
{"claude", "", 2}, {"claude-code", "", 2}, {"codex", "", 2},
|
|
{"codex-work", "codex", 2}, {"universal", "", 0}, {"cursor", "", 0},
|
|
} {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
for _, mode := range []string{"merge", "copy"} {
|
|
target := config.TargetConfig{Agent: tc.agent, Path: filepath.Join(t.TempDir(), "skills"), Mode: mode}
|
|
selected, err := SelectTargetSkills(skills, tc.name, target.SkillsConfig())
|
|
if err != nil || len(selected) != tc.want {
|
|
t.Fatalf("selected = %d, want %d: %v", len(selected), tc.want, err)
|
|
}
|
|
run := SyncSkillTarget(SkillTarget{Name: tc.name, Target: target, Mode: mode}, skills, SkillRunOptions{Source: src})
|
|
if run.Err != nil || len(run.Linked) != tc.want {
|
|
t.Fatalf("%s sync = %+v", mode, run)
|
|
}
|
|
for _, sk := range selected {
|
|
want, err := os.ReadFile(filepath.Join(sk.SourcePath, "SKILL.md"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got, err := os.ReadFile(filepath.Join(target.Path, sk.FlatName, "SKILL.md"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !bytes.Equal(got, want) {
|
|
t.Fatalf("%s changed bytes for %s", mode, sk.RelPath)
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantRoutingPrecedence(t *testing.T) {
|
|
src := t.TempDir()
|
|
paths := []string{"_repo/claude/skills/codex/inferred", "_repo/skills/codex/explicit", "_repo/skills/codex/all", "_repo/skills/codex/override"}
|
|
for _, path := range paths {
|
|
// A second canonical agent distinguishes this family from a category.
|
|
peer := strings.Replace(path, "/skills/codex/", "/skills/claude/", 1)
|
|
writeSkillMD(t, filepath.Join(src, peer), "---\nmetadata:\n targets: [unused]\n---\n# Peer")
|
|
content := "# Instructions"
|
|
if filepath.Base(path) == "explicit" || filepath.Base(path) == "override" {
|
|
content = "---\nmetadata:\n targets: [custom]\n---\n# Instructions"
|
|
}
|
|
writeSkillMD(t, filepath.Join(src, path), content)
|
|
}
|
|
store := install.NewMetadataStore()
|
|
store.SetTargetOverride(paths[2], nil)
|
|
store.SetTargetOverride(paths[3], []string{"claude"})
|
|
if err := store.Save(src); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
skills, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, tc := range []struct {
|
|
name string
|
|
want []string
|
|
}{
|
|
{"codex", []string{paths[0], paths[2]}}, {"universal", []string{paths[2]}},
|
|
{"custom", []string{paths[1], paths[2]}}, {"claude", []string{paths[2], paths[3]}},
|
|
} {
|
|
got, err := SelectTargetSkills(skills, tc.name, config.ResourceTargetConfig{})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(got) != len(tc.want) {
|
|
t.Errorf("%s paths = %v, want %v", tc.name, got, tc.want)
|
|
continue
|
|
}
|
|
for _, sk := range got {
|
|
found := false
|
|
for _, want := range tc.want {
|
|
found = found || sk.RelPath == want
|
|
}
|
|
if !found {
|
|
t.Errorf("%s unexpectedly receives %s", tc.name, sk.RelPath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantAliasAmbiguity(t *testing.T) {
|
|
src := t.TempDir()
|
|
for _, agent := range []string{"claude", "claude-code", "codex"} {
|
|
writeSkillMD(t, filepath.Join(src, "_repo/skills", agent, "fix"), "# Instructions")
|
|
}
|
|
skills, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got, err := SelectTargetSkills(skills, "claude", config.ResourceTargetConfig{})
|
|
if err != nil || len(got) != 0 {
|
|
t.Fatalf("ambiguous Claude variants selected = %v: %v", got, err)
|
|
}
|
|
resolution, err := ResolveTargetSkillsForTarget("claude", config.ResourceTargetConfig{}, skills)
|
|
if err != nil || len(resolution.SelectionWarnings) == 0 || len(resolution.Warnings) != 0 || resolution.NamingSkippedCount != 0 {
|
|
t.Fatalf("ambiguous variants need a diagnostic: %+v, %v", resolution, err)
|
|
}
|
|
got, err = SelectTargetSkills(skills, "claude", config.ResourceTargetConfig{Include: []string{"_repo__skills__claude__fix"}})
|
|
if err != nil || len(got) != 1 {
|
|
t.Fatalf("explicit include should resolve ambiguity: %v, %v", got, err)
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantCountsKeepRepositoryPrefixAndSuffix(t *testing.T) {
|
|
src := t.TempDir()
|
|
for _, repo := range []string{"_one", "org/_two"} {
|
|
if err := os.MkdirAll(filepath.Join(src, repo, ".git"), 0755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, prefix := range []string{"internal/skills", "other/skills"} {
|
|
for _, suffix := range []string{"fix", "review/skills/codex/fix"} {
|
|
for _, agent := range []string{"claude", "codex"} {
|
|
writeSkillMD(t, filepath.Join(src, repo, prefix, agent, suffix), "# Instructions")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Unknown agent layouts and ordinary skills remain independent physical skills.
|
|
for _, path := range []string{"_one/skills/unknown/fix", "_one/skills/shared/fix", "skills/claude/fix", "skills/codex/fix"} {
|
|
writeSkillMD(t, filepath.Join(src, path), "# Instructions")
|
|
}
|
|
full, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
lite, _, err := DiscoverSourceSkillsLite(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, skills := range [][]DiscoveredSkill{full, lite} {
|
|
counts, repos := CountSkillsByRepo(skills)
|
|
if counts.Skills != 12 || counts.Variants != 20 {
|
|
t.Errorf("source counts = %+v, want 12 skills/20 variants", counts)
|
|
}
|
|
if repos["_one"].Skills != 6 || repos["org/_two"].Skills != 4 {
|
|
t.Errorf("repo counts = %+v", repos)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantIgnoresAndPhysicalContext(t *testing.T) {
|
|
src := t.TempDir()
|
|
for _, path := range []string{"_repo/skills/claude/fix", "_repo/skills/codex/fix", "_repo/skills/claude/hidden", "_repo/skills/codex/hidden"} {
|
|
writeSkillMD(t, filepath.Join(src, path), "---\nname: fix\ndescription: Review changes\n---\n# Instructions")
|
|
}
|
|
if err := os.WriteFile(filepath.Join(src, ".skillignore"), []byte("**/hidden\n_repo/skills/claude/fix\n"), 0644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
skills, err := DiscoverSourceSkillsForAnalyze(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
counts := CountSkills(skills)
|
|
if counts.Skills != 1 || counts.Variants != 1 {
|
|
t.Fatalf("active counts = %+v", counts)
|
|
}
|
|
selected, err := SelectTargetSkills(skills, "claude", config.ResourceTargetConfig{Include: []string{"*"}})
|
|
if err != nil || len(selected) != 0 {
|
|
t.Fatalf("ignored Claude gets substitute: %+v, %v", selected, err)
|
|
}
|
|
for _, mode := range []string{"merge", "symlink"} {
|
|
target := config.TargetConfig{Mode: mode}
|
|
loaded, err := TargetSkills("codex", target, mode, src, skills)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want := 1
|
|
if mode == "symlink" {
|
|
want = 4
|
|
}
|
|
if len(loaded) != want {
|
|
t.Fatalf("%s physical context entries = %d, want %d", mode, len(loaded), want)
|
|
}
|
|
for _, sk := range loaded {
|
|
if sk.BodyChars == 0 {
|
|
t.Fatalf("missing physical context for %s", sk.RelPath)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantUpgradeDisclosesPrunedEntries(t *testing.T) {
|
|
for _, mode := range []string{"merge", "copy"} {
|
|
t.Run(mode, func(t *testing.T) {
|
|
src := t.TempDir()
|
|
store := install.NewMetadataStore()
|
|
for _, agent := range []string{"claude", "codex"} {
|
|
rel := "_repo/skills/" + agent + "/fix"
|
|
writeSkillMD(t, filepath.Join(src, rel), "# Instructions for "+agent)
|
|
store.SetTargetOverride(rel, nil)
|
|
}
|
|
if err := store.Save(src); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
// Empty overrides reproduce the unrestricted selection of pre-upgrade discovery.
|
|
legacy, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
target := SkillTarget{Name: "universal", Target: config.TargetConfig{Path: t.TempDir(), Mode: mode}, Mode: mode}
|
|
before := SyncSkillTarget(target, legacy, SkillRunOptions{Source: src})
|
|
if before.Err != nil || len(before.Linked) != 2 {
|
|
t.Fatalf("unrestricted sync: %+v", before)
|
|
}
|
|
store.RemoveTargetOverrides("_repo")
|
|
if err := store.Save(src); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
inferred, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, dryRun := range []bool{true, false} {
|
|
after := SyncSkillTarget(target, inferred, SkillRunOptions{Source: src, DryRun: dryRun})
|
|
warnings := strings.Join(after.Warnings, "\n")
|
|
if after.Err != nil || len(after.Pruned) != 2 {
|
|
t.Fatalf("upgrade prune: %+v", after)
|
|
}
|
|
if !strings.Contains(warnings, "automatic agent routing") || !strings.Contains(warnings, "target override") {
|
|
t.Fatalf("upgrade removals need routing and recovery explanation: %+v", after)
|
|
}
|
|
}
|
|
for _, sk := range inferred {
|
|
if _, err := os.Stat(filepath.Join(sk.SourcePath, "SKILL.md")); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := os.Lstat(filepath.Join(target.Target.Path, sk.FlatName)); !os.IsNotExist(err) {
|
|
t.Fatalf("mismatched target entry survived: %s, %v", sk.FlatName, err)
|
|
}
|
|
}
|
|
store.SetTargetOverride("_repo/skills/codex/fix", []string{"universal"})
|
|
if err := store.Save(src); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
restored, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
recovery := SyncSkillTarget(target, restored, SkillRunOptions{Source: src})
|
|
if recovery.Err != nil || len(recovery.Linked) != 1 || len(recovery.Pruned) != 0 {
|
|
t.Fatalf("override recovery: %+v", recovery)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestTrackedVariantAmbiguousPruneExplainsRemoval(t *testing.T) {
|
|
for _, mode := range []string{"merge", "copy"} {
|
|
t.Run(mode, func(t *testing.T) {
|
|
src := t.TempDir()
|
|
for _, agent := range []string{"claude", "codex"} {
|
|
writeSkillMD(t, filepath.Join(src, "_repo/skills", agent, "fix"), "# Instructions")
|
|
}
|
|
target := SkillTarget{Name: "claude", Target: config.TargetConfig{Path: t.TempDir()}, Mode: mode}
|
|
skills, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if result := SyncSkillTarget(target, skills, SkillRunOptions{Source: src}); result.Err != nil || len(result.Linked) != 1 {
|
|
t.Fatalf("initial sync: %+v", result)
|
|
}
|
|
writeSkillMD(t, filepath.Join(src, "_repo/skills/claude-code/fix"), "# Alias makes selection ambiguous")
|
|
skills, err = DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
result := SyncSkillTarget(target, skills, SkillRunOptions{Source: src})
|
|
if result.Err != nil || len(result.Pruned) != 1 || !strings.Contains(strings.Join(result.Warnings, "\n"), "ambiguous") {
|
|
t.Fatalf("silent ambiguous removal: %+v", result)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestNestedAgentNamedSkillsRemainOrdinary(t *testing.T) {
|
|
src := t.TempDir()
|
|
for _, agent := range []string{"codex", "gemini"} {
|
|
writeSkillMD(t, filepath.Join(src, "_repo/skills", agent), "# Parent skill")
|
|
writeSkillMD(t, filepath.Join(src, "_repo/skills", agent, "review"), "# Nested skill")
|
|
}
|
|
skills, err := DiscoverSourceSkills(src)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, skill := range skills {
|
|
if skill.LogicalID != "" {
|
|
t.Fatalf("ordinary nested skill inferred as variant: %+v", skill)
|
|
}
|
|
}
|
|
selected, err := SelectTargetSkills(skills, "claude", config.ResourceTargetConfig{})
|
|
if err != nil || len(selected) != 4 {
|
|
t.Fatalf("selected = %v, %v", selected, err)
|
|
}
|
|
}
|