MCPcopy Index your code
hub / github.com/anomalyco/opencode / parseWorktreeList

Function parseWorktreeList

packages/opencode/src/worktree/index.ts:302–319  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

300 })
301
302 function parseWorktreeList(text: string) {
303 return text
304 .split("\n")
305 .map((line) => line.trim())
306 .reduce<{ path?: string; branch?: string }[]>((acc, line) => {
307 if (!line) return acc
308 if (line.startsWith("worktree ")) {
309 acc.push({ path: line.slice("worktree ".length).trim() })
310 return acc
311 }
312 const current = acc[acc.length - 1]
313 if (!current) return acc
314 if (line.startsWith("branch ")) {
315 current.branch = line.slice("branch ".length).trim()
316 }
317 return acc
318 }, [])
319 }
320
321 const locateWorktree = Effect.fnUntraced(function* (
322 entries: { path?: string; branch?: string }[],

Callers 1

index.tsFile · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected