MCPcopy Create free account
hub / github.com/github/gh-aw / computeIncludeResolveAndSecurityBases

Function computeIncludeResolveAndSecurityBases

pkg/parser/remote_fetch.go:239–263  ·  view source on GitHub ↗
(filePath, baseDir string)

Source from the content-addressed store, hash-verified

237}
238
239func computeIncludeResolveAndSecurityBases(filePath, baseDir string) (string, string, string) {
240 githubFolder := findGitHubFolder(baseDir)
241 resolveBase := baseDir
242 securityBase := githubFolder
243 normalizedFilePath := filePath
244 if strings.HasSuffix(githubFolder, ".github") {
245 repoRoot := filepath.Dir(githubFolder)
246 filePathSlash := filepath.ToSlash(filePath)
247 if strings.HasPrefix(filePathSlash, constants.GithubDir) {
248 resolveBase = repoRoot
249 } else if stripped, ok := strings.CutPrefix(filePathSlash, "/"); ok {
250 if !strings.HasPrefix(stripped, constants.GithubDir) && !strings.HasPrefix(stripped, ".agents/") {
251 return "", "", filePath
252 }
253 normalizedFilePath = filepath.FromSlash(stripped)
254 resolveBase = repoRoot
255 if strings.HasPrefix(stripped, ".agents/") {
256 securityBase = filepath.Join(repoRoot, ".agents")
257 } else {
258 securityBase = githubFolder
259 }
260 }
261 }
262 return resolveBase, securityBase, normalizedFilePath
263}
264
265func resolveAndValidateLocalIncludePath(filePath, resolveBase, securityBase string) (string, error) {
266 if stripped, ok := strings.CutPrefix(filepath.ToSlash(filePath), "/"); ok {

Callers 1

ResolveIncludePathFunction · 0.85

Calls 1

findGitHubFolderFunction · 0.85

Tested by

no test coverage detected