From a5bd7dd1eb63a2be332ecda50fbeccfe5d5de0a8 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 11 Jun 2026 08:49:20 +0300 Subject: appconfig: split FeatureConfig into cohesive per-subsystem structs The FeatureConfig section was a grab-bag mixing five unrelated non-LLM subsystems (ignore filtering, stats, tmux popup editor, tmux action menu, MCP server). Decompose it into named per-subsystem structs (IgnoreConfig, StatsConfig, TmuxEditConfig, TmuxActionConfig, MCPConfig) embedded into FeatureConfig so the subsystem boundaries are explicit. Embedding keeps Go field promotion intact, so existing flat read access (e.g. cfg.MCPPromptsDir) and the JSON/TOML on-disk shape are unchanged; only composite literals that set these leaf fields directly were updated to the nested form. Add fine-grained, defensive-copy section accessors on App (IgnoreSection, StatsSection, TmuxEditSection, TmuxActionSection, MCPSection) so consumers can depend on a single subsystem's config instead of the whole App God-struct. Decouple slashcommands.NewSyncer to accept appconfig.MCPConfig rather than appconfig.App. All tests pass with -race; appconfig coverage 91.5%, total 86.2%. Co-Authored-By: Claude Opus 4.8 --- internal/appconfig/app_sections_test.go | 50 ++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'internal/appconfig/app_sections_test.go') diff --git a/internal/appconfig/app_sections_test.go b/internal/appconfig/app_sections_test.go index e26d3f3..bcd1cbe 100644 --- a/internal/appconfig/app_sections_test.go +++ b/internal/appconfig/app_sections_test.go @@ -169,28 +169,34 @@ func testPromptConfig() PromptConfig { func testFeatureConfig() FeatureConfig { return FeatureConfig{ - StatsWindowMinutes: 15, - IgnoreGitignore: sectionBoolPtr(true), - IgnoreExtraPatterns: []string{"vendor/**", "tmp/**"}, - IgnoreLSPNotify: sectionBoolPtr(false), - TmuxEditPopupWidth: "80%", - TmuxEditPopupHeight: "75%", - TmuxEditDefaultAgent: "codex", - TmuxEditAgents: []TmuxEditAgentCfg{{ - Name: "codex", - DisplayName: "Codex", - DetectPattern: "(?i)codex", - SectionPattern: "section", - PromptPattern: "prompt", - StripPatterns: []string{"x", "y"}, - ClearFirst: sectionBoolPtr(true), - ClearKeys: "C-u", - NewlineKeys: "S-Enter", - SubmitKeys: "Enter", - }}, - MCPPromptsDir: ".hexai/prompts", - MCPSlashCommandSync: true, - MCPSlashCommandDir: ".hexai/slash", + StatsConfig: StatsConfig{StatsWindowMinutes: 15}, + IgnoreConfig: IgnoreConfig{ + IgnoreGitignore: sectionBoolPtr(true), + IgnoreExtraPatterns: []string{"vendor/**", "tmp/**"}, + IgnoreLSPNotify: sectionBoolPtr(false), + }, + TmuxEditConfig: TmuxEditConfig{ + TmuxEditPopupWidth: "80%", + TmuxEditPopupHeight: "75%", + TmuxEditDefaultAgent: "codex", + TmuxEditAgents: []TmuxEditAgentCfg{{ + Name: "codex", + DisplayName: "Codex", + DetectPattern: "(?i)codex", + SectionPattern: "section", + PromptPattern: "prompt", + StripPatterns: []string{"x", "y"}, + ClearFirst: sectionBoolPtr(true), + ClearKeys: "C-u", + NewlineKeys: "S-Enter", + SubmitKeys: "Enter", + }}, + }, + MCPConfig: MCPConfig{ + MCPPromptsDir: ".hexai/prompts", + MCPSlashCommandSync: true, + MCPSlashCommandDir: ".hexai/slash", + }, } } -- cgit v1.2.3