Skip to content

feat(search): Find group chats by title with --type conversations - #104

Merged
frankieyan merged 7 commits into
mainfrom
frankie/search-type-conversations
Nov 5, 2026
Merged

frankieyan merged 7 commits into
mainfrom
frankie/search-type-conversations

Conversation

@frankieyan

@frankieyan frankieyan commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Overview

This PR lets the CLI's search command find group chats by title with --type conversations, using the chat search from Doist/comms-backend#1148, where the logic is consistent across clients.

A similar functionality already exists with tdc conversation list --name, but that fetches every chat and filters locally.

Reference

Test plan

  • On this branch, run npm ci && npm run build, then export COMMS_BASE_URL=https://comms.staging.todoist.com COMMS_API_TOKEN=<staging token>.
  • Create or rename a chat on staging so it gets indexed: curl -X POST https://comms.staging.todoist.com/api/v1/conversations/update -H "Authorization: Bearer $COMMS_API_TOKEN" -H "Content-Type: application/json" -d '{"id":"<chat id>","title":"<title>"}'.
  • Run node dist/index.js search "<word>" --type conversations --workspace <staging workspace id> with a word from the title of a group chat you're in.
    • The chat shows as [conversation], with a URL ending in /msg/<chat id>/.
  • Run node dist/index.js search "<word>" --workspace <staging workspace id> with a word from a message in a conversation.
    • The message hit's URL ends in /msg/<chat id>/m/<message id>.
  • Run node dist/index.js mentions --type conversations.
    • It fails with Allowed choices are threads, messages, all.

frankieyan and others added 2 commits November 4, 2026 17:07
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@frankieyan frankieyan added the 👀 Show PR requires passing checks before merge and independent human review before or after merge. label Nov 5, 2026

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR adds a conversations type to tdc search so group chats can be found by title via the backend chat search, with per-command --type options keeping mentions limited to its existing choices, and conversation result URLs now optionally include a message ID. No inline issues were flagged — the change is well-scoped and consistent, with tests covering the option plumbing and URL building, and README, SKILL.md, and SKILL_CONTENT all updated in sync.

I also left one optional follow-up note in the details below.

Optional follow-up note (1)
  • P3 src/commands/search.ts:34: Adding conversations to the search type routes conversation searches through runSearch, which always calls filterVisibleSearchResults. Without --include-private-channels, that calls getPublicChannelIds → client.channels.getChannels({ workspaceId }) and builds a Set, then filters on item.channelId. Conversation results have no channelId, so this API call and Set build are wasted on every tdc search --type conversations run. Fetch the public channel IDs lazily (only when response.items.some((item) => item.channelId)) or skip the visibility filter for the conversations type.

Share Feedback • Review Logs

Co-Authored-By: Claude <noreply@anthropic.com>
@frankieyan
frankieyan requested a review from doistbot November 5, 2026 02:36

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR adds a conversations search type so tdc search <word> --type conversations finds group chats by title via the backend's chat search (Doist/comms-backend#1148), instead of the local filtering approach used by conversation list --name. The change threads the new type through the shared search-option config while keeping mentions on its existing choices, updates the URL builder to link conversation hits (optionally deep-linking to a message), and makes the public-channel lookup lazy so it's skipped when no result has a channelId. Docs, SKILL.md, and SKILL_CONTENT are kept in sync, and tests cover the option plumbing, URL building, lazy channel filtering, and the mentions validation. No inline issues were flagged — nice, well-scoped work.

I also left one optional follow-up note in the details below.

Optional follow-up note (1)
  • P3 src/commands/search.test.ts:213: This test only asserts that getPublicChannelIds was not called, so it verifies the lazy-lookup optimization but not the behavior that optimization exists to protect: a --type conversations result with no channelId must still be emitted when --include-private-channels is off. Capture the log from captureConsole('log') and also assert the conversation title appears in the output (e.g. expect(log).toHaveBeenCalledWith(expect.stringContaining('Outcasts'))), so a future refactor that drops channel-less results fails this test.

Share Feedback • Review Logs

@frankieyan
frankieyan requested review from a team and rfgamaral and removed request for a team November 5, 2026 03:38
@frankieyan

Copy link
Copy Markdown
Member Author

Waiting til the post-merge backfill mentioned in https://github.com/Doist/comms-backend/pull/1148 is complete. While it wouldn't error, it would also return 200 with no results except newly created or renamed chats, which might be confusing.

@rfgamaral rfgamaral left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good overall. I left a few small suggestions for your consideration, none of them blocking 👍

Comment thread src/commands/search.ts Resolved
Comment thread src/commands/search.ts Resolved
Comment thread src/lib/search-helpers.ts Resolved
frankieyan and others added 3 commits November 5, 2026 13:03
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@frankieyan
frankieyan merged commit 6d47024 into main Nov 5, 2026
6 checks passed
@frankieyan
frankieyan deleted the frankie/search-type-conversations branch November 5, 2026 21:34
doist-release-bot Bot added a commit that referenced this pull request Nov 5, 2026
## [3.10.0](v3.9.1...v3.10.0) (2026-11-05)

### Features

* **search:** Find group chats by title with --type conversations ([#104](#104)) ([6d47024](6d47024))
@doist-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

released 👀 Show PR requires passing checks before merge and independent human review before or after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants