Skip to content

refactor(tool): convert apply_patch to Tool.defineEffect#21938

Merged
kitlangton merged 2 commits intodevfrom
kit/tool-effect-apply-patch
Apr 10, 2026
Merged

refactor(tool): convert apply_patch to Tool.defineEffect#21938
kitlangton merged 2 commits intodevfrom
kit/tool-effect-apply-patch

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Summary

  • Convert apply_patch tool from Tool.define to Tool.defineEffect pattern
  • Yield LSP.Service for touchFile/diagnostics calls instead of using static methods
  • Wrap fs/promises calls, ctx.ask, and Format.file in Effect.promise
  • Use assertExternalDirectoryEffect instead of assertExternalDirectory
  • Return execute via Effect.runPromise with Effect.orDie
  • Update registry to yield ApplyPatchTool and pass resolved value to Tool.init
  • Update test to use ManagedRuntime with LSP.defaultLayer

Test plan

  • bun run typecheck passes (no new errors)
  • bun run test test/tool/apply_patch.test.ts — all 26 tests pass

@kitlangton kitlangton force-pushed the kit/tool-effect-apply-patch branch 2 times, most recently from 3cd643f to 5985901 Compare April 10, 2026 23:29
…fect

Migrate apply_patch tool to the Effect pattern: yield LSP.Service for
touchFile/diagnostics, wrap fs calls and ctx.ask in Effect.promise,
use assertExternalDirectoryEffect, and return execute via
Effect.runPromise with Effect.orDie. Update registry to yield
ApplyPatchTool and pass the resolved value to Tool.init. Update tests
to use ManagedRuntime with LSP.defaultLayer.
@kitlangton kitlangton force-pushed the kit/tool-effect-apply-patch branch from 5985901 to 226d16d Compare April 10, 2026 23:37
@kitlangton kitlangton marked this pull request as ready for review April 10, 2026 23:37
@kitlangton kitlangton merged commit 0556774 into dev Apr 10, 2026
8 of 9 checks passed
@kitlangton kitlangton deleted the kit/tool-effect-apply-patch branch April 10, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant