MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / parsedFilePath

Function parsedFilePath

packages/agent-core/src/tools/builtin/file/grep.ts:722–736  ·  view source on GitHub ↗
(
  line: ParsedGrepLine,
  mode: GrepMode,
  pathClass: PathClass,
)

Source from the content-addressed store, hash-verified

720}
721
722function parsedFilePath(
723 line: ParsedGrepLine,
724 mode: GrepMode,
725 pathClass: PathClass,
726): string | undefined {
727 if (line.kind === 'record') return normalize(line.filePath);
728 if (line.kind === 'separator') return undefined;
729 const text = line.text;
730 if (mode === 'files_with_matches') return normalize(text);
731 if (mode === 'count_matches') {
732 const idx = text.lastIndexOf(':');
733 return idx > 0 ? normalize(text.slice(0, idx)) : normalize(text);
734 }
735 return extractContentFilePath(text, pathClass);
736}
737
738function extractContentFilePath(line: string, pathClass: PathClass): string | undefined {
739 const m = CONTENT_LINE_RE.exec(line);

Callers 1

filterSensitiveLinesFunction · 0.85

Calls 2

normalizeFunction · 0.85
extractContentFilePathFunction · 0.85

Tested by

no test coverage detected