@ofocus/sdk 0.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.
Files changed (200) hide show
  1. package/README.md +80 -0
  2. package/api-report/ofocus-sdk.api.md +564 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/applescript.d.ts +30 -0
  5. package/dist/applescript.d.ts.map +1 -0
  6. package/dist/applescript.js +142 -0
  7. package/dist/applescript.js.map +1 -0
  8. package/dist/commands/batch.d.ts +23 -0
  9. package/dist/commands/batch.d.ts.map +1 -0
  10. package/dist/commands/batch.js +324 -0
  11. package/dist/commands/batch.js.map +1 -0
  12. package/dist/commands/complete.d.ts +14 -0
  13. package/dist/commands/complete.d.ts.map +1 -0
  14. package/dist/commands/complete.js +37 -0
  15. package/dist/commands/complete.js.map +1 -0
  16. package/dist/commands/create-project.d.ts +6 -0
  17. package/dist/commands/create-project.d.ts.map +1 -0
  18. package/dist/commands/create-project.js +124 -0
  19. package/dist/commands/create-project.js.map +1 -0
  20. package/dist/commands/drop.d.ts +26 -0
  21. package/dist/commands/drop.d.ts.map +1 -0
  22. package/dist/commands/drop.js +62 -0
  23. package/dist/commands/drop.js.map +1 -0
  24. package/dist/commands/folders.d.ts +10 -0
  25. package/dist/commands/folders.d.ts.map +1 -0
  26. package/dist/commands/folders.js +150 -0
  27. package/dist/commands/folders.js.map +1 -0
  28. package/dist/commands/inbox.d.ts +6 -0
  29. package/dist/commands/inbox.d.ts.map +1 -0
  30. package/dist/commands/inbox.js +124 -0
  31. package/dist/commands/inbox.js.map +1 -0
  32. package/dist/commands/perspectives.d.ts +20 -0
  33. package/dist/commands/perspectives.d.ts.map +1 -0
  34. package/dist/commands/perspectives.js +166 -0
  35. package/dist/commands/perspectives.js.map +1 -0
  36. package/dist/commands/projects.d.ts +6 -0
  37. package/dist/commands/projects.d.ts.map +1 -0
  38. package/dist/commands/projects.js +113 -0
  39. package/dist/commands/projects.js.map +1 -0
  40. package/dist/commands/repetition.d.ts +17 -0
  41. package/dist/commands/repetition.d.ts.map +1 -0
  42. package/dist/commands/repetition.js +59 -0
  43. package/dist/commands/repetition.js.map +1 -0
  44. package/dist/commands/review.d.ts +10 -0
  45. package/dist/commands/review.d.ts.map +1 -0
  46. package/dist/commands/review.js +132 -0
  47. package/dist/commands/review.js.map +1 -0
  48. package/dist/commands/search.d.ts +6 -0
  49. package/dist/commands/search.d.ts.map +1 -0
  50. package/dist/commands/search.js +150 -0
  51. package/dist/commands/search.js.map +1 -0
  52. package/dist/commands/subtasks.d.ts +14 -0
  53. package/dist/commands/subtasks.d.ts.map +1 -0
  54. package/dist/commands/subtasks.js +370 -0
  55. package/dist/commands/subtasks.js.map +1 -0
  56. package/dist/commands/tags-crud.d.ts +22 -0
  57. package/dist/commands/tags-crud.d.ts.map +1 -0
  58. package/dist/commands/tags-crud.js +187 -0
  59. package/dist/commands/tags-crud.js.map +1 -0
  60. package/dist/commands/tags.d.ts +6 -0
  61. package/dist/commands/tags.d.ts.map +1 -0
  62. package/dist/commands/tags.js +61 -0
  63. package/dist/commands/tags.js.map +1 -0
  64. package/dist/commands/tasks.d.ts +6 -0
  65. package/dist/commands/tasks.d.ts.map +1 -0
  66. package/dist/commands/tasks.js +160 -0
  67. package/dist/commands/tasks.js.map +1 -0
  68. package/dist/commands/update.d.ts +6 -0
  69. package/dist/commands/update.d.ts.map +1 -0
  70. package/dist/commands/update.js +179 -0
  71. package/dist/commands/update.js.map +1 -0
  72. package/dist/errors.d.ts +38 -0
  73. package/dist/errors.d.ts.map +1 -0
  74. package/dist/errors.js +77 -0
  75. package/dist/errors.js.map +1 -0
  76. package/dist/escape.d.ts +6 -0
  77. package/dist/escape.d.ts.map +1 -0
  78. package/dist/escape.js +8 -0
  79. package/dist/escape.js.map +1 -0
  80. package/dist/index.d.ts +30 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +36 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/ofocus-sdk.d.ts +608 -0
  85. package/dist/result.d.ts +15 -0
  86. package/dist/result.d.ts.map +1 -0
  87. package/dist/result.js +29 -0
  88. package/dist/result.js.map +1 -0
  89. package/dist/types.d.ts +228 -0
  90. package/dist/types.d.ts.map +1 -0
  91. package/dist/types.js +2 -0
  92. package/dist/types.js.map +1 -0
  93. package/dist/validation.d.ts +57 -0
  94. package/dist/validation.d.ts.map +1 -0
  95. package/dist/validation.js +172 -0
  96. package/dist/validation.js.map +1 -0
  97. package/docs/index.md +30 -0
  98. package/docs/sdk.addtoinbox.md +68 -0
  99. package/docs/sdk.applescriptresult.data.md +11 -0
  100. package/docs/sdk.applescriptresult.error.md +11 -0
  101. package/docs/sdk.applescriptresult.md +92 -0
  102. package/docs/sdk.applescriptresult.success.md +11 -0
  103. package/docs/sdk.clierror.code.md +11 -0
  104. package/docs/sdk.clierror.details.md +11 -0
  105. package/docs/sdk.clierror.md +92 -0
  106. package/docs/sdk.clierror.message.md +11 -0
  107. package/docs/sdk.clioutput.data.md +11 -0
  108. package/docs/sdk.clioutput.error.md +11 -0
  109. package/docs/sdk.clioutput.md +90 -0
  110. package/docs/sdk.clioutput.success.md +11 -0
  111. package/docs/sdk.commandinfo.description.md +11 -0
  112. package/docs/sdk.commandinfo.md +90 -0
  113. package/docs/sdk.commandinfo.name.md +11 -0
  114. package/docs/sdk.commandinfo.usage.md +11 -0
  115. package/docs/sdk.completeresult.completed.md +11 -0
  116. package/docs/sdk.completeresult.md +90 -0
  117. package/docs/sdk.completeresult.taskid.md +11 -0
  118. package/docs/sdk.completeresult.taskname.md +11 -0
  119. package/docs/sdk.completetask.md +52 -0
  120. package/docs/sdk.createerror.md +82 -0
  121. package/docs/sdk.errorcode.md +24 -0
  122. package/docs/sdk.escapeapplescript.md +52 -0
  123. package/docs/sdk.failure.md +52 -0
  124. package/docs/sdk.failuremessage.md +52 -0
  125. package/docs/sdk.inboxoptions.defer.md +11 -0
  126. package/docs/sdk.inboxoptions.due.md +11 -0
  127. package/docs/sdk.inboxoptions.flag.md +11 -0
  128. package/docs/sdk.inboxoptions.md +134 -0
  129. package/docs/sdk.inboxoptions.note.md +11 -0
  130. package/docs/sdk.inboxoptions.tags.md +11 -0
  131. package/docs/sdk.jsonhelpers.md +13 -0
  132. package/docs/sdk.md +471 -0
  133. package/docs/sdk.ofperspective.id.md +11 -0
  134. package/docs/sdk.ofperspective.md +73 -0
  135. package/docs/sdk.ofperspective.name.md +11 -0
  136. package/docs/sdk.ofproject.folderid.md +11 -0
  137. package/docs/sdk.ofproject.foldername.md +11 -0
  138. package/docs/sdk.ofproject.id.md +11 -0
  139. package/docs/sdk.ofproject.md +192 -0
  140. package/docs/sdk.ofproject.name.md +11 -0
  141. package/docs/sdk.ofproject.note.md +11 -0
  142. package/docs/sdk.ofproject.remainingtaskcount.md +11 -0
  143. package/docs/sdk.ofproject.sequential.md +11 -0
  144. package/docs/sdk.ofproject.status.md +11 -0
  145. package/docs/sdk.ofproject.taskcount.md +11 -0
  146. package/docs/sdk.oftag.availabletaskcount.md +11 -0
  147. package/docs/sdk.oftag.id.md +11 -0
  148. package/docs/sdk.oftag.md +124 -0
  149. package/docs/sdk.oftag.name.md +11 -0
  150. package/docs/sdk.oftag.parentid.md +11 -0
  151. package/docs/sdk.oftag.parentname.md +11 -0
  152. package/docs/sdk.oftask.completed.md +11 -0
  153. package/docs/sdk.oftask.completiondate.md +11 -0
  154. package/docs/sdk.oftask.deferdate.md +11 -0
  155. package/docs/sdk.oftask.duedate.md +11 -0
  156. package/docs/sdk.oftask.flagged.md +11 -0
  157. package/docs/sdk.oftask.id.md +11 -0
  158. package/docs/sdk.oftask.md +226 -0
  159. package/docs/sdk.oftask.name.md +11 -0
  160. package/docs/sdk.oftask.note.md +11 -0
  161. package/docs/sdk.oftask.projectid.md +11 -0
  162. package/docs/sdk.oftask.projectname.md +11 -0
  163. package/docs/sdk.oftask.tags.md +11 -0
  164. package/docs/sdk.omnifocusscript.md +52 -0
  165. package/docs/sdk.omnifocusscriptwithhelpers.md +52 -0
  166. package/docs/sdk.parseapplescripterror.md +52 -0
  167. package/docs/sdk.projectqueryoptions.folder.md +11 -0
  168. package/docs/sdk.projectqueryoptions.md +96 -0
  169. package/docs/sdk.projectqueryoptions.sequential.md +11 -0
  170. package/docs/sdk.projectqueryoptions.status.md +11 -0
  171. package/docs/sdk.queryprojects.md +54 -0
  172. package/docs/sdk.querytags.md +54 -0
  173. package/docs/sdk.querytasks.md +54 -0
  174. package/docs/sdk.runapplescript.md +52 -0
  175. package/docs/sdk.runapplescriptfile.md +68 -0
  176. package/docs/sdk.success.md +52 -0
  177. package/docs/sdk.tagqueryoptions.md +58 -0
  178. package/docs/sdk.tagqueryoptions.parent.md +11 -0
  179. package/docs/sdk.taskqueryoptions.available.md +11 -0
  180. package/docs/sdk.taskqueryoptions.completed.md +11 -0
  181. package/docs/sdk.taskqueryoptions.dueafter.md +11 -0
  182. package/docs/sdk.taskqueryoptions.duebefore.md +11 -0
  183. package/docs/sdk.taskqueryoptions.flagged.md +11 -0
  184. package/docs/sdk.taskqueryoptions.md +172 -0
  185. package/docs/sdk.taskqueryoptions.project.md +11 -0
  186. package/docs/sdk.taskqueryoptions.tag.md +11 -0
  187. package/docs/sdk.taskupdateoptions.defer.md +11 -0
  188. package/docs/sdk.taskupdateoptions.due.md +11 -0
  189. package/docs/sdk.taskupdateoptions.flag.md +11 -0
  190. package/docs/sdk.taskupdateoptions.md +172 -0
  191. package/docs/sdk.taskupdateoptions.note.md +11 -0
  192. package/docs/sdk.taskupdateoptions.project.md +11 -0
  193. package/docs/sdk.taskupdateoptions.tags.md +11 -0
  194. package/docs/sdk.taskupdateoptions.title.md +11 -0
  195. package/docs/sdk.updatetask.md +66 -0
  196. package/docs/sdk.validatedatestring.md +54 -0
  197. package/docs/sdk.validateid.md +66 -0
  198. package/docs/sdk.validateprojectname.md +52 -0
  199. package/docs/sdk.validatetags.md +52 -0
  200. package/package.json +51 -0
@@ -0,0 +1,608 @@
1
+ /**
2
+ * Add a task to the OmniFocus inbox.
3
+ */
4
+ export declare function addToInbox(title: string, options?: InboxOptions): Promise<CliOutput<OFTask>>;
5
+
6
+ export declare interface AppleScriptResult<T> {
7
+ success: boolean;
8
+ data?: T;
9
+ error?: CliError;
10
+ }
11
+
12
+ /** Batch complete result item */
13
+ export declare interface BatchCompleteItem {
14
+ taskId: string;
15
+ taskName: string;
16
+ }
17
+
18
+ /** Batch delete result item */
19
+ export declare interface BatchDeleteItem {
20
+ taskId: string;
21
+ }
22
+
23
+ /**
24
+ * Result from a batch operation.
25
+ */
26
+ export declare interface BatchResult<T> {
27
+ succeeded: T[];
28
+ failed: {
29
+ id: string;
30
+ error: string;
31
+ }[];
32
+ totalSucceeded: number;
33
+ totalFailed: number;
34
+ }
35
+
36
+ /**
37
+ * Build AppleScript to set a repetition rule on a task.
38
+ * @param taskVar - The AppleScript variable name for the task
39
+ * @param rule - The repetition rule to apply
40
+ */
41
+ export declare function buildRepetitionRuleScript(taskVar: string, rule: RepetitionRule): string;
42
+
43
+ /**
44
+ * Build iCalendar RRULE string from a RepetitionRule.
45
+ */
46
+ export declare function buildRRule(rule: RepetitionRule): string;
47
+
48
+ /**
49
+ * Structured error representation for CLI output.
50
+ */
51
+ export declare interface CliError {
52
+ code: ErrorCode;
53
+ message: string;
54
+ details?: string;
55
+ }
56
+
57
+ /**
58
+ * Standard CLI output format for all commands.
59
+ */
60
+ export declare interface CliOutput<T> {
61
+ success: boolean;
62
+ data: T | null;
63
+ error: CliError | null;
64
+ }
65
+
66
+ /**
67
+ * Metadata about a CLI command for semantic activation by AI agents.
68
+ */
69
+ export declare interface CommandInfo {
70
+ name: string;
71
+ description: string;
72
+ usage: string;
73
+ }
74
+
75
+ /**
76
+ * Result from completing a task.
77
+ */
78
+ export declare interface CompleteResult {
79
+ taskId: string;
80
+ taskName: string;
81
+ completed: boolean;
82
+ }
83
+
84
+ /**
85
+ * Mark a task as complete in OmniFocus.
86
+ */
87
+ export declare function completeTask(taskId: string): Promise<CliOutput<CompleteResult>>;
88
+
89
+ /**
90
+ * Complete multiple tasks in a single operation.
91
+ */
92
+ export declare function completeTasks(taskIds: string[]): Promise<CliOutput<BatchResult<BatchCompleteItem>>>;
93
+
94
+ /**
95
+ * Create a CliError with the given code and message.
96
+ */
97
+ export declare function createError(code: ErrorCode, message: string, details?: string): CliError;
98
+
99
+ /**
100
+ * Create a new folder in OmniFocus.
101
+ */
102
+ export declare function createFolder(name: string, options?: CreateFolderOptions): Promise<CliOutput<OFFolder>>;
103
+
104
+ /**
105
+ * Options for creating a folder.
106
+ */
107
+ export declare interface CreateFolderOptions {
108
+ parentFolderId?: string | undefined;
109
+ parentFolderName?: string | undefined;
110
+ }
111
+
112
+ /**
113
+ * Create a new project in OmniFocus.
114
+ */
115
+ export declare function createProject(name: string, options?: CreateProjectOptions): Promise<CliOutput<OFProject>>;
116
+
117
+ /**
118
+ * Options for creating a project.
119
+ */
120
+ export declare interface CreateProjectOptions {
121
+ note?: string | undefined;
122
+ folderId?: string | undefined;
123
+ folderName?: string | undefined;
124
+ sequential?: boolean | undefined;
125
+ status?: "active" | "on-hold" | undefined;
126
+ dueDate?: string | undefined;
127
+ deferDate?: string | undefined;
128
+ }
129
+
130
+ /**
131
+ * Create a subtask under a parent task in OmniFocus.
132
+ */
133
+ export declare function createSubtask(title: string, parentTaskId: string, options?: InboxOptions): Promise<CliOutput<OFTaskWithChildren>>;
134
+
135
+ /**
136
+ * Create a new tag in OmniFocus.
137
+ */
138
+ export declare function createTag(name: string, options?: CreateTagOptions): Promise<CliOutput<OFTag>>;
139
+
140
+ /**
141
+ * Options for creating a tag.
142
+ */
143
+ export declare interface CreateTagOptions {
144
+ parentTagId?: string | undefined;
145
+ parentTagName?: string | undefined;
146
+ }
147
+
148
+ /**
149
+ * Result from deleting a task.
150
+ */
151
+ export declare interface DeleteResult {
152
+ taskId: string;
153
+ deleted: true;
154
+ }
155
+
156
+ /**
157
+ * Delete a tag from OmniFocus.
158
+ * Note: This cannot be undone.
159
+ */
160
+ export declare function deleteTag(tagId: string): Promise<CliOutput<DeleteTagResult>>;
161
+
162
+ /**
163
+ * Result from deleting a tag.
164
+ */
165
+ export declare interface DeleteTagResult {
166
+ tagId: string;
167
+ deleted: true;
168
+ }
169
+
170
+ /**
171
+ * Delete a task permanently from OmniFocus.
172
+ * Note: This cannot be undone.
173
+ */
174
+ export declare function deleteTask(taskId: string): Promise<CliOutput<DeleteResult>>;
175
+
176
+ /**
177
+ * Delete multiple tasks permanently in a single operation.
178
+ */
179
+ export declare function deleteTasks(taskIds: string[]): Promise<CliOutput<BatchResult<BatchDeleteItem>>>;
180
+
181
+ /**
182
+ * Result from dropping a task.
183
+ */
184
+ export declare interface DropResult {
185
+ taskId: string;
186
+ taskName: string;
187
+ dropped: boolean;
188
+ }
189
+
190
+ /**
191
+ * Drop a task in OmniFocus (marks as dropped but keeps history).
192
+ */
193
+ export declare function dropTask(taskId: string): Promise<CliOutput<DropResult>>;
194
+
195
+ /**
196
+ * Error codes for semantic error handling.
197
+ */
198
+ declare const ErrorCode: {
199
+ readonly TASK_NOT_FOUND: "TASK_NOT_FOUND";
200
+ readonly PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND";
201
+ readonly TAG_NOT_FOUND: "TAG_NOT_FOUND";
202
+ readonly FOLDER_NOT_FOUND: "FOLDER_NOT_FOUND";
203
+ readonly PERSPECTIVE_NOT_FOUND: "PERSPECTIVE_NOT_FOUND";
204
+ readonly DUPLICATE_NAME: "DUPLICATE_NAME";
205
+ readonly OMNIFOCUS_NOT_RUNNING: "OMNIFOCUS_NOT_RUNNING";
206
+ readonly INVALID_DATE_FORMAT: "INVALID_DATE_FORMAT";
207
+ readonly INVALID_ID_FORMAT: "INVALID_ID_FORMAT";
208
+ readonly INVALID_REPETITION_RULE: "INVALID_REPETITION_RULE";
209
+ readonly APPLESCRIPT_ERROR: "APPLESCRIPT_ERROR";
210
+ readonly JSON_PARSE_ERROR: "JSON_PARSE_ERROR";
211
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
212
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
213
+ };
214
+
215
+ declare type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
216
+ export { ErrorCode }
217
+ export { ErrorCode as ErrorCodeType }
218
+
219
+ /**
220
+ * Escape a string for safe use in AppleScript double-quoted strings.
221
+ * Handles backslashes and double quotes.
222
+ */
223
+ export declare function escapeAppleScript(str: string): string;
224
+
225
+ /**
226
+ * Create a failed CLI output with a structured error.
227
+ */
228
+ export declare function failure<T = null>(error: CliError): CliOutput<T>;
229
+
230
+ /**
231
+ * Create a failed CLI output with a simple string message.
232
+ * This is a convenience function that wraps the message in an UNKNOWN_ERROR.
233
+ */
234
+ export declare function failureMessage<T = null>(message: string): CliOutput<T>;
235
+
236
+ /**
237
+ * Options for querying folders.
238
+ */
239
+ export declare interface FolderQueryOptions {
240
+ parent?: string | undefined;
241
+ }
242
+
243
+ /**
244
+ * Options for adding a task to the inbox.
245
+ */
246
+ export declare interface InboxOptions {
247
+ note?: string | undefined;
248
+ due?: string | undefined;
249
+ defer?: string | undefined;
250
+ flag?: boolean | undefined;
251
+ tags?: string[] | undefined;
252
+ estimatedMinutes?: number | undefined;
253
+ repeat?: RepetitionRule | undefined;
254
+ }
255
+
256
+ /**
257
+ * AppleScript helper functions for JSON serialization.
258
+ * These must be defined at the top level (outside tell blocks).
259
+ */
260
+ export declare const jsonHelpers = "\non jsonString(val)\n if val is \"\" or val is missing value or val is \"missing value\" then\n return \"null\"\n else\n return \"\\\"\" & my escapeJson(val) & \"\\\"\"\n end if\nend jsonString\n\non jsonArray(theList)\n if (count of theList) is 0 then\n return \"[]\"\n end if\n set output to \"[\"\n repeat with i from 1 to count of theList\n if i > 1 then set output to output & \",\"\n set output to output & \"\\\"\" & (my escapeJson(item i of theList)) & \"\\\"\"\n end repeat\n return output & \"]\"\nend jsonArray\n\non escapeJson(str)\n set output to \"\"\n repeat with c in characters of (str as string)\n if c is \"\\\"\" then\n set output to output & \"\\\\\\\"\"\n else if c is \"\\\\\" then\n set output to output & \"\\\\\\\\\"\n else if c is return then\n set output to output & \"\\\\n\"\n else if c is linefeed then\n set output to output & \"\\\\n\"\n else\n set output to output & c\n end if\n end repeat\n return output\nend escapeJson\n";
261
+
262
+ /**
263
+ * List all perspectives in OmniFocus.
264
+ */
265
+ export declare function listPerspectives(): Promise<CliOutput<OFPerspective[]>>;
266
+
267
+ /**
268
+ * Move a task to become a subtask of another task.
269
+ */
270
+ export declare function moveTaskToParent(taskId: string, parentTaskId: string): Promise<CliOutput<OFTaskWithChildren>>;
271
+
272
+ /**
273
+ * OmniFocus folder representation.
274
+ */
275
+ export declare interface OFFolder {
276
+ id: string;
277
+ name: string;
278
+ parentId: string | null;
279
+ parentName: string | null;
280
+ projectCount: number;
281
+ folderCount: number;
282
+ }
283
+
284
+ /**
285
+ * OmniFocus perspective representation.
286
+ */
287
+ export declare interface OFPerspective {
288
+ id: string;
289
+ name: string;
290
+ custom: boolean;
291
+ }
292
+
293
+ /**
294
+ * OmniFocus project representation.
295
+ */
296
+ export declare interface OFProject {
297
+ id: string;
298
+ name: string;
299
+ note: string | null;
300
+ status: "active" | "on-hold" | "completed" | "dropped";
301
+ sequential: boolean;
302
+ folderId: string | null;
303
+ folderName: string | null;
304
+ taskCount: number;
305
+ remainingTaskCount: number;
306
+ }
307
+
308
+ /**
309
+ * OmniFocus tag representation.
310
+ */
311
+ export declare interface OFTag {
312
+ id: string;
313
+ name: string;
314
+ parentId: string | null;
315
+ parentName: string | null;
316
+ availableTaskCount: number;
317
+ }
318
+
319
+ /**
320
+ * OmniFocus task representation.
321
+ */
322
+ export declare interface OFTask {
323
+ id: string;
324
+ name: string;
325
+ note: string | null;
326
+ flagged: boolean;
327
+ completed: boolean;
328
+ dueDate: string | null;
329
+ deferDate: string | null;
330
+ completionDate: string | null;
331
+ projectId: string | null;
332
+ projectName: string | null;
333
+ tags: string[];
334
+ estimatedMinutes: number | null;
335
+ }
336
+
337
+ /**
338
+ * OmniFocus task with hierarchy information.
339
+ */
340
+ export declare interface OFTaskWithChildren extends OFTask {
341
+ parentTaskId: string | null;
342
+ parentTaskName: string | null;
343
+ childTaskCount: number;
344
+ isActionGroup: boolean;
345
+ }
346
+
347
+ /**
348
+ * Build an AppleScript that tells OmniFocus to do something.
349
+ */
350
+ export declare function omniFocusScript(body: string): string;
351
+
352
+ /**
353
+ * Build an AppleScript that tells OmniFocus to do something,
354
+ * with JSON helper functions defined at the top level.
355
+ */
356
+ export declare function omniFocusScriptWithHelpers(body: string): string;
357
+
358
+ /**
359
+ * Parse an AppleScript error message into a structured CliError.
360
+ * Detects common error patterns and maps them to appropriate error codes.
361
+ */
362
+ export declare function parseAppleScriptError(rawError: string): CliError;
363
+
364
+ /**
365
+ * Options for querying a perspective.
366
+ */
367
+ export declare interface PerspectiveQueryOptions {
368
+ limit?: number | undefined;
369
+ }
370
+
371
+ /**
372
+ * Options for querying projects.
373
+ */
374
+ export declare interface ProjectQueryOptions {
375
+ folder?: string | undefined;
376
+ status?: "active" | "on-hold" | "completed" | "dropped" | undefined;
377
+ sequential?: boolean | undefined;
378
+ }
379
+
380
+ /**
381
+ * Query folders from OmniFocus with optional filters.
382
+ */
383
+ export declare function queryFolders(options?: FolderQueryOptions): Promise<CliOutput<OFFolder[]>>;
384
+
385
+ /**
386
+ * Query tasks from a specific perspective in OmniFocus.
387
+ *
388
+ * Note: This function retrieves tasks based on the perspective's filtering rules.
389
+ * Some perspectives may require UI interaction in OmniFocus to be properly evaluated.
390
+ * Built-in perspectives like "Flagged", "Forecast", and "Projects" work best.
391
+ */
392
+ export declare function queryPerspective(name: string, options?: PerspectiveQueryOptions): Promise<CliOutput<OFTask[]>>;
393
+
394
+ /**
395
+ * Query projects from OmniFocus with optional filters.
396
+ */
397
+ export declare function queryProjects(options?: ProjectQueryOptions): Promise<CliOutput<OFProject[]>>;
398
+
399
+ /**
400
+ * Query projects that are due for review in OmniFocus.
401
+ */
402
+ export declare function queryProjectsForReview(): Promise<CliOutput<OFProject[]>>;
403
+
404
+ /**
405
+ * Query subtasks of a parent task in OmniFocus.
406
+ */
407
+ export declare function querySubtasks(parentTaskId: string, options?: SubtaskQueryOptions): Promise<CliOutput<OFTaskWithChildren[]>>;
408
+
409
+ /**
410
+ * Query tags from OmniFocus with optional filters.
411
+ */
412
+ export declare function queryTags(options?: TagQueryOptions): Promise<CliOutput<OFTag[]>>;
413
+
414
+ /**
415
+ * Query tasks from OmniFocus with optional filters.
416
+ */
417
+ export declare function queryTasks(options?: TaskQueryOptions): Promise<CliOutput<OFTask[]>>;
418
+
419
+ /**
420
+ * Repetition rule for recurring tasks.
421
+ */
422
+ export declare interface RepetitionRule {
423
+ frequency: "daily" | "weekly" | "monthly" | "yearly";
424
+ interval: number;
425
+ repeatMethod: "due-again" | "defer-another";
426
+ daysOfWeek?: number[] | undefined;
427
+ dayOfMonth?: number | undefined;
428
+ }
429
+
430
+ /**
431
+ * Mark a project as reviewed in OmniFocus.
432
+ */
433
+ export declare function reviewProject(projectId: string): Promise<CliOutput<ReviewResult>>;
434
+
435
+ /**
436
+ * Result from a review operation.
437
+ */
438
+ export declare interface ReviewResult {
439
+ projectId: string;
440
+ projectName: string;
441
+ lastReviewed: string;
442
+ nextReviewDate: string | null;
443
+ }
444
+
445
+ /**
446
+ * Execute an AppleScript and return the result.
447
+ * The script should return a value that can be parsed as JSON for structured data.
448
+ */
449
+ export declare function runAppleScript<T>(script: string): Promise<AppleScriptResult<T>>;
450
+
451
+ /**
452
+ * Execute an AppleScript file.
453
+ */
454
+ export declare function runAppleScriptFile<T>(filePath: string, args?: string[]): Promise<AppleScriptResult<T>>;
455
+
456
+ /**
457
+ * Options for searching tasks.
458
+ */
459
+ export declare interface SearchOptions {
460
+ scope?: "name" | "note" | "both" | undefined;
461
+ limit?: number | undefined;
462
+ includeCompleted?: boolean | undefined;
463
+ }
464
+
465
+ /**
466
+ * Search tasks in OmniFocus.
467
+ */
468
+ export declare function searchTasks(query: string, options?: SearchOptions): Promise<CliOutput<OFTask[]>>;
469
+
470
+ /**
471
+ * Options for querying subtasks.
472
+ */
473
+ export declare interface SubtaskQueryOptions {
474
+ completed?: boolean | undefined;
475
+ flagged?: boolean | undefined;
476
+ }
477
+
478
+ /**
479
+ * Create a successful CLI output.
480
+ */
481
+ export declare function success<T>(data: T): CliOutput<T>;
482
+
483
+ /**
484
+ * Options for querying tags.
485
+ */
486
+ export declare interface TagQueryOptions {
487
+ parent?: string | undefined;
488
+ }
489
+
490
+ /**
491
+ * Options for querying tasks.
492
+ */
493
+ export declare interface TaskQueryOptions {
494
+ project?: string | undefined;
495
+ tag?: string | undefined;
496
+ dueBefore?: string | undefined;
497
+ dueAfter?: string | undefined;
498
+ flagged?: boolean | undefined;
499
+ completed?: boolean | undefined;
500
+ available?: boolean | undefined;
501
+ }
502
+
503
+ /**
504
+ * Options for updating a task.
505
+ */
506
+ export declare interface TaskUpdateOptions {
507
+ title?: string | undefined;
508
+ note?: string | undefined;
509
+ due?: string | undefined;
510
+ defer?: string | undefined;
511
+ flag?: boolean | undefined;
512
+ project?: string | undefined;
513
+ tags?: string[] | undefined;
514
+ estimatedMinutes?: number | undefined;
515
+ clearEstimate?: boolean | undefined;
516
+ repeat?: RepetitionRule | undefined;
517
+ clearRepeat?: boolean | undefined;
518
+ }
519
+
520
+ /**
521
+ * Update an existing tag in OmniFocus.
522
+ */
523
+ export declare function updateTag(tagId: string, options: UpdateTagOptions): Promise<CliOutput<OFTag>>;
524
+
525
+ /**
526
+ * Options for updating a tag.
527
+ */
528
+ export declare interface UpdateTagOptions {
529
+ name?: string | undefined;
530
+ parentTagId?: string | undefined;
531
+ parentTagName?: string | undefined;
532
+ }
533
+
534
+ /**
535
+ * Update properties of an existing task in OmniFocus.
536
+ */
537
+ export declare function updateTask(taskId: string, options: TaskUpdateOptions): Promise<CliOutput<OFTask>>;
538
+
539
+ /**
540
+ * Update multiple tasks with the same properties in a single operation.
541
+ */
542
+ export declare function updateTasks(taskIds: string[], options: TaskUpdateOptions): Promise<CliOutput<BatchResult<BatchCompleteItem>>>;
543
+
544
+ /**
545
+ * Validate a date string for use with AppleScript.
546
+ * Returns null if valid (or empty), or a CliError if invalid.
547
+ *
548
+ * Note: We do basic validation here; the actual date parsing
549
+ * is done by AppleScript and more detailed errors come from there.
550
+ */
551
+ export declare function validateDateString(dateStr: string): CliError | null;
552
+
553
+ /**
554
+ * Validate an estimated minutes value.
555
+ * Returns null if valid (or undefined), or a CliError if invalid.
556
+ */
557
+ export declare function validateEstimatedMinutes(minutes: number | undefined): CliError | null;
558
+
559
+ /**
560
+ * Validate a folder name.
561
+ * Returns null if valid (or empty), or a CliError if invalid.
562
+ */
563
+ export declare function validateFolderName(name: string | undefined): CliError | null;
564
+
565
+ /**
566
+ * Validate an OmniFocus ID string.
567
+ * IDs are alphanumeric with possible dashes/underscores.
568
+ * Returns null if valid, or a CliError if invalid.
569
+ */
570
+ export declare function validateId(id: string, type: "task" | "project" | "tag"): CliError | null;
571
+
572
+ /**
573
+ * Validate a project name.
574
+ * Returns null if valid (or empty), or a CliError if invalid.
575
+ */
576
+ export declare function validateProjectName(name: string | undefined): CliError | null;
577
+
578
+ /**
579
+ * Validate a repetition rule.
580
+ * Returns null if valid (or undefined), or a CliError if invalid.
581
+ */
582
+ export declare function validateRepetitionRule(rule: {
583
+ frequency: string;
584
+ interval: number;
585
+ repeatMethod: string;
586
+ daysOfWeek?: number[] | undefined;
587
+ dayOfMonth?: number | undefined;
588
+ } | undefined): CliError | null;
589
+
590
+ /**
591
+ * Validate a search query.
592
+ * Returns null if valid, or a CliError if invalid.
593
+ */
594
+ export declare function validateSearchQuery(query: string): CliError | null;
595
+
596
+ /**
597
+ * Validate a tag name for creation/update.
598
+ * Returns null if valid, or a CliError if invalid.
599
+ */
600
+ export declare function validateTagName(name: string): CliError | null;
601
+
602
+ /**
603
+ * Validate a list of tag names.
604
+ * Returns null if valid, or a CliError if any tag is invalid.
605
+ */
606
+ export declare function validateTags(tags: string[] | undefined): CliError | null;
607
+
608
+ export { }
@@ -0,0 +1,15 @@
1
+ import type { CliOutput, CliError } from "./types.js";
2
+ /**
3
+ * Create a successful CLI output.
4
+ */
5
+ export declare function success<T>(data: T): CliOutput<T>;
6
+ /**
7
+ * Create a failed CLI output with a structured error.
8
+ */
9
+ export declare function failure<T = null>(error: CliError): CliOutput<T>;
10
+ /**
11
+ * Create a failed CLI output with a simple string message.
12
+ * This is a convenience function that wraps the message in an UNKNOWN_ERROR.
13
+ */
14
+ export declare function failureMessage<T = null>(message: string): CliOutput<T>;
15
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtD;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAMhD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAM/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAEtE"}
package/dist/result.js ADDED
@@ -0,0 +1,29 @@
1
+ import { ErrorCode, createError } from "./errors.js";
2
+ /**
3
+ * Create a successful CLI output.
4
+ */
5
+ export function success(data) {
6
+ return {
7
+ success: true,
8
+ data,
9
+ error: null,
10
+ };
11
+ }
12
+ /**
13
+ * Create a failed CLI output with a structured error.
14
+ */
15
+ export function failure(error) {
16
+ return {
17
+ success: false,
18
+ data: null,
19
+ error,
20
+ };
21
+ }
22
+ /**
23
+ * Create a failed CLI output with a simple string message.
24
+ * This is a convenience function that wraps the message in an UNKNOWN_ERROR.
25
+ */
26
+ export function failureMessage(message) {
27
+ return failure(createError(ErrorCode.UNKNOWN_ERROR, message));
28
+ }
29
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,MAAM,UAAU,OAAO,CAAI,IAAO;IAChC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI;QACJ,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAW,KAAe;IAC/C,OAAO;QACL,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,IAAI;QACV,KAAK;KACN,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAW,OAAe;IACtD,OAAO,OAAO,CAAI,WAAW,CAAC,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC"}