Files
webstudio/packages/protocol
Oleg Isonen 92084aeea3 fix: Remove MCP workflow friction (#5974)
## Summary

- Make MCP discoverable from the CLI README and expose direct MCP tool
calls as restart-free CLI subcommands.
- Preserve required discriminator fields in compact MCP SDK schemas and
surface the `set-text-content` contract.
- Return instance props by default from `inspect-instance` and improve
the `list-instances` input hint.
- Add a Builder context-menu **Move** submenu as an accessible
alternative to drag-and-drop sibling reordering.

Companion generated documentation:
https://github.com/webstudio-is/webstudio-community/pull/274

## Technical choices and compatibility

- Compact SDK schemas retain required fields only inside root
composition branches, avoiding broad schema expansion.
- `inspect-instance` now defaults to `props` only; larger styles,
bindings, sources, children, and ancestors remain opt-in.
- Existing move commands and shortcuts back the new menu, so command
behavior stays centralized.
- No migrations, fixture inputs, generated fixture bundles, or generated
API contracts are affected.

## Todo

- [x] Add direct CLI MCP discovery and restart guidance.
- [x] Preserve discriminated-union requirements for SDK clients.
- [x] Improve instance inspection and input diagnostics.
- [x] Add accessible menu-based instance movement.
- [x] Add regression coverage and verify fail/pass behavior.
- [x] Run targeted tests, typechecks, lint, package-boundary, and
generated-doc checks.
- [ ] Deferred: run `pnpm evaluations` after separate explicit approval,
as required by repository policy.

## Verification

- `@webstudio-is/project-build`: 172 targeted tests passed.
- `@webstudio-is/protocol`: 8 targeted tests passed; typecheck passed.
- `@webstudio-is/builder`: 8 targeted tests passed; typecheck passed.
- CLI and project-build typechecks passed.
- Root lint, package-boundary check, generated-doc check, and diff
checks passed.
- New and modified regression tests were demonstrated failing before
their fixes and passing afterward.

## Known limitations

Synthetic drag-and-drop behavior is unchanged. The new menu and existing
keyboard shortcuts provide the automatable and accessible reordering
path. Agent evaluations were not run because explicit approval was not
provided.
2026-08-03 00:36:56 +02:00
..

Protocol

@webstudio-is/protocol owns Webstudio data exchange protocols.

The project bundle is the external export/import artifact used by sync, local .webstudio/data.json, project import, transferred asset files, and prebuild. This package owns the assembled bundle schemas, transfer RPC payloads, and bundle compatibility/version helpers.

Domain models such as pages, assets, and serialized builds remain owned by their domain packages and are composed here through schema-only entrypoints. Do not copy those schemas into this package.

Terminology

Project bundle is the authoritative external project artifact. It is used by sync, .webstudio/data.json, project import, transferred asset files, and prebuild.

Data envelope is a serialized single-key object whose key is a versioned Webstudio marker, for example { "@webstudio/instance/v0.1": data }. The envelope identifies the payload version and lets consumers detect malformed Webstudio-owned data before falling back to other formats.

Transfer data is the domain payload inside a data envelope. Examples include InstanceTransferData, InstancesTransferData, and PageTransferData. Transfer data is portable and detached from a project; insertion/import remaps ids and merges it into authoritative project state. Runtime-owned transfer formats live in @webstudio-is/project-build/transfer.

Clipboard data is a UI transport concern. Builder copy/paste may serialize transfer data into a data envelope and place it on the browser clipboard, but runtime and protocol code should name the reusable format as data envelope or transfer data, not clipboard.