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