diff options
| author | Paul Buetow <paul@buetow.org> | 2025-08-31 23:50:32 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-08-31 23:50:32 +0300 |
| commit | 69fb353b042ebc0e288bc60ccc1c4f7403994d13 (patch) | |
| tree | 7cb7fdbf38a642677417d3e5cbe45c1cd031951b | |
| parent | 64a846c2b2abc244106cbf24b0a309a1e57308fe (diff) | |
update the status
| -rw-r--r-- | PROJECTSTATUS.md | 25 | ||||
| -rw-r--r-- | docs/source-structure.md | 127 | ||||
| -rw-r--r-- | internal/lsp/handlers.go | 1 |
3 files changed, 138 insertions, 15 deletions
diff --git a/PROJECTSTATUS.md b/PROJECTSTATUS.md index d65467d..43f47f8 100644 --- a/PROJECTSTATUS.md +++ b/PROJECTSTATUS.md @@ -6,35 +6,32 @@ ### Improvements -* [ ] TODO's in the code to be addressed +* [X] TODO's in the code to be addressed * [ ] Include unit test coverage reports -* [ ] Split up into more modules or packages for better organization (look at all the FOO_something.go files, when FOO becomes >2) ### New features * [ ] implement a code action for selected code block the way via a unix pipe as faster access in helix -* [x] Use hexai as a gh copilot... CLI replacemant for command line questions -* [ ] Resolve diagnostics code action feature +* [X] Use hexai as a gh copilot... CLI replacemant for command line questions +* [X] Resolve diagnostics code action feature * [X] LSP server to be used with the Helix text editor * [X] Code completion using LLMs * [ ] Have all text LLM prompts be configurable. With defaults as of now. * [X] Text completion in general -* [ ] Be a replacement for 'github copilot cli' -* [ ] Be able to perform inline chats (keeping history in the document) +* [/] Be a replacement for 'github copilot cli' +* [X] Be able to perform inline chats (keeping history in the document) * [ ] Be able to switch the underlying model via a prompt -* [ ] Fine tune when Large Language Model (LLM) completions trigger, as it seems that there are some cases where the Large Language Model (LLM) receives a request but Helix isn't suggesting any completions. There seems to be something odd with the in logic. Investigate the TriggerChar logic and make sure it matches Helix's expectations. -* [ ] Only one code completion should run at a time, even if multiple triggers occur simultaneously +* [/] Fine tune when Large Language Model (LLM) completions trigger, as it seems that there are some cases where the Large Language Model (LLM) receives a request but Helix isn't suggesting any completions. There seems to be something odd with the in logic. Investigate the TriggerChar logic and make sure it matches Helix's expectations. + * [ ] Actually document the completion timeout settings in HelixEditor +* [X] Only one code completion should run at a time, even if multiple triggers occur simultaneously * [ ] Create "generate unit test" code action for selected code block => write test to FILE_test.go file -* [ ] Can anything else can be done with LSP? +* [X] Can anything else can be done with LSP? Be able to select code blocks and perform code actions on them * [ ] Commenting exiting code -* [ ] Code refactoring - -Be able to chat with the LLM - -* [ ] Have a dialog with the LLM, like in lsp-ai +* [ ] Improve code +* [X] Code refactoring (via comment instruction) Be able to switch LLMs. diff --git a/docs/source-structure.md b/docs/source-structure.md new file mode 100644 index 0000000..65db4d9 --- /dev/null +++ b/docs/source-structure.md @@ -0,0 +1,127 @@ +# Source code structure + +This document provides a high‑level map of the Hexai source layout and how the +main packages relate to each other. + +## Diagram + +```mermaid +graph TD + %% Entrypoints + A[cmd/hexai\nCLI entrypoint] --> B[internal/hexaicli\nCLI runner] + C[cmd/hexai-lsp\nLSP entrypoint] --> D[internal/hexailsp\nLSP runner] + + %% Shared/internal packages + subgraph internal/ + I[appconfig\nLoad config from file/env] + L[llm\nClient + providers] + G[logging\nBound logger + helpers] + S[lsp\nJSON-RPC, server, handlers] + end + + %% Relationships + B --> I + B --> L + B --> G + + D --> I + D --> L + D --> G + D --> S + + S --> L + S --> G + + %% LLM providers + subgraph internal/llm + P1[openai.go] + P2[ollama.go] + P3[copilot.go] + end + L --> P1 + L --> P2 + L --> P3 + + %% Version info + V[internal/version.go\nVersion string] --> A + V --> C +``` + +## ASCII diagram + +``` + +----------------------+ + | internal/version.go | + +----------------------+ + | provides Version + +-------------+-------------+ + | | + +--------------+ +----------------+ + | cmd/hexai | | cmd/hexai-lsp | + | (CLI) | | (LSP server) | + +--------------+ +----------------+ + | | + v v + +------------------+ +------------------+ + | internal/hexaicli| | internal/hexailsp| + | (CLI runner) | | (LSP runner) | + +------------------+ +------------------+ + | | | | | | + | | | | | +----> logging + | | +----> logging | +--------> llm (client) + | +--------> llm (client) +-------------> appconfig + +-------------> appconfig | + builds options + v + +------------------+ + | internal/lsp | + | (server, JSON-RPC| + | handlers, docs) | + +------------------+ + | | + | +----> logging + +-------------> llm (client) + + llm providers: + +-----------------------------+ + | internal/llm/providers | + | - openai.go | + | - ollama.go | + | - copilot.go | + +-----------------------------+ + + shared libs: + - internal/appconfig: config from file/env + - internal/logging: logger binding + helpers +``` + +## Module overview + +- cmd/hexai: CLI binary that parses flags, prints version via `internal.Version`, + and delegates to `internal/hexaicli.Run`. +- cmd/hexai-lsp: LSP server binary that parses flags, prints version, and calls + `internal/hexailsp.Run` (stdio JSON‑RPC server). +- internal/hexaicli: CLI flow — reads stdin/args, loads config, builds an LLM + client, constructs messages, and runs a single chat request (streaming when + supported). +- internal/hexailsp: LSP orchestration — binds logging, loads config, builds the + LLM client, constructs `internal/lsp.ServerOptions`, and runs the server. +- internal/lsp: Minimal LSP over stdio — document store, JSON‑RPC handlers + (initialize, completion, code action, etc.), context building, and a small + completion cache. +- internal/llm: Provider‑agnostic client interface plus concrete providers for + OpenAI, GitHub Copilot, and Ollama, including streaming support where + available. +- internal/appconfig: Loads user configuration from file and environment, shared + by both CLI and LSP paths. +- internal/logging: Central logger binding and small helpers for consistent, + readable logs and chat summaries. +- internal/version.go: Single place for the version string used by both + binaries. + +## Typical flows + +- CLI: `cmd/hexai` → `internal/hexaicli` → `internal/appconfig` → `internal/llm` + (providers) → print output and a short summary line. +- LSP: `cmd/hexai-lsp` → `internal/hexailsp` → `internal/lsp.Server` → + request handlers → `internal/llm` for completions/actions. diff --git a/internal/lsp/handlers.go b/internal/lsp/handlers.go index a5649f1..531b454 100644 --- a/internal/lsp/handlers.go +++ b/internal/lsp/handlers.go @@ -1,5 +1,4 @@ // Summary: LSP JSON-RPC handlers; implements core methods and integrates with the LLM client when enabled. -// TODO: Split this up into multiple smaller files. package lsp import ( |
