diff --git a/.agents/checks/evidence.md b/.agents/checks/evidence.md
index 2bad877..2577501 100644
--- a/.agents/checks/evidence.md
+++ b/.agents/checks/evidence.md
@@ -6,7 +6,7 @@ Apply to the PR description and any report from an agent.
- A behaviour claim ("fixed", "works", "safe", "no regressions") with no test or command that ran it.
- A "Not verified" section missing when something could not be checked: the real Comms API, output in a real terminal, the other Node version CI tests on.
-- A change to shared code (`src/lib/`, command registration or global flags in `src/index.ts`, an `@todoist/cli-core` or `@doist/comms-sdk` upgrade) without the one fact that makes it safe.
+- A change to shared code (`src/lib/`, command registration or global flags in `src/index.ts`, an `@todoist/cli-core` or `@todoist/comms-sdk` upgrade) without the one fact that makes it safe.
- A PR title whose type doesn't match the change: behaviour changes need `feat:`, `fix:` or `perf:` to release (`!` for breaking); tooling and docs use `chore:`, `ci:`, `docs:` or `test:` so they don't.
## Fine
diff --git a/.agents/skills/review-changes/SKILL.md b/.agents/skills/review-changes/SKILL.md
index f872b03..2f200b5 100644
--- a/.agents/skills/review-changes/SKILL.md
+++ b/.agents/skills/review-changes/SKILL.md
@@ -18,7 +18,7 @@ Done when the brief is written and the tree holds only the change, with no secre
## 2. Run the reviews in parallel
- **Task review**, always: a fresh subagent with the brief and the diff. It looks for missing pieces, unrequested changes, unhandled cases, tests that would pass with the feature broken, and, in a refactor, any changed test input or assertion. Doistbot can't do this: it never sees the task.
-- **Blast-radius review**, when the change alters code others rely on: `src/lib/` (the client and caches in `src/lib/api.ts` above all), command registration, global flags or argv handling in `src/index.ts`, the `@todoist/cli-core` or `@doist/comms-sdk` version, other `package.json` dependencies, build or CI config. It names the one fact that makes the change safe and proves it by running code. It looks where text search stops: library versions in `package-lock.json`, the shape of API responses, scripts and installed skills reading `--json` output.
+- **Blast-radius review**, when the change alters code others rely on: `src/lib/` (the client and caches in `src/lib/api.ts` above all), command registration, global flags or argv handling in `src/index.ts`, the `@todoist/cli-core` or `@todoist/comms-sdk` version, other `package.json` dependencies, build or CI config. It names the one fact that makes the change safe and proves it by running code. It looks where text search stops: library versions in `package-lock.json`, the shape of API responses, scripts and installed skills reading `--json` output.
- **Code review**: Doistbot if it is set up (below). Otherwise one subagent per relevant check in `.agents/checks/`, each with the brief and that check.
Every brief says: **the shared working tree is read-only.** A reviewer that needs to run or break code makes its own copy with `npm run review:worktree --
`, then `npm ci` in it, and removes it after.
diff --git a/.agents/skills/verify/SKILL.md b/.agents/skills/verify/SKILL.md
index a0ac32e..c2c01bd 100644
--- a/.agents/skills/verify/SKILL.md
+++ b/.agents/skills/verify/SKILL.md
@@ -43,7 +43,7 @@ Rate every claim on this ladder:
Claims about behaviour ("fixed", "works", "safe", "no regressions") need **ran** or higher. A fact the code shows needs **cited**. Anything lower goes under **Not verified**, with why.
-For a change to code others rely on (shared helpers in `src/lib/`, command registration and global flags in `src/index.ts`, an `@todoist/cli-core` or `@doist/comms-sdk` upgrade), name the one fact that makes it safe, and how you proved it.
+For a change to code others rely on (shared helpers in `src/lib/`, command registration and global flags in `src/index.ts`, an `@todoist/cli-core` or `@todoist/comms-sdk` upgrade), name the one fact that makes it safe, and how you proved it.
Report format:
diff --git a/.github/workflows/update-comms-sdk.yml b/.github/workflows/update-comms-sdk.yml
index cbaa7f5..2108235 100644
--- a/.github/workflows/update-comms-sdk.yml
+++ b/.github/workflows/update-comms-sdk.yml
@@ -27,8 +27,8 @@ jobs:
- name: Install current dependencies
run: npm ci
- - name: Update @doist/comms-sdk to latest
- run: npm install @doist/comms-sdk@latest
+ - name: Update @todoist/comms-sdk to latest
+ run: npm install @todoist/comms-sdk@latest
- name: Build
run: npm run build
@@ -46,10 +46,10 @@ jobs:
id: changes
run: |
if git diff --quiet package.json package-lock.json; then
- echo "No updates available - @doist/comms-sdk is already at the latest version"
+ echo "No updates available - @todoist/comms-sdk is already at the latest version"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
- echo "Changes detected - @doist/comms-sdk has been updated"
+ echo "Changes detected - @todoist/comms-sdk has been updated"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
@@ -59,7 +59,7 @@ jobs:
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add package.json package-lock.json
- git commit -m "fix(deps): update to latest \`@doist/comms-sdk\` package"
+ git commit -m "fix(deps): update to latest \`@todoist/comms-sdk\` package"
git push
- name: Trigger release workflow
@@ -74,9 +74,9 @@ jobs:
- name: Report success
run: |
if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
- echo "✅ Successfully updated @doist/comms-sdk package"
+ echo "✅ Successfully updated @todoist/comms-sdk package"
echo "📦 Changes committed to main branch"
echo "🚀 Release workflow triggered - semantic release will create a new patch version"
else
- echo "ℹ️ No updates needed - @doist/comms-sdk is already at the latest version"
+ echo "ℹ️ No updates needed - @todoist/comms-sdk is already at the latest version"
fi
diff --git a/AGENTS.md b/AGENTS.md
index c888e16..e97b230 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -76,7 +76,7 @@ This is a TypeScript CLI (`tdc`) for Comms messaging, built with Commander.js.
**Lib** (`src/lib/`):
-- `api.ts` - Singleton CommsApi client from `@doist/comms-sdk`, workspace/user caching
+- `api.ts` - Singleton CommsApi client from `@todoist/comms-sdk`, workspace/user caching
- `refs.ts` - Reference parsing: accepts IDs (`id:` or bare IDs when unambiguous), Comms URLs, or fuzzy names for workspaces/users/channels/groups
- `output.ts` - JSON/NDJSON formatting with essential field filtering per entity type
- `config.ts` - Persists config to `~/.config/comms-cli/config.json`
diff --git a/CODEBASE.md b/CODEBASE.md
index 1264c8f..be679cf 100644
--- a/CODEBASE.md
+++ b/CODEBASE.md
@@ -7,7 +7,7 @@
## What this project is
`@todoist/comms-cli` is a **TypeScript CLI** for Comms messaging. Binary name:
-`tdc`. It wraps `@doist/comms-sdk` and publishes a single executable
+`tdc`. It wraps `@todoist/comms-sdk` and publishes a single executable
(`dist/index.js`).
ESM-only · Node `^20.19 || >=22.12` · Commander 14 · vitest · oxlint + oxfmt (no
@@ -282,7 +282,7 @@ see a per-command `--user`).
runs the tests. See `docs/agents.md`.
- **Release:** semantic-release on merge to `main`; Conventional Commits required
(enforced by `check-semantic-pull-request.yml`). `update-comms-sdk.yml` keeps
- `@doist/comms-sdk` current.
+ `@todoist/comms-sdk` current.
## Skill content flow
diff --git a/docs/SPEC.md b/docs/SPEC.md
index 93c8cdb..8da1b51 100644
--- a/docs/SPEC.md
+++ b/docs/SPEC.md
@@ -8,7 +8,7 @@ A command-line interface for Comms, following the architecture and patterns esta
- **Language**: TypeScript 5.x (strict mode)
- **CLI Framework**: Commander.js
- **Terminal Styling**: chalk
-- **API Client**: `@doist/comms-sdk`
+- **API Client**: `@todoist/comms-sdk`
- **Testing**: vitest
- **Formatting**: prettier
- **Git Hooks**: lefthook
diff --git a/package-lock.json b/package-lock.json
index cce2721..48a50f1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,9 +10,9 @@
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
- "@doist/comms-sdk": "3.11.0",
"@pnpm/tabtab": "0.5.4",
"@todoist/cli-core": "2.0.0",
+ "@todoist/comms-sdk": "5.0.0",
"chalk": "5.6.2",
"commander": "14.0.3",
"marked": "18.0.3",
@@ -135,45 +135,6 @@
"node": ">=0.1.90"
}
},
- "node_modules/@doist/comms-sdk": {
- "version": "3.11.0",
- "resolved": "https://registry.npmjs.org/@doist/comms-sdk/-/comms-sdk-3.11.0.tgz",
- "integrity": "sha512-xbiIYaiGe9FN5wWekF8Dbcwh6NrbESnJMxADj8vJGeauZboVd8UkM87bnJ5btxepyB6h0MAR4FFk2n3218eRdQ==",
- "license": "MIT",
- "dependencies": {
- "@doist/sdk-kmp": "0.6.0",
- "camelcase": "9.0.0",
- "ts-custom-error": "3.3.1",
- "undici": "8.12.3",
- "uuid": "11.1.1",
- "zod": "4.6.6"
- },
- "engines": {
- "node": ">=24",
- "npm": ">=11"
- }
- },
- "node_modules/@doist/comms-sdk/node_modules/camelcase": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-9.0.0.tgz",
- "integrity": "sha512-TO9xmyXTZ9HUHI8M1OnvExxYB0eYVS/1e5s7IDMTAoIcwUd+aNcFODs6Xk83mobk0velyHFQgA1yIrvYc6wclw==",
- "license": "MIT",
- "engines": {
- "node": ">=20"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
- "node_modules/@doist/comms-sdk/node_modules/undici": {
- "version": "8.12.3",
- "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.3.tgz",
- "integrity": "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==",
- "license": "MIT",
- "engines": {
- "node": ">=22.19.0"
- }
- },
"node_modules/@doist/sdk-kmp": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@doist/sdk-kmp/-/sdk-kmp-0.6.0.tgz",
@@ -2755,6 +2716,45 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/@todoist/comms-sdk": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/@todoist/comms-sdk/-/comms-sdk-5.0.0.tgz",
+ "integrity": "sha512-5MoNSFLooRKvjzYfqYckY3r1+6V4R2uho4tSrUmTHMG80XVoICiBD5aCh5XIMjzV40AU6sbBUcvDXgfyAL7IoA==",
+ "license": "MIT",
+ "dependencies": {
+ "@doist/sdk-kmp": "0.6.0",
+ "camelcase": "9.0.0",
+ "ts-custom-error": "3.3.1",
+ "undici": "8.12.3",
+ "uuid": "11.1.1",
+ "zod": "4.6.6"
+ },
+ "engines": {
+ "node": ">=24",
+ "npm": ">=11"
+ }
+ },
+ "node_modules/@todoist/comms-sdk/node_modules/camelcase": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-9.0.0.tgz",
+ "integrity": "sha512-TO9xmyXTZ9HUHI8M1OnvExxYB0eYVS/1e5s7IDMTAoIcwUd+aNcFODs6Xk83mobk0velyHFQgA1yIrvYc6wclw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@todoist/comms-sdk/node_modules/undici": {
+ "version": "8.12.3",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.3.tgz",
+ "integrity": "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=22.19.0"
+ }
+ },
"node_modules/@tokenizer/inflate": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz",
diff --git a/package.json b/package.json
index d3417b4..87ae73b 100644
--- a/package.json
+++ b/package.json
@@ -54,9 +54,9 @@
"CHANGELOG.md"
],
"dependencies": {
- "@doist/comms-sdk": "3.11.0",
"@pnpm/tabtab": "0.5.4",
"@todoist/cli-core": "2.0.0",
+ "@todoist/comms-sdk": "5.0.0",
"chalk": "5.6.2",
"commander": "14.0.3",
"marked": "18.0.3",
diff --git a/src/commands/auth/auth.test.ts b/src/commands/auth/auth.test.ts
index 52bd1fe..5b5a409 100644
--- a/src/commands/auth/auth.test.ts
+++ b/src/commands/auth/auth.test.ts
@@ -104,8 +104,8 @@ import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { createInterface, type Interface } from 'node:readline'
-import { CommsRequestError, type User } from '@doist/comms-sdk'
import { attachLoginCommand, type AuthProvider } from '@todoist/cli-core/auth'
+import { CommsRequestError, type User } from '@todoist/comms-sdk'
import { createWrappedCommsClient } from '../../lib/api.js'
import { type CommsAccount, type CommsTokenStore } from '../../lib/auth-provider.js'
import { getTokenRefreshOptions, TOKEN_ENV_VAR } from '../../lib/auth.js'
diff --git a/src/commands/auth/status.ts b/src/commands/auth/status.ts
index e819995..b825ece 100644
--- a/src/commands/auth/status.ts
+++ b/src/commands/auth/status.ts
@@ -1,5 +1,5 @@
-import { CommsRequestError, type User } from '@doist/comms-sdk'
import { attachStatusCommand } from '@todoist/cli-core/auth'
+import { CommsRequestError, type User } from '@todoist/comms-sdk'
import chalk from 'chalk'
import type { Command } from 'commander'
import { createWrappedCommsClient } from '../../lib/api.js'
diff --git a/src/commands/channel/create.ts b/src/commands/channel/create.ts
index 6158cb2..4a36daa 100644
--- a/src/commands/channel/create.ts
+++ b/src/commands/channel/create.ts
@@ -1,4 +1,4 @@
-import type { CreateChannelArgs } from '@doist/comms-sdk'
+import type { CreateChannelArgs } from '@todoist/comms-sdk'
import { getCommsClient } from '../../lib/api.js'
import type { MutationOptions } from '../../lib/options.js'
import { formatJson, printDryRun } from '../../lib/output.js'
diff --git a/src/commands/channel/helpers.ts b/src/commands/channel/helpers.ts
index 6d1cd72..f92a360 100644
--- a/src/commands/channel/helpers.ts
+++ b/src/commands/channel/helpers.ts
@@ -1,4 +1,4 @@
-import type { Channel } from '@doist/comms-sdk'
+import type { Channel } from '@todoist/comms-sdk'
import { getCommsClient, getCurrentWorkspaceId } from '../../lib/api.js'
import { CliError } from '../../lib/errors.js'
import {
diff --git a/src/commands/channel/list.ts b/src/commands/channel/list.ts
index d788c91..66427b0 100644
--- a/src/commands/channel/list.ts
+++ b/src/commands/channel/list.ts
@@ -1,5 +1,5 @@
-import type { Channel } from '@doist/comms-sdk'
import { outputIds, printEmpty, resolveOutputMode } from '@todoist/cli-core'
+import type { Channel } from '@todoist/comms-sdk'
import { getCommsClient } from '../../lib/api.js'
import { CliError } from '../../lib/errors.js'
import { includePrivateChannels } from '../../lib/global-args.js'
diff --git a/src/commands/channel/members.ts b/src/commands/channel/members.ts
index ea24279..aee1f18 100644
--- a/src/commands/channel/members.ts
+++ b/src/commands/channel/members.ts
@@ -1,5 +1,5 @@
-import { isRestrictedWorkspaceUser } from '@doist/comms-sdk'
import { outputIds, resolveOutputMode } from '@todoist/cli-core'
+import { isRestrictedWorkspaceUser } from '@todoist/comms-sdk'
import { getCurrentWorkspaceId, getWorkspaceGroups } from '../../lib/api.js'
import type { ViewOptions } from '../../lib/options.js'
import { colors, formatJson, formatNdjson, pluralize } from '../../lib/output.js'
diff --git a/src/commands/channel/membership-helpers.ts b/src/commands/channel/membership-helpers.ts
index a511969..ea1969a 100644
--- a/src/commands/channel/membership-helpers.ts
+++ b/src/commands/channel/membership-helpers.ts
@@ -1,4 +1,4 @@
-import type { Channel, Group, VisibleWorkspaceUser } from '@doist/comms-sdk'
+import type { Channel, Group, VisibleWorkspaceUser } from '@todoist/comms-sdk'
import {
addUsersToChannel,
getCommsClient,
diff --git a/src/commands/channel/set.ts b/src/commands/channel/set.ts
index b886640..ee3adef 100644
--- a/src/commands/channel/set.ts
+++ b/src/commands/channel/set.ts
@@ -1,4 +1,4 @@
-import type { User } from '@doist/comms-sdk'
+import type { User } from '@todoist/comms-sdk'
import {
addUsersToChannel,
getCommsClient,
diff --git a/src/commands/channel/threads.ts b/src/commands/channel/threads.ts
index 3c0bddf..54ccd5a 100644
--- a/src/commands/channel/threads.ts
+++ b/src/commands/channel/threads.ts
@@ -1,6 +1,6 @@
import { createHash } from 'node:crypto'
-import type { ArchiveFilter, CommsApi, GetThreadsArgs, Thread } from '@doist/comms-sdk'
import { outputIds, resolveOutputMode } from '@todoist/cli-core'
+import type { ArchiveFilter, CommsApi, GetThreadsArgs, Thread } from '@todoist/comms-sdk'
import chalk from 'chalk'
import { getCommsClient, getCurrentWorkspaceId } from '../../lib/api.js'
import { formatRelativeDate } from '../../lib/dates.js'
diff --git a/src/commands/channel/update.ts b/src/commands/channel/update.ts
index 5bd2e12..ca45f2e 100644
--- a/src/commands/channel/update.ts
+++ b/src/commands/channel/update.ts
@@ -1,4 +1,4 @@
-import type { UpdateChannelArgs } from '@doist/comms-sdk'
+import type { UpdateChannelArgs } from '@todoist/comms-sdk'
import { getCommsClient } from '../../lib/api.js'
import { CliError } from '../../lib/errors.js'
import type { MutationOptions } from '../../lib/options.js'
diff --git a/src/commands/conversation/conversation.test.ts b/src/commands/conversation/conversation.test.ts
index f27f5b1..a6b6b97 100644
--- a/src/commands/conversation/conversation.test.ts
+++ b/src/commands/conversation/conversation.test.ts
@@ -173,7 +173,9 @@ const createProgram = () => createTestProgram(registerConversationCommand)
// Shared setup for the --file suite: a fresh mock client wired into getCommsClient
// plus a program. Tests asserting on output call captureConsole('log') themselves.
function setupFileTest() {
- const client = createClient({})
+ const client = createClient({
+ activeConversations: [createConversation(42, [1, 2], '2026-03-08T10:00:00.000Z')],
+ })
apiMocks.getCommsClient.mockResolvedValue(client)
return { client, program: createProgram() }
}
@@ -1412,7 +1414,7 @@ describe('conversation reply --file', () => {
expect(client.attachments.upload).toHaveBeenCalledTimes(1)
expect(client.attachments.upload).toHaveBeenCalledWith(
- expect.objectContaining({ fileName: 'photo.png' }),
+ expect.objectContaining({ fileName: 'photo.png', workspaceId: 1 }),
)
expect(client.conversationMessages.createMessage).toHaveBeenCalledWith(
expect.objectContaining({
diff --git a/src/commands/conversation/helpers.ts b/src/commands/conversation/helpers.ts
index c10297a..ba49c7a 100644
--- a/src/commands/conversation/helpers.ts
+++ b/src/commands/conversation/helpers.ts
@@ -1,5 +1,5 @@
-import type { Conversation } from '@doist/comms-sdk'
import { outputIds, printEmpty, resolveOutputMode } from '@todoist/cli-core'
+import type { Conversation } from '@todoist/comms-sdk'
import chalk from 'chalk'
import { buildUserNameMap, getCommsClient } from '../../lib/api.js'
import { formatRelativeDate } from '../../lib/dates.js'
diff --git a/src/commands/conversation/reply.ts b/src/commands/conversation/reply.ts
index 4947991..6626080 100644
--- a/src/commands/conversation/reply.ts
+++ b/src/commands/conversation/reply.ts
@@ -48,13 +48,15 @@ export async function replyToConversation(
const client = await getCommsClient()
- // Preflight the target before uploading so an invalid or forbidden
- // conversation fails fast instead of leaving an orphaned upload behind.
- if (hasFiles) {
- await client.conversations.getConversation(conversationId)
- }
-
- const attachments = hasFiles ? await uploadAttachments(files) : undefined
+ // Fetch the target before uploading: an invalid or forbidden conversation
+ // fails fast instead of leaving an orphaned upload behind, and the upload
+ // goes to the conversation's own workspace.
+ const attachments = hasFiles
+ ? await uploadAttachments(
+ files,
+ (await client.conversations.getConversation(conversationId)).workspaceId,
+ )
+ : undefined
const message = await client.conversationMessages.createMessage({
conversationId,
content: messageContent,
diff --git a/src/commands/conversation/view.ts b/src/commands/conversation/view.ts
index 9da6504..648c98d 100644
--- a/src/commands/conversation/view.ts
+++ b/src/commands/conversation/view.ts
@@ -1,4 +1,4 @@
-import type { CommsApi, VisibleWorkspaceUser } from '@doist/comms-sdk'
+import type { CommsApi, VisibleWorkspaceUser } from '@todoist/comms-sdk'
import chalk from 'chalk'
import { getCommsClient } from '../../lib/api.js'
import { formatRelativeDate } from '../../lib/dates.js'
diff --git a/src/commands/groups/view.ts b/src/commands/groups/view.ts
index 2831b98..d79bdcb 100644
--- a/src/commands/groups/view.ts
+++ b/src/commands/groups/view.ts
@@ -1,4 +1,4 @@
-import { isRestrictedWorkspaceUser, type VisibleWorkspaceUser } from '@doist/comms-sdk'
+import { isRestrictedWorkspaceUser, type VisibleWorkspaceUser } from '@todoist/comms-sdk'
import { getCommsClient, getCurrentWorkspaceId } from '../../lib/api.js'
import type { ViewOptions } from '../../lib/options.js'
import { colors, formatJson, formatNdjson, pluralize } from '../../lib/output.js'
diff --git a/src/commands/inbox.ts b/src/commands/inbox.ts
index 451eaa2..5cdd546 100644
--- a/src/commands/inbox.ts
+++ b/src/commands/inbox.ts
@@ -1,5 +1,5 @@
-import type { ArchiveFilter } from '@doist/comms-sdk'
import { outputIds, printEmpty, resolveOutputMode } from '@todoist/cli-core'
+import type { ArchiveFilter } from '@todoist/comms-sdk'
import chalk from 'chalk'
import { Command, Option } from 'commander'
import { getCommsClient, getCurrentWorkspaceId } from '../lib/api.js'
diff --git a/src/commands/migrate/migrate.test.ts b/src/commands/migrate/migrate.test.ts
index 209c7db..ebd6b3e 100644
--- a/src/commands/migrate/migrate.test.ts
+++ b/src/commands/migrate/migrate.test.ts
@@ -5,9 +5,9 @@ const sdkMocks = vi.hoisted(() => ({
fetchNewCommsUrls: vi.fn(),
}))
-vi.mock('@doist/comms-sdk', async (importActual) => ({
+vi.mock('@todoist/comms-sdk', async (importActual) => ({
// errors.ts reads helpers from the SDK, so only the network call is faked.
- ...(await importActual()),
+ ...(await importActual()),
fetchNewCommsUrls: sdkMocks.fetchNewCommsUrls,
}))
diff --git a/src/commands/migrate/urls.ts b/src/commands/migrate/urls.ts
index d4dc078..a364784 100644
--- a/src/commands/migrate/urls.ts
+++ b/src/commands/migrate/urls.ts
@@ -1,4 +1,4 @@
-import { type CommsRequestError, fetchNewCommsUrls } from '@doist/comms-sdk'
+import { type CommsRequestError, fetchNewCommsUrls } from '@todoist/comms-sdk'
import { CliError } from '../../lib/errors.js'
import { readContent } from '../../lib/input.js'
import type { StdinOptions } from '../../lib/options.js'
diff --git a/src/commands/status/helpers.ts b/src/commands/status/helpers.ts
index c62cedb..f9dfdb1 100644
--- a/src/commands/status/helpers.ts
+++ b/src/commands/status/helpers.ts
@@ -1,4 +1,4 @@
-import type { User } from '@doist/comms-sdk'
+import type { User } from '@todoist/comms-sdk'
import { formatJson } from '../../lib/output.js'
/** The `{ status }` payload, or the whole user with `--full`, as every status command prints it. */
diff --git a/src/commands/status/set.ts b/src/commands/status/set.ts
index 72508de..39b9b8c 100644
--- a/src/commands/status/set.ts
+++ b/src/commands/status/set.ts
@@ -1,4 +1,4 @@
-import type { SetStatusArgs } from '@doist/comms-sdk'
+import type { SetStatusArgs } from '@todoist/comms-sdk'
import { getCommsClient } from '../../lib/api.js'
import { formatDateTime, parseLocalDate } from '../../lib/dates.js'
import { parseDuration } from '../../lib/duration.js'
diff --git a/src/commands/thread/create.ts b/src/commands/thread/create.ts
index f7a4004..276a8fe 100644
--- a/src/commands/thread/create.ts
+++ b/src/commands/thread/create.ts
@@ -81,7 +81,7 @@ export async function createThread(
return
}
- const attachments = hasFiles ? await uploadAttachments(files) : undefined
+ const attachments = hasFiles ? await uploadAttachments(files, channel.workspaceId) : undefined
const thread = await client.threads.createThread({
channelId,
diff --git a/src/commands/thread/helpers.ts b/src/commands/thread/helpers.ts
index 98e3ca6..8a6012d 100644
--- a/src/commands/thread/helpers.ts
+++ b/src/commands/thread/helpers.ts
@@ -1,4 +1,4 @@
-import type { CommsApi, Thread } from '@doist/comms-sdk'
+import type { CommsApi, Thread } from '@todoist/comms-sdk'
import chalk from 'chalk'
import { getCommsClient, getWorkspaceGroups, getWorkspaceUsers } from '../../lib/api.js'
import { formatRelativeDate } from '../../lib/dates.js'
diff --git a/src/commands/thread/read.ts b/src/commands/thread/read.ts
index a8b42da..ba78d67 100644
--- a/src/commands/thread/read.ts
+++ b/src/commands/thread/read.ts
@@ -1,4 +1,4 @@
-import type { Thread } from '@doist/comms-sdk'
+import type { Thread } from '@todoist/comms-sdk'
import type { MutationOptions, StdinOptions } from '../../lib/options.js'
import { runThreadReadStateMutation } from './helpers.js'
diff --git a/src/commands/thread/reply.ts b/src/commands/thread/reply.ts
index 1397c8f..0dc1381 100644
--- a/src/commands/thread/reply.ts
+++ b/src/commands/thread/reply.ts
@@ -100,7 +100,7 @@ export async function replyToThread(
return
}
- const attachments = hasFiles ? await uploadAttachments(files) : undefined
+ const attachments = hasFiles ? await uploadAttachments(files, thread.workspaceId) : undefined
const notificationFields = notifyNone
? { groups: [], directMentions: [], directGroupMentions: [] }
: resolved?.groups
diff --git a/src/commands/thread/thread.test.ts b/src/commands/thread/thread.test.ts
index cbca100..2141eb6 100644
--- a/src/commands/thread/thread.test.ts
+++ b/src/commands/thread/thread.test.ts
@@ -1,13 +1,13 @@
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
-import { CommsApi, type CustomFetch, generateId } from '@doist/comms-sdk'
import {
captureConsole,
captureStream,
createTestProgram,
mockStdin,
} from '@todoist/cli-core/testing'
+import { CommsApi, type CustomFetch, generateId } from '@todoist/comms-sdk'
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'
const apiMocks = vi.hoisted(() => ({
@@ -2354,7 +2354,7 @@ describe('thread reply --file', () => {
expect(client.attachments.upload).toHaveBeenCalledTimes(1)
expect(client.attachments.upload).toHaveBeenCalledWith(
- expect.objectContaining({ fileName: 'diagram.png' }),
+ expect.objectContaining({ fileName: 'diagram.png', workspaceId: 10 }),
)
expect(client.comments.createComment).toHaveBeenCalledWith(
expect.objectContaining({
@@ -2489,6 +2489,9 @@ describe('thread create --file', () => {
])
expect(client.attachments.upload).toHaveBeenCalledTimes(2)
+ expect(client.attachments.upload).toHaveBeenCalledWith(
+ expect.objectContaining({ workspaceId: 10 }),
+ )
const args = client.threads.createThread.mock.calls[0][0] as {
title: string
content: string
diff --git a/src/commands/thread/unread.ts b/src/commands/thread/unread.ts
index dc70a17..d789863 100644
--- a/src/commands/thread/unread.ts
+++ b/src/commands/thread/unread.ts
@@ -1,4 +1,4 @@
-import type { CommsApi } from '@doist/comms-sdk'
+import type { CommsApi } from '@todoist/comms-sdk'
import { CliError } from '../../lib/errors.js'
import type { MutationOptions, StdinOptions } from '../../lib/options.js'
import { resolveCommentId } from '../../lib/refs.js'
diff --git a/src/commands/thread/view.ts b/src/commands/thread/view.ts
index f677198..6f81aa0 100644
--- a/src/commands/thread/view.ts
+++ b/src/commands/thread/view.ts
@@ -1,4 +1,4 @@
-import type { CommsApi } from '@doist/comms-sdk'
+import type { CommsApi } from '@todoist/comms-sdk'
import chalk from 'chalk'
import { buildUserNameMap, getCommsClient } from '../../lib/api.js'
import { formatRelativeDate } from '../../lib/dates.js'
diff --git a/src/lib/api.test.ts b/src/lib/api.test.ts
index 2320335..78299ea 100644
--- a/src/lib/api.test.ts
+++ b/src/lib/api.test.ts
@@ -1,4 +1,4 @@
-import { CommsRequestError } from '@doist/comms-sdk'
+import { CommsRequestError } from '@todoist/comms-sdk'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import packageJson from '../../package.json' with { type: 'json' }
@@ -14,10 +14,10 @@ const sdkMocks = vi.hoisted(() => ({
addGroupUsers: vi.fn(),
}))
-vi.mock('@doist/comms-sdk', async (importActual) => {
+vi.mock('@todoist/comms-sdk', async (importActual) => {
// Only the client is faked. The error class and the helpers that inspect it
// stay real, because the status mapping under test depends on them agreeing.
- const actual = await importActual()
+ const actual = await importActual()
class CommsApi {
channels = { deleteChannel: sdkMocks.deleteChannel }
attachments = { upload: sdkMocks.uploadAttachment }
@@ -214,7 +214,11 @@ describe('wrapResult — central 403 translation', () => {
const client = createWrappedCommsClient('test-token')
await expect(
- client.attachments.upload({ file: new Blob(['x']), fileName: 'x.png' }),
+ client.attachments.upload({
+ file: new Blob(['x']),
+ fileName: 'x.png',
+ workspaceId: 42,
+ }),
).rejects.toMatchObject({
code: 'INSUFFICIENT_SCOPE',
message: 'This action requires permissions your current token does not have.',
@@ -232,7 +236,11 @@ describe('wrapResult — central 403 translation', () => {
const client = createWrappedCommsClient('test-token')
await expect(
- client.attachments.upload({ file: new Blob(['x']), fileName: 'x.png' }),
+ client.attachments.upload({
+ file: new Blob(['x']),
+ fileName: 'x.png',
+ workspaceId: 42,
+ }),
).rejects.toThrow('READ_ONLY')
// The SDK upload must never fire when the write-guard rejects.
expect(sdkMocks.uploadAttachment).not.toHaveBeenCalled()
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 0610801..bed6a71 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -8,7 +8,7 @@ import {
type User,
type Workspace,
type WorkspaceUser,
-} from '@doist/comms-sdk'
+} from '@todoist/comms-sdk'
import { getApiTokenSnapshot } from './auth.js'
import { getConfig, updateConfig } from './config.js'
import {
diff --git a/src/lib/attachments.test.ts b/src/lib/attachments.test.ts
index 7a2ac5d..d384273 100644
--- a/src/lib/attachments.test.ts
+++ b/src/lib/attachments.test.ts
@@ -51,9 +51,19 @@ describe('uploadAttachments', () => {
const client = createClient()
apiMocks.getCommsClient.mockResolvedValue(client)
- const result = await uploadAttachments([fileA, fileB])
+ const result = await uploadAttachments([fileA, fileB], 42)
expect(client.attachments.upload).toHaveBeenCalledTimes(2)
+ expect(client.attachments.upload).toHaveBeenNthCalledWith(1, {
+ file: expect.any(Blob),
+ fileName: 'a.png',
+ workspaceId: 42,
+ })
+ expect(client.attachments.upload).toHaveBeenNthCalledWith(2, {
+ file: expect.any(Blob),
+ fileName: 'b.pdf',
+ workspaceId: 42,
+ })
expect(result.map((a) => a.fileName)).toEqual(['a.png', 'b.pdf'])
})
@@ -62,7 +72,7 @@ describe('uploadAttachments', () => {
apiMocks.getCommsClient.mockResolvedValue(client)
await expect(
- uploadAttachments([fileA, join(tmpDir, 'missing.png'), fileB]),
+ uploadAttachments([fileA, join(tmpDir, 'missing.png'), fileB], 42),
).rejects.toMatchObject({ code: 'FILE_NOT_FOUND' })
expect(client.attachments.upload).not.toHaveBeenCalled()
diff --git a/src/lib/attachments.ts b/src/lib/attachments.ts
index 08fd1f4..14873f8 100644
--- a/src/lib/attachments.ts
+++ b/src/lib/attachments.ts
@@ -1,4 +1,4 @@
-import type { Attachment } from '@doist/comms-sdk'
+import type { Attachment } from '@todoist/comms-sdk'
import { getCommsClient } from './api.js'
import { openLocalFileAsBlob } from './local-file.js'
@@ -36,22 +36,28 @@ export async function validateAttachmentFiles(files: string[]): Promise {
}
/**
- * Upload one or more local files and return the created {@link Attachment}s,
- * ready to splice into the `attachments` array of `comments.createComment`,
- * `conversationMessages.createMessage`, or `threads.createThread`.
+ * Upload one or more local files to `workspaceId` and return the created
+ * {@link Attachment}s, ready to splice into the `attachments` array of
+ * `comments.createComment`, `conversationMessages.createMessage`, or
+ * `threads.createThread`. Pass the workspace of the thread, channel or
+ * conversation the files will be attached to: the API requires it, and its
+ * plan sets the largest file it accepts.
*
* All paths are validated (existence + readability) up front, before any
* upload starts, so a bad path fails fast without leaving a partial set of
* uploaded-but-unreferenced attachments behind. Uploads then run with bounded
* concurrency while the returned array preserves the input order.
*/
-export async function uploadAttachments(files: string[]): Promise {
+export async function uploadAttachments(
+ files: string[],
+ workspaceId: number,
+): Promise {
// Validate every path first so a bad one fails before we upload anything.
const opened = await Promise.all(files.map((file) => openLocalFileAsBlob({ file })))
const client = await getCommsClient()
return mapWithConcurrency(opened, MAX_UPLOAD_CONCURRENCY, ({ blob, fileName }) =>
- client.attachments.upload({ file: blob, fileName }),
+ client.attachments.upload({ file: blob, fileName, workspaceId }),
)
}
diff --git a/src/lib/errors.test.ts b/src/lib/errors.test.ts
index 5d20fda..fb05f05 100644
--- a/src/lib/errors.test.ts
+++ b/src/lib/errors.test.ts
@@ -1,4 +1,4 @@
-import { CommsRequestError } from '@doist/comms-sdk'
+import { CommsRequestError } from '@todoist/comms-sdk'
import { describe, expect, it } from 'vitest'
import {
diff --git a/src/lib/errors.ts b/src/lib/errors.ts
index 264bb38..e880d6e 100644
--- a/src/lib/errors.ts
+++ b/src/lib/errors.ts
@@ -1,5 +1,5 @@
-import { CommsRequestError, getCommsErrorString } from '@doist/comms-sdk'
import { CliError as BaseCliError, type CliErrorCode, type ErrorType } from '@todoist/cli-core'
+import { CommsRequestError, getCommsErrorString } from '@todoist/comms-sdk'
export { BaseCliError }
export type { ErrorType } from '@todoist/cli-core'
diff --git a/src/lib/refs.ts b/src/lib/refs.ts
index 921ddc4..5ba65d6 100644
--- a/src/lib/refs.ts
+++ b/src/lib/refs.ts
@@ -4,7 +4,7 @@ import {
isValidUuidV7Base58,
parseCommsURL,
type Workspace,
-} from '@doist/comms-sdk'
+} from '@todoist/comms-sdk'
import { fetchWorkspaces, getGroup, getWorkspaceGroups, getCommsClient } from './api.js'
import { CliError, type ErrorCode, isCliErrorCode } from './errors.js'
diff --git a/src/lib/search-api.test.ts b/src/lib/search-api.test.ts
index 5e2c351..d4c7816 100644
--- a/src/lib/search-api.test.ts
+++ b/src/lib/search-api.test.ts
@@ -1,4 +1,4 @@
-import { DEFAULT_API_VERSION } from '@doist/comms-sdk'
+import { DEFAULT_API_VERSION } from '@todoist/comms-sdk'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import packageJson from '../../package.json' with { type: 'json' }
diff --git a/src/lib/search-api.ts b/src/lib/search-api.ts
index 6bd6964..ac16f67 100644
--- a/src/lib/search-api.ts
+++ b/src/lib/search-api.ts
@@ -1,4 +1,4 @@
-import { DEFAULT_API_VERSION, type SearchResult } from '@doist/comms-sdk'
+import { DEFAULT_API_VERSION, type SearchResult } from '@todoist/comms-sdk'
import { getApiTokenSnapshot } from './auth.js'
import { CliError } from './errors.js'
import { usageTracking } from './usage-tracking.js'
diff --git a/src/lib/search-helpers.ts b/src/lib/search-helpers.ts
index 8b90abe..f4e39cd 100644
--- a/src/lib/search-helpers.ts
+++ b/src/lib/search-helpers.ts
@@ -1,4 +1,4 @@
-import { getFullCommsURL, type SearchResult } from '@doist/comms-sdk'
+import { getFullCommsURL, type SearchResult } from '@todoist/comms-sdk'
import { Command, Option } from 'commander'
import { getCurrentWorkspaceId } from './api.js'
import { withCaseInsensitiveChoices } from './completion.js'
diff --git a/src/lib/status.ts b/src/lib/status.ts
index 48bf25a..9bf0599 100644
--- a/src/lib/status.ts
+++ b/src/lib/status.ts
@@ -1,4 +1,4 @@
-import type { UserStatus } from '@doist/comms-sdk'
+import type { UserStatus } from '@todoist/comms-sdk'
import { formatDateTime } from './dates.js'
/** One line for a status: emoji and message, then the expiry and the pause when they apply. */
diff --git a/src/lib/threads.ts b/src/lib/threads.ts
index 40208af..8f85f5e 100644
--- a/src/lib/threads.ts
+++ b/src/lib/threads.ts
@@ -1,4 +1,4 @@
-import type { CommsApi, UnreadThread } from '@doist/comms-sdk'
+import type { CommsApi, UnreadThread } from '@todoist/comms-sdk'
export type UnreadThreadMap = Map
diff --git a/src/lib/usage-tracking.test.ts b/src/lib/usage-tracking.test.ts
index 8274a19..e047e36 100644
--- a/src/lib/usage-tracking.test.ts
+++ b/src/lib/usage-tracking.test.ts
@@ -13,8 +13,8 @@ type RecordedRequest = { method: string; headers: Record }
const sdk = vi.hoisted(() => ({ requests: [] as RecordedRequest[] }))
-vi.mock('@doist/comms-sdk', async (importActual) => {
- const actual = await importActual()
+vi.mock('@todoist/comms-sdk', async (importActual) => {
+ const actual = await importActual()
type HeadersOption = Record | (() => Record)
// Every method records the headers the real SDK would send with that one
// request (it calls a `headers` function once per request), then fails, so