summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-17 18:52:51 +0300
committerPaul Buetow <paul@buetow.org>2025-08-17 18:52:51 +0300
commit454451105ad3522d2ac3d22136eedee4a4d034af (patch)
treeaa4b5723809c4d45bfc9094a38c01c6415582f9c /README.md
parent498923e77c201ca90dc35c7934f4f7f1c9c3ccd2 (diff)
cli+lsp: refactor main packages into internal runners; add tests
- Move CLI logic to internal/hexaicli with Run/RunWithClient - Move LSP logic to internal/hexailsp with Run/RunWithFactory - Extract helpers; keep behavior identical for both binaries - Add unit tests for hexaicli (input parsing, messages, streaming) and hexailsp (factory wiring, client creation, logging settings) - Add top-of-file summaries and 'Not yet reviewed by a human' comments to all Go files - Update README with internal package docs
Diffstat (limited to 'README.md')
-rw-r--r--README.md18
1 files changed, 17 insertions, 1 deletions
diff --git a/README.md b/README.md
index b17983d..dc79489 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
Hexai, the AI LSP for the Helix editor and also a simple command line tool to interact with LLMs in general.
-At the moment this project is only in the proof of PoC phase.
+At the moment this project is in the alpha state.
## LLM provider
@@ -74,6 +74,22 @@ Notes for `hexai` (CLI):
- Add the word `explain` in your prompt to request a verbose explanation.
- Exit codes: `0` success, `1` provider/config error, `2` no input.
+### Internal CLI package
+
+- Package `internal/hexaicli` contains the CLI logic extracted from `cmd/hexai`.
+- Entry points:
+- `Run(ctx, args, stdin, stdout, stderr)`: Full CLI flow; parses input and builds the LLM client from config/env.
+- `RunWithClient(ctx, args, stdin, stdout, stderr, client)`: Same flow using a provided `llm.Client` (useful for tests and embedding).
+- Behavior is identical to the `hexai` binary: provider/model banner on stderr, streamed output when available, and a final summary line.
+
+### Internal LSP package
+
+- Package `internal/hexailsp` contains the LSP binary logic extracted from `cmd/hexai-lsp`.
+- Entry points:
+- `Run(logPath, stdin, stdout, stderr)`: Configures logging, loads config, builds the LLM client, and runs the LSP server over stdio.
+- `RunWithFactory(logPath, stdin, stdout, logger, cfg, client, factory)`: Testable entry that accepts a prebuilt `llm.Client` and a factory for `lsp.Server` creation.
+- Mirrors the behavior of the `hexai-lsp` binary while enabling unit tests without invoking the full server loop.
+
Examples:
```