Add configuration editor UI and RPC endpoints - #195
Merged
Conversation
Clients can now read and edit the server's TOML config instead of the user hand-editing ~/.config/codereviewserver.toml. Server: - GetConfig returns the config re-read from disk, plus the workflow type and filter registries so clients build their pickers from what this server actually supports. - UpdateConfig applies a partial change: omitted fields (and keys the server doesn't model) are carried over, while sending Workflows replaces the list. It validates the config the update would produce before touching disk, writes atomically with a .bak of the previous file, and reloads the running config. A rejected config comes back as okay=false with per-field errors rather than an RPC error, so clients can attach each message to the input that caused it. Validation is split along package ownership: config.Validate covers root-level settings and the fields every workflow needs, while workflows.ValidateWorkflows owns the type and filter registries. Tests guard those registries against drifting from filter_func_map and the MatchWorkflows switch. Web client: - Preferences (the gear icon) now has Appearance and Server Configuration tabs. The latter edits the global settings and the workflow list, with collapsible workflow cards, reordering, dropdowns for workflow types and filters (including inputs for filters that take an argument), and fields shown per the selected type. - Client-side validation mirrors the server's rules and blocks a save while anything is wrong; anything it misses comes back from the server attached to the same field. List and filter-argument fields keep what the user typed and are only tidied at save time. Docs: configuration.md gains an "Editing the Config from a Client" section with the validation rules, protocol.md documents both methods and their payloads, and clients.md / building_clients.md cover the UI and what a new client should build against. config.go picks up gofmt formatting alongside the struct tag changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SkT2ZH9t9TRYxwYd4CbHTr
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.
Summary
Adds a web UI for editing the server's TOML configuration file, along with the necessary backend RPC endpoints (
GetConfigandUpdateConfig) to support it. Users can now modify workflows, repositories, and global settings through the web client instead of editing the config file directly.Changes
ConfigManager.tsx): New React component providing a full UI for editing the server config with real-time validation, workflow management (add/remove/reorder), and immediate feedback on validation errors.config_utils.ts): Pure helper functions for config validation, serialization, and transformation between the server's config format and the editor's draft format. Includes comprehensive unit tests.server.go): NewGetConfigandUpdateConfigRPC methods that read/write the TOML config file, validate changes, and return workflow type and filter registries so the UI can build dynamic pickers.config/file.go): NewUpdatetype andRender()method that merges partial updates into the existing config file while preserving unknown keys and formatting. Includes atomic write with.bakbackup.config/validate.go): Validates the entire config structure (repos format, sleep duration bounds, section sorting options, workflow requirements) and returns structured errors.workflows/validate.go): ExposesWorkflowTypes()andFilterTypes()registries so clients can offer only what the server actually supports. Validates workflow field requirements and filter syntax.server.ts(Bun backend) and updatedApp.tsxto include the config editor in the preferences UI.protocol.md,configuration.md,clients.md): Documented the new RPC endpoints and UI.Test Plan
go build ./...passesgo test ./...passes — includes new tests for config file I/O, validation, and RPC handlersbun run testpasses — includes comprehensive unit tests for config utilities and validation logichttps://claude.ai/code/session_01SkT2ZH9t9TRYxwYd4CbHTr