feat: rename adapter.client to adapter.octokit / adapter.linearClient / adapter.webClient#478
Merged
Merged
Conversation
Rename the public native client getter on `GitHubAdapter` from `.client` to `.octokit` so it matches the underlying SDK class name. The previous `.client` getter is preserved as a `@deprecated` alias that delegates to `.octokit`, so existing code keeps working without changes. Internal refactor: - The colliding private field `octokit` is renamed to `defaultOctokit` (mirroring Linear's `defaultClient`), and the single internal use of `this.client` in `fetchSubject` is updated to `this.octokit`. - TSDoc is added to both getters covering single- vs multi-tenant resolution and when calling outside a webhook handler throws. Tests: - Existing `fetchSubject` tests that reflectively assigned to the private octokit field are updated to use `defaultOctokit`. - A new `octokit getter` describe block asserts: PAT-mode returns the underlying `Octokit`, single-tenant calls return the same instance, the deprecated `.client` alias points at `.octokit`, and multi-tenant mode without webhook context throws on both getters.
Rename the public native client getter on `LinearAdapter` from `.client` to `.linearClient` so it matches the underlying SDK class name from `@linear/sdk`. The previous `.client` getter is preserved as a `@deprecated` alias that delegates to `.linearClient`, so existing code keeps working without changes. TSDoc is added to both getters covering single-tenant (apiKey, accessToken, client credentials) vs multi-tenant OAuth resolution and when calling outside a webhook handler throws. A new `linearClient getter` describe block asserts: apiKey mode returns the underlying `LinearClient`, single-tenant calls return the same instance, the deprecated `.client` alias points at `.linearClient`, and multi-tenant OAuth without webhook context throws on both getters.
Update chat-sdk.dev pages that referenced `bot.getAdapter(...).client` to use the new SDK-named getters (`.octokit` for GitHub, `.linearClient` for Linear), and note that the previous `.client` getter remains as a deprecated alias. Touches the usage, API reference, subject, and adapters pages.
Minor bump for `@chat-adapter/github` and `@chat-adapter/linear` covering the rename of `adapter.client` to `adapter.octokit` / `adapter.linearClient`, with the `.client` alias kept as deprecated.
Move the inline `/installation/i` and `/No Linear access token available/` regex literals used by the new `octokit getter` and `linearClient getter` `expect.toThrow` assertions into top-level `const`s, satisfying ultracite's `lint/performance/useTopLevelRegex` rule.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
visyat
previously approved these changes
May 11, 2026
…lient-getters # Conflicts: # packages/adapter-github/src/index.ts # packages/adapter-linear/src/index.ts
visyat
previously approved these changes
May 11, 2026
…lient-getters # Conflicts: # apps/docs/content/docs/api/chat.mdx # apps/docs/content/docs/usage.mdx
Rename the public native client getter on `SlackAdapter` from `.client` to `.webClient` so it matches the underlying SDK class name (`WebClient` from `@slack/web-api`). The previous `.client` getter is preserved as a `@deprecated` alias that delegates to `.webClient`, so existing code keeps working without changes. This brings Slack in line with the same SDK-named convention this PR applies to the GitHub (`.octokit`) and Linear (`.linearClient`) adapters. TSDoc on the new getter covers single-workspace vs multi-workspace token resolution, the `withBotToken` escape hatch, and when calling outside a webhook handler throws. A new `webClient getter` describe block asserts: the new getter returns a `WebClient` bound to the static `botToken`, repeated calls return the same instance, the deprecated `.client` alias points at `.webClient`, multi-workspace mode without context throws on both getters, and the context token from `withBotToken` flows through `.webClient`. The existing `direct WebClient access via adapter.client` block is kept as-is to verify the deprecated alias retains its full behavior.
Update chat-sdk.dev pages so the native client examples use the SDK-named getters across all three adapters (`.webClient` for Slack, `.linearClient` for Linear, `.octokit` for GitHub): - `docs/api/chat.mdx`: rewrite the "Direct client access" section to introduce the SDK-named getter for each adapter, mention that the `.client` alias is deprecated on all three, and update the `withBotToken` callout to reference `.webClient`. - `docs/usage.mdx`: switch the Slack snippet to `.webClient`. - `docs/adapters.mdx`: rename the "Native client" capability row to link to all three SDK-named getters and mark Slack as supported. - Per-adapter pages: switch the official Slack/Linear/GitHub adapter reference pages to use the SDK-named getter and add a deprecation note. The Slack adapter page didn't previously document `.client` — add a "Direct API client" section to it now.
Extend the existing rename changeset to also cover `@chat-adapter/slack` now that this PR adds the matching `.webClient` getter (with `.client` preserved as a deprecated alias) to the Slack adapter.
… the new client getters Add the symmetric "with webhook context" tests for the new `.octokit` and `.linearClient` getters that were previously only covered implicitly by webhook-driven tests. Each test wires the adapter's private `requestContext` `AsyncLocalStorage` directly and asserts: - inside the context, the public getter resolves to the per-tenant client (per-installation `Octokit` for GitHub, per-org `LinearClient` for Linear); - repeated reads inside the same context return the same instance and the deprecated `.client` alias matches; - on GitHub, a different installation context resolves to a different cached client; - exiting the context throws again — the per-call context isn't sticky. This brings GitHub and Linear up to parity with the equivalent `webClient` test on Slack (`uses the request context token under withBotToken via webClient`).
visyat
approved these changes
May 12, 2026
This was referenced May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rename the public native client getter on the GitHub, Linear, and Slack adapters so it matches the underlying SDK class instead of the generic
.client. The previous.clientgetter is preserved as a@deprecatedalias on all three adapters, so existing code keeps working without changes.bot.getAdapter("github").clientis nowbot.getAdapter("github").octokit(returnsOctokit)bot.getAdapter("linear").clientis nowbot.getAdapter("linear").linearClient(returnsLinearClientfrom@linear/sdk)bot.getAdapter("slack").clientis nowbot.getAdapter("slack").webClient(returnsWebClientfrom@slack/web-api)Each new getter has TSDoc covering single- vs multi-tenant resolution rules and when calling outside a webhook handler throws. Focused unit tests assert that the new getter returns the underlying SDK instance, that single-tenant calls return the same instance, that the deprecated
.clientalias points at the new getter, that multi-tenant mode without webhook context throws on both getters, and that inside a webhook context the getter resolves to the per-tenant client.Commits are split for review:
feat(adapter-github): rename adapter.client to adapter.octokitfeat(adapter-linear): rename adapter.client to adapter.linearClientdocs: use .octokit / .linearClient in chat-sdk.dev exampleschore: changeset for adapter native client getter renamefix: hoist regex literals in new client-getter tests to module scopefeat(adapter-slack): rename adapter.client to adapter.webClientdocs: include slack .webClient in chat-sdk.dev exampleschore: include adapter-slack in native client getter rename changesettest(adapter-github,adapter-linear): cover with-context resolution on the new client getters