Skip to content
Kward Search API index

Module: Kward::CLI::ProjectSkillsCommands

Defined in:
lib/kward/cli/project_skills_commands.rb

Overview

Handles explicit project skill trust management commands.

Instance Method Summary collapse

Instance Method Details

#handle_project_skills_cli_command(arguments) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/kward/cli/project_skills_commands.rb', line 6

def handle_project_skills_cli_command(arguments)
  argument = Array(arguments).join(" ").strip.downcase
  _workspace_root, candidates, coordinator = project_skill_trust_coordinator
  if candidates.empty? && argument != "untrust"
    @prompt.say("No project skills found in the current workspace.")
    return
  end

  case argument
  when "", "status"
    lines = candidates.empty? ? ["No project skills found in the current workspace."] : candidates.map { |candidate| "#{relative_workspace_path(candidate.path)}: #{coordinator.decision(candidate) || "needs review"}" }
    @prompt.say(lines.join("\n"))
  when "trust"
    coordinator.record!(candidates, "allow")
    @prompt.say("Project skills trusted for the current skill snapshots.")
  when "untrust"
    coordinator.remove_workspace!
    @prompt.say("Project skill trust removed for this workspace.")
  when "review"
    review_project_skills(candidates)
  else
    raise ArgumentError, "Usage: kward skills [status|trust|untrust|review]"
  end
end

#handle_project_skills_command(argument) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/kward/cli/project_skills_commands.rb', line 31

def handle_project_skills_command(argument)
  case argument.to_s.strip.downcase
  when "", "status"
    show_project_skills_status
  when "trust"
    trust_current_project_skills
  when "untrust"
    untrust_current_project_skills
  else
    runtime_output("Usage: /skills [status|trust|untrust]")
  end
end