@harborppm/cli 0.121.0 → 0.123.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 -2
- package/dist/app.mjs +218 -29
- package/dist/words.mjs +101 -3
- package/lib/cli.mjs +27 -8
- package/lib/format.mjs +12 -1
- package/lib/words.mjs +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,7 +173,7 @@ harbor project "NAME" --program P [--lead me|NAME] [--starts DATE]
|
|
|
173
173
|
--from: dead reckoning, its tasks due when
|
|
174
174
|
they really finished in that project
|
|
175
175
|
harbor add "TITLE" --project P [--assignee me|NAME] [--also "NAME, NAME"] [--due DATE|pilot]
|
|
176
|
-
[--priority low|medium|high|urgent] [--status S] [--comment TEXT]
|
|
176
|
+
[--at TIME] [--priority low|medium|high|urgent] [--status S] [--comment TEXT]
|
|
177
177
|
[--starts DATE] [--over-limit] [--literal] [--dry-run] [--unless-exists]
|
|
178
178
|
no TITLE: one title a line from stdin
|
|
179
179
|
--due pilot takes the earliest day the owner's queue
|
|
@@ -187,7 +187,7 @@ harbor start TASK | submit TASK | done TASK [--confirm] [--over-limit] [--commen
|
|
|
187
187
|
each in turn; one that can't move says why and the
|
|
188
188
|
rest carry on
|
|
189
189
|
harbor edit TASK [--title T] [--assignee me|none|NAME] [--also "NAME, NAME"|none]
|
|
190
|
-
[--due DATE|pilot|none] [--starts DATE|none]
|
|
190
|
+
[--due DATE|pilot|none] [--at TIME|none] [--starts DATE|none]
|
|
191
191
|
[--priority P] [--status S] [--notes TEXT]
|
|
192
192
|
[--repeat weekly|biweekly|monthly|never]
|
|
193
193
|
[--waits-on TASK,TASK|none] [--confirm] [--over-limit]
|
package/dist/app.mjs
CHANGED
|
@@ -35,15 +35,15 @@ var __exportAll = (all, flags) => {
|
|
|
35
35
|
// src/lib/clock.ts
|
|
36
36
|
/** A date's local wall-clock time, with no zone: "2026-10-05T23:10:00". */
|
|
37
37
|
function wallClock(d = /* @__PURE__ */ new Date()) {
|
|
38
|
-
return `${d.getFullYear()}-${pad$
|
|
38
|
+
return `${d.getFullYear()}-${pad$3(d.getMonth() + 1)}-${pad$3(d.getDate())}T${pad$3(d.getHours())}:${pad$3(d.getMinutes())}:${pad$3(d.getSeconds())}`;
|
|
39
39
|
}
|
|
40
40
|
function clockNow() {
|
|
41
41
|
return frozen ? new Date(frozen) : /* @__PURE__ */ new Date();
|
|
42
42
|
}
|
|
43
|
-
var frozen, pad$
|
|
43
|
+
var frozen, pad$3;
|
|
44
44
|
var init_clock = __esmMin((() => {
|
|
45
45
|
frozen = null;
|
|
46
|
-
pad$
|
|
46
|
+
pad$3 = (n) => String(n).padStart(2, "0");
|
|
47
47
|
}));
|
|
48
48
|
|
|
49
49
|
// src/lib/date-text.ts
|
|
@@ -128,7 +128,7 @@ function timeAgo(date, now = clockNow()) {
|
|
|
128
128
|
const words = `${n} ${unit}${n === 1 ? "" : "s"}`;
|
|
129
129
|
return diff > 0 ? `in ${words}` : `${words} ago`;
|
|
130
130
|
}
|
|
131
|
-
var MONTHS$2, DAYS$2, pad$
|
|
131
|
+
var MONTHS$2, DAYS$2, pad$2, TOKENS, TOKEN, ISO, MINUTE;
|
|
132
132
|
var init_date_text = __esmMin((() => {
|
|
133
133
|
init_clock();
|
|
134
134
|
MONTHS$2 = [
|
|
@@ -154,13 +154,13 @@ var init_date_text = __esmMin((() => {
|
|
|
154
154
|
"Friday",
|
|
155
155
|
"Saturday"
|
|
156
156
|
];
|
|
157
|
-
pad$
|
|
157
|
+
pad$2 = (n, width = 2) => String(n).padStart(width, "0");
|
|
158
158
|
TOKENS = {
|
|
159
|
-
yyyy: (d) => pad$
|
|
159
|
+
yyyy: (d) => pad$2(d.getFullYear(), 4),
|
|
160
160
|
MMMM: (d) => MONTHS$2[d.getMonth()],
|
|
161
161
|
MMM: (d) => MONTHS$2[d.getMonth()].slice(0, 3),
|
|
162
|
-
MM: (d) => pad$
|
|
163
|
-
dd: (d) => pad$
|
|
162
|
+
MM: (d) => pad$2(d.getMonth() + 1),
|
|
163
|
+
dd: (d) => pad$2(d.getDate()),
|
|
164
164
|
d: (d) => String(d.getDate()),
|
|
165
165
|
EEEE: (d) => DAYS$2[d.getDay()],
|
|
166
166
|
EEE: (d) => DAYS$2[d.getDay()].slice(0, 3)
|
|
@@ -7866,7 +7866,7 @@ var init_sheet_feed = __esmMin((() => {}));
|
|
|
7866
7866
|
/** What a thanks is for, read from the harbor; null once that's gone. */
|
|
7867
7867
|
function thanksTarget(doc, on) {
|
|
7868
7868
|
if (on.kind === "task") {
|
|
7869
|
-
const t = doc.tasks.
|
|
7869
|
+
const t = byId(doc.tasks).get(on.id);
|
|
7870
7870
|
if (!t) return null;
|
|
7871
7871
|
const project = byId(doc.projects).get(t.projectId);
|
|
7872
7872
|
const key = taskKey(t, project);
|
|
@@ -7904,6 +7904,15 @@ function thanksProblem(body, toId, fromId) {
|
|
|
7904
7904
|
if (toId === fromId) return "Thanks go to someone else.";
|
|
7905
7905
|
return null;
|
|
7906
7906
|
}
|
|
7907
|
+
/**
|
|
7908
|
+
* The thanks already standing for this one: the same writer, to the same
|
|
7909
|
+
* person, for the same work, in the same words, a few minutes ago (a second
|
|
7910
|
+
* press of Send, or the line sent from the Inbox and the task's panel).
|
|
7911
|
+
*/
|
|
7912
|
+
function sameThanks(reflections, row) {
|
|
7913
|
+
const at = Date.parse(row.createdAt);
|
|
7914
|
+
return (reflections ?? []).find((r) => isThanks(r) && r.authorId === row.authorId && r.toId === row.toId && r.thanksFor.kind === row.thanksFor.kind && r.thanksFor.id === row.thanksFor.id && r.body.toLowerCase() === row.body.toLowerCase() && Math.abs(at - Date.parse(r.createdAt)) < 6e5);
|
|
7915
|
+
}
|
|
7907
7916
|
/** Thanks given since `since`, newest first, with names and what each was for; `keep` narrows them. */
|
|
7908
7917
|
function thanksSince(doc, since, keep = () => true) {
|
|
7909
7918
|
const out = [];
|
|
@@ -7924,11 +7933,13 @@ function thanksSince(doc, since, keep = () => true) {
|
|
|
7924
7933
|
function thanksText(line) {
|
|
7925
7934
|
return `${line.from} to ${line.to} for ${line.for}: “${line.thanks.body.trim()}”`;
|
|
7926
7935
|
}
|
|
7927
|
-
var isThanks, first$2;
|
|
7936
|
+
var isThanks, thankable, THANKS_TWICE_MS, first$2;
|
|
7928
7937
|
var init_thanks = __esmMin((() => {
|
|
7929
7938
|
init_indexes();
|
|
7930
7939
|
init_task_keys();
|
|
7931
7940
|
isThanks = (r) => r.kind === "thanks" && !!r.thanksFor && !!r.toId;
|
|
7941
|
+
thankable = (p) => !!p && p.kind !== "agent";
|
|
7942
|
+
THANKS_TWICE_MS = 6e5;
|
|
7932
7943
|
first$2 = (doc, id) => doc.people.find((p) => p.id === id)?.name.split(" ")[0] ?? "Someone";
|
|
7933
7944
|
}));
|
|
7934
7945
|
|
|
@@ -10892,7 +10903,7 @@ function voyageLog(data, projectId) {
|
|
|
10892
10903
|
closed
|
|
10893
10904
|
})).filter((c) => c.person).sort((a, b) => b.closed - a.closed || a.person.name.localeCompare(b.person.name));
|
|
10894
10905
|
const lines = (data.reflections ?? []).filter((r) => r.projectId === projectId && r.kind === "voyage").sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
10895
|
-
const thanks = (data.reflections ?? []).filter((r) => r.projectId === projectId && isThanks(r)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
10906
|
+
const thanks = (data.reflections ?? []).filter((r) => r.projectId === projectId && isThanks(r) && !!thanksTarget(data, r.thanksFor)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
10896
10907
|
return {
|
|
10897
10908
|
project,
|
|
10898
10909
|
done: project.health === "done",
|
|
@@ -11109,7 +11120,106 @@ function applyReckoning(actions, projectId, r, startDate) {
|
|
|
11109
11120
|
};
|
|
11110
11121
|
}
|
|
11111
11122
|
|
|
11123
|
+
// src/lib/due-time.ts
|
|
11124
|
+
/** "9 AM", "9:30 AM", "12 PM", "12:15 AM": a time as people say it. */
|
|
11125
|
+
function timeOfDay(hhmm) {
|
|
11126
|
+
const m = HHMM$1.exec(hhmm);
|
|
11127
|
+
if (!m) return "";
|
|
11128
|
+
const h = Number(m[1]);
|
|
11129
|
+
const half = h < 12 ? "AM" : "PM";
|
|
11130
|
+
const twelve = h % 12 === 0 ? 12 : h % 12;
|
|
11131
|
+
return m[2] === "00" ? `${twelve} ${half}` : `${twelve}:${m[2]} ${half}`;
|
|
11132
|
+
}
|
|
11133
|
+
/**
|
|
11134
|
+
* Orders one day's tasks by their times: timed ones first, earliest first,
|
|
11135
|
+
* then the rest in the order they came (the sort is stable).
|
|
11136
|
+
*/
|
|
11137
|
+
function byDueTime(a, b) {
|
|
11138
|
+
const x = a.dueDate && isDueTime(a.dueTime) ? a.dueTime : null;
|
|
11139
|
+
const y = b.dueDate && isDueTime(b.dueTime) ? b.dueTime : null;
|
|
11140
|
+
if (x && y) return x < y ? -1 : x > y ? 1 : 0;
|
|
11141
|
+
return x ? -1 : y ? 1 : 0;
|
|
11142
|
+
}
|
|
11143
|
+
/** The task with no time left where it can't have one: no due day, or not a time. */
|
|
11144
|
+
function keepDueTime(task) {
|
|
11145
|
+
if (!("dueTime" in task) || task.dueTime === void 0) return task;
|
|
11146
|
+
if (task.dueTime !== null && task.dueDate && isDueTime(task.dueTime)) return task;
|
|
11147
|
+
const { dueTime: _gone, ...rest } = task;
|
|
11148
|
+
return rest;
|
|
11149
|
+
}
|
|
11150
|
+
var HHMM$1, isDueTime;
|
|
11151
|
+
var init_due_time = __esmMin((() => {
|
|
11152
|
+
HHMM$1 = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
11153
|
+
isDueTime = (v) => typeof v === "string" && HHMM$1.test(v);
|
|
11154
|
+
}));
|
|
11155
|
+
|
|
11156
|
+
// src/lib/time-words.ts
|
|
11157
|
+
init_due_time();
|
|
11158
|
+
/**
|
|
11159
|
+
* Times of day as people type or say them, for a task's time (due-time.ts):
|
|
11160
|
+
* "9", "9am", "9:30", "9.30 pm", "2p", "14:00", "noon", "midday",
|
|
11161
|
+
* "midnight". Pure, and kept out of the first load: the task panel's time
|
|
11162
|
+
* box and the plain-words reader take it when they open.
|
|
11163
|
+
*/
|
|
11164
|
+
const pad$1 = (n) => String(n).padStart(2, "0");
|
|
11165
|
+
/**
|
|
11166
|
+
* The hour a bare number most likely means when no AM or PM is said: 7 to
|
|
11167
|
+
* 11 in the morning, 12 at noon, 1 to 6 in the afternoon. "Call Nina at 3"
|
|
11168
|
+
* is three in the afternoon. In the evening ("tonight at 8"), every bare
|
|
11169
|
+
* hour before noon is PM.
|
|
11170
|
+
*/
|
|
11171
|
+
function guessHour(h, evening) {
|
|
11172
|
+
if (h >= 12) return h;
|
|
11173
|
+
if (evening) return h + 12;
|
|
11174
|
+
return h >= 1 && h <= 6 ? h + 12 : h;
|
|
11175
|
+
}
|
|
11176
|
+
/**
|
|
11177
|
+
* The time a phrase names, as "HH:MM", or null. A bare hour with no AM or
|
|
11178
|
+
* PM is read the way people mean it (`guessHour`); "0:30" or "17:00" are
|
|
11179
|
+
* taken as written.
|
|
11180
|
+
*/
|
|
11181
|
+
function readTime(text, opts = {}) {
|
|
11182
|
+
const p = text.trim().toLowerCase().replace(/^at\s+/, "").replace(/\s+/g, " ");
|
|
11183
|
+
if (p === "noon" || p === "midday" || p === "12 noon") return "12:00";
|
|
11184
|
+
if (p === "midnight") return "00:00";
|
|
11185
|
+
const m = /^(\d{1,2})(?:[:.](\d{2}))? ?(a|p|am|pm|a\.m\.?|p\.m\.?)?$/.exec(p);
|
|
11186
|
+
if (!m) return null;
|
|
11187
|
+
let h = Number(m[1]);
|
|
11188
|
+
const min = Number(m[2] ?? 0);
|
|
11189
|
+
if (min > 59) return null;
|
|
11190
|
+
const half = m[3]?.[0];
|
|
11191
|
+
if (half) {
|
|
11192
|
+
if (h < 1 || h > 12) return null;
|
|
11193
|
+
h = h % 12 + (half === "p" ? 12 : 0);
|
|
11194
|
+
} else if (m[1].length === 2 && m[1][0] === "0") {} else if (h <= 12 && !(m[2] && h === 0)) h = guessHour(h, opts.evening ?? false);
|
|
11195
|
+
if (h > 23) return null;
|
|
11196
|
+
return `${pad$1(h)}:${pad$1(min)}`;
|
|
11197
|
+
}
|
|
11198
|
+
/**
|
|
11199
|
+
* The words of a time in a sentence, for the plain-words reader: a number
|
|
11200
|
+
* with AM or PM or minutes ("9am", "9:30"), or noon and the like. A bare
|
|
11201
|
+
* number counts only after "at" (see plain-words.ts), so "by Friday 3
|
|
11202
|
+
* copies" keeps its copies.
|
|
11203
|
+
*/
|
|
11204
|
+
const TIME_WORD = "(?:\\d{1,2}(?:[:.]\\d{2})?(?: ?(?:a\\.m\\.?|p\\.m\\.?|am|pm)|[ap])|\\d{1,2}:\\d{2}|noon|midday|midnight)";
|
|
11205
|
+
/** "at 9", "at 9:30am", "at noon": after "at", a bare hour counts too. */
|
|
11206
|
+
const AT_TIME_WORD = `at (?:${TIME_WORD}|\\d{1,2})`;
|
|
11207
|
+
|
|
11112
11208
|
// src/lib/plain-words.ts
|
|
11209
|
+
/**
|
|
11210
|
+
* A new task in plain words: "Book the venue @Sam by Friday !high #Launch"
|
|
11211
|
+
* reads as the title "Book the venue", owned by Sam, due on the coming
|
|
11212
|
+
* Friday, high priority, in the Launch project. Typed or said aloud (the
|
|
11213
|
+
* composer's mic), so the spoken forms are here too: "assign to Sam",
|
|
11214
|
+
* "high priority", "due next week".
|
|
11215
|
+
*
|
|
11216
|
+
* Careful by design, so a title doesn't quietly lose words: a day counts
|
|
11217
|
+
* only after "by", "due", "on", "before" or "until", or as the very last
|
|
11218
|
+
* words (not after "to", "for" or "from": "Move the meeting to Friday"
|
|
11219
|
+
* keeps its Friday); a person only after @ or "assign to"; a project only after #. Each
|
|
11220
|
+
* thing read keeps the words it came from, so the composer can show them
|
|
11221
|
+
* and put them back. Pure.
|
|
11222
|
+
*/
|
|
11113
11223
|
const DAYS$1 = [
|
|
11114
11224
|
"sunday",
|
|
11115
11225
|
"monday",
|
|
@@ -11277,6 +11387,35 @@ function without(text, spans) {
|
|
|
11277
11387
|
for (const s of [...spans].sort((a, b) => b.start - a.start)) out = `${out.slice(0, s.start)} ${out.slice(s.end)}`;
|
|
11278
11388
|
return out.replace(/\s+([,.;:!?])/g, "$1").replace(/[,;:]+([,.;:!?])/g, "$1").replace(/\s{2,}/g, " ").replace(/(?:[\s,;:–—-]+)$/u, "").replace(/^[\s,;:]+/, "").trim();
|
|
11279
11389
|
}
|
|
11390
|
+
/**
|
|
11391
|
+
* A day read from the words, with the time said beside it when there is
|
|
11392
|
+
* one: "friday at 9", "tomorrow 3pm", "at 10:30 on monday". A bare number
|
|
11393
|
+
* counts only after "at" ("by friday 3 copies" keeps its copies).
|
|
11394
|
+
*/
|
|
11395
|
+
function withTime(text, due, free) {
|
|
11396
|
+
const evening = /tonight/i.test(text.slice(due.start, due.end));
|
|
11397
|
+
const after = new RegExp(`^(,?\\s+)(${AT_TIME_WORD}|${TIME_WORD})(?=$|[\\s,.;:!?])`, "i").exec(text.slice(due.end));
|
|
11398
|
+
if (after) {
|
|
11399
|
+
const end = due.end + after[0].length;
|
|
11400
|
+
const time = readTime(after[2], { evening });
|
|
11401
|
+
if (time && free(due.end, end)) return {
|
|
11402
|
+
...due,
|
|
11403
|
+
end,
|
|
11404
|
+
time
|
|
11405
|
+
};
|
|
11406
|
+
}
|
|
11407
|
+
const before = new RegExp(`(?:^|[\\s,])(${AT_TIME_WORD})(?: on)? $`, "i").exec(text.slice(0, due.start));
|
|
11408
|
+
if (before) {
|
|
11409
|
+
const start = before.index + before[0].indexOf(before[1]);
|
|
11410
|
+
const time = readTime(before[1], { evening });
|
|
11411
|
+
if (time && free(start, due.start)) return {
|
|
11412
|
+
...due,
|
|
11413
|
+
start,
|
|
11414
|
+
time
|
|
11415
|
+
};
|
|
11416
|
+
}
|
|
11417
|
+
return due;
|
|
11418
|
+
}
|
|
11280
11419
|
/** What a new task's words say, and the title they leave. */
|
|
11281
11420
|
function readTaskWords(input, ctx) {
|
|
11282
11421
|
const skip = ctx.skip ?? /* @__PURE__ */ new Set();
|
|
@@ -11379,7 +11518,9 @@ function readTaskWords(input, ctx) {
|
|
|
11379
11518
|
break;
|
|
11380
11519
|
}
|
|
11381
11520
|
if (!due) {
|
|
11382
|
-
const
|
|
11521
|
+
const whole = without(text, [...taken, ...nobody]);
|
|
11522
|
+
const timeAtEnd = ctx.noTime ? null : new RegExp(`[\\s,]+(?:${AT_TIME_WORD}|${TIME_WORD})[.!]?$`, "i").exec(whole);
|
|
11523
|
+
const rest = timeAtEnd ? whole.slice(0, timeAtEnd.index) : whole;
|
|
11383
11524
|
const tail = new RegExp(`(?:^|[\\s,])(${WHEN})[.!]?$`, "i").exec(rest);
|
|
11384
11525
|
const short = tail && /^(?:sun|mon|tue|wed|thu|fri|sat)$/i.test(tail[1]);
|
|
11385
11526
|
const said = tail && /\b(?:to|for|from|after|with|since)$/i.test(rest.slice(0, tail.index).trimEnd());
|
|
@@ -11395,6 +11536,7 @@ function readTaskWords(input, ctx) {
|
|
|
11395
11536
|
}
|
|
11396
11537
|
}
|
|
11397
11538
|
}
|
|
11539
|
+
if (due && !ctx.noTime) due = withTime(text, due, free);
|
|
11398
11540
|
if (due) taken.push(due);
|
|
11399
11541
|
}
|
|
11400
11542
|
const span = (f) => f ? text.slice(f.start, f.end).trim() : "";
|
|
@@ -11405,7 +11547,8 @@ function readTaskWords(input, ctx) {
|
|
|
11405
11547
|
title,
|
|
11406
11548
|
due: due ? {
|
|
11407
11549
|
value: due.value,
|
|
11408
|
-
text: span(due)
|
|
11550
|
+
text: span(due),
|
|
11551
|
+
...due.time ? { time: due.time } : {}
|
|
11409
11552
|
} : null,
|
|
11410
11553
|
owner: owner ? {
|
|
11411
11554
|
value: owner.value,
|
|
@@ -11483,7 +11626,7 @@ function readNewTask(text, data, today) {
|
|
|
11483
11626
|
});
|
|
11484
11627
|
const bits = [
|
|
11485
11628
|
words.owner && (data.people.find((p) => p.id === words.owner.value)?.name ?? "someone"),
|
|
11486
|
-
words.due && `due ${longDate(words.due.value)}`,
|
|
11629
|
+
words.due && `due ${longDate(words.due.value)}${words.due.time ? ` at ${timeOfDay(words.due.time)}` : ""}`,
|
|
11487
11630
|
words.priority && `${PRIORITY_LABEL[words.priority.value].toLowerCase()} priority`,
|
|
11488
11631
|
words.project && (data.projects.find((p) => p.id === words.project.value)?.name ?? "project")
|
|
11489
11632
|
].filter((b) => Boolean(b));
|
|
@@ -13746,17 +13889,21 @@ function dailyDigest(data, scope, since) {
|
|
|
13746
13889
|
const projectById = byId(data.projects);
|
|
13747
13890
|
const programById = byId(data.programs);
|
|
13748
13891
|
const talkBy = /* @__PURE__ */ new Map();
|
|
13749
|
-
const count = (key, where, path, authorId, taskId) => {
|
|
13892
|
+
const count = (key, where, title, path, authorId, taskId) => {
|
|
13893
|
+
if (scope.kind === "person" && authorId === scope.id) return;
|
|
13750
13894
|
const t = talkBy.get(key) ?? {
|
|
13751
13895
|
where,
|
|
13896
|
+
title,
|
|
13752
13897
|
path,
|
|
13753
13898
|
...taskId ? { taskId } : {},
|
|
13754
13899
|
count: 0,
|
|
13755
|
-
who: []
|
|
13900
|
+
who: [],
|
|
13901
|
+
whoIds: []
|
|
13756
13902
|
};
|
|
13757
13903
|
t.count++;
|
|
13758
13904
|
const name = first(authorId);
|
|
13759
13905
|
if (!t.who.includes(name)) t.who.push(name);
|
|
13906
|
+
if (!t.whoIds.includes(authorId)) t.whoIds.push(authorId);
|
|
13760
13907
|
talkBy.set(key, t);
|
|
13761
13908
|
};
|
|
13762
13909
|
for (const r of data.reflections ?? []) {
|
|
@@ -13765,7 +13912,7 @@ function dailyDigest(data, scope, since) {
|
|
|
13765
13912
|
const holder = place.kind === "program" ? programById.get(place.id) : projectById.get(place.id);
|
|
13766
13913
|
const inside = place.kind === "program" ? programIds.has(place.id) : projectIds.has(place.id);
|
|
13767
13914
|
if (!holder || !inside) continue;
|
|
13768
|
-
count(`${place.kind}:${place.id}`, holder.name, placePath(place), r.authorId);
|
|
13915
|
+
count(`${place.kind}:${place.id}`, holder.name, holder.name, placePath(place), r.authorId);
|
|
13769
13916
|
}
|
|
13770
13917
|
const taskById = byId(data.tasks);
|
|
13771
13918
|
for (const c of data.comments) {
|
|
@@ -13773,7 +13920,7 @@ function dailyDigest(data, scope, since) {
|
|
|
13773
13920
|
const task = taskById.get(c.taskId);
|
|
13774
13921
|
if (!task || !projectIds.has(task.projectId)) continue;
|
|
13775
13922
|
const key = taskKey(task, projectById.get(task.projectId));
|
|
13776
|
-
count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, `/projects/${task.projectId}`, c.authorId, task.id);
|
|
13923
|
+
count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, task.title, `/projects/${task.projectId}`, c.authorId, task.id);
|
|
13777
13924
|
}
|
|
13778
13925
|
const talk = [...talkBy.values()].sort((a, b) => b.count - a.count || a.where.localeCompare(b.where));
|
|
13779
13926
|
return {
|
|
@@ -14098,6 +14245,7 @@ init_work();
|
|
|
14098
14245
|
init_project_messages();
|
|
14099
14246
|
init_clock();
|
|
14100
14247
|
init_soundings();
|
|
14248
|
+
init_thanks();
|
|
14101
14249
|
const KIND_RANK = {
|
|
14102
14250
|
harbor: -1,
|
|
14103
14251
|
waiting: 0,
|
|
@@ -14110,6 +14258,7 @@ const KIND_RANK = {
|
|
|
14110
14258
|
mention: 6,
|
|
14111
14259
|
reply: 7,
|
|
14112
14260
|
finished: 8,
|
|
14261
|
+
thanks: 9,
|
|
14113
14262
|
convoy: 1.5
|
|
14114
14263
|
};
|
|
14115
14264
|
const PING_KIND_LABEL = {
|
|
@@ -14124,6 +14273,7 @@ const PING_KIND_LABEL = {
|
|
|
14124
14273
|
mention: "Mentions",
|
|
14125
14274
|
reply: "Replies",
|
|
14126
14275
|
finished: "Finished",
|
|
14276
|
+
thanks: "Thanks",
|
|
14127
14277
|
convoy: "Between programs"
|
|
14128
14278
|
};
|
|
14129
14279
|
function firstName$3(name) {
|
|
@@ -14494,6 +14644,24 @@ function inboxOf(data, personId, now = clockNow()) {
|
|
|
14494
14644
|
href: `/projects/${task.projectId}`
|
|
14495
14645
|
});
|
|
14496
14646
|
}
|
|
14647
|
+
for (const r of data.reflections ?? []) {
|
|
14648
|
+
if (!isThanks(r) || r.toId !== personId || r.authorId === personId || r.createdAt < since) continue;
|
|
14649
|
+
const target = thanksTarget(data, r.thanksFor);
|
|
14650
|
+
if (!target) continue;
|
|
14651
|
+
const from = data.people.find((p) => p.id === r.authorId);
|
|
14652
|
+
const on = r.thanksFor;
|
|
14653
|
+
pings.push({
|
|
14654
|
+
id: `thanks:${r.id}`,
|
|
14655
|
+
kind: "thanks",
|
|
14656
|
+
title: `${from ? firstName$3(from.name) : "Someone"} thanked you`,
|
|
14657
|
+
detail: `“${r.body.trim()}” · for ${target.title}`,
|
|
14658
|
+
at: r.createdAt,
|
|
14659
|
+
personId: r.authorId,
|
|
14660
|
+
taskId: on.kind === "task" ? on.id : void 0,
|
|
14661
|
+
programId: on.kind === "milestone" ? target.programId ?? void 0 : void 0,
|
|
14662
|
+
href: on.kind === "task" ? `/projects/${target.projectId}` : on.kind === "milestone" ? `/programs/${target.programId}?view=milestones` : target.projectId ? `/projects/${target.projectId}?view=decisions` : target.programId ? `/programs/${target.programId}` : void 0
|
|
14663
|
+
});
|
|
14664
|
+
}
|
|
14497
14665
|
pings.push(...convoyPings(data, personId, now, since));
|
|
14498
14666
|
return pings.sort((a, b) => {
|
|
14499
14667
|
const rank = KIND_RANK[a.kind] - KIND_RANK[b.kind];
|
|
@@ -17737,7 +17905,8 @@ function NewTask({ projectId, status, width, onDone, onFull }) {
|
|
|
17737
17905
|
status: status ?? "todo",
|
|
17738
17906
|
priority: words.priority?.value ?? "medium",
|
|
17739
17907
|
assigneeId: words.owner?.value ?? (me || null),
|
|
17740
|
-
dueDate: words.due?.value ?? null
|
|
17908
|
+
dueDate: words.due?.value ?? null,
|
|
17909
|
+
...words.due?.time ? { dueTime: words.due.time } : {}
|
|
17741
17910
|
}));
|
|
17742
17911
|
}
|
|
17743
17912
|
})
|
|
@@ -26665,6 +26834,7 @@ function buildBreakdown(doc, root, today) {
|
|
|
26665
26834
|
const percentDone = (n) => n.total > 0 ? Math.round(n.done / n.total * 100) : 0;
|
|
26666
26835
|
|
|
26667
26836
|
// src/lib/mcp/tools.ts
|
|
26837
|
+
init_due_time();
|
|
26668
26838
|
init_project_messages();
|
|
26669
26839
|
init_daily_digest();
|
|
26670
26840
|
init_subtasks();
|
|
@@ -27072,6 +27242,7 @@ function taskLine(t, people, projects, all, data) {
|
|
|
27072
27242
|
position: boardPositions(all).get(t.id) ?? null,
|
|
27073
27243
|
priority: t.priority,
|
|
27074
27244
|
due: dayOf(t.dueDate),
|
|
27245
|
+
...t.dueDate && isDueTime(t.dueTime) ? { at: t.dueTime } : {},
|
|
27075
27246
|
assignee: nameOf$2(people, t.assigneeId),
|
|
27076
27247
|
...alsoOnOf(t, people),
|
|
27077
27248
|
project: project?.name ?? null,
|
|
@@ -27750,6 +27921,7 @@ const HARBOR_TOOLS = [
|
|
|
27750
27921
|
position: boardPositions(data.tasks).get(t.id) ?? null,
|
|
27751
27922
|
priority: t.priority,
|
|
27752
27923
|
due: dayOf(t.dueDate),
|
|
27924
|
+
...t.dueDate && isDueTime(t.dueTime) ? { at: t.dueTime } : {},
|
|
27753
27925
|
...t.startDate ? { starts: dayOf(t.startDate) } : {},
|
|
27754
27926
|
assignee: nameOf$2(people, t.assigneeId),
|
|
27755
27927
|
...alsoOnOf(t, people),
|
|
@@ -27849,7 +28021,7 @@ const HARBOR_TOOLS = [
|
|
|
27849
28021
|
const today = todayFor(mine, ctx.now, todayISO(ctx.now));
|
|
27850
28022
|
const people = byId(data.people);
|
|
27851
28023
|
const projects = byId(data.projects);
|
|
27852
|
-
const open = data.tasks.filter((t) => t.assigneeId === mine.id && isOpen(t)).sort((a, b) => (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999"));
|
|
28024
|
+
const open = data.tasks.filter((t) => t.assigneeId === mine.id && isOpen(t)).sort((a, b) => (a.dueDate ?? "9999").localeCompare(b.dueDate ?? "9999") || byDueTime(a, b));
|
|
27853
28025
|
const waiters = waitersByBlocker(data.tasks);
|
|
27854
28026
|
const waitingOnYou = open.flatMap((t) => (waiters.get(t.id) ?? []).filter(isOpen).map((w) => ({
|
|
27855
28027
|
yourTask: {
|
|
@@ -29645,7 +29817,8 @@ function withoutFirstDue(task) {
|
|
|
29645
29817
|
return rest;
|
|
29646
29818
|
}
|
|
29647
29819
|
/**
|
|
29648
|
-
* Keeps each task's first due day through a write
|
|
29820
|
+
* Keeps each task's first due day through a write, and drops a time of day
|
|
29821
|
+
* from a task left with no day (due-time.ts): only tasks whose object
|
|
29649
29822
|
* changed are looked at, so a write that doesn't touch tasks costs nothing.
|
|
29650
29823
|
*/
|
|
29651
29824
|
function keepFirstDue(before, after) {
|
|
@@ -29654,8 +29827,8 @@ function keepFirstDue(before, after) {
|
|
|
29654
29827
|
let changed = false;
|
|
29655
29828
|
const tasks = after.tasks.map((t) => {
|
|
29656
29829
|
const old = was.get(t.id);
|
|
29657
|
-
if (
|
|
29658
|
-
const next = firstDueAfter(old, t);
|
|
29830
|
+
if (old === t) return t;
|
|
29831
|
+
const next = keepDueTime(old ? firstDueAfter(old, t) : t);
|
|
29659
29832
|
if (next !== t) changed = true;
|
|
29660
29833
|
return next;
|
|
29661
29834
|
});
|
|
@@ -29666,6 +29839,7 @@ function keepFirstDue(before, after) {
|
|
|
29666
29839
|
}
|
|
29667
29840
|
var day;
|
|
29668
29841
|
var init_first_due = __esmMin((() => {
|
|
29842
|
+
init_due_time();
|
|
29669
29843
|
init_indexes();
|
|
29670
29844
|
day = (iso) => iso ? iso.slice(0, 10) : null;
|
|
29671
29845
|
}));
|
|
@@ -30806,14 +30980,24 @@ var init_hierarchy = __esmMin((() => {
|
|
|
30806
30980
|
}));
|
|
30807
30981
|
|
|
30808
30982
|
// src/lib/github-refs.ts
|
|
30809
|
-
/**
|
|
30983
|
+
/**
|
|
30984
|
+
* The task's list with this pull request or commit added, or updated in place, newest first.
|
|
30985
|
+
* The pull request that made the task stays marked as its maker, and stays on the list.
|
|
30986
|
+
*/
|
|
30810
30987
|
function withRef(list, ref) {
|
|
30811
|
-
const
|
|
30812
|
-
|
|
30813
|
-
|
|
30814
|
-
|
|
30988
|
+
const next = (list ?? []).find((r) => sameRef(r, ref))?.made && !ref.made ? {
|
|
30989
|
+
...ref,
|
|
30990
|
+
made: true
|
|
30991
|
+
} : ref;
|
|
30992
|
+
const rest = (list ?? []).filter((r) => !sameRef(r, ref));
|
|
30993
|
+
const kept = [next, ...rest].slice(0, 20);
|
|
30994
|
+
const maker = rest.find((r) => r.made);
|
|
30995
|
+
return maker && !kept.includes(maker) ? [...kept.slice(0, 19), maker] : kept;
|
|
30996
|
+
}
|
|
30997
|
+
var REFS_KEPT, sameRef;
|
|
30815
30998
|
var init_github_refs = __esmMin((() => {
|
|
30816
30999
|
REFS_KEPT = 20;
|
|
31000
|
+
sameRef = (a, b) => a.kind === b.kind && a.repo === b.repo && a.ref === b.ref;
|
|
30817
31001
|
}));
|
|
30818
31002
|
|
|
30819
31003
|
// src/lib/automations.ts
|
|
@@ -32083,7 +32267,7 @@ function milestonesRaidSlice({ get, write }) {
|
|
|
32083
32267
|
const text = body.replace(/\s+/g, " ").trim().slice(0, 200);
|
|
32084
32268
|
const target = thanksTarget(s, on);
|
|
32085
32269
|
if (!target || thanksProblem(text, toId, me)) return null;
|
|
32086
|
-
if (!s.people.
|
|
32270
|
+
if (!thankable(s.people.find((p) => p.id === toId))) return null;
|
|
32087
32271
|
const row = {
|
|
32088
32272
|
id: uid("rf"),
|
|
32089
32273
|
projectId: target.projectId,
|
|
@@ -32097,6 +32281,11 @@ function milestonesRaidSlice({ get, write }) {
|
|
|
32097
32281
|
id: on.id
|
|
32098
32282
|
}
|
|
32099
32283
|
};
|
|
32284
|
+
const twice = sameThanks(s.reflections, {
|
|
32285
|
+
...row,
|
|
32286
|
+
thanksFor: row.thanksFor
|
|
32287
|
+
});
|
|
32288
|
+
if (twice) return twice.id;
|
|
32100
32289
|
write({ reflections: [...s.reflections ?? [], row] });
|
|
32101
32290
|
return row.id;
|
|
32102
32291
|
},
|
package/dist/words.mjs
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
// Built from src/lib/plain-words.ts by cli/build.mjs. Edit the source, not this file.
|
|
2
|
+
// src/lib/time-words.ts
|
|
3
|
+
/**
|
|
4
|
+
* Times of day as people type or say them, for a task's time (due-time.ts):
|
|
5
|
+
* "9", "9am", "9:30", "9.30 pm", "2p", "14:00", "noon", "midday",
|
|
6
|
+
* "midnight". Pure, and kept out of the first load: the task panel's time
|
|
7
|
+
* box and the plain-words reader take it when they open.
|
|
8
|
+
*/
|
|
9
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
10
|
+
/**
|
|
11
|
+
* The hour a bare number most likely means when no AM or PM is said: 7 to
|
|
12
|
+
* 11 in the morning, 12 at noon, 1 to 6 in the afternoon. "Call Nina at 3"
|
|
13
|
+
* is three in the afternoon. In the evening ("tonight at 8"), every bare
|
|
14
|
+
* hour before noon is PM.
|
|
15
|
+
*/
|
|
16
|
+
function guessHour(h, evening) {
|
|
17
|
+
if (h >= 12) return h;
|
|
18
|
+
if (evening) return h + 12;
|
|
19
|
+
return h >= 1 && h <= 6 ? h + 12 : h;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The time a phrase names, as "HH:MM", or null. A bare hour with no AM or
|
|
23
|
+
* PM is read the way people mean it (`guessHour`); "0:30" or "17:00" are
|
|
24
|
+
* taken as written.
|
|
25
|
+
*/
|
|
26
|
+
function readTime(text, opts = {}) {
|
|
27
|
+
const p = text.trim().toLowerCase().replace(/^at\s+/, "").replace(/\s+/g, " ");
|
|
28
|
+
if (p === "noon" || p === "midday" || p === "12 noon") return "12:00";
|
|
29
|
+
if (p === "midnight") return "00:00";
|
|
30
|
+
const m = /^(\d{1,2})(?:[:.](\d{2}))? ?(a|p|am|pm|a\.m\.?|p\.m\.?)?$/.exec(p);
|
|
31
|
+
if (!m) return null;
|
|
32
|
+
let h = Number(m[1]);
|
|
33
|
+
const min = Number(m[2] ?? 0);
|
|
34
|
+
if (min > 59) return null;
|
|
35
|
+
const half = m[3]?.[0];
|
|
36
|
+
if (half) {
|
|
37
|
+
if (h < 1 || h > 12) return null;
|
|
38
|
+
h = h % 12 + (half === "p" ? 12 : 0);
|
|
39
|
+
} else if (m[1].length === 2 && m[1][0] === "0") {} else if (h <= 12 && !(m[2] && h === 0)) h = guessHour(h, opts.evening ?? false);
|
|
40
|
+
if (h > 23) return null;
|
|
41
|
+
return `${pad(h)}:${pad(min)}`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The words of a time in a sentence, for the plain-words reader: a number
|
|
45
|
+
* with AM or PM or minutes ("9am", "9:30"), or noon and the like. A bare
|
|
46
|
+
* number counts only after "at" (see plain-words.ts), so "by Friday 3
|
|
47
|
+
* copies" keeps its copies.
|
|
48
|
+
*/
|
|
49
|
+
const TIME_WORD = "(?:\\d{1,2}(?:[:.]\\d{2})?(?: ?(?:a\\.m\\.?|p\\.m\\.?|am|pm)|[ap])|\\d{1,2}:\\d{2}|noon|midday|midnight)";
|
|
50
|
+
/** "at 9", "at 9:30am", "at noon": after "at", a bare hour counts too. */
|
|
51
|
+
const AT_TIME_WORD = `at (?:${TIME_WORD}|\\d{1,2})`;
|
|
52
|
+
|
|
2
53
|
// src/lib/plain-words.ts
|
|
54
|
+
/**
|
|
55
|
+
* A new task in plain words: "Book the venue @Sam by Friday !high #Launch"
|
|
56
|
+
* reads as the title "Book the venue", owned by Sam, due on the coming
|
|
57
|
+
* Friday, high priority, in the Launch project. Typed or said aloud (the
|
|
58
|
+
* composer's mic), so the spoken forms are here too: "assign to Sam",
|
|
59
|
+
* "high priority", "due next week".
|
|
60
|
+
*
|
|
61
|
+
* Careful by design, so a title doesn't quietly lose words: a day counts
|
|
62
|
+
* only after "by", "due", "on", "before" or "until", or as the very last
|
|
63
|
+
* words (not after "to", "for" or "from": "Move the meeting to Friday"
|
|
64
|
+
* keeps its Friday); a person only after @ or "assign to"; a project only after #. Each
|
|
65
|
+
* thing read keeps the words it came from, so the composer can show them
|
|
66
|
+
* and put them back. Pure.
|
|
67
|
+
*/
|
|
3
68
|
const DAYS = [
|
|
4
69
|
"sunday",
|
|
5
70
|
"monday",
|
|
@@ -171,6 +236,35 @@ function without(text, spans) {
|
|
|
171
236
|
for (const s of [...spans].sort((a, b) => b.start - a.start)) out = `${out.slice(0, s.start)} ${out.slice(s.end)}`;
|
|
172
237
|
return out.replace(/\s+([,.;:!?])/g, "$1").replace(/[,;:]+([,.;:!?])/g, "$1").replace(/\s{2,}/g, " ").replace(/(?:[\s,;:–—-]+)$/u, "").replace(/^[\s,;:]+/, "").trim();
|
|
173
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* A day read from the words, with the time said beside it when there is
|
|
241
|
+
* one: "friday at 9", "tomorrow 3pm", "at 10:30 on monday". A bare number
|
|
242
|
+
* counts only after "at" ("by friday 3 copies" keeps its copies).
|
|
243
|
+
*/
|
|
244
|
+
function withTime(text, due, free) {
|
|
245
|
+
const evening = /tonight/i.test(text.slice(due.start, due.end));
|
|
246
|
+
const after = new RegExp(`^(,?\\s+)(${AT_TIME_WORD}|${TIME_WORD})(?=$|[\\s,.;:!?])`, "i").exec(text.slice(due.end));
|
|
247
|
+
if (after) {
|
|
248
|
+
const end = due.end + after[0].length;
|
|
249
|
+
const time = readTime(after[2], { evening });
|
|
250
|
+
if (time && free(due.end, end)) return {
|
|
251
|
+
...due,
|
|
252
|
+
end,
|
|
253
|
+
time
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
const before = new RegExp(`(?:^|[\\s,])(${AT_TIME_WORD})(?: on)? $`, "i").exec(text.slice(0, due.start));
|
|
257
|
+
if (before) {
|
|
258
|
+
const start = before.index + before[0].indexOf(before[1]);
|
|
259
|
+
const time = readTime(before[1], { evening });
|
|
260
|
+
if (time && free(start, due.start)) return {
|
|
261
|
+
...due,
|
|
262
|
+
start,
|
|
263
|
+
time
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return due;
|
|
267
|
+
}
|
|
174
268
|
/** What a new task's words say, and the title they leave. */
|
|
175
269
|
function readTaskWords(input, ctx) {
|
|
176
270
|
const skip = ctx.skip ?? /* @__PURE__ */ new Set();
|
|
@@ -273,7 +367,9 @@ function readTaskWords(input, ctx) {
|
|
|
273
367
|
break;
|
|
274
368
|
}
|
|
275
369
|
if (!due) {
|
|
276
|
-
const
|
|
370
|
+
const whole = without(text, [...taken, ...nobody]);
|
|
371
|
+
const timeAtEnd = ctx.noTime ? null : new RegExp(`[\\s,]+(?:${AT_TIME_WORD}|${TIME_WORD})[.!]?$`, "i").exec(whole);
|
|
372
|
+
const rest = timeAtEnd ? whole.slice(0, timeAtEnd.index) : whole;
|
|
277
373
|
const tail = new RegExp(`(?:^|[\\s,])(${WHEN})[.!]?$`, "i").exec(rest);
|
|
278
374
|
const short = tail && /^(?:sun|mon|tue|wed|thu|fri|sat)$/i.test(tail[1]);
|
|
279
375
|
const said = tail && /\b(?:to|for|from|after|with|since)$/i.test(rest.slice(0, tail.index).trimEnd());
|
|
@@ -289,6 +385,7 @@ function readTaskWords(input, ctx) {
|
|
|
289
385
|
}
|
|
290
386
|
}
|
|
291
387
|
}
|
|
388
|
+
if (due && !ctx.noTime) due = withTime(text, due, free);
|
|
292
389
|
if (due) taken.push(due);
|
|
293
390
|
}
|
|
294
391
|
const span = (f) => f ? text.slice(f.start, f.end).trim() : "";
|
|
@@ -299,7 +396,8 @@ function readTaskWords(input, ctx) {
|
|
|
299
396
|
title,
|
|
300
397
|
due: due ? {
|
|
301
398
|
value: due.value,
|
|
302
|
-
text: span(due)
|
|
399
|
+
text: span(due),
|
|
400
|
+
...due.time ? { time: due.time } : {}
|
|
303
401
|
} : null,
|
|
304
402
|
owner: owner ? {
|
|
305
403
|
value: owner.value,
|
|
@@ -317,4 +415,4 @@ function readTaskWords(input, ctx) {
|
|
|
317
415
|
};
|
|
318
416
|
}
|
|
319
417
|
|
|
320
|
-
export { dayFromWords, looseName, personForKey, readTaskWords };
|
|
418
|
+
export { dayFromWords, looseName, personForKey, readTaskWords, readTime };
|
package/lib/cli.mjs
CHANGED
|
@@ -88,6 +88,7 @@ import {
|
|
|
88
88
|
programTree,
|
|
89
89
|
projectList,
|
|
90
90
|
taskLine,
|
|
91
|
+
timeOfDay,
|
|
91
92
|
taskList,
|
|
92
93
|
todayLocal,
|
|
93
94
|
weekText,
|
|
@@ -96,7 +97,7 @@ import { colourDepth, logoLines } from "./logo.mjs";
|
|
|
96
97
|
import { NO_HARBOR } from "./errors.mjs";
|
|
97
98
|
import { HarborError, createClient } from "./mcp.mjs";
|
|
98
99
|
import { jsonText, plain } from "./plain.mjs";
|
|
99
|
-
import { dayFromWords, readTaskWords } from "./words.mjs";
|
|
100
|
+
import { dayFromWords, readTaskWords, readTime } from "./words.mjs";
|
|
100
101
|
import {
|
|
101
102
|
FETCH_LIMIT,
|
|
102
103
|
SHELLS,
|
|
@@ -196,8 +197,8 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
196
197
|
--from: plan it from a finished
|
|
197
198
|
project as that one really ran
|
|
198
199
|
harbor add "TITLE" [--project P] [--assignee me|none|NAME]
|
|
199
|
-
[--also "NAME, NAME"] [--due DATE|pilot] [--
|
|
200
|
-
[--priority low|medium|high|urgent]
|
|
200
|
+
[--also "NAME, NAME"] [--due DATE|pilot] [--at TIME]
|
|
201
|
+
[--starts DATE] [--priority low|medium|high|urgent]
|
|
201
202
|
[--status S] [--comment TEXT] [--over-limit] [--dry-run]
|
|
202
203
|
[--unless-exists] [--literal] [--template NAME]
|
|
203
204
|
[--parent TASK]
|
|
@@ -217,7 +218,7 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
217
218
|
on each as it moves
|
|
218
219
|
harbor edit TASK [--title T] [--assignee me|none|NAME]
|
|
219
220
|
[--also "NAME, NAME"|none] [--due DATE|pilot|none]
|
|
220
|
-
[--starts DATE|none]
|
|
221
|
+
[--at TIME|none] [--starts DATE|none]
|
|
221
222
|
[--priority P] [--status S] [--notes TEXT]
|
|
222
223
|
[--repeat weekly|biweekly|monthly|never]
|
|
223
224
|
[--waits-on TASK,TASK|none] [--parent TASK|none]
|
|
@@ -430,7 +431,7 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
430
431
|
tasks that tick themselves off as you try things, from here too; harbor add
|
|
431
432
|
puts a task there while it's your only project. The brief, harbor week,
|
|
432
433
|
bridge and forecast leave it out. To look around a made-up harbor instead,
|
|
433
|
-
open harborppm.com/demo
|
|
434
|
+
open harborppm.com/demo.
|
|
434
435
|
`;
|
|
435
436
|
|
|
436
437
|
/**
|
|
@@ -588,6 +589,12 @@ const level = (v, name) => {
|
|
|
588
589
|
return n;
|
|
589
590
|
};
|
|
590
591
|
const nullable = (v) => (v === "none" ? null : v);
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* --at as people say it ("9", "9:30", "4pm", "noon") as "HH:MM"; anything
|
|
595
|
+
* else goes on as typed, for Harbor to refuse with what it takes.
|
|
596
|
+
*/
|
|
597
|
+
const atTime = (v) => readTime(String(v)) ?? String(v);
|
|
591
598
|
const REPEAT_WORD = { weekly: "every week", biweekly: "every two weeks", monthly: "every month" };
|
|
592
599
|
|
|
593
600
|
const WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
@@ -778,7 +785,8 @@ export function dayWithWeekday(iso) {
|
|
|
778
785
|
function wordsLine(r) {
|
|
779
786
|
const bits = [
|
|
780
787
|
r.owner && `${r.owner.value} (${r.owner.text})`,
|
|
781
|
-
r.due &&
|
|
788
|
+
r.due &&
|
|
789
|
+
`due ${dayWithWeekday(r.due.value)}${r.due.time ? ` at ${timeOfDay(r.due.time)}` : ""} (${r.due.text})`,
|
|
782
790
|
r.priority && `${r.priority.value} priority (${r.priority.text})`,
|
|
783
791
|
r.project && `in ${r.project.value} (${r.project.text})`,
|
|
784
792
|
].filter(Boolean);
|
|
@@ -939,7 +947,7 @@ export function hint(message, project) {
|
|
|
939
947
|
)
|
|
940
948
|
.replace(
|
|
941
949
|
/^Nothing to change: pass a field to update\.$/,
|
|
942
|
-
"Nothing to change. Say what with --title, --assignee, --also, --due, --starts, --priority, --status, --notes, --repeat, --waits-on, --parent or --milestone.",
|
|
950
|
+
"Nothing to change. Say what with --title, --assignee, --also, --due, --at, --starts, --priority, --status, --notes, --repeat, --waits-on, --parent or --milestone.",
|
|
943
951
|
)
|
|
944
952
|
.replace(
|
|
945
953
|
/^This connection was allowed to read only\..*$/s,
|
|
@@ -1023,7 +1031,8 @@ const DETAIL = {
|
|
|
1023
1031
|
" every title exactly as typed. What's read: a person after @ or \"assign",
|
|
1024
1032
|
' to"; a day after by, due, on, before or until, or as the very last',
|
|
1025
1033
|
' words ("Call the mill friday"), never after to, for or from ("Move',
|
|
1026
|
-
' the call to Friday" keeps it)
|
|
1034
|
+
' the call to Friday" keeps it), with its time beside it ("friday at 9",',
|
|
1035
|
+
' "tomorrow 3pm"); !high or "high priority"; #Project.',
|
|
1027
1036
|
" An @name that matches nobody stays in the title, and Harbor says so.",
|
|
1028
1037
|
" With --dry-run --literal it says what the words would have read as.",
|
|
1029
1038
|
"",
|
|
@@ -1049,6 +1058,10 @@ const DETAIL = {
|
|
|
1049
1058
|
" project's timeline shows each milestone under its tasks. harbor edit TASK",
|
|
1050
1059
|
" --milestone NAME|none changes or clears it.",
|
|
1051
1060
|
"",
|
|
1061
|
+
" --at TIME gives the due day a time of day (9, 9:30, 4pm, noon), on the",
|
|
1062
|
+
" owner's clock: when they mean to do it. It never makes a task late, and",
|
|
1063
|
+
" moving the day keeps it. harbor edit TASK --at TIME|none changes it.",
|
|
1064
|
+
"",
|
|
1052
1065
|
" --starts DATE gives it a start day as well as a due day, so the project's",
|
|
1053
1066
|
" timeline draws it as a bar from one to the other; a start after the due",
|
|
1054
1067
|
" day comes to the due day. harbor edit TASK --starts DATE|none moves it.",
|
|
@@ -3138,6 +3151,7 @@ export async function run(argv, io = {}) {
|
|
|
3138
3151
|
"assignee",
|
|
3139
3152
|
"also",
|
|
3140
3153
|
"due",
|
|
3154
|
+
"at",
|
|
3141
3155
|
"starts",
|
|
3142
3156
|
"priority",
|
|
3143
3157
|
"status",
|
|
@@ -3205,6 +3219,7 @@ export async function run(argv, io = {}) {
|
|
|
3205
3219
|
...(t.alsoOn ? { alsoOn: t.alsoOn } : {}),
|
|
3206
3220
|
priority: t.priority,
|
|
3207
3221
|
due: t.due,
|
|
3222
|
+
...(t.at ? { at: t.at } : {}),
|
|
3208
3223
|
...(t.starts ? { starts: t.starts } : {}),
|
|
3209
3224
|
...(t.subtaskOf ? { subtaskOf: t.subtaskOf } : {}),
|
|
3210
3225
|
...(t.milestone ? { milestone: t.milestone } : {}),
|
|
@@ -3220,6 +3235,8 @@ export async function run(argv, io = {}) {
|
|
|
3220
3235
|
assignee: values.assignee ?? words.owner?.value ?? (values.template ? undefined : "me"),
|
|
3221
3236
|
also: values.also === undefined ? undefined : alsoList(values.also),
|
|
3222
3237
|
due: duePilot(values.due) ? undefined : (dueDate(values.due) ?? words.due?.value),
|
|
3238
|
+
// --at wins; else the time said with the day in the words ("friday at 9").
|
|
3239
|
+
at: values.at !== undefined ? atTime(values.at) : values.due === undefined ? words.due?.time : undefined,
|
|
3223
3240
|
suggestedDue: duePilot(values.due),
|
|
3224
3241
|
starts: dueDate(values.starts),
|
|
3225
3242
|
priority: values.priority ?? words.priority?.value,
|
|
@@ -3548,6 +3565,7 @@ export async function run(argv, io = {}) {
|
|
|
3548
3565
|
"assignee",
|
|
3549
3566
|
"also",
|
|
3550
3567
|
"due",
|
|
3568
|
+
"at",
|
|
3551
3569
|
"starts",
|
|
3552
3570
|
"priority",
|
|
3553
3571
|
"status",
|
|
@@ -3573,6 +3591,7 @@ export async function run(argv, io = {}) {
|
|
|
3573
3591
|
? undefined
|
|
3574
3592
|
: nullable(dueDate(values.due)),
|
|
3575
3593
|
suggestedDue: duePilot(values.due),
|
|
3594
|
+
at: values.at === undefined ? undefined : values.at === "none" ? null : atTime(values.at),
|
|
3576
3595
|
starts: values.starts === undefined ? undefined : nullable(dueDate(values.starts)),
|
|
3577
3596
|
priority: values.priority,
|
|
3578
3597
|
status: values.status === undefined ? undefined : statusWord(values.status),
|
package/lib/format.mjs
CHANGED
|
@@ -39,6 +39,15 @@ export function statusWord(typed) {
|
|
|
39
39
|
export const statusText = (t) =>
|
|
40
40
|
t.column ? t.column.toLowerCase() : (STATUS[t.status] ?? t.status);
|
|
41
41
|
|
|
42
|
+
/** "09:30" as "9:30 AM", "14:00" as "2 PM": a task's time of day, as the website says it. */
|
|
43
|
+
export function timeOfDay(hhmm) {
|
|
44
|
+
const m = /^([01]\d|2[0-3]):([0-5]\d)$/.exec(hhmm ?? "");
|
|
45
|
+
if (!m) return "";
|
|
46
|
+
const h = Number(m[1]);
|
|
47
|
+
const twelve = h % 12 === 0 ? 12 : h % 12;
|
|
48
|
+
return `${twelve}${m[2] === "00" ? "" : `:${m[2]}`} ${h < 12 ? "AM" : "PM"}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
export function taskLine(t, { today, mine = false, width } = {}) {
|
|
43
52
|
const open = t.status !== "done";
|
|
44
53
|
const late = t.due && today && t.due < today && open;
|
|
@@ -46,7 +55,9 @@ export function taskLine(t, { today, mine = false, width } = {}) {
|
|
|
46
55
|
const soon = open && today && t.due ? soonWord(t.due, today) : null;
|
|
47
56
|
const bits = [
|
|
48
57
|
statusText(t),
|
|
49
|
-
t.due
|
|
58
|
+
t.due
|
|
59
|
+
? `${late ? `late, due ${t.due}` : soon ? `due ${soon}` : `due ${t.due}`}${t.at && !late ? ` at ${timeOfDay(t.at)}` : ""}`
|
|
60
|
+
: null,
|
|
50
61
|
t.priority && t.priority !== "medium" ? t.priority : null,
|
|
51
62
|
mine
|
|
52
63
|
? null
|
package/lib/words.mjs
CHANGED
|
@@ -18,3 +18,5 @@ const words = await load();
|
|
|
18
18
|
export const readTaskWords = words.readTaskWords;
|
|
19
19
|
/** @type {typeof import("../../src/lib/plain-words.ts").dayFromWords} */
|
|
20
20
|
export const dayFromWords = words.dayFromWords;
|
|
21
|
+
/** @type {typeof import("../../src/lib/time-words.ts").readTime} */
|
|
22
|
+
export const readTime = words.readTime;
|