MCPcopy Create free account
hub / github.com/anomalyco/opencode / toModelOutput

Function toModelOutput

packages/core/src/tool/grep.ts:38–50  ·  view source on GitHub ↗
(output: ModelOutput)

Source from the content-addressed store, hash-verified

36
37/** Format raw search matches into the familiar concise model output. */
38export const toModelOutput = (output: ModelOutput) => {
39 const lines = output.length === 0 ? ["No files found"] : [`Found ${output.length} matches`]
40 let current = ""
41 for (const match of output) {
42 if (current !== match.entry.path) {
43 if (current) lines.push("")
44 current = match.entry.path
45 lines.push(`${match.entry.path}:`)
46 }
47 lines.push(` Line ${match.line}: ${match.text}`)
48 }
49 return lines.join("\n")
50}
51
52/** Grep leaf that defaults its filesystem root to the active Location. */
53const layer = Layer.effectDiscard(

Callers 2

grep.tsFile · 0.70
projectFunction · 0.50

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected