module Bai

Overview

Bai exposes the CLI entry logic for the executable and for tests.

Defined in:

bai.cr
bai/anthropic_client.cr
bai/types.cr

Constant Summary

VERSION = "0.4.1"

The current released version of the CLI.

Class Method Summary

Class Method Detail

def self.run(argv : Array(String), stdin : IO = STDIN, stdout : IO = STDOUT, stderr : IO = STDERR, stdin_tty : Bool = STDIN.tty?, command_requester : Proc(String, RequestOptions, GenerationResult) | Nil = nil, clipboard_copier : Proc(String, Bool) | Nil = nil) : Int32 #

Parses CLI arguments and prints either help text, a dry-run prompt preview, or the proposed shell command.

The query is read from argv first and falls back to stdin when piped input is available. Returns 0 on success, 1 on runtime or API failures, and 2 when no query was provided.