@harborppm/cli 0.101.0 → 0.103.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/README.md +2 -1
- package/dist/app.mjs +419 -27
- package/lib/cli.mjs +190 -6
- package/lib/format.mjs +81 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -216,6 +216,7 @@ harbor import FILE [--project P] [--portfolio P] [--no-people]
|
|
|
216
216
|
harbor premortem PROJECT ["WHAT WENT WRONG"] [--start]
|
|
217
217
|
harbor voyage PROJECT ["YOUR LINE"]
|
|
218
218
|
harbor messages PROJECT ["TEXT"] [--limit N] | messages PROJECT --edit "TEXT" [--message ID]
|
|
219
|
+
harbor chat TASK|PROJECT|PROGRAM ["TEXT"] [--reply N] [--watch]
|
|
219
220
|
harbor note PROJECT ["NOTE"] [--opens DATE|--milestone NAME|--off-track]
|
|
220
221
|
harbor sound TASK [--answer DAYS|--ask NAMES|--settle DAYS] [--why TEXT]
|
|
221
222
|
harbor soundings [PROJECT]
|
|
@@ -269,7 +270,7 @@ A task has one owner (`--assignee`), who answers for it and whose load it counts
|
|
|
269
270
|
|
|
270
271
|
`harbor limit RR` prints how many tasks each of a board's columns takes at once; `harbor limit RR doing 8` changes one (1 to 20, or `none` for no limit), if you own the harbor. `harbor projects --json` carries each board's `limits` too.
|
|
271
272
|
|
|
272
|
-
`harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor messages PROJECT` reads a project's Messages tab, one conversation for the whole project, and `harbor messages PROJECT "TEXT"` writes to it; `@Name` sends it to that person's Inbox. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor goals` lists each portfolio's goals, off track first, with each key result's progress. `harbor goal "TITLE" --new` sets one, and `harbor goal "GOAL"` reads or changes one: `--owner`, `--due`, `--why`, `--link "Ridge Runner"` to count a program, project or task toward it, `--kr "Stores signed" --target 40` to add a number key result and `--kr "Stores signed" --at 12` to move it. `harbor milestones` lists a program's milestones soonest first, with how many of their tasks are done, who signs them off and what they wait on; `harbor milestone "NAME" --new --program P --due DATE` adds one, and `harbor milestone "NAME"` moves (`--due`), renames, ticks (`--reached`), sets who signs it off (`--signs-off`), or, if it's yours to sign, `--approve`s it or asks for `--changes`. `harbor reports` prints the Reports page's dashboards, each chart as its numbers. `harbor messages PROJECT --edit "TEXT"` fixes your latest message there. `harbor ashore` lists the public holidays and time away in the next eight weeks; `--country US,GB` sets whose holidays the harbor takes and `--person NAME --country DE` one person's own, which the forecast and the weekly load then count as days off.
|
|
273
|
+
`harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor messages PROJECT` reads a project's Messages tab, one conversation for the whole project, and `harbor messages PROJECT "TEXT"` writes to it; `@Name` sends it to that person's Inbox. `harbor chat` is the same for any piece of work: `harbor chat RR-42` reads a task's comments, `harbor chat Footwear` a program's messages, `harbor chat Footwear "TEXT" --reply 2` replies under message [2], and `--watch` follows the conversation live, printing new lines as they come; in a terminal, type a line to post it. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor goals` lists each portfolio's goals, off track first, with each key result's progress. `harbor goal "TITLE" --new` sets one, and `harbor goal "GOAL"` reads or changes one: `--owner`, `--due`, `--why`, `--link "Ridge Runner"` to count a program, project or task toward it, `--kr "Stores signed" --target 40` to add a number key result and `--kr "Stores signed" --at 12` to move it. `harbor milestones` lists a program's milestones soonest first, with how many of their tasks are done, who signs them off and what they wait on; `harbor milestone "NAME" --new --program P --due DATE` adds one, and `harbor milestone "NAME"` moves (`--due`), renames, ticks (`--reached`), sets who signs it off (`--signs-off`), or, if it's yours to sign, `--approve`s it or asks for `--changes`. `harbor reports` prints the Reports page's dashboards, each chart as its numbers. `harbor messages PROJECT --edit "TEXT"` fixes your latest message there. `harbor ashore` lists the public holidays and time away in the next eight weeks; `--country US,GB` sets whose holidays the harbor takes and `--person NAME --country DE` one person's own, which the forecast and the weekly load then count as days off.
|
|
273
274
|
|
|
274
275
|
`harbor brief --say` turns the brief into the BBC's Shipping Forecast: each program an area, wind for late work, visibility for health, gale warnings for anything off track. It prints the forecast and speaks it with your computer's own voice (`say` on a Mac, Windows' speech, or `espeak-ng` on Linux, which you may need to install). With `--json` it prints the forecast and stays quiet.
|
|
275
276
|
|
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();
|
|
@@ -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$
|
|
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$
|
|
2845
|
+
].map((i) => iso$5(addDays(d, i)));
|
|
2831
2846
|
}
|
|
2832
2847
|
function shiftWeek(monday, weeks) {
|
|
2833
|
-
return iso$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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)],
|
|
@@ -6903,6 +6918,28 @@ function messagesIn(reflections, place) {
|
|
|
6903
6918
|
return (reflections ?? []).filter((r) => inPlace(r, place)).sort(oldestFirst);
|
|
6904
6919
|
}
|
|
6905
6920
|
/**
|
|
6921
|
+
* A conversation as threads, in the order each began. An answer whose
|
|
6922
|
+
* message was deleted stands on its own, so nobody's words go missing.
|
|
6923
|
+
*/
|
|
6924
|
+
function threadsOf(messages) {
|
|
6925
|
+
const sorted = [...messages].sort(oldestFirst);
|
|
6926
|
+
const byId = new Map(sorted.map((m) => [m.id, m]));
|
|
6927
|
+
const rootOf = (m) => {
|
|
6928
|
+
const parent = m.replyToId ? byId.get(m.replyToId) : void 0;
|
|
6929
|
+
return parent && parent.id !== m.id && !parent.replyToId ? parent.id : null;
|
|
6930
|
+
};
|
|
6931
|
+
const threads = /* @__PURE__ */ new Map();
|
|
6932
|
+
for (const m of sorted) if (!rootOf(m)) threads.set(m.id, {
|
|
6933
|
+
message: m,
|
|
6934
|
+
replies: []
|
|
6935
|
+
});
|
|
6936
|
+
for (const m of sorted) {
|
|
6937
|
+
const root = rootOf(m);
|
|
6938
|
+
if (root) threads.get(root).replies.push(m);
|
|
6939
|
+
}
|
|
6940
|
+
return [...threads.values()];
|
|
6941
|
+
}
|
|
6942
|
+
/**
|
|
6906
6943
|
* The message an answer hangs under: the one asked for, or, for an answer
|
|
6907
6944
|
* to an answer, that answer's own message. Null when it isn't a message in
|
|
6908
6945
|
* the same conversation.
|
|
@@ -9580,7 +9617,7 @@ function programIsBlocked(data, program) {
|
|
|
9580
9617
|
}
|
|
9581
9618
|
function daysOverdue(dueDate, now) {
|
|
9582
9619
|
if (!dueDate) return 0;
|
|
9583
|
-
const today = iso$
|
|
9620
|
+
const today = iso$3(now);
|
|
9584
9621
|
if (today !== overdueDay) {
|
|
9585
9622
|
overdueDay = today;
|
|
9586
9623
|
overdueByDue.clear();
|
|
@@ -9599,7 +9636,7 @@ function daysOverdue(dueDate, now) {
|
|
|
9599
9636
|
}
|
|
9600
9637
|
function daysUntil$1(date, now) {
|
|
9601
9638
|
if (!date) return null;
|
|
9602
|
-
const today = iso$
|
|
9639
|
+
const today = iso$3(now);
|
|
9603
9640
|
if (today !== untilDay) {
|
|
9604
9641
|
untilDay = today;
|
|
9605
9642
|
untilByDate.clear();
|
|
@@ -9664,7 +9701,7 @@ function effectiveProjectHealth(project, data, now) {
|
|
|
9664
9701
|
}
|
|
9665
9702
|
/** Milestones past their date and still open. */
|
|
9666
9703
|
function lateMilestonesOf(milestones, now) {
|
|
9667
|
-
const today = iso$
|
|
9704
|
+
const today = iso$3(now);
|
|
9668
9705
|
return milestones.filter((m) => !m.done && m.dueDate < today);
|
|
9669
9706
|
}
|
|
9670
9707
|
/**
|
|
@@ -9789,7 +9826,7 @@ function programLateCount(programId, data, now) {
|
|
|
9789
9826
|
for (const p of data.projects) if (p.programId === programId) late += lateTasksOf([...tasksOf(data.tasks, p.id)], now).length;
|
|
9790
9827
|
return late;
|
|
9791
9828
|
}
|
|
9792
|
-
var iso$
|
|
9829
|
+
var iso$3, overdueDay, overdueByDue, untilDay, untilByDate;
|
|
9793
9830
|
var init_derived_health = __esmMin((() => {
|
|
9794
9831
|
init_date_fns();
|
|
9795
9832
|
init_date_text();
|
|
@@ -9797,7 +9834,7 @@ var init_derived_health = __esmMin((() => {
|
|
|
9797
9834
|
init_indexes();
|
|
9798
9835
|
init_health_history();
|
|
9799
9836
|
init_clock();
|
|
9800
|
-
iso$
|
|
9837
|
+
iso$3 = (d) => {
|
|
9801
9838
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
9802
9839
|
};
|
|
9803
9840
|
overdueDay = "";
|
|
@@ -12926,13 +12963,13 @@ function InboxView({ active, width, height, go }) {
|
|
|
12926
12963
|
/** Open tasks for one person, bucketed by the week they are due, plus what is already late or has no date. */
|
|
12927
12964
|
function weeklyLoad(tasks, personId, now, weeks = 6, calendar) {
|
|
12928
12965
|
const mine = tasks.filter((t) => t.assigneeId === personId && t.status !== "done");
|
|
12929
|
-
const today = iso$
|
|
12966
|
+
const today = iso$2(now);
|
|
12930
12967
|
const origin = startOfWeek(now, { weekStartsOn: 1 });
|
|
12931
12968
|
const buckets = Array.from({ length: weeks }, (_, i) => {
|
|
12932
|
-
const start = iso$
|
|
12969
|
+
const start = iso$2(addDays(origin, i * 7));
|
|
12933
12970
|
const off = [];
|
|
12934
12971
|
if (calendar?.active) for (let d = 0; d < 5; d++) {
|
|
12935
|
-
const date = iso$
|
|
12972
|
+
const date = iso$2(addDays(origin, i * 7 + d));
|
|
12936
12973
|
const why = calendar.offOn(personId, date);
|
|
12937
12974
|
if (why) off.push({
|
|
12938
12975
|
date,
|
|
@@ -12967,10 +13004,19 @@ function weeklyLoad(tasks, personId, now, weeks = 6, calendar) {
|
|
|
12967
13004
|
weeks: buckets
|
|
12968
13005
|
};
|
|
12969
13006
|
}
|
|
12970
|
-
|
|
13007
|
+
/** A week's capacity, less the weekdays someone is off: 5 a week with two days off is 3. */
|
|
13008
|
+
function weekCapacity(capacity, workDays) {
|
|
13009
|
+
return Math.round(capacity * Math.max(0, Math.min(5, workDays)) / 5 * 10) / 10;
|
|
13010
|
+
}
|
|
13011
|
+
/** Capacity a person has for one program, given the share of their week promised to it. */
|
|
13012
|
+
function allocatedCapacity(weeklyCapacity, percent) {
|
|
13013
|
+
return Math.max(0, Math.round((weeklyCapacity ?? 5) * percent / 100 * 10) / 10);
|
|
13014
|
+
}
|
|
13015
|
+
var DEFAULT_WEEKLY_CAPACITY, iso$2;
|
|
12971
13016
|
var init_load = __esmMin((() => {
|
|
12972
13017
|
init_date_fns();
|
|
12973
|
-
|
|
13018
|
+
DEFAULT_WEEKLY_CAPACITY = 5;
|
|
13019
|
+
iso$2 = (d) => {
|
|
12974
13020
|
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
12975
13021
|
};
|
|
12976
13022
|
}));
|
|
@@ -16146,6 +16192,158 @@ function dueFrom(value, now) {
|
|
|
16146
16192
|
throw new CommandError(`Can't read the date "${value}". Try today, fri, +3 or 2026-11-02.`);
|
|
16147
16193
|
}
|
|
16148
16194
|
|
|
16195
|
+
// src/lib/load-line.ts
|
|
16196
|
+
init_date_fns();
|
|
16197
|
+
init_load();
|
|
16198
|
+
init_indexes();
|
|
16199
|
+
/** The weeks a load line looks at: this one and the two after. */
|
|
16200
|
+
const LOAD_LINE_WEEKS = 3;
|
|
16201
|
+
const iso$1 = (d) => {
|
|
16202
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
16203
|
+
};
|
|
16204
|
+
/** The window: today, and the last day of the last week looked at (a Sunday). */
|
|
16205
|
+
function loadWindow(now, weeks = 3) {
|
|
16206
|
+
const monday = startOfWeek(now, { weekStartsOn: 1 });
|
|
16207
|
+
return {
|
|
16208
|
+
today: iso$1(now),
|
|
16209
|
+
monday,
|
|
16210
|
+
end: iso$1(addDays(monday, weeks * 7 - 1))
|
|
16211
|
+
};
|
|
16212
|
+
}
|
|
16213
|
+
/**
|
|
16214
|
+
* Weekdays a person is off in the window, by week: from the harbor's
|
|
16215
|
+
* calendar when given (holidays and time away), else their time away alone,
|
|
16216
|
+
* so a picker that doesn't load the holiday rules still sees someone away.
|
|
16217
|
+
*/
|
|
16218
|
+
function offByWeek(calendar, person, monday, weeks) {
|
|
16219
|
+
const away = person.away?.until && person.away.since ? [person.away.since.slice(0, 10), person.away.until.slice(0, 10)] : null;
|
|
16220
|
+
return Array.from({ length: weeks }, (_, w) => {
|
|
16221
|
+
let off = 0;
|
|
16222
|
+
for (let d = 0; d < 5; d++) {
|
|
16223
|
+
const day = iso$1(addDays(monday, w * 7 + d));
|
|
16224
|
+
if (calendar?.active) {
|
|
16225
|
+
if (calendar.offOn(person.id, day)) off += 1;
|
|
16226
|
+
} else if (away && day >= away[0] && day < away[1]) off += 1;
|
|
16227
|
+
}
|
|
16228
|
+
return off;
|
|
16229
|
+
});
|
|
16230
|
+
}
|
|
16231
|
+
function line(cargo, late, capacity, daysOff, undated) {
|
|
16232
|
+
const ratio = cargo === 0 ? 0 : capacity <= 0 ? Number.POSITIVE_INFINITY : cargo / capacity;
|
|
16233
|
+
const tenth = (n) => Math.round(n * 10) / 10;
|
|
16234
|
+
return {
|
|
16235
|
+
cargo,
|
|
16236
|
+
late,
|
|
16237
|
+
capacity: tenth(capacity),
|
|
16238
|
+
ratio,
|
|
16239
|
+
over: tenth(Math.max(0, cargo - capacity)),
|
|
16240
|
+
room: tenth(Math.max(0, capacity - cargo)),
|
|
16241
|
+
daysOff,
|
|
16242
|
+
undated
|
|
16243
|
+
};
|
|
16244
|
+
}
|
|
16245
|
+
/** Count a person's open work: late, due in the window, and undated. */
|
|
16246
|
+
function countWork(tasks, today, end) {
|
|
16247
|
+
let late = 0;
|
|
16248
|
+
let due = 0;
|
|
16249
|
+
let undated = 0;
|
|
16250
|
+
for (const t of tasks) {
|
|
16251
|
+
if (t.status === "done") continue;
|
|
16252
|
+
const d = t.dueDate?.slice(0, 10);
|
|
16253
|
+
if (!d) undated += 1;
|
|
16254
|
+
else if (d < today) late += 1;
|
|
16255
|
+
else if (d <= end) due += 1;
|
|
16256
|
+
}
|
|
16257
|
+
return {
|
|
16258
|
+
late,
|
|
16259
|
+
due,
|
|
16260
|
+
undated
|
|
16261
|
+
};
|
|
16262
|
+
}
|
|
16263
|
+
/**
|
|
16264
|
+
* One person's load line. Null for an agent on the crew: an app has no
|
|
16265
|
+
* week to fill.
|
|
16266
|
+
*/
|
|
16267
|
+
function personLoadLine(data, person, now, calendar, weeks = 3) {
|
|
16268
|
+
if (person.kind === "agent") return null;
|
|
16269
|
+
const { today, monday, end } = loadWindow(now, weeks);
|
|
16270
|
+
const { late, due, undated } = countWork(openTasksByAssignee(data.tasks).get(person.id) ?? [], today, end);
|
|
16271
|
+
const pace = person.weeklyCapacity ?? 5;
|
|
16272
|
+
const off = offByWeek(calendar, person, monday, weeks);
|
|
16273
|
+
const capacity = off.reduce((sum, o) => sum + weekCapacity(pace, 5 - o), 0);
|
|
16274
|
+
return line(late + due, late, capacity, off.reduce((a, b) => a + b, 0), undated);
|
|
16275
|
+
}
|
|
16276
|
+
/**
|
|
16277
|
+
* A program's load line: the crew time promised to it against its open
|
|
16278
|
+
* work in the window. Null while nobody's time is promised to it, since
|
|
16279
|
+
* there's no line to draw.
|
|
16280
|
+
*/
|
|
16281
|
+
function programLoadLine(data, programId, now, calendar, weeks = 3) {
|
|
16282
|
+
const { today, monday, end } = loadWindow(now, weeks);
|
|
16283
|
+
let capacity = 0;
|
|
16284
|
+
let daysOff = 0;
|
|
16285
|
+
let crew = 0;
|
|
16286
|
+
for (const p of data.people) {
|
|
16287
|
+
if (p.kind === "agent") continue;
|
|
16288
|
+
const share = p.allocations?.find((a) => a.programId === programId)?.percent ?? 0;
|
|
16289
|
+
if (share <= 0) continue;
|
|
16290
|
+
crew += 1;
|
|
16291
|
+
const pace = allocatedCapacity(p.weeklyCapacity, share);
|
|
16292
|
+
const off = offByWeek(calendar, p, monday, weeks);
|
|
16293
|
+
for (const o of off) capacity += weekCapacity(pace, 5 - o);
|
|
16294
|
+
daysOff += off.reduce((a, b) => a + b, 0);
|
|
16295
|
+
}
|
|
16296
|
+
if (crew === 0) return null;
|
|
16297
|
+
let late = 0;
|
|
16298
|
+
let due = 0;
|
|
16299
|
+
let undated = 0;
|
|
16300
|
+
let unheld = 0;
|
|
16301
|
+
for (const project of data.projects) {
|
|
16302
|
+
if (project.programId !== programId || project.health === "done") continue;
|
|
16303
|
+
for (const t of tasksOf(data.tasks, project.id)) {
|
|
16304
|
+
if (t.status === "done") continue;
|
|
16305
|
+
const d = t.dueDate?.slice(0, 10);
|
|
16306
|
+
if (!d) {
|
|
16307
|
+
undated += 1;
|
|
16308
|
+
continue;
|
|
16309
|
+
}
|
|
16310
|
+
if (d > end) continue;
|
|
16311
|
+
if (d < today) late += 1;
|
|
16312
|
+
else due += 1;
|
|
16313
|
+
if (!t.assigneeId) unheld += 1;
|
|
16314
|
+
}
|
|
16315
|
+
}
|
|
16316
|
+
return {
|
|
16317
|
+
...line(late + due, late, capacity, daysOff, undated),
|
|
16318
|
+
unheld
|
|
16319
|
+
};
|
|
16320
|
+
}
|
|
16321
|
+
const tasksWord = (n) => `${n} task${n === 1 ? "" : "s"}`;
|
|
16322
|
+
/**
|
|
16323
|
+
* "Past the line by 3 tasks: 11 due in the next 3 weeks (2 late), room for 8.",
|
|
16324
|
+
* or "Room for 4 more in the next 3 weeks (8 of 12)." Said the same in a tooltip,
|
|
16325
|
+
* the terminal and for agents.
|
|
16326
|
+
*/
|
|
16327
|
+
function loadLineText(l, weeks = 3) {
|
|
16328
|
+
const span = `the next ${weeks} weeks`;
|
|
16329
|
+
const lateBit = l.late ? ` (${l.late} late)` : "";
|
|
16330
|
+
if (l.cargo === 0) return l.capacity > 0 ? `Nothing due in ${span}.` : `Nothing due, and off for ${span}.`;
|
|
16331
|
+
if (l.capacity <= 0) return `${tasksWord(l.cargo)} due in ${span}${lateBit}, with no room: off the whole time.`;
|
|
16332
|
+
if (l.over > 0) return `Past the line by ${tasksWord(l.over)}: ${l.cargo} due in ${span}${lateBit}, room for ${l.capacity}.`;
|
|
16333
|
+
if (l.room === 0) return `At the line: ${l.cargo} due in ${span}${lateBit}, room for ${l.capacity}.`;
|
|
16334
|
+
return `Room for ${tasksWord(l.room)} more in ${span}: ${l.cargo} of ${l.capacity}${lateBit}.`;
|
|
16335
|
+
}
|
|
16336
|
+
/** Everyone's line, worst first: the people page's order when it sorts by load. */
|
|
16337
|
+
function crewLoadLines(data, now, calendar) {
|
|
16338
|
+
return data.people.flatMap((person) => {
|
|
16339
|
+
const l = personLoadLine(data, person, now, calendar);
|
|
16340
|
+
return l ? [{
|
|
16341
|
+
person,
|
|
16342
|
+
line: l
|
|
16343
|
+
}] : [];
|
|
16344
|
+
}).sort((a, b) => b.line.ratio - a.line.ratio || b.line.cargo - a.line.cargo);
|
|
16345
|
+
}
|
|
16346
|
+
|
|
16149
16347
|
// src/lib/dry-dock.ts
|
|
16150
16348
|
init_date_fns();
|
|
16151
16349
|
init_format();
|
|
@@ -16382,7 +16580,9 @@ function dockCompare(data, projectId, changes, now) {
|
|
|
16382
16580
|
person,
|
|
16383
16581
|
capacity: person.weeklyCapacity ?? 5,
|
|
16384
16582
|
real: weeklyLoad(data.tasks, id, now),
|
|
16385
|
-
docked: weeklyLoad(plan.allTasks, id, now)
|
|
16583
|
+
docked: weeklyLoad(plan.allTasks, id, now),
|
|
16584
|
+
realLine: personLoadLine(data, person, now),
|
|
16585
|
+
dockedLine: personLoadLine({ tasks: plan.allTasks }, person, now)
|
|
16386
16586
|
});
|
|
16387
16587
|
}
|
|
16388
16588
|
load.sort((x, y) => x.person.name.localeCompare(y.person.name));
|
|
@@ -24093,6 +24293,128 @@ function notesOf(ctx, p) {
|
|
|
24093
24293
|
};
|
|
24094
24294
|
}) };
|
|
24095
24295
|
}
|
|
24296
|
+
const CHAT_KINDS = [
|
|
24297
|
+
"task",
|
|
24298
|
+
"project",
|
|
24299
|
+
"program"
|
|
24300
|
+
];
|
|
24301
|
+
const exactlyNamed = (items, want) => {
|
|
24302
|
+
const w = want.trim().toLowerCase();
|
|
24303
|
+
return items.filter((i) => i.id === want.trim() || i.name.trim().toLowerCase() === w || i.key?.toLowerCase() === w);
|
|
24304
|
+
};
|
|
24305
|
+
/**
|
|
24306
|
+
* The chat `on` names: a task by key or id, a project, or a program, by name,
|
|
24307
|
+
* key or id. With no `kind`, a task key wins, then an exact project or
|
|
24308
|
+
* program name, then the nearest project name, then the nearest program's.
|
|
24309
|
+
* A project and a program with the very same name need `kind`.
|
|
24310
|
+
*/
|
|
24311
|
+
function chatTarget(data, on, kind) {
|
|
24312
|
+
const asTask = (t) => {
|
|
24313
|
+
const project = data.projects.find((p) => p.id === t.projectId);
|
|
24314
|
+
return {
|
|
24315
|
+
kind: "task",
|
|
24316
|
+
task: t,
|
|
24317
|
+
name: t.title,
|
|
24318
|
+
key: taskKey(t, project) ?? null,
|
|
24319
|
+
project: project?.name ?? null
|
|
24320
|
+
};
|
|
24321
|
+
};
|
|
24322
|
+
const asProject = (p) => ({
|
|
24323
|
+
kind: "project",
|
|
24324
|
+
place: {
|
|
24325
|
+
kind: "project",
|
|
24326
|
+
id: p.id
|
|
24327
|
+
},
|
|
24328
|
+
name: p.name
|
|
24329
|
+
});
|
|
24330
|
+
const asProgram = (p) => ({
|
|
24331
|
+
kind: "program",
|
|
24332
|
+
place: {
|
|
24333
|
+
kind: "program",
|
|
24334
|
+
id: p.id
|
|
24335
|
+
},
|
|
24336
|
+
name: p.name
|
|
24337
|
+
});
|
|
24338
|
+
if (kind === "task") return asTask(taskByRef(data, on));
|
|
24339
|
+
if (kind === "project") return asProject(findOne(data.projects, on, "project"));
|
|
24340
|
+
if (kind === "program") return asProgram(findOne(data.programs, on, "program"));
|
|
24341
|
+
const task = data.tasks.find((x) => x.id === on.trim()) ?? findByKey(data, on);
|
|
24342
|
+
if (task) return asTask(task);
|
|
24343
|
+
const projects = exactlyNamed(data.projects, on);
|
|
24344
|
+
const programs = exactlyNamed(data.programs, on);
|
|
24345
|
+
if (projects.length && programs.length) throw new ToolError(`A project and a program are both called "${on.trim()}". Say which: kind project or kind program.`);
|
|
24346
|
+
if (programs.length && !projects.length) return asProgram(findOne(data.programs, on, "program"));
|
|
24347
|
+
try {
|
|
24348
|
+
return asProject(findOne(data.projects, on, "project"));
|
|
24349
|
+
} catch (err) {
|
|
24350
|
+
if (!(err instanceof ToolError) || !/^No project matches/.test(err.message)) throw err;
|
|
24351
|
+
}
|
|
24352
|
+
try {
|
|
24353
|
+
return asProgram(findOne(data.programs, on, "program"));
|
|
24354
|
+
} catch (err) {
|
|
24355
|
+
if (!(err instanceof ToolError) || !/^No program matches/.test(err.message)) throw err;
|
|
24356
|
+
throw new ToolError(`Nothing to chat on called "${on.trim()}": no task key, project or program matches. Try a task key like RR-42, or a project's or program's name.`);
|
|
24357
|
+
}
|
|
24358
|
+
}
|
|
24359
|
+
/** Every line of a chat, oldest first: a task's comments, or a conversation's messages with their numbers. */
|
|
24360
|
+
function chatLines(data, target) {
|
|
24361
|
+
if (target.kind === "task") return data.comments.filter((c) => c.taskId === target.task.id).sort((a, b) => a.createdAt.localeCompare(b.createdAt)).map((c, i) => ({
|
|
24362
|
+
id: c.id,
|
|
24363
|
+
n: i + 1,
|
|
24364
|
+
authorId: c.authorId,
|
|
24365
|
+
body: c.body,
|
|
24366
|
+
at: c.createdAt,
|
|
24367
|
+
editedAt: c.editedAt ?? null,
|
|
24368
|
+
mentionedIds: c.mentionedIds ?? []
|
|
24369
|
+
}));
|
|
24370
|
+
const threads = threadsOf(messagesIn(data.reflections, target.place));
|
|
24371
|
+
const number = new Map(threads.map((t, i) => [t.message.id, i + 1]));
|
|
24372
|
+
const lines = [];
|
|
24373
|
+
for (const t of threads) for (const m of [t.message, ...t.replies]) {
|
|
24374
|
+
const root = m === t.message ? null : t.message.id;
|
|
24375
|
+
lines.push({
|
|
24376
|
+
id: m.id,
|
|
24377
|
+
...root ? { replyTo: {
|
|
24378
|
+
id: root,
|
|
24379
|
+
n: number.get(root)
|
|
24380
|
+
} } : { n: number.get(m.id) },
|
|
24381
|
+
authorId: m.authorId,
|
|
24382
|
+
body: m.body,
|
|
24383
|
+
at: m.createdAt,
|
|
24384
|
+
editedAt: m.editedAt ?? null,
|
|
24385
|
+
mentionedIds: m.mentionedIds ?? []
|
|
24386
|
+
});
|
|
24387
|
+
}
|
|
24388
|
+
return lines.sort((a, b) => a.at.localeCompare(b.at));
|
|
24389
|
+
}
|
|
24390
|
+
/** A chat as the tools give it back: where, and each line with names for ids. */
|
|
24391
|
+
function chatAnswer(data, target, lines) {
|
|
24392
|
+
const people = byId(data.people);
|
|
24393
|
+
return {
|
|
24394
|
+
on: {
|
|
24395
|
+
kind: target.kind,
|
|
24396
|
+
name: target.name,
|
|
24397
|
+
...target.kind === "task" ? {
|
|
24398
|
+
taskId: target.task.id,
|
|
24399
|
+
...target.key ? { key: target.key } : {}
|
|
24400
|
+
} : { id: target.place.id },
|
|
24401
|
+
...target.kind === "task" && target.project ? { project: target.project } : {}
|
|
24402
|
+
},
|
|
24403
|
+
messages: lines.map((l) => ({
|
|
24404
|
+
id: l.id,
|
|
24405
|
+
...l.n ? { n: l.n } : {},
|
|
24406
|
+
from: nameOf$2(people, l.authorId),
|
|
24407
|
+
at: l.at,
|
|
24408
|
+
...l.editedAt ? { edited: l.editedAt } : {},
|
|
24409
|
+
...l.replyTo ? {
|
|
24410
|
+
replyTo: l.replyTo.n,
|
|
24411
|
+
replyToId: l.replyTo.id
|
|
24412
|
+
} : {},
|
|
24413
|
+
body: l.body,
|
|
24414
|
+
...l.mentionedIds.length ? { mentions: l.mentionedIds.map((id) => nameOf$2(people, id)) } : {}
|
|
24415
|
+
}))
|
|
24416
|
+
};
|
|
24417
|
+
}
|
|
24096
24418
|
const HARBOR_TOOLS = [
|
|
24097
24419
|
tool({
|
|
24098
24420
|
name: "harbor_overview",
|
|
@@ -25061,6 +25383,34 @@ const HARBOR_TOOLS = [
|
|
|
25061
25383
|
};
|
|
25062
25384
|
}
|
|
25063
25385
|
}),
|
|
25386
|
+
tool({
|
|
25387
|
+
name: "read_chat",
|
|
25388
|
+
title: "Read the chat on a task, project or program",
|
|
25389
|
+
description: "The conversation on one piece of work, oldest first: a task's comments (on: its key, like RR-42), a project's messages or a program's messages (on: its name). Each line has who wrote it, when, whether it was edited, who it @mentions, and its number n (messages that answer another carry replyTo, that message's number, instead). since leaves out lines written before it, for checking what's new; limit keeps the newest (default 50; more says how many earlier ones were left out). post_chat writes one." + DATA_NOTE,
|
|
25390
|
+
input: object({
|
|
25391
|
+
harbor: harborArg,
|
|
25392
|
+
on: string().min(1).max(200).describe("A task key or id, or a project's or program's name."),
|
|
25393
|
+
kind: _enum(CHAT_KINDS).optional().describe("Only when a project and a program share the name."),
|
|
25394
|
+
since: string().max(40).optional().describe("An ISO time: only lines written after it."),
|
|
25395
|
+
limit: number().int().min(1).max(500).optional()
|
|
25396
|
+
}),
|
|
25397
|
+
run: (ctx, input) => {
|
|
25398
|
+
const { data } = ctx;
|
|
25399
|
+
const target = chatTarget(data, input.on, input.kind);
|
|
25400
|
+
let lines = chatLines(data, target);
|
|
25401
|
+
if (input.since) {
|
|
25402
|
+
const since = Date.parse(input.since);
|
|
25403
|
+
if (!Number.isFinite(since)) throw new ToolError(`since takes an ISO time, not "${input.since}".`);
|
|
25404
|
+
lines = lines.filter((l) => Date.parse(l.at) > since);
|
|
25405
|
+
}
|
|
25406
|
+
const limit = input.limit ?? 50;
|
|
25407
|
+
const shown = lines.slice(-limit);
|
|
25408
|
+
return {
|
|
25409
|
+
...chatAnswer(data, target, shown),
|
|
25410
|
+
...lines.length > shown.length ? { more: lines.length - shown.length } : {}
|
|
25411
|
+
};
|
|
25412
|
+
}
|
|
25413
|
+
}),
|
|
25064
25414
|
tool({
|
|
25065
25415
|
name: "list_soundings",
|
|
25066
25416
|
title: "Soundings",
|
|
@@ -25665,6 +26015,48 @@ const HARBOR_TOOLS = [
|
|
|
25665
26015
|
};
|
|
25666
26016
|
}
|
|
25667
26017
|
}),
|
|
26018
|
+
tool({
|
|
26019
|
+
name: "load_line",
|
|
26020
|
+
title: "Who is past their load line",
|
|
26021
|
+
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,
|
|
26022
|
+
input: object({
|
|
26023
|
+
harbor: harborArg,
|
|
26024
|
+
program: string().max(200).optional().describe("Program id or name.")
|
|
26025
|
+
}),
|
|
26026
|
+
run: (ctx, input) => {
|
|
26027
|
+
const { data } = ctx;
|
|
26028
|
+
const cal = workCalendar(data);
|
|
26029
|
+
const shape = (l) => ({
|
|
26030
|
+
cargo: l.cargo,
|
|
26031
|
+
late: l.late,
|
|
26032
|
+
capacity: l.capacity,
|
|
26033
|
+
over: l.over,
|
|
26034
|
+
room: l.room,
|
|
26035
|
+
daysOff: l.daysOff,
|
|
26036
|
+
undated: l.undated,
|
|
26037
|
+
...l.unheld !== void 0 ? { unheld: l.unheld } : {},
|
|
26038
|
+
text: loadLineText(l)
|
|
26039
|
+
});
|
|
26040
|
+
const people = crewLoadLines(data, ctx.now, cal).map(({ person, line }) => ({
|
|
26041
|
+
who: person.name,
|
|
26042
|
+
...shape(line)
|
|
26043
|
+
}));
|
|
26044
|
+
if (!input.program) return {
|
|
26045
|
+
weeks: 3,
|
|
26046
|
+
people
|
|
26047
|
+
};
|
|
26048
|
+
const program = findOne(data.programs, input.program, "program");
|
|
26049
|
+
const line = programLoadLine(data, program.id, ctx.now, cal);
|
|
26050
|
+
return {
|
|
26051
|
+
weeks: 3,
|
|
26052
|
+
program: {
|
|
26053
|
+
name: program.name,
|
|
26054
|
+
line: line ? shape(line) : null
|
|
26055
|
+
},
|
|
26056
|
+
people
|
|
26057
|
+
};
|
|
26058
|
+
}
|
|
26059
|
+
}),
|
|
25668
26060
|
tool({
|
|
25669
26061
|
name: "handover_plan",
|
|
25670
26062
|
title: "What handing someone's work over would move",
|
package/lib/cli.mjs
CHANGED
|
@@ -34,8 +34,12 @@ import {
|
|
|
34
34
|
premortemText,
|
|
35
35
|
notesText,
|
|
36
36
|
messagesText,
|
|
37
|
+
chatText,
|
|
38
|
+
chatLineText,
|
|
39
|
+
chatWhere,
|
|
37
40
|
charterText,
|
|
38
41
|
landfallText,
|
|
42
|
+
loadLineCliText,
|
|
39
43
|
daysText,
|
|
40
44
|
soundingText,
|
|
41
45
|
lifeboatsText,
|
|
@@ -264,6 +268,10 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
264
268
|
harbor messages PROJECT ["TEXT"] [--limit N]
|
|
265
269
|
a project's messages, or write
|
|
266
270
|
one (@Name tells them)
|
|
271
|
+
harbor chat TASK|PROJECT|PROGRAM ["TEXT"] [--reply N] [--watch]
|
|
272
|
+
the conversation on a task,
|
|
273
|
+
project or program: read it,
|
|
274
|
+
write in it, or follow it live
|
|
267
275
|
harbor messages PROJECT --edit "TEXT" [--message ID]
|
|
268
276
|
fix your latest message (or that
|
|
269
277
|
one) in its project
|
|
@@ -315,6 +323,10 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
315
323
|
harbor approvals tasks waiting on your approval
|
|
316
324
|
harbor field TASK NAME VALUE set one of the project's own
|
|
317
325
|
fields on a task ("" clears it)
|
|
326
|
+
harbor load [--program NAME] who is past their load line: work
|
|
327
|
+
due in the next 3 weeks against
|
|
328
|
+
what each person (or a program's
|
|
329
|
+
crew) can close
|
|
318
330
|
harbor ashore [--weeks N] [--country CODES|none] [--person NAME]
|
|
319
331
|
public holidays and time away
|
|
320
332
|
coming up, and whose holidays
|
|
@@ -404,6 +416,9 @@ function banner(io, env, words) {
|
|
|
404
416
|
}
|
|
405
417
|
|
|
406
418
|
const THEMES = ["auto", "light", "dark"];
|
|
419
|
+
/** harbor chat --watch asks this often while people are talking, and slows to the most once it's quiet. */
|
|
420
|
+
const CHAT_POLL_MS = 5_000;
|
|
421
|
+
const CHAT_POLL_MAX_MS = 30_000;
|
|
407
422
|
|
|
408
423
|
const COMMON = { flags: ["json", "help"], options: ["harbor"] };
|
|
409
424
|
const spec = (flags = [], options = [], repeat = []) => ({
|
|
@@ -965,14 +980,16 @@ const DETAIL = {
|
|
|
965
980
|
" harbor shore PROGRAM --url URL writes: posts go to this Slack, Discord,",
|
|
966
981
|
" Teams or Google Chat webhook address",
|
|
967
982
|
" harbor shore PROGRAM --on KINDS writes: turns posts on; KINDS are",
|
|
968
|
-
" forecast, health and
|
|
983
|
+
" forecast, health, notes and messages,",
|
|
984
|
+
" with commas",
|
|
969
985
|
" harbor shore PROGRAM --off KINDS writes: turns them off",
|
|
970
986
|
" harbor shore PROGRAM --test writes: sends a test post",
|
|
971
987
|
" harbor shore PROGRAM --remove writes: stops posting and forgets the",
|
|
972
988
|
" address",
|
|
973
989
|
"",
|
|
974
990
|
" forecast is the morning harbor forecast, health a line when the program or",
|
|
975
|
-
" one of its projects changes health, notes a note for later when it opens
|
|
991
|
+
" one of its projects changes health, notes a note for later when it opens,",
|
|
992
|
+
" messages each new message or reply on the program or its projects.",
|
|
976
993
|
" Every post links back to Harbor. A new channel posts nothing until you turn",
|
|
977
994
|
" something on. The address is a secret: once saved, only a hint of it shows.",
|
|
978
995
|
],
|
|
@@ -1140,6 +1157,18 @@ const DETAIL = {
|
|
|
1140
1157
|
" everyone has. Close guesses give the task an estimate; far-apart ones",
|
|
1141
1158
|
" say talk first. The forecast draws on every answer.",
|
|
1142
1159
|
],
|
|
1160
|
+
load: [
|
|
1161
|
+
" harbor load each person's load line: open tasks",
|
|
1162
|
+
" due in the next 3 weeks (and any",
|
|
1163
|
+
" late) against what they can close,",
|
|
1164
|
+
" worst first; ▼ marks past the line",
|
|
1165
|
+
" harbor load --program NAME also the program's line: the crew",
|
|
1166
|
+
" time promised to it against its work",
|
|
1167
|
+
"",
|
|
1168
|
+
" What someone can close is their tasks a week (People, Per week; 5 unless",
|
|
1169
|
+
" set), less weekdays off for holidays and time away (harbor ashore).",
|
|
1170
|
+
" Tasks with no due date aren't counted, but are said.",
|
|
1171
|
+
],
|
|
1143
1172
|
ashore: [
|
|
1144
1173
|
" harbor ashore [--weeks N] reads: holidays and time away in the",
|
|
1145
1174
|
" next N weeks (8 unless you say)",
|
|
@@ -1444,6 +1473,24 @@ const DETAIL = {
|
|
|
1444
1473
|
" it explains. The weekly brief names projects that grew a lot since",
|
|
1445
1474
|
" their baseline.",
|
|
1446
1475
|
],
|
|
1476
|
+
chat: [
|
|
1477
|
+
" harbor chat RR-42 reads a task's comments",
|
|
1478
|
+
' harbor chat "Ridge Runner" reads a project\'s messages',
|
|
1479
|
+
" harbor chat Footwear reads a program's messages",
|
|
1480
|
+
' harbor chat RR-42 "TEXT" writes: comments on the task',
|
|
1481
|
+
' harbor chat Footwear "TEXT" --reply 2 writes: replies under message [2]',
|
|
1482
|
+
" harbor chat Footwear --watch follows it live: new lines print as",
|
|
1483
|
+
" they come; in a terminal, type a",
|
|
1484
|
+
' line to post it, "/r N text" to',
|
|
1485
|
+
" reply, Ctrl+C to stop",
|
|
1486
|
+
"",
|
|
1487
|
+
" A task key goes to its comments; a name to that project's messages, or",
|
|
1488
|
+
" the program's when no project has it (--project or --program says which",
|
|
1489
|
+
" when both do). Messages are numbered [1], [2]… with their replies under",
|
|
1490
|
+
" them. @Name sends it to that person's Inbox. Reading shows the newest 50;",
|
|
1491
|
+
" --limit N shows up to 500. --watch asks every 5 seconds while people are",
|
|
1492
|
+
" talking and every 30 once it's quiet.",
|
|
1493
|
+
],
|
|
1447
1494
|
messages: [
|
|
1448
1495
|
" harbor messages PROJECT reads a project's Messages tab",
|
|
1449
1496
|
' harbor messages PROJECT "TEXT" writes: posts to everyone on it',
|
|
@@ -2683,9 +2730,11 @@ export async function run(argv, io = {}) {
|
|
|
2683
2730
|
.split(",")
|
|
2684
2731
|
.map((k) => k.trim().toLowerCase())
|
|
2685
2732
|
.filter(Boolean);
|
|
2686
|
-
const bad = list.find((k) => !["forecast", "health", "notes"].includes(k));
|
|
2733
|
+
const bad = list.find((k) => !["forecast", "health", "notes", "messages"].includes(k));
|
|
2687
2734
|
if (bad || !list.length)
|
|
2688
|
-
throw new HarborError(
|
|
2735
|
+
throw new HarborError(
|
|
2736
|
+
`--${flag} takes forecast, health, notes or messages, with commas between.`,
|
|
2737
|
+
);
|
|
2689
2738
|
return list;
|
|
2690
2739
|
};
|
|
2691
2740
|
const on = kinds("on");
|
|
@@ -2725,10 +2774,11 @@ export async function run(argv, io = {}) {
|
|
|
2725
2774
|
forecast: "morning forecast",
|
|
2726
2775
|
health: "health changes",
|
|
2727
2776
|
notes: "notes when they open",
|
|
2777
|
+
messages: "messages",
|
|
2728
2778
|
};
|
|
2729
|
-
const posts = ["forecast", "health", "notes"].filter((k) => r.hook[k]).map((k) => label[k]);
|
|
2779
|
+
const posts = ["forecast", "health", "notes", "messages"].filter((k) => r.hook[k]).map((k) => label[k]);
|
|
2730
2780
|
const lines = [
|
|
2731
|
-
`${r.program} posts to ${r.hook.service} (${r.hook.hint}): ${posts.length ? posts.join(", ") : "nothing yet; --on forecast,health,notes turns posts on"}.`,
|
|
2781
|
+
`${r.program} posts to ${r.hook.service} (${r.hook.hint}): ${posts.length ? posts.join(", ") : "nothing yet; --on forecast,health,notes,messages turns posts on"}.`,
|
|
2732
2782
|
];
|
|
2733
2783
|
if (r.hook.failures > 0)
|
|
2734
2784
|
lines.push(
|
|
@@ -3918,6 +3968,15 @@ export async function run(argv, io = {}) {
|
|
|
3918
3968
|
goalsText(r),
|
|
3919
3969
|
);
|
|
3920
3970
|
}
|
|
3971
|
+
case "load": {
|
|
3972
|
+
const { positionals, values, harbor } = parse(spec([], ["program"]));
|
|
3973
|
+
none(positionals);
|
|
3974
|
+
return call(
|
|
3975
|
+
"load_line",
|
|
3976
|
+
{ harbor, ...(values.program ? { program: values.program } : {}) },
|
|
3977
|
+
(r) => loadLineCliText(r),
|
|
3978
|
+
);
|
|
3979
|
+
}
|
|
3921
3980
|
case "ashore": {
|
|
3922
3981
|
const { positionals, values, harbor } = parse(spec([], ["weeks", "country", "person"]));
|
|
3923
3982
|
none(positionals);
|
|
@@ -4041,6 +4100,131 @@ export async function run(argv, io = {}) {
|
|
|
4041
4100
|
throw new HarborError("--limit is a whole number from 1 to 500.");
|
|
4042
4101
|
return call("list_messages", { harbor, project, ...(limit ? { limit } : {}) }, messagesText);
|
|
4043
4102
|
}
|
|
4103
|
+
case "chat": {
|
|
4104
|
+
const { positionals, values, harbor } = parse(
|
|
4105
|
+
spec(["watch", "task", "project", "program"], ["limit", "reply"]),
|
|
4106
|
+
);
|
|
4107
|
+
const [on, ...words] = positionals;
|
|
4108
|
+
if (!on)
|
|
4109
|
+
throw new HarborError(
|
|
4110
|
+
'Give a task key, project or program, and a message if you\'re writing one: harbor chat RR-42 "TEXT".',
|
|
4111
|
+
);
|
|
4112
|
+
const kinds = ["task", "project", "program"].filter((k) => values[k]);
|
|
4113
|
+
if (kinds.length > 1) throw new HarborError("Say one of --task, --project or --program.");
|
|
4114
|
+
const where = { harbor, on, ...(kinds[0] ? { kind: kinds[0] } : {}) };
|
|
4115
|
+
const quoted = /\s/.test(on) ? `"${on}"` : on;
|
|
4116
|
+
const body = words.join(" ").trim();
|
|
4117
|
+
const limit = values.limit ? Number(values.limit) : undefined;
|
|
4118
|
+
if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > 500))
|
|
4119
|
+
throw new HarborError("--limit is a whole number from 1 to 500.");
|
|
4120
|
+
const post = (text, replyTo) =>
|
|
4121
|
+
client
|
|
4122
|
+
.call("post_chat", { ...where, body: text, ...(replyTo ? { replyTo } : {}) })
|
|
4123
|
+
.catch((err) => {
|
|
4124
|
+
if (err instanceof HarborError) throw new HarborError(hint(err.message));
|
|
4125
|
+
throw err;
|
|
4126
|
+
});
|
|
4127
|
+
if (body && !values.watch) {
|
|
4128
|
+
if (values.limit) throw new HarborError("--limit is for reading; leave it off when you write.");
|
|
4129
|
+
const r = await post(body, values.reply);
|
|
4130
|
+
if (asJson) {
|
|
4131
|
+
out(jsonText(r));
|
|
4132
|
+
return 0;
|
|
4133
|
+
}
|
|
4134
|
+
const m = r.posted.message;
|
|
4135
|
+
const what = m.replyTo ? `Replied to [${m.replyTo}]` : r.posted.kind === "task" ? "Commented" : `Posted [${m.n}]`;
|
|
4136
|
+
out(plain(`${what} on ${chatWhere(r.posted)}${r.mentioned?.length ? `; told ${r.mentioned.join(", ")}` : ""}.`));
|
|
4137
|
+
return 0;
|
|
4138
|
+
}
|
|
4139
|
+
if (values.reply && !body) throw new HarborError("--reply goes with the words to post.");
|
|
4140
|
+
const read = (n) => client.call("read_chat", { ...where, limit: n }).catch((err) => {
|
|
4141
|
+
if (err instanceof HarborError) throw new HarborError(hint(err.message));
|
|
4142
|
+
throw err;
|
|
4143
|
+
});
|
|
4144
|
+
if (!values.watch) {
|
|
4145
|
+
const r = await read(limit ?? 50);
|
|
4146
|
+
out(asJson ? jsonText(r) : plain(chatText(r, quoted)));
|
|
4147
|
+
return 0;
|
|
4148
|
+
}
|
|
4149
|
+
// --watch: what's there, then each new line as it comes, until Ctrl+C.
|
|
4150
|
+
// It asks every few seconds (no open connection), more slowly while
|
|
4151
|
+
// nothing's said. In a terminal, a line you type is posted; "/r N text"
|
|
4152
|
+
// replies to message N.
|
|
4153
|
+
if (asJson) throw new HarborError("--watch prints lines as they come; leave --json off.");
|
|
4154
|
+
if (body) {
|
|
4155
|
+
const r = await post(body, values.reply);
|
|
4156
|
+
out(plain(`Posted on ${chatWhere(r.posted)}.`));
|
|
4157
|
+
}
|
|
4158
|
+
const first = await read(limit ?? 20);
|
|
4159
|
+
out(plain(chatText(first, quoted)));
|
|
4160
|
+
const seen = new Set(first.messages.map((m) => m.id));
|
|
4161
|
+
const terminal = io.terminal ?? Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
4162
|
+
const sleep = io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
|
|
4163
|
+
const task = first.on.kind === "task";
|
|
4164
|
+
out(
|
|
4165
|
+
plain(
|
|
4166
|
+
terminal
|
|
4167
|
+
? `Watching ${chatWhere(first.on)}. Type a line and Enter to post${task ? "" : ', "/r N text" to reply to [N]'}; Ctrl+C stops.`
|
|
4168
|
+
: `Watching ${chatWhere(first.on)}; Ctrl+C stops.`,
|
|
4169
|
+
),
|
|
4170
|
+
);
|
|
4171
|
+
let typing = null;
|
|
4172
|
+
let stopped = false;
|
|
4173
|
+
let delay = CHAT_POLL_MS;
|
|
4174
|
+
if (terminal && (io.stdin ?? process.stdin).isTTY !== false) {
|
|
4175
|
+
const { createInterface } = await import("node:readline");
|
|
4176
|
+
typing = createInterface({ input: io.stdin ?? process.stdin, terminal: false });
|
|
4177
|
+
typing.on("close", () => {
|
|
4178
|
+
stopped = true;
|
|
4179
|
+
});
|
|
4180
|
+
typing.on("line", (line) => {
|
|
4181
|
+
const text = line.trim();
|
|
4182
|
+
if (!text) return;
|
|
4183
|
+
if (text === "/q" || text === "/quit") {
|
|
4184
|
+
typing.close();
|
|
4185
|
+
return;
|
|
4186
|
+
}
|
|
4187
|
+
const reply = /^\/r(?:eply)?\s+(\d+)\s+([\s\S]+)$/.exec(text);
|
|
4188
|
+
if (/^\/r(?:eply)?\b/.test(text) && !reply) {
|
|
4189
|
+
out('To reply: /r N text, where N is the message\'s number in [ ].');
|
|
4190
|
+
return;
|
|
4191
|
+
}
|
|
4192
|
+
post(reply ? reply[2] : text, reply ? reply[1] : undefined).then(
|
|
4193
|
+
(r) => {
|
|
4194
|
+
seen.add(r.posted.message.id);
|
|
4195
|
+
delay = CHAT_POLL_MS;
|
|
4196
|
+
out(plain(` (posted${r.posted.message.n ? ` as [${r.posted.message.n}]` : ""})`));
|
|
4197
|
+
},
|
|
4198
|
+
(err) => out(plain(` Not posted: ${err instanceof Error ? err.message : String(err)}`)),
|
|
4199
|
+
);
|
|
4200
|
+
});
|
|
4201
|
+
}
|
|
4202
|
+
let rounds = io.watchRounds ?? Infinity;
|
|
4203
|
+
try {
|
|
4204
|
+
while (!stopped && rounds-- > 0) {
|
|
4205
|
+
await sleep(delay);
|
|
4206
|
+
if (stopped) break;
|
|
4207
|
+
let r;
|
|
4208
|
+
try {
|
|
4209
|
+
r = await read(50);
|
|
4210
|
+
} catch (err) {
|
|
4211
|
+
// A dropped connection waits and tries again; anything else stops.
|
|
4212
|
+
if (err instanceof HarborError) throw err;
|
|
4213
|
+
delay = CHAT_POLL_MAX_MS;
|
|
4214
|
+
continue;
|
|
4215
|
+
}
|
|
4216
|
+
const fresh = r.messages.filter((m) => !seen.has(m.id));
|
|
4217
|
+
for (const m of fresh) {
|
|
4218
|
+
seen.add(m.id);
|
|
4219
|
+
out(plain(chatLineText(m)));
|
|
4220
|
+
}
|
|
4221
|
+
delay = fresh.length ? CHAT_POLL_MS : Math.min(CHAT_POLL_MAX_MS, Math.round(delay * 1.5));
|
|
4222
|
+
}
|
|
4223
|
+
} finally {
|
|
4224
|
+
typing?.close();
|
|
4225
|
+
}
|
|
4226
|
+
return 0;
|
|
4227
|
+
}
|
|
4044
4228
|
case "watch": {
|
|
4045
4229
|
const { positionals, values, harbor } = parse(spec(["bell", "once"], ["project", "since"]));
|
|
4046
4230
|
none(positionals);
|
package/lib/format.mjs
CHANGED
|
@@ -844,6 +844,31 @@ export function charterText(r) {
|
|
|
844
844
|
return lines.join("\n");
|
|
845
845
|
}
|
|
846
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
|
+
|
|
847
872
|
const LANDFALL_RESULT = { yes: "Paid off", partly: "Partly", no: "Didn't" };
|
|
848
873
|
|
|
849
874
|
/** A project's landfall as get_project, set_landfall or answer_landfall gives it. */
|
|
@@ -1411,6 +1436,62 @@ export function messagesText(r) {
|
|
|
1411
1436
|
].join("\n\n");
|
|
1412
1437
|
}
|
|
1413
1438
|
|
|
1439
|
+
/** Where a chat is, as its heading says it: "RR-42 Call the printer", "Ridge Runner", "Footwear (program)". */
|
|
1440
|
+
export function chatWhere(on) {
|
|
1441
|
+
if (on.kind === "task") return on.key ? `${on.key} ${on.name}` : on.name;
|
|
1442
|
+
return on.kind === "program" ? `${on.name} (program)` : on.name;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
const chatStamp = (m) => `${m.at.slice(0, 16).replace("T", " ")}${m.edited ? " (edited)" : ""}`;
|
|
1446
|
+
|
|
1447
|
+
/** One new line while watching: "[3] Mara · 2026-11-08 14:10: Launch moved", a reply with ↳. */
|
|
1448
|
+
export function chatLineText(m) {
|
|
1449
|
+
const body = m.body.replace(/\s*\n\s*/g, " / ");
|
|
1450
|
+
const lead = m.replyTo ? ` ↳ [${m.replyTo}]` : m.n ? `[${m.n}]` : "";
|
|
1451
|
+
return `${lead ? `${lead} ` : ""}${m.from ?? "Someone"} · ${chatStamp(m)}: ${body}`;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
/** read_chat: the conversation, each message with its number and its replies under it. */
|
|
1455
|
+
export function chatText(r, quoted) {
|
|
1456
|
+
const where = chatWhere(r.on);
|
|
1457
|
+
const list = r.messages ?? [];
|
|
1458
|
+
const task = r.on.kind === "task";
|
|
1459
|
+
const noun = task ? "comments" : "messages";
|
|
1460
|
+
if (!list.length)
|
|
1461
|
+
return `No ${noun} on ${where} yet. harbor chat ${quoted} "TEXT" writes the first.`;
|
|
1462
|
+
const out = [`${where} · ${noun}`];
|
|
1463
|
+
if (r.more)
|
|
1464
|
+
out.push(
|
|
1465
|
+
`${r.more} earlier ${r.more === 1 ? "line" : "lines"} left out (--limit N shows more).`,
|
|
1466
|
+
);
|
|
1467
|
+
const indent = (text, pad) => text.replace(/\n/g, `\n${pad}`);
|
|
1468
|
+
const shown = new Set(list.filter((m) => m.n).map((m) => m.n));
|
|
1469
|
+
// Replies whose message is older than the lines shown come first, saying what they answer.
|
|
1470
|
+
for (const m of list.filter((x) => x.replyTo && !shown.has(x.replyTo)))
|
|
1471
|
+
out.push(
|
|
1472
|
+
"",
|
|
1473
|
+
` ↳ to [${m.replyTo}] ${m.from ?? "Someone"} · ${chatStamp(m)}`,
|
|
1474
|
+
` ${indent(m.body, " ")}`,
|
|
1475
|
+
);
|
|
1476
|
+
for (const m of list.filter((x) => !x.replyTo)) {
|
|
1477
|
+
out.push(
|
|
1478
|
+
"",
|
|
1479
|
+
`${task ? "" : `[${m.n}] `}${m.from ?? "Someone"} · ${chatStamp(m)}`,
|
|
1480
|
+
` ${indent(m.body, " ")}`,
|
|
1481
|
+
);
|
|
1482
|
+
for (const reply of list.filter((x) => x.replyTo === m.n))
|
|
1483
|
+
out.push(
|
|
1484
|
+
` ↳ ${reply.from ?? "Someone"} · ${chatStamp(reply)}`,
|
|
1485
|
+
` ${indent(reply.body, " ")}`,
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
if (!task) {
|
|
1489
|
+
const first = list.find((m) => m.n)?.n;
|
|
1490
|
+
if (first) out.push("", `--reply ${first} answers message [${first}].`);
|
|
1491
|
+
}
|
|
1492
|
+
return out.join("\n");
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1414
1495
|
const SIGN_OFF = {
|
|
1415
1496
|
pending: "waiting on the sign-off",
|
|
1416
1497
|
approved: "signed off",
|