on main help sign in
chore: make getContextFromPaths config independent
f491a6dKujtim Hoxha
internal/llm/prompt/coder.go+1−1
@@ -28,7 +28,7 @@ func CoderPrompt(p string, contextFiles ...string) string {
28
28
29 basePrompt = fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation())
29 basePrompt = fmt.Sprintf("%s\n\n%s\n%s", basePrompt, envInfo, lspInformation())
30
30
31− contextContent := getContextFromPaths(contextFiles)
31+ contextContent := getContextFromPaths(config.Get().WorkingDir(), contextFiles)
32 slog.Debug("Context content", "Context", contextContent)
32 slog.Debug("Context content", "Context", contextContent)
33 if contextContent != "" {
33 if contextContent != "" {
34 return fmt.Sprintf("%s\n\n# Project-Specific Context\n Make sure to follow the instructions in the context below\n%s", basePrompt, contextContent)
34 return fmt.Sprintf("%s\n\n# Project-Specific Context\n Make sure to follow the instructions in the context below\n%s", basePrompt, contextContent)
internal/llm/prompt/prompt.go+2−4
@@ -5,8 +5,6 @@ import (
5 "path/filepath"
5 "path/filepath"
6 "strings"
6 "strings"
7 "sync"
7 "sync"
8−
9− "github.com/charmbracelet/crush/internal/config"
10)
8)
11
9
12type PromptID string
10type PromptID string
@@ -36,8 +34,8 @@ func GetPrompt(promptID PromptID, provider string, contextPaths ...string) strin
36 return basePrompt
34 return basePrompt
37}
35}
38
36
39−func getContextFromPaths(contextPaths []string) string {
37+func getContextFromPaths(workingDir string, contextPaths []string) string {
40− return processContextPaths(config.Get().WorkingDir(), contextPaths)
38+ return processContextPaths(workingDir, contextPaths)
41}
39}
42
40
43func processContextPaths(workDir string, paths []string) string {
41func processContextPaths(workDir string, paths []string) string {