commands

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expand

func Expand(ctx context.Context, tmpl string, args []string,
	runner ShellRunner, readFile func(string) (string, error)) (string, error)

Expand interpolates a command template with the given arguments. Order: $N → $ARGUMENTS → append args if no placeholders → !`cmd` → @file.

func Load

func Load(cwd, home string) (map[string]Command, error)

Load scans cwd/.deepseek/command and home/.deepseek/command for *.md files and returns a name→Command map. Same-name commands: cwd wins. Missing directories are silently skipped.

func Tokenize

func Tokenize(argline string) []string

Tokenize splits argline by whitespace, respecting single and double quotes. Matched quote pairs are stripped. Returns nil if no tokens.

Types

type Command

type Command struct {
	Name        string // derived from relative path (filled by Load)
	Description string // frontmatter "description"
	Agent       string // frontmatter "agent" (active)
	Model       string // frontmatter "model" (active)
	Subtask     bool   // frontmatter "subtask" (active)
	Template    string // body after frontmatter (trimmed)
	Path        string // absolute path (filled by Load)
}

Command represents a user-defined slash command loaded from a .md file.

func ParseCommand

func ParseCommand(content string) (Command, error)

ParseCommand parses a .md file into a Command. If the content starts with "---\n", the block between the first and second "---" is parsed as frontmatter; otherwise the entire content becomes Template.

type ShellRunner

type ShellRunner func(ctx context.Context, cmd string) (string, error)

ShellRunner executes !`cmd` injections, returning stdout (trimmed).

Jump to

Keyboard shortcuts

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