MCPcopy Index your code
hub / github.com/codeaashu/claude-code / readEditContext

Function readEditContext

src/utils/readEditContext.ts:31–43  ·  view source on GitHub ↗
(
  path: string,
  needle: string,
  contextLines = 3,
)

Source from the content-addressed store, hash-verified

29 * needle isn't found within MAX_SCAN_BYTES.
30 */
31export async function readEditContext(
32 path: string,
33 needle: string,
34 contextLines = 3,
35): Promise<EditContext | null> {
36 const handle = await openForScan(path)
37 if (handle === null) return null
38 try {
39 return await scanForContext(handle, needle, contextLines)
40 } finally {
41 await handle.close()
42 }
43}
44
45/**
46 * Opens `path` for reading. Returns null on ENOENT. Caller owns close().

Callers 1

loadRejectionDiffFunction · 0.85

Calls 3

openForScanFunction · 0.85
scanForContextFunction · 0.85
closeMethod · 0.45

Tested by

no test coverage detected