@harborppm/cli 0.111.0 → 0.112.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/dist/app.mjs CHANGED
@@ -2732,7 +2732,28 @@ function withoutPractice(data) {
2732
2732
  if (data.spendEntries) out.spendEntries = data.spendEntries.filter((e) => !isVoyageProject(e.projectId));
2733
2733
  return out;
2734
2734
  }
2735
- var VOYAGE_PROJECT_ID, STEPS, voyageTaskId, VOYAGE_NO_FORECAST, SEEDED;
2735
+ /**
2736
+ * First voyage's open tasks that what's happened in the harbor has now done.
2737
+ * Only the ones on the person whose device this is: a tick is saved as theirs,
2738
+ * so someone who joined never ticks the owner's practice (History would say
2739
+ * they did), and the owner's own apps are the ones that count.
2740
+ */
2741
+ function voyageTicks(data, signals) {
2742
+ if (!data.projects.some((p) => isVoyageProject(p.id))) return [];
2743
+ const open = data.tasks.filter((t) => SEEDED.has(t.id) && t.status !== "done" && t.assigneeId === data.currentUserId);
2744
+ if (open.length === 0) return [];
2745
+ const own = (t) => !SEEDED.has(t.id);
2746
+ const done = {
2747
+ task: data.tasks.some(own),
2748
+ move: data.tasks.some((t) => MOVED.includes(t.status) || own(t) && t.status === "done"),
2749
+ crew: data.people.length > 1,
2750
+ terminal: signals.apps?.some((a) => a === "Harbor CLI") ?? false,
2751
+ agent: signals.apps?.some((a) => a !== "Harbor CLI") ?? false,
2752
+ wrap: false
2753
+ };
2754
+ return open.filter((t) => done[t.id.slice(7)]).map((t) => t.id);
2755
+ }
2756
+ var VOYAGE_PROJECT_ID, STEPS, voyageTaskId, VOYAGE_NO_FORECAST, MOVED, SEEDED;
2736
2757
  var init_first_voyage = __esmMin((() => {
2737
2758
  VOYAGE_PROJECT_ID = "voyage";
2738
2759
  STEPS = [
@@ -2769,6 +2790,7 @@ var init_first_voyage = __esmMin((() => {
2769
2790
  ];
2770
2791
  voyageTaskId = (step) => `voyage-${step}`;
2771
2792
  VOYAGE_NO_FORECAST = "It's practice, not the crew's pace, so there's nothing to forecast.";
2793
+ MOVED = ["doing", "review"];
2772
2794
  SEEDED = new Set(STEPS.map((s) => voyageTaskId(s.step)));
2773
2795
  }));
2774
2796
 
@@ -6683,7 +6705,7 @@ function RowList$1({ rows, at, height, width }) {
6683
6705
  color: on ? theme.selected : r.color ?? (r.plain ? theme.muted : void 0),
6684
6706
  bold: on || r.plain && !r.text.startsWith(" "),
6685
6707
  wrap: "truncate-end",
6686
- children: [r.plain ? " " : on ? "›" : " ", r.text]
6708
+ children: [r.plain ? " " : on ? "› " : " ", r.text]
6687
6709
  })
6688
6710
  }, r.key);
6689
6711
  }) });
@@ -9245,15 +9267,19 @@ const KIND_WORD = {
9245
9267
  raid: "Risk or issue"
9246
9268
  };
9247
9269
  const ago = (iso) => iso ? timeAgo(new Date(iso), clockNow()) : "never";
9248
- /** Recently deleted as lines: what it was, where it sat, what came with it, who and when. */
9270
+ /**
9271
+ * Recently deleted as lines: what it was, who deleted it and when, where it
9272
+ * sat, and what came with it. When says the most, so it comes before where:
9273
+ * a narrow terminal cuts from the end.
9274
+ */
9249
9275
  function deletedRows(entries) {
9250
9276
  return entries.map((e) => ({
9251
9277
  key: e.id,
9252
9278
  text: [
9253
9279
  `${KIND_WORD[e.kind]} · ${e.name}`,
9280
+ `deleted ${ago(e.deletedAt)}${e.deletedBy ? ` by ${e.deletedBy}` : ""}`,
9254
9281
  e.parentName ? `in ${e.parentName}` : null,
9255
- e.summary ? `with ${e.summary}` : null,
9256
- `deleted ${ago(e.deletedAt)}${e.deletedBy ? ` by ${e.deletedBy}` : ""}`
9282
+ e.summary ? `with ${e.summary}` : null
9257
9283
  ].filter(Boolean).join(" · "),
9258
9284
  item: e
9259
9285
  }));
@@ -11022,6 +11048,7 @@ function readTaskWords(input, ctx) {
11022
11048
  break;
11023
11049
  }
11024
11050
  let owner = null;
11051
+ const nobody = [];
11025
11052
  if (!skip.has("owner")) {
11026
11053
  const byKey = (key) => {
11027
11054
  const full = ctx.people.filter((p) => loose(p.name) === key);
@@ -11032,16 +11059,23 @@ function readTaskWords(input, ctx) {
11032
11059
  return key.length >= 3 && begins.length === 1 ? begins[0] : null;
11033
11060
  };
11034
11061
  for (const m of text.matchAll(/(?:^|\s)@([\p{L}\p{N}._-]+)/gu)) {
11035
- const hit = byKey(loose(m[1]));
11036
- if (!hit) continue;
11037
11062
  const start = m.index + (m[0].length - m[0].trimStart().length);
11038
- if (!free(start, m.index + m[0].length)) continue;
11063
+ const end = m.index + m[0].length;
11064
+ const hit = byKey(loose(m[1]));
11065
+ if (!hit) {
11066
+ if (free(start, end)) nobody.push({
11067
+ value: text.slice(start, end),
11068
+ start,
11069
+ end
11070
+ });
11071
+ continue;
11072
+ }
11073
+ if (owner || !free(start, end)) continue;
11039
11074
  owner = {
11040
11075
  value: hit.id,
11041
11076
  start,
11042
- end: m.index + m[0].length
11077
+ end
11043
11078
  };
11044
- break;
11045
11079
  }
11046
11080
  if (!owner) for (const m of text.matchAll(/(?:^|[\s,])(?:assign(?:ed)? (?:it )?to|owner(?: is)?:?) (\p{L}+(?: \p{L}+)?)/giu)) {
11047
11081
  const words = m[1].split(" ");
@@ -11079,7 +11113,7 @@ function readTaskWords(input, ctx) {
11079
11113
  break;
11080
11114
  }
11081
11115
  if (!due) {
11082
- const rest = without(text, taken);
11116
+ const rest = without(text, [...taken, ...nobody]);
11083
11117
  const tail = new RegExp(`(?:^|[\\s,])(${WHEN})[.!]?$`, "i").exec(rest);
11084
11118
  const short = tail && /^(?:sun|mon|tue|wed|thu|fri|sat)$/i.test(tail[1]);
11085
11119
  const said = tail && /\b(?:to|for|from|after|with|since)$/i.test(rest.slice(0, tail.index).trimEnd());
@@ -11118,7 +11152,8 @@ function readTaskWords(input, ctx) {
11118
11152
  project: project ? {
11119
11153
  value: project.value,
11120
11154
  text: span(project)
11121
- } : null
11155
+ } : null,
11156
+ nobody: nobody.filter((n) => free(n.start, n.end)).map((n) => n.value)
11122
11157
  };
11123
11158
  }
11124
11159
 
@@ -11186,9 +11221,14 @@ function readNewTask(text, data, today) {
11186
11221
  words.priority && `${PRIORITY_LABEL[words.priority.value].toLowerCase()} priority`,
11187
11222
  words.project && (data.projects.find((p) => p.id === words.project.value)?.name ?? "project")
11188
11223
  ].filter((b) => Boolean(b));
11224
+ const nobody = words.nobody.map((n) => `no one called ${n.slice(1)} yet`);
11189
11225
  return {
11190
11226
  words,
11191
- line: bits.length && words.title ? [`Adds “${words.title}”`, ...bits].join(" · ") : null
11227
+ line: (bits.length || nobody.length) && words.title ? [
11228
+ `Adds “${words.title}”`,
11229
+ ...bits,
11230
+ ...nobody
11231
+ ].join(" · ") : null
11192
11232
  };
11193
11233
  }
11194
11234
  const CREATE_TITLE = {
@@ -12211,7 +12251,103 @@ function blankCharters(data, programs, today) {
12211
12251
  return out.sort((a, b) => b.days - a.days || a.project.name.localeCompare(b.project.name));
12212
12252
  }
12213
12253
 
12254
+ // src/lib/empty.ts
12255
+ function addMonths(iso, months) {
12256
+ const [y, m, d] = iso.split("-").map(Number);
12257
+ const dt = new Date(y, (m ?? 1) - 1, d ?? 1);
12258
+ dt.setMonth(dt.getMonth() + months);
12259
+ return todayISO(dt);
12260
+ }
12261
+ /**
12262
+ * True when an account's name is just its email's local part: what sign-up
12263
+ * filled in before it asked, and still does when the name is left blank.
12264
+ */
12265
+ function nameFromEmail(name, email) {
12266
+ const local = (email ?? "").split("@")[0]?.trim().toLowerCase() ?? "";
12267
+ const given = (name ?? "").trim().toLowerCase();
12268
+ return given === "" || local !== "" && given === local;
12269
+ }
12270
+ /**
12271
+ * A name worth offering in the harbor-name field: "Sam's harbor", or "" when
12272
+ * no real name is known yet, so the field stays empty and shows its
12273
+ * placeholder. An email address isn't a name: "test+x's harbor" reads worse
12274
+ * than none.
12275
+ */
12276
+ function harborNameFor(displayName, email) {
12277
+ if (nameFromEmail(displayName, email)) return "";
12278
+ const first = (displayName ?? "").split(/\s/)[0]?.trim();
12279
+ return first ? `${first}'s harbor` : "";
12280
+ }
12281
+ /** What a new harbor is called until its owner names it: "Sam's harbor", else "My harbor". */
12282
+ function suggestedHarborName(displayName, email) {
12283
+ return harborNameFor(displayName, email) || "My harbor";
12284
+ }
12285
+ function createEmptyHarbor(opts) {
12286
+ const today = todayISO();
12287
+ const person = opts.person;
12288
+ const harbor = opts.harborName.trim() || "Harbor";
12289
+ const program = opts.programName?.trim() || "The work";
12290
+ const drum = opts.drumTitle?.trim() ?? "";
12291
+ return {
12292
+ currentUserId: person.id,
12293
+ readPingIds: [],
12294
+ ropes: [],
12295
+ checkIns: [],
12296
+ boardConfigs: {},
12297
+ people: [person],
12298
+ portfolios: [{
12299
+ id: "home",
12300
+ name: harbor,
12301
+ description: "The work of this harbor.",
12302
+ swatch: "pine",
12303
+ ownerId: person.id,
12304
+ health: "on-track",
12305
+ budget: 0
12306
+ }],
12307
+ programs: [{
12308
+ id: "p1",
12309
+ portfolioId: "home",
12310
+ name: program,
12311
+ description: opts.programDescription?.trim() ?? "",
12312
+ swatch: "pine",
12313
+ ownerId: person.id,
12314
+ health: "on-track",
12315
+ startDate: today,
12316
+ endDate: addMonths(today, 6),
12317
+ budget: 0
12318
+ }],
12319
+ projects: [],
12320
+ milestones: [],
12321
+ raidItems: [],
12322
+ constraints: drum ? [{
12323
+ id: "k1",
12324
+ programId: "p1",
12325
+ title: drum,
12326
+ kind: opts.drumKind ?? "external",
12327
+ status: "active",
12328
+ ownerId: person.id,
12329
+ note: opts.drumNote?.trim() ?? ""
12330
+ }] : [],
12331
+ tasks: [],
12332
+ comments: [],
12333
+ attachments: [],
12334
+ activity: [{
12335
+ id: "a1",
12336
+ personId: person.id,
12337
+ text: drum ? `named the constraint — ${drum}` : `opened ${harbor}`,
12338
+ at: (/* @__PURE__ */ new Date()).toISOString(),
12339
+ href: "/today"
12340
+ }]
12341
+ };
12342
+ }
12343
+ var STARTER_PROGRAM;
12344
+ var init_empty = __esmMin((() => {
12345
+ init_format();
12346
+ STARTER_PROGRAM = "The work";
12347
+ }));
12348
+
12214
12349
  // src/tui/moves.ts
12350
+ init_empty();
12215
12351
  init_board();
12216
12352
  function moveTask(store, go, task, status) {
12217
12353
  const s = store.getState();
@@ -13169,6 +13305,146 @@ function HistoryView({ active, width, height, go }) {
13169
13305
  });
13170
13306
  }
13171
13307
 
13308
+ // src/lib/daily-digest.ts
13309
+ /**
13310
+ * The projects a scope covers; a person's are the ones they lead, sit under,
13311
+ * or have a task in. First voyage is practice, so its tasks, talk and
13312
+ * health never count as what changed.
13313
+ */
13314
+ function projectsIn(data, scope) {
13315
+ const own = ownProjects(data.projects);
13316
+ if (scope.kind === "harbor") return own;
13317
+ if (scope.kind === "program") return own.filter((p) => p.programId === scope.id);
13318
+ const led = new Set(data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id));
13319
+ return own.filter((p) => p.ownerId === scope.id || led.has(p.programId) || tasksOf(data.tasks, p.id).some((t) => t.assigneeId === scope.id));
13320
+ }
13321
+ /** Where health went since `since`: from what it was just before to what it is now, if it moved. */
13322
+ function moved(history, now, since) {
13323
+ const list = history ?? [];
13324
+ if (!list.some((h) => h.at >= since)) return null;
13325
+ const before = [...list].reverse().find((h) => h.at < since)?.health;
13326
+ return before && before !== now ? {
13327
+ from: before,
13328
+ to: now
13329
+ } : null;
13330
+ }
13331
+ /** What changed in `scope` from `since` (an ISO moment) on. */
13332
+ function dailyDigest(data, scope, since) {
13333
+ const projects = projectsIn(data, scope);
13334
+ const projectIds = new Set(projects.map((p) => p.id));
13335
+ const programIds = scope.kind === "program" ? /* @__PURE__ */ new Set([scope.id]) : new Set(scope.kind === "harbor" ? data.programs.map((p) => p.id) : [...projects.map((p) => p.programId), ...data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id)]);
13336
+ const tasks = projects.flatMap((p) => tasksOf(data.tasks, p.id));
13337
+ const arrivedDone = (t) => Boolean(t.completedAt) && Math.abs(Date.parse(t.completedAt) - Date.parse(t.createdAt)) < ARRIVED_DONE_MS;
13338
+ const finished = tasks.filter((t) => t.status === "done" && t.completedAt && t.completedAt >= since && !arrivedDone(t)).sort((a, b) => b.completedAt.localeCompare(a.completedAt));
13339
+ const finishedIds = new Set(finished.map((t) => t.id));
13340
+ const added = tasks.filter((t) => t.createdAt >= since && !finishedIds.has(t.id)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
13341
+ const health = [];
13342
+ for (const p of data.programs) {
13343
+ if (!programIds.has(p.id)) continue;
13344
+ const m = moved(p.healthHistory, p.health, since);
13345
+ if (m) health.push({
13346
+ name: p.name,
13347
+ path: `/programs/${p.id}`,
13348
+ ...m
13349
+ });
13350
+ }
13351
+ for (const p of projects) {
13352
+ const m = moved(p.healthHistory, p.health, since);
13353
+ if (m) health.push({
13354
+ name: p.name,
13355
+ path: `/projects/${p.id}`,
13356
+ ...m
13357
+ });
13358
+ }
13359
+ const inScope = (r) => r.projectId ? projectIds.has(r.projectId) : r.programId ? programIds.has(r.programId) : scope.kind === "harbor";
13360
+ const raised = data.raidItems.filter((r) => r.kind !== "decision" && r.createdAt >= since && inScope(r)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
13361
+ const decided = data.raidItems.filter((r) => r.kind === "decision" && r.status !== "proposed" && Boolean(r.decidedAt) && r.decidedAt >= since && inScope(r)).sort((a, b) => b.decidedAt.localeCompare(a.decidedAt));
13362
+ const people = byId(data.people);
13363
+ const first = (id) => people.get(id)?.name.split(" ")[0] ?? "Someone";
13364
+ const projectById = byId(data.projects);
13365
+ const programById = byId(data.programs);
13366
+ const talkBy = /* @__PURE__ */ new Map();
13367
+ const count = (key, where, path, authorId, taskId) => {
13368
+ const t = talkBy.get(key) ?? {
13369
+ where,
13370
+ path,
13371
+ ...taskId ? { taskId } : {},
13372
+ count: 0,
13373
+ who: []
13374
+ };
13375
+ t.count++;
13376
+ const name = first(authorId);
13377
+ if (!t.who.includes(name)) t.who.push(name);
13378
+ talkBy.set(key, t);
13379
+ };
13380
+ for (const r of data.reflections ?? []) {
13381
+ if (!isMessage(r) || r.createdAt < since) continue;
13382
+ const place = placeOf(r);
13383
+ const holder = place.kind === "program" ? programById.get(place.id) : projectById.get(place.id);
13384
+ const inside = place.kind === "program" ? programIds.has(place.id) : projectIds.has(place.id);
13385
+ if (!holder || !inside) continue;
13386
+ count(`${place.kind}:${place.id}`, holder.name, placePath(place), r.authorId);
13387
+ }
13388
+ const taskById = byId(data.tasks);
13389
+ for (const c of data.comments) {
13390
+ if (c.createdAt < since) continue;
13391
+ const task = taskById.get(c.taskId);
13392
+ if (!task || !projectIds.has(task.projectId)) continue;
13393
+ const key = taskKey(task, projectById.get(task.projectId));
13394
+ count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, `/projects/${task.projectId}`, c.authorId, task.id);
13395
+ }
13396
+ const talk = [...talkBy.values()].sort((a, b) => b.count - a.count || a.where.localeCompare(b.where));
13397
+ return {
13398
+ since,
13399
+ finished,
13400
+ added,
13401
+ health,
13402
+ raised,
13403
+ decided,
13404
+ talk,
13405
+ quiet: !finished.length && !added.length && !health.length && !raised.length && !decided.length && !talk.length
13406
+ };
13407
+ }
13408
+ /** "A, B and 2 more". */
13409
+ function some(names, shown = 3) {
13410
+ const quoted = names.slice(0, shown).map((n) => `“${n}”`);
13411
+ const rest = names.length - quoted.length;
13412
+ if (rest > 0) return `${quoted.join(", ")} and ${rest} more`;
13413
+ if (quoted.length < 2) return quoted.join("");
13414
+ return `${quoted.slice(0, -1).join(", ")} and ${quoted.at(-1)}`;
13415
+ }
13416
+ /** The digest as short plain lines, the way the Inbox card, a chat post and the terminal say it. */
13417
+ function digestLines(d) {
13418
+ const lines = [];
13419
+ if (d.finished.length) lines.push(`${plural$6(d.finished.length, "task")} finished: ${some(d.finished.map((t) => t.title))}.`);
13420
+ if (d.added.length) lines.push(`${plural$6(d.added.length, "task")} added: ${some(d.added.map((t) => t.title))}.`);
13421
+ for (const h of d.health.slice(0, 5)) lines.push(`${h.name} went from ${HEALTH_LABEL$1[h.from] ?? h.from} to ${HEALTH_LABEL$1[h.to] ?? h.to}.`);
13422
+ if (d.health.length > 5) lines.push(`${d.health.length - 5} more changed health.`);
13423
+ if (d.raised.length) {
13424
+ const risks = d.raised.filter((r) => r.kind === "risk").length;
13425
+ const issues = d.raised.length - risks;
13426
+ const what = [risks ? plural$6(risks, "risk") : "", issues ? plural$6(issues, "issue") : ""].filter(Boolean).join(" and ");
13427
+ lines.push(`${what} raised: ${some(d.raised.map((r) => r.title))}.`);
13428
+ }
13429
+ if (d.decided.length) lines.push(`${plural$6(d.decided.length, "decision")} made: ${some(d.decided.map((r) => r.title))}.`);
13430
+ if (d.talk.length) {
13431
+ const top = d.talk.slice(0, 3).map((t) => `${t.where} (${t.count}, ${t.who.join(", ")})`).join("; ");
13432
+ const rest = d.talk.length - 3;
13433
+ lines.push(`Talk: ${top}${rest > 0 ? `; and ${plural$6(rest, "more conversation")}` : ""}.`);
13434
+ }
13435
+ return lines;
13436
+ }
13437
+ var ARRIVED_DONE_MS, plural$6;
13438
+ var init_daily_digest = __esmMin((() => {
13439
+ init_swatches();
13440
+ init_first_voyage();
13441
+ init_indexes();
13442
+ init_project_messages();
13443
+ init_task_keys();
13444
+ ARRIVED_DONE_MS = 6e4;
13445
+ plural$6 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
13446
+ }));
13447
+
13172
13448
  // src/lib/landfall-lines.ts
13173
13449
  function isLandfallDays(n) {
13174
13450
  return LANDFALL_DAYS.includes(n);
@@ -13245,6 +13521,7 @@ var init_landfall_lines = __esmMin((() => {
13245
13521
  }));
13246
13522
 
13247
13523
  // src/lib/landfall.ts
13524
+ init_daily_digest();
13248
13525
  init_date_fns();
13249
13526
  init_date_text();
13250
13527
  function plusDays(iso, days) {
@@ -13845,9 +14122,17 @@ function inboxOf(data, personId, now = clockNow()) {
13845
14122
 
13846
14123
  // src/tui/views/inbox.tsx
13847
14124
  init_date_text();
13848
- /** What's asking for you, the same pings as the website's Inbox: Enter opens one, space marks it read. */
14125
+ const DAY_MS = 864e5;
14126
+ /** The day What changed was hidden on: it comes back with the next day's, as on the website. */
14127
+ let digestHiddenOn = null;
14128
+ /**
14129
+ * What's asking for you, the same pings as the website's Inbox: Enter opens
14130
+ * one, space marks it read. What changed sits on top, as on the website: the
14131
+ * last day on your own projects (src/lib/daily-digest.ts), nothing on a quiet
14132
+ * day, and h hides it until tomorrow.
14133
+ */
13849
14134
  function InboxView({ active, width, height, go }) {
13850
- const { store } = useDeps();
14135
+ const { store, today } = useDeps();
13851
14136
  const tasks = useHarbor((s) => s.tasks);
13852
14137
  const comments = useHarbor((s) => s.comments);
13853
14138
  const milestones = useHarbor((s) => s.milestones);
@@ -13868,6 +14153,28 @@ function InboxView({ active, width, height, go }) {
13868
14153
  me,
13869
14154
  store
13870
14155
  ]);
14156
+ const projects = useHarbor((s) => s.projects);
14157
+ const programs = useHarbor((s) => s.programs);
14158
+ const day = today();
14159
+ const [hidden, setHidden] = useState(() => digestHiddenOn === day);
14160
+ const news = useMemo(() => {
14161
+ const d = dailyDigest(store.getState(), {
14162
+ kind: "person",
14163
+ id: me
14164
+ }, (/* @__PURE__ */ new Date(Date.now() - DAY_MS)).toISOString());
14165
+ return d.quiet ? [] : digestLines(d);
14166
+ }, [
14167
+ tasks,
14168
+ comments,
14169
+ raidItems,
14170
+ people,
14171
+ reflections,
14172
+ projects,
14173
+ programs,
14174
+ me,
14175
+ store
14176
+ ]);
14177
+ const shown = hidden ? [] : news;
13871
14178
  const read = readBy(readIds, me);
13872
14179
  const unread = pings.filter((p) => !read(p.id)).length;
13873
14180
  const [at, setAt] = useState(0);
@@ -13884,8 +14191,13 @@ function InboxView({ active, width, height, go }) {
13884
14191
  else if (key.return && ping) open(ping);
13885
14192
  else if (input === " " && ping) store.getState().readPing(readMark(me, ping.id));
13886
14193
  else if (input === "a") store.getState().catchUp(pings.map((p) => readMark(me, p.id)));
14194
+ else if (input === "h" && shown.length) {
14195
+ digestHiddenOn = day;
14196
+ setHidden(true);
14197
+ }
13887
14198
  }, { isActive: active });
13888
- const view = windowOf(pings, at, Math.max(1, height - 2));
14199
+ const newsRows = shown.length ? shown.length + 2 : 0;
14200
+ const view = windowOf(pings, at, Math.max(1, height - 2 - newsRows));
13889
14201
  return /* @__PURE__ */ jsxs(Box, {
13890
14202
  flexDirection: "column",
13891
14203
  width,
@@ -13896,6 +14208,20 @@ function InboxView({ active, width, height, go }) {
13896
14208
  right: `${unread} unread · a reads all`,
13897
14209
  children: "Inbox"
13898
14210
  }),
14211
+ shown.length ? /* @__PURE__ */ jsxs(Box, {
14212
+ flexDirection: "column",
14213
+ marginBottom: 1,
14214
+ children: [/* @__PURE__ */ jsxs(Text, {
14215
+ bold: true,
14216
+ children: ["What changed ", /* @__PURE__ */ jsx(Text, {
14217
+ color: theme.muted,
14218
+ children: "in the last day, on your work · h hides it"
14219
+ })]
14220
+ }), shown.map((line) => /* @__PURE__ */ jsxs(Text, {
14221
+ wrap: "truncate-end",
14222
+ children: [" ", line]
14223
+ }, line))]
14224
+ }) : null,
13899
14225
  pings.length === 0 ? /* @__PURE__ */ jsx(Text, {
13900
14226
  color: theme.muted,
13901
14227
  children: "Nothing waiting on you. Good."
@@ -14262,7 +14588,7 @@ function byTask(rows, who) {
14262
14588
  }
14263
14589
  return out;
14264
14590
  }
14265
- const plural$6 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
14591
+ const plural$5 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
14266
14592
  /** Work only one person has touched, soonest-needed first. `scope` narrows it to some programs. */
14267
14593
  function lifeboats(data, now, opts = {}) {
14268
14594
  const today = isoDay(now);
@@ -14301,7 +14627,7 @@ function lifeboats(data, now, opts = {}) {
14301
14627
  kind: "project",
14302
14628
  id: project.id,
14303
14629
  label: project.name,
14304
- detail: `${plural$6(open.length, "open task")}, nobody else on them`,
14630
+ detail: `${plural$5(open.length, "open task")}, nobody else on them`,
14305
14631
  soloId: solo[0],
14306
14632
  projectId: project.id,
14307
14633
  programId: project.programId,
@@ -14323,7 +14649,7 @@ function lifeboats(data, now, opts = {}) {
14323
14649
  out.push({
14324
14650
  kind: "tasks",
14325
14651
  id: `tasks:${project.id}:${soloId}`,
14326
- label: `${plural$6(list.length, "task")} on ${project.name}`,
14652
+ label: `${plural$5(list.length, "task")} on ${project.name}`,
14327
14653
  detail: `only ${first} has touched them`,
14328
14654
  soloId,
14329
14655
  projectId: project.id,
@@ -14343,7 +14669,7 @@ function lifeboats(data, now, opts = {}) {
14343
14669
  kind: "task",
14344
14670
  id: t.id,
14345
14671
  label: key ? `${key} ${t.title}` : t.title,
14346
- detail: [d < today ? `late since ${md(d)}` : `due ${md(d)}`, holds ? `${plural$6(holds, "task")} ${holds === 1 ? "waits" : "wait"} on it` : "urgent"].join(", "),
14672
+ detail: [d < today ? `late since ${md(d)}` : `due ${md(d)}`, holds ? `${plural$5(holds, "task")} ${holds === 1 ? "waits" : "wait"} on it` : "urgent"].join(", "),
14347
14673
  soloId,
14348
14674
  projectId: project.id,
14349
14675
  programId: project.programId,
@@ -14370,7 +14696,7 @@ function lifeboats(data, now, opts = {}) {
14370
14696
  const programId = first.programId ?? project?.programId ?? null;
14371
14697
  const where = project?.name ?? (programId ? programs.get(programId)?.name : null) ?? null;
14372
14698
  const issues = items.filter((r) => r.kind === "issue").length;
14373
- const noun = issues === 0 ? plural$6(items.length, "risk") : issues === items.length ? plural$6(items.length, "issue") : `${plural$6(items.length - issues, "risk")} and ${plural$6(issues, "issue")}`;
14699
+ const noun = issues === 0 ? plural$5(items.length, "risk") : issues === items.length ? plural$5(items.length, "issue") : `${plural$5(items.length - issues, "risk")} and ${plural$5(issues, "issue")}`;
14374
14700
  out.push({
14375
14701
  kind: "risks",
14376
14702
  id: key,
@@ -17692,140 +18018,6 @@ function applyDock(actions, projectId, changes) {
17692
18018
  return made;
17693
18019
  }
17694
18020
 
17695
- // src/lib/daily-digest.ts
17696
- /** The projects a scope covers; a person's are the ones they lead, sit under, or have a task in. */
17697
- function projectsIn(data, scope) {
17698
- if (scope.kind === "harbor") return data.projects;
17699
- if (scope.kind === "program") return data.projects.filter((p) => p.programId === scope.id);
17700
- const led = new Set(data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id));
17701
- return data.projects.filter((p) => p.ownerId === scope.id || led.has(p.programId) || tasksOf(data.tasks, p.id).some((t) => t.assigneeId === scope.id));
17702
- }
17703
- /** Where health went since `since`: from what it was just before to what it is now, if it moved. */
17704
- function moved(history, now, since) {
17705
- const list = history ?? [];
17706
- if (!list.some((h) => h.at >= since)) return null;
17707
- const before = [...list].reverse().find((h) => h.at < since)?.health;
17708
- return before && before !== now ? {
17709
- from: before,
17710
- to: now
17711
- } : null;
17712
- }
17713
- /** What changed in `scope` from `since` (an ISO moment) on. */
17714
- function dailyDigest(data, scope, since) {
17715
- const projects = projectsIn(data, scope);
17716
- const projectIds = new Set(projects.map((p) => p.id));
17717
- const programIds = scope.kind === "program" ? /* @__PURE__ */ new Set([scope.id]) : new Set(scope.kind === "harbor" ? data.programs.map((p) => p.id) : [...projects.map((p) => p.programId), ...data.programs.filter((p) => p.ownerId === scope.id).map((p) => p.id)]);
17718
- const tasks = projects.flatMap((p) => tasksOf(data.tasks, p.id));
17719
- const arrivedDone = (t) => Boolean(t.completedAt) && Math.abs(Date.parse(t.completedAt) - Date.parse(t.createdAt)) < ARRIVED_DONE_MS;
17720
- const finished = tasks.filter((t) => t.status === "done" && t.completedAt && t.completedAt >= since && !arrivedDone(t)).sort((a, b) => b.completedAt.localeCompare(a.completedAt));
17721
- const finishedIds = new Set(finished.map((t) => t.id));
17722
- const added = tasks.filter((t) => t.createdAt >= since && !finishedIds.has(t.id)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
17723
- const health = [];
17724
- for (const p of data.programs) {
17725
- if (!programIds.has(p.id)) continue;
17726
- const m = moved(p.healthHistory, p.health, since);
17727
- if (m) health.push({
17728
- name: p.name,
17729
- path: `/programs/${p.id}`,
17730
- ...m
17731
- });
17732
- }
17733
- for (const p of projects) {
17734
- const m = moved(p.healthHistory, p.health, since);
17735
- if (m) health.push({
17736
- name: p.name,
17737
- path: `/projects/${p.id}`,
17738
- ...m
17739
- });
17740
- }
17741
- const inScope = (r) => r.projectId ? projectIds.has(r.projectId) : r.programId ? programIds.has(r.programId) : scope.kind === "harbor";
17742
- const raised = data.raidItems.filter((r) => r.kind !== "decision" && r.createdAt >= since && inScope(r)).sort((a, b) => b.createdAt.localeCompare(a.createdAt));
17743
- const decided = data.raidItems.filter((r) => r.kind === "decision" && r.status !== "proposed" && Boolean(r.decidedAt) && r.decidedAt >= since && inScope(r)).sort((a, b) => b.decidedAt.localeCompare(a.decidedAt));
17744
- const people = byId(data.people);
17745
- const first = (id) => people.get(id)?.name.split(" ")[0] ?? "Someone";
17746
- const projectById = byId(data.projects);
17747
- const programById = byId(data.programs);
17748
- const talkBy = /* @__PURE__ */ new Map();
17749
- const count = (key, where, path, authorId, taskId) => {
17750
- const t = talkBy.get(key) ?? {
17751
- where,
17752
- path,
17753
- ...taskId ? { taskId } : {},
17754
- count: 0,
17755
- who: []
17756
- };
17757
- t.count++;
17758
- const name = first(authorId);
17759
- if (!t.who.includes(name)) t.who.push(name);
17760
- talkBy.set(key, t);
17761
- };
17762
- for (const r of data.reflections ?? []) {
17763
- if (!isMessage(r) || r.createdAt < since) continue;
17764
- const place = placeOf(r);
17765
- const holder = place.kind === "program" ? programById.get(place.id) : projectById.get(place.id);
17766
- const inside = place.kind === "program" ? programIds.has(place.id) : projectIds.has(place.id);
17767
- if (!holder || !inside) continue;
17768
- count(`${place.kind}:${place.id}`, holder.name, placePath(place), r.authorId);
17769
- }
17770
- const taskById = byId(data.tasks);
17771
- for (const c of data.comments) {
17772
- if (c.createdAt < since) continue;
17773
- const task = taskById.get(c.taskId);
17774
- if (!task || !projectIds.has(task.projectId)) continue;
17775
- const key = taskKey(task, projectById.get(task.projectId));
17776
- count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, `/projects/${task.projectId}`, c.authorId, task.id);
17777
- }
17778
- const talk = [...talkBy.values()].sort((a, b) => b.count - a.count || a.where.localeCompare(b.where));
17779
- return {
17780
- since,
17781
- finished,
17782
- added,
17783
- health,
17784
- raised,
17785
- decided,
17786
- talk,
17787
- quiet: !finished.length && !added.length && !health.length && !raised.length && !decided.length && !talk.length
17788
- };
17789
- }
17790
- /** "A, B and 2 more". */
17791
- function some(names, shown = 3) {
17792
- const quoted = names.slice(0, shown).map((n) => `“${n}”`);
17793
- const rest = names.length - quoted.length;
17794
- if (rest > 0) return `${quoted.join(", ")} and ${rest} more`;
17795
- if (quoted.length < 2) return quoted.join("");
17796
- return `${quoted.slice(0, -1).join(", ")} and ${quoted.at(-1)}`;
17797
- }
17798
- /** The digest as short plain lines, the way the Inbox card, a chat post and the terminal say it. */
17799
- function digestLines(d) {
17800
- const lines = [];
17801
- if (d.finished.length) lines.push(`${plural$5(d.finished.length, "task")} finished: ${some(d.finished.map((t) => t.title))}.`);
17802
- if (d.added.length) lines.push(`${plural$5(d.added.length, "task")} added: ${some(d.added.map((t) => t.title))}.`);
17803
- for (const h of d.health.slice(0, 5)) lines.push(`${h.name} went from ${HEALTH_LABEL$1[h.from] ?? h.from} to ${HEALTH_LABEL$1[h.to] ?? h.to}.`);
17804
- if (d.health.length > 5) lines.push(`${d.health.length - 5} more changed health.`);
17805
- if (d.raised.length) {
17806
- const risks = d.raised.filter((r) => r.kind === "risk").length;
17807
- const issues = d.raised.length - risks;
17808
- const what = [risks ? plural$5(risks, "risk") : "", issues ? plural$5(issues, "issue") : ""].filter(Boolean).join(" and ");
17809
- lines.push(`${what} raised: ${some(d.raised.map((r) => r.title))}.`);
17810
- }
17811
- if (d.decided.length) lines.push(`${plural$5(d.decided.length, "decision")} made: ${some(d.decided.map((r) => r.title))}.`);
17812
- if (d.talk.length) {
17813
- const top = d.talk.slice(0, 3).map((t) => `${t.where} (${t.count}, ${t.who.join(", ")})`).join("; ");
17814
- const rest = d.talk.length - 3;
17815
- lines.push(`Talk: ${top}${rest > 0 ? `; and ${plural$5(rest, "more conversation")}` : ""}.`);
17816
- }
17817
- return lines;
17818
- }
17819
- var ARRIVED_DONE_MS, plural$5;
17820
- var init_daily_digest = __esmMin((() => {
17821
- init_swatches();
17822
- init_indexes();
17823
- init_project_messages();
17824
- init_task_keys();
17825
- ARRIVED_DONE_MS = 6e4;
17826
- plural$5 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
17827
- }));
17828
-
17829
18021
  // src/lib/milestone-edits.ts
17830
18022
  /**
17831
18023
  * A milestone with `patch` applied, remembering the day it was reached:
@@ -17942,7 +18134,6 @@ var init_task_milestones = __esmMin((() => {
17942
18134
  }));
17943
18135
 
17944
18136
  // src/lib/compass.ts
17945
- init_daily_digest();
17946
18137
  init_task_milestones();
17947
18138
  init_indexes();
17948
18139
  const zero = () => ({
@@ -24909,6 +25100,7 @@ function approvalsWaitingOn(tasks, personId) {
24909
25100
 
24910
25101
  // src/lib/mcp/tools.ts
24911
25102
  init_project_messages();
25103
+ init_daily_digest();
24912
25104
  init_subtasks();
24913
25105
  init_blockers();
24914
25106
  init_time_log();
@@ -27498,89 +27690,6 @@ var init_errors = __esmMin((() => {
27498
27690
  };
27499
27691
  }));
27500
27692
 
27501
- // src/lib/empty.ts
27502
- function addMonths(iso, months) {
27503
- const [y, m, d] = iso.split("-").map(Number);
27504
- const dt = new Date(y, (m ?? 1) - 1, d ?? 1);
27505
- dt.setMonth(dt.getMonth() + months);
27506
- return todayISO(dt);
27507
- }
27508
- /**
27509
- * A name worth offering in the harbor-name field: "Sam's harbor", or "" when
27510
- * nobody is known yet, so the field stays empty and shows its placeholder.
27511
- */
27512
- function harborNameFor(displayName, email) {
27513
- const first = (displayName || email || "").split(/[\s@]/)[0]?.trim();
27514
- return first ? `${first}'s harbor` : "";
27515
- }
27516
- /** What a new harbor is called until its owner names it: "Sam's harbor", else "My harbor". */
27517
- function suggestedHarborName(displayName, email) {
27518
- return harborNameFor(displayName, email) || "My harbor";
27519
- }
27520
- function createEmptyHarbor(opts) {
27521
- const today = todayISO();
27522
- const person = opts.person;
27523
- const harbor = opts.harborName.trim() || "Harbor";
27524
- const program = opts.programName?.trim() || "The work";
27525
- const drum = opts.drumTitle?.trim() ?? "";
27526
- return {
27527
- currentUserId: person.id,
27528
- readPingIds: [],
27529
- ropes: [],
27530
- checkIns: [],
27531
- boardConfigs: {},
27532
- people: [person],
27533
- portfolios: [{
27534
- id: "home",
27535
- name: harbor,
27536
- description: "The work of this harbor.",
27537
- swatch: "pine",
27538
- ownerId: person.id,
27539
- health: "on-track",
27540
- budget: 0
27541
- }],
27542
- programs: [{
27543
- id: "p1",
27544
- portfolioId: "home",
27545
- name: program,
27546
- description: opts.programDescription?.trim() ?? "",
27547
- swatch: "pine",
27548
- ownerId: person.id,
27549
- health: "on-track",
27550
- startDate: today,
27551
- endDate: addMonths(today, 6),
27552
- budget: 0
27553
- }],
27554
- projects: [],
27555
- milestones: [],
27556
- raidItems: [],
27557
- constraints: drum ? [{
27558
- id: "k1",
27559
- programId: "p1",
27560
- title: drum,
27561
- kind: opts.drumKind ?? "external",
27562
- status: "active",
27563
- ownerId: person.id,
27564
- note: opts.drumNote?.trim() ?? ""
27565
- }] : [],
27566
- tasks: [],
27567
- comments: [],
27568
- attachments: [],
27569
- activity: [{
27570
- id: "a1",
27571
- personId: person.id,
27572
- text: drum ? `named the constraint — ${drum}` : `opened ${harbor}`,
27573
- at: (/* @__PURE__ */ new Date()).toISOString(),
27574
- href: "/today"
27575
- }]
27576
- };
27577
- }
27578
- var STARTER_PROGRAM;
27579
- var init_empty = __esmMin((() => {
27580
- init_format();
27581
- STARTER_PROGRAM = "The work";
27582
- }));
27583
-
27584
27693
  // src/lib/deep-equal.ts
27585
27694
  /**
27586
27695
  * Structural equality, key-order independent, treating `undefined` and a
@@ -28079,12 +28188,27 @@ var init_session = __esmMin((() => {
28079
28188
  }));
28080
28189
 
28081
28190
  // src/lib/first-week.ts
28082
- /** The program launch named for you, when nobody has renamed it yet. */
28191
+ /**
28192
+ * The few things a new harbor needs in its first week, in the order they
28193
+ * matter: a first project, a real name on the account, a confirmed email,
28194
+ * and someone else aboard. Today lists the ones not done. Someone who
28195
+ * joined is asked only for their name and their email.
28196
+ *
28197
+ * The placeholder program ("The work") isn't on the list: it gives way to
28198
+ * the first program anyone makes, so naming it is never a chore to set.
28199
+ */
28200
+ /**
28201
+ * The program launch named for you, while nobody has renamed it and it holds
28202
+ * nothing but First voyage: once someone's own project, milestone or risk is
28203
+ * in it, it's their program, and a new one is made beside it.
28204
+ */
28083
28205
  function starterProgram(data) {
28084
- return data.programs.find((p) => p.name.trim() === "The work") ?? null;
28206
+ const program = data.programs.find((p) => p.name.trim() === STARTER_PROGRAM);
28207
+ if (!program) return null;
28208
+ return ownProjects(data.projects).some((p) => p.programId === program.id) || data.milestones.some((m) => m.programId === program.id) || data.raidItems.some((r) => r.programId === program.id) ? null : program;
28085
28209
  }
28086
28210
  var init_first_week = __esmMin((() => {
28087
- init_empty();
28211
+ init_first_voyage();
28088
28212
  }));
28089
28213
 
28090
28214
  // src/lib/slices/hierarchy.ts
@@ -37006,6 +37130,7 @@ function WeekView({ active, width, height, go }) {
37006
37130
  * over the screen, which stays mounted so Esc comes back to the same place.
37007
37131
  */
37008
37132
  init_esm();
37133
+ init_empty();
37009
37134
  const NAV = [
37010
37135
  {
37011
37136
  screen: "today",
@@ -37071,6 +37196,15 @@ const LETTER_KEYS = [
37071
37196
  "G",
37072
37197
  "O"
37073
37198
  ];
37199
+ /** The screens where n makes something: a task, or what the screen lists. */
37200
+ const N_MAKES = /* @__PURE__ */ new Set([
37201
+ "today",
37202
+ "projects",
37203
+ "programs",
37204
+ "risks",
37205
+ "goals",
37206
+ "reports"
37207
+ ]);
37074
37208
  /** The key that opens a sidebar screen: 1 to 9, 0 for the tenth, then a letter. */
37075
37209
  const navKey = (i) => i < 10 ? String((i + 1) % 10) : LETTER_KEYS[i - 10] ?? " ";
37076
37210
  /** The sidebar's width: its longest line ("9 Calendar", ": Anything") with room either side. */
@@ -37579,7 +37713,7 @@ function App({ ui, startIn }) {
37579
37713
  ["0–9", "screens"],
37580
37714
  [":", "anything"],
37581
37715
  ["/", "find"],
37582
- ["n", "new"],
37716
+ ...N_MAKES.has(screen) ? [["n", "new"]] : [],
37583
37717
  ["u", "undo"],
37584
37718
  ["H", "harbors"],
37585
37719
  ["?", "keys"],
@@ -37675,7 +37809,11 @@ function App({ ui, startIn }) {
37675
37809
  children: quitting ? "● saving before you go…" : saveText
37676
37810
  }), /* @__PURE__ */ jsxs(Text, {
37677
37811
  color: theme.muted,
37678
- children: [" · ", account.name || account.email]
37812
+ children: [
37813
+ " ",
37814
+ "· ",
37815
+ nameFromEmail(account.name, account.email) ? account.email : account.name
37816
+ ]
37679
37817
  })] })]
37680
37818
  }),
37681
37819
  /* @__PURE__ */ jsxs(Box, {
@@ -38448,6 +38586,7 @@ init_errors();
38448
38586
  init_plain();
38449
38587
  init_search();
38450
38588
  init_view_only();
38589
+ init_first_voyage();
38451
38590
  init_repo_sync();
38452
38591
  init_commands();
38453
38592
  const today = () => format(/* @__PURE__ */ new Date(), "yyyy-MM-dd");
@@ -38485,6 +38624,11 @@ async function startApp(deps, options = {}) {
38485
38624
  instance.unmount();
38486
38625
  throw err;
38487
38626
  }
38627
+ const opened = store.getState();
38628
+ if (opened.myRole !== "viewer" && !opened.keepPaused) {
38629
+ const ticks = voyageTicks(opened, { apps: ["Harbor CLI"] });
38630
+ if (ticks.length) opened.tickVoyage(ticks);
38631
+ }
38488
38632
  if (deps.firstRun) {
38489
38633
  const project = deps.firstRun.project;
38490
38634
  if (project) addFirstProject(store, project, account.id, today());
package/dist/words.mjs CHANGED
@@ -198,6 +198,7 @@ function readTaskWords(input, ctx) {
198
198
  break;
199
199
  }
200
200
  let owner = null;
201
+ const nobody = [];
201
202
  if (!skip.has("owner")) {
202
203
  const byKey = (key) => {
203
204
  const full = ctx.people.filter((p) => loose(p.name) === key);
@@ -208,16 +209,23 @@ function readTaskWords(input, ctx) {
208
209
  return key.length >= 3 && begins.length === 1 ? begins[0] : null;
209
210
  };
210
211
  for (const m of text.matchAll(/(?:^|\s)@([\p{L}\p{N}._-]+)/gu)) {
211
- const hit = byKey(loose(m[1]));
212
- if (!hit) continue;
213
212
  const start = m.index + (m[0].length - m[0].trimStart().length);
214
- if (!free(start, m.index + m[0].length)) continue;
213
+ const end = m.index + m[0].length;
214
+ const hit = byKey(loose(m[1]));
215
+ if (!hit) {
216
+ if (free(start, end)) nobody.push({
217
+ value: text.slice(start, end),
218
+ start,
219
+ end
220
+ });
221
+ continue;
222
+ }
223
+ if (owner || !free(start, end)) continue;
215
224
  owner = {
216
225
  value: hit.id,
217
226
  start,
218
- end: m.index + m[0].length
227
+ end
219
228
  };
220
- break;
221
229
  }
222
230
  if (!owner) for (const m of text.matchAll(/(?:^|[\s,])(?:assign(?:ed)? (?:it )?to|owner(?: is)?:?) (\p{L}+(?: \p{L}+)?)/giu)) {
223
231
  const words = m[1].split(" ");
@@ -255,7 +263,7 @@ function readTaskWords(input, ctx) {
255
263
  break;
256
264
  }
257
265
  if (!due) {
258
- const rest = without(text, taken);
266
+ const rest = without(text, [...taken, ...nobody]);
259
267
  const tail = new RegExp(`(?:^|[\\s,])(${WHEN})[.!]?$`, "i").exec(rest);
260
268
  const short = tail && /^(?:sun|mon|tue|wed|thu|fri|sat)$/i.test(tail[1]);
261
269
  const said = tail && /\b(?:to|for|from|after|with|since)$/i.test(rest.slice(0, tail.index).trimEnd());
@@ -294,7 +302,8 @@ function readTaskWords(input, ctx) {
294
302
  project: project ? {
295
303
  value: project.value,
296
304
  text: span(project)
297
- } : null
305
+ } : null,
306
+ nobody: nobody.filter((n) => free(n.start, n.end)).map((n) => n.value)
298
307
  };
299
308
  }
300
309
 
package/lib/cli.mjs CHANGED
@@ -90,6 +90,7 @@ import {
90
90
  weekText,
91
91
  } from "./format.mjs";
92
92
  import { colourDepth, logoLines } from "./logo.mjs";
93
+ import { NO_HARBOR } from "./errors.mjs";
93
94
  import { HarborError, createClient } from "./mcp.mjs";
94
95
  import { jsonText, plain } from "./plain.mjs";
95
96
  import { dayFromWords, readTaskWords } from "./words.mjs";
@@ -722,10 +723,17 @@ async function readTitles(client, harbor, titles, values, today = todayLocal())
722
723
  skip,
723
724
  });
724
725
  const read = r.owner || r.due || r.priority || r.project;
725
- return read && r.title ? r : { title, owner: null, due: null, priority: null, project: null };
726
+ return read && r.title
727
+ ? r
728
+ : { title, owner: null, due: null, priority: null, project: null, nobody: r.nobody ?? [] };
726
729
  });
727
730
  }
728
731
 
732
+ /** Each @name in a title that matches nobody: it stays in the title, and nobody is made up. */
733
+ function nobodyLines(r) {
734
+ return (r?.nobody ?? []).map((n) => `${n}: no one by that name, kept in the title.`);
735
+ }
736
+
729
737
  /** "Fri 2026-11-13": a day with its weekday, so "next friday" shows which Friday it became. */
730
738
  export function dayWithWeekday(iso) {
731
739
  if (!/^\d{4}-\d{2}-\d{2}$/.test(iso)) return iso;
@@ -899,10 +907,7 @@ export function hint(message, project) {
899
907
  /^Say which project or program it belongs to\.$/,
900
908
  "Say where it belongs: --project NAME or --program NAME.",
901
909
  )
902
- .replace(
903
- /^You don't belong to a harbor yet\..*$/s,
904
- "You aren't in a harbor yet. Run harbor to make one, or open the invite a team sent you.",
905
- );
910
+ .replace(/^You don't belong to a harbor yet\..*$/s, NO_HARBOR);
906
911
  }
907
912
 
908
913
  /** get_premortem's answer with its note naming the command, not the agent tool, since --json shows it. */
@@ -977,6 +982,7 @@ const DETAIL = {
977
982
  " to\"; a day after by, due, on, before or until, or as the very last",
978
983
  " words (\"Call the mill friday\"), never after to, for or from (\"Move",
979
984
  " the call to Friday\" keeps it); !high or \"high priority\"; #Project.",
985
+ " An @name that matches nobody stays in the title, and Harbor says so.",
980
986
  " With --dry-run --literal it says what the words would have read as.",
981
987
  "",
982
988
  " --assignee me|none|NAME, --also \"NAME, NAME\" (others on it with the",
@@ -2671,6 +2677,10 @@ export async function run(argv, io = {}) {
2671
2677
  case "mine": {
2672
2678
  const { positionals, harbor } = parse(spec());
2673
2679
  none(positionals);
2680
+ // First voyage's "Try Harbor in your terminal" isn't ticked from here:
2681
+ // my_work only reads, and a read that saves a change would be a
2682
+ // surprise (and History would show it). The full-screen app ticks it
2683
+ // when it opens (src/tui/main.tsx), and the website when it next loads.
2674
2684
  return call("my_work", { harbor }, (r) => myWork(r, opts));
2675
2685
  }
2676
2686
  case "tasks": {
@@ -3102,6 +3112,7 @@ export async function run(argv, io = {}) {
3102
3112
  ...(values.template ? { template: values.template } : {}),
3103
3113
  ...(values.comment ? { comment: values.comment } : {}),
3104
3114
  ...(wordsRead(words) ? { read: wordsRead(words) } : {}),
3115
+ ...(words.nobody?.length ? { unknownPeople: words.nobody } : {}),
3105
3116
  ...(unread && wordsRead(unread[i]) ? { keptWords: wordsRead(unread[i]) } : {}),
3106
3117
  ...(p.sameAs ? { sameAs: p.sameAs } : {}),
3107
3118
  ...(p.sameAs && values["unless-exists"] ? { skipped: true } : {}),
@@ -3143,6 +3154,7 @@ export async function run(argv, io = {}) {
3143
3154
  ` ${l.title}${l.skipped ? " (already there, skipped)" : ""}`,
3144
3155
  ` ${bits.join(" · ")}`,
3145
3156
  ...(wordsLine(words) ? [` ${wordsLine(words)} --literal keeps them in the title.`] : []),
3157
+ ...nobodyLines(words).map((x) => ` ${x}`),
3146
3158
  ...(l.keptWords
3147
3159
  ? [` --literal kept the words as typed. ${wordsLine(unread[i]).replace("Read from your words", "Without it, they'd read as")}`]
3148
3160
  : []),
@@ -3192,6 +3204,7 @@ export async function run(argv, io = {}) {
3192
3204
  // The words read out of the title, field by field, and the title as typed.
3193
3205
  const read = wordsRead(words);
3194
3206
  if (read) r.read = { ...read, typed: titles[i] };
3207
+ if (words.nobody?.length) r.unknownPeople = words.nobody;
3195
3208
  added.push(r);
3196
3209
  }
3197
3210
  await stalePromptCache(env);
@@ -3209,6 +3222,7 @@ export async function run(argv, io = {}) {
3209
3222
  ...(values.template ? { template: values.template } : {}),
3210
3223
  ...(r.comment ? { comment: r.comment } : {}),
3211
3224
  ...(r.read ? { read: r.read } : {}),
3225
+ ...(r.unknownPeople ? { unknownPeople: r.unknownPeople } : {}),
3212
3226
  ...(r.pilot ? { pilot: r.pilot } : {}),
3213
3227
  ...(r.milestoneReached ? { milestoneReached: r.milestoneReached } : {}),
3214
3228
  ...(r.milestoneReopened ? { milestoneReopened: r.milestoneReopened } : {}),
@@ -3241,6 +3255,7 @@ export async function run(argv, io = {}) {
3241
3255
  `You typed “${r.read.typed}”. ${wordsLine(reads[added.indexOf(r)])} --literal keeps the words in the title.`,
3242
3256
  ]
3243
3257
  : []),
3258
+ ...nobodyLines({ nobody: r.unknownPeople }),
3244
3259
  // --due in words ("next friday"): the day it became, weekday and all.
3245
3260
  ...(dueWords(values.due) ? [`--due ${values.due}: ${dayWithWeekday(dueDate(values.due))}.`] : []),
3246
3261
  // Pilot speaks up only when a date was given that the queue says won't hold.
package/lib/errors.mjs CHANGED
@@ -8,6 +8,21 @@ export class HarborError extends Error {
8
8
  name = "HarborError";
9
9
  }
10
10
 
11
+ /**
12
+ * No harbor yet, said the same by every command: the full-screen app (harbor
13
+ * on its own) makes one, so that's where it points rather than the website.
14
+ */
15
+ export const NO_HARBOR =
16
+ "You aren't in a harbor yet. Run harbor on its own and it helps you make one, or open the invite a team sent you.";
17
+
18
+ /**
19
+ * Harbor's own "no harbor yet" (worded for any app) in the terminal's words.
20
+ * @param {string} said
21
+ */
22
+ export function terminalWords(said) {
23
+ return /^You don't belong to a harbor yet\./.test(said) ? NO_HARBOR : said;
24
+ }
25
+
11
26
  /**
12
27
  * fetch, with "the server isn't there" said plainly rather than as
13
28
  * "fetch failed" (no network, a wrong --server, the server down).
package/lib/format.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import { NO_HARBOR } from "./errors.mjs";
2
+
1
3
  /** Plain text for a terminal: one task per line, its key (or id) first so it can be copied. */
2
4
 
3
5
  /** Statuses in the board's words, as the website, the app and an export say them. */
@@ -230,7 +232,7 @@ export function whoami(r, creds) {
230
232
  else if (list.length === 1) lines.push(`Commands use ${list[0].name}, your only harbor.`);
231
233
  else if (list.length)
232
234
  lines.push("No harbor set: say --harbor NAME, or set one with harbor use NAME.");
233
- else lines.push("You aren't in any harbor yet. Run harbor to make one.");
235
+ else lines.push(NO_HARBOR);
234
236
  // Shown from whoamiData (build), or straight from list_harbors (server).
235
237
  lines.push(serverLine(r.build ?? (typeof r.server === "object" ? r.server : null)));
236
238
  return lines.join("\n");
@@ -269,7 +271,7 @@ export function whoamiData(r, creds) {
269
271
 
270
272
  export function harbors(r) {
271
273
  const list = r.harbors ?? [];
272
- if (!list.length) return "You aren't in any harbor yet. Run harbor to make one.";
274
+ if (!list.length) return NO_HARBOR;
273
275
  // The website's words for a role, not the stored ones; names, not ids
274
276
  // (harbor use and --harbor take a name).
275
277
  const label = (role) =>
package/lib/mcp.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
  * refreshed once and the call retried.
5
5
  */
6
6
  import { refresh } from "./auth.mjs";
7
- import { HarborError, reach } from "./errors.mjs";
7
+ import { HarborError, reach, terminalWords } from "./errors.mjs";
8
8
 
9
9
  export { HarborError };
10
10
 
@@ -51,7 +51,7 @@ export function createClient({ creds, save, fetcher = fetch, now = Date.now }) {
51
51
  throw new HarborError("Harbor asked to slow down. Try again in a minute.");
52
52
  if (!res.ok) throw new HarborError(`Harbor answered ${res.status}.`);
53
53
  const msg = await res.json();
54
- if (msg.error) throw new HarborError(msg.error.message);
54
+ if (msg.error) throw new HarborError(terminalWords(msg.error.message));
55
55
  const result = msg.result ?? {};
56
56
  if (result.isError) {
57
57
  const said = result.content?.map((c) => c.text).join("\n") || "Harbor said no.";
@@ -60,7 +60,7 @@ export function createClient({ creds, save, fetcher = fetch, now = Date.now }) {
60
60
  throw new HarborError(
61
61
  `${new URL(current.server).host} doesn't have this yet. Try again after the next site update.`,
62
62
  );
63
- throw new HarborError(said);
63
+ throw new HarborError(terminalWords(said));
64
64
  }
65
65
  return result.structuredContent ?? JSON.parse(result.content?.[0]?.text ?? "{}");
66
66
  },
@@ -79,7 +79,8 @@ export function createClient({ creds, save, fetcher = fetch, now = Date.now }) {
79
79
  }
80
80
  if (res.status === 401) throw new HarborError("Signed out. Run harbor login.");
81
81
  const answer = await res.json().catch(() => ({}));
82
- if (!res.ok) throw new HarborError(answer.error ?? `Harbor answered ${res.status}.`);
82
+ if (!res.ok)
83
+ throw new HarborError(terminalWords(answer.error ?? `Harbor answered ${res.status}.`));
83
84
  return answer;
84
85
  },
85
86
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.111.0",
3
+ "version": "0.112.0",
4
4
  "description": "Harbor from the terminal: a full-screen app with everything, plus commands for scripts and agents.",
5
5
  "keywords": [
6
6
  "harbor",