You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the new command uses a **read-only** SDK method (e.g., `getXxx`, `listXxx`), add it to the `KNOWN_SAFE_API_METHODS` set. This set uses a default-deny approach: any method **not** listed is treated as mutating and will be blocked when the CLI is authenticated with a read-only OAuth token (`td auth login --read-only`).
30
+
31
+
-**Read-only methods** (fetch/list/view): add to `KNOWN_SAFE_API_METHODS`
32
+
-**Mutating methods** (add/update/delete/archive/move): do NOT add — they are blocked by default, which is the correct behavior
Commands with multiple subcommands use a folder-based structure:
30
37
@@ -83,7 +90,7 @@ const myCmd = parent
83
90
84
91
The variable assignment (`const myCmd = ...`) is needed so the `.action()` callback can call `myCmd.help()` when the argument is missing.
85
92
86
-
## 4. Accessibility (`src/lib/output.ts`)
93
+
## 5. Accessibility (`src/lib/output.ts`)
87
94
88
95
The CLI supports accessible mode via `isAccessible()` (checks `TD_ACCESSIBLE=1` or `--accessible` flag). When adding output that uses color or visual elements, consider whether information is conveyed **only** by color or decoration.
89
96
@@ -119,7 +126,7 @@ if (isAccessible()) {
119
126
120
127
If adding a new shared formatter to `output.ts`, use `Record<ExactType, ...>` rather than `Record<string, ...>` so the compiler catches missing variants.
121
128
122
-
## 5. Tests (`src/__tests__/<entity>.test.ts`)
129
+
## 6. Tests (`src/__tests__/<entity>.test.ts`)
123
130
124
131
Follow the existing pattern: mock `getApi`, use `program.parseAsync()`.
125
132
@@ -130,7 +137,7 @@ Always test:
130
137
-`--dry-run` for mutating commands (API method should NOT be called, preview text shown)
131
138
-`--json` output where applicable
132
139
133
-
## 6. Skill Content (`src/lib/skills/content.ts`)
140
+
## 7. Skill Content (`src/lib/skills/content.ts`)
134
141
135
142
Update `SKILL_CONTENT` with examples for the new command. Update relevant sections:
136
143
@@ -139,7 +146,7 @@ Update `SKILL_CONTENT` with examples for the new command. Update relevant sectio
139
146
- Mutating `--json` list if the command returns an entity
140
147
-`--dry-run` list if applicable
141
148
142
-
## 7. Sync Skill File
149
+
## 8. Sync Skill File
143
150
144
151
After all code changes are complete:
145
152
@@ -149,7 +156,7 @@ npm run sync:skill
149
156
150
157
This builds the project and regenerates `skills/todoist-cli/SKILL.md` from the compiled skill content. The regenerated file must be committed. CI will fail (`npm run check:skill-sync`) if it is out of sync.
Copy file name to clipboardExpand all lines: README.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,6 +72,14 @@ This opens your browser to authenticate with Todoist. Once approved, the token i
72
72
73
73
If secure storage is unavailable, the CLI warns and falls back to `~/.config/todoist-cli/config.json`. Existing plaintext tokens are migrated automatically the next time the CLI reads them successfully from the config file.
74
74
75
+
For a read-only OAuth token (scope `data:read`), run:
76
+
77
+
```bash
78
+
td auth login --read-only
79
+
```
80
+
81
+
In read-only mode, commands that change Todoist data (create/update/delete/complete/move/archive, etc.) are blocked by the CLI.
82
+
75
83
### Alternative methods
76
84
77
85
**Manual token:** Get your API token from [Todoist Settings > Integrations > Developer](https://todoist.com/app/settings/integrations/developer):
`TODOIST_API_TOKEN` always takes priority over the stored token.
90
98
99
+
Note: externally provided tokens (`TODOIST_API_TOKEN` or `td auth token`) are treated as unknown scope and assumed write-capable. The CLI cannot currently auto-detect OAuth scope for these tokens.
100
+
91
101
### Auth commands
92
102
93
103
```bash
94
-
td auth status # check if authenticated
95
-
td auth logout# remove saved token
104
+
td auth status # check if authenticated + mode (read-only/read-write/unknown)
105
+
td auth logout# remove saved token and auth metadata
0 commit comments