@harborppm/cli 0.105.0 → 0.108.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.
package/dist/app.mjs CHANGED
@@ -128,10 +128,10 @@ function timeAgo(date, now = clockNow()) {
128
128
  const words = `${n} ${unit}${n === 1 ? "" : "s"}`;
129
129
  return diff > 0 ? `in ${words}` : `${words} ago`;
130
130
  }
131
- var MONTHS$1, DAYS$2, pad$1, TOKENS, TOKEN, ISO, MINUTE;
131
+ var MONTHS$2, DAYS$2, pad$1, TOKENS, TOKEN, ISO, MINUTE;
132
132
  var init_date_text = __esmMin((() => {
133
133
  init_clock();
134
- MONTHS$1 = [
134
+ MONTHS$2 = [
135
135
  "January",
136
136
  "February",
137
137
  "March",
@@ -157,8 +157,8 @@ var init_date_text = __esmMin((() => {
157
157
  pad$1 = (n, width = 2) => String(n).padStart(width, "0");
158
158
  TOKENS = {
159
159
  yyyy: (d) => pad$1(d.getFullYear(), 4),
160
- MMMM: (d) => MONTHS$1[d.getMonth()],
161
- MMM: (d) => MONTHS$1[d.getMonth()].slice(0, 3),
160
+ MMMM: (d) => MONTHS$2[d.getMonth()],
161
+ MMM: (d) => MONTHS$2[d.getMonth()].slice(0, 3),
162
162
  MM: (d) => pad$1(d.getMonth() + 1),
163
163
  dd: (d) => pad$1(d.getDate()),
164
164
  d: (d) => String(d.getDate()),
@@ -3084,7 +3084,7 @@ var init_cascade = __esmMin((() => {
3084
3084
  // src/lib/forecast.ts
3085
3085
  init_cascade();
3086
3086
  init_date_fns();
3087
- const day$8 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
3087
+ const day$9 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
3088
3088
  /**
3089
3089
  * A straight-line estimate at completion from the burn so far: spend divided
3090
3090
  * by the share of the schedule elapsed. Null before anything is spent or
@@ -3093,8 +3093,8 @@ const day$8 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
3093
3093
  */
3094
3094
  function forecastAtCompletion(item, now) {
3095
3095
  if (item.spent <= 0) return null;
3096
- const total = differenceInCalendarDays(day$8(item.endDate), day$8(item.startDate)) + 1;
3097
- const gone = differenceInCalendarDays(now, day$8(item.startDate)) + 1;
3096
+ const total = differenceInCalendarDays(day$9(item.endDate), day$9(item.startDate)) + 1;
3097
+ const gone = differenceInCalendarDays(now, day$9(item.startDate)) + 1;
3098
3098
  if (total <= 0 || gone <= 0) return null;
3099
3099
  const elapsed = Math.min(1, gone / total);
3100
3100
  const eac = Math.round(item.spent / elapsed);
@@ -4341,7 +4341,7 @@ init_tide();
4341
4341
  init_raid();
4342
4342
  init_flow();
4343
4343
  init_date_fns();
4344
- const day$7 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
4344
+ const day$8 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
4345
4345
  function monthKey(iso) {
4346
4346
  return iso.slice(0, 7);
4347
4347
  }
@@ -4357,7 +4357,7 @@ function monthsBetween(from, to) {
4357
4357
  return out;
4358
4358
  }
4359
4359
  function daysIn(key) {
4360
- return getDaysInMonth(day$7(`${key}-01`));
4360
+ return getDaysInMonth(day$8(`${key}-01`));
4361
4361
  }
4362
4362
  /** How many of the schedule's days fall in `key`. */
4363
4363
  function overlapDays(key, start, end) {
@@ -4365,7 +4365,7 @@ function overlapDays(key, start, end) {
4365
4365
  const lastDay = `${key}-${String(daysIn(key)).padStart(2, "0")}`;
4366
4366
  const from = start > first ? start : first;
4367
4367
  const to = end < lastDay ? end : lastDay;
4368
- return to < from ? 0 : differenceInCalendarDays(day$7(to), day$7(from)) + 1;
4368
+ return to < from ? 0 : differenceInCalendarDays(day$8(to), day$8(from)) + 1;
4369
4369
  }
4370
4370
  /**
4371
4371
  * The budget spread straight across the schedule: each month gets the share
@@ -4375,7 +4375,7 @@ function overlapDays(key, start, end) {
4375
4375
  function evenPhasing(project) {
4376
4376
  const end = project.endDate < project.startDate ? project.startDate : project.endDate;
4377
4377
  const months = monthsBetween(project.startDate, end);
4378
- const total = differenceInCalendarDays(day$7(end), day$7(project.startDate)) + 1;
4378
+ const total = differenceInCalendarDays(day$8(end), day$8(project.startDate)) + 1;
4379
4379
  const out = {};
4380
4380
  let placed = 0;
4381
4381
  months.forEach((k, i) => {
@@ -4482,7 +4482,7 @@ function hasBaseline(p) {
4482
4482
  /** Days the end has moved past the baseline end; negative when it came in. Null without a baseline. */
4483
4483
  function slipDays(p) {
4484
4484
  if (!p.baselineEnd) return null;
4485
- return differenceInCalendarDays(day$6(p.endDate), day$6(p.baselineEnd));
4485
+ return differenceInCalendarDays(day$7(p.endDate), day$7(p.baselineEnd));
4486
4486
  }
4487
4487
  /**
4488
4488
  * The projects with the current dates committed as their baseline; ones that
@@ -4504,10 +4504,10 @@ function slipLabel(p) {
4504
4504
  const n = Math.abs(slip);
4505
4505
  return slip > 0 ? `slipped ${n} day${n === 1 ? "" : "s"}` : `${n} day${n === 1 ? "" : "s"} early`;
4506
4506
  }
4507
- var day$6;
4507
+ var day$7;
4508
4508
  var init_baseline = __esmMin((() => {
4509
4509
  init_date_fns();
4510
- day$6 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
4510
+ day$7 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
4511
4511
  }));
4512
4512
 
4513
4513
  // src/lib/roadmap.ts
@@ -4535,7 +4535,7 @@ const ZOOMS = [
4535
4535
  step: 3
4536
4536
  }
4537
4537
  ];
4538
- const day$5 = (iso) => /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T12:00:00`);
4538
+ const day$6 = (iso) => /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T12:00:00`);
4539
4539
  /** Names in the order people expect: "Phase 2" before "Phase 10". */
4540
4540
  const byName = (a, b) => a.localeCompare(b, void 0, { numeric: true });
4541
4541
  const isoDay$3 = (d) => format(d, "yyyy-MM-dd");
@@ -4545,7 +4545,7 @@ const isoDay$3 = (d) => format(d, "yyyy-MM-dd");
4545
4545
  */
4546
4546
  function roadmapWindow(zoom, today, shift = 0) {
4547
4547
  const z = ZOOMS.find((x) => x.id === zoom) ?? ZOOMS[1];
4548
- const first = addMonths$1(startOfMonth(day$5(today)), -1 + shift * z.step);
4548
+ const first = addMonths$1(startOfMonth(day$6(today)), -1 + shift * z.step);
4549
4549
  const after = addMonths$1(first, z.months);
4550
4550
  const days = differenceInCalendarDays(after, first);
4551
4551
  const months = Array.from({ length: z.months }, (_, i) => {
@@ -4569,15 +4569,15 @@ function roadmapWindow(zoom, today, shift = 0) {
4569
4569
  function at(iso, w) {
4570
4570
  if (!iso) return null;
4571
4571
  if (iso < w.start || iso >= w.end) return null;
4572
- return differenceInCalendarDays(day$5(iso), day$5(w.start)) / w.days;
4572
+ return differenceInCalendarDays(day$6(iso), day$6(w.start)) / w.days;
4573
4573
  }
4574
4574
  /** A bar for a start–end span, clipped to the window; null when it's wholly outside. */
4575
4575
  function span$1(start, end, w) {
4576
4576
  if (!start || !end || end < w.start || start >= w.end) return null;
4577
4577
  const from = start < w.start ? w.start : start;
4578
- const until = end >= w.end ? w.end : isoDay$3(new Date(day$5(end).getTime() + 864e5));
4579
- const left = differenceInCalendarDays(day$5(from), day$5(w.start)) / w.days;
4580
- const right = differenceInCalendarDays(day$5(until), day$5(w.start)) / w.days;
4578
+ const until = end >= w.end ? w.end : isoDay$3(new Date(day$6(end).getTime() + 864e5));
4579
+ const left = differenceInCalendarDays(day$6(from), day$6(w.start)) / w.days;
4580
+ const right = differenceInCalendarDays(day$6(until), day$6(w.start)) / w.days;
4581
4581
  return {
4582
4582
  left,
4583
4583
  width: Math.max(right - left, 1 / w.days),
@@ -5275,7 +5275,7 @@ function readDue$1(text, today) {
5275
5275
  return null;
5276
5276
  }
5277
5277
  /** "Oct 14", with the year when it isn't this one. */
5278
- function shortDay(iso, today) {
5278
+ function shortDay$1(iso, today) {
5279
5279
  if (!iso) return "";
5280
5280
  const d = parseIso(iso);
5281
5281
  return format(d, iso.slice(0, 4) === today.slice(0, 4) ? "MMM d" : "MMM d, yyyy");
@@ -5395,12 +5395,12 @@ function tideLine(data, project, today) {
5395
5395
  text: "Not done in the next two years at this pace",
5396
5396
  late: true
5397
5397
  };
5398
- const very = tide.veryLikely ? `, very likely by ${shortDay(tide.veryLikely, today)}` : "";
5399
- const end = project.endDate >= today ? ` · ${chanceText(tide.chanceByEnd)} by its end, ${shortDay(project.endDate, today)}` : "";
5398
+ const very = tide.veryLikely ? `, very likely by ${shortDay$1(tide.veryLikely, today)}` : "";
5399
+ const end = project.endDate >= today ? ` · ${chanceText(tide.chanceByEnd)} by its end, ${shortDay$1(project.endDate, today)}` : "";
5400
5400
  const later = dueAfterFinish(tide);
5401
- const due = later ? ` · ${taskKey(later, project) ?? `“${later.title}”`} is due ${shortDay(later.dueDate.slice(0, 10), today)}` : "";
5401
+ const due = later ? ` · ${taskKey(later, project) ?? `“${later.title}”`} is due ${shortDay$1(later.dueDate.slice(0, 10), today)}` : "";
5402
5402
  return {
5403
- text: `Probably done ${shortDay(tide.likely, today)}${very}${end}${due}${tide.rough ? " · rough" : ""}`,
5403
+ text: `Probably done ${shortDay$1(tide.likely, today)}${very}${end}${due}${tide.rough ? " · rough" : ""}`,
5404
5404
  late: tide.chanceByEnd < .5
5405
5405
  };
5406
5406
  }
@@ -5499,6 +5499,20 @@ function wrapLines(text, width) {
5499
5499
  }
5500
5500
  return out;
5501
5501
  }
5502
+ /**
5503
+ * Text on at most `lines` lines no wider than `width`, the last ending in "…"
5504
+ * when some is left over: a board card's title, which must never run into the
5505
+ * card below.
5506
+ */
5507
+ function clampLines(text, width, lines) {
5508
+ const w = Math.max(1, width);
5509
+ const all = wrapLines(text.replace(/\s+/g, " ").trim(), w).map((l) => l.slice(0, w));
5510
+ if (all.length <= lines) return all;
5511
+ const kept = all.slice(0, lines);
5512
+ const last = kept[lines - 1];
5513
+ kept[lines - 1] = (last.length >= w ? last.slice(0, w - 1) : last).trimEnd() + "…";
5514
+ return kept;
5515
+ }
5502
5516
  /** The first of the month a day falls in. */
5503
5517
  function monthOf(iso) {
5504
5518
  return `${iso.slice(0, 7)}-01`;
@@ -5552,7 +5566,7 @@ function markdownToPlain(md) {
5552
5566
  }
5553
5567
  /** A thing's health moves, newest first, as "Oct 12 At risk (set by hand: note)". */
5554
5568
  function healthMoves(history, today, max = 3) {
5555
- return [...history ?? []].slice(-max).reverse().map((h) => `${shortDay(h.at.slice(0, 10), today).padEnd(7)} ${HEALTH_LABEL[h.health]}${h.override ? ` (set by hand${h.note ? `: ${h.note}` : ""})` : ""}`);
5569
+ return [...history ?? []].slice(-max).reverse().map((h) => `${shortDay$1(h.at.slice(0, 10), today).padEnd(7)} ${HEALTH_LABEL[h.health]}${h.override ? ` (set by hand${h.note ? `: ${h.note}` : ""})` : ""}`);
5556
5570
  }
5557
5571
  /**
5558
5572
  * A project's pre-mortem for the terminal: whether one runs, the question,
@@ -5763,6 +5777,13 @@ function crewRows(crew, data, now) {
5763
5777
  which: "assignments",
5764
5778
  on: crew.email.assignments
5765
5779
  });
5780
+ rows.push({
5781
+ kind: "email",
5782
+ text: "A sea shanty about the week, at the end of the Monday digest",
5783
+ detail: crew.email.shanty ? "on" : "off",
5784
+ which: "shanty",
5785
+ on: crew.email.shanty
5786
+ });
5766
5787
  rows.push({
5767
5788
  kind: "heading",
5768
5789
  text: "Keep"
@@ -8038,7 +8059,7 @@ function bottleState(note, ctx) {
8038
8059
  /** "opens on Nov 14", "opens when Factory buy-off is reached", "opens if Ridge Runner launch turns Off track" */
8039
8060
  function opensText(opens, ctx) {
8040
8061
  if (!opens) return "open now";
8041
- if (opens.on === "date") return `opens on ${day$4(opens.date)}`;
8062
+ if (opens.on === "date") return `opens on ${day$5(opens.date)}`;
8042
8063
  if (opens.on === "milestone") {
8043
8064
  const m = ctx.milestones.find((x) => x.id === opens.milestoneId);
8044
8065
  return m ? `opens when ${m.name} is reached` : "opens when its milestone is reached";
@@ -8072,7 +8093,7 @@ function freshlyOpened(data, projects, now) {
8072
8093
  }
8073
8094
  return out.sort((a, b) => (b.state.openedOn ?? "").localeCompare(a.state.openedOn ?? ""));
8074
8095
  }
8075
- var BOTTLE_FRESH_DAYS, isBottle, sealed, day$4;
8096
+ var BOTTLE_FRESH_DAYS, isBottle, sealed, day$5;
8076
8097
  var init_bottle = __esmMin((() => {
8077
8098
  init_date_fns();
8078
8099
  init_date_text();
@@ -8084,7 +8105,7 @@ var init_bottle = __esmMin((() => {
8084
8105
  open: false,
8085
8106
  openedOn: null
8086
8107
  };
8087
- day$4 = (iso) => format(parseIso(iso.slice(0, 10)), "MMM d");
8108
+ day$5 = (iso) => format(parseIso(iso.slice(0, 10)), "MMM d");
8088
8109
  }));
8089
8110
 
8090
8111
  // src/lib/decisions.ts
@@ -8259,31 +8280,31 @@ function barnaclesHeadline(b) {
8259
8280
  if (b.added === 0) return null;
8260
8281
  const when = b.from === "baseline" ? "since the baseline" : "since its first week";
8261
8282
  const pct = b.share != null && !b.caveat ? `, ${Math.round(b.share * 100)}% more than planned` : "";
8262
- return `+${plural$7(b.added, "task")} ${when}${pct}`;
8283
+ return `+${plural$8(b.added, "task")} ${when}${pct}`;
8263
8284
  }
8264
8285
  /** What the added work costs in days, and how much of the slip it explains. */
8265
8286
  function barnaclesDaysLine(b) {
8266
8287
  if (b.added === 0 || b.days == null || b.perWeek == null || b.caveat) return null;
8267
- const work = `At the crew's pace (about ${b.perWeek} a week) that's about ${plural$7(b.days, "day")} of work`;
8288
+ const work = `At the crew's pace (about ${b.perWeek} a week) that's about ${plural$8(b.days, "day")} of work`;
8268
8289
  if (b.slip == null || b.slip <= 0) return `${work}.`;
8269
- if (b.days >= b.slip) return `${work}: enough to explain all ${plural$7(b.slip, "day")} of the slip.`;
8270
- return `${work}: about ${b.days} of the ${plural$7(b.slip, "day")} it has slipped.`;
8290
+ if (b.days >= b.slip) return `${work}: enough to explain all ${plural$8(b.slip, "day")} of the slip.`;
8291
+ return `${work}: about ${b.days} of the ${plural$8(b.slip, "day")} it has slipped.`;
8271
8292
  }
8272
8293
  /** One line for the brief or a list: "+14 tasks (38%) since the baseline, 3 this week, about 65 days of work". */
8273
8294
  function barnaclesShort(b) {
8274
8295
  const pct = b.share != null && !b.caveat ? ` (${Math.round(b.share * 100)}%)` : "";
8275
8296
  const when = b.from === "baseline" ? "since the baseline" : "since its first week";
8276
8297
  const week = b.thisWeek ? `, ${b.thisWeek} this week` : "";
8277
- const days = b.days != null && !b.caveat ? `, about ${plural$7(b.days, "day")} of work` : "";
8298
+ const days = b.days != null && !b.caveat ? `, about ${plural$8(b.days, "day")} of work` : "";
8278
8299
  const top = b.adders.find((a) => a.personId);
8279
8300
  const who = top && top.added * 2 > b.added ? `, mostly from ${top.name}` : "";
8280
- return `+${plural$7(b.added, "task")}${pct} ${when}${week}${days}${who}`;
8301
+ return `+${plural$8(b.added, "task")}${pct} ${when}${week}${days}${who}`;
8281
8302
  }
8282
8303
  /** Whether the brief names it: measured from a baseline, enough added, and enough of the plan. */
8283
8304
  function briefWorthy(b) {
8284
8305
  return b.from === "baseline" && !b.caveat && b.added >= 3 && (b.share == null || b.share >= .15);
8285
8306
  }
8286
- var SETTLE_DAYS, THIN_PLANNED, THIN_WEEKS, BULK_SHARE, BULK_MIN, BRIEF_MIN_ADDED, BRIEF_MIN_SHARE, noon$2, isoDay$2, plural$7;
8307
+ var SETTLE_DAYS, THIN_PLANNED, THIN_WEEKS, BULK_SHARE, BULK_MIN, BRIEF_MIN_ADDED, BRIEF_MIN_SHARE, noon$2, isoDay$2, plural$8;
8287
8308
  var init_barnacles = __esmMin((() => {
8288
8309
  init_date_fns();
8289
8310
  init_format();
@@ -8297,7 +8318,7 @@ var init_barnacles = __esmMin((() => {
8297
8318
  BRIEF_MIN_SHARE = .15;
8298
8319
  noon$2 = (iso) => /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T12:00:00`);
8299
8320
  isoDay$2 = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
8300
- plural$7 = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
8321
+ plural$8 = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
8301
8322
  }));
8302
8323
 
8303
8324
  // src/lib/brief.ts
@@ -10110,6 +10131,13 @@ function withDashboard(list, input) {
10110
10131
  createdAt: input.createdAt
10111
10132
  }];
10112
10133
  }
10134
+ function renamedDashboard(list, id, name) {
10135
+ const clean = cleanName(name);
10136
+ return list.map((d) => d.id === id ? {
10137
+ ...d,
10138
+ name: clean
10139
+ } : d);
10140
+ }
10113
10141
  function withoutDashboard(list, id) {
10114
10142
  return list.filter((d) => d.id !== id);
10115
10143
  }
@@ -10169,6 +10197,14 @@ function starterCharts(makeId) {
10169
10197
  init_utils();
10170
10198
  /** The longest bar a chart draws, in characters. */
10171
10199
  const BAR = 24;
10200
+ /**
10201
+ * A value's bar, then a space: nothing for a zero (a block there reads as
10202
+ * something done), at least one block for anything above it.
10203
+ */
10204
+ function barOf(value, top) {
10205
+ if (!(value > 0)) return "";
10206
+ return `${"█".repeat(Math.max(1, Math.round(value / Math.max(top, value) * BAR)))} `;
10207
+ }
10172
10208
  /** Each dashboard and its charts as lines: a chart's name and total, then a bar a value. */
10173
10209
  function reportRows(data, today) {
10174
10210
  const out = [];
@@ -10203,7 +10239,7 @@ function reportRows(data, today) {
10203
10239
  });
10204
10240
  for (const s of r.slices) out.push({
10205
10241
  key: `${chart.id}-${s.key}`,
10206
- text: ` ${s.label.slice(0, label).padEnd(label)} ${"█".repeat(Math.max(1, Math.round(s.value / top * BAR)))} ${s.value}`,
10242
+ text: ` ${s.label.slice(0, label).padEnd(label)} ${barOf(s.value, top)}${s.value}`,
10207
10243
  plain: true
10208
10244
  });
10209
10245
  }
@@ -10274,6 +10310,10 @@ function ReportsView({ active, width, height, go }) {
10274
10310
  }));
10275
10311
  });
10276
10312
  if (!cursor) return;
10313
+ if (key.return) {
10314
+ if (viewOnly) return go.notify("You can only view this harbor.");
10315
+ return chartMenu(go, cursor, change);
10316
+ }
10277
10317
  if (input === "a") return addChart(go, cursor.dashboard, change);
10278
10318
  if ((input === "[" || input === "]") && cursor.chart) return change((list) => movedChart(list, cursor.dashboard.id, cursor.chart.id, input === "[" ? -1 : 1));
10279
10319
  if (input === "d") return go.confirm(cursor.chart ? `Remove the chart “${cursor.chart.title}”? u undoes it.` : `Delete the dashboard “${cursor.dashboard.name}” and its charts? u undoes it.`, () => change((list) => cursor.chart ? withoutChart(list, cursor.dashboard.id, cursor.chart.id) : withoutDashboard(list, cursor.dashboard.id)), cursor.chart ? "Remove" : "Delete");
@@ -10285,7 +10325,7 @@ function ReportsView({ active, width, height, go }) {
10285
10325
  paddingX: 1,
10286
10326
  children: [
10287
10327
  /* @__PURE__ */ jsx(Heading, {
10288
- right: "↑↓ · n dashboard · a chart · [ ] move · d remove",
10328
+ right: "↑↓ · Enter change · n dashboard · a chart · [ ] move · d remove",
10289
10329
  children: "Reports"
10290
10330
  }),
10291
10331
  /* @__PURE__ */ jsx(Text, { children: " " }),
@@ -10301,6 +10341,62 @@ function ReportsView({ active, width, height, go }) {
10301
10341
  ]
10302
10342
  });
10303
10343
  }
10344
+ /** Enter on a dashboard or a chart: what can change about it, as on the website. */
10345
+ function chartMenu(go, { dashboard, chart }, change) {
10346
+ if (!chart) return go.pick(dashboard.name, [{
10347
+ label: "Rename it",
10348
+ value: "rename"
10349
+ }, {
10350
+ label: "Add a chart",
10351
+ value: "add"
10352
+ }], (what) => what === "add" ? addChart(go, dashboard, change) : go.ask("The dashboard's name", (name) => {
10353
+ if (name.trim()) change((list) => renamedDashboard(list, dashboard.id, name));
10354
+ }, dashboard.name));
10355
+ const { id, ...rest } = chart;
10356
+ const keep = (patch) => change((list) => withChart(list, dashboard.id, {
10357
+ ...rest,
10358
+ ...patch
10359
+ }, id));
10360
+ go.pick(chart.title, [
10361
+ {
10362
+ label: "Rename it",
10363
+ value: "rename"
10364
+ },
10365
+ {
10366
+ label: "Split it another way",
10367
+ value: "split"
10368
+ },
10369
+ {
10370
+ label: "Move it up",
10371
+ value: "up"
10372
+ },
10373
+ {
10374
+ label: "Move it down",
10375
+ value: "down"
10376
+ }
10377
+ ], (what) => {
10378
+ if (what === "rename") return go.ask("The chart's title", (title) => {
10379
+ if (title.trim()) keep({ title: title.trim() });
10380
+ }, chart.title);
10381
+ if (what === "split") return go.pick(`${MEASURE_LABEL[chart.measure]}, split by`, groupsFor(chart.measure).filter((g) => g !== "field").map((g) => ({
10382
+ label: groupLabel(chart.measure, g),
10383
+ value: g
10384
+ })), (g) => {
10385
+ const groupBy = g;
10386
+ const titled = chart.title === defaultTitle(chart);
10387
+ keep({
10388
+ groupBy,
10389
+ field: void 0,
10390
+ view: defaultView(groupBy),
10391
+ title: titled ? defaultTitle({
10392
+ measure: chart.measure,
10393
+ groupBy
10394
+ }) : chart.title
10395
+ });
10396
+ });
10397
+ change((list) => movedChart(list, dashboard.id, chart.id, what === "up" ? -1 : 1));
10398
+ });
10399
+ }
10304
10400
  function addChart(go, dashboard, change) {
10305
10401
  go.pick(`A chart on ${dashboard.name}: what does it count?`, MEASURES.map((m) => ({
10306
10402
  label: MEASURE_LABEL[m],
@@ -10395,8 +10491,8 @@ init_blockers();
10395
10491
  init_date_text();
10396
10492
  init_premortem();
10397
10493
  init_thanks();
10398
- const day$3 = (iso) => parseIso(localDay(iso));
10399
- const between = (a, b) => differenceInCalendarDays(day$3(b), day$3(a));
10494
+ const day$4 = (iso) => parseIso(localDay(iso));
10495
+ const between = (a, b) => differenceInCalendarDays(day$4(b), day$4(a));
10400
10496
  function voyageLog(data, projectId) {
10401
10497
  const project = data.projects.find((p) => p.id === projectId);
10402
10498
  if (!project) return null;
@@ -10462,8 +10558,8 @@ function voyageLog(data, projectId) {
10462
10558
  thanks
10463
10559
  };
10464
10560
  }
10465
- const plural$6 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
10466
- const md$1 = (iso) => format(day$3(iso), "MMM d");
10561
+ const plural$7 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
10562
+ const md$1 = (iso) => format(day$4(iso), "MMM d");
10467
10563
  /** The three numbers at the top: how late, how much work, how many risks came true. */
10468
10564
  function voyageStats(log) {
10469
10565
  const happened = log.risks.filter((r) => r.happened).length;
@@ -10477,10 +10573,10 @@ function voyageStats(log) {
10477
10573
  value: "On time",
10478
10574
  label: "on the planned day"
10479
10575
  } : days > 0 ? {
10480
- value: `+${plural$6(days, "day")}`,
10576
+ value: `+${plural$7(days, "day")}`,
10481
10577
  label: `past the ${plan}`
10482
10578
  } : {
10483
- value: plural$6(-days, "day"),
10579
+ value: plural$7(-days, "day"),
10484
10580
  label: `ahead of the ${plan}`
10485
10581
  },
10486
10582
  {
@@ -10506,7 +10602,7 @@ function voyageStory(log) {
10506
10602
  out.push(`Barnacles: ${grew}${by}.${days ? ` ${days}` : ""}`);
10507
10603
  }
10508
10604
  for (const s of log.slips) {
10509
- const late = `“${s.task.title}” finished ${plural$6(s.daysLate, "day")} late`;
10605
+ const late = `“${s.task.title}” finished ${plural$7(s.daysLate, "day")} late`;
10510
10606
  out.push(s.waitedOn ? `${late}; it waited on “${s.waitedOn.title}”, done ${md$1(s.waitedOn.completedAt)}.` : `${late}.`);
10511
10607
  }
10512
10608
  for (const r of log.risks.filter((x) => x.happened)) out.push(`The risk “${r.risk.title}” came true${r.guessed ? " (an issue names it)" : ""}.`);
@@ -10514,11 +10610,11 @@ function voyageStory(log) {
10514
10610
  if (against) out.push(against);
10515
10611
  if (log.decisions.length) {
10516
10612
  const changed = log.decisions.filter((d) => d.status === "superseded").length;
10517
- out.push(`${plural$6(log.decisions.length, "decision was", "decisions were")} written down${changed ? `; ${changed === 1 ? "one was" : `${changed} were`} changed later` : ""}.`);
10613
+ out.push(`${plural$7(log.decisions.length, "decision was", "decisions were")} written down${changed ? `; ${changed === 1 ? "one was" : `${changed} were`} changed later` : ""}.`);
10518
10614
  }
10519
10615
  const top = log.carriers[0];
10520
- if (top && log.carriers.length > 1) out.push(`${top.person.name} closed ${plural$6(top.closed, "task")}, the most on the crew.`);
10521
- else if (top) out.push(`${top.person.name} closed ${plural$6(top.closed, "task")}.`);
10616
+ if (top && log.carriers.length > 1) out.push(`${top.person.name} closed ${plural$7(top.closed, "task")}, the most on the crew.`);
10617
+ else if (top) out.push(`${top.person.name} closed ${plural$7(top.closed, "task")}.`);
10522
10618
  if (log.budget > 0) {
10523
10619
  const pct = Math.round(log.spent / log.budget * 100);
10524
10620
  out.push(`Spent ${pct}% of the budget.`);
@@ -10665,7 +10761,7 @@ const DAYS$1 = [
10665
10761
  "friday",
10666
10762
  "saturday"
10667
10763
  ];
10668
- const MONTHS = [
10764
+ const MONTHS$1 = [
10669
10765
  "january",
10670
10766
  "february",
10671
10767
  "march",
@@ -10717,7 +10813,7 @@ function nextMonthDay(today, m, d) {
10717
10813
  const monthIndex = (word) => {
10718
10814
  const w = word.toLowerCase().replace(/\.$/, "");
10719
10815
  if (w.length < 3) return -1;
10720
- return MONTHS.findIndex((m) => m.startsWith(w) && (w.length >= 3 || m === w));
10816
+ return MONTHS$1.findIndex((m) => m.startsWith(w) && (w.length >= 3 || m === w));
10721
10817
  };
10722
10818
  const DAY_WORD = "(?:sun|mon|tues?|wed(?:nes)?|thu(?:rs?)?|fri|sat(?:ur)?)(?:day)?";
10723
10819
  const MONTH_WORD = "(?:jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec)[a-z]*\\.?";
@@ -11472,7 +11568,7 @@ function Stepper({ title, steps, width, onDone, onCancel }) {
11472
11568
  const done = Object.entries(values).map(([k, v]) => {
11473
11569
  const s = steps.find((x) => x.key === k);
11474
11570
  if (!s || v == null || v === "") return null;
11475
- const shown = s.kind === "pick" ? choicesOf(s, values).find((c) => c.value === v)?.label ?? "" : s.kind === "date" ? shortDay(String(v), today()) : String(v);
11571
+ const shown = s.kind === "pick" ? choicesOf(s, values).find((c) => c.value === v)?.label ?? "" : s.kind === "date" ? shortDay$1(String(v), today()) : String(v);
11476
11572
  return `${s.label}: ${shown}`;
11477
11573
  }).filter(Boolean).join(" · ");
11478
11574
  return /* @__PURE__ */ jsxs(Box, {
@@ -11866,7 +11962,7 @@ function BridgeView({ active, width, height, go, programIds, onBack }) {
11866
11962
  assigneeId: who ?? null,
11867
11963
  dueDate: due
11868
11964
  }, { allowOverCap: true }));
11869
- go.notify(`Action added, due ${shortDay(due, today())}.`);
11965
+ go.notify(`Action added, due ${shortDay$1(due, today())}.`);
11870
11966
  });
11871
11967
  });
11872
11968
  };
@@ -11956,11 +12052,11 @@ function BridgeView({ active, width, height, go, programIds, onBack }) {
11956
12052
  [
11957
12053
  HEALTH_LABEL[slide.project.health],
11958
12054
  owner?.name,
11959
- `ends ${shortDay(slide.project.endDate, today())}`,
12055
+ `ends ${shortDay$1(slide.project.endDate, today())}`,
11960
12056
  `${slide.late} late of ${slide.open} open`,
11961
12057
  slide.highRisks ? `${slide.highRisks} high risk${slide.highRisks === 1 ? "" : "s"}` : null
11962
12058
  ].filter(Boolean).join(" · "),
11963
- slide.milestone ? `Next milestone: ${slide.milestone.name}, ${shortDay(slide.milestone.dueDate, today())}` : "",
12059
+ slide.milestone ? `Next milestone: ${slide.milestone.name}, ${shortDay$1(slide.milestone.dueDate, today())}` : "",
11964
12060
  "",
11965
12061
  `Since ${program.reviewedAt ? "the last review" : "last week"}, ${timeAgo(new Date(slide.since), started)}:`,
11966
12062
  ...slide.changes.flatMap((c) => all && c.more > 0 && c.items ? [`• ${changeHeading(c)} (${c.items.length}):`, ...c.items.map((i) => ` ${i}`)] : [`• ${c.text}`]),
@@ -12099,7 +12195,7 @@ function TaskLine({ task, projects, people, today, selected, picked = false, wid
12099
12195
  children: [
12100
12196
  " ",
12101
12197
  late ? "late · " : "",
12102
- shortDay(task.dueDate, today)
12198
+ shortDay$1(task.dueDate, today)
12103
12199
  ]
12104
12200
  }) : null,
12105
12201
  blocked ? /* @__PURE__ */ jsx(Text, {
@@ -12620,7 +12716,7 @@ function dollars(value) {
12620
12716
  const n = Number(value ?? 0);
12621
12717
  return whole.format(Number.isFinite(n) ? n : 0);
12622
12718
  }
12623
- function day$2(value) {
12719
+ function day$3(value) {
12624
12720
  return value ? shortDate(value) : "no date";
12625
12721
  }
12626
12722
  /** Whole days from one ISO day to another. */
@@ -12708,15 +12804,15 @@ function describeEvent(e, names) {
12708
12804
  };
12709
12805
  case "dueDate": return {
12710
12806
  action: "moved the due date of",
12711
- detail: `from ${day$2(from)} to ${day$2(to)}${slip(from, to)}`
12807
+ detail: `from ${day$3(from)} to ${day$3(to)}${slip(from, to)}`
12712
12808
  };
12713
12809
  case "startDate": return {
12714
12810
  action: "moved the start of",
12715
- detail: `from ${day$2(from)} to ${day$2(to)}${slip(from, to)}`
12811
+ detail: `from ${day$3(from)} to ${day$3(to)}${slip(from, to)}`
12716
12812
  };
12717
12813
  case "endDate": return {
12718
12814
  action: "moved the end of",
12719
- detail: `from ${day$2(from)} to ${day$2(to)}${slip(from, to)}`
12815
+ detail: `from ${day$3(from)} to ${day$3(to)}${slip(from, to)}`
12720
12816
  };
12721
12817
  case "budget": return {
12722
12818
  action: "changed the budget of",
@@ -13151,6 +13247,116 @@ function readBy(marks, personId) {
13151
13247
  return (pingId) => set.has(pingId) || set.has(readMark(personId, pingId));
13152
13248
  }
13153
13249
 
13250
+ // src/lib/convoy.ts
13251
+ init_date_fns();
13252
+ init_date_text();
13253
+ init_indexes();
13254
+ init_tide();
13255
+ const day$2 = (iso) => parseIso(iso.slice(0, 10));
13256
+ /** When a convoy looks like arriving, and how that was read. */
13257
+ function expectedOf(data, convoy, now) {
13258
+ const project = convoy.projectId ? byId(data.projects).get(convoy.projectId) ?? null : null;
13259
+ if (convoy.status === "delivered") return {
13260
+ expected: convoy.deliveredAt?.slice(0, 10) ?? null,
13261
+ basis: "delivered",
13262
+ project
13263
+ };
13264
+ if (convoy.status !== "accepted" || !project) return {
13265
+ expected: null,
13266
+ basis: "none",
13267
+ project
13268
+ };
13269
+ const tide = tideForecast(project, tasksOf(data.tasks, project.id), now, tideOptions(data));
13270
+ if (tide.kind === "forecast" && tide.likely) return {
13271
+ expected: tide.likely,
13272
+ basis: "forecast",
13273
+ project
13274
+ };
13275
+ if (tide.kind === "done") return {
13276
+ expected: null,
13277
+ basis: "finished",
13278
+ project
13279
+ };
13280
+ return {
13281
+ expected: project.endDate?.slice(0, 10) || null,
13282
+ basis: "end date",
13283
+ project
13284
+ };
13285
+ }
13286
+ /** Every convoy in the harbor with where it stands, the asking program's first. */
13287
+ function convoyRows(data, now) {
13288
+ const programs = byId(data.programs);
13289
+ const out = [];
13290
+ for (const asker of data.programs) for (const convoy of asker.convoys ?? []) {
13291
+ const giver = programs.get(convoy.toProgramId) ?? null;
13292
+ const { expected, basis, project } = expectedOf(data, convoy, now);
13293
+ const late = expected ? differenceInCalendarDays(day$2(expected), day$2(convoy.by)) : null;
13294
+ out.push({
13295
+ convoy,
13296
+ asker,
13297
+ giver,
13298
+ project,
13299
+ expected,
13300
+ basis,
13301
+ late
13302
+ });
13303
+ }
13304
+ return out;
13305
+ }
13306
+ /** What one program is waiting on, and what others wait on it for. */
13307
+ function convoysOf(rows, programId) {
13308
+ const open = (r) => r.convoy.status !== "delivered" && r.convoy.status !== "declined";
13309
+ const order = (a, b) => Number(open(b)) - Number(open(a)) || a.convoy.by.localeCompare(b.convoy.by);
13310
+ return {
13311
+ waitingOn: rows.filter((r) => r.asker.id === programId).sort(order),
13312
+ waitedOnBy: rows.filter((r) => r.giver?.id === programId).sort(order)
13313
+ };
13314
+ }
13315
+ /** Behind: accepted, not delivered, and looking like arriving after the day asked. */
13316
+ function isBehind(row) {
13317
+ return row.convoy.status === "accepted" && row.late != null && row.late > 0;
13318
+ }
13319
+ /** A plain line for where a convoy stands. */
13320
+ function standingText(row, today, side = "asker") {
13321
+ const c = row.convoy;
13322
+ const from = row.giver?.name ?? "A deleted program";
13323
+ if (c.status === "asked") return side === "giver" ? "Needs your answer" : `Waiting for ${from} to answer`;
13324
+ if (c.status === "declined") return `${from} can't${c.note ? `: “${c.note}”` : ""}`;
13325
+ if (c.status === "delivered") return `Delivered${c.deliveredAt ? ` ${shortDay(c.deliveredAt)}` : ""}`;
13326
+ if (row.basis === "finished") return `${row.project?.name ?? "Its project"} is finished`;
13327
+ if (!row.project) return c.projectId ? `Accepted by ${from}, but the project it named was deleted` : `Accepted by ${from}; no project named yet`;
13328
+ if (!row.expected) return `Accepted; ${row.project.name} has no date to go by`;
13329
+ const when = `${row.basis === "forecast" ? "likely" : "planned to end"} ${shortDay(row.expected)}`;
13330
+ if (row.late != null && row.late > 0) return `${row.project.name} is ${when}, ${row.late} day${row.late === 1 ? "" : "s"} late`;
13331
+ return c.by.slice(0, 10) < today ? `Past the day; ${row.project.name} is ${when}` : `In time: ${row.project.name} is ${when}`;
13332
+ }
13333
+ const MONTHS = [
13334
+ "Jan",
13335
+ "Feb",
13336
+ "Mar",
13337
+ "Apr",
13338
+ "May",
13339
+ "Jun",
13340
+ "Jul",
13341
+ "Aug",
13342
+ "Sep",
13343
+ "Oct",
13344
+ "Nov",
13345
+ "Dec"
13346
+ ];
13347
+ /** "Dec 12". */
13348
+ function shortDay(iso) {
13349
+ const d = day$2(iso);
13350
+ return Number.isNaN(d.getTime()) ? iso : `${MONTHS[d.getMonth()]} ${d.getDate()}`;
13351
+ }
13352
+ /** Who should hear about a convoy: its program's owner and whoever asked or answered. */
13353
+ function askerSide(row) {
13354
+ return [...new Set([row.asker.ownerId, row.convoy.askedById].filter(Boolean))];
13355
+ }
13356
+ function giverSide(row) {
13357
+ return [...new Set([row.giver?.ownerId, row.convoy.answeredById].filter((x) => Boolean(x)))];
13358
+ }
13359
+
13154
13360
  // src/lib/inbox.ts
13155
13361
  init_date_fns();
13156
13362
  init_indexes();
@@ -13172,7 +13378,8 @@ const KIND_RANK = {
13172
13378
  idle: 5,
13173
13379
  mention: 6,
13174
13380
  reply: 7,
13175
- finished: 8
13381
+ finished: 8,
13382
+ convoy: 1.5
13176
13383
  };
13177
13384
  const PING_KIND_LABEL = {
13178
13385
  harbor: "Your harbor",
@@ -13185,7 +13392,8 @@ const PING_KIND_LABEL = {
13185
13392
  idle: "Quiet blockers",
13186
13393
  mention: "Mentions",
13187
13394
  reply: "Replies",
13188
- finished: "Finished"
13395
+ finished: "Finished",
13396
+ convoy: "Between programs"
13189
13397
  };
13190
13398
  function firstName$3(name) {
13191
13399
  return name.split(/\s+/)[0] ?? name;
@@ -13214,6 +13422,56 @@ function projectOf(data, task) {
13214
13422
  }
13215
13423
  /** How long an assignment stays in the inbox. */
13216
13424
  const ASSIGNED_DAYS = 14;
13425
+ /**
13426
+ * Convoys (src/lib/convoy.ts): an ask waiting on your program's answer, an
13427
+ * answer to your program's ask, and a promise whose project now looks like
13428
+ * arriving after its day, told to both sides as soon as the forecast says so.
13429
+ * A later slip is a new line (the id carries the day it looks like).
13430
+ */
13431
+ function convoyPings(data, personId, now, since) {
13432
+ if (!data.programs.some((p) => p.convoys?.length)) return [];
13433
+ const out = [];
13434
+ for (const row of convoyRows(data, now)) {
13435
+ const c = row.convoy;
13436
+ const giver = row.giver?.name ?? "A deleted program";
13437
+ const href = (id) => `/programs/${id}?view=convoy`;
13438
+ const asker = askerSide(row).includes(personId);
13439
+ const giving = Boolean(row.giver) && giverSide(row).includes(personId);
13440
+ if (c.status === "asked" && giving && c.askedById !== personId) out.push({
13441
+ id: `convoy-ask:${c.id}:${c.by}`,
13442
+ kind: "convoy",
13443
+ title: `${row.asker.name} asks ${giver} for “${c.what}”`,
13444
+ detail: `Needed by ${shortDay(c.by)}. Accept it, naming the project that delivers, or say you can't.`,
13445
+ at: c.askedAt,
13446
+ personId: c.askedById,
13447
+ programId: row.giver.id,
13448
+ href: href(row.giver.id)
13449
+ });
13450
+ if (asker && (c.status === "accepted" || c.status === "declined") && c.answeredAt && c.answeredAt >= since && c.answeredById !== personId) out.push({
13451
+ id: `convoy-${c.status}:${c.id}:${c.answeredAt}`,
13452
+ kind: "convoy",
13453
+ title: c.status === "accepted" ? `${giver} took on “${c.what}”` : `${giver} can't take on “${c.what}”`,
13454
+ detail: c.status === "accepted" ? `By ${shortDay(c.by)}${row.project ? `, through ${row.project.name}` : ""}.` : c.note ? `“${c.note}” Move the day or ask elsewhere.` : "Move the day or ask elsewhere.",
13455
+ at: c.answeredAt,
13456
+ personId: c.answeredById ?? null,
13457
+ programId: row.asker.id,
13458
+ href: href(row.asker.id)
13459
+ });
13460
+ if (isBehind(row) && (asker || giving)) {
13461
+ const late = row.late;
13462
+ out.push({
13463
+ id: `convoy-late:${c.id}:${c.by}:${row.expected}`,
13464
+ kind: "convoy",
13465
+ title: `“${c.what}” looks like arriving late`,
13466
+ detail: `${row.project.name} is ${row.basis === "forecast" ? "likely done" : "planned to end"} ${shortDay(row.expected)}, ${late} day${late === 1 ? "" : "s"} after ${row.asker.name} needs it (${shortDay(c.by)}).`,
13467
+ at: now.toISOString(),
13468
+ programId: asker ? row.asker.id : row.giver.id,
13469
+ href: href(asker ? row.asker.id : row.giver.id)
13470
+ });
13471
+ }
13472
+ }
13473
+ return out;
13474
+ }
13217
13475
  function inboxOf(data, personId, now = clockNow()) {
13218
13476
  const pings = [];
13219
13477
  const mine = data.tasks.filter((t) => t.assigneeId === personId && t.status !== "done");
@@ -13505,6 +13763,7 @@ function inboxOf(data, personId, now = clockNow()) {
13505
13763
  href: `/projects/${task.projectId}`
13506
13764
  });
13507
13765
  }
13766
+ pings.push(...convoyPings(data, personId, now, since));
13508
13767
  return pings.sort((a, b) => {
13509
13768
  const rank = KIND_RANK[a.kind] - KIND_RANK[b.kind];
13510
13769
  if (rank !== 0) return rank;
@@ -13931,7 +14190,7 @@ function byTask(rows, who) {
13931
14190
  }
13932
14191
  return out;
13933
14192
  }
13934
- const plural$5 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
14193
+ const plural$6 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
13935
14194
  /** Work only one person has touched, soonest-needed first. `scope` narrows it to some programs. */
13936
14195
  function lifeboats(data, now, opts = {}) {
13937
14196
  const today = isoDay(now);
@@ -13970,7 +14229,7 @@ function lifeboats(data, now, opts = {}) {
13970
14229
  kind: "project",
13971
14230
  id: project.id,
13972
14231
  label: project.name,
13973
- detail: `${plural$5(open.length, "open task")}, nobody else on them`,
14232
+ detail: `${plural$6(open.length, "open task")}, nobody else on them`,
13974
14233
  soloId: solo[0],
13975
14234
  projectId: project.id,
13976
14235
  programId: project.programId,
@@ -13992,7 +14251,7 @@ function lifeboats(data, now, opts = {}) {
13992
14251
  out.push({
13993
14252
  kind: "tasks",
13994
14253
  id: `tasks:${project.id}:${soloId}`,
13995
- label: `${plural$5(list.length, "task")} on ${project.name}`,
14254
+ label: `${plural$6(list.length, "task")} on ${project.name}`,
13996
14255
  detail: `only ${first} has touched them`,
13997
14256
  soloId,
13998
14257
  projectId: project.id,
@@ -14012,7 +14271,7 @@ function lifeboats(data, now, opts = {}) {
14012
14271
  kind: "task",
14013
14272
  id: t.id,
14014
14273
  label: key ? `${key} ${t.title}` : t.title,
14015
- detail: [d < today ? `late since ${md(d)}` : `due ${md(d)}`, holds ? `${plural$5(holds, "task")} ${holds === 1 ? "waits" : "wait"} on it` : "urgent"].join(", "),
14274
+ detail: [d < today ? `late since ${md(d)}` : `due ${md(d)}`, holds ? `${plural$6(holds, "task")} ${holds === 1 ? "waits" : "wait"} on it` : "urgent"].join(", "),
14016
14275
  soloId,
14017
14276
  projectId: project.id,
14018
14277
  programId: project.programId,
@@ -14039,7 +14298,7 @@ function lifeboats(data, now, opts = {}) {
14039
14298
  const programId = first.programId ?? project?.programId ?? null;
14040
14299
  const where = project?.name ?? (programId ? programs.get(programId)?.name : null) ?? null;
14041
14300
  const issues = items.filter((r) => r.kind === "issue").length;
14042
- const noun = issues === 0 ? plural$5(items.length, "risk") : issues === items.length ? plural$5(items.length, "issue") : `${plural$5(items.length - issues, "risk")} and ${plural$5(issues, "issue")}`;
14301
+ const noun = issues === 0 ? plural$6(items.length, "risk") : issues === items.length ? plural$6(items.length, "issue") : `${plural$6(items.length - issues, "risk")} and ${plural$6(issues, "issue")}`;
14043
14302
  out.push({
14044
14303
  kind: "risks",
14045
14304
  id: key,
@@ -14717,7 +14976,7 @@ function ProgramPanel({ id, width, height, go, active, onClose }) {
14717
14976
  },
14718
14977
  {
14719
14978
  label: "Starts",
14720
- value: shortDay(program.startDate, today()),
14979
+ value: shortDay$1(program.startDate, today()),
14721
14980
  edit: {
14722
14981
  kind: "date",
14723
14982
  initial: program.startDate,
@@ -14726,7 +14985,7 @@ function ProgramPanel({ id, width, height, go, active, onClose }) {
14726
14985
  },
14727
14986
  {
14728
14987
  label: "Ends",
14729
- value: shortDay(program.endDate, today()),
14988
+ value: shortDay$1(program.endDate, today()),
14730
14989
  edit: {
14731
14990
  kind: "date",
14732
14991
  initial: program.endDate,
@@ -15014,7 +15273,7 @@ function ProjectPanel({ id, width, height, go, active, onClose }) {
15014
15273
  },
15015
15274
  {
15016
15275
  label: "Starts",
15017
- value: shortDay(project.startDate, today()),
15276
+ value: shortDay$1(project.startDate, today()),
15018
15277
  edit: {
15019
15278
  kind: "date",
15020
15279
  initial: project.startDate,
@@ -15023,7 +15282,7 @@ function ProjectPanel({ id, width, height, go, active, onClose }) {
15023
15282
  },
15024
15283
  {
15025
15284
  label: "Ends",
15026
- value: shortDay(project.endDate, today()),
15285
+ value: shortDay$1(project.endDate, today()),
15027
15286
  edit: {
15028
15287
  kind: "date",
15029
15288
  initial: project.endDate,
@@ -15099,7 +15358,7 @@ function ProjectPanel({ id, width, height, go, active, onClose }) {
15099
15358
  }] : [],
15100
15359
  {
15101
15360
  label: "Baseline",
15102
- value: hasBaseline(project) ? `${shortDay(project.baselineStart, today())} to ${shortDay(project.baselineEnd, today())}${slip ? `, ${slip}` : ""}` : "Not set (set it on the program)",
15361
+ value: hasBaseline(project) ? `${shortDay$1(project.baselineStart, today())} to ${shortDay$1(project.baselineEnd, today())}${slip ? `, ${slip}` : ""}` : "Not set (set it on the program)",
15103
15362
  color: slip?.startsWith("slipped") ? theme.bad : void 0
15104
15363
  },
15105
15364
  {
@@ -15183,7 +15442,7 @@ function MilestonePanel({ id, width, height, go, active, onClose }) {
15183
15442
  },
15184
15443
  {
15185
15444
  label: "Due",
15186
- value: `${shortDay(milestone.dueDate, today())}${late ? " (late)" : ""}`,
15445
+ value: `${shortDay$1(milestone.dueDate, today())}${late ? " (late)" : ""}`,
15187
15446
  color: late ? theme.bad : void 0,
15188
15447
  edit: {
15189
15448
  kind: "date",
@@ -15278,7 +15537,7 @@ function MilestonePanel({ id, width, height, go, active, onClose }) {
15278
15537
  " ",
15279
15538
  "At risk:",
15280
15539
  " ",
15281
- r.reason === "ends-after" ? `${r.project.name} ends ${shortDay(r.project.endDate, today())}` : `${r.project.name} is off track`
15540
+ r.reason === "ends-after" ? `${r.project.name} ends ${shortDay$1(r.project.endDate, today())}` : `${r.project.name} is off track`
15282
15541
  ]
15283
15542
  }, r.project.id))] }) : null,
15284
15543
  active,
@@ -15440,7 +15699,7 @@ function RaidPanel({ id, width, height, go, active, onClose }) {
15440
15699
  },
15441
15700
  {
15442
15701
  label: "Decided on",
15443
- value: item.decidedAt ? shortDay(item.decidedAt, today()) : "Not yet",
15702
+ value: item.decidedAt ? shortDay$1(item.decidedAt, today()) : "Not yet",
15444
15703
  edit: {
15445
15704
  kind: "date",
15446
15705
  initial: item.decidedAt ?? null,
@@ -15460,7 +15719,7 @@ function RaidPanel({ id, width, height, go, active, onClose }) {
15460
15719
  ] : [],
15461
15720
  {
15462
15721
  label: copy.dueDate,
15463
- value: shortDay(item.dueDate, today()),
15722
+ value: shortDay$1(item.dueDate, today()),
15464
15723
  edit: {
15465
15724
  kind: "date",
15466
15725
  initial: item.dueDate,
@@ -15513,7 +15772,7 @@ function RaidPanel({ id, width, height, go, active, onClose }) {
15513
15772
  " ",
15514
15773
  /* @__PURE__ */ jsx(Text, {
15515
15774
  color: theme.muted,
15516
- children: shortDay(u.createdAt.slice(0, 10), today())
15775
+ children: shortDay$1(u.createdAt.slice(0, 10), today())
15517
15776
  }),
15518
15777
  " ",
15519
15778
  u.body.replace(/\s+/g, " ")
@@ -15724,7 +15983,7 @@ function ProjectsView({ active, width, height, go }) {
15724
15983
  depth: 2,
15725
15984
  title: `${project.name}${project.key ? ` ${project.key}` : ""}`,
15726
15985
  health: project.health,
15727
- detail: `${finished}/${total} done${late ? ` · ${late} late` : ""} · ends ${shortDay(project.endDate, today())}`
15986
+ detail: `${finished}/${total} done${late ? ` · ${late} late` : ""} · ends ${shortDay$1(project.endDate, today())}`
15728
15987
  });
15729
15988
  }
15730
15989
  }
@@ -15824,7 +16083,7 @@ function ProgramsView({ active, width, height, go }) {
15824
16083
  health: program.health,
15825
16084
  detail: [
15826
16085
  lead?.name.split(" ")[0],
15827
- program.endDate ? `ends ${shortDay(program.endDate, day)}` : null,
16086
+ program.endDate ? `ends ${shortDay$1(program.endDate, day)}` : null,
15828
16087
  late ? `${late} late` : null,
15829
16088
  slip >= 100 ? `slipping costs ${dollars$1(slip)}` : null,
15830
16089
  isRated(program) ? quadrantOf(program, maxBudget, rules) : null,
@@ -16425,9 +16684,9 @@ const HELP$1 = [
16425
16684
  ["v", "switch layout: board, list, budget, by project"],
16426
16685
  ["m R P t D", "milestone / risk / pre-mortem / dry dock / Done"],
16427
16686
  ["c a C S", "on a task: comment / step / yours / sounding"],
16428
- ["s T / M T", "subtask, as template / messages, from template"],
16429
- ["f / c", "on Today: focus on a task / check in"],
16430
- ["f / p", "on a board: filter by owner / priority"],
16687
+ ["s T", "on a task: add a subtask / save as a template"],
16688
+ ["M T", "on a project: messages / a task from a template"],
16689
+ ["f c / f p", "Today: focus, check in · board: owner, priority"],
16431
16690
  ["q", "quit (saves first)"]
16432
16691
  ];
16433
16692
  /**
@@ -16687,7 +16946,7 @@ function PremortemPanel({ id, width, height, go, active, onClose }) {
16687
16946
  ]
16688
16947
  });
16689
16948
  if (pm.phase === "none") {
16690
- const ends = project.endDate ? `after ${shortDay(project.endDate, today())}` : "three months from now";
16949
+ const ends = project.endDate ? `after ${shortDay$1(project.endDate, today())}` : "three months from now";
16691
16950
  return frame(/* @__PURE__ */ jsxs(Fragment$1, { children: [
16692
16951
  /* @__PURE__ */ jsxs(Text, {
16693
16952
  wrap: "wrap",
@@ -17360,6 +17619,140 @@ function applyDock(actions, projectId, changes) {
17360
17619
  return made;
17361
17620
  }
17362
17621
 
17622
+ // src/lib/daily-digest.ts
17623
+ /** The projects a scope covers; a person's are the ones they lead, sit under, or have a task in. */
17624
+ function projectsIn(data, scope) {
17625
+ if (scope.kind === "harbor") return data.projects;
17626
+ if (scope.kind === "program") return data.projects.filter((p) => p.programId === scope.id);
17627
+ const led = new Set(data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id));
17628
+ return data.projects.filter((p) => p.ownerId === scope.id || led.has(p.programId) || tasksOf(data.tasks, p.id).some((t) => t.assigneeId === scope.id));
17629
+ }
17630
+ /** Where health went since `since`: from what it was just before to what it is now, if it moved. */
17631
+ function moved(history, now, since) {
17632
+ const list = history ?? [];
17633
+ if (!list.some((h) => h.at >= since)) return null;
17634
+ const before = [...list].reverse().find((h) => h.at < since)?.health;
17635
+ return before && before !== now ? {
17636
+ from: before,
17637
+ to: now
17638
+ } : null;
17639
+ }
17640
+ /** What changed in `scope` from `since` (an ISO moment) on. */
17641
+ function dailyDigest(data, scope, since) {
17642
+ const projects = projectsIn(data, scope);
17643
+ const projectIds = new Set(projects.map((p) => p.id));
17644
+ const programIds = scope.kind === "program" ? /* @__PURE__ */ new Set([scope.id]) : new Set(scope.kind === "harbor" ? data.programs.map((p) => p.id) : [...projects.map((p) => p.programId), ...data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id)]);
17645
+ const tasks = projects.flatMap((p) => tasksOf(data.tasks, p.id));
17646
+ const arrivedDone = (t) => Boolean(t.completedAt) && Math.abs(Date.parse(t.completedAt) - Date.parse(t.createdAt)) < ARRIVED_DONE_MS;
17647
+ const finished = tasks.filter((t) => t.status === "done" && t.completedAt && t.completedAt >= since && !arrivedDone(t)).sort((a, b) => b.completedAt.localeCompare(a.completedAt));
17648
+ const finishedIds = new Set(finished.map((t) => t.id));
17649
+ const added = tasks.filter((t) => t.createdAt >= since && !finishedIds.has(t.id)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
17650
+ const health = [];
17651
+ for (const p of data.programs) {
17652
+ if (!programIds.has(p.id)) continue;
17653
+ const m = moved(p.healthHistory, p.health, since);
17654
+ if (m) health.push({
17655
+ name: p.name,
17656
+ path: `/programs/${p.id}`,
17657
+ ...m
17658
+ });
17659
+ }
17660
+ for (const p of projects) {
17661
+ const m = moved(p.healthHistory, p.health, since);
17662
+ if (m) health.push({
17663
+ name: p.name,
17664
+ path: `/projects/${p.id}`,
17665
+ ...m
17666
+ });
17667
+ }
17668
+ const inScope = (r) => r.projectId ? projectIds.has(r.projectId) : r.programId ? programIds.has(r.programId) : scope.kind === "harbor";
17669
+ const raised = data.raidItems.filter((r) => r.kind !== "decision" && r.createdAt >= since && inScope(r)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
17670
+ const decided = data.raidItems.filter((r) => r.kind === "decision" && r.status !== "proposed" && Boolean(r.decidedAt) && r.decidedAt >= since && inScope(r)).sort((a, b) => b.decidedAt.localeCompare(a.decidedAt));
17671
+ const people = byId(data.people);
17672
+ const first = (id) => people.get(id)?.name.split(" ")[0] ?? "Someone";
17673
+ const projectById = byId(data.projects);
17674
+ const programById = byId(data.programs);
17675
+ const talkBy = /* @__PURE__ */ new Map();
17676
+ const count = (key, where, path, authorId, taskId) => {
17677
+ const t = talkBy.get(key) ?? {
17678
+ where,
17679
+ path,
17680
+ ...taskId ? { taskId } : {},
17681
+ count: 0,
17682
+ who: []
17683
+ };
17684
+ t.count++;
17685
+ const name = first(authorId);
17686
+ if (!t.who.includes(name)) t.who.push(name);
17687
+ talkBy.set(key, t);
17688
+ };
17689
+ for (const r of data.reflections ?? []) {
17690
+ if (!isMessage(r) || r.createdAt < since) continue;
17691
+ const place = placeOf(r);
17692
+ const holder = place.kind === "program" ? programById.get(place.id) : projectById.get(place.id);
17693
+ const inside = place.kind === "program" ? programIds.has(place.id) : projectIds.has(place.id);
17694
+ if (!holder || !inside) continue;
17695
+ count(`${place.kind}:${place.id}`, holder.name, placePath(place), r.authorId);
17696
+ }
17697
+ const taskById = byId(data.tasks);
17698
+ for (const c of data.comments) {
17699
+ if (c.createdAt < since) continue;
17700
+ const task = taskById.get(c.taskId);
17701
+ if (!task || !projectIds.has(task.projectId)) continue;
17702
+ const key = taskKey(task, projectById.get(task.projectId));
17703
+ count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, `/projects/${task.projectId}`, c.authorId, task.id);
17704
+ }
17705
+ const talk = [...talkBy.values()].sort((a, b) => b.count - a.count || a.where.localeCompare(b.where));
17706
+ return {
17707
+ since,
17708
+ finished,
17709
+ added,
17710
+ health,
17711
+ raised,
17712
+ decided,
17713
+ talk,
17714
+ quiet: !finished.length && !added.length && !health.length && !raised.length && !decided.length && !talk.length
17715
+ };
17716
+ }
17717
+ /** "A, B and 2 more". */
17718
+ function some(names, shown = 3) {
17719
+ const quoted = names.slice(0, shown).map((n) => `“${n}”`);
17720
+ const rest = names.length - quoted.length;
17721
+ if (rest > 0) return `${quoted.join(", ")} and ${rest} more`;
17722
+ if (quoted.length < 2) return quoted.join("");
17723
+ return `${quoted.slice(0, -1).join(", ")} and ${quoted.at(-1)}`;
17724
+ }
17725
+ /** The digest as short plain lines, the way the Inbox card, a chat post and the terminal say it. */
17726
+ function digestLines(d) {
17727
+ const lines = [];
17728
+ if (d.finished.length) lines.push(`${plural$5(d.finished.length, "task")} finished: ${some(d.finished.map((t) => t.title))}.`);
17729
+ if (d.added.length) lines.push(`${plural$5(d.added.length, "task")} added: ${some(d.added.map((t) => t.title))}.`);
17730
+ for (const h of d.health.slice(0, 5)) lines.push(`${h.name} went from ${HEALTH_LABEL$1[h.from] ?? h.from} to ${HEALTH_LABEL$1[h.to] ?? h.to}.`);
17731
+ if (d.health.length > 5) lines.push(`${d.health.length - 5} more changed health.`);
17732
+ if (d.raised.length) {
17733
+ const risks = d.raised.filter((r) => r.kind === "risk").length;
17734
+ const issues = d.raised.length - risks;
17735
+ const what = [risks ? plural$5(risks, "risk") : "", issues ? plural$5(issues, "issue") : ""].filter(Boolean).join(" and ");
17736
+ lines.push(`${what} raised: ${some(d.raised.map((r) => r.title))}.`);
17737
+ }
17738
+ if (d.decided.length) lines.push(`${plural$5(d.decided.length, "decision")} made: ${some(d.decided.map((r) => r.title))}.`);
17739
+ if (d.talk.length) {
17740
+ const top = d.talk.slice(0, 3).map((t) => `${t.where} (${t.count}, ${t.who.join(", ")})`).join("; ");
17741
+ const rest = d.talk.length - 3;
17742
+ lines.push(`Talk: ${top}${rest > 0 ? `; and ${plural$5(rest, "more conversation")}` : ""}.`);
17743
+ }
17744
+ return lines;
17745
+ }
17746
+ var ARRIVED_DONE_MS, plural$5;
17747
+ var init_daily_digest = __esmMin((() => {
17748
+ init_swatches();
17749
+ init_indexes();
17750
+ init_project_messages();
17751
+ init_task_keys();
17752
+ ARRIVED_DONE_MS = 6e4;
17753
+ plural$5 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
17754
+ }));
17755
+
17363
17756
  // src/lib/milestone-edits.ts
17364
17757
  /**
17365
17758
  * A milestone with `patch` applied, remembering the day it was reached:
@@ -17476,6 +17869,7 @@ var init_task_milestones = __esmMin((() => {
17476
17869
  }));
17477
17870
 
17478
17871
  // src/lib/compass.ts
17872
+ init_daily_digest();
17479
17873
  init_task_milestones();
17480
17874
  init_indexes();
17481
17875
  const zero = () => ({
@@ -23474,6 +23868,21 @@ function welcomeWhen(person, lastSeen, today) {
23474
23868
  days
23475
23869
  } : null;
23476
23870
  }
23871
+ /**
23872
+ * The later of this device's mark and the last thing the person did in the
23873
+ * harbor by hand (its activity log and their comments), so time spent on the
23874
+ * website, a phone or the commands counts as having looked. Changes made for
23875
+ * them (`via` GitHub and the like) don't.
23876
+ */
23877
+ function lastLooked(mark, data, personId) {
23878
+ let last = mark ?? null;
23879
+ const later = (at) => {
23880
+ if (at && (!last || at > last)) last = at;
23881
+ };
23882
+ for (const a of data.activity ?? []) if (a.personId === personId && !a.via) later(a.at);
23883
+ for (const c of data.comments ?? []) if (c.authorId === personId) later(c.createdAt);
23884
+ return last;
23885
+ }
23477
23886
 
23478
23887
  // src/lib/welcome-back.ts
23479
23888
  init_date_text();
@@ -25401,6 +25810,58 @@ const HARBOR_TOOLS = [
25401
25810
  };
25402
25811
  }
25403
25812
  }),
25813
+ tool({
25814
+ name: "daily_digest",
25815
+ title: "What changed",
25816
+ description: "What changed in the last day (or hours), the way the top of the Inbox and a program's morning chat post say it: tasks finished and added, health that moved, risks and issues raised, decisions made, and where people talked (each conversation with how many lines and who wrote). On the person's own projects by default, or one program's with program. lines is the same as short sentences; quiet means nothing happened." + DATA_NOTE,
25817
+ input: object({
25818
+ harbor: harborArg,
25819
+ program: string().min(1).max(200).optional().describe("Program id or name."),
25820
+ hours: number().int().min(1).max(168).optional().describe("How far back; default 24.")
25821
+ }),
25822
+ run: (ctx, input) => {
25823
+ const { data } = ctx;
25824
+ const program = input.program ? findOne(data.programs, input.program, "program") : null;
25825
+ const mine = me(ctx);
25826
+ const since = (/* @__PURE__ */ new Date(ctx.now.getTime() - (input.hours ?? 24) * 36e5)).toISOString();
25827
+ const d = dailyDigest(data, program ? {
25828
+ kind: "program",
25829
+ id: program.id
25830
+ } : mine ? {
25831
+ kind: "person",
25832
+ id: mine.id
25833
+ } : { kind: "harbor" }, since);
25834
+ const projects = byId(data.projects);
25835
+ const taskOut = (t) => ({
25836
+ id: t.id,
25837
+ ...taskKey(t, projects.get(t.projectId)) ? { key: taskKey(t, projects.get(t.projectId)) } : {},
25838
+ title: t.title
25839
+ });
25840
+ return {
25841
+ on: program ? program.name : mine ? "your work" : "the whole harbor",
25842
+ since,
25843
+ quiet: d.quiet,
25844
+ lines: digestLines(d),
25845
+ finished: d.finished.slice(0, 20).map(taskOut),
25846
+ added: d.added.slice(0, 20).map(taskOut),
25847
+ health: d.health,
25848
+ raised: d.raised.map((r) => ({
25849
+ id: r.id,
25850
+ kind: r.kind,
25851
+ title: r.title
25852
+ })),
25853
+ decided: d.decided.map((r) => ({
25854
+ id: r.id,
25855
+ title: r.title
25856
+ })),
25857
+ talk: d.talk.map((t) => ({
25858
+ where: t.where,
25859
+ count: t.count,
25860
+ who: t.who
25861
+ }))
25862
+ };
25863
+ }
25864
+ }),
25404
25865
  tool({
25405
25866
  name: "weekly_brief",
25406
25867
  title: "Weekly brief",
@@ -26002,6 +26463,41 @@ const HARBOR_TOOLS = [
26002
26463
  })) };
26003
26464
  }
26004
26465
  }),
26466
+ tool({
26467
+ name: "list_convoys",
26468
+ title: "Convoys",
26469
+ description: "Promises between programs (convoys): what one program asked another for by a day, whether the asked program accepted (and which of its projects delivers it), declined (and why) or delivered, and whether the delivering project's forecast lands after the day. Give a program to see what it waits on and what others wait on it for." + DATA_NOTE,
26470
+ input: object({
26471
+ harbor: harborArg,
26472
+ program: string().max(200).optional().describe("Program id or name. Default: every convoy.")
26473
+ }),
26474
+ run: (ctx, input) => {
26475
+ const { data } = ctx;
26476
+ const today = todayISO(ctx.now);
26477
+ const rows = convoyRows(data, ctx.now);
26478
+ const shape = (r, side = "asker") => ({
26479
+ id: r.convoy.id,
26480
+ what: r.convoy.what,
26481
+ from: r.asker.name,
26482
+ to: r.giver?.name ?? null,
26483
+ by: r.convoy.by,
26484
+ status: r.convoy.status,
26485
+ project: r.project?.name ?? null,
26486
+ expected: r.expected,
26487
+ late: isBehind(r) ? r.late : 0,
26488
+ ...r.convoy.note ? { note: r.convoy.note } : {},
26489
+ text: standingText(r, today, side)
26490
+ });
26491
+ if (!input.program) return { convoys: rows.map((r) => shape(r)) };
26492
+ const program = findOne(data.programs, input.program, "program");
26493
+ const { waitingOn, waitedOnBy } = convoysOf(rows, program.id);
26494
+ return {
26495
+ program: program.name,
26496
+ waitingOn: waitingOn.map((r) => shape(r)),
26497
+ waitedOnBy: waitedOnBy.map((r) => shape(r, "giver"))
26498
+ };
26499
+ }
26500
+ }),
26005
26501
  tool({
26006
26502
  name: "list_dashboards",
26007
26503
  title: "Dashboards",
@@ -30302,7 +30798,8 @@ function memoryCrew(account, harbor) {
30302
30798
  }];
30303
30799
  const email = {
30304
30800
  weeklyDigest: true,
30305
- assignments: true
30801
+ assignments: true,
30802
+ shanty: false
30306
30803
  };
30307
30804
  const keep = {
30308
30805
  kept: false,
@@ -30410,6 +30907,7 @@ function memoryCrew(account, harbor) {
30410
30907
  case "email":
30411
30908
  if (act.weeklyDigest !== void 0) email.weeklyDigest = act.weeklyDigest;
30412
30909
  if (act.assignments !== void 0) email.assignments = act.assignments;
30910
+ if (act.shanty !== void 0) email.shanty = act.shanty;
30413
30911
  return view();
30414
30912
  }
30415
30913
  },
@@ -30503,6 +31001,11 @@ var init_shore = __esmMin((() => {
30503
31001
  kind: "messages",
30504
31002
  label: "Messages",
30505
31003
  hint: "Each new message and reply in the program’s messages and its projects’, with a link to answer in Harbor."
31004
+ },
31005
+ {
31006
+ kind: "digest",
31007
+ label: "What changed, each morning",
31008
+ hint: "One post a day: tasks finished and added, health that moved, risks raised, decisions made and where people talked. Nothing on a quiet day."
30506
31009
  }
30507
31010
  ];
30508
31011
  }));
@@ -30614,6 +31117,7 @@ function memoryHarbor(start, opts) {
30614
31117
  health: false,
30615
31118
  notes: false,
30616
31119
  messages: false,
31120
+ digest: false,
30617
31121
  ...row,
30618
31122
  ...ask.url ? { url } : {}
30619
31123
  };
@@ -30629,6 +31133,7 @@ function memoryHarbor(start, opts) {
30629
31133
  health: row.health,
30630
31134
  notes: row.notes,
30631
31135
  messages: row.messages,
31136
+ digest: row.digest,
30632
31137
  failures: 0
30633
31138
  } : null;
30634
31139
  if (ask.test) {
@@ -32596,7 +33101,7 @@ function riskLine(r, today) {
32596
33101
  r.title,
32597
33102
  /* @__PURE__ */ jsxs(Text, {
32598
33103
  color: theme.muted,
32599
- children: [score != null ? ` · score ${score}` : "", r.dueDate ? ` · review ${shortDay(r.dueDate, today)}` : ""]
33104
+ children: [score != null ? ` · score ${score}` : "", r.dueDate ? ` · review ${shortDay$1(r.dueDate, today)}` : ""]
32600
33105
  })
32601
33106
  ]
32602
33107
  });
@@ -32730,7 +33235,7 @@ function ProgramBands({ bands, at, active, width, height, w, today }) {
32730
33235
  " ",
32731
33236
  "· ",
32732
33237
  m.dueDate < today ? "late, " : "",
32733
- shortDay(m.dueDate, today)
33238
+ shortDay$1(m.dueDate, today)
32734
33239
  ]
32735
33240
  })
32736
33241
  ]
@@ -32815,7 +33320,7 @@ function ProjectBands({ bands, at, active, width, height, w, today }) {
32815
33320
  }) : null,
32816
33321
  " · ends",
32817
33322
  " ",
32818
- shortDay(p.endDate, today)
33323
+ shortDay$1(p.endDate, today)
32819
33324
  ]
32820
33325
  })
32821
33326
  });
@@ -32964,9 +33469,9 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
32964
33469
  portfolio?.name,
32965
33470
  lead ? ` · ${lead.name}` : "",
32966
33471
  " · ",
32967
- shortDay(program.startDate, today()),
33472
+ shortDay$1(program.startDate, today()),
32968
33473
  "–",
32969
- shortDay(program.endDate, today())
33474
+ shortDay$1(program.endDate, today())
32970
33475
  ]
32971
33476
  })
32972
33477
  })]
@@ -33027,7 +33532,7 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
33027
33532
  "/",
33028
33533
  total,
33029
33534
  " · ends ",
33030
- shortDay(p.endDate, today())
33535
+ shortDay$1(p.endDate, today())
33031
33536
  ]
33032
33537
  })
33033
33538
  ]
@@ -33062,7 +33567,7 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
33062
33567
  " ",
33063
33568
  /* @__PURE__ */ jsxs(Text, {
33064
33569
  color: late ? theme.bad : theme.muted,
33065
- children: [late ? "late · " : "", shortDay(m.dueDate, today())]
33570
+ children: [late ? "late · " : "", shortDay$1(m.dueDate, today())]
33066
33571
  }),
33067
33572
  m.approverId ? /* @__PURE__ */ jsx(Text, {
33068
33573
  color: theme.muted,
@@ -33270,7 +33775,7 @@ function PortfolioView({ portfolioId, active, width, height, go, onBack }) {
33270
33775
  " ",
33271
33776
  /* @__PURE__ */ jsx(Text, {
33272
33777
  color: m.dueDate < day ? theme.bad : theme.muted,
33273
- children: shortDay(m.dueDate, day)
33778
+ children: shortDay$1(m.dueDate, day)
33274
33779
  })
33275
33780
  ]
33276
33781
  }, m.id)),
@@ -33898,13 +34403,14 @@ function ProjectView({ projectId, active, width, height, go, onBack }) {
33898
34403
  taskKey: keyOf$1({ projects }, t),
33899
34404
  title: t.title,
33900
34405
  owner: people.find((p) => p.id === t.assigneeId)?.initials,
33901
- due: t.dueDate ? shortDay(t.dueDate, day) : null,
34406
+ due: t.dueDate ? shortDay$1(t.dueDate, day) : null,
33902
34407
  late: isLate(t, day),
33903
34408
  waits: blocked(data, t),
33904
34409
  priority: t.priority,
33905
34410
  selected: on && view.start + i === r,
33906
34411
  fog: fogWeeks(t),
33907
- picked: picked.includes(t.id)
34412
+ picked: picked.includes(t.id),
34413
+ width: Math.max(1, w - 4)
33908
34414
  }, t.id)),
33909
34415
  view.start + view.items.length < c.tasks.length ? /* @__PURE__ */ jsxs(Text, {
33910
34416
  color: theme.muted,
@@ -33946,10 +34452,11 @@ function ProjectView({ projectId, active, width, height, go, onBack }) {
33946
34452
  });
33947
34453
  }
33948
34454
  /** One card on the board: its key, due date and owner, then the title on up to two lines. */
33949
- function Card({ taskKey, title, owner, due, late, waits, priority, selected, fog = null, picked = false }) {
34455
+ function Card({ taskKey, title, owner, due, late, waits, priority, selected, fog = null, picked = false, width }) {
33950
34456
  return /* @__PURE__ */ jsxs(Box, {
33951
34457
  flexDirection: "column",
33952
34458
  height: 3,
34459
+ overflow: "hidden",
33953
34460
  children: [/* @__PURE__ */ jsxs(Text, {
33954
34461
  wrap: "truncate-end",
33955
34462
  inverse: selected,
@@ -33988,13 +34495,15 @@ function Card({ taskKey, title, owner, due, late, waits, priority, selected, fog
33988
34495
  ]
33989
34496
  }), /* @__PURE__ */ jsx(Box, {
33990
34497
  height: 2,
33991
- children: /* @__PURE__ */ jsx(Text, {
33992
- wrap: "wrap",
34498
+ flexDirection: "column",
34499
+ overflow: "hidden",
34500
+ children: clampLines(title, width, 2).map((line, i) => /* @__PURE__ */ jsx(Text, {
34501
+ wrap: "truncate-end",
33993
34502
  bold: selected,
33994
34503
  dimColor: fog != null && !selected,
33995
34504
  color: selected ? theme.selected : fog != null ? theme.muted : void 0,
33996
- children: title
33997
- })
34505
+ children: line
34506
+ }, i))
33998
34507
  })]
33999
34508
  });
34000
34509
  }
@@ -34059,7 +34568,7 @@ function BudgetPane({ project, spendEntries, at, active, height, today }) {
34059
34568
  on ? "› " : " ",
34060
34569
  /* @__PURE__ */ jsx(Text, {
34061
34570
  color: theme.muted,
34062
- children: shortDay(e.date, today).padEnd(13)
34571
+ children: shortDay$1(e.date, today).padEnd(13)
34063
34572
  }),
34064
34573
  money(e.amount).padStart(8),
34065
34574
  " ",
@@ -34107,7 +34616,7 @@ function FilesPane({ files, projects, people, at, active, height, width, today }
34107
34616
  children: [
34108
34617
  who,
34109
34618
  ", ",
34110
- shortDay(file.addedAt.slice(0, 10), today),
34619
+ shortDay$1(file.addedAt.slice(0, 10), today),
34111
34620
  " · on"
34112
34621
  ]
34113
34622
  }),
@@ -35191,7 +35700,7 @@ function TaskPanel({ taskId, width, height, go, active = true, onClose }) {
35191
35700
  status: STATUS_LABEL[task.status],
35192
35701
  assignee: owner?.name ?? "Nobody yet",
35193
35702
  also: alsoOnIds(task).map((id) => people.find((p) => p.id === id)?.name ?? "someone").join(", ") || "Only the owner",
35194
- due: task.dueDate ? `${shortDay(task.dueDate, day)}${isLate(task, day) ? " (late)" : ""}` : "None",
35703
+ due: task.dueDate ? `${shortDay$1(task.dueDate, day)}${isLate(task, day) ? " (late)" : ""}` : "None",
35195
35704
  priority: PRIORITY_LABEL[task.priority],
35196
35705
  project: project ? `${project.name}${project.key ? ` (${project.key})` : ""}` : "",
35197
35706
  waits: blockers.length ? blockers.map((b) => `${keyOf$1({ projects }, b)}${b.status === "done" ? " (done)" : ""}`).join(", ") : "Nothing",
@@ -35599,7 +36108,7 @@ function TaskPanel({ taskId, width, height, go, active = true, onClose }) {
35599
36108
  /* @__PURE__ */ jsx(Box, { flexGrow: 1 }),
35600
36109
  editor ?? /* @__PURE__ */ jsx(Text, {
35601
36110
  color: theme.muted,
35602
- wrap: "truncate-end",
36111
+ wrap: "wrap",
35603
36112
  children: "↑↓ field · Enter change · o who's on it · c comment · C yours · a add step · e edit step · space tick · x done · S sounding · s subtask · T save as template · d delete · Esc close"
35604
36113
  })
35605
36114
  ]
@@ -36221,7 +36730,8 @@ function App({ ui, startIn }) {
36221
36730
  const s = store.getState();
36222
36731
  const me = s.people.find((p) => p.id === s.currentUserId);
36223
36732
  if (!seen || !me || !s.workspaceId || s.workspaceId === "local") return null;
36224
- return welcomeWhen(me, seen.last(s.workspaceId), today());
36733
+ const mark = seen.last(s.workspaceId);
36734
+ return welcomeWhen(me, mark ? lastLooked(mark, s, me.id) : null, today());
36225
36735
  });
36226
36736
  useEffect(() => {
36227
36737
  const id = store.getState().workspaceId;
@@ -36984,7 +37494,7 @@ async function sweepFog(opts) {
36984
37494
  keyOf$1(s, task),
36985
37495
  opts.projectId ? null : project?.name,
36986
37496
  untouchedText(days),
36987
- task.dueDate ? `due ${shortDay(task.dueDate, today)}` : null
37497
+ task.dueDate ? `due ${shortDay$1(task.dueDate, today)}` : null
36988
37498
  ].filter(Boolean).join(" · ");
36989
37499
  say(`${i + 1} of ${queue.length} ${task.title}`);
36990
37500
  say(` ${where}`);
@@ -37008,7 +37518,7 @@ async function sweepFog(opts) {
37008
37518
  if (!due) continue;
37009
37519
  store.getState().updateTask(task.id, { dueDate: due });
37010
37520
  tally.dated++;
37011
- say(` Due ${shortDay(due, today)} now.\n`);
37521
+ say(` Due ${shortDay$1(due, today)} now.\n`);
37012
37522
  } else if (key === "x") {
37013
37523
  store.getState().deleteTask(task.id);
37014
37524
  tally.dropped++;