Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is the current version of oat. Kept as a package-level alias for backwards compatibility with callers that set it directly via older `-ldflags "-X .../internal/cli.Version=..."` invocations. New build tooling should set internal/version.Version instead; the canonical getter (GetVersion) already consults that package.

Functions

func GetVersion

func GetVersion() string

GetVersion returns the semver-formatted version string for the running binary. Release builds inject the real version via ldflags into internal/version; development builds fall back to Go's VCS stamps so `go install …@sha` still produces a useful "0.0.0+<sha>-dev" label.

func IsDevVersion

func IsDevVersion() bool

IsDevVersion reports whether the binary was built without a release version stamp (either via the new internal/version package or the legacy internal/cli.Version override).

func ParseFlags

func ParseFlags(args []string) (map[string]string, []string)

ParseFlags is a simple flag parser

func SelectFromList

func SelectFromList(prompt string, items []SelectableItem) (string, error)

SelectFromList displays a list of items and prompts the user to select one. Returns the selected item name, or empty string if canceled. If there's only one item, it's auto-selected without prompting.

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

CLI manages the command-line interface.

Every exec.Command and worktree.Manager constructed by a CLI method uses ctx so that Ctrl-C (SIGINT) cancels in-flight git / gh / tmux calls instead of orphaning them. The ctx is populated by Execute; when using the CLI outside of a signal-aware entry point (tests), ctx defaults to context.Background().

func New

func New() (*CLI, error)

New creates a new CLI

func NewWithPaths

func NewWithPaths(paths *config.Paths) *CLI

NewWithPaths creates a CLI with custom paths (for testing)

func (*CLI) Execute

func (c *CLI) Execute(args []string) error

Execute executes the CLI with the given arguments

func (*CLI) GenerateDocumentation

func (c *CLI) GenerateDocumentation() string

GenerateDocumentation generates the full markdown reference for every registered CLI command. Used by `oat docs` and tests; agent prompts should call GenerateDocumentationForAgent instead so human-only and agent-irrelevant commands get trimmed.

func (*CLI) GenerateDocumentationForAgent

func (c *CLI) GenerateDocumentationForAgent(agentType state.AgentType) string

GenerateDocumentationForAgent returns a CLI reference trimmed to the commands relevant to agentType. Pass an empty agentType to drop only human-only commands while keeping everything else.

func (*CLI) SetContext

func (c *CLI) SetContext(ctx context.Context)

SetContext wires a cancellable context into the CLI. Must be called by the entry point before Execute so that SIGINT / SIGTERM propagate into exec.Command calls spawned by CLI commands.

type Command

type Command struct {
	Name        string
	Description string
	Usage       string
	Run         func(args []string) error
	Subcommands map[string]*Command
}

Command represents a CLI command

type SelectableItem

type SelectableItem struct {
	Name        string
	Description string
}

SelectableItem represents an item that can be selected from a list

type VerificationCheck

type VerificationCheck struct {
	Name        string   `json:"name"`
	Passed      bool     `json:"passed"`
	Score       float64  `json:"score"` // 0-100
	Issues      []string `json:"issues"`
	AutoFixable bool     `json:"auto_fixable"`
	Duration    string   `json:"duration"`
	Details     string   `json:"details,omitempty"`
}

VerificationCheck represents a single verification check

type VerificationResult

type VerificationResult struct {
	OverallScore     float64           `json:"overall_score"`
	OverallPassed    bool              `json:"overall_passed"`
	TaskAlignment    VerificationCheck `json:"task_alignment"`
	InputValidation  VerificationCheck `json:"input_validation"`
	TestExecution    VerificationCheck `json:"test_execution"`
	FileIntegrity    VerificationCheck `json:"file_integrity"`
	SyntaxValidation VerificationCheck `json:"syntax_validation"`
	Recommendations  []string          `json:"recommendations"`
	AutoFixAttempted bool              `json:"auto_fix_attempted"`
	AutoFixResults   map[string]string `json:"auto_fix_results,omitempty"`
}

VerificationResult holds the complete verification results

type WorkerConfig

type WorkerConfig struct {
	PushToBranch string           // Branch to push to instead of creating a new PR (for iterating on existing PRs)
	ForkConfig   state.ForkConfig // Fork configuration (if working in a fork)
	IssueNumber  string           // GitHub issue number for this task (optional, for issue-tied comments)
	IssueURL     string           // Optional issue URL
}

WorkerConfig holds configuration for creating worker prompts

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL