MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / resolveTemplatePath

Function resolveTemplatePath

agentContext/builder.go:57–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 current = parent
56 }
57 }
58
59 if root := config.FindLuminaRoot(""); root != "" {
60 candidate := config.LuminaResourcePath(root, apppaths.LegacySystemDirName, apppaths.SystemPromptFileName)
61 if fileExists(candidate) {
62 return candidate
63 }
64 }
65
66 _, filename, _, ok := runtime.Caller(0)
67 if !ok {
68 return apppaths.ProjectSystemPrompt(".")
69 }
70
71 current := filepath.Dir(filename)
72
73 for i := 0; i < 6; i++ {
74 candidate := apppaths.ProjectSystemPrompt(current)
75 if fileExists(candidate) {
76 return candidate
77 }
78
79 parent := filepath.Dir(current)
80 if parent == current {
81 break
82 }
83
84 current = parent
85 }
86
87 return filepath.Join(
88 filepath.Dir(filename),
89 "..",
90 apppaths.ProjectLocalDirName,
91 apppaths.LegacySystemDirName,
92 apppaths.SystemPromptFileName,
93 )
94}
95
96func resolveTemplatePathForCWD(cwd string) string {
97 if path, ok := projectTemplatePathForCWD(cwd); ok {
98 return path
99 }
100 return getTemplatePath()
101}
102
103func projectTemplatePathForCWD(cwd string) (string, bool) {

Callers 1

getTemplatePathFunction · 0.85

Calls 3

FindLuminaRootFunction · 0.92
LuminaResourcePathFunction · 0.92
fileExistsFunction · 0.70

Tested by

no test coverage detected