Skip to content

Commit f088bfd

Browse files
stephendolanclaude
andauthored
chore(release): 2.1.0 (#8)
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 82c9a12 commit f088bfd

File tree

15 files changed

+330
-374
lines changed

15 files changed

+330
-374
lines changed

CLAUDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Commands follow Commander.js patterns:
4343
- All commands output JSON for machine-readable automation
4444

4545
Files:
46-
- `src/index.ts` - Main entry point, registers all commands
46+
- `src/cli.ts` - Main entry point, registers all commands
4747
- `src/commands/task.ts` - Task CRUD operations
4848
- `src/commands/project.ts` - Project CRUD operations
4949
- `src/commands/inbox.ts` - Inbox list/count
@@ -73,10 +73,10 @@ Core types in `src/types.ts`:
7373
5. Parse JSON output from serialized OmniFocus objects
7474

7575
### Error Handling
76-
Commands use `executeOmniFocusCommand()` which:
77-
- Shows loading spinner during execution
78-
- Catches errors and outputs error messages to stderr
76+
Commands use `withErrorHandling()` HOF which:
77+
- Catches errors and outputs JSON error objects to stdout
7978
- Calls `process.exit(1)` on failure
79+
- Error format: `{"error": {"name": "...", "detail": "...", "statusCode": ...}}`
8080
- OmniFocus API errors (like "Task not found") bubble up from JXA execution
8181

8282
### Perspective Tasks

bun.lock

Lines changed: 3 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "@stephendolan/omnifocus-cli",
3-
"version": "2.0.0",
3+
"version": "2.1.0",
44
"description": "A command-line interface for OmniFocus on macOS",
5-
"main": "dist/index.js",
5+
"main": "dist/cli.js",
66
"type": "module",
77
"bin": {
8-
"of": "dist/index.js"
8+
"of": "dist/cli.js"
99
},
1010
"scripts": {
1111
"build": "bun run tsup",
12-
"dev": "bun run src/index.ts",
13-
"start": "bun dist/index.js",
12+
"dev": "bun run src/cli.ts",
13+
"start": "bun dist/cli.js",
1414
"lint": "bun run oxlint src",
1515
"format": "bun run biome format --write src",
1616
"format:check": "bun run biome format src",
@@ -48,16 +48,14 @@
4848
"bun": ">=1.0.0"
4949
},
5050
"dependencies": {
51-
"chalk": "^5.3.0",
5251
"commander": "^12.1.0",
53-
"ora": "^8.1.1"
52+
"dayjs": "^1.11.19"
5453
},
5554
"devDependencies": {
5655
"@biomejs/biome": "^1.9.4",
5756
"@types/node": "^22.10.2",
5857
"oxlint": "^0.16.0",
5958
"tsup": "^8.0.0",
60-
"tsx": "^4.7.0",
6159
"typescript": "^5.7.2",
6260
"vitest": "^4.0.14"
6361
}
File renamed without changes.

src/commands/folder.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Command } from 'commander';
22
import { outputJson } from '../lib/output.js';
3-
import { executeOmniFocusCommand } from '../lib/command-utils.js';
3+
import { withErrorHandling } from '../lib/command-utils.js';
4+
import { OmniFocus } from '../lib/omnifocus.js';
45
import type { FolderFilters } from '../types.js';
56

67
export function createFolderCommand(): Command {
@@ -12,28 +13,26 @@ export function createFolderCommand(): Command {
1213
.alias('ls')
1314
.description('List top-level folders with nested children')
1415
.option('-d, --dropped', 'Include dropped folders')
15-
.action(async (options) => {
16-
await executeOmniFocusCommand(
17-
'Loading folders...',
18-
(of) => of.listFolders({ includeDropped: options.dropped }),
19-
(folders) => outputJson(folders),
20-
'Failed to load folders'
21-
);
22-
});
16+
.action(
17+
withErrorHandling(async (options) => {
18+
const of = new OmniFocus();
19+
const folders = await of.listFolders({ includeDropped: options.dropped });
20+
outputJson(folders);
21+
})
22+
);
2323

2424
command
2525
.command('view <idOrName>')
2626
.description('View folder details and children')
2727
.option('-d, --dropped', 'Include dropped child folders')
28-
.action(async (idOrName, options) => {
29-
const filters: FolderFilters = { includeDropped: options.dropped };
30-
await executeOmniFocusCommand(
31-
'Loading folder...',
32-
(of) => of.getFolder(idOrName, filters),
33-
(folder) => outputJson(folder),
34-
'Failed to load folder'
35-
);
36-
});
28+
.action(
29+
withErrorHandling(async (idOrName, options) => {
30+
const of = new OmniFocus();
31+
const filters: FolderFilters = { includeDropped: options.dropped };
32+
const folder = await of.getFolder(idOrName, filters);
33+
outputJson(folder);
34+
})
35+
);
3736

3837
return command;
3938
}

src/commands/inbox.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Command } from 'commander';
22
import { outputJson } from '../lib/output.js';
3-
import { executeOmniFocusCommand } from '../lib/command-utils.js';
3+
import { withErrorHandling } from '../lib/command-utils.js';
4+
import { OmniFocus } from '../lib/omnifocus.js';
45

56
export function createInboxCommand(): Command {
67
const command = new Command('inbox');
@@ -10,26 +11,24 @@ export function createInboxCommand(): Command {
1011
.command('list')
1112
.alias('ls')
1213
.description('List inbox tasks')
13-
.action(async () => {
14-
await executeOmniFocusCommand(
15-
'Loading inbox...',
16-
(of) => of.listInboxTasks(),
17-
(tasks) => outputJson(tasks),
18-
'Failed to load inbox'
19-
);
20-
});
14+
.action(
15+
withErrorHandling(async () => {
16+
const of = new OmniFocus();
17+
const tasks = await of.listInboxTasks();
18+
outputJson(tasks);
19+
})
20+
);
2121

2222
command
2323
.command('count')
2424
.description('Get inbox count')
25-
.action(async () => {
26-
await executeOmniFocusCommand(
27-
'Counting inbox items...',
28-
(of) => of.getInboxCount(),
29-
(count) => outputJson({ count }),
30-
'Failed to get inbox count'
31-
);
32-
});
25+
.action(
26+
withErrorHandling(async () => {
27+
const of = new OmniFocus();
28+
const count = await of.getInboxCount();
29+
outputJson({ count });
30+
})
31+
);
3332

3433
return command;
3534
}

src/commands/perspective.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Command } from 'commander';
22
import { outputJson } from '../lib/output.js';
3-
import { executeOmniFocusCommand } from '../lib/command-utils.js';
3+
import { withErrorHandling } from '../lib/command-utils.js';
4+
import { OmniFocus } from '../lib/omnifocus.js';
45

56
export function createPerspectiveCommand(): Command {
67
const command = new Command('perspective');
@@ -10,26 +11,24 @@ export function createPerspectiveCommand(): Command {
1011
.command('list')
1112
.alias('ls')
1213
.description('List all perspectives')
13-
.action(async () => {
14-
await executeOmniFocusCommand(
15-
'Loading perspectives...',
16-
(of) => of.listPerspectives(),
17-
(perspectives) => outputJson(perspectives),
18-
'Failed to load perspectives'
19-
);
20-
});
14+
.action(
15+
withErrorHandling(async () => {
16+
const of = new OmniFocus();
17+
const perspectives = await of.listPerspectives();
18+
outputJson(perspectives);
19+
})
20+
);
2121

2222
command
2323
.command('view <name>')
2424
.description('View tasks in a perspective')
25-
.action(async (name) => {
26-
await executeOmniFocusCommand(
27-
`Loading perspective "${name}"...`,
28-
(of) => of.getPerspectiveTasks(name),
29-
(tasks) => outputJson(tasks),
30-
'Failed to load perspective'
31-
);
32-
});
25+
.action(
26+
withErrorHandling(async (name) => {
27+
const of = new OmniFocus();
28+
const tasks = await of.getPerspectiveTasks(name);
29+
outputJson(tasks);
30+
})
31+
);
3332

3433
return command;
3534
}

0 commit comments

Comments
 (0)