cmd

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultContainerAutonomy = engine.AutonomySemi

DefaultContainerAutonomy is the tier applied when the sandbox becomes ready.

Variables

View Source
var (
	Version = "dev"
	Commit  = "none"
	Date    = "unknown"
)

Build-time variables injected by goreleaser/ldflags.

Functions

func AdvancedHelp added in v0.1.1

func AdvancedHelp() string

AdvancedHelp returns the full command reference.

func ApplyPowerLevel

func ApplyPowerLevel(sess *engine.Session, level int)

ApplyPowerLevel configures a session based on power level. When level is 0, minimal mode is applied.

func BeginnerHelp added in v0.1.1

func BeginnerHelp() string

BeginnerHelp returns a simplified help message for new users.

func BlockStyle added in v0.1.1

func BlockStyle(kind BlockKind) (titleStyle, contentStyle lipgloss.Style)

BlockStyle returns the lipgloss style for a block kind.

func BuildResearchPrompt

func BuildResearchPrompt(cfg ResearchConfig) string

BuildResearchPrompt generates the full autonomous research prompt based on Karpathy's autoresearch program.md pattern.

func DescribePower

func DescribePower(level int) string

DescribePower returns a human-readable description of what a power level does.

func DetectColorSupport added in v0.1.1

func DetectColorSupport() bool

DetectColorSupport checks if the terminal supports color output.

func DetectRunCommand

func DetectRunCommand(dir string) string

DetectRunCommand auto-detects the project's test/build command by looking for well-known build files in the given directory.

func DetectTerminalWidth added in v0.1.1

func DetectTerminalWidth() int

DetectTerminalWidth returns the terminal width or a default of 80.

func DetectUnicodeSupport added in v0.1.1

func DetectUnicodeSupport() bool

DetectUnicodeSupport checks if the terminal supports Unicode characters.

func DisplayVersion added in v0.1.1

func DisplayVersion() string

DisplayVersion returns the user-facing version string for banners and /version. Release builds inject version via ldflags; local builds fall back to VERSION file.

func Execute

func Execute() error

Execute runs the root command.

func ExportContext

func ExportContext(dir string, focus string) (string, error)

ExportContext generates a comprehensive context document about the current project. Output is optimized for pasting into any LLM chat.

func ExportContextToFile

func ExportContextToFile(dir, focus, outputPath string) error

ExportContextToFile writes context to a .md file.

func FormatAffectedTests added in v0.1.1

func FormatAffectedTests(at AffectedTests) string

FormatAffectedTests returns a human-readable summary of affected tests.

func FormatBGSessions added in v0.1.1

func FormatBGSessions(sessions []*BGSessionInfo) string

FormatBGSessions formats background sessions for display.

func FormatHistory added in v0.1.1

func FormatHistory(notifications []Notification) string

FormatHistory formats a list of notifications for display.

func FormatImageMessage added in v0.1.1

func FormatImageMessage(content string, imgPath string) string

FormatImageMessage formats a user message with image attachment info for display.

func FormatNotification added in v0.1.1

func FormatNotification(notif Notification) string

FormatNotification formats a single notification for display.

func FormatReviewReport

func FormatReviewReport(findings []ReviewFinding) string

FormatReviewReport formats findings as a readable report grouped by severity.

func FormatSuggestions added in v0.1.1

func FormatSuggestions(suggestions []Suggestion, maxDisplay int) string

FormatSuggestions formats suggestions for terminal display.

func FuzzyMatch added in v0.1.1

func FuzzyMatch(input, candidate string) (bool, float64)

FuzzyMatch performs subsequence matching between input and candidate. Returns whether there is a match and a quality score. Scores are based on: consecutive matches, start-of-word matches, exact prefix bonus.

func FuzzyScore added in v0.1.1

func FuzzyScore(query, target string) int

FuzzyScore computes a relevance score for how well query matches target. Higher scores indicate better matches. Returns -1 if no match. Scoring priorities:

  • Exact prefix match (highest)
  • Consecutive character bonus
  • Word boundary bonus (matching after / or _ or -)
  • CamelCase boundary bonus

func GenerateAgentsTemplate

func GenerateAgentsTemplate(projectType string) string

GenerateAgentsTemplate returns an AGENTS.md template for the given project type.

func GenerateManPage

func GenerateManPage() string

GenerateManPage produces a man page in roff format for hawk.

func GetHelpForLevel added in v0.1.1

func GetHelpForLevel(level UserLevel) string

GetHelpForLevel returns the appropriate help text for the user's level.

func HighlightCode added in v0.1.1

func HighlightCode(code string, language string) string

HighlightCode performs regex-based syntax highlighting for common languages. Supports Go, Python, JavaScript/TypeScript, Rust, and Bash.

func InstallCompletion added in v0.1.1

func InstallCompletion(shell string) (string, error)

InstallCompletion returns the filesystem path where the completion script should be installed for the given shell. It does not write the file; the caller should decide whether to proceed.

func IntermediateHelp added in v0.1.1

func IntermediateHelp() string

IntermediateHelp returns the standard help message.

func InvalidateModelCache added in v0.1.1

func InvalidateModelCache()

InvalidateModelCache clears all in-memory model picker rows.

func InvalidateModelCacheProvider added in v0.1.1

func InvalidateModelCacheProvider(provider string)

InvalidateModelCacheProvider drops one gateway's cached picker rows.

func IsImageFile added in v0.1.1

func IsImageFile(path string) bool

IsImageFile returns true if the path points to a supported image file.

func IsPDFFile added in v0.1.1

func IsPDFFile(path string) bool

IsPDFFile returns true if the path points to a PDF file.

func KillBGSession added in v0.1.1

func KillBGSession(id string) error

KillBGSession terminates a background session.

func ReadPDFText added in v0.1.1

func ReadPDFText(path string) (string, error)

ReadPDFText reads a PDF and extracts its text content using stdlib only.

eyrie does not expose a native document/PDF content block, so PDFs are degraded to text and injected inline. This is a best-effort extractor: it inflates FlateDecode content streams and pulls text from PDF text-showing operators (Tj / TJ). It does not handle every PDF (encrypted, scanned-image, or exotic font encodings will yield little or no text); callers should treat empty output as "no extractable text" rather than an error.

Swap in a dedicated PDF library (e.g. ledongthuc/pdf) for layout-aware extraction if one is added to go.mod; the interface here is intentionally stable so that change is internal.

func RenderBlockSection added in v0.1.1

func RenderBlockSection(block BlockSection, width int) string

RenderBlockSection renders a collapsible block section.

func RenderBreakdown

func RenderBreakdown(tb TokenBreakdown, windowSize int) string

RenderBreakdown produces a multi-line token breakdown for /context command.

func RenderStreaming added in v0.1.1

func RenderStreaming(ch <-chan string) <-chan string

RenderStreaming takes a channel of raw markdown chunks and returns a channel of rendered chunks. It buffers partial markdown elements until they can be completely rendered.

func RenderTable added in v0.1.1

func RenderTable(rows [][]string) string

RenderTable renders a table with box-drawing characters. The first row is treated as the header. Column widths are auto-calculated.

func SaveBGSession added in v0.1.1

func SaveBGSession(info *BGSessionInfo) error

SaveBGSession persists a background session info.

func SetBuildDate

func SetBuildDate(d string)

SetBuildDate sets the build date from main.

func SetVersion

func SetVersion(v string)

SetVersion sets the version string from main.

func ShortVersion

func ShortVersion() string

ShortVersion returns just the version number.

func StripANSI added in v0.1.1

func StripANSI(text string) string

StripANSI removes all ANSI escape codes from a string (for plain output).

func VersionString

func VersionString() string

VersionString returns the full version string.

func VibeLoop

func VibeLoop(ctx context.Context, sess *engine.Session, prompt string, config VibeConfig) error

VibeLoop runs the vibe coding loop: edit -> run -> check -> fix -> repeat.

1. Send prompt to LLM 2. Auto-apply all file changes (no permission prompt) 3. Run RunCommand 4. If passes: done, print success 5. If fails: send error output back to LLM, ask it to fix 6. Repeat until passes or MaxIterations reached

func WrapText added in v0.1.1

func WrapText(text string, width int) string

WrapText performs word-wrapping at the specified width boundary. It respects ANSI escape codes by measuring only visible characters.

Types

type AIDirective

type AIDirective struct {
	Path        string
	Line        int
	Instruction string
	Mode        string // "!" (do) or "?" (ask)
}

AIDirective represents a found AI comment directive in a source file.

type AffectedTests added in v0.1.1

type AffectedTests struct {
	ChangedFiles  []string
	AffectedTests []string
	TestFileMap   map[string][]string // source file -> test files that import it
}

AffectedTests holds the result of affected test detection.

func DetectAffectedTests added in v0.1.1

func DetectAffectedTests(changedFiles []string) AffectedTests

DetectAffectedTests analyzes changed files and determines which tests are affected by tracing the import graph. For Go projects, it uses a simple heuristic: for each changed .go file, find test files in the same package and packages that import the changed file's package.

type AgentGrid added in v0.1.1

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

AgentGrid manages multiple agent panes in a grid layout.

func NewAgentGrid added in v0.1.1

func NewAgentGrid(tasks []string, width, height int) *AgentGrid

NewAgentGrid creates a grid for displaying multiple agents.

func (*AgentGrid) AllDone added in v0.1.1

func (g *AgentGrid) AllDone() bool

AllDone returns true if all agents have completed.

func (*AgentGrid) GetPane added in v0.1.1

func (g *AgentGrid) GetPane(id string) *AgentPane

GetPane returns the pane for the given agent ID.

func (*AgentGrid) Render added in v0.1.1

func (g *AgentGrid) Render() string

Render draws all agent panes in a grid layout.

func (*AgentGrid) Summary added in v0.1.1

func (g *AgentGrid) Summary() string

Summary returns a summary of all agent states.

func (*AgentGrid) Update added in v0.1.1

func (g *AgentGrid) Update(msg tea.Msg) tea.Cmd

Update processes a message for the grid.

type AgentPane added in v0.1.1

type AgentPane struct {
	ID     string
	Task   string
	State  AgentState
	Output []string
	// contains filtered or unexported fields
}

AgentPane represents a single agent's display pane in the grid.

func NewAgentPane added in v0.1.1

func NewAgentPane(id, task string, width, height int) *AgentPane

NewAgentPane creates a new agent pane for the given task.

func (*AgentPane) Append added in v0.1.1

func (p *AgentPane) Append(line string)

Append adds a line of output to the pane.

func (*AgentPane) Render added in v0.1.1

func (p *AgentPane) Render() string

Render draws the agent pane.

func (*AgentPane) SetState added in v0.1.1

func (p *AgentPane) SetState(state AgentState)

SetState updates the agent's state.

type AgentState added in v0.1.1

type AgentState int

AgentState represents the current state of a parallel agent.

const (
	AgentIdle AgentState = iota
	AgentRunning
	AgentDone
	AgentFailed
)

func (AgentState) String added in v0.1.1

func (s AgentState) String() string

String returns a human-readable label for the state.

type AuditCount added in v0.1.1

type AuditCount struct {
	Name      string   `json:"name"`
	Category  string   `json:"category"`
	Severity  string   `json:"severity"`
	Hits      int      `json:"hits"`
	Projects  int      `json:"projects"`
	Examples  []string `json:"examples"`
	FirstSeen string   `json:"first_seen,omitempty"`
	LastSeen  string   `json:"last_seen,omitempty"`
}

AuditCount represents aggregated hits for one detector.

type AuditResult added in v0.1.1

type AuditResult struct {
	Version   int          `json:"version"`
	ScannedAt string       `json:"scanned_at"`
	Days      int          `json:"days"`
	Sessions  int          `json:"sessions_scanned"`
	TotalHits int          `json:"total_hits"`
	Detectors []AuditCount `json:"detectors"`
}

AuditResult is the top-level audit output.

type Autocompleter added in v0.1.1

type Autocompleter struct {
	History       []string
	Tools         []string
	SlashCommands []string
	Files         []string
	ProjectDir    string
	// contains filtered or unexported fields
}

Autocompleter provides context-aware autocompletion for the REPL.

func NewAutocompleter added in v0.1.1

func NewAutocompleter(projectDir string) *Autocompleter

NewAutocompleter creates an Autocompleter initialized for the given project directory.

func (*Autocompleter) Complete added in v0.1.1

func (ac *Autocompleter) Complete(input string, cursorPos int) []Suggestion

Complete returns context-aware suggestions for the given input and cursor position.

func (*Autocompleter) CompleteFilePath added in v0.1.1

func (ac *Autocompleter) CompleteFilePath(prefix string) []Suggestion

CompleteFilePath returns suggestions for file paths matching the prefix.

func (*Autocompleter) CompleteFromHistory added in v0.1.1

func (ac *Autocompleter) CompleteFromHistory(prefix string) []Suggestion

CompleteFromHistory returns suggestions from command history matching the prefix.

func (*Autocompleter) CompleteSlashCommand added in v0.1.1

func (ac *Autocompleter) CompleteSlashCommand(prefix string) []Suggestion

CompleteSlashCommand returns suggestions for slash commands matching the prefix.

func (*Autocompleter) RankSuggestions added in v0.1.1

func (ac *Autocompleter) RankSuggestions(suggestions []Suggestion) []Suggestion

RankSuggestions sorts suggestions by: exact prefix first, then by score, then alphabetical.

func (*Autocompleter) RecordInput added in v0.1.1

func (ac *Autocompleter) RecordInput(input string)

RecordInput records user input for future history-based completions.

func (*Autocompleter) RefreshFiles added in v0.1.1

func (ac *Autocompleter) RefreshFiles()

RefreshFiles rescans the project directory for file completions.

type BGSessionInfo added in v0.1.1

type BGSessionInfo struct {
	ID        string    `json:"id"`
	Prompt    string    `json:"prompt"`
	PID       int       `json:"pid"`
	StartedAt time.Time `json:"started_at"`
	CWD       string    `json:"cwd"`
	LogFile   string    `json:"log_file"`
	Status    string    `json:"status"` // running, completed, failed
}

BGSessionInfo tracks a running background session.

func ListBGSessions added in v0.1.1

func ListBGSessions() ([]*BGSessionInfo, error)

ListBGSessions returns all background sessions.

func LoadBGSession added in v0.1.1

func LoadBGSession(id string) (*BGSessionInfo, error)

LoadBGSession reads a background session info.

func StartBGSession added in v0.1.1

func StartBGSession(prompt string, args []string) (*BGSessionInfo, error)

StartBGSession launches hawk in background mode.

type BlockKind added in v0.1.1

type BlockKind int

BlockKind categorizes the section type for styling.

const (
	BlockToolUse  BlockKind = iota // tool calls and results
	BlockThinking                  // LLM reasoning
	BlockDiff                      // code diffs
	BlockTest                      // test output
	BlockReview                    // review findings
	BlockPlan                      // planning sections
)

func DetectBlockKind added in v0.1.1

func DetectBlockKind(title, content string) BlockKind

DetectBlockKind infers the block kind from content.

type BlockSection added in v0.1.1

type BlockSection struct {
	Title     string
	Content   string
	Collapsed bool
	Kind      BlockKind // controls styling
}

BlockSection represents a collapsible section in the conversation.

type BrailleSpinner added in v0.1.1

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

BrailleSpinner renders the glyph frame (◐◓◑◒) and a 20-color wave on the whole status strip: glyph → verb → ▪▫▫.

func NewBrailleSpinner added in v0.1.1

func NewBrailleSpinner(style SpinnerStyle, text string) *BrailleSpinner

NewBrailleSpinner creates a spinner with the given style and label text.

func (*BrailleSpinner) Frame added in v0.1.1

func (s *BrailleSpinner) Frame() string

Frame returns the current rendered frame (glyph + verb + dots, all in the wave).

func (*BrailleSpinner) GlyphChar added in v0.1.1

func (s *BrailleSpinner) GlyphChar() string

GlyphChar returns the current spinner glyph only (no verb or typing dots).

func (*BrailleSpinner) SetLabel added in v0.1.1

func (s *BrailleSpinner) SetLabel(text string)

SetLabel updates spinner label text.

func (*BrailleSpinner) SetWave added in v0.1.1

func (s *BrailleSpinner) SetWave(_ bool)

SetWave is kept for backwards compatibility with existing call sites. The verb and typing dots always use the 20-color wave; this is a no-op.

func (*BrailleSpinner) Start added in v0.1.1

func (s *BrailleSpinner) Start(interval time.Duration, render func(string))

Start begins auto-advancing the spinner. Call Stop() to end. NOTE: Not used in TUI mode (Tick() is called manually per frame). Kept for non-TUI contexts (daemon, CLI progress bars).

func (*BrailleSpinner) Stop added in v0.1.1

func (s *BrailleSpinner) Stop()

Stop halts the spinner.

func (*BrailleSpinner) Tick added in v0.1.1

func (s *BrailleSpinner) Tick() string

Tick advances to the next frame and cycles the dot highlight.

type ChatSubcommand added in v0.1.1

type ChatSubcommand interface {
	// Name is the canonical command name WITHOUT the leading slash.
	// e.g. "help" for "/help". Names are lowercase.
	Name() string

	// Aliases are alternative names that dispatch to the same
	// implementation. e.g. "exit" and "quit" both map to the
	// session command. Empty for no aliases.
	Aliases() []string

	// Description is a one-line help string shown in /help output.
	// Keep under 60 characters to fit the help column.
	Description() string

	// Usage is shown when the user provides invalid arguments.
	// Empty for argument-free commands.
	Usage() string

	// Handle dispatches the command. The chat model is the
	// receiver for state access. args is the parsed argument list
	// (without the command name); text is the original raw text
	// (including the command name) for cases that need to
	// re-parse (e.g., quoted strings).
	//
	// The returned tea.Model is the (possibly new) model; tea.Cmd
	// is an optional side-effect to enqueue (tea.Quit for /quit).
	Handle(m *chatModel, args []string, text string) (tea.Model, tea.Cmd)
}

ChatSubcommand is a single slash-command handler. Implementations live in their own file (cmd/chat_subcommand_<name>.go) and are registered via SubcommandRegistry.Register. The interface is the foundation for decomposing chat_commands.go (1745 lines as of 2026-06) into one file per command.

Migration path from the existing handleCommand switch statement:

  1. Create a new file cmd/chat_subcommand_<name>.go with a type implementing ChatSubcommand.
  2. Implement the existing handler logic in Handle().
  3. Register the subcommand in init() or in a package-level subcommand registry.
  4. Replace the case in handleCommand with a lookup against the registry.

The interface lives in this file (not chat_commands.go) so that subcommand implementations can be defined in any file without modifying chat_commands.go.

type CollapsibleBlocks added in v0.1.1

type CollapsibleBlocks struct {
	Blocks []BlockSection
}

CollapsibleBlocks manages a collection of collapsible sections.

func NewCollapsibleBlocks added in v0.1.1

func NewCollapsibleBlocks() *CollapsibleBlocks

NewCollapsibleBlocks creates a new block manager.

func (*CollapsibleBlocks) Add added in v0.1.1

func (cb *CollapsibleBlocks) Add(title, content string, kind BlockKind)

Add appends a new block section.

func (*CollapsibleBlocks) CollapseAll added in v0.1.1

func (cb *CollapsibleBlocks) CollapseAll()

CollapseAll collapses all blocks.

func (*CollapsibleBlocks) ExpandAll added in v0.1.1

func (cb *CollapsibleBlocks) ExpandAll()

ExpandAll expands all blocks.

func (*CollapsibleBlocks) RenderAll added in v0.1.1

func (cb *CollapsibleBlocks) RenderAll(width int) string

RenderAll renders all blocks to a string.

func (*CollapsibleBlocks) Toggle added in v0.1.1

func (cb *CollapsibleBlocks) Toggle(idx int)

Toggle collapses/expands the block at the given index.

type CommandInfo added in v0.1.1

type CommandInfo struct {
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Subcommands []CommandInfo `json:"subcommands,omitempty"`
	Flags       []FlagInfo    `json:"flags,omitempty"`
}

CommandInfo describes a CLI command for completion generation.

type CommandPalette added in v0.1.1

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

CommandPalette is a Ctrl+K command palette for quick command discovery.

func NewCommandPalette added in v0.1.1

func NewCommandPalette(width int) *CommandPalette

NewCommandPalette creates a new command palette with all available commands.

func (*CommandPalette) Close added in v0.1.1

func (cp *CommandPalette) Close()

Close closes the command palette.

func (*CommandPalette) IsOpen added in v0.1.1

func (cp *CommandPalette) IsOpen() bool

IsOpen returns whether the palette is open.

func (*CommandPalette) Open added in v0.1.1

func (cp *CommandPalette) Open()

Open opens the command palette.

func (*CommandPalette) Render added in v0.1.1

func (cp *CommandPalette) Render(viewWidth int) string

Render renders the command palette as a string.

func (*CommandPalette) Selected added in v0.1.1

func (cp *CommandPalette) Selected() *CommandPaletteEntry

Selected returns the currently selected entry, or nil.

func (*CommandPalette) Update added in v0.1.1

func (cp *CommandPalette) Update(msg tea.KeyMsg) (string, bool)

Update handles key events for the command palette.

type CommandPaletteEntry added in v0.1.1

type CommandPaletteEntry struct {
	Name        string
	Description string
	Category    string
	Action      string // slash command to execute
}

CommandPaletteEntry represents a single command in the palette.

type CommandState

type CommandState struct {
	Type     CommandType
	Op       Operator
	Count    int
	Digits   string
	FindType byte // f, F, t, T
	Scope    byte // i (inner), a (around)
}

CommandState tracks the in-progress vim command.

type CommandType

type CommandType int

CommandType represents what the command state is waiting for.

const (
	CmdIdle CommandType = iota
	CmdCount
	CmdOperator
	CmdFind
	CmdOperatorFind
	CmdOperatorTextObj
	CmdReplace
)

type CompletionGenerator added in v0.1.1

type CompletionGenerator struct {
	Commands      []CommandInfo `json:"commands"`
	Flags         []FlagInfo    `json:"flags"`
	SlashCommands []string      `json:"slash_commands"`
	Models        []string      `json:"models"`
	Providers     []string      `json:"providers"`
}

CompletionGenerator generates shell completion scripts for hawk.

func NewCompletionGenerator added in v0.1.1

func NewCompletionGenerator() *CompletionGenerator

NewCompletionGenerator creates a CompletionGenerator pre-populated with hawk's command structure, flags, providers, models, and slash commands.

func (*CompletionGenerator) GenerateBash added in v0.1.1

func (g *CompletionGenerator) GenerateBash() string

GenerateBash returns a complete bash completion script for hawk.

func (*CompletionGenerator) GenerateFish added in v0.1.1

func (g *CompletionGenerator) GenerateFish() string

GenerateFish returns a complete fish shell completion script for hawk.

func (*CompletionGenerator) GenerateJSON added in v0.1.1

func (g *CompletionGenerator) GenerateJSON() string

GenerateJSON returns a machine-readable JSON completion spec for IDE integration.

func (*CompletionGenerator) GenerateZsh added in v0.1.1

func (g *CompletionGenerator) GenerateZsh() string

GenerateZsh returns a complete zsh completion script for hawk.

type ContextState

type ContextState int

ContextState represents the urgency level of context usage.

const (
	ContextNormal   ContextState = iota
	ContextWarning               // approaching compact threshold
	ContextError                 // approaching blocking
	ContextBlocking              // at capacity
)

type ContextVisualization

type ContextVisualization struct {
	ContextWindowSize int
	CurrentTokens     int
	CompactThreshold  int
	WarningThreshold  int
	BlockingThreshold int
}

ContextVisualization renders token usage as a visual bar in the TUI.

func NewContextVisualization

func NewContextVisualization(windowSize int) *ContextVisualization

NewContextVisualization creates a visualization with default thresholds.

func (*ContextVisualization) PercentUsed

func (cv *ContextVisualization) PercentUsed() float64

PercentUsed returns the percentage of context window used.

func (*ContextVisualization) Render

func (cv *ContextVisualization) Render(width int) string

Render produces a styled context bar for the TUI status line.

func (*ContextVisualization) State

func (cv *ContextVisualization) State() ContextState

State returns the current warning state.

func (*ContextVisualization) Update

func (cv *ContextVisualization) Update(tokens int)

Update sets the current token count.

type ContextualHelp added in v0.1.1

type ContextualHelp struct {
	Entries map[string]*HelpEntry
	// contains filtered or unexported fields
}

ContextualHelp provides context-aware help and documentation lookup.

func NewContextualHelp added in v0.1.1

func NewContextualHelp() *ContextualHelp

NewContextualHelp creates a new ContextualHelp instance populated with all built-in help entries.

func (*ContextualHelp) FormatHelp added in v0.1.1

func (ch *ContextualHelp) FormatHelp(entry *HelpEntry) string

FormatHelp formats a single help entry for display.

func (*ContextualHelp) FormatSearchResults added in v0.1.1

func (ch *ContextualHelp) FormatSearchResults(entries []*HelpEntry) string

FormatSearchResults formats multiple help entries as a search result list.

func (*ContextualHelp) GetCategories added in v0.1.1

func (ch *ContextualHelp) GetCategories() []string

GetCategories returns all unique categories sorted alphabetically.

func (*ContextualHelp) GetHelp added in v0.1.1

func (ch *ContextualHelp) GetHelp(topic string) *HelpEntry

GetHelp retrieves a specific help entry by topic.

func (*ContextualHelp) ListByCategory added in v0.1.1

func (ch *ContextualHelp) ListByCategory(category string) []*HelpEntry

ListByCategory returns all help entries in a given category.

func (*ContextualHelp) SearchHelp added in v0.1.1

func (ch *ContextualHelp) SearchHelp(query string) []*HelpEntry

SearchHelp performs fuzzy search across topics, summaries, and details.

func (*ContextualHelp) SuggestHelp added in v0.1.1

func (ch *ContextualHelp) SuggestHelp(context string) []*HelpEntry

SuggestHelp returns relevant help entries based on the current context.

type DiffTheme added in v0.1.1

type DiffTheme struct {
	Added   string
	Removed string
	Changed string
	Context string
	LineNo  string
	Header  string
	WordAdd string
	WordDel string
	Reset   string
}

DiffTheme defines ANSI color codes for rendering diffs.

func DefaultDiffTheme added in v0.1.1

func DefaultDiffTheme() DiffTheme

DefaultDiffTheme returns a DiffTheme with standard terminal colors.

type DisclosureConfig added in v0.1.1

type DisclosureConfig struct {
	Level UserLevel
}

DisclosureConfig tracks the user's preferred disclosure level.

func DefaultDisclosureConfig added in v0.1.1

func DefaultDisclosureConfig() DisclosureConfig

DefaultDisclosureConfig returns intermediate as default.

type ExecResult

type ExecResult struct {
	SessionID  string `json:"session_id"`
	Response   string `json:"response"`
	ExitCode   int    `json:"exit_code"`
	TokensIn   int    `json:"tokens_in,omitempty"`
	TokensOut  int    `json:"tokens_out,omitempty"`
	TurnsTaken int    `json:"turns_taken"`
	Duration   string `json:"duration"`
	Model      string `json:"model,omitempty"`
	Worktree   string `json:"worktree,omitempty"`
	Branch     string `json:"branch,omitempty"`
}

ExecResult is the structured output for --output-format json.

type ExitCodeError added in v0.1.1

type ExitCodeError struct {
	Code int
	Err  error
}

ExitCodeError wraps a non-zero exit code so it can be returned from RunE instead of calling os.Exit directly. This allows deferred cleanup (worktree removal, global state restoration) to run before the process exits.

func (*ExitCodeError) Error added in v0.1.1

func (e *ExitCodeError) Error() string

func (*ExitCodeError) Unwrap added in v0.1.1

func (e *ExitCodeError) Unwrap() error

type FeedbackReport added in v0.1.1

type FeedbackReport struct {
	Timestamp string `json:"timestamp"`
	Version   string `json:"version"`
	Model     string `json:"model"`
	Provider  string `json:"provider"`
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	Category  string `json:"category"`
	Body      string `json:"body"`
	SessionID string `json:"session_id,omitempty"`
}

FeedbackReport is the structured report written to file or used in issue URL.

type FileDiffStat added in v0.1.1

type FileDiffStat struct {
	Path      string
	Additions int
	Deletions int
	Status    string // "M", "A", "D", "R"
}

FileDiffStat holds statistics about a single file's diff.

type FileWatcher

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

FileWatcher watches a directory tree for file changes, debounces them, computes a git diff, and calls an onChange callback.

func NewFileWatcher

func NewFileWatcher(dir string, ignore []string, onChange func(string, string)) *FileWatcher

NewFileWatcher creates a new FileWatcher. ignore is a list of path substrings to skip (e.g. ".git", "node_modules"). onChange is called with the changed file path and the git diff for that file.

func (*FileWatcher) Start

func (fw *FileWatcher) Start(ctx context.Context) error

Start begins watching for file changes. It blocks until ctx is cancelled or Stop is called.

func (*FileWatcher) Stop

func (fw *FileWatcher) Stop()

Stop signals the watcher to shut down.

type FlagInfo added in v0.1.1

type FlagInfo struct {
	Name        string   `json:"name"`
	Short       string   `json:"short,omitempty"`
	Description string   `json:"description"`
	Type        string   `json:"type"` // "string", "bool", "int"
	Choices     []string `json:"choices,omitempty"`
}

FlagInfo describes a CLI flag for completion generation.

type FuzzyMatchResult added in v0.1.1

type FuzzyMatchResult struct {
	Score    int
	MatchIdx []int // indices of matched characters in the target
}

FuzzyMatchResult holds a scored fuzzy match result.

type GHAContext added in v0.1.1

type GHAContext struct {
	Active    bool    // GITHUB_ACTIONS == "true"
	EventName string  // GITHUB_EVENT_NAME
	Mode      GHAMode // resolved operating mode
	Prompt    string  // event-derived prompt body
	Mention   bool    // whether an @hawk mention was found in a comment
}

GHAContext captures the relevant fields parsed from the GitHub Actions environment and event payload.

type GHAMode added in v0.1.1

type GHAMode string

GHAMode is the operating mode derived from a GitHub Actions event.

const (
	// GHAModeNone means we are not running inside GitHub Actions.
	GHAModeNone GHAMode = ""
	// GHAModeInteractive is used when a human mentioned @hawk in a comment and
	// expects a conversational reply.
	GHAModeInteractive GHAMode = "interactive"
	// GHAModeAutomation is used for label/issue triggers where hawk should act
	// autonomously on the issue/PR body.
	GHAModeAutomation GHAMode = "automation"
)

type GhostText added in v0.1.1

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

GhostText provides predictive suggestions shown as dim text after the cursor. After the AI responds, it suggests the likely next command.

func NewGhostText added in v0.1.1

func NewGhostText() *GhostText

NewGhostText creates a new ghost text manager.

func (*GhostText) Accept added in v0.1.1

func (g *GhostText) Accept() string

Accept returns the suggestion and clears it (user pressed → or Tab).

func (*GhostText) Active added in v0.1.1

func (g *GhostText) Active() bool

Active reports whether a suggestion is currently showing.

func (*GhostText) Clear added in v0.1.1

func (g *GhostText) Clear()

Clear dismisses the current suggestion (user started typing).

func (*GhostText) Get added in v0.1.1

func (g *GhostText) Get() string

Get returns the current suggestion, or empty if none.

func (*GhostText) Suggest added in v0.1.1

func (g *GhostText) Suggest(aiResponse string)

Suggest sets a ghost text suggestion based on the AI's last response.

func (*GhostText) SuggestExplicit added in v0.1.1

func (g *GhostText) SuggestExplicit(cmd string)

SuggestExplicit sets an explicit suggestion (e.g., from reroute context).

type HUDAgent added in v0.1.1

type HUDAgent struct {
	ID     string
	Task   string
	Status string
}

HUDAgent describes a single active agent/feature worker.

type HUDData added in v0.1.1

type HUDData struct {
	// Mission
	MissionID      string
	MissionStatus  string
	FeaturesTotal  int
	FeaturesDone   int
	FeaturesFailed int

	// Agents (from the mission watchdog)
	ActiveAgents []HUDAgent

	// Message bus activity (most recent first)
	RecentMessages []HUDMessage

	// Memory stats (from yaad)
	MemoryReady    bool
	MemoryNodes    int
	MemoryEdges    int
	MemorySessions int
}

HUDData is a snapshot of agent/mission/memory state rendered by the HUD panel. It is decoupled from live subsystem types so the panel is independently testable and does not require threading mutable references through chatModel.

type HUDMessage added in v0.1.1

type HUDMessage struct {
	From    string
	Topic   string
	Content string
}

HUDMessage is a compact message-bus entry for display.

type HelpEntry added in v0.1.1

type HelpEntry struct {
	Topic    string
	Summary  string
	Detail   string
	Examples []string
	Related  []string
	Category string
}

HelpEntry represents a single help topic with its documentation.

type ImageAttachment added in v0.1.1

type ImageAttachment struct {
	Base64   string
	MIMEType string
	FilePath string
}

ImageAttachment represents an image ready to be attached to a message.

func ReadImageBytes added in v0.1.1

func ReadImageBytes(data []byte, mimeType string) *ImageAttachment

ReadImageBytes creates an ImageAttachment from raw bytes.

func ReadImageFile added in v0.1.1

func ReadImageFile(path string) (*ImageAttachment, error)

ReadImageFile reads an image file and returns a base64-encoded attachment. Supports common image formats: png, jpg, jpeg, gif, webp, bmp.

type InputClass added in v0.1.1

type InputClass int

InputClass represents the classification of user input.

const (
	InputClassNeutral InputClass = iota // empty or undetermined
	InputClassShell                     // shell command (starts with !)
	InputClassAgent                     // AI query
	InputClassSlash                     // slash command (/config, /model, etc.)
)

type InputIndicator added in v0.1.1

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

InputIndicator provides real-time visual feedback on input classification.

func (*InputIndicator) Classify added in v0.1.1

func (ind *InputIndicator) Classify(input string, mode shellmode.Mode) InputClass

Classify determines the input class from the current buffer text and mode.

func (*InputIndicator) Label added in v0.1.1

func (ind *InputIndicator) Label() string

Label returns a short text label for the current classification.

func (*InputIndicator) Render added in v0.1.1

func (ind *InputIndicator) Render() string

Render returns the colored indicator character for the current classification.

type InspectPipelineConfig added in v0.1.1

type InspectPipelineConfig struct {
	Target      string // URL to inspect
	Depth       int
	Checks      []string // which checks to run
	FailOn      string   // severity threshold
	Concurrency int
}

InspectPipelineConfig controls how inspect integrates into the review pipeline.

func DefaultInspectPipelineConfig added in v0.1.1

func DefaultInspectPipelineConfig(target string) InspectPipelineConfig

DefaultInspectPipelineConfig returns sensible defaults.

type MarkdownRenderer added in v0.1.1

type MarkdownRenderer struct {
	Width           int
	Theme           *MarkdownTheme
	SyntaxHighlight bool
}

MarkdownRenderer renders markdown text to styled ANSI terminal output.

func NewMarkdownRenderer added in v0.1.1

func NewMarkdownRenderer(width int) *MarkdownRenderer

NewMarkdownRenderer creates a new renderer with the given terminal width.

func (*MarkdownRenderer) Render added in v0.1.1

func (r *MarkdownRenderer) Render(markdown string) string

Render converts a markdown string to ANSI-styled terminal output.

type MarkdownTheme added in v0.1.1

type MarkdownTheme struct {
	Heading        string
	Bold           string
	Italic         string
	Code           string
	CodeBlock      string
	Link           string
	ListBullet     string
	BlockQuote     string
	HorizontalRule string
	Reset          string
}

MarkdownTheme defines ANSI escape codes for styling markdown elements.

func DefaultTheme added in v0.1.1

func DefaultTheme() *MarkdownTheme

DefaultTheme returns a visually appealing terminal color theme.

type Notification added in v0.1.1

type Notification struct {
	ID        string
	Title     string
	Message   string
	Level     string // "info", "success", "warning", "error"
	Timestamp time.Time
	Read      bool
}

Notification represents a single notification event.

type Notifier added in v0.1.1

type Notifier struct {
	Enabled bool
	Level   string // "all", "important", "critical"
	Sound   bool
	Desktop bool
	History []Notification
	// contains filtered or unexported fields
}

Notifier manages terminal notifications for hawk events.

func NewNotifier added in v0.1.1

func NewNotifier() *Notifier

NewNotifier creates a new Notifier with default settings.

func (*Notifier) Bell added in v0.1.1

func (n *Notifier) Bell()

Bell writes the terminal bell character to stdout.

func (*Notifier) ClearTitle added in v0.1.1

func (n *Notifier) ClearTitle()

ClearTitle resets the terminal title.

func (*Notifier) DesktopNotify added in v0.1.1

func (n *Notifier) DesktopNotify(title, message string) error

DesktopNotify sends a desktop notification using OS-specific mechanisms.

func (*Notifier) GetHistory added in v0.1.1

func (n *Notifier) GetHistory(limit int) []Notification

GetHistory returns the most recent notifications, limited by count.

func (*Notifier) GetUnread added in v0.1.1

func (n *Notifier) GetUnread() []Notification

GetUnread returns all unread notifications.

func (*Notifier) MarkRead added in v0.1.1

func (n *Notifier) MarkRead(id string)

MarkRead marks a notification as read by ID.

func (*Notifier) Notify added in v0.1.1

func (n *Notifier) Notify(title, message, level string)

Notify creates a notification and dispatches it via configured methods.

func (*Notifier) NotifyBudgetWarning added in v0.1.1

func (n *Notifier) NotifyBudgetWarning(pct float64, remaining float64)

NotifyBudgetWarning sends a budget warning notification.

func (*Notifier) NotifyCostMilestone added in v0.1.1

func (n *Notifier) NotifyCostMilestone(cost float64)

NotifyCostMilestone sends a notification when spending crosses a cost milestone.

func (*Notifier) NotifyError added in v0.1.1

func (n *Notifier) NotifyError(err string)

NotifyError sends an error notification.

func (*Notifier) NotifyTaskComplete added in v0.1.1

func (n *Notifier) NotifyTaskComplete(task string, duration time.Duration)

NotifyTaskComplete sends a task completion notification.

func (*Notifier) SetTerminalTitle added in v0.1.1

func (n *Notifier) SetTerminalTitle(title string)

SetTerminalTitle sets the terminal title using escape sequences.

type Operator

type Operator int

Operator represents a vim operator (d, c, y).

const (
	OpNone Operator = iota
	OpDelete
	OpChange
	OpYank
)

type OutputFormatter added in v0.1.1

type OutputFormatter struct {
	Width          int
	ColorEnabled   bool
	UnicodeEnabled bool
	Theme          OutputTheme
	Verbose        bool
	// contains filtered or unexported fields
}

OutputFormatter adapts output format based on terminal capabilities, width, and user preferences.

func NewOutputFormatter added in v0.1.1

func NewOutputFormatter() *OutputFormatter

NewOutputFormatter creates an OutputFormatter with auto-detected terminal settings.

func (*OutputFormatter) FormatBytes added in v0.1.1

func (f *OutputFormatter) FormatBytes(n int64) string

FormatBytes formats a byte count into a human-readable string.

func (*OutputFormatter) FormatDiff added in v0.1.1

func (f *OutputFormatter) FormatDiff(added, removed int) string

FormatDiff formats added/removed line counts with green/red coloring.

func (*OutputFormatter) FormatDuration added in v0.1.1

func (f *OutputFormatter) FormatDuration(d time.Duration) string

FormatDuration formats a time.Duration into a human-readable string.

func (*OutputFormatter) FormatError added in v0.1.1

func (f *OutputFormatter) FormatError(msg string) string

FormatError formats an error message with a red X.

func (*OutputFormatter) FormatInfo added in v0.1.1

func (f *OutputFormatter) FormatInfo(msg string) string

FormatInfo formats an informational message with a blue circle.

func (*OutputFormatter) FormatList added in v0.1.1

func (f *OutputFormatter) FormatList(items []string, numbered bool) string

FormatList formats a list of items, optionally with numbering.

func (*OutputFormatter) FormatNumber added in v0.1.1

func (f *OutputFormatter) FormatNumber(n int) string

FormatNumber formats an integer into a human-readable string with commas or suffixes.

func (*OutputFormatter) FormatProgress added in v0.1.1

func (f *OutputFormatter) FormatProgress(current, total int, label string) string

FormatProgress formats a progress bar. Example: [████████░░░░] 67% (8/12) Installing packages...

func (*OutputFormatter) FormatSuccess added in v0.1.1

func (f *OutputFormatter) FormatSuccess(msg string) string

FormatSuccess formats a success message with a green checkmark.

func (*OutputFormatter) FormatTable added in v0.1.1

func (f *OutputFormatter) FormatTable(headers []string, rows [][]string) string

FormatTable formats tabular data with auto-calculated column widths. If Unicode is supported, box-drawing characters are used. Cells are truncated to fit within the terminal width.

func (*OutputFormatter) FormatTree added in v0.1.1

func (f *OutputFormatter) FormatTree(root string, children []TreeNode) string

FormatTree formats a tree structure with box-drawing characters.

func (*OutputFormatter) FormatWarning added in v0.1.1

func (f *OutputFormatter) FormatWarning(msg string) string

FormatWarning formats a warning message with a yellow triangle.

func (*OutputFormatter) Truncate added in v0.1.1

func (f *OutputFormatter) Truncate(s string, maxWidth int) string

Truncate truncates a string to maxWidth, appending "..." if it exceeds.

type OutputTheme added in v0.1.1

type OutputTheme struct {
	Primary   string
	Secondary string
	Success   string
	Error     string
	Warning   string
	Info      string
	Muted     string
	Reset     string
}

OutputTheme holds ANSI color codes for themed output.

type PersistentState

type PersistentState struct {
	LastFind     byte
	LastFindType byte
	Register     string
	RegisterLine bool
	LastChange   *RecordedChange
	Recording    *RecordedChange
}

PersistentState survives across commands.

type PowerConfig

type PowerConfig struct {
	Level           int
	Model           string
	MaxTokens       int
	ContextWindow   int
	Temperature     float64
	MaxTurns        int
	ToolParallelism int
	ReviewDepth     string // "none", "quick", "thorough"
	AutoApply       bool
	BudgetUSD       float64
}

PowerConfig maps a power level (1-10) to all relevant settings.

func MinimalPreset added in v0.1.1

func MinimalPreset() PowerConfig

MinimalPreset returns a PowerConfig for minimal mode: a focused experience with only core tools, the cheapest model, and conservative limits. Tool restriction itself is applied via the "minimal" ToolPreset at registry build time; this preset configures the session's model and budget.

func PowerPreset

func PowerPreset(level int) PowerConfig

PowerPreset returns the configuration for a given power level (1-10).

1-2: haiku/flash, 4K context, fast, no review, $0.05 budget -- quick questions 3-4: sonnet-mini/gpt-4o-mini, 16K context, moderate -- simple tasks 5-6: sonnet/gpt-4o, 64K context, standard -- normal coding (DEFAULT) 7-8: sonnet/opus, 128K context, thorough review -- complex tasks 9-10: opus, 200K context, multi-pass review, council mode -- critical work

type ProgressStep added in v0.1.1

type ProgressStep struct {
	Name      string
	Status    string // "pending", "active", "done", "failed", "skipped"
	StartTime *time.Time
	EndTime   *time.Time
	Duration  time.Duration
	Substeps  []string
	Progress  float64
	// contains filtered or unexported fields
}

ProgressStep represents a single step in a multi-step task.

type ProgressTracker added in v0.1.1

type ProgressTracker struct {
	Steps       []ProgressStep
	CurrentStep int
	StartTime   time.Time
	Title       string
	// contains filtered or unexported fields
}

ProgressTracker tracks the progress of a multi-step operation and renders it for display in the TUI. Inspired by cline's focus-chain pattern.

func NewProgressTracker added in v0.1.1

func NewProgressTracker(title string) *ProgressTracker

NewProgressTracker creates a new ProgressTracker with the given title.

func (*ProgressTracker) AddStep added in v0.1.1

func (pt *ProgressTracker) AddStep(name string)

AddStep appends a new step with the given name in "pending" status.

func (*ProgressTracker) AddSubstep added in v0.1.1

func (pt *ProgressTracker) AddSubstep(stepIndex int, substep string)

AddSubstep adds a substep description to the step at the given index.

func (*ProgressTracker) CompleteStep added in v0.1.1

func (pt *ProgressTracker) CompleteStep(index int)

CompleteStep marks the step at the given index as "done" and records its end time and duration.

func (*ProgressTracker) EstimateRemaining added in v0.1.1

func (pt *ProgressTracker) EstimateRemaining() time.Duration

EstimateRemaining estimates the remaining time based on average step duration.

func (*ProgressTracker) FailStep added in v0.1.1

func (pt *ProgressTracker) FailStep(index int, reason string)

FailStep marks the step at the given index as "failed" with the provided reason.

func (*ProgressTracker) GetElapsed added in v0.1.1

func (pt *ProgressTracker) GetElapsed() time.Duration

GetElapsed returns the time elapsed since the tracker was created.

func (*ProgressTracker) IsComplete added in v0.1.1

func (pt *ProgressTracker) IsComplete() bool

IsComplete returns true if all steps have finished (done, failed, or skipped).

func (*ProgressTracker) Render added in v0.1.1

func (pt *ProgressTracker) Render() string

Render produces a full multi-line progress display suitable for the TUI.

func (*ProgressTracker) RenderCompact added in v0.1.1

func (pt *ProgressTracker) RenderCompact() string

RenderCompact produces a single-line progress summary.

func (*ProgressTracker) RenderDone added in v0.1.1

func (pt *ProgressTracker) RenderDone() string

RenderDone produces a completion summary.

func (*ProgressTracker) SetProgress added in v0.1.1

func (pt *ProgressTracker) SetProgress(index int, pct float64)

SetProgress sets the progress percentage (0.0 to 1.0) for the step at the given index.

func (*ProgressTracker) SkipStep added in v0.1.1

func (pt *ProgressTracker) SkipStep(index int)

SkipStep marks the step at the given index as "skipped".

func (*ProgressTracker) StartStep added in v0.1.1

func (pt *ProgressTracker) StartStep(index int)

StartStep marks the step at the given index as "active" and records its start time.

type QueryProfile

type QueryProfile struct {
	StartTime time.Time
	TTFT      time.Duration // time to first token
	APICall   time.Duration
	ToolExec  time.Duration
	TotalTime time.Duration
	TokensIn  int
	TokensOut int
	// contains filtered or unexported fields
}

QueryProfile tracks timing for a single query.

func (*QueryProfile) Finish

func (p *QueryProfile) Finish()

Finish completes the profile and records the total time.

func (*QueryProfile) RecordAPICallEnd

func (p *QueryProfile) RecordAPICallEnd()

RecordAPICallEnd marks the end of an API call and accumulates duration.

func (*QueryProfile) RecordAPICallStart

func (p *QueryProfile) RecordAPICallStart()

RecordAPICallStart marks the beginning of an API call.

func (*QueryProfile) RecordTTFT

func (p *QueryProfile) RecordTTFT()

RecordTTFT records the time to first token.

func (*QueryProfile) RecordToolExecEnd

func (p *QueryProfile) RecordToolExecEnd()

RecordToolExecEnd marks the end of a tool execution and accumulates duration.

func (*QueryProfile) RecordToolExecStart

func (p *QueryProfile) RecordToolExecStart()

RecordToolExecStart marks the beginning of a tool execution.

func (*QueryProfile) String

func (p *QueryProfile) String() string

String returns a formatted summary of the profile, suitable for debug output.

type RankedEntry added in v0.1.1

type RankedEntry struct {
	Entry CommandPaletteEntry
	Score int
}

RankFuzzyResults sorts entries by fuzzy score against the query. Only entries with score > 0 are returned.

func RankFuzzyResults added in v0.1.1

func RankFuzzyResults(query string, entries []CommandPaletteEntry) []RankedEntry

type RecordedChange

type RecordedChange struct {
	Type     string // "insert", "operator", "replace", "x", "toggleCase"
	Keys     []tea.KeyMsg
	Text     string
	StartPos int
	EndPos   int
}

RecordedChange stores info needed for dot-repeat.

type ResearchConfig

type ResearchConfig struct {
	MetricCmd    string // command to run the experiment (e.g. "go test -bench .")
	MetricGrep   string // grep pattern to extract the metric (e.g. "^val_bpb:")
	Direction    string // "lower" or "higher" — whether lower or higher metric is better
	Budget       int    // time budget per experiment in minutes (default: 5)
	BranchPrefix string // git branch prefix (default: "autoresearch")
	ResultsFile  string // TSV results file (default: "results.tsv")
}

ResearchConfig controls the autonomous research loop. The loop itself is executed by the LLM agent via the generated prompt.

func DefaultResearchConfig

func DefaultResearchConfig() ResearchConfig

DefaultResearchConfig returns sensible defaults.

type ReviewChatFn added in v0.1.1

type ReviewChatFn func(ctx context.Context, prompt string) (string, error)

ReviewChatFn is a function that sends a prompt to an LLM and returns the response.

type ReviewConcern

type ReviewConcern struct {
	Name   string // "security", "performance", "style", "bugs", "correctness"
	Prompt string // specialized review prompt for this concern
}

ReviewConcern represents one aspect of code review.

func DefaultConcerns

func DefaultConcerns() []ReviewConcern

DefaultConcerns returns standard review concerns.

type ReviewFinding

type ReviewFinding struct {
	Concern  string
	Severity string // "critical", "high", "medium", "low"
	File     string
	Line     int
	Message  string
	Fix      string // suggested fix
}

ReviewFinding represents one issue found.

func InspectToReviewFindings added in v0.1.1

func InspectToReviewFindings(report *verifycontracts.Report) []ReviewFinding

InspectToReviewFindings converts an inspect report into ReviewFindings so they can be displayed alongside code review findings.

func MergeInspectWithReview added in v0.1.1

func MergeInspectWithReview(reviewFindings, inspectFindings []ReviewFinding) []ReviewFinding

MergeInspectWithReview merges inspect findings into an existing review findings list, deduplicating by file+message.

func RunInspectPipeline added in v0.1.1

func RunInspectPipeline(ctx context.Context, cfg InspectPipelineConfig) ([]ReviewFinding, string, error)

RunInspectPipeline runs an inspect scan and returns results formatted as review findings that can be merged with code review results.

func RunReviewPipeline

func RunReviewPipeline(ctx context.Context, files []string, concerns []ReviewConcern, chatFn ReviewChatFn) ([]ReviewFinding, string)

RunReviewPipeline performs multi-concern parallel review using the provided chat function to query an LLM. Returns deduplicated findings sorted by severity and a formatted report string.

type ReviewRecord added in v0.1.1

type ReviewRecord struct {
	ID          int64
	SHA         string
	Status      ReviewStatus
	Findings    []reviewcontracts.Finding
	Report      string
	MaxSeverity string
	TokensUsed  int
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

ReviewRecord represents a persisted review in the SQLite store.

type ReviewStatus added in v0.1.1

type ReviewStatus string

ReviewStatus represents the state of a review.

const (
	ReviewStatusPending ReviewStatus = "pending"
	ReviewStatusRunning ReviewStatus = "running"
	ReviewStatusOpen    ReviewStatus = "open"
	ReviewStatusPassed  ReviewStatus = "passed"
	ReviewStatusFixed   ReviewStatus = "fixed"
	ReviewStatusClosed  ReviewStatus = "closed"
	ReviewStatusFailed  ReviewStatus = "failed" // review process itself failed
)

type ReviewStore added in v0.1.1

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

ReviewStore provides SQLite-backed review persistence.

func OpenReviewStore added in v0.1.1

func OpenReviewStore(projectDir string) (*ReviewStore, error)

OpenReviewStore opens or creates the review database.

func (*ReviewStore) Close added in v0.1.1

func (s *ReviewStore) Close() error

Close checkpoints the WAL and closes the database. Running PRAGMA wal_checkpoint(TRUNCATE) before close ensures that .db-wal and .db-shm files are cleaned up after all data is safely flushed to the main database file.

func (*ReviewStore) Create added in v0.1.1

func (s *ReviewStore) Create(sha string) (int64, error)

Create inserts a new review record and returns its ID.

func (*ReviewStore) Get added in v0.1.1

func (s *ReviewStore) Get(id int64) (*ReviewRecord, error)

Get retrieves a single review by ID.

func (*ReviewStore) GetBySHA added in v0.1.1

func (s *ReviewStore) GetBySHA(sha string) (*ReviewRecord, error)

GetBySHA retrieves the latest review for a commit.

func (*ReviewStore) ListAll added in v0.1.1

func (s *ReviewStore) ListAll(limit int) ([]*ReviewRecord, error)

ListAll returns all reviews ordered by creation time.

func (*ReviewStore) ListOpen added in v0.1.1

func (s *ReviewStore) ListOpen() ([]*ReviewRecord, error)

ListOpen returns all reviews with open/pending/running status.

func (*ReviewStore) SetStatus added in v0.1.1

func (s *ReviewStore) SetStatus(id int64, status ReviewStatus) error

SetStatus updates only the status field.

func (*ReviewStore) Summary added in v0.1.1

func (s *ReviewStore) Summary() (map[ReviewStatus]int, error)

Summary returns counts by status.

func (*ReviewStore) Update added in v0.1.1

func (s *ReviewStore) Update(id int64, status ReviewStatus, result *reviewcontracts.Result) error

Update sets the review result after completion.

type SessionInfo added in v0.1.1

type SessionInfo struct {
	Path      string
	CWD       string
	StartTime time.Time
}

SessionInfo represents a discovered session transcript.

type SpinnerStyle added in v0.1.1

type SpinnerStyle string

SpinnerStyle names an animation style.

const (
	SpinnerBraille     SpinnerStyle = "braille"
	SpinnerBrailleWave SpinnerStyle = "braillewave"
	SpinnerHawk        SpinnerStyle = "hawk"
	SpinnerHawkQuad    SpinnerStyle = "hawkquad"
	SpinnerDNA         SpinnerStyle = "dna"
	SpinnerScan        SpinnerStyle = "scan"
	SpinnerPulse       SpinnerStyle = "pulse"
	SpinnerSnake       SpinnerStyle = "snake"
	SpinnerOrbit       SpinnerStyle = "orbit"
	SpinnerWing        SpinnerStyle = "wing"   // ⫷⫸ — two-frame wing flap
	SpinnerTalons      SpinnerStyle = "talons" // ⩤⩥⩦⩧ — four-frame talon cycle
	SpinnerRandom      SpinnerStyle = "random"
)

type StartupWarning

type StartupWarning struct {
	Check   string
	Message string
}

StartupWarning represents a non-fatal startup issue.

func (StartupWarning) String

func (w StartupWarning) String() string

type SubcommandRegistry added in v0.1.1

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

SubcommandRegistry is the canonical index mapping slash command names (and their aliases) to ChatSubcommand implementations. It's safe for concurrent use.

func NewSubcommandRegistry added in v0.1.1

func NewSubcommandRegistry() *SubcommandRegistry

NewSubcommandRegistry creates an empty registry. Subcommands are registered via Register() (typically from per-file init() funcs or from a single aggregate init that imports each subcommand).

func (*SubcommandRegistry) All added in v0.1.1

All returns all registered subcommands (deduplicated by primary name). Used by /help to render the full help table.

func (*SubcommandRegistry) Lookup added in v0.1.1

func (r *SubcommandRegistry) Lookup(name string) (ChatSubcommand, bool)

Lookup returns the subcommand for a slash name (without the leading slash). The second return is false if neither the name nor any of its aliases is registered.

func (*SubcommandRegistry) Names added in v0.1.1

func (r *SubcommandRegistry) Names() []string

Names returns all primary command names in sorted order. Used by /help and /commands to enumerate available subcommands.

func (*SubcommandRegistry) Register added in v0.1.1

func (r *SubcommandRegistry) Register(cmd ChatSubcommand)

Register adds a subcommand to the registry. The primary name and all aliases are indexed. If a name is already registered, this is a no-op (the existing entry is kept) — duplicate registration is treated as a configuration error but doesn't panic, so test ordering and re-init don't blow up the binary. The same applies to alias collisions: if any of the subcommand's aliases is already registered (either as a primary or as another alias), registration is rejected (see M5 in the code review).

func (*SubcommandRegistry) Size added in v0.1.1

func (r *SubcommandRegistry) Size() int

Size returns the number of primary subcommands (excluding aliases). Used by tests and by /commands to show a count.

type Suggestion added in v0.1.1

type Suggestion struct {
	Text        string
	Description string
	Category    string // "command", "file", "tool", "history", "model"
	Score       float64
}

Suggestion represents a single autocompletion suggestion.

type TestFirstConfig added in v0.1.1

type TestFirstConfig struct {
	TestCmd     string // test command to run (e.g. "go test ./...")
	MaxRounds   int    // maximum fix iterations before giving up
	FailPattern string // pattern to match in test output for failures
}

TestFirstConfig controls the test-first fix workflow.

func DefaultTestFirstConfig added in v0.1.1

func DefaultTestFirstConfig() TestFirstConfig

DefaultTestFirstConfig returns sensible defaults for Go projects.

type TestFirstResult added in v0.1.1

type TestFirstResult struct {
	Rounds      int
	FinalOutput string
	Passed      bool
	FixPrompts  []string // prompts sent to the LLM for each round
}

TestFirstResult holds the outcome of a test-first workflow run.

func RunTestFirstWorkflow added in v0.1.1

func RunTestFirstWorkflow(cfg TestFirstConfig, chatFn ReviewChatFn) TestFirstResult

RunTestFirstWorkflow executes tests, then feeds failures as context to an LLM fix cycle. Each round runs tests, checks for failures, and if failures exist, asks the LLM to fix them. Returns when tests pass or max rounds hit.

type Tip

type Tip struct {
	ID       string `json:"id"`
	Text     string `json:"text"`
	Category string `json:"category"`
}

Tip represents a single hawk usage tip.

type TokenBreakdown

type TokenBreakdown struct {
	System     int `json:"system"`
	UserMsgs   int `json:"user_messages"`
	Assistant  int `json:"assistant"`
	ToolUse    int `json:"tool_use"`
	ToolResult int `json:"tool_results"`
	Total      int `json:"total"`
}

TokenBreakdown provides a detailed breakdown of token usage by category.

type TreeNode added in v0.1.1

type TreeNode struct {
	Name     string
	Children []TreeNode
	Icon     string
}

TreeNode represents a node in a tree structure for FormatTree.

type UserLevel added in v0.1.1

type UserLevel int

UserLevel represents the user's experience level.

const (
	LevelBeginner     UserLevel = iota // simplified help, fewer commands shown
	LevelIntermediate                  // standard help
	LevelAdvanced                      // all commands and options shown
)

func ParseUserLevel added in v0.1.1

func ParseUserLevel(s string) (UserLevel, bool)

ParseUserLevel parses a level string.

func (UserLevel) String added in v0.1.1

func (l UserLevel) String() string

type VibeConfig

type VibeConfig struct {
	Enabled       bool
	AutoApply     bool   // apply file changes without asking
	AutoRun       bool   // run build/test after each change
	RunCommand    string // command to run (default: auto-detect)
	ShowDiffs     bool   // show diffs briefly (default: false in full vibe, true in semi-vibe)
	MaxIterations int    // max auto-fix iterations (default: 10)
}

VibeConfig controls vibe coding behavior.

func DefaultVibeConfig

func DefaultVibeConfig() VibeConfig

DefaultVibeConfig returns the default vibe coding configuration.

type VimMode

type VimMode int

VimMode represents the current vim mode.

const (
	VimInsert VimMode = iota
	VimNormal
)

type VimState

type VimState struct {
	Mode       VimMode
	Command    CommandState
	Persistent PersistentState
	// contains filtered or unexported fields
}

VimState is the full vim state machine.

func NewVimState

func NewVimState() *VimState

NewVimState creates a new vim state starting in insert mode.

func (*VimState) HandleKey

func (v *VimState) HandleKey(msg tea.KeyMsg, text string, cursor int) (string, int, bool)

HandleKey processes a key event and returns the new text, cursor position, and whether the key was consumed by vim.

func (*VimState) IsEnabled

func (v *VimState) IsEnabled() bool

IsEnabled returns whether vim mode is active.

func (*VimState) ModeString

func (v *VimState) ModeString() string

ModeString returns a display string for the current mode.

func (*VimState) SetEnabled

func (v *VimState) SetEnabled(enabled bool)

SetEnabled enables or disables vim mode.

type VisualDiff added in v0.1.1

type VisualDiff struct {
	Width           int
	Theme           DiffTheme
	ShowLineNumbers bool
	ContextLines    int
	WordLevel       bool
}

VisualDiff renders diffs with colors and formatting for TUI display.

func NewVisualDiff added in v0.1.1

func NewVisualDiff(width int) *VisualDiff

NewVisualDiff creates a VisualDiff renderer with the given terminal width.

func (*VisualDiff) ColorizeByLanguage added in v0.1.1

func (vd *VisualDiff) ColorizeByLanguage(line, language string) string

ColorizeByLanguage provides basic syntax highlighting for a line based on language.

func (*VisualDiff) RenderDiffSummary added in v0.1.1

func (vd *VisualDiff) RenderDiffSummary(files []FileDiffStat) string

RenderDiffSummary renders a summary table of file changes.

func (*VisualDiff) RenderFileDiff added in v0.1.1

func (vd *VisualDiff) RenderFileDiff(path, oldContent, newContent string) string

RenderFileDiff renders a full file diff with header and collapsed unchanged regions.

func (*VisualDiff) RenderInline added in v0.1.1

func (vd *VisualDiff) RenderInline(diff string) string

RenderInline renders a unified diff with colors and line numbers.

func (*VisualDiff) RenderSideBySide added in v0.1.1

func (vd *VisualDiff) RenderSideBySide(diff string) string

RenderSideBySide renders a diff in two-column format.

func (*VisualDiff) RenderWordDiff added in v0.1.1

func (vd *VisualDiff) RenderWordDiff(oldLine, newLine string) (string, string)

RenderWordDiff finds word-level changes between two lines and returns both lines with inline ANSI highlighting on the changed words.

type WordChange added in v0.1.1

type WordChange struct {
	Type string // "equal", "insert", "delete"
	Text string
}

WordChange represents a single word-level change between two strings.

func FindWordChanges added in v0.1.1

func FindWordChanges(old, new string) []WordChange

FindWordChanges computes word-level changes between old and new strings. It splits on whitespace boundaries and uses a longest common subsequence approach.

Source Files

Directories

Path Synopsis
compat-test reads compatibility-matrix.json and runs basic compatibility checks across the listed components.
compat-test reads compatibility-matrix.json and runs basic compatibility checks across the listed components.

Jump to

Keyboard shortcuts

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