Skip to main content

Module tools

Module tools 

Source
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§

ExecContext
Execution context passed to tools.
GlobalFlags
Flags injected into every migrated builtin via #[command(flatten)] global: GlobalFlags.
ParamSchema
Schema for a tool parameter.
ToolArgs
Parsed arguments ready for tool execution.
ToolRegistry
Registry of available tools.
ToolSchema
Schema describing a tool’s interface.

Enums§

OutputContext
Output context determines how command output should be formatted.

Constants§

WORD_ASSIGN_BUILTINS
Commands that consume bareword key=value argv (Arg::WordAssign) as shell-assignment pairs and route them through tool_args.named. For every other command, key=value lands as a positional "key=value" string — matching bash (cat foo=bar opens a file named foo=bar).

Traits§

Tool
A tool that can be executed.
ToolCtx
The portable execution context a tool sees.

Functions§

accepts_word_assign
is_global_output_flag
Check if a flag name is the kernel-owned --json flag.
params_from_clap
Reflect each Arg in a clap Command into a ParamSchema.
register_builtins
Register all built-in tools with the registry.
schema_from_clap
Build a ToolSchema for a builtin from its clap Command reflection plus hand-written description and examples.
schema_tree_from_clap
Build a recursive ToolSchema from a composed clap Command tree.
validate_against_schema
Validate arguments against a tool schema.