Class: LocalVault::MCP::ExecCommandBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/localvault/mcp/exec_command_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(command:, vault: nil, project: nil, only: nil, except: nil, map: nil, profile: nil) ⇒ ExecCommandBuilder

Returns a new instance of ExecCommandBuilder.



7
8
9
10
11
12
13
14
15
# File 'lib/localvault/mcp/exec_command_builder.rb', line 7

def initialize(command:, vault: nil, project: nil, only: nil, except: nil, map: nil, profile: nil)
  @command = command
  @vault = vault
  @project = project
  @only = only
  @except = except
  @map = map
  @profile = profile
end

Instance Method Details

#buildObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/localvault/mcp/exec_command_builder.rb', line 17

def build
  validate!
  argv = ["localvault", "exec"]
  append(argv, "-v", @vault)
  append(argv, "--project", @project)
  append(argv, "--only", serialize_selectors(@only))
  append(argv, "--except", serialize_selectors(@except))
  append(argv, "--map", serialize_map)
  append(argv, "--profile", @profile)
  argv.concat(["--", *@command])

  {
    "command" => Shellwords.join(argv),
    "exposes_plaintext" => false,
    "executes_command" => false,
    "next_action" => "Run this command through your normal shell tool."
  }.freeze
end