@harborppm/cli 0.118.0 → 0.120.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 +12 -1
- package/bin/harbor.mjs +9 -2
- package/dist/app.mjs +615 -79
- package/lib/args.mjs +35 -1
- package/lib/cli.mjs +159 -35
- package/lib/format.mjs +40 -1
- 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((() => {
|
|
@@ -3118,6 +3117,7 @@ function weekPlan(data, personId, monday) {
|
|
|
3118
3117
|
date,
|
|
3119
3118
|
items,
|
|
3120
3119
|
hours,
|
|
3120
|
+
doneHours: items.reduce((sum, i) => sum + (i.task.status === "done" ? i.hours : 0), 0),
|
|
3121
3121
|
over: hours > dayHours
|
|
3122
3122
|
};
|
|
3123
3123
|
});
|
|
@@ -3226,7 +3226,7 @@ function trialDaysLeft(trialEndsAt, now = /* @__PURE__ */ new Date()) {
|
|
|
3226
3226
|
|
|
3227
3227
|
// src/lib/forecast.ts
|
|
3228
3228
|
init_date_fns();
|
|
3229
|
-
const day$
|
|
3229
|
+
const day$11 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
3230
3230
|
/**
|
|
3231
3231
|
* A straight-line estimate at completion from the burn so far: spend divided
|
|
3232
3232
|
* by the share of the schedule elapsed. Null before anything is spent or
|
|
@@ -3235,8 +3235,8 @@ const day$9 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
|
3235
3235
|
*/
|
|
3236
3236
|
function forecastAtCompletion(item, now) {
|
|
3237
3237
|
if (item.spent <= 0) return null;
|
|
3238
|
-
const total = differenceInCalendarDays(day$
|
|
3239
|
-
const gone = differenceInCalendarDays(now, day$
|
|
3238
|
+
const total = differenceInCalendarDays(day$11(item.endDate), day$11(item.startDate)) + 1;
|
|
3239
|
+
const gone = differenceInCalendarDays(now, day$11(item.startDate)) + 1;
|
|
3240
3240
|
if (total <= 0 || gone <= 0) return null;
|
|
3241
3241
|
const elapsed = Math.min(1, gone / total);
|
|
3242
3242
|
const eac = Math.round(item.spent / elapsed);
|
|
@@ -3910,7 +3910,7 @@ function weeklyFinished(tasks, startDate, now, weeks = 6) {
|
|
|
3910
3910
|
return counts;
|
|
3911
3911
|
}
|
|
3912
3912
|
function hash(text) {
|
|
3913
|
-
let h =
|
|
3913
|
+
let h = 0x811c9dc5;
|
|
3914
3914
|
for (let i = 0; i < text.length; i++) {
|
|
3915
3915
|
h ^= text.charCodeAt(i);
|
|
3916
3916
|
h = Math.imul(h, 16777619);
|
|
@@ -3921,7 +3921,7 @@ function hash(text) {
|
|
|
3921
3921
|
function random(seed) {
|
|
3922
3922
|
let a = seed;
|
|
3923
3923
|
return () => {
|
|
3924
|
-
a = a +
|
|
3924
|
+
a = a + 0x6d2b79f5 | 0;
|
|
3925
3925
|
let t = Math.imul(a ^ a >>> 15, 1 | a);
|
|
3926
3926
|
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
3927
3927
|
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
@@ -3933,7 +3933,7 @@ function simulate(remaining, weekly, seed, pace = 1, shares = null) {
|
|
|
3933
3933
|
const out = [];
|
|
3934
3934
|
for (let run = 0; run < TRIALS; run++) {
|
|
3935
3935
|
let left = remaining;
|
|
3936
|
-
let days =
|
|
3936
|
+
let days = 1e400;
|
|
3937
3937
|
for (let week = 0; week < MAX_WEEKS; week++) {
|
|
3938
3938
|
const drawn = weekly[Math.floor(next() * weekly.length)];
|
|
3939
3939
|
let closed = pace === 1 ? drawn : Math.floor(drawn * pace) + (next() < drawn * pace % 1 ? 1 : 0);
|
|
@@ -4483,7 +4483,7 @@ init_tide();
|
|
|
4483
4483
|
init_raid();
|
|
4484
4484
|
init_flow();
|
|
4485
4485
|
init_date_fns();
|
|
4486
|
-
const day$
|
|
4486
|
+
const day$10 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
4487
4487
|
function monthKey(iso) {
|
|
4488
4488
|
return iso.slice(0, 7);
|
|
4489
4489
|
}
|
|
@@ -4499,7 +4499,7 @@ function monthsBetween(from, to) {
|
|
|
4499
4499
|
return out;
|
|
4500
4500
|
}
|
|
4501
4501
|
function daysIn(key) {
|
|
4502
|
-
return getDaysInMonth(day$
|
|
4502
|
+
return getDaysInMonth(day$10(`${key}-01`));
|
|
4503
4503
|
}
|
|
4504
4504
|
/** How many of the schedule's days fall in `key`. */
|
|
4505
4505
|
function overlapDays(key, start, end) {
|
|
@@ -4507,7 +4507,7 @@ function overlapDays(key, start, end) {
|
|
|
4507
4507
|
const lastDay = `${key}-${String(daysIn(key)).padStart(2, "0")}`;
|
|
4508
4508
|
const from = start > first ? start : first;
|
|
4509
4509
|
const to = end < lastDay ? end : lastDay;
|
|
4510
|
-
return to < from ? 0 : differenceInCalendarDays(day$
|
|
4510
|
+
return to < from ? 0 : differenceInCalendarDays(day$10(to), day$10(from)) + 1;
|
|
4511
4511
|
}
|
|
4512
4512
|
/**
|
|
4513
4513
|
* The budget spread straight across the schedule: each month gets the share
|
|
@@ -4517,7 +4517,7 @@ function overlapDays(key, start, end) {
|
|
|
4517
4517
|
function evenPhasing(project) {
|
|
4518
4518
|
const end = project.endDate < project.startDate ? project.startDate : project.endDate;
|
|
4519
4519
|
const months = monthsBetween(project.startDate, end);
|
|
4520
|
-
const total = differenceInCalendarDays(day$
|
|
4520
|
+
const total = differenceInCalendarDays(day$10(end), day$10(project.startDate)) + 1;
|
|
4521
4521
|
const out = {};
|
|
4522
4522
|
let placed = 0;
|
|
4523
4523
|
months.forEach((k, i) => {
|
|
@@ -4624,7 +4624,7 @@ function hasBaseline(p) {
|
|
|
4624
4624
|
/** Days the end has moved past the baseline end; negative when it came in. Null without a baseline. */
|
|
4625
4625
|
function slipDays(p) {
|
|
4626
4626
|
if (!p.baselineEnd) return null;
|
|
4627
|
-
return differenceInCalendarDays(day$
|
|
4627
|
+
return differenceInCalendarDays(day$9(p.endDate), day$9(p.baselineEnd));
|
|
4628
4628
|
}
|
|
4629
4629
|
/**
|
|
4630
4630
|
* The projects with the current dates committed as their baseline; ones that
|
|
@@ -4646,10 +4646,10 @@ function slipLabel(p) {
|
|
|
4646
4646
|
const n = Math.abs(slip);
|
|
4647
4647
|
return slip > 0 ? `slipped ${n} day${n === 1 ? "" : "s"}` : `${n} day${n === 1 ? "" : "s"} early`;
|
|
4648
4648
|
}
|
|
4649
|
-
var day$
|
|
4649
|
+
var day$9;
|
|
4650
4650
|
var init_baseline = __esmMin((() => {
|
|
4651
4651
|
init_date_fns();
|
|
4652
|
-
day$
|
|
4652
|
+
day$9 = (iso) => /* @__PURE__ */ new Date(`${iso}T12:00:00`);
|
|
4653
4653
|
}));
|
|
4654
4654
|
|
|
4655
4655
|
// src/lib/roadmap.ts
|
|
@@ -4677,7 +4677,7 @@ const ZOOMS = [
|
|
|
4677
4677
|
step: 3
|
|
4678
4678
|
}
|
|
4679
4679
|
];
|
|
4680
|
-
const day$
|
|
4680
|
+
const day$8 = (iso) => /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T12:00:00`);
|
|
4681
4681
|
/** Names in the order people expect: "Phase 2" before "Phase 10". */
|
|
4682
4682
|
const byName = (a, b) => a.localeCompare(b, void 0, { numeric: true });
|
|
4683
4683
|
const isoDay$4 = (d) => format(d, "yyyy-MM-dd");
|
|
@@ -4687,7 +4687,7 @@ const isoDay$4 = (d) => format(d, "yyyy-MM-dd");
|
|
|
4687
4687
|
*/
|
|
4688
4688
|
function roadmapWindow(zoom, today, shift = 0) {
|
|
4689
4689
|
const z = ZOOMS.find((x) => x.id === zoom) ?? ZOOMS[1];
|
|
4690
|
-
const first = addMonths$1(startOfMonth(day$
|
|
4690
|
+
const first = addMonths$1(startOfMonth(day$8(today)), -1 + shift * z.step);
|
|
4691
4691
|
const after = addMonths$1(first, z.months);
|
|
4692
4692
|
const days = differenceInCalendarDays(after, first);
|
|
4693
4693
|
const months = Array.from({ length: z.months }, (_, i) => {
|
|
@@ -4711,15 +4711,15 @@ function roadmapWindow(zoom, today, shift = 0) {
|
|
|
4711
4711
|
function at(iso, w) {
|
|
4712
4712
|
if (!iso) return null;
|
|
4713
4713
|
if (iso < w.start || iso >= w.end) return null;
|
|
4714
|
-
return differenceInCalendarDays(day$
|
|
4714
|
+
return differenceInCalendarDays(day$8(iso), day$8(w.start)) / w.days;
|
|
4715
4715
|
}
|
|
4716
4716
|
/** A bar for a start–end span, clipped to the window; null when it's wholly outside. */
|
|
4717
4717
|
function span$1(start, end, w) {
|
|
4718
4718
|
if (!start || !end || end < w.start || start >= w.end) return null;
|
|
4719
4719
|
const from = start < w.start ? w.start : start;
|
|
4720
|
-
const until = end >= w.end ? w.end : isoDay$4(new Date(day$
|
|
4721
|
-
const left = differenceInCalendarDays(day$
|
|
4722
|
-
const right = differenceInCalendarDays(day$
|
|
4720
|
+
const until = end >= w.end ? w.end : isoDay$4(new Date(day$8(end).getTime() + 864e5));
|
|
4721
|
+
const left = differenceInCalendarDays(day$8(from), day$8(w.start)) / w.days;
|
|
4722
|
+
const right = differenceInCalendarDays(day$8(until), day$8(w.start)) / w.days;
|
|
4723
4723
|
return {
|
|
4724
4724
|
left,
|
|
4725
4725
|
width: Math.max(right - left, 1 / w.days),
|
|
@@ -4834,7 +4834,7 @@ function scoreMatch(query, name, ...secondary) {
|
|
|
4834
4834
|
return tokens.every((t) => blob.includes(t)) ? SCORE.anywhere : 0;
|
|
4835
4835
|
}
|
|
4836
4836
|
/** Keep what matches, best first. Ties keep the caller's order. */
|
|
4837
|
-
function rank(items, score, limit =
|
|
4837
|
+
function rank(items, score, limit = 1e400) {
|
|
4838
4838
|
const out = [];
|
|
4839
4839
|
items.forEach((item, index) => {
|
|
4840
4840
|
const s = score(item);
|
|
@@ -8366,7 +8366,7 @@ function bottleState(note, ctx) {
|
|
|
8366
8366
|
/** "opens on Nov 14", "opens when Factory buy-off is reached", "opens if Ridge Runner launch turns Off track" */
|
|
8367
8367
|
function opensText(opens, ctx) {
|
|
8368
8368
|
if (!opens) return "open now";
|
|
8369
|
-
if (opens.on === "date") return `opens on ${day$
|
|
8369
|
+
if (opens.on === "date") return `opens on ${day$7(opens.date)}`;
|
|
8370
8370
|
if (opens.on === "milestone") {
|
|
8371
8371
|
const m = ctx.milestones.find((x) => x.id === opens.milestoneId);
|
|
8372
8372
|
return m ? `opens when ${m.name} is reached` : "opens when its milestone is reached";
|
|
@@ -8400,7 +8400,7 @@ function freshlyOpened(data, projects, now) {
|
|
|
8400
8400
|
}
|
|
8401
8401
|
return out.sort((a, b) => (b.state.openedOn ?? "").localeCompare(a.state.openedOn ?? ""));
|
|
8402
8402
|
}
|
|
8403
|
-
var BOTTLE_FRESH_DAYS, isBottle, sealed, day$
|
|
8403
|
+
var BOTTLE_FRESH_DAYS, isBottle, sealed, day$7;
|
|
8404
8404
|
var init_bottle = __esmMin((() => {
|
|
8405
8405
|
init_date_fns();
|
|
8406
8406
|
init_date_text();
|
|
@@ -8412,7 +8412,7 @@ var init_bottle = __esmMin((() => {
|
|
|
8412
8412
|
open: false,
|
|
8413
8413
|
openedOn: null
|
|
8414
8414
|
};
|
|
8415
|
-
day$
|
|
8415
|
+
day$7 = (iso) => format(parseIso(iso.slice(0, 10)), "MMM d");
|
|
8416
8416
|
}));
|
|
8417
8417
|
|
|
8418
8418
|
// src/lib/decisions.ts
|
|
@@ -8727,7 +8727,7 @@ function lateOwnersOf(data, tasks, now) {
|
|
|
8727
8727
|
}
|
|
8728
8728
|
function composeBriefBody(opts) {
|
|
8729
8729
|
const date = format(opts.date, "MMMM d, yyyy");
|
|
8730
|
-
const shown = opts.all ?
|
|
8730
|
+
const shown = opts.all ? 1e400 : 8;
|
|
8731
8731
|
const watch = opts.watch ?? [];
|
|
8732
8732
|
const milestones = opts.milestones ?? [];
|
|
8733
8733
|
const lateMilestones = milestones.filter((m) => m.daysLate > 0);
|
|
@@ -10802,8 +10802,8 @@ init_blockers();
|
|
|
10802
10802
|
init_date_text();
|
|
10803
10803
|
init_premortem();
|
|
10804
10804
|
init_thanks();
|
|
10805
|
-
const day$
|
|
10806
|
-
const between = (a, b) => differenceInCalendarDays(day$
|
|
10805
|
+
const day$6 = (iso) => parseIso(localDay(iso));
|
|
10806
|
+
const between = (a, b) => differenceInCalendarDays(day$6(b), day$6(a));
|
|
10807
10807
|
function voyageLog(data, projectId) {
|
|
10808
10808
|
const project = data.projects.find((p) => p.id === projectId);
|
|
10809
10809
|
if (!project) return null;
|
|
@@ -10870,7 +10870,7 @@ function voyageLog(data, projectId) {
|
|
|
10870
10870
|
};
|
|
10871
10871
|
}
|
|
10872
10872
|
const plural$7 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
10873
|
-
const md$1 = (iso) => format(day$
|
|
10873
|
+
const md$1 = (iso) => format(day$6(iso), "MMM d");
|
|
10874
10874
|
/** The three numbers at the top: how late, how much work, how many risks came true. */
|
|
10875
10875
|
function voyageStats(log) {
|
|
10876
10876
|
const happened = log.risks.filter((r) => r.happened).length;
|
|
@@ -13257,7 +13257,7 @@ function dollars(value) {
|
|
|
13257
13257
|
const n = Number(value ?? 0);
|
|
13258
13258
|
return whole$1.format(Number.isFinite(n) ? n : 0);
|
|
13259
13259
|
}
|
|
13260
|
-
function day$
|
|
13260
|
+
function day$5(value) {
|
|
13261
13261
|
return value ? shortDate(value) : "no date";
|
|
13262
13262
|
}
|
|
13263
13263
|
/** Whole days from one ISO day to another. */
|
|
@@ -13345,15 +13345,15 @@ function describeEvent(e, names) {
|
|
|
13345
13345
|
};
|
|
13346
13346
|
case "dueDate": return {
|
|
13347
13347
|
action: "moved the due date of",
|
|
13348
|
-
detail: `from ${day$
|
|
13348
|
+
detail: `from ${day$5(from)} to ${day$5(to)}${slip(from, to)}`
|
|
13349
13349
|
};
|
|
13350
13350
|
case "startDate": return {
|
|
13351
13351
|
action: "moved the start of",
|
|
13352
|
-
detail: `from ${day$
|
|
13352
|
+
detail: `from ${day$5(from)} to ${day$5(to)}${slip(from, to)}`
|
|
13353
13353
|
};
|
|
13354
13354
|
case "endDate": return {
|
|
13355
13355
|
action: "moved the end of",
|
|
13356
|
-
detail: `from ${day$
|
|
13356
|
+
detail: `from ${day$5(from)} to ${day$5(to)}${slip(from, to)}`
|
|
13357
13357
|
};
|
|
13358
13358
|
case "budget": return {
|
|
13359
13359
|
action: "changed the budget of",
|
|
@@ -13795,7 +13795,7 @@ function landfallProblem(input) {
|
|
|
13795
13795
|
function landfallAnswerProblem(input) {
|
|
13796
13796
|
if (!LANDFALL_RESULTS.includes(input.result)) return "Say yes, partly or no.";
|
|
13797
13797
|
if (input.value != null && (typeof input.value !== "number" || !Number.isFinite(input.value))) return "The number has to be a number.";
|
|
13798
|
-
if (typeof input.value === "number" && Math.abs(input.value) >
|
|
13798
|
+
if (typeof input.value === "number" && Math.abs(input.value) > 1e12) return "That number is too big.";
|
|
13799
13799
|
if (clean$1(input.note).length > 500) return `Keep the note under ${500} characters.`;
|
|
13800
13800
|
return null;
|
|
13801
13801
|
}
|
|
@@ -13909,7 +13909,7 @@ function landfallJson(project, tasks, today, people) {
|
|
|
13909
13909
|
*/
|
|
13910
13910
|
/** FNV-1a over the text, as eight hex digits. */
|
|
13911
13911
|
function hash8(text) {
|
|
13912
|
-
let h =
|
|
13912
|
+
let h = 0x811c9dc5;
|
|
13913
13913
|
for (let i = 0; i < text.length; i++) {
|
|
13914
13914
|
h ^= text.charCodeAt(i);
|
|
13915
13915
|
h = Math.imul(h, 16777619);
|
|
@@ -13934,7 +13934,7 @@ init_date_fns();
|
|
|
13934
13934
|
init_date_text();
|
|
13935
13935
|
init_indexes();
|
|
13936
13936
|
init_tide();
|
|
13937
|
-
const day$
|
|
13937
|
+
const day$4 = (iso) => parseIso(iso.slice(0, 10));
|
|
13938
13938
|
/** When a convoy looks like arriving, and how that was read. */
|
|
13939
13939
|
function expectedOf(data, convoy, now) {
|
|
13940
13940
|
const project = convoy.projectId ? byId(data.projects).get(convoy.projectId) ?? null : null;
|
|
@@ -13972,7 +13972,7 @@ function convoyRows(data, now) {
|
|
|
13972
13972
|
for (const asker of data.programs) for (const convoy of asker.convoys ?? []) {
|
|
13973
13973
|
const giver = programs.get(convoy.toProgramId) ?? null;
|
|
13974
13974
|
const { expected, basis, project } = expectedOf(data, convoy, now);
|
|
13975
|
-
const late = expected ? differenceInCalendarDays(day$
|
|
13975
|
+
const late = expected ? differenceInCalendarDays(day$4(expected), day$4(convoy.by)) : null;
|
|
13976
13976
|
out.push({
|
|
13977
13977
|
convoy,
|
|
13978
13978
|
asker,
|
|
@@ -14028,7 +14028,7 @@ const MONTHS = [
|
|
|
14028
14028
|
];
|
|
14029
14029
|
/** "Dec 12". */
|
|
14030
14030
|
function shortDay(iso) {
|
|
14031
|
-
const d = day$
|
|
14031
|
+
const d = day$4(iso);
|
|
14032
14032
|
return Number.isNaN(d.getTime()) ? iso : `${MONTHS[d.getMonth()]} ${d.getDate()}`;
|
|
14033
14033
|
}
|
|
14034
14034
|
/** Who should hear about a convoy: its program's owner and whoever asked or answered. */
|
|
@@ -14082,7 +14082,7 @@ function firstName$3(name) {
|
|
|
14082
14082
|
}
|
|
14083
14083
|
/** FNV-1a over the text, as eight hex digits: a short, stable name for a set of ids. */
|
|
14084
14084
|
function shortHash(text) {
|
|
14085
|
-
let h =
|
|
14085
|
+
let h = 0x811c9dc5;
|
|
14086
14086
|
for (let i = 0; i < text.length; i++) {
|
|
14087
14087
|
h ^= text.charCodeAt(i);
|
|
14088
14088
|
h = Math.imul(h, 16777619);
|
|
@@ -15080,7 +15080,7 @@ function suggestTakers(data, fromId, items, now, today) {
|
|
|
15080
15080
|
for (const item of items) {
|
|
15081
15081
|
if (item.kind !== "task") continue;
|
|
15082
15082
|
let pick = people[0].id;
|
|
15083
|
-
let score = -
|
|
15083
|
+
let score = -1e400;
|
|
15084
15084
|
for (const p of people) {
|
|
15085
15085
|
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);
|
|
15086
15086
|
if (s > score) {
|
|
@@ -15198,7 +15198,7 @@ init_handover();
|
|
|
15198
15198
|
const SOON_DAYS = 21;
|
|
15199
15199
|
/** This many open tasks in one project that only one person has touched read as their corner of it. */
|
|
15200
15200
|
const CLUSTER = 4;
|
|
15201
|
-
const isoDay$1 = (d) => d
|
|
15201
|
+
const isoDay$1 = (d) => format(d, "yyyy-MM-dd");
|
|
15202
15202
|
const md = (iso) => format(parseIso(iso), "MMM d");
|
|
15203
15203
|
/** Everyone a task has passed through. */
|
|
15204
15204
|
function taskHands(task, commentsBy, attachedBy) {
|
|
@@ -15386,7 +15386,7 @@ function withSuggestions(data, lines, now) {
|
|
|
15386
15386
|
return lines.map((line) => {
|
|
15387
15387
|
const pool = takers({ people }, line.soloId, today);
|
|
15388
15388
|
let best = null;
|
|
15389
|
-
let score = -
|
|
15389
|
+
let score = -1e400;
|
|
15390
15390
|
for (const p of pool) {
|
|
15391
15391
|
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);
|
|
15392
15392
|
if (s > score) {
|
|
@@ -19203,7 +19203,7 @@ function raiseRows(data, projectId, at, byId) {
|
|
|
19203
19203
|
}
|
|
19204
19204
|
var WHY_MAX, kept;
|
|
19205
19205
|
var init_scuttle_rows = __esmMin((() => {
|
|
19206
|
-
init_assignment();
|
|
19206
|
+
/* @__PURE__ */ init_assignment();
|
|
19207
19207
|
init_indexes();
|
|
19208
19208
|
init_raid();
|
|
19209
19209
|
init_rollup_lock();
|
|
@@ -19979,8 +19979,8 @@ function optionalKeys(shape) {
|
|
|
19979
19979
|
}
|
|
19980
19980
|
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
19981
19981
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
19982
|
-
int32: [-
|
|
19983
|
-
uint32: [0,
|
|
19982
|
+
int32: [-0x80000000, 0x7fffffff],
|
|
19983
|
+
uint32: [0, 0xffffffff],
|
|
19984
19984
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
19985
19985
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
19986
19986
|
}))();
|
|
@@ -22101,9 +22101,7 @@ function mergeValues(a, b) {
|
|
|
22101
22101
|
};
|
|
22102
22102
|
const newArray = [];
|
|
22103
22103
|
for (let index = 0; index < a.length; index++) {
|
|
22104
|
-
const
|
|
22105
|
-
const itemB = b[index];
|
|
22106
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
22104
|
+
const sharedValue = mergeValues(a[index], b[index]);
|
|
22107
22105
|
if (!sharedValue.valid) return {
|
|
22108
22106
|
valid: false,
|
|
22109
22107
|
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
@@ -24988,7 +24986,7 @@ init_format();
|
|
|
24988
24986
|
init_indexes();
|
|
24989
24987
|
const noon$1 = (iso) => /* @__PURE__ */ new Date(`${iso.slice(0, 10)}T12:00:00`);
|
|
24990
24988
|
const days$2 = (from, to) => differenceInCalendarDays(noon$1(to), noon$1(from));
|
|
24991
|
-
const later = (a, b) => !a ? b : !b ? a : a >= b ? a : b;
|
|
24989
|
+
const later$1 = (a, b) => !a ? b : !b ? a : a >= b ? a : b;
|
|
24992
24990
|
const open = (t) => t.status !== "done";
|
|
24993
24991
|
/** True when `a` finishes later than `b`, or as late behind a longer line. */
|
|
24994
24992
|
const beats = (a, b) => !b || a.finish > b.finish || a.finish === b.finish && a.depth > b.depth;
|
|
@@ -25011,10 +25009,10 @@ function finishes(all, today) {
|
|
|
25011
25009
|
const w = walk(b);
|
|
25012
25010
|
if (w.finish && beats(w, behind)) behind = w;
|
|
25013
25011
|
}
|
|
25014
|
-
const own = t.dueDate ? later(t.dueDate.slice(0, 10), today) : null;
|
|
25012
|
+
const own = t.dueDate ? later$1(t.dueDate.slice(0, 10), today) : null;
|
|
25015
25013
|
onPath.delete(t.id);
|
|
25016
25014
|
const out = {
|
|
25017
|
-
finish: later(own, behind?.finish ?? null),
|
|
25015
|
+
finish: later$1(own, behind?.finish ?? null),
|
|
25018
25016
|
depth: (behind?.depth ?? 0) + 1
|
|
25019
25017
|
};
|
|
25020
25018
|
memo.set(t.id, out);
|
|
@@ -25135,7 +25133,7 @@ function milestonePole(milestone, data, now) {
|
|
|
25135
25133
|
return [{
|
|
25136
25134
|
project,
|
|
25137
25135
|
pole,
|
|
25138
|
-
finish: pole.kind === "chain" ? later(pole.finish, end) ?? end : end
|
|
25136
|
+
finish: pole.kind === "chain" ? later$1(pole.finish, end) ?? end : end
|
|
25139
25137
|
}];
|
|
25140
25138
|
});
|
|
25141
25139
|
if (runs.length === 0) return {
|
|
@@ -25469,7 +25467,7 @@ const SIMILAR_MIN = 3;
|
|
|
25469
25467
|
/** A finished task that took longer than this sat somewhere; it counts as this long. */
|
|
25470
25468
|
const SIMILAR_CAP = 15;
|
|
25471
25469
|
const firstName$1 = (name) => name.trim().split(/\s+/)[0] || name;
|
|
25472
|
-
const day$
|
|
25470
|
+
const day$3 = (iso) => iso ? iso.slice(0, 10) : null;
|
|
25473
25471
|
function quantile(sorted, q) {
|
|
25474
25472
|
const at = (sorted.length - 1) * q;
|
|
25475
25473
|
const lo = Math.floor(at);
|
|
@@ -25485,7 +25483,7 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25485
25483
|
const owner = byId(data.people).get(task.assigneeId);
|
|
25486
25484
|
if (!owner || owner.kind === "agent") return null;
|
|
25487
25485
|
const today = at ? todayFor(owner, at, localToday) : localToday;
|
|
25488
|
-
const chosen = day$
|
|
25486
|
+
const chosen = day$3(task.dueDate);
|
|
25489
25487
|
let underWay = 0;
|
|
25490
25488
|
const dated = [];
|
|
25491
25489
|
const finished = [];
|
|
@@ -25495,14 +25493,14 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25495
25493
|
if (t.projectId === task.projectId && t.completedAt) finished.push(t);
|
|
25496
25494
|
continue;
|
|
25497
25495
|
}
|
|
25498
|
-
const due = day$
|
|
25496
|
+
const due = day$3(t.dueDate);
|
|
25499
25497
|
if (t.status === "doing" || t.status === "review") underWay += 1;
|
|
25500
25498
|
else if (due) dated.push(due);
|
|
25501
25499
|
}
|
|
25502
25500
|
const perDay = Math.max(.2, (owner.weeklyCapacity ?? 5) / 5);
|
|
25503
25501
|
let similar = null;
|
|
25504
25502
|
if (finished.length >= SIMILAR_MIN) {
|
|
25505
|
-
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$
|
|
25503
|
+
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);
|
|
25506
25504
|
similar = {
|
|
25507
25505
|
low: Math.round(quantile(took, .25)),
|
|
25508
25506
|
high: Math.round(quantile(took, .75)),
|
|
@@ -25510,7 +25508,7 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25510
25508
|
};
|
|
25511
25509
|
}
|
|
25512
25510
|
const ownDays = Math.min(5, Math.max(1, similar?.low ?? 1));
|
|
25513
|
-
const backOn = isAway(owner, today) ? day$
|
|
25511
|
+
const backOn = isAway(owner, today) ? day$3(owner.away.until) : null;
|
|
25514
25512
|
const start = backOn && backOn > today ? dayBefore(backOn) : today;
|
|
25515
25513
|
const tasks = byId(data.tasks);
|
|
25516
25514
|
const projects = byId(data.projects);
|
|
@@ -25521,7 +25519,7 @@ function pilotDate(task, data, localToday, at) {
|
|
|
25521
25519
|
for (const id of blockers) {
|
|
25522
25520
|
const b = tasks.get(id);
|
|
25523
25521
|
if (!b || b.status === "done") continue;
|
|
25524
|
-
const due = day$
|
|
25522
|
+
const due = day$3(b.dueDate);
|
|
25525
25523
|
if (!due) {
|
|
25526
25524
|
undated ??= b;
|
|
25527
25525
|
continue;
|
|
@@ -25590,7 +25588,7 @@ const plural$3 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
|
25590
25588
|
/** 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". */
|
|
25591
25589
|
function pilotHeadline(p, chosen, you = false) {
|
|
25592
25590
|
const who = you ? "You" : firstName$1(p.owner.name);
|
|
25593
|
-
if (!day$
|
|
25591
|
+
if (!day$3(chosen)) return `${who} could likely have this by ${shortDate(p.earliest)}`;
|
|
25594
25592
|
return `${you ? "Your" : `${who}'s`} queue says ${shortDate(p.earliest)} at the earliest`;
|
|
25595
25593
|
}
|
|
25596
25594
|
/** Why: the queue, time away, what it waits on, and how long similar tasks took. */
|
|
@@ -25662,7 +25660,7 @@ function lastLooked(mark, data, personId) {
|
|
|
25662
25660
|
init_date_text();
|
|
25663
25661
|
init_indexes();
|
|
25664
25662
|
init_task_keys();
|
|
25665
|
-
const day = (iso) => parseIso(iso.slice(0, 10));
|
|
25663
|
+
const day$2 = (iso) => parseIso(iso.slice(0, 10));
|
|
25666
25664
|
const daysBetween = dayGap;
|
|
25667
25665
|
/** Their projects: ones they lead, in a program they lead, or with a task of theirs. */
|
|
25668
25666
|
function projectsOf(data, personId) {
|
|
@@ -25677,7 +25675,7 @@ function dueText(task, today) {
|
|
|
25677
25675
|
if (d === 0) return "due today";
|
|
25678
25676
|
if (d < 0) return `${-d} day${d === -1 ? "" : "s"} late`;
|
|
25679
25677
|
if (d === 1) return "due tomorrow";
|
|
25680
|
-
return `due ${format(day(task.dueDate), "EEE, MMM d")}`;
|
|
25678
|
+
return `due ${format(day$2(task.dueDate), "EEE, MMM d")}`;
|
|
25681
25679
|
}
|
|
25682
25680
|
/** What a person needs to hear about since `when.since`, as of `today` (YYYY-MM-DD). */
|
|
25683
25681
|
function welcomeBack(data, personId, when, today, shown = []) {
|
|
@@ -25805,7 +25803,7 @@ function moreText(more) {
|
|
|
25805
25803
|
/** "Welcome back, Priya · away Oct 3 to Oct 17", or "· 5 days since you last looked". */
|
|
25806
25804
|
function welcomeTitle(w, name, today) {
|
|
25807
25805
|
const hi = name ? `Welcome back, ${name}` : "Welcome back";
|
|
25808
|
-
if (w.when.why === "away") return `${hi} · away ${format(day(w.when.since), "MMM d")} to ${format(day(today), "MMM d")}`;
|
|
25806
|
+
if (w.when.why === "away") return `${hi} · away ${format(day$2(w.when.since), "MMM d")} to ${format(day$2(today), "MMM d")}`;
|
|
25809
25807
|
return `${hi} · ${w.when.days} days since you last looked`;
|
|
25810
25808
|
}
|
|
25811
25809
|
/** "Checkout v3: 4 done, 2 added, now At risk (was On track)". */
|
|
@@ -26277,6 +26275,346 @@ function gapText(gap) {
|
|
|
26277
26275
|
return `${called}; the numbers have said ${WORD[gap.rules]} for the last ${weeksText(gap.days)}.`;
|
|
26278
26276
|
}
|
|
26279
26277
|
|
|
26278
|
+
// src/lib/wbs-move.ts
|
|
26279
|
+
var wbs_move_exports = /* @__PURE__ */ __exportAll({
|
|
26280
|
+
applyMove: () => applyMove,
|
|
26281
|
+
moveProblem: () => moveProblem,
|
|
26282
|
+
orderPlans: () => orderPlans,
|
|
26283
|
+
orderTasks: () => orderTasks
|
|
26284
|
+
});
|
|
26285
|
+
/** Ranked first, in rank order; the rest after, as `fallback` orders them (stable). */
|
|
26286
|
+
function byRank(list, fallback) {
|
|
26287
|
+
const at = new Map(list.map((x, i) => [x.id, i]));
|
|
26288
|
+
return [...list].sort((a, b) => {
|
|
26289
|
+
const ra = a.wbsRank ?? 1e400;
|
|
26290
|
+
const rb = b.wbsRank ?? 1e400;
|
|
26291
|
+
if (ra !== rb) return ra - rb;
|
|
26292
|
+
if (fallback) {
|
|
26293
|
+
const f = fallback(a, b);
|
|
26294
|
+
if (f) return f;
|
|
26295
|
+
}
|
|
26296
|
+
return at.get(a.id) - at.get(b.id);
|
|
26297
|
+
});
|
|
26298
|
+
}
|
|
26299
|
+
/** The task a link really points at as its parent (subtasks.ts's rule, without the import). */
|
|
26300
|
+
function realParent(t, index) {
|
|
26301
|
+
const p = t.parentTaskId ? index.get(t.parentTaskId) : void 0;
|
|
26302
|
+
if (!p || p.id === t.id || p.projectId !== t.projectId || p.parentTaskId) return null;
|
|
26303
|
+
return p;
|
|
26304
|
+
}
|
|
26305
|
+
/** The subtasks under `parent`, in list order. */
|
|
26306
|
+
function subsOf(parent, tasks, index) {
|
|
26307
|
+
if (realParent(parent, index)) return [];
|
|
26308
|
+
return (childrenByParent(tasks).get(parent.id) ?? []).filter((t) => t.projectId === parent.projectId && t.id !== parent.id);
|
|
26309
|
+
}
|
|
26310
|
+
/** The tasks that stand on their own in a project. */
|
|
26311
|
+
function topOf(projectId, tasks, index) {
|
|
26312
|
+
return tasksOf(tasks, projectId).filter((t) => !realParent(t, index));
|
|
26313
|
+
}
|
|
26314
|
+
/** Why this move can't be made, in a sentence; null when it can. */
|
|
26315
|
+
function moveProblem(doc, move) {
|
|
26316
|
+
if (move.kind === "program") {
|
|
26317
|
+
if (!doc.programs.some((p) => p.id === move.id)) return "That program isn't here any more.";
|
|
26318
|
+
return null;
|
|
26319
|
+
}
|
|
26320
|
+
if (move.kind === "project") {
|
|
26321
|
+
if (!doc.projects.some((p) => p.id === move.id)) return "That project isn't here any more.";
|
|
26322
|
+
if (!doc.programs.some((p) => p.id === move.into)) return "That program isn't here any more.";
|
|
26323
|
+
return null;
|
|
26324
|
+
}
|
|
26325
|
+
const index = byId(doc.tasks);
|
|
26326
|
+
const task = index.get(move.id);
|
|
26327
|
+
if (!task) return "That task isn't here any more.";
|
|
26328
|
+
const parent = move.into.kind === "task" ? index.get(move.into.id) : void 0;
|
|
26329
|
+
if (move.into.kind === "task" && !parent) return "That task isn't here any more.";
|
|
26330
|
+
const projectId = parent ? parent.projectId : move.into.id;
|
|
26331
|
+
if (!doc.projects.some((p) => p.id === projectId)) return "That project isn't here any more.";
|
|
26332
|
+
const locked = lockedFields(task);
|
|
26333
|
+
if (projectId !== task.projectId && locked.includes("projectId")) return "This task is kept in step from another tool, so it stays in its project.";
|
|
26334
|
+
const parentNow = realParent(task, index)?.id ?? null;
|
|
26335
|
+
if ((parent?.id ?? null) !== parentNow && locked.includes("parentTaskId")) return "This task is kept in step from Jira, which says what it sits under.";
|
|
26336
|
+
if (!parent) return null;
|
|
26337
|
+
if (parent.id === task.id) return "A task can't go inside itself.";
|
|
26338
|
+
if (realParent(parent, index)) return "That task is already a subtask; subtasks go one level deep.";
|
|
26339
|
+
if (subsOf(task, doc.tasks, index).length > 0) return "This task has subtasks of its own, so it can't go inside another.";
|
|
26340
|
+
if (subsOf(parent, doc.tasks, index).filter((t) => t.id !== task.id).length >= 50) return `A task can hold up to ${50} subtasks.`;
|
|
26341
|
+
return null;
|
|
26342
|
+
}
|
|
26343
|
+
/** `list` with `item` put before `before` (or last), each given its place as its rank. */
|
|
26344
|
+
function ranked(list, item, before) {
|
|
26345
|
+
const rest = list.filter((x) => x.id !== item.id);
|
|
26346
|
+
const at = before ? rest.findIndex((x) => x.id === before) : -1;
|
|
26347
|
+
rest.splice(at < 0 ? rest.length : at, 0, item);
|
|
26348
|
+
return new Map(rest.map((x, i) => [x.id, i + 1]));
|
|
26349
|
+
}
|
|
26350
|
+
/**
|
|
26351
|
+
* The rows the move changes, or null when it changes nothing (or can't be
|
|
26352
|
+
* made: ask `moveProblem` for why). A task moved to another project takes its
|
|
26353
|
+
* subtasks with it, as moving it from its drawer does; one kept in step from
|
|
26354
|
+
* another tool can't leave, so it stands alone where it was.
|
|
26355
|
+
*/
|
|
26356
|
+
function applyMove(doc, move, now) {
|
|
26357
|
+
if (moveProblem(doc, move)) return null;
|
|
26358
|
+
if (move.kind === "program") {
|
|
26359
|
+
const program = doc.programs.find((p) => p.id === move.id);
|
|
26360
|
+
const ranks = ranked(orderPlans(doc.programs.filter((p) => p.portfolioId === move.into)), program, move.before);
|
|
26361
|
+
let changed = false;
|
|
26362
|
+
const programs = doc.programs.map((p) => {
|
|
26363
|
+
const rank = ranks.get(p.id);
|
|
26364
|
+
if (rank === void 0) return p;
|
|
26365
|
+
const portfolioId = p.id === program.id ? move.into : p.portfolioId;
|
|
26366
|
+
if (p.wbsRank === rank && p.portfolioId === portfolioId) return p;
|
|
26367
|
+
changed = true;
|
|
26368
|
+
return {
|
|
26369
|
+
...p,
|
|
26370
|
+
wbsRank: rank,
|
|
26371
|
+
portfolioId
|
|
26372
|
+
};
|
|
26373
|
+
});
|
|
26374
|
+
return changed ? { programs } : null;
|
|
26375
|
+
}
|
|
26376
|
+
if (move.kind === "project") {
|
|
26377
|
+
const project = doc.projects.find((p) => p.id === move.id);
|
|
26378
|
+
const ranks = ranked(orderPlans(doc.projects.filter((p) => p.programId === move.into)), project, move.before);
|
|
26379
|
+
let changed = false;
|
|
26380
|
+
const projects = doc.projects.map((p) => {
|
|
26381
|
+
const rank = ranks.get(p.id);
|
|
26382
|
+
if (rank === void 0) return p;
|
|
26383
|
+
const programId = p.id === project.id ? move.into : p.programId;
|
|
26384
|
+
if (p.wbsRank === rank && p.programId === programId) return p;
|
|
26385
|
+
changed = true;
|
|
26386
|
+
return {
|
|
26387
|
+
...p,
|
|
26388
|
+
wbsRank: rank,
|
|
26389
|
+
programId
|
|
26390
|
+
};
|
|
26391
|
+
});
|
|
26392
|
+
return changed ? { projects } : null;
|
|
26393
|
+
}
|
|
26394
|
+
const index = byId(doc.tasks);
|
|
26395
|
+
const task = index.get(move.id);
|
|
26396
|
+
const parent = move.into.kind === "task" ? index.get(move.into.id) : null;
|
|
26397
|
+
const projectId = parent ? parent.projectId : move.into.id;
|
|
26398
|
+
const parentTaskId = parent?.id ?? null;
|
|
26399
|
+
const ranks = ranked(parent ? orderTasks(subsOf(parent, doc.tasks, index)) : orderTasks(topOf(projectId, doc.tasks, index)), task, move.before);
|
|
26400
|
+
const under = projectId !== task.projectId ? subsOf(task, doc.tasks, index) : [];
|
|
26401
|
+
const carried = new Set(under.filter((t) => !lockedFields(t).includes("projectId")).map((t) => t.id));
|
|
26402
|
+
const leftBehind = new Set(under.filter((t) => !carried.has(t.id)).map((t) => t.id));
|
|
26403
|
+
let changed = false;
|
|
26404
|
+
const tasks = doc.tasks.map((t) => {
|
|
26405
|
+
if (t.id === task.id) {
|
|
26406
|
+
const rank = ranks.get(t.id);
|
|
26407
|
+
const parentNow = realParent(t, index)?.id ?? null;
|
|
26408
|
+
if (t.projectId === projectId && parentNow === parentTaskId && t.wbsRank === rank) return t;
|
|
26409
|
+
changed = true;
|
|
26410
|
+
return {
|
|
26411
|
+
...t,
|
|
26412
|
+
projectId,
|
|
26413
|
+
parentTaskId,
|
|
26414
|
+
wbsRank: rank,
|
|
26415
|
+
touchedAt: now
|
|
26416
|
+
};
|
|
26417
|
+
}
|
|
26418
|
+
if (carried.has(t.id)) {
|
|
26419
|
+
changed = true;
|
|
26420
|
+
return {
|
|
26421
|
+
...t,
|
|
26422
|
+
projectId,
|
|
26423
|
+
touchedAt: now
|
|
26424
|
+
};
|
|
26425
|
+
}
|
|
26426
|
+
if (leftBehind.has(t.id)) {
|
|
26427
|
+
changed = true;
|
|
26428
|
+
return {
|
|
26429
|
+
...t,
|
|
26430
|
+
parentTaskId: null
|
|
26431
|
+
};
|
|
26432
|
+
}
|
|
26433
|
+
const rank = ranks.get(t.id);
|
|
26434
|
+
if (rank === void 0 || t.wbsRank === rank) return t;
|
|
26435
|
+
changed = true;
|
|
26436
|
+
return {
|
|
26437
|
+
...t,
|
|
26438
|
+
wbsRank: rank
|
|
26439
|
+
};
|
|
26440
|
+
});
|
|
26441
|
+
return changed ? { tasks } : null;
|
|
26442
|
+
}
|
|
26443
|
+
var byStart, orderTasks, orderPlans;
|
|
26444
|
+
var init_wbs_move = __esmMin((() => {
|
|
26445
|
+
init_indexes();
|
|
26446
|
+
init_rollup_lock();
|
|
26447
|
+
init_subtasks();
|
|
26448
|
+
byStart = (a, b) => (a.startDate || "").localeCompare(b.startDate || "") || a.name.localeCompare(b.name);
|
|
26449
|
+
orderTasks = (list) => byRank(list);
|
|
26450
|
+
orderPlans = (list) => byRank(list, byStart);
|
|
26451
|
+
}));
|
|
26452
|
+
|
|
26453
|
+
// src/lib/wbs.ts
|
|
26454
|
+
init_indexes();
|
|
26455
|
+
init_rollup_lock();
|
|
26456
|
+
init_task_keys();
|
|
26457
|
+
init_wbs_move();
|
|
26458
|
+
const day$1 = (iso) => iso ? iso.slice(0, 10) : null;
|
|
26459
|
+
const earlier = (a, b) => !a ? b : !b ? a : a < b ? a : b;
|
|
26460
|
+
const later = (a, b) => !a ? b : !b ? a : a > b ? a : b;
|
|
26461
|
+
function lockOf(t) {
|
|
26462
|
+
const locked = lockedFields(t);
|
|
26463
|
+
if (!locked.includes("projectId")) return void 0;
|
|
26464
|
+
return locked.includes("parentTaskId") ? "all" : "project";
|
|
26465
|
+
}
|
|
26466
|
+
function taskNode(t, kind, code, level, project, subs, today) {
|
|
26467
|
+
const lateOf = (x) => x.status !== "done" && x.dueDate && day$1(x.dueDate) < today ? 1 : 0;
|
|
26468
|
+
const children = orderTasks(subs).map((s, i) => taskNode(s, "subtask", `${code}.${i + 1}`, level + 1, project, [], today));
|
|
26469
|
+
let start = day$1(t.startDate);
|
|
26470
|
+
let end = day$1(t.dueDate);
|
|
26471
|
+
if (children.length) {
|
|
26472
|
+
start = earlier(start, end);
|
|
26473
|
+
for (const c of children) {
|
|
26474
|
+
start = earlier(earlier(start, c.start), c.end);
|
|
26475
|
+
end = later(later(end, c.end), c.start);
|
|
26476
|
+
}
|
|
26477
|
+
}
|
|
26478
|
+
const doneSubs = children.filter((c) => c.finished).length;
|
|
26479
|
+
return {
|
|
26480
|
+
kind,
|
|
26481
|
+
id: t.id,
|
|
26482
|
+
code,
|
|
26483
|
+
level,
|
|
26484
|
+
title: t.title,
|
|
26485
|
+
key: taskKey(t, project) ?? void 0,
|
|
26486
|
+
ownerId: t.assigneeId,
|
|
26487
|
+
start,
|
|
26488
|
+
end,
|
|
26489
|
+
runsPast: false,
|
|
26490
|
+
done: children.length ? doneSubs : t.status === "done" ? 1 : 0,
|
|
26491
|
+
total: children.length || 1,
|
|
26492
|
+
late: lateOf(t) + children.reduce((n, c) => n + c.late, 0),
|
|
26493
|
+
status: t.status,
|
|
26494
|
+
finished: t.status === "done",
|
|
26495
|
+
projectId: t.projectId,
|
|
26496
|
+
locked: lockOf(t),
|
|
26497
|
+
children
|
|
26498
|
+
};
|
|
26499
|
+
}
|
|
26500
|
+
function projectNode(p, code, level, doc, today) {
|
|
26501
|
+
const index = byId(doc.tasks);
|
|
26502
|
+
const kids = childrenByParent(doc.tasks);
|
|
26503
|
+
const all = tasksByProject(doc.tasks).get(p.id) ?? [];
|
|
26504
|
+
const parentOf = (t) => {
|
|
26505
|
+
const q = t.parentTaskId ? index.get(t.parentTaskId) : void 0;
|
|
26506
|
+
return q && q.id !== t.id && q.projectId === t.projectId && !q.parentTaskId ? q : null;
|
|
26507
|
+
};
|
|
26508
|
+
const children = orderTasks(all.filter((t) => !parentOf(t))).map((t, i) => {
|
|
26509
|
+
const subs = (kids.get(t.id) ?? []).filter((s) => s.projectId === p.id && s.id !== t.id);
|
|
26510
|
+
return taskNode(t, "task", code ? `${code}.${i + 1}` : `${i + 1}`, level + 1, p, subs, today);
|
|
26511
|
+
});
|
|
26512
|
+
let latest = null;
|
|
26513
|
+
for (const c of children) latest = later(latest, c.end);
|
|
26514
|
+
const end = day$1(p.endDate);
|
|
26515
|
+
const done = all.filter((t) => t.status === "done").length;
|
|
26516
|
+
return {
|
|
26517
|
+
kind: "project",
|
|
26518
|
+
id: p.id,
|
|
26519
|
+
code,
|
|
26520
|
+
level,
|
|
26521
|
+
title: p.name,
|
|
26522
|
+
key: p.key,
|
|
26523
|
+
ownerId: p.ownerId || null,
|
|
26524
|
+
start: day$1(p.startDate),
|
|
26525
|
+
end,
|
|
26526
|
+
runsPast: Boolean(end && latest && latest > end),
|
|
26527
|
+
done,
|
|
26528
|
+
total: all.length,
|
|
26529
|
+
late: children.reduce((n, c) => n + c.late, 0),
|
|
26530
|
+
health: p.health,
|
|
26531
|
+
finished: p.health === "done",
|
|
26532
|
+
children
|
|
26533
|
+
};
|
|
26534
|
+
}
|
|
26535
|
+
/** A node that adds up its children's tasks. */
|
|
26536
|
+
function summed(base) {
|
|
26537
|
+
let done = 0;
|
|
26538
|
+
let total = 0;
|
|
26539
|
+
let late = 0;
|
|
26540
|
+
for (const c of base.children) {
|
|
26541
|
+
done += c.done;
|
|
26542
|
+
total += c.total;
|
|
26543
|
+
late += c.late;
|
|
26544
|
+
}
|
|
26545
|
+
return {
|
|
26546
|
+
...base,
|
|
26547
|
+
done,
|
|
26548
|
+
total,
|
|
26549
|
+
late
|
|
26550
|
+
};
|
|
26551
|
+
}
|
|
26552
|
+
function programNode(g, code, level, doc, today) {
|
|
26553
|
+
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));
|
|
26554
|
+
let latest = null;
|
|
26555
|
+
for (const c of children) latest = later(latest, later(c.end, latestUnder(c)));
|
|
26556
|
+
const end = day$1(g.endDate);
|
|
26557
|
+
return summed({
|
|
26558
|
+
kind: "program",
|
|
26559
|
+
id: g.id,
|
|
26560
|
+
code,
|
|
26561
|
+
level,
|
|
26562
|
+
title: g.name,
|
|
26563
|
+
ownerId: g.ownerId || null,
|
|
26564
|
+
start: day$1(g.startDate),
|
|
26565
|
+
end,
|
|
26566
|
+
runsPast: Boolean(end && latest && latest > end),
|
|
26567
|
+
health: g.health,
|
|
26568
|
+
finished: g.health === "done",
|
|
26569
|
+
children
|
|
26570
|
+
});
|
|
26571
|
+
}
|
|
26572
|
+
/** The latest end among a node's children, all the way down. */
|
|
26573
|
+
function latestUnder(n) {
|
|
26574
|
+
let out = null;
|
|
26575
|
+
for (const c of n.children) out = later(out, later(c.end, latestUnder(c)));
|
|
26576
|
+
return out;
|
|
26577
|
+
}
|
|
26578
|
+
/**
|
|
26579
|
+
* The breakdown of one portfolio, program or project, or null when it isn't
|
|
26580
|
+
* there. `today` is "YYYY-MM-DD", for what's late.
|
|
26581
|
+
*/
|
|
26582
|
+
function buildBreakdown(doc, root, today) {
|
|
26583
|
+
if (root.kind === "project") {
|
|
26584
|
+
const p = doc.projects.find((x) => x.id === root.id);
|
|
26585
|
+
return p ? projectNode(p, "", 0, doc, today) : null;
|
|
26586
|
+
}
|
|
26587
|
+
if (root.kind === "program") {
|
|
26588
|
+
const g = doc.programs.find((x) => x.id === root.id);
|
|
26589
|
+
return g ? programNode(g, "", 0, doc, today) : null;
|
|
26590
|
+
}
|
|
26591
|
+
const f = doc.portfolios.find((x) => x.id === root.id);
|
|
26592
|
+
if (!f) return null;
|
|
26593
|
+
const children = orderPlans(doc.programs.filter((g) => g.portfolioId === f.id)).map((g, i) => programNode(g, `${i + 1}`, 1, doc, today));
|
|
26594
|
+
let start = null;
|
|
26595
|
+
let end = null;
|
|
26596
|
+
for (const c of children) {
|
|
26597
|
+
start = earlier(start, c.start);
|
|
26598
|
+
end = later(end, c.end);
|
|
26599
|
+
}
|
|
26600
|
+
return summed({
|
|
26601
|
+
kind: "portfolio",
|
|
26602
|
+
id: f.id,
|
|
26603
|
+
code: "",
|
|
26604
|
+
level: 0,
|
|
26605
|
+
title: f.name,
|
|
26606
|
+
ownerId: f.ownerId || null,
|
|
26607
|
+
start,
|
|
26608
|
+
end,
|
|
26609
|
+
runsPast: false,
|
|
26610
|
+
health: f.health,
|
|
26611
|
+
finished: f.health === "done",
|
|
26612
|
+
children
|
|
26613
|
+
});
|
|
26614
|
+
}
|
|
26615
|
+
/** Whole percent done; 0 with nothing to count. */
|
|
26616
|
+
const percentDone = (n) => n.total > 0 ? Math.round(n.done / n.total * 100) : 0;
|
|
26617
|
+
|
|
26280
26618
|
// src/lib/mcp/tools.ts
|
|
26281
26619
|
init_project_messages();
|
|
26282
26620
|
init_daily_digest();
|
|
@@ -26998,6 +27336,60 @@ function chatAnswer(data, target, lines) {
|
|
|
26998
27336
|
}))
|
|
26999
27337
|
};
|
|
27000
27338
|
}
|
|
27339
|
+
/** The portfolio, program or project a breakdown is asked of; a name that's two kinds asks which. */
|
|
27340
|
+
function breakdownTarget(data, of, kind) {
|
|
27341
|
+
const lists = {
|
|
27342
|
+
project: data.projects,
|
|
27343
|
+
program: data.programs,
|
|
27344
|
+
portfolio: data.portfolios
|
|
27345
|
+
};
|
|
27346
|
+
if (kind) return {
|
|
27347
|
+
kind,
|
|
27348
|
+
id: findOne(lists[kind], of, kind).id
|
|
27349
|
+
};
|
|
27350
|
+
const want = of.trim().toLowerCase();
|
|
27351
|
+
const exact = [
|
|
27352
|
+
"project",
|
|
27353
|
+
"program",
|
|
27354
|
+
"portfolio"
|
|
27355
|
+
].flatMap((k) => lists[k].filter((i) => i.id === of.trim() || i.name.trim().toLowerCase() === want || i.key?.toLowerCase() === want).map((i) => ({
|
|
27356
|
+
kind: k,
|
|
27357
|
+
id: i.id
|
|
27358
|
+
})));
|
|
27359
|
+
const kinds = new Set(exact.map((e) => e.kind));
|
|
27360
|
+
if (kinds.size > 1) throw new ToolError(`"${of.trim()}" is a ${[...kinds].join(" and a ")}; say which with kind.`);
|
|
27361
|
+
if (exact.length) return {
|
|
27362
|
+
kind: exact[0].kind,
|
|
27363
|
+
id: findOne(lists[exact[0].kind], of, exact[0].kind).id
|
|
27364
|
+
};
|
|
27365
|
+
for (const k of [
|
|
27366
|
+
"project",
|
|
27367
|
+
"program",
|
|
27368
|
+
"portfolio"
|
|
27369
|
+
]) try {
|
|
27370
|
+
return {
|
|
27371
|
+
kind: k,
|
|
27372
|
+
id: findOne(lists[k], of, k).id
|
|
27373
|
+
};
|
|
27374
|
+
} catch (e) {
|
|
27375
|
+
if (!(e instanceof ToolError) || !/^No /.test(e.message)) throw e;
|
|
27376
|
+
}
|
|
27377
|
+
throw new ToolError(`No portfolio, program or project called "${of.trim()}".`);
|
|
27378
|
+
}
|
|
27379
|
+
/** The lines under `root`, top to bottom, `depth` levels down; with `open`, nothing finished or under it. */
|
|
27380
|
+
function breakdownLines(root, depth, open) {
|
|
27381
|
+
const out = [];
|
|
27382
|
+
const walk = (n) => {
|
|
27383
|
+
for (const c of n.children) {
|
|
27384
|
+
if (open && c.finished) continue;
|
|
27385
|
+
if (depth && c.level - root.level > depth) continue;
|
|
27386
|
+
out.push(c);
|
|
27387
|
+
walk(c);
|
|
27388
|
+
}
|
|
27389
|
+
};
|
|
27390
|
+
walk(root);
|
|
27391
|
+
return out;
|
|
27392
|
+
}
|
|
27001
27393
|
const HARBOR_TOOLS = [
|
|
27002
27394
|
tool({
|
|
27003
27395
|
name: "harbor_overview",
|
|
@@ -28934,6 +29326,58 @@ const HARBOR_TOOLS = [
|
|
|
28934
29326
|
};
|
|
28935
29327
|
}
|
|
28936
29328
|
}),
|
|
29329
|
+
tool({
|
|
29330
|
+
name: "work_breakdown",
|
|
29331
|
+
title: "Work breakdown",
|
|
29332
|
+
description: "A portfolio, program or project as its work breakdown (the website's Breakdown view): one numbered line per program, project, task and subtask under it (1, 1.1, 1.1.2), each with its owner, dates, tasks done of all and how many are late, rolled up from under it. Numbers count from the thing asked for and include finished work, so they match the website's. `of` names it; `kind` settles a name that's both a project and a program. `depth` keeps to that many levels; `open` leaves finished work out." + DATA_NOTE,
|
|
29333
|
+
input: object({
|
|
29334
|
+
harbor: harborArg,
|
|
29335
|
+
of: string().min(1).max(200).describe("Portfolio, program or project: id, key or name."),
|
|
29336
|
+
kind: _enum([
|
|
29337
|
+
"portfolio",
|
|
29338
|
+
"program",
|
|
29339
|
+
"project"
|
|
29340
|
+
]).optional(),
|
|
29341
|
+
depth: number().int().min(1).max(4).optional().describe("Levels to show, 1 being its children."),
|
|
29342
|
+
open: boolean().default(false).describe("Leave finished work out (numbers stay)."),
|
|
29343
|
+
limit: limitArg(1e3, 300),
|
|
29344
|
+
offset: offsetArg
|
|
29345
|
+
}),
|
|
29346
|
+
run: (ctx, input) => {
|
|
29347
|
+
const { data } = ctx;
|
|
29348
|
+
const root = breakdownTarget(data, input.of, input.kind);
|
|
29349
|
+
const tree = buildBreakdown(data, root, todayISO(ctx.now));
|
|
29350
|
+
const people = byId(data.people);
|
|
29351
|
+
const all = breakdownLines(tree, input.depth, input.open);
|
|
29352
|
+
return {
|
|
29353
|
+
of: {
|
|
29354
|
+
kind: tree.kind,
|
|
29355
|
+
name: tree.title
|
|
29356
|
+
},
|
|
29357
|
+
done: tree.done,
|
|
29358
|
+
tasks: tree.total,
|
|
29359
|
+
late: tree.late,
|
|
29360
|
+
lines: all.slice(input.offset, input.offset + input.limit).map((n) => ({
|
|
29361
|
+
wbs: n.code,
|
|
29362
|
+
level: n.level - tree.level,
|
|
29363
|
+
kind: n.kind,
|
|
29364
|
+
name: n.title,
|
|
29365
|
+
...n.key && (n.kind === "task" || n.kind === "subtask") ? { key: n.key } : {},
|
|
29366
|
+
owner: nameOf$2(people, n.ownerId),
|
|
29367
|
+
start: n.start,
|
|
29368
|
+
end: n.end,
|
|
29369
|
+
...n.status ? { status: n.status } : n.finished ? { status: "done" } : {},
|
|
29370
|
+
...n.kind === "task" && n.children.length ? { subtasks: n.children.length } : {},
|
|
29371
|
+
done: n.done,
|
|
29372
|
+
tasks: n.total,
|
|
29373
|
+
percent: percentDone(n),
|
|
29374
|
+
...n.late ? { late: n.late } : {},
|
|
29375
|
+
...n.runsPast ? { runsPastEnd: true } : {}
|
|
29376
|
+
})),
|
|
29377
|
+
more: all.length > input.offset + input.limit
|
|
29378
|
+
};
|
|
29379
|
+
}
|
|
29380
|
+
}),
|
|
28937
29381
|
tool({
|
|
28938
29382
|
name: "what_if",
|
|
28939
29383
|
title: "Try a what-if plan for a portfolio",
|
|
@@ -29125,6 +29569,58 @@ var init_errors = __esmMin((() => {
|
|
|
29125
29569
|
};
|
|
29126
29570
|
}));
|
|
29127
29571
|
|
|
29572
|
+
// src/lib/first-due.ts
|
|
29573
|
+
/** The task as it should be saved after its due day went from `was` to `task`'s. */
|
|
29574
|
+
function firstDueAfter(was, task) {
|
|
29575
|
+
if (task.firstDue !== was.firstDue) return task.firstDue == null ? dropFirstDue(task) : task;
|
|
29576
|
+
const from = day(was.dueDate);
|
|
29577
|
+
const to = day(task.dueDate);
|
|
29578
|
+
if (from === to) return task;
|
|
29579
|
+
if (!to || !from) return dropFirstDue(task);
|
|
29580
|
+
const first = task.firstDue ?? from;
|
|
29581
|
+
if (first === to) return dropFirstDue(task);
|
|
29582
|
+
return task.firstDue === first ? task : {
|
|
29583
|
+
...task,
|
|
29584
|
+
firstDue: first
|
|
29585
|
+
};
|
|
29586
|
+
}
|
|
29587
|
+
function dropFirstDue(task) {
|
|
29588
|
+
if (!("firstDue" in task)) return task;
|
|
29589
|
+
const { firstDue: _gone, ...rest } = task;
|
|
29590
|
+
return rest;
|
|
29591
|
+
}
|
|
29592
|
+
/** A new task in a series, or a copy, starts with its own first date. */
|
|
29593
|
+
function withoutFirstDue(task) {
|
|
29594
|
+
if (!("firstDue" in task)) return task;
|
|
29595
|
+
const { firstDue: _gone, ...rest } = task;
|
|
29596
|
+
return rest;
|
|
29597
|
+
}
|
|
29598
|
+
/**
|
|
29599
|
+
* Keeps each task's first due day through a write: only tasks whose object
|
|
29600
|
+
* changed are looked at, so a write that doesn't touch tasks costs nothing.
|
|
29601
|
+
*/
|
|
29602
|
+
function keepFirstDue(before, after) {
|
|
29603
|
+
if (after.tasks === before.tasks) return after;
|
|
29604
|
+
const was = byId(before.tasks);
|
|
29605
|
+
let changed = false;
|
|
29606
|
+
const tasks = after.tasks.map((t) => {
|
|
29607
|
+
const old = was.get(t.id);
|
|
29608
|
+
if (!old || old === t) return t;
|
|
29609
|
+
const next = firstDueAfter(old, t);
|
|
29610
|
+
if (next !== t) changed = true;
|
|
29611
|
+
return next;
|
|
29612
|
+
});
|
|
29613
|
+
return changed ? {
|
|
29614
|
+
...after,
|
|
29615
|
+
tasks
|
|
29616
|
+
} : after;
|
|
29617
|
+
}
|
|
29618
|
+
var day;
|
|
29619
|
+
var init_first_due = __esmMin((() => {
|
|
29620
|
+
init_indexes();
|
|
29621
|
+
day = (iso) => iso ? iso.slice(0, 10) : null;
|
|
29622
|
+
}));
|
|
29623
|
+
|
|
29128
29624
|
// src/lib/deep-equal.ts
|
|
29129
29625
|
/**
|
|
29130
29626
|
* Structural equality, key-order independent, treating `undefined` and a
|
|
@@ -29281,7 +29777,7 @@ function applyRowChanges(rows, changes, options = {}) {
|
|
|
29281
29777
|
}
|
|
29282
29778
|
var LATEST_WINS;
|
|
29283
29779
|
var init_row_changes = __esmMin((() => {
|
|
29284
|
-
init_deep_equal();
|
|
29780
|
+
/* @__PURE__ */ init_deep_equal();
|
|
29285
29781
|
LATEST_WINS = /* @__PURE__ */ new Set(["touchedAt"]);
|
|
29286
29782
|
}));
|
|
29287
29783
|
|
|
@@ -29638,6 +30134,12 @@ var init_session = __esmMin((() => {
|
|
|
29638
30134
|
*
|
|
29639
30135
|
* The placeholder program ("The work") isn't on the list: it gives way to
|
|
29640
30136
|
* the first program anyone makes, so naming it is never a chore to set.
|
|
30137
|
+
*
|
|
30138
|
+
* The list opens partway done, because it is: making the account, and
|
|
30139
|
+
* opening the harbor (or joining one), are the first steps, and they were
|
|
30140
|
+
* taken before Today ever showed. People finish a list they've already
|
|
30141
|
+
* started more often than an empty one, so those count, ticked. Nothing
|
|
30142
|
+
* else is ticked that wasn't done.
|
|
29641
30143
|
*/
|
|
29642
30144
|
/**
|
|
29643
30145
|
* The program launch named for you, while nobody has renamed it and it holds
|
|
@@ -30074,6 +30576,19 @@ function hierarchySlice({ get, write }) {
|
|
|
30074
30576
|
const program = get().programs.find((p) => p.id === programId);
|
|
30075
30577
|
get().log(`moved ${ids.length} project${ids.length === 1 ? "" : "s"} to ${program?.name ?? "a program"}`, `/programs/${programId}`);
|
|
30076
30578
|
},
|
|
30579
|
+
placeInBreakdown: async (move) => {
|
|
30580
|
+
const { applyMove, moveProblem } = await Promise.resolve().then(() => (init_wbs_move(), wbs_move_exports));
|
|
30581
|
+
const s = get();
|
|
30582
|
+
const problem = moveProblem(s, move);
|
|
30583
|
+
if (problem) return problem;
|
|
30584
|
+
const rows = applyMove(s, move, stamp());
|
|
30585
|
+
if (!rows) return null;
|
|
30586
|
+
write(rows);
|
|
30587
|
+
const name = move.kind === "task" ? s.tasks.find((t) => t.id === move.id)?.title : move.kind === "project" ? s.projects.find((p) => p.id === move.id)?.name : s.programs.find((p) => p.id === move.id)?.name;
|
|
30588
|
+
const where = move.kind === "task" ? move.into.kind === "task" ? `/projects/${s.tasks.find((t) => t.id === move.into.id)?.projectId ?? ""}` : `/projects/${move.into.id}` : move.kind === "project" ? `/programs/${move.into}` : `/portfolios/${move.into}`;
|
|
30589
|
+
get().log(`moved “${name ?? "an item"}” in the breakdown`, where);
|
|
30590
|
+
return null;
|
|
30591
|
+
},
|
|
30077
30592
|
restoreRows: (rows, links) => {
|
|
30078
30593
|
const state = get();
|
|
30079
30594
|
const back = (current, add) => {
|
|
@@ -30170,6 +30685,24 @@ function hierarchySlice({ get, write }) {
|
|
|
30170
30685
|
get().log("cleared the sample portfolio", "/portfolios");
|
|
30171
30686
|
return true;
|
|
30172
30687
|
},
|
|
30688
|
+
addSamplePortfolio: (withSample) => {
|
|
30689
|
+
const state = get();
|
|
30690
|
+
if (hasSample(state)) return false;
|
|
30691
|
+
const next = withSample(state, todayISO());
|
|
30692
|
+
write({
|
|
30693
|
+
people: next.people,
|
|
30694
|
+
portfolios: next.portfolios,
|
|
30695
|
+
programs: next.programs,
|
|
30696
|
+
projects: next.projects,
|
|
30697
|
+
milestones: next.milestones,
|
|
30698
|
+
tasks: next.tasks,
|
|
30699
|
+
raidItems: next.raidItems,
|
|
30700
|
+
comments: next.comments,
|
|
30701
|
+
boardConfigs: next.boardConfigs
|
|
30702
|
+
});
|
|
30703
|
+
get().log("added the sample portfolio", `/portfolios/${SAMPLE_PORTFOLIO_ID}`);
|
|
30704
|
+
return true;
|
|
30705
|
+
},
|
|
30173
30706
|
setBoardConfig: (projectId, config) => {
|
|
30174
30707
|
write({ boardConfigs: {
|
|
30175
30708
|
...get().boardConfigs ?? {},
|
|
@@ -30211,7 +30744,7 @@ var init_hierarchy = __esmMin((() => {
|
|
|
30211
30744
|
init_health_history();
|
|
30212
30745
|
init_derived_health();
|
|
30213
30746
|
init_shared();
|
|
30214
|
-
init_assignment();
|
|
30747
|
+
/* @__PURE__ */ init_assignment();
|
|
30215
30748
|
init_scuttle_rows();
|
|
30216
30749
|
init_hill();
|
|
30217
30750
|
init_charter_lines();
|
|
@@ -30436,7 +30969,7 @@ function nextOccurrence(task, id, today, createdAt, siblings = []) {
|
|
|
30436
30969
|
if (siblings.some((t) => t.status !== "done" && t.repeat === task.repeat && t.title === task.title && (t.dueDate ?? "") >= dueDate)) return null;
|
|
30437
30970
|
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;
|
|
30438
30971
|
return {
|
|
30439
|
-
...task,
|
|
30972
|
+
...withoutFirstDue(task),
|
|
30440
30973
|
id,
|
|
30441
30974
|
status: "todo",
|
|
30442
30975
|
dueDate,
|
|
@@ -30457,6 +30990,7 @@ var REPEAT_LABEL, iso, step;
|
|
|
30457
30990
|
var init_recurrence = __esmMin((() => {
|
|
30458
30991
|
init_date_fns();
|
|
30459
30992
|
init_date_text();
|
|
30993
|
+
init_first_due();
|
|
30460
30994
|
REPEAT_LABEL = {
|
|
30461
30995
|
weekly: "Every week",
|
|
30462
30996
|
biweekly: "Every two weeks",
|
|
@@ -30572,7 +31106,7 @@ function tasksSlice({ set, get, write }) {
|
|
|
30572
31106
|
}
|
|
30573
31107
|
const id = uid("t");
|
|
30574
31108
|
const row = {
|
|
30575
|
-
...t,
|
|
31109
|
+
...withoutFirstDue(t),
|
|
30576
31110
|
id,
|
|
30577
31111
|
createdAt: stamp(),
|
|
30578
31112
|
createdById: t.createdById ?? (get().currentUserId || null),
|
|
@@ -31156,8 +31690,9 @@ var init_tasks = __esmMin((() => {
|
|
|
31156
31690
|
init_work();
|
|
31157
31691
|
init_shared();
|
|
31158
31692
|
init_recurrence();
|
|
31693
|
+
init_first_due();
|
|
31159
31694
|
init_indexes();
|
|
31160
|
-
init_assignment();
|
|
31695
|
+
/* @__PURE__ */ init_assignment();
|
|
31161
31696
|
init_bulk();
|
|
31162
31697
|
init_task_people();
|
|
31163
31698
|
init_subtasks();
|
|
@@ -31936,13 +32471,13 @@ function applyMoves(s, moves, lineFor) {
|
|
|
31936
32471
|
var init_people_spend = __esmMin((() => {
|
|
31937
32472
|
init_format();
|
|
31938
32473
|
init_handover();
|
|
31939
|
-
init_assignment();
|
|
32474
|
+
/* @__PURE__ */ init_assignment();
|
|
31940
32475
|
init_rollup_lock();
|
|
31941
32476
|
init_spend();
|
|
31942
32477
|
init_utils();
|
|
31943
32478
|
init_countries();
|
|
31944
32479
|
init_shared();
|
|
31945
|
-
init_allocation();
|
|
32480
|
+
/* @__PURE__ */ init_allocation();
|
|
31946
32481
|
}));
|
|
31947
32482
|
|
|
31948
32483
|
// src/tui/engine/store.ts
|
|
@@ -31969,10 +32504,10 @@ function createAppStore(onNotice = () => {}) {
|
|
|
31969
32504
|
};
|
|
31970
32505
|
const write = (partial) => {
|
|
31971
32506
|
const before = get();
|
|
31972
|
-
guardedSet((s) => stampHealth(followMilestones(s, numberNewTasks(s, {
|
|
32507
|
+
guardedSet((s) => stampHealth(followMilestones(s, keepFirstDue(s, numberNewTasks(s, {
|
|
31973
32508
|
...s,
|
|
31974
32509
|
...partial
|
|
31975
|
-
}))));
|
|
32510
|
+
})))));
|
|
31976
32511
|
undo = nextStep(undo, before, get(), Date.now());
|
|
31977
32512
|
};
|
|
31978
32513
|
const api = {
|
|
@@ -32038,6 +32573,7 @@ var init_store = __esmMin((() => {
|
|
|
32038
32573
|
init_vanilla();
|
|
32039
32574
|
init_derived_health();
|
|
32040
32575
|
init_task_keys();
|
|
32576
|
+
init_first_due();
|
|
32041
32577
|
init_task_milestones();
|
|
32042
32578
|
init_payload();
|
|
32043
32579
|
init_undo();
|
|
@@ -32128,7 +32664,7 @@ function liftWholeRows(sent, stored, sameVersion) {
|
|
|
32128
32664
|
}
|
|
32129
32665
|
var COLLECTIONS, ROW_COLLECTIONS, KEYED, isKeyed, isRowKey;
|
|
32130
32666
|
var init_changes = __esmMin((() => {
|
|
32131
|
-
init_deep_equal();
|
|
32667
|
+
/* @__PURE__ */ init_deep_equal();
|
|
32132
32668
|
init_row_changes();
|
|
32133
32669
|
COLLECTIONS = [
|
|
32134
32670
|
"currentUserId",
|
|
@@ -32354,7 +32890,7 @@ function catchUpPatch(current, fresh) {
|
|
|
32354
32890
|
var hasId;
|
|
32355
32891
|
var init_catch_up = __esmMin((() => {
|
|
32356
32892
|
init_changes();
|
|
32357
|
-
init_deep_equal();
|
|
32893
|
+
/* @__PURE__ */ init_deep_equal();
|
|
32358
32894
|
hasId = (v) => typeof v === "object" && v !== null && typeof v.id === "string";
|
|
32359
32895
|
}));
|
|
32360
32896
|
|
|
@@ -32395,7 +32931,7 @@ var NOT_WHOLE;
|
|
|
32395
32931
|
var init_live_changes = __esmMin((() => {
|
|
32396
32932
|
init_changes();
|
|
32397
32933
|
init_catch_up();
|
|
32398
|
-
init_deep_equal();
|
|
32934
|
+
/* @__PURE__ */ init_deep_equal();
|
|
32399
32935
|
init_row_changes();
|
|
32400
32936
|
NOT_WHOLE = [...ROW_COLLECTIONS, "currentUserId"];
|
|
32401
32937
|
}));
|