@harborppm/cli 0.119.0 → 0.121.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 +9 -1
- package/bin/harbor.mjs +9 -2
- package/dist/app.mjs +202 -96
- package/lib/args.mjs +35 -1
- package/lib/cli.mjs +116 -35
- package/lib/format.mjs +9 -2
- package/lib/paint.mjs +137 -0
- package/package.json +1 -1
package/dist/app.mjs
CHANGED
|
@@ -18,18 +18,18 @@ var __esmMin = (fn, res, err) => () => {
|
|
|
18
18
|
throw err = [e], e;
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
var __exportAll = (all,
|
|
22
|
-
let target = {};
|
|
21
|
+
var __exportAll = (all, flags) => {
|
|
22
|
+
let target = Object.setPrototypeOf({}, null);
|
|
23
23
|
for (var name in all) {
|
|
24
24
|
__defProp(target, name, {
|
|
25
25
|
get: all[name],
|
|
26
26
|
enumerable: true
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
if (!
|
|
29
|
+
if (!(flags & 1)) {
|
|
30
30
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
31
31
|
}
|
|
32
|
-
return target;
|
|
32
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// src/lib/clock.ts
|
|
@@ -653,11 +653,11 @@ var init_esm = __esmMin((() => {
|
|
|
653
653
|
}));
|
|
654
654
|
|
|
655
655
|
// src/tui/context.tsx
|
|
656
|
-
init_utils();
|
|
657
656
|
/**
|
|
658
657
|
* What every screen of the terminal app reaches for: the store, the sync
|
|
659
658
|
* loop, who is signed in and the harbors they belong to.
|
|
660
659
|
*/
|
|
660
|
+
init_utils();
|
|
661
661
|
init_esm();
|
|
662
662
|
const Deps = createContext(null);
|
|
663
663
|
const DepsProvider = Deps.Provider;
|
|
@@ -2514,8 +2514,7 @@ function wipFullMessage(overflow) {
|
|
|
2514
2514
|
function columnWip(data, projectId, status, extra = 1) {
|
|
2515
2515
|
const col = boardConfigOf(data, projectId).columns.find((c) => c.status === status);
|
|
2516
2516
|
if (!col) return null;
|
|
2517
|
-
|
|
2518
|
-
return wipOverflow(col, current, extra);
|
|
2517
|
+
return wipOverflow(col, tasksOf(data.tasks, projectId).filter((t) => t.status === status && !isSubtask(t, data.tasks)).length, extra);
|
|
2519
2518
|
}
|
|
2520
2519
|
var BOARD_PRESETS, ALL_FIELDS, DEFAULT_DOING_WIP, DEFAULT_REVIEW_WIP, WIP_CAP_CHOICES;
|
|
2521
2520
|
var init_board = __esmMin((() => {
|
|
@@ -3225,9 +3224,45 @@ function trialDaysLeft(trialEndsAt, now = /* @__PURE__ */ new Date()) {
|
|
|
3225
3224
|
return Math.ceil(ms / 864e5);
|
|
3226
3225
|
}
|
|
3227
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
|
+
|
|
3228
3262
|
// src/lib/forecast.ts
|
|
3263
|
+
init_roles();
|
|
3229
3264
|
init_date_fns();
|
|
3230
|
-
const day$
|
|
3265
|
+
const day$11 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
3231
3266
|
/**
|
|
3232
3267
|
* A straight-line estimate at completion from the burn so far: spend divided
|
|
3233
3268
|
* by the share of the schedule elapsed. Null before anything is spent or
|
|
@@ -3236,8 +3271,8 @@ const day$10 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
|
3236
3271
|
*/
|
|
3237
3272
|
function forecastAtCompletion(item, now) {
|
|
3238
3273
|
if (item.spent <= 0) return null;
|
|
3239
|
-
const total = differenceInCalendarDays(day$
|
|
3240
|
-
const gone = differenceInCalendarDays(now, day$
|
|
3274
|
+
const total = differenceInCalendarDays(day$11(item.endDate), day$11(item.startDate)) + 1;
|
|
3275
|
+
const gone = differenceInCalendarDays(now, day$11(item.startDate)) + 1;
|
|
3241
3276
|
if (total <= 0 || gone <= 0) return null;
|
|
3242
3277
|
const elapsed = Math.min(1, gone / total);
|
|
3243
3278
|
const eac = Math.round(item.spent / elapsed);
|
|
@@ -3911,7 +3946,7 @@ function weeklyFinished(tasks, startDate, now, weeks = 6) {
|
|
|
3911
3946
|
return counts;
|
|
3912
3947
|
}
|
|
3913
3948
|
function hash(text) {
|
|
3914
|
-
let h =
|
|
3949
|
+
let h = 0x811c9dc5;
|
|
3915
3950
|
for (let i = 0; i < text.length; i++) {
|
|
3916
3951
|
h ^= text.charCodeAt(i);
|
|
3917
3952
|
h = Math.imul(h, 16777619);
|
|
@@ -3922,7 +3957,7 @@ function hash(text) {
|
|
|
3922
3957
|
function random(seed) {
|
|
3923
3958
|
let a = seed;
|
|
3924
3959
|
return () => {
|
|
3925
|
-
a = a +
|
|
3960
|
+
a = a + 0x6d2b79f5 | 0;
|
|
3926
3961
|
let t = Math.imul(a ^ a >>> 15, 1 | a);
|
|
3927
3962
|
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
3928
3963
|
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
@@ -3934,7 +3969,7 @@ function simulate(remaining, weekly, seed, pace = 1, shares = null) {
|
|
|
3934
3969
|
const out = [];
|
|
3935
3970
|
for (let run = 0; run < TRIALS; run++) {
|
|
3936
3971
|
let left = remaining;
|
|
3937
|
-
let days =
|
|
3972
|
+
let days = 1e400;
|
|
3938
3973
|
for (let week = 0; week < MAX_WEEKS; week++) {
|
|
3939
3974
|
const drawn = weekly[Math.floor(next() * weekly.length)];
|
|
3940
3975
|
let closed = pace === 1 ? drawn : Math.floor(drawn * pace) + (next() < drawn * pace % 1 ? 1 : 0);
|
|
@@ -4484,7 +4519,7 @@ init_tide();
|
|
|
4484
4519
|
init_raid();
|
|
4485
4520
|
init_flow();
|
|
4486
4521
|
init_date_fns();
|
|
4487
|
-
const day$
|
|
4522
|
+
const day$10 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
4488
4523
|
function monthKey(iso) {
|
|
4489
4524
|
return iso.slice(0, 7);
|
|
4490
4525
|
}
|
|
@@ -4500,7 +4535,7 @@ function monthsBetween(from, to) {
|
|
|
4500
4535
|
return out;
|
|
4501
4536
|
}
|
|
4502
4537
|
function daysIn(key) {
|
|
4503
|
-
return getDaysInMonth(day$
|
|
4538
|
+
return getDaysInMonth(day$10(`${key}-01`));
|
|
4504
4539
|
}
|
|
4505
4540
|
/** How many of the schedule's days fall in `key`. */
|
|
4506
4541
|
function overlapDays(key, start, end) {
|
|
@@ -4508,7 +4543,7 @@ function overlapDays(key, start, end) {
|
|
|
4508
4543
|
const lastDay = `${key}-${String(daysIn(key)).padStart(2, "0")}`;
|
|
4509
4544
|
const from = start > first ? start : first;
|
|
4510
4545
|
const to = end < lastDay ? end : lastDay;
|
|
4511
|
-
return to < from ? 0 : differenceInCalendarDays(day$
|
|
4546
|
+
return to < from ? 0 : differenceInCalendarDays(day$10(to), day$10(from)) + 1;
|
|
4512
4547
|
}
|
|
4513
4548
|
/**
|
|
4514
4549
|
* The budget spread straight across the schedule: each month gets the share
|
|
@@ -4518,7 +4553,7 @@ function overlapDays(key, start, end) {
|
|
|
4518
4553
|
function evenPhasing(project) {
|
|
4519
4554
|
const end = project.endDate < project.startDate ? project.startDate : project.endDate;
|
|
4520
4555
|
const months = monthsBetween(project.startDate, end);
|
|
4521
|
-
const total = differenceInCalendarDays(day$
|
|
4556
|
+
const total = differenceInCalendarDays(day$10(end), day$10(project.startDate)) + 1;
|
|
4522
4557
|
const out = {};
|
|
4523
4558
|
let placed = 0;
|
|
4524
4559
|
months.forEach((k, i) => {
|
|
@@ -4625,7 +4660,7 @@ function hasBaseline(p) {
|
|
|
4625
4660
|
/** Days the end has moved past the baseline end; negative when it came in. Null without a baseline. */
|
|
4626
4661
|
function slipDays(p) {
|
|
4627
4662
|
if (!p.baselineEnd) return null;
|
|
4628
|
-
return differenceInCalendarDays(day$
|
|
4663
|
+
return differenceInCalendarDays(day$9(p.endDate), day$9(p.baselineEnd));
|
|
4629
4664
|
}
|
|
4630
4665
|
/**
|
|
4631
4666
|
* The projects with the current dates committed as their baseline; ones that
|
|
@@ -4647,10 +4682,10 @@ function slipLabel(p) {
|
|
|
4647
4682
|
const n = Math.abs(slip);
|
|
4648
4683
|
return slip > 0 ? `slipped ${n} day${n === 1 ? "" : "s"}` : `${n} day${n === 1 ? "" : "s"} early`;
|
|
4649
4684
|
}
|
|
4650
|
-
var day$
|
|
4685
|
+
var day$9;
|
|
4651
4686
|
var init_baseline = __esmMin((() => {
|
|
4652
4687
|
init_date_fns();
|
|
4653
|
-
day$
|
|
4688
|
+
day$9 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
4654
4689
|
}));
|
|
4655
4690
|
|
|
4656
4691
|
// src/lib/roadmap.ts
|
|
@@ -4678,7 +4713,7 @@ const ZOOMS = [
|
|
|
4678
4713
|
step: 3
|
|
4679
4714
|
}
|
|
4680
4715
|
];
|
|
4681
|
-
const day$
|
|
4716
|
+
const day$8 = (iso) => /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T12:00:00`);
|
|
4682
4717
|
/** Names in the order people expect: "Phase 2" before "Phase 10". */
|
|
4683
4718
|
const byName = (a, b) => a.localeCompare(b, void 0, { numeric: true });
|
|
4684
4719
|
const isoDay$4 = (d) => format(d, "yyyy-MM-dd");
|
|
@@ -4688,7 +4723,7 @@ const isoDay$4 = (d) => format(d, "yyyy-MM-dd");
|
|
|
4688
4723
|
*/
|
|
4689
4724
|
function roadmapWindow(zoom, today, shift = 0) {
|
|
4690
4725
|
const z = ZOOMS.find((x) => x.id === zoom) ?? ZOOMS[1];
|
|
4691
|
-
const first = addMonths$1(startOfMonth(day$
|
|
4726
|
+
const first = addMonths$1(startOfMonth(day$8(today)), -1 + shift * z.step);
|
|
4692
4727
|
const after = addMonths$1(first, z.months);
|
|
4693
4728
|
const days = differenceInCalendarDays(after, first);
|
|
4694
4729
|
const months = Array.from({ length: z.months }, (_, i) => {
|
|
@@ -4712,15 +4747,15 @@ function roadmapWindow(zoom, today, shift = 0) {
|
|
|
4712
4747
|
function at(iso, w) {
|
|
4713
4748
|
if (!iso) return null;
|
|
4714
4749
|
if (iso < w.start || iso >= w.end) return null;
|
|
4715
|
-
return differenceInCalendarDays(day$
|
|
4750
|
+
return differenceInCalendarDays(day$8(iso), day$8(w.start)) / w.days;
|
|
4716
4751
|
}
|
|
4717
4752
|
/** A bar for a start–end span, clipped to the window; null when it's wholly outside. */
|
|
4718
4753
|
function span$1(start, end, w) {
|
|
4719
4754
|
if (!start || !end || end < w.start || start >= w.end) return null;
|
|
4720
4755
|
const from = start < w.start ? w.start : start;
|
|
4721
|
-
const until = end >= w.end ? w.end : isoDay$4(new Date(day$
|
|
4722
|
-
const left = differenceInCalendarDays(day$
|
|
4723
|
-
const right = differenceInCalendarDays(day$
|
|
4756
|
+
const until = end >= w.end ? w.end : isoDay$4(new Date(day$8(end).getTime() + 864e5));
|
|
4757
|
+
const left = differenceInCalendarDays(day$8(from), day$8(w.start)) / w.days;
|
|
4758
|
+
const right = differenceInCalendarDays(day$8(until), day$8(w.start)) / w.days;
|
|
4724
4759
|
return {
|
|
4725
4760
|
left,
|
|
4726
4761
|
width: Math.max(right - left, 1 / w.days),
|
|
@@ -4835,7 +4870,7 @@ function scoreMatch(query, name, ...secondary) {
|
|
|
4835
4870
|
return tokens.every((t) => blob.includes(t)) ? SCORE.anywhere : 0;
|
|
4836
4871
|
}
|
|
4837
4872
|
/** Keep what matches, best first. Ties keep the caller's order. */
|
|
4838
|
-
function rank(items, score, limit =
|
|
4873
|
+
function rank(items, score, limit = 1e400) {
|
|
4839
4874
|
const out = [];
|
|
4840
4875
|
items.forEach((item, index) => {
|
|
4841
4876
|
const s = score(item);
|
|
@@ -5785,6 +5820,7 @@ function charterNote(project, tasks, today) {
|
|
|
5785
5820
|
}
|
|
5786
5821
|
const ROLE_LABEL = {
|
|
5787
5822
|
owner: "Owner",
|
|
5823
|
+
admin: "Admin",
|
|
5788
5824
|
member: "Can edit",
|
|
5789
5825
|
viewer: "View only"
|
|
5790
5826
|
};
|
|
@@ -5798,6 +5834,7 @@ const bare = (url) => url.replace(/^https?:\/\//, "");
|
|
|
5798
5834
|
*/
|
|
5799
5835
|
function crewRows(crew, data, now) {
|
|
5800
5836
|
const owner = crew.harbor.role === "owner";
|
|
5837
|
+
const lead = runsCrew(crew.harbor.role);
|
|
5801
5838
|
const rows = [];
|
|
5802
5839
|
const nameWidth = Math.min(24, Math.max(0, ...crew.members.map((m) => (m.name ?? "").length)));
|
|
5803
5840
|
rows.push({
|
|
@@ -5814,9 +5851,9 @@ function crewRows(crew, data, now) {
|
|
|
5814
5851
|
].filter(Boolean).join(" · "),
|
|
5815
5852
|
userId: m.userId,
|
|
5816
5853
|
role: m.role,
|
|
5817
|
-
changeable:
|
|
5854
|
+
changeable: m.userId !== crew.you && mayChangeRole(crew.harbor.role, m.role, "member") && mayChangeRole(crew.harbor.role, m.role, "viewer")
|
|
5818
5855
|
});
|
|
5819
|
-
if (!
|
|
5856
|
+
if (!lead) {
|
|
5820
5857
|
const by = crew.members.find((m) => m.role === "owner");
|
|
5821
5858
|
rows.push({
|
|
5822
5859
|
kind: "note",
|
|
@@ -5838,6 +5875,15 @@ function crewRows(crew, data, now) {
|
|
|
5838
5875
|
token: i.token,
|
|
5839
5876
|
url: i.url
|
|
5840
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) {
|
|
5841
5887
|
rows.push({
|
|
5842
5888
|
kind: "heading",
|
|
5843
5889
|
text: "Share links: a portfolio, read-only, for anyone with the link"
|
|
@@ -8367,7 +8413,7 @@ function bottleState(note, ctx) {
|
|
|
8367
8413
|
/** "opens on Nov 14", "opens when Factory buy-off is reached", "opens if Ridge Runner launch turns Off track" */
|
|
8368
8414
|
function opensText(opens, ctx) {
|
|
8369
8415
|
if (!opens) return "open now";
|
|
8370
|
-
if (opens.on === "date") return `opens on ${day$
|
|
8416
|
+
if (opens.on === "date") return `opens on ${day$7(opens.date)}`;
|
|
8371
8417
|
if (opens.on === "milestone") {
|
|
8372
8418
|
const m = ctx.milestones.find((x) => x.id === opens.milestoneId);
|
|
8373
8419
|
return m ? `opens when ${m.name} is reached` : "opens when its milestone is reached";
|
|
@@ -8401,7 +8447,7 @@ function freshlyOpened(data, projects, now) {
|
|
|
8401
8447
|
}
|
|
8402
8448
|
return out.sort((a, b) => (b.state.openedOn ?? "").localeCompare(a.state.openedOn ?? ""));
|
|
8403
8449
|
}
|
|
8404
|
-
var BOTTLE_FRESH_DAYS, isBottle, sealed, day$
|
|
8450
|
+
var BOTTLE_FRESH_DAYS, isBottle, sealed, day$7;
|
|
8405
8451
|
var init_bottle = __esmMin((() => {
|
|
8406
8452
|
init_date_fns();
|
|
8407
8453
|
init_date_text();
|
|
@@ -8413,7 +8459,7 @@ var init_bottle = __esmMin((() => {
|
|
|
8413
8459
|
open: false,
|
|
8414
8460
|
openedOn: null
|
|
8415
8461
|
};
|
|
8416
|
-
day$
|
|
8462
|
+
day$7 = (iso) => format(parseIso(iso.slice(0, 10)), "MMM d");
|
|
8417
8463
|
}));
|
|
8418
8464
|
|
|
8419
8465
|
// src/lib/decisions.ts
|
|
@@ -8728,7 +8774,7 @@ function lateOwnersOf(data, tasks, now) {
|
|
|
8728
8774
|
}
|
|
8729
8775
|
function composeBriefBody(opts) {
|
|
8730
8776
|
const date = format(opts.date, "MMMM d, yyyy");
|
|
8731
|
-
const shown = opts.all ?
|
|
8777
|
+
const shown = opts.all ? 1e400 : 8;
|
|
8732
8778
|
const watch = opts.watch ?? [];
|
|
8733
8779
|
const milestones = opts.milestones ?? [];
|
|
8734
8780
|
const lateMilestones = milestones.filter((m) => m.daysLate > 0);
|
|
@@ -10803,8 +10849,8 @@ init_blockers();
|
|
|
10803
10849
|
init_date_text();
|
|
10804
10850
|
init_premortem();
|
|
10805
10851
|
init_thanks();
|
|
10806
|
-
const day$
|
|
10807
|
-
const between = (a, b) => differenceInCalendarDays(day$
|
|
10852
|
+
const day$6 = (iso) => parseIso(localDay(iso));
|
|
10853
|
+
const between = (a, b) => differenceInCalendarDays(day$6(b), day$6(a));
|
|
10808
10854
|
function voyageLog(data, projectId) {
|
|
10809
10855
|
const project = data.projects.find((p) => p.id === projectId);
|
|
10810
10856
|
if (!project) return null;
|
|
@@ -10871,7 +10917,7 @@ function voyageLog(data, projectId) {
|
|
|
10871
10917
|
};
|
|
10872
10918
|
}
|
|
10873
10919
|
const plural$7 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
10874
|
-
const md$1 = (iso) => format(day$
|
|
10920
|
+
const md$1 = (iso) => format(day$6(iso), "MMM d");
|
|
10875
10921
|
/** The three numbers at the top: how late, how much work, how many risks came true. */
|
|
10876
10922
|
function voyageStats(log) {
|
|
10877
10923
|
const happened = log.risks.filter((r) => r.happened).length;
|
|
@@ -12917,6 +12963,7 @@ function CalendarView({ active, width, height, go }) {
|
|
|
12917
12963
|
* opening and after each change (mcp/app.server.ts answerCrew).
|
|
12918
12964
|
*/
|
|
12919
12965
|
init_clock();
|
|
12966
|
+
init_roles();
|
|
12920
12967
|
const actionable = (r) => r.kind !== "heading" && r.kind !== "note";
|
|
12921
12968
|
/** What the chosen line's keys do, for the line along the bottom. */
|
|
12922
12969
|
function rowHints(r, owner) {
|
|
@@ -12968,6 +13015,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
12968
13015
|
const chosen = picks.length ? picks[Math.min(at, picks.length - 1)] : -1;
|
|
12969
13016
|
const row = chosen >= 0 ? rows[chosen] : void 0;
|
|
12970
13017
|
const owner = crew?.harbor.role === "owner";
|
|
13018
|
+
const lead = runsCrew(crew?.harbor.role);
|
|
12971
13019
|
/** One change, then the screen as Harbor now has it; `said` words the notice. */
|
|
12972
13020
|
const run = (act, said) => {
|
|
12973
13021
|
if (!workspaceId || busy) return;
|
|
@@ -13016,7 +13064,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
13016
13064
|
if (key.pageDown) return setAt((i) => Math.min(picks.length - 1, i + 10));
|
|
13017
13065
|
if (key.pageUp) return setAt((i) => Math.max(0, i - 10));
|
|
13018
13066
|
if (!crew) return;
|
|
13019
|
-
if (
|
|
13067
|
+
if (lead && input === "i") return invite();
|
|
13020
13068
|
if (owner && input === "s") {
|
|
13021
13069
|
if (!portfolios.length) return go.notify("There's no portfolio to share yet.");
|
|
13022
13070
|
return go.pick("Share which portfolio, read-only?", portfolios.map((p) => ({
|
|
@@ -13136,7 +13184,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
13136
13184
|
"i invite",
|
|
13137
13185
|
"s share link",
|
|
13138
13186
|
"f intake form"
|
|
13139
|
-
] : []];
|
|
13187
|
+
] : lead ? ["i invite"] : []];
|
|
13140
13188
|
const view = windowOf(rows, Math.max(0, chosen), Math.max(3, height - 3));
|
|
13141
13189
|
return /* @__PURE__ */ jsxs(Box, {
|
|
13142
13190
|
flexDirection: "column",
|
|
@@ -13145,7 +13193,7 @@ function CrewView({ active, width, height, go }) {
|
|
|
13145
13193
|
paddingX: 1,
|
|
13146
13194
|
children: [
|
|
13147
13195
|
/* @__PURE__ */ jsx(Heading, {
|
|
13148
|
-
right: owner ? "you're the owner" : `you ${crew.harbor.role === "viewer" ? "can view" : "can edit"}`,
|
|
13196
|
+
right: owner ? "you're the owner" : lead ? "you're an admin" : `you ${crew.harbor.role === "viewer" ? "can view" : "can edit"}`,
|
|
13149
13197
|
children: "Crew"
|
|
13150
13198
|
}),
|
|
13151
13199
|
view.items.map((r, n) => {
|
|
@@ -13258,7 +13306,7 @@ function dollars(value) {
|
|
|
13258
13306
|
const n = Number(value ?? 0);
|
|
13259
13307
|
return whole$1.format(Number.isFinite(n) ? n : 0);
|
|
13260
13308
|
}
|
|
13261
|
-
function day$
|
|
13309
|
+
function day$5(value) {
|
|
13262
13310
|
return value ? shortDate(value) : "no date";
|
|
13263
13311
|
}
|
|
13264
13312
|
/** Whole days from one ISO day to another. */
|
|
@@ -13346,15 +13394,15 @@ function describeEvent(e, names) {
|
|
|
13346
13394
|
};
|
|
13347
13395
|
case "dueDate": return {
|
|
13348
13396
|
action: "moved the due date of",
|
|
13349
|
-
detail: `from ${day$
|
|
13397
|
+
detail: `from ${day$5(from)} to ${day$5(to)}${slip(from, to)}`
|
|
13350
13398
|
};
|
|
13351
13399
|
case "startDate": return {
|
|
13352
13400
|
action: "moved the start of",
|
|
13353
|
-
detail: `from ${day$
|
|
13401
|
+
detail: `from ${day$5(from)} to ${day$5(to)}${slip(from, to)}`
|
|
13354
13402
|
};
|
|
13355
13403
|
case "endDate": return {
|
|
13356
13404
|
action: "moved the end of",
|
|
13357
|
-
detail: `from ${day$
|
|
13405
|
+
detail: `from ${day$5(from)} to ${day$5(to)}${slip(from, to)}`
|
|
13358
13406
|
};
|
|
13359
13407
|
case "budget": return {
|
|
13360
13408
|
action: "changed the budget of",
|
|
@@ -13796,7 +13844,7 @@ function landfallProblem(input) {
|
|
|
13796
13844
|
function landfallAnswerProblem(input) {
|
|
13797
13845
|
if (!LANDFALL_RESULTS.includes(input.result)) return "Say yes, partly or no.";
|
|
13798
13846
|
if (input.value != null && (typeof input.value !== "number" || !Number.isFinite(input.value))) return "The number has to be a number.";
|
|
13799
|
-
if (typeof input.value === "number" && Math.abs(input.value) >
|
|
13847
|
+
if (typeof input.value === "number" && Math.abs(input.value) > 1e12) return "That number is too big.";
|
|
13800
13848
|
if (clean$1(input.note).length > 500) return `Keep the note under ${500} characters.`;
|
|
13801
13849
|
return null;
|
|
13802
13850
|
}
|
|
@@ -13910,7 +13958,7 @@ function landfallJson(project, tasks, today, people) {
|
|
|
13910
13958
|
*/
|
|
13911
13959
|
/** FNV-1a over the text, as eight hex digits. */
|
|
13912
13960
|
function hash8(text) {
|
|
13913
|
-
let h =
|
|
13961
|
+
let h = 0x811c9dc5;
|
|
13914
13962
|
for (let i = 0; i < text.length; i++) {
|
|
13915
13963
|
h ^= text.charCodeAt(i);
|
|
13916
13964
|
h = Math.imul(h, 16777619);
|
|
@@ -13935,7 +13983,7 @@ init_date_fns();
|
|
|
13935
13983
|
init_date_text();
|
|
13936
13984
|
init_indexes();
|
|
13937
13985
|
init_tide();
|
|
13938
|
-
const day$
|
|
13986
|
+
const day$4 = (iso) => parseIso(iso.slice(0, 10));
|
|
13939
13987
|
/** When a convoy looks like arriving, and how that was read. */
|
|
13940
13988
|
function expectedOf(data, convoy, now) {
|
|
13941
13989
|
const project = convoy.projectId ? byId(data.projects).get(convoy.projectId) ?? null : null;
|
|
@@ -13973,7 +14021,7 @@ function convoyRows(data, now) {
|
|
|
13973
14021
|
for (const asker of data.programs) for (const convoy of asker.convoys ?? []) {
|
|
13974
14022
|
const giver = programs.get(convoy.toProgramId) ?? null;
|
|
13975
14023
|
const { expected, basis, project } = expectedOf(data, convoy, now);
|
|
13976
|
-
const late = expected ? differenceInCalendarDays(day$
|
|
14024
|
+
const late = expected ? differenceInCalendarDays(day$4(expected), day$4(convoy.by)) : null;
|
|
13977
14025
|
out.push({
|
|
13978
14026
|
convoy,
|
|
13979
14027
|
asker,
|
|
@@ -14029,7 +14077,7 @@ const MONTHS = [
|
|
|
14029
14077
|
];
|
|
14030
14078
|
/** "Dec 12". */
|
|
14031
14079
|
function shortDay(iso) {
|
|
14032
|
-
const d = day$
|
|
14080
|
+
const d = day$4(iso);
|
|
14033
14081
|
return Number.isNaN(d.getTime()) ? iso : `${MONTHS[d.getMonth()]} ${d.getDate()}`;
|
|
14034
14082
|
}
|
|
14035
14083
|
/** Who should hear about a convoy: its program's owner and whoever asked or answered. */
|
|
@@ -14083,7 +14131,7 @@ function firstName$3(name) {
|
|
|
14083
14131
|
}
|
|
14084
14132
|
/** FNV-1a over the text, as eight hex digits: a short, stable name for a set of ids. */
|
|
14085
14133
|
function shortHash(text) {
|
|
14086
|
-
let h =
|
|
14134
|
+
let h = 0x811c9dc5;
|
|
14087
14135
|
for (let i = 0; i < text.length; i++) {
|
|
14088
14136
|
h ^= text.charCodeAt(i);
|
|
14089
14137
|
h = Math.imul(h, 16777619);
|
|
@@ -15081,7 +15129,7 @@ function suggestTakers(data, fromId, items, now, today) {
|
|
|
15081
15129
|
for (const item of items) {
|
|
15082
15130
|
if (item.kind !== "task") continue;
|
|
15083
15131
|
let pick = people[0].id;
|
|
15084
|
-
let score = -
|
|
15132
|
+
let score = -1e400;
|
|
15085
15133
|
for (const p of people) {
|
|
15086
15134
|
const s = room.get(p.id) + (inProject.get(item.projectId)?.has(p.id) ? 1.5 : 0) + (handed.get(item.projectId)?.has(p.id) ? 1 : 0);
|
|
15087
15135
|
if (s > score) {
|
|
@@ -15387,7 +15435,7 @@ function withSuggestions(data, lines, now) {
|
|
|
15387
15435
|
return lines.map((line) => {
|
|
15388
15436
|
const pool = takers({ people }, line.soloId, today);
|
|
15389
15437
|
let best = null;
|
|
15390
|
-
let score = -
|
|
15438
|
+
let score = -1e400;
|
|
15391
15439
|
for (const p of pool) {
|
|
15392
15440
|
const s = (room.get(p.id) ?? 0) + (line.projectId && inProject.get(line.projectId)?.has(p.id) ? 3 : 0) + (line.programId && inProgram.get(line.programId)?.has(p.id) ? 1 : 0);
|
|
15393
15441
|
if (s > score) {
|
|
@@ -19204,7 +19252,7 @@ function raiseRows(data, projectId, at, byId) {
|
|
|
19204
19252
|
}
|
|
19205
19253
|
var WHY_MAX, kept;
|
|
19206
19254
|
var init_scuttle_rows = __esmMin((() => {
|
|
19207
|
-
init_assignment();
|
|
19255
|
+
/* @__PURE__ */ init_assignment();
|
|
19208
19256
|
init_indexes();
|
|
19209
19257
|
init_raid();
|
|
19210
19258
|
init_rollup_lock();
|
|
@@ -19980,8 +20028,8 @@ function optionalKeys(shape) {
|
|
|
19980
20028
|
}
|
|
19981
20029
|
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
19982
20030
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
19983
|
-
int32: [-
|
|
19984
|
-
uint32: [0,
|
|
20031
|
+
int32: [-0x80000000, 0x7fffffff],
|
|
20032
|
+
uint32: [0, 0xffffffff],
|
|
19985
20033
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
19986
20034
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
19987
20035
|
}))();
|
|
@@ -22102,9 +22150,7 @@ function mergeValues(a, b) {
|
|
|
22102
22150
|
};
|
|
22103
22151
|
const newArray = [];
|
|
22104
22152
|
for (let index = 0; index < a.length; index++) {
|
|
22105
|
-
const
|
|
22106
|
-
const itemB = b[index];
|
|
22107
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
22153
|
+
const sharedValue = mergeValues(a[index], b[index]);
|
|
22108
22154
|
if (!sharedValue.valid) return {
|
|
22109
22155
|
valid: false,
|
|
22110
22156
|
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
@@ -25470,7 +25516,7 @@ const SIMILAR_MIN = 3;
|
|
|
25470
25516
|
/** A finished task that took longer than this sat somewhere; it counts as this long. */
|
|
25471
25517
|
const SIMILAR_CAP = 15;
|
|
25472
25518
|
const firstName$1 = (name) => name.trim().split(/\s+/)[0] || name;
|
|
25473
|
-
const day$
|
|
25519
|
+
const day$3 = (iso) => iso ? iso.slice(0, 10) : null;
|
|
25474
25520
|
function quantile(sorted, q) {
|
|
25475
25521
|
const at = (sorted.length - 1) * q;
|
|
25476
25522
|
const lo = Math.floor(at);
|
|
@@ -25486,7 +25532,7 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25486
25532
|
const owner = byId(data.people).get(task.assigneeId);
|
|
25487
25533
|
if (!owner || owner.kind === "agent") return null;
|
|
25488
25534
|
const today = at ? todayFor(owner, at, localToday) : localToday;
|
|
25489
|
-
const chosen = day$
|
|
25535
|
+
const chosen = day$3(task.dueDate);
|
|
25490
25536
|
let underWay = 0;
|
|
25491
25537
|
const dated = [];
|
|
25492
25538
|
const finished = [];
|
|
@@ -25496,14 +25542,14 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25496
25542
|
if (t.projectId === task.projectId && t.completedAt) finished.push(t);
|
|
25497
25543
|
continue;
|
|
25498
25544
|
}
|
|
25499
|
-
const due = day$
|
|
25545
|
+
const due = day$3(t.dueDate);
|
|
25500
25546
|
if (t.status === "doing" || t.status === "review") underWay += 1;
|
|
25501
25547
|
else if (due) dated.push(due);
|
|
25502
25548
|
}
|
|
25503
25549
|
const perDay = Math.max(.2, (owner.weeklyCapacity ?? 5) / 5);
|
|
25504
25550
|
let similar = null;
|
|
25505
25551
|
if (finished.length >= SIMILAR_MIN) {
|
|
25506
|
-
const took = finished.sort((a, b) => b.completedAt < a.completedAt ? -1 : 1).slice(0, SIMILAR).map((t) => Math.min(SIMILAR_CAP, Math.max(1, workingDaysBetween(day$
|
|
25552
|
+
const took = finished.sort((a, b) => b.completedAt < a.completedAt ? -1 : 1).slice(0, SIMILAR).map((t) => Math.min(SIMILAR_CAP, Math.max(1, workingDaysBetween(day$3(t.createdAt), day$3(t.completedAt))))).sort((a, b) => a - b);
|
|
25507
25553
|
similar = {
|
|
25508
25554
|
low: Math.round(quantile(took, .25)),
|
|
25509
25555
|
high: Math.round(quantile(took, .75)),
|
|
@@ -25511,7 +25557,7 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25511
25557
|
};
|
|
25512
25558
|
}
|
|
25513
25559
|
const ownDays = Math.min(5, Math.max(1, similar?.low ?? 1));
|
|
25514
|
-
const backOn = isAway(owner, today) ? day$
|
|
25560
|
+
const backOn = isAway(owner, today) ? day$3(owner.away.until) : null;
|
|
25515
25561
|
const start = backOn && backOn > today ? dayBefore(backOn) : today;
|
|
25516
25562
|
const tasks = byId(data.tasks);
|
|
25517
25563
|
const projects = byId(data.projects);
|
|
@@ -25522,7 +25568,7 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25522
25568
|
for (const id of blockers) {
|
|
25523
25569
|
const b = tasks.get(id);
|
|
25524
25570
|
if (!b || b.status === "done") continue;
|
|
25525
|
-
const due = day$
|
|
25571
|
+
const due = day$3(b.dueDate);
|
|
25526
25572
|
if (!due) {
|
|
25527
25573
|
undated ??= b;
|
|
25528
25574
|
continue;
|
|
@@ -25591,7 +25637,7 @@ const plural$3 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
|
25591
25637
|
/** The line under the date: "Dana's queue says Nov 12 at the earliest", or, with no date yet, "Dana could likely have this by Nov 12". */
|
|
25592
25638
|
function pilotHeadline(p, chosen, you = false) {
|
|
25593
25639
|
const who = you ? "You" : firstName$1(p.owner.name);
|
|
25594
|
-
if (!day$
|
|
25640
|
+
if (!day$3(chosen)) return `${who} could likely have this by ${shortDate(p.earliest)}`;
|
|
25595
25641
|
return `${you ? "Your" : `${who}'s`} queue says ${shortDate(p.earliest)} at the earliest`;
|
|
25596
25642
|
}
|
|
25597
25643
|
/** Why: the queue, time away, what it waits on, and how long similar tasks took. */
|
|
@@ -25663,7 +25709,7 @@ function lastLooked(mark, data, personId) {
|
|
|
25663
25709
|
init_date_text();
|
|
25664
25710
|
init_indexes();
|
|
25665
25711
|
init_task_keys();
|
|
25666
|
-
const day$
|
|
25712
|
+
const day$2 = (iso) => parseIso(iso.slice(0, 10));
|
|
25667
25713
|
const daysBetween = dayGap;
|
|
25668
25714
|
/** Their projects: ones they lead, in a program they lead, or with a task of theirs. */
|
|
25669
25715
|
function projectsOf(data, personId) {
|
|
@@ -25678,7 +25724,7 @@ function dueText(task, today) {
|
|
|
25678
25724
|
if (d === 0) return "due today";
|
|
25679
25725
|
if (d < 0) return `${-d} day${d === -1 ? "" : "s"} late`;
|
|
25680
25726
|
if (d === 1) return "due tomorrow";
|
|
25681
|
-
return `due ${format(day$
|
|
25727
|
+
return `due ${format(day$2(task.dueDate), "EEE, MMM d")}`;
|
|
25682
25728
|
}
|
|
25683
25729
|
/** What a person needs to hear about since `when.since`, as of `today` (YYYY-MM-DD). */
|
|
25684
25730
|
function welcomeBack(data, personId, when, today, shown = []) {
|
|
@@ -25806,7 +25852,7 @@ function moreText(more) {
|
|
|
25806
25852
|
/** "Welcome back, Priya · away Oct 3 to Oct 17", or "· 5 days since you last looked". */
|
|
25807
25853
|
function welcomeTitle(w, name, today) {
|
|
25808
25854
|
const hi = name ? `Welcome back, ${name}` : "Welcome back";
|
|
25809
|
-
if (w.when.why === "away") return `${hi} · away ${format(day$
|
|
25855
|
+
if (w.when.why === "away") return `${hi} · away ${format(day$2(w.when.since), "MMM d")} to ${format(day$2(today), "MMM d")}`;
|
|
25810
25856
|
return `${hi} · ${w.when.days} days since you last looked`;
|
|
25811
25857
|
}
|
|
25812
25858
|
/** "Checkout v3: 4 done, 2 added, now At risk (was On track)". */
|
|
@@ -26289,8 +26335,8 @@ var wbs_move_exports = /* @__PURE__ */ __exportAll({
|
|
|
26289
26335
|
function byRank(list, fallback) {
|
|
26290
26336
|
const at = new Map(list.map((x, i) => [x.id, i]));
|
|
26291
26337
|
return [...list].sort((a, b) => {
|
|
26292
|
-
const ra = a.wbsRank ??
|
|
26293
|
-
const rb = b.wbsRank ??
|
|
26338
|
+
const ra = a.wbsRank ?? 1e400;
|
|
26339
|
+
const rb = b.wbsRank ?? 1e400;
|
|
26294
26340
|
if (ra !== rb) return ra - rb;
|
|
26295
26341
|
if (fallback) {
|
|
26296
26342
|
const f = fallback(a, b);
|
|
@@ -26458,7 +26504,7 @@ init_indexes();
|
|
|
26458
26504
|
init_rollup_lock();
|
|
26459
26505
|
init_task_keys();
|
|
26460
26506
|
init_wbs_move();
|
|
26461
|
-
const day = (iso) => iso ? iso.slice(0, 10) : null;
|
|
26507
|
+
const day$1 = (iso) => iso ? iso.slice(0, 10) : null;
|
|
26462
26508
|
const earlier = (a, b) => !a ? b : !b ? a : a < b ? a : b;
|
|
26463
26509
|
const later = (a, b) => !a ? b : !b ? a : a > b ? a : b;
|
|
26464
26510
|
function lockOf(t) {
|
|
@@ -26467,10 +26513,10 @@ function lockOf(t) {
|
|
|
26467
26513
|
return locked.includes("parentTaskId") ? "all" : "project";
|
|
26468
26514
|
}
|
|
26469
26515
|
function taskNode(t, kind, code, level, project, subs, today) {
|
|
26470
|
-
const lateOf = (x) => x.status !== "done" && x.dueDate && day(x.dueDate) < today ? 1 : 0;
|
|
26516
|
+
const lateOf = (x) => x.status !== "done" && x.dueDate && day$1(x.dueDate) < today ? 1 : 0;
|
|
26471
26517
|
const children = orderTasks(subs).map((s, i) => taskNode(s, "subtask", `${code}.${i + 1}`, level + 1, project, [], today));
|
|
26472
|
-
let start = day(t.startDate);
|
|
26473
|
-
let end = day(t.dueDate);
|
|
26518
|
+
let start = day$1(t.startDate);
|
|
26519
|
+
let end = day$1(t.dueDate);
|
|
26474
26520
|
if (children.length) {
|
|
26475
26521
|
start = earlier(start, end);
|
|
26476
26522
|
for (const c of children) {
|
|
@@ -26514,7 +26560,7 @@ function projectNode(p, code, level, doc, today) {
|
|
|
26514
26560
|
});
|
|
26515
26561
|
let latest = null;
|
|
26516
26562
|
for (const c of children) latest = later(latest, c.end);
|
|
26517
|
-
const end = day(p.endDate);
|
|
26563
|
+
const end = day$1(p.endDate);
|
|
26518
26564
|
const done = all.filter((t) => t.status === "done").length;
|
|
26519
26565
|
return {
|
|
26520
26566
|
kind: "project",
|
|
@@ -26524,7 +26570,7 @@ function projectNode(p, code, level, doc, today) {
|
|
|
26524
26570
|
title: p.name,
|
|
26525
26571
|
key: p.key,
|
|
26526
26572
|
ownerId: p.ownerId || null,
|
|
26527
|
-
start: day(p.startDate),
|
|
26573
|
+
start: day$1(p.startDate),
|
|
26528
26574
|
end,
|
|
26529
26575
|
runsPast: Boolean(end && latest && latest > end),
|
|
26530
26576
|
done,
|
|
@@ -26556,7 +26602,7 @@ function programNode(g, code, level, doc, today) {
|
|
|
26556
26602
|
const children = orderPlans(doc.projects.filter((p) => p.programId === g.id)).map((p, i) => projectNode(p, code ? `${code}.${i + 1}` : `${i + 1}`, level + 1, doc, today));
|
|
26557
26603
|
let latest = null;
|
|
26558
26604
|
for (const c of children) latest = later(latest, later(c.end, latestUnder(c)));
|
|
26559
|
-
const end = day(g.endDate);
|
|
26605
|
+
const end = day$1(g.endDate);
|
|
26560
26606
|
return summed({
|
|
26561
26607
|
kind: "program",
|
|
26562
26608
|
id: g.id,
|
|
@@ -26564,7 +26610,7 @@ function programNode(g, code, level, doc, today) {
|
|
|
26564
26610
|
level,
|
|
26565
26611
|
title: g.name,
|
|
26566
26612
|
ownerId: g.ownerId || null,
|
|
26567
|
-
start: day(g.startDate),
|
|
26613
|
+
start: day$1(g.startDate),
|
|
26568
26614
|
end,
|
|
26569
26615
|
runsPast: Boolean(end && latest && latest > end),
|
|
26570
26616
|
health: g.health,
|
|
@@ -29572,6 +29618,58 @@ var init_errors = __esmMin((() => {
|
|
|
29572
29618
|
};
|
|
29573
29619
|
}));
|
|
29574
29620
|
|
|
29621
|
+
// src/lib/first-due.ts
|
|
29622
|
+
/** The task as it should be saved after its due day went from `was` to `task`'s. */
|
|
29623
|
+
function firstDueAfter(was, task) {
|
|
29624
|
+
if (task.firstDue !== was.firstDue) return task.firstDue == null ? dropFirstDue(task) : task;
|
|
29625
|
+
const from = day(was.dueDate);
|
|
29626
|
+
const to = day(task.dueDate);
|
|
29627
|
+
if (from === to) return task;
|
|
29628
|
+
if (!to || !from) return dropFirstDue(task);
|
|
29629
|
+
const first = task.firstDue ?? from;
|
|
29630
|
+
if (first === to) return dropFirstDue(task);
|
|
29631
|
+
return task.firstDue === first ? task : {
|
|
29632
|
+
...task,
|
|
29633
|
+
firstDue: first
|
|
29634
|
+
};
|
|
29635
|
+
}
|
|
29636
|
+
function dropFirstDue(task) {
|
|
29637
|
+
if (!("firstDue" in task)) return task;
|
|
29638
|
+
const { firstDue: _gone, ...rest } = task;
|
|
29639
|
+
return rest;
|
|
29640
|
+
}
|
|
29641
|
+
/** A new task in a series, or a copy, starts with its own first date. */
|
|
29642
|
+
function withoutFirstDue(task) {
|
|
29643
|
+
if (!("firstDue" in task)) return task;
|
|
29644
|
+
const { firstDue: _gone, ...rest } = task;
|
|
29645
|
+
return rest;
|
|
29646
|
+
}
|
|
29647
|
+
/**
|
|
29648
|
+
* Keeps each task's first due day through a write: only tasks whose object
|
|
29649
|
+
* changed are looked at, so a write that doesn't touch tasks costs nothing.
|
|
29650
|
+
*/
|
|
29651
|
+
function keepFirstDue(before, after) {
|
|
29652
|
+
if (after.tasks === before.tasks) return after;
|
|
29653
|
+
const was = byId(before.tasks);
|
|
29654
|
+
let changed = false;
|
|
29655
|
+
const tasks = after.tasks.map((t) => {
|
|
29656
|
+
const old = was.get(t.id);
|
|
29657
|
+
if (!old || old === t) return t;
|
|
29658
|
+
const next = firstDueAfter(old, t);
|
|
29659
|
+
if (next !== t) changed = true;
|
|
29660
|
+
return next;
|
|
29661
|
+
});
|
|
29662
|
+
return changed ? {
|
|
29663
|
+
...after,
|
|
29664
|
+
tasks
|
|
29665
|
+
} : after;
|
|
29666
|
+
}
|
|
29667
|
+
var day;
|
|
29668
|
+
var init_first_due = __esmMin((() => {
|
|
29669
|
+
init_indexes();
|
|
29670
|
+
day = (iso) => iso ? iso.slice(0, 10) : null;
|
|
29671
|
+
}));
|
|
29672
|
+
|
|
29575
29673
|
// src/lib/deep-equal.ts
|
|
29576
29674
|
/**
|
|
29577
29675
|
* Structural equality, key-order independent, treating `undefined` and a
|
|
@@ -29728,7 +29826,7 @@ function applyRowChanges(rows, changes, options = {}) {
|
|
|
29728
29826
|
}
|
|
29729
29827
|
var LATEST_WINS;
|
|
29730
29828
|
var init_row_changes = __esmMin((() => {
|
|
29731
|
-
init_deep_equal();
|
|
29829
|
+
/* @__PURE__ */ init_deep_equal();
|
|
29732
29830
|
LATEST_WINS = /* @__PURE__ */ new Set(["touchedAt"]);
|
|
29733
29831
|
}));
|
|
29734
29832
|
|
|
@@ -30085,6 +30183,12 @@ var init_session = __esmMin((() => {
|
|
|
30085
30183
|
*
|
|
30086
30184
|
* The placeholder program ("The work") isn't on the list: it gives way to
|
|
30087
30185
|
* the first program anyone makes, so naming it is never a chore to set.
|
|
30186
|
+
*
|
|
30187
|
+
* The list opens partway done, because it is: making the account, and
|
|
30188
|
+
* opening the harbor (or joining one), are the first steps, and they were
|
|
30189
|
+
* taken before Today ever showed. People finish a list they've already
|
|
30190
|
+
* started more often than an empty one, so those count, ticked. Nothing
|
|
30191
|
+
* else is ticked that wasn't done.
|
|
30088
30192
|
*/
|
|
30089
30193
|
/**
|
|
30090
30194
|
* The program launch named for you, while nobody has renamed it and it holds
|
|
@@ -30689,7 +30793,7 @@ var init_hierarchy = __esmMin((() => {
|
|
|
30689
30793
|
init_health_history();
|
|
30690
30794
|
init_derived_health();
|
|
30691
30795
|
init_shared();
|
|
30692
|
-
init_assignment();
|
|
30796
|
+
/* @__PURE__ */ init_assignment();
|
|
30693
30797
|
init_scuttle_rows();
|
|
30694
30798
|
init_hill();
|
|
30695
30799
|
init_charter_lines();
|
|
@@ -30914,7 +31018,7 @@ function nextOccurrence(task, id, today, createdAt, siblings = []) {
|
|
|
30914
31018
|
if (siblings.some((t) => t.status !== "done" && t.repeat === task.repeat && t.title === task.title && (t.dueDate ?? "") >= dueDate)) return null;
|
|
30915
31019
|
const lead = task.startDate && task.dueDate ? differenceInCalendarDays(/* @__PURE__ */ new Date(`${task.dueDate.slice(0, 10)}T12:00:00`), /* @__PURE__ */ new Date(`${task.startDate.slice(0, 10)}T12:00:00`)) : null;
|
|
30916
31020
|
return {
|
|
30917
|
-
...task,
|
|
31021
|
+
...withoutFirstDue(task),
|
|
30918
31022
|
id,
|
|
30919
31023
|
status: "todo",
|
|
30920
31024
|
dueDate,
|
|
@@ -30935,6 +31039,7 @@ var REPEAT_LABEL, iso, step;
|
|
|
30935
31039
|
var init_recurrence = __esmMin((() => {
|
|
30936
31040
|
init_date_fns();
|
|
30937
31041
|
init_date_text();
|
|
31042
|
+
init_first_due();
|
|
30938
31043
|
REPEAT_LABEL = {
|
|
30939
31044
|
weekly: "Every week",
|
|
30940
31045
|
biweekly: "Every two weeks",
|
|
@@ -31050,7 +31155,7 @@ function tasksSlice({ set, get, write }) {
|
|
|
31050
31155
|
}
|
|
31051
31156
|
const id = uid("t");
|
|
31052
31157
|
const row = {
|
|
31053
|
-
...t,
|
|
31158
|
+
...withoutFirstDue(t),
|
|
31054
31159
|
id,
|
|
31055
31160
|
createdAt: stamp(),
|
|
31056
31161
|
createdById: t.createdById ?? (get().currentUserId || null),
|
|
@@ -31438,6 +31543,12 @@ function tasksSlice({ set, get, write }) {
|
|
|
31438
31543
|
for (const mark of marks) have.add(mark);
|
|
31439
31544
|
set({ readPingIds: [...have] });
|
|
31440
31545
|
},
|
|
31546
|
+
forgetReads: (marks) => {
|
|
31547
|
+
const drop = new Set(marks);
|
|
31548
|
+
const ids = get().readPingIds ?? [];
|
|
31549
|
+
if (!ids.some((id) => drop.has(id))) return;
|
|
31550
|
+
set({ readPingIds: ids.filter((id) => !drop.has(id)) });
|
|
31551
|
+
},
|
|
31441
31552
|
tickVoyage: (ids) => {
|
|
31442
31553
|
const ticked = get().tasks.filter((t) => ids.includes(t.id) && t.status !== "done" && !isExternal(t));
|
|
31443
31554
|
if (ticked.length === 0) return;
|
|
@@ -31634,8 +31745,9 @@ var init_tasks = __esmMin((() => {
|
|
|
31634
31745
|
init_work();
|
|
31635
31746
|
init_shared();
|
|
31636
31747
|
init_recurrence();
|
|
31748
|
+
init_first_due();
|
|
31637
31749
|
init_indexes();
|
|
31638
|
-
init_assignment();
|
|
31750
|
+
/* @__PURE__ */ init_assignment();
|
|
31639
31751
|
init_bulk();
|
|
31640
31752
|
init_task_people();
|
|
31641
31753
|
init_subtasks();
|
|
@@ -32414,13 +32526,13 @@ function applyMoves(s, moves, lineFor) {
|
|
|
32414
32526
|
var init_people_spend = __esmMin((() => {
|
|
32415
32527
|
init_format();
|
|
32416
32528
|
init_handover();
|
|
32417
|
-
init_assignment();
|
|
32529
|
+
/* @__PURE__ */ init_assignment();
|
|
32418
32530
|
init_rollup_lock();
|
|
32419
32531
|
init_spend();
|
|
32420
32532
|
init_utils();
|
|
32421
32533
|
init_countries();
|
|
32422
32534
|
init_shared();
|
|
32423
|
-
init_allocation();
|
|
32535
|
+
/* @__PURE__ */ init_allocation();
|
|
32424
32536
|
}));
|
|
32425
32537
|
|
|
32426
32538
|
// src/tui/engine/store.ts
|
|
@@ -32447,10 +32559,10 @@ function createAppStore(onNotice = () => {}) {
|
|
|
32447
32559
|
};
|
|
32448
32560
|
const write = (partial) => {
|
|
32449
32561
|
const before = get();
|
|
32450
|
-
guardedSet((s) => stampHealth(followMilestones(s, numberNewTasks(s, {
|
|
32562
|
+
guardedSet((s) => stampHealth(followMilestones(s, keepFirstDue(s, numberNewTasks(s, {
|
|
32451
32563
|
...s,
|
|
32452
32564
|
...partial
|
|
32453
|
-
}))));
|
|
32565
|
+
})))));
|
|
32454
32566
|
undo = nextStep(undo, before, get(), Date.now());
|
|
32455
32567
|
};
|
|
32456
32568
|
const api = {
|
|
@@ -32516,6 +32628,7 @@ var init_store = __esmMin((() => {
|
|
|
32516
32628
|
init_vanilla();
|
|
32517
32629
|
init_derived_health();
|
|
32518
32630
|
init_task_keys();
|
|
32631
|
+
init_first_due();
|
|
32519
32632
|
init_task_milestones();
|
|
32520
32633
|
init_payload();
|
|
32521
32634
|
init_undo();
|
|
@@ -32606,7 +32719,7 @@ function liftWholeRows(sent, stored, sameVersion) {
|
|
|
32606
32719
|
}
|
|
32607
32720
|
var COLLECTIONS, ROW_COLLECTIONS, KEYED, isKeyed, isRowKey;
|
|
32608
32721
|
var init_changes = __esmMin((() => {
|
|
32609
|
-
init_deep_equal();
|
|
32722
|
+
/* @__PURE__ */ init_deep_equal();
|
|
32610
32723
|
init_row_changes();
|
|
32611
32724
|
COLLECTIONS = [
|
|
32612
32725
|
"currentUserId",
|
|
@@ -32832,7 +32945,7 @@ function catchUpPatch(current, fresh) {
|
|
|
32832
32945
|
var hasId;
|
|
32833
32946
|
var init_catch_up = __esmMin((() => {
|
|
32834
32947
|
init_changes();
|
|
32835
|
-
init_deep_equal();
|
|
32948
|
+
/* @__PURE__ */ init_deep_equal();
|
|
32836
32949
|
hasId = (v) => typeof v === "object" && v !== null && typeof v.id === "string";
|
|
32837
32950
|
}));
|
|
32838
32951
|
|
|
@@ -32873,18 +32986,11 @@ var NOT_WHOLE;
|
|
|
32873
32986
|
var init_live_changes = __esmMin((() => {
|
|
32874
32987
|
init_changes();
|
|
32875
32988
|
init_catch_up();
|
|
32876
|
-
init_deep_equal();
|
|
32989
|
+
/* @__PURE__ */ init_deep_equal();
|
|
32877
32990
|
init_row_changes();
|
|
32878
32991
|
NOT_WHOLE = [...ROW_COLLECTIONS, "currentUserId"];
|
|
32879
32992
|
}));
|
|
32880
32993
|
|
|
32881
|
-
// src/lib/roles.ts
|
|
32882
|
-
/** Anything stored that is not a known role reads as a member, as before roles existed. */
|
|
32883
|
-
function normalizeRole(raw) {
|
|
32884
|
-
return raw === "owner" || raw === "viewer" ? raw : "member";
|
|
32885
|
-
}
|
|
32886
|
-
var init_roles = __esmMin((() => {}));
|
|
32887
|
-
|
|
32888
32994
|
// src/lib/sync-state.ts
|
|
32889
32995
|
/** Wait before the nth retry (0-based): 2 s, 4 s, 8 s, 16 s, then every 30 s. */
|
|
32890
32996
|
function retryDelay(attempt) {
|