Documentation
¶
Overview ¶
Package usercommands loads user-defined slash commands from markdown files.
A user drops a file at `.zero/commands/<name>.md` (project, checked into the repo and shared with the team) or `<userConfigDir>/zero/commands/<name>.md` (personal), with optional YAML-style frontmatter:
--- description: Open a PR for the current branch model: claude-sonnet-4.5 --- Create a pull request for the current branch. Title: $1. Summarize: $ARGUMENTS
Typing `/<name> some args` expands the body template ($ARGUMENTS, $1..$N) and submits it as a normal prompt. This turns Zero's model-pulled skills into user-invokable, repo-checked-in team workflows. Project commands override user commands of the same name (mirrors the specialist scope precedence).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand substitutes the argument placeholders in a command template:
$ARGUMENTS → all args, space-joined (the whole arg string)
$1 .. $9 → the Nth whitespace-separated positional arg ("" if absent)
$$ → a literal "$"
A template with no placeholders is returned with the raw arg string appended on its own line, so a trivial command still receives the user's input.
Types ¶
type Command ¶
type Command struct {
Name string // the `/name` (file basename, lowercased, sans .md)
Description string // frontmatter `description:`, for help + autocomplete
Model string // optional frontmatter `model:` override
Agent string // optional frontmatter `agent:`/`mode:` routing
Template string // the markdown body, expanded on invocation
Path string // source file, for diagnostics
Project bool // true if from the project `.zero/commands` dir
}
Command is a user-defined slash command parsed from a markdown file.
type Paths ¶
Paths are the directories scanned for command files, project first.
func DefaultPaths ¶
DefaultPaths returns the project and user command directories. workspaceRoot is the repo root; userConfigDir is the OS config dir (os.UserConfigDir).