summaryrefslogtreecommitdiff
path: root/internal/appconfig/app_sections.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-11 08:49:20 +0300
committerPaul Buetow <paul@buetow.org>2026-06-11 08:49:20 +0300
commita5bd7dd1eb63a2be332ecda50fbeccfe5d5de0a8 (patch)
treede9986add3f31b6af8b00c1cf99c5237416d8ed1 /internal/appconfig/app_sections.go
parent133ef49de26ae251c2c86417f9c673ebc7166f76 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'internal/appconfig/app_sections.go')
-rw-r--r--internal/appconfig/app_sections.go30
1 files changed, 11 insertions, 19 deletions
diff --git a/internal/appconfig/app_sections.go b/internal/appconfig/app_sections.go
index 05b3171..5919db1 100644
--- a/internal/appconfig/app_sections.go
+++ b/internal/appconfig/app_sections.go
@@ -102,26 +102,18 @@ type PromptConfig struct {
TmuxCustomMenuHotkey string `json:"-"`
}
-// FeatureConfig contains non-LLM feature toggles/integration settings.
-// It is embedded in App; fields use json:"-" since features are not exposed via JSON.
+// FeatureConfig groups the non-LLM feature subsystems. Rather than a flat
+// grab-bag, it now embeds one cohesive struct per subsystem (see
+// feature_sections.go). Embedding keeps field promotion intact so existing flat
+// access (e.g. cfg.MCPPromptsDir) and the JSON shape are unchanged; the split
+// just makes the subsystem boundaries explicit and lets callers depend on a
+// single subsystem via the App.*Section accessors.
type FeatureConfig struct {
- // Stats
- StatsWindowMinutes int `json:"-"`
- // Ignore: gitignore-aware file filtering for LSP
- IgnoreGitignore *bool `json:"-"`
- IgnoreExtraPatterns []string `json:"-"`
- IgnoreLSPNotify *bool `json:"-"`
- // TmuxEdit: popup editor settings for hexai-tmux-edit
- TmuxEditPopupWidth string `json:"-"`
- TmuxEditPopupHeight string `json:"-"`
- TmuxEditDefaultAgent string `json:"-"`
- TmuxEditAgents []TmuxEditAgentCfg `json:"-"`
- // TmuxAction: configurable main menu for hexai-tmux-action
- TmuxActionMenu []TmuxActionMenuEntry `json:"-"`
- // MCP: Model Context Protocol server settings
- MCPPromptsDir string `json:"-"` // Directory for prompt storage
- MCPSlashCommandSync bool `json:"-"` // Enable slash command sync
- MCPSlashCommandDir string `json:"-"` // Directory for slash command files
+ StatsConfig // usage statistics window
+ IgnoreConfig // gitignore-aware file filtering for LSP
+ TmuxEditConfig // popup editor settings for hexai-tmux-edit
+ TmuxActionConfig // configurable main menu for hexai-tmux-action
+ MCPConfig // Model Context Protocol server settings
}
// AppSections is the focused split of App into subsystem-specific config groups.