From f4470bbcfbe3b14c99baeef475fe872825a13a39 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 14 Sep 2025 23:40:26 +0300 Subject: release: v0.10.0 --- PLAN.md | 34 + config.toml.example | 21 + docs/coverage.html | 2904 +- docs/coverage.out | 31890 +++++++++++--------- docs/custom-code-actions.md | 136 + internal/appconfig/config.go | 148 +- internal/appconfig/config_test.go | 128 + internal/appconfig/custom_validation_more_test.go | 48 + internal/hexaiaction/custom_exec_more_test.go | 48 + internal/hexaiaction/custom_exec_test.go | 29 + internal/hexaiaction/prompts.go | 15 + internal/hexaiaction/run.go | 20 +- internal/hexaiaction/tui_custom.go | 76 + internal/hexaiaction/tui_custom_test.go | 77 + internal/hexailsp/run.go | 23 + internal/lsp/codeaction_custom_errors_test.go | 92 + internal/lsp/codeaction_custom_test.go | 110 + internal/lsp/handlers_codeaction.go | 108 +- internal/lsp/server.go | 21 + internal/version.go | 2 +- 20 files changed, 20076 insertions(+), 15854 deletions(-) create mode 100644 PLAN.md create mode 100644 docs/custom-code-actions.md create mode 100644 internal/appconfig/custom_validation_more_test.go create mode 100644 internal/hexaiaction/custom_exec_more_test.go create mode 100644 internal/hexaiaction/custom_exec_test.go create mode 100644 internal/hexaiaction/tui_custom.go create mode 100644 internal/hexaiaction/tui_custom_test.go create mode 100644 internal/lsp/codeaction_custom_errors_test.go create mode 100644 internal/lsp/codeaction_custom_test.go diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..fc9e4dd --- /dev/null +++ b/PLAN.md @@ -0,0 +1,34 @@ +Hexai: Custom Code Actions — Implementation Plan + +Status legend: [ ] pending, [x] done, [~] in progress + +1) Baseline + Design setup + - [x] Add design doc and sample config updates + - [x] Establish baseline test/coverage command + +2) App config: model + parsing + validation + - [x] Add App fields, TOML parsing for [[prompts.code_action.custom]] and [tmux] + - [x] Implement App.Validate() and wire into LSP + tmux startup + - [x] Unit tests: parsing, validation, duplicate detection, hotkey conflicts + +3) LSP: list/resolve custom actions + - [x] Extend ServerOptions + Server to carry custom actions + - [x] List custom actions (scope-aware) in codeAction + - [x] Resolve custom actions (instruction or system+user) + - [x] Unit tests: list includes, resolve edits for selection/diagnostics + +4) Tmux action: submenu + execution + - [x] Add configurable “Custom actions…” menu item with [tmux].custom_menu_hotkey + - [x] Implement submenu to pick a custom action (with per-item hotkeys) + - [x] Implement runCustom() execution path + - [x] Unit tests: runCustom path + - [x] Unit tests: submenu hotkeys and selection via seam + +5) Polish + - [x] Update docs and finalize examples + - [x] All unit tests pass + - [ ] gofumpt formatting on modified Go files + - [ ] (Optional) Raise coverage further with additional tests + +Notes: +- After each numbered section is completed, run tests and verify coverage >= 85% before moving to the next. diff --git a/config.toml.example b/config.toml.example index d9ed8ee..c237d5b 100644 --- a/config.toml.example +++ b/config.toml.example @@ -76,6 +76,27 @@ temperature = 0.2 # simplify_system = "You are a precise code improvement engine. Simplify and improve the given code while preserving behavior. Return only the improved code with no prose or backticks." # simplify_user = "Improve this code:\n{{selection}}" +# Define additional custom code actions (optional) +# [[prompts.code_action.custom]] +# id = "extract-function" # required, unique slug (case-insensitive) +# title = "Extract function" # required, appears in LSP and tmux +# kind = "refactor.extract" # optional (default: "refactor") +# scope = "selection" # optional: selection | diagnostics (default: selection) +# hotkey = "e" # optional, single character for tmux submenu +# instruction = "Extract selected code into a new function named 'extracted' and replace with a call. Return only code, no backticks." + +# [[prompts.code_action.custom]] +# id = "fix-lints" +# title = "Fix linters" +# kind = "quickfix" +# scope = "diagnostics" +# hotkey = "l" +# system = "You are a precise code fixer. Only change selected code." +# user = "Diagnostics to resolve (selection only):\n{{diagnostics}}\n\nSelected code:\n{{selection}}" + [prompts.cli] # default_system = "You are Hexai CLI. Default to very short, concise answers. If the user asks for commands, output only the commands (one per line) with no commentary or explanation. Only when the word 'explain' appears in the prompt, produce a verbose explanation." # explain_system = "You are Hexai CLI. The user requested an explanation. Provide a clear, verbose explanation with reasoning and details. If commands are needed, include them with brief context." + +[tmux] +# custom_menu_hotkey = "a" # hotkey to open the custom actions submenu in hexai-tmux-action diff --git a/docs/coverage.html b/docs/coverage.html index 059834b..2d72d59 100644 --- a/docs/coverage.html +++ b/docs/coverage.html @@ -61,7 +61,7 @@ - + @@ -69,63 +69,67 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + @@ -178,33 +182,32 @@ func main() {