Skip to content

[Feature]: wsh layout save/load — serialize a workspace/tab to JSON and replay it #3250

@qveys

Description

@qveys

Feature description

Wave already persists saved workspaces (tabs, blocks, layouts) automatically. But there's no way to reproduce a workspace setup programmatically — no equivalent of tmuxinator, smug, or VS Code's code-workspace files.

Today, wsh run, wsh launch, wsh web open, wsh view each create blocks one at a time, but there's no compositional API to say "lay out this set of blocks in this configuration." wsh blocks list exposes block IDs but is read-only (wsh-reference#blocks).

As a user with multiple repos + a monitoring stack, I want a per-project layout file checked into the repo (or ~/.config/waveterm/layouts/) that I can replay with one command:

wsh layout apply ~/Git/my-supervision/.wave-layout.json

…and end up with the same tab/block tree every time, on every machine.

Implementation Suggestion

  1. wsh layout save [<file>] — serialize the current tab (or --workspace, or --all) to JSON: tab metadata, layout tree, per-block meta (view, controller, cmd, cwd, connection, magnified, etc.). The internal layout system (docs) already has a tree representation — just expose it.
  2. wsh layout apply <file> [--into-tab|--new-tab|--new-workspace] — recreate the tree, instantiating each block via the existing block-creation paths. Respect connection, cmd:cwd, cmd:initscript, etc. so connections.json + secrets are reused.
  3. JSON schema + json-schema entry in the same way widgets.json and connections.json get autocomplete (v0.11.1 release notes).
  4. Optional: widgets.json widgets that point at a layout file ("view": "layout") so a single-click button restores a whole tab tree.

Anything else?

This composes beautifully with existing features:

  • term:durable: true per-block in the layout file → reproducible long-running setups.
  • cmd:initscript entries already in connections.json → no duplication.
  • A team can commit .wave-layout.json next to docker-compose.yml/Makefile to onboard new contributors with one command.

Closely related (but not duplicate): #1372 (env vars from another block), #2738 (CLI focus/switch tabs), #3196 (rename tabs via wsh), #2106 (set window title via wsh). Those are individual primitives; this issue is about the composition layer on top.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions