tools

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeSDKManifestURL = "https://unpkg.com/@use-tusk/drift-node-sdk@latest/dist/instrumentation-manifest.json"
)

SDK manifest URLs

Variables

View Source
var ErrSetupAborted = errors.New("setup aborted")

ErrSetupAborted is a sentinel error for checking abort status

Functions

func AbortSetup

func AbortSetup(input json.RawMessage) (string, error)

AbortSetup handles graceful exit when setup cannot proceed This is used when the agent detects an unsupported project type

func FetchManifestFromURL

func FetchManifestFromURL(url string) (string, error)

FetchManifestFromURL fetches an SDK manifest from a URL Returns the raw JSON string

Types

type AbortError

type AbortError struct {
	Reason      string
	ProjectType string
}

AbortError wraps ErrSetupAborted with the reason and detected project type

func (*AbortError) Error

func (e *AbortError) Error() string

func (*AbortError) Is

func (e *AbortError) Is(target error) bool

type FilesystemTools

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

FilesystemTools provides file system operations

func NewFilesystemTools

func NewFilesystemTools(workDir string) *FilesystemTools

NewFilesystemTools creates a new FilesystemTools instance

func (*FilesystemTools) Grep

func (ft *FilesystemTools) Grep(input json.RawMessage) (string, error)

Grep searches for a pattern in files

func (*FilesystemTools) ListDirectory

func (ft *FilesystemTools) ListDirectory(input json.RawMessage) (string, error)

ListDirectory lists files and directories in a path

func (*FilesystemTools) PatchFile

func (ft *FilesystemTools) PatchFile(input json.RawMessage) (string, error)

PatchFile applies a targeted edit to a file

func (*FilesystemTools) ReadFile

func (ft *FilesystemTools) ReadFile(input json.RawMessage) (string, error)

ReadFile reads the contents of a file

func (*FilesystemTools) WriteFile

func (ft *FilesystemTools) WriteFile(input json.RawMessage) (string, error)

WriteFile writes content to a file

type HTTPTools

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

HTTPTools provides HTTP request operations

func NewHTTPTools

func NewHTTPTools() *HTTPTools

NewHTTPTools creates a new HTTPTools instance

func (*HTTPTools) Request

func (ht *HTTPTools) Request(input json.RawMessage) (string, error)

Request makes an HTTP request and returns the response

type ManagedProcess

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

ManagedProcess represents a background process

type ProcessManager

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

ProcessManager manages background processes

func NewProcessManager

func NewProcessManager(workDir string) *ProcessManager

NewProcessManager creates a new ProcessManager

func NewProcessManagerWithOptions

func NewProcessManagerWithOptions(workDir string, disableSandbox bool) *ProcessManager

NewProcessManagerWithOptions creates a new ProcessManager with options

func (*ProcessManager) IsSandboxEnabled

func (pm *ProcessManager) IsSandboxEnabled() bool

IsSandboxEnabled returns whether sandboxing is enabled

func (*ProcessManager) StopAll

func (pm *ProcessManager) StopAll()

StopAll stops all managed processes and cleans up resources

type ProcessTools

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

ProcessTools provides process management operations

func NewProcessTools

func NewProcessTools(pm *ProcessManager, workDir string) *ProcessTools

NewProcessTools creates a new ProcessTools instance

func (*ProcessTools) GetLogs

func (pt *ProcessTools) GetLogs(input json.RawMessage) (string, error)

GetLogs returns recent logs from a background process

func (*ProcessTools) RunCommand

func (pt *ProcessTools) RunCommand(input json.RawMessage) (string, error)

RunCommand executes a command and waits for completion

func (*ProcessTools) StartBackground

func (pt *ProcessTools) StartBackground(input json.RawMessage) (string, error)

StartBackground starts a process in the background. Note: This is NOT sandboxed because it's used for: - "Confirm App Starts" phase (needs real DB connections) - "Record" mode (needs real outbound calls to capture behavior) Replay mode sandboxing is handled by the runner package, not here.

func (*ProcessTools) StopBackground

func (pt *ProcessTools) StopBackground(input json.RawMessage) (string, error)

StopBackground stops a background process

func (*ProcessTools) WaitForReady

func (pt *ProcessTools) WaitForReady(input json.RawMessage) (string, error)

WaitForReady polls a URL until it responds successfully

type RingBuffer

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

RingBuffer keeps the last N lines

func NewRingBuffer

func NewRingBuffer(size int) *RingBuffer

NewRingBuffer creates a new ring buffer

func (*RingBuffer) All

func (rb *RingBuffer) All() []string

All returns all lines

func (*RingBuffer) Lines

func (rb *RingBuffer) Lines(n int) []string

Lines returns the last n lines

func (*RingBuffer) Write

func (rb *RingBuffer) Write(line string)

Write adds a line to the buffer

type TuskTools

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

TuskTools provides Tusk CLI operations using internal runner package

func NewTuskTools

func NewTuskTools(workDir string) *TuskTools

NewTuskTools creates a new TuskTools instance

func (*TuskTools) List

func (tt *TuskTools) List(input json.RawMessage) (string, error)

List loads and lists traces from the .tusk/traces directory

func (*TuskTools) Run

func (tt *TuskTools) Run(input json.RawMessage) (string, error)

Run runs tests using the internal runner

type UserTools

type UserTools struct{}

UserTools provides user interaction operations

func NewUserTools

func NewUserTools() *UserTools

NewUserTools creates a new UserTools instance

func (*UserTools) Ask

func (ut *UserTools) Ask(input json.RawMessage) (string, error)

Ask prompts the user with a question and returns their response

Jump to

Keyboard shortcuts

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