picoclaw/pkg/commands/builtin.go
seagochen d17233e195 feat(commands): add /exec command and ! prefix shell execution
Register /exec as a built-in command so shell commands can be run
from pico (AI) mode without switching sessions. Also makes ! a
universal shell-exec prefix: unknown !foo commands fall back to
/exec instead of passing through to the agent.

- pkg/commands/cmd_exec.go: new /exec command definition
- pkg/commands/runtime.go: add ExecCmd callback to Runtime
- pkg/commands/builtin.go: register execCommand()
- pkg/commands/executor.go: ! prefix fallback to /exec for unknown commands
- pkg/agent/loop.go: wire ExecCmd callback in buildCommandsRuntime()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-11 13:56:21 +08:00

26 lines
676 B
Go

package commands
// BuiltinDefinitions returns all built-in command definitions.
// Each command group is defined in its own cmd_*.go file.
// Definitions are stateless — runtime dependencies are provided
// via the Runtime parameter passed to handlers at execution time.
func BuiltinDefinitions() []Definition {
return []Definition{
startCommand(),
helpCommand(),
showCommand(),
listCommand(),
switchCommand(),
checkCommand(),
// Session mode commands (formerly : prefix)
cmdModeCommand(),
picoModeCommand(),
hipicoCmnd(),
execCommand(),
editCommand(),
// Info and session management
usageCommand(),
clearCommand(),
compactCommand(),
}
}