scanner

package
v0.0.0-...-360ba47 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Type     string
	Argument string
	Content  string
	StartPos int
	EndPos   int
	Original string
}

Command represents a parsed command from LLM output

type ExecutionResult

type ExecutionResult struct {
	Command       Command
	Success       bool
	Result        string
	Error         error
	ExecutionTime time.Duration
	BytesWritten  int64
	BackupFile    string
	Action        string
	ExitCode      int
	Stdout        string
	Stderr        string
	ContainerID   string
}

ExecutionResult holds the result of a command execution

type Scanner

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

Scanner implements a state-machine based input processor

func NewScanner

func NewScanner(reader *bufio.Reader) *Scanner

NewScanner creates a new state-machine scanner

func (*Scanner) Err

func (s *Scanner) Err() error

Err returns the first non-EOF error encountered during scanning. It should be checked after Scan returns nil.

func (*Scanner) Scan

func (s *Scanner) Scan() *Command

Scan reads input and returns the next complete command Returns nil when EOF or no command found

type ScannerState

type ScannerState int

ScannerState represents the current parsing state

const (
	StateScanning  ScannerState = iota // Default: scanning for commands or plain text
	StateTagOpen                       // Saw '<', determining tag type
	StateOpen                          // Parsing <open filepath>
	StateWrite                         // Parsing <write filepath>
	StateWriteBody                     // Accumulating write content until </write>
	StateExec                          // Parsing <exec command>
	StateExecBody                      // Accumulating exec body
	StateSearch                        // Parsing <search query>
)

func (ScannerState) String

func (s ScannerState) String() string

String returns the name of the state (for debugging)

Jump to

Keyboard shortcuts

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