slash

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package slash is part of the GoFastr harness.

See docs/harness-architecture.md § Slash commands.

Package slash implements the slash-command parser + the built-in command catalog.

Per § Slash commands, parsing happens at the client: a /-prefixed input is converted to a typed wire Command before being sent to the engine. Built-in commands (bare /foo, no namespace) ship with the harness; user/plugin commands live under namespaces like /custom:bar, /super-skill:baz.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSlashCommand = errors.New("slash: not a slash command")

ErrNotSlashCommand signals an input didn't start with '/'.

View Source
var ErrUnknownNamespace = errors.New("slash: unknown namespace")

ErrUnknownNamespace is returned by the resolver when a namespace isn't claimed by built-ins or any plugin.

Functions

func AllNamespaces

func AllNamespaces() []string

AllNamespaces returns the reserved namespaces shipped in v0.1. Plugins claim additional namespaces via Plugin.Register.

Types

type Builtin

type Builtin struct {
	Name        string
	Description string
	ArgsHelp    string // one-line argument summary
}

Builtin is one shipped command's metadata.

func AllBuiltins

func AllBuiltins() []Builtin

AllBuiltins returns the v0.1 built-in command catalog, as documented at § Slash commands → Built-in commands shipped in v0.1.

The handlers are wired by the harness composition layer; this catalog is what clients display via GET /v1/slash-commands.

type Cmd

type Cmd struct {
	// IsBuiltin reports whether Namespace is empty.
	IsBuiltin bool
	// Namespace is the prefix before the colon ("skills" in
	// "/skills:foo"). Empty for built-ins.
	Namespace string
	// Name is the verb after the colon (or after the slash for
	// built-ins). "foo" in "/skills:foo".
	Name string
	// Args is the remaining whitespace-delimited tokens, preserving
	// quoted segments as single tokens.
	Args []string
	// Raw is the original input including leading slash.
	Raw string
}

Cmd is a parsed slash-command invocation.

func Parse

func Parse(input string) (Cmd, error)

Parse converts a slash-prefixed input to a Cmd. Returns ErrNotSlashCommand if the input doesn't start with '/'.

Quoting: arguments may be wrapped in double quotes to preserve whitespace ("path with spaces"). Escapes inside quotes: \\ → \, \" → ", \n → newline.

Jump to

Keyboard shortcuts

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