MCPcopy
hub / github.com/vercel/next.js / injectIntoClaudeMd

Function injectIntoClaudeMd

packages/next-codemod/lib/agents-md.ts:321–340  ·  view source on GitHub ↗
(
  claudeMdContent: string,
  indexContent: string
)

Source from the content-addressed store, hash-verified

319}
320
321export function injectIntoClaudeMd(
322 claudeMdContent: string,
323 indexContent: string
324): string {
325 const wrappedContent = wrapWithMarkers(indexContent)
326
327 if (hasExistingIndex(claudeMdContent)) {
328 const startIdx = claudeMdContent.indexOf(START_MARKER)
329 const endIdx = claudeMdContent.indexOf(END_MARKER) + END_MARKER.length
330
331 return (
332 claudeMdContent.slice(0, startIdx) +
333 wrappedContent +
334 claudeMdContent.slice(endIdx)
335 )
336 }
337
338 const separator = claudeMdContent.endsWith('\n') ? '\n' : '\n\n'
339 return claudeMdContent + separator + wrappedContent + '\n'
340}
341
342interface GitignoreStatus {
343 path: string

Callers 1

runAgentsMdFunction · 0.90

Calls 5

wrapWithMarkersFunction · 0.85
hasExistingIndexFunction · 0.85
indexOfMethod · 0.45
sliceMethod · 0.45
endsWithMethod · 0.45

Tested by

no test coverage detected