| 29 | ) |
| 30 | |
| 31 | func TestNewCmdInstall(t *testing.T) { |
| 32 | tests := []struct { |
| 33 | name string |
| 34 | cli string |
| 35 | wantOpts InstallOptions |
| 36 | wantLocalPath bool |
| 37 | wantErr bool |
| 38 | }{ |
| 39 | { |
| 40 | name: "repo argument only", |
| 41 | cli: "monalisa/skills-repo", |
| 42 | wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", Scope: "project"}, |
| 43 | }, |
| 44 | { |
| 45 | name: "repo and skill", |
| 46 | cli: "monalisa/skills-repo git-commit", |
| 47 | wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", SkillName: "git-commit", Scope: "project"}, |
| 48 | }, |
| 49 | { |
| 50 | name: "repo and all flag", |
| 51 | cli: "monalisa/skills-repo --all", |
| 52 | wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", All: true, Scope: "project"}, |
| 53 | }, |
| 54 | { |
| 55 | name: "all flags", |
| 56 | cli: "monalisa/skills-repo git-commit --agent github-copilot --scope user --pin v1.0.0 --force", |
| 57 | wantOpts: InstallOptions{ |
| 58 | SkillSource: "monalisa/skills-repo", |
| 59 | SkillName: "git-commit", |
| 60 | Agent: "github-copilot", |
| 61 | Scope: "user", |
| 62 | Pin: "v1.0.0", |
| 63 | Force: true, |
| 64 | }, |
| 65 | }, |
| 66 | { |
| 67 | name: "dir flag", |
| 68 | cli: "monalisa/skills-repo git-commit --dir ./custom-skills", |
| 69 | wantOpts: InstallOptions{SkillSource: "monalisa/skills-repo", SkillName: "git-commit", Dir: "./custom-skills", Scope: "project"}, |
| 70 | }, |
| 71 | { |
| 72 | name: "too many args", |
| 73 | cli: "a b c", |
| 74 | wantErr: true, |
| 75 | }, |
| 76 | { |
| 77 | name: "invalid agent flag", |
| 78 | cli: "monalisa/skills-repo git-commit --agent nonexistent", |
| 79 | wantErr: true, |
| 80 | }, |
| 81 | { |
| 82 | name: "pin conflicts with inline version", |
| 83 | cli: "monalisa/skills-repo git-commit@v1.0.0 --pin v2.0.0", |
| 84 | wantErr: true, |
| 85 | }, |
| 86 | { |
| 87 | name: "all conflicts with skill name", |
| 88 | cli: "monalisa/skills-repo git-commit --all", |