@harborppm/cli 0.105.0 → 0.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/app.mjs +616 -106
- package/lib/cli.mjs +129 -59
- package/lib/format.mjs +21 -6
- package/package.json +1 -1
package/lib/cli.mjs
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
chatText,
|
|
41
41
|
chatLineText,
|
|
42
42
|
chatWhere,
|
|
43
|
+
digestText,
|
|
43
44
|
charterText,
|
|
44
45
|
landfallText,
|
|
45
46
|
loadLineCliText,
|
|
@@ -135,6 +136,8 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
135
136
|
what you're also on
|
|
136
137
|
harbor catchup [--since DATE] while you were away: handed to
|
|
137
138
|
you, decided, what moved
|
|
139
|
+
harbor digest [--program P] [--hours N] what changed in the last day on
|
|
140
|
+
your work, or in one program
|
|
138
141
|
harbor clock [NAME] [--zone ZONE|here|none] [--hours 9-17]
|
|
139
142
|
who's working now, or set your
|
|
140
143
|
(or NAME's) time zone and hours
|
|
@@ -310,8 +313,8 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
310
313
|
harbor goal "TITLE" --new [--portfolio P] [--owner NAME] [--due DATE]
|
|
311
314
|
set a new goal (harbor help goal)
|
|
312
315
|
harbor milestones [PROGRAM] [--project P] [--done]
|
|
313
|
-
milestones soonest first
|
|
314
|
-
done, sign-off,
|
|
316
|
+
milestones soonest first, with
|
|
317
|
+
tasks done, sign-off, waits
|
|
315
318
|
harbor milestone "NAME" [--program P] [--due DATE] [--rename T]
|
|
316
319
|
[--reached|--open] [--signs-off NAME|none]
|
|
317
320
|
[--approve|--changes NOTE]
|
|
@@ -713,6 +716,24 @@ function wordsLine(r) {
|
|
|
713
716
|
return bits.length ? `Read from your words: ${bits.join(", ")}.` : null;
|
|
714
717
|
}
|
|
715
718
|
|
|
719
|
+
/**
|
|
720
|
+
* What the words in a title read as, field by field, with the words each came
|
|
721
|
+
* from (`from`), for --dry-run --json; null when they read as nothing.
|
|
722
|
+
*/
|
|
723
|
+
function wordsRead(r) {
|
|
724
|
+
const fields = [
|
|
725
|
+
["assignee", r.owner],
|
|
726
|
+
["due", r.due],
|
|
727
|
+
["priority", r.priority],
|
|
728
|
+
["project", r.project],
|
|
729
|
+
].filter(([, x]) => x);
|
|
730
|
+
if (!fields.length) return null;
|
|
731
|
+
return {
|
|
732
|
+
...Object.fromEntries(fields.map(([k, x]) => [k, x.value])),
|
|
733
|
+
from: Object.fromEntries(fields.map(([k, x]) => [k, x.text])),
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
|
|
716
737
|
/** --due given in words rather than as a date or +N, when it reads as a day. */
|
|
717
738
|
function dueWords(v) {
|
|
718
739
|
if (typeof v !== "string" || /^(\d{4}-\d{2}-\d{2}|\+\d{1,3})$/.test(v) || PILOT.has(v.toLowerCase())) return false;
|
|
@@ -908,12 +929,14 @@ const DETAIL = {
|
|
|
908
929
|
" priority, dates, parent and milestone, the words read from its title,",
|
|
909
930
|
" an open task that already has the title, and anything Harbor would",
|
|
910
931
|
" refuse (a full column, an unknown person) with why. It exits 1 when",
|
|
911
|
-
" something would be refused. --json lists the same under tasks.",
|
|
932
|
+
" something would be refused. --json lists the same under tasks. The key",
|
|
933
|
+
" is a forecast, not held for you: an add from anyone in between takes it.",
|
|
912
934
|
"",
|
|
913
935
|
" --unless-exists skips a title the project already has open (case and",
|
|
914
936
|
" spacing aside), saying which task it found; a done one doesn't count,",
|
|
915
|
-
" so a weekly chore is still added
|
|
916
|
-
"
|
|
937
|
+
" so a weekly chore is still added (only open tasks are checked). --json",
|
|
938
|
+
" has the dry run's shape: tasks, one a title, a skipped one marked",
|
|
939
|
+
" skipped with the open task's key as sameAs (one title also: created).",
|
|
917
940
|
"",
|
|
918
941
|
" --project can be left out when the harbor has one open project (First",
|
|
919
942
|
" voyage aside); the task goes there.",
|
|
@@ -1042,8 +1065,8 @@ const DETAIL = {
|
|
|
1042
1065
|
" harbor shore PROGRAM --url URL writes: posts go to this Slack, Discord,",
|
|
1043
1066
|
" Teams or Google Chat webhook address",
|
|
1044
1067
|
" harbor shore PROGRAM --on KINDS writes: turns posts on; KINDS are",
|
|
1045
|
-
" forecast, health, notes and
|
|
1046
|
-
" with commas",
|
|
1068
|
+
" forecast, health, notes, messages and",
|
|
1069
|
+
" digest, with commas",
|
|
1047
1070
|
" harbor shore PROGRAM --off KINDS writes: turns them off",
|
|
1048
1071
|
" harbor shore PROGRAM --test writes: sends a test post",
|
|
1049
1072
|
" harbor shore PROGRAM --remove writes: stops posting and forgets the",
|
|
@@ -1051,7 +1074,8 @@ const DETAIL = {
|
|
|
1051
1074
|
"",
|
|
1052
1075
|
" forecast is the morning harbor forecast, health a line when the program or",
|
|
1053
1076
|
" one of its projects changes health, notes a note for later when it opens,",
|
|
1054
|
-
" messages each new message or reply on the program or its projects
|
|
1077
|
+
" messages each new message or reply on the program or its projects, digest",
|
|
1078
|
+
" a morning post of what changed the day before (nothing on a quiet day).",
|
|
1055
1079
|
" Every post links back to Harbor. A new channel posts nothing until you turn",
|
|
1056
1080
|
" something on. The address is a secret: once saved, only a hint of it shows.",
|
|
1057
1081
|
],
|
|
@@ -1323,8 +1347,9 @@ const DETAIL = {
|
|
|
1323
1347
|
" soonest first",
|
|
1324
1348
|
" harbor milestones --project P reads: the milestones of P's program",
|
|
1325
1349
|
"",
|
|
1326
|
-
" Each says its due day and whether it's late, how many of the tasks
|
|
1327
|
-
" to it are done
|
|
1350
|
+
" Each says its due day and whether it's late, and how many of the tasks",
|
|
1351
|
+
" tied to it are done (a task ties with harbor add or edit --milestone).",
|
|
1352
|
+
" When it has them, who signs it off and where that stands, and the",
|
|
1328
1353
|
" projects it waits on. --done adds the reached ones.",
|
|
1329
1354
|
],
|
|
1330
1355
|
milestone: [
|
|
@@ -1439,7 +1464,9 @@ const DETAIL = {
|
|
|
1439
1464
|
" prints each new one as it lands. Lines about your own work (your tasks,",
|
|
1440
1465
|
" mentions of you, what you lead) are bright; the rest are dim. It runs",
|
|
1441
1466
|
" until q or Ctrl+C (or until it's killed, when piped or with --json);",
|
|
1442
|
-
" --once returns at once.
|
|
1467
|
+
" --once returns at once. Harbor keeps the latest 40 changes, so --since",
|
|
1468
|
+
" further back than those says where its list starts. Made for a narrow",
|
|
1469
|
+
" split or a tmux pane; it needs",
|
|
1443
1470
|
" full access (harbor login without --read-only).",
|
|
1444
1471
|
],
|
|
1445
1472
|
lifeboats: [
|
|
@@ -1530,6 +1557,17 @@ const DETAIL = {
|
|
|
1530
1557
|
" counts tasks added from now on as growth. On the website a program's",
|
|
1531
1558
|
" Set baseline does the same for all its projects.",
|
|
1532
1559
|
],
|
|
1560
|
+
digest: [
|
|
1561
|
+
" harbor digest reads what changed in the last day",
|
|
1562
|
+
" on your projects",
|
|
1563
|
+
" harbor digest --program P reads it for one program",
|
|
1564
|
+
" harbor digest --hours 72 reads it further back (up to 168)",
|
|
1565
|
+
"",
|
|
1566
|
+
" Tasks finished and added, health that moved, risks and issues raised,",
|
|
1567
|
+
" decisions made, and where people talked: the same as the top of the",
|
|
1568
|
+
" Inbox, and the morning post harbor shore P --on digest sends to a",
|
|
1569
|
+
" program's chat channel.",
|
|
1570
|
+
],
|
|
1533
1571
|
catchup: [
|
|
1534
1572
|
" harbor catchup reads the catch-up the app opens on",
|
|
1535
1573
|
" harbor catchup --since DATE reads it from a day (YYYY-MM-DD)",
|
|
@@ -2808,10 +2846,12 @@ export async function run(argv, io = {}) {
|
|
|
2808
2846
|
.split(",")
|
|
2809
2847
|
.map((k) => k.trim().toLowerCase())
|
|
2810
2848
|
.filter(Boolean);
|
|
2811
|
-
const bad = list.find(
|
|
2849
|
+
const bad = list.find(
|
|
2850
|
+
(k) => !["forecast", "health", "notes", "messages", "digest"].includes(k),
|
|
2851
|
+
);
|
|
2812
2852
|
if (bad || !list.length)
|
|
2813
2853
|
throw new HarborError(
|
|
2814
|
-
`--${flag} takes forecast, health, notes or
|
|
2854
|
+
`--${flag} takes forecast, health, notes, messages or digest, with commas between.`,
|
|
2815
2855
|
);
|
|
2816
2856
|
return list;
|
|
2817
2857
|
};
|
|
@@ -2853,10 +2893,11 @@ export async function run(argv, io = {}) {
|
|
|
2853
2893
|
health: "health changes",
|
|
2854
2894
|
notes: "notes when they open",
|
|
2855
2895
|
messages: "messages",
|
|
2896
|
+
digest: "what changed each morning",
|
|
2856
2897
|
};
|
|
2857
|
-
const posts = ["forecast", "health", "notes", "messages"].filter((k) => r.hook[k]).map((k) => label[k]);
|
|
2898
|
+
const posts = ["forecast", "health", "notes", "messages", "digest"].filter((k) => r.hook[k]).map((k) => label[k]);
|
|
2858
2899
|
const lines = [
|
|
2859
|
-
`${r.program} posts to ${r.hook.service} (${r.hook.hint}): ${posts.length ? posts.join(", ") : "nothing yet; --on forecast,health,notes,messages turns posts on"}.`,
|
|
2900
|
+
`${r.program} posts to ${r.hook.service} (${r.hook.hint}): ${posts.length ? posts.join(", ") : "nothing yet; --on forecast,health,notes,messages,digest turns posts on"}.`,
|
|
2860
2901
|
];
|
|
2861
2902
|
if (r.hook.failures > 0)
|
|
2862
2903
|
lines.push(
|
|
@@ -2912,6 +2953,26 @@ export async function run(argv, io = {}) {
|
|
|
2912
2953
|
if (!values.project && !reads.every((r) => r.project))
|
|
2913
2954
|
values.project = await onlyProject(client, harbor, "--project NAME or #NAME in the title");
|
|
2914
2955
|
const projectOf = (r) => values.project ?? r.project?.value;
|
|
2956
|
+
// One task as --json lists it, the same for a dry run and the real thing.
|
|
2957
|
+
const taskEntry = (t, title) => ({
|
|
2958
|
+
title: t?.title ?? title,
|
|
2959
|
+
...(t
|
|
2960
|
+
? {
|
|
2961
|
+
key: t.key ?? null,
|
|
2962
|
+
...(t.id ? { id: t.id } : {}),
|
|
2963
|
+
project: t.project,
|
|
2964
|
+
status: t.status,
|
|
2965
|
+
...(t.column ? { column: t.column } : {}),
|
|
2966
|
+
assignee: t.assignee,
|
|
2967
|
+
...(t.alsoOn ? { alsoOn: t.alsoOn } : {}),
|
|
2968
|
+
priority: t.priority,
|
|
2969
|
+
due: t.due,
|
|
2970
|
+
...(t.starts ? { starts: t.starts } : {}),
|
|
2971
|
+
...(t.subtaskOf ? { subtaskOf: t.subtaskOf } : {}),
|
|
2972
|
+
...(t.milestone ? { milestone: t.milestone } : {}),
|
|
2973
|
+
}
|
|
2974
|
+
: {}),
|
|
2975
|
+
});
|
|
2915
2976
|
// What create_task gets for one line, the same for a dry run and the real thing.
|
|
2916
2977
|
const argsFor = (words) => ({
|
|
2917
2978
|
project: projectOf(words),
|
|
@@ -2942,38 +3003,13 @@ export async function run(argv, io = {}) {
|
|
|
2942
3003
|
const unread =
|
|
2943
3004
|
values.literal && !fromTemplate ? await readTitles(client, harbor, titles, values) : null;
|
|
2944
3005
|
const lines = preview.tasks.map((p, i) => {
|
|
2945
|
-
const t = p.created;
|
|
2946
3006
|
const words = reads[i];
|
|
2947
3007
|
return {
|
|
2948
|
-
|
|
2949
|
-
...(t
|
|
2950
|
-
? {
|
|
2951
|
-
key: t.key ?? null,
|
|
2952
|
-
project: t.project,
|
|
2953
|
-
status: t.status,
|
|
2954
|
-
...(t.column ? { column: t.column } : {}),
|
|
2955
|
-
assignee: t.assignee,
|
|
2956
|
-
...(t.alsoOn ? { alsoOn: t.alsoOn } : {}),
|
|
2957
|
-
priority: t.priority,
|
|
2958
|
-
due: t.due,
|
|
2959
|
-
...(t.starts ? { starts: t.starts } : {}),
|
|
2960
|
-
...(t.subtaskOf ? { subtaskOf: t.subtaskOf } : {}),
|
|
2961
|
-
...(t.milestone ? { milestone: t.milestone } : {}),
|
|
2962
|
-
}
|
|
2963
|
-
: {}),
|
|
3008
|
+
...taskEntry(p.created, p.title ?? words.title),
|
|
2964
3009
|
...(values.template ? { template: values.template } : {}),
|
|
2965
3010
|
...(values.comment ? { comment: values.comment } : {}),
|
|
2966
|
-
...(words
|
|
2967
|
-
|
|
2968
|
-
read: {
|
|
2969
|
-
...(words.owner ? { assignee: words.owner.value, from: words.owner.text } : {}),
|
|
2970
|
-
...(words.due ? { due: words.due.value } : {}),
|
|
2971
|
-
...(words.priority ? { priority: words.priority.value } : {}),
|
|
2972
|
-
...(words.project ? { project: words.project.value } : {}),
|
|
2973
|
-
},
|
|
2974
|
-
}
|
|
2975
|
-
: {}),
|
|
2976
|
-
...(unread && wordsLine(unread[i]) ? { keptWords: wordsLine(unread[i]) } : {}),
|
|
3011
|
+
...(wordsRead(words) ? { read: wordsRead(words) } : {}),
|
|
3012
|
+
...(unread && wordsRead(unread[i]) ? { keptWords: wordsRead(unread[i]) } : {}),
|
|
2977
3013
|
...(p.sameAs ? { sameAs: p.sameAs } : {}),
|
|
2978
3014
|
...(p.sameAs && values["unless-exists"] ? { skipped: true } : {}),
|
|
2979
3015
|
...(p.refused ? { refused: p.refused } : {}),
|
|
@@ -3015,7 +3051,7 @@ export async function run(argv, io = {}) {
|
|
|
3015
3051
|
` ${bits.join(" · ")}`,
|
|
3016
3052
|
...(wordsLine(words) ? [` ${wordsLine(words)} --literal keeps them in the title.`] : []),
|
|
3017
3053
|
...(l.keptWords
|
|
3018
|
-
? [` --literal kept the words as typed. ${
|
|
3054
|
+
? [` --literal kept the words as typed. ${wordsLine(unread[i]).replace("Read from your words", "Without it, they'd read as")}`]
|
|
3019
3055
|
: []),
|
|
3020
3056
|
...(l.comment ? [` with your comment: ${l.comment}`] : []),
|
|
3021
3057
|
...(l.sameAs && !l.skipped
|
|
@@ -3027,7 +3063,7 @@ export async function run(argv, io = {}) {
|
|
|
3027
3063
|
out(
|
|
3028
3064
|
plain(
|
|
3029
3065
|
[
|
|
3030
|
-
`Would add ${n(would)}${skipped ? `, skip ${skipped}` : ""}${refused ? `; ${refused} would be refused` : ""}. Nothing changed.`,
|
|
3066
|
+
`Would add ${n(would)}${skipped ? `, skip ${skipped}` : ""}${refused ? `; ${refused} would be refused` : ""}. Nothing changed${lines.some((l) => l.key) ? ", and the keys aren't held" : ""}.`,
|
|
3031
3067
|
...body,
|
|
3032
3068
|
...(pilot ? [`--due pilot: ${pilot.says}`] : []),
|
|
3033
3069
|
].join("\n"),
|
|
@@ -3037,7 +3073,7 @@ export async function run(argv, io = {}) {
|
|
|
3037
3073
|
return refused ? 1 : 0;
|
|
3038
3074
|
}
|
|
3039
3075
|
const added = [];
|
|
3040
|
-
for (const words of reads) {
|
|
3076
|
+
for (const [i, words] of reads.entries()) {
|
|
3041
3077
|
const r = await client
|
|
3042
3078
|
.call("create_task", { harbor, ...argsFor(words) })
|
|
3043
3079
|
.catch((err) => {
|
|
@@ -3060,25 +3096,43 @@ export async function run(argv, io = {}) {
|
|
|
3060
3096
|
body: values.comment,
|
|
3061
3097
|
})
|
|
3062
3098
|
).commented;
|
|
3063
|
-
|
|
3064
|
-
|
|
3099
|
+
// The words read out of the title, field by field, and the title as typed.
|
|
3100
|
+
const read = wordsRead(words);
|
|
3101
|
+
if (read) r.read = { ...read, typed: titles[i] };
|
|
3065
3102
|
added.push(r);
|
|
3066
3103
|
}
|
|
3067
3104
|
await stalePromptCache(env);
|
|
3068
3105
|
const made = added.filter((r) => r.created);
|
|
3069
|
-
|
|
3070
|
-
//
|
|
3071
|
-
// `skipped`
|
|
3072
|
-
//
|
|
3073
|
-
|
|
3074
|
-
|
|
3106
|
+
// The dry run's shape, so a script reads both the same way: `tasks`
|
|
3107
|
+
// has one entry a title, a skipped one (--unless-exists found it open)
|
|
3108
|
+
// marked `skipped` with the open task's key as `sameAs`. One title added
|
|
3109
|
+
// alone also keeps `created`, as before.
|
|
3110
|
+
if (asJson) {
|
|
3111
|
+
const tasks = added.map((r, i) =>
|
|
3112
|
+
r.existing
|
|
3113
|
+
? { ...taskEntry(r.existing, titles[i]), sameAs: r.existing.key ?? r.existing.id, skipped: true }
|
|
3114
|
+
: {
|
|
3115
|
+
...taskEntry(r.created, titles[i]),
|
|
3116
|
+
...(values.template ? { template: values.template } : {}),
|
|
3117
|
+
...(r.comment ? { comment: r.comment } : {}),
|
|
3118
|
+
...(r.read ? { read: r.read } : {}),
|
|
3119
|
+
...(r.pilot ? { pilot: r.pilot } : {}),
|
|
3120
|
+
...(r.milestoneReached ? { milestoneReached: r.milestoneReached } : {}),
|
|
3121
|
+
...(r.milestoneReopened ? { milestoneReopened: r.milestoneReopened } : {}),
|
|
3122
|
+
},
|
|
3123
|
+
);
|
|
3124
|
+
const where = [...new Set(tasks.map((t) => t.project).filter(Boolean))];
|
|
3075
3125
|
out(
|
|
3076
3126
|
jsonText({
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3127
|
+
dryRun: false,
|
|
3128
|
+
literal: Boolean(values.literal),
|
|
3129
|
+
project: where.length === 1 ? where[0] : (values.project ?? null),
|
|
3130
|
+
titles: tasks.map((t) => t.title),
|
|
3131
|
+
tasks,
|
|
3132
|
+
...(made.length === 1 && added.length === 1 ? { created: made[0].created } : {}),
|
|
3080
3133
|
}),
|
|
3081
3134
|
);
|
|
3135
|
+
}
|
|
3082
3136
|
else
|
|
3083
3137
|
out(
|
|
3084
3138
|
plain(
|
|
@@ -3089,7 +3143,11 @@ export async function run(argv, io = {}) {
|
|
|
3089
3143
|
: [
|
|
3090
3144
|
`Added: ${taskLine(r.created, opts)}${r.comment ? ", with your comment" : ""}`,
|
|
3091
3145
|
// What the title's words said, so nothing is read without being seen.
|
|
3092
|
-
...(r.read
|
|
3146
|
+
...(r.read
|
|
3147
|
+
? [
|
|
3148
|
+
`You typed “${r.read.typed}”. ${wordsLine(reads[added.indexOf(r)])} --literal keeps the words in the title.`,
|
|
3149
|
+
]
|
|
3150
|
+
: []),
|
|
3093
3151
|
// --due in words ("next friday"): the day it became, weekday and all.
|
|
3094
3152
|
...(dueWords(values.due) ? [`--due ${values.due}: ${dayWithWeekday(dueDate(values.due))}.`] : []),
|
|
3095
3153
|
// Pilot speaks up only when a date was given that the queue says won't hold.
|
|
@@ -3882,7 +3940,7 @@ export async function run(argv, io = {}) {
|
|
|
3882
3940
|
return call(
|
|
3883
3941
|
"list_milestones",
|
|
3884
3942
|
{ harbor, program, project: values.project, done: Boolean(values.done) },
|
|
3885
|
-
milestonesText,
|
|
3943
|
+
(r) => milestonesText(r, { done: Boolean(values.done) }),
|
|
3886
3944
|
);
|
|
3887
3945
|
}
|
|
3888
3946
|
case "milestone": {
|
|
@@ -4134,6 +4192,18 @@ export async function run(argv, io = {}) {
|
|
|
4134
4192
|
if (!of) throw new HarborError("Say what: a project, a task key like RR-42, or a milestone.");
|
|
4135
4193
|
return call("long_pole", { harbor, of }, whyText);
|
|
4136
4194
|
}
|
|
4195
|
+
case "digest": {
|
|
4196
|
+
const { positionals, values, harbor } = parse(spec([], ["program", "hours"]));
|
|
4197
|
+
none(positionals);
|
|
4198
|
+
const hours = values.hours === undefined ? undefined : Number(values.hours);
|
|
4199
|
+
if (hours !== undefined && (!Number.isInteger(hours) || hours < 1 || hours > 168))
|
|
4200
|
+
throw new HarborError("--hours is a whole number from 1 to 168.");
|
|
4201
|
+
return call(
|
|
4202
|
+
"daily_digest",
|
|
4203
|
+
{ harbor, ...(values.program ? { program: values.program } : {}), ...(hours ? { hours } : {}) },
|
|
4204
|
+
(r) => digestText(r, hours),
|
|
4205
|
+
);
|
|
4206
|
+
}
|
|
4137
4207
|
case "catchup": {
|
|
4138
4208
|
const { positionals, values, harbor } = parse(spec([], ["since"]));
|
|
4139
4209
|
none(positionals);
|
package/lib/format.mjs
CHANGED
|
@@ -1504,7 +1504,9 @@ export function milestoneLine(m, { program = true } = {}) {
|
|
|
1504
1504
|
m.reached ? "reached" : m.late ? `late, due ${m.due}` : `due ${m.due}`,
|
|
1505
1505
|
m.tasks
|
|
1506
1506
|
? `${m.tasks.done} of ${m.tasks.total} task${m.tasks.total === 1 ? "" : "s"} done`
|
|
1507
|
-
:
|
|
1507
|
+
: m.reached
|
|
1508
|
+
? null
|
|
1509
|
+
: "no tasks lead to it",
|
|
1508
1510
|
m.signOff
|
|
1509
1511
|
? `${m.signOff.by ?? "someone"} signs off: ${SIGN_OFF[m.signOff.status] ?? m.signOff.status}${m.signOff.note ? ` (“${m.signOff.note}”)` : ""}`
|
|
1510
1512
|
: null,
|
|
@@ -1517,8 +1519,12 @@ export function milestoneLine(m, { program = true } = {}) {
|
|
|
1517
1519
|
}
|
|
1518
1520
|
|
|
1519
1521
|
/** list_milestones: soonest first, the program named once when it's one. */
|
|
1520
|
-
export function milestonesText(r) {
|
|
1522
|
+
export function milestonesText(r, { done = false } = {}) {
|
|
1521
1523
|
const list = r.milestones ?? [];
|
|
1524
|
+
const noneReached =
|
|
1525
|
+
done && list.length && !list.some((m) => m.reached)
|
|
1526
|
+
? [`None ${r.program ? `in ${r.program} ` : ""}reached yet.`]
|
|
1527
|
+
: [];
|
|
1522
1528
|
const hidden = r.reachedHidden
|
|
1523
1529
|
? `${r.reachedHidden} reached ${r.reachedHidden === 1 ? "one" : "ones"} not shown (--done shows them).`
|
|
1524
1530
|
: "";
|
|
@@ -1532,6 +1538,7 @@ export function milestonesText(r) {
|
|
|
1532
1538
|
...(r.program ? [`${r.program}:`] : []),
|
|
1533
1539
|
...list.map((m) => `${r.program ? " " : ""}${milestoneLine(m, { program: !r.program })}`),
|
|
1534
1540
|
...(hidden ? [hidden] : []),
|
|
1541
|
+
...noneReached,
|
|
1535
1542
|
].join("\n");
|
|
1536
1543
|
}
|
|
1537
1544
|
|
|
@@ -1563,11 +1570,19 @@ export function reportsText(r) {
|
|
|
1563
1570
|
out.push(d.name);
|
|
1564
1571
|
if (!d.charts.length) out.push(" No charts on it yet.");
|
|
1565
1572
|
for (const c of d.charts) {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
);
|
|
1573
|
+
// The line under says what the title doesn't: a starter chart's title already is "Open tasks by owner".
|
|
1574
|
+
const what = `${c.counts} by ${c.splitBy.toLowerCase()}`;
|
|
1575
|
+
const said = (c.title ?? "").toLowerCase().includes(what.toLowerCase());
|
|
1576
|
+
const sub = [said ? null : what, c.from ? `in ${c.from}` : null].filter(Boolean).join(", ");
|
|
1577
|
+
out.push(` ${c.text}`, ...(sub ? [` ${sub[0].toUpperCase()}${sub.slice(1)}`] : []));
|
|
1570
1578
|
}
|
|
1571
1579
|
}
|
|
1572
1580
|
return out.join("\n");
|
|
1573
1581
|
}
|
|
1582
|
+
|
|
1583
|
+
/** daily_digest: a heading, then each line. */
|
|
1584
|
+
export function digestText(r, hours) {
|
|
1585
|
+
const span = !hours || hours === 24 ? "the last day" : `the last ${hours} hours`;
|
|
1586
|
+
if (r.quiet) return `Nothing changed on ${r.on} in ${span}.`;
|
|
1587
|
+
return [`What changed on ${r.on} in ${span}`, ...r.lines.map((l) => ` • ${l}`)].join("\n");
|
|
1588
|
+
}
|