Class: Ask::CodingHarness::CLI
- Inherits:
-
Object
- Object
- Ask::CodingHarness::CLI
- Defined in:
- lib/ask/coding_harness/cli.rb
Overview
Command-line interface for the coding harness.
ach serve Start the web server (default)
ach run "task" Run a prompt headlessly against the workspace
ach sessions List saved conversations
ach version Print the version
ach help Show help
The ask-coding-harness executable runs serve by default.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv, stdout: $stdout, stderr: $stderr) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv, stdout: $stdout, stderr: $stderr) ⇒ CLI
Returns a new instance of CLI.
21 22 23 24 25 26 27 28 |
# File 'lib/ask/coding_harness/cli.rb', line 21 def initialize(argv, stdout: $stdout, stderr: $stderr) @argv = argv.dup @stdout = stdout @stderr = stderr # Fresh config per invocation: the CLI is a process boundary and # must honor the environment at launch, not a memoized global. @config = Ask::CodingHarness::Config.new end |
Class Method Details
.run(argv, stdout: $stdout, stderr: $stderr) ⇒ Object
17 18 19 |
# File 'lib/ask/coding_harness/cli.rb', line 17 def self.run(argv, stdout: $stdout, stderr: $stderr) new(argv, stdout: stdout, stderr: stderr).run end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/ask/coding_harness/cli.rb', line 30 def run command = @argv.shift || "serve" case command when "serve", "server" then serve when "demo" then serve(demo: true) when "run" then run_headless when "sessions" then list_sessions when "version", "--version", "-v" then @stdout.puts Ask::CodingHarness::VERSION when "help", "--help", "-h" then help else @stderr.puts "Unknown command: #{command}" help exit 1 end end |