diff --git a/cmd/pilotctl/skills.go b/cmd/pilotctl/skills.go index 5d12e2d9..62bcf727 100644 --- a/cmd/pilotctl/skills.go +++ b/cmd/pilotctl/skills.go @@ -253,6 +253,11 @@ func cmdSkillsDisable(args []string) { "usage: pilotctl skills disable ", "skill id required") } + if args[0] != "all" { + fatalHint("invalid_argument", + "only 'all' is supported; per-skill disable is not yet implemented", + "unknown skill id: %s", args[0]) + } home, err := os.UserHomeDir() if err != nil { fatalCode("internal", "home dir: %v", err) @@ -344,6 +349,11 @@ func cmdSkillsEnable(args []string) { "usage: pilotctl skills enable ", "skill id required") } + if args[0] != "all" { + fatalHint("invalid_argument", + "only 'all' is supported; per-skill enable is not yet implemented", + "unknown skill id: %s", args[0]) + } home, err := os.UserHomeDir() if err != nil { fatalCode("internal", "home dir: %v", err) diff --git a/cmd/pilotctl/zz_skills_test.go b/cmd/pilotctl/zz_skills_test.go index 56123d9c..968bfb52 100644 --- a/cmd/pilotctl/zz_skills_test.go +++ b/cmd/pilotctl/zz_skills_test.go @@ -153,3 +153,32 @@ func TestCLISkillsDisable_RejectsNoArgs(t *testing.T) { t.Errorf("expected 'usage' or 'skill id required' in stderr, got: %s", stderr) } } + +// TestCLISkillsDisable_RejectsNonAll pins the PILOT-394 fix: pre-fix the +// command accepted any but silently ran a global disable. +// Now only "all" is accepted; anything else prints an error. +func TestCLISkillsDisable_RejectsNonAll(t *testing.T) { + t.Parallel() + _, stderr, code := runCLI(t, []string{"skills", "disable", "foo"}, nil) + if code == 0 { + t.Fatalf("expected non-zero exit for 'disable foo', got 0\nstderr=%s", stderr) + } + low := strings.ToLower(stderr) + if !strings.Contains(low, "only 'all' is supported") { + t.Errorf("expected 'only all is supported' in stderr, got: %s", stderr) + } +} + +// TestCLISkillsEnable_RejectsNonAll pins the PILOT-394 fix for the +// enable side: only "all" is accepted; anything else prints an error. +func TestCLISkillsEnable_RejectsNonAll(t *testing.T) { + t.Parallel() + _, stderr, code := runCLI(t, []string{"skills", "enable", "bar"}, nil) + if code == 0 { + t.Fatalf("expected non-zero exit for 'enable bar', got 0\nstderr=%s", stderr) + } + low := strings.ToLower(stderr) + if !strings.Contains(low, "only 'all' is supported") { + t.Errorf("expected 'only all is supported' in stderr, got: %s", stderr) + } +}