Expand description
Tool system for kaish.
Tools are the primary way to perform actions in kaish. Every command
is a tool — builtins and user-defined tools all implement
the same Tool trait.
§Architecture
ToolRegistry
├── Builtins (echo, ls, cat, ...)
└── User Tools (defined via `tool` statements)Structs§
- Exec
Context - Execution context passed to tools.
- Global
Flags - Flags injected into every migrated builtin via
#[command(flatten)] global: GlobalFlags. - Param
Schema - Schema for a tool parameter.
- Tool
Args - Parsed arguments ready for tool execution.
- Tool
Registry - Registry of available tools.
- Tool
Schema - Schema describing a tool’s interface.
Enums§
- Output
Context - Output context determines how command output should be formatted.
Constants§
- WORD_
ASSIGN_ BUILTINS - Commands that consume bareword
key=valueargv (Arg::WordAssign) as shell-assignment pairs and route them throughtool_args.named. For every other command,key=valuelands as a positional"key=value"string — matching bash (cat foo=baropens a file namedfoo=bar).
Traits§
Functions§
- accepts_
word_ assign - is_
global_ output_ flag - Check if a flag name is the kernel-owned
--jsonflag. - params_
from_ clap - Reflect each
Argin a clapCommandinto aParamSchema. - register_
builtins - Register all built-in tools with the registry.
- schema_
from_ clap - Build a
ToolSchemafor a builtin from its clapCommandreflection plus hand-written description and examples. - schema_
tree_ from_ clap - Build a recursive
ToolSchemafrom a composed clapCommandtree. - validate_
against_ schema - Validate arguments against a tool schema.