Add Inline VS Code serve-web settings (port, data dir, persistence, extra args)

Closed
AU
2mo ago
+3279-10

Fixes #6645

What

Exposes the Inline VS Code serve-web launch details that were previously hard-coded in the launcher path, both in cmux.json and the Settings UI. Adds an inlineVSCode config block:

SettingPurpose
persistServeWebStateKeep serve-web state (sign-in, Settings Sync) across launches. Default true; false uses a throwaway data dir so nothing persists.
portPin the local serve-web port. Default 0 = random free port.
serverDataDirChoose the serve-web --server-data-dir. Empty = VS Code default; leading ~ expands.
extraArgsAdvanced upstream serve-web flags, appended verbatim.
{
  "inlineVSCode": {
    "persistServeWebState": true,
    "port": 8123,
    "serverDataDir": "~/Library/Application Support/cmux/vscode-serve-web",
    "extraArgs": []
  }
}

Precedence

cmux.json (also written by the Settings UI) > environment variable (CMUX_INLINE_VSCODE_PORT / _SERVER_DATA_DIR / _PERSIST_STATE / _EXTRA_ARGS) > internal defaults.

Defaults preserve the historical behavior (random port, VS Code default data location, persistent state) — this change is purely additive.

Design notes

  • One launch path. The macOS launcher (VSCodeServeWebController) reads the live global cmux.json on each (re)start via a single shared path, so there is no second way to start VS Code. "Restart Inline VS Code" applies changes immediately.
  • Security unchanged. serve-web is always bound to 127.0.0.1 with a connection-token file; extraArgs are appended after the cmux-managed flags and documented as advanced/unsupported.
  • The arg builder, config/env/default resolver, and presence-aware cmux.json reader are pure and unit-tested (cmuxTests/InlineVSCodeServeWebOptionsTests.swift).

Surfaces touched

  • Launcher: Sources/App/InlineVSCodeServeWebOptions.swift (new) + TerminalDirectoryOpenSupport.swift (net-neutral wiring).
  • Settings: new InlineVSCodeCatalogSection (CmuxSettings) + InlineVSCodeSection UI (CmuxSettingsUI), section nav, curated search entries.
  • Docs/schema: cmux.schema.json, configuration docs page, web/messages/en.json + ja.json.
  • Localization: all new Swift strings added to Resources/Localizable.xcstrings (en + ja).

Localization audit

All new user-facing Swift strings use String(localized:) with matching en + ja entries in Localizable.xcstrings. Schema descriptions carry descriptionKeys with en + ja in the web message catalogs; the other 18 locales deep-merge-fall-back to en (existing i18n/request.ts behavior, matching markdown/canvas/workspaceGroups).

🤖 Generated with Claude Code


Summary by cubic

Adds configurable Inline VS Code serve-web options (port, server data dir, persistence, extra args) in cmux.json and the Settings UI. Fixes #6645 while keeping loopback + token invariants and cleaning up per‑launch temp dirs when non‑persistent.

  • New Features

    • New inlineVSCode config: persistServeWebState, port (0 = random), serverDataDir (supports ~), extraArgs.
    • Precedence: cmux.json > env (CMUX_INLINE_VSCODE_*) > defaults; read at each start; use “Restart Inline VS Code” to apply now.
    • UI: Settings > Inline VS Code; fields commit on blur or Return; section nav and curated search entries; fully localized.
    • Security: always binds 127.0.0.1 with a connection token; strips cmux-owned flags from extraArgs to prevent overrides.
  • Bug Fixes

    • inlineVSCode.port in cmux.json rejects fractional numbers instead of truncating (e.g., 1.9 ignored; 8123.0 accepted).

Summary by CodeRabbit

  • New Features

    • Added a new Inline VS Code settings section with options for session persistence, port selection, server data directory, and extra launch arguments.
    • Inline VS Code settings now appear in the app’s settings sidebar, search, and configuration examples.
    • Updated the VS Code launch flow to respect these settings, including support for persistent or per-launch data storage.
  • Bug Fixes

    • Improved handling of custom launch arguments so managed connection and host settings stay protected.