@harborppm/cli 0.105.0 → 0.106.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
  }
@@ -5552,7 +5552,7 @@ function markdownToPlain(md) {
5552
5552
  }
5553
5553
  /** A thing's health moves, newest first, as "Oct 12 At risk (set by hand: note)". */
5554
5554
  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}` : ""})` : ""}`);
5555
+ 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
5556
  }
5557
5557
  /**
5558
5558
  * A project's pre-mortem for the terminal: whether one runs, the question,
@@ -8038,7 +8038,7 @@ function bottleState(note, ctx) {
8038
8038
  /** "opens on Nov 14", "opens when Factory buy-off is reached", "opens if Ridge Runner launch turns Off track" */
8039
8039
  function opensText(opens, ctx) {
8040
8040
  if (!opens) return "open now";
8041
- if (opens.on === "date") return `opens on ${day$4(opens.date)}`;
8041
+ if (opens.on === "date") return `opens on ${day$5(opens.date)}`;
8042
8042
  if (opens.on === "milestone") {
8043
8043
  const m = ctx.milestones.find((x) => x.id === opens.milestoneId);
8044
8044
  return m ? `opens when ${m.name} is reached` : "opens when its milestone is reached";
@@ -8072,7 +8072,7 @@ function freshlyOpened(data, projects, now) {
8072
8072
  }
8073
8073
  return out.sort((a, b) => (b.state.openedOn ?? "").localeCompare(a.state.openedOn ?? ""));
8074
8074
  }
8075
- var BOTTLE_FRESH_DAYS, isBottle, sealed, day$4;
8075
+ var BOTTLE_FRESH_DAYS, isBottle, sealed, day$5;
8076
8076
  var init_bottle = __esmMin((() => {
8077
8077
  init_date_fns();
8078
8078
  init_date_text();
@@ -8084,7 +8084,7 @@ var init_bottle = __esmMin((() => {
8084
8084
  open: false,
8085
8085
  openedOn: null
8086
8086
  };
8087
- day$4 = (iso) => format(parseIso(iso.slice(0, 10)), "MMM d");
8087
+ day$5 = (iso) => format(parseIso(iso.slice(0, 10)), "MMM d");
8088
8088
  }));
8089
8089
 
8090
8090
  // src/lib/decisions.ts
@@ -8259,31 +8259,31 @@ function barnaclesHeadline(b) {
8259
8259
  if (b.added === 0) return null;
8260
8260
  const when = b.from === "baseline" ? "since the baseline" : "since its first week";
8261
8261
  const pct = b.share != null && !b.caveat ? `, ${Math.round(b.share * 100)}% more than planned` : "";
8262
- return `+${plural$7(b.added, "task")} ${when}${pct}`;
8262
+ return `+${plural$8(b.added, "task")} ${when}${pct}`;
8263
8263
  }
8264
8264
  /** What the added work costs in days, and how much of the slip it explains. */
8265
8265
  function barnaclesDaysLine(b) {
8266
8266
  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`;
8267
+ const work = `At the crew's pace (about ${b.perWeek} a week) that's about ${plural$8(b.days, "day")} of work`;
8268
8268
  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.`;
8269
+ if (b.days >= b.slip) return `${work}: enough to explain all ${plural$8(b.slip, "day")} of the slip.`;
8270
+ return `${work}: about ${b.days} of the ${plural$8(b.slip, "day")} it has slipped.`;
8271
8271
  }
8272
8272
  /** One line for the brief or a list: "+14 tasks (38%) since the baseline, 3 this week, about 65 days of work". */
8273
8273
  function barnaclesShort(b) {
8274
8274
  const pct = b.share != null && !b.caveat ? ` (${Math.round(b.share * 100)}%)` : "";
8275
8275
  const when = b.from === "baseline" ? "since the baseline" : "since its first week";
8276
8276
  const week = b.thisWeek ? `, ${b.thisWeek} this week` : "";
8277
- const days = b.days != null && !b.caveat ? `, about ${plural$7(b.days, "day")} of work` : "";
8277
+ const days = b.days != null && !b.caveat ? `, about ${plural$8(b.days, "day")} of work` : "";
8278
8278
  const top = b.adders.find((a) => a.personId);
8279
8279
  const who = top && top.added * 2 > b.added ? `, mostly from ${top.name}` : "";
8280
- return `+${plural$7(b.added, "task")}${pct} ${when}${week}${days}${who}`;
8280
+ return `+${plural$8(b.added, "task")}${pct} ${when}${week}${days}${who}`;
8281
8281
  }
8282
8282
  /** Whether the brief names it: measured from a baseline, enough added, and enough of the plan. */
8283
8283
  function briefWorthy(b) {
8284
8284
  return b.from === "baseline" && !b.caveat && b.added >= 3 && (b.share == null || b.share >= .15);
8285
8285
  }
8286
- var SETTLE_DAYS, THIN_PLANNED, THIN_WEEKS, BULK_SHARE, BULK_MIN, BRIEF_MIN_ADDED, BRIEF_MIN_SHARE, noon$2, isoDay$2, plural$7;
8286
+ var SETTLE_DAYS, THIN_PLANNED, THIN_WEEKS, BULK_SHARE, BULK_MIN, BRIEF_MIN_ADDED, BRIEF_MIN_SHARE, noon$2, isoDay$2, plural$8;
8287
8287
  var init_barnacles = __esmMin((() => {
8288
8288
  init_date_fns();
8289
8289
  init_format();
@@ -8297,7 +8297,7 @@ var init_barnacles = __esmMin((() => {
8297
8297
  BRIEF_MIN_SHARE = .15;
8298
8298
  noon$2 = (iso) => /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T12:00:00`);
8299
8299
  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"}`;
8300
+ plural$8 = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
8301
8301
  }));
8302
8302
 
8303
8303
  // src/lib/brief.ts
@@ -10395,8 +10395,8 @@ init_blockers();
10395
10395
  init_date_text();
10396
10396
  init_premortem();
10397
10397
  init_thanks();
10398
- const day$3 = (iso) => parseIso(localDay(iso));
10399
- const between = (a, b) => differenceInCalendarDays(day$3(b), day$3(a));
10398
+ const day$4 = (iso) => parseIso(localDay(iso));
10399
+ const between = (a, b) => differenceInCalendarDays(day$4(b), day$4(a));
10400
10400
  function voyageLog(data, projectId) {
10401
10401
  const project = data.projects.find((p) => p.id === projectId);
10402
10402
  if (!project) return null;
@@ -10462,8 +10462,8 @@ function voyageLog(data, projectId) {
10462
10462
  thanks
10463
10463
  };
10464
10464
  }
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");
10465
+ const plural$7 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
10466
+ const md$1 = (iso) => format(day$4(iso), "MMM d");
10467
10467
  /** The three numbers at the top: how late, how much work, how many risks came true. */
10468
10468
  function voyageStats(log) {
10469
10469
  const happened = log.risks.filter((r) => r.happened).length;
@@ -10477,10 +10477,10 @@ function voyageStats(log) {
10477
10477
  value: "On time",
10478
10478
  label: "on the planned day"
10479
10479
  } : days > 0 ? {
10480
- value: `+${plural$6(days, "day")}`,
10480
+ value: `+${plural$7(days, "day")}`,
10481
10481
  label: `past the ${plan}`
10482
10482
  } : {
10483
- value: plural$6(-days, "day"),
10483
+ value: plural$7(-days, "day"),
10484
10484
  label: `ahead of the ${plan}`
10485
10485
  },
10486
10486
  {
@@ -10506,7 +10506,7 @@ function voyageStory(log) {
10506
10506
  out.push(`Barnacles: ${grew}${by}.${days ? ` ${days}` : ""}`);
10507
10507
  }
10508
10508
  for (const s of log.slips) {
10509
- const late = `“${s.task.title}” finished ${plural$6(s.daysLate, "day")} late`;
10509
+ const late = `“${s.task.title}” finished ${plural$7(s.daysLate, "day")} late`;
10510
10510
  out.push(s.waitedOn ? `${late}; it waited on “${s.waitedOn.title}”, done ${md$1(s.waitedOn.completedAt)}.` : `${late}.`);
10511
10511
  }
10512
10512
  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 +10514,11 @@ function voyageStory(log) {
10514
10514
  if (against) out.push(against);
10515
10515
  if (log.decisions.length) {
10516
10516
  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` : ""}.`);
10517
+ out.push(`${plural$7(log.decisions.length, "decision was", "decisions were")} written down${changed ? `; ${changed === 1 ? "one was" : `${changed} were`} changed later` : ""}.`);
10518
10518
  }
10519
10519
  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")}.`);
10520
+ if (top && log.carriers.length > 1) out.push(`${top.person.name} closed ${plural$7(top.closed, "task")}, the most on the crew.`);
10521
+ else if (top) out.push(`${top.person.name} closed ${plural$7(top.closed, "task")}.`);
10522
10522
  if (log.budget > 0) {
10523
10523
  const pct = Math.round(log.spent / log.budget * 100);
10524
10524
  out.push(`Spent ${pct}% of the budget.`);
@@ -10665,7 +10665,7 @@ const DAYS$1 = [
10665
10665
  "friday",
10666
10666
  "saturday"
10667
10667
  ];
10668
- const MONTHS = [
10668
+ const MONTHS$1 = [
10669
10669
  "january",
10670
10670
  "february",
10671
10671
  "march",
@@ -10717,7 +10717,7 @@ function nextMonthDay(today, m, d) {
10717
10717
  const monthIndex = (word) => {
10718
10718
  const w = word.toLowerCase().replace(/\.$/, "");
10719
10719
  if (w.length < 3) return -1;
10720
- return MONTHS.findIndex((m) => m.startsWith(w) && (w.length >= 3 || m === w));
10720
+ return MONTHS$1.findIndex((m) => m.startsWith(w) && (w.length >= 3 || m === w));
10721
10721
  };
10722
10722
  const DAY_WORD = "(?:sun|mon|tues?|wed(?:nes)?|thu(?:rs?)?|fri|sat(?:ur)?)(?:day)?";
10723
10723
  const MONTH_WORD = "(?:jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec)[a-z]*\\.?";
@@ -11472,7 +11472,7 @@ function Stepper({ title, steps, width, onDone, onCancel }) {
11472
11472
  const done = Object.entries(values).map(([k, v]) => {
11473
11473
  const s = steps.find((x) => x.key === k);
11474
11474
  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);
11475
+ 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
11476
  return `${s.label}: ${shown}`;
11477
11477
  }).filter(Boolean).join(" · ");
11478
11478
  return /* @__PURE__ */ jsxs(Box, {
@@ -11866,7 +11866,7 @@ function BridgeView({ active, width, height, go, programIds, onBack }) {
11866
11866
  assigneeId: who ?? null,
11867
11867
  dueDate: due
11868
11868
  }, { allowOverCap: true }));
11869
- go.notify(`Action added, due ${shortDay(due, today())}.`);
11869
+ go.notify(`Action added, due ${shortDay$1(due, today())}.`);
11870
11870
  });
11871
11871
  });
11872
11872
  };
@@ -11956,11 +11956,11 @@ function BridgeView({ active, width, height, go, programIds, onBack }) {
11956
11956
  [
11957
11957
  HEALTH_LABEL[slide.project.health],
11958
11958
  owner?.name,
11959
- `ends ${shortDay(slide.project.endDate, today())}`,
11959
+ `ends ${shortDay$1(slide.project.endDate, today())}`,
11960
11960
  `${slide.late} late of ${slide.open} open`,
11961
11961
  slide.highRisks ? `${slide.highRisks} high risk${slide.highRisks === 1 ? "" : "s"}` : null
11962
11962
  ].filter(Boolean).join(" · "),
11963
- slide.milestone ? `Next milestone: ${slide.milestone.name}, ${shortDay(slide.milestone.dueDate, today())}` : "",
11963
+ slide.milestone ? `Next milestone: ${slide.milestone.name}, ${shortDay$1(slide.milestone.dueDate, today())}` : "",
11964
11964
  "",
11965
11965
  `Since ${program.reviewedAt ? "the last review" : "last week"}, ${timeAgo(new Date(slide.since), started)}:`,
11966
11966
  ...slide.changes.flatMap((c) => all && c.more > 0 && c.items ? [`• ${changeHeading(c)} (${c.items.length}):`, ...c.items.map((i) => ` ${i}`)] : [`• ${c.text}`]),
@@ -12099,7 +12099,7 @@ function TaskLine({ task, projects, people, today, selected, picked = false, wid
12099
12099
  children: [
12100
12100
  " ",
12101
12101
  late ? "late · " : "",
12102
- shortDay(task.dueDate, today)
12102
+ shortDay$1(task.dueDate, today)
12103
12103
  ]
12104
12104
  }) : null,
12105
12105
  blocked ? /* @__PURE__ */ jsx(Text, {
@@ -12620,7 +12620,7 @@ function dollars(value) {
12620
12620
  const n = Number(value ?? 0);
12621
12621
  return whole.format(Number.isFinite(n) ? n : 0);
12622
12622
  }
12623
- function day$2(value) {
12623
+ function day$3(value) {
12624
12624
  return value ? shortDate(value) : "no date";
12625
12625
  }
12626
12626
  /** Whole days from one ISO day to another. */
@@ -12708,15 +12708,15 @@ function describeEvent(e, names) {
12708
12708
  };
12709
12709
  case "dueDate": return {
12710
12710
  action: "moved the due date of",
12711
- detail: `from ${day$2(from)} to ${day$2(to)}${slip(from, to)}`
12711
+ detail: `from ${day$3(from)} to ${day$3(to)}${slip(from, to)}`
12712
12712
  };
12713
12713
  case "startDate": return {
12714
12714
  action: "moved the start of",
12715
- detail: `from ${day$2(from)} to ${day$2(to)}${slip(from, to)}`
12715
+ detail: `from ${day$3(from)} to ${day$3(to)}${slip(from, to)}`
12716
12716
  };
12717
12717
  case "endDate": return {
12718
12718
  action: "moved the end of",
12719
- detail: `from ${day$2(from)} to ${day$2(to)}${slip(from, to)}`
12719
+ detail: `from ${day$3(from)} to ${day$3(to)}${slip(from, to)}`
12720
12720
  };
12721
12721
  case "budget": return {
12722
12722
  action: "changed the budget of",
@@ -13151,6 +13151,116 @@ function readBy(marks, personId) {
13151
13151
  return (pingId) => set.has(pingId) || set.has(readMark(personId, pingId));
13152
13152
  }
13153
13153
 
13154
+ // src/lib/convoy.ts
13155
+ init_date_fns();
13156
+ init_date_text();
13157
+ init_indexes();
13158
+ init_tide();
13159
+ const day$2 = (iso) => parseIso(iso.slice(0, 10));
13160
+ /** When a convoy looks like arriving, and how that was read. */
13161
+ function expectedOf(data, convoy, now) {
13162
+ const project = convoy.projectId ? byId(data.projects).get(convoy.projectId) ?? null : null;
13163
+ if (convoy.status === "delivered") return {
13164
+ expected: convoy.deliveredAt?.slice(0, 10) ?? null,
13165
+ basis: "delivered",
13166
+ project
13167
+ };
13168
+ if (convoy.status !== "accepted" || !project) return {
13169
+ expected: null,
13170
+ basis: "none",
13171
+ project
13172
+ };
13173
+ const tide = tideForecast(project, tasksOf(data.tasks, project.id), now, tideOptions(data));
13174
+ if (tide.kind === "forecast" && tide.likely) return {
13175
+ expected: tide.likely,
13176
+ basis: "forecast",
13177
+ project
13178
+ };
13179
+ if (tide.kind === "done") return {
13180
+ expected: null,
13181
+ basis: "finished",
13182
+ project
13183
+ };
13184
+ return {
13185
+ expected: project.endDate?.slice(0, 10) || null,
13186
+ basis: "end date",
13187
+ project
13188
+ };
13189
+ }
13190
+ /** Every convoy in the harbor with where it stands, the asking program's first. */
13191
+ function convoyRows(data, now) {
13192
+ const programs = byId(data.programs);
13193
+ const out = [];
13194
+ for (const asker of data.programs) for (const convoy of asker.convoys ?? []) {
13195
+ const giver = programs.get(convoy.toProgramId) ?? null;
13196
+ const { expected, basis, project } = expectedOf(data, convoy, now);
13197
+ const late = expected ? differenceInCalendarDays(day$2(expected), day$2(convoy.by)) : null;
13198
+ out.push({
13199
+ convoy,
13200
+ asker,
13201
+ giver,
13202
+ project,
13203
+ expected,
13204
+ basis,
13205
+ late
13206
+ });
13207
+ }
13208
+ return out;
13209
+ }
13210
+ /** What one program is waiting on, and what others wait on it for. */
13211
+ function convoysOf(rows, programId) {
13212
+ const open = (r) => r.convoy.status !== "delivered" && r.convoy.status !== "declined";
13213
+ const order = (a, b) => Number(open(b)) - Number(open(a)) || a.convoy.by.localeCompare(b.convoy.by);
13214
+ return {
13215
+ waitingOn: rows.filter((r) => r.asker.id === programId).sort(order),
13216
+ waitedOnBy: rows.filter((r) => r.giver?.id === programId).sort(order)
13217
+ };
13218
+ }
13219
+ /** Behind: accepted, not delivered, and looking like arriving after the day asked. */
13220
+ function isBehind(row) {
13221
+ return row.convoy.status === "accepted" && row.late != null && row.late > 0;
13222
+ }
13223
+ /** A plain line for where a convoy stands. */
13224
+ function standingText(row, today, side = "asker") {
13225
+ const c = row.convoy;
13226
+ const from = row.giver?.name ?? "A deleted program";
13227
+ if (c.status === "asked") return side === "giver" ? "Needs your answer" : `Waiting for ${from} to answer`;
13228
+ if (c.status === "declined") return `${from} can't${c.note ? `: “${c.note}”` : ""}`;
13229
+ if (c.status === "delivered") return `Delivered${c.deliveredAt ? ` ${shortDay(c.deliveredAt)}` : ""}`;
13230
+ if (row.basis === "finished") return `${row.project?.name ?? "Its project"} is finished`;
13231
+ if (!row.project) return c.projectId ? `Accepted by ${from}, but the project it named was deleted` : `Accepted by ${from}; no project named yet`;
13232
+ if (!row.expected) return `Accepted; ${row.project.name} has no date to go by`;
13233
+ const when = `${row.basis === "forecast" ? "likely" : "planned to end"} ${shortDay(row.expected)}`;
13234
+ if (row.late != null && row.late > 0) return `${row.project.name} is ${when}, ${row.late} day${row.late === 1 ? "" : "s"} late`;
13235
+ return c.by.slice(0, 10) < today ? `Past the day; ${row.project.name} is ${when}` : `In time: ${row.project.name} is ${when}`;
13236
+ }
13237
+ const MONTHS = [
13238
+ "Jan",
13239
+ "Feb",
13240
+ "Mar",
13241
+ "Apr",
13242
+ "May",
13243
+ "Jun",
13244
+ "Jul",
13245
+ "Aug",
13246
+ "Sep",
13247
+ "Oct",
13248
+ "Nov",
13249
+ "Dec"
13250
+ ];
13251
+ /** "Dec 12". */
13252
+ function shortDay(iso) {
13253
+ const d = day$2(iso);
13254
+ return Number.isNaN(d.getTime()) ? iso : `${MONTHS[d.getMonth()]} ${d.getDate()}`;
13255
+ }
13256
+ /** Who should hear about a convoy: its program's owner and whoever asked or answered. */
13257
+ function askerSide(row) {
13258
+ return [...new Set([row.asker.ownerId, row.convoy.askedById].filter(Boolean))];
13259
+ }
13260
+ function giverSide(row) {
13261
+ return [...new Set([row.giver?.ownerId, row.convoy.answeredById].filter((x) => Boolean(x)))];
13262
+ }
13263
+
13154
13264
  // src/lib/inbox.ts
13155
13265
  init_date_fns();
13156
13266
  init_indexes();
@@ -13172,7 +13282,8 @@ const KIND_RANK = {
13172
13282
  idle: 5,
13173
13283
  mention: 6,
13174
13284
  reply: 7,
13175
- finished: 8
13285
+ finished: 8,
13286
+ convoy: 1.5
13176
13287
  };
13177
13288
  const PING_KIND_LABEL = {
13178
13289
  harbor: "Your harbor",
@@ -13185,7 +13296,8 @@ const PING_KIND_LABEL = {
13185
13296
  idle: "Quiet blockers",
13186
13297
  mention: "Mentions",
13187
13298
  reply: "Replies",
13188
- finished: "Finished"
13299
+ finished: "Finished",
13300
+ convoy: "Between programs"
13189
13301
  };
13190
13302
  function firstName$3(name) {
13191
13303
  return name.split(/\s+/)[0] ?? name;
@@ -13214,6 +13326,56 @@ function projectOf(data, task) {
13214
13326
  }
13215
13327
  /** How long an assignment stays in the inbox. */
13216
13328
  const ASSIGNED_DAYS = 14;
13329
+ /**
13330
+ * Convoys (src/lib/convoy.ts): an ask waiting on your program's answer, an
13331
+ * answer to your program's ask, and a promise whose project now looks like
13332
+ * arriving after its day, told to both sides as soon as the forecast says so.
13333
+ * A later slip is a new line (the id carries the day it looks like).
13334
+ */
13335
+ function convoyPings(data, personId, now, since) {
13336
+ if (!data.programs.some((p) => p.convoys?.length)) return [];
13337
+ const out = [];
13338
+ for (const row of convoyRows(data, now)) {
13339
+ const c = row.convoy;
13340
+ const giver = row.giver?.name ?? "A deleted program";
13341
+ const href = (id) => `/programs/${id}?view=convoy`;
13342
+ const asker = askerSide(row).includes(personId);
13343
+ const giving = Boolean(row.giver) && giverSide(row).includes(personId);
13344
+ if (c.status === "asked" && giving && c.askedById !== personId) out.push({
13345
+ id: `convoy-ask:${c.id}:${c.by}`,
13346
+ kind: "convoy",
13347
+ title: `${row.asker.name} asks ${giver} for “${c.what}”`,
13348
+ detail: `Needed by ${shortDay(c.by)}. Accept it, naming the project that delivers, or say you can't.`,
13349
+ at: c.askedAt,
13350
+ personId: c.askedById,
13351
+ programId: row.giver.id,
13352
+ href: href(row.giver.id)
13353
+ });
13354
+ if (asker && (c.status === "accepted" || c.status === "declined") && c.answeredAt && c.answeredAt >= since && c.answeredById !== personId) out.push({
13355
+ id: `convoy-${c.status}:${c.id}:${c.answeredAt}`,
13356
+ kind: "convoy",
13357
+ title: c.status === "accepted" ? `${giver} took on “${c.what}”` : `${giver} can't take on “${c.what}”`,
13358
+ 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.",
13359
+ at: c.answeredAt,
13360
+ personId: c.answeredById ?? null,
13361
+ programId: row.asker.id,
13362
+ href: href(row.asker.id)
13363
+ });
13364
+ if (isBehind(row) && (asker || giving)) {
13365
+ const late = row.late;
13366
+ out.push({
13367
+ id: `convoy-late:${c.id}:${c.by}:${row.expected}`,
13368
+ kind: "convoy",
13369
+ title: `“${c.what}” looks like arriving late`,
13370
+ 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)}).`,
13371
+ at: now.toISOString(),
13372
+ programId: asker ? row.asker.id : row.giver.id,
13373
+ href: href(asker ? row.asker.id : row.giver.id)
13374
+ });
13375
+ }
13376
+ }
13377
+ return out;
13378
+ }
13217
13379
  function inboxOf(data, personId, now = clockNow()) {
13218
13380
  const pings = [];
13219
13381
  const mine = data.tasks.filter((t) => t.assigneeId === personId && t.status !== "done");
@@ -13505,6 +13667,7 @@ function inboxOf(data, personId, now = clockNow()) {
13505
13667
  href: `/projects/${task.projectId}`
13506
13668
  });
13507
13669
  }
13670
+ pings.push(...convoyPings(data, personId, now, since));
13508
13671
  return pings.sort((a, b) => {
13509
13672
  const rank = KIND_RANK[a.kind] - KIND_RANK[b.kind];
13510
13673
  if (rank !== 0) return rank;
@@ -13931,7 +14094,7 @@ function byTask(rows, who) {
13931
14094
  }
13932
14095
  return out;
13933
14096
  }
13934
- const plural$5 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
14097
+ const plural$6 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
13935
14098
  /** Work only one person has touched, soonest-needed first. `scope` narrows it to some programs. */
13936
14099
  function lifeboats(data, now, opts = {}) {
13937
14100
  const today = isoDay(now);
@@ -13970,7 +14133,7 @@ function lifeboats(data, now, opts = {}) {
13970
14133
  kind: "project",
13971
14134
  id: project.id,
13972
14135
  label: project.name,
13973
- detail: `${plural$5(open.length, "open task")}, nobody else on them`,
14136
+ detail: `${plural$6(open.length, "open task")}, nobody else on them`,
13974
14137
  soloId: solo[0],
13975
14138
  projectId: project.id,
13976
14139
  programId: project.programId,
@@ -13992,7 +14155,7 @@ function lifeboats(data, now, opts = {}) {
13992
14155
  out.push({
13993
14156
  kind: "tasks",
13994
14157
  id: `tasks:${project.id}:${soloId}`,
13995
- label: `${plural$5(list.length, "task")} on ${project.name}`,
14158
+ label: `${plural$6(list.length, "task")} on ${project.name}`,
13996
14159
  detail: `only ${first} has touched them`,
13997
14160
  soloId,
13998
14161
  projectId: project.id,
@@ -14012,7 +14175,7 @@ function lifeboats(data, now, opts = {}) {
14012
14175
  kind: "task",
14013
14176
  id: t.id,
14014
14177
  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(", "),
14178
+ detail: [d < today ? `late since ${md(d)}` : `due ${md(d)}`, holds ? `${plural$6(holds, "task")} ${holds === 1 ? "waits" : "wait"} on it` : "urgent"].join(", "),
14016
14179
  soloId,
14017
14180
  projectId: project.id,
14018
14181
  programId: project.programId,
@@ -14039,7 +14202,7 @@ function lifeboats(data, now, opts = {}) {
14039
14202
  const programId = first.programId ?? project?.programId ?? null;
14040
14203
  const where = project?.name ?? (programId ? programs.get(programId)?.name : null) ?? null;
14041
14204
  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")}`;
14205
+ 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
14206
  out.push({
14044
14207
  kind: "risks",
14045
14208
  id: key,
@@ -14717,7 +14880,7 @@ function ProgramPanel({ id, width, height, go, active, onClose }) {
14717
14880
  },
14718
14881
  {
14719
14882
  label: "Starts",
14720
- value: shortDay(program.startDate, today()),
14883
+ value: shortDay$1(program.startDate, today()),
14721
14884
  edit: {
14722
14885
  kind: "date",
14723
14886
  initial: program.startDate,
@@ -14726,7 +14889,7 @@ function ProgramPanel({ id, width, height, go, active, onClose }) {
14726
14889
  },
14727
14890
  {
14728
14891
  label: "Ends",
14729
- value: shortDay(program.endDate, today()),
14892
+ value: shortDay$1(program.endDate, today()),
14730
14893
  edit: {
14731
14894
  kind: "date",
14732
14895
  initial: program.endDate,
@@ -15014,7 +15177,7 @@ function ProjectPanel({ id, width, height, go, active, onClose }) {
15014
15177
  },
15015
15178
  {
15016
15179
  label: "Starts",
15017
- value: shortDay(project.startDate, today()),
15180
+ value: shortDay$1(project.startDate, today()),
15018
15181
  edit: {
15019
15182
  kind: "date",
15020
15183
  initial: project.startDate,
@@ -15023,7 +15186,7 @@ function ProjectPanel({ id, width, height, go, active, onClose }) {
15023
15186
  },
15024
15187
  {
15025
15188
  label: "Ends",
15026
- value: shortDay(project.endDate, today()),
15189
+ value: shortDay$1(project.endDate, today()),
15027
15190
  edit: {
15028
15191
  kind: "date",
15029
15192
  initial: project.endDate,
@@ -15099,7 +15262,7 @@ function ProjectPanel({ id, width, height, go, active, onClose }) {
15099
15262
  }] : [],
15100
15263
  {
15101
15264
  label: "Baseline",
15102
- value: hasBaseline(project) ? `${shortDay(project.baselineStart, today())} to ${shortDay(project.baselineEnd, today())}${slip ? `, ${slip}` : ""}` : "Not set (set it on the program)",
15265
+ value: hasBaseline(project) ? `${shortDay$1(project.baselineStart, today())} to ${shortDay$1(project.baselineEnd, today())}${slip ? `, ${slip}` : ""}` : "Not set (set it on the program)",
15103
15266
  color: slip?.startsWith("slipped") ? theme.bad : void 0
15104
15267
  },
15105
15268
  {
@@ -15183,7 +15346,7 @@ function MilestonePanel({ id, width, height, go, active, onClose }) {
15183
15346
  },
15184
15347
  {
15185
15348
  label: "Due",
15186
- value: `${shortDay(milestone.dueDate, today())}${late ? " (late)" : ""}`,
15349
+ value: `${shortDay$1(milestone.dueDate, today())}${late ? " (late)" : ""}`,
15187
15350
  color: late ? theme.bad : void 0,
15188
15351
  edit: {
15189
15352
  kind: "date",
@@ -15278,7 +15441,7 @@ function MilestonePanel({ id, width, height, go, active, onClose }) {
15278
15441
  " ",
15279
15442
  "At risk:",
15280
15443
  " ",
15281
- r.reason === "ends-after" ? `${r.project.name} ends ${shortDay(r.project.endDate, today())}` : `${r.project.name} is off track`
15444
+ r.reason === "ends-after" ? `${r.project.name} ends ${shortDay$1(r.project.endDate, today())}` : `${r.project.name} is off track`
15282
15445
  ]
15283
15446
  }, r.project.id))] }) : null,
15284
15447
  active,
@@ -15440,7 +15603,7 @@ function RaidPanel({ id, width, height, go, active, onClose }) {
15440
15603
  },
15441
15604
  {
15442
15605
  label: "Decided on",
15443
- value: item.decidedAt ? shortDay(item.decidedAt, today()) : "Not yet",
15606
+ value: item.decidedAt ? shortDay$1(item.decidedAt, today()) : "Not yet",
15444
15607
  edit: {
15445
15608
  kind: "date",
15446
15609
  initial: item.decidedAt ?? null,
@@ -15460,7 +15623,7 @@ function RaidPanel({ id, width, height, go, active, onClose }) {
15460
15623
  ] : [],
15461
15624
  {
15462
15625
  label: copy.dueDate,
15463
- value: shortDay(item.dueDate, today()),
15626
+ value: shortDay$1(item.dueDate, today()),
15464
15627
  edit: {
15465
15628
  kind: "date",
15466
15629
  initial: item.dueDate,
@@ -15513,7 +15676,7 @@ function RaidPanel({ id, width, height, go, active, onClose }) {
15513
15676
  " ",
15514
15677
  /* @__PURE__ */ jsx(Text, {
15515
15678
  color: theme.muted,
15516
- children: shortDay(u.createdAt.slice(0, 10), today())
15679
+ children: shortDay$1(u.createdAt.slice(0, 10), today())
15517
15680
  }),
15518
15681
  " ",
15519
15682
  u.body.replace(/\s+/g, " ")
@@ -15724,7 +15887,7 @@ function ProjectsView({ active, width, height, go }) {
15724
15887
  depth: 2,
15725
15888
  title: `${project.name}${project.key ? ` ${project.key}` : ""}`,
15726
15889
  health: project.health,
15727
- detail: `${finished}/${total} done${late ? ` · ${late} late` : ""} · ends ${shortDay(project.endDate, today())}`
15890
+ detail: `${finished}/${total} done${late ? ` · ${late} late` : ""} · ends ${shortDay$1(project.endDate, today())}`
15728
15891
  });
15729
15892
  }
15730
15893
  }
@@ -15824,7 +15987,7 @@ function ProgramsView({ active, width, height, go }) {
15824
15987
  health: program.health,
15825
15988
  detail: [
15826
15989
  lead?.name.split(" ")[0],
15827
- program.endDate ? `ends ${shortDay(program.endDate, day)}` : null,
15990
+ program.endDate ? `ends ${shortDay$1(program.endDate, day)}` : null,
15828
15991
  late ? `${late} late` : null,
15829
15992
  slip >= 100 ? `slipping costs ${dollars$1(slip)}` : null,
15830
15993
  isRated(program) ? quadrantOf(program, maxBudget, rules) : null,
@@ -16687,7 +16850,7 @@ function PremortemPanel({ id, width, height, go, active, onClose }) {
16687
16850
  ]
16688
16851
  });
16689
16852
  if (pm.phase === "none") {
16690
- const ends = project.endDate ? `after ${shortDay(project.endDate, today())}` : "three months from now";
16853
+ const ends = project.endDate ? `after ${shortDay$1(project.endDate, today())}` : "three months from now";
16691
16854
  return frame(/* @__PURE__ */ jsxs(Fragment$1, { children: [
16692
16855
  /* @__PURE__ */ jsxs(Text, {
16693
16856
  wrap: "wrap",
@@ -17360,6 +17523,140 @@ function applyDock(actions, projectId, changes) {
17360
17523
  return made;
17361
17524
  }
17362
17525
 
17526
+ // src/lib/daily-digest.ts
17527
+ /** The projects a scope covers; a person's are the ones they lead, sit under, or have a task in. */
17528
+ function projectsIn(data, scope) {
17529
+ if (scope.kind === "harbor") return data.projects;
17530
+ if (scope.kind === "program") return data.projects.filter((p) => p.programId === scope.id);
17531
+ const led = new Set(data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id));
17532
+ return data.projects.filter((p) => p.ownerId === scope.id || led.has(p.programId) || tasksOf(data.tasks, p.id).some((t) => t.assigneeId === scope.id));
17533
+ }
17534
+ /** Where health went since `since`: from what it was just before to what it is now, if it moved. */
17535
+ function moved(history, now, since) {
17536
+ const list = history ?? [];
17537
+ if (!list.some((h) => h.at >= since)) return null;
17538
+ const before = [...list].reverse().find((h) => h.at < since)?.health;
17539
+ return before && before !== now ? {
17540
+ from: before,
17541
+ to: now
17542
+ } : null;
17543
+ }
17544
+ /** What changed in `scope` from `since` (an ISO moment) on. */
17545
+ function dailyDigest(data, scope, since) {
17546
+ const projects = projectsIn(data, scope);
17547
+ const projectIds = new Set(projects.map((p) => p.id));
17548
+ 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)]);
17549
+ const tasks = projects.flatMap((p) => tasksOf(data.tasks, p.id));
17550
+ const arrivedDone = (t) => Boolean(t.completedAt) && Math.abs(Date.parse(t.completedAt) - Date.parse(t.createdAt)) < ARRIVED_DONE_MS;
17551
+ const finished = tasks.filter((t) => t.status === "done" && t.completedAt && t.completedAt >= since && !arrivedDone(t)).sort((a, b) => b.completedAt.localeCompare(a.completedAt));
17552
+ const finishedIds = new Set(finished.map((t) => t.id));
17553
+ const added = tasks.filter((t) => t.createdAt >= since && !finishedIds.has(t.id)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
17554
+ const health = [];
17555
+ for (const p of data.programs) {
17556
+ if (!programIds.has(p.id)) continue;
17557
+ const m = moved(p.healthHistory, p.health, since);
17558
+ if (m) health.push({
17559
+ name: p.name,
17560
+ path: `/programs/${p.id}`,
17561
+ ...m
17562
+ });
17563
+ }
17564
+ for (const p of projects) {
17565
+ const m = moved(p.healthHistory, p.health, since);
17566
+ if (m) health.push({
17567
+ name: p.name,
17568
+ path: `/projects/${p.id}`,
17569
+ ...m
17570
+ });
17571
+ }
17572
+ const inScope = (r) => r.projectId ? projectIds.has(r.projectId) : r.programId ? programIds.has(r.programId) : scope.kind === "harbor";
17573
+ const raised = data.raidItems.filter((r) => r.kind !== "decision" && r.createdAt >= since && inScope(r)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
17574
+ 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));
17575
+ const people = byId(data.people);
17576
+ const first = (id) => people.get(id)?.name.split(" ")[0] ?? "Someone";
17577
+ const projectById = byId(data.projects);
17578
+ const programById = byId(data.programs);
17579
+ const talkBy = /* @__PURE__ */ new Map();
17580
+ const count = (key, where, path, authorId, taskId) => {
17581
+ const t = talkBy.get(key) ?? {
17582
+ where,
17583
+ path,
17584
+ ...taskId ? { taskId } : {},
17585
+ count: 0,
17586
+ who: []
17587
+ };
17588
+ t.count++;
17589
+ const name = first(authorId);
17590
+ if (!t.who.includes(name)) t.who.push(name);
17591
+ talkBy.set(key, t);
17592
+ };
17593
+ for (const r of data.reflections ?? []) {
17594
+ if (!isMessage(r) || r.createdAt < since) continue;
17595
+ const place = placeOf(r);
17596
+ const holder = place.kind === "program" ? programById.get(place.id) : projectById.get(place.id);
17597
+ const inside = place.kind === "program" ? programIds.has(place.id) : projectIds.has(place.id);
17598
+ if (!holder || !inside) continue;
17599
+ count(`${place.kind}:${place.id}`, holder.name, placePath(place), r.authorId);
17600
+ }
17601
+ const taskById = byId(data.tasks);
17602
+ for (const c of data.comments) {
17603
+ if (c.createdAt < since) continue;
17604
+ const task = taskById.get(c.taskId);
17605
+ if (!task || !projectIds.has(task.projectId)) continue;
17606
+ const key = taskKey(task, projectById.get(task.projectId));
17607
+ count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, `/projects/${task.projectId}`, c.authorId, task.id);
17608
+ }
17609
+ const talk = [...talkBy.values()].sort((a, b) => b.count - a.count || a.where.localeCompare(b.where));
17610
+ return {
17611
+ since,
17612
+ finished,
17613
+ added,
17614
+ health,
17615
+ raised,
17616
+ decided,
17617
+ talk,
17618
+ quiet: !finished.length && !added.length && !health.length && !raised.length && !decided.length && !talk.length
17619
+ };
17620
+ }
17621
+ /** "A, B and 2 more". */
17622
+ function some(names, shown = 3) {
17623
+ const quoted = names.slice(0, shown).map((n) => `“${n}”`);
17624
+ const rest = names.length - quoted.length;
17625
+ if (rest > 0) return `${quoted.join(", ")} and ${rest} more`;
17626
+ if (quoted.length < 2) return quoted.join("");
17627
+ return `${quoted.slice(0, -1).join(", ")} and ${quoted.at(-1)}`;
17628
+ }
17629
+ /** The digest as short plain lines, the way the Inbox card, a chat post and the terminal say it. */
17630
+ function digestLines(d) {
17631
+ const lines = [];
17632
+ if (d.finished.length) lines.push(`${plural$5(d.finished.length, "task")} finished: ${some(d.finished.map((t) => t.title))}.`);
17633
+ if (d.added.length) lines.push(`${plural$5(d.added.length, "task")} added: ${some(d.added.map((t) => t.title))}.`);
17634
+ 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}.`);
17635
+ if (d.health.length > 5) lines.push(`${d.health.length - 5} more changed health.`);
17636
+ if (d.raised.length) {
17637
+ const risks = d.raised.filter((r) => r.kind === "risk").length;
17638
+ const issues = d.raised.length - risks;
17639
+ const what = [risks ? plural$5(risks, "risk") : "", issues ? plural$5(issues, "issue") : ""].filter(Boolean).join(" and ");
17640
+ lines.push(`${what} raised: ${some(d.raised.map((r) => r.title))}.`);
17641
+ }
17642
+ if (d.decided.length) lines.push(`${plural$5(d.decided.length, "decision")} made: ${some(d.decided.map((r) => r.title))}.`);
17643
+ if (d.talk.length) {
17644
+ const top = d.talk.slice(0, 3).map((t) => `${t.where} (${t.count}, ${t.who.join(", ")})`).join("; ");
17645
+ const rest = d.talk.length - 3;
17646
+ lines.push(`Talk: ${top}${rest > 0 ? `; and ${plural$5(rest, "more conversation")}` : ""}.`);
17647
+ }
17648
+ return lines;
17649
+ }
17650
+ var ARRIVED_DONE_MS, plural$5;
17651
+ var init_daily_digest = __esmMin((() => {
17652
+ init_swatches();
17653
+ init_indexes();
17654
+ init_project_messages();
17655
+ init_task_keys();
17656
+ ARRIVED_DONE_MS = 6e4;
17657
+ plural$5 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
17658
+ }));
17659
+
17363
17660
  // src/lib/milestone-edits.ts
17364
17661
  /**
17365
17662
  * A milestone with `patch` applied, remembering the day it was reached:
@@ -17476,6 +17773,7 @@ var init_task_milestones = __esmMin((() => {
17476
17773
  }));
17477
17774
 
17478
17775
  // src/lib/compass.ts
17776
+ init_daily_digest();
17479
17777
  init_task_milestones();
17480
17778
  init_indexes();
17481
17779
  const zero = () => ({
@@ -25401,6 +25699,58 @@ const HARBOR_TOOLS = [
25401
25699
  };
25402
25700
  }
25403
25701
  }),
25702
+ tool({
25703
+ name: "daily_digest",
25704
+ title: "What changed",
25705
+ 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,
25706
+ input: object({
25707
+ harbor: harborArg,
25708
+ program: string().min(1).max(200).optional().describe("Program id or name."),
25709
+ hours: number().int().min(1).max(168).optional().describe("How far back; default 24.")
25710
+ }),
25711
+ run: (ctx, input) => {
25712
+ const { data } = ctx;
25713
+ const program = input.program ? findOne(data.programs, input.program, "program") : null;
25714
+ const mine = me(ctx);
25715
+ const since = (/* @__PURE__ */ new Date(ctx.now.getTime() - (input.hours ?? 24) * 36e5)).toISOString();
25716
+ const d = dailyDigest(data, program ? {
25717
+ kind: "program",
25718
+ id: program.id
25719
+ } : mine ? {
25720
+ kind: "person",
25721
+ id: mine.id
25722
+ } : { kind: "harbor" }, since);
25723
+ const projects = byId(data.projects);
25724
+ const taskOut = (t) => ({
25725
+ id: t.id,
25726
+ ...taskKey(t, projects.get(t.projectId)) ? { key: taskKey(t, projects.get(t.projectId)) } : {},
25727
+ title: t.title
25728
+ });
25729
+ return {
25730
+ on: program ? program.name : mine ? "your work" : "the whole harbor",
25731
+ since,
25732
+ quiet: d.quiet,
25733
+ lines: digestLines(d),
25734
+ finished: d.finished.slice(0, 20).map(taskOut),
25735
+ added: d.added.slice(0, 20).map(taskOut),
25736
+ health: d.health,
25737
+ raised: d.raised.map((r) => ({
25738
+ id: r.id,
25739
+ kind: r.kind,
25740
+ title: r.title
25741
+ })),
25742
+ decided: d.decided.map((r) => ({
25743
+ id: r.id,
25744
+ title: r.title
25745
+ })),
25746
+ talk: d.talk.map((t) => ({
25747
+ where: t.where,
25748
+ count: t.count,
25749
+ who: t.who
25750
+ }))
25751
+ };
25752
+ }
25753
+ }),
25404
25754
  tool({
25405
25755
  name: "weekly_brief",
25406
25756
  title: "Weekly brief",
@@ -26002,6 +26352,41 @@ const HARBOR_TOOLS = [
26002
26352
  })) };
26003
26353
  }
26004
26354
  }),
26355
+ tool({
26356
+ name: "list_convoys",
26357
+ title: "Convoys",
26358
+ 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,
26359
+ input: object({
26360
+ harbor: harborArg,
26361
+ program: string().max(200).optional().describe("Program id or name. Default: every convoy.")
26362
+ }),
26363
+ run: (ctx, input) => {
26364
+ const { data } = ctx;
26365
+ const today = todayISO(ctx.now);
26366
+ const rows = convoyRows(data, ctx.now);
26367
+ const shape = (r, side = "asker") => ({
26368
+ id: r.convoy.id,
26369
+ what: r.convoy.what,
26370
+ from: r.asker.name,
26371
+ to: r.giver?.name ?? null,
26372
+ by: r.convoy.by,
26373
+ status: r.convoy.status,
26374
+ project: r.project?.name ?? null,
26375
+ expected: r.expected,
26376
+ late: isBehind(r) ? r.late : 0,
26377
+ ...r.convoy.note ? { note: r.convoy.note } : {},
26378
+ text: standingText(r, today, side)
26379
+ });
26380
+ if (!input.program) return { convoys: rows.map((r) => shape(r)) };
26381
+ const program = findOne(data.programs, input.program, "program");
26382
+ const { waitingOn, waitedOnBy } = convoysOf(rows, program.id);
26383
+ return {
26384
+ program: program.name,
26385
+ waitingOn: waitingOn.map((r) => shape(r)),
26386
+ waitedOnBy: waitedOnBy.map((r) => shape(r, "giver"))
26387
+ };
26388
+ }
26389
+ }),
26005
26390
  tool({
26006
26391
  name: "list_dashboards",
26007
26392
  title: "Dashboards",
@@ -30503,6 +30888,11 @@ var init_shore = __esmMin((() => {
30503
30888
  kind: "messages",
30504
30889
  label: "Messages",
30505
30890
  hint: "Each new message and reply in the program’s messages and its projects’, with a link to answer in Harbor."
30891
+ },
30892
+ {
30893
+ kind: "digest",
30894
+ label: "What changed, each morning",
30895
+ 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
30896
  }
30507
30897
  ];
30508
30898
  }));
@@ -30614,6 +31004,7 @@ function memoryHarbor(start, opts) {
30614
31004
  health: false,
30615
31005
  notes: false,
30616
31006
  messages: false,
31007
+ digest: false,
30617
31008
  ...row,
30618
31009
  ...ask.url ? { url } : {}
30619
31010
  };
@@ -30629,6 +31020,7 @@ function memoryHarbor(start, opts) {
30629
31020
  health: row.health,
30630
31021
  notes: row.notes,
30631
31022
  messages: row.messages,
31023
+ digest: row.digest,
30632
31024
  failures: 0
30633
31025
  } : null;
30634
31026
  if (ask.test) {
@@ -32596,7 +32988,7 @@ function riskLine(r, today) {
32596
32988
  r.title,
32597
32989
  /* @__PURE__ */ jsxs(Text, {
32598
32990
  color: theme.muted,
32599
- children: [score != null ? ` · score ${score}` : "", r.dueDate ? ` · review ${shortDay(r.dueDate, today)}` : ""]
32991
+ children: [score != null ? ` · score ${score}` : "", r.dueDate ? ` · review ${shortDay$1(r.dueDate, today)}` : ""]
32600
32992
  })
32601
32993
  ]
32602
32994
  });
@@ -32730,7 +33122,7 @@ function ProgramBands({ bands, at, active, width, height, w, today }) {
32730
33122
  " ",
32731
33123
  "· ",
32732
33124
  m.dueDate < today ? "late, " : "",
32733
- shortDay(m.dueDate, today)
33125
+ shortDay$1(m.dueDate, today)
32734
33126
  ]
32735
33127
  })
32736
33128
  ]
@@ -32815,7 +33207,7 @@ function ProjectBands({ bands, at, active, width, height, w, today }) {
32815
33207
  }) : null,
32816
33208
  " · ends",
32817
33209
  " ",
32818
- shortDay(p.endDate, today)
33210
+ shortDay$1(p.endDate, today)
32819
33211
  ]
32820
33212
  })
32821
33213
  });
@@ -32964,9 +33356,9 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
32964
33356
  portfolio?.name,
32965
33357
  lead ? ` · ${lead.name}` : "",
32966
33358
  " · ",
32967
- shortDay(program.startDate, today()),
33359
+ shortDay$1(program.startDate, today()),
32968
33360
  "–",
32969
- shortDay(program.endDate, today())
33361
+ shortDay$1(program.endDate, today())
32970
33362
  ]
32971
33363
  })
32972
33364
  })]
@@ -33027,7 +33419,7 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
33027
33419
  "/",
33028
33420
  total,
33029
33421
  " · ends ",
33030
- shortDay(p.endDate, today())
33422
+ shortDay$1(p.endDate, today())
33031
33423
  ]
33032
33424
  })
33033
33425
  ]
@@ -33062,7 +33454,7 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
33062
33454
  " ",
33063
33455
  /* @__PURE__ */ jsxs(Text, {
33064
33456
  color: late ? theme.bad : theme.muted,
33065
- children: [late ? "late · " : "", shortDay(m.dueDate, today())]
33457
+ children: [late ? "late · " : "", shortDay$1(m.dueDate, today())]
33066
33458
  }),
33067
33459
  m.approverId ? /* @__PURE__ */ jsx(Text, {
33068
33460
  color: theme.muted,
@@ -33270,7 +33662,7 @@ function PortfolioView({ portfolioId, active, width, height, go, onBack }) {
33270
33662
  " ",
33271
33663
  /* @__PURE__ */ jsx(Text, {
33272
33664
  color: m.dueDate < day ? theme.bad : theme.muted,
33273
- children: shortDay(m.dueDate, day)
33665
+ children: shortDay$1(m.dueDate, day)
33274
33666
  })
33275
33667
  ]
33276
33668
  }, m.id)),
@@ -33898,7 +34290,7 @@ function ProjectView({ projectId, active, width, height, go, onBack }) {
33898
34290
  taskKey: keyOf$1({ projects }, t),
33899
34291
  title: t.title,
33900
34292
  owner: people.find((p) => p.id === t.assigneeId)?.initials,
33901
- due: t.dueDate ? shortDay(t.dueDate, day) : null,
34293
+ due: t.dueDate ? shortDay$1(t.dueDate, day) : null,
33902
34294
  late: isLate(t, day),
33903
34295
  waits: blocked(data, t),
33904
34296
  priority: t.priority,
@@ -34059,7 +34451,7 @@ function BudgetPane({ project, spendEntries, at, active, height, today }) {
34059
34451
  on ? "› " : " ",
34060
34452
  /* @__PURE__ */ jsx(Text, {
34061
34453
  color: theme.muted,
34062
- children: shortDay(e.date, today).padEnd(13)
34454
+ children: shortDay$1(e.date, today).padEnd(13)
34063
34455
  }),
34064
34456
  money(e.amount).padStart(8),
34065
34457
  " ",
@@ -34107,7 +34499,7 @@ function FilesPane({ files, projects, people, at, active, height, width, today }
34107
34499
  children: [
34108
34500
  who,
34109
34501
  ", ",
34110
- shortDay(file.addedAt.slice(0, 10), today),
34502
+ shortDay$1(file.addedAt.slice(0, 10), today),
34111
34503
  " · on"
34112
34504
  ]
34113
34505
  }),
@@ -35191,7 +35583,7 @@ function TaskPanel({ taskId, width, height, go, active = true, onClose }) {
35191
35583
  status: STATUS_LABEL[task.status],
35192
35584
  assignee: owner?.name ?? "Nobody yet",
35193
35585
  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",
35586
+ due: task.dueDate ? `${shortDay$1(task.dueDate, day)}${isLate(task, day) ? " (late)" : ""}` : "None",
35195
35587
  priority: PRIORITY_LABEL[task.priority],
35196
35588
  project: project ? `${project.name}${project.key ? ` (${project.key})` : ""}` : "",
35197
35589
  waits: blockers.length ? blockers.map((b) => `${keyOf$1({ projects }, b)}${b.status === "done" ? " (done)" : ""}`).join(", ") : "Nothing",
@@ -36984,7 +37376,7 @@ async function sweepFog(opts) {
36984
37376
  keyOf$1(s, task),
36985
37377
  opts.projectId ? null : project?.name,
36986
37378
  untouchedText(days),
36987
- task.dueDate ? `due ${shortDay(task.dueDate, today)}` : null
37379
+ task.dueDate ? `due ${shortDay$1(task.dueDate, today)}` : null
36988
37380
  ].filter(Boolean).join(" · ");
36989
37381
  say(`${i + 1} of ${queue.length} ${task.title}`);
36990
37382
  say(` ${where}`);
@@ -37008,7 +37400,7 @@ async function sweepFog(opts) {
37008
37400
  if (!due) continue;
37009
37401
  store.getState().updateTask(task.id, { dueDate: due });
37010
37402
  tally.dated++;
37011
- say(` Due ${shortDay(due, today)} now.\n`);
37403
+ say(` Due ${shortDay$1(due, today)} now.\n`);
37012
37404
  } else if (key === "x") {
37013
37405
  store.getState().deleteTask(task.id);
37014
37406
  tally.dropped++;
package/lib/cli.mjs CHANGED
@@ -40,6 +40,7 @@ import {
40
40
  chatText,
41
41
  chatLineText,
42
42
  chatWhere,
43
+ digestText,
43
44
  charterText,
44
45
  landfallText,
45
46
  loadLineCliText,
@@ -135,6 +136,8 @@ export const HELP = `harbor: Harbor from the terminal
135
136
  what you're also on
136
137
  harbor catchup [--since DATE] while you were away: handed to
137
138
  you, decided, what moved
139
+ harbor digest [--program P] [--hours N] what changed in the last day on
140
+ your work, or in one program
138
141
  harbor clock [NAME] [--zone ZONE|here|none] [--hours 9-17]
139
142
  who's working now, or set your
140
143
  (or NAME's) time zone and hours
@@ -1042,8 +1045,8 @@ const DETAIL = {
1042
1045
  " harbor shore PROGRAM --url URL writes: posts go to this Slack, Discord,",
1043
1046
  " Teams or Google Chat webhook address",
1044
1047
  " harbor shore PROGRAM --on KINDS writes: turns posts on; KINDS are",
1045
- " forecast, health, notes and messages,",
1046
- " with commas",
1048
+ " forecast, health, notes, messages and",
1049
+ " digest, with commas",
1047
1050
  " harbor shore PROGRAM --off KINDS writes: turns them off",
1048
1051
  " harbor shore PROGRAM --test writes: sends a test post",
1049
1052
  " harbor shore PROGRAM --remove writes: stops posting and forgets the",
@@ -1051,7 +1054,8 @@ const DETAIL = {
1051
1054
  "",
1052
1055
  " forecast is the morning harbor forecast, health a line when the program or",
1053
1056
  " one of its projects changes health, notes a note for later when it opens,",
1054
- " messages each new message or reply on the program or its projects.",
1057
+ " messages each new message or reply on the program or its projects, digest",
1058
+ " a morning post of what changed the day before (nothing on a quiet day).",
1055
1059
  " Every post links back to Harbor. A new channel posts nothing until you turn",
1056
1060
  " something on. The address is a secret: once saved, only a hint of it shows.",
1057
1061
  ],
@@ -1530,6 +1534,17 @@ const DETAIL = {
1530
1534
  " counts tasks added from now on as growth. On the website a program's",
1531
1535
  " Set baseline does the same for all its projects.",
1532
1536
  ],
1537
+ digest: [
1538
+ " harbor digest reads what changed in the last day",
1539
+ " on your projects",
1540
+ " harbor digest --program P reads it for one program",
1541
+ " harbor digest --hours 72 reads it further back (up to 168)",
1542
+ "",
1543
+ " Tasks finished and added, health that moved, risks and issues raised,",
1544
+ " decisions made, and where people talked: the same as the top of the",
1545
+ " Inbox, and the morning post harbor shore P --on digest sends to a",
1546
+ " program's chat channel.",
1547
+ ],
1533
1548
  catchup: [
1534
1549
  " harbor catchup reads the catch-up the app opens on",
1535
1550
  " harbor catchup --since DATE reads it from a day (YYYY-MM-DD)",
@@ -2808,10 +2823,12 @@ export async function run(argv, io = {}) {
2808
2823
  .split(",")
2809
2824
  .map((k) => k.trim().toLowerCase())
2810
2825
  .filter(Boolean);
2811
- const bad = list.find((k) => !["forecast", "health", "notes", "messages"].includes(k));
2826
+ const bad = list.find(
2827
+ (k) => !["forecast", "health", "notes", "messages", "digest"].includes(k),
2828
+ );
2812
2829
  if (bad || !list.length)
2813
2830
  throw new HarborError(
2814
- `--${flag} takes forecast, health, notes or messages, with commas between.`,
2831
+ `--${flag} takes forecast, health, notes, messages or digest, with commas between.`,
2815
2832
  );
2816
2833
  return list;
2817
2834
  };
@@ -2853,10 +2870,11 @@ export async function run(argv, io = {}) {
2853
2870
  health: "health changes",
2854
2871
  notes: "notes when they open",
2855
2872
  messages: "messages",
2873
+ digest: "what changed each morning",
2856
2874
  };
2857
- const posts = ["forecast", "health", "notes", "messages"].filter((k) => r.hook[k]).map((k) => label[k]);
2875
+ const posts = ["forecast", "health", "notes", "messages", "digest"].filter((k) => r.hook[k]).map((k) => label[k]);
2858
2876
  const lines = [
2859
- `${r.program} posts to ${r.hook.service} (${r.hook.hint}): ${posts.length ? posts.join(", ") : "nothing yet; --on forecast,health,notes,messages turns posts on"}.`,
2877
+ `${r.program} posts to ${r.hook.service} (${r.hook.hint}): ${posts.length ? posts.join(", ") : "nothing yet; --on forecast,health,notes,messages,digest turns posts on"}.`,
2860
2878
  ];
2861
2879
  if (r.hook.failures > 0)
2862
2880
  lines.push(
@@ -4134,6 +4152,18 @@ export async function run(argv, io = {}) {
4134
4152
  if (!of) throw new HarborError("Say what: a project, a task key like RR-42, or a milestone.");
4135
4153
  return call("long_pole", { harbor, of }, whyText);
4136
4154
  }
4155
+ case "digest": {
4156
+ const { positionals, values, harbor } = parse(spec([], ["program", "hours"]));
4157
+ none(positionals);
4158
+ const hours = values.hours === undefined ? undefined : Number(values.hours);
4159
+ if (hours !== undefined && (!Number.isInteger(hours) || hours < 1 || hours > 168))
4160
+ throw new HarborError("--hours is a whole number from 1 to 168.");
4161
+ return call(
4162
+ "daily_digest",
4163
+ { harbor, ...(values.program ? { program: values.program } : {}), ...(hours ? { hours } : {}) },
4164
+ (r) => digestText(r, hours),
4165
+ );
4166
+ }
4137
4167
  case "catchup": {
4138
4168
  const { positionals, values, harbor } = parse(spec([], ["since"]));
4139
4169
  none(positionals);
package/lib/format.mjs CHANGED
@@ -1571,3 +1571,10 @@ export function reportsText(r) {
1571
1571
  }
1572
1572
  return out.join("\n");
1573
1573
  }
1574
+
1575
+ /** daily_digest: a heading, then each line. */
1576
+ export function digestText(r, hours) {
1577
+ const span = !hours || hours === 24 ? "the last day" : `the last ${hours} hours`;
1578
+ if (r.quiet) return `Nothing changed on ${r.on} in ${span}.`;
1579
+ return [`What changed on ${r.on} in ${span}`, ...r.lines.map((l) => ` • ${l}`)].join("\n");
1580
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.105.0",
3
+ "version": "0.106.0",
4
4
  "description": "Harbor from the terminal: a full-screen app with everything, plus commands for scripts and agents.",
5
5
  "keywords": [
6
6
  "harbor",