Plugins, hooks and custom extensions
Adapter design. This page specifies the unpublished adapter. Run a request with Octokit and Effect.
Use the client returned by Octokit.plugin(...) or a caller-supplied subclass. Preserve static defaults, plugin order, deduplication behavior, custom constructor options, methods, symbols and receivers. Core request hooks include callable invocation, before, after, error, wrap and remove. The original method must cross the installed hook chain exactly once. Preserve error-hook recovery, wrapper short circuits and option/response mutation semantics.
Support typed extension adapters that receive the concrete client and shared Effect constructors. A use((client, signal) => ...) escape hatch preserves inference for arbitrary plugins. Wrap known official extensions explicitly. A custom method may be synchronous, callback-based, overloaded, return a stream, or access a getter with side effects. A recursive promise proxy cannot establish its contract.
| Official extension | Treatment |
|---|---|
| REST endpoints, legacy aliases, REST and GraphQL pagination | Mapped in their operation families. composePaginateRest, isPaginatingEndpoint, paginatingEndpoints, page-info types and plugin versions remain accessible as appropriate. |
| Retry and throttling | Preserve retry.retryRequest(error, retries, retryAfter), options, throttle callbacks and throttling.triggersNotification. The retry helper returns an annotated error. Do not convert it into an extra network request. |
| Request log, enterprise compatibility | Preserve installed request hooks; do not double-log or bypass compatibility transforms. |
| Enterprise Cloud and GHES version/admin bundles | Register only for the installed plugin’s actual profile. Preserve its namespaces, operation names and host-specific defaults. Broad upstream Function declarations need separate type evidence. |
| Create or update text file | Wrap createOrUpdateTextFile and the standalone composition form. Preserve async content callback, unchanged-file result and create/update outcomes. A read/modify/write conflict belongs to the caller’s policy. |
| Actions client | Keep its environment, proxy agent, custom fetch, auth discovery, legacy REST and pagination in the optional profile. No Actions environment reads on a normal root import. |
For hook registration, retain the installed callback identity and deregister in scope. Callback effects inherit the registering application’s services. Unknown plugin operations are reachable through use; promote common ones to named wrappers after documenting their semantics and tests. Core plugins · Optional profile inventory