cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package cli implements the agentmod command dispatcher: flag parsing, help text, and exit codes. Subcommands register here as they land.

Index

Constants

View Source
const (
	ExitOK           = 0 // success
	ExitError        = 1 // generic error
	ExitNotInProject = 2 // not inside an agentmod project where one is required
	ExitValidation   = 3 // validation/verification failure (doctor, snapshot verify)
)

Exit codes (IMPLEMENTATION_PLAN §3).

Variables

View Source
var Version = devVersion

Functions

func Run

func Run(args []string, stdout, stderr io.Writer) int

Run dispatches command-line args (without the program name) and returns the process exit code. All output goes to the supplied writers so tests can capture it.

Types

type Env

type Env struct {
	Getwd      func() (string, error)
	LookupEnv  func(key string) (string, bool)
	GOOS       string
	Stdin      io.Reader
	Executable func() (string, error)
	Now        func() time.Time
}

Env carries the parts of the process environment the CLI reads, so tests can substitute fakes without touching real process state. GOOS is the runtime.GOOS value, injected so platform-specific findings (the macOS Keychain note) are testable on any host; fakes leave it "" (treated as not-darwin) unless a test sets it explicitly. Stdin is the process stdin (consumed by `guard claude-bash`); fakes leave it nil (treated as empty) unless a test sets it. Executable resolves the running agentmod binary's absolute path (consumed by init's guard wiring); fakes return a fixed fake path so wiring is exercised without a real binary. Now is the clock (consumed by handoff create for the manifest timestamp and default snapshot name); fakes return a fixed instant so output is deterministic.

Jump to

Keyboard shortcuts

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