Module: PromptObjects::CLI

Defined in:
lib/prompt_objects/cli.rb,
lib/prompt_objects/cli/helpers.rb,
lib/prompt_objects/cli/env_command.rb,
lib/prompt_objects/cli/repl_command.rb,
lib/prompt_objects/cli/serve_command.rb,
lib/prompt_objects/cli/events_command.rb,
lib/prompt_objects/cli/explore_command.rb,
lib/prompt_objects/cli/message_command.rb,
lib/prompt_objects/cli/diagnostics_command.rb

Overview

Command-line interface. CLI.run is the single entry point used by the prompt_objects and poop executables; each command lives in its own class under lib/prompt_objects/cli/.

Defined Under Namespace

Modules: Helpers Classes: DiagnosticsCommand, EnvCommand, EventsCommand, ExploreCommand, MessageCommand, REPL, ReplCommand, Sandbox, ServeCommand

Class Method Summary collapse

Class Method Details



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/prompt_objects/cli.rb', line 46

def self.print_main_help
  prog = Helpers.program_name
  puts <<~HELP
    Usage: #{prog} <command> [options]

    Commands:
      env                          Manage environments (create, list, export, etc.)
      serve <env>                  Run environment as a web server
      message <env> <po> "text"    Send a message to a PO and print the response
      events <env> [--session ID]  Show recent events from the message bus
      diagnostics <env> [--json]   Show content-free runtime health metrics
      explore [env] [--session ID] Open Thread Explorer to visualize conversations
      repl [name] [objects_dir]    Start interactive REPL with a prompt object
      help                         Show this help message

    Run '#{prog} <command> --help' for command-specific help.

    Examples:
      #{prog} env list                     # List all environments
      #{prog} env create demo --template basic  # Create from template
      #{prog} serve my-env                 # Start web UI
      #{prog} serve my-env --open          # Start and open browser
      #{prog} message my-env solver "Hello"     # Send a message
      #{prog} message my-env solver "Hello" --json  # JSON output
      #{prog} explore my-env                  # Visualize conversations
  HELP
end

.run(argv) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/prompt_objects/cli.rb', line 17

def self.run(argv)
  command = argv[0]
  args = argv[1..] || []

  case command
  when nil, "help", "--help", "-h"
    print_main_help
  when "version", "--version", "-v"
    puts PromptObjects::VERSION
  when "env"
    EnvCommand.new.run(args)
  when "serve"
    ServeCommand.new.run(args)
  when "message", "msg"
    MessageCommand.new.run(args)
  when "events"
    EventsCommand.new.run(args)
  when "diagnostics", "diag"
    DiagnosticsCommand.new.run(args)
  when "explore"
    ExploreCommand.new.run(args)
  when "repl"
    ReplCommand.new.run(args)
  else
    # Legacy behavior: treat as repl with name argument
    ReplCommand.new.run(argv)
  end
end