@harborppm/cli 0.122.0 → 0.123.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
@@ -7866,7 +7866,7 @@ var init_sheet_feed = __esmMin((() => {}));
7866
7866
  /** What a thanks is for, read from the harbor; null once that's gone. */
7867
7867
  function thanksTarget(doc, on) {
7868
7868
  if (on.kind === "task") {
7869
- const t = doc.tasks.find((x) => x.id === on.id);
7869
+ const t = byId(doc.tasks).get(on.id);
7870
7870
  if (!t) return null;
7871
7871
  const project = byId(doc.projects).get(t.projectId);
7872
7872
  const key = taskKey(t, project);
@@ -7904,6 +7904,15 @@ function thanksProblem(body, toId, fromId) {
7904
7904
  if (toId === fromId) return "Thanks go to someone else.";
7905
7905
  return null;
7906
7906
  }
7907
+ /**
7908
+ * The thanks already standing for this one: the same writer, to the same
7909
+ * person, for the same work, in the same words, a few minutes ago (a second
7910
+ * press of Send, or the line sent from the Inbox and the task's panel).
7911
+ */
7912
+ function sameThanks(reflections, row) {
7913
+ const at = Date.parse(row.createdAt);
7914
+ return (reflections ?? []).find((r) => isThanks(r) && r.authorId === row.authorId && r.toId === row.toId && r.thanksFor.kind === row.thanksFor.kind && r.thanksFor.id === row.thanksFor.id && r.body.toLowerCase() === row.body.toLowerCase() && Math.abs(at - Date.parse(r.createdAt)) < 6e5);
7915
+ }
7907
7916
  /** Thanks given since `since`, newest first, with names and what each was for; `keep` narrows them. */
7908
7917
  function thanksSince(doc, since, keep = () => true) {
7909
7918
  const out = [];
@@ -7924,11 +7933,13 @@ function thanksSince(doc, since, keep = () => true) {
7924
7933
  function thanksText(line) {
7925
7934
  return `${line.from} to ${line.to} for ${line.for}: “${line.thanks.body.trim()}”`;
7926
7935
  }
7927
- var isThanks, first$2;
7936
+ var isThanks, thankable, THANKS_TWICE_MS, first$2;
7928
7937
  var init_thanks = __esmMin((() => {
7929
7938
  init_indexes();
7930
7939
  init_task_keys();
7931
7940
  isThanks = (r) => r.kind === "thanks" && !!r.thanksFor && !!r.toId;
7941
+ thankable = (p) => !!p && p.kind !== "agent";
7942
+ THANKS_TWICE_MS = 6e5;
7932
7943
  first$2 = (doc, id) => doc.people.find((p) => p.id === id)?.name.split(" ")[0] ?? "Someone";
7933
7944
  }));
7934
7945
 
@@ -10892,7 +10903,7 @@ function voyageLog(data, projectId) {
10892
10903
  closed
10893
10904
  })).filter((c) => c.person).sort((a, b) => b.closed - a.closed || a.person.name.localeCompare(b.person.name));
10894
10905
  const lines = (data.reflections ?? []).filter((r) => r.projectId === projectId && r.kind === "voyage").sort((a, b) => a.createdAt.localeCompare(b.createdAt));
10895
- const thanks = (data.reflections ?? []).filter((r) => r.projectId === projectId && isThanks(r)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
10906
+ const thanks = (data.reflections ?? []).filter((r) => r.projectId === projectId && isThanks(r) && !!thanksTarget(data, r.thanksFor)).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
10896
10907
  return {
10897
10908
  project,
10898
10909
  done: project.health === "done",
@@ -13878,17 +13889,21 @@ function dailyDigest(data, scope, since) {
13878
13889
  const projectById = byId(data.projects);
13879
13890
  const programById = byId(data.programs);
13880
13891
  const talkBy = /* @__PURE__ */ new Map();
13881
- const count = (key, where, path, authorId, taskId) => {
13892
+ const count = (key, where, title, path, authorId, taskId) => {
13893
+ if (scope.kind === "person" && authorId === scope.id) return;
13882
13894
  const t = talkBy.get(key) ?? {
13883
13895
  where,
13896
+ title,
13884
13897
  path,
13885
13898
  ...taskId ? { taskId } : {},
13886
13899
  count: 0,
13887
- who: []
13900
+ who: [],
13901
+ whoIds: []
13888
13902
  };
13889
13903
  t.count++;
13890
13904
  const name = first(authorId);
13891
13905
  if (!t.who.includes(name)) t.who.push(name);
13906
+ if (!t.whoIds.includes(authorId)) t.whoIds.push(authorId);
13892
13907
  talkBy.set(key, t);
13893
13908
  };
13894
13909
  for (const r of data.reflections ?? []) {
@@ -13897,7 +13912,7 @@ function dailyDigest(data, scope, since) {
13897
13912
  const holder = place.kind === "program" ? programById.get(place.id) : projectById.get(place.id);
13898
13913
  const inside = place.kind === "program" ? programIds.has(place.id) : projectIds.has(place.id);
13899
13914
  if (!holder || !inside) continue;
13900
- count(`${place.kind}:${place.id}`, holder.name, placePath(place), r.authorId);
13915
+ count(`${place.kind}:${place.id}`, holder.name, holder.name, placePath(place), r.authorId);
13901
13916
  }
13902
13917
  const taskById = byId(data.tasks);
13903
13918
  for (const c of data.comments) {
@@ -13905,7 +13920,7 @@ function dailyDigest(data, scope, since) {
13905
13920
  const task = taskById.get(c.taskId);
13906
13921
  if (!task || !projectIds.has(task.projectId)) continue;
13907
13922
  const key = taskKey(task, projectById.get(task.projectId));
13908
- count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, `/projects/${task.projectId}`, c.authorId, task.id);
13923
+ count(`task:${task.id}`, key ? `${key} ${task.title}` : task.title, task.title, `/projects/${task.projectId}`, c.authorId, task.id);
13909
13924
  }
13910
13925
  const talk = [...talkBy.values()].sort((a, b) => b.count - a.count || a.where.localeCompare(b.where));
13911
13926
  return {
@@ -14230,6 +14245,7 @@ init_work();
14230
14245
  init_project_messages();
14231
14246
  init_clock();
14232
14247
  init_soundings();
14248
+ init_thanks();
14233
14249
  const KIND_RANK = {
14234
14250
  harbor: -1,
14235
14251
  waiting: 0,
@@ -14242,6 +14258,7 @@ const KIND_RANK = {
14242
14258
  mention: 6,
14243
14259
  reply: 7,
14244
14260
  finished: 8,
14261
+ thanks: 9,
14245
14262
  convoy: 1.5
14246
14263
  };
14247
14264
  const PING_KIND_LABEL = {
@@ -14256,6 +14273,7 @@ const PING_KIND_LABEL = {
14256
14273
  mention: "Mentions",
14257
14274
  reply: "Replies",
14258
14275
  finished: "Finished",
14276
+ thanks: "Thanks",
14259
14277
  convoy: "Between programs"
14260
14278
  };
14261
14279
  function firstName$3(name) {
@@ -14626,6 +14644,24 @@ function inboxOf(data, personId, now = clockNow()) {
14626
14644
  href: `/projects/${task.projectId}`
14627
14645
  });
14628
14646
  }
14647
+ for (const r of data.reflections ?? []) {
14648
+ if (!isThanks(r) || r.toId !== personId || r.authorId === personId || r.createdAt < since) continue;
14649
+ const target = thanksTarget(data, r.thanksFor);
14650
+ if (!target) continue;
14651
+ const from = data.people.find((p) => p.id === r.authorId);
14652
+ const on = r.thanksFor;
14653
+ pings.push({
14654
+ id: `thanks:${r.id}`,
14655
+ kind: "thanks",
14656
+ title: `${from ? firstName$3(from.name) : "Someone"} thanked you`,
14657
+ detail: `“${r.body.trim()}” · for ${target.title}`,
14658
+ at: r.createdAt,
14659
+ personId: r.authorId,
14660
+ taskId: on.kind === "task" ? on.id : void 0,
14661
+ programId: on.kind === "milestone" ? target.programId ?? void 0 : void 0,
14662
+ href: on.kind === "task" ? `/projects/${target.projectId}` : on.kind === "milestone" ? `/programs/${target.programId}?view=milestones` : target.projectId ? `/projects/${target.projectId}?view=decisions` : target.programId ? `/programs/${target.programId}` : void 0
14663
+ });
14664
+ }
14629
14665
  pings.push(...convoyPings(data, personId, now, since));
14630
14666
  return pings.sort((a, b) => {
14631
14667
  const rank = KIND_RANK[a.kind] - KIND_RANK[b.kind];
@@ -32231,7 +32267,7 @@ function milestonesRaidSlice({ get, write }) {
32231
32267
  const text = body.replace(/\s+/g, " ").trim().slice(0, 200);
32232
32268
  const target = thanksTarget(s, on);
32233
32269
  if (!target || thanksProblem(text, toId, me)) return null;
32234
- if (!s.people.some((p) => p.id === toId)) return null;
32270
+ if (!thankable(s.people.find((p) => p.id === toId))) return null;
32235
32271
  const row = {
32236
32272
  id: uid("rf"),
32237
32273
  projectId: target.projectId,
@@ -32245,6 +32281,11 @@ function milestonesRaidSlice({ get, write }) {
32245
32281
  id: on.id
32246
32282
  }
32247
32283
  };
32284
+ const twice = sameThanks(s.reflections, {
32285
+ ...row,
32286
+ thanksFor: row.thanksFor
32287
+ });
32288
+ if (twice) return twice.id;
32248
32289
  write({ reflections: [...s.reflections ?? [], row] });
32249
32290
  return row.id;
32250
32291
  },
package/lib/cli.mjs CHANGED
@@ -431,7 +431,7 @@ export const HELP = `harbor: Harbor from the terminal
431
431
  tasks that tick themselves off as you try things, from here too; harbor add
432
432
  puts a task there while it's your only project. The brief, harbor week,
433
433
  bridge and forecast leave it out. To look around a made-up harbor instead,
434
- open harborppm.com/demo or run ssh try.harborppm.com.
434
+ open harborppm.com/demo.
435
435
  `;
436
436
 
437
437
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.122.0",
3
+ "version": "0.123.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",