@harborppm/cli 0.121.0 → 0.122.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 +169 -21
- package/dist/words.mjs +101 -3
- package/lib/cli.mjs +26 -7
- 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)
|
|
@@ -11109,7 +11109,106 @@ function applyReckoning(actions, projectId, r, startDate) {
|
|
|
11109
11109
|
};
|
|
11110
11110
|
}
|
|
11111
11111
|
|
|
11112
|
+
// src/lib/due-time.ts
|
|
11113
|
+
/** "9 AM", "9:30 AM", "12 PM", "12:15 AM": a time as people say it. */
|
|
11114
|
+
function timeOfDay(hhmm) {
|
|
11115
|
+
const m = HHMM$1.exec(hhmm);
|
|
11116
|
+
if (!m) return "";
|
|
11117
|
+
const h = Number(m[1]);
|
|
11118
|
+
const half = h < 12 ? "AM" : "PM";
|
|
11119
|
+
const twelve = h % 12 === 0 ? 12 : h % 12;
|
|
11120
|
+
return m[2] === "00" ? `${twelve} ${half}` : `${twelve}:${m[2]} ${half}`;
|
|
11121
|
+
}
|
|
11122
|
+
/**
|
|
11123
|
+
* Orders one day's tasks by their times: timed ones first, earliest first,
|
|
11124
|
+
* then the rest in the order they came (the sort is stable).
|
|
11125
|
+
*/
|
|
11126
|
+
function byDueTime(a, b) {
|
|
11127
|
+
const x = a.dueDate && isDueTime(a.dueTime) ? a.dueTime : null;
|
|
11128
|
+
const y = b.dueDate && isDueTime(b.dueTime) ? b.dueTime : null;
|
|
11129
|
+
if (x && y) return x < y ? -1 : x > y ? 1 : 0;
|
|
11130
|
+
return x ? -1 : y ? 1 : 0;
|
|
11131
|
+
}
|
|
11132
|
+
/** The task with no time left where it can't have one: no due day, or not a time. */
|
|
11133
|
+
function keepDueTime(task) {
|
|
11134
|
+
if (!("dueTime" in task) || task.dueTime === void 0) return task;
|
|
11135
|
+
if (task.dueTime !== null && task.dueDate && isDueTime(task.dueTime)) return task;
|
|
11136
|
+
const { dueTime: _gone, ...rest } = task;
|
|
11137
|
+
return rest;
|
|
11138
|
+
}
|
|
11139
|
+
var HHMM$1, isDueTime;
|
|
11140
|
+
var init_due_time = __esmMin((() => {
|
|
11141
|
+
HHMM$1 = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
11142
|
+
isDueTime = (v) => typeof v === "string" && HHMM$1.test(v);
|
|
11143
|
+
}));
|
|
11144
|
+
|
|
11145
|
+
// src/lib/time-words.ts
|
|
11146
|
+
init_due_time();
|
|
11147
|
+
/**
|
|
11148
|
+
* Times of day as people type or say them, for a task's time (due-time.ts):
|
|
11149
|
+
* "9", "9am", "9:30", "9.30 pm", "2p", "14:00", "noon", "midday",
|
|
11150
|
+
* "midnight". Pure, and kept out of the first load: the task panel's time
|
|
11151
|
+
* box and the plain-words reader take it when they open.
|
|
11152
|
+
*/
|
|
11153
|
+
const pad$1 = (n) => String(n).padStart(2, "0");
|
|
11154
|
+
/**
|
|
11155
|
+
* The hour a bare number most likely means when no AM or PM is said: 7 to
|
|
11156
|
+
* 11 in the morning, 12 at noon, 1 to 6 in the afternoon. "Call Nina at 3"
|
|
11157
|
+
* is three in the afternoon. In the evening ("tonight at 8"), every bare
|
|
11158
|
+
* hour before noon is PM.
|
|
11159
|
+
*/
|
|
11160
|
+
function guessHour(h, evening) {
|
|
11161
|
+
if (h >= 12) return h;
|
|
11162
|
+
if (evening) return h + 12;
|
|
11163
|
+
return h >= 1 && h <= 6 ? h + 12 : h;
|
|
11164
|
+
}
|
|
11165
|
+
/**
|
|
11166
|
+
* The time a phrase names, as "HH:MM", or null. A bare hour with no AM or
|
|
11167
|
+
* PM is read the way people mean it (`guessHour`); "0:30" or "17:00" are
|
|
11168
|
+
* taken as written.
|
|
11169
|
+
*/
|
|
11170
|
+
function readTime(text, opts = {}) {
|
|
11171
|
+
const p = text.trim().toLowerCase().replace(/^at\s+/, "").replace(/\s+/g, " ");
|
|
11172
|
+
if (p === "noon" || p === "midday" || p === "12 noon") return "12:00";
|
|
11173
|
+
if (p === "midnight") return "00:00";
|
|
11174
|
+
const m = /^(\d{1,2})(?:[:.](\d{2}))? ?(a|p|am|pm|a\.m\.?|p\.m\.?)?$/.exec(p);
|
|
11175
|
+
if (!m) return null;
|
|
11176
|
+
let h = Number(m[1]);
|
|
11177
|
+
const min = Number(m[2] ?? 0);
|
|
11178
|
+
if (min > 59) return null;
|
|
11179
|
+
const half = m[3]?.[0];
|
|
11180
|
+
if (half) {
|
|
11181
|
+
if (h < 1 || h > 12) return null;
|
|
11182
|
+
h = h % 12 + (half === "p" ? 12 : 0);
|
|
11183
|
+
} else if (m[1].length === 2 && m[1][0] === "0") {} else if (h <= 12 && !(m[2] && h === 0)) h = guessHour(h, opts.evening ?? false);
|
|
11184
|
+
if (h > 23) return null;
|
|
11185
|
+
return `${pad$1(h)}:${pad$1(min)}`;
|
|
11186
|
+
}
|
|
11187
|
+
/**
|
|
11188
|
+
* The words of a time in a sentence, for the plain-words reader: a number
|
|
11189
|
+
* with AM or PM or minutes ("9am", "9:30"), or noon and the like. A bare
|
|
11190
|
+
* number counts only after "at" (see plain-words.ts), so "by Friday 3
|
|
11191
|
+
* copies" keeps its copies.
|
|
11192
|
+
*/
|
|
11193
|
+
const TIME_WORD = "(?:\\d{1,2}(?:[:.]\\d{2})?(?: ?(?:a\\.m\\.?|p\\.m\\.?|am|pm)|[ap])|\\d{1,2}:\\d{2}|noon|midday|midnight)";
|
|
11194
|
+
/** "at 9", "at 9:30am", "at noon": after "at", a bare hour counts too. */
|
|
11195
|
+
const AT_TIME_WORD = `at (?:${TIME_WORD}|\\d{1,2})`;
|
|
11196
|
+
|
|
11112
11197
|
// src/lib/plain-words.ts
|
|
11198
|
+
/**
|
|
11199
|
+
* A new task in plain words: "Book the venue @Sam by Friday !high #Launch"
|
|
11200
|
+
* reads as the title "Book the venue", owned by Sam, due on the coming
|
|
11201
|
+
* Friday, high priority, in the Launch project. Typed or said aloud (the
|
|
11202
|
+
* composer's mic), so the spoken forms are here too: "assign to Sam",
|
|
11203
|
+
* "high priority", "due next week".
|
|
11204
|
+
*
|
|
11205
|
+
* Careful by design, so a title doesn't quietly lose words: a day counts
|
|
11206
|
+
* only after "by", "due", "on", "before" or "until", or as the very last
|
|
11207
|
+
* words (not after "to", "for" or "from": "Move the meeting to Friday"
|
|
11208
|
+
* keeps its Friday); a person only after @ or "assign to"; a project only after #. Each
|
|
11209
|
+
* thing read keeps the words it came from, so the composer can show them
|
|
11210
|
+
* and put them back. Pure.
|
|
11211
|
+
*/
|
|
11113
11212
|
const DAYS$1 = [
|
|
11114
11213
|
"sunday",
|
|
11115
11214
|
"monday",
|
|
@@ -11277,6 +11376,35 @@ function without(text, spans) {
|
|
|
11277
11376
|
for (const s of [...spans].sort((a, b) => b.start - a.start)) out = `${out.slice(0, s.start)} ${out.slice(s.end)}`;
|
|
11278
11377
|
return out.replace(/\s+([,.;:!?])/g, "$1").replace(/[,;:]+([,.;:!?])/g, "$1").replace(/\s{2,}/g, " ").replace(/(?:[\s,;:–—-]+)$/u, "").replace(/^[\s,;:]+/, "").trim();
|
|
11279
11378
|
}
|
|
11379
|
+
/**
|
|
11380
|
+
* A day read from the words, with the time said beside it when there is
|
|
11381
|
+
* one: "friday at 9", "tomorrow 3pm", "at 10:30 on monday". A bare number
|
|
11382
|
+
* counts only after "at" ("by friday 3 copies" keeps its copies).
|
|
11383
|
+
*/
|
|
11384
|
+
function withTime(text, due, free) {
|
|
11385
|
+
const evening = /tonight/i.test(text.slice(due.start, due.end));
|
|
11386
|
+
const after = new RegExp(`^(,?\\s+)(${AT_TIME_WORD}|${TIME_WORD})(?=$|[\\s,.;:!?])`, "i").exec(text.slice(due.end));
|
|
11387
|
+
if (after) {
|
|
11388
|
+
const end = due.end + after[0].length;
|
|
11389
|
+
const time = readTime(after[2], { evening });
|
|
11390
|
+
if (time && free(due.end, end)) return {
|
|
11391
|
+
...due,
|
|
11392
|
+
end,
|
|
11393
|
+
time
|
|
11394
|
+
};
|
|
11395
|
+
}
|
|
11396
|
+
const before = new RegExp(`(?:^|[\\s,])(${AT_TIME_WORD})(?: on)? $`, "i").exec(text.slice(0, due.start));
|
|
11397
|
+
if (before) {
|
|
11398
|
+
const start = before.index + before[0].indexOf(before[1]);
|
|
11399
|
+
const time = readTime(before[1], { evening });
|
|
11400
|
+
if (time && free(start, due.start)) return {
|
|
11401
|
+
...due,
|
|
11402
|
+
start,
|
|
11403
|
+
time
|
|
11404
|
+
};
|
|
11405
|
+
}
|
|
11406
|
+
return due;
|
|
11407
|
+
}
|
|
11280
11408
|
/** What a new task's words say, and the title they leave. */
|
|
11281
11409
|
function readTaskWords(input, ctx) {
|
|
11282
11410
|
const skip = ctx.skip ?? /* @__PURE__ */ new Set();
|
|
@@ -11379,7 +11507,9 @@ function readTaskWords(input, ctx) {
|
|
|
11379
11507
|
break;
|
|
11380
11508
|
}
|
|
11381
11509
|
if (!due) {
|
|
11382
|
-
const
|
|
11510
|
+
const whole = without(text, [...taken, ...nobody]);
|
|
11511
|
+
const timeAtEnd = ctx.noTime ? null : new RegExp(`[\\s,]+(?:${AT_TIME_WORD}|${TIME_WORD})[.!]?$`, "i").exec(whole);
|
|
11512
|
+
const rest = timeAtEnd ? whole.slice(0, timeAtEnd.index) : whole;
|
|
11383
11513
|
const tail = new RegExp(`(?:^|[\\s,])(${WHEN})[.!]?$`, "i").exec(rest);
|
|
11384
11514
|
const short = tail && /^(?:sun|mon|tue|wed|thu|fri|sat)$/i.test(tail[1]);
|
|
11385
11515
|
const said = tail && /\b(?:to|for|from|after|with|since)$/i.test(rest.slice(0, tail.index).trimEnd());
|
|
@@ -11395,6 +11525,7 @@ function readTaskWords(input, ctx) {
|
|
|
11395
11525
|
}
|
|
11396
11526
|
}
|
|
11397
11527
|
}
|
|
11528
|
+
if (due && !ctx.noTime) due = withTime(text, due, free);
|
|
11398
11529
|
if (due) taken.push(due);
|
|
11399
11530
|
}
|
|
11400
11531
|
const span = (f) => f ? text.slice(f.start, f.end).trim() : "";
|
|
@@ -11405,7 +11536,8 @@ function readTaskWords(input, ctx) {
|
|
|
11405
11536
|
title,
|
|
11406
11537
|
due: due ? {
|
|
11407
11538
|
value: due.value,
|
|
11408
|
-
text: span(due)
|
|
11539
|
+
text: span(due),
|
|
11540
|
+
...due.time ? { time: due.time } : {}
|
|
11409
11541
|
} : null,
|
|
11410
11542
|
owner: owner ? {
|
|
11411
11543
|
value: owner.value,
|
|
@@ -11483,7 +11615,7 @@ function readNewTask(text, data, today) {
|
|
|
11483
11615
|
});
|
|
11484
11616
|
const bits = [
|
|
11485
11617
|
words.owner && (data.people.find((p) => p.id === words.owner.value)?.name ?? "someone"),
|
|
11486
|
-
words.due && `due ${longDate(words.due.value)}`,
|
|
11618
|
+
words.due && `due ${longDate(words.due.value)}${words.due.time ? ` at ${timeOfDay(words.due.time)}` : ""}`,
|
|
11487
11619
|
words.priority && `${PRIORITY_LABEL[words.priority.value].toLowerCase()} priority`,
|
|
11488
11620
|
words.project && (data.projects.find((p) => p.id === words.project.value)?.name ?? "project")
|
|
11489
11621
|
].filter((b) => Boolean(b));
|
|
@@ -17737,7 +17869,8 @@ function NewTask({ projectId, status, width, onDone, onFull }) {
|
|
|
17737
17869
|
status: status ?? "todo",
|
|
17738
17870
|
priority: words.priority?.value ?? "medium",
|
|
17739
17871
|
assigneeId: words.owner?.value ?? (me || null),
|
|
17740
|
-
dueDate: words.due?.value ?? null
|
|
17872
|
+
dueDate: words.due?.value ?? null,
|
|
17873
|
+
...words.due?.time ? { dueTime: words.due.time } : {}
|
|
17741
17874
|
}));
|
|
17742
17875
|
}
|
|
17743
17876
|
})
|
|
@@ -26665,6 +26798,7 @@ function buildBreakdown(doc, root, today) {
|
|
|
26665
26798
|
const percentDone = (n) => n.total > 0 ? Math.round(n.done / n.total * 100) : 0;
|
|
26666
26799
|
|
|
26667
26800
|
// src/lib/mcp/tools.ts
|
|
26801
|
+
init_due_time();
|
|
26668
26802
|
init_project_messages();
|
|
26669
26803
|
init_daily_digest();
|
|
26670
26804
|
init_subtasks();
|
|
@@ -27072,6 +27206,7 @@ function taskLine(t, people, projects, all, data) {
|
|
|
27072
27206
|
position: boardPositions(all).get(t.id) ?? null,
|
|
27073
27207
|
priority: t.priority,
|
|
27074
27208
|
due: dayOf(t.dueDate),
|
|
27209
|
+
...t.dueDate && isDueTime(t.dueTime) ? { at: t.dueTime } : {},
|
|
27075
27210
|
assignee: nameOf$2(people, t.assigneeId),
|
|
27076
27211
|
...alsoOnOf(t, people),
|
|
27077
27212
|
project: project?.name ?? null,
|
|
@@ -27750,6 +27885,7 @@ const HARBOR_TOOLS = [
|
|
|
27750
27885
|
position: boardPositions(data.tasks).get(t.id) ?? null,
|
|
27751
27886
|
priority: t.priority,
|
|
27752
27887
|
due: dayOf(t.dueDate),
|
|
27888
|
+
...t.dueDate && isDueTime(t.dueTime) ? { at: t.dueTime } : {},
|
|
27753
27889
|
...t.startDate ? { starts: dayOf(t.startDate) } : {},
|
|
27754
27890
|
assignee: nameOf$2(people, t.assigneeId),
|
|
27755
27891
|
...alsoOnOf(t, people),
|
|
@@ -27849,7 +27985,7 @@ const HARBOR_TOOLS = [
|
|
|
27849
27985
|
const today = todayFor(mine, ctx.now, todayISO(ctx.now));
|
|
27850
27986
|
const people = byId(data.people);
|
|
27851
27987
|
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"));
|
|
27988
|
+
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
27989
|
const waiters = waitersByBlocker(data.tasks);
|
|
27854
27990
|
const waitingOnYou = open.flatMap((t) => (waiters.get(t.id) ?? []).filter(isOpen).map((w) => ({
|
|
27855
27991
|
yourTask: {
|
|
@@ -29645,7 +29781,8 @@ function withoutFirstDue(task) {
|
|
|
29645
29781
|
return rest;
|
|
29646
29782
|
}
|
|
29647
29783
|
/**
|
|
29648
|
-
* Keeps each task's first due day through a write
|
|
29784
|
+
* Keeps each task's first due day through a write, and drops a time of day
|
|
29785
|
+
* from a task left with no day (due-time.ts): only tasks whose object
|
|
29649
29786
|
* changed are looked at, so a write that doesn't touch tasks costs nothing.
|
|
29650
29787
|
*/
|
|
29651
29788
|
function keepFirstDue(before, after) {
|
|
@@ -29654,8 +29791,8 @@ function keepFirstDue(before, after) {
|
|
|
29654
29791
|
let changed = false;
|
|
29655
29792
|
const tasks = after.tasks.map((t) => {
|
|
29656
29793
|
const old = was.get(t.id);
|
|
29657
|
-
if (
|
|
29658
|
-
const next = firstDueAfter(old, t);
|
|
29794
|
+
if (old === t) return t;
|
|
29795
|
+
const next = keepDueTime(old ? firstDueAfter(old, t) : t);
|
|
29659
29796
|
if (next !== t) changed = true;
|
|
29660
29797
|
return next;
|
|
29661
29798
|
});
|
|
@@ -29666,6 +29803,7 @@ function keepFirstDue(before, after) {
|
|
|
29666
29803
|
}
|
|
29667
29804
|
var day;
|
|
29668
29805
|
var init_first_due = __esmMin((() => {
|
|
29806
|
+
init_due_time();
|
|
29669
29807
|
init_indexes();
|
|
29670
29808
|
day = (iso) => iso ? iso.slice(0, 10) : null;
|
|
29671
29809
|
}));
|
|
@@ -30806,14 +30944,24 @@ var init_hierarchy = __esmMin((() => {
|
|
|
30806
30944
|
}));
|
|
30807
30945
|
|
|
30808
30946
|
// src/lib/github-refs.ts
|
|
30809
|
-
/**
|
|
30947
|
+
/**
|
|
30948
|
+
* The task's list with this pull request or commit added, or updated in place, newest first.
|
|
30949
|
+
* The pull request that made the task stays marked as its maker, and stays on the list.
|
|
30950
|
+
*/
|
|
30810
30951
|
function withRef(list, ref) {
|
|
30811
|
-
const
|
|
30812
|
-
|
|
30813
|
-
|
|
30814
|
-
|
|
30952
|
+
const next = (list ?? []).find((r) => sameRef(r, ref))?.made && !ref.made ? {
|
|
30953
|
+
...ref,
|
|
30954
|
+
made: true
|
|
30955
|
+
} : ref;
|
|
30956
|
+
const rest = (list ?? []).filter((r) => !sameRef(r, ref));
|
|
30957
|
+
const kept = [next, ...rest].slice(0, 20);
|
|
30958
|
+
const maker = rest.find((r) => r.made);
|
|
30959
|
+
return maker && !kept.includes(maker) ? [...kept.slice(0, 19), maker] : kept;
|
|
30960
|
+
}
|
|
30961
|
+
var REFS_KEPT, sameRef;
|
|
30815
30962
|
var init_github_refs = __esmMin((() => {
|
|
30816
30963
|
REFS_KEPT = 20;
|
|
30964
|
+
sameRef = (a, b) => a.kind === b.kind && a.repo === b.repo && a.ref === b.ref;
|
|
30817
30965
|
}));
|
|
30818
30966
|
|
|
30819
30967
|
// src/lib/automations.ts
|
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]
|
|
@@ -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;
|