Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v1.112.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneThroughJSON

func CloneThroughJSON(oldConfig, newConfig any)

Types

type Command

type Command struct {
	// Description is shown in completion dialogs and help text.
	// For simple format commands, this is empty and the instruction is used for display.
	Description string `json:"description,omitempty"`

	// Instruction is the prompt sent to the agent.
	// Supports:
	// - Bang commands: !`command` (executed and output inserted)
	// - Positional arguments: $1, $2, etc.
	Instruction string `json:"instruction,omitempty"`

	// Agent, when set, makes the command switch the active agent to the named
	// sub-agent before any (optional) instruction is sent. This lets users
	// hand off to a different agent with a single slash command, e.g. /plan
	// to switch to the "planner" sub-agent.
	Agent string `json:"agent,omitempty"`

	// URL, when set, makes the command open the given URL in the user's
	// default browser instead of sending a prompt to the agent. Any custom
	// URI scheme the OS knows how to handle works too (e.g. docker-desktop://
	// to deep-link into Docker Desktop). The token {{session_id}} is replaced
	// at invocation time with the current session ID (URL-query-escaped).
	URL string `json:"url,omitempty"`
}

Command represents an agent command with optional metadata. It supports two YAML formats:

Simple format (string value):

fix-lint: "Fix the lint issues"

Advanced format (object value):

fix-lint:
  description: "Fix linting errors in the codebase"
  instruction: |
    Fix the lint issues reported by: !`golangci-lint run`
    Focus on files: $1

Agent-switching format (object value):

plan:
  description: "Hand off to the planner sub-agent"
  agent: planner

URL-opening format (object value):

feedback:
  description: "Open the feedback site"
  url: https://example.com/feedback

func (Command) DisplayText

func (c Command) DisplayText() string

DisplayText returns the text to show in completion dialogs. It returns Description when available, otherwise the Instruction. For agent-only commands (no instruction or description), it falls back to a short "switch to <agent>" hint so the completion dialog still has something meaningful to show.

type Commands

type Commands map[string]Command

Commands represents a set of named prompts for quick-starting conversations. It supports multiple YAML formats:

Map of simple strings:

commands:
  df: "check disk space"
  ls: "list files"

List of singleton maps (simple strings):

commands:
  - df: "check disk space"
  - ls: "list files"

Map of advanced objects:

commands:
  fix-lint:
    description: "Fix linting errors"
    instruction: "Fix the lint issues"

Mixed format (simple and advanced):

commands:
  simple: "A simple command"
  advanced:
    description: "An advanced command"
    instruction: "Do something complex"

func (*Commands) UnmarshalYAML

func (c *Commands) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML supports both map and list-of-singleton-maps syntaxes, with values being either simple strings or Command objects.

type StringOrList

type StringOrList []string

func (*StringOrList) UnmarshalYAML

func (sm *StringOrList) UnmarshalYAML(unmarshal func(any) error) error

Jump to

Keyboard shortcuts

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