feat(channel list): add --via-counts flag for Enterprise Grid#109
Open
cawilliamson wants to merge 1 commit into
Open
feat(channel list): add --via-counts flag for Enterprise Grid#109cawilliamson wants to merge 1 commit into
cawilliamson wants to merge 1 commit into
Conversation
On Enterprise Grid, users.conversations and conversations.list return
enterprise_is_restricted for browser/session tokens, so `channel list`
(and `channel list --all`) can't enumerate conversations without an
admin-approved app token.
Add `channel list --via-counts`, which enumerates the current user's
joined conversations via client.counts (the slack web client's sidebar
method, still permitted on Grid) + conversations.info per id for names.
Output matches the existing channel-record shape from the other list
helpers.
- listConversationsViaCounts: client.counts -> ids across channels/mpims/ims
-> conversations.info per id (parallel), keep {id} on info failure
- --via-counts is incompatible with --all and --user (client.counts is
current-user, joined-only, no server-side pagination; --limit slices
locally, --cursor is ignored)
- tests for enumeration, info-failure fallback, limit slicing, id-less
entries
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.
What
channel list --via-counts— lists the current user's joined conversations (channels, MPIMs, DMs) with names on Enterprise Grid workspaces, where browser/session tokens can't useusers.conversations/conversations.list(Slack returnsenterprise_is_restricted).Why
On Enterprise Grid, Slack restricts org-wide conversation enumeration (
conversations.list,users.conversations) for browser/session (xoxc/xoxd) tokens — this is intentional on Slack's side and not something a CLI can route around. The web client builds its sidebar fromclient.counts, which is still permitted and returns every conversation the user has joined (split acrosschannels/mpims/ims, ids only). This PR exposes that same path behind an explicit flag so Grid users can list their joined conversations from the CLI without an admin-approved app token.--all(full workspace enumeration) remains inherently unavailable via browser tokens on Grid — only an app token (xoxp) withconversations:readcan do that.--via-countsis therefore incompatible with--alland--user(client.countsis current-user, joined-only, and has no server-side pagination;--limitslices locally,--cursoris ignored).How
listConversationsViaCounts(src/slack/channels.ts): callsclient.counts, collects ids fromchannels/mpims/ims, enriches each viaconversations.info(parallelised withPromise.all), and returns the sameConversationsPageshape as the other list helpers. Keeps{ id }ifconversations.infofails for a given conversation.channel list(src/cli/channel-command.ts) gains--via-counts; mutually exclusive with--all/--user.Testing
bun run typecheck— cleanbun run lint— no new warnings/errors (10 pre-existing warnings unchanged)bun run format:check— cleanbun test— 242 pass, 0 fail (3 new tests forlistConversationsViaCounts: enumeration + enrichment, info-failure fallback, limit slicing / id-less entries)Example