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
10 changes: 10 additions & 0 deletions cmd/pilotctl/skills.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ func cmdSkillsDisable(args []string) {
"usage: pilotctl skills disable <skill-id|all>",
"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)
Expand Down Expand Up @@ -344,6 +349,11 @@ func cmdSkillsEnable(args []string) {
"usage: pilotctl skills enable <skill-id|all>",
"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)
Expand Down
29 changes: 29 additions & 0 deletions cmd/pilotctl/zz_skills_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <skill-id> 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)
}
}
Loading