@harborppm/cli 0.100.0 → 0.102.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
@@ -262,6 +262,20 @@ function tasksByProject(tasks) {
262
262
  function tasksOf(tasks, projectId) {
263
263
  return tasksByProject(tasks).get(projectId) ?? EMPTY;
264
264
  }
265
+ /** Open (not done) tasks grouped by who holds them; unheld ones under "". Read-only. */
266
+ function openTasksByAssignee(tasks) {
267
+ return cached$1(assigneeTasks, tasks, () => {
268
+ const out = /* @__PURE__ */ new Map();
269
+ for (const t of tasks) {
270
+ if (t.status === "done") continue;
271
+ const key = t.assigneeId ?? "";
272
+ const list = out.get(key);
273
+ if (list) list.push(t);
274
+ else out.set(key, [t]);
275
+ }
276
+ return out;
277
+ });
278
+ }
265
279
  /** For each task id, the tasks that wait on it. */
266
280
  function waitersByBlocker(tasks) {
267
281
  return cached$1(waiting, tasks, () => {
@@ -304,12 +318,13 @@ function childrenByParent(tasks) {
304
318
  return out;
305
319
  });
306
320
  }
307
- var ids$1, projectTasks$1, EMPTY, waiting, positions, children;
321
+ var ids$1, projectTasks$1, EMPTY, assigneeTasks, waiting, positions, children;
308
322
  var init_indexes = __esmMin((() => {
309
323
  init_blockers();
310
324
  ids$1 = /* @__PURE__ */ new WeakMap();
311
325
  projectTasks$1 = /* @__PURE__ */ new WeakMap();
312
326
  EMPTY = Object.freeze([]);
327
+ assigneeTasks = /* @__PURE__ */ new WeakMap();
313
328
  waiting = /* @__PURE__ */ new WeakMap();
314
329
  positions = /* @__PURE__ */ new WeakMap();
315
330
  children = /* @__PURE__ */ new WeakMap();
@@ -833,7 +848,7 @@ var init_task_keys = __esmMin((() => {
833
848
  // src/lib/agents.ts
834
849
  /** What an agent should work on: its open tasks not yet waiting on review, in progress first, then most urgent and soonest. */
835
850
  function agentQueue(data, agentId) {
836
- return data.tasks.filter((t) => t.assigneeId === agentId && (t.status === "todo" || t.status === "doing" || t.status === "backlog")).sort((a, b) => Number(b.status === "doing") - Number(a.status === "doing") || Number(a.status === "backlog") - Number(b.status === "backlog") || RANK[a.priority] - RANK[b.priority] || (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999"));
851
+ return data.tasks.filter((t) => t.assigneeId === agentId && (t.status === "todo" || t.status === "doing" || t.status === "backlog")).sort((a, b) => Number(b.status === "doing") - Number(a.status === "doing") || Number(a.status === "backlog") - Number(b.status === "backlog") || RANK$1[a.priority] - RANK$1[b.priority] || (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999"));
837
852
  }
838
853
  /** The agent an app means: the one named, else the only one on the crew. */
839
854
  function pickAgent(people, key) {
@@ -846,10 +861,10 @@ function pickAgent(people, key) {
846
861
  const k = key.trim().toLowerCase();
847
862
  return agents.find((a) => a.id === key.trim() || a.name.trim().toLowerCase() === k) ?? `No agent called "${key}". The crew's agents: ${agents.map((a) => a.name).join(", ")}.`;
848
863
  }
849
- var isAgent, RANK;
864
+ var isAgent, RANK$1;
850
865
  var init_agents = __esmMin((() => {
851
866
  isAgent = (p) => p?.kind === "agent";
852
- RANK = {
867
+ RANK$1 = {
853
868
  urgent: 0,
854
869
  high: 1,
855
870
  medium: 2,
@@ -2816,7 +2831,7 @@ function weekOf(day = todayISO()) {
2816
2831
  const d = at$1(day);
2817
2832
  const wd = d.getDay();
2818
2833
  const back = wd === 0 ? -1 : wd === 6 ? -2 : wd - 1;
2819
- return iso$4(addDays(d, -back));
2834
+ return iso$5(addDays(d, -back));
2820
2835
  }
2821
2836
  /** Monday to Friday of the week starting `monday`. */
2822
2837
  function weekDays(monday) {
@@ -2827,10 +2842,10 @@ function weekDays(monday) {
2827
2842
  2,
2828
2843
  3,
2829
2844
  4
2830
- ].map((i) => iso$4(addDays(d, i)));
2845
+ ].map((i) => iso$5(addDays(d, i)));
2831
2846
  }
2832
2847
  function shiftWeek(monday, weeks) {
2833
- return iso$4(addDays(at$1(monday), weeks * 7));
2848
+ return iso$5(addDays(at$1(monday), weeks * 7));
2834
2849
  }
2835
2850
  /** Whether a week should read back how it went: from its Friday on. */
2836
2851
  function isReviewTime(monday, today = todayISO()) {
@@ -2879,7 +2894,7 @@ function weekPlan(data, personId, monday) {
2879
2894
  function weekReview(data, personId, monday) {
2880
2895
  const plan = weekPlan(data, personId, monday);
2881
2896
  const first = plan.days[0].date;
2882
- const sunday = iso$4(addDays(at$1(monday), 6));
2897
+ const sunday = iso$5(addDays(at$1(monday), 6));
2883
2898
  const doneInWeek = (t) => t.status === "done" && Boolean(t.completedAt) && todayISO(new Date(t.completedAt)) >= first && todayISO(new Date(t.completedAt)) <= sunday;
2884
2899
  const hoursBy = /* @__PURE__ */ new Map();
2885
2900
  for (const d of plan.days) for (const i of d.items) {
@@ -2919,7 +2934,7 @@ function stalePlacements(data, personId, today = todayISO()) {
2919
2934
  const cutoff = shiftWeek(weekOf(today), -12);
2920
2935
  return new Set(placementsOf(data, personId).filter((r) => (r.date ?? "") < cutoff).map((r) => r.id));
2921
2936
  }
2922
- var DAY_HOURS, DEFAULT_HOURS$1, MIN_HOURS, MAX_HOURS, HOUR_CHOICES, isPassage, iso$4, at$1, byDue, DAY_WORDS;
2937
+ var DAY_HOURS, DEFAULT_HOURS$1, MIN_HOURS, MAX_HOURS, HOUR_CHOICES, isPassage, iso$5, at$1, byDue, DAY_WORDS;
2923
2938
  var init_passage = __esmMin((() => {
2924
2939
  init_date_fns();
2925
2940
  init_date_text();
@@ -2940,7 +2955,7 @@ var init_passage = __esmMin((() => {
2940
2955
  8
2941
2956
  ];
2942
2957
  isPassage = (r) => r.kind === "passage";
2943
- iso$4 = (d) => todayISO(d);
2958
+ iso$5 = (d) => todayISO(d);
2944
2959
  at$1 = (day) => parseIso(`${day}T12:00:00`);
2945
2960
  byDue = (a, b) => (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999");
2946
2961
  DAY_WORDS = [
@@ -3329,16 +3344,16 @@ function easter(year) {
3329
3344
  const m = Math.floor((a + 11 * h + 22 * l) / 451);
3330
3345
  const month = Math.floor((h + l - 7 * m + 114) / 31);
3331
3346
  const day = (h + l - 7 * m + 114) % 31 + 1;
3332
- return iso$3(year, month, day);
3347
+ return iso$4(year, month, day);
3333
3348
  }
3334
3349
  /** The nth given weekday (0 Sunday) of a month; n = -1 for the last. */
3335
3350
  function nth(year, month, dow, n) {
3336
3351
  if (n > 0) {
3337
- const first = iso$3(year, month, 1);
3352
+ const first = iso$4(year, month, 1);
3338
3353
  const shift = (dow - weekday$1(first) + 7) % 7;
3339
3354
  return plus$1(first, shift + (n - 1) * 7);
3340
3355
  }
3341
- const last = iso$3(year, month + 1, 0);
3356
+ const last = iso$4(year, month + 1, 0);
3342
3357
  return plus$1(last, -((weekday$1(last) - dow + 7) % 7));
3343
3358
  }
3344
3359
  /** A country's public holidays in a year, by the day they're taken, oldest first. */
@@ -3454,12 +3469,12 @@ function harborHolidays(data, from, to) {
3454
3469
  };
3455
3470
  });
3456
3471
  }
3457
- var iso$3, weekday$1, plus$1, isWeekend, onOrBefore, fixed, fromEaster, MATARIKI, RULES, cache, PLAIN_CALENDAR;
3472
+ var iso$4, weekday$1, plus$1, isWeekend, onOrBefore, fixed, fromEaster, MATARIKI, RULES, cache, PLAIN_CALENDAR;
3458
3473
  var init_holidays = __esmMin((() => {
3459
3474
  init_date_fns();
3460
3475
  init_format();
3461
3476
  init_countries();
3462
- iso$3 = (y, m, d) => todayISO(new Date(y, m - 1, d, 12));
3477
+ iso$4 = (y, m, d) => todayISO(new Date(y, m - 1, d, 12));
3463
3478
  weekday$1 = (day) => (/* @__PURE__ */ new Date(`${day}T12:00:00`)).getDay();
3464
3479
  plus$1 = (day, n) => todayISO(addDays(/* @__PURE__ */ new Date(`${day}T12:00:00`), n));
3465
3480
  isWeekend = (day) => {
@@ -3467,7 +3482,7 @@ var init_holidays = __esmMin((() => {
3467
3482
  return wd === 0 || wd === 6;
3468
3483
  };
3469
3484
  onOrBefore = (day, dow) => plus$1(day, -((weekday$1(day) - dow + 7) % 7));
3470
- fixed = (m, d) => (y) => iso$3(y, m, d);
3485
+ fixed = (m, d) => (y) => iso$4(y, m, d);
3471
3486
  fromEaster = (n) => (y) => plus$1(easter(y), n);
3472
3487
  MATARIKI = {
3473
3488
  2025: "2025-06-20",
@@ -3517,7 +3532,7 @@ var init_holidays = __esmMin((() => {
3517
3532
  "next"
3518
3533
  ],
3519
3534
  ["Good Friday", fromEaster(-2)],
3520
- ["Victoria Day", (y) => onOrBefore(iso$3(y, 5, 24), 1)],
3535
+ ["Victoria Day", (y) => onOrBefore(iso$4(y, 5, 24), 1)],
3521
3536
  [
3522
3537
  "Canada Day",
3523
3538
  fixed(7, 1),
@@ -3564,7 +3579,7 @@ var init_holidays = __esmMin((() => {
3564
3579
  fixed(1, 1),
3565
3580
  "next"
3566
3581
  ],
3567
- ["St Brigid's Day", (y) => weekday$1(iso$3(y, 2, 1)) === 5 ? iso$3(y, 2, 1) : nth(y, 2, 1, 1)],
3582
+ ["St Brigid's Day", (y) => weekday$1(iso$4(y, 2, 1)) === 5 ? iso$4(y, 2, 1) : nth(y, 2, 1, 1)],
3568
3583
  [
3569
3584
  "St Patrick's Day",
3570
3585
  fixed(3, 17),
@@ -3676,7 +3691,7 @@ var init_holidays = __esmMin((() => {
3676
3691
  NL: [
3677
3692
  ["Nieuwjaarsdag", fixed(1, 1)],
3678
3693
  ["Tweede paasdag", fromEaster(1)],
3679
- ["Koningsdag", (y) => weekday$1(iso$3(y, 4, 27)) === 0 ? iso$3(y, 4, 26) : iso$3(y, 4, 27)],
3694
+ ["Koningsdag", (y) => weekday$1(iso$4(y, 4, 27)) === 0 ? iso$4(y, 4, 26) : iso$4(y, 4, 27)],
3680
3695
  ["Hemelvaartsdag", fromEaster(39)],
3681
3696
  ["Tweede pinksterdag", fromEaster(50)],
3682
3697
  ["Eerste kerstdag", fixed(12, 25)],
@@ -8502,8 +8517,8 @@ init_date_text();
8502
8517
  init_format();
8503
8518
  init_indexes();
8504
8519
  init_premortem();
8505
- const DAY$1 = (iso) => parseIso(iso.slice(0, 10));
8506
- const span = (a, b) => differenceInCalendarDays(DAY$1(b), DAY$1(a));
8520
+ const DAY$2 = (iso) => parseIso(iso.slice(0, 10));
8521
+ const span = (a, b) => differenceInCalendarDays(DAY$2(b), DAY$2(a));
8507
8522
  /** Projects marked Done that have tasks to copy, most recently finished first. */
8508
8523
  function finishedProjects(data) {
8509
8524
  return data.projects.filter((p) => p.health === "done" && tasksOf(data.tasks, p.id).length > 0).map((p) => ({
@@ -8594,7 +8609,7 @@ function reckoningLine(r) {
8594
8609
  }
8595
8610
  /** The new project's end date, as long after its start as the old one really ran. */
8596
8611
  function reckonedEnd(r, startDate) {
8597
- return todayISO(addDays(DAY$1(startDate), r.took));
8612
+ return todayISO(addDays(DAY$2(startDate), r.took));
8598
8613
  }
8599
8614
  /** Puts the reckoning's tasks and risks into the new project, dated from its start. */
8600
8615
  function applyReckoning(actions, projectId, r, startDate) {
@@ -8605,7 +8620,7 @@ function applyReckoning(actions, projectId, r, startDate) {
8605
8620
  status: "todo",
8606
8621
  priority: t.priority,
8607
8622
  assigneeId: null,
8608
- dueDate: todayISO(addDays(DAY$1(startDate), t.dueIn))
8623
+ dueDate: todayISO(addDays(DAY$2(startDate), t.dueIn))
8609
8624
  }, {
8610
8625
  allowOverCap: true,
8611
8626
  allowBlocked: true
@@ -9496,7 +9511,32 @@ function recordHealth(history, health, at, override, note) {
9496
9511
  note: note ?? null
9497
9512
  }].slice(-30);
9498
9513
  }
9499
- var init_health_history = __esmMin((() => {}));
9514
+ /**
9515
+ * What the rules said over time, oldest first: the history's lines the rules
9516
+ * set, and the readings kept while a person's call stood in front of them.
9517
+ */
9518
+ function rulesTimeline(item) {
9519
+ const out = [];
9520
+ for (const h of item.healthHistory ?? []) if (!h.override && isTrack$1(h.health)) out.push({
9521
+ at: h.at,
9522
+ health: h.health
9523
+ });
9524
+ for (const r of item.ruleHistory ?? []) out.push(r);
9525
+ return out.sort((a, b) => a.at.localeCompare(b.at));
9526
+ }
9527
+ /** The readings with one more line when the rules now say something other than they last did. Same array otherwise. */
9528
+ function recordRule(item, health, at) {
9529
+ const last = rulesTimeline(item).at(-1);
9530
+ if (last && last.health === health) return item.ruleHistory;
9531
+ return [...item.ruleHistory ?? [], {
9532
+ at,
9533
+ health
9534
+ }].slice(-40);
9535
+ }
9536
+ var isTrack$1;
9537
+ var init_health_history = __esmMin((() => {
9538
+ isTrack$1 = (h) => h === "on-track" || h === "at-risk" || h === "off-track";
9539
+ }));
9500
9540
 
9501
9541
  // src/lib/derived-health.ts
9502
9542
  function parseDate(value) {
@@ -9555,7 +9595,7 @@ function programIsBlocked(data, program) {
9555
9595
  }
9556
9596
  function daysOverdue(dueDate, now) {
9557
9597
  if (!dueDate) return 0;
9558
- const today = iso$2(now);
9598
+ const today = iso$3(now);
9559
9599
  if (today !== overdueDay) {
9560
9600
  overdueDay = today;
9561
9601
  overdueByDue.clear();
@@ -9574,7 +9614,7 @@ function daysOverdue(dueDate, now) {
9574
9614
  }
9575
9615
  function daysUntil$1(date, now) {
9576
9616
  if (!date) return null;
9577
- const today = iso$2(now);
9617
+ const today = iso$3(now);
9578
9618
  if (today !== untilDay) {
9579
9619
  untilDay = today;
9580
9620
  untilByDate.clear();
@@ -9639,7 +9679,7 @@ function effectiveProjectHealth(project, data, now) {
9639
9679
  }
9640
9680
  /** Milestones past their date and still open. */
9641
9681
  function lateMilestonesOf(milestones, now) {
9642
- const today = iso$2(now);
9682
+ const today = iso$3(now);
9643
9683
  return milestones.filter((m) => !m.done && m.dueDate < today);
9644
9684
  }
9645
9685
  /**
@@ -9704,7 +9744,7 @@ function rankHealth(h) {
9704
9744
  */
9705
9745
  function stampHealth(data, now = clockNow()) {
9706
9746
  const at = now.toISOString();
9707
- const projects = restamp(data.projects, (p) => effectiveProjectHealth(p, data, now), at);
9747
+ const projects = noteRules(restamp(data.projects, (p) => effectiveProjectHealth(p, data, now), at), data, now, at);
9708
9748
  const mid = projects === data.projects ? data : {
9709
9749
  ...data,
9710
9750
  projects
@@ -9738,13 +9778,33 @@ function restamp(rows, healthOf, at) {
9738
9778
  });
9739
9779
  return changed ? next : rows;
9740
9780
  }
9781
+ /**
9782
+ * While a person's call (On track, At risk or Off track) stands in front of a
9783
+ * project's health, keep what the rules say behind it, a line each time it
9784
+ * moves, so Hull check (src/lib/hull-check.ts) can set the two side by side.
9785
+ * Only hand-set projects are worked out again; the rest keep the same rows.
9786
+ */
9787
+ function noteRules(projects, data, now, at) {
9788
+ let changed = false;
9789
+ const next = projects.map((p) => {
9790
+ if (!overridesTrack(p)) return p;
9791
+ const ruleHistory = recordRule(p, deriveProjectHealth(p, data, now), at);
9792
+ if (ruleHistory === p.ruleHistory) return p;
9793
+ changed = true;
9794
+ return {
9795
+ ...p,
9796
+ ruleHistory
9797
+ };
9798
+ });
9799
+ return changed ? next : projects;
9800
+ }
9741
9801
  /** Late tasks across a program's projects, from the per-project lookup rather than every task. */
9742
9802
  function programLateCount(programId, data, now) {
9743
9803
  let late = 0;
9744
9804
  for (const p of data.projects) if (p.programId === programId) late += lateTasksOf([...tasksOf(data.tasks, p.id)], now).length;
9745
9805
  return late;
9746
9806
  }
9747
- var iso$2, overdueDay, overdueByDue, untilDay, untilByDate;
9807
+ var iso$3, overdueDay, overdueByDue, untilDay, untilByDate;
9748
9808
  var init_derived_health = __esmMin((() => {
9749
9809
  init_date_fns();
9750
9810
  init_date_text();
@@ -9752,7 +9812,7 @@ var init_derived_health = __esmMin((() => {
9752
9812
  init_indexes();
9753
9813
  init_health_history();
9754
9814
  init_clock();
9755
- iso$2 = (d) => {
9815
+ iso$3 = (d) => {
9756
9816
  return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
9757
9817
  };
9758
9818
  overdueDay = "";
@@ -11005,7 +11065,7 @@ function reviewedPrograms(slides, quiet) {
11005
11065
  // src/tui/views/bridge.tsx
11006
11066
  init_date_fns();
11007
11067
  init_date_text();
11008
- const WORD = {
11068
+ const WORD$1 = {
11009
11069
  decision: "Decided",
11010
11070
  action: "Action",
11011
11071
  risk: "Risk"
@@ -11206,7 +11266,7 @@ function BridgeView({ active, width, height, go, programIds, onBack }) {
11206
11266
  "",
11207
11267
  `${part.program.name}${channels[part.program.id] ? ` · ${channels[part.program.id]} channel` : ""}`,
11208
11268
  `Covered: ${part.covered.map((p) => p.name).join(", ") || "none"}`,
11209
- ...part.lines.length ? part.lines.map((l) => `• ${WORD[l.kind]}: ${l.text}`) : ["Nothing new logged."]
11269
+ ...part.lines.length ? part.lines.map((l) => `• ${WORD$1[l.kind]}: ${l.text}`) : ["Nothing new logged."]
11210
11270
  ]),
11211
11271
  ...quiet.length ? ["", `No change on ${quiet.map((q) => q.project.name).join(", ")}.`] : []
11212
11272
  ].join("\n");
@@ -11242,7 +11302,7 @@ function BridgeView({ active, width, height, go, programIds, onBack }) {
11242
11302
  ...here.length ? [
11243
11303
  "",
11244
11304
  "Logged in this meeting:",
11245
- ...here.map((l) => `• ${WORD[l.kind]}: ${l.text}`)
11305
+ ...here.map((l) => `• ${WORD$1[l.kind]}: ${l.text}`)
11246
11306
  ] : [],
11247
11307
  "",
11248
11308
  `Next move: ${program.nextMove?.trim() || "none yet"}`
@@ -12881,13 +12941,13 @@ function InboxView({ active, width, height, go }) {
12881
12941
  /** Open tasks for one person, bucketed by the week they are due, plus what is already late or has no date. */
12882
12942
  function weeklyLoad(tasks, personId, now, weeks = 6, calendar) {
12883
12943
  const mine = tasks.filter((t) => t.assigneeId === personId && t.status !== "done");
12884
- const today = iso$1(now);
12944
+ const today = iso$2(now);
12885
12945
  const origin = startOfWeek(now, { weekStartsOn: 1 });
12886
12946
  const buckets = Array.from({ length: weeks }, (_, i) => {
12887
- const start = iso$1(addDays(origin, i * 7));
12947
+ const start = iso$2(addDays(origin, i * 7));
12888
12948
  const off = [];
12889
12949
  if (calendar?.active) for (let d = 0; d < 5; d++) {
12890
- const date = iso$1(addDays(origin, i * 7 + d));
12950
+ const date = iso$2(addDays(origin, i * 7 + d));
12891
12951
  const why = calendar.offOn(personId, date);
12892
12952
  if (why) off.push({
12893
12953
  date,
@@ -12922,10 +12982,19 @@ function weeklyLoad(tasks, personId, now, weeks = 6, calendar) {
12922
12982
  weeks: buckets
12923
12983
  };
12924
12984
  }
12925
- var iso$1;
12985
+ /** A week's capacity, less the weekdays someone is off: 5 a week with two days off is 3. */
12986
+ function weekCapacity(capacity, workDays) {
12987
+ return Math.round(capacity * Math.max(0, Math.min(5, workDays)) / 5 * 10) / 10;
12988
+ }
12989
+ /** Capacity a person has for one program, given the share of their week promised to it. */
12990
+ function allocatedCapacity(weeklyCapacity, percent) {
12991
+ return Math.max(0, Math.round((weeklyCapacity ?? 5) * percent / 100 * 10) / 10);
12992
+ }
12993
+ var DEFAULT_WEEKLY_CAPACITY, iso$2;
12926
12994
  var init_load = __esmMin((() => {
12927
12995
  init_date_fns();
12928
- iso$1 = (d) => {
12996
+ DEFAULT_WEEKLY_CAPACITY = 5;
12997
+ iso$2 = (d) => {
12929
12998
  return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
12930
12999
  };
12931
13000
  }));
@@ -16101,6 +16170,158 @@ function dueFrom(value, now) {
16101
16170
  throw new CommandError(`Can't read the date "${value}". Try today, fri, +3 or 2026-11-02.`);
16102
16171
  }
16103
16172
 
16173
+ // src/lib/load-line.ts
16174
+ init_date_fns();
16175
+ init_load();
16176
+ init_indexes();
16177
+ /** The weeks a load line looks at: this one and the two after. */
16178
+ const LOAD_LINE_WEEKS = 3;
16179
+ const iso$1 = (d) => {
16180
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
16181
+ };
16182
+ /** The window: today, and the last day of the last week looked at (a Sunday). */
16183
+ function loadWindow(now, weeks = 3) {
16184
+ const monday = startOfWeek(now, { weekStartsOn: 1 });
16185
+ return {
16186
+ today: iso$1(now),
16187
+ monday,
16188
+ end: iso$1(addDays(monday, weeks * 7 - 1))
16189
+ };
16190
+ }
16191
+ /**
16192
+ * Weekdays a person is off in the window, by week: from the harbor's
16193
+ * calendar when given (holidays and time away), else their time away alone,
16194
+ * so a picker that doesn't load the holiday rules still sees someone away.
16195
+ */
16196
+ function offByWeek(calendar, person, monday, weeks) {
16197
+ const away = person.away?.until && person.away.since ? [person.away.since.slice(0, 10), person.away.until.slice(0, 10)] : null;
16198
+ return Array.from({ length: weeks }, (_, w) => {
16199
+ let off = 0;
16200
+ for (let d = 0; d < 5; d++) {
16201
+ const day = iso$1(addDays(monday, w * 7 + d));
16202
+ if (calendar?.active) {
16203
+ if (calendar.offOn(person.id, day)) off += 1;
16204
+ } else if (away && day >= away[0] && day < away[1]) off += 1;
16205
+ }
16206
+ return off;
16207
+ });
16208
+ }
16209
+ function line(cargo, late, capacity, daysOff, undated) {
16210
+ const ratio = cargo === 0 ? 0 : capacity <= 0 ? Number.POSITIVE_INFINITY : cargo / capacity;
16211
+ const tenth = (n) => Math.round(n * 10) / 10;
16212
+ return {
16213
+ cargo,
16214
+ late,
16215
+ capacity: tenth(capacity),
16216
+ ratio,
16217
+ over: tenth(Math.max(0, cargo - capacity)),
16218
+ room: tenth(Math.max(0, capacity - cargo)),
16219
+ daysOff,
16220
+ undated
16221
+ };
16222
+ }
16223
+ /** Count a person's open work: late, due in the window, and undated. */
16224
+ function countWork(tasks, today, end) {
16225
+ let late = 0;
16226
+ let due = 0;
16227
+ let undated = 0;
16228
+ for (const t of tasks) {
16229
+ if (t.status === "done") continue;
16230
+ const d = t.dueDate?.slice(0, 10);
16231
+ if (!d) undated += 1;
16232
+ else if (d < today) late += 1;
16233
+ else if (d <= end) due += 1;
16234
+ }
16235
+ return {
16236
+ late,
16237
+ due,
16238
+ undated
16239
+ };
16240
+ }
16241
+ /**
16242
+ * One person's load line. Null for an agent on the crew: an app has no
16243
+ * week to fill.
16244
+ */
16245
+ function personLoadLine(data, person, now, calendar, weeks = 3) {
16246
+ if (person.kind === "agent") return null;
16247
+ const { today, monday, end } = loadWindow(now, weeks);
16248
+ const { late, due, undated } = countWork(openTasksByAssignee(data.tasks).get(person.id) ?? [], today, end);
16249
+ const pace = person.weeklyCapacity ?? 5;
16250
+ const off = offByWeek(calendar, person, monday, weeks);
16251
+ const capacity = off.reduce((sum, o) => sum + weekCapacity(pace, 5 - o), 0);
16252
+ return line(late + due, late, capacity, off.reduce((a, b) => a + b, 0), undated);
16253
+ }
16254
+ /**
16255
+ * A program's load line: the crew time promised to it against its open
16256
+ * work in the window. Null while nobody's time is promised to it, since
16257
+ * there's no line to draw.
16258
+ */
16259
+ function programLoadLine(data, programId, now, calendar, weeks = 3) {
16260
+ const { today, monday, end } = loadWindow(now, weeks);
16261
+ let capacity = 0;
16262
+ let daysOff = 0;
16263
+ let crew = 0;
16264
+ for (const p of data.people) {
16265
+ if (p.kind === "agent") continue;
16266
+ const share = p.allocations?.find((a) => a.programId === programId)?.percent ?? 0;
16267
+ if (share <= 0) continue;
16268
+ crew += 1;
16269
+ const pace = allocatedCapacity(p.weeklyCapacity, share);
16270
+ const off = offByWeek(calendar, p, monday, weeks);
16271
+ for (const o of off) capacity += weekCapacity(pace, 5 - o);
16272
+ daysOff += off.reduce((a, b) => a + b, 0);
16273
+ }
16274
+ if (crew === 0) return null;
16275
+ let late = 0;
16276
+ let due = 0;
16277
+ let undated = 0;
16278
+ let unheld = 0;
16279
+ for (const project of data.projects) {
16280
+ if (project.programId !== programId || project.health === "done") continue;
16281
+ for (const t of tasksOf(data.tasks, project.id)) {
16282
+ if (t.status === "done") continue;
16283
+ const d = t.dueDate?.slice(0, 10);
16284
+ if (!d) {
16285
+ undated += 1;
16286
+ continue;
16287
+ }
16288
+ if (d > end) continue;
16289
+ if (d < today) late += 1;
16290
+ else due += 1;
16291
+ if (!t.assigneeId) unheld += 1;
16292
+ }
16293
+ }
16294
+ return {
16295
+ ...line(late + due, late, capacity, daysOff, undated),
16296
+ unheld
16297
+ };
16298
+ }
16299
+ const tasksWord = (n) => `${n} task${n === 1 ? "" : "s"}`;
16300
+ /**
16301
+ * "Past the line by 3 tasks: 11 due in the next 3 weeks (2 late), room for 8.",
16302
+ * or "Room for 4 more in the next 3 weeks (8 of 12)." Said the same in a tooltip,
16303
+ * the terminal and for agents.
16304
+ */
16305
+ function loadLineText(l, weeks = 3) {
16306
+ const span = `the next ${weeks} weeks`;
16307
+ const lateBit = l.late ? ` (${l.late} late)` : "";
16308
+ if (l.cargo === 0) return l.capacity > 0 ? `Nothing due in ${span}.` : `Nothing due, and off for ${span}.`;
16309
+ if (l.capacity <= 0) return `${tasksWord(l.cargo)} due in ${span}${lateBit}, with no room: off the whole time.`;
16310
+ if (l.over > 0) return `Past the line by ${tasksWord(l.over)}: ${l.cargo} due in ${span}${lateBit}, room for ${l.capacity}.`;
16311
+ if (l.room === 0) return `At the line: ${l.cargo} due in ${span}${lateBit}, room for ${l.capacity}.`;
16312
+ return `Room for ${tasksWord(l.room)} more in ${span}: ${l.cargo} of ${l.capacity}${lateBit}.`;
16313
+ }
16314
+ /** Everyone's line, worst first: the people page's order when it sorts by load. */
16315
+ function crewLoadLines(data, now, calendar) {
16316
+ return data.people.flatMap((person) => {
16317
+ const l = personLoadLine(data, person, now, calendar);
16318
+ return l ? [{
16319
+ person,
16320
+ line: l
16321
+ }] : [];
16322
+ }).sort((a, b) => b.line.ratio - a.line.ratio || b.line.cargo - a.line.cargo);
16323
+ }
16324
+
16104
16325
  // src/lib/dry-dock.ts
16105
16326
  init_date_fns();
16106
16327
  init_format();
@@ -16337,7 +16558,9 @@ function dockCompare(data, projectId, changes, now) {
16337
16558
  person,
16338
16559
  capacity: person.weeklyCapacity ?? 5,
16339
16560
  real: weeklyLoad(data.tasks, id, now),
16340
- docked: weeklyLoad(plan.allTasks, id, now)
16561
+ docked: weeklyLoad(plan.allTasks, id, now),
16562
+ realLine: personLoadLine(data, person, now),
16563
+ dockedLine: personLoadLine({ tasks: plan.allTasks }, person, now)
16341
16564
  });
16342
16565
  }
16343
16566
  load.sort((x, y) => x.person.name.localeCompare(y.person.name));
@@ -16472,6 +16695,25 @@ function applyDock(actions, projectId, changes) {
16472
16695
  return made;
16473
16696
  }
16474
16697
 
16698
+ // src/lib/milestone-edits.ts
16699
+ /**
16700
+ * A milestone with `patch` applied, remembering the day it was reached:
16701
+ * `doneAt` is today when it turns done (unless the patch says otherwise),
16702
+ * and cleared when it opens again.
16703
+ */
16704
+ function stampDone(m, patch) {
16705
+ const next = {
16706
+ ...m,
16707
+ ...patch
16708
+ };
16709
+ if (next.done && !m.done && !("doneAt" in patch)) next.doneAt = todayISO();
16710
+ if (!next.done && m.done) next.doneAt = null;
16711
+ return next;
16712
+ }
16713
+ var init_milestone_edits = __esmMin((() => {
16714
+ init_format();
16715
+ }));
16716
+
16475
16717
  // src/lib/task-milestones.ts
16476
16718
  /** The milestone a task is tied to, or null when it isn't (or the tie no longer holds). */
16477
16719
  function milestoneOf(task, milestones, projects) {
@@ -16547,17 +16789,11 @@ function followMilestones(before, after) {
16547
16789
  if (!m.done && lost.has(m.id) && p && p.total > 0 && p.done === p.total) {
16548
16790
  if (!waitsClear(m, after.projects)) return m;
16549
16791
  changed = true;
16550
- return {
16551
- ...m,
16552
- done: true
16553
- };
16792
+ return stampDone(m, { done: true });
16554
16793
  }
16555
16794
  if (m.done && gained.has(m.id)) {
16556
16795
  changed = true;
16557
- return {
16558
- ...m,
16559
- done: false
16560
- };
16796
+ return stampDone(m, { done: false });
16561
16797
  }
16562
16798
  return m;
16563
16799
  });
@@ -16570,6 +16806,7 @@ var follows;
16570
16806
  var init_task_milestones = __esmMin((() => {
16571
16807
  init_blockers();
16572
16808
  init_indexes();
16809
+ init_milestone_edits();
16573
16810
  follows = (m) => !m.approverId;
16574
16811
  }));
16575
16812
 
@@ -23318,6 +23555,157 @@ function signText(sign) {
23318
23555
  }
23319
23556
  }
23320
23557
 
23558
+ // src/lib/hull-check.ts
23559
+ init_date_fns();
23560
+ init_derived_health();
23561
+ init_health_history();
23562
+ /** A call rosier than the numbers this long is flagged. */
23563
+ const HULL_DAYS = 21;
23564
+ /** Steady hands are read over this window. */
23565
+ const STEADY_WINDOW_DAYS = 90;
23566
+ /** At least this many days of calls by hand in the window, to say anything. */
23567
+ const STEADY_MIN_DAYS = 14;
23568
+ /** At most this share of those days rosier than the numbers. */
23569
+ const STEADY_MAX_ROSY = .1;
23570
+ const RANK = {
23571
+ "on-track": 0,
23572
+ "at-risk": 1,
23573
+ "off-track": 2
23574
+ };
23575
+ const isTrack = (h) => h === "on-track" || h === "at-risk" || h === "off-track";
23576
+ const DAY$1 = 864e5;
23577
+ const ms = (iso) => new Date(iso).getTime();
23578
+ /** The calls and the rules' readings as one run of moments, oldest first, with the rules' word now at the end. */
23579
+ function moments(project, rulesNow, now) {
23580
+ const out = [];
23581
+ for (const h of project.healthHistory ?? []) out.push({
23582
+ at: ms(h.at),
23583
+ declared: h.override && isTrack(h.health) ? h.health : null
23584
+ });
23585
+ for (const r of rulesTimeline(project)) out.push({
23586
+ at: ms(r.at),
23587
+ rules: r.health
23588
+ });
23589
+ out.sort((a, b) => a.at - b.at);
23590
+ if (rulesNow) out.push({
23591
+ at: now.getTime(),
23592
+ rules: rulesNow
23593
+ });
23594
+ return out.filter((m) => Number.isFinite(m.at));
23595
+ }
23596
+ /** The project's time cut into stretches with one call and one reading each, up to now. */
23597
+ function stretches(project, rulesNow, now) {
23598
+ const list = moments(project, rulesNow, now);
23599
+ const out = [];
23600
+ let declared = null;
23601
+ let rules = null;
23602
+ for (let i = 0; i < list.length; i++) {
23603
+ const m = list[i];
23604
+ if (m.declared !== void 0) declared = m.declared;
23605
+ if (m.rules !== void 0) rules = m.rules;
23606
+ const to = i + 1 < list.length ? list[i + 1].at : now.getTime();
23607
+ if (to > m.at) out.push({
23608
+ from: m.at,
23609
+ to,
23610
+ declared,
23611
+ rules
23612
+ });
23613
+ }
23614
+ const last = out.at(-1);
23615
+ if (last) last.declared = isTrack(project.healthOverride) ? project.healthOverride : null;
23616
+ return out;
23617
+ }
23618
+ const rosier = (s) => s.declared !== null && s.rules !== null && RANK[s.declared] < RANK[s.rules];
23619
+ /**
23620
+ * The project's call against the numbers, when the call is rosier now; null
23621
+ * otherwise (no call by hand, Paused or Done, or the call is as gloomy as the
23622
+ * numbers or more).
23623
+ */
23624
+ function hullGap(project, data, now) {
23625
+ if (!overridesTrack(project) || !isTrack(project.healthOverride)) return null;
23626
+ const declared = project.healthOverride;
23627
+ const rules = deriveProjectHealth(project, data, now);
23628
+ if (RANK[declared] >= RANK[rules]) return null;
23629
+ const parts = stretches(project, rules, now);
23630
+ let since = now.getTime();
23631
+ for (let i = parts.length - 1; i >= 0 && rosier(parts[i]); i--) since = parts[i].from;
23632
+ let calledAt = now.getTime();
23633
+ for (let i = parts.length - 1; i >= 0 && parts[i].declared === declared; i--) calledAt = parts[i].from;
23634
+ const days = (t) => Math.max(0, differenceInCalendarDays(now, new Date(t)));
23635
+ return {
23636
+ project,
23637
+ declared,
23638
+ rules,
23639
+ days: days(since),
23640
+ calledDays: days(calledAt),
23641
+ note: project.healthNote?.trim() || null
23642
+ };
23643
+ }
23644
+ /** Projects whose rosier call has stood three weeks, longest first. Done and paused projects are left out. */
23645
+ function hullCheck(data, now, projectIds) {
23646
+ const out = [];
23647
+ for (const p of data.projects) {
23648
+ if (projectIds && !projectIds.has(p.id)) continue;
23649
+ const gap = hullGap(p, data, now);
23650
+ if (gap && gap.days >= 21) out.push(gap);
23651
+ }
23652
+ return out.sort((a, b) => b.days - a.days || a.project.name.localeCompare(b.project.name));
23653
+ }
23654
+ /** Each project owner's calls by hand over the last three months, against the numbers behind them. */
23655
+ function callRecords(data, now) {
23656
+ const start = now.getTime() - 90 * DAY$1;
23657
+ const by = /* @__PURE__ */ new Map();
23658
+ for (const p of data.projects) {
23659
+ if (!(p.healthHistory ?? []).some((h) => h.override) && !overridesTrack(p)) continue;
23660
+ const rulesNow = overridesTrack(p) ? deriveProjectHealth(p, data, now) : null;
23661
+ for (const s of stretches(p, rulesNow, now)) {
23662
+ if (s.declared === null || s.rules === null) continue;
23663
+ const from = Math.max(s.from, start);
23664
+ if (s.to <= from) continue;
23665
+ const days = (s.to - from) / DAY$1;
23666
+ const rec = by.get(p.ownerId) ?? {
23667
+ personId: p.ownerId,
23668
+ calledDays: 0,
23669
+ rosyDays: 0
23670
+ };
23671
+ rec.calledDays += days;
23672
+ if (rosier(s)) rec.rosyDays += days;
23673
+ by.set(p.ownerId, rec);
23674
+ }
23675
+ }
23676
+ return [...by.values()];
23677
+ }
23678
+ /**
23679
+ * Owners whose calls by hand have matched the numbers over the last three
23680
+ * months: two weeks of calls at least, rosier for a tenth of it at most, and
23681
+ * nothing flagged now. A set, not a ranking.
23682
+ */
23683
+ function steadyHands(data, now) {
23684
+ const flagged = new Set(hullCheck(data, now).map((g) => g.project.ownerId));
23685
+ const out = /* @__PURE__ */ new Set();
23686
+ for (const r of callRecords(data, now)) {
23687
+ if (flagged.has(r.personId)) continue;
23688
+ if (r.calledDays >= 14 && r.rosyDays <= r.calledDays * .1) out.add(r.personId);
23689
+ }
23690
+ return out;
23691
+ }
23692
+ const WORD = {
23693
+ "on-track": "On track",
23694
+ "at-risk": "At risk",
23695
+ "off-track": "Off track"
23696
+ };
23697
+ /** "3 weeks", "10 days". */
23698
+ function weeksText(days) {
23699
+ if (days >= 14) return `${Math.floor(days / 7)} weeks`;
23700
+ return `${days} day${days === 1 ? "" : "s"}`;
23701
+ }
23702
+ /** "Called On track by hand for 5 weeks; the numbers have said Off track for 4 of them." */
23703
+ function gapText(gap) {
23704
+ const called = `Called ${WORD[gap.declared]} by hand for ${weeksText(gap.calledDays)}`;
23705
+ if (gap.days >= gap.calledDays - 1) return `${called}, while the numbers have said ${WORD[gap.rules]} the whole time.`;
23706
+ return `${called}; the numbers have said ${WORD[gap.rules]} for the last ${weeksText(gap.days)}.`;
23707
+ }
23708
+
23321
23709
  // src/lib/task-approval.ts
23322
23710
  /** Waits on its approver now: asked, not yet answered, and not done. */
23323
23711
  function awaitingApproval(task) {
@@ -24575,7 +24963,7 @@ const HARBOR_TOOLS = [
24575
24963
  tool({
24576
24964
  name: "program_review",
24577
24965
  title: "The review",
24578
- description: "The website's Review: programs worst health first, then soonest end, each with its lead, end date, health (and the note when set by hand), late tasks, where it sits on the priority matrix and its next move. Done programs only with includeDone. blankCharters lists running projects in them whose charter is still empty a week after they started (set_charter writes one)." + DATA_NOTE,
24966
+ description: "The website's Review: programs worst health first, then soonest end, each with its lead, end date, health (and the note when set by hand), late tasks, where it sits on the priority matrix and its next move. Done programs only with includeDone. blankCharters lists running projects in them whose charter is still empty a week after they started (set_charter writes one). hullCheck lists projects whose health was set by hand rosier than their work has said for three weeks or more (watermelons: the call, what the numbers say, for how long, and the note); set_health with \"auto\" hands one back to the numbers, only on the person's word. steadyHands names owners whose calls by hand over three months matched the work or warned early; it is not a ranking." + DATA_NOTE,
24579
24967
  input: object({
24580
24968
  harbor: harborArg,
24581
24969
  owner: string().max(200).optional().describe("\"me\", or a person's id or name: programs they lead, lead a project in or hold a task in."),
@@ -24617,6 +25005,23 @@ const HARBOR_TOOLS = [
24617
25005
  program: data.programs.find((x) => x.id === b.project.programId)?.name ?? null,
24618
25006
  startedDaysAgo: b.days
24619
25007
  })),
25008
+ hullCheck: (() => {
25009
+ const programIds = new Set(listed.map((p) => p.id));
25010
+ const projectIds = new Set(data.projects.filter((p) => programIds.has(p.programId)).map((p) => p.id));
25011
+ return hullCheck(data, ctx.now, projectIds).map((g) => ({
25012
+ project: g.project.name,
25013
+ ...g.project.key ? { key: g.project.key } : {},
25014
+ program: data.programs.find((x) => x.id === g.project.programId)?.name ?? null,
25015
+ owner: nameOf$2(people, g.project.ownerId),
25016
+ calledByHand: g.declared,
25017
+ numbersSay: g.rules,
25018
+ forDays: g.days,
25019
+ calledDaysAgo: g.calledDays,
25020
+ note: g.note,
25021
+ text: gapText(g)
25022
+ }));
25023
+ })(),
25024
+ steadyHands: [...steadyHands(data, ctx.now)].map((id) => nameOf$2(people, id)).filter(Boolean),
24620
25025
  onlyOneKnows: lifeboats(data, ctx.now, { programIds: new Set(listed.map((p) => p.id)) }).slice(0, 25).map((l) => lifeboatOut(data, l, people))
24621
25026
  };
24622
25027
  }
@@ -25438,6 +25843,48 @@ const HARBOR_TOOLS = [
25438
25843
  };
25439
25844
  }
25440
25845
  }),
25846
+ tool({
25847
+ name: "load_line",
25848
+ title: "Who is past their load line",
25849
+ description: "Each person's load line: open tasks due in the next 3 weeks plus any already late (cargo), against what they can close in that time (capacity: their tasks a week, less weekdays off for holidays and time away). over is how many tasks past the line, room how many before it; text says it in a sentence. Worst first. Agents on the crew have none. With program, also that program's line: the crew time promised to it (allocations) against its open work in the same weeks, including work nobody holds yet (unheld); null when no one's time is promised to it." + DATA_NOTE,
25850
+ input: object({
25851
+ harbor: harborArg,
25852
+ program: string().max(200).optional().describe("Program id or name.")
25853
+ }),
25854
+ run: (ctx, input) => {
25855
+ const { data } = ctx;
25856
+ const cal = workCalendar(data);
25857
+ const shape = (l) => ({
25858
+ cargo: l.cargo,
25859
+ late: l.late,
25860
+ capacity: l.capacity,
25861
+ over: l.over,
25862
+ room: l.room,
25863
+ daysOff: l.daysOff,
25864
+ undated: l.undated,
25865
+ ...l.unheld !== void 0 ? { unheld: l.unheld } : {},
25866
+ text: loadLineText(l)
25867
+ });
25868
+ const people = crewLoadLines(data, ctx.now, cal).map(({ person, line }) => ({
25869
+ who: person.name,
25870
+ ...shape(line)
25871
+ }));
25872
+ if (!input.program) return {
25873
+ weeks: 3,
25874
+ people
25875
+ };
25876
+ const program = findOne(data.programs, input.program, "program");
25877
+ const line = programLoadLine(data, program.id, ctx.now, cal);
25878
+ return {
25879
+ weeks: 3,
25880
+ program: {
25881
+ name: program.name,
25882
+ line: line ? shape(line) : null
25883
+ },
25884
+ people
25885
+ };
25886
+ }
25887
+ }),
25441
25888
  tool({
25442
25889
  name: "handover_plan",
25443
25890
  title: "What handing someone's work over would move",
@@ -27610,10 +28057,7 @@ function milestonesRaidSlice({ get, write }) {
27610
28057
  return {
27611
28058
  toggleMilestone: (id) => {
27612
28059
  if (get().milestones.find((m) => m.id === id)?.approverId) return;
27613
- write({ milestones: get().milestones.map((m) => m.id === id ? {
27614
- ...m,
27615
- done: !m.done
27616
- } : m) });
28060
+ write({ milestones: get().milestones.map((m) => m.id === id ? stampDone(m, { done: !m.done }) : m) });
27617
28061
  },
27618
28062
  addMilestone: (m) => {
27619
28063
  const id = uid("ms");
@@ -27625,10 +28069,7 @@ function milestonesRaidSlice({ get, write }) {
27625
28069
  return id;
27626
28070
  },
27627
28071
  updateMilestone: (id, patch) => {
27628
- write({ milestones: get().milestones.map((m) => m.id === id ? {
27629
- ...m,
27630
- ...patch
27631
- } : m) });
28072
+ write({ milestones: get().milestones.map((m) => m.id === id ? stampDone(m, patch) : m) });
27632
28073
  },
27633
28074
  deleteMilestone: (id) => {
27634
28075
  write({ milestones: get().milestones.filter((m) => m.id !== id) });
@@ -28043,6 +28484,7 @@ var init_milestones_raid = __esmMin((() => {
28043
28484
  init_raid_history();
28044
28485
  init_passage();
28045
28486
  init_format();
28487
+ init_milestone_edits();
28046
28488
  init_project_messages();
28047
28489
  init_utils();
28048
28490
  init_shared();
package/lib/cli.mjs CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  messagesText,
37
37
  charterText,
38
38
  landfallText,
39
+ loadLineCliText,
39
40
  daysText,
40
41
  soundingText,
41
42
  lifeboatsText,
@@ -315,6 +316,10 @@ export const HELP = `harbor: Harbor from the terminal
315
316
  harbor approvals tasks waiting on your approval
316
317
  harbor field TASK NAME VALUE set one of the project's own
317
318
  fields on a task ("" clears it)
319
+ harbor load [--program NAME] who is past their load line: work
320
+ due in the next 3 weeks against
321
+ what each person (or a program's
322
+ crew) can close
318
323
  harbor ashore [--weeks N] [--country CODES|none] [--person NAME]
319
324
  public holidays and time away
320
325
  coming up, and whose holidays
@@ -1140,6 +1145,18 @@ const DETAIL = {
1140
1145
  " everyone has. Close guesses give the task an estimate; far-apart ones",
1141
1146
  " say talk first. The forecast draws on every answer.",
1142
1147
  ],
1148
+ load: [
1149
+ " harbor load each person's load line: open tasks",
1150
+ " due in the next 3 weeks (and any",
1151
+ " late) against what they can close,",
1152
+ " worst first; ▼ marks past the line",
1153
+ " harbor load --program NAME also the program's line: the crew",
1154
+ " time promised to it against its work",
1155
+ "",
1156
+ " What someone can close is their tasks a week (People, Per week; 5 unless",
1157
+ " set), less weekdays off for holidays and time away (harbor ashore).",
1158
+ " Tasks with no due date aren't counted, but are said.",
1159
+ ],
1143
1160
  ashore: [
1144
1161
  " harbor ashore [--weeks N] reads: holidays and time away in the",
1145
1162
  " next N weeks (8 unless you say)",
@@ -3015,7 +3032,8 @@ export async function run(argv, io = {}) {
3015
3032
  const programs = r.programs.filter((p) => nameHas(p.name, words));
3016
3033
  const names = new Set(programs.map((p) => p.name));
3017
3034
  const blankCharters = (r.blankCharters ?? []).filter((b) => names.has(b.program));
3018
- return { ...r, programs, blankCharters };
3035
+ const hullCheck = (r.hullCheck ?? []).filter((h) => names.has(h.program));
3036
+ return { ...r, programs, blankCharters, hullCheck, steadyHands: [] };
3019
3037
  },
3020
3038
  );
3021
3039
  }
@@ -3917,6 +3935,15 @@ export async function run(argv, io = {}) {
3917
3935
  goalsText(r),
3918
3936
  );
3919
3937
  }
3938
+ case "load": {
3939
+ const { positionals, values, harbor } = parse(spec([], ["program"]));
3940
+ none(positionals);
3941
+ return call(
3942
+ "load_line",
3943
+ { harbor, ...(values.program ? { program: values.program } : {}) },
3944
+ (r) => loadLineCliText(r),
3945
+ );
3946
+ }
3920
3947
  case "ashore": {
3921
3948
  const { positionals, values, harbor } = parse(spec([], ["weeks", "country", "person"]));
3922
3949
  none(positionals);
package/lib/format.mjs CHANGED
@@ -392,6 +392,22 @@ export function reviewList(r) {
392
392
  if (blank.length > 8) out.push(` and ${blank.length - 8} more`);
393
393
  out.push(' harbor charter "PROJECT" --why "…" writes one.');
394
394
  }
395
+ const hull = r.hullCheck ?? [];
396
+ if (hull.length) {
397
+ out.push("", "Hull check: health set by hand better than the work says, three weeks or more:");
398
+ for (const h of hull.slice(0, 8)) {
399
+ out.push(` ${h.project}${h.owner ? ` (${h.owner})` : ""}`);
400
+ out.push(` ${h.text}${h.note ? ` “${h.note}”` : ""}`);
401
+ }
402
+ if (hull.length > 8) out.push(` and ${hull.length - 8} more`);
403
+ out.push(' harbor health auto --project "PROJECT" lets the numbers speak.');
404
+ }
405
+ const steady = r.steadyHands ?? [];
406
+ if (steady.length)
407
+ out.push(
408
+ "",
409
+ `Steady hand${steady.length === 1 ? "" : "s"}: ${steady.join(", ")}. Their calls by hand over three months matched the work, or warned early.`,
410
+ );
395
411
  return out.join("\n") + more;
396
412
  }
397
413
 
@@ -828,6 +844,31 @@ export function charterText(r) {
828
844
  return lines.join("\n");
829
845
  }
830
846
 
847
+ /** load_line as the terminal prints it: each person against their line, worst first. */
848
+ export function loadLineCliText(r) {
849
+ const lines = [`Load line · the next ${r.weeks} weeks`];
850
+ if (r.program) {
851
+ lines.push(
852
+ r.program.line
853
+ ? ` ${r.program.name}: ${r.program.line.text}${r.program.line.unheld ? ` ${r.program.line.unheld} nobody holds yet.` : ""}`
854
+ : ` ${r.program.name}: nobody's time is promised to it yet, so it has no line. Set crew time on People.`,
855
+ "",
856
+ );
857
+ }
858
+ if (!r.people?.length) {
859
+ lines.push(" Nobody on the crew yet.");
860
+ return lines.join("\n");
861
+ }
862
+ const width = Math.max(...r.people.map((p) => p.who.length));
863
+ for (const p of r.people) {
864
+ const mark = p.over > 0 ? "▼" : " ";
865
+ lines.push(`${mark} ${p.who.padEnd(width)} ${p.text}`);
866
+ }
867
+ const over = r.people.filter((p) => p.over > 0).length;
868
+ if (over > 0) lines.push("", `${over} past the line (▼).`);
869
+ return lines.join("\n");
870
+ }
871
+
831
872
  const LANDFALL_RESULT = { yes: "Paid off", partly: "Partly", no: "Didn't" };
832
873
 
833
874
  /** A project's landfall as get_project, set_landfall or answer_landfall gives it. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.100.0",
3
+ "version": "0.102.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",