@harborppm/cli 0.120.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 +229 -33
- 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)
|
|
@@ -3224,7 +3224,43 @@ function trialDaysLeft(trialEndsAt, now = /* @__PURE__ */ new Date()) {
|
|
|
3224
3224
|
return Math.ceil(ms / 864e5);
|
|
3225
3225
|
}
|
|
3226
3226
|
|
|
3227
|
+
// src/lib/roles.ts
|
|
3228
|
+
/** Anything stored that is not a known role reads as a member, as before roles existed. */
|
|
3229
|
+
function normalizeRole(raw) {
|
|
3230
|
+
return raw === "owner" || raw === "admin" || raw === "viewer" ? raw : "member";
|
|
3231
|
+
}
|
|
3232
|
+
/** Who may invite, take back an invite, switch roles and remove someone: the owner and admins. */
|
|
3233
|
+
function runsCrew(role) {
|
|
3234
|
+
return role === "owner" || role === "admin";
|
|
3235
|
+
}
|
|
3236
|
+
/**
|
|
3237
|
+
* The roles `actor` may set on someone who is `target` now. The owner never
|
|
3238
|
+
* changes here (that's a handover). The owner may set any crew role; an
|
|
3239
|
+
* admin only moves members and viewers between editing and viewing, so an
|
|
3240
|
+
* admin can't make more admins or undo another's.
|
|
3241
|
+
*/
|
|
3242
|
+
function rolesToOffer(actor, target) {
|
|
3243
|
+
const them = normalizeRole(target);
|
|
3244
|
+
if (them === "owner") return [];
|
|
3245
|
+
if (actor === "owner") return [...CREW_ROLES];
|
|
3246
|
+
if (actor === "admin" && (them === "member" || them === "viewer")) return ["member", "viewer"];
|
|
3247
|
+
return [];
|
|
3248
|
+
}
|
|
3249
|
+
/** Whether `actor` may set `target` (someone else) to `to`. */
|
|
3250
|
+
function mayChangeRole(actor, target, to) {
|
|
3251
|
+
return rolesToOffer(actor, target).includes(to);
|
|
3252
|
+
}
|
|
3253
|
+
var CREW_ROLES;
|
|
3254
|
+
var init_roles = __esmMin((() => {
|
|
3255
|
+
CREW_ROLES = [
|
|
3256
|
+
"admin",
|
|
3257
|
+
"member",
|
|
3258
|
+
"viewer"
|
|
3259
|
+
];
|
|
3260
|
+
}));
|
|
3261
|
+
|
|
3227
3262
|
// src/lib/forecast.ts
|
|
3263
|
+
init_roles();
|
|
3228
3264
|
init_date_fns();
|
|
3229
3265
|
const day$11 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
3230
3266
|
/**
|
|
@@ -5784,6 +5820,7 @@ function charterNote(project, tasks, today) {
|
|
|
5784
5820
|
}
|
|
5785
5821
|
const ROLE_LABEL = {
|
|
5786
5822
|
owner: "Owner",
|
|
5823
|
+
admin: "Admin",
|
|
5787
5824
|
member: "Can edit",
|
|
5788
5825
|
viewer: "View only"
|
|
5789
5826
|
};
|
|
@@ -5797,6 +5834,7 @@ const bare = (url) => url.replace(/^https?:\/\//, "");
|
|
|
5797
5834
|
*/
|
|
5798
5835
|
function crewRows(crew, data, now) {
|
|
5799
5836
|
const owner = crew.harbor.role === "owner";
|
|
5837
|
+
const lead = runsCrew(crew.harbor.role);
|
|
5800
5838
|
const rows = [];
|
|
5801
5839
|
const nameWidth = Math.min(24, Math.max(0, ...crew.members.map((m) => (m.name ?? "").length)));
|
|
5802
5840
|
rows.push({
|
|
@@ -5813,9 +5851,9 @@ function crewRows(crew, data, now) {
|
|
|
5813
5851
|
].filter(Boolean).join(" · "),
|
|
5814
5852
|
userId: m.userId,
|
|
5815
5853
|
role: m.role,
|
|
5816
|
-
changeable:
|
|
5854
|
+
changeable: m.userId !== crew.you && mayChangeRole(crew.harbor.role, m.role, "member") && mayChangeRole(crew.harbor.role, m.role, "viewer")
|
|
5817
5855
|
});
|
|
5818
|
-
if (!
|
|
5856
|
+
if (!lead) {
|
|
5819
5857
|
const by = crew.members.find((m) => m.role === "owner");
|
|
5820
5858
|
rows.push({
|
|
5821
5859
|
kind: "note",
|
|
@@ -5837,6 +5875,15 @@ function crewRows(crew, data, now) {
|
|
|
5837
5875
|
token: i.token,
|
|
5838
5876
|
url: i.url
|
|
5839
5877
|
});
|
|
5878
|
+
}
|
|
5879
|
+
if (lead && !owner) {
|
|
5880
|
+
const by = crew.members.find((m) => m.role === "owner");
|
|
5881
|
+
rows.push({
|
|
5882
|
+
kind: "note",
|
|
5883
|
+
text: `${by?.name || "The owner"} makes share links and intake forms.`
|
|
5884
|
+
});
|
|
5885
|
+
}
|
|
5886
|
+
if (owner) {
|
|
5840
5887
|
rows.push({
|
|
5841
5888
|
kind: "heading",
|
|
5842
5889
|
text: "Share links: a portfolio, read-only, for anyone with the link"
|
|
@@ -11062,7 +11109,106 @@ function applyReckoning(actions, projectId, r, startDate) {
|
|
|
11062
11109
|
};
|
|
11063
11110
|
}
|
|
11064
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
|
+
|
|
11065
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
|
+
*/
|
|
11066
11212
|
const DAYS$1 = [
|
|
11067
11213
|
"sunday",
|
|
11068
11214
|
"monday",
|
|
@@ -11230,6 +11376,35 @@ function without(text, spans) {
|
|
|
11230
11376
|
for (const s of [...spans].sort((a, b) => b.start - a.start)) out = `${out.slice(0, s.start)} ${out.slice(s.end)}`;
|
|
11231
11377
|
return out.replace(/\s+([,.;:!?])/g, "$1").replace(/[,;:]+([,.;:!?])/g, "$1").replace(/\s{2,}/g, " ").replace(/(?:[\s,;:–—-]+)$/u, "").replace(/^[\s,;:]+/, "").trim();
|
|
11232
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
|
+
}
|
|
11233
11408
|
/** What a new task's words say, and the title they leave. */
|
|
11234
11409
|
function readTaskWords(input, ctx) {
|
|
11235
11410
|
const skip = ctx.skip ?? /* @__PURE__ */ new Set();
|
|
@@ -11332,7 +11507,9 @@ function readTaskWords(input, ctx) {
|
|
|
11332
11507
|
break;
|
|
11333
11508
|
}
|
|
11334
11509
|
if (!due) {
|
|
11335
|
-
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;
|
|
11336
11513
|
const tail = new RegExp(`(?:^|[\\s,])(${WHEN})[.!]?$`, "i").exec(rest);
|
|
11337
11514
|
const short = tail && /^(?:sun|mon|tue|wed|thu|fri|sat)$/i.test(tail[1]);
|
|
11338
11515
|
const said = tail && /\b(?:to|for|from|after|with|since)$/i.test(rest.slice(0, tail.index).trimEnd());
|
|
@@ -11348,6 +11525,7 @@ function readTaskWords(input, ctx) {
|
|
|
11348
11525
|
}
|
|
11349
11526
|
}
|
|
11350
11527
|
}
|
|
11528
|
+
if (due && !ctx.noTime) due = withTime(text, due, free);
|
|
11351
11529
|
if (due) taken.push(due);
|
|
11352
11530
|
}
|
|
11353
11531
|
const span = (f) => f ? text.slice(f.start, f.end).trim() : "";
|
|
@@ -11358,7 +11536,8 @@ function readTaskWords(input, ctx) {
|
|
|
11358
11536
|
title,
|
|
11359
11537
|
due: due ? {
|
|
11360
11538
|
value: due.value,
|
|
11361
|
-
text: span(due)
|
|
11539
|
+
text: span(due),
|
|
11540
|
+
...due.time ? { time: due.time } : {}
|
|
11362
11541
|
} : null,
|
|
11363
11542
|
owner: owner ? {
|
|
11364
11543
|
value: owner.value,
|
|
@@ -11436,7 +11615,7 @@ function readNewTask(text, data, today) {
|
|
|
11436
11615
|
});
|
|
11437
11616
|
const bits = [
|
|
11438
11617
|
words.owner && (data.people.find((p) => p.id === words.owner.value)?.name ?? "someone"),
|
|
11439
|
-
words.due && `due ${longDate(words.due.value)}`,
|
|
11618
|
+
words.due && `due ${longDate(words.due.value)}${words.due.time ? ` at ${timeOfDay(words.due.time)}` : ""}`,
|
|
11440
11619
|
words.priority && `${PRIORITY_LABEL[words.priority.value].toLowerCase()} priority`,
|
|
11441
11620
|
words.project && (data.projects.find((p) => p.id === words.project.value)?.name ?? "project")
|
|
11442
11621
|
].filter((b) => Boolean(b));
|
|
@@ -12916,6 +13095,7 @@ function CalendarView({ active, width, height, go }) {
|
|
|
12916
13095
|
* opening and after each change (mcp/app.server.ts answerCrew).
|
|
12917
13096
|
*/
|
|
12918
13097
|
init_clock();
|
|
13098
|
+
init_roles();
|
|
12919
13099
|
const actionable = (r) => r.kind !== "heading" && r.kind !== "note";
|
|
12920
13100
|
/** What the chosen line's keys do, for the line along the bottom. */
|
|
12921
13101
|
function rowHints(r, owner) {
|
|
@@ -12967,6 +13147,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
12967
13147
|
const chosen = picks.length ? picks[Math.min(at, picks.length - 1)] : -1;
|
|
12968
13148
|
const row = chosen >= 0 ? rows[chosen] : void 0;
|
|
12969
13149
|
const owner = crew?.harbor.role === "owner";
|
|
13150
|
+
const lead = runsCrew(crew?.harbor.role);
|
|
12970
13151
|
/** One change, then the screen as Harbor now has it; `said` words the notice. */
|
|
12971
13152
|
const run = (act, said) => {
|
|
12972
13153
|
if (!workspaceId || busy) return;
|
|
@@ -13015,7 +13196,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
13015
13196
|
if (key.pageDown) return setAt((i) => Math.min(picks.length - 1, i + 10));
|
|
13016
13197
|
if (key.pageUp) return setAt((i) => Math.max(0, i - 10));
|
|
13017
13198
|
if (!crew) return;
|
|
13018
|
-
if (
|
|
13199
|
+
if (lead && input === "i") return invite();
|
|
13019
13200
|
if (owner && input === "s") {
|
|
13020
13201
|
if (!portfolios.length) return go.notify("There's no portfolio to share yet.");
|
|
13021
13202
|
return go.pick("Share which portfolio, read-only?", portfolios.map((p) => ({
|
|
@@ -13135,7 +13316,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
13135
13316
|
"i invite",
|
|
13136
13317
|
"s share link",
|
|
13137
13318
|
"f intake form"
|
|
13138
|
-
] : []];
|
|
13319
|
+
] : lead ? ["i invite"] : []];
|
|
13139
13320
|
const view = windowOf(rows, Math.max(0, chosen), Math.max(3, height - 3));
|
|
13140
13321
|
return /* @__PURE__ */ jsxs(Box, {
|
|
13141
13322
|
flexDirection: "column",
|
|
@@ -13144,7 +13325,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
13144
13325
|
paddingX: 1,
|
|
13145
13326
|
children: [
|
|
13146
13327
|
/* @__PURE__ */ jsx(Heading, {
|
|
13147
|
-
right: owner ? "you're the owner" : `you ${crew.harbor.role === "viewer" ? "can view" : "can edit"}`,
|
|
13328
|
+
right: owner ? "you're the owner" : lead ? "you're an admin" : `you ${crew.harbor.role === "viewer" ? "can view" : "can edit"}`,
|
|
13148
13329
|
children: "Crew"
|
|
13149
13330
|
}),
|
|
13150
13331
|
view.items.map((r, n) => {
|
|
@@ -17688,7 +17869,8 @@ function NewTask({ projectId, status, width, onDone, onFull }) {
|
|
|
17688
17869
|
status: status ?? "todo",
|
|
17689
17870
|
priority: words.priority?.value ?? "medium",
|
|
17690
17871
|
assigneeId: words.owner?.value ?? (me || null),
|
|
17691
|
-
dueDate: words.due?.value ?? null
|
|
17872
|
+
dueDate: words.due?.value ?? null,
|
|
17873
|
+
...words.due?.time ? { dueTime: words.due.time } : {}
|
|
17692
17874
|
}));
|
|
17693
17875
|
}
|
|
17694
17876
|
})
|
|
@@ -26616,6 +26798,7 @@ function buildBreakdown(doc, root, today) {
|
|
|
26616
26798
|
const percentDone = (n) => n.total > 0 ? Math.round(n.done / n.total * 100) : 0;
|
|
26617
26799
|
|
|
26618
26800
|
// src/lib/mcp/tools.ts
|
|
26801
|
+
init_due_time();
|
|
26619
26802
|
init_project_messages();
|
|
26620
26803
|
init_daily_digest();
|
|
26621
26804
|
init_subtasks();
|
|
@@ -27023,6 +27206,7 @@ function taskLine(t, people, projects, all, data) {
|
|
|
27023
27206
|
position: boardPositions(all).get(t.id) ?? null,
|
|
27024
27207
|
priority: t.priority,
|
|
27025
27208
|
due: dayOf(t.dueDate),
|
|
27209
|
+
...t.dueDate && isDueTime(t.dueTime) ? { at: t.dueTime } : {},
|
|
27026
27210
|
assignee: nameOf$2(people, t.assigneeId),
|
|
27027
27211
|
...alsoOnOf(t, people),
|
|
27028
27212
|
project: project?.name ?? null,
|
|
@@ -27701,6 +27885,7 @@ const HARBOR_TOOLS = [
|
|
|
27701
27885
|
position: boardPositions(data.tasks).get(t.id) ?? null,
|
|
27702
27886
|
priority: t.priority,
|
|
27703
27887
|
due: dayOf(t.dueDate),
|
|
27888
|
+
...t.dueDate && isDueTime(t.dueTime) ? { at: t.dueTime } : {},
|
|
27704
27889
|
...t.startDate ? { starts: dayOf(t.startDate) } : {},
|
|
27705
27890
|
assignee: nameOf$2(people, t.assigneeId),
|
|
27706
27891
|
...alsoOnOf(t, people),
|
|
@@ -27800,7 +27985,7 @@ const HARBOR_TOOLS = [
|
|
|
27800
27985
|
const today = todayFor(mine, ctx.now, todayISO(ctx.now));
|
|
27801
27986
|
const people = byId(data.people);
|
|
27802
27987
|
const projects = byId(data.projects);
|
|
27803
|
-
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));
|
|
27804
27989
|
const waiters = waitersByBlocker(data.tasks);
|
|
27805
27990
|
const waitingOnYou = open.flatMap((t) => (waiters.get(t.id) ?? []).filter(isOpen).map((w) => ({
|
|
27806
27991
|
yourTask: {
|
|
@@ -29596,7 +29781,8 @@ function withoutFirstDue(task) {
|
|
|
29596
29781
|
return rest;
|
|
29597
29782
|
}
|
|
29598
29783
|
/**
|
|
29599
|
-
* 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
|
|
29600
29786
|
* changed are looked at, so a write that doesn't touch tasks costs nothing.
|
|
29601
29787
|
*/
|
|
29602
29788
|
function keepFirstDue(before, after) {
|
|
@@ -29605,8 +29791,8 @@ function keepFirstDue(before, after) {
|
|
|
29605
29791
|
let changed = false;
|
|
29606
29792
|
const tasks = after.tasks.map((t) => {
|
|
29607
29793
|
const old = was.get(t.id);
|
|
29608
|
-
if (
|
|
29609
|
-
const next = firstDueAfter(old, t);
|
|
29794
|
+
if (old === t) return t;
|
|
29795
|
+
const next = keepDueTime(old ? firstDueAfter(old, t) : t);
|
|
29610
29796
|
if (next !== t) changed = true;
|
|
29611
29797
|
return next;
|
|
29612
29798
|
});
|
|
@@ -29617,6 +29803,7 @@ function keepFirstDue(before, after) {
|
|
|
29617
29803
|
}
|
|
29618
29804
|
var day;
|
|
29619
29805
|
var init_first_due = __esmMin((() => {
|
|
29806
|
+
init_due_time();
|
|
29620
29807
|
init_indexes();
|
|
29621
29808
|
day = (iso) => iso ? iso.slice(0, 10) : null;
|
|
29622
29809
|
}));
|
|
@@ -30757,14 +30944,24 @@ var init_hierarchy = __esmMin((() => {
|
|
|
30757
30944
|
}));
|
|
30758
30945
|
|
|
30759
30946
|
// src/lib/github-refs.ts
|
|
30760
|
-
/**
|
|
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
|
+
*/
|
|
30761
30951
|
function withRef(list, ref) {
|
|
30762
|
-
const
|
|
30763
|
-
|
|
30764
|
-
|
|
30765
|
-
|
|
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;
|
|
30766
30962
|
var init_github_refs = __esmMin((() => {
|
|
30767
30963
|
REFS_KEPT = 20;
|
|
30964
|
+
sameRef = (a, b) => a.kind === b.kind && a.repo === b.repo && a.ref === b.ref;
|
|
30768
30965
|
}));
|
|
30769
30966
|
|
|
30770
30967
|
// src/lib/automations.ts
|
|
@@ -31494,6 +31691,12 @@ function tasksSlice({ set, get, write }) {
|
|
|
31494
31691
|
for (const mark of marks) have.add(mark);
|
|
31495
31692
|
set({ readPingIds: [...have] });
|
|
31496
31693
|
},
|
|
31694
|
+
forgetReads: (marks) => {
|
|
31695
|
+
const drop = new Set(marks);
|
|
31696
|
+
const ids = get().readPingIds ?? [];
|
|
31697
|
+
if (!ids.some((id) => drop.has(id))) return;
|
|
31698
|
+
set({ readPingIds: ids.filter((id) => !drop.has(id)) });
|
|
31699
|
+
},
|
|
31497
31700
|
tickVoyage: (ids) => {
|
|
31498
31701
|
const ticked = get().tasks.filter((t) => ids.includes(t.id) && t.status !== "done" && !isExternal(t));
|
|
31499
31702
|
if (ticked.length === 0) return;
|
|
@@ -32936,13 +33139,6 @@ var init_live_changes = __esmMin((() => {
|
|
|
32936
33139
|
NOT_WHOLE = [...ROW_COLLECTIONS, "currentUserId"];
|
|
32937
33140
|
}));
|
|
32938
33141
|
|
|
32939
|
-
// src/lib/roles.ts
|
|
32940
|
-
/** Anything stored that is not a known role reads as a member, as before roles existed. */
|
|
32941
|
-
function normalizeRole(raw) {
|
|
32942
|
-
return raw === "owner" || raw === "viewer" ? raw : "member";
|
|
32943
|
-
}
|
|
32944
|
-
var init_roles = __esmMin((() => {}));
|
|
32945
|
-
|
|
32946
33142
|
// src/lib/sync-state.ts
|
|
32947
33143
|
/** Wait before the nth retry (0-based): 2 s, 4 s, 8 s, 16 s, then every 30 s. */
|
|
32948
33144
|
function retryDelay(attempt) {
|
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;
|