@togglhq/cli 1.5.19

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 ADDED
@@ -0,0 +1,299 @@
1
+ # @toggl/cli
2
+
3
+ Command-line interface for [Toggl Focus](https://focus.toggl.com). Published publicly as **`@togglhq/cli`** on **npmjs.org**. Internal builds publish as **`@toggl/cli-internal`** on GitHub Packages.
4
+
5
+ ## Installation
6
+
7
+ From npm (no GitHub token):
8
+
9
+ ```bash
10
+ npm install -g @togglhq/cli
11
+ ```
12
+
13
+ Or from GitHub Packages (Toggl staff): configure your `.npmrc` with a GitHub Packages token, then:
14
+
15
+ ```bash
16
+ npm install -g @toggl/cli-internal
17
+ ```
18
+
19
+ Or run without installing:
20
+
21
+ ```bash
22
+ npx @togglhq/cli
23
+ ```
24
+
25
+ ## Authentication
26
+
27
+ ```bash
28
+ toggl auth
29
+ ```
30
+
31
+ Opens a browser for OAuth sign-in. On success, credentials are saved to `~/.toggl/focus-tools.json`. When `--profile` is omitted, the CLI saves the account under a name based on your account, such as `hazem-12345`, and makes it active.
32
+
33
+ **Options:**
34
+
35
+ | Flag | Description |
36
+ | --------------------- | --------------------------------------------------------------------- |
37
+ | `--workspace-id <id>` | Select a specific workspace (required when your account has multiple) |
38
+ | `--profile <name>` | Save credentials under an explicit profile name |
39
+
40
+ Sessions refresh automatically. Re-run `toggl auth` only to switch workspaces or after 4 weeks of inactivity.
41
+
42
+ ## Profiles
43
+
44
+ Use profiles to switch between saved accounts and environments:
45
+
46
+ ```bash
47
+ toggl profile list
48
+ toggl profile current
49
+ toggl profile switch hazem-12345
50
+ toggl profile switch # omit name in a TTY: pick from a menu or use the only profile
51
+ toggl profile remove hazem-12345
52
+ ```
53
+
54
+ The active profile controls both the account and environment for later commands. You can still override it for one call with the global `--profile <name>` flag.
55
+
56
+ ## Agent skill setup
57
+
58
+ `@toggl/cli` ships a `toggl-cli` agent skill under `skills/toggl-cli`. Install it with:
59
+
60
+ ```bash
61
+ toggl skill setup
62
+ ```
63
+
64
+ This delegates to the [`skills`](https://www.npmjs.com/package/skills) CLI, listed as a **dependency** of `@toggl/cli` (no separate install). Interactive agent/scope prompts come from that CLI.
65
+
66
+ After upgrading the CLI, refresh the skill install:
67
+
68
+ ```bash
69
+ toggl skill sync
70
+ ```
71
+
72
+ By default the installer **symlinks** into your agent skill dirs so updates track CLI upgrades; use `--copy` only if you need a detached snapshot (then re-run `toggl skill sync` after upgrades). Pass flags for non-interactive setup:
73
+
74
+ ```bash
75
+ toggl skill setup --agent cursor --global --copy --yes
76
+ toggl skill setup --agent cursor codex --copy --yes
77
+ ```
78
+
79
+ ## Command shape
80
+
81
+ Generated Focus commands look like:
82
+
83
+ ```
84
+ toggl [global flags] <group> … <subcommand> [flags]
85
+ ```
86
+
87
+ Many endpoints use two segments (`toggl tasks list`). Some use nested groups, including:
88
+
89
+ - **`toggl organization …`** — organization APIs (not `toggl org …`; there is no `org` top-level command). Examples: `toggl organization invitations list`, `toggl organization members get`, `toggl organization workspaces list`.
90
+ - **`toggl shared …`** — shared workspace/org data routed through `@toggl/queries` helpers (status, holidays, working hours, time off). Example: `toggl shared status get`.
91
+
92
+ Core resource groups still include `tasks`, `projects`, `time-blocks`, `time-entries`, `statuses`, `users`, `tags`, `clients`, and others surfaced by `@toggl/operations`. Endpoints marked **`hidden: true`** in the catalog (currently calendar-integration and scheduler helper operations) are omitted from the CLI and MCP. Existing public command paths and operation IDs stay stable; use `toggl --help` and `toggl <group> --help` to explore what shipped.
93
+
94
+ **Typical entity commands:**
95
+
96
+ | Resource | Actions |
97
+ | -------------- | -------------------------------------------------------- |
98
+ | `tasks` | `list` (alias `ls`), `get`, `create`, `update`, `delete` |
99
+ | `projects` | `list` (alias `ls`), `get`, `create`, `update`, `delete` |
100
+ | `time-blocks` | `list` (alias `ls`), `get`, `create`, `update`, `delete` |
101
+ | `time-entries` | `list` (alias `ls`), `start`, `stop` |
102
+ | `statuses` | `list` (alias `ls`) |
103
+ | `users` | `list` (alias `ls`) |
104
+
105
+ Bulk mutations use `toggl <resource> bulk <verb>`; see `toggl tasks bulk --help`.
106
+
107
+ **Global flags** (placed before the command path):
108
+
109
+ | Flag | Description |
110
+ | --------------------- | ------------------------------------------------------------- |
111
+ | `--json` | Pretty-printed JSON output (easier to pipe than human tables) |
112
+ | `--workspace-id <id>` | Override the active workspace for this call |
113
+ | `--profile <name>` | Use a named auth profile |
114
+
115
+ **Per-command flags** on generated operations always include `--data`, `--data-file`, and `--dry-run`. **`--interactive`** / **`--no-interactive`** appear only when the operation’s catalog metadata allows interactive prompting (read-only operations default to non-interactive unless marked otherwise). Interactive prompting requires a TTY and is disabled when you pass `--json`, `--data`, `--data-file`, `CI`, or `TOGGL_NON_INTERACTIVE`.
116
+
117
+ To see scalar flags for an operation, use **`toggl <group> … <command> --help`**. To print the resolved operation id and validated body without calling the API, use **`--dry-run`**.
118
+
119
+ ## Providing input
120
+
121
+ There are three ways to pass the request body:
122
+
123
+ ### 1. Scalar flags
124
+
125
+ Each input field maps to a `--field-name` flag. Numeric values are coerced automatically.
126
+
127
+ ```bash
128
+ toggl tasks get --task-id 12345
129
+ toggl tasks list --project-id 999 --status-id 243956
130
+ toggl time-entries list --date-from 2025-01-01 --date-to 2025-01-07
131
+ toggl time-entries start --task-id 12345 --type activity
132
+ ```
133
+
134
+ For `update` commands, payload fields use a `--payload-<field>` prefix:
135
+
136
+ ```bash
137
+ toggl tasks update --task-id 12345 --payload-name "New name" --payload-status-id 270002
138
+ toggl projects update --project-id 999 --payload-name "Renamed"
139
+ ```
140
+
141
+ ### 2. `--data` inline JSON
142
+
143
+ Pass the full input as a JSON string:
144
+
145
+ ```bash
146
+ toggl tasks list --data '{"project_id": 436195, "per_page": 50}'
147
+ toggl tasks create --data '{"name": "Fix login bug", "project_id": 436195}'
148
+ toggl tasks update --data '{"task_id": 12345, "payload": {"name": "Updated", "status_id": 270002}}'
149
+ ```
150
+
151
+ ### 3. `--data -` (stdin) or `--data-file <path>`
152
+
153
+ Read JSON from stdin or a file:
154
+
155
+ ```bash
156
+ echo '{"task_id": 12345}' | toggl tasks get --data -
157
+ toggl tasks create --data-file ./new-task.json
158
+ ```
159
+
160
+ ## Output and errors
161
+
162
+ - Successful output goes to **stdout** as JSON (pretty-printed; `--json` keeps JSON while skipping human-oriented formatting helpers).
163
+ - Validation errors and API errors go to **stderr**.
164
+ - Exit code `0` on success, `1` on error.
165
+
166
+ ## Safety flags
167
+
168
+ ### `--dry-run`
169
+
170
+ Preview the resolved input without making an API call. Output includes `dry_run: true`, the operation ID, and the validated input object:
171
+
172
+ ```bash
173
+ toggl tasks delete --task-id 12345 --dry-run
174
+ # {"dry_run":true,"operation":"focus.tasks.delete","input":{"task_id":12345}}
175
+ ```
176
+
177
+ ### `--yes` (destructive operations)
178
+
179
+ `delete` commands require `--yes` to execute. Omitting it prints an error to stderr:
180
+
181
+ ```bash
182
+ toggl tasks delete --task-id 12345 --yes
183
+ toggl projects delete --project-id 999 --yes
184
+ toggl time-blocks delete --task-id 12345 --time-block-id 67890 --yes
185
+ ```
186
+
187
+ ## Examples
188
+
189
+ **Tasks**
190
+
191
+ ```bash
192
+ # List all tasks in a project
193
+ toggl tasks list --project-id 436195
194
+
195
+ # Get a single task
196
+ toggl tasks get --task-id 12345
197
+
198
+ # Create a task
199
+ toggl tasks create --data '{"name": "Write release notes", "project_id": 436195}'
200
+
201
+ # Move task to "In Progress"
202
+ toggl tasks update --task-id 12345 --payload-status-id 270002
203
+
204
+ # Delete a task (requires --yes)
205
+ toggl tasks delete --task-id 12345 --yes
206
+ ```
207
+
208
+ **Projects**
209
+
210
+ ```bash
211
+ toggl projects list
212
+ toggl projects get --project-id 436195
213
+ toggl projects create --data '{"name": "Q3 Planning", "workspace_id": 356965}'
214
+ toggl projects update --project-id 436195 --payload-name "Q3 Planning (archived)"
215
+ toggl projects delete --project-id 999 --yes
216
+ ```
217
+
218
+ **Time entries**
219
+
220
+ ```bash
221
+ # List time entries for a week
222
+ toggl time-entries list --date-from 2025-01-01 --date-to 2025-01-07
223
+
224
+ # Start tracking (defaults type to 'activity')
225
+ toggl time-entries start --task-id 12345
226
+
227
+ # Start a break
228
+ toggl time-entries start --type break
229
+
230
+ # Stop the running timer
231
+ toggl time-entries stop
232
+ ```
233
+
234
+ **Time blocks**
235
+
236
+ ```bash
237
+ # List scheduled blocks for a week
238
+ toggl time-blocks list --date-from 2025-01-01 --date-to 2025-01-07
239
+
240
+ # Create a time block
241
+ toggl time-blocks create --data '{
242
+ "task_id": 12345,
243
+ "payload": {"start": "2025-01-06T09:00:00Z", "end": "2025-01-06T11:00:00Z"}
244
+ }'
245
+
246
+ # Delete a time block
247
+ toggl time-blocks delete --task-id 12345 --time-block-id 67890 --yes
248
+ ```
249
+
250
+ **Reference data**
251
+
252
+ ```bash
253
+ # List workspace statuses (useful for getting status IDs)
254
+ toggl statuses list
255
+
256
+ # List workspace members (useful for getting user IDs)
257
+ toggl users list
258
+ ```
259
+
260
+ ## Dates
261
+
262
+ `--date-from` and `--date-to` accept:
263
+
264
+ - `YYYY-MM-DD` — expanded to `T00:00:00Z` (from) or `T23:59:59Z` (to)
265
+ - RFC 3339 datetime — used as-is (e.g. `2025-01-01T08:00:00+02:00`)
266
+
267
+ ## Troubleshooting
268
+
269
+ **Not authenticated**
270
+
271
+ ```
272
+ Not authenticated. Run `toggl auth` to sign in.
273
+ ```
274
+
275
+ Run `toggl auth`. Credentials are stored in `~/.toggl/focus-tools.json`. If you previously authenticated with an older version, your session at `~/.toggl-focus-mcp/config.json` is still read automatically.
276
+
277
+ **Invalid JSON from `--data`**
278
+
279
+ ```
280
+ Invalid JSON from --data: Unexpected token ...
281
+ ```
282
+
283
+ Verify your JSON is well-formed. Use `--data-file` with a file if quoting is difficult in your shell.
284
+
285
+ **Validation error**
286
+
287
+ ```
288
+ Invalid input: date_from: must be YYYY-MM-DD or RFC3339 datetime
289
+ ```
290
+
291
+ Check field names and types. Use `--dry-run` to validate input without executing.
292
+
293
+ **Debug API responses**
294
+
295
+ ```bash
296
+ TOGGL_DEBUG=1 toggl tasks list
297
+ ```
298
+
299
+ Prints schema validation warnings from API responses to stderr.
@@ -0,0 +1 @@
1
+ export { };
package/build/index.js ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import { n as CommanderError, t as createProgram } from "./program-BwnVUFVS.js";
3
+ //#region src/index.ts
4
+ try {
5
+ await createProgram({ enableUpdateNotification: true }).parseAsync(process.argv);
6
+ } catch (error) {
7
+ if (error instanceof CommanderError) process.exit(error.exitCode);
8
+ throw error;
9
+ }
10
+ //#endregion
11
+ export {};
12
+
13
+ //# sourceMappingURL=index.js.map