summaryrefslogtreecommitdiff
path: root/internal/appconfig/config.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-08 16:31:40 +0200
committerPaul Buetow <paul@buetow.org>2026-02-08 16:31:40 +0200
commitc802ba5803de1a53749bb5c4ecbc0159fceb385f (patch)
tree02e612286f36bc6c65563bc33cf53639817d2db1 /internal/appconfig/config.go
parent887d7bc186db90c3903851b0f1db2d24df5d7a7b (diff)
refactor tmuxedit to Agent interface with cursor/claude/config implementations
Replace monolithic AgentConfig struct with an Agent interface backed by baseAgent defaults and separate implementations for cursor (box-drawing extraction, bulk backspace clearing) and claude (section-scoped extraction with continuation lines, vim clearing). Simple agents (amp, aider) and user-defined agents use configAgent with baseAgent defaults. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/appconfig/config.go')
-rw-r--r--internal/appconfig/config.go57
1 files changed, 30 insertions, 27 deletions
diff --git a/internal/appconfig/config.go b/internal/appconfig/config.go
index b21a4de..63b5ea5 100644
--- a/internal/appconfig/config.go
+++ b/internal/appconfig/config.go
@@ -141,15 +141,16 @@ type CustomAction struct {
// TmuxEditAgentCfg describes an AI agent's detection and interaction patterns
// for the tmux popup editor (hexai-tmux-edit).
type TmuxEditAgentCfg struct {
- Name string
- DisplayName string
- DetectPattern string
- PromptPattern string
- StripPatterns []string
- ClearFirst *bool
- ClearKeys string
- NewlineKeys string
- SubmitKeys string
+ Name string
+ DisplayName string
+ DetectPattern string
+ SectionPattern string
+ PromptPattern string
+ StripPatterns []string
+ ClearFirst *bool
+ ClearKeys string
+ NewlineKeys string
+ SubmitKeys string
}
// Constructor: defaults for App (kept first among functions)
@@ -364,15 +365,16 @@ type sectionTmuxEdit struct {
// sectionTmuxEditAgent defines detection and interaction patterns for one AI agent.
type sectionTmuxEditAgent struct {
- Name string `toml:"name"`
- DisplayName string `toml:"display_name"`
- DetectPattern string `toml:"detect_pattern"`
- PromptPattern string `toml:"prompt_pattern"`
- StripPatterns []string `toml:"strip_patterns"`
- ClearFirst *bool `toml:"clear_first"`
- ClearKeys string `toml:"clear_keys"`
- NewlineKeys string `toml:"newline_keys"`
- SubmitKeys string `toml:"submit_keys"`
+ Name string `toml:"name"`
+ DisplayName string `toml:"display_name"`
+ DetectPattern string `toml:"detect_pattern"`
+ SectionPattern string `toml:"section_pattern"`
+ PromptPattern string `toml:"prompt_pattern"`
+ StripPatterns []string `toml:"strip_patterns"`
+ ClearFirst *bool `toml:"clear_first"`
+ ClearKeys string `toml:"clear_keys"`
+ NewlineKeys string `toml:"newline_keys"`
+ SubmitKeys string `toml:"submit_keys"`
}
type sectionOpenAI struct {
@@ -724,15 +726,16 @@ func (fc *fileConfig) applyTmuxEdit(out *App) {
continue
}
out.TmuxEditAgents = append(out.TmuxEditAgents, TmuxEditAgentCfg{
- Name: strings.TrimSpace(a.Name),
- DisplayName: strings.TrimSpace(a.DisplayName),
- DetectPattern: strings.TrimSpace(a.DetectPattern),
- PromptPattern: strings.TrimSpace(a.PromptPattern),
- StripPatterns: a.StripPatterns,
- ClearFirst: a.ClearFirst,
- ClearKeys: strings.TrimSpace(a.ClearKeys),
- NewlineKeys: strings.TrimSpace(a.NewlineKeys),
- SubmitKeys: strings.TrimSpace(a.SubmitKeys),
+ Name: strings.TrimSpace(a.Name),
+ DisplayName: strings.TrimSpace(a.DisplayName),
+ DetectPattern: strings.TrimSpace(a.DetectPattern),
+ SectionPattern: strings.TrimSpace(a.SectionPattern),
+ PromptPattern: strings.TrimSpace(a.PromptPattern),
+ StripPatterns: a.StripPatterns,
+ ClearFirst: a.ClearFirst,
+ ClearKeys: strings.TrimSpace(a.ClearKeys),
+ NewlineKeys: strings.TrimSpace(a.NewlineKeys),
+ SubmitKeys: strings.TrimSpace(a.SubmitKeys),
})
}
}