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

Function scanCodebase

apps/kimi-code/src/feedback/codebase/scanner.ts:42–62  ·  view source on GitHub ↗
(
  rootInput: string,
  options: ScanCodebaseOptions = {},
)

Source from the content-addressed store, hash-verified

40}
41
42export async function scanCodebase(
43 rootInput: string,
44 options: ScanCodebaseOptions = {},
45): Promise<FeedbackCodebaseScanResult> {
46 const root = resolve(rootInput);
47 const limits = resolveLimits(options.limits);
48 throwIfAborted(options.signal);
49 const usedGitIgnore = await isInsideGitWorkTree(root);
50 const collected = usedGitIgnore
51 ? await scanWithGit(root, limits, options.signal)
52 : await scanWithoutFilter(root, limits, options.signal);
53 const sortedFiles = collected.files.toSorted((a, b) => a.path.localeCompare(b.path));
54
55 return {
56 root,
57 files: sortedFiles,
58 fingerprint: fingerprintFiles(sortedFiles),
59 usedGitIgnore,
60 exceedsLimit: collected.exceedsLimit,
61 };
62}
63
64function resolveLimits(limits: ScanCodebaseOptions['limits']): ScanCodebaseLimits {
65 return {

Callers 2

scanCodebaseForFeedbackFunction · 0.90

Calls 7

resolveLimitsFunction · 0.85
isInsideGitWorkTreeFunction · 0.85
scanWithGitFunction · 0.85
scanWithoutFilterFunction · 0.85
fingerprintFilesFunction · 0.85
throwIfAbortedFunction · 0.70
resolveFunction · 0.50

Tested by

no test coverage detected