phi config: replace HTML editor with full-screen TUI - #250
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.