Skip to content

fix(plugin-gateway,plugin-cache,plugin-sharder): add a no-op ./register subpath export - #123

Merged
kodiakhq[bot] merged 1 commit into
mainfrom
claude/issue-121-plugin-effects-41p1vw
Sep 26, 2026
Merged

kodiakhq[bot] merged 1 commit into
mainfrom
claude/issue-121-plugin-effects-41p1vw

Conversation

@RedStar071

Copy link
Copy Markdown
Member

🔗 Linked issue

Part of #121 (item 1, the blocking one). Supersedes #122, which was closed.

🧭 Context

The Stars CLI build (stars:plugin-registrations in @wolfstar/vite-server) adds import "<name>/register" to the entry for every dependency whose name matches /^@wolfstar\/plugin-[^/]+$/. It never checks the package's exports. plugin-gateway, plugin-cache and plugin-sharder only export ".", so a project that depends on any of them builds fine and then crashes at startup with ERR_PACKAGE_PATH_NOT_EXPORTED. The issue only names gateway and cache, but plugin-sharder has the same gap.

📚 Description

Should register use a Plugin hook to do something? I checked, and for these three packages the answer is no. The entrypoint is intentionally a no-op (export {}):

  • plugin-cache and plugin-sharder don't depend on @wolfstar/http-framework, and they never touch its Client. The cache is passed explicitly through GatewayClient's cache option, and the sharder manager runs outside the bot process. They have no hook to register.
  • plugin-gateway: a hook runs for every Client in the process (the sharder manager, plain HTTP clients), not only for GatewayClient. Stars injects the import for every project that depends on the package, so any side effect would reach users who never opted in. The lifecycle also doesn't fit. Client runs preGenericsInitialization, preInitialization and postInitialization from the base constructor, before GatewayClient's constructor has created gateway and cache. A postListen auto-connect would also double-connect with GatewayClient#start(), which already runs load → listen → connect. Everything a hook could set up, GatewayClient's own constructor already does, so a hook adds nothing.

The same reasoning is written as a comment in each src/register.ts. The sideEffects: false flag stays: the module is empty, so a bundler can drop the import without changing behavior.

The durable fix is to make the Stars transform check exports["./register"] before it injects the import. That code lives in @wolfstar/cli / @wolfstar/vite-server, not in this repo.

Key changes

Package Change
plugin-cache, plugin-gateway, plugin-sharder New src/register.ts (no-op), exports["./register"], tsdown entry + attwEntrypoints
workspace tests/register-entrypoints.test.ts fails when any @wolfstar/plugin-* package lacks ./register (it currently checks all 7)
.changeset/register-entrypoints.md patch for the three packages

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Workflow / CI change

Pre-flight Checklist

  • I have read the Contributing Guidelines (if applicable)
  • My code follows the code style of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (pnpm test: 41 files, 443 tests)
  • I have updated the documentation accordingly (n/a)
  • I added a changeset with pnpm changeset

Checks I ran: pnpm build for each of the three packages passes, with attw and publint clean on ./register. node -e "await import('@wolfstar/plugin-<name>/register')" resolves for all three. pnpm lint and pnpm typecheck pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RBWEHLtNzWNykJMPqeqqbB


Generated by Claude Code

…ter` subpath export

The Stars CLI build imports `<name>/register` for every `@wolfstar/plugin-*` dependency
of a project, so these three packages crashed their consumers at startup with
`ERR_PACKAGE_PATH_NOT_EXPORTED`.

None of them registers an `@wolfstar/http-framework` `Plugin` hook: plugin-cache and
plugin-sharder never touch the framework's `Client`, and a gateway hook would run for
every `Client` of the process, while `postInitialization` runs from the base constructor
before `GatewayClient` sets up its gateway and cache.

A workspace test now fails when a `@wolfstar/plugin-*` package lacks the subpath.

Refs #121

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RBWEHLtNzWNykJMPqeqqbB
@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

◈ PR Lens

🟢 +0 new · 🟠 ~4 changed · 🔴 -0 removed · 0 flows · 10 files · commit 8f1c5b6


Architecture

Architecture diagram for wolfstar-project/plugins at 8f1c5b6

4 components touched across 5 lanes.

Play the interactive walkthrough


Data flow

No data-flow sequence changed in this PR.


View

  • Architecture lens
  • Data flow lens
  • Expand every detail

Tip

Click the link under each diagram to open it on a canvas you can zoom, pan and step through

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists
  • Untick Architecture lens or Data flow lens under View to hide a diagram, or tick Expand every detail to open every section. The comment redraws in a few seconds
  • The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change
  • Open a diagram on the canvas, then press W or click play to walk through the change one step at a time
  • The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture and data flow row. Drawing still runs as before
  • Set github.draw: on-demand in .github/pr-lens.yml and PR Lens stops drawing pull requests on its own. Comment @pr-lens draw on a pull request when you want that one drawn
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works
  • Push a commit and the drawing stays, with a note that it is out of date. Tick Redraw in the note to draw the new head
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion

Thanks for using PR Lens! It's built by Coldtea, free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

@wolfstarbot wolfstarbot added packages:plugin-cache Changes in plugin-cache packages:plugin-gateway Changes in plugin-gateway packages:plugin-sharder Changes in plugin-sharder labels Sep 26, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Reviewed the full diff: a no-op ./register subpath export added to plugin-cache, plugin-gateway, and plugin-sharder, plus a workspace test guarding it.

  • New src/register.ts per package: export {}; behind an oxlint-disable-next-line unicorn/require-module-specifiers comment, with a comment explaining why no Plugin hook applies to that package.
  • package.json#exports["./register"]: standard import/types/default trio pointing at ./dist/esm/register.{js,d.ts}; sideEffects correctly stays a bare false since these entrypoints have no real side effect (unlike plugin-api/plugin-logger, whose register.ts does import ./index and declares sideEffects as an array).
  • tsdown.config.ts: entry/attwEntrypoints extended to build and type-check the new subpath.
  • tests/register-entrypoints.test.ts: asserts every @wolfstar/plugin-* package declares the ./register export and ships the backing file.
  • Changeset: patch for all three affected packages.

I verified rather than took the PR description's checks at face value:

  • oxlint -c .oxlintrc.json and oxlint src --fix on all three new register.ts files: 0 errors, and --fix does not strip the export {}; — confirms the disable comment correctly defuses the unicorn/require-module-specifiers → unicorn/no-empty-file auto-fix trap this repo has hit before.
  • vitest run tests/register-entrypoints.test.ts: 8/8 pass.
  • pnpm --filter @wolfstar/plugin-cache build: clean, attw and publint both pass on ./register.
  • Read GatewayClient.ts's constructor to confirm the register.ts comment's claim is accurate: super(options) (which runs the base Client's preGenericsInitialization/preInitialization/postInitialization hooks) does execute before this.cache/this.gateway are assigned, so a hook genuinely couldn't see them yet.

No functional issues. The no-op design is well-reasoned and matches the actual code.

Pullfrog  | View workflow run | Using Claude Sonnet | 𝕏

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

Labels

packages:plugin-cache Changes in plugin-cache packages:plugin-gateway Changes in plugin-gateway packages:plugin-sharder Changes in plugin-sharder

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants