From f491a6d8c38a65392e241aab6b3bc8c37b7cdfce Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Sat, 5 Jul 2025 17:34:40 +0200 Subject: [PATCH] chore: make getContextFromPaths config independent --- internal/llm/prompt/coder.go | 2 +- internal/llm/prompt/prompt.go | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/llm/prompt/coder.go b/internal/llm/prompt/coder.go index 24b90c0fab792b03591e486534a52e4139178bf4..4a1dceb1cf5949de4520a25a3e7703e8435eadd3 100644 --- a/internal/llm/prompt/coder.go +++ b/internal/llm/prompt/coder.go @@ -28,7 +28,7 @@ func CoderPrompt(p string, contextFiles ...string) string { basePrompt = fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation()) - contextContent := getContextFromPaths(contextFiles) + contextContent := getContextFromPaths(config.Get().WorkingDir(), contextFiles) slog.Debug("Context content", "Context", contextContent) if contextContent != "" { return fmt.Sprintf("%s\n\n# Project-Specific Context\n Make sure to follow the instructions in the context below\n%s", basePrompt, contextContent) diff --git a/internal/llm/prompt/prompt.go b/internal/llm/prompt/prompt.go index 0c70d41770ca0d35bcf1cb1d0e7353d1b194790d..835279b4f4c0e08e46aaad271b7cb7f2a59b467f 100644 --- a/internal/llm/prompt/prompt.go +++ b/internal/llm/prompt/prompt.go @@ -5,8 +5,6 @@ import ( "path/filepath" "strings" "sync" - - "github.com/charmbracelet/crush/internal/config" ) type PromptID string @@ -36,8 +34,8 @@ func GetPrompt(promptID PromptID, provider string, contextPaths ...string) strin return basePrompt } -func getContextFromPaths(contextPaths []string) string { - return processContextPaths(config.Get().WorkingDir(), contextPaths) +func getContextFromPaths(workingDir string, contextPaths []string) string { + return processContextPaths(workingDir, contextPaths) } func processContextPaths(workDir string, paths []string) string {