feat: add honest plugin inspection reporting

Shift the Rust parity increment away from implying TS-style plugin UX and toward an honest inspection surface. /plugin now reports current local plugin support, checked directories, and missing runtime wiring, while /reload-plugins rebuilds the runtime and prints the same inspection snapshot.\n\nConstraint: Rust only supports local manifest-backed plugins today; marketplace/discovery parity does not exist\nRejected: Stub marketplace installer flow | would overstate current capability\nRejected: Keep /plugin as list-only output | hides important gaps and checked paths\nConfidence: high\nScope-risk: narrow\nReversibility: clean\nDirective: Keep plugin reporting aligned with actual runtime wiring; do not advertise manifest commands/hooks as active until the runtime uses them\nTested: cargo test -p commands\nTested: cargo test -p claw-cli\nNot-tested: cargo clippy -p commands -p claw-cli --tests -- -D warnings (blocked by pre-existing workspace warnings in commands/claw-cli/lsp)
This commit is contained in:
Yeachan-Heo
2026-04-02 00:04:23 +00:00
parent a2f22b1ece
commit b8d78c9a53
4 changed files with 240 additions and 19 deletions

View File

@@ -648,6 +648,17 @@ pub struct PluginSummary {
pub enabled: bool,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PluginInspection {
pub install_root: PathBuf,
pub registry_path: PathBuf,
pub settings_path: PathBuf,
pub bundled_root: PathBuf,
pub external_dirs: Vec<PathBuf>,
pub discoverable_plugins: Vec<PluginSummary>,
pub installed_plugins: Vec<PluginSummary>,
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct PluginRegistry {
plugins: Vec<RegisteredPlugin>,
@@ -934,6 +945,31 @@ impl PluginManager {
self.config.config_home.join(SETTINGS_FILE_NAME)
}
#[must_use]
pub fn bundled_root_path(&self) -> PathBuf {
self.config
.bundled_root
.clone()
.unwrap_or_else(Self::bundled_root)
}
#[must_use]
pub fn external_dirs(&self) -> &[PathBuf] {
&self.config.external_dirs
}
pub fn inspect(&self) -> Result<PluginInspection, PluginError> {
Ok(PluginInspection {
install_root: self.install_root(),
registry_path: self.registry_path(),
settings_path: self.settings_path(),
bundled_root: self.bundled_root_path(),
external_dirs: self.external_dirs().to_vec(),
discoverable_plugins: self.list_plugins()?,
installed_plugins: self.list_installed_plugins()?,
})
}
pub fn plugin_registry(&self) -> Result<PluginRegistry, PluginError> {
Ok(PluginRegistry::new(
self.discover_plugins()?