cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 78 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Build-time variables injected by goreleaser/ldflags.

Functions

func ApplyPowerLevel

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

ApplyPowerLevel configures a session based on power level.

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.2.0

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.2.0

func DetectTerminalWidth() int

DetectTerminalWidth returns the terminal width or a default of 80.

func DetectUnicodeSupport added in v0.2.0

func DetectUnicodeSupport() bool

DetectUnicodeSupport checks if the terminal supports Unicode characters.

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 FormatHistory added in v0.2.0

func FormatHistory(notifications []Notification) string

FormatHistory formats a list of notifications for display.

func FormatNotification added in v0.2.0

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.2.0

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

FormatSuggestions formats suggestions for terminal display.

func FuzzyMatch added in v0.2.0

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 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 HighlightCode added in v0.2.0

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.2.0

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 RenderBreakdown

func RenderBreakdown(tb TokenBreakdown, windowSize int) string

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

func RenderStreaming added in v0.2.0

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.2.0

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 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.2.0

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.2.0

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 Autocompleter added in v0.2.0

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.2.0

func NewAutocompleter(projectDir string) *Autocompleter

NewAutocompleter creates an Autocompleter initialized for the given project directory.

func (*Autocompleter) Complete added in v0.2.0

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.2.0

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

CompleteFilePath returns suggestions for file paths matching the prefix.

func (*Autocompleter) CompleteFromHistory added in v0.2.0

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

CompleteFromHistory returns suggestions from command history matching the prefix.

func (*Autocompleter) CompleteSlashCommand added in v0.2.0

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

CompleteSlashCommand returns suggestions for slash commands matching the prefix.

func (*Autocompleter) RankSuggestions added in v0.2.0

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.2.0

func (ac *Autocompleter) RecordInput(input string)

RecordInput records user input for future history-based completions.

func (*Autocompleter) RefreshFiles added in v0.2.0

func (ac *Autocompleter) RefreshFiles()

RefreshFiles rescans the project directory for file completions.

type BrailleSpinner added in v0.2.0

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

BrailleSpinner renders animated braille spinners with shimmer text.

func NewBrailleSpinner added in v0.2.0

func NewBrailleSpinner(style SpinnerStyle, text string) *BrailleSpinner

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

func (*BrailleSpinner) Frame added in v0.2.0

func (s *BrailleSpinner) Frame() string

Frame returns the current rendered frame (spinner + shimmer text).

func (*BrailleSpinner) Start added in v0.2.0

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.2.0

func (s *BrailleSpinner) Stop()

Stop halts the spinner.

func (*BrailleSpinner) Tick added in v0.2.0

func (s *BrailleSpinner) Tick() string

Tick advances to the next frame. Returns the rendered string.

type CommandInfo added in v0.2.0

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 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.2.0

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.2.0

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.2.0

func (g *CompletionGenerator) GenerateBash() string

GenerateBash returns a complete bash completion script for hawk.

func (*CompletionGenerator) GenerateFish added in v0.2.0

func (g *CompletionGenerator) GenerateFish() string

GenerateFish returns a complete fish shell completion script for hawk.

func (*CompletionGenerator) GenerateJSON added in v0.2.0

func (g *CompletionGenerator) GenerateJSON() string

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

func (*CompletionGenerator) GenerateZsh added in v0.2.0

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.2.0

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.2.0

func NewContextualHelp() *ContextualHelp

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

func (*ContextualHelp) FormatHelp added in v0.2.0

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

FormatHelp formats a single help entry for display.

func (*ContextualHelp) FormatSearchResults added in v0.2.0

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

FormatSearchResults formats multiple help entries as a search result list.

func (*ContextualHelp) GetCategories added in v0.2.0

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

GetCategories returns all unique categories sorted alphabetically.

func (*ContextualHelp) GetHelp added in v0.2.0

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

GetHelp retrieves a specific help entry by topic.

func (*ContextualHelp) ListByCategory added in v0.2.0

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

ListByCategory returns all help entries in a given category.

func (*ContextualHelp) SearchHelp added in v0.2.0

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

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

func (*ContextualHelp) SuggestHelp added in v0.2.0

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

SuggestHelp returns relevant help entries based on the current context.

type DiffTheme added in v0.2.0

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.2.0

func DefaultDiffTheme() DiffTheme

DefaultDiffTheme returns a DiffTheme with standard terminal colors.

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 FeedbackReport added in v0.2.0

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.2.0

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.2.0

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 GhostText added in v0.2.0

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.2.0

func NewGhostText() *GhostText

NewGhostText creates a new ghost text manager.

func (*GhostText) Accept added in v0.2.0

func (g *GhostText) Accept() string

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

func (*GhostText) Active added in v0.2.0

func (g *GhostText) Active() bool

Active reports whether a suggestion is currently showing.

func (*GhostText) Clear added in v0.2.0

func (g *GhostText) Clear()

Clear dismisses the current suggestion (user started typing).

func (*GhostText) Get added in v0.2.0

func (g *GhostText) Get() string

Get returns the current suggestion, or empty if none.

func (*GhostText) Suggest added in v0.2.0

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.2.0

func (g *GhostText) SuggestExplicit(cmd string)

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

type HelpEntry added in v0.2.0

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 InputClass added in v0.2.0

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.2.0

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

InputIndicator provides real-time visual feedback on input classification.

func (*InputIndicator) Classify added in v0.2.0

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.2.0

func (ind *InputIndicator) Label() string

Label returns a short text label for the current classification.

func (*InputIndicator) Render added in v0.2.0

func (ind *InputIndicator) Render() string

Render returns the colored indicator character for the current classification.

type MarkdownRenderer added in v0.2.0

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

MarkdownRenderer renders markdown text to styled ANSI terminal output.

func NewMarkdownRenderer added in v0.2.0

func NewMarkdownRenderer(width int) *MarkdownRenderer

NewMarkdownRenderer creates a new renderer with the given terminal width.

func (*MarkdownRenderer) Render added in v0.2.0

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

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

type MarkdownTheme added in v0.2.0

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.2.0

func DefaultTheme() *MarkdownTheme

DefaultTheme returns a visually appealing terminal color theme.

type Notification added in v0.2.0

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.2.0

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.2.0

func NewNotifier() *Notifier

NewNotifier creates a new Notifier with default settings.

func (*Notifier) Bell added in v0.2.0

func (n *Notifier) Bell()

Bell writes the terminal bell character to stdout.

func (*Notifier) ClearTitle added in v0.2.0

func (n *Notifier) ClearTitle()

ClearTitle resets the terminal title.

func (*Notifier) DesktopNotify added in v0.2.0

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

DesktopNotify sends a desktop notification using OS-specific mechanisms.

func (*Notifier) GetHistory added in v0.2.0

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

GetHistory returns the most recent notifications, limited by count.

func (*Notifier) GetUnread added in v0.2.0

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

GetUnread returns all unread notifications.

func (*Notifier) MarkRead added in v0.2.0

func (n *Notifier) MarkRead(id string)

MarkRead marks a notification as read by ID.

func (*Notifier) Notify added in v0.2.0

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

Notify creates a notification and dispatches it via configured methods.

func (*Notifier) NotifyBudgetWarning added in v0.2.0

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

NotifyBudgetWarning sends a budget warning notification.

func (*Notifier) NotifyCostMilestone added in v0.2.0

func (n *Notifier) NotifyCostMilestone(cost float64)

NotifyCostMilestone sends a notification when spending crosses a cost milestone.

func (*Notifier) NotifyError added in v0.2.0

func (n *Notifier) NotifyError(err string)

NotifyError sends an error notification.

func (*Notifier) NotifyTaskComplete added in v0.2.0

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

NotifyTaskComplete sends a task completion notification.

func (*Notifier) SetTerminalTitle added in v0.2.0

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.2.0

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.2.0

func NewOutputFormatter() *OutputFormatter

NewOutputFormatter creates an OutputFormatter with auto-detected terminal settings.

func (*OutputFormatter) FormatBytes added in v0.2.0

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

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

func (*OutputFormatter) FormatDiff added in v0.2.0

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

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

func (*OutputFormatter) FormatDuration added in v0.2.0

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

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

func (*OutputFormatter) FormatError added in v0.2.0

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

FormatError formats an error message with a red X.

func (*OutputFormatter) FormatInfo added in v0.2.0

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

FormatInfo formats an informational message with a blue circle.

func (*OutputFormatter) FormatList added in v0.2.0

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

FormatList formats a list of items, optionally with numbering.

func (*OutputFormatter) FormatNumber added in v0.2.0

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.2.0

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.2.0

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

FormatSuccess formats a success message with a green checkmark.

func (*OutputFormatter) FormatTable added in v0.2.0

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.2.0

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

FormatTree formats a tree structure with box-drawing characters.

func (*OutputFormatter) FormatWarning added in v0.2.0

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

FormatWarning formats a warning message with a yellow triangle.

func (*OutputFormatter) Truncate added in v0.2.0

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

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

type OutputTheme added in v0.2.0

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 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.2.0

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.2.0

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.2.0

func NewProgressTracker(title string) *ProgressTracker

NewProgressTracker creates a new ProgressTracker with the given title.

func (*ProgressTracker) AddStep added in v0.2.0

func (pt *ProgressTracker) AddStep(name string)

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

func (*ProgressTracker) AddSubstep added in v0.2.0

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.2.0

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.2.0

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

EstimateRemaining estimates the remaining time based on average step duration.

func (*ProgressTracker) FailStep added in v0.2.0

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.2.0

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

GetElapsed returns the time elapsed since the tracker was created.

func (*ProgressTracker) IsComplete added in v0.2.0

func (pt *ProgressTracker) IsComplete() bool

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

func (*ProgressTracker) Render added in v0.2.0

func (pt *ProgressTracker) Render() string

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

func (*ProgressTracker) RenderCompact added in v0.2.0

func (pt *ProgressTracker) RenderCompact() string

RenderCompact produces a single-line progress summary.

func (*ProgressTracker) RenderDone added in v0.2.0

func (pt *ProgressTracker) RenderDone() string

RenderDone produces a completion summary.

func (*ProgressTracker) SetProgress added in v0.2.0

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.2.0

func (pt *ProgressTracker) SkipStep(index int)

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

func (*ProgressTracker) StartStep added in v0.2.0

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 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 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 RunReviewPipeline

func RunReviewPipeline(files []string, concerns []ReviewConcern) ([]ReviewFinding, string)

RunReviewPipeline performs multi-concern parallel review. In this implementation, the LLM calls are simulated by building per-concern prompts and collecting placeholder findings. The caller is expected to wire in actual LLM queries. Returns deduplicated findings sorted by severity and a formatted report string.

type SpinnerStyle added in v0.2.0

type SpinnerStyle string

SpinnerStyle names an animation style.

const (
	SpinnerBraille     SpinnerStyle = "braille"
	SpinnerBrailleWave SpinnerStyle = "braillewave"
	SpinnerDNA         SpinnerStyle = "dna"
	SpinnerScan        SpinnerStyle = "scan"
	SpinnerPulse       SpinnerStyle = "pulse"
	SpinnerSnake       SpinnerStyle = "snake"
	SpinnerOrbit       SpinnerStyle = "orbit"
	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 Suggestion added in v0.2.0

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

Suggestion represents a single autocompletion suggestion.

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.2.0

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

TreeNode represents a node in a tree structure for FormatTree.

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.2.0

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.2.0

func NewVisualDiff(width int) *VisualDiff

NewVisualDiff creates a VisualDiff renderer with the given terminal width.

func (*VisualDiff) ColorizeByLanguage added in v0.2.0

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.2.0

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

RenderDiffSummary renders a summary table of file changes.

func (*VisualDiff) RenderFileDiff added in v0.2.0

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.2.0

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

RenderInline renders a unified diff with colors and line numbers.

func (*VisualDiff) RenderSideBySide added in v0.2.0

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

RenderSideBySide renders a diff in two-column format.

func (*VisualDiff) RenderWordDiff added in v0.2.0

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.2.0

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.2.0

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.

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