@todoist/automations-cli 0.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,45 +1,704 @@
1
- # @todoist/automations-cli
1
+ # `tda`
2
2
 
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
3
+ Terminal client for Todoist Automations. It can inspect and manage automations, drafts,
4
+ conversations, and runs, and it uses the same persisted agent conversations and client-managed tools
5
+ as the Automations frontend.
4
6
 
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
7
+ The agent can create and edit automations, inspect existing automations and runs, troubleshoot
8
+ failures, and answer other automation-related questions. The CLI sends the initial message unchanged;
9
+ it does not assume that every conversation is an authoring request.
6
10
 
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
11
+ ## Installing
8
12
 
9
- ## Purpose
13
+ ```bash
14
+ npm install -g @todoist/automations-cli
15
+ ```
10
16
 
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@todoist/automations-cli`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
17
+ Versions before 2.0.0 were published as `@doist/automations-cli`. Both install `tda`, so run
18
+ `npm uninstall -g @doist/automations-cli` before installing the new name.
15
19
 
16
- ## What is OIDC Trusted Publishing?
20
+ Once installed, upgrade with `tda update`, or `tda update --check` to see what is available without
21
+ installing anything. Releases are published under the `latest` dist tag and no other, so there is no
22
+ release channel to choose. Re-running the install command above works just as well.
17
23
 
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
24
+ Signing in still needs an account with Automations access, so installing the CLI on its own grants
25
+ nothing.
19
26
 
20
- ## Setup Instructions
27
+ ## Local development
21
28
 
22
- To properly configure OIDC trusted publishing for this package:
29
+ From the monorepo root, install dependencies and create the global link once:
23
30
 
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
31
+ ```bash
32
+ npm install
33
+ npm run setup:cli
34
+ ```
28
35
 
29
- ## DO NOT USE THIS PACKAGE
36
+ This builds the shared workspace packages and CLI, then creates an npm link for the `tda` executable.
37
+ The link is persistent. After editing `apps/cli/src`, rebuild only the CLI:
30
38
 
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
39
+ ```bash
40
+ npm run build:cli
41
+ ```
36
42
 
37
- ## More Information
43
+ For active development, keep the bundler running instead:
38
44
 
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
45
+ ```bash
46
+ npm run dev:cli
47
+ ```
42
48
 
43
- ---
49
+ Both commands update the linked executable without recreating the link. A linked build reports its
50
+ version as `0.0.0-development`, since the real number is written at publish time, so
51
+ `tda update --check` always claims an update is available; rebuild the link rather than running
52
+ `tda update`, which would replace it with a global install. Run `npm run build:core`
53
+ after editing a shared package. Run `npm unlink --global @todoist/automations-cli` to remove the link.
44
54
 
45
- **Maintained for OIDC setup purposes only**
55
+ A global install and a link cannot both own `tda`, so uninstall the published package first if you
56
+ have one.
57
+
58
+ ## Changing the icon
59
+
60
+ The icon on the OAuth consent screen is `icons/service_automations-cli_color_192px.png`, published to the CDN on merge. See [docs/icon.md](docs/icon.md).
61
+
62
+ ## Releases
63
+
64
+ `@todoist/automations-cli` is published from `main` by
65
+ [`.github/workflows/release-cli.yml`](../../.github/workflows/release-cli.yml), which runs
66
+ semantic-release with the configuration in [`release.config.js`](./release.config.js). The version
67
+ comes from the conventional-commit messages of the commits that count towards the CLI, so nothing
68
+ has to be bumped by hand and the repository holds no version number of its own. The same commits
69
+ make up the release notes and the Comms announcement.
70
+
71
+ The workspace libraries the CLI uses are not published, so `npm run build` compiles them into
72
+ `dist/` rather than resolving them at install time. Only the packages listed under `dependencies`
73
+ are left external. Any change here counts, except tests, docs and `package.json` fields that don't
74
+ change what gets installed. `packages/sdk`, `packages/core` and `packages/bitmapist` are shared with
75
+ the backend and the web app, so a change confined to them counts only when its commit is scoped
76
+ `cli` or `sdk`. Any other change there still ships, with the next release. See
77
+ [Published packages](../../docs/standards/commit-guidelines.md#published-packages) for how to split
78
+ pull requests so each change lands in the right release.
79
+
80
+ Once linked, `tda skill install claude-code` gives your coding agent instructions for driving the
81
+ CLI. See [Agent skill](#agent-skill).
82
+
83
+ ## Authentication
84
+
85
+ Sign in with your Todoist account:
86
+
87
+ ```bash
88
+ tda auth login
89
+ ```
90
+
91
+ This opens a browser, asks Todoist to authorize the CLI, and stores the resulting token in your
92
+ operating system credential manager. `tda auth status` shows which account is signed in, and
93
+ `tda auth logout` removes the credential and tells Todoist to revoke it.
94
+
95
+ The token is minted for Automations specifically rather than for Todoist as a whole, so it grants
96
+ access to your automations and not to your tasks, projects or comments. The exceptions are the two
97
+ identity scopes it also asks for, `user:read` and `workspaces:read`, which reach the parts of
98
+ Todoist that are shared across products rather than owned by one: your account id and email, which
99
+ is how the CLI knows who it stored the credential for, and the workspaces you belong to, which is
100
+ what the `workspace` commands act on. It lasts an hour and is renewed automatically as commands
101
+ run, so signing in is a one-off.
102
+
103
+ ### Scopes
104
+
105
+ By default the CLI asks for write access to automations, connections, chat and your Automations
106
+ preferences, plus permission to run automations and connectors' read-only actions. `--read-only`
107
+ asks for read access instead, which leaves `automation trigger`, `chat`, `connector run`, every
108
+ connector change and saving a Personalization note failing with a permissions error.
109
+
110
+ ```bash
111
+ tda auth login --read-only
112
+ ```
113
+
114
+ Webhooks, which no command needs yet, are not requested by default, and neither is notification
115
+ management, which `tda question answer` needs. That one is opt-in on purpose: an automation asks a
116
+ question to put a person in front of what it does next, so letting the CLI (or an agent driving it)
117
+ answer is something you grant once rather than get by default. Ask for these up front if you want
118
+ them, rather than signing in a second time later:
119
+
120
+ ```bash
121
+ tda auth login --additional-scopes notifications,webhooks
122
+ ```
123
+
124
+ The workspace scopes are part of the default grant, since the `workspace` commands and
125
+ `--workspace` need them. They are a separate resource with their own scopes, because a workspace
126
+ holds other people's automations too. So is `automations:notifications:read`, which `--read-only`
127
+ also includes: `tda question list` and `run view` read the questions automations are waiting on,
128
+ and `chat continue` reads your push subscriptions to answer the agent when it asks for push
129
+ notifications. So is `automations:connections:execute`, which `connector run` needs, and
130
+ `automations:settings:write`, which `draft guide` needs to read your Personalization notes and the
131
+ `personalization` commands need to change them. A login made before any of these was added needs
132
+ `tda auth login` again.
133
+
134
+ `tda auth login --help` lists them with what each one covers.
135
+
136
+ ### Environments
137
+
138
+ `--env` selects which Automations deployment to talk to, and the account you sign in as is stored
139
+ per environment, so a staging login never leaks into a production command:
140
+
141
+ ```bash
142
+ tda --env staging auth login
143
+ tda --env staging automation list
144
+ ```
145
+
146
+ `prod` is the default. `TDA_ENV` sets it for a shell session. `--api-url` (or `TDA_API_URL`)
147
+ overrides just the API address, for a proxy or a local backend, and takes precedence over `--env`.
148
+
149
+ Signing in against `dev` needs the local backend running with `APP_URL=https://local-agentist.todoist.com`.
150
+ On its default of `http://localhost:24368`, Todoist cannot fetch the document that identifies the
151
+ CLI, so the login fails.
152
+
153
+ ### Personal API tokens
154
+
155
+ A Todoist personal API token still works, and takes over when no account is signed in:
156
+
157
+ ```bash
158
+ export TODOIST_API_TOKEN="<your Todoist personal API token>"
159
+ ```
160
+
161
+ A signed-in account wins over the variable, so logging in does not require unsetting it. The
162
+ variable is useful for CI and scripts, where opening a browser is not an option.
163
+
164
+ ### Using the stored token elsewhere
165
+
166
+ `tda auth token view` prints the stored access token to stdout, and `tda auth refresh-token view`
167
+ does the same for the refresh token. Both accept `--user <ref>` to pick an account. The output is
168
+ bare, so capture it into a variable rather than echoing it into a log:
169
+
170
+ ```bash
171
+ TOKEN=$(tda auth token view)
172
+ ```
173
+
174
+ ### Where the credential is stored
175
+
176
+ By default, only in your operating system credential manager. On a machine without one — a
177
+ container, a headless host, some WSL setups — login fails rather than quietly writing the token to
178
+ a file. Use `--credential-store` to choose deliberately:
179
+
180
+ ```bash
181
+ tda auth login --credential-store fallback # keyring if available, config file if not
182
+ tda auth login --credential-store plaintext # config file, always
183
+ ```
184
+
185
+ `plaintext` always writes the token to `~/.config/tda/config.json`; `fallback` does so only when no
186
+ keyring is available, and otherwise behaves like the default. That file is readable by anything
187
+ running as you, so it is worth knowing which one you get. It is created `0600`.
188
+
189
+ ### Known limitation
190
+
191
+ A `tda chat` turn starts with at least ten minutes of token life, which covers any normal turn. A
192
+ turn running longer than that fails partway through, because the connection carries the token it
193
+ opened with. Re-run `tda chat continue` to resume. Fixing this properly means the SDK resolving the
194
+ token per request rather than holding the one it was built with.
195
+
196
+ ## Workspaces
197
+
198
+ An automation belongs either to your personal space or to a Todoist workspace, and the two are
199
+ separate: a workspace automation is invisible to the personal commands, and vice versa.
200
+
201
+ ```bash
202
+ tda workspace list # id, name, plan, role, and whether it is usable
203
+ tda workspace use <workspace-id> # pin it for later commands
204
+ tda workspace current # what commands act on right now
205
+ tda workspace clear # back to your personal space
206
+ tda workspace default-space # where new automations go when nothing is named or pinned
207
+ ```
208
+
209
+ Commands act on your personal space until you pin a workspace. The pin is stored per environment,
210
+ so a selection made against staging cannot leak into production.
211
+
212
+ Creating is the exception. With no flag and no pin, `draft create` (for a new automation),
213
+ `template install` and `chat start` use your default space, which the API stores and the MCP
214
+ server shares. Unless you change it, that is the oldest Business workspace you can create in,
215
+ with the new automation private to you, or else your personal space.
216
+ `tda workspace default-space <id> [--visibility private|workspace]`, `--personal` and `--auto`
217
+ change it. `--visibility` on the creation commands sets the visibility explicitly in a workspace.
218
+
219
+ `--workspace <id>` and `--personal` override the pin for a single command. Every `run` command takes
220
+ them, as does every `automation` command except `move`, which names its destination with `--to`; so
221
+ do `chat start`, `template install` and every `draft` command. A conversation keeps the scope it was
222
+ started in, so `chat continue` and `chat status` take no flag and follow the conversation; an
223
+ automation published from a workspace conversation belongs to that workspace. Connections stay
224
+ personal: a workspace automation still runs on its creator's own connections. Passing both flags is
225
+ an error rather than a silent precedence rule.
226
+
227
+ A workspace automation is either visible to the whole workspace (the default when it is created
228
+ there) or private to its creator. `automation list` and `automation view` in a workspace show
229
+ every automation you can see, with its visibility and who created it; another member's
230
+ automation is read-only for you, and its API trigger id is never included. You can still run it:
231
+ `automation trigger` works on any workspace automation you can see, the run executes on its
232
+ creator's connections, and `run list`/`run view` show who started each run. The creator can change
233
+ visibility:
234
+
235
+ ```bash
236
+ tda automation visibility <automation-id> private --workspace <id>
237
+ tda automation visibility <automation-id> workspace --workspace <id>
238
+ ```
239
+
240
+ A workspace admin can manage any automation shared with the team as if they had created it:
241
+ `automation enable`, `automation disable`, `automation update` (rename, describe),
242
+ `automation visibility` and `automation delete` work on another member's team-visible automation
243
+ for an admin, where a member gets a 403. Editing stays with the creator, so `automation schedule`,
244
+ drafts and `chat` edits answer 403 for an admin too: the automation runs on the creator's
245
+ connections, and only the creator can attach those. A private automation is out of an admin's
246
+ reach like anyone else's, so an admin who takes one private cannot reach it again until the
247
+ creator shares it.
248
+ `automation view` shows `Last changed by:` with the Todoist user id of whoever last changed a
249
+ workspace automation, so a creator can tell an admin's change from their own.
250
+
251
+ An automation you created can be moved into a workspace, from your personal space or from another
252
+ workspace you belong to. It keeps running on your connections and becomes team-visible unless you
253
+ say otherwise. `--to` names the destination and defaults to the pinned workspace; there is no
254
+ `--personal` form, because the destination is always a workspace. An automation cannot be moved out
255
+ of a workspace you no longer belong to, or whose plan no longer includes Automations: the workspace
256
+ keeps it.
257
+
258
+ ```bash
259
+ tda automation move <automation-id> --to <workspace-id>
260
+ tda automation move <automation-id> --to <workspace-id> --visibility private
261
+ ```
262
+
263
+ `workspace use` checks the id against the list before storing it: an id that is wrong, or one you
264
+ cannot use, would otherwise sit in your config and fail every later command a long way from the
265
+ mistake.
266
+
267
+ `workspace list` shows only workspaces you can address. One marked `locked` is a workspace you
268
+ belong to whose plan does not include Automations — it is listed rather than hidden, but its
269
+ automations will not run, and `workspace use` refuses to pin it. If these commands report an
270
+ insufficient scope, the login predates the workspace scopes; run `tda auth login` again.
271
+
272
+ ## Inspecting resources
273
+
274
+ Every resource has `list` and `view` commands. Use `--json` for machine-readable output:
275
+
276
+ ```bash
277
+ tda --json automation list --all
278
+ tda --json automation list --all --full # manifests included; large
279
+ tda --json automation view <automation-id>
280
+
281
+ tda --json draft list --all
282
+ tda --json draft list --all --full # partial manifests included
283
+ tda --json draft view <draft-id>
284
+
285
+ tda --json conversation list --status all --limit 200
286
+ tda --json conversation view <conversation-id>
287
+
288
+ tda --json template list
289
+ tda --json template list --connector gmail --trigger webhook --staff-picks
290
+ tda --json template view <template-id>
291
+
292
+ tda --json run list <automation-id> --status failed --all
293
+ tda --json run list <automation-id> --status failed --since 2026-08-01 --until 2026-08-07
294
+ tda --json run view <automation-id> <run-id>
295
+ tda --json run view <automation-id> <run-id> --full
296
+ ```
297
+
298
+ Automation, draft, and run lists support `--limit`, `--cursor`, and `--all`. `--limit` controls the
299
+ total number of returned resources; `--all` removes that limit. JSON responses retain the API's
300
+ `data` and `nextCursor` fields. NDJSON emits one resource per line and adds a final
301
+ `{"_meta":true,"nextCursor":"..."}` record when another page is available.
302
+
303
+ `automation list` returns summaries (id, name, state, triggers, connection ids) and `draft list`
304
+ returns id, name, completeness and linked ids, so a listing stays small enough to read. `view`
305
+ returns the whole resource for one id. Pass `--full` to a list to get whole resources, manifests
306
+ included.
307
+
308
+ `run list` filters on when a run was created. `--since` and `--until` each take a full ISO timestamp
309
+ (`2026-08-01T09:00:00Z`) or a plain `YYYY-MM-DD` date, and both bounds are inclusive: a plain date
310
+ covers that entire UTC day, so `--since 2026-08-01 --until 2026-08-07` returns everything from the
311
+ start of the 1st to the end of the 7th. Either bound can be used on its own; with only `--since`,
312
+ the range runs up to now.
313
+
314
+ `template list` returns the curated templates without their manifests: what each does, its triggers
315
+ in words, the connectors it uses and what for, its steps and their tools, and whether it is a staff
316
+ pick or installable in one click. `--query`, `--connector`, `--trigger` and `--staff-picks` narrow
317
+ the list. `template view` adds the manifest and the template's authoring instructions. Template ids
318
+ are stable slugs.
319
+
320
+ `conversation view` returns the persisted conversation and its raw messages. `chat status` remains
321
+ focused on resumable agent state, including pending client actions.
322
+
323
+ To investigate a failing automation, an agent can list automations, inspect the selected automation,
324
+ list its failed runs, and inspect one failed run. Run details default to a compact diagnostic view
325
+ with failure, step, and tool-call errors. Use `run view --full` when raw step results and tool payloads
326
+ are needed.
327
+
328
+ ## Managing automations
329
+
330
+ Enable or disable an automation, or start a live run:
331
+
332
+ ```bash
333
+ tda automation enable <automation-id>
334
+ tda automation disable <automation-id>
335
+ tda automation trigger <automation-id>
336
+ tda automation trigger <automation-id> --wait --timeout 15m
337
+ ```
338
+
339
+ `automation trigger` supports scheduled and API automations. It starts a live run and prints the
340
+ run's ID with the `tda run view` command that shows it. With `--wait` it follows the run until it
341
+ ends (10 minutes by default) and reports how it ended, the step that failed and its error, exiting 1
342
+ unless the run completed. A run that stops at an `ask` step ends the wait straight away and reports
343
+ the question it is waiting on. If the wait stops early, from Ctrl-C or a failed status check, the run
344
+ keeps going and the error names it. An API automation runs with empty input, as Run now in the app
345
+ does, since the command cannot provide a payload. Webhook automations run through their configured
346
+ event. In a workspace, any member who can see an automation can trigger it; the run executes as its
347
+ creator and is recorded as started by you. Manual runs are rate-limited per automation rather than
348
+ per person.
349
+
350
+ Replace an automation's name and description together:
351
+
352
+ ```bash
353
+ tda automation update <automation-id> \
354
+ --name "Daily summary" \
355
+ --description "Creates a morning summary"
356
+ ```
357
+
358
+ Replace its schedule with either an interval or a five-part cron expression:
359
+
360
+ ```bash
361
+ tda automation schedule <automation-id> --interval "45m"
362
+
363
+ tda automation schedule <automation-id> \
364
+ --cron "0 9 * * *" \
365
+ --timezone "America/Santiago"
366
+ ```
367
+
368
+ Cron schedules require an IANA timezone. `--cron` and `--interval` are mutually exclusive, and
369
+ natural-language values such as `every day at 9am` are not supported.
370
+
371
+ Share a workspace automation with the team, or take it back to private (see Workspaces above):
372
+
373
+ ```bash
374
+ tda automation visibility <automation-id> private --workspace <id>
375
+ ```
376
+
377
+ `automation visibility` has no personal form: a personal automation has no team to be visible to.
378
+
379
+ Move an automation you created into a workspace (see Workspaces above):
380
+
381
+ ```bash
382
+ tda automation move <automation-id> --to <workspace-id>
383
+ ```
384
+
385
+ Delete an automation. Without `--yes` the command only previews: it names the automation it would
386
+ remove and exits without deleting anything.
387
+
388
+ ```bash
389
+ tda automation delete <automation-id> # preview only
390
+ tda automation delete <automation-id> --yes
391
+ ```
392
+
393
+ The preview names the automation that `--yes` would attempt to delete, so a wrong id fails with the
394
+ API's own error. Being able to read an automation does not mean being able to delete it: the `DELETE`
395
+ call is what enforces that. In a workspace, the creator or a workspace admin can delete a
396
+ team-visible automation; a private automation can only be deleted by its creator. Anyone else can
397
+ still preview a team-visible automation but gets a 403 on `--yes`.
398
+
399
+ Apart from `automation delete`, which previews unless `--yes` is present, these mutation commands
400
+ act immediately: none prompts for confirmation and none supports `--dry-run`. Use the global
401
+ `--json` or `--ndjson` option for structured results.
402
+
403
+ ### Managing drafts
404
+
405
+ Writing the manifest yourself and saving it as a draft is the default way for an agent to create or
406
+ change an automation, after looking up what it needs with `connector actions`, `connector run` and
407
+ `connector event` (see [Connections](#connections)). `chat start` hands the authoring to the
408
+ Automations agent instead. `draft guide` prints the rules a manifest must follow, the same ones the
409
+ MCP's `get-authoring-guide` returns, followed by your Personalization notes so an agent applies the
410
+ same preferences the in-app agent does. The rules need no credential; signed out, the guide says how
411
+ to sign in instead of listing the notes:
412
+
413
+ ```bash
414
+ tda draft guide
415
+ ```
416
+
417
+ Check a manifest file offline before doing anything with it. The command needs no credentials and
418
+ makes no network call; it exits `1` with `MANIFEST_INVALID` and the failing field paths otherwise:
419
+
420
+ ```bash
421
+ tda draft validate --file manifest.json
422
+ cat manifest.json | tda --json draft validate --stdin
423
+ ```
424
+
425
+ Create a draft from a manifest file, or replace an existing draft's manifest. Without `--automation`
426
+ the draft will publish as a new automation; with it, the command opens an edit draft for that
427
+ automation and applies the file, so publishing updates it in place. An automation can only have one
428
+ open edit draft, so a second `create --automation` fails with `DRAFT_CONFLICT` and names the open one.
429
+ Description fields are stored as written: `create` switches off the API's translation pass for
430
+ imports, and `update` never translates.
431
+
432
+ ```bash
433
+ tda draft create --file manifest.json
434
+ tda draft create --file manifest.json --automation <automation-id>
435
+ tda draft update <draft-id> --file manifest.json
436
+ ```
437
+
438
+ Start a new draft from a template instead of a file. The API copies the template's manifest,
439
+ translated into your language as the web app does, so no manifest passes through the CLI. Templates
440
+ with one-click install can also be published as they are, after a preview:
441
+
442
+ ```bash
443
+ tda draft create --template <template-id>
444
+ tda template install <template-id> # preview only
445
+ tda template install <template-id> --yes
446
+ tda template install <template-id> --workspace <workspace-id> --yes
447
+ ```
448
+
449
+ Bind your service connections to a draft. Creating or updating a draft never binds anything, so a
450
+ manifest that uses Slack reports Slack as missing until you connect it. `--auto` binds every required
451
+ slot you have exactly one authorised connection for and reports the rest; `--connection` names one
452
+ explicitly, with the same `connector[:mcp|trigger]=connection-id` selector `chat continue` takes:
453
+
454
+ ```bash
455
+ tda draft connect <draft-id> --auto
456
+ tda draft connect <draft-id> --connection slack:mcp=<connection-id>
457
+ ```
458
+
459
+ Publish a draft. Without `--yes` the command only previews: what the draft is called, where it will
460
+ live, whether it creates a new automation or updates one (with a step-level diff against the published
461
+ manifest in that case), its validation issues, its connection status and its schedule. With `--yes`
462
+ it publishes, reads the automation back and warns if the published manifest differs from the draft.
463
+ Pass the manifest file the draft came from with `--file` (or `--stdin`) to check against that file
464
+ instead: the preview then shows how the saved draft differs from it, and the publish warns if the
465
+ published manifest does. Defaults the API fills in, `%user_id%` and its other documented changes are
466
+ allowed for, so what remains is something like a key the API dropped or a later edit to the draft.
467
+
468
+ ```bash
469
+ tda draft publish <draft-id> --file manifest.json # preview only
470
+ tda draft publish <draft-id> --yes --file manifest.json
471
+ ```
472
+
473
+ Delete a draft you own. As with `automation delete`, the command previews unless `--yes` is present:
474
+
475
+ ```bash
476
+ tda draft delete <draft-id> # preview only
477
+ tda draft delete <draft-id> --yes
478
+ ```
479
+
480
+ Deleting the last draft in a conversation archives that conversation, so the preview says so before
481
+ you confirm. Only the draft's owner can delete it; anyone else gets a 404.
482
+
483
+ ### Personalization notes
484
+
485
+ The Personalization notes in Automations settings are preferences the in-app agent applies whenever
486
+ it builds an automation, and `draft guide` hands them to an agent writing a manifest. These commands
487
+ read and edit them. `add` puts a note on a new line; `replace` and `remove` need text that matches
488
+ exactly one place in the notes, and fail without changing anything otherwise. Each edit applies to the
489
+ notes as saved now, so it cannot overwrite a note saved in chat since you last read them.
490
+
491
+ ```bash
492
+ tda personalization view
493
+ tda personalization add "End Comms posts with: -- Posted via Todoist Automations"
494
+ tda personalization replace "Lives in Berlin." "Lives in Lisbon."
495
+ tda personalization remove "Uses 24-hour time."
496
+ ```
497
+
498
+ ## Answering questions
499
+
500
+ An automation with an `ask` step stops partway through a run and waits for you to pick one of its
501
+ options, usually before it deletes or changes something. The run stays running until someone answers
502
+ or the question expires, which stops it. Each question is emailed to you and pushed to your devices,
503
+ unless you have turned those off in the app's notification settings, and you can answer it on the
504
+ automation's page in the app or from the CLI:
505
+
506
+ ```bash
507
+ tda question list
508
+ tda question view <question-id>
509
+ tda question answer <question-id> <option> # preview only
510
+ tda question answer <question-id> <option> --yes
511
+ ```
512
+
513
+ `<option>` is the option's value or label. Without `--yes`, `answer` says whether that option lets
514
+ the run continue or stops it, and sends nothing; an answer cannot be changed. Answering needs
515
+ `tda auth login --additional-scopes notifications`. `tda run view` shows the question a running run
516
+ is waiting on, and `tda draft publish` lists the questions a draft's runs will ask before you publish
517
+ it.
518
+
519
+ ## Conversations
520
+
521
+ ```bash
522
+ tda --ndjson chat start \
523
+ "Why did my daily summary automation fail yesterday?"
524
+
525
+ tda --ndjson chat continue <conversation-id> \
526
+ "Inspect its most recent run"
527
+
528
+ tda --json chat status <conversation-id>
529
+ ```
530
+
531
+ Creating an automation is another kind of conversation. State the desired publication behavior in
532
+ the message:
533
+
534
+ ```bash
535
+ tda chat start "Create and publish an automation that reschedules overdue tasks every night"
536
+
537
+ tda chat start \
538
+ "Create an automation that reschedules overdue tasks every night, but leave it as a draft"
539
+ ```
540
+
541
+ The CLI does not add publication or draft instructions to these messages.
542
+
543
+ ## Agent usage
544
+
545
+ The CLI streams one durable server turn and exits. In NDJSON mode, `turn_started` means the process is
546
+ still active, and silence produces periodic `turn_progress` heartbeats. Keep monitoring the same
547
+ process until both of these are true:
548
+
549
+ 1. It emits a record with `terminal: true`: `turn_completed`, `error`, or `interrupted` after
550
+ SIGINT. That record is always the last line, and there is exactly one.
551
+ 2. The process exits.
552
+
553
+ Only then should an agent invoke `tda chat continue` with the emitted conversation ID. A local
554
+ per-conversation lock rejects a concurrent turn and reports the PID that is already active. The lock
555
+ protects processes on the same machine; it is not a distributed backend lock.
556
+
557
+ In a human terminal without `--json`, `--ndjson`, or `--no-interactive`, the command remains open as
558
+ an interactive conversation.
559
+
560
+ Machine output gives the assistant's text for each step whole, as one `assistant_message`, and the
561
+ terminal `turn_completed` carries the full reply as `assistantText`. Pass `--stream-text` to
562
+ `chat start` or `chat continue` to get it fragment by fragment as `assistant_text` under `--ndjson`
563
+ instead.
564
+
565
+ ```ndjson
566
+ {"type":"turn_started","conversationId":"...","state":"running","terminal":false}
567
+ {"type":"turn_progress","conversationId":"...","state":"running","terminal":false,"elapsedSeconds":30}
568
+ {"type":"turn_completed","conversationId":"...","state":"completed","terminal":true,"outcome":"awaiting_input","resumeCommand":"tda chat continue ..."}
569
+ ```
570
+
571
+ If a conversation publishes an automation, `tda` archives the conversation before emitting the
572
+ terminal `turn_completed` event. Successful machine output includes `conversation_archived` and
573
+ `conversationArchived: true`. If publication succeeds but archival fails, the CLI emits a
574
+ `TDA_CHAT_ARCHIVE_FAILED` warning and completes with `conversationArchived: false`; agents must not
575
+ retry publication in response to that warning.
576
+
577
+ A failed `chat start` or `chat continue` ends with an `error` event whose `code` says what kind of
578
+ failure it was: `CHAT_TURN_FAILED` for a server error, a lost connection or a reply cut off partway,
579
+ which is worth retrying; `CHAT_TURN_REJECTED` when the API refused the turn as sent; `CHAT_TURN_ACTIVE`
580
+ when another process is running a turn on the conversation; and a `CHAT_` input code when `continue`
581
+ was given input the conversation is not waiting for. The event also carries the `conversationId`, a
582
+ `resumeCommand` unless another process holds the turn, and when they are known the `requestId` the
583
+ backend logged the request under, the `httpStatus`, and the conversation's `draftId` with a
584
+ `draftCommand` that shows it. A failed turn
585
+ leaves the draft in place, so when the conversation cannot be continued, the draft commands can
586
+ finish it.
587
+
588
+ ## Connections
589
+
590
+ Discover every service supported by Automations and include the current user's connection status:
591
+
592
+ ```bash
593
+ tda connector list
594
+ tda connector list --query github
595
+ tda connector list --capability mcp
596
+ tda connector list --connection-status authorized
597
+ tda connector list --capability trigger --connection-status expired
598
+ tda connector list --without-connections
599
+ tda connector list --no-connections
600
+ tda connector view github
601
+ ```
602
+
603
+ `--capability` filters connectors by what they support but does not remove other capabilities or
604
+ connections from the output. When combined with `--connection-status`, both conditions must match
605
+ the same connection. `--without-connections` returns only connectors for which the user has no
606
+ connection records. `--no-connections` skips fetching connection data and omits the `connections`
607
+ field; it cannot be combined with connection filters.
608
+
609
+ Look up what a manifest needs instead of guessing: a connector's actions with their fields (and full
610
+ schemas for up to five with `--names`), a read-only action run to turn a name into the stable id a
611
+ step should use, and a trigger event's payload schema and filterable fields:
612
+
613
+ ```bash
614
+ tda connector actions github
615
+ tda connector actions github --names search_issues
616
+ tda connector run github search_issues --args '{"query":"login bug"}'
617
+ tda connector event github github.issues.opened
618
+ ```
619
+
620
+ `run` only runs actions the service declares read-only. Without `--connection`, these commands use
621
+ your only authorised connection for the connector; with several, the error lists the ids to pass.
622
+
623
+ List the published automations that require a connector:
624
+
625
+ ```bash
626
+ tda connector automations github
627
+ ```
628
+
629
+ Start a connection directly, or resume and repair an existing setup:
630
+
631
+ ```bash
632
+ tda connector connect github --capability mcp
633
+ tda connector wait <connection-id>
634
+ tda connector repair <connection-id>
635
+ ```
636
+
637
+ OAuth setup opens in the default browser. Managed connectors print their instructions and setup
638
+ code. Use the global `--no-open` option to print setup links without opening them.
639
+
640
+ Disconnecting is preview-only unless `--yes` is present. The CLI refuses to disconnect an exact
641
+ connection used by any enabled automation. Disabled automations do not block disconnection, but they
642
+ will need a valid connection before they can run again.
643
+
644
+ ```bash
645
+ tda connector disconnect <connection-id>
646
+ tda connector disconnect <connection-id> --yes
647
+ ```
648
+
649
+ The dependency check currently runs in the CLI before deletion and is not atomic with the backend
650
+ operation. Backend enforcement is tracked in
651
+ [#3928](https://github.com/todoist/automations/issues/3928).
652
+
653
+ ### Connections requested by chat
654
+
655
+ The backend and CLI automatically reuse the sole authorized account for a requested service. When
656
+ more than one authorized account exists, machine mode emits an `action_required` event containing
657
+ the available connection IDs. Resolve it with:
658
+
659
+ ```bash
660
+ tda --ndjson chat continue <conversation-id> \
661
+ --connection slack:mcp=<connection-id>
662
+ ```
663
+
664
+ Repeat `--connection` when several service choices are required.
665
+
666
+ When no authorized account exists, the CLI creates a connection and waits for setup to complete. For
667
+ OAuth connectors it prints the authorization URL and opens it in the default browser. For managed
668
+ connectors it prints the setup instructions and code, and opens the deep link when one is available.
669
+ Machine mode emits `connection_authorization_started`, periodic
670
+ `connection_authorization_waiting`, and `connection_authorized` events while the same process stays
671
+ alive. Pending setup is reused if the command is interrupted and resumed, avoiding duplicate
672
+ connections.
673
+
674
+ Use `--no-open` to print OAuth and managed deep-link URLs without trying to launch a browser:
675
+
676
+ ```bash
677
+ tda --no-open --ndjson chat start "Help me troubleshoot my Slack automation"
678
+ ```
679
+
680
+ ## Agent skill
681
+
682
+ `tda` ships a skill document that teaches a coding agent how to drive it: which command answers which
683
+ question, what each flag really does, the chat turn protocol, and the error codes worth branching on.
684
+ Install it for whichever agents you use:
685
+
686
+ ```bash
687
+ tda skill install claude-code # writes ~/.claude/skills/automations-cli/SKILL.md
688
+ tda skill install claude-code --local # writes ./.claude/skills/automations-cli/SKILL.md
689
+ tda skill list
690
+ tda skill update all
691
+ tda skill uninstall claude-code
692
+ ```
693
+
694
+ `tda skill list` shows every supported agent (`claude-code`, `codex`, `copilot`, `cursor`, `gemini`,
695
+ `pi`, and `universal` for `~/.agents`) along with whether its skill file is missing, current, or
696
+ outdated. A global install refuses when the agent's home directory does not exist, so a typo cannot
697
+ create a directory nothing reads; use `--local` or the `universal` target instead. Already-installed
698
+ skill files are rewritten by `npm run build:cli`, which is when the document can change, so a rebuilt
699
+ CLI never leaves an agent reading instructions that no longer match it. `tda skill update all` does
700
+ the same on demand.
701
+
702
+ The document's source is `src/lib/skills/content.ts`, and `skills/automations-cli/SKILL.md` is the
703
+ generated copy committed for review. Edit the former and run `npm run sync:skill`; `npm run check`
704
+ fails when they diverge.