Skip to content

feat(studio): edit fleets.toml in-app — CodeMirror TOML editor (ADR #19 C) - #27

Closed
brettchien wants to merge 1 commit into
feat/fleet-config-panelfrom
feat/fleet-config-edit
Closed

feat(studio): edit fleets.toml in-app — CodeMirror TOML editor (ADR #19 C)#27
brettchien wants to merge 1 commit into
feat/fleet-config-panelfrom
feat/fleet-config-edit

Conversation

@brettchien

Copy link
Copy Markdown
Contributor

Drafted by Orca (ecs-claude) — flagging authorship (shared GitHub identity across the fleet).

Slice C of the config panel — the edit half — stacked on #26 (A+B view/switch); base retargets to main when #26 merges. Completes the loop: declare(edit) → switch → observe → reconcile.

The operator asked for a raw TOML editor (not a structured form), so this edits fleets.toml as text.

What:

  • studio-cpread_bindings_text / write_bindings_atomic (temp file + rename) / save_bindings_text: validate the text parses before writing (a bad edit never lands on disk) and store the bytes verbatim — comments/layout survive with no format-preserving library. Unit tests: round-trip + preserved-verbatim, reject-invalid-without-write, missing-file-is-empty.
  • oab-mcpfleet_config now also returns the raw text; new write tool fleet_config_write { text } validates + writes + hot-reloads (bindings moved behind an RwLock; the per-cluster resolved-config memo is cleared on write, since a changed profile/region invalidates it). Catalog is 10 tools.
  • src-taurifleet_config_write bridge command.
  • console — a CodeMirror 6 TOML editor (StreamLanguage + the legacy TOML mode — the standard CM6 route, no dedicated TOML lang pkg exists). Mounted imperatively in a section separate from the re-rendered panel, so switching fleets never wipes an open edit. "Edit config" opens it; Save calls the write tool and surfaces a parse error inline; Cancel discards. New deps: codemirror + @codemirror/{state,view,language,legacy-modes} (bundle grows to ~405 KB / 132 KB gzip — expected for an editor).

Effect: the config panel now views fleets, switches between them (#26), and edits the binding file in-app — the full "no panel for config" gap closed.

Verification:

  • console: tsc clean · vitest 22/22 · vite build OK (CM6 bundles).
  • studio-cp + oab-mcp: cargo check + cargo check --tests clean locally. Test execution + the src-tauri tauri build are left to CIci.yml build-test (ubuntu) runs the Rust workspace tests (my save_bindings_text + catalog tests), and desktop.yml bundle-macos runs on this PR (npm run build + tauri build, compiling the bridge). Full local Rust test-linking has previously exhausted this runtime's disk.

Known follow-up: the CM editor uses CodeMirror's default (light) theme; a dark-mode theme keyed to the app's prefers-color-scheme is a small follow-up, not in this slice.

Relates to #19, stacks on #26.

🤖 Generated with Claude Code

… C)

The edit half of the config panel: the operator edits the raw fleets.toml in a
CodeMirror TOML editor and saves; the change validates, persists, and hot-reloads
without a restart. Completes declare(edit) → switch → observe → reconcile.

- studio-cp: `read_bindings_text` / `write_bindings_atomic` (temp+rename) /
  `save_bindings_text` — validate the text parses BEFORE writing (a bad edit
  never lands on disk) and store bytes verbatim, so comments/layout survive with
  no format-preserving lib. Unit tests: round-trip, reject-invalid-without-write,
  missing-file-is-empty.
- oab-mcp: `fleet_config` now also returns the raw `text`; new write tool
  `fleet_config_write { text }` validates + writes + hot-reloads (bindings moved
  behind an RwLock; the per-cluster resolved-config memo is cleared on write).
  Catalog is 10 tools.
- src-tauri: `fleet_config_write` bridge command.
- console: CodeMirror 6 TOML editor (StreamLanguage + legacy TOML mode) mounted
  imperatively in a section separate from the re-rendered panel, so switching
  fleets never wipes an open edit. "Edit config" opens it; Save calls the write
  tool and surfaces a parse error inline; Cancel discards. 1 new render test.

Slice C of the config panel, stacked on the A+B view/switch slice. Editing is
raw-text (operator chose a TOML editor over a structured form).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant