command

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(path string) bool

Exists checks if a command file exists

func Save

func Save(cmd *Command, dir string) error

Save saves a command to a directory

Types

type Arg

type Arg struct {
	Type        string   `json:"type"`                  // "string", "number", "boolean"
	Enum        []string `json:"enum,omitempty"`        // Allowed values
	Default     any      `json:"default,omitempty"`     // Default value
	Description string   `json:"description,omitempty"` // Help text
	Required    bool     `json:"required,omitempty"`    // Is this arg required?
}

Arg represents a command argument definition

type Command

type Command struct {
	Name            string                  `json:"name"`
	Description     string                  `json:"description"`
	Prompt          string                  `json:"prompt"`
	ArgumentHint    string                  `json:"argumentHint,omitempty"`    // Hint for expected arguments (e.g., "[file.md or feature]")
	Model           string                  `json:"model,omitempty"`           // Preferred model (opus, sonnet, haiku, gpt-4, etc.)
	Args            map[string]Arg          `json:"args,omitempty"`            // Structured argument definitions
	AllowedTools    []string                `json:"allowedTools,omitempty"`    // Tools this command can use
	DisallowedTools []string                `json:"disallowedTools,omitempty"` // Tools this command cannot use
	Overrides       map[string]ToolOverride `json:"overrides,omitempty"`       // Per-tool overrides
	PromptRef       string                  `json:"promptRef,omitempty"`       // Reference to a prompt template

	// Runtime fields (not serialized)
	Scope      string `json:"-"` // "local" or "global" - where this command came from
	SourcePath string `json:"-"` // Path to the source file
}

Command represents a slash command configuration

func Load

func Load(path string) (*Command, error)

Load loads a command from a JSON file

func LoadAll

func LoadAll(dir string) ([]*Command, error)

LoadAll loads all commands from a directory

type ToolOverride

type ToolOverride struct {
	AllowedTools    []string `json:"allowedTools,omitempty"`
	DisallowedTools []string `json:"disallowedTools,omitempty"`
	AlwaysApply     bool     `json:"alwaysApply,omitempty"`
}

ToolOverride represents tool-specific command overrides

Jump to

Keyboard shortcuts

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