summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-18 18:54:53 +0300
committerPaul Buetow <paul@buetow.org>2025-08-18 18:54:53 +0300
commit4fd086f3807f4b5b1fa414b2d1d6ec0f24c3f9b4 (patch)
tree417989a21a0b02617f2db507ea954de7a2a84c46 /internal
parent75acc1b1b442d40524ab93a662c37ee8af99bd72 (diff)
hexaicli: load config with logger to respect provider\n\nFix CLI requiring OPENAI_API_KEY when provider is ollama by actually loading user config.\n\nREADME: update Helix example to use hexai-lsp binary.
Diffstat (limited to 'internal')
-rw-r--r--internal/hexaicli/run.go29
-rw-r--r--internal/llm/copilot.go1
-rw-r--r--internal/llm/openai.go1
3 files changed, 16 insertions, 15 deletions
diff --git a/internal/hexaicli/run.go b/internal/hexaicli/run.go
index 839daef..cfc70ec 100644
--- a/internal/hexaicli/run.go
+++ b/internal/hexaicli/run.go
@@ -3,13 +3,14 @@
package hexaicli
import (
- "bufio"
- "context"
- "fmt"
- "io"
- "os"
- "strings"
- "time"
+ "bufio"
+ "context"
+ "fmt"
+ "io"
+ "log"
+ "os"
+ "strings"
+ "time"
"hexai/internal/appconfig"
"hexai/internal/llm"
@@ -19,12 +20,14 @@ import (
// Run executes the Hexai CLI behavior given arguments and I/O streams.
// It assumes flags have already been parsed by the caller.
func Run(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) error {
- cfg := appconfig.Load(nil)
- client, err := newClientFromConfig(cfg)
- if err != nil {
- fmt.Fprintf(stderr, logging.AnsiBase+"hexai: LLM disabled: %v"+logging.AnsiReset+"\n", err)
- return err
- }
+ // Load configuration with a logger so file-based config is respected.
+ logger := log.New(stderr, "hexai ", log.LstdFlags|log.Lmsgprefix)
+ cfg := appconfig.Load(logger)
+ client, err := newClientFromConfig(cfg)
+ if err != nil {
+ fmt.Fprintf(stderr, logging.AnsiBase+"hexai: LLM disabled: %v"+logging.AnsiReset+"\n", err)
+ return err
+ }
return RunWithClient(ctx, args, stdin, stdout, stderr, client)
}
diff --git a/internal/llm/copilot.go b/internal/llm/copilot.go
index 67cffc9..1c9f60d 100644
--- a/internal/llm/copilot.go
+++ b/internal/llm/copilot.go
@@ -1,5 +1,4 @@
// Summary: GitHub Copilot client implementation for chat completions using the Copilot API.
-// Not yet reviewed by a human
package llm
import (
diff --git a/internal/llm/openai.go b/internal/llm/openai.go
index 69c0cfc..3093891 100644
--- a/internal/llm/openai.go
+++ b/internal/llm/openai.go
@@ -1,5 +1,4 @@
// Summary: OpenAI client implementation for chat completions with optional streaming and detailed logging.
-// Not yet reviewed by a human
package llm
import (