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
.print_main_help ⇒ Object
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 " Usage: \#{prog} <command> [options]\n\n Commands:\n env Manage environments (create, list, export, etc.)\n serve <env> Run environment as a web server\n message <env> <po> \"text\" Send a message to a PO and print the response\n events <env> [--session ID] Show recent events from the message bus\n diagnostics <env> [--json] Show content-free runtime health metrics\n explore [env] [--session ID] Open Thread Explorer to visualize conversations\n repl [name] [objects_dir] Start interactive REPL with a prompt object\n help Show this help message\n\n Run '\#{prog} <command> --help' for command-specific help.\n\n Examples:\n \#{prog} env list # List all environments\n \#{prog} env create demo --template basic # Create from template\n \#{prog} serve my-env # Start web UI\n \#{prog} serve my-env --open # Start and open browser\n \#{prog} message my-env solver \"Hello\" # Send a message\n \#{prog} message my-env solver \"Hello\" --json # JSON output\n \#{prog} explore my-env # Visualize conversations\n HELP\nend\n" |
.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 |