things-api 0.10.0 → 0.11.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 (151) hide show
  1. package/README.md +38 -12
  2. package/dist/cli/clock.d.ts +8 -0
  3. package/dist/cli/clock.js +24 -0
  4. package/dist/cli/clock.js.map +1 -0
  5. package/dist/cli/commands/area.js +8 -9
  6. package/dist/cli/commands/area.js.map +1 -1
  7. package/dist/cli/commands/install-skill.d.ts +45 -0
  8. package/dist/cli/commands/install-skill.js +207 -0
  9. package/dist/cli/commands/install-skill.js.map +1 -0
  10. package/dist/cli/commands/project.js +7 -6
  11. package/dist/cli/commands/project.js.map +1 -1
  12. package/dist/cli/commands/reads.d.ts +15 -2
  13. package/dist/cli/commands/reads.js +45 -17
  14. package/dist/cli/commands/reads.js.map +1 -1
  15. package/dist/cli/commands/setup.js +7 -2
  16. package/dist/cli/commands/setup.js.map +1 -1
  17. package/dist/cli/commands/show.js +6 -6
  18. package/dist/cli/commands/show.js.map +1 -1
  19. package/dist/cli/commands/todo.js +14 -8
  20. package/dist/cli/commands/todo.js.map +1 -1
  21. package/dist/cli/commands/writes.js +29 -32
  22. package/dist/cli/commands/writes.js.map +1 -1
  23. package/dist/cli/glyphs.d.ts +16 -0
  24. package/dist/cli/glyphs.js +23 -0
  25. package/dist/cli/glyphs.js.map +1 -1
  26. package/dist/cli/help.js +56 -6
  27. package/dist/cli/help.js.map +1 -1
  28. package/dist/cli/main.js +33 -2
  29. package/dist/cli/main.js.map +1 -1
  30. package/dist/cli/move-hint.d.ts +45 -0
  31. package/dist/cli/move-hint.js +196 -0
  32. package/dist/cli/move-hint.js.map +1 -0
  33. package/dist/cli/period.d.ts +2 -8
  34. package/dist/cli/period.js +44 -30
  35. package/dist/cli/period.js.map +1 -1
  36. package/dist/cli/read-driver.js +11 -1
  37. package/dist/cli/read-driver.js.map +1 -1
  38. package/dist/cli/render.js +16 -7
  39. package/dist/cli/render.js.map +1 -1
  40. package/dist/cli/skill-check.d.ts +21 -0
  41. package/dist/cli/skill-check.js +82 -0
  42. package/dist/cli/skill-check.js.map +1 -0
  43. package/dist/cli/skill.d.ts +62 -0
  44. package/dist/cli/skill.js +142 -0
  45. package/dist/cli/skill.js.map +1 -0
  46. package/dist/cli/tag-filters.d.ts +6 -2
  47. package/dist/cli/tag-filters.js +8 -6
  48. package/dist/cli/tag-filters.js.map +1 -1
  49. package/dist/cli/verb-hint.js +27 -2
  50. package/dist/cli/verb-hint.js.map +1 -1
  51. package/dist/cli/version.d.ts +4 -0
  52. package/dist/cli/version.js +18 -0
  53. package/dist/cli/version.js.map +1 -0
  54. package/dist/client.d.ts +35 -12
  55. package/dist/client.js +42 -18
  56. package/dist/client.js.map +1 -1
  57. package/dist/contracts.d.ts +11 -1
  58. package/dist/contracts.js +1 -1
  59. package/dist/contracts.js.map +1 -1
  60. package/dist/index.d.ts +6 -1
  61. package/dist/index.js +3 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/mcp/server.js +550 -506
  64. package/dist/mcp/server.js.map +1 -1
  65. package/dist/model/clock.d.ts +61 -0
  66. package/dist/model/clock.js +71 -0
  67. package/dist/model/clock.js.map +1 -0
  68. package/dist/model/dates.d.ts +26 -3
  69. package/dist/model/dates.js +84 -3
  70. package/dist/model/dates.js.map +1 -1
  71. package/dist/model/entities.d.ts +17 -3
  72. package/dist/model/entities.js.map +1 -1
  73. package/dist/model/mappers.d.ts +2 -2
  74. package/dist/model/mappers.js +25 -7
  75. package/dist/model/mappers.js.map +1 -1
  76. package/dist/read/area-view.d.ts +1 -1
  77. package/dist/read/area-view.js +8 -6
  78. package/dist/read/area-view.js.map +1 -1
  79. package/dist/read/detail.d.ts +1 -1
  80. package/dist/read/detail.js +11 -4
  81. package/dist/read/detail.js.map +1 -1
  82. package/dist/read/log-boundary.d.ts +1 -1
  83. package/dist/read/log-boundary.js +13 -3
  84. package/dist/read/log-boundary.js.map +1 -1
  85. package/dist/read/project-view.d.ts +1 -1
  86. package/dist/read/project-view.js +8 -6
  87. package/dist/read/project-view.js.map +1 -1
  88. package/dist/read/queries.d.ts +3 -1
  89. package/dist/read/queries.js +27 -5
  90. package/dist/read/queries.js.map +1 -1
  91. package/dist/read/snapshot.d.ts +1 -1
  92. package/dist/read/snapshot.js +9 -2
  93. package/dist/read/snapshot.js.map +1 -1
  94. package/dist/read/truncation.d.ts +1 -1
  95. package/dist/read/truncation.js +2 -2
  96. package/dist/read/truncation.js.map +1 -1
  97. package/dist/read/views.d.ts +12 -11
  98. package/dist/read/views.js +48 -43
  99. package/dist/read/views.js.map +1 -1
  100. package/dist/write/accessibility-probe.d.ts +1 -1
  101. package/dist/write/accessibility-probe.js +8 -0
  102. package/dist/write/accessibility-probe.js.map +1 -1
  103. package/dist/write/automation-probe.d.ts +1 -1
  104. package/dist/write/automation-probe.js +8 -0
  105. package/dist/write/automation-probe.js.map +1 -1
  106. package/dist/write/batch.js +3 -2
  107. package/dist/write/batch.js.map +1 -1
  108. package/dist/write/commands.d.ts +1 -1
  109. package/dist/write/commands.js +54 -15
  110. package/dist/write/commands.js.map +1 -1
  111. package/dist/write/guards.d.ts +1 -1
  112. package/dist/write/guards.js +23 -0
  113. package/dist/write/guards.js.map +1 -1
  114. package/dist/write/pipeline.d.ts +54 -2
  115. package/dist/write/pipeline.js +112 -20
  116. package/dist/write/pipeline.js.map +1 -1
  117. package/dist/write/planner.js +8 -1
  118. package/dist/write/planner.js.map +1 -1
  119. package/dist/write/pre-state.d.ts +37 -0
  120. package/dist/write/pre-state.js +42 -0
  121. package/dist/write/pre-state.js.map +1 -1
  122. package/dist/write/recurrence-rule-blob.d.ts +65 -0
  123. package/dist/write/recurrence-rule-blob.js +150 -0
  124. package/dist/write/recurrence-rule-blob.js.map +1 -0
  125. package/dist/write/vectors/registry.d.ts +5 -7
  126. package/dist/write/vectors/registry.js +49 -2
  127. package/dist/write/vectors/registry.js.map +1 -1
  128. package/dist/write/vectors/simulator.d.ts +44 -0
  129. package/dist/write/vectors/simulator.js +1136 -0
  130. package/dist/write/vectors/simulator.js.map +1 -0
  131. package/dist/write/vectors/types.d.ts +35 -0
  132. package/dist/write/vectors/ui-certification.d.ts +9 -3
  133. package/dist/write/vectors/ui-certification.js +3 -6
  134. package/dist/write/vectors/ui-certification.js.map +1 -1
  135. package/dist/write/vectors/ui-recipes.d.ts +13 -0
  136. package/dist/write/vectors/ui-recipes.js +52 -0
  137. package/dist/write/vectors/ui-recipes.js.map +1 -1
  138. package/dist/write/vectors/ui.d.ts +15 -0
  139. package/dist/write/vectors/ui.js +54 -6
  140. package/dist/write/vectors/ui.js.map +1 -1
  141. package/dist/write/verify/delta.d.ts +110 -1
  142. package/dist/write/verify/delta.js +177 -15
  143. package/dist/write/verify/delta.js.map +1 -1
  144. package/dist/write/verify/poller.d.ts +7 -1
  145. package/dist/write/verify/poller.js +20 -1
  146. package/dist/write/verify/poller.js.map +1 -1
  147. package/package.json +18 -3
  148. package/skills/things-cli/SKILL.md +53 -0
  149. package/skills/things-cli/references/contracts.md +41 -0
  150. package/skills/things-cli/references/gui.md +11 -0
  151. package/skills/things-cli/references/model.md +51 -0
@@ -21,7 +21,78 @@ export interface CreateProbe {
21
21
  * pre-existing same-title uuids.
22
22
  */
23
23
  excludeUuids?: string[];
24
+ /**
25
+ * Make-repeating template discovery (RSIM-P2/RSIM-R). Its presence tells
26
+ * `findCreated` to KEEP the `sinceEpoch` time-bound even though `excludeUuids`
27
+ * is set (a minted template always carries a fresh write-time creationDate, so
28
+ * the bound is safe and tightens the same-title gauntlet), and tells
29
+ * `evaluateDelta` to disambiguate multiple surviving templates by the source
30
+ * FINGERPRINT, derive the spawned instance via the template FK, and resolve
31
+ * the source's fate — the enriched `repeating` block the caller returns.
32
+ */
33
+ repeating?: RepeatingProbe;
24
34
  }
35
+ /**
36
+ * The context a make-repeating create-probe carries to harden discovery and
37
+ * enrich the result. Captured in the op's pre-read (the source row is gone or
38
+ * relinked by verify time, so it must be snapshotted before the drive).
39
+ */
40
+ export interface RepeatingProbe {
41
+ /** The original item's uuid (the ref the caller passed to make-repeating). */
42
+ sourceUuid: string;
43
+ /**
44
+ * Pre-write fingerprint of the source row. Used ONLY to break a tie between
45
+ * multiple surviving same-title templates — deadline is deliberately excluded
46
+ * (the template drops the source's deadline while the instance keeps it, so it
47
+ * is asymmetric and unsafe to match on; RSIM-P2 B3).
48
+ */
49
+ fingerprint: RepeatingFingerprint;
50
+ /**
51
+ * Project conversions only: the uuids of the source subtree rows (to-dos +
52
+ * headings) captured pre-write. `childrenReplaced` counts how many of these
53
+ * are ABSENT post-op — dead uuids the caller may have held (the delete-remint
54
+ * fate kills the whole subtree; the nested-repeater preserve fate typically
55
+ * kills only the flattened nested-template row, the visible children surviving
56
+ * with their uuids). Absent (undefined) for to-do conversions.
57
+ */
58
+ subtreeUuids?: string[];
59
+ }
60
+ /**
61
+ * Source-row fingerprint for template disambiguation. Notes, tags, container
62
+ * pointer, and checklist titles copy verbatim to the minted template; deadline
63
+ * does NOT (see RepeatingProbe.fingerprint).
64
+ */
65
+ export interface RepeatingFingerprint {
66
+ notes: string;
67
+ /** Direct tag titles, sorted. */
68
+ tags: string[];
69
+ /** Container pointer (project / heading / area uuid), null for a loose item. */
70
+ container: string | null;
71
+ /** Checklist item titles in order (to-dos; empty for projects). */
72
+ checklistTitles: string[];
73
+ }
74
+ /**
75
+ * The enriched make-repeating outcome derived post-write:
76
+ * - templateUuid — the discovered repeating template (also the result `uuid`).
77
+ * - instanceUuid — the current-occurrence instance, derived via the template
78
+ * FK (null + a warning when it cannot be derived).
79
+ * - replacedUuid — the original uuid when the source was destroyed (identity
80
+ * replacement); null when the source was preserved AS the
81
+ * instance (then instanceUuid === the original uuid).
82
+ * - childrenReplaced — project conversions only: how many pre-read child uuids
83
+ * are now DEAD (dead-uuid signaling, like replacedUuid).
84
+ */
85
+ export interface RepeatingDiscovery {
86
+ templateUuid: string;
87
+ instanceUuid: string | null;
88
+ replacedUuid: string | null;
89
+ childrenReplaced?: number;
90
+ }
91
+ /**
92
+ * Build a source fingerprint from a decoded task for RepeatingProbe. Deadline is
93
+ * intentionally omitted (asymmetric between template and instance).
94
+ */
95
+ export declare function buildRepeatingFingerprint(task: AnyTask): RepeatingFingerprint;
25
96
  export type DeltaSpec = {
26
97
  mode: "update";
27
98
  uuid: string;
@@ -113,6 +184,17 @@ export interface DeltaEvaluation {
113
184
  observed: Record<string, unknown> | null;
114
185
  /** For create mode: uuid of the row that satisfied the probe. */
115
186
  discoveredUuid?: string;
187
+ /** Make-repeating create-probe: the enriched template/instance/replaced block. */
188
+ repeating?: RepeatingDiscovery;
189
+ /** Advisory notes from the repeating derivation (underivable instance, etc.). */
190
+ repeatingWarnings?: string[];
191
+ /**
192
+ * A PERMANENT verify failure the poller must not retry (e.g. an unbreakable
193
+ * template ambiguity) — carries a distinct `detail` naming the cause.
194
+ */
195
+ terminal?: boolean;
196
+ /** Custom failure detail surfaced by the pipeline in place of the generic one. */
197
+ detail?: string;
116
198
  }
117
199
  export interface VerifyReader {
118
200
  taskByUuid(uuid: string): AnyTask | null;
@@ -128,6 +210,23 @@ export interface VerifyReader {
128
210
  rankOf(uuid: string, key: "index" | "todayIndex" | "area-index"): number | null;
129
211
  trashedCount(): number;
130
212
  findCreated(probe: CreateProbe): AnyTask[];
213
+ /**
214
+ * Non-trashed rows of the given DB type (0=to-do, 1=project, 2=heading)
215
+ * whose `rt1_repeatingTemplate` FK points at the template — the exact,
216
+ * time/title-free way to derive a spawned instance (RSIM-P2 B4).
217
+ */
218
+ instancesOfTemplate(templateUuid: string, dbType: number): string[];
219
+ /**
220
+ * The post-write fate of a make-repeating source row: whether it still
221
+ * exists, and (if so) which template its `rt1_repeatingTemplate` points at.
222
+ * A DELETE leaves it absent; a preserve relinks it to the new template.
223
+ */
224
+ repeatingSourceFate(uuid: string): {
225
+ present: boolean;
226
+ templateFk: string | null;
227
+ };
228
+ /** How many of these uuids no longer exist as TMTask rows (dead-uuid count). */
229
+ countAbsent(uuids: string[]): number;
131
230
  modDateOf(uuid: string): number | null;
132
231
  /**
133
232
  * Assertable fields of a TMArea/TMTag row: title, tags (areas, sorted
@@ -135,7 +234,17 @@ export interface VerifyReader {
135
234
  */
136
235
  entityFields(entity: "area" | "tag", uuid: string): Record<string, unknown> | null;
137
236
  }
138
- export declare function createDbReader(db: DatabaseSync): VerifyReader;
237
+ /**
238
+ * `now`/`zone` supply the evaluation clock the reader hands to `byUuid` (and thus
239
+ * `mapTodaySection`) so a verified read-after-write gates `todaySection` on the
240
+ * SAME injected clock the write planner used — never the wall clock. Under a
241
+ * pinned `THINGS_NOW` (consumer-timezone / bench fence), an `evening`/`today`
242
+ * item dated pinned-today would otherwise be judged future-dated by a real-clock
243
+ * reader and lose its `todaySection`, failing the delta assertion (bench-caught
244
+ * regression from the #211 todaySection gate). Defaults to the host clock so the
245
+ * pure verify-reader tests and ordering call sites are unaffected.
246
+ */
247
+ export declare function createDbReader(db: DatabaseSync, now?: Date, zone?: string): VerifyReader;
139
248
  /**
140
249
  * Resolve an assertion path against a decoded entity. Computed paths:
141
250
  * `tags` → sorted direct-tag titles; `checklistTitles` → checklist titles
@@ -1,7 +1,42 @@
1
1
  import { byUuid } from "../../read/detail.js";
2
- export function createDbReader(db) {
2
+ /**
3
+ * Build a source fingerprint from a decoded task for RepeatingProbe. Deadline is
4
+ * intentionally omitted (asymmetric between template and instance).
5
+ */
6
+ export function buildRepeatingFingerprint(task) {
3
7
  return {
4
- taskByUuid: (uuid) => byUuid(db, uuid),
8
+ notes: task.type === "heading" ? "" : task.notes,
9
+ tags: task.type === "heading" ? [] : task.tags.map((t) => t.title).toSorted(),
10
+ container: containerKey(task),
11
+ checklistTitles: task.type === "to-do" ? (task.checklist ?? []).map((c) => c.title) : [],
12
+ };
13
+ }
14
+ /** DB `type` int for a probe task type (0=to-do, 1=project, 2=heading). */
15
+ function dbTypeOf(type) {
16
+ return type === "project" ? 1 : type === "heading" ? 2 : 0;
17
+ }
18
+ /** The container pointer a template inherits from its source (project→heading→area). */
19
+ function containerKey(task) {
20
+ if (task.type === "heading")
21
+ return task.project?.uuid ?? null;
22
+ if (task.type === "to-do") {
23
+ return task.project?.uuid ?? task.heading?.uuid ?? task.area?.uuid ?? null;
24
+ }
25
+ return task.area?.uuid ?? null;
26
+ }
27
+ /**
28
+ * `now`/`zone` supply the evaluation clock the reader hands to `byUuid` (and thus
29
+ * `mapTodaySection`) so a verified read-after-write gates `todaySection` on the
30
+ * SAME injected clock the write planner used — never the wall clock. Under a
31
+ * pinned `THINGS_NOW` (consumer-timezone / bench fence), an `evening`/`today`
32
+ * item dated pinned-today would otherwise be judged future-dated by a real-clock
33
+ * reader and lose its `todaySection`, failing the delta assertion (bench-caught
34
+ * regression from the #211 todaySection gate). Defaults to the host clock so the
35
+ * pure verify-reader tests and ordering call sites are unaffected.
36
+ */
37
+ export function createDbReader(db, now = new Date(), zone) {
38
+ return {
39
+ taskByUuid: (uuid) => byUuid(db, uuid, now, zone),
5
40
  areaExists(uuid) {
6
41
  return db.prepare("SELECT 1 FROM TMArea WHERE uuid = ?").get(uuid) !== undefined;
7
42
  },
@@ -28,18 +63,47 @@ export function createDbReader(db) {
28
63
  },
29
64
  findCreated(probe) {
30
65
  const excluded = new Set(probe.excludeUuids ?? []);
66
+ // The time-bound is dropped to 0 ONLY for a backdated create (add-logged):
67
+ // there `excludeUuids` is present but `creationDate` is intentionally in
68
+ // the past, so a bound would filter the very row we seek. A make-repeating
69
+ // template (`repeating` set) DOES carry a fresh write-time creationDate, so
70
+ // its bound is restored even with `excludeUuids` — tightening discovery.
71
+ const bound = probe.excludeUuids === undefined || probe.repeating !== undefined ? probe.sinceEpoch : 0;
31
72
  const rows = db
32
73
  .prepare("SELECT uuid FROM TMTask WHERE title = ? AND type = ? AND creationDate >= ? " +
33
74
  "ORDER BY creationDate DESC LIMIT 25")
34
- .all(probe.title, probe.type === "project" ? 1 : probe.type === "heading" ? 2 : 0, probe.excludeUuids === undefined ? probe.sinceEpoch : 0).filter((r) => !excluded.has(r.uuid));
75
+ .all(probe.title, dbTypeOf(probe.type), bound).filter((r) => !excluded.has(r.uuid));
35
76
  const tasks = [];
36
77
  for (const r of rows) {
37
- const task = byUuid(db, r.uuid);
78
+ const task = byUuid(db, r.uuid, now, zone);
38
79
  if (task !== null)
39
80
  tasks.push(task);
40
81
  }
41
82
  return tasks;
42
83
  },
84
+ instancesOfTemplate(templateUuid, dbType) {
85
+ return db
86
+ .prepare("SELECT uuid FROM TMTask WHERE rt1_repeatingTemplate = ? AND type = ? AND trashed = 0")
87
+ .all(templateUuid, dbType).map((r) => r.uuid);
88
+ },
89
+ repeatingSourceFate(uuid) {
90
+ const row = db
91
+ .prepare("SELECT rt1_repeatingTemplate AS fk FROM TMTask WHERE uuid = ?")
92
+ .get(uuid);
93
+ if (row === undefined)
94
+ return { present: false, templateFk: null };
95
+ return { present: true, templateFk: row.fk ?? null };
96
+ },
97
+ countAbsent(uuids) {
98
+ if (uuids.length === 0)
99
+ return 0;
100
+ const stmt = db.prepare("SELECT 1 FROM TMTask WHERE uuid = ?");
101
+ let absent = 0;
102
+ for (const u of uuids)
103
+ if (stmt.get(u) === undefined)
104
+ absent += 1;
105
+ return absent;
106
+ },
43
107
  modDateOf(uuid) {
44
108
  const row = db.prepare("SELECT userModificationDate FROM TMTask WHERE uuid = ?").get(uuid);
45
109
  return row?.userModificationDate ?? null;
@@ -116,6 +180,101 @@ function checkAssertions(entity, assertions) {
116
180
  }
117
181
  return { pass, observed };
118
182
  }
183
+ /** Does a candidate template carry the source's fingerprint (deadline excluded)? */
184
+ function matchesFingerprint(candidate, fp) {
185
+ const c = buildRepeatingFingerprint(candidate);
186
+ return (c.notes === fp.notes &&
187
+ c.container === fp.container &&
188
+ JSON.stringify(c.tags) === JSON.stringify(fp.tags) &&
189
+ JSON.stringify(c.checklistTitles) === JSON.stringify(fp.checklistTitles));
190
+ }
191
+ /** Pick the single FK-derived instance, warning on the zero/many cases (never hard-fails). */
192
+ function pickInstance(fkInstances, warnings) {
193
+ if (fkInstances.length === 1)
194
+ return fkInstances[0] ?? null;
195
+ if (fkInstances.length === 0) {
196
+ warnings.push("could not derive the spawned instance: no row links back to the new repeating template " +
197
+ "(the app may not have materialized the current occurrence)");
198
+ return null;
199
+ }
200
+ warnings.push(`derived ${fkInstances.length} rows linking to the new repeating template; the app's ` +
201
+ "per-occurrence stamping is nondeterministic — using the first");
202
+ return fkInstances[0] ?? null;
203
+ }
204
+ /**
205
+ * Resolve a make-repeating create-probe once at least one same-title template
206
+ * has passed the `isTemplate` assertion: disambiguate by source fingerprint,
207
+ * derive the spawned instance via the template FK, and resolve the source fate.
208
+ */
209
+ function evaluateRepeatingCreate(spec, passing, probe, reader) {
210
+ // 1. Disambiguate the template when more than one same-title template survives.
211
+ let template = passing[0];
212
+ if (passing.length > 1) {
213
+ const matches = passing.filter((c) => matchesFingerprint(c, probe.fingerprint));
214
+ if (matches.length === 1) {
215
+ template = matches[0];
216
+ }
217
+ else {
218
+ return {
219
+ satisfied: false,
220
+ movement: true,
221
+ assertedMovement: true,
222
+ observed: template ? checkAssertions(template, spec.assert).observed : null,
223
+ terminal: true,
224
+ detail: `discovery found ${passing.length} same-title repeating templates in the write window and ` +
225
+ `${matches.length} of them match the source fingerprint (notes/tags/container/checklist) — ` +
226
+ "refusing to guess which one the app just created",
227
+ };
228
+ }
229
+ }
230
+ if (template === undefined) {
231
+ return { satisfied: false, movement: false, assertedMovement: false, observed: null };
232
+ }
233
+ // 2. Derive the instance via the template FK + resolve the source fate.
234
+ const dbType = dbTypeOf(spec.probe.type);
235
+ const fkInstances = reader.instancesOfTemplate(template.uuid, dbType);
236
+ const fate = reader.repeatingSourceFate(probe.sourceUuid);
237
+ const warnings = [];
238
+ let instanceUuid;
239
+ let replacedUuid;
240
+ if (fate.present && fate.templateFk === template.uuid) {
241
+ // Source preserved AND relinked as the current-occurrence instance.
242
+ instanceUuid = probe.sourceUuid;
243
+ replacedUuid = null;
244
+ }
245
+ else if (!fate.present) {
246
+ // Identity replacement: the source was destroyed; a fresh instance minted.
247
+ replacedUuid = probe.sourceUuid;
248
+ instanceUuid = pickInstance(fkInstances, warnings);
249
+ }
250
+ else {
251
+ // Present but not linked to the new template — an unexpected post-op state.
252
+ warnings.push(`the original item (${probe.sourceUuid}) is still present but not linked to the new ` +
253
+ "repeating template — unexpected post-op state");
254
+ replacedUuid = null;
255
+ instanceUuid = pickInstance(fkInstances, warnings);
256
+ }
257
+ const repeating = {
258
+ templateUuid: template.uuid,
259
+ instanceUuid,
260
+ replacedUuid,
261
+ // How many pre-read child uuids are now DEAD (absent) — dead-uuid signaling,
262
+ // matching replacedUuid: the whole subtree in the delete-remint fate, just
263
+ // the flattened nested-template row in the preserve fate.
264
+ ...(probe.subtreeUuids !== undefined && {
265
+ childrenReplaced: reader.countAbsent(probe.subtreeUuids),
266
+ }),
267
+ };
268
+ return {
269
+ satisfied: true,
270
+ movement: true,
271
+ assertedMovement: true,
272
+ observed: checkAssertions(template, spec.assert).observed,
273
+ discoveredUuid: template.uuid,
274
+ repeating,
275
+ ...(warnings.length > 0 && { repeatingWarnings: warnings }),
276
+ };
277
+ }
119
278
  /**
120
279
  * One verification poll: evaluate the spec against fresh reads.
121
280
  * `preModDates` and `preFields` come from the pipeline's pre-read and feed
@@ -152,17 +311,20 @@ export function evaluateDelta(spec, reader, pre) {
152
311
  }
153
312
  case "create": {
154
313
  const candidates = reader.findCreated(spec.probe);
155
- for (const candidate of candidates) {
156
- const { pass, observed } = checkAssertions(candidate, spec.assert);
157
- if (pass) {
158
- return {
159
- satisfied: true,
160
- movement: true,
161
- assertedMovement: true,
162
- observed,
163
- discoveredUuid: candidate.uuid,
164
- };
165
- }
314
+ const passing = candidates.filter((c) => checkAssertions(c, spec.assert).pass);
315
+ const repeatingProbe = spec.probe.repeating;
316
+ if (passing.length > 0 && repeatingProbe !== undefined) {
317
+ return evaluateRepeatingCreate(spec, passing, repeatingProbe, reader);
318
+ }
319
+ const winner = passing[0];
320
+ if (winner !== undefined) {
321
+ return {
322
+ satisfied: true,
323
+ movement: true,
324
+ assertedMovement: true,
325
+ observed: checkAssertions(winner, spec.assert).observed,
326
+ discoveredUuid: winner.uuid,
327
+ };
166
328
  }
167
329
  const nearest = candidates[0];
168
330
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"delta.js","sourceRoot":"","sources":["../../../src/write/verify/delta.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAsH9C,MAAM,UAAU,cAAc,CAAC,EAAgB;IAC7C,OAAO;QACL,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC;QACtC,UAAU,CAAC,IAAI;YACb,OAAO,EAAE,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;QACnF,CAAC;QACD,SAAS,CAAC,IAAI;YACZ,OAAO,EAAE,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC;QAClF,CAAC;QACD,YAAY,CAAC,KAAK;YAChB,OAAO,EAAE,CAAC,OAAO,CAAC,wDAAwD,CAAC,CAAC,GAAG,CAAC,KAAK,CAElF,CAAC;QACN,CAAC;QACD,WAAW,CAAC,KAAK;YACf,OAAO,EAAE;iBACN,OAAO,CAAC,+DAA+D,CAAC;iBACxE,GAAG,CAAC,KAAK,CAA8C,CAAC;QAC7D,CAAC;QACD,MAAM,CAAC,IAAI,EAAE,GAAG;YACd,MAAM,KAAK,GAAG,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;YACzD,MAAM,MAAM,GAAG,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;YAC/D,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,MAAM,iBAAiB,KAAK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C,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,UAAU,GAAU,IAAI,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,MAAoB,EAAE,GAA8B;IACpF,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,GAAG,KAAK,IAAI,CAAC,CAAC,eAAe;IAC9D,IAAI,GAAG,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,CAAC,eAAe;IACjE,OAAO,GAAG,KAAK,MAAM,CAAC;AACxB,CAAC"}
@@ -9,13 +9,19 @@
9
9
  * only tripwire moved → timeout (something happened, not what we asked)
10
10
  * nothing moved → silent-noop
11
11
  */
12
- import type { DeltaEvaluation } from "./delta.ts";
12
+ import type { DeltaEvaluation, RepeatingDiscovery } from "./delta.ts";
13
13
  export interface PollOutcome {
14
14
  kind: "ok" | "timeout" | "mismatch" | "silent-noop";
15
15
  attempts: number;
16
16
  elapsedMs: number;
17
17
  observed: Record<string, unknown> | null;
18
18
  discoveredUuid?: string;
19
+ /** Make-repeating: the enriched template/instance/replaced block. */
20
+ repeating?: RepeatingDiscovery;
21
+ /** Make-repeating: advisory notes from the repeating derivation. */
22
+ repeatingWarnings?: string[];
23
+ /** A distinct failure detail from a terminal evaluation (overrides the generic one). */
24
+ detail?: string;
19
25
  }
20
26
  export interface PollerDeps {
21
27
  now?: () => number;
@@ -15,12 +15,31 @@ export async function pollUntilVerified(evaluate, timeoutMs, deps = {}) {
15
15
  elapsedMs: now() - started,
16
16
  observed: last.observed,
17
17
  ...(last.discoveredUuid !== undefined && { discoveredUuid: last.discoveredUuid }),
18
+ ...(last.repeating !== undefined && { repeating: last.repeating }),
19
+ ...(last.repeatingWarnings !== undefined && { repeatingWarnings: last.repeatingWarnings }),
20
+ };
21
+ }
22
+ // A terminal evaluation (e.g. an unbreakable template ambiguity) will never
23
+ // resolve by waiting — fail fast as a mismatch with its distinct detail.
24
+ if (last.terminal === true) {
25
+ return {
26
+ kind: "mismatch",
27
+ attempts,
28
+ elapsedMs: now() - started,
29
+ observed: last.observed,
30
+ ...(last.detail !== undefined && { detail: last.detail }),
18
31
  };
19
32
  }
20
33
  const elapsed = now() - started;
21
34
  if (now() >= deadline) {
22
35
  const kind = last.assertedMovement ? "mismatch" : last.movement ? "timeout" : "silent-noop";
23
- return { kind, attempts, elapsedMs: elapsed, observed: last.observed };
36
+ return {
37
+ kind,
38
+ attempts,
39
+ elapsedMs: elapsed,
40
+ observed: last.observed,
41
+ ...(last.detail !== undefined && { detail: last.detail }),
42
+ };
24
43
  }
25
44
  // poll retries are inherently sequential: each attempt must observe the DB state left by the previous wait, never overlap
26
45
  await sleep(elapsed < 2000 ? 100 : 300);
@@ -1 +1 @@
1
- {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../src/write/verify/poller.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAA+B,EAC/B,SAAiB,EACjB,OAAmB,EAAE;IAErB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC;IACtB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,CAAC,QAAQ;gBACvB,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;aAC1D,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC;QAChC,IAAI,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;YACtB,MAAM,IAAI,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC;YAC5F,OAAO;gBACL,IAAI;gBACJ,QAAQ;gBACR,SAAS,EAAE,OAAO;gBAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;aAC1D,CAAC;QACJ,CAAC;QACD,0HAA0H;QAC1H,MAAM,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,15 +1,24 @@
1
1
  {
2
2
  "name": "things-api",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Typed TypeScript library + CLI for Things 3 (Cultured Code) — verified writes, audit trail, schema-drift detection",
5
+ "homepage": "https://github.com/mikegreiling/things-api#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/mikegreiling/things-api/issues"
8
+ },
5
9
  "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/mikegreiling/things-api.git"
13
+ },
6
14
  "bin": {
7
15
  "things": "bin/things.js"
8
16
  },
9
17
  "files": [
10
18
  "bin",
11
19
  "dist",
12
- "shortcuts"
20
+ "shortcuts",
21
+ "skills"
13
22
  ],
14
23
  "type": "module",
15
24
  "exports": {
@@ -21,7 +30,7 @@
21
30
  },
22
31
  "scripts": {
23
32
  "build": "tsc -p tsconfig.build.json",
24
- "prepublishOnly": "npm run check && npm run build",
33
+ "prepublishOnly": "npm run check && npm run build && node scripts/stamp-skill.mjs",
25
34
  "smoke:pack": "bash scripts/pack-smoke.sh",
26
35
  "typecheck": "tsc --noEmit",
27
36
  "lint": "oxlint",
@@ -33,6 +42,9 @@
33
42
  "lab:compare": "node lab/runner/main.ts compare",
34
43
  "lab:gc": "node lab/runner/main.ts gc",
35
44
  "lab:regress": "bash lab/scripts/regress.sh",
45
+ "bench": "node bench/runner.ts",
46
+ "bench:login": "node bench/login.ts",
47
+ "bench:report": "node bench/report.ts",
36
48
  "check": "npm run typecheck && npm run lint && npm run fmt:check && npm run test"
37
49
  },
38
50
  "dependencies": {
@@ -41,7 +53,10 @@
41
53
  "zod": "^4.4.3"
42
54
  },
43
55
  "devDependencies": {
56
+ "@earendil-works/pi-agent-core": "0.80.10",
57
+ "@earendil-works/pi-ai": "0.80.10",
44
58
  "@types/node": "^24.13.2",
59
+ "just-bash": "3.1.0",
45
60
  "oxfmt": "^0.57.0",
46
61
  "oxlint": "^1.72.0",
47
62
  "typescript": "^6.0.3",
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: things-cli
3
+ description: Read and manage a user's tasks in the Things 3 app (macOS) through the `things` CLI — list views like Today/Inbox/Upcoming, search, and create, edit, schedule, complete, move, or organize to-dos, projects, areas, headings, and tags. Use whenever the user asks about their tasks, to-dos, projects, or anything in Things.
4
+ version: 0.11.0
5
+ ---
6
+
7
+ # Things CLI
8
+
9
+ `things` is a command-line interface to the user's Things 3 task database. Reads are instant SQL queries; writes go through the app itself and are verified after they land. Use `things` when it is on your PATH; otherwise — or when `things --version` reports below **0.11.0** — substitute `npx -y things-api@latest` in every command (identical subcommands and flags), which always pairs the current commands with their current help.
10
+
11
+ `things --help` is the one-screen index; `things <group> --help` lists a group's verbs and flags (always current for the binary you invoke); `things help <topic>` opens a contract guide — topics: `agent`, `filters`, `ids`, `output`, `repeating`, `writes`.
12
+
13
+ ## Data model (read this first)
14
+
15
+ - **To-do** — the basic item: title, notes, an optional **checklist** (sub-steps), tags, schedule, deadline, reminder. Has at most ONE container — loose in an **area**, directly in a **project**, or under a **heading** inside a project — or **none at all** (standalone to-dos are normal, like standalone projects).
16
+ - **Inbox** — not a container but the *untriaged state*: an inbox to-do has no container and no schedule. Filing it into a container or scheduling it moves it out of the Inbox; moving something back TO the Inbox un-files AND un-schedules it.
17
+ - **Project** — a goal-sized container of to-dos, optionally divided by **headings** (section labels; a heading belongs to one project and cannot hold projects). Projects live in an area or stand alone. Projects can also have their own notes, tags, schedule, and deadline.
18
+ - **Area** — a top-level bucket (e.g. a sphere of responsibility) holding projects and loose to-dos. Areas have tags but no dates.
19
+ - **Tags** — form a hierarchy, and are **inherited downward**: a to-do effectively carries its own tags plus those of its project and area. Headings carry no tags, but inheritance flows through them from project to to-do.
20
+ - **Views** are queries over this model, matching the app's sidebar: `inbox` (unsorted), `today` (scheduled for today, incl. This Evening), `upcoming` (future-dated), `anytime` (all active), `someday` (kept without a date), `logbook` (completed/canceled), `trash`.
21
+ - **Scheduling vocabulary**: an item's *when* is `today | evening | anytime | someday | YYYY-MM-DD` — where the item sits/starts. A **deadline** is a separate due date. A **reminder** is a separate time-of-day alert parameter — never write `date@time` into *when*.
22
+
23
+ ## Referring to items
24
+
25
+ Commands take a `<ref>`: a UUID, a unique UUID prefix, or a (unique) title. Ambiguous refs fail with the candidates listed — pick one and retry. Discover UUIDs via any read command; add `--json` for stable machine output (UUIDs are in `.uuid`).
26
+
27
+ ## Stable contracts
28
+
29
+ These hold regardless of the binary version; see [references/contracts.md](references/contracts.md) for the full text.
30
+
31
+ - **JSON envelope**: every `--json` response is `{ ok, data, meta }`. Read results from `.data` (usually `.data[]`), never `.items`; UUIDs are `.uuid`, not `.id`. Check `meta.truncation` before concluding "no match" or "that's everything". List/search rows are summaries whose `tags` may be incomplete — use `things show <ref> --json` for effective tags, checklist, and placement.
32
+ - **Exit codes**: `0` landed and verified · `2` usage error · `3` verify-failed. Nonzero means the change did NOT stick; the message names the fix.
33
+ - **Previews, undo & gates**: `--dry-run` shows any write's exact plan without executing; `things undo` reverses recent changes made through this tool; repeating and other disruptive operations require `--allow-disruptive`, INCLUDING their dry runs.
34
+ - **Preconditions**: referenced containers and tags must already exist — create nested structures outside-in and reuse each returned UUID.
35
+ - **Recurrence**: converting to a *fixed* repeater REPLACES the item, returning a `repeating` block — use `instanceUuid` to reach the visible occurrence and `templateUuid` for `reschedule-repeat`. Full vocabulary: `things help repeating`.
36
+ - **View reasoning from JSON**: `start:"inbox"`→Inbox, `start:"someday"`→Someday, `start:"active"` with no `startDate`→Anytime; a dated open item is Today when dated for `meta.clock.today`, else Upcoming. `todaySection` only marks placement within Today and is NOT evidence an undated item is in Today. Completed/canceled → Logbook, trashed → Trash, regardless of a stale `logged` field.
37
+ - If the user requests a JSON reply schema, return exactly that object after the read or verified write.
38
+
39
+ ## Reading
40
+
41
+ Views and lookups — pass `--json` whenever you will act on the output: `things today | inbox | upcoming | anytime | someday | logbook | trash`, `things show <ref>` (full detail incl. notes + checklist + effective tags), `things projects [ref]`, `things areas [ref]`, `things tags`, `things search <words>`, `things changes --since <moment>`. Filters (`--tag`, `--untagged`, `--overdue`, `--limit N`, …) compose with AND — see `things help filters` and [references/model.md](references/model.md).
42
+
43
+ ## Writing
44
+
45
+ Namespaced verb families — run `things <group> --help` for the verbs and `things <group> <verb> --help` for exact flags: `things todo …` (add/update/complete/cancel/reopen/move/delete/restore/tags/checklist/make-repeating), `things project …`, `things area …`, `things heading …`, `things tag …`, plus `things batch` (JSONL of many changes), `things undo`, and `things reorder`.
46
+
47
+ **Scheduling is an update, not a move**: `things todo update <ref> --when today|evening|anytime|someday|YYYY-MM-DD` schedules or parks an item; `move` changes its CONTAINER only (`--area`/`--project`/`--heading`). Per-verb preconditions and the rest of the write vocabulary: `things help writes`, `things help repeating`, [references/contracts.md](references/contracts.md).
48
+
49
+ ## Going deeper
50
+
51
+ - [references/model.md](references/model.md) — the full data model, view-membership semantics, and filters.
52
+ - [references/contracts.md](references/contracts.md) — the JSON envelope, exit codes, safety/undo/ambiguity recovery, and the recurrence contract.
53
+ - [references/gui.md](references/gui.md) — how the user sees Things in the app (where results appear, what list rows show).