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

Function withCreatedWorktree

packages/opencode/test/project/worktree.test.ts:50–64  ·  view source on GitHub ↗
(
  input: Parameters<Worktree.Interface["create"]>[0],
  use: (created: { info: Worktree.Info; ready: { name: string; branch?: string } }) => Effect.Effect<A, E, R>,
)

Source from the content-addressed store, hash-verified

48 })
49
50const withCreatedWorktree = <A, E, R>(
51 input: Parameters<Worktree.Interface["create"]>[0],
52 use: (created: { info: Worktree.Info; ready: { name: string; branch?: string } }) => Effect.Effect<A, E, R>,
53) =>
54 Effect.acquireUseRelease(
55 Effect.gen(function* () {
56 const svc = yield* Worktree.Service
57 const ready = yield* waitReady().pipe(Effect.forkScoped)
58 const info = yield* svc.create(input)
59 const props = yield* Fiber.join(ready)
60 return { info, ready: props }
61 }),
62 use,
63 ({ info }) => removeCreatedWorktree(info.directory),
64 )
65
66const git = Effect.fn("WorktreeTest.git")(function* (cwd: string, args: string[]) {
67 const service = yield* Git.Service

Callers 1

worktree.test.tsFile · 0.70

Calls 3

waitReadyFunction · 0.85
removeCreatedWorktreeFunction · 0.70
createMethod · 0.65

Tested by

no test coverage detected