agnt

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package agnt provides configuration and runtime management for the agnt CLI.

Index

Constants

View Source
const ConfigFileName = ".agnt.kdl"

ConfigFileName is the name of the agnt configuration file.

Variables

This section is empty.

Functions

func FindConfigFile

func FindConfigFile(dir string) string

FindConfigFile searches for .agnt.kdl starting from dir and walking up.

func WriteDefaultConfig

func WriteDefaultConfig(path string) error

WriteDefaultConfig writes a default configuration file with documentation.

Types

type AutoStarter

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

AutoStarter manages auto-starting scripts and proxies from config.

func NewAutoStarter

func NewAutoStarter(config *Config, client *daemon.ResilientClient) *AutoStarter

NewAutoStarter creates a new AutoStarter.

func (*AutoStarter) Start

func (a *AutoStarter) Start(ctx context.Context, projectPath string) error

Start starts all configured auto-start scripts and proxies.

func (*AutoStarter) StartedProxies

func (a *AutoStarter) StartedProxies() []string

StartedProxies returns the names of proxies that were auto-started.

func (*AutoStarter) StartedScripts

func (a *AutoStarter) StartedScripts() []string

StartedScripts returns the names of scripts that were auto-started.

func (*AutoStarter) Stop

func (a *AutoStarter) Stop(ctx context.Context) error

Stop stops all auto-started scripts and proxies.

type Config

type Config struct {
	// Scripts to manage
	Scripts map[string]*ScriptConfig `kdl:"scripts"`

	// Proxies to manage
	Proxies map[string]*ProxyConfig `kdl:"proxies"`

	// Hooks configuration
	Hooks *HooksConfig `kdl:"hooks"`

	// Toast notification settings
	Toast *ToastConfig `kdl:"toast"`
}

Config represents the agnt configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a config with sensible defaults.

func LoadConfig

func LoadConfig(dir string) (*Config, error)

LoadConfig loads configuration from the specified directory. It looks for .agnt.kdl in the directory and its parents.

func LoadConfigFile

func LoadConfigFile(path string) (*Config, error)

LoadConfigFile loads configuration from a specific file.

func ParseConfig

func ParseConfig(data string) (*Config, error)

ParseConfig parses KDL configuration data.

func (*Config) GetAutostartProxies

func (c *Config) GetAutostartProxies() map[string]*ProxyConfig

GetAutostartProxies returns proxies configured for autostart.

func (*Config) GetAutostartScripts

func (c *Config) GetAutostartScripts() map[string]*ScriptConfig

GetAutostartScripts returns scripts configured for autostart.

type HooksConfig

type HooksConfig struct {
	// OnResponse controls what happens when Claude responds
	OnResponse *ResponseHookConfig `kdl:"on-response"`
}

HooksConfig defines hook behavior.

type ProxyConfig

type ProxyConfig struct {
	Target     string `kdl:"target"`
	Port       int    `kdl:"port"`
	Autostart  bool   `kdl:"autostart"`
	MaxLogSize int    `kdl:"max-log-size"`
}

ProxyConfig defines a reverse proxy to start.

type ResponseHookConfig

type ResponseHookConfig struct {
	// Toast shows a toast notification in the browser
	Toast bool `kdl:"toast"`
	// Indicator updates the bug indicator
	Indicator bool `kdl:"indicator"`
	// Sound plays a notification sound
	Sound bool `kdl:"sound"`
}

ResponseHookConfig controls response notification behavior.

type ScriptConfig

type ScriptConfig struct {
	Command   string            `kdl:"command"`
	Args      []string          `kdl:"args"`
	Autostart bool              `kdl:"autostart"`
	Env       map[string]string `kdl:"env"`
	Cwd       string            `kdl:"cwd"`
}

ScriptConfig defines a script to run.

type ToastConfig

type ToastConfig struct {
	// Duration in milliseconds (default 4000)
	Duration int `kdl:"duration"`
	// Position: "top-right", "top-left", "bottom-right", "bottom-left"
	Position string `kdl:"position"`
	// MaxVisible is the max number of visible toasts (default 3)
	MaxVisible int `kdl:"max-visible"`
}

ToastConfig configures toast notifications.

Jump to

Keyboard shortcuts

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