@harborppm/cli 0.108.0 → 0.109.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
@@ -222,6 +222,8 @@ harbor premortem PROJECT ["WHAT WENT WRONG"] [--start]
222
222
  harbor voyage PROJECT ["YOUR LINE"]
223
223
  harbor messages PROJECT ["TEXT"] [--limit N] | messages PROJECT --edit "TEXT" [--message ID]
224
224
  harbor chat TASK|PROJECT|PROGRAM ["TEXT"] [--reply N] [--watch]
225
+ harbor chat @NAME [@NAME…] ["TEXT"] [--watch]
226
+ harbor chats
225
227
  harbor note PROJECT ["NOTE"] [--opens DATE|--milestone NAME|--off-track]
226
228
  harbor sound TASK [--answer DAYS|--ask NAMES|--settle DAYS] [--why TEXT]
227
229
  harbor soundings [PROJECT]
@@ -275,7 +277,7 @@ A task has one owner (`--assignee`), who answers for it and whose load it counts
275
277
 
276
278
  `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.
277
279
 
278
- `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 chat` is the same for any piece of work: `harbor chat RR-42` reads a task's comments, `harbor chat Footwear` a program's messages, `harbor chat Footwear "TEXT" --reply 2` replies under message [2], and `--watch` follows the conversation live, printing new lines as they come; in a terminal, type a line to post it. `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, off track first, with each key result's progress. `harbor goal "TITLE" --new` sets one, and `harbor goal "GOAL"` reads or changes one: `--owner`, `--due`, `--why`, `--link "Ridge Runner"` to count a program, project or task toward it, `--kr "Stores signed" --target 40` to add a number key result and `--kr "Stores signed" --at 12` to move it. `harbor milestones` lists a program's milestones soonest first, with how many of their tasks are done, who signs them off and what they wait on; `harbor milestone "NAME" --new --program P --due DATE` adds one, and `harbor milestone "NAME"` moves (`--due`), renames, ticks (`--reached`), sets who signs it off (`--signs-off`), or, if it's yours to sign, `--approve`s it or asks for `--changes`. `harbor reports` prints the Reports page's dashboards, each chart as its numbers. `harbor messages PROJECT --edit "TEXT"` fixes your latest message there. `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.
280
+ `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 chat` is the same for any piece of work: `harbor chat RR-42` reads a task's comments, `harbor chat Footwear` a program's messages, `harbor chat Footwear "TEXT" --reply 2` replies under message [2], and `--watch` follows the conversation live, printing new lines as they come; in a terminal, type a line to post it. `harbor chat @aya "TEXT"` writes a direct message (the Chat page's), `harbor chat @aya @ben "TEXT"` writes to a group of just them, `harbor chat @aya` reads it (and `--watch` follows it), and `harbor chats` lists your direct messages; only the people in a chat can read it. `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, off track first, with each key result's progress. `harbor goal "TITLE" --new` sets one, and `harbor goal "GOAL"` reads or changes one: `--owner`, `--due`, `--why`, `--link "Ridge Runner"` to count a program, project or task toward it, `--kr "Stores signed" --target 40` to add a number key result and `--kr "Stores signed" --at 12` to move it. `harbor milestones` lists a program's milestones soonest first, with how many of their tasks are done, who signs them off and what they wait on; `harbor milestone "NAME" --new --program P --due DATE` adds one, and `harbor milestone "NAME"` moves (`--due`), renames, ticks (`--reached`), sets who signs it off (`--signs-off`), or, if it's yours to sign, `--approve`s it or asks for `--changes`. `harbor reports` prints the Reports page's dashboards, each chart as its numbers. `harbor messages PROJECT --edit "TEXT"` fixes your latest message there. `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.
279
281
 
280
282
  `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.
281
283
 
package/dist/app.mjs CHANGED
@@ -17043,6 +17043,7 @@ init_format();
17043
17043
  const PAGES = {
17044
17044
  today: "/today",
17045
17045
  inbox: "/inbox",
17046
+ chat: "/chat",
17046
17047
  week: "/week",
17047
17048
  brief: "/brief",
17048
17049
  review: "/review",
package/lib/cli.mjs CHANGED
@@ -38,6 +38,9 @@ import {
38
38
  notesText,
39
39
  messagesText,
40
40
  chatText,
41
+ chatsText,
42
+ directLineText,
43
+ directText,
41
44
  chatLineText,
42
45
  chatWhere,
43
46
  digestText,
@@ -285,6 +288,10 @@ export const HELP = `harbor: Harbor from the terminal
285
288
  harbor messages PROJECT --edit "TEXT" [--message ID]
286
289
  fix your latest message (or that
287
290
  one) in its project
291
+ harbor chat @NAME [@NAME…] ["TEXT"] [--watch]
292
+ direct messages: to one person or
293
+ a few, private to them
294
+ harbor chats your direct messages
288
295
  harbor charter PROJECT [--why T] [--in T] [--out T] [--done-when T]
289
296
  [--calls NAME]
290
297
  a project's five-line charter
@@ -1599,7 +1606,13 @@ const DETAIL = {
1599
1606
  " they come; in a terminal, type a",
1600
1607
  ' line to post it, "/r N text" to',
1601
1608
  " reply, Ctrl+C to stop",
1609
+ ' harbor chat @aya "TEXT" writes a direct message to Aya',
1610
+ ' harbor chat @aya @ben "TEXT" writes to a group of just them',
1611
+ " harbor chat @aya [--watch] reads (or follows) your chat with Aya",
1612
+ " harbor chats lists your direct messages",
1602
1613
  "",
1614
+ " Direct messages are private: only the people in a chat can read it, and",
1615
+ " the Chat page on the website has the same ones.",
1603
1616
  " A task key goes to its comments; a name to that project's messages, or",
1604
1617
  " the program's when no project has it (--project or --program says which",
1605
1618
  " when both do). Messages are numbered [1], [2]… with their replies under",
@@ -1607,6 +1620,13 @@ const DETAIL = {
1607
1620
  " --limit N shows up to 500. --watch asks every 5 seconds while people are",
1608
1621
  " talking and every 30 once it's quiet.",
1609
1622
  ],
1623
+ chats: [
1624
+ " harbor chats your direct messages, newest first",
1625
+ "",
1626
+ " Each with who it's with, what's unread and its last line, and the",
1627
+ " command that opens it. harbor chat @aya \"TEXT\" writes to someone;",
1628
+ " harbor chat @aya @ben \"TEXT\" to a group of just them.",
1629
+ ],
1610
1630
  messages: [
1611
1631
  " harbor messages PROJECT reads a project's Messages tab",
1612
1632
  ' harbor messages PROJECT "TEXT" writes: posts to everyone on it',
@@ -4292,10 +4312,109 @@ export async function run(argv, io = {}) {
4292
4312
  const { positionals, values, harbor } = parse(
4293
4313
  spec(["watch", "task", "project", "program"], ["limit", "reply"]),
4294
4314
  );
4315
+ // harbor chat @aya [@ben …] ["TEXT"]: direct messages, private to the people in them.
4316
+ const ats = [];
4317
+ while (ats.length < positionals.length && positionals[ats.length].startsWith("@"))
4318
+ ats.push(positionals[ats.length]);
4319
+ if (ats.length || /^chat_[\w-]+$/.test(positionals[0] ?? "")) {
4320
+ if (["task", "project", "program"].some((k) => values[k]) || values.reply)
4321
+ throw new HarborError(
4322
+ "--task, --project, --program and --reply are for the talk on the work, not direct messages.",
4323
+ );
4324
+ const who = ats.length
4325
+ ? { harbor, with: ats.join(",") }
4326
+ : { harbor, chat: positionals[0] };
4327
+ const text = positionals.slice(ats.length || 1).join(" ").trim();
4328
+ const call = (name, args) =>
4329
+ client.call(name, { ...who, ...args }).catch((err) => {
4330
+ if (err instanceof HarborError) throw new HarborError(hint(err.message));
4331
+ throw err;
4332
+ });
4333
+ const n = values.limit ? Number(values.limit) : 30;
4334
+ if (!Number.isInteger(n) || n < 1 || n > 200)
4335
+ throw new HarborError("--limit is a whole number from 1 to 200 for direct messages.");
4336
+ if (text && !values.watch) {
4337
+ const r = await call("post_direct", { body: text });
4338
+ out(asJson ? jsonText(r) : plain(`Sent to ${r.chat.title}.`));
4339
+ return 0;
4340
+ }
4341
+ if (!values.watch) {
4342
+ const r = await call("read_direct", { limit: n, markRead: true });
4343
+ out(asJson ? jsonText(r) : plain(directText(r)));
4344
+ return 0;
4345
+ }
4346
+ if (asJson) throw new HarborError("--watch prints lines as they come; leave --json off.");
4347
+ if (text) await call("post_direct", { body: text });
4348
+ const firstRead = await call("read_direct", { limit: 20, markRead: true });
4349
+ out(plain(directText(firstRead)));
4350
+ const seenIds = new Set(firstRead.messages.map((m) => m.id));
4351
+ let last = firstRead.messages.at(-1)?.at;
4352
+ const tty = io.terminal ?? Boolean(process.stdout.isTTY && process.stdin.isTTY);
4353
+ const nap = io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
4354
+ out(
4355
+ plain(
4356
+ tty
4357
+ ? `Watching your chat with ${firstRead.chat.title}. Type a line and Enter to send; Ctrl+C stops.`
4358
+ : `Watching your chat with ${firstRead.chat.title}; Ctrl+C stops.`,
4359
+ ),
4360
+ );
4361
+ let lines = null;
4362
+ let done = false;
4363
+ let wait = CHAT_POLL_MS;
4364
+ if (tty && (io.stdin ?? process.stdin).isTTY !== false) {
4365
+ const { createInterface } = await import("node:readline");
4366
+ lines = createInterface({ input: io.stdin ?? process.stdin, terminal: false });
4367
+ lines.on("close", () => {
4368
+ done = true;
4369
+ });
4370
+ lines.on("line", (line) => {
4371
+ const said = line.trim();
4372
+ if (!said) return;
4373
+ if (said === "/q" || said === "/quit") return void lines.close();
4374
+ call("post_direct", { body: said }).then(
4375
+ (r) => {
4376
+ seenIds.add(r.message.id);
4377
+ wait = CHAT_POLL_MS;
4378
+ out(" (sent)");
4379
+ },
4380
+ (err) => out(plain(` Not sent: ${err instanceof Error ? err.message : String(err)}`)),
4381
+ );
4382
+ });
4383
+ }
4384
+ let turns = io.watchRounds ?? Infinity;
4385
+ try {
4386
+ while (!done && turns-- > 0) {
4387
+ await nap(wait);
4388
+ if (done) break;
4389
+ let r;
4390
+ try {
4391
+ r = await call("read_direct", {
4392
+ limit: 200,
4393
+ markRead: true,
4394
+ ...(last ? { since: last } : {}),
4395
+ });
4396
+ } catch (err) {
4397
+ if (err instanceof HarborError) throw err;
4398
+ wait = CHAT_POLL_MAX_MS;
4399
+ continue;
4400
+ }
4401
+ const fresh = r.messages.filter((m) => !seenIds.has(m.id));
4402
+ for (const m of fresh) {
4403
+ seenIds.add(m.id);
4404
+ out(plain(directLineText(m)));
4405
+ }
4406
+ if (r.messages.length) last = r.messages.at(-1).at;
4407
+ wait = fresh.length ? CHAT_POLL_MS : Math.min(CHAT_POLL_MAX_MS, Math.round(wait * 1.5));
4408
+ }
4409
+ } finally {
4410
+ lines?.close();
4411
+ }
4412
+ return 0;
4413
+ }
4295
4414
  const [on, ...words] = positionals;
4296
4415
  if (!on)
4297
4416
  throw new HarborError(
4298
- 'Give a task key, project or program, and a message if you\'re writing one: harbor chat RR-42 "TEXT".',
4417
+ 'Give a task key, project or program, and a message if you\'re writing one: harbor chat RR-42 "TEXT". For a direct message: harbor chat @aya "TEXT".',
4299
4418
  );
4300
4419
  const kinds = ["task", "project", "program"].filter((k) => values[k]);
4301
4420
  if (kinds.length > 1) throw new HarborError("Say one of --task, --project or --program.");
@@ -4413,6 +4532,16 @@ export async function run(argv, io = {}) {
4413
4532
  }
4414
4533
  return 0;
4415
4534
  }
4535
+ case "chats": {
4536
+ const { positionals, harbor } = parse(spec([], []));
4537
+ none(positionals);
4538
+ const r = await client.call("direct_chats", { harbor }).catch((err) => {
4539
+ if (err instanceof HarborError) throw new HarborError(hint(err.message));
4540
+ throw err;
4541
+ });
4542
+ out(asJson ? jsonText(r) : plain(chatsText(r)));
4543
+ return 0;
4544
+ }
4416
4545
  case "watch": {
4417
4546
  const { positionals, values, harbor } = parse(spec(["bell", "once"], ["project", "since"]));
4418
4547
  none(positionals);
package/lib/format.mjs CHANGED
@@ -1586,3 +1586,39 @@ export function digestText(r, hours) {
1586
1586
  if (r.quiet) return `Nothing changed on ${r.on} in ${span}.`;
1587
1587
  return [`What changed on ${r.on} in ${span}`, ...r.lines.map((l) => ` • ${l}`)].join("\n");
1588
1588
  }
1589
+
1590
+ const directWhen = (at) => at.slice(0, 16).replace("T", " ");
1591
+
1592
+ /** One line of a direct chat: "Aya Tan · 2026-11-08 14:10: see you there", or what happened to it. */
1593
+ export function directLineText(m) {
1594
+ const when = directWhen(m.at);
1595
+ if (m.event === "left") return `· ${m.who} left · ${when}`;
1596
+ if (m.event === "joined") return `· ${m.who} added ${m.detail ?? "someone"} · ${when}`;
1597
+ if (m.event === "renamed")
1598
+ return m.detail ? `· ${m.who} named it “${m.detail}” · ${when}` : `· ${m.who} took its name off · ${when}`;
1599
+ return `${m.who} · ${when}: ${(m.text ?? "").replace(/\s*\n\s*/g, " / ")}`;
1600
+ }
1601
+
1602
+ /** read_direct: the chat's messages, oldest first. */
1603
+ export function directText(r) {
1604
+ const head = r.chat.kind === "pair" ? `Chat with ${r.chat.title}` : `${r.chat.title} (${r.chat.with.join(", ")})`;
1605
+ const list = r.messages ?? [];
1606
+ if (!list.length) return `${head}\nNothing yet. Only the people in it can read it.`;
1607
+ return [head, ...(r.more ? ["Earlier messages left out (--limit N shows more)."] : []), ...list.map(directLineText)].join("\n");
1608
+ }
1609
+
1610
+ /** direct_chats: your direct messages, newest first. */
1611
+ export function chatsText(r) {
1612
+ const chats = r.chats ?? [];
1613
+ if (!chats.length) return 'No direct messages yet. harbor chat @NAME "TEXT" writes to someone; @a,@b starts a group.';
1614
+ const out = [`${chats.length} ${chats.length === 1 ? "chat" : "chats"} in ${r.harbor.name}`];
1615
+ for (const c of chats) {
1616
+ out.push(
1617
+ "",
1618
+ `${c.title}${c.kind === "group" ? ` (${c.with.join(", ")})` : ""}${c.unread ? ` · ${c.unread} unread` : ""}`,
1619
+ c.last ? ` ${directLineText(c.last)}` : " No messages yet",
1620
+ ` harbor chat ${c.id}`,
1621
+ );
1622
+ }
1623
+ return out.join("\n");
1624
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.108.0",
3
+ "version": "0.109.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",