Skip to content

feat(v3): add/remove plugins from a dropdown + "New" button (v0.20)#90

Merged
mbreiser merged 1 commit into
mainfrom
feat/v3-add-plugin-dropdown
Jun 1, 2026
Merged

feat(v3): add/remove plugins from a dropdown + "New" button (v0.20)#90
mbreiser merged 1 commit into
mainfrom
feat/v3-add-plugin-dropdown

Conversation

@mbreiser
Copy link
Copy Markdown
Contributor

@mbreiser mbreiser commented Jun 1, 2026

What & why

Addresses Lisa's Slack feedback: the v3 Experiment Designer only exposed commands for plugins already declared in the imported YAML, so there was no way to add a new plugin (e.g. a thermometer for temperature monitoring) and surface its commands. Separately, creating a protocol from scratch was possible but hidden inside the "Load demo" dropdown.

Changes

Add/remove plugins (Settings → Plugins)

  • "+ Add plugin…" dropdown lists supported plugins from the registry (backlight, thermometer/DAQThermometerPlugin, camera), excluding ones already declared.
  • Add button inserts the entry with registry defaults; per-plugin removes it (confirm dialog warns if commands still reference it).
  • Newly added plugins' commands appear in the Inspector's "+ add" picker immediately.
  • Config values (device_id, channels, ports) are still edited in the exported YAML.

"+ New" button — loads the blank minimum-valid skeleton from the toolbar (next to Import); removed the now-redundant demo-dropdown entry.

Plumbing

  • onAddPlugin / onRemovePlugin / countPluginUsage follow the existing mutation pattern (importMode guard, pushUndo, renderAll); newBtn added to IMPORT_LOCKED_CONTROLS.
  • js/protocol-yaml-v3.js: new docRemovePlugin(). The add path reuses createPluginEntry_doc.createNode → existing docInsertPluginNode.

Tests

  • New Suite N11 in tests/test-protocol-roundtrip-v3.js (add / remove / roundtrip / no-plugins:-key creation). 592/592 pass.
  • Browser-verified: New → add thermometer → commands appear in picker → remove → gone; no console errors.

🤖 Generated with Claude Code

Addresses Lisa's feedback: the v3 editor only exposed commands for
plugins already declared in the imported YAML, with no way to add a
new one (e.g. a thermometer for temperature monitoring). Creating a
protocol from scratch was also hidden inside the demo dropdown.

- Settings → Plugins is now editable: a "+ Add plugin…" dropdown lists
  supported plugins from the registry (backlight, thermometer, camera),
  excluding ones already declared, with an Add button and a per-plugin
  ✕ remove button (confirm dialog warns if commands still reference it).
  Newly added plugins' commands appear in the Inspector "+ add" picker
  immediately (listV3PluginNames reads experiment.plugins[]).
- New "+ New" toolbar button loads the blank skeleton (was only
  reachable via the demo dropdown); removed the redundant demo entry.
- New onAddPlugin/onRemovePlugin/countPluginUsage handlers follow the
  existing mutation pattern (importMode guard, pushUndo, renderAll);
  newBtn added to IMPORT_LOCKED_CONTROLS.
- protocol-yaml-v3.js: new docRemovePlugin(); add path reuses
  createPluginEntry → _doc.createNode → docInsertPluginNode.
- Tests: new Suite N11 (add/remove/roundtrip) — 592/592 pass.
- Quickstart + footer updated to v0.20.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mbreiser mbreiser merged commit 0726e5b into main Jun 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant