Skip to content

feat(config): editable ~/.config/termio/config file - #5

Open
jiweiyuan wants to merge 1 commit into
mainfrom
feat/config-file
Open

feat(config): editable ~/.config/termio/config file#5
jiweiyuan wants to merge 1 commit into
mainfrom
feat/config-file

Conversation

@jiweiyuan

Copy link
Copy Markdown
Collaborator

What

Adds a canonical, editable ~/.config/termio/config file (Ghostty-style key = value). The Settings GUI now edits the common subset and writes back into the file; the file exposes the full scalar set for hand-editing, and termio watches it so an external edit applies live — no relaunch.

GUI and file are the same source of truth: the GUI is a curated window onto a superset the file exposes in full. UserDefaults is demoted to a cache + one-time migration source — existing prefs seed the file on first run, so nothing is lost.

Changes

  • Config/ConfigFile.swift (new) — XDG path, parser, and a surgical rewriter that updates changed keys in place while preserving comments, layout, and keys termio doesn't manage. Plus ConfigFileWatcher: a directory-level vnode watch (survives editors' atomic saves), debounced, hopping back to the main actor.
  • Settings.swiftAppSettings adopts the file on launch (hand edits win over the UserDefaults cache), seeds a self-documenting file on first run, and mirrors GUI edits back (debounced). An isApplyingConfig guard + a last-written content check prevent a write→watch→rewrite loop.
  • AppearanceSettingsTab.swift — an "Open Config File…" button + a Config File section.
  • scripts/termiotermio config path and termio config edit subcommands.

Scope

Scalar appearance / terminal / interface options plus the two agent toggles (18 keys). Per-agent command overrides deferred to a follow-up (repeated-key round-tripping); app-state/consent (recent projects, usage/keychain) excluded — not user config.

Verification

  • swift build clean
  • ✅ Parse/rewrite round-trip unit-tested: comments preserved, unmanaged key survived, in-place update, theme light/dark pair encoded + re-parsed
  • ✅ CLI config path resolves correctly (dev-channel aware), shell syntax OK
  • ⚠️ Not yet exercised in the live app — file-watch live-reload and GUI write-back are reasoned through and tested at the text layer, but an end-to-end run in the dev app is still pending

Make a Ghostty-style key=value config file the canonical settings store.
The Settings window edits the common subset and writes back into the file;
the file exposes the full scalar set for hand-editing, and termio watches
it so an external edit applies live — no relaunch.

- ConfigFile: XDG path, parser, and a surgical rewriter that updates keys
  in place while preserving comments, layout, and unmanaged keys
- ConfigFileWatcher: directory-level vnode watch (survives atomic saves),
  debounced, hopping back to the main actor
- AppSettings: adopt the file on launch (hand edits win over the
  UserDefaults cache), seed a self-documenting file on first run from
  existing prefs, and mirror GUI edits back debounced; an applying-guard
  plus a last-written content check prevent a write/watch/rewrite loop
- Appearance settings: an "Open Config File…" button
- termio CLI: `config path` and `config edit` subcommands

Scope: scalar appearance/terminal/interface options plus the two agent
toggles. Per-agent command overrides and app-state/consent are excluded.
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
landing Ready Ready Preview, Comment Jul 17, 2026 12:03am

Request Review

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