@stephendolan/omnifocus-cli 2.1.0 → 2.3.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,494 +1,151 @@
1
1
  # OmniFocus CLI
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@stephendolan/omnifocus-cli.svg)](https://www.npmjs.com/package/@stephendolan/omnifocus-cli)
4
- [![npm downloads](https://img.shields.io/npm/dm/@stephendolan/omnifocus-cli.svg)](https://www.npmjs.com/package/@stephendolan/omnifocus-cli)
5
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![Bun](https://img.shields.io/badge/Bun-%3E%3D1.0-black)](https://bun.sh)
7
- [![Platform](https://img.shields.io/badge/platform-macOS-lightgrey.svg)](https://www.apple.com/macos/)
8
5
 
9
- A powerful command-line interface for OmniFocus on macOS, inspired by the GitHub CLI (`gh`).
10
-
11
- ## Features
12
-
13
- - 📝 **Task Management** - Create, list, update, and delete tasks
14
- - 📂 **Project Management** - Manage projects and their organization
15
- - 📥 **Inbox Management** - View and count inbox items
16
- - 🏷️ **Tag Analysis** - View tag usage statistics and identify stale tags
17
- - 🔍 **Search** - Full-text search across tasks
18
- - 📊 **JSON Output** - Machine-readable output for automation and scripting
19
- - ⚡ **Fast** - Direct OmniFocus integration using JXA
6
+ A command-line interface for OmniFocus on macOS.
20
7
 
21
8
  ## Installation
22
9
 
23
- Requires [Bun](https://bun.sh) runtime.
24
-
25
10
  ```bash
26
- # Install globally with bun (recommended)
27
11
  bun install -g @stephendolan/omnifocus-cli
28
-
29
- # Or run directly without installing
30
- bunx @stephendolan/omnifocus-cli task list
31
- npx @stephendolan/omnifocus-cli task list # also works
32
- ```
33
-
34
- ### From Source
35
-
36
- ```bash
37
- git clone https://github.com/stephendolan/omnifocus-cli.git
38
- cd omnifocus-cli
39
- bun install
40
- bun run link # Build and link globally
41
- ```
42
-
43
- Now you can use the `of` command anywhere in your terminal.
44
-
45
- ## Output Format
46
-
47
- All commands output JSON by default:
48
-
49
- ```bash
50
- # Pretty-printed JSON (default)
51
- of task list
52
-
53
- # Compact JSON (single line)
54
- of task list --compact
55
- ```
56
-
57
- ### Working with JSON Output
58
-
59
- Use `jq` to filter and transform the JSON output:
60
-
61
- ```bash
62
- # Count inbox tasks
63
- of inbox list | jq 'length'
64
-
65
- # Get task names only
66
- of task list | jq '.[] | .name'
67
-
68
- # Get flagged tasks with specific fields
69
- of task list --flagged | jq '.[] | {name, project, due}'
70
-
71
- # Find tasks added more than 2 hours ago
72
- of inbox list | jq --arg cutoff "$(date -u -v-2H +%Y-%m-%dT%H:%M:%SZ)" \
73
- '.[] | select(.added < $cutoff)'
74
-
75
- # Count unprocessed inbox items
76
- of inbox list | jq '[.[] | select(.project == null)] | length'
77
- ```
78
-
79
- ## Usage
80
-
81
- ### Task Commands
82
-
83
- #### List Tasks
84
-
85
- ```bash
86
- # List all active tasks
87
- of task list
88
-
89
- # List flagged tasks only
90
- of task list --flagged
91
-
92
- # Filter by project
93
- of task list --project "Work"
94
-
95
- # Filter by tag
96
- of task list --tag "urgent"
97
-
98
- # Include completed tasks
99
- of task list --completed
100
- ```
101
-
102
- #### Create a Task
103
-
104
- ```bash
105
- # Simple task to inbox
106
- of task create "Review pull requests"
107
-
108
- # Task with project
109
- of task create "Write documentation" --project "Website"
110
-
111
- # Task with multiple options
112
- of task create "Call dentist" \
113
- --project "Personal" \
114
- --tag "phone" \
115
- --due "2024-01-15" \
116
- --flagged \
117
- --estimate 15
118
- ```
119
-
120
- #### Update a Task
121
-
122
- ```bash
123
- # Mark as completed
124
- of task update "Review pull requests" --complete
125
-
126
- # Flag a task
127
- of task update "Call dentist" --flag
128
-
129
- # Move to different project
130
- of task update "Write docs" --project "Documentation"
131
-
132
- # Update multiple properties
133
- of task update "Email team" \
134
- --name "Email team about launch" \
135
- --due "2024-01-20" \
136
- --flag
137
- ```
138
-
139
- #### View Task Details
140
-
141
- ```bash
142
- # View by name
143
- of task view "Review pull requests"
144
-
145
- # View by ID
146
- of task view "kXu3B-LZfFH"
147
- ```
148
-
149
- #### Delete a Task
150
-
151
- ```bash
152
- of task delete "Old task"
153
- of task rm "Old task" # alias
154
- ```
155
-
156
- ### Project Commands
157
-
158
- #### List Projects
159
-
160
- ```bash
161
- # List all active projects
162
- of project list
163
-
164
- # Filter by folder
165
- of project list --folder "Work"
166
-
167
- # Filter by status
168
- of project list --status "on hold"
169
-
170
- # Include dropped projects
171
- of project list --dropped
172
- ```
173
-
174
- #### Create a Project
175
-
176
- ```bash
177
- # Simple project
178
- of project create "Website Redesign"
179
-
180
- # Project with folder and tags
181
- of project create "Q1 Planning" \
182
- --folder "Work" \
183
- --tag "quarterly" \
184
- --sequential
185
- ```
186
-
187
- #### View Project Details
188
-
189
- ```bash
190
- of project view "Website Redesign"
191
- ```
192
-
193
- #### Delete a Project
194
-
195
- ```bash
196
- of project delete "Old Project"
197
- of project rm "Old Project" # alias
198
12
  ```
199
13
 
200
- ### Inbox Commands
201
-
202
- ```bash
203
- # List inbox items
204
- of inbox list
205
-
206
- # Get inbox count
207
- of inbox count
208
- ```
14
+ Requires [Bun](https://bun.sh) and macOS with OmniFocus installed.
209
15
 
210
- ### Search
16
+ ## Quick Start
211
17
 
212
18
  ```bash
213
- # Search for tasks
214
- of search "documentation"
19
+ of inbox count # Check inbox
20
+ of task list --flagged # Today's tasks
21
+ of task create "Buy groceries" # Quick capture
22
+ of task update "Buy groceries" --complete # Mark done
215
23
  ```
216
24
 
217
- ### Tag Commands
25
+ ## Commands
218
26
 
219
- #### List Tags
27
+ ### Tasks
220
28
 
221
29
  ```bash
222
- # List all tags with usage counts
223
- of tag list
224
-
225
- # Show tags unused for 30+ days
226
- of tag list --unused-days 30
30
+ of task list # List active tasks
31
+ of task list --flagged # Flagged tasks only
32
+ of task list --project "Work" # Filter by project
33
+ of task list --tag "urgent" # Filter by tag
34
+ of task list --completed # Include completed
227
35
 
228
- # Sort by usage (most used first)
229
- of tag list --sort usage
36
+ of task create "Name" [options]
37
+ --project <name> # Assign to project
38
+ --tag <tags...> # Add tags
39
+ --due <YYYY-MM-DD> # Set due date
40
+ --defer <YYYY-MM-DD> # Set defer date
41
+ --flagged # Flag the task
42
+ --estimate <minutes> # Time estimate
43
+ --note <text> # Add note
230
44
 
231
- # Sort by activity (most recent first)
232
- of tag list --sort activity
45
+ of task update <name|id> [options]
46
+ --complete # Mark completed
47
+ --flag / --unflag # Toggle flag
48
+ --name <new-name> # Rename
49
+ --project/--tag/--due/--defer # Same as create
233
50
 
234
- # Only count active (incomplete) tasks
235
- of tag list --active-only
51
+ of task view <name|id> # View details
52
+ of task delete <name|id> # Delete task
236
53
  ```
237
54
 
238
- #### Tag Statistics
55
+ ### Projects
239
56
 
240
57
  ```bash
241
- # Show comprehensive tag usage statistics
242
- of tag stats
243
- ```
244
-
245
- Displays total tag counts, average tasks per tag, most/least used tags, and stale tags.
58
+ of project list # List active projects
59
+ of project list --folder "Work" # Filter by folder
60
+ of project list --status "on hold" # Filter by status
61
+ of project list --dropped # Include dropped
246
62
 
247
- #### Create Tag
63
+ of project create "Name" [options]
64
+ --folder <name> # Assign to folder
65
+ --tag <tags...> # Add tags
66
+ --sequential # Sequential project
67
+ --note <text> # Add note
248
68
 
249
- ```bash
250
- # Create a new tag
251
- of tag create "New Tag"
252
-
253
- # Create a nested tag (child of existing tag)
254
- of tag create "Child Tag" --parent "Parent Tag"
69
+ of project view <name|id> # View details
70
+ of project delete <name|id> # Delete project
255
71
  ```
256
72
 
257
- #### View Tag
258
-
259
- ```bash
260
- # View tag details by name
261
- of tag view "Tag Name"
262
-
263
- # View tag by ID (always unique)
264
- of tag view "kXu3B-LZfFH"
265
-
266
- # View nested tag using path syntax
267
- of tag view "Parent/Child"
268
- ```
269
-
270
- If multiple tags share the same name in different hierarchies, use the full hierarchical path or tag ID. The command will show available paths if the name is ambiguous.
271
-
272
- #### Update Tag
73
+ ### Tags
273
74
 
274
75
  ```bash
275
- # Rename a tag
276
- of tag update "Old Name" --name "New Name"
76
+ of tag list # All tags with counts
77
+ of tag list --unused-days 30 # Stale tags
78
+ of tag list --sort usage # Most used first
79
+ of tag list --sort activity # Most recent first
80
+ of tag list --active-only # Only count incomplete tasks
277
81
 
278
- # Deactivate a tag
279
- of tag update "Tag Name" --inactive
82
+ of tag stats # Usage statistics
280
83
 
281
- # Reactivate a tag
282
- of tag update "Tag Name" --active
84
+ of tag create "Name" # Create tag
85
+ of tag create "Child" --parent "Parent" # Nested tag
283
86
 
284
- # Update nested tag using path
285
- of tag update "Parent/Child" --name "New Name"
87
+ of tag view <name|path|id> # View details
88
+ of tag update <name> --name "New" # Rename
89
+ of tag update <name> --inactive # Deactivate
90
+ of tag delete <name> # Delete tag
286
91
  ```
287
92
 
288
- #### Delete Tag
289
-
290
- ```bash
291
- # Delete a tag by name
292
- of tag delete "Tag Name"
293
-
294
- # Delete using alias
295
- of tag rm "Tag Name"
296
-
297
- # Delete nested tag using path
298
- of tag delete "Parent/Child"
299
- ```
300
-
301
- ## Command Reference
302
-
303
- ### Global Options
304
-
305
- - `-h, --help` - Show help for any command
306
- - `-V, --version` - Show version number
307
- - `--compact` - Compact JSON output (single line)
308
-
309
- ### Task Filters
310
-
311
- - `-f, --flagged` - Show only flagged tasks
312
- - `-p, --project <name>` - Filter by project name
313
- - `-t, --tag <name>` - Filter by tag name
314
- - `-c, --completed` - Include completed tasks
315
-
316
- ### Task Options
317
-
318
- - `--project <name>` - Assign to project
319
- - `--note <text>` - Add note
320
- - `--tag <tags...>` - Add tags (space-separated)
321
- - `--due <date>` - Set due date (ISO format: YYYY-MM-DD)
322
- - `--defer <date>` - Set defer date (ISO format)
323
- - `--flagged` - Flag the task
324
- - `--estimate <minutes>` - Set time estimate in minutes
325
-
326
- ### Project Options
327
-
328
- - `--folder <name>` - Assign to folder
329
- - `--note <text>` - Add note
330
- - `--tag <tags...>` - Add tags (space-separated)
331
- - `--sequential` - Make it a sequential project
332
- - `--status <status>` - Set status (active, on hold, dropped)
333
-
334
- ### Tag Options
335
-
336
- **List options:**
337
- - `-u, --unused-days <days>` - Show tags unused for N days
338
- - `-s, --sort <field>` - Sort by: name, usage, activity (default: name)
339
- - `-a, --active-only` - Only count active (incomplete) tasks
340
-
341
- **Create/Update options:**
342
- - `-p, --parent <name>` - Create as child of parent tag (create only)
343
- - `-n, --name <name>` - Rename tag (update only)
344
- - `-a, --active` - Set tag as active (update only)
345
- - `-i, --inactive` - Set tag as inactive (update only)
346
-
347
- ## Task Object Schema
348
-
349
- Task objects include these fields:
350
-
351
- - `id` - Unique identifier
352
- - `name` - Task name
353
- - `note` - Notes (or null)
354
- - `completed` - Boolean completion status
355
- - `flagged` - Boolean flagged status
356
- - `project` - Project name (null for inbox items)
357
- - `tags` - Array of tag names
358
- - `defer` - Defer date in ISO format (or null)
359
- - `due` - Due date in ISO format (or null)
360
- - `estimatedMinutes` - Time estimate in minutes (or null)
361
- - `completionDate` - Completion timestamp (or null)
362
- - `added` - Creation timestamp (or null)
363
- - `modified` - Last modification timestamp (or null)
364
-
365
- ## Examples
366
-
367
- ### Daily Workflow
93
+ ### Other
368
94
 
369
95
  ```bash
370
- # Check inbox
371
- of inbox count
372
-
373
- # List today's tasks
374
- of task list --flagged
375
-
376
- # Add a quick task
377
- of task create "Buy groceries" --tag "errands"
378
-
379
- # Review project status
380
- of project list
96
+ of inbox list # List inbox items
97
+ of inbox count # Inbox count
98
+ of search "query" # Search tasks
381
99
  ```
382
100
 
383
- ### Weekly Review
101
+ ## JSON Output
384
102
 
385
- ```bash
386
- # Check all projects
387
- of project list
388
-
389
- # Review flagged items
390
- of task list --flagged
391
-
392
- # Search for specific topics
393
- of search "meeting"
394
- ```
395
-
396
- ### Task Management
103
+ All commands output JSON. Use `--compact` for single-line output.
397
104
 
398
105
  ```bash
399
- # Create a task in a project with details
400
- of task create "Draft quarterly report" \
401
- --project "Management" \
402
- --tag "writing" \
403
- --due "2024-02-01" \
404
- --estimate 120 \
405
- --note "Include metrics from Q4 dashboard"
406
-
407
- # Complete a task
408
- of task update "Draft quarterly report" --complete
409
-
410
- # Reschedule a task
411
- of task update "Team meeting prep" --due "2024-01-22"
106
+ of task list | jq 'length' # Count tasks
107
+ of task list | jq '.[] | .name' # Task names
108
+ of task list --flagged | jq '.[] | {name, due}' # Specific fields
412
109
  ```
413
110
 
414
- ### Tag Management
415
-
416
- ```bash
417
- # View all tags with usage stats
418
- of tag list
419
-
420
- # Find stale tags not used in 60+ days
421
- of tag list --unused-days 60
422
-
423
- # See most used tags
424
- of tag list --sort usage
425
-
426
- # View recently active tags
427
- of tag list --sort activity
428
-
429
- # Get comprehensive tag statistics
430
- of tag stats
431
-
432
- # Create a new tag
433
- of tag create "Urgent"
111
+ ## Task Schema
434
112
 
435
- # Create nested tags for organization
436
- of tag create "Work Meetings" --parent "Work"
437
- of tag create "Personal Meetings" --parent "Personal"
438
-
439
- # View a specific tag (with hierarchical path if needed)
440
- of tag view "Work/Work Meetings"
441
-
442
- # Rename a stale tag
443
- of tag update "Old Project" --name "Archived Project"
444
-
445
- # Deactivate unused tags
446
- of tag update "Archived Project" --inactive
447
-
448
- # Delete completely unused tags
449
- of tag delete "Obsolete Tag"
113
+ ```json
114
+ {
115
+ "id": "kXu3B-LZfFH",
116
+ "name": "Task name",
117
+ "completed": false,
118
+ "flagged": true,
119
+ "project": "Project Name",
120
+ "tags": ["tag1", "tag2"],
121
+ "due": "2024-01-15T00:00:00.000Z",
122
+ "defer": null,
123
+ "estimatedMinutes": 30,
124
+ "note": "Notes here",
125
+ "added": "2024-01-01T10:00:00.000Z",
126
+ "modified": "2024-01-10T15:30:00.000Z",
127
+ "completionDate": null
128
+ }
450
129
  ```
451
130
 
452
- ## Requirements
131
+ ## Troubleshooting
453
132
 
454
- - macOS (OmniFocus is Mac-only)
455
- - OmniFocus installed and running
456
- - [Bun](https://bun.sh) 1.0+
133
+ **Permission denied**: Grant automation permission in System Settings > Privacy & Security > Automation.
457
134
 
458
- ## How It Works
135
+ **Task not found**: Use exact name or ID. IDs appear in JSON output.
459
136
 
460
- The CLI uses JavaScript for Automation (JXA) to communicate directly with OmniFocus, providing fast, direct access without external services.
137
+ **Date format**: Use ISO format `YYYY-MM-DD` or `YYYY-MM-DDTHH:MM:SS`.
461
138
 
462
139
  ## Development
463
140
 
464
141
  ```bash
465
- # Install dependencies
142
+ git clone https://github.com/stephendolan/omnifocus-cli.git
143
+ cd omnifocus-cli
466
144
  bun install
467
-
468
- # Build TypeScript
469
- bun run build
470
-
471
- # Watch mode for development
472
- bun run dev
473
-
474
- # Link for local testing
475
- bun link
145
+ bun run dev # Watch mode
146
+ bun link # Link globally as `of`
476
147
  ```
477
148
 
478
- ## Troubleshooting
479
-
480
- ### Permission Issues
481
-
482
- When you first run a command, macOS will ask for permission to control OmniFocus. Make sure to grant this permission in System Settings > Privacy & Security > Automation.
483
-
484
- ### Task Not Found
485
-
486
- Use the exact task name or ID. Task IDs are included in the JSON output of all list commands.
487
-
488
- ### Date Format
489
-
490
- Use ISO format for dates: `YYYY-MM-DD` or full ISO strings like `2024-01-15T10:00:00`.
491
-
492
149
  ## License
493
150
 
494
151
  MIT