things-api 0.8.0 → 0.9.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 (91) hide show
  1. package/README.md +3 -2
  2. package/dist/cli/commands/area.d.ts +9 -0
  3. package/dist/cli/commands/area.js +62 -5
  4. package/dist/cli/commands/area.js.map +1 -1
  5. package/dist/cli/commands/project.d.ts +5 -0
  6. package/dist/cli/commands/project.js +34 -5
  7. package/dist/cli/commands/project.js.map +1 -1
  8. package/dist/cli/commands/reads.d.ts +6 -125
  9. package/dist/cli/commands/reads.js +337 -611
  10. package/dist/cli/commands/reads.js.map +1 -1
  11. package/dist/cli/commands/show.d.ts +1 -1
  12. package/dist/cli/commands/show.js +145 -17
  13. package/dist/cli/commands/show.js.map +1 -1
  14. package/dist/cli/commands/snapshot.js +1 -1
  15. package/dist/cli/commands/snapshot.js.map +1 -1
  16. package/dist/cli/commands/todo.js +14 -3
  17. package/dist/cli/commands/todo.js.map +1 -1
  18. package/dist/cli/did-you-mean.d.ts +29 -0
  19. package/dist/cli/did-you-mean.js +53 -0
  20. package/dist/cli/did-you-mean.js.map +1 -0
  21. package/dist/cli/glyphs.d.ts +28 -5
  22. package/dist/cli/glyphs.js +123 -10
  23. package/dist/cli/glyphs.js.map +1 -1
  24. package/dist/cli/main.js +9 -1
  25. package/dist/cli/main.js.map +1 -1
  26. package/dist/cli/period.d.ts +32 -0
  27. package/dist/cli/period.js +129 -0
  28. package/dist/cli/period.js.map +1 -0
  29. package/dist/cli/read-driver.d.ts +76 -0
  30. package/dist/cli/read-driver.js +181 -0
  31. package/dist/cli/read-driver.js.map +1 -0
  32. package/dist/cli/render.d.ts +182 -0
  33. package/dist/cli/render.js +585 -0
  34. package/dist/cli/render.js.map +1 -0
  35. package/dist/cli/resolve-invocation.d.ts +78 -0
  36. package/dist/cli/resolve-invocation.js +178 -0
  37. package/dist/cli/resolve-invocation.js.map +1 -0
  38. package/dist/cli/shell-quote.d.ts +9 -0
  39. package/dist/cli/shell-quote.js +12 -0
  40. package/dist/cli/shell-quote.js.map +1 -0
  41. package/dist/client.d.ts +13 -4
  42. package/dist/client.js +2 -1
  43. package/dist/client.js.map +1 -1
  44. package/dist/contracts.d.ts +66 -1
  45. package/dist/contracts.js +1 -1
  46. package/dist/contracts.js.map +1 -1
  47. package/dist/mcp/server.js +208 -44
  48. package/dist/mcp/server.js.map +1 -1
  49. package/dist/model/entities.d.ts +9 -0
  50. package/dist/model/entities.js.map +1 -1
  51. package/dist/model/mappers.js +13 -1
  52. package/dist/model/mappers.js.map +1 -1
  53. package/dist/model/occurrences.d.ts +6 -1
  54. package/dist/model/occurrences.js +9 -5
  55. package/dist/model/occurrences.js.map +1 -1
  56. package/dist/model/recurrence.d.ts +17 -8
  57. package/dist/model/recurrence.js.map +1 -1
  58. package/dist/read/caps.d.ts +14 -0
  59. package/dist/read/caps.js +21 -0
  60. package/dist/read/caps.js.map +1 -0
  61. package/dist/read/log-boundary.d.ts +9 -4
  62. package/dist/read/log-boundary.js.map +1 -1
  63. package/dist/read/pagination.d.ts +104 -0
  64. package/dist/read/pagination.js +208 -0
  65. package/dist/read/pagination.js.map +1 -0
  66. package/dist/read/predicates.d.ts +31 -0
  67. package/dist/read/predicates.js +48 -0
  68. package/dist/read/predicates.js.map +1 -0
  69. package/dist/read/queries.d.ts +7 -2
  70. package/dist/read/queries.js +11 -7
  71. package/dist/read/queries.js.map +1 -1
  72. package/dist/read/search-rank.d.ts +36 -0
  73. package/dist/read/search-rank.js +31 -0
  74. package/dist/read/search-rank.js.map +1 -0
  75. package/dist/read/show-target.d.ts +13 -4
  76. package/dist/read/show-target.js +11 -2
  77. package/dist/read/show-target.js.map +1 -1
  78. package/dist/read/sidebar-order.d.ts +19 -0
  79. package/dist/read/sidebar-order.js +92 -0
  80. package/dist/read/sidebar-order.js.map +1 -0
  81. package/dist/read/views.d.ts +39 -5
  82. package/dist/read/views.js +142 -162
  83. package/dist/read/views.js.map +1 -1
  84. package/dist/surface-copy.d.ts +23 -0
  85. package/dist/surface-copy.js +23 -0
  86. package/dist/surface-copy.js.map +1 -1
  87. package/dist/write/capabilities.js +1 -0
  88. package/dist/write/capabilities.js.map +1 -1
  89. package/dist/write/undo.js +1 -0
  90. package/dist/write/undo.js.map +1 -1
  91. package/package.json +1 -1
@@ -0,0 +1,585 @@
1
+ /**
2
+ * The pure human-rendering family for the read views: the glyph-language item
3
+ * formatter, the flat and grouped list renderers, the sidebar/upcoming/logbook
4
+ * layouts, the anytime/someday previews, and the legend. No commander and no
5
+ * database access — every function maps already-fetched data to output lines,
6
+ * so the whole module is unit-testable in isolation. UUIDs are always shown
7
+ * (agents and humans both need stable references); colors engage on a TTY only
8
+ * (../cli/style.ts).
9
+ */
10
+ import { isTodayMember, } from "../read/views.js";
11
+ import { localToday } from "../model/dates.js";
12
+ import { templateStatus } from "../model/recurrence.js";
13
+ import { blue, bold, dim, strike, underline } from "./style.js";
14
+ import { areaMark, CHECKLIST_MARK, countChip, dateChip, deadlineToken, eveningMoon, LEGEND, LEGEND_GROUPS, loggedDate, NOTES_MARK, projectCircle, REMINDER_MARK, todayStar, todoBox, } from "./glyphs.js";
15
+ import { partitionSomedaySection, splitSectionBlocks, } from "../read/pagination.js";
16
+ import { FULL_MONTHS, upcomingBucket } from "./period.js";
17
+ /**
18
+ * A view's TTY-only title preamble: bold view name + its dim Things deep link,
19
+ * then a blank line — e.g. `Anytime (things:///show?id=anytime)`. The id is the
20
+ * app's documented show id (identical to the command name for these views).
21
+ * Suppressed off a TTY so `things inbox | grep …` stays clean, and never part
22
+ * of `--json`; the caller gates on both.
23
+ */
24
+ export function viewHeaderLines(view) {
25
+ const title = view.charAt(0).toUpperCase() + view.slice(1);
26
+ return [`${bold(title)} ${dim(`(things:///show?id=${view})`)}`, ""];
27
+ }
28
+ const ANSI = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
29
+ export const stripAnsi = (s) => s.replace(ANSI, "");
30
+ const visibleWidth = (s) => [...stripAnsi(s)].length;
31
+ /** Left-column width for the legend's glyph samples (short marks align; long textual samples overflow). */
32
+ const LEGEND_GUTTER = 10;
33
+ /**
34
+ * The `things legend` layout: the visual language grouped into sections
35
+ * (`── To-dos ──`, …), each row the glyph as it actually renders (color on a
36
+ * TTY) followed by its meaning. Content comes straight from glyphs.ts's LEGEND
37
+ * table, so it can never drift from what the list renderers emit.
38
+ */
39
+ export function renderLegend() {
40
+ const lines = [];
41
+ for (const group of LEGEND_GROUPS) {
42
+ const entries = LEGEND.filter((e) => e.group === group);
43
+ if (entries.length === 0)
44
+ continue;
45
+ if (lines.length > 0)
46
+ lines.push("");
47
+ lines.push(bold(`── ${group} ──`));
48
+ for (const e of entries) {
49
+ const pad = " ".repeat(Math.max(0, LEGEND_GUTTER - visibleWidth(e.glyph)));
50
+ lines.push(`${e.glyph}${pad} ${e.meaning}`);
51
+ }
52
+ }
53
+ return lines;
54
+ }
55
+ /**
56
+ * One item line:
57
+ * `<uuid-prefix> <box> [★|⏾] [logged-date] [‹chip›] <title> [‹n›] [⍾] [≡] [≔] (container) #tags [⚑ deadline]`.
58
+ * Repeating templates seat ↻ INSIDE the box (`[↻]`/`(↻)`) rather than as a
59
+ * separate mark; open project rows render their circle and title blue.
60
+ * The box is the glyph-language state carrier (../glyphs.ts): `[ ]`-family
61
+ * for to-dos, `( )`-family for projects — state survives with color
62
+ * stripped. Completed titles dim; canceled titles dim+strike (the `[×]`
63
+ * mark keeps the state when strike/ANSI is unavailable). Human output shows
64
+ * a SHORTENED uuid prefix (every command accepts unique prefixes >= 6
65
+ * chars); `uuidWidth` is the display length from uuidDisplayWidth — never
66
+ * below 8 so a copied prefix stays unique across the whole database, not
67
+ * just the rendered list. Tags follow the title (`#`-prefixed, green — GUI
68
+ * color), after the count chip (projects), notes marker, and container.
69
+ * Heading-nested to-dos label their parent PROJECT (via headingProject),
70
+ * never the heading — GUI behavior. Colors engage on a TTY only
71
+ * (../style.ts); `--json` always carries full uuids.
72
+ */
73
+ export function formatItem(item, uuidWidth = 0, opts = {}) {
74
+ const todayIso = localToday(opts.now);
75
+ const asTitle = opts.projectTitle === true && item.type === "project";
76
+ const box = item.type === "project" ? projectCircle(item) : todoBox(item);
77
+ const meta = [];
78
+ if (opts.mark != null)
79
+ meta.push(opts.mark);
80
+ // ↻ now lives INSIDE the box for templates (glyphs.ts) — no separate mark.
81
+ if (opts.statusWord !== undefined)
82
+ meta.push(dim(opts.statusWord));
83
+ if (item.status !== "open" && item.stopped !== null)
84
+ meta.push(loggedDate(item.stopped, todayIso));
85
+ if (opts.hideDateChip === true) {
86
+ // rows under a day header — the header carries the date
87
+ }
88
+ else if (item.status === "open" && item.startDate !== null && item.startDate > todayIso)
89
+ meta.push(dateChip(item.startDate, todayIso));
90
+ // Repeating templates chip their app-materialized next occurrence.
91
+ else if (item.repeating.isTemplate && item.repeating.nextOccurrence != null)
92
+ meta.push(dateChip(item.repeating.nextOccurrence, todayIso));
93
+ // List rows mute their tags (the GUI's gray pills); tags go green only on
94
+ // the opened resource (todo show / the project|area header row).
95
+ const tags = item.tags.length > 0 ? ` ${dim(`#${item.tags.map((t) => t.title).join(" #")}`)}` : "";
96
+ // Closed rows drop the deadline flag — a months-old red "n days ago" on a
97
+ // logged item is noise (the GUI doesn't flag logbook rows either). Raw
98
+ // template rows drop it via the sentinel guard: their deadline column
99
+ // carries app-internal 4001-01-01 sentinels (upcoming's synthesized
100
+ // occurrences carry REAL rule-derived deadlines and must keep the flag).
101
+ const rule = item.repeating.rule;
102
+ const deadline = item.status === "open" && item.deadline !== null && item.deadline < "4000"
103
+ ? ` ${deadlineToken(item.deadline, todayIso)}`
104
+ : // The GUI's bare flag on no-date repeating templates: the rule WILL
105
+ // assign each occurrence a deadline (fixed rules always do; after-
106
+ // completion only with a start offset), date unknown until spawned.
107
+ item.repeating.isTemplate &&
108
+ rule !== undefined &&
109
+ (rule.type === "fixed" || rule.startOffsetDays < 0)
110
+ ? ` ${bold(dim("⚑"))}`
111
+ : "";
112
+ const container = item.type === "to-do" ? (item.project ?? item.headingProject ?? null) : null;
113
+ const context = container !== null
114
+ ? container.uuid === opts.suppressProject
115
+ ? ""
116
+ : ` (${container.title})`
117
+ : item.area
118
+ ? item.area.uuid === opts.suppressArea
119
+ ? ""
120
+ : ` (${item.area.title})`
121
+ : "";
122
+ // width 0 (the default) means "no column" — show the full uuid untouched.
123
+ const shownUuid = uuidWidth > 0 ? uuidCol(item.uuid, uuidWidth) : item.uuid;
124
+ let title = item.title;
125
+ if (asTitle)
126
+ title = bold(underline(title));
127
+ else if (item.status === "canceled")
128
+ title = dim(strike(title));
129
+ else if (item.status === "completed")
130
+ title = dim(title);
131
+ // Open project rows render their title blue — GUI parity (list accent) and
132
+ // a color cue reinforcing the round bracket. To-dos stay default-colored.
133
+ else if (item.type === "project")
134
+ title = blue(title);
135
+ // GUI indicator order after the title: bell, document, checklist.
136
+ const tail = [
137
+ ...(item.type === "project" ? [countChip(item)] : []),
138
+ ...(item.reminder !== null ? [dim(REMINDER_MARK)] : []),
139
+ ...(item.notes !== "" ? [dim(NOTES_MARK)] : []),
140
+ ...(item.type === "to-do" && item.checklistItemsCount > 0 ? [dim(CHECKLIST_MARK)] : []),
141
+ ];
142
+ return [
143
+ `${dim(shownUuid)} `,
144
+ box,
145
+ ...meta,
146
+ `${title}${tail.length > 0 ? ` ${tail.join(" ")}` : ""}${tags}${context === "" ? "" : dim(context)}${deadline}`,
147
+ ].join(" ");
148
+ }
149
+ /**
150
+ * Row prefix in today-aware views: yellow ★ for Today members, cyan ⏾ for
151
+ * effective This-Evening members (raw evening assignment counts only while
152
+ * startDate is exactly today — the UI's daily expiry), null otherwise.
153
+ */
154
+ export function todayMark(item, now) {
155
+ if (!isTodayMember(item, now))
156
+ return null;
157
+ const evening = item.todaySection === "evening" && item.startDate === localToday(now);
158
+ return evening ? eveningMoon() : todayStar();
159
+ }
160
+ /** Minimum displayed-prefix length: shorter prefixes collide across the DB. */
161
+ const UUID_DISPLAY_MIN = 8;
162
+ /**
163
+ * Display width for a list's uuid column: the shortest prefix that is
164
+ * unique WITHIN the list, floored at UUID_DISPLAY_MIN (list-local
165
+ * uniqueness at 2–3 chars would still collide database-wide).
166
+ */
167
+ export function uuidDisplayWidth(items) {
168
+ if (items.length === 0)
169
+ return UUID_DISPLAY_MIN;
170
+ const sorted = items.map((i) => i.uuid).toSorted();
171
+ let needed = 1;
172
+ for (let i = 1; i < sorted.length; i++) {
173
+ const a = sorted[i - 1] ?? "";
174
+ const b = sorted[i] ?? "";
175
+ let common = 0;
176
+ while (common < a.length && common < b.length && a[common] === b[common])
177
+ common++;
178
+ needed = Math.max(needed, common + 1);
179
+ }
180
+ return Math.max(UUID_DISPLAY_MIN, needed);
181
+ }
182
+ /**
183
+ * Fit a uuid into the shared id column: truncate to `width` when longer, pad
184
+ * to it when shorter, so ids line up under one another regardless of prefix
185
+ * length. `width` is the value from uuidDisplayWidth.
186
+ */
187
+ export function uuidCol(uuid, width) {
188
+ return uuid.length > width ? uuid.slice(0, width) : uuid.padEnd(width);
189
+ }
190
+ export function renderList(items) {
191
+ const w = uuidDisplayWidth(items);
192
+ return items.length === 0 ? ["(empty)"] : items.map((i) => formatItem(i, w));
193
+ }
194
+ /**
195
+ * The `things today` split. The membership glyph lives in the SECTION HEADER,
196
+ * not on every row — a yellow ★ in the Today header (which also carries the
197
+ * sidebar badge split) and a blue ⏾ in the This Evening header — so the rows
198
+ * drop the redundant per-item marker (the same convention that suppresses a
199
+ * `(project)` context inside that project's own view). Every OTHER view keeps
200
+ * the per-row ★/⏾, where the marker still carries information.
201
+ *
202
+ * This Evening mirrors the GUI: it renders ONLY when evening items exist —
203
+ * a truly-empty evening has no header at all. `full` is the pre-cap view and
204
+ * `shown` the rows that survived the global `--limit`; the split lets the
205
+ * section stay honest under truncation. When the cap hid some or all evening
206
+ * rows, an honest muted hint counts the hidden ones and names the `--limit`
207
+ * that reveals them — never the misleading `(empty)` a truncated evening used
208
+ * to show. `base` is the user's own invocation (flags echoed). The global
209
+ * footer (row driver) still reports the whole-view remainder separately.
210
+ */
211
+ export function renderToday(full, shown, base) {
212
+ const w = uuidDisplayWidth([...shown.today, ...shown.evening]);
213
+ const lines = [
214
+ `${bold("──")} ${todayStar()} ${bold(`Today (badge: ${full.badge.dueOrOverdue} due/overdue · ${full.badge.other} other) ──`)}`,
215
+ ...(shown.today.length === 0 ? ["(empty)"] : shown.today.map((i) => formatItem(i, w))),
216
+ ];
217
+ if (full.evening.length > 0) {
218
+ lines.push(`${bold("──")} ${eveningMoon()} ${bold("This Evening ──")}`);
219
+ for (const i of shown.evening)
220
+ lines.push(formatItem(i, w));
221
+ const hidden = full.evening.length - shown.evening.length;
222
+ if (hidden > 0) {
223
+ const total = full.today.length + full.evening.length;
224
+ const more = shown.evening.length > 0 ? "more " : "";
225
+ lines.push(dim(`… ${hidden} ${more}evening item${hidden === 1 ? "" : "s"} — \`${base} --limit ${total}\` · all: \`${base} --all\``));
226
+ }
227
+ }
228
+ return lines;
229
+ }
230
+ /**
231
+ * Search rows: a standard list row, plus — for a project surfaced by a HEADING
232
+ * title match — a muted `(via heading "…")` suffix crediting the heading whose
233
+ * text matched (the parent project row stands in for the heading; the GUI has
234
+ * no bare heading row). Ordinary title/notes matches render as plain rows.
235
+ */
236
+ export function renderSearch(items) {
237
+ if (items.length === 0)
238
+ return ["(empty)"];
239
+ const w = uuidDisplayWidth(items);
240
+ return items.map((i) => {
241
+ const via = i.matchedVia;
242
+ const row = formatItem(i, w);
243
+ return via === undefined ? row : `${row} ${dim(`(via heading "${via.title}")`)}`;
244
+ });
245
+ }
246
+ /**
247
+ * The sidebar mirror for `things projects`: loose projects first (the GUI
248
+ * lists them above the areas), then a `── ⬡ Area ──` header per area with
249
+ * its projects beneath (the redundant `(Area)` suffix suppressed). Items
250
+ * arrive from projectsView already in sidebar order — this only inserts the
251
+ * headers. Denser than renderSections on purpose: no title styling and no
252
+ * blank line per project (every row here IS a project). With `hints`,
253
+ * default-hidden later projects are never silent: each group trails a muted
254
+ * `…n later projects` count (a later-only area still gets its header), and
255
+ * the output ends with the flag that reveals them.
256
+ */
257
+ export function renderProjectsSidebar(items, hints) {
258
+ const total = hints?.groups.reduce((n, g) => n + g.hidden, 0) ?? 0;
259
+ if (items.length === 0 && total === 0 && (hints === undefined || hints.groups.length === 0))
260
+ return ["(empty)"];
261
+ const w = uuidDisplayWidth(items);
262
+ const byGroup = new Map();
263
+ for (const item of items) {
264
+ const key = item.area?.uuid ?? null;
265
+ byGroup.set(key, [...(byGroup.get(key) ?? []), item]);
266
+ }
267
+ // hints (when present) carry the full sidebar group order, including
268
+ // later-only groups the visible items can't reveal.
269
+ const groups = hints?.groups ??
270
+ [...byGroup.keys()].map((key) => ({
271
+ area: key === null ? null : (items.find((i) => i.area?.uuid === key)?.area ?? null),
272
+ hidden: 0,
273
+ }));
274
+ const lines = [];
275
+ for (const group of groups) {
276
+ const rows = byGroup.get(group.area?.uuid ?? null) ?? [];
277
+ // The loose block only exists when it has content; areas mirror the
278
+ // sidebar and render even when empty.
279
+ if (group.area === null && rows.length === 0 && group.hidden === 0)
280
+ continue;
281
+ if (group.area !== null) {
282
+ if (lines.length > 0)
283
+ lines.push("");
284
+ lines.push(`${bold("──")} ${areaMark()} ${bold(`${group.area.title} ──`)}`);
285
+ }
286
+ lines.push(...rows.map((item) => formatItem(item, w, { suppressArea: group.area?.uuid ?? null })));
287
+ if (group.hidden > 0)
288
+ lines.push(dim(`…${group.hidden} later project${group.hidden === 1 ? "" : "s"}`));
289
+ else if (group.area !== null && rows.length === 0)
290
+ lines.push(dim("(no projects)"));
291
+ }
292
+ if (total > 0)
293
+ lines.push("", dim(`(${total} later project${total === 1 ? "" : "s"} — visible with \`things projects --show-later\`)`));
294
+ return lines;
295
+ }
296
+ /**
297
+ * Upcoming rows under GUI-style date headers (empty periods are simply
298
+ * absent), with the trailing Repeating To-Dos section: templates with no
299
+ * set next occurrence, carrying their waiting/paused/ended status word and
300
+ * the bare ⚑ when the rule will assign a deadline per occurrence.
301
+ */
302
+ export function renderUpcoming(items, now) {
303
+ if (items.length === 0)
304
+ return ["(empty)"];
305
+ const todayIso = localToday(now);
306
+ const w = uuidDisplayWidth(items);
307
+ const fmtOpts = now === undefined ? {} : { now };
308
+ const dated = items.filter((i) => i.startDate !== null);
309
+ const resting = items.filter((i) => i.startDate === null && i.repeating.isTemplate);
310
+ const lines = [];
311
+ let openHeader = null;
312
+ for (const item of dated) {
313
+ const bucket = upcomingBucket(item.startDate ?? "", todayIso);
314
+ if (bucket.label !== openHeader) {
315
+ if (lines.length > 0)
316
+ lines.push("");
317
+ lines.push(bold(`── ${bucket.label} ──`));
318
+ openHeader = bucket.label;
319
+ }
320
+ lines.push(formatItem(item, w, { ...fmtOpts, hideDateChip: bucket.isDay }));
321
+ }
322
+ if (resting.length > 0) {
323
+ if (lines.length > 0)
324
+ lines.push("");
325
+ lines.push(bold("── Repeating To-Dos ──"));
326
+ for (const item of resting) {
327
+ lines.push(formatItem(item, w, { ...fmtOpts, statusWord: templateStatus(item.repeating, todayIso) }));
328
+ }
329
+ }
330
+ return lines;
331
+ }
332
+ /**
333
+ * Logbook rows under GUI-style date headings, month granularity throughout
334
+ * — `── July ──` within the current year, `── March 2025 ──` beyond (finer
335
+ * than the GUI's bare per-year buckets, deliberately). Truncation past the
336
+ * row limit is reported by the shared hint the command appends, not here.
337
+ */
338
+ export function renderLogbook(items, now) {
339
+ if (items.length === 0)
340
+ return ["(empty)"];
341
+ const w = uuidDisplayWidth(items);
342
+ const currentYear = localToday(now).slice(0, 4);
343
+ const lines = [];
344
+ let openHeading = null;
345
+ for (const item of items) {
346
+ const s = item.stopped;
347
+ const heading = s === null
348
+ ? "no logged date"
349
+ : `${FULL_MONTHS[s.getMonth()]}${String(s.getFullYear()) === currentYear ? "" : ` ${s.getFullYear()}`}`;
350
+ if (heading !== openHeading) {
351
+ if (lines.length > 0)
352
+ lines.push("");
353
+ lines.push(bold(`── ${heading} ──`));
354
+ openHeading = heading;
355
+ }
356
+ lines.push(formatItem(item, w, now === undefined ? {} : { now }));
357
+ }
358
+ return lines;
359
+ }
360
+ /**
361
+ * Sidebar-grouped views (anytime/someday), rendered the way the GUI reads:
362
+ * the area-less block headerless first, then one `── <area> ──` header per
363
+ * area; inside a section, loose to-dos first, then each project GROUP — a
364
+ * blank line, the project's bold+underlined title row, then its members.
365
+ * Container names implied by the grouping are not repeated on member rows
366
+ * (an area header covers its rows; a project title row covers the to-dos
367
+ * beneath it — a clustered child whose project row is absent, e.g. under a
368
+ * tag filter, keeps its `(project)` suffix). `star` prefixes each item line
369
+ * with the Today-membership mark (★, or ⏾ for This-Evening members).
370
+ */
371
+ export function renderSections(sections, star = false) {
372
+ const all = sections.flatMap((s) => s.items);
373
+ if (all.length === 0)
374
+ return ["(empty)"];
375
+ const w = uuidDisplayWidth(all);
376
+ const lines = [];
377
+ const blank = () => {
378
+ if (lines.length > 0 && lines.at(-1) !== "")
379
+ lines.push("");
380
+ };
381
+ for (const section of sections) {
382
+ if (section.area !== null) {
383
+ blank();
384
+ lines.push(`${bold("──")} ${areaMark()} ${bold(`${section.area.title} ──`)}`);
385
+ }
386
+ // The uuid of the project whose title row is directly above (its member
387
+ // rows drop their redundant `(project)` suffix).
388
+ let openProject = null;
389
+ for (const item of section.items) {
390
+ const mark = star ? todayMark(item) : null;
391
+ if (item.type === "project") {
392
+ openProject = item.uuid;
393
+ blank();
394
+ lines.push(formatItem(item, w, {
395
+ projectTitle: true,
396
+ suppressArea: section.area?.uuid ?? null,
397
+ mark,
398
+ }));
399
+ }
400
+ else {
401
+ lines.push(formatItem(item, w, {
402
+ suppressProject: openProject,
403
+ suppressArea: section.area?.uuid ?? null,
404
+ mark,
405
+ }));
406
+ }
407
+ }
408
+ }
409
+ return lines;
410
+ }
411
+ /** Single-quote a title for a copy-pasteable drill-down command. */
412
+ function quoteTitle(title) {
413
+ return `'${title.replace(/'/g, "'\\''")}'`;
414
+ }
415
+ const takeUpTo = (items, limit) => limit === null ? items : items.slice(0, limit);
416
+ /** Muted per-block truncation line: `… N more — \`drill-down\``. */
417
+ function blockMoreLine(total, shown, drill) {
418
+ return dim(` … ${total - shown} more${drill === null ? "" : ` — \`${drill}\``}`);
419
+ }
420
+ /**
421
+ * Type-aware variant for blocks that mix project rows and to-dos (someday's
422
+ * loose/area blocks): the hidden remainder is split by type — `… 5 more
423
+ * projects, 14 more to-dos` — omitting a type with nothing hidden and
424
+ * pluralizing per count.
425
+ */
426
+ function mixedMoreLine(hidden, drill) {
427
+ const projects = hidden.filter((i) => i.type === "project").length;
428
+ const todos = hidden.length - projects;
429
+ const parts = [
430
+ ...(projects > 0 ? [`${projects} more project${projects === 1 ? "" : "s"}`] : []),
431
+ ...(todos > 0 ? [`${todos} more to-do${todos === 1 ? "" : "s"}`] : []),
432
+ ];
433
+ return dim(` … ${parts.join(", ")}${drill === null ? "" : ` — \`${drill}\``}`);
434
+ }
435
+ /**
436
+ * Muted bottom line for a truncated grouped view: `── more per group — see
437
+ * more: \`<base> <bigger flags>\` · all: \`<base> --all\` ──`, where the
438
+ * bigger-flags command doubles exactly the caps that actually truncated.
439
+ */
440
+ function groupedBottomLine(base, escalations, allBase = base) {
441
+ const seeMore = escalations.length > 0 ? `see more: \`${base} ${escalations.join(" ")}\` · ` : "";
442
+ return dim(`── more per group — ${seeMore}all: \`${allBase} --all\` ──`);
443
+ }
444
+ /**
445
+ * The anytime preview: the FULL block skeleton — every area header and every
446
+ * project row — always renders; `limits.area` caps the loose block and each
447
+ * area's direct to-dos, `limits.project` each project's to-dos. A truncated
448
+ * block trails a muted `… N more — \`things (project|area) show '…'\``
449
+ * drill-down (the loose block has no container, so it shows only the count),
450
+ * and the view ends with one line escalating the caps that hit. Today members
451
+ * are starred. Mirrors renderSections' layout exactly.
452
+ */
453
+ export function renderAnytimePreview(sections, limits, base) {
454
+ const all = sections.flatMap((s) => s.items);
455
+ if (all.length === 0)
456
+ return ["(empty)"];
457
+ const w = uuidDisplayWidth(all);
458
+ const lines = [];
459
+ let areaHit = false;
460
+ let projectHit = false;
461
+ const blank = () => {
462
+ if (lines.length > 0 && lines.at(-1) !== "")
463
+ lines.push("");
464
+ };
465
+ for (const section of sections) {
466
+ if (section.area !== null) {
467
+ blank();
468
+ lines.push(`${bold("──")} ${areaMark()} ${bold(`${section.area.title} ──`)}`);
469
+ }
470
+ const { direct, projects } = splitSectionBlocks(section);
471
+ const suppressArea = section.area?.uuid ?? null;
472
+ const shownDirect = takeUpTo(direct, limits.area);
473
+ for (const item of shownDirect) {
474
+ lines.push(formatItem(item, w, { suppressArea, mark: todayMark(item) }));
475
+ }
476
+ if (direct.length > shownDirect.length) {
477
+ areaHit = true;
478
+ const drill = section.area === null ? null : `things area show ${quoteTitle(section.area.title)}`;
479
+ lines.push(blockMoreLine(direct.length, shownDirect.length, drill));
480
+ }
481
+ for (const { project, items: children } of projects) {
482
+ blank();
483
+ lines.push(formatItem(project, w, { projectTitle: true, suppressArea, mark: todayMark(project) }));
484
+ const shownChildren = takeUpTo(children, limits.project);
485
+ for (const item of shownChildren) {
486
+ lines.push(formatItem(item, w, {
487
+ suppressProject: project.uuid,
488
+ suppressArea,
489
+ mark: todayMark(item),
490
+ }));
491
+ }
492
+ if (children.length > shownChildren.length) {
493
+ projectHit = true;
494
+ lines.push(blockMoreLine(children.length, shownChildren.length, `things project show ${quoteTitle(project.title)}`));
495
+ }
496
+ }
497
+ }
498
+ if (areaHit || projectHit) {
499
+ const escalations = [
500
+ ...(areaHit && limits.area !== null ? [`--area-limit ${limits.area * 2}`] : []),
501
+ ...(projectHit && limits.project !== null ? [`--project-limit ${limits.project * 2}`] : []),
502
+ ];
503
+ lines.push("", groupedBottomLine(base, escalations));
504
+ }
505
+ return lines;
506
+ }
507
+ /**
508
+ * The someday preview, mirroring the GUI (side-by-side, 2026-07-12): inside
509
+ * each group the project rows render as PLAIN items — `(~)` circle, count
510
+ * chip, no header styling, no surrounding blank lines — listed before the
511
+ * direct to-dos; `limits.area` caps each group's combined list. With
512
+ * `showActive` (the --show-active-project-items toggle) the someday to-dos
513
+ * living inside active projects append as a separate trailing
514
+ * `── From active projects ──` section — a flat run of project-header blocks
515
+ * (no area grouping), each capped at `limits.project` (null = every item).
516
+ * When the toggle is off and such items exist, a muted bottom hint counts
517
+ * them and names the flag.
518
+ */
519
+ export function renderSomedayPreview(sections, limits, base, showActive, hiddenActiveItems) {
520
+ const all = sections.flatMap((s) => s.items);
521
+ const lines = [];
522
+ let areaHit = false;
523
+ let projectHit = false;
524
+ const blank = () => {
525
+ if (lines.length > 0 && lines.at(-1) !== "")
526
+ lines.push("");
527
+ };
528
+ if (all.length === 0) {
529
+ lines.push("(empty)");
530
+ }
531
+ else {
532
+ const w = uuidDisplayWidth(all);
533
+ const trailing = [];
534
+ for (const section of sections) {
535
+ const { own, children } = partitionSomedaySection(section);
536
+ trailing.push(...children);
537
+ if (section.area !== null) {
538
+ blank();
539
+ lines.push(`${bold("──")} ${areaMark()} ${bold(`${section.area.title} ──`)}`);
540
+ }
541
+ const suppressArea = section.area?.uuid ?? null;
542
+ const shownOwn = takeUpTo(own, limits.area);
543
+ for (const item of shownOwn)
544
+ lines.push(formatItem(item, w, { suppressArea }));
545
+ if (own.length > shownOwn.length) {
546
+ areaHit = true;
547
+ const drill = section.area === null ? null : `things area show ${quoteTitle(section.area.title)}`;
548
+ lines.push(mixedMoreLine(own.slice(shownOwn.length), drill));
549
+ }
550
+ }
551
+ if (trailing.length > 0) {
552
+ blank();
553
+ lines.push(bold("── From active projects ──"));
554
+ for (const group of trailing) {
555
+ blank();
556
+ lines.push(`${dim(uuidCol(group.project.uuid, w))} ${bold(underline(group.project.title))}`);
557
+ const shown = takeUpTo(group.items, limits.project);
558
+ for (const item of shown) {
559
+ lines.push(formatItem(item, w, { suppressProject: group.project.uuid }));
560
+ }
561
+ if (group.items.length > shown.length) {
562
+ projectHit = true;
563
+ lines.push(blockMoreLine(group.items.length, shown.length, `things project show ${quoteTitle(group.project.title)}`));
564
+ }
565
+ }
566
+ }
567
+ }
568
+ if (areaHit || projectHit) {
569
+ const escalations = [
570
+ ...(areaHit && limits.area !== null ? [`--area-limit ${limits.area * 2}`] : []),
571
+ ...(projectHit && limits.project !== null
572
+ ? [`--show-active-project-items ${limits.project * 2}`]
573
+ : []),
574
+ ];
575
+ // The bare flag keeps the active-projects section visible under --all.
576
+ const allBase = showActive ? `${base} --show-active-project-items` : base;
577
+ lines.push("", groupedBottomLine(base, escalations, allBase));
578
+ }
579
+ if (!showActive && hiddenActiveItems > 0) {
580
+ blank();
581
+ lines.push(dim(`(${hiddenActiveItems} someday to-do${hiddenActiveItems === 1 ? "" : "s"} inside active projects — visible with \`things someday --show-active-project-items\`)`));
582
+ }
583
+ return lines;
584
+ }
585
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/cli/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,aAAa,GAId,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EACL,QAAQ,EACR,cAAc,EACd,SAAS,EACT,QAAQ,EACR,aAAa,EACb,WAAW,EACX,MAAM,EACN,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CA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