@harborppm/cli 0.92.0 → 0.93.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 CHANGED
@@ -213,6 +213,7 @@ harbor import FILE [--project P] [--portfolio P] [--no-people]
213
213
  add tasks from a CSV file
214
214
  harbor premortem PROJECT ["WHAT WENT WRONG"] [--start]
215
215
  harbor voyage PROJECT ["YOUR LINE"]
216
+ harbor messages PROJECT ["TEXT"] [--limit N]
216
217
  harbor note PROJECT ["NOTE"] [--opens DATE|--milestone NAME|--off-track]
217
218
  harbor sound TASK [--answer DAYS|--ask NAMES|--settle DAYS] [--why TEXT]
218
219
  harbor soundings [PROJECT]
@@ -258,7 +259,7 @@ A task has one owner (`--assignee`), who answers for it and whose load it counts
258
259
 
259
260
  `harbor limit RR` prints how many tasks each of a board's columns takes at once; `harbor limit RR doing 8` changes one (1 to 20, or `none` for no limit), if you own the harbor. `harbor projects --json` carries each board's `limits` too.
260
261
 
261
- `harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor goals` lists each portfolio's goals (set on the portfolio's page on the website), off track first, with each key result's progress. `harbor ashore` lists the public holidays and time away in the next eight weeks; `--country US,GB` sets whose holidays the harbor takes and `--person NAME --country DE` one person's own, which the forecast and the weekly load then count as days off.
262
+ `harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor messages PROJECT` reads a project's Messages tab, one conversation for the whole project, and `harbor messages PROJECT "TEXT"` writes to it; `@Name` sends it to that person's Inbox. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor goals` lists each portfolio's goals (set on the portfolio's page on the website), off track first, with each key result's progress. `harbor ashore` lists the public holidays and time away in the next eight weeks; `--country US,GB` sets whose holidays the harbor takes and `--person NAME --country DE` one person's own, which the forecast and the weekly load then count as days off.
262
263
 
263
264
  `harbor brief --say` turns the brief into the BBC's Shipping Forecast: each program an area, wind for late work, visibility for health, gale warnings for anything off track. It prints the forecast and speaks it with your computer's own voice (`say` on a Mac, Windows' speech, or `espeak-ng` on Linux, which you may need to install). With `--json` it prints the forecast and stays quiet.
264
265
 
package/dist/app.mjs CHANGED
@@ -10003,7 +10003,83 @@ function HistoryView({ active, width, height, go }) {
10003
10003
  });
10004
10004
  }
10005
10005
 
10006
+ // src/lib/project-messages.ts
10007
+ /** This project's messages, oldest first. */
10008
+ function messagesOf(reflections, projectId) {
10009
+ return (reflections ?? []).filter((r) => r.projectId === projectId && isMessage(r)).sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));
10010
+ }
10011
+ /** Why a message can't be posted, or null. */
10012
+ function messageProblem(body) {
10013
+ const t = body.trim();
10014
+ if (!t) return "Write something first.";
10015
+ if (t.length > 4e3) return `Keep it under ${MESSAGE_MAX.toLocaleString("en")} characters.`;
10016
+ return null;
10017
+ }
10018
+ /** Who a message @mentions, leaving out its writer. */
10019
+ function messageMentions(body, people, authorId) {
10020
+ return parseMentions(body, people).filter((id) => id !== authorId);
10021
+ }
10022
+ /** Whether someone may change or delete a message: its writer, or the harbor's owner (delete only). */
10023
+ function mayChangeMessage(message, personId, role, action) {
10024
+ if (message.authorId === personId) return true;
10025
+ return action === "delete" && role === "owner";
10026
+ }
10027
+ /**
10028
+ * What a person's Inbox says about project messages since `since`: each
10029
+ * message that @mentions them, and for each project they've written in, the
10030
+ * messages others posted after their last one (a mention among them is
10031
+ * already its own line). Projects that are finished are left out.
10032
+ */
10033
+ function messageLines(data, personId, since) {
10034
+ const done = new Set(data.projects.filter((p) => p.health === "done").map((p) => p.id));
10035
+ const byProject = /* @__PURE__ */ new Map();
10036
+ for (const r of data.reflections ?? []) {
10037
+ if (!isMessage(r) || done.has(r.projectId)) continue;
10038
+ const list = byProject.get(r.projectId);
10039
+ if (list) list.push(r);
10040
+ else byProject.set(r.projectId, [r]);
10041
+ }
10042
+ const out = [];
10043
+ for (const list of byProject.values()) {
10044
+ list.sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));
10045
+ let joined = false;
10046
+ let replies = [];
10047
+ for (const m of list) {
10048
+ if (m.authorId === personId) {
10049
+ joined = true;
10050
+ replies = [];
10051
+ continue;
10052
+ }
10053
+ if (m.createdAt < since) continue;
10054
+ if ((m.mentionedIds ?? []).includes(personId)) {
10055
+ out.push({
10056
+ kind: "mention",
10057
+ message: m,
10058
+ authorIds: [m.authorId]
10059
+ });
10060
+ continue;
10061
+ }
10062
+ if (joined) replies.push(m);
10063
+ }
10064
+ const latest = replies.at(-1);
10065
+ if (latest) out.push({
10066
+ kind: "reply",
10067
+ message: latest,
10068
+ authorIds: [...new Set(replies.map((m) => m.authorId))]
10069
+ });
10070
+ }
10071
+ return out;
10072
+ }
10073
+ var MESSAGE_MAX, isMessage, messageText;
10074
+ var init_project_messages = __esmMin((() => {
10075
+ init_work();
10076
+ MESSAGE_MAX = 4e3;
10077
+ isMessage = (r) => r.kind === "message";
10078
+ messageText = (body) => body.trim().slice(0, MESSAGE_MAX);
10079
+ }));
10080
+
10006
10081
  // src/lib/read-marks.ts
10082
+ init_project_messages();
10007
10083
  /**
10008
10084
  * Inbox read marks. A harbor keeps one list of them (`readPingIds`), shared
10009
10085
  * by everyone in it, so each mark names whose it is: reading a mention that
@@ -10313,6 +10389,25 @@ function inboxOf(data, personId, now = clockNow()) {
10313
10389
  href: `/projects/${task.projectId}`
10314
10390
  });
10315
10391
  }
10392
+ for (const line of messageLines(data, personId, since)) {
10393
+ const project = data.projects.find((p) => p.id === line.message.projectId);
10394
+ if (!project) continue;
10395
+ const names = line.authorIds.map((id) => {
10396
+ const who = data.people.find((p) => p.id === id);
10397
+ return who ? firstName$3(who.name) : "Someone";
10398
+ });
10399
+ const snippet = excerpt(line.message.body);
10400
+ const where = `in ${project.name}’s messages`;
10401
+ pings.push({
10402
+ id: `message-${line.kind}:${line.message.id}`,
10403
+ kind: line.kind,
10404
+ title: line.kind === "mention" ? `${names[0]} mentioned you` : `${listNames(names)} wrote back`,
10405
+ detail: snippet ? `${where} — ${snippet}` : where,
10406
+ at: line.message.createdAt,
10407
+ personId: line.message.authorId,
10408
+ href: `/projects/${project.id}?view=messages`
10409
+ });
10410
+ }
10316
10411
  for (const task of data.tasks) {
10317
10412
  if (task.assignedBy !== personId || !task.assigneeId || task.assigneeId === personId) continue;
10318
10413
  if (task.status !== "done" || !task.completedAt || task.completedAt < since) continue;
@@ -21071,6 +21166,7 @@ function approvalsWaitingOn(tasks, personId) {
21071
21166
  }
21072
21167
 
21073
21168
  // src/lib/mcp/tools.ts
21169
+ init_project_messages();
21074
21170
  init_subtasks();
21075
21171
  init_thanks();
21076
21172
  init_task_keys();
@@ -22466,6 +22562,36 @@ const HARBOR_TOOLS = [
22466
22562
  };
22467
22563
  }
22468
22564
  }),
22565
+ tool({
22566
+ name: "list_messages",
22567
+ title: "A project's messages",
22568
+ description: "The conversation on a project's Messages tab, for what isn't about one task: each message with who wrote it, when, whether it was edited, and who it @mentions, oldest first (the newest `limit`, default 50; more says how many earlier ones were left out). post_message writes one." + DATA_NOTE,
22569
+ input: object({
22570
+ harbor: harborArg,
22571
+ project: string().min(1).max(200).describe("Project id or name."),
22572
+ limit: number().int().min(1).max(500).optional()
22573
+ }),
22574
+ run: (ctx, input) => {
22575
+ const { data } = ctx;
22576
+ const p = findOne(data.projects, input.project, "project");
22577
+ const people = byId(data.people);
22578
+ const all = messagesOf(data.reflections, p.id);
22579
+ const limit = input.limit ?? 50;
22580
+ const shown = all.slice(-limit);
22581
+ return {
22582
+ project: p.name,
22583
+ messages: shown.map((m) => ({
22584
+ id: m.id,
22585
+ from: nameOf$2(people, m.authorId),
22586
+ at: m.createdAt,
22587
+ ...m.editedAt ? { edited: m.editedAt } : {},
22588
+ body: m.body,
22589
+ ...(m.mentionedIds ?? []).length ? { mentions: (m.mentionedIds ?? []).map((id) => nameOf$2(people, id)) } : {}
22590
+ })),
22591
+ ...all.length > shown.length ? { more: all.length - shown.length } : {}
22592
+ };
22593
+ }
22594
+ }),
22469
22595
  tool({
22470
22596
  name: "list_soundings",
22471
22597
  title: "Soundings",
@@ -25372,6 +25498,48 @@ function milestonesRaidSlice({ get, write }) {
25372
25498
  write({ reflections: [...s.reflections ?? [], row] });
25373
25499
  return row.id;
25374
25500
  },
25501
+ postMessage: (projectId, body) => {
25502
+ const s = get();
25503
+ if (messageProblem(body)) return null;
25504
+ const project = s.projects.find((p) => p.id === projectId);
25505
+ if (!project) return null;
25506
+ const me = s.currentUserId;
25507
+ const text = messageText(body);
25508
+ const row = {
25509
+ id: uid("msg"),
25510
+ projectId,
25511
+ kind: "message",
25512
+ authorId: me,
25513
+ body: text,
25514
+ createdAt: stamp(),
25515
+ mentionedIds: messageMentions(text, s.people, me)
25516
+ };
25517
+ write({ reflections: [...s.reflections ?? [], row] });
25518
+ get().log(`wrote in ${project.name}’s messages`, `/projects/${projectId}?view=messages`);
25519
+ return row.id;
25520
+ },
25521
+ editMessage: (id, body) => {
25522
+ const s = get();
25523
+ const all = s.reflections ?? [];
25524
+ const row = all.find((r) => r.id === id && isMessage(r));
25525
+ if (!row || !mayChangeMessage(row, s.currentUserId, s.myRole, "edit")) return;
25526
+ if (messageProblem(body)) return;
25527
+ const text = messageText(body);
25528
+ if (text === row.body) return;
25529
+ write({ reflections: all.map((r) => r.id === id ? {
25530
+ ...r,
25531
+ body: text,
25532
+ mentionedIds: messageMentions(text, s.people, r.authorId),
25533
+ editedAt: stamp()
25534
+ } : r) });
25535
+ },
25536
+ deleteMessage: (id) => {
25537
+ const s = get();
25538
+ const all = s.reflections ?? [];
25539
+ const row = all.find((r) => r.id === id && isMessage(r));
25540
+ if (!row || !mayChangeMessage(row, s.currentUserId, s.myRole, "delete")) return;
25541
+ write({ reflections: all.filter((r) => r.id !== id) });
25542
+ },
25375
25543
  writeVoyageLine: (projectId, body) => {
25376
25544
  const text = body.trim().slice(0, 600);
25377
25545
  const me = get().currentUserId;
@@ -25465,6 +25633,7 @@ var init_milestones_raid = __esmMin((() => {
25465
25633
  init_raid_history();
25466
25634
  init_passage();
25467
25635
  init_format();
25636
+ init_project_messages();
25468
25637
  init_utils();
25469
25638
  init_shared();
25470
25639
  }));
package/lib/cli.mjs CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  myWork,
34
34
  premortemText,
35
35
  notesText,
36
+ messagesText,
36
37
  charterText,
37
38
  daysText,
38
39
  soundingText,
@@ -251,6 +252,9 @@ export const HELP = `harbor: Harbor from the terminal
251
252
  answer or read it
252
253
  harbor voyage PROJECT ["YOUR LINE"] a Done project's voyage log, and
253
254
  your line in it
255
+ harbor messages PROJECT ["TEXT"] [--limit N]
256
+ a project's messages, or write
257
+ one (@Name tells them)
254
258
  harbor charter PROJECT [--why T] [--in T] [--out T] [--done-when T]
255
259
  [--calls NAME]
256
260
  a project's five-line charter
@@ -1270,6 +1274,14 @@ const DETAIL = {
1270
1274
  " it explains. The weekly brief names projects that grew a lot since",
1271
1275
  " their baseline.",
1272
1276
  ],
1277
+ messages: [
1278
+ " harbor messages PROJECT reads a project's Messages tab",
1279
+ ' harbor messages PROJECT "TEXT" writes: posts to everyone on it',
1280
+ "",
1281
+ " One conversation for the whole project, for what isn't about one task;",
1282
+ " harbor comment TASK is for that. @Name sends it to that person's Inbox.",
1283
+ " Reading shows the newest 50, oldest first; --limit N shows up to 500.",
1284
+ ],
1273
1285
  voyage: [
1274
1286
  " harbor voyage PROJECT reads a Done project's voyage log",
1275
1287
  ' harbor voyage PROJECT "YOUR LINE" writes: adds or changes your line in it',
@@ -3458,6 +3470,29 @@ export async function run(argv, io = {}) {
3458
3470
  }
3459
3471
  return call("get_voyage_log", { harbor, project }, voyageText, voyageForTerminal);
3460
3472
  }
3473
+ case "messages": {
3474
+ const { positionals, values, harbor } = parse(spec([], ["limit"]));
3475
+ const [project, ...words] = positionals;
3476
+ if (!project)
3477
+ throw new HarborError(
3478
+ 'Give a project, and a message if you\'re writing one: harbor messages "NAME" "TEXT".',
3479
+ );
3480
+ const body = words.join(" ").trim();
3481
+ if (body) {
3482
+ if (values.limit)
3483
+ throw new HarborError("--limit is for reading; leave it off when you write.");
3484
+ return call(
3485
+ "post_message",
3486
+ { harbor, project, body },
3487
+ (r) =>
3488
+ `Posted in ${r.posted.project}'s messages${r.mentioned?.length ? `; told ${r.mentioned.join(", ")}` : ""}.`,
3489
+ );
3490
+ }
3491
+ const limit = values.limit ? Number(values.limit) : undefined;
3492
+ if (limit !== undefined && (!Number.isInteger(limit) || limit < 1 || limit > 500))
3493
+ throw new HarborError("--limit is a whole number from 1 to 500.");
3494
+ return call("list_messages", { harbor, project, ...(limit ? { limit } : {}) }, messagesText);
3495
+ }
3461
3496
  case "watch": {
3462
3497
  const { positionals, values, harbor } = parse(spec(["bell", "once"], ["project", "since"]));
3463
3498
  none(positionals);
package/lib/format.mjs CHANGED
@@ -1295,3 +1295,22 @@ export function goalsText(r) {
1295
1295
  }
1296
1296
  return lines.join("\n");
1297
1297
  }
1298
+
1299
+ /** A project's Messages tab, as list_messages answers it: oldest first, one block a message. */
1300
+ export function messagesText(r) {
1301
+ const list = r.messages ?? [];
1302
+ if (!list.length)
1303
+ return `No messages on ${r.project} yet. harbor messages "${r.project}" "TEXT" writes the first.`;
1304
+ const head = r.more
1305
+ ? [
1306
+ `${r.more} earlier ${r.more === 1 ? "message" : "messages"} left out (--limit N shows more).`,
1307
+ ]
1308
+ : [];
1309
+ return [
1310
+ ...head,
1311
+ ...list.map(
1312
+ (m) =>
1313
+ `${m.from ?? "Someone"} · ${m.at.slice(0, 16).replace("T", " ")}${m.edited ? " (edited)" : ""}\n ${m.body.replace(/\n/g, "\n ")}`,
1314
+ ),
1315
+ ].join("\n\n");
1316
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.92.0",
3
+ "version": "0.93.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",