Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/checks/evidence.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/review-changes/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- <dir>`, then `npm ci` in it, and removes it after.
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/verify/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/update-comms-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:<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`
Expand Down
4 changes: 2 additions & 2 deletions CODEBASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
80 changes: 40 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/auth/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/auth/status.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/create.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/helpers.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/list.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/members.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/membership-helpers.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/set.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { User } from '@doist/comms-sdk'
import type { User } from '@todoist/comms-sdk'
import {
addUsersToChannel,
getCommsClient,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/threads.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/channel/update.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
6 changes: 4 additions & 2 deletions src/commands/conversation/conversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/commands/conversation/helpers.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
16 changes: 9 additions & 7 deletions src/commands/conversation/reply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/conversation/view.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/groups/view.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/inbox.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
4 changes: 2 additions & 2 deletions src/commands/migrate/migrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof import('@doist/comms-sdk')>()),
...(await importActual<typeof import('@todoist/comms-sdk')>()),
fetchNewCommsUrls: sdkMocks.fetchNewCommsUrls,
}))

Expand Down
2 changes: 1 addition & 1 deletion src/commands/migrate/urls.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/commands/status/helpers.ts
Original file line number Diff line number Diff line change
@@ -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. */
Expand Down
Loading
Loading