Skip to content

phi config: replace HTML editor with full-screen TUI - #250

Merged
libinops merged 4 commits into
mainfrom
meta-config
Sep 28, 2026
Merged

libinops merged 4 commits into
mainfrom
meta-config

Conversation

@yumosx

@yumosx yumosx commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Replace the loopback web server + embedded HTML page with a
keyboard-driven full-screen terminal editor (internal/tui/configui).
The form edits ~/.phi/config.yaml with inline text fields, choice
pickers (model list, thinking level, api, permission mode), tri-state
toggles, and expandable bash allow/deny rule lists. Nothing is written
to disk until the user presses s; the previous file is kept as
config.yaml.bak.

The editable schema moved to internal/project (project.ConfigDoc,
ReadConfigDoc, Save, Validate) so the editor and the runtime parser
share one definition. Pointer fields preserve the "key absent vs zero
value" distinction the loader relies on, and empty api_key/base_url
values are omitted from saved files.

The old cmd/config.html, the HTTP server, origin checks, and the
browser launch are gone. fetchModelIDs stays as a standalone function
that probes OpenAI/Anthropic /models endpoints with redirect-same-origin
protection and dual-envelope decoding.

README/README.zh-CN updated with TUI key bindings; stale screenshot
removed. CHANGELOG updated under Changed + Removed.
Labels keep a flat quiet tone (Muted, no Dim) so the left column
never reads as mud. Values are the only column that carries emphasis:
body text when set, the same quiet tone when absent, and semantic
color only for state (on, not set, default). A filled api_key now
reads as data instead of looking empty.

The selection stripe also stops punching holes: the trailing hint
and list bullets now carry the stripe background. An unset field
stays quiet under the cursor so it can never be mistaken for a
filled one.

Tests lock the grammar: label vs value vs absent tones, and the
stripe's background coverage.
displayPath returned the raw path tail after stripping home, so on
Windows the border label and the skills fallback rendered as
"~\.phi\config.yaml". Normalize both sides with filepath.ToSlash
before cutting the prefix (a no-op on Unix).
@libinops
libinops merged commit 8a888c8 into main Sep 28, 2026
9 checks passed
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.

2 participants