Skip to content

feat: upgrade to @doist/comms-sdk@0.2.0#2

Merged
amix merged 5 commits into
mainfrom
amix/upgrade-comms-sdk
May 21, 2026
Merged

feat: upgrade to @doist/comms-sdk@0.2.0#2
amix merged 5 commits into
mainfrom
amix/upgrade-comms-sdk

Conversation

@amix

@amix amix commented May 21, 2026

Copy link
Copy Markdown
Member

Context

The CLI was bootstrapped from twist-cli and still depended on @doist/comms-sdk through a local file:../comms-sdk-typescript path.

Since then, the SDK has changed in several ways:

  • Removed batch support
  • Changed entity IDs from numeric IDs to base58 UUIDv7 strings
  • Renamed User.name to User.fullName
  • Removed User.bot, User.defaultWorkspace, and awayMode
  • Made the Groups API workspace-scoped
  • Renamed /api/v3 to /api/v1

This PR moves the CLI to the published SDK package and updates all call sites so the CLI and SDK stay aligned.

What changed

  • Updated package.json to use "@doist/comms-sdk": "0.1.0-alpha.1" from the registry instead of the local file: dependency, then regenerated the lockfile.
  • Replaced all client.batch(...) calls with Promise.all(...) over direct client calls.
  • Removed the batch helpers from src/lib/api.ts.
  • Updated thread, channel, comment, conversation, message, and group IDs to strings across refs.ts, public-channels.ts, command handlers, fixtures, and URL regexes.
  • Replaced User.name with User.fullName.
  • Updated default workspace resolution to use api.workspaces.getDefaultWorkspace().
  • Removed bot display, since User.bot is no longer exposed.
  • Updated Groups API wrappers and callers to pass { id, workspaceId }.
  • Removed tdc away ..., since the SDK no longer exposes awayMode.
  • Updated search to call /api/v1/search instead of /api/v3/search.
  • Updated search handling for string channel and conversation IDs.
  • Added COMMS_BASE_URL support for both the SDK client and the search API fallback, so the CLI can target staging and alternate hosts.
  • Replaced per-user batch lookups with buildUserNameMap(workspaceId, client?), backed by a single getWorkspaceUsers call.

Out of scope

  • tdc mentions currently returns 400 on staging because the backend now requires a query arg even when mention_self=true. This will be fixed in the follow-up modernization PR.
  • Broader cleanup and consolidation will land in PR 2.

Test plan

  • npm run type-check clean
  • npm run lint:check clean
  • npm test passes, 612/612
  • npm run build
  • Smoke-tested against staging, workspace 48121, with COMMS_BASE_URL:
    • tdc user
    • tdc workspaces
    • tdc users 48121
    • tdc channels 48121
    • tdc channel threads <id> 48121
    • tdc thread view <id>
    • tdc view <comms-url>
    • tdc inbox 48121
    • tdc conversation unread 48121
    • tdc search smoke --workspace 48121

🤖 Generated with Claude Code

Switches the SDK dependency from the local file: link to the published
registry version, and migrates the CLI to the SDK's new shape.

## What changed

- **SDK source**: `file:../comms-sdk-typescript` → `0.1.0-alpha.1` from npm
- **Batch removed**: replaced every `client.batch(...)` site with direct
  `Promise.all(...)` of individual calls; dropped the `assertBatchData`,
  `buildBatchNameMap`, `getOptionalBatchData`, and
  `buildOptionalBatchNameMap` helpers in `src/lib/api.ts`
- **String IDs**: thread, channel, comment, conversation, message, and
  group IDs are now base58 strings instead of numbers. `parseRef`,
  `resolveThreadId`/`resolveChannelId`/etc, URL parsing regexes, and all
  consumers updated accordingly. User and workspace IDs stay numeric.
- **User schema rename**: `User.name` → `User.fullName`; `User.bot` and
  `User.defaultWorkspace` were removed from the SDK. Default-workspace
  resolution now uses `api.workspaces.getDefaultWorkspace()`. The display
  of `[bot]` was dropped since `userType` no longer carries that signal.
- **Groups API**: every group method (`getGroup`, `updateGroup`,
  `deleteGroup`, `addUsers`, `removeUsers`) now requires `workspaceId`
  alongside the string `id`. Wrappers and callers in `commands/groups/*`
  updated.
- **Away removed**: the SDK dropped `awayMode` / `AWAY_MODE_TYPES`, so
  the `tdc away ...` command tree is removed too. We'll bring it back
  if/when the API surfaces it again.
- **Search v3 → v1**: `src/lib/search-api.ts` now hits `/api/v1/search`
  (was `/api/v3/search`) and uses string channel/conversation IDs.
- **`COMMS_BASE_URL`**: new env var lets users point at staging /
  alternate hosts; threaded through the SDK client and the search-api
  fallback.
- **buildUserNameMap helper**: replaces per-user batch lookups with a
  single `getWorkspaceUsers` call, scoped to the calling client so test
  mocks of `getCommsClient` apply.

## Smoke testing

Verified against staging (workspace 48121) with `COMMS_BASE_URL` set:
`tdc user`, `tdc workspaces`, `tdc users`, `tdc channels`,
`tdc channel threads`, `tdc thread view`, `tdc inbox`, `tdc search`,
`tdc view <url>`, and `tdc conversation unread` all return clean data.
`tdc mentions` 400s on staging because the backend now requires a
`query` arg even when `mention_self=true` — leaving that for PR2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@amix amix requested a review from scottlovegrove May 21, 2026 14:39
@amix amix added the 👀 Show PR PR must be reviewed before or after merging label May 21, 2026
@amix amix marked this pull request as ready for review May 21, 2026 14:39
Regenerating the lockfile on darwin dropped the non-darwin rolldown
optional bindings, so CI on ubuntu couldn't find
`@rolldown/binding-linux-x64-gnu`. Reseeded the lockfile from `main`
and re-resolved only `@doist/comms-sdk`, which keeps all 15 platform
binding entries.

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

@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 update successfully migrates the CLI to the published @doist/comms-sdk alpha, updating entity IDs to strings and replacing legacy batch requests with parallel SDK calls. This modernization keeps the CLI in lock-step with upstream changes and simplifies the underlying data models. There are a few areas to refine, specifically optimizing the user map fetches to avoid loading full workspace directories for single conversations or groups, restoring lazy lookup optimizations, ensuring the AI skill documentation reflects the removal of the away command, and addressing minor test coverage and code deduplication details.

Share FeedbackReview Logs

Comment thread src/commands/away/index.ts
Comment thread src/commands/inbox.ts Outdated
Comment thread src/commands/conversation/conversation.test.ts Outdated
Comment thread src/commands/conversation/helpers.ts
Comment thread src/commands/conversation/view.ts Outdated
Comment thread src/commands/groups/view.ts Outdated
Comment thread src/commands/inbox.test.ts
Comment thread src/commands/conversation/conversation.test.ts
amix and others added 3 commits May 21, 2026 16:59
- Drop the "Away Status" section from `src/lib/skills/content.ts` and
  regenerate `skills/comms-cli/SKILL.md` so the agent skill matches the
  removed command tree.
- Extract `fetchUnreadThreadIds(client, workspaceId)` into
  `src/lib/threads.ts`; `inbox.ts` and `channel/threads.ts` now share
  one place to normalise the SDK's `{ data, version }` unread shape.
- Restore active-first lookup in `findDirectConversation`: only scan
  archived conversations when the active page misses, instead of always
  fetching both pages in parallel.
- `conversation/view.ts` and `groups/view.ts` switch from a workspace-wide
  user fetch to per-ID `getUserById` calls so small reads don't pay for
  the full directory; both fall back to `user:${id}` when a lookup fails.
- Add a regression test for the new `Promise.all` path in `inbox.ts` and a
  graceful-fallback test for `conversation view` when participant lookups
  reject. Move repeated `clearWorkspaceUserCache()` to one top-level
  `beforeEach` in `conversation.test.ts`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a "Staging / alternate hosts" subsection under Setup explaining
how to point the CLI at a non-production Comms instance.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0.2.0 is a release-pipeline bump with no API changes since
0.1.0-alpha.1 — typecheck, tests (615/615), and staging smoke pass
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@amix amix changed the title feat: upgrade to @doist/comms-sdk@0.1.0-alpha.1 feat: upgrade to @doist/comms-sdk@0.2.0 May 21, 2026
@amix amix merged commit ae4d6e1 into main May 21, 2026
7 checks passed
@amix amix deleted the amix/upgrade-comms-sdk branch May 21, 2026 15:57
doist-release-bot Bot added a commit that referenced this pull request May 25, 2026
## 1.0.0 (2026-05-25)

### Features

* add channel create and update commands ([#4](#4)) ([f097378](f097378))
* adopt cli-core DCR provider + account command attachers ([#5](#5)) ([4749a07](4749a07))
* bootstrap Comms CLI from twist-cli ([ea28735](ea28735))
* upgrade to @doist/comms-sdk@0.2.0 ([#2](#2)) ([ae4d6e1](ae4d6e1))
@doist-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.0.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 PR must be reviewed before or after merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants