Skip to content

feat(console): capture as template — export, parameterize, save (CHOO-2658) - #406

Open
abeldantas wants to merge 1 commit into
mainfrom
work/capture-export
Open

abeldantas wants to merge 1 commit into
mainfrom
work/capture-export

Conversation

@abeldantas

@abeldantas abeldantas commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Brief

Closes the share loop for room templates: the reverse of CHOO-2656's "Create from template" — a button on a live room that packages it into a template file, with an optional parameterize step before saving. Part of the room-templates workstream (epic CHOO-2600). Anyone can now capture a room, mark fields as parameters, save or clipboard the result, and share it in a channel for others to import.

Jira: CHOO-2658

Summary

  • Gateway client: exportRoomYaml() appended — calls GET /rooms/{id}/yaml with optional section toggles
  • Parameterize transform (@switch-console/shared): pure function replacing values with {key} placeholders, quoting for YAML safety, and prepending a params: block matching the server-side grammar from CHOO-2657
  • Capture view: "Capture as template" button on the room configuration panel navigates to a new view with YAML preview, parameterize checkboxes (room name, description, agents), round-trip parse guard, save-to-file (native Electron dialog) and copy-to-clipboard
  • RPC wiring: exportRoomYaml on switchServersController, saveToFile + copyToClipboard on roomTemplatesController
  • Server-side round-trip test: export → parameterize (replace name with {room_name}) → re-parse with inputs → structurally identical room under a new name
  • Merges work/group-templates (CHOO-2657) for the params parser

@abeldantas
abeldantas requested a review from amaudruz as a code owner September 8, 2026 22:23
Copilot AI lite review requested due to automatic review settings September 8, 2026 22:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are a couple of correctness/quality blockers in the new backend parsing/endpoint path (input validation + an unused local that will fail Ruff) that should be fixed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds end-to-end “capture room as a template” support: the backend YAML import surface now supports typed template params + JSON inputs, and the Console can export a live room’s YAML, optionally parameterize it, then save/copy it for sharing.

Changes:

  • Backend: extend RoomYamlService.parse() to support top-level params: + {name} interpolation, and allow POST /rooms/from-yaml to accept JSON { yaml, inputs }.
  • Console: add a room “Capture as template” flow (new view) with export, parameterize, preview, save-to-file, and copy-to-clipboard.
  • Tests: add backend coverage for param resolution/interpolation + a round-trip export→parameterize→re-parse scenario; add unit tests for the client-side parameterize transform.
File summaries
File Description
core/tests/switch_core/test_rooms_yaml.py Adds tests for params resolution/interpolation and an export→parameterize→re-parse round trip.
core/switch_core/rooms_yaml.py Implements params: + placeholder interpolation in parse(), plus param coercion helpers.
core/switch_core/gateway/rooms.py Allows /rooms/from-yaml to accept JSON {yaml, inputs} in addition to raw YAML.
console/packages/shared/src/parameterize.ts Adds client-side YAML parameterization transform and YAML-safe quoting.
console/packages/shared/src/parameterize.test.ts Adds vitest coverage for parameterize() behavior and quoting rules.
console/packages/shared/src/index.ts Re-exports parameterize and ParamSubstitution.
console/apps/switch-console-desktop/src/shared/core/views/view-ids.ts Registers new roomTemplateCapture view id.
console/apps/switch-console-desktop/src/renderer/features/switch-rooms/room-configuration-panel.tsx Adds “Capture as template” button entry point from a live room.
console/apps/switch-console-desktop/src/renderer/features/room-templates/room-template-capture-view.tsx Implements the capture UI: export, candidate selection, preview, save, copy.
console/apps/switch-console-desktop/src/renderer/app/view-registry.ts Wires the new capture view into the registry.
console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.ts Adds exportRoomYaml() client calling GET /rooms/{id}/yaml with section toggles.
console/apps/switch-console-desktop/src/main/core/switch-servers/controller.ts Exposes exportRoomYaml over RPC.
console/apps/switch-console-desktop/src/main/core/room-templates/controller.ts Adds saveToFile + copyToClipboard RPC helpers and keeps YAML parsing utilities.
Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/switch_core/gateway/rooms.py
Comment thread core/switch_core/rooms_yaml.py
Comment thread core/switch_core/rooms_yaml.py
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@abeldantas

Copy link
Copy Markdown
Collaborator Author

recheck

@abeldantas
abeldantas force-pushed the work/import-ux branch 2 times, most recently from 37a875f to 8983d27 Compare September 9, 2026 06:43
@abeldantas
abeldantas changed the base branch from work/import-ux to main September 9, 2026 08:43
…-2658)

Adds the reverse of "Create from template": a button on a live room that
packages it into a shareable template file with an optional parameterize step.

Console:
- "Capture as template" button on the room configuration panel
- Capture view: two-column layout with parameterize panel (editable param
  names, "keep literal" toggle per field), YAML preview, round-trip check
  sidebar (parse validity, param defaults, no-secrets confirmation), share-it
  guidance, full-width stacked Copy YAML / Save file buttons
- gateway-client: exportRoomYaml() (GET /rooms/{id}/yaml)
- roomTemplatesController: saveToFile (Electron dialog), copyToClipboard

Shared:
- parameterize transform: pure function replacing values with {key}
  placeholders, quoting for YAML safety, prepending a params: block
  matching the server-side grammar — 12 unit tests

Backend:
- Refactored export() to share _export_room_data() helper
- Parameterized export round-trip test (export → {room_name} → re-parse)
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.

2 participants