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

Function locationFrom

packages/opencode/src/acp/tool.ts:310–323  ·  view source on GitHub ↗
(...values: unknown[])

Source from the content-addressed store, hash-verified

308export const buildErrorToolUpdate = errorToolUpdate
309
310function locationFrom(...values: unknown[]): ToolCallLocation[] {
311 return Array.from(
312 new Set(
313 values.flatMap((value): string[] => {
314 if (Array.isArray(value)) {
315 return value.filter((item): item is string => typeof item === "string" && item.length > 0)
316 }
317 const path = stringValue(value)
318 return path ? [path] : []
319 }),
320 ),
321 (path) => ({ path }),
322 )
323}
324
325function diffContent(input: ToolInput): ToolCallContent[] {
326 const oldText = stringValue(input.oldString)

Callers 1

toLocationsFunction · 0.85

Calls 2

stringValueFunction · 0.70
fromMethod · 0.45

Tested by

no test coverage detected