summaryrefslogtreecommitdiff
path: root/internal/appconfig/feature_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/feature_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/feature_sections.go')
-rw-r--r--internal/appconfig/feature_sections.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/internal/appconfig/feature_sections.go b/internal/appconfig/feature_sections.go
new file mode 100644
index 0000000..9216400
--- /dev/null
+++ b/internal/appconfig/feature_sections.go
@@ -0,0 +1,50 @@
+package appconfig
+
+// This file defines the cohesive per-subsystem config structs that make up
+// FeatureConfig. The old FeatureConfig was a grab-bag that mixed five unrelated
+// non-LLM subsystems (ignore filtering, stats, tmux popup editor, tmux action
+// menu, MCP server). Splitting them into named structs documents the seams
+// between subsystems and lets consumers depend on a single subsystem's config
+// (via the *Section accessors on App) instead of the whole App God-struct.
+//
+// Each struct is embedded into FeatureConfig, so Go field promotion keeps the
+// historical flat access (e.g. cfg.MCPPromptsDir) working for read sites across
+// the codebase. Only composite literals that set these leaf fields directly on
+// FeatureConfig had to move to the nested form.
+
+// IgnoreConfig controls gitignore-aware file filtering for the LSP server.
+// Files matching these patterns are skipped for completions and code actions.
+type IgnoreConfig struct {
+ // IgnoreGitignore enables respecting .gitignore entries (default true).
+ IgnoreGitignore *bool `json:"-"`
+ // IgnoreExtraPatterns are additional glob patterns to always ignore.
+ IgnoreExtraPatterns []string `json:"-"`
+ // IgnoreLSPNotify controls whether the LSP notifies when ignoring a file.
+ IgnoreLSPNotify *bool `json:"-"`
+}
+
+// StatsConfig holds settings for the usage statistics subsystem.
+type StatsConfig struct {
+ // StatsWindowMinutes is the rolling window (in minutes) used for stats.
+ StatsWindowMinutes int `json:"-"`
+}
+
+// TmuxEditConfig configures the tmux popup editor feature (hexai-tmux-edit).
+type TmuxEditConfig struct {
+ TmuxEditPopupWidth string `json:"-"`
+ TmuxEditPopupHeight string `json:"-"`
+ TmuxEditDefaultAgent string `json:"-"`
+ TmuxEditAgents []TmuxEditAgentCfg `json:"-"`
+}
+
+// TmuxActionConfig configures the main menu for hexai-tmux-action.
+type TmuxActionConfig struct {
+ TmuxActionMenu []TmuxActionMenuEntry `json:"-"`
+}
+
+// MCPConfig holds Model Context Protocol server settings.
+type MCPConfig struct {
+ MCPPromptsDir string `json:"-"` // Directory for prompt storage
+ MCPSlashCommandSync bool `json:"-"` // Enable slash command sync
+ MCPSlashCommandDir string `json:"-"` // Directory for slash command files
+}