@harborppm/cli 0.106.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
@@ -38,7 +38,7 @@ harbor # name your harbor and its first project, and you're in
38
38
  10. **Brief** (`0`): the weekly brief the website writes, for all portfolios or one (`p`), with how many programs sit at each health and the notes that opened; `f` swaps in the shipping forecast and `y` copies what's shown (in a terminal that lets apps copy; tmux needs `set-clipboard on`).
39
39
  11. **Crew** (`C`): who's aboard and what each can do. The owner switches someone between editing and viewing (Enter), invites by email (`i`), copies (`y`) or withdraws (`w`) a letter still out, makes a read-only share link to a portfolio (`s`) and picks who gets its Monday update (`m`), and makes a project's intake form (`f`). Everyone sees the apps they connected (`d` disconnects one), turns their emails on or off, and opens Keep in the browser.
40
40
  12. **Goals** (`G`): each portfolio's goals with how far along they are, off track in red, and their key results. `n` sets a goal; Enter on a goal renames it, gives it an owner, a due day or why it matters, adds a number key result or counts a program or project toward it; Enter on a number key result moves it; `d` removes the goal or key result.
41
- 13. **Reports** (`O`): the Reports page's dashboards, each chart drawn as bars with its numbers. `n` makes a dashboard (the first starts with a few charts), `a` adds a chart (what it counts, then how it's split), `[` `]` move one, `d` removes it.
41
+ 13. **Reports** (`O`): the Reports page's dashboards, each chart drawn as bars with its numbers. `n` makes a dashboard (the first starts with a few charts), `a` adds a chart (what it counts, then how it's split), Enter renames a dashboard or chart, splits a chart another way or moves it, `[` `]` move one, `d` removes it.
42
42
 
43
43
  `:` also opens three pages that aren't screens of their own. **Recently deleted** lists what was deleted in the last 30 days, and Enter brings one back (for editors; it says first when what it sat in is gone too). **Sheet links** lists yours, `n` makes one for a program (or, for the owner, the whole harbor) and copies it, since it shows only once, and `d` turns one off. **API keys** lists yours with when each was last used, and `d` revokes one; `n` opens the website, where a new key is made and shown once.
44
44
 
@@ -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]
@@ -259,7 +261,7 @@ harbor agent report TASK "WHAT YOU DID" [--start] [--agent NAME]
259
261
 
260
262
  `harbor fog` lists the open tasks nobody has opened, moved, edited or commented on for three weeks, longest first. `harbor fog --sweep` walks through them one at a time in a terminal: `k` still needed (clears the fog), `d` a new date, `x` drop it, `s` skip, `q` stop. On the board, in the app and on the website, those cards show dimmed.
261
263
 
262
- `harbor watch` turns a narrow split or a tmux pane into a live ticker of your harbor: cards moving, comments, health changes, a line each as they happen, over the same live updates the website uses. Lines about your own work (your tasks, mentions of you, what you lead) are bright and the rest dim; `--bell` rings the terminal's bell when something of yours changes, and `--project` keeps to one project. It starts with the latest few changes and the time it began listening; `--since 14:30` (or a date) starts from then instead, on this computer's clock (`14:30Z` or `14:30 UTC` for UTC); the header names the time zone the ticker's times are in, and Harbor says "Nothing since 14:30 BST." when nothing has. A change the GitHub link made reads "Finished RR-4 … via GitHub", as History does. `q` stops; piped or with `--json` (one JSON object a line) it runs until it's killed, and `--once` prints what's there and returns, for scripts.
264
+ `harbor watch` turns a narrow split or a tmux pane into a live ticker of your harbor: cards moving, comments, health changes, a line each as they happen, over the same live updates the website uses. Lines about your own work (your tasks, mentions of you, what you lead) are bright and the rest dim; `--bell` rings the terminal's bell when something of yours changes, and `--project` keeps to one project. It starts with the latest few changes and the time it began listening; `--since 14:30` (or a date) starts from then instead, on this computer's clock (`14:30Z` or `14:30 UTC` for UTC); the header names the time zone the ticker's times are in, and Harbor says "Nothing since 14:30 BST." when nothing has. A change the GitHub link made reads "Finished RR-4 … via GitHub", as History does. `q` stops; piped or with `--json` (one JSON object a line) it runs until it's killed, and `--once` prints what's there and returns, for scripts. Harbor keeps the latest 40 changes, so a `--since` further back says where its list starts.
263
265
 
264
266
  `harbor lifeboats` lists the work only one person has touched (a project, their corner of one, a task others wait on, their serious risks), numbered, each with someone who has room this week and already works nearby. `harbor lifeboats 2` puts that person on line 2 as a second pair of hands (`--person NAME` for someone else); `harbor follow RR-4 --person Sam` does it for one task. Following doesn't take the work over. `harbor raid "DECISION" --still-stands "WHY"` says a decision that came back for a look still stands.
265
267
 
@@ -269,13 +271,13 @@ Agents on the crew: put an AI app on People with Add an agent and assign it task
269
271
 
270
272
  A task has one owner (`--assignee`), who answers for it and whose load it counts against, and anyone else on it with them (`--also "Sam, Aya"`): they see it under Also on in `harbor mine` and on Today, and count as knowing it. `harbor edit RR-4 --also none` leaves only the owner.
271
273
 
272
- `harbor add --project Trail --comment "From Monday's call" < list.txt` adds one task per line of the file, each with the comment (every option applies to every line); `--dry-run` asks Harbor to add them on a copy it throws away, so it shows each task as it would really be (key, column, owner, priority, dates, parent, milestone), an open task that already has the title, and anything it would refuse and why; it exits 1 when something would be refused. `--unless-exists` adds a title only if the project has no open task by that name, so a retried script doesn't double up. `--json` gives `added` and `skipped` lists, each entry with its key, for one title or a hundred.
274
+ `harbor add --project Trail --comment "From Monday's call" < list.txt` adds one task per line of the file, each with the comment (every option applies to every line); `--dry-run` asks Harbor to add them on a copy it throws away, so it shows each task as it would really be (key, column, owner, priority, dates, parent, milestone), an open task that already has the title, and anything it would refuse and why; it exits 1 when something would be refused. The key it shows is a forecast, not held: an add from anyone in between takes it. `--unless-exists` adds a title only if the project has no open task by that name (done tasks aren't checked, so a weekly chore still goes in), so a retried script doesn't double up. `--json` has the dry run's shape, so a script reads both the same way: `tasks`, one entry a title with its key, and a skipped one marked `skipped` with the open task's key as `sameAs` (one title added alone also keeps `created`).
273
275
 
274
276
  `harbor add "Book the venue @Quinn by Friday !high #Website"` reads the title in plain words, as the website's New task does: it adds "Book the venue" for Quinn, due Friday, high priority, in the Website project, and says what it read. A flag wins over the words (they stay in the title), `--literal` keeps the title exactly as typed, and `--due` takes the same words (`--due "next friday"`, `--due "in two weeks"`). In the full-screen app, `n` reads a new task's title the same way.
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
@@ -5499,6 +5499,20 @@ function wrapLines(text, width) {
5499
5499
  }
5500
5500
  return out;
5501
5501
  }
5502
+ /**
5503
+ * Text on at most `lines` lines no wider than `width`, the last ending in "…"
5504
+ * when some is left over: a board card's title, which must never run into the
5505
+ * card below.
5506
+ */
5507
+ function clampLines(text, width, lines) {
5508
+ const w = Math.max(1, width);
5509
+ const all = wrapLines(text.replace(/\s+/g, " ").trim(), w).map((l) => l.slice(0, w));
5510
+ if (all.length <= lines) return all;
5511
+ const kept = all.slice(0, lines);
5512
+ const last = kept[lines - 1];
5513
+ kept[lines - 1] = (last.length >= w ? last.slice(0, w - 1) : last).trimEnd() + "…";
5514
+ return kept;
5515
+ }
5502
5516
  /** The first of the month a day falls in. */
5503
5517
  function monthOf(iso) {
5504
5518
  return `${iso.slice(0, 7)}-01`;
@@ -5763,6 +5777,13 @@ function crewRows(crew, data, now) {
5763
5777
  which: "assignments",
5764
5778
  on: crew.email.assignments
5765
5779
  });
5780
+ rows.push({
5781
+ kind: "email",
5782
+ text: "A sea shanty about the week, at the end of the Monday digest",
5783
+ detail: crew.email.shanty ? "on" : "off",
5784
+ which: "shanty",
5785
+ on: crew.email.shanty
5786
+ });
5766
5787
  rows.push({
5767
5788
  kind: "heading",
5768
5789
  text: "Keep"
@@ -10110,6 +10131,13 @@ function withDashboard(list, input) {
10110
10131
  createdAt: input.createdAt
10111
10132
  }];
10112
10133
  }
10134
+ function renamedDashboard(list, id, name) {
10135
+ const clean = cleanName(name);
10136
+ return list.map((d) => d.id === id ? {
10137
+ ...d,
10138
+ name: clean
10139
+ } : d);
10140
+ }
10113
10141
  function withoutDashboard(list, id) {
10114
10142
  return list.filter((d) => d.id !== id);
10115
10143
  }
@@ -10169,6 +10197,14 @@ function starterCharts(makeId) {
10169
10197
  init_utils();
10170
10198
  /** The longest bar a chart draws, in characters. */
10171
10199
  const BAR = 24;
10200
+ /**
10201
+ * A value's bar, then a space: nothing for a zero (a block there reads as
10202
+ * something done), at least one block for anything above it.
10203
+ */
10204
+ function barOf(value, top) {
10205
+ if (!(value > 0)) return "";
10206
+ return `${"█".repeat(Math.max(1, Math.round(value / Math.max(top, value) * BAR)))} `;
10207
+ }
10172
10208
  /** Each dashboard and its charts as lines: a chart's name and total, then a bar a value. */
10173
10209
  function reportRows(data, today) {
10174
10210
  const out = [];
@@ -10203,7 +10239,7 @@ function reportRows(data, today) {
10203
10239
  });
10204
10240
  for (const s of r.slices) out.push({
10205
10241
  key: `${chart.id}-${s.key}`,
10206
- text: ` ${s.label.slice(0, label).padEnd(label)} ${"█".repeat(Math.max(1, Math.round(s.value / top * BAR)))} ${s.value}`,
10242
+ text: ` ${s.label.slice(0, label).padEnd(label)} ${barOf(s.value, top)}${s.value}`,
10207
10243
  plain: true
10208
10244
  });
10209
10245
  }
@@ -10274,6 +10310,10 @@ function ReportsView({ active, width, height, go }) {
10274
10310
  }));
10275
10311
  });
10276
10312
  if (!cursor) return;
10313
+ if (key.return) {
10314
+ if (viewOnly) return go.notify("You can only view this harbor.");
10315
+ return chartMenu(go, cursor, change);
10316
+ }
10277
10317
  if (input === "a") return addChart(go, cursor.dashboard, change);
10278
10318
  if ((input === "[" || input === "]") && cursor.chart) return change((list) => movedChart(list, cursor.dashboard.id, cursor.chart.id, input === "[" ? -1 : 1));
10279
10319
  if (input === "d") return go.confirm(cursor.chart ? `Remove the chart “${cursor.chart.title}”? u undoes it.` : `Delete the dashboard “${cursor.dashboard.name}” and its charts? u undoes it.`, () => change((list) => cursor.chart ? withoutChart(list, cursor.dashboard.id, cursor.chart.id) : withoutDashboard(list, cursor.dashboard.id)), cursor.chart ? "Remove" : "Delete");
@@ -10285,7 +10325,7 @@ function ReportsView({ active, width, height, go }) {
10285
10325
  paddingX: 1,
10286
10326
  children: [
10287
10327
  /* @__PURE__ */ jsx(Heading, {
10288
- right: "↑↓ · n dashboard · a chart · [ ] move · d remove",
10328
+ right: "↑↓ · Enter change · n dashboard · a chart · [ ] move · d remove",
10289
10329
  children: "Reports"
10290
10330
  }),
10291
10331
  /* @__PURE__ */ jsx(Text, { children: " " }),
@@ -10301,6 +10341,62 @@ function ReportsView({ active, width, height, go }) {
10301
10341
  ]
10302
10342
  });
10303
10343
  }
10344
+ /** Enter on a dashboard or a chart: what can change about it, as on the website. */
10345
+ function chartMenu(go, { dashboard, chart }, change) {
10346
+ if (!chart) return go.pick(dashboard.name, [{
10347
+ label: "Rename it",
10348
+ value: "rename"
10349
+ }, {
10350
+ label: "Add a chart",
10351
+ value: "add"
10352
+ }], (what) => what === "add" ? addChart(go, dashboard, change) : go.ask("The dashboard's name", (name) => {
10353
+ if (name.trim()) change((list) => renamedDashboard(list, dashboard.id, name));
10354
+ }, dashboard.name));
10355
+ const { id, ...rest } = chart;
10356
+ const keep = (patch) => change((list) => withChart(list, dashboard.id, {
10357
+ ...rest,
10358
+ ...patch
10359
+ }, id));
10360
+ go.pick(chart.title, [
10361
+ {
10362
+ label: "Rename it",
10363
+ value: "rename"
10364
+ },
10365
+ {
10366
+ label: "Split it another way",
10367
+ value: "split"
10368
+ },
10369
+ {
10370
+ label: "Move it up",
10371
+ value: "up"
10372
+ },
10373
+ {
10374
+ label: "Move it down",
10375
+ value: "down"
10376
+ }
10377
+ ], (what) => {
10378
+ if (what === "rename") return go.ask("The chart's title", (title) => {
10379
+ if (title.trim()) keep({ title: title.trim() });
10380
+ }, chart.title);
10381
+ if (what === "split") return go.pick(`${MEASURE_LABEL[chart.measure]}, split by`, groupsFor(chart.measure).filter((g) => g !== "field").map((g) => ({
10382
+ label: groupLabel(chart.measure, g),
10383
+ value: g
10384
+ })), (g) => {
10385
+ const groupBy = g;
10386
+ const titled = chart.title === defaultTitle(chart);
10387
+ keep({
10388
+ groupBy,
10389
+ field: void 0,
10390
+ view: defaultView(groupBy),
10391
+ title: titled ? defaultTitle({
10392
+ measure: chart.measure,
10393
+ groupBy
10394
+ }) : chart.title
10395
+ });
10396
+ });
10397
+ change((list) => movedChart(list, dashboard.id, chart.id, what === "up" ? -1 : 1));
10398
+ });
10399
+ }
10304
10400
  function addChart(go, dashboard, change) {
10305
10401
  go.pick(`A chart on ${dashboard.name}: what does it count?`, MEASURES.map((m) => ({
10306
10402
  label: MEASURE_LABEL[m],
@@ -16588,9 +16684,9 @@ const HELP$1 = [
16588
16684
  ["v", "switch layout: board, list, budget, by project"],
16589
16685
  ["m R P t D", "milestone / risk / pre-mortem / dry dock / Done"],
16590
16686
  ["c a C S", "on a task: comment / step / yours / sounding"],
16591
- ["s T / M T", "subtask, as template / messages, from template"],
16592
- ["f / c", "on Today: focus on a task / check in"],
16593
- ["f / p", "on a board: filter by owner / priority"],
16687
+ ["s T", "on a task: add a subtask / save as a template"],
16688
+ ["M T", "on a project: messages / a task from a template"],
16689
+ ["f c / f p", "Today: focus, check in · board: owner, priority"],
16594
16690
  ["q", "quit (saves first)"]
16595
16691
  ];
16596
16692
  /**
@@ -16947,6 +17043,7 @@ init_format();
16947
17043
  const PAGES = {
16948
17044
  today: "/today",
16949
17045
  inbox: "/inbox",
17046
+ chat: "/chat",
16950
17047
  week: "/week",
16951
17048
  brief: "/brief",
16952
17049
  review: "/review",
@@ -23772,6 +23869,21 @@ function welcomeWhen(person, lastSeen, today) {
23772
23869
  days
23773
23870
  } : null;
23774
23871
  }
23872
+ /**
23873
+ * The later of this device's mark and the last thing the person did in the
23874
+ * harbor by hand (its activity log and their comments), so time spent on the
23875
+ * website, a phone or the commands counts as having looked. Changes made for
23876
+ * them (`via` GitHub and the like) don't.
23877
+ */
23878
+ function lastLooked(mark, data, personId) {
23879
+ let last = mark ?? null;
23880
+ const later = (at) => {
23881
+ if (at && (!last || at > last)) last = at;
23882
+ };
23883
+ for (const a of data.activity ?? []) if (a.personId === personId && !a.via) later(a.at);
23884
+ for (const c of data.comments ?? []) if (c.authorId === personId) later(c.createdAt);
23885
+ return last;
23886
+ }
23775
23887
 
23776
23888
  // src/lib/welcome-back.ts
23777
23889
  init_date_text();
@@ -30687,7 +30799,8 @@ function memoryCrew(account, harbor) {
30687
30799
  }];
30688
30800
  const email = {
30689
30801
  weeklyDigest: true,
30690
- assignments: true
30802
+ assignments: true,
30803
+ shanty: false
30691
30804
  };
30692
30805
  const keep = {
30693
30806
  kept: false,
@@ -30795,6 +30908,7 @@ function memoryCrew(account, harbor) {
30795
30908
  case "email":
30796
30909
  if (act.weeklyDigest !== void 0) email.weeklyDigest = act.weeklyDigest;
30797
30910
  if (act.assignments !== void 0) email.assignments = act.assignments;
30911
+ if (act.shanty !== void 0) email.shanty = act.shanty;
30798
30912
  return view();
30799
30913
  }
30800
30914
  },
@@ -34296,7 +34410,8 @@ function ProjectView({ projectId, active, width, height, go, onBack }) {
34296
34410
  priority: t.priority,
34297
34411
  selected: on && view.start + i === r,
34298
34412
  fog: fogWeeks(t),
34299
- picked: picked.includes(t.id)
34413
+ picked: picked.includes(t.id),
34414
+ width: Math.max(1, w - 4)
34300
34415
  }, t.id)),
34301
34416
  view.start + view.items.length < c.tasks.length ? /* @__PURE__ */ jsxs(Text, {
34302
34417
  color: theme.muted,
@@ -34338,10 +34453,11 @@ function ProjectView({ projectId, active, width, height, go, onBack }) {
34338
34453
  });
34339
34454
  }
34340
34455
  /** One card on the board: its key, due date and owner, then the title on up to two lines. */
34341
- function Card({ taskKey, title, owner, due, late, waits, priority, selected, fog = null, picked = false }) {
34456
+ function Card({ taskKey, title, owner, due, late, waits, priority, selected, fog = null, picked = false, width }) {
34342
34457
  return /* @__PURE__ */ jsxs(Box, {
34343
34458
  flexDirection: "column",
34344
34459
  height: 3,
34460
+ overflow: "hidden",
34345
34461
  children: [/* @__PURE__ */ jsxs(Text, {
34346
34462
  wrap: "truncate-end",
34347
34463
  inverse: selected,
@@ -34380,13 +34496,15 @@ function Card({ taskKey, title, owner, due, late, waits, priority, selected, fog
34380
34496
  ]
34381
34497
  }), /* @__PURE__ */ jsx(Box, {
34382
34498
  height: 2,
34383
- children: /* @__PURE__ */ jsx(Text, {
34384
- wrap: "wrap",
34499
+ flexDirection: "column",
34500
+ overflow: "hidden",
34501
+ children: clampLines(title, width, 2).map((line, i) => /* @__PURE__ */ jsx(Text, {
34502
+ wrap: "truncate-end",
34385
34503
  bold: selected,
34386
34504
  dimColor: fog != null && !selected,
34387
34505
  color: selected ? theme.selected : fog != null ? theme.muted : void 0,
34388
- children: title
34389
- })
34506
+ children: line
34507
+ }, i))
34390
34508
  })]
34391
34509
  });
34392
34510
  }
@@ -35991,7 +36109,7 @@ function TaskPanel({ taskId, width, height, go, active = true, onClose }) {
35991
36109
  /* @__PURE__ */ jsx(Box, { flexGrow: 1 }),
35992
36110
  editor ?? /* @__PURE__ */ jsx(Text, {
35993
36111
  color: theme.muted,
35994
- wrap: "truncate-end",
36112
+ wrap: "wrap",
35995
36113
  children: "↑↓ field · Enter change · o who's on it · c comment · C yours · a add step · e edit step · space tick · x done · S sounding · s subtask · T save as template · d delete · Esc close"
35996
36114
  })
35997
36115
  ]
@@ -36613,7 +36731,8 @@ function App({ ui, startIn }) {
36613
36731
  const s = store.getState();
36614
36732
  const me = s.people.find((p) => p.id === s.currentUserId);
36615
36733
  if (!seen || !me || !s.workspaceId || s.workspaceId === "local") return null;
36616
- return welcomeWhen(me, seen.last(s.workspaceId), today());
36734
+ const mark = seen.last(s.workspaceId);
36735
+ return welcomeWhen(me, mark ? lastLooked(mark, s, me.id) : null, today());
36617
36736
  });
36618
36737
  useEffect(() => {
36619
36738
  const id = store.getState().workspaceId;
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
@@ -313,8 +320,8 @@ export const HELP = `harbor: Harbor from the terminal
313
320
  harbor goal "TITLE" --new [--portfolio P] [--owner NAME] [--due DATE]
314
321
  set a new goal (harbor help goal)
315
322
  harbor milestones [PROGRAM] [--project P] [--done]
316
- milestones soonest first: tasks
317
- done, sign-off, what they wait on
323
+ milestones soonest first, with
324
+ tasks done, sign-off, waits
318
325
  harbor milestone "NAME" [--program P] [--due DATE] [--rename T]
319
326
  [--reached|--open] [--signs-off NAME|none]
320
327
  [--approve|--changes NOTE]
@@ -716,6 +723,24 @@ function wordsLine(r) {
716
723
  return bits.length ? `Read from your words: ${bits.join(", ")}.` : null;
717
724
  }
718
725
 
726
+ /**
727
+ * What the words in a title read as, field by field, with the words each came
728
+ * from (`from`), for --dry-run --json; null when they read as nothing.
729
+ */
730
+ function wordsRead(r) {
731
+ const fields = [
732
+ ["assignee", r.owner],
733
+ ["due", r.due],
734
+ ["priority", r.priority],
735
+ ["project", r.project],
736
+ ].filter(([, x]) => x);
737
+ if (!fields.length) return null;
738
+ return {
739
+ ...Object.fromEntries(fields.map(([k, x]) => [k, x.value])),
740
+ from: Object.fromEntries(fields.map(([k, x]) => [k, x.text])),
741
+ };
742
+ }
743
+
719
744
  /** --due given in words rather than as a date or +N, when it reads as a day. */
720
745
  function dueWords(v) {
721
746
  if (typeof v !== "string" || /^(\d{4}-\d{2}-\d{2}|\+\d{1,3})$/.test(v) || PILOT.has(v.toLowerCase())) return false;
@@ -911,12 +936,14 @@ const DETAIL = {
911
936
  " priority, dates, parent and milestone, the words read from its title,",
912
937
  " an open task that already has the title, and anything Harbor would",
913
938
  " refuse (a full column, an unknown person) with why. It exits 1 when",
914
- " something would be refused. --json lists the same under tasks.",
939
+ " something would be refused. --json lists the same under tasks. The key",
940
+ " is a forecast, not held for you: an add from anyone in between takes it.",
915
941
  "",
916
942
  " --unless-exists skips a title the project already has open (case and",
917
943
  " spacing aside), saying which task it found; a done one doesn't count,",
918
- " so a weekly chore is still added. --json lists added and skipped tasks,",
919
- " each with its key, the same shape for one title or a hundred.",
944
+ " so a weekly chore is still added (only open tasks are checked). --json",
945
+ " has the dry run's shape: tasks, one a title, a skipped one marked",
946
+ " skipped with the open task's key as sameAs (one title also: created).",
920
947
  "",
921
948
  " --project can be left out when the harbor has one open project (First",
922
949
  " voyage aside); the task goes there.",
@@ -1327,8 +1354,9 @@ const DETAIL = {
1327
1354
  " soonest first",
1328
1355
  " harbor milestones --project P reads: the milestones of P's program",
1329
1356
  "",
1330
- " Each says its due day and whether it's late, how many of the tasks tied",
1331
- " to it are done, who signs it off and where that stands, and the",
1357
+ " Each says its due day and whether it's late, and how many of the tasks",
1358
+ " tied to it are done (a task ties with harbor add or edit --milestone).",
1359
+ " When it has them, who signs it off and where that stands, and the",
1332
1360
  " projects it waits on. --done adds the reached ones.",
1333
1361
  ],
1334
1362
  milestone: [
@@ -1443,7 +1471,9 @@ const DETAIL = {
1443
1471
  " prints each new one as it lands. Lines about your own work (your tasks,",
1444
1472
  " mentions of you, what you lead) are bright; the rest are dim. It runs",
1445
1473
  " until q or Ctrl+C (or until it's killed, when piped or with --json);",
1446
- " --once returns at once. Made for a narrow split or a tmux pane; it needs",
1474
+ " --once returns at once. Harbor keeps the latest 40 changes, so --since",
1475
+ " further back than those says where its list starts. Made for a narrow",
1476
+ " split or a tmux pane; it needs",
1447
1477
  " full access (harbor login without --read-only).",
1448
1478
  ],
1449
1479
  lifeboats: [
@@ -1576,7 +1606,13 @@ const DETAIL = {
1576
1606
  " they come; in a terminal, type a",
1577
1607
  ' line to post it, "/r N text" to',
1578
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",
1579
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.",
1580
1616
  " A task key goes to its comments; a name to that project's messages, or",
1581
1617
  " the program's when no project has it (--project or --program says which",
1582
1618
  " when both do). Messages are numbered [1], [2]… with their replies under",
@@ -1584,6 +1620,13 @@ const DETAIL = {
1584
1620
  " --limit N shows up to 500. --watch asks every 5 seconds while people are",
1585
1621
  " talking and every 30 once it's quiet.",
1586
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
+ ],
1587
1630
  messages: [
1588
1631
  " harbor messages PROJECT reads a project's Messages tab",
1589
1632
  ' harbor messages PROJECT "TEXT" writes: posts to everyone on it',
@@ -2930,6 +2973,26 @@ export async function run(argv, io = {}) {
2930
2973
  if (!values.project && !reads.every((r) => r.project))
2931
2974
  values.project = await onlyProject(client, harbor, "--project NAME or #NAME in the title");
2932
2975
  const projectOf = (r) => values.project ?? r.project?.value;
2976
+ // One task as --json lists it, the same for a dry run and the real thing.
2977
+ const taskEntry = (t, title) => ({
2978
+ title: t?.title ?? title,
2979
+ ...(t
2980
+ ? {
2981
+ key: t.key ?? null,
2982
+ ...(t.id ? { id: t.id } : {}),
2983
+ project: t.project,
2984
+ status: t.status,
2985
+ ...(t.column ? { column: t.column } : {}),
2986
+ assignee: t.assignee,
2987
+ ...(t.alsoOn ? { alsoOn: t.alsoOn } : {}),
2988
+ priority: t.priority,
2989
+ due: t.due,
2990
+ ...(t.starts ? { starts: t.starts } : {}),
2991
+ ...(t.subtaskOf ? { subtaskOf: t.subtaskOf } : {}),
2992
+ ...(t.milestone ? { milestone: t.milestone } : {}),
2993
+ }
2994
+ : {}),
2995
+ });
2933
2996
  // What create_task gets for one line, the same for a dry run and the real thing.
2934
2997
  const argsFor = (words) => ({
2935
2998
  project: projectOf(words),
@@ -2960,38 +3023,13 @@ export async function run(argv, io = {}) {
2960
3023
  const unread =
2961
3024
  values.literal && !fromTemplate ? await readTitles(client, harbor, titles, values) : null;
2962
3025
  const lines = preview.tasks.map((p, i) => {
2963
- const t = p.created;
2964
3026
  const words = reads[i];
2965
3027
  return {
2966
- title: t?.title ?? p.title ?? words.title,
2967
- ...(t
2968
- ? {
2969
- key: t.key ?? null,
2970
- project: t.project,
2971
- status: t.status,
2972
- ...(t.column ? { column: t.column } : {}),
2973
- assignee: t.assignee,
2974
- ...(t.alsoOn ? { alsoOn: t.alsoOn } : {}),
2975
- priority: t.priority,
2976
- due: t.due,
2977
- ...(t.starts ? { starts: t.starts } : {}),
2978
- ...(t.subtaskOf ? { subtaskOf: t.subtaskOf } : {}),
2979
- ...(t.milestone ? { milestone: t.milestone } : {}),
2980
- }
2981
- : {}),
3028
+ ...taskEntry(p.created, p.title ?? words.title),
2982
3029
  ...(values.template ? { template: values.template } : {}),
2983
3030
  ...(values.comment ? { comment: values.comment } : {}),
2984
- ...(words.owner || words.due || words.priority || words.project
2985
- ? {
2986
- read: {
2987
- ...(words.owner ? { assignee: words.owner.value, from: words.owner.text } : {}),
2988
- ...(words.due ? { due: words.due.value } : {}),
2989
- ...(words.priority ? { priority: words.priority.value } : {}),
2990
- ...(words.project ? { project: words.project.value } : {}),
2991
- },
2992
- }
2993
- : {}),
2994
- ...(unread && wordsLine(unread[i]) ? { keptWords: wordsLine(unread[i]) } : {}),
3031
+ ...(wordsRead(words) ? { read: wordsRead(words) } : {}),
3032
+ ...(unread && wordsRead(unread[i]) ? { keptWords: wordsRead(unread[i]) } : {}),
2995
3033
  ...(p.sameAs ? { sameAs: p.sameAs } : {}),
2996
3034
  ...(p.sameAs && values["unless-exists"] ? { skipped: true } : {}),
2997
3035
  ...(p.refused ? { refused: p.refused } : {}),
@@ -3033,7 +3071,7 @@ export async function run(argv, io = {}) {
3033
3071
  ` ${bits.join(" · ")}`,
3034
3072
  ...(wordsLine(words) ? [` ${wordsLine(words)} --literal keeps them in the title.`] : []),
3035
3073
  ...(l.keptWords
3036
- ? [` --literal kept the words as typed. ${l.keptWords.replace("Read from your words", "Without it, they'd read as")}`]
3074
+ ? [` --literal kept the words as typed. ${wordsLine(unread[i]).replace("Read from your words", "Without it, they'd read as")}`]
3037
3075
  : []),
3038
3076
  ...(l.comment ? [` with your comment: ${l.comment}`] : []),
3039
3077
  ...(l.sameAs && !l.skipped
@@ -3045,7 +3083,7 @@ export async function run(argv, io = {}) {
3045
3083
  out(
3046
3084
  plain(
3047
3085
  [
3048
- `Would add ${n(would)}${skipped ? `, skip ${skipped}` : ""}${refused ? `; ${refused} would be refused` : ""}. Nothing changed.`,
3086
+ `Would add ${n(would)}${skipped ? `, skip ${skipped}` : ""}${refused ? `; ${refused} would be refused` : ""}. Nothing changed${lines.some((l) => l.key) ? ", and the keys aren't held" : ""}.`,
3049
3087
  ...body,
3050
3088
  ...(pilot ? [`--due pilot: ${pilot.says}`] : []),
3051
3089
  ].join("\n"),
@@ -3055,7 +3093,7 @@ export async function run(argv, io = {}) {
3055
3093
  return refused ? 1 : 0;
3056
3094
  }
3057
3095
  const added = [];
3058
- for (const words of reads) {
3096
+ for (const [i, words] of reads.entries()) {
3059
3097
  const r = await client
3060
3098
  .call("create_task", { harbor, ...argsFor(words) })
3061
3099
  .catch((err) => {
@@ -3078,25 +3116,43 @@ export async function run(argv, io = {}) {
3078
3116
  body: values.comment,
3079
3117
  })
3080
3118
  ).commented;
3081
- const line = wordsLine(words);
3082
- if (line) r.read = line;
3119
+ // The words read out of the title, field by field, and the title as typed.
3120
+ const read = wordsRead(words);
3121
+ if (read) r.read = { ...read, typed: titles[i] };
3083
3122
  added.push(r);
3084
3123
  }
3085
3124
  await stalePromptCache(env);
3086
3125
  const made = added.filter((r) => r.created);
3087
- const kept = added.filter((r) => r.existing);
3088
- // One shape however many titles: `added` lists what was added and
3089
- // `skipped` what --unless-exists found open already, each entry with
3090
- // its key at the top; one title added also keeps its `created`.
3091
- const entry = (r, t) => ({ key: t.key ?? null, id: t.id, title: t.title, ...r });
3092
- if (asJson)
3126
+ // The dry run's shape, so a script reads both the same way: `tasks`
3127
+ // has one entry a title, a skipped one (--unless-exists found it open)
3128
+ // marked `skipped` with the open task's key as `sameAs`. One title added
3129
+ // alone also keeps `created`, as before.
3130
+ if (asJson) {
3131
+ const tasks = added.map((r, i) =>
3132
+ r.existing
3133
+ ? { ...taskEntry(r.existing, titles[i]), sameAs: r.existing.key ?? r.existing.id, skipped: true }
3134
+ : {
3135
+ ...taskEntry(r.created, titles[i]),
3136
+ ...(values.template ? { template: values.template } : {}),
3137
+ ...(r.comment ? { comment: r.comment } : {}),
3138
+ ...(r.read ? { read: r.read } : {}),
3139
+ ...(r.pilot ? { pilot: r.pilot } : {}),
3140
+ ...(r.milestoneReached ? { milestoneReached: r.milestoneReached } : {}),
3141
+ ...(r.milestoneReopened ? { milestoneReopened: r.milestoneReopened } : {}),
3142
+ },
3143
+ );
3144
+ const where = [...new Set(tasks.map((t) => t.project).filter(Boolean))];
3093
3145
  out(
3094
3146
  jsonText({
3095
- ...(made.length === 1 && added.length === 1 ? made[0] : {}),
3096
- added: made.map((r) => entry(r, r.created)),
3097
- skipped: kept.map((r) => entry(r, r.existing)),
3147
+ dryRun: false,
3148
+ literal: Boolean(values.literal),
3149
+ project: where.length === 1 ? where[0] : (values.project ?? null),
3150
+ titles: tasks.map((t) => t.title),
3151
+ tasks,
3152
+ ...(made.length === 1 && added.length === 1 ? { created: made[0].created } : {}),
3098
3153
  }),
3099
3154
  );
3155
+ }
3100
3156
  else
3101
3157
  out(
3102
3158
  plain(
@@ -3107,7 +3163,11 @@ export async function run(argv, io = {}) {
3107
3163
  : [
3108
3164
  `Added: ${taskLine(r.created, opts)}${r.comment ? ", with your comment" : ""}`,
3109
3165
  // What the title's words said, so nothing is read without being seen.
3110
- ...(r.read ? [`${r.read} --literal keeps the words in the title.`] : []),
3166
+ ...(r.read
3167
+ ? [
3168
+ `You typed “${r.read.typed}”. ${wordsLine(reads[added.indexOf(r)])} --literal keeps the words in the title.`,
3169
+ ]
3170
+ : []),
3111
3171
  // --due in words ("next friday"): the day it became, weekday and all.
3112
3172
  ...(dueWords(values.due) ? [`--due ${values.due}: ${dayWithWeekday(dueDate(values.due))}.`] : []),
3113
3173
  // Pilot speaks up only when a date was given that the queue says won't hold.
@@ -3900,7 +3960,7 @@ export async function run(argv, io = {}) {
3900
3960
  return call(
3901
3961
  "list_milestones",
3902
3962
  { harbor, program, project: values.project, done: Boolean(values.done) },
3903
- milestonesText,
3963
+ (r) => milestonesText(r, { done: Boolean(values.done) }),
3904
3964
  );
3905
3965
  }
3906
3966
  case "milestone": {
@@ -4252,10 +4312,109 @@ export async function run(argv, io = {}) {
4252
4312
  const { positionals, values, harbor } = parse(
4253
4313
  spec(["watch", "task", "project", "program"], ["limit", "reply"]),
4254
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
+ }
4255
4414
  const [on, ...words] = positionals;
4256
4415
  if (!on)
4257
4416
  throw new HarborError(
4258
- '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".',
4259
4418
  );
4260
4419
  const kinds = ["task", "project", "program"].filter((k) => values[k]);
4261
4420
  if (kinds.length > 1) throw new HarborError("Say one of --task, --project or --program.");
@@ -4373,6 +4532,16 @@ export async function run(argv, io = {}) {
4373
4532
  }
4374
4533
  return 0;
4375
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
+ }
4376
4545
  case "watch": {
4377
4546
  const { positionals, values, harbor } = parse(spec(["bell", "once"], ["project", "since"]));
4378
4547
  none(positionals);
package/lib/format.mjs CHANGED
@@ -1504,7 +1504,9 @@ export function milestoneLine(m, { program = true } = {}) {
1504
1504
  m.reached ? "reached" : m.late ? `late, due ${m.due}` : `due ${m.due}`,
1505
1505
  m.tasks
1506
1506
  ? `${m.tasks.done} of ${m.tasks.total} task${m.tasks.total === 1 ? "" : "s"} done`
1507
- : null,
1507
+ : m.reached
1508
+ ? null
1509
+ : "no tasks lead to it",
1508
1510
  m.signOff
1509
1511
  ? `${m.signOff.by ?? "someone"} signs off: ${SIGN_OFF[m.signOff.status] ?? m.signOff.status}${m.signOff.note ? ` (“${m.signOff.note}”)` : ""}`
1510
1512
  : null,
@@ -1517,8 +1519,12 @@ export function milestoneLine(m, { program = true } = {}) {
1517
1519
  }
1518
1520
 
1519
1521
  /** list_milestones: soonest first, the program named once when it's one. */
1520
- export function milestonesText(r) {
1522
+ export function milestonesText(r, { done = false } = {}) {
1521
1523
  const list = r.milestones ?? [];
1524
+ const noneReached =
1525
+ done && list.length && !list.some((m) => m.reached)
1526
+ ? [`None ${r.program ? `in ${r.program} ` : ""}reached yet.`]
1527
+ : [];
1522
1528
  const hidden = r.reachedHidden
1523
1529
  ? `${r.reachedHidden} reached ${r.reachedHidden === 1 ? "one" : "ones"} not shown (--done shows them).`
1524
1530
  : "";
@@ -1532,6 +1538,7 @@ export function milestonesText(r) {
1532
1538
  ...(r.program ? [`${r.program}:`] : []),
1533
1539
  ...list.map((m) => `${r.program ? " " : ""}${milestoneLine(m, { program: !r.program })}`),
1534
1540
  ...(hidden ? [hidden] : []),
1541
+ ...noneReached,
1535
1542
  ].join("\n");
1536
1543
  }
1537
1544
 
@@ -1563,10 +1570,11 @@ export function reportsText(r) {
1563
1570
  out.push(d.name);
1564
1571
  if (!d.charts.length) out.push(" No charts on it yet.");
1565
1572
  for (const c of d.charts) {
1566
- out.push(
1567
- ` ${c.text}`,
1568
- ` ${c.counts} by ${c.splitBy.toLowerCase()}${c.from ? `, in ${c.from}` : ""}`,
1569
- );
1573
+ // The line under says what the title doesn't: a starter chart's title already is "Open tasks by owner".
1574
+ const what = `${c.counts} by ${c.splitBy.toLowerCase()}`;
1575
+ const said = (c.title ?? "").toLowerCase().includes(what.toLowerCase());
1576
+ const sub = [said ? null : what, c.from ? `in ${c.from}` : null].filter(Boolean).join(", ");
1577
+ out.push(` ${c.text}`, ...(sub ? [` ${sub[0].toUpperCase()}${sub.slice(1)}`] : []));
1570
1578
  }
1571
1579
  }
1572
1580
  return out.join("\n");
@@ -1578,3 +1586,39 @@ export function digestText(r, hours) {
1578
1586
  if (r.quiet) return `Nothing changed on ${r.on} in ${span}.`;
1579
1587
  return [`What changed on ${r.on} in ${span}`, ...r.lines.map((l) => ` • ${l}`)].join("\n");
1580
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.106.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",