Skip to content

feat: add typed client port with SDK adapter and test infrastructure#46

Open
chriswritescode-dev wants to merge 1 commit into
mainfrom
feat/typed-client-port
Open

feat: add typed client port with SDK adapter and test infrastructure#46
chriswritescode-dev wants to merge 1 commit into
mainfrom
feat/typed-client-port

Conversation

@chriswritescode-dev

Copy link
Copy Markdown
Owner

Summary

Adds a typed ForgeClient port interface that abstracts the opencode SDK v2,
an SDK adapter that normalises the {data, error} envelope with classified
errors, a FakeClient for hermetic testing, and refactors the existing
codebase to use the new port throughout.

Changes

Added

  • src/client/port.ts — typed port interface with session, workspace, tui, and sync namespaces
  • src/client/sdk-adapter.ts — SDK v2 adapter with error classification and combined factory
  • test/client/sdk-adapter.test.ts — adapter test coverage
  • test/helpers/fake-client.ts — fake client for hermetic test isolation
  • test/helpers/fake-client.test.ts — fake client test coverage

Updated

  • src/services/execution.ts, src/loop/runtime.ts, src/index.ts — core services migrated to ForgeClient
  • src/hooks/* — all hooks updated to use the new port
  • src/workspace/*, src/utils/* — utilities migrated to typed client
  • src/tools/*, src/tui.tsx — tool and UI layer updated
  • test/**/*.test.ts — all test files refactored to use FakeClient or the port
  • vitest.config.ts — test config update

Removed

  • Direct OpencodeClient v1 type usage across the codebase
  • Inline SDK error handling — consolidated into sdk-adapter.ts

Breaking changes

None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant