things-api 0.6.0 → 0.8.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 (130) hide show
  1. package/README.md +13 -1
  2. package/dist/cli/commands/area.d.ts +14 -0
  3. package/dist/cli/commands/area.js +112 -33
  4. package/dist/cli/commands/area.js.map +1 -1
  5. package/dist/cli/commands/doctor.js +8 -0
  6. package/dist/cli/commands/doctor.js.map +1 -1
  7. package/dist/cli/commands/project.d.ts +14 -0
  8. package/dist/cli/commands/project.js +123 -34
  9. package/dist/cli/commands/project.js.map +1 -1
  10. package/dist/cli/commands/reads.d.ts +111 -10
  11. package/dist/cli/commands/reads.js +567 -73
  12. package/dist/cli/commands/reads.js.map +1 -1
  13. package/dist/cli/commands/setup.d.ts +2 -0
  14. package/dist/cli/commands/setup.js +91 -0
  15. package/dist/cli/commands/setup.js.map +1 -0
  16. package/dist/cli/commands/show.d.ts +9 -0
  17. package/dist/cli/commands/show.js +41 -0
  18. package/dist/cli/commands/show.js.map +1 -0
  19. package/dist/cli/commands/todo.d.ts +9 -0
  20. package/dist/cli/commands/todo.js +89 -15
  21. package/dist/cli/commands/todo.js.map +1 -1
  22. package/dist/cli/commands/writes.js +55 -1
  23. package/dist/cli/commands/writes.js.map +1 -1
  24. package/dist/cli/glyphs.d.ts +72 -0
  25. package/dist/cli/glyphs.js +169 -0
  26. package/dist/cli/glyphs.js.map +1 -0
  27. package/dist/cli/main.js +4 -0
  28. package/dist/cli/main.js.map +1 -1
  29. package/dist/cli/style.d.ts +6 -0
  30. package/dist/cli/style.js +6 -0
  31. package/dist/cli/style.js.map +1 -1
  32. package/dist/client.d.ts +35 -37
  33. package/dist/client.js +10 -74
  34. package/dist/client.js.map +1 -1
  35. package/dist/contracts.d.ts +1 -1
  36. package/dist/contracts.js +1 -1
  37. package/dist/db/baselines/db-v26.js +7 -5
  38. package/dist/db/baselines/db-v26.js.map +1 -1
  39. package/dist/db/schema.d.ts +1 -1
  40. package/dist/db/schema.js +7 -1
  41. package/dist/db/schema.js.map +1 -1
  42. package/dist/diagnose.d.ts +19 -0
  43. package/dist/diagnose.js +42 -0
  44. package/dist/diagnose.js.map +1 -1
  45. package/dist/mcp/server.js +20 -1
  46. package/dist/mcp/server.js.map +1 -1
  47. package/dist/model/entities.d.ts +14 -0
  48. package/dist/model/entities.js.map +1 -1
  49. package/dist/model/mappers.js +8 -0
  50. package/dist/model/mappers.js.map +1 -1
  51. package/dist/model/occurrences.js +4 -1
  52. package/dist/model/occurrences.js.map +1 -1
  53. package/dist/model/recurrence.d.ts +23 -2
  54. package/dist/model/recurrence.js +33 -1
  55. package/dist/model/recurrence.js.map +1 -1
  56. package/dist/read/area-view.js +21 -5
  57. package/dist/read/area-view.js.map +1 -1
  58. package/dist/read/detail.js +12 -2
  59. package/dist/read/detail.js.map +1 -1
  60. package/dist/read/log-boundary.d.ts +24 -0
  61. package/dist/read/log-boundary.js +38 -0
  62. package/dist/read/log-boundary.js.map +1 -0
  63. package/dist/read/project-view.js +28 -3
  64. package/dist/read/project-view.js.map +1 -1
  65. package/dist/read/queries.d.ts +14 -1
  66. package/dist/read/queries.js +25 -2
  67. package/dist/read/queries.js.map +1 -1
  68. package/dist/read/show-target.d.ts +16 -0
  69. package/dist/read/show-target.js +32 -0
  70. package/dist/read/show-target.js.map +1 -0
  71. package/dist/read/snapshot.js +2 -0
  72. package/dist/read/snapshot.js.map +1 -1
  73. package/dist/read/views.d.ts +25 -3
  74. package/dist/read/views.js +176 -21
  75. package/dist/read/views.js.map +1 -1
  76. package/dist/write/automation-probe.js +14 -6
  77. package/dist/write/automation-probe.js.map +1 -1
  78. package/dist/write/availability.d.ts +28 -0
  79. package/dist/write/availability.js +105 -0
  80. package/dist/write/availability.js.map +1 -0
  81. package/dist/write/capabilities.d.ts +3 -0
  82. package/dist/write/capabilities.js +2 -0
  83. package/dist/write/capabilities.js.map +1 -1
  84. package/dist/write/checklist.d.ts +50 -0
  85. package/dist/write/checklist.js +61 -0
  86. package/dist/write/checklist.js.map +1 -0
  87. package/dist/write/clear-reminder.d.ts +3 -0
  88. package/dist/write/clear-reminder.js +205 -0
  89. package/dist/write/clear-reminder.js.map +1 -0
  90. package/dist/write/commands.js +129 -9
  91. package/dist/write/commands.js.map +1 -1
  92. package/dist/write/edit-checklist.d.ts +3 -0
  93. package/dist/write/edit-checklist.js +184 -0
  94. package/dist/write/edit-checklist.js.map +1 -0
  95. package/dist/write/failure-hints.d.ts +14 -1
  96. package/dist/write/failure-hints.js +31 -6
  97. package/dist/write/failure-hints.js.map +1 -1
  98. package/dist/write/guards.d.ts +1 -1
  99. package/dist/write/guards.js +16 -0
  100. package/dist/write/guards.js.map +1 -1
  101. package/dist/write/operations.d.ts +32 -1
  102. package/dist/write/operations.js +3 -0
  103. package/dist/write/operations.js.map +1 -1
  104. package/dist/write/pipeline.d.ts +5 -0
  105. package/dist/write/pipeline.js +24 -1
  106. package/dist/write/pipeline.js.map +1 -1
  107. package/dist/write/reversibility.d.ts +46 -0
  108. package/dist/write/reversibility.js +164 -0
  109. package/dist/write/reversibility.js.map +1 -0
  110. package/dist/write/undo.d.ts +29 -2
  111. package/dist/write/undo.js +356 -9
  112. package/dist/write/undo.js.map +1 -1
  113. package/dist/write/vectors/registry.js +2 -1
  114. package/dist/write/vectors/registry.js.map +1 -1
  115. package/dist/write/vectors/shortcuts.d.ts +9 -0
  116. package/dist/write/vectors/shortcuts.js +90 -0
  117. package/dist/write/vectors/shortcuts.js.map +1 -0
  118. package/dist/write/vectors/types.d.ts +11 -3
  119. package/dist/write/vectors/url-scheme.js +16 -0
  120. package/dist/write/vectors/url-scheme.js.map +1 -1
  121. package/dist/write/verify/delta.d.ts +1 -1
  122. package/dist/write/verify/delta.js +1 -1
  123. package/dist/write/verify/delta.js.map +1 -1
  124. package/package.json +3 -2
  125. package/shortcuts/things-proxy-create-heading.shortcut +0 -0
  126. package/shortcuts/things-proxy-delete-items-permanently.shortcut +0 -0
  127. package/shortcuts/things-proxy-delete-items.shortcut +0 -0
  128. package/shortcuts/things-proxy-edit-title.shortcut +0 -0
  129. package/shortcuts/things-proxy-find-items.shortcut +0 -0
  130. package/shortcuts/things-proxy-set-detail.shortcut +0 -0
@@ -4,23 +4,61 @@
4
4
  */
5
5
  import type { Command } from "commander";
6
6
  import { type ThingsClient } from "../../client.ts";
7
- import { type ListItem } from "../../read/views.ts";
7
+ import { type ListItem, type SidebarSection } from "../../read/views.ts";
8
8
  interface GlobalReadOpts {
9
9
  json?: boolean;
10
10
  db?: string;
11
11
  }
12
12
  export declare function withClient(opts: GlobalReadOpts, kind: string, fn: (client: ThingsClient) => unknown, render: (data: never) => string[]): void;
13
+ export interface FormatOpts {
14
+ /**
15
+ * Render a grouped project TITLE row: bold+underlined title (the GUI's
16
+ * project-header look) — the circle glyph and count chip still apply.
17
+ */
18
+ projectTitle?: boolean;
19
+ /** Container uuids already implied by surrounding output — their context suffix is dropped. */
20
+ suppressProject?: string | null;
21
+ suppressArea?: string | null;
22
+ /** Reference instant for date-relative tokens (tests pin this; defaults to now). */
23
+ now?: Date;
24
+ /** Pre-styled Today/Evening mark (★/⏾), rendered right after the box — GUI position. */
25
+ mark?: string | null;
26
+ /** Dim status word after the box (the GUI's waiting/paused/ended chips on repeating templates). */
27
+ statusWord?: string;
28
+ /** Suppress the ‹date› chip (rows under a day header already carry the date). */
29
+ hideDateChip?: boolean;
30
+ }
31
+ /**
32
+ * One item line:
33
+ * `<uuid-prefix> <box> [★|⏾] [logged-date] [‹chip›] <title> [‹n›] [⍾] [≡] [≔] (container) #tags [⚑ deadline]`.
34
+ * Repeating templates seat ↻ INSIDE the box (`[↻]`/`(↻)`) rather than as a
35
+ * separate mark; open project rows render their circle and title blue.
36
+ * The box is the glyph-language state carrier (../glyphs.ts): `[ ]`-family
37
+ * for to-dos, `( )`-family for projects — state survives with color
38
+ * stripped. Completed titles dim; canceled titles dim+strike (the `[×]`
39
+ * mark keeps the state when strike/ANSI is unavailable). Human output shows
40
+ * a SHORTENED uuid prefix (every command accepts unique prefixes >= 6
41
+ * chars); `uuidWidth` is the display length from uuidDisplayWidth — never
42
+ * below 8 so a copied prefix stays unique across the whole database, not
43
+ * just the rendered list. Tags follow the title (`#`-prefixed, green — GUI
44
+ * color), after the count chip (projects), notes marker, and container.
45
+ * Heading-nested to-dos label their parent PROJECT (via headingProject),
46
+ * never the heading — GUI behavior. Colors engage on a TTY only
47
+ * (../style.ts); `--json` always carries full uuids.
48
+ */
49
+ export declare function formatItem(item: ListItem, uuidWidth?: number, opts?: FormatOpts): string;
50
+ /**
51
+ * Row prefix in today-aware views: yellow ★ for Today members, cyan ⏾ for
52
+ * effective This-Evening members (raw evening assignment counts only while
53
+ * startDate is exactly today — the UI's daily expiry), null otherwise.
54
+ */
55
+ export declare function todayMark(item: ListItem, now?: Date): string | null;
13
56
  /**
14
- * One item line: `<uuid-prefix> <marker> [meta …] <title> (container)`.
15
- * Human output shows a SHORTENED uuid prefix (every command accepts unique
16
- * prefixes >= 6 chars); `uuidWidth` is the display length from
17
- * uuidDisplayWidth — never below 8 so a copied prefix stays unique across
18
- * the whole database, not just the rendered list. Exactly one space
19
- * separates every following token; meta tokens colorize on a TTY only
20
- * (../style.ts) — piped output stays plain. `--json` always carries full
21
- * uuids.
57
+ * Foreground the Things app on a resource via its share URI. A GUI action
58
+ * on this Mac NOT headless; the shared implementation behind every
59
+ * `open` command. Returns the URI it launched.
22
60
  */
23
- export declare function formatItem(item: ListItem, uuidWidth?: number): string;
61
+ export declare function openInThings(uuid: string): string;
24
62
  /**
25
63
  * Display width for a list's uuid column: the shortest prefix that is
26
64
  * unique WITHIN the list, floored at UUID_DISPLAY_MIN (list-local
@@ -29,5 +67,68 @@ export declare function formatItem(item: ListItem, uuidWidth?: number): string;
29
67
  export declare function uuidDisplayWidth(items: Array<{
30
68
  uuid: string;
31
69
  }>): number;
70
+ /** Hidden-later counts per sidebar group (null area = the loose block). */
71
+ export interface LaterHints {
72
+ /** Sidebar-ordered, INCLUDING groups whose every project is later. */
73
+ groups: Array<{
74
+ area: {
75
+ uuid: string;
76
+ title: string;
77
+ } | null;
78
+ hidden: number;
79
+ }>;
80
+ }
81
+ /**
82
+ * The sidebar mirror for `things projects`: loose projects first (the GUI
83
+ * lists them above the areas), then a `── ⬡ Area ──` header per area with
84
+ * its projects beneath (the redundant `(Area)` suffix suppressed). Items
85
+ * arrive from projectsView already in sidebar order — this only inserts the
86
+ * headers. Denser than renderSections on purpose: no title styling and no
87
+ * blank line per project (every row here IS a project). With `hints`,
88
+ * default-hidden later projects are never silent: each group trails a muted
89
+ * `…n later projects` count (a later-only area still gets its header), and
90
+ * the output ends with the flag that reveals them.
91
+ */
92
+ export declare function renderProjectsSidebar(items: ListItem[], hints?: LaterHints): string[];
93
+ /**
94
+ * `--until` accepting whole periods: `2024` means through Dec 31 2024,
95
+ * `2024-03` through Mar 31, `2024-03-05` through end of that day; relative
96
+ * periods (`2w`, `1m`, `1y`) count FORWARD from now through the end of the
97
+ * landing day; anything else parses as an instant.
98
+ */
99
+ export declare function parsePeriodEnd(s: string, now?: Date): Date;
100
+ /**
101
+ * `--since` accepting the same vocabulary at the period's START: `2024` =
102
+ * Jan 1 2024 00:00, `2024-03` = Mar 1, `2024-03-05` = that midnight;
103
+ * relative periods (`2w`, `1m`) count BACKWARD from now to the landing
104
+ * day's midnight; anything else parses as an instant.
105
+ */
106
+ export declare function parsePeriodStart(s: string, now?: Date): Date;
107
+ /**
108
+ * Upcoming rows under GUI-style date headers (empty periods are simply
109
+ * absent), with the trailing Repeating To-Dos section: templates with no
110
+ * set next occurrence, carrying their waiting/paused/ended status word and
111
+ * the bare ⚑ when the rule will assign a deadline per occurrence.
112
+ */
113
+ export declare function renderUpcoming(items: ListItem[], now?: Date): string[];
114
+ /**
115
+ * Logbook rows under GUI-style date headings, month granularity throughout
116
+ * — `── July ──` within the current year, `── March 2025 ──` beyond (finer
117
+ * than the GUI's bare per-year buckets, deliberately). When the row count
118
+ * hits the limit, a trailing note says the range is NOT exhaustive.
119
+ */
120
+ export declare function renderLogbook(items: ListItem[], limit: number, now?: Date): string[];
121
+ /**
122
+ * Sidebar-grouped views (anytime/someday), rendered the way the GUI reads:
123
+ * the area-less block headerless first, then one `── <area> ──` header per
124
+ * area; inside a section, loose to-dos first, then each project GROUP — a
125
+ * blank line, the project's bold+underlined title row, then its members.
126
+ * Container names implied by the grouping are not repeated on member rows
127
+ * (an area header covers its rows; a project title row covers the to-dos
128
+ * beneath it — a clustered child whose project row is absent, e.g. under a
129
+ * tag filter, keeps its `(project)` suffix). `star` prefixes each item line
130
+ * with the Today-membership mark (★, or ⏾ for This-Evening members).
131
+ */
132
+ export declare function renderSections(sections: SidebarSection[], star?: boolean): string[];
32
133
  export declare function registerReadCommands(program: Command): void;
33
134
  export {};