@myanalyticsschool/connect-ide
v0.1.0
Published
Run a VS Code IDE on your own machine and mirror it into a MAS Class lesson
Maintainers
Readme
@myanalyticsschool/connect-ide
Open a VS Code IDE on your own machine, mirrored into a MAS Class lesson tab.
This is the IDE companion to @myanalyticsschool/connect. The terminal CLI mirrors a single shell; this one mirrors a full IDE (file tree, editor, integrated terminal, extensions) by running code-server locally and exposing it through a Cloudflare Quick Tunnel.
Install
You don't install this package directly — your lesson page tells you to run it via npx:
npx -y @myanalyticsschool/connect-ide <session-token> --relay <wss-url>You do need two tools on your PATH:
# macOS
brew install code-server cloudflared
# Linux
curl -fsSL https://code-server.dev/install.sh | sh
# (cloudflared via your distro: https://pkg.cloudflare.com/)
# Windows
winget install --id Cloudflare.cloudflared
# code-server: https://github.com/coder/code-server/releasesWhat it does
- Spawns
code-server --auth noneon a random127.0.0.1port, with your chosen workspace folder. - Spawns
cloudflared tunnel --url http://127.0.0.1:<port>, captures the generatedhttps://<hash>.trycloudflare.comURL. - Opens a WebSocket to the MAS relay (
/api/terminal/relay) using the lesson session token. - When the lesson tab connects, sends
{type:"ide-ready", url}to it. The tab iframes the tunnel URL. - Holds the session until you press
Ctrl-Cor close the lesson tab.
On exit, both child processes are stopped and the temp user-data dir is removed.
Options
--workspace <dir> Folder to open in VS Code (default: current dir)
--relay <wss-url> Override the relay endpoint (env: MAS_CONNECT_RELAY_URL)
--port <n> Force the local code-server port (default: random)
--no-confirm Skip the safety prompt (NOT recommended)
--keep-data-dir Keep the temp VS Code user-data dir on exit (debug)
-h, --help Show help
-v, --version Show versionTrust model
code-server runs with --auth none because there is no documented way to pre-authenticate a code-server iframe across origins. The trycloudflare URL itself is the secret:
- It is
<~25 random chars>.trycloudflare.com. - It is only sent to your lesson tab over our authenticated WSS relay.
- It is never logged or persisted server-side.
- It expires when this CLI exits.
The lesson tab will be able to read, edit, and execute any file inside the workspace folder you chose — including via the integrated terminal. Pick a workspace folder that does not contain secrets you don't want to expose to the lesson.
Compared to @myanalyticsschool/connect
| | connect | connect-ide |
|---|---|---|
| What's mirrored | One shell (PTY bytes) | Full VS Code (HTTPS iframe) |
| Local tool needed | Just Node | code-server + cloudflared |
| Bytes in iframe path | Browser ↔ relay ↔ CLI | Browser ↔ Cloudflare ↔ local |
| Off-by | exit in shell | Ctrl-C in this CLI |
Both use the same relay endpoint and the same session token — your lesson scene picks which mode to use.
