1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Stable plugin API for kaish tools.
//!
//! This leaf crate defines the contract that every kaish tool — builtin or
//! third-party — implements, without pulling in `kaish-kernel`'s parser,
//! interpreter, or async runtime internals. It exists so out-of-tree tool
//! bundles (`kaish-tools-host`, `kaish-tools-git`, a hypothetical
//! `kaish-tools-perl`) can be written against a small, audited surface.
//!
//! # The surface
//!
//! - [`Tool`] — the trait every command implements. Its `execute` takes a
//! `&mut dyn ToolCtx`, so the concrete kernel context never leaks into the
//! public API.
//! - [`ToolCtx`] — the **trimmed** execution context. It exposes only what a
//! well-behaved, portable tool needs (backend I/O, cwd, variable access,
//! output format). Trusted in-tree builtins that need deeper kernel state
//! (job control, pipes, the dispatcher) recover the concrete context via
//! [`ToolCtx::as_any_mut`] — a documented escape hatch, not part of the
//! portable contract.
//! - [`KernelBackend`] — the I/O + tool-dispatch backend a tool reaches
//! through `ctx.backend()`.
//! - [`GlobalFlags`], [`schema_from_clap`], [`validate_against_schema`] — the
//! clap-reflection and validation machinery shared by all builtins.
//!
//! The pure-data types tools traffic in (`Value`, `ToolArgs`, `ToolSchema`,
//! `ExecResult`, `OutputData`, …) live one layer down in `kaish-types`.
pub use KernelBackend;
pub use ;
pub use ToolCtx;
pub use GlobalFlags;
pub use ;
pub use ;
// Re-export the data types tool authors need most often, so a tool crate can
// depend on just `kaish-tool-api` for the common case.
pub use ;