Skip to content

Add configuration editor UI and RPC endpoints - #195

Merged
C-Hipple merged 1 commit into
mainfrom
claude/workflow-config-management-u2v8dc
Jul 29, 2026
Merged

Add configuration editor UI and RPC endpoints#195
C-Hipple merged 1 commit into
mainfrom
claude/workflow-config-management-u2v8dc

Conversation

@C-Hipple

Copy link
Copy Markdown
Owner

Summary

Adds a web UI for editing the server's TOML configuration file, along with the necessary backend RPC endpoints (GetConfig and UpdateConfig) to support it. Users can now modify workflows, repositories, and global settings through the web client instead of editing the config file directly.

Changes

  • Frontend Configuration Editor (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.
  • Configuration Utilities (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.
  • Backend RPC Endpoints (server.go): New GetConfig and UpdateConfig RPC 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 Management (config/file.go): New Update type and Render() method that merges partial updates into the existing config file while preserving unknown keys and formatting. Includes atomic write with .bak backup.
  • Config Validation (config/validate.go): Validates the entire config structure (repos format, sleep duration bounds, section sorting options, workflow requirements) and returns structured errors.
  • Workflow Validation (workflows/validate.go): Exposes WorkflowTypes() and FilterTypes() registries so clients can offer only what the server actually supports. Validates workflow field requirements and filter syntax.
  • Integration: Wired up new RPC endpoints in server.ts (Bun backend) and updated App.tsx to include the config editor in the preferences UI.
  • Documentation (protocol.md, configuration.md, clients.md): Documented the new RPC endpoints and UI.

Test Plan

  • go build ./... passes
  • go test ./... passes — includes new tests for config file I/O, validation, and RPC handlers
  • bun run test passes — includes comprehensive unit tests for config utilities and validation logic
  • Existing tests verify that workflow type and filter registries stay in sync with the builders

https://claude.ai/code/session_01SkT2ZH9t9TRYxwYd4CbHTr

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
@C-Hipple
C-Hipple merged commit 559a247 into main Jul 29, 2026
7 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