tool

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tool contains shared process, file and JSON primitives used by the three public commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsoluteExecutable

func AbsoluteExecutable(name string) (string, error)

func Array

func Array(v any) []any

func CopyFile

func CopyFile(source, target string) error

func CopySaved

func CopySaved(source, target string) error

func CopyTree

func CopyTree(source, target string) error

func CreateOutput

func CreateOutput(path, mode string) (string, error)

CreateOutput returns a new attempt directory. Existing paths are never overwritten because failed attempts are evidence too.

func DataDir

func DataDir() (string, error)

DataDir is the single owner of persistent tool data. Attempts and private archives are siblings rather than copies of the same environment logic.

func DigestBytes

func DigestBytes(data []byte) string

func FileDigest

func FileDigest(path string) (string, error)

func OutputBase

func OutputBase(mode string) (string, error)

func ReadJSON

func ReadJSON(path string, v any) error

func RunPeer

func RunPeer(o PeerOptions) (runErr error)

func Str

func Str(v any) string

func Strings

func Strings(v any) []string

func ValidateCommand

func ValidateCommand(value string) (string, error)

ValidateCommand resolves a caller-selected absolute executable without PATH lookup.

func WaitDriver

func WaitDriver(ctx context.Context, cmd *exec.Cmd, started ...func(int) error) (runErr error)

WaitDriver owns the process group so cancellation also reaps descendants.

func WaitProcessGroup

func WaitProcessGroup(pid int) error

WaitProcessGroup confirms that even descendants abandoned by an SDK have stopped. A surviving group leaves the official reservation intact.

func WriteFiles

func WriteFiles(root string, files Object) error

func WriteJSON

func WriteJSON(path string, v any) error

Types

type Command

type Command struct {
	Command string            `json:"command"`
	Env     map[string]string `json:"env,omitempty"`
	Args    []string          `json:"args,omitempty"`
}

type Object

type Object = map[string]any

Object is the lossless-enough JSON object shape used between stages. Native protocol bytes stay in internal/protocol/recording and are never rebuilt here.

func Obj

func Obj(v any) Object

type PeerOptions

type PeerOptions struct {
	Request   string
	Lifecycle string
	Results   string
	In        io.Reader
	Out       io.Writer
	Err       io.Writer
}

type Result

type Result struct {
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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