Skip to content

fix(overwatch): Make the package loadable from CommonJS - #706

Merged
xavierhamel merged 2 commits into
masterfrom
fix/overwatch-octokit-cjs
Aug 4, 2026
Merged

fix(overwatch): Make the package loadable from CommonJS#706
xavierhamel merged 2 commits into
masterfrom
fix/overwatch-octokit-cjs

Conversation

@xavierhamel

Copy link
Copy Markdown
Contributor

The octokit mega-package eagerly imports @octokit/app, whose exports map
exposes only import conditions with no require-resolvable target. Since this
package ships a CJS build, any consumer whose loader resolves under the require
condition — notably a loop file run through tsx, which transpiles octokit's ESM
bundle down to CJS — dies with ERR_PACKAGE_PATH_NOT_EXPORTED before the loop
starts.

Compose @octokit/core with the rest-endpoint-methods and paginate-rest plugins
instead. That covers everything github.ts uses (rest, paginate, graphql, auth),
never pulls in @octokit/app, and drops the unused OAuth/App/webhooks surface
from the install.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

xavierhamel and others added 2 commits August 4, 2026 14:18
The `octokit` mega-package eagerly imports `@octokit/app`, whose exports map
exposes only `import` conditions with no `require`-resolvable target. Since this
package ships a CJS build, any consumer whose loader resolves under the `require`
condition — notably a loop file run through tsx, which transpiles octokit's ESM
bundle down to CJS — dies with ERR_PACKAGE_PATH_NOT_EXPORTED before the loop
starts.

Compose `@octokit/core` with the rest-endpoint-methods and paginate-rest plugins
instead. That covers everything `github.ts` uses (rest, paginate, graphql, auth),
never pulls in `@octokit/app`, and drops the unused OAuth/App/webhooks surface
from the install.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR replaces the batteries-included octokit dependency with a smaller composition intended to make Overwatch's CommonJS build loadable.

  • Adds @octokit/core, REST endpoint methods, and REST pagination as direct dependencies.
  • Removes the aggregate octokit package and its unused App, OAuth, and webhook dependency surface.
  • Preserves the required REST, pagination, GraphQL, and authentication APIs, but also drops the former retry and throttling behavior.

Confidence Score: 4/5

The transient-error regression should be fixed before merging because routine GitHub failures and rate limits can now abort control-loop runs that previously recovered automatically.

The composed client retains the APIs used by Overwatch but omits the prior retry and throttling plugins, while most GitHub request paths have no equivalent local recovery.

Files Needing Attention: overwatch/src/github.ts

Important Files Changed

Filename Overview
overwatch/src/github.ts Replaces the aggregate Octokit constructor with a manually composed client, preserving used API surfaces but dropping automatic retry and throttling.
overwatch/package.json Adds the three focused Octokit dependencies, removes the mega-package, and bumps the package patch version.
overwatch/pnpm-lock.yaml Resolves the focused Octokit packages and removes the aggregate package's App, OAuth, webhook, retry, and throttling dependency graph.

Reviews (1): Last reviewed commit: "fix(overwatch): Make the package loadabl..." | Re-trigger Greptile

Comment thread overwatch/src/github.ts
@xavierhamel
xavierhamel merged commit f69c01e into master Aug 4, 2026
1 check passed
@xavierhamel
xavierhamel deleted the fix/overwatch-octokit-cjs branch August 4, 2026 19:05
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.

2 participants