Inspector: CLI integration in Playground#18271
Inspector: CLI integration in Playground#18271ryantrem wants to merge 13 commits intoBabylonJS:masterfrom
Conversation
Updatable name Include snippet id in document.title
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18271/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18271/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18271/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18271/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18271/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
There was a problem hiding this comment.
Pull request overview
Integrates Inspector v2 CLI support into the Babylon.js Playground by auto-starting the inspectable bridge, adding Playground-specific CLI commands, and enhancing the CLI/bridge protocol to support dynamic session naming and file-backed command arguments.
Changes:
- Add a Playground CLI command service (file ops, run, save, diagnostics) and start Inspectable automatically when Inspector v2 is present.
- Extend Inspector CLI/bridge protocol to support
getInfo(dynamic session names) andfile-typed command arguments (CLI reads file contents). - Improve Playground state synchronization (Monaco ↔ GlobalState, snippet title in
document.title, and programmatic save options).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/tools/playground/src/tools/saveManager.ts | Adds save options payload support to bypass the metadata dialog. |
| packages/tools/playground/src/tools/playgroundCommandService.ts | New Playground-specific CLI commands registered into Inspector CLI registry. |
| packages/tools/playground/src/tools/monaco/monacoManager.ts | Sync Monaco models with globalState.files and expose diagnostics via markers. |
| packages/tools/playground/src/playground.tsx | Syncs document.title with the URL hash (snippet id/revision). |
| packages/tools/playground/src/globalState.ts | Adds ISaveOptions, IDiagnosticInfo, and updates observable typings. |
| packages/tools/playground/src/components/rendererComponent.tsx | Auto-starts Inspectable bridge (CLI) and registers Playground command service. |
| packages/tools/playground/src/components/editor/monacoComponent.tsx | Ensures editor switches Monaco model when the active file changes. |
| packages/dev/inspector-v2/test/unit/cli/bridge.test.ts | Updates bridge tests for getInfo and dynamic name behavior. |
| packages/dev/inspector-v2/src/services/cli/inspectableCommandRegistry.ts | Adds arg type to support file-backed arguments. |
| packages/dev/inspector-v2/src/services/cli/inspectableBridgeService.ts | Implements getInfo handling in the browser-side bridge service. |
| packages/dev/inspector-v2/src/inspectable.ts | Improves InspectableToken.isDisposed to reflect underlying container disposal. |
| packages/dev/inspector-v2/src/cli/protocol.ts | Adds GetInfoRequest/InfoResponse and arg type to protocol types. |
| packages/dev/inspector-v2/src/cli/cli.ts | Implements file arg resolution by reading content from disk before exec. |
| packages/dev/inspector-v2/src/cli/bridge.ts | Queries sessions via getInfo to return up-to-date session names. |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18271/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18271/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
Draft for now and probably will wait to talk with @RaananW about some Playground mcp experiments he was doing.
The main goal of this PR is to integrate the Inspector CLI into Playground and add Playground specific commands. Some pre-requisite changes were needed for this:
isDisposedreturns true if the underlying container is disposed (e.g. because the scene was disposed).document.title(which is a small but nice improvement regardless, since it makes it easier to distinguish between Playground tabs in the browser). (document.titleis the default session name for the Inspector CLI).globalState, and a bit more detail is exposed throughglobalState.globalStateto save the current PG to a snippet without opening a dialog (e.g. name, description, and tags can be programmatically passed).With these improvements in place, the actual changes for Inspector CLI integration in Playground are:
StartInspectableautomatically (does not require opening Inspector).