Documentation
¶
Index ¶
- type CommandJsonSchema
- type JsonSchemaProperty
- type ShellCommand
- type ShellCommandDescription
- type ShellCommandLoader
- func (l *ShellCommandLoader) GetFileExtensions() []string
- func (l *ShellCommandLoader) GetName() string
- func (l *ShellCommandLoader) IsFileSupported(f fs.FS, fileName string) bool
- func (l *ShellCommandLoader) LoadCommands(fs_ fs.FS, filePath string, options []glazed_cmds.CommandDescriptionOption, ...) ([]glazed_cmds.Command, error)
- type ShellCommandOption
- type ShellTool
- type ShellToolProvider
- type ShellToolProviderOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandJsonSchema ¶
type CommandJsonSchema struct { Type string `json:"type"` Description string `json:"description,omitempty"` Properties map[string]*JsonSchemaProperty `json:"properties"` Required []string `json:"required,omitempty"` }
CommandJsonSchema represents the root JSON Schema for a command
type JsonSchemaProperty ¶
type JsonSchemaProperty struct { Type string `json:"type"` Description string `json:"description,omitempty"` Enum []string `json:"enum,omitempty"` Default interface{} `json:"default,omitempty"` Items *JsonSchemaProperty `json:"items,omitempty"` Required bool `json:"-"` Properties map[string]*JsonSchemaProperty `json:"properties,omitempty"` }
JsonSchemaProperty represents a property in the JSON Schema
type ShellCommand ¶
type ShellCommand struct { *cmds.CommandDescription ShellScript string Command []string Cwd string Environment map[string]string CaptureStderr bool }
ShellCommand is the runtime representation of a shell command
func LoadShellCommandFromYAML ¶
func LoadShellCommandFromYAML(data []byte) (*ShellCommand, error)
LoadShellCommandFromYAML creates a new ShellCommand from YAML data
func NewShellCommand ¶
func NewShellCommand( description *cmds.CommandDescription, options ...ShellCommandOption, ) (*ShellCommand, error)
NewShellCommand creates a new ShellCommand with the given options
func (*ShellCommand) ExecuteCommand ¶
func (c *ShellCommand) ExecuteCommand( ctx context.Context, args map[string]interface{}, w io.Writer, ) error
ExecuteCommand handles the actual command execution
func (*ShellCommand) RunIntoWriter ¶
func (c *ShellCommand) RunIntoWriter( ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer, ) error
RunIntoWriter implements the WriterCommand interface
func (*ShellCommand) ToJsonSchema ¶
func (c *ShellCommand) ToJsonSchema() (*CommandJsonSchema, error)
ToJsonSchema converts a ShellCommand to a JSON Schema representation
type ShellCommandDescription ¶
type ShellCommandDescription struct { Name string `yaml:"name"` Short string `yaml:"short"` Long string `yaml:"long,omitempty"` Flags []*parameters.ParameterDefinition `yaml:"flags,omitempty"` Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"` Layers []layers.ParameterLayer `yaml:"layers,omitempty"` ShellScript string `yaml:"shell-script,omitempty"` Command []string `yaml:"command,omitempty"` Cwd string `yaml:"cwd,omitempty"` Environment map[string]string `yaml:"environment,omitempty"` CaptureStderr bool `yaml:"capture-stderr,omitempty"` }
ShellCommandDescription represents the YAML structure for shell commands
type ShellCommandLoader ¶
type ShellCommandLoader struct{}
func (*ShellCommandLoader) GetFileExtensions ¶
func (l *ShellCommandLoader) GetFileExtensions() []string
func (*ShellCommandLoader) GetName ¶
func (l *ShellCommandLoader) GetName() string
func (*ShellCommandLoader) IsFileSupported ¶
func (l *ShellCommandLoader) IsFileSupported(f fs.FS, fileName string) bool
func (*ShellCommandLoader) LoadCommands ¶
func (l *ShellCommandLoader) LoadCommands( fs_ fs.FS, filePath string, options []glazed_cmds.CommandDescriptionOption, aliasOptions []alias.Option, ) ([]glazed_cmds.Command, error)
type ShellCommandOption ¶
type ShellCommandOption func(*ShellCommand)
func WithCaptureStderr ¶
func WithCaptureStderr(capture bool) ShellCommandOption
func WithCommand ¶
func WithCommand(cmd []string) ShellCommandOption
func WithCwd ¶
func WithCwd(cwd string) ShellCommandOption
func WithEnvironment ¶
func WithEnvironment(env map[string]string) ShellCommandOption
func WithShellScript ¶
func WithShellScript(script string) ShellCommandOption
type ShellTool ¶
type ShellTool struct {
// contains filtered or unexported fields
}
ShellTool is a wrapper around a shell command that implements the Tool interface
type ShellToolProvider ¶
type ShellToolProvider struct {
// contains filtered or unexported fields
}
ShellToolProvider is a ToolProvider that exposes shell commands as tools
func NewShellToolProvider ¶
func NewShellToolProvider(commands []cmds.Command, options ...ShellToolProviderOption) (*ShellToolProvider, error)
NewShellToolProvider creates a new ShellToolProvider with the given commands
func (*ShellToolProvider) CallTool ¶
func (p *ShellToolProvider) CallTool(ctx context.Context, name string, arguments map[string]interface{}) (*protocol.ToolResult, error)
CallTool invokes a specific tool with the given arguments
type ShellToolProviderOption ¶
type ShellToolProviderOption func(*ShellToolProvider)
func WithDebug ¶
func WithDebug(debug bool) ShellToolProviderOption
func WithTracingDir ¶
func WithTracingDir(dir string) ShellToolProviderOption