tonin-plugin
Minimal Plan API for tonin plugin authors.
Reads tonin.toml and resolves environment overlays without pulling in the
CLI dep tree (no clap, tera, include_dir, or codegen machinery). Intended as
the stable bridge between services and the tools that deploy them.
[]
= "0.5"
Core usage
use ;
let env = select_env; // reads $TONIN_ENV, defaults to "dev"
let plan = load_with_env?;
println!;
Version axes
tonin is split into three independently-versioned crates so each can evolve at its own pace:
tonin-sdk tonin-plugin tonin (CLI)
(runtime) (bridge) (tool)
───────── ──────────── ──────────
bumps on: bumps on: bumps on:
Rust API tonin.toml schema new commands
new capabilities new Plan fields new templates
tokio/tonic major new [section] deploy options
pinned by: pinned by: pinned by:
service devs plugin authors infra / devs
(compile-time) (plugin dev time) (install once)
A service pinning tonin-sdk = "0.6" can be deployed by CLI 1.1 or
1.2 — the CLI version is independent and irrelevant at runtime.
Compatibility matrix
| tonin-sdk | tonin-plugin | tonin CLI | What changed |
|---|---|---|---|
| 0.5.x | 0.5.x | 0.5.x | Initial split; tonin-plugin extracted from CLI, tonin-sdk renamed from tonin-core |
| 0.5.x | 0.4.x | 0.5.x | tonin-sdk gains EventBus trait (no schema change) |
| 0.5.x | 0.5.x | 0.5.x | [eventbus] section added to tonin.toml |
| 0.6.x | 0.5.x | 0.6.x | SecretStore improvements (no schema change) |
| 0.6.x | 0.6.x | 0.6.x | [config] section added to tonin.toml |
| 1.0.x | 1.0.x | 1.0.x | Stable API guarantee begins |
Rules:
tonin-sdkpatch/minor bumps never requiretonin-pluginor CLI changes.tonin-pluginbumps whentonin.tomlschema changes (new section or field).- CLI minor bumps freely; CLI major only when commands break (rare).
CLI version advisory (RECOMMENDED_CLI_MIN)
tonin-plugin exports a RECOMMENDED_CLI_MIN constant:
pub const RECOMMENDED_CLI_MIN: &str = "0.4.2";
The tonin CLI reads this at tonin k8s generate / tonin helm generate
time and warns (never errors) when it is older. This catches the common case
of a service repo upgrading tonin-plugin while the developer's installed
CLI is still the previous version.
To bump: update RECOMMENDED_CLI_MIN in src/plan.rs in the same commit
that adds the new tonin.toml field.
Writing a plugin
// In your plugin's main.rs:
use ;
Name your binary tonin-<name> and tonin dispatches to it automatically:
Optionally support --tonin-describe to show a description in
tonin plugin list --verbose:
if args.nth.as_deref == Some