feat(plugin): add a Plugin Manager window listing installed add-ons

Read-only inventory of the add-ons compiled into the build — name, version,
id, API level, description, command prefixes — built from the extracted
`ocs_plugin_api` manifest. Opened with the `PLUGINS` / `PLUGINMANAGER` command
or the Start-page "Plugins" button.

Adds `installed_manifests()` to the plugin registry and wires the window the
same way as the existing About / Shortcuts windows.

Part of #100 (phase-1 plugin manager UI stub).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-15 01:46:09 +03:00
1 parent 72ec1146df
commit ec865a95aa
9 files changed
+221 -2

No files matched your search

+1 -1
View File
@@ -10,4 +10,4 @@ pub mod registry;
pub use registry::all_ribbon_modules;
pub(crate) use host::BuiltinPlugin;
pub(crate) use registry::try_dispatch;
pub(crate) use registry::{installed_manifests, try_dispatch};
+29
View File
@@ -1,6 +1,7 @@
// Compile-time plugin registry via `inventory`.
use super::host::{BuiltinPlugin, HostSession};
use super::manifest::PluginManifest;
use crate::app::OpenCADStudio;
use crate::modules::{registry as core_registry, CadModule};
@@ -18,6 +19,15 @@ pub fn all_plugins() -> Vec<Box<dyn BuiltinPlugin>> {
.collect()
}
/// Static manifest of every installed add-on, sorted by `ribbon_order` then id
/// for a stable display. Used by the plugin manager window.
pub fn installed_manifests() -> Vec<&'static PluginManifest> {
let mut manifests: Vec<&'static PluginManifest> =
all_plugins().iter().map(|p| p.manifest()).collect();
manifests.sort_by(|a, b| a.ribbon_order.cmp(&b.ribbon_order).then(a.id.cmp(b.id)));
manifests
}
/// Core ribbon tabs plus add-on tabs (sorted by `manifest.ribbon_order`).
pub fn all_ribbon_modules() -> Vec<Box<dyn CadModule>> {
let mut core = core_registry::all_modules();
@@ -61,6 +71,25 @@ mod tests {
);
}
#[test]
fn installed_manifests_lists_demo_plugin() {
let manifests = installed_manifests();
assert!(
manifests.iter().any(|m| m.id == "opencad.demo_plugin"),
"ids: {:?}",
manifests.iter().map(|m| m.id).collect::<Vec<_>>()
);
// Sorted by (ribbon_order, id) — verify non-decreasing order.
let mut prev: Option<(i32, &str)> = None;
for m in &manifests {
let key = (m.ribbon_order, m.id);
if let Some(p) = prev {
assert!(p <= key, "manifests not sorted: {p:?} then {key:?}");
}
prev = Some(key);
}
}
#[test]
fn addon_ribbon_tabs_merge_after_core() {
let titles: Vec<&str> = all_ribbon_modules().iter().map(|m| m.title()).collect();