Skip to content

refactor(tool): convert write tool to Tool.defineEffect - #21901

Merged
kitlangton merged 1 commit into
devfrom
kit/tool-effect-write
Apr 10, 2026
Merged

kitlangton merged 1 commit into
devfrom
kit/tool-effect-write

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Summary

  • Convert WriteTool from Tool.define to Tool.defineEffect with proper Effect services
  • Yield LSP.Service in the outer Effect.gen and replace static LSP.touchFile/LSP.diagnostics calls with instance methods (lsp.touchFile/lsp.diagnostics)
  • Wrap remaining Promise-based calls (Filesystem.*, FileTime.*, Format.file, ctx.ask, Bus.publish) with Effect.promise
  • Update ToolRegistry to resolve WriteTool as an Effect (const writetool = yield* WriteTool) and pass it to Tool.init(writetool)
  • Update test to use ManagedRuntime for resolving the Effect-based WriteTool

Test plan

  • bun run typecheck passes (no write-related errors)
  • bun run test test/tool/write.test.ts — all 13 tests pass

@kitlangton
kitlangton force-pushed the kit/tool-effect-write branch 3 times, most recently from 48ff033 to e49466c Compare April 10, 2026 19:45
@kitlangton
kitlangton marked this pull request as ready for review April 10, 2026 19:46
@kitlangton
kitlangton force-pushed the kit/tool-effect-write branch from e49466c to 038f397 Compare April 10, 2026 19:48
Migrate WriteTool to use Tool.defineEffect with proper Effect services.
LSP static calls replaced with yielded LSP.Service instance methods.
@kitlangton
kitlangton force-pushed the kit/tool-effect-write branch from 038f397 to 69ac261 Compare April 10, 2026 19:50
@kitlangton
kitlangton merged commit b139bc2 into dev Apr 10, 2026
9 of 10 checks passed
@kitlangton
kitlangton deleted the kit/tool-effect-write branch April 10, 2026 20:57
mrsimpson pushed a commit to mrsimpson/opencode that referenced this pull request Apr 14, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
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