Skip to content

feat(plugin-gateway): add valueOf, resolveIdentifier, widgetImageURL and channel count - #221

Merged
kodiakhq[bot] merged 1 commit into
mainfrom
feat/plugin-gateway-guild-manager-methods
Oct 6, 2026
Merged

kodiakhq[bot] merged 1 commit into
mainfrom
feat/plugin-gateway-guild-manager-methods

Conversation

@RedStar071

Copy link
Copy Markdown
Member

🔗 Linked issue

Refs #216

🧭 Context

#216 tracks discord.js manager parity for @wolfstar/plugin-gateway. It is split into several PRs; this first one carries the small manager methods, so the issue stays open.

📚 Description

Adds four small discord.js manager members: DataManager#valueOf(), GuildEmojiManager#resolveIdentifier(), GuildManager#widgetImageURL(guild, style?) and GuildChannelManager#channelCountWithoutThreads.

Where this departs from the plan on the issue:

  • The guild-scoped guild.members, guild.roles, guild.presences and guild.voiceStates in the plan landed in feat(plugin-gateway): add guild managers with caches keyed by id #219 while this PR was in progress. I had drafted them as thin views; that code is dropped.
  • rawFetchGuildActiveThreads is skipped, nothing would consume it.
  • Widget#imageURL already exists, so widgetImageURL is only the manager-level counterpart.
  • resolveIdentifier throws for a value it cannot resolve, where discord.js returns null. An uncached emoji ID still answers null.
  • channelCountWithoutThreads enumerates the raw channel store (GuildChannelManager has no cache of its own), so it throws CacheNotIterable when the store cannot enumerate its entries.

Design notes are in docs/superpowers/specs/2026-10-06-guild-manager-methods-design.md.

Key changes

Member Behaviour
DataManager#valueOf() Returns the manager's cache.
GuildEmojiManager#resolveIdentifier() Emoji, cached emoji ID or unicode/mention to the identifier reaction routes expect.
GuildManager#widgetImageURL() Widget image URL from a guild, an ID or anything with guildId; throws GuildResolve.
GuildChannelManager#channelCountWithoutThreads CacheRead<number>: guild channels in the channel store, threads excluded.

Verification: pnpm lint, pnpm build, pnpm typecheck and pnpm test all pass locally (109 test files, 1508 tests). The new tests run against a synchronous cache, the default CollectionCache and an asynchronous store, plus a type-level consumption test.

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
  • I have updated the documentation accordingly
  • I added a changeset with pnpm changeset (or pnpm changeset add --empty if no release is needed). See .changeset/README.md.

🤖 AI disclosure: Claude Code was used on this PR. Code written with claude-sonnet-5-5; PR description written with claude-sonnet-5-5. AI policy.

…and channel count

Add DataManager#valueOf, GuildEmojiManager#resolveIdentifier,
GuildManager#widgetImageURL and GuildChannelManager#channelCountWithoutThreads,
the small discord.js manager methods of issue #216.

Refs #216
@coldtea-pr-lens

coldtea-pr-lens Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

✅ Clean pass · 5a30646 looks sound on architecture, data flow and security


Architecture

Architecture diagram for wolfstar-project/plugins at 5a30646

Play the walkthrough


Data flow

Data flow diagram for wolfstar-project/plugins at 5a30646

Follow each request


View

  • Architecture lens
  • Data flow lens
  • Expand every detail

Tip

The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change

🪧 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
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through
  • 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 the packages:plugin-gateway Changes in plugin-gateway label Oct 6, 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: the full single-commit diff, checked against the surrounding plugin-gateway managers, ReactionEmoji, Widget and the cache helpers.

  • DataManager#valueOf(): returns the manager's cache, matching discord.js.
  • GuildEmojiManager#resolveIdentifier(): resolves a GuildEmoji, a cached emoji ID (sync or async through whenAll) or falls back to ReactionEmoji.resolveIdentifier. The throw-instead-of-null deviation is documented in the changeset.
  • GuildManager#widgetImageURL(): resolves a guild, an ID or anything with guildId, and throws the new GuildResolve error otherwise.
  • GuildChannelManager#channelCountWithoutThreads: counts through the internal ChannelManager#_countInGuild over the raw store, reusing iterableCache() and guard(), so CacheNotIterable and cacheErrors behave like listCached.
  • Tests, changeset and spec: runtime tests across sync, default and async caches, plus a type-level consumption test.

ℹ️ Nitpicks

  • GuildManager#widgetImageURL rebuilds the same ${RouteBases.api}${Routes.guildWidgetImage(id)}?style=${style} string as Widget#imageURL (structures/guilds/Widget.ts:89). A shared helper would keep the two from drifting.
  • In tests/guild-manager-methods.test.ts, GIVEN a synchronous cache THEN the count is synchronous overlaps with the thread test just above it, which already asserts a synchronous toBe(1). One of the two could go.

Pullfrog  | View workflow run | Using claude-sonnet-5-5 | 𝕏

@kodiakhq
kodiakhq Bot merged commit 3a209a4 into main Oct 6, 2026
18 checks passed
@kodiakhq
kodiakhq Bot deleted the feat/plugin-gateway-guild-manager-methods branch October 6, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages:plugin-gateway Changes in plugin-gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants