Class: Textus::CLI::Verb::Propose

Inherits:
Textus::CLI::Verb show all
Defined in:
lib/textus/cli/verb/propose.rb

Overview

Queue a proposal. Mirrors the MCP ‘propose` tool: resolves the manifest’s propose_zone and prefixes the key, so the author does not need to know the queue zone’s name. ADR 0036.

Instance Attribute Summary

Attributes inherited from Textus::CLI::Verb

#positional

Instance Method Summary collapse

Methods inherited from Textus::CLI::Verb

command_name, #context_for, descendants, #emit, inherited, #initialize, needs_store?, option, options, parent_group, #parse, #resolved_role, #session_for

Constructor Details

This class inherits a constructor from Textus::CLI::Verb

Instance Method Details

#call(store) ⇒ Object

Raises:



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/textus/cli/verb/propose.rb', line 13

def call(store)
  rel = positional.shift or raise UsageError.new("propose requires a key")
  raise UsageError.new("propose requires --stdin") unless use_stdin

  payload = JSON.parse(@stdin.read)
  env = store.as(resolved_role(store)).propose(
    rel,
    meta: payload["_meta"] || {},
    body: payload["body"] || "",
  )
  emit(env.to_h_for_wire)
end