@ftrdotdev/pi-tracker 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 (36) hide show
  1. package/README.md +183 -60
  2. package/package.json +23 -11
  3. package/src/compaction/candidate.test.ts +9 -6
  4. package/src/compaction/candidate.ts +32 -2
  5. package/src/compaction/classifier.test.ts +67 -60
  6. package/src/compaction/classifier.ts +24 -22
  7. package/src/compaction/completion.test.ts +127 -49
  8. package/src/compaction/completion.ts +1 -3
  9. package/src/compaction/decision-record.test.ts +91 -0
  10. package/src/compaction/decision-record.ts +101 -0
  11. package/src/compaction/digest.test.ts +104 -9
  12. package/src/compaction/digest.ts +96 -9
  13. package/src/compaction/footprint.test.ts +135 -0
  14. package/src/compaction/footprint.ts +387 -0
  15. package/src/compaction/observations.test.ts +199 -0
  16. package/src/compaction/observations.ts +348 -0
  17. package/src/compaction/rules.test.ts +253 -0
  18. package/src/compaction/rules.ts +188 -0
  19. package/src/compaction/settings.test.ts +105 -49
  20. package/src/compaction/settings.ts +53 -31
  21. package/src/compaction/settle.test.ts +370 -0
  22. package/src/compaction/settle.ts +109 -53
  23. package/src/core/deps.test.ts +1 -1
  24. package/src/core/domain.test.ts +42 -9
  25. package/src/core/domain.ts +73 -8
  26. package/src/core/persistence.test.ts +7 -7
  27. package/src/core/store.test.ts +116 -50
  28. package/src/core/store.ts +92 -31
  29. package/src/index.test.ts +209 -68
  30. package/src/index.ts +170 -48
  31. package/src/presentation/tool-metadata.test.ts +263 -48
  32. package/src/presentation/tool-metadata.ts +325 -102
  33. package/src/presentation/ui.test.ts +122 -7
  34. package/src/presentation/ui.ts +81 -18
  35. package/src/presentation/vim-settings.test.ts +98 -0
  36. package/src/presentation/vim-settings.ts +59 -0
@@ -29,6 +29,47 @@ const itemDeps = Schema.Array(Schema.String).pipe(
29
29
  Schema.withConstructorDefault(Effect.succeed([])),
30
30
  );
31
31
 
32
+ /** The optional longer explanation of an item; defaults to empty. */
33
+ const itemDescription = Schema.String.pipe(
34
+ Schema.withDecodingDefaultType(Effect.succeed("")),
35
+ Schema.withConstructorDefault(Effect.succeed("")),
36
+ );
37
+
38
+ /**
39
+ * A declared reference: a path the item must read (optionally narrowed to a
40
+ * symbol or a line span), or a decision topic it depends on.
41
+ */
42
+ const declaredReference = Schema.Union([
43
+ Schema.Struct({
44
+ kind: Schema.Literal("path"),
45
+ path: Schema.String,
46
+ symbol: Schema.optional(Schema.String),
47
+ span: Schema.optional(Schema.String),
48
+ }),
49
+ Schema.Struct({
50
+ kind: Schema.Literal("decision"),
51
+ topic: Schema.String,
52
+ }),
53
+ ]);
54
+
55
+ /** A document the item will write. */
56
+ const declaredProduct = Schema.Struct({ path: Schema.String });
57
+
58
+ /** Declared references; defaults to empty, so an old item decodes without them. */
59
+ const itemRefs = Schema.Array(declaredReference).pipe(
60
+ Schema.withDecodingDefaultType(Effect.succeed([])),
61
+ Schema.withConstructorDefault(Effect.succeed([])),
62
+ );
63
+
64
+ /** Declared products; defaults to empty, so an old item decodes without them. */
65
+ const itemProduces = Schema.Array(declaredProduct).pipe(
66
+ Schema.withDecodingDefaultType(Effect.succeed([])),
67
+ Schema.withConstructorDefault(Effect.succeed([])),
68
+ );
69
+
70
+ export type DeclaredReference = Schema.Schema.Type<typeof declaredReference>;
71
+ export type DeclaredProduct = Schema.Schema.Type<typeof declaredProduct>;
72
+
32
73
  /**
33
74
  * Sentinel for a list that stored no item id counter, which means the snapshot
34
75
  * was written before item ids existed. `normalizeSnapshot` stamps it so
@@ -44,7 +85,10 @@ const itemCounter = Schema.Int.pipe(
44
85
 
45
86
  export class TodoItem extends Schema.Class<TodoItem>("tracker/TodoItem")({
46
87
  id: itemId,
47
- text: Schema.String,
88
+ title: Schema.String,
89
+ description: itemDescription,
90
+ refs: itemRefs,
91
+ produces: itemProduces,
48
92
  done: Schema.Boolean,
49
93
  deps: itemDeps,
50
94
  }) {}
@@ -81,7 +125,15 @@ export const emptyState = (): TrackerState =>
81
125
 
82
126
  /** A copy of `item` with a replaced id. */
83
127
  const withId = (item: TodoItem, id: number): TodoItem =>
84
- new TodoItem({ id, text: item.text, done: item.done, deps: item.deps });
128
+ new TodoItem({
129
+ id,
130
+ title: item.title,
131
+ description: item.description,
132
+ refs: item.refs,
133
+ produces: item.produces,
134
+ done: item.done,
135
+ deps: item.deps,
136
+ });
85
137
 
86
138
  /**
87
139
  * Reassign ids for one list and return it with a counter above every id.
@@ -127,16 +179,29 @@ export const migrateState = (state: TrackerState): TrackerState =>
127
179
 
128
180
  /**
129
181
  * Drop a legacy `listName:index` string item id so the item decodes as
130
- * unassigned. An older format stored the id as a string; the schema now
131
- * stores an integer, and rejecting the snapshot would lose the whole session.
182
+ * unassigned, and split a legacy `text` into a title and a description. An
183
+ * older format stored the id as a string and the item content as one `text`
184
+ * string; the schema now stores an integer id plus separate `title` and
185
+ * `description` fields, and rejecting the snapshot would lose the whole
186
+ * session.
132
187
  */
133
188
  const normalizeItem = (item: unknown): unknown => {
134
189
  if (typeof item !== "object" || item === null || Array.isArray(item)) return item;
135
190
  const record = item as Record<string, unknown>;
136
- if (typeof record.id !== "string") return item;
137
- const next = { ...record };
138
- delete next.id;
139
- return next;
191
+ const next: Record<string, unknown> = { ...record };
192
+ let changed = false;
193
+ if (typeof record.id === "string") {
194
+ delete next.id;
195
+ changed = true;
196
+ }
197
+ if (record.title === undefined && typeof record.text === "string") {
198
+ const newline = record.text.indexOf("\n");
199
+ next.title = newline === -1 ? record.text : record.text.slice(0, newline);
200
+ next.description = newline === -1 ? "" : record.text.slice(newline + 1);
201
+ delete next.text;
202
+ changed = true;
203
+ }
204
+ return changed ? next : item;
140
205
  };
141
206
 
142
207
  /**
@@ -27,15 +27,15 @@ layer(
27
27
  name: "Work",
28
28
  nextItemId: 3,
29
29
  items: [
30
- new TodoItem({ id: 1, text: "write plan", done: true }),
31
- new TodoItem({ id: 2, text: "implement tracker", done: false }),
30
+ new TodoItem({ id: 1, title: "write plan", done: true }),
31
+ new TodoItem({ id: 2, title: "implement tracker", done: false }),
32
32
  ],
33
33
  }),
34
34
  new TodoList({
35
35
  id: 2,
36
36
  name: "Home",
37
37
  nextItemId: 2,
38
- items: [new TodoItem({ id: 1, text: "water plants", done: false })],
38
+ items: [new TodoItem({ id: 1, title: "water plants", done: false })],
39
39
  }),
40
40
  ],
41
41
  activeListId: 1,
@@ -168,7 +168,7 @@ layer(
168
168
  id: 1,
169
169
  name: "Work",
170
170
  nextItemId: 2,
171
- items: [new TodoItem({ id: 1, text: "a", done: false })],
171
+ items: [new TodoItem({ id: 1, title: "a", done: false })],
172
172
  }),
173
173
  ],
174
174
  activeListId: 1,
@@ -176,7 +176,7 @@ layer(
176
176
  });
177
177
  assert.deepStrictEqual(encodeState(restored), encodeState(expected));
178
178
  assert.deepStrictEqual(restored.lists[0]?.items, [
179
- new TodoItem({ id: 1, text: "a", done: false }),
179
+ new TodoItem({ id: 1, title: "a", done: false }),
180
180
  ]);
181
181
  }),
182
182
  );
@@ -262,7 +262,7 @@ layer(
262
262
  const restored = yield* persistence.restore(legacy);
263
263
 
264
264
  assert.deepStrictEqual(
265
- restored.lists[0]?.items.map((i) => [i.id, i.text]),
265
+ restored.lists[0]?.items.map((i) => [i.id, i.title]),
266
266
  [[1, "a"]],
267
267
  );
268
268
  }),
@@ -281,7 +281,7 @@ layer(
281
281
  yield* decodeFailureOf({ lists: 42 });
282
282
  yield* decodeFailureOf({ lists: [] }); // missing counters + activeListId
283
283
  yield* decodeFailureOf({
284
- lists: [{ id: 1, name: "Work", items: [{ text: "x", done: "yes" }] }],
284
+ lists: [{ id: 1, name: "Work", items: [{ title: "x", done: "yes" }] }],
285
285
  activeListId: null,
286
286
  nextListId: 2,
287
287
  });
@@ -124,7 +124,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
124
124
  const list = yield* store.createList("Work", { initialItems: ["a", "b"] });
125
125
  assert.strictEqual(list.id, 1);
126
126
  assert.deepStrictEqual(
127
- list.items.map((i) => [i.text, i.done]),
127
+ list.items.map((i) => [i.title, i.done]),
128
128
  [
129
129
  ["a", false],
130
130
  ["b", false],
@@ -144,7 +144,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
144
144
 
145
145
  const list = yield* store.createList("Work", { initialItems: [" a ", "b"] });
146
146
  assert.deepStrictEqual(
147
- list.items.map((i) => i.text),
147
+ list.items.map((i) => i.title),
148
148
  ["a", "b"],
149
149
  );
150
150
  }),
@@ -286,7 +286,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
286
286
 
287
287
  const list = yield* store.createList("Work");
288
288
  const item = yield* store.addItem(list.id, "write plan");
289
- assert.strictEqual(item.text, "write plan");
289
+ assert.strictEqual(item.title, "write plan");
290
290
  assert.strictEqual(item.done, false);
291
291
 
292
292
  const state = yield* store.state;
@@ -301,7 +301,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
301
301
 
302
302
  const list = yield* store.createList("Work");
303
303
  const item = yield* store.addItem(list.id, " ship ");
304
- assert.strictEqual(item.text, "ship");
304
+ assert.strictEqual(item.title, "ship");
305
305
 
306
306
  for (const bad of ["", " "]) {
307
307
  const result = yield* Effect.result(store.addItem(list.id, bad));
@@ -319,7 +319,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
319
319
  const list = yield* store.createList("Work");
320
320
  const items = yield* store.addItems(list.id, ["a", "b", "c"]);
321
321
  assert.deepStrictEqual(
322
- items.map((i) => [i.text, i.done]),
322
+ items.map((i) => [i.title, i.done]),
323
323
  [
324
324
  ["a", false],
325
325
  ["b", false],
@@ -329,7 +329,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
329
329
 
330
330
  const state = yield* store.state;
331
331
  assert.deepStrictEqual(
332
- state.lists[0]?.items.map((i) => i.text),
332
+ state.lists[0]?.items.map((i) => i.title),
333
333
  ["a", "b", "c"],
334
334
  );
335
335
  }),
@@ -343,7 +343,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
343
343
  const list = yield* store.createList("Work");
344
344
  const items = yield* store.addItems(list.id, [" a ", "b"]);
345
345
  assert.deepStrictEqual(
346
- items.map((i) => i.text),
346
+ items.map((i) => i.title),
347
347
  ["a", "b"],
348
348
  );
349
349
  }),
@@ -396,7 +396,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
396
396
  const list = yield* store.createList("Work");
397
397
  const items = yield* store.addItems(list.id, ["write plan"]);
398
398
  assert.strictEqual(items.length, 1);
399
- assert.strictEqual(items[0]?.text, "write plan");
399
+ assert.strictEqual(items[0]?.title, "write plan");
400
400
  assert.strictEqual(items[0]?.done, false);
401
401
  }),
402
402
  );
@@ -410,7 +410,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
410
410
  yield* store.addItem(list.id, "write plan");
411
411
  const updated = yield* store.updateItem("Work:1", { done: true });
412
412
  assert.strictEqual(updated.done, true);
413
- assert.strictEqual(updated.text, "write plan");
413
+ assert.strictEqual(updated.title, "write plan");
414
414
 
415
415
  const state = yield* store.state;
416
416
  assert.strictEqual(state.lists[0]?.items[0]?.done, true);
@@ -424,12 +424,12 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
424
424
 
425
425
  const list = yield* store.createList("Work");
426
426
  yield* store.addItem(list.id, "write plan");
427
- const updated = yield* store.updateItem("Work:1", { text: "ship it" });
428
- assert.strictEqual(updated.text, "ship it");
427
+ const updated = yield* store.updateItem("Work:1", { title: "ship it" });
428
+ assert.strictEqual(updated.title, "ship it");
429
429
  assert.strictEqual(updated.done, false); // untouched field preserved
430
430
 
431
431
  const state = yield* store.state;
432
- assert.strictEqual(state.lists[0]?.items[0]?.text, "ship it");
432
+ assert.strictEqual(state.lists[0]?.items[0]?.title, "ship it");
433
433
  }),
434
434
  );
435
435
 
@@ -440,12 +440,78 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
440
440
 
441
441
  const list = yield* store.createList("Work");
442
442
  yield* store.addItem(list.id, "write plan");
443
- const updated = yield* store.updateItem("Work:1", { text: "done!", done: true });
444
- assert.strictEqual(updated.text, "done!");
443
+ const updated = yield* store.updateItem("Work:1", { title: "done!", done: true });
444
+ assert.strictEqual(updated.title, "done!");
445
445
  assert.strictEqual(updated.done, true);
446
446
  }),
447
447
  );
448
448
 
449
+ it.effect("keeps the description across a title-only patch", () =>
450
+ Effect.gen(function* () {
451
+ const store = yield* TrackerStore;
452
+ yield* store.reset(emptyState());
453
+
454
+ const list = yield* store.createList("Work");
455
+ yield* store.addItem(list.id, { title: "T", description: "D" });
456
+ const updated = yield* store.updateItem("Work:1", { title: "T2" });
457
+ assert.strictEqual(updated.title, "T2");
458
+ assert.strictEqual(updated.description, "D");
459
+ const state = yield* store.state;
460
+ assert.strictEqual(state.lists[0]?.items[0]?.description, "D");
461
+ }),
462
+ );
463
+
464
+ it.effect("round-trips a path reference with its symbol and span", () =>
465
+ Effect.gen(function* () {
466
+ const store = yield* TrackerStore;
467
+ yield* store.reset(emptyState());
468
+
469
+ const list = yield* store.createList("Work");
470
+ yield* store.addItem(list.id, {
471
+ title: "route",
472
+ refs: [{ kind: "path", path: "src/a.ts", symbol: "route", span: "12-14" }],
473
+ });
474
+ const item = (yield* store.state).lists[0]!.items[0]!;
475
+ assert.deepStrictEqual(item.refs, [
476
+ { kind: "path", path: "src/a.ts", symbol: "route", span: "12-14" },
477
+ ]);
478
+ }),
479
+ );
480
+
481
+ it.effect("round-trips a decision reference", () =>
482
+ Effect.gen(function* () {
483
+ const store = yield* TrackerStore;
484
+ yield* store.reset(emptyState());
485
+
486
+ const list = yield* store.createList("Work");
487
+ yield* store.addItem(list.id, {
488
+ title: "shape",
489
+ refs: [{ kind: "decision", topic: "storage shape" }],
490
+ });
491
+ const item = (yield* store.state).lists[0]!.items[0]!;
492
+ assert.deepStrictEqual(item.refs, [{ kind: "decision", topic: "storage shape" }]);
493
+ }),
494
+ );
495
+
496
+ it.effect("an update patch replaces the whole declaration list", () =>
497
+ Effect.gen(function* () {
498
+ const store = yield* TrackerStore;
499
+ yield* store.reset(emptyState());
500
+
501
+ const list = yield* store.createList("Work");
502
+ yield* store.addItem(list.id, {
503
+ title: "two refs",
504
+ refs: [
505
+ { kind: "path", path: "src/a.ts" },
506
+ { kind: "decision", topic: "old" },
507
+ ],
508
+ });
509
+ yield* store.updateItem("Work:1", { refs: [{ kind: "decision", topic: "new" }] });
510
+ const item = (yield* store.state).lists[0]!.items[0]!;
511
+ assert.deepStrictEqual(item.refs, [{ kind: "decision", topic: "new" }]);
512
+ }),
513
+ );
514
+
449
515
  it.effect("updateItem with an empty patch is a no-op", () =>
450
516
  Effect.gen(function* () {
451
517
  const store = yield* TrackerStore;
@@ -457,7 +523,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
457
523
  const result = yield* store.updateItem("Work:1", {});
458
524
  const stateAfter = yield* store.state;
459
525
 
460
- assert.strictEqual(result.text, "write plan");
526
+ assert.strictEqual(result.title, "write plan");
461
527
  assert.deepStrictEqual(stateAfter, stateBefore);
462
528
  }),
463
529
  );
@@ -471,7 +537,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
471
537
  yield* store.addItem(list.id, "write plan");
472
538
  const stateBefore = yield* store.state;
473
539
 
474
- const result = yield* Effect.result(store.updateItem("Work:1", { text: " " }));
540
+ const result = yield* Effect.result(store.updateItem("Work:1", { title: " " }));
475
541
  assert(Result.isFailure(result));
476
542
  assert.strictEqual(Option.getOrThrow(Result.getFailure(result)).reason, "EmptyText");
477
543
 
@@ -490,12 +556,12 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
490
556
 
491
557
  const updated = yield* store.updateItems(list.id, [
492
558
  { itemId: "Work:1", done: true },
493
- { itemId: "Work:2", text: "bee" },
494
- { itemId: "Work:3", text: "sea", done: true },
559
+ { itemId: "Work:2", title: "bee" },
560
+ { itemId: "Work:3", title: "sea", done: true },
495
561
  ]);
496
562
  // Returned in patch order, with the final state of each item.
497
563
  assert.deepStrictEqual(
498
- updated.map((i) => [i.text, i.done]),
564
+ updated.map((i) => [i.title, i.done]),
499
565
  [
500
566
  ["a", true],
501
567
  ["bee", false],
@@ -503,7 +569,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
503
569
  ],
504
570
  );
505
571
  assert.deepStrictEqual(
506
- (yield* store.state).lists[0]?.items.map((i) => [i.text, i.done]),
572
+ (yield* store.state).lists[0]?.items.map((i) => [i.title, i.done]),
507
573
  [
508
574
  ["a", true],
509
575
  ["bee", false],
@@ -560,7 +626,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
560
626
  const result = yield* Effect.result(
561
627
  store.updateItems(list.id, [
562
628
  { itemId: "Work:1", done: true },
563
- { itemId: "Work:1", text: " " },
629
+ { itemId: "Work:1", title: " " },
564
630
  ]),
565
631
  );
566
632
  assert(Result.isFailure(result));
@@ -578,18 +644,18 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
578
644
  yield* store.addItem(list.id, "a");
579
645
 
580
646
  const updated = yield* store.updateItems(list.id, [
581
- { itemId: "Work:1", text: "first" },
582
- { itemId: "Work:1", text: "second", done: true },
647
+ { itemId: "Work:1", title: "first" },
648
+ { itemId: "Work:1", title: "second", done: true },
583
649
  ]);
584
650
  assert.deepStrictEqual(
585
- updated.map((i) => [i.text, i.done]),
651
+ updated.map((i) => [i.title, i.done]),
586
652
  [
587
653
  ["second", true],
588
654
  ["second", true],
589
655
  ],
590
656
  );
591
657
  assert.deepStrictEqual(
592
- (yield* store.state).lists[0]?.items.map((i) => [i.text, i.done]),
658
+ (yield* store.state).lists[0]?.items.map((i) => [i.title, i.done]),
593
659
  [["second", true]],
594
660
  );
595
661
  }),
@@ -651,7 +717,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
651
717
  const state = yield* store.state;
652
718
  const items = state.lists[0]?.items ?? [];
653
719
  assert.deepStrictEqual(
654
- items.map((i) => i.text),
720
+ items.map((i) => i.title),
655
721
  ["a", "c"],
656
722
  );
657
723
  }),
@@ -710,7 +776,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
710
776
 
711
777
  // Ids are per-list counters, assigned in creation order.
712
778
  const first = yield* store.updateItem("B:1", { done: true });
713
- assert.strictEqual(first.text, "one");
779
+ assert.strictEqual(first.title, "one");
714
780
  assert.strictEqual(first.done, true);
715
781
 
716
782
  // Removing "one" leaves a gap: "two" keeps id 2 instead of becoming B:1.
@@ -718,12 +784,12 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
718
784
  const stale = yield* Effect.result(store.updateItem("B:1", { done: true }));
719
785
  assert(Result.isFailure(stale));
720
786
  const second = yield* store.updateItem("B:2", { done: true });
721
- assert.strictEqual(second.text, "two");
787
+ assert.strictEqual(second.title, "two");
722
788
 
723
789
  // New items take the next counter value, never the gap.
724
790
  yield* store.addItem(b.id, "three");
725
791
  const third = yield* store.updateItem("B:3", { done: true });
726
- assert.strictEqual(third.text, "three");
792
+ assert.strictEqual(third.title, "three");
727
793
 
728
794
  // List ids are still strictly monotonic, never reused after deletes.
729
795
  assert.strictEqual(c.id, 3);
@@ -801,11 +867,11 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
801
867
  yield* store.createList("Work", { initialItems: ["a", "b", "c"] });
802
868
  yield* store.removeItem("Work:1");
803
869
 
804
- const updated = yield* store.updateItem("Work:3", { text: "cee" });
870
+ const updated = yield* store.updateItem("Work:3", { title: "cee" });
805
871
 
806
- assert.strictEqual(updated.text, "cee");
872
+ assert.strictEqual(updated.title, "cee");
807
873
  assert.deepStrictEqual(
808
- (yield* store.state).lists[0]?.items.map((i) => [i.id, i.text]),
874
+ (yield* store.state).lists[0]?.items.map((i) => [i.id, i.title]),
809
875
  [
810
876
  [2, "b"],
811
877
  [3, "cee"],
@@ -820,7 +886,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
820
886
  yield* store.reset(emptyState());
821
887
 
822
888
  yield* store.createList("Work", { initialItems: ["a"] });
823
- const updated = yield* store.updateItem("Work:1", { done: true, text: "ay" });
889
+ const updated = yield* store.updateItem("Work:1", { done: true, title: "ay" });
824
890
 
825
891
  assert.strictEqual(updated.id, 1);
826
892
  assert.strictEqual((yield* store.state).lists[0]?.nextItemId, 2);
@@ -835,7 +901,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
835
901
  const list = yield* store.createList("Work", { initialItems: ["a", "b", "c"] });
836
902
  const updated = yield* store.updateItems(list.id, [
837
903
  { itemId: "Work:1", done: true },
838
- { itemId: "Work:3", text: "cee" },
904
+ { itemId: "Work:3", title: "cee" },
839
905
  ]);
840
906
 
841
907
  assert.deepStrictEqual(
@@ -879,7 +945,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
879
945
  yield* store.addItem(list.id, "a");
880
946
 
881
947
  const updated = yield* store.updateItem("Work:2024:1", { done: true });
882
- assert.strictEqual(updated.text, "a");
948
+ assert.strictEqual(updated.title, "a");
883
949
  assert.strictEqual(updated.done, true);
884
950
  }),
885
951
  );
@@ -890,7 +956,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
890
956
  yield* store.reset(emptyState());
891
957
 
892
958
  const list = yield* store.createList("Work", {
893
- initialItems: ["a", { text: "b", deps: ["Work:1"] }],
959
+ initialItems: ["a", { title: "b", deps: ["Work:1"] }],
894
960
  });
895
961
 
896
962
  assert.deepStrictEqual(
@@ -907,7 +973,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
907
973
 
908
974
  const list = yield* store.createList("Work");
909
975
  yield* store.addItem(list.id, "a");
910
- const items = yield* store.addItems(list.id, ["b", { text: "c", deps: ["Work:2"] }]);
976
+ const items = yield* store.addItems(list.id, ["b", { title: "c", deps: ["Work:2"] }]);
911
977
 
912
978
  assert.deepStrictEqual(
913
979
  items.map((i) => i.id),
@@ -923,7 +989,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
923
989
  yield* store.reset(emptyState());
924
990
 
925
991
  const list = yield* store.createList("Work");
926
- const items = yield* store.addItems(list.id, ["a", { text: "b", deps: ["Work:1"] }]);
992
+ const items = yield* store.addItems(list.id, ["a", { title: "b", deps: ["Work:1"] }]);
927
993
 
928
994
  assert.deepStrictEqual(items[1]?.deps, ["Work:1"]);
929
995
  }),
@@ -992,7 +1058,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
992
1058
  yield* store.reset(emptyState());
993
1059
 
994
1060
  yield* store.createList("Work", {
995
- initialItems: ["a", { text: "b", deps: ["Work:1"] }],
1061
+ initialItems: ["a", { title: "b", deps: ["Work:1"] }],
996
1062
  });
997
1063
  const before = yield* store.state;
998
1064
 
@@ -1068,7 +1134,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1068
1134
  yield* store.reset(emptyState());
1069
1135
 
1070
1136
  yield* store.createList("Work", {
1071
- initialItems: ["a", { text: "b", deps: ["Work:1"] }],
1137
+ initialItems: ["a", { title: "b", deps: ["Work:1"] }],
1072
1138
  });
1073
1139
 
1074
1140
  const snapshot = encodeState(yield* store.state);
@@ -1084,7 +1150,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1084
1150
  const store = yield* TrackerStore;
1085
1151
  yield* store.reset(emptyState());
1086
1152
 
1087
- yield* store.createList("Work", { initialItems: ["a", { text: "b", deps: ["Work:1"] }] });
1153
+ yield* store.createList("Work", { initialItems: ["a", { title: "b", deps: ["Work:1"] }] });
1088
1154
  const before = yield* store.state;
1089
1155
 
1090
1156
  const result = yield* Effect.result(store.updateItem("Work:2", { done: true }));
@@ -1105,7 +1171,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1105
1171
 
1106
1172
  // "b" is done, then its dependency is reopened, so "b" is blocked but
1107
1173
  // must stay reopenable (only completion is gated).
1108
- yield* store.createList("Work", { initialItems: ["a", { text: "b", deps: ["Work:1"] }] });
1174
+ yield* store.createList("Work", { initialItems: ["a", { title: "b", deps: ["Work:1"] }] });
1109
1175
  yield* store.updateItem("Work:1", { done: true });
1110
1176
  yield* store.updateItem("Work:2", { done: true });
1111
1177
  yield* store.updateItem("Work:1", { done: false });
@@ -1121,7 +1187,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1121
1187
  const store = yield* TrackerStore;
1122
1188
  yield* store.reset(emptyState());
1123
1189
 
1124
- yield* store.createList("Work", { initialItems: ["a", { text: "b", deps: ["Work:1"] }] });
1190
+ yield* store.createList("Work", { initialItems: ["a", { title: "b", deps: ["Work:1"] }] });
1125
1191
  yield* store.updateItem("Work:1", { done: true });
1126
1192
 
1127
1193
  const completed = yield* store.updateItem("Work:2", { done: true });
@@ -1135,7 +1201,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1135
1201
  const store = yield* TrackerStore;
1136
1202
  yield* store.reset(emptyState());
1137
1203
 
1138
- yield* store.createList("Work", { initialItems: ["a", { text: "b", deps: ["Work:1"] }] });
1204
+ yield* store.createList("Work", { initialItems: ["a", { title: "b", deps: ["Work:1"] }] });
1139
1205
  yield* store.updateItem("Work:1", { done: true });
1140
1206
  yield* store.updateItem("Work:2", { done: true });
1141
1207
 
@@ -1154,7 +1220,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1154
1220
  const store = yield* TrackerStore;
1155
1221
  yield* store.reset(emptyState());
1156
1222
 
1157
- yield* store.createList("Work", { initialItems: ["a", { text: "b", deps: ["Work:1"] }] });
1223
+ yield* store.createList("Work", { initialItems: ["a", { title: "b", deps: ["Work:1"] }] });
1158
1224
  const before = yield* store.state;
1159
1225
 
1160
1226
  const result = yield* Effect.result(store.removeItem("Work:1"));
@@ -1173,7 +1239,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1173
1239
  yield* store.reset(emptyState());
1174
1240
 
1175
1241
  yield* store.createList("Work", {
1176
- initialItems: ["a", "b", { text: "c", deps: ["Work:2"] }],
1242
+ initialItems: ["a", "b", { title: "c", deps: ["Work:2"] }],
1177
1243
  });
1178
1244
  yield* store.removeItem("Work:1");
1179
1245
 
@@ -1192,7 +1258,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1192
1258
  yield* store.reset(emptyState());
1193
1259
 
1194
1260
  const list = yield* store.createList("Work", {
1195
- initialItems: ["a", { text: "b", deps: ["Work:1"] }, { text: "c", deps: ["Work:2"] }],
1261
+ initialItems: ["a", { title: "b", deps: ["Work:1"] }, { title: "c", deps: ["Work:2"] }],
1196
1262
  });
1197
1263
 
1198
1264
  // Each completion unblocks the next patch, exactly as three sequential
@@ -1216,7 +1282,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1216
1282
  yield* store.reset(emptyState());
1217
1283
 
1218
1284
  const list = yield* store.createList("Work", {
1219
- initialItems: ["a", { text: "b", deps: ["Work:1"] }],
1285
+ initialItems: ["a", { title: "b", deps: ["Work:1"] }],
1220
1286
  });
1221
1287
  const before = yield* store.state;
1222
1288
 
@@ -1241,7 +1307,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1241
1307
  yield* store.reset(emptyState());
1242
1308
 
1243
1309
  const list = yield* store.createList("Work", {
1244
- initialItems: ["a", { text: "b", deps: ["Work:1"] }],
1310
+ initialItems: ["a", { title: "b", deps: ["Work:1"] }],
1245
1311
  });
1246
1312
 
1247
1313
  // Items are addressed by id and the patches are one per item in the
@@ -1263,7 +1329,7 @@ layer(TrackerStore.layer)("TrackerStore", (it) => {
1263
1329
  yield* store.reset(emptyState());
1264
1330
 
1265
1331
  const list = yield* store.createList("Work", {
1266
- initialItems: ["a", { text: "b", deps: ["Work:1"] }],
1332
+ initialItems: ["a", { title: "b", deps: ["Work:1"] }],
1267
1333
  });
1268
1334
  yield* store.updateItem("Work:1", { done: true });
1269
1335