Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownCommand = errors.New("unknown command")
ErrUnknownCommand is returned by Run for a verb that is not registered or carries no handler. The dispatcher must fail closed on it (exit 2), never 0.
var ErrUsage = errors.New("usage")
ErrUsage is the sentinel for fail-closed rejections that must map to exit code 2 (usage / out-of-phase / invalid-enum), as opposed to gate/verify failures which exit 1. main.go inspects it. Wrap it, never return it bare, so the message names the specific violation (spec 03 R2, R3).
var Registry map[string]Handler
Registry is populated in init() rather than as a var initializer: the runMCP handler now reaches Run (via the injected MCP executor), and Run reads Registry — a static var-initializer graph would flag that as an initialization cycle. init() assignment is exempt from that analysis and still runs before any dispatch.
Functions ¶
func RegisteredCommandNames ¶ added in v0.3.0
func RegisteredCommandNames() []string
func Run ¶ added in v0.3.0
Run is the single dispatch choke point. It resolves the verb, enforces declared flag enums and lifecycle-phase compatibility *before* any handler side effect, then invokes the handler. Fail-closed rejections wrap ErrUsage (exit 2); unknown verbs wrap ErrUnknownCommand (exit 2). This is the one place the harness turns command metadata into enforcement (spec 03).