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

Function readProjectInstructionFileWithOptions

agentContext/builder.go:315–338  ·  view source on GitHub ↗
(directory string, filenames []string, maxBytes int)

Source from the content-addressed store, hash-verified

313func runGitCommand(cwd string, timeout time.Duration, args ...string) (string, bool) {
314 ctx, cancel := context.WithTimeout(context.Background(), timeout)
315 defer cancel()
316 cmd := exec.CommandContext(ctx, "git", args...)
317 cmd.Dir = cwd
318 out, err := cmd.Output()
319 if err != nil {
320 return "", false
321 }
322 return string(out), true
323}
324
325func readProjectInstructionFile(directory string) (string, error) {
326 doc, err := readProjectInstructionFileWithOptions(directory, projectInstructionFilenames, 0)
327 if err != nil {
328 return "", err
329 }
330 return doc.Content, nil
331}
332
333func readProjectInstructionFileWithOptions(directory string, filenames []string, maxBytes int) (ProjectDoc, error) {
334 if len(filenames) == 0 {
335 filenames = projectInstructionFilenames
336 }
337 for _, filename := range filenames {
338 instructionFilePath := filepath.Join(directory, filename)
339 info, err := os.Stat(instructionFilePath)
340 if err != nil || info.IsDir() {
341 continue

Callers 2

DiscoverProjectDocsFunction · 0.85

Calls 1

readFileWithByteLimitFunction · 0.85

Tested by

no test coverage detected