Skip to main content

bamboo_plugin/
lib.rs

1//! Foundation for Bamboo's local plugin system.
2//!
3//! A **plugin** is a locally-installed bundle that can provide any of:
4//! skills, MCP servers, prompt presets, and (future) workflows. It is
5//! installed to `~/.bamboo/plugins/<id>/` (see
6//! `bamboo_config::paths::plugin_dir`), keeping the plugin's own files
7//! together (manifest, skills, prompts, workflows, optional per-platform
8//! binaries), then REGISTERED into Bamboo's existing capability locations:
9//!
10//! | Capability | Registered into | Discovery model |
11//! |---|---|---|
12//! | MCP servers | `config.json` (`Config.mcp`) + `mcp_manager.start_server` | copied into shared config |
13//! | Skills | N/A — discovered **in place** | `~/.bamboo/plugins/*/skills` is an additional `SkillDiscoveryDir` (see `bamboo-skills`) |
14//! | Prompt presets | `prompt-presets.json` | copied into shared store |
15//! | Workflows | `~/.bamboo/workflows/*.md` | copied into shared dir (no discovery-dir mechanism exists yet) |
16//!
17//! This crate defines the shared skeleton three things build on:
18//!
19//! 1. [`manifest::PluginManifest`] — the `plugin.json` schema, with
20//!    validation and the `${plugin_dir}`/`${platform_bin}` token-substitution
21//!    contract for MCP stdio commands (see the `manifest` module docs for the
22//!    full contract).
23//! 2. [`registry::InstalledPlugins`] — the `~/.bamboo/plugins/installed.json`
24//!    provenance registry (load/save/add/remove), recording exactly what each
25//!    plugin registered so uninstall/upgrade is precise.
26//! 3. [`installer::PluginInstaller`] — the trait later agents implement to
27//!    actually wire capability registration (that wiring needs `AppState`,
28//!    which this `infra`-layer crate intentionally does not depend on).
29//!
30//! See the repo-root `PLUGIN_PLAN.md` (temporary, deleted before final merge)
31//! for how the remaining work is split across parallel agents, and
32//! `examples/hello-plugin/` for a minimal end-to-end reference plugin
33//! (one skill + one prompt preset, no binary, no MCP server).
34
35pub mod error;
36pub mod installer;
37pub mod manifest;
38pub mod registry;
39
40pub use error::{PluginError, PluginResult};
41pub use installer::{
42    load_previous_for_disposition, on_disk_skill_dirs, preflight_install, InstallDisposition,
43    LocalPluginInstaller, PluginInstaller,
44};
45pub use manifest::{
46    McpServerManifestEntry, McpTransportManifest, Platform, PluginArtifact, PluginManifest,
47    PluginPromptPreset, PluginProvides,
48};
49pub use registry::{
50    classify_ownership, reconcile_exclusive, ExclusiveReconciliation, InstalledPlugin,
51    InstalledPlugins, Ownership, PluginInstallStatus, PluginSource, RegisteredCapabilities,
52};