diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-06 13:18:21 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-06 13:18:21 +0300 |
| commit | 5e966f50111adf6e2cb2683fe588f6fe033fa931 (patch) | |
| tree | 19ac2033483c2ac6147e8f44ac37f14e6a5c0cf7 /README.md | |
| parent | 80e61812986573464cd24c4b3ffa605c4003146a (diff) | |
fix unit test coverage
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 58 |
1 files changed, 57 insertions, 1 deletions
@@ -11,6 +11,7 @@ It has got improved capabilities for Go code understanding (for example, create * LSP Code actions * LSP in-editor chat with the LLM * Stand-alone command line tool for LLM interaction +* TUI code-action runner (`hexai-action`) with Bubble Tea * Support for OpenAI, GitHub Copilot, and Ollama ## Documentation @@ -24,7 +25,7 @@ It has got improved capabilities for Go code understanding (for example, create Hexai uses Mage for developer tasks. Install Mage, then run targets like build, dev, test, and install. - Install Mage: `go install github.com/magefile/mage@latest` -- Build binaries: `mage build` (produces `hexai` and `hexai-lsp`) +- Build binaries: `mage build` (produces `hexai`, `hexai-lsp`, and `hexai-action`) - Dev build (+ tests, vet, lint): `mage dev` - Run tests: `mage test` - Run tests with coverage: `go test ./... -cover` @@ -40,3 +41,58 @@ Either use the Mage method as mentioned above, or install directly with: - CLI: `go install codeberg.org/snonux/hexai/cmd/hexai@latest` - LSP: `go install codeberg.org/snonux/hexai/cmd/hexai-lsp@latest` + +For `hexai-action`, use Mage or a local build: + +- Build locally: `go build -o hexai-action cmd/internal/hexai-action/main.go` +- Or via Mage: `mage buildHexaiAction` (or `mage build`) +- Install: `mage install` (copies `hexai-action` to `GOPATH/bin` together with other binaries) + +## Hexai Action (TUI) + +`hexai-action` is a small TUI to run Hexai code actions from stdin. It loads the same `config.toml` as `hexai` and `hexai-lsp` (XDG path: `~/.config/hexai/config.toml`), and respects the same environment overrides. + +- Pipe code (and optionally diagnostics) into the tool. +- Select an action with arrow keys, vi keys (`j/k`, `g/G`), Enter, or hotkeys `[s] [r] [d] [c] [t]`. +- The tool prints the transformed text to stdout. + +Input formats + +- Rewrite: include an inline instruction near the top of the selection using one of: + - `;do something;` + - `/* do something */` + - `<!-- do something -->` + - `// do something` (or `#`, `--`) + +- Diagnostics (optional block): + - Begin with a header line `Diagnostics:` (case-insensitive), one diagnostic per line, blank line, then the code selection. + +Examples + +- Rewrite selection: + +``` +;replace fmt.Println with log.Println; +package main + +import "fmt" + +func main() { fmt.Println("hi") } +``` + +- Diagnostics + selection: + +``` +Diagnostics: +missing return at end of function +use of undefined: foo + +func f() int { + foo() +} +``` + +Run: + +- `cat input.go | ./hexai-action` +- or `./hexai-action < input.go` |
