@harborppm/cli 0.117.0 → 0.118.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/lib/cli.mjs CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { spawn } from "node:child_process";
7
7
  import { readFileSync } from "node:fs";
8
+ import { dirname, join, resolve } from "node:path";
8
9
  import { parseArgs } from "./args.mjs";
9
10
  import { hasFullAccess, loadApp, tokenSource } from "./app.mjs";
10
11
  import { login } from "./auth.mjs";
@@ -79,6 +80,7 @@ import {
79
80
  rankText,
80
81
  setRankText,
81
82
  agentWorkText,
83
+ agentsText,
82
84
  raidDetail,
83
85
  raidList,
84
86
  reviewList,
@@ -399,6 +401,11 @@ export const HELP = `harbor: Harbor from the terminal
399
401
  harbor agent report TASK "WHAT YOU DID" [--start] [--agent NAME]
400
402
  the agent's note; moves the task
401
403
  to In review (--start: In play)
404
+ harbor agent log "TITLE" --note "WHAT YOU DID" [--project P] [--link URL]
405
+ work nobody gave the agent, handed
406
+ in as a task in review
407
+ harbor agents [--agent NAME] [--project P] every agent's work: for you to
408
+ check, in play, sent back
402
409
 
403
410
  Every command takes --json, and --harbor NAME when you're in more than one
404
411
  harbor (or set one with harbor use). harbor help COMMAND shows just that one.
@@ -585,7 +592,9 @@ async function onlyProject(client, harbor, say = "--project NAME") {
585
592
  const open = (r.projects ?? []).filter((p) => p.id !== "voyage");
586
593
  if (open.length === 1) return open[0].name;
587
594
  if (open.length === 0)
588
- throw new HarborError('This harbor has no open project yet; harbor project "NAME" --program P makes one.');
595
+ throw new HarborError(
596
+ 'This harbor has no open project yet; harbor project "NAME" --program P makes one.',
597
+ );
589
598
  const names = open.slice(0, 3).map((p) => p.name);
590
599
  const more = open.length > 3 || r.total > 5 ? ", …" : "";
591
600
  throw new HarborError(`Say which project: ${say} (${names.join(", ")}${more}).`);
@@ -635,7 +644,11 @@ export function draftWhere(values, harbor) {
635
644
  const base = harbor ? { harbor } : {};
636
645
  if (values.new !== undefined) {
637
646
  if (values.new === "program")
638
- return { ...base, level: "projects", ...(values.portfolio ? { portfolio: values.portfolio } : {}) };
647
+ return {
648
+ ...base,
649
+ level: "projects",
650
+ ...(values.portfolio ? { portfolio: values.portfolio } : {}),
651
+ };
639
652
  if (values.new === "portfolio") return { ...base, level: "programs" };
640
653
  throw new HarborError("--new is program or portfolio.");
641
654
  }
@@ -772,7 +785,12 @@ function wordsRead(r) {
772
785
 
773
786
  /** --due given in words rather than as a date or +N, when it reads as a day. */
774
787
  function dueWords(v) {
775
- if (typeof v !== "string" || /^(\d{4}-\d{2}-\d{2}|\+\d{1,3})$/.test(v) || PILOT.has(v.toLowerCase())) return false;
788
+ if (
789
+ typeof v !== "string" ||
790
+ /^(\d{4}-\d{2}-\d{2}|\+\d{1,3})$/.test(v) ||
791
+ PILOT.has(v.toLowerCase())
792
+ )
793
+ return false;
776
794
  return /^\d{4}-\d{2}-\d{2}$/.test(dueDate(v));
777
795
  }
778
796
 
@@ -782,7 +800,8 @@ function statusList(typed) {
782
800
  .split(",")
783
801
  .map((x) => x.trim())
784
802
  .filter(Boolean);
785
- if (list.some((x) => x.toLowerCase() === "all")) return ["backlog", "todo", "doing", "review", "done"];
803
+ if (list.some((x) => x.toLowerCase() === "all"))
804
+ return ["backlog", "todo", "doing", "review", "done"];
786
805
  return list.map(statusWord);
787
806
  }
788
807
 
@@ -874,7 +893,10 @@ export function hint(message, project) {
874
893
  (_, list) => `pick one of ${list.replace(/"/g, "").split("|").join(", ")}`,
875
894
  )
876
895
  // The CLI reads today, tomorrow and +N before Harbor sees the date.
877
- .replace(/^a date as YYYY-MM-DD$/, "a date like 2026-11-30, today, tomorrow, friday, next friday or +N days");
896
+ .replace(
897
+ /^a date as YYYY-MM-DD$/,
898
+ "a date like 2026-11-30, today, tomorrow, friday, next friday or +N days",
899
+ );
878
900
  if (!seen.has(flag)) seen.set(flag, said);
879
901
  }
880
902
  return [...seen].map(([flag, why]) => `${flag}: ${why}`).join("\n");
@@ -954,7 +976,7 @@ const DETAIL = {
954
976
  " harbor add --project P < titles.txt writes: one task a line of stdin",
955
977
  " harbor add --project P --dry-run reads: says what it would add, and",
956
978
  " adds nothing",
957
- " harbor add \"TITLE\" --unless-exists writes: only if no open task in the",
979
+ ' harbor add "TITLE" --unless-exists writes: only if no open task in the',
958
980
  " project has that title (safe to retry)",
959
981
  "",
960
982
  " --dry-run asks Harbor to add them on a copy that's thrown away, so it",
@@ -974,20 +996,20 @@ const DETAIL = {
974
996
  " --project can be left out when the harbor has one open project (First",
975
997
  " voyage aside); the task goes there.",
976
998
  "",
977
- " Plain words in a title are read as the website reads them: \"Book the",
978
- " venue @Quinn by friday !high #Website\" adds \"Book the venue\" for",
999
+ ' Plain words in a title are read as the website reads them: "Book the',
1000
+ ' venue @Quinn by friday !high #Website" adds "Book the venue" for',
979
1001
  " Quinn, due Friday, high priority, in Website. Harbor says what it read.",
980
1002
  " A flag wins over the words (they stay in the title), and --literal keeps",
981
1003
  " every title exactly as typed. What's read: a person after @ or \"assign",
982
- " to\"; a day after by, due, on, before or until, or as the very last",
983
- " words (\"Call the mill friday\"), never after to, for or from (\"Move",
984
- " the call to Friday\" keeps it); !high or \"high priority\"; #Project.",
1004
+ ' to"; a day after by, due, on, before or until, or as the very last',
1005
+ ' words ("Call the mill friday"), never after to, for or from ("Move',
1006
+ ' the call to Friday" keeps it); !high or "high priority"; #Project.',
985
1007
  " An @name that matches nobody stays in the title, and Harbor says so.",
986
1008
  " With --dry-run --literal it says what the words would have read as.",
987
1009
  "",
988
- " --assignee me|none|NAME, --also \"NAME, NAME\" (others on it with the",
1010
+ ' --assignee me|none|NAME, --also "NAME, NAME" (others on it with the',
989
1011
  " owner), --due DATE|pilot, --priority low|medium|high|urgent,",
990
- " --status S (backlog, todo, doing, review or done; \"in play\", \"in",
1012
+ ' --status S (backlog, todo, doing, review or done; "in play", "in',
991
1013
  " progress\" and the board's other words work too), --comment TEXT and",
992
1014
  " --over-limit apply to every task added, so",
993
1015
  " ten lines with --comment add the same comment to all ten. More than 100",
@@ -1491,7 +1513,7 @@ const DETAIL = {
1491
1513
  " harbor convoy ask PROGRAM … and its answers write them (harbor help convoy).",
1492
1514
  ],
1493
1515
  convoy: [
1494
- " harbor convoy ask PROGRAM --to OTHER --by DATE \"WHAT\"",
1516
+ ' harbor convoy ask PROGRAM --to OTHER --by DATE "WHAT"',
1495
1517
  " writes: PROGRAM asks OTHER for WHAT",
1496
1518
  " harbor convoy accept CONVOY [--project P]",
1497
1519
  " writes: the asked program takes it on,",
@@ -1543,7 +1565,7 @@ const DETAIL = {
1543
1565
  " --json one JSON object a line (at, text, quote, mine, tone;",
1544
1566
  " earlier: true for the ones from before it started)",
1545
1567
  "",
1546
- " It starts with the latest few changes and a \"since HH:MM\" line, then",
1568
+ ' It starts with the latest few changes and a "since HH:MM" line, then',
1547
1569
  " prints each new one as it lands. Lines about your own work (your tasks,",
1548
1570
  " mentions of you, what you lead) are bright; the rest are dim. It runs",
1549
1571
  " until q or Ctrl+C (or until it's killed, when piped or with --json);",
@@ -1589,12 +1611,30 @@ const DETAIL = {
1589
1611
  " writes: the note, and moves it to",
1590
1612
  " In play",
1591
1613
  "",
1614
+ ' harbor agent log "TITLE" --note "TEXT" [--project P] [--link URL]',
1615
+ " writes: a task in P for work nobody",
1616
+ " gave the agent, with its note, in",
1617
+ " review for a person to check",
1618
+ "",
1592
1619
  " TASK is a task key, like RR-42 (harbor agent lists them), or an id. It",
1593
1620
  " has to be assigned to an agent: for anyone else's task, report refuses",
1594
1621
  " and nothing changes, so assign it to the agent on the website first.",
1595
1622
  " --agent NAME picks the agent when the crew has more than one. An agent",
1596
1623
  " never marks its own work Done; a person does, on the website or in the",
1597
- " terminal app.",
1624
+ " terminal app. log is for work done without a task, like changes in a",
1625
+ " repository: in a folder that ran harbor init it goes to that project",
1626
+ " unless --project says otherwise. An agent logs at most 20 a day.",
1627
+ ],
1628
+ agents: [
1629
+ " harbor agents reads every agent's work across the",
1630
+ " harbor: handed in to you, with",
1631
+ " someone else, in play, sent back and",
1632
+ " not picked up, and approved today",
1633
+ " harbor agents --agent NAME one agent's",
1634
+ " harbor agents --project P one project's",
1635
+ "",
1636
+ " The Agents page on the website, as text. harbor approve TASK approves one;",
1637
+ ' harbor approve TASK --changes "NOTE" sends it back to the agent.',
1598
1638
  ],
1599
1639
  why: [
1600
1640
  " harbor why PROJECT the line of task waits that sets a",
@@ -1700,8 +1740,8 @@ const DETAIL = {
1700
1740
  " harbor chats your direct messages, newest first",
1701
1741
  "",
1702
1742
  " Each with who it's with, what's unread and its last line, and the",
1703
- " command that opens it. harbor chat @aya \"TEXT\" writes to someone;",
1704
- " harbor chat @aya @ben \"TEXT\" to a group of just them.",
1743
+ ' command that opens it. harbor chat @aya "TEXT" writes to someone;',
1744
+ ' harbor chat @aya @ben "TEXT" to a group of just them.',
1705
1745
  ],
1706
1746
  messages: [
1707
1747
  " harbor messages PROJECT reads a project's Messages tab",
@@ -1778,7 +1818,7 @@ const DETAIL = {
1778
1818
  " newly late or added, risks raised, decisions made. ←→ move between",
1779
1819
  " projects; d logs a decision, a an action (who takes it, due in a week),",
1780
1820
  " r a risk, m the program's next move, v shows every item behind an",
1781
- " \"and N more\" (↑↓ scroll); e ends it, Esc or q leaves without ending",
1821
+ ' "and N more" (↑↓ scroll); e ends it, Esc or q leaves without ending',
1782
1822
  " it. The summary lists what was logged; p posts it to each program's",
1783
1823
  " chat channel where one is set (Ship to shore, set on the website), y",
1784
1824
  " copies it. The next meeting counts from when this one ended.",
@@ -1908,24 +1948,47 @@ function distance(a, b) {
1908
1948
  return d[a.length][b.length];
1909
1949
  }
1910
1950
 
1951
+ /**
1952
+ * The .harbor/harbor.json of the repository (or folder) this runs in, when
1953
+ * harbor init kept it in step with a project; null for a local plan or none.
1954
+ */
1955
+ export function repoPlanConfig(start) {
1956
+ let dir = resolve(start);
1957
+ for (;;) {
1958
+ try {
1959
+ const config = JSON.parse(readFileSync(join(dir, ".harbor", "harbor.json"), "utf8"));
1960
+ return config && !config.local && config.project?.id ? config : null;
1961
+ } catch {
1962
+ /* not here: look a folder up */
1963
+ }
1964
+ const up = dirname(dir);
1965
+ if (up === dir) return null;
1966
+ dir = up;
1967
+ }
1968
+ }
1969
+
1911
1970
  /** What someone who knows the website, or a feature's name, might type. */
1912
1971
  const OTHER_NAMES = {
1913
1972
  today: "harbor mine lists what's on you, late first; harbor week plans your days.",
1914
1973
  inbox: "harbor catchup says what was handed to you and what moved.",
1915
- people: "harbor lifeboats, harbor clock and harbor ashore cover the crew; the app's People screen (harbor, then 6) shows everyone's load.",
1974
+ people:
1975
+ "harbor lifeboats, harbor clock and harbor ashore cover the crew; the app's People screen (harbor, then 6) shows everyone's load.",
1916
1976
  crew: "harbor invite EMAIL brings someone aboard; the app's Crew screen (harbor, then C) lists who's on it.",
1917
1977
  longpole: "harbor why PROJECT shows what's holding it up.",
1918
1978
  "long-pole": "harbor why PROJECT shows what's holding it up.",
1919
- pilot: "harbor show TASK says the date its owner's queue suggests; --due pilot on add or edit takes it.",
1979
+ pilot:
1980
+ "harbor show TASK says the date its owner's queue suggests; --due pilot on add or edit takes it.",
1920
1981
  dashboards: "harbor reports lists the Reports page's dashboards, each chart as its numbers.",
1921
- report: "harbor report PROGRAM is a program's status report; harbor reports lists the dashboards.",
1982
+ report:
1983
+ "harbor report PROGRAM is a program's status report; harbor reports lists the dashboards.",
1922
1984
  decide: 'harbor decision "TITLE" --project P logs a decision.',
1923
1985
  dock: "harbor try PROJECT is the dry dock; harbor rank PORTFOLIO says which ship docks first.",
1924
1986
  "dry-dock": "harbor try PROJECT is the dry dock.",
1925
1987
  ranking: "harbor rank PORTFOLIO says which ship docks first.",
1926
1988
  salt: "harbor salts PROJECT lists its old salts.",
1927
1989
  "old-salts": "harbor salts PROJECT lists its old salts.",
1928
- night: "Harbor at night is the portfolio chart room's evening scene for a wall screen, a picture to look at; harbor programs and harbor reports read the same projects.",
1990
+ night:
1991
+ "Harbor at night is the portfolio chart room's evening scene for a wall screen, a picture to look at; harbor programs and harbor reports read the same projects.",
1929
1992
  };
1930
1993
 
1931
1994
  /** A mistyped command, with the one it was probably meant to be. */
@@ -2706,7 +2769,11 @@ export async function run(argv, io = {}) {
2706
2769
  (r) => taskList(r, opts),
2707
2770
  (r) =>
2708
2771
  r.total > (r.tasks?.length ?? 0)
2709
- ? { ...r, more: r.total - r.tasks.length, note: "Capped at 20; --all lists every one." }
2772
+ ? {
2773
+ ...r,
2774
+ more: r.total - r.tasks.length,
2775
+ note: "Capped at 20; --all lists every one.",
2776
+ }
2710
2777
  : r,
2711
2778
  );
2712
2779
  // --all pages through every match, PAGE at a time (search_tasks' most).
@@ -2758,7 +2825,8 @@ export async function run(argv, io = {}) {
2758
2825
  ];
2759
2826
  if (t.alsoOn?.length) lines.push(`Also on it: ${t.alsoOn.join(", ")}.`);
2760
2827
  if (t.starts) lines.push(`Starts ${t.starts}${t.due ? `, due ${t.due}` : ""}.`);
2761
- if (t.subtaskOf) lines.push(`Subtask of ${t.subtaskOf.key ?? t.subtaskOf.id} ${t.subtaskOf.title}.`);
2828
+ if (t.subtaskOf)
2829
+ lines.push(`Subtask of ${t.subtaskOf.key ?? t.subtaskOf.id} ${t.subtaskOf.title}.`);
2762
2830
  if (t.milestone)
2763
2831
  lines.push(
2764
2832
  `Toward the milestone ${t.milestone.name} (${t.milestone.due}): ${t.milestone.reached ? "reached" : `${t.milestone.done} of ${t.milestone.total} of its tasks done`}.`,
@@ -2784,17 +2852,13 @@ export async function run(argv, io = {}) {
2784
2852
  lines.push(
2785
2853
  "",
2786
2854
  "Waits on:",
2787
- ...t.waitingOn.map(
2788
- (w) => ` ${w.key ?? w.id} ${w.title} (${statusText(w)})`,
2789
- ),
2855
+ ...t.waitingOn.map((w) => ` ${w.key ?? w.id} ${w.title} (${statusText(w)})`),
2790
2856
  );
2791
2857
  if (t.waitedOnBy.length)
2792
2858
  lines.push(
2793
2859
  "",
2794
2860
  "Holds up:",
2795
- ...t.waitedOnBy.map(
2796
- (w) => ` ${w.key ?? w.id} ${w.title} (${statusText(w)})`,
2797
- ),
2861
+ ...t.waitedOnBy.map((w) => ` ${w.key ?? w.id} ${w.title} (${statusText(w)})`),
2798
2862
  );
2799
2863
  if (t.files?.length) lines.push("", "Files:", ...t.files.map((f) => ` ${fileText(f)}`));
2800
2864
  if (t.comments.length)
@@ -3000,7 +3064,9 @@ export async function run(argv, io = {}) {
3000
3064
  messages: "messages",
3001
3065
  digest: "what changed each morning",
3002
3066
  };
3003
- const posts = ["forecast", "health", "notes", "messages", "digest"].filter((k) => r.hook[k]).map((k) => label[k]);
3067
+ const posts = ["forecast", "health", "notes", "messages", "digest"]
3068
+ .filter((k) => r.hook[k])
3069
+ .map((k) => label[k]);
3004
3070
  const lines = [
3005
3071
  `${r.program} posts to ${r.hook.service} (${r.hook.hint}): ${posts.length ? posts.join(", ") : "nothing yet; --on forecast,health,notes,messages,digest turns posts on"}.`,
3006
3072
  ];
@@ -3021,7 +3087,19 @@ export async function run(argv, io = {}) {
3021
3087
  const { positionals, values, harbor } = parse(
3022
3088
  spec(
3023
3089
  ["over-limit", "dry-run", "literal", "unless-exists"],
3024
- ["project", "assignee", "also", "due", "starts", "priority", "status", "comment", "template", "parent", "milestone"],
3090
+ [
3091
+ "project",
3092
+ "assignee",
3093
+ "also",
3094
+ "due",
3095
+ "starts",
3096
+ "priority",
3097
+ "status",
3098
+ "comment",
3099
+ "template",
3100
+ "parent",
3101
+ "milestone",
3102
+ ],
3025
3103
  ),
3026
3104
  );
3027
3105
  // A subtask goes in its parent's project.
@@ -3051,9 +3129,16 @@ export async function run(argv, io = {}) {
3051
3129
  );
3052
3130
  // Plain words, as on the website: @person, by Friday, !high, #Project.
3053
3131
  // --literal keeps every title exactly as typed.
3054
- const reads = values.literal || fromTemplate
3055
- ? titles.map((title) => ({ title, owner: null, due: null, priority: null, project: null }))
3056
- : await readTitles(client, harbor, titles, values);
3132
+ const reads =
3133
+ values.literal || fromTemplate
3134
+ ? titles.map((title) => ({
3135
+ title,
3136
+ owner: null,
3137
+ due: null,
3138
+ priority: null,
3139
+ project: null,
3140
+ }))
3141
+ : await readTitles(client, harbor, titles, values);
3057
3142
  // No --project and no #Project: the harbor's one open project, if that's all there is.
3058
3143
  if (!values.project && !reads.every((r) => r.project))
3059
3144
  values.project = await onlyProject(client, harbor, "--project NAME or #NAME in the title");
@@ -3101,7 +3186,8 @@ export async function run(argv, io = {}) {
3101
3186
  const preview = await client
3102
3187
  .call("preview_tasks", { harbor, tasks: reads.map(argsFor) })
3103
3188
  .catch((err) => {
3104
- if (err instanceof HarborError) throw new HarborError(hint(err.message, values.project));
3189
+ if (err instanceof HarborError)
3190
+ throw new HarborError(hint(err.message, values.project));
3105
3191
  throw err;
3106
3192
  });
3107
3193
  // --literal: what the words would have read as, so it's plain what it kept.
@@ -3155,10 +3241,14 @@ export async function run(argv, io = {}) {
3155
3241
  return [
3156
3242
  ` ${l.title}${l.skipped ? " (already there, skipped)" : ""}`,
3157
3243
  ` ${bits.join(" · ")}`,
3158
- ...(wordsLine(words) ? [` ${wordsLine(words)} --literal keeps them in the title.`] : []),
3244
+ ...(wordsLine(words)
3245
+ ? [` ${wordsLine(words)} --literal keeps them in the title.`]
3246
+ : []),
3159
3247
  ...nobodyLines(words).map((x) => ` ${x}`),
3160
3248
  ...(l.keptWords
3161
- ? [` --literal kept the words as typed. ${wordsLine(unread[i]).replace("Read from your words", "Without it, they'd read as")}`]
3249
+ ? [
3250
+ ` --literal kept the words as typed. ${wordsLine(unread[i]).replace("Read from your words", "Without it, they'd read as")}`,
3251
+ ]
3162
3252
  : []),
3163
3253
  ...(l.comment ? [` with your comment: ${l.comment}`] : []),
3164
3254
  ...(l.sameAs && !l.skipped
@@ -3181,15 +3271,13 @@ export async function run(argv, io = {}) {
3181
3271
  }
3182
3272
  const added = [];
3183
3273
  for (const [i, words] of reads.entries()) {
3184
- const r = await client
3185
- .call("create_task", { harbor, ...argsFor(words) })
3186
- .catch((err) => {
3187
- if (err instanceof HarborError) {
3188
- const done = added.length ? ` (added ${added.length} before it)` : "";
3189
- throw new HarborError(`${hint(err.message, projectOf(words))}${done}`);
3190
- }
3191
- throw err;
3192
- });
3274
+ const r = await client.call("create_task", { harbor, ...argsFor(words) }).catch((err) => {
3275
+ if (err instanceof HarborError) {
3276
+ const done = added.length ? ` (added ${added.length} before it)` : "";
3277
+ throw new HarborError(`${hint(err.message, projectOf(words))}${done}`);
3278
+ }
3279
+ throw err;
3280
+ });
3193
3281
  // --unless-exists found it open already: nothing added, no comment.
3194
3282
  if (r.existing) {
3195
3283
  added.push(r);
@@ -3218,7 +3306,11 @@ export async function run(argv, io = {}) {
3218
3306
  if (asJson) {
3219
3307
  const tasks = added.map((r, i) =>
3220
3308
  r.existing
3221
- ? { ...taskEntry(r.existing, titles[i]), sameAs: r.existing.key ?? r.existing.id, skipped: true }
3309
+ ? {
3310
+ ...taskEntry(r.existing, titles[i]),
3311
+ sameAs: r.existing.key ?? r.existing.id,
3312
+ skipped: true,
3313
+ }
3222
3314
  : {
3223
3315
  ...taskEntry(r.created, titles[i]),
3224
3316
  ...(values.template ? { template: values.template } : {}),
@@ -3241,8 +3333,7 @@ export async function run(argv, io = {}) {
3241
3333
  ...(made.length === 1 && added.length === 1 ? { created: made[0].created } : {}),
3242
3334
  }),
3243
3335
  );
3244
- }
3245
- else
3336
+ } else
3246
3337
  out(
3247
3338
  plain(
3248
3339
  added
@@ -3250,20 +3341,26 @@ export async function run(argv, io = {}) {
3250
3341
  r.existing
3251
3342
  ? `Already there, not added again: ${taskLine(r.existing, opts)}`
3252
3343
  : [
3253
- `Added: ${taskLine(r.created, opts)}${r.comment ? ", with your comment" : ""}`,
3254
- // What the title's words said, so nothing is read without being seen.
3255
- ...(r.read
3256
- ? [
3257
- `You typed “${r.read.typed}”. ${wordsLine(reads[added.indexOf(r)])} --literal keeps the words in the title.`,
3258
- ]
3259
- : []),
3260
- ...nobodyLines({ nobody: r.unknownPeople }),
3261
- // --due in words ("next friday"): the day it became, weekday and all.
3262
- ...(dueWords(values.due) ? [`--due ${values.due}: ${dayWithWeekday(dueDate(values.due))}.`] : []),
3263
- // Pilot speaks up only when a date was given that the queue says won't hold.
3264
- ...(values.due ? pilotLines(r, r.created) : []),
3265
- ...(r.created.milestone ? [`Toward the milestone ${r.created.milestone}.`] : []),
3266
- ...(r.milestoneReopened ? [`${r.milestoneReopened} is open again: it has an open task now.`] : []),
3344
+ `Added: ${taskLine(r.created, opts)}${r.comment ? ", with your comment" : ""}`,
3345
+ // What the title's words said, so nothing is read without being seen.
3346
+ ...(r.read
3347
+ ? [
3348
+ `You typed “${r.read.typed}”. ${wordsLine(reads[added.indexOf(r)])} --literal keeps the words in the title.`,
3349
+ ]
3350
+ : []),
3351
+ ...nobodyLines({ nobody: r.unknownPeople }),
3352
+ // --due in words ("next friday"): the day it became, weekday and all.
3353
+ ...(dueWords(values.due)
3354
+ ? [`--due ${values.due}: ${dayWithWeekday(dueDate(values.due))}.`]
3355
+ : []),
3356
+ // Pilot speaks up only when a date was given that the queue says won't hold.
3357
+ ...(values.due ? pilotLines(r, r.created) : []),
3358
+ ...(r.created.milestone
3359
+ ? [`Toward the milestone ${r.created.milestone}.`]
3360
+ : []),
3361
+ ...(r.milestoneReopened
3362
+ ? [`${r.milestoneReopened} is open again: it has an open task now.`]
3363
+ : []),
3267
3364
  ].join("\n"),
3268
3365
  )
3269
3366
  .join("\n"),
@@ -3330,8 +3427,12 @@ export async function run(argv, io = {}) {
3330
3427
  [
3331
3428
  `${r.updated.title}: ${r.reopened ? "reopened, " : ""}${{ doing: "started", review: "in review", done: "done" }[status]}.`,
3332
3429
  r.queuedNext ? `Next one: ${taskLine(r.queuedNext, opts)}` : "",
3333
- r.milestoneReached ? `That was the last of its tasks: ${r.milestoneReached} is reached.` : "",
3334
- r.milestoneReopened ? `${r.milestoneReopened} is open again: one of its tasks is open.` : "",
3430
+ r.milestoneReached
3431
+ ? `That was the last of its tasks: ${r.milestoneReached} is reached.`
3432
+ : "",
3433
+ r.milestoneReopened
3434
+ ? `${r.milestoneReopened} is open again: one of its tasks is open.`
3435
+ : "",
3335
3436
  r.projectFinished
3336
3437
  ? `That was the last open task in ${r.projectFinished}. Mark the project Done in the app (harbor) or on the website.`
3337
3438
  : "",
@@ -3411,8 +3512,12 @@ export async function run(argv, io = {}) {
3411
3512
  ? `Toward the milestone ${r.updated.milestone}.`
3412
3513
  : "Not tied to a milestone now."
3413
3514
  : null,
3414
- r.milestoneReached ? `That was the last of its tasks: ${r.milestoneReached} is reached.` : null,
3415
- r.milestoneReopened ? `${r.milestoneReopened} is open again: one of its tasks is open.` : null,
3515
+ r.milestoneReached
3516
+ ? `That was the last of its tasks: ${r.milestoneReached} is reached.`
3517
+ : null,
3518
+ r.milestoneReopened
3519
+ ? `${r.milestoneReopened} is open again: one of its tasks is open.`
3520
+ : null,
3416
3521
  values.also !== undefined
3417
3522
  ? r.updated.alsoOn?.length
3418
3523
  ? `Also on it: ${r.updated.alsoOn.join(", ")}.`
@@ -3527,7 +3632,10 @@ export async function run(argv, io = {}) {
3527
3632
  let zone = values.zone;
3528
3633
  if (zone?.toLowerCase() === "here") {
3529
3634
  zone = Intl.DateTimeFormat().resolvedOptions().timeZone;
3530
- if (!zone) throw new HarborError("This machine doesn't say its time zone. Give one, like --zone Europe/London.");
3635
+ if (!zone)
3636
+ throw new HarborError(
3637
+ "This machine doesn't say its time zone. Give one, like --zone Europe/London.",
3638
+ );
3531
3639
  }
3532
3640
  let starts;
3533
3641
  let ends;
@@ -3536,13 +3644,10 @@ export async function run(argv, io = {}) {
3536
3644
  if (!m) throw new HarborError("--hours is a start and an end, like 9-17 or 8:30-16:30.");
3537
3645
  [, starts, ends] = m;
3538
3646
  }
3539
- return call(
3540
- "set_clock",
3541
- { harbor, person: who || "me", zone, starts, ends },
3542
- (r) =>
3543
- r.zone
3544
- ? `${r.person}: ${r.zone.replace(/_/g, " ")}, ${r.hours} on weekdays. ${r.working ? `Working now (${r.localTime} there).` : (r.picksUp ?? "")}`.trim()
3545
- : `${r.person} has no time zone now.`,
3647
+ return call("set_clock", { harbor, person: who || "me", zone, starts, ends }, (r) =>
3648
+ r.zone
3649
+ ? `${r.person}: ${r.zone.replace(/_/g, " ")}, ${r.hours} on weekdays. ${r.working ? `Working now (${r.localTime} there).` : (r.picksUp ?? "")}`.trim()
3650
+ : `${r.person} has no time zone now.`,
3546
3651
  );
3547
3652
  }
3548
3653
  case "checkin": {
@@ -3670,7 +3775,11 @@ export async function run(argv, io = {}) {
3670
3775
  const plan = { ...drafted.plan, ...(values.ends ? { ends: dueDate(values.ends) } : {}) };
3671
3776
  if (values.add) {
3672
3777
  const result = await client.call("add_plan", { ...where, ...plan });
3673
- out(asJson ? jsonText({ drafted, ...result }) : plain(`${draftText(drafted)}\n\n${result.added.says}`));
3778
+ out(
3779
+ asJson
3780
+ ? jsonText({ drafted, ...result })
3781
+ : plain(`${draftText(drafted)}\n\n${result.added.says}`),
3782
+ );
3674
3783
  return 0;
3675
3784
  }
3676
3785
  await writeLastDraft({ where, plan }, env);
@@ -4015,7 +4124,9 @@ export async function run(argv, io = {}) {
4015
4124
  const { positionals, harbor } = parse(spec());
4016
4125
  const [task, field, ...value] = positionals;
4017
4126
  if (!task || !field)
4018
- throw new HarborError('Give a task, a field and a value, like harbor field RR-4 Size L (or "" to clear).');
4127
+ throw new HarborError(
4128
+ 'Give a task, a field and a value, like harbor field RR-4 Size L (or "" to clear).',
4129
+ );
4019
4130
  return call("set_field", { harbor, task, field, value: value.join(" ") }, (r) => {
4020
4131
  const name = r.set.key ?? r.set.title;
4021
4132
  const said = Object.entries(r.set.fields ?? {}).find(
@@ -4061,7 +4172,8 @@ export async function run(argv, io = {}) {
4061
4172
  ),
4062
4173
  );
4063
4174
  const name = text(positionals, "the milestone");
4064
- if (values.reached && values.open) throw new HarborError("Say --reached or --open, not both.");
4175
+ if (values.reached && values.open)
4176
+ throw new HarborError("Say --reached or --open, not both.");
4065
4177
  const changes =
4066
4178
  values.new ||
4067
4179
  values.reached ||
@@ -4070,10 +4182,16 @@ export async function run(argv, io = {}) {
4070
4182
  ["due", "rename", "signs-off", "changes"].some((k) => values[k] !== undefined);
4071
4183
  if (!changes) {
4072
4184
  // Reading one: the program's (or harbor's) milestones, reached ones too.
4073
- const r = await client.call("list_milestones", { harbor, program: values.program, done: true });
4185
+ const r = await client.call("list_milestones", {
4186
+ harbor,
4187
+ program: values.program,
4188
+ done: true,
4189
+ });
4074
4190
  const want = name.toLowerCase();
4075
4191
  const same = r.milestones.filter((m) => m.name.toLowerCase() === want);
4076
- const near = same.length ? same : r.milestones.filter((m) => m.name.toLowerCase().includes(want));
4192
+ const near = same.length
4193
+ ? same
4194
+ : r.milestones.filter((m) => m.name.toLowerCase().includes(want));
4077
4195
  if (near.length !== 1)
4078
4196
  throw new HarborError(
4079
4197
  near.length
@@ -4098,14 +4216,32 @@ export async function run(argv, io = {}) {
4098
4216
  approve: values.approve || undefined,
4099
4217
  changes: values.changes,
4100
4218
  },
4101
- (r) => (r.added ? `Added to ${r.added.program}: ${milestoneLine(r.added, { program: false })}` : milestoneLine(r.milestone)),
4219
+ (r) =>
4220
+ r.added
4221
+ ? `Added to ${r.added.program}: ${milestoneLine(r.added, { program: false })}`
4222
+ : milestoneLine(r.milestone),
4102
4223
  );
4103
4224
  }
4104
4225
  case "goal": {
4105
4226
  const { positionals, values, harbor } = parse(
4106
4227
  spec(
4107
4228
  ["new"],
4108
- ["portfolio", "title", "owner", "due", "starts", "why", "link", "unlink", "kr", "at", "target", "start", "unit", "counts"],
4229
+ [
4230
+ "portfolio",
4231
+ "title",
4232
+ "owner",
4233
+ "due",
4234
+ "starts",
4235
+ "why",
4236
+ "link",
4237
+ "unlink",
4238
+ "kr",
4239
+ "at",
4240
+ "target",
4241
+ "start",
4242
+ "unit",
4243
+ "counts",
4244
+ ],
4109
4245
  ),
4110
4246
  );
4111
4247
  const ref = text(positionals, "the goal");
@@ -4124,10 +4260,20 @@ export async function run(argv, io = {}) {
4124
4260
  .map((x) => x.trim())
4125
4261
  .filter(Boolean);
4126
4262
  const day = (flag) =>
4127
- values[flag] === undefined ? undefined : /^none$/i.test(values[flag]) ? "none" : dueDate(values[flag]);
4263
+ values[flag] === undefined
4264
+ ? undefined
4265
+ : /^none$/i.test(values[flag])
4266
+ ? "none"
4267
+ : dueDate(values[flag]);
4128
4268
  if (values.new) {
4129
- if (values.kr && (values.at !== undefined || values.counts === undefined) && values.target === undefined)
4130
- throw new HarborError("A new number key result needs --target N (or --counts WORK for work).");
4269
+ if (
4270
+ values.kr &&
4271
+ (values.at !== undefined || values.counts === undefined) &&
4272
+ values.target === undefined
4273
+ )
4274
+ throw new HarborError(
4275
+ "A new number key result needs --target N (or --counts WORK for work).",
4276
+ );
4131
4277
  return call(
4132
4278
  "set_goal",
4133
4279
  {
@@ -4141,16 +4287,28 @@ export async function run(argv, io = {}) {
4141
4287
  ? [
4142
4288
  values.counts !== undefined
4143
4289
  ? { title: values.kr, kind: "work", counts: list("counts") }
4144
- : { title: values.kr, kind: "number", start: num("start"), target: num("target"), unit: values.unit },
4290
+ : {
4291
+ title: values.kr,
4292
+ kind: "number",
4293
+ start: num("start"),
4294
+ target: num("target"),
4295
+ unit: values.unit,
4296
+ },
4145
4297
  ]
4146
4298
  : [],
4147
4299
  },
4148
- (r) => `Set on ${r.goal.portfolio}: ${r.goal.title} (${r.goal.progress}).${r.goal.keyResults.length ? "" : ` Add a key result with harbor goal "${r.goal.title}" --kr "TITLE" --target N.`}`,
4300
+ (r) =>
4301
+ `Set on ${r.goal.portfolio}: ${r.goal.title} (${r.goal.progress}).${r.goal.keyResults.length ? "" : ` Add a key result with harbor goal "${r.goal.title}" --kr "TITLE" --target N.`}`,
4149
4302
  );
4150
4303
  }
4151
4304
  // The goal as Harbor has it, for its id and key results.
4152
- const goals = await client.call("list_goals", { harbor, ...(values.portfolio ? { portfolio: values.portfolio } : {}) });
4153
- const all = (goals.portfolios ?? []).flatMap((pf) => (pf.goals ?? []).map((g) => ({ pf, g })));
4305
+ const goals = await client.call("list_goals", {
4306
+ harbor,
4307
+ ...(values.portfolio ? { portfolio: values.portfolio } : {}),
4308
+ });
4309
+ const all = (goals.portfolios ?? []).flatMap((pf) =>
4310
+ (pf.goals ?? []).map((g) => ({ pf, g })),
4311
+ );
4154
4312
  const want = ref.trim().toLowerCase();
4155
4313
  const exact = all.filter((x) => x.g.title.trim().toLowerCase() === want || x.g.id === ref);
4156
4314
  const near = exact.length ? exact : all.filter((x) => x.g.title.toLowerCase().includes(want));
@@ -4161,12 +4319,17 @@ export async function run(argv, io = {}) {
4161
4319
  : `No goal matches "${ref}".${all.length ? ` harbor goals lists them.` : ` Set one with harbor goal "TITLE" --new.`}`,
4162
4320
  );
4163
4321
  const { pf, g } = near[0];
4164
- const edits = ["title", "owner", "due", "starts", "why", "link", "unlink"].some((k) => values[k] !== undefined);
4322
+ const edits = ["title", "owner", "due", "starts", "why", "link", "unlink"].some(
4323
+ (k) => values[k] !== undefined,
4324
+ );
4165
4325
  if (!values.kr && !edits) {
4166
4326
  out(asJson ? jsonText({ goal: g, portfolio: pf.name }) : plain(goalText(g, pf.name)));
4167
4327
  return 0;
4168
4328
  }
4169
- if (!values.kr && ["at", "target", "start", "unit", "counts"].some((k) => values[k] !== undefined))
4329
+ if (
4330
+ !values.kr &&
4331
+ ["at", "target", "start", "unit", "counts"].some((k) => values[k] !== undefined)
4332
+ )
4170
4333
  throw new HarborError('Say which key result with --kr "TITLE".');
4171
4334
  const results = [];
4172
4335
  if (edits)
@@ -4184,7 +4347,9 @@ export async function run(argv, io = {}) {
4184
4347
  }),
4185
4348
  );
4186
4349
  if (values.kr) {
4187
- const kr = g.keyResults.find((k) => k.title.trim().toLowerCase() === values.kr.trim().toLowerCase());
4350
+ const kr = g.keyResults.find(
4351
+ (k) => k.title.trim().toLowerCase() === values.kr.trim().toLowerCase(),
4352
+ );
4188
4353
  const shape = ["target", "start", "unit"].some((k) => values[k] !== undefined);
4189
4354
  if (!kr) {
4190
4355
  if (values.at !== undefined && !shape)
@@ -4192,7 +4357,9 @@ export async function run(argv, io = {}) {
4192
4357
  `"${g.title}" has no key result "${values.kr}"${g.keyResults.length ? ` (it has ${g.keyResults.map((k) => `"${k.title}"`).join(", ")})` : ""}. --target N adds one.`,
4193
4358
  );
4194
4359
  if (values.counts === undefined && values.target === undefined)
4195
- throw new HarborError("A new key result needs --target N for a number, or --counts WORK to count work.");
4360
+ throw new HarborError(
4361
+ "A new key result needs --target N for a number, or --counts WORK to count work.",
4362
+ );
4196
4363
  results.push(
4197
4364
  await client.call("set_goal", {
4198
4365
  harbor,
@@ -4201,7 +4368,13 @@ export async function run(argv, io = {}) {
4201
4368
  keyResults: [
4202
4369
  values.counts !== undefined
4203
4370
  ? { title: values.kr, kind: "work", counts: list("counts") }
4204
- : { title: values.kr, kind: "number", start: num("start"), target: num("target"), unit: values.unit },
4371
+ : {
4372
+ title: values.kr,
4373
+ kind: "number",
4374
+ start: num("start"),
4375
+ target: num("target"),
4376
+ unit: values.unit,
4377
+ },
4205
4378
  ],
4206
4379
  }),
4207
4380
  );
@@ -4211,7 +4384,12 @@ export async function run(argv, io = {}) {
4211
4384
  await client.call("edit_goal", {
4212
4385
  harbor,
4213
4386
  goal: g.id,
4214
- keyResult: { ref: kr.id, start: num("start"), target: num("target"), unit: values.unit },
4387
+ keyResult: {
4388
+ ref: kr.id,
4389
+ start: num("start"),
4390
+ target: num("target"),
4391
+ unit: values.unit,
4392
+ },
4215
4393
  ...(values.counts !== undefined ? { link: list("counts") } : {}),
4216
4394
  }),
4217
4395
  );
@@ -4219,11 +4397,18 @@ export async function run(argv, io = {}) {
4219
4397
  if (kr.kind !== "number")
4220
4398
  throw new HarborError(`"${kr.title}" counts work, so it moves as its tasks finish.`);
4221
4399
  results.push(
4222
- await client.call("update_key_result", { harbor, goal: g.id, keyResult: kr.id, value: num("at") }),
4400
+ await client.call("update_key_result", {
4401
+ harbor,
4402
+ goal: g.id,
4403
+ keyResult: kr.id,
4404
+ value: num("at"),
4405
+ }),
4223
4406
  );
4224
4407
  }
4225
4408
  if (values.at === undefined && !shape && values.counts === undefined)
4226
- throw new HarborError(`Say what to do with "${kr.title}": --at N, or --target N to change its numbers.`);
4409
+ throw new HarborError(
4410
+ `Say what to do with "${kr.title}": --at N, or --target N to change its numbers.`,
4411
+ );
4227
4412
  }
4228
4413
  }
4229
4414
  const last = results.at(-1);
@@ -4310,7 +4495,11 @@ export async function run(argv, io = {}) {
4310
4495
  throw new HarborError("--hours is a whole number from 1 to 168.");
4311
4496
  return call(
4312
4497
  "daily_digest",
4313
- { harbor, ...(values.program ? { program: values.program } : {}), ...(hours ? { hours } : {}) },
4498
+ {
4499
+ harbor,
4500
+ ...(values.program ? { program: values.program } : {}),
4501
+ ...(hours ? { hours } : {}),
4502
+ },
4314
4503
  (r) => digestText(r, hours),
4315
4504
  );
4316
4505
  }
@@ -4373,9 +4562,11 @@ export async function run(argv, io = {}) {
4373
4562
  const body = words.join(" ").trim();
4374
4563
  if (values.edit !== undefined || values.message !== undefined) {
4375
4564
  const edit = (values.edit ?? "").trim() || body;
4376
- if (!edit) throw new HarborError('Say the new words: harbor messages "NAME" --edit "TEXT".');
4565
+ if (!edit)
4566
+ throw new HarborError('Say the new words: harbor messages "NAME" --edit "TEXT".');
4377
4567
  if (values.edit && body) throw new HarborError("Give the new words once, after --edit.");
4378
- if (values.limit) throw new HarborError("--limit is for reading; leave it off when you edit.");
4568
+ if (values.limit)
4569
+ throw new HarborError("--limit is for reading; leave it off when you edit.");
4379
4570
  return call(
4380
4571
  "edit_message",
4381
4572
  { harbor, project, body: edit, ...(values.message ? { message: values.message } : {}) },
@@ -4411,10 +4602,11 @@ export async function run(argv, io = {}) {
4411
4602
  throw new HarborError(
4412
4603
  "--task, --project, --program and --reply are for the talk on the work, not direct messages.",
4413
4604
  );
4414
- const who = ats.length
4415
- ? { harbor, with: ats.join(",") }
4416
- : { harbor, chat: positionals[0] };
4417
- const text = positionals.slice(ats.length || 1).join(" ").trim();
4605
+ const who = ats.length ? { harbor, with: ats.join(",") } : { harbor, chat: positionals[0] };
4606
+ const text = positionals
4607
+ .slice(ats.length || 1)
4608
+ .join(" ")
4609
+ .trim();
4418
4610
  const call = (name, args) =>
4419
4611
  client.call(name, { ...who, ...args }).catch((err) => {
4420
4612
  if (err instanceof HarborError) throw new HarborError(hint(err.message));
@@ -4467,7 +4659,8 @@ export async function run(argv, io = {}) {
4467
4659
  wait = CHAT_POLL_MS;
4468
4660
  out(" (sent)");
4469
4661
  },
4470
- (err) => out(plain(` Not sent: ${err instanceof Error ? err.message : String(err)}`)),
4662
+ (err) =>
4663
+ out(plain(` Not sent: ${err instanceof Error ? err.message : String(err)}`)),
4471
4664
  );
4472
4665
  });
4473
4666
  }
@@ -4522,22 +4715,32 @@ export async function run(argv, io = {}) {
4522
4715
  throw err;
4523
4716
  });
4524
4717
  if (body && !values.watch) {
4525
- if (values.limit) throw new HarborError("--limit is for reading; leave it off when you write.");
4718
+ if (values.limit)
4719
+ throw new HarborError("--limit is for reading; leave it off when you write.");
4526
4720
  const r = await post(body, values.reply);
4527
4721
  if (asJson) {
4528
4722
  out(jsonText(r));
4529
4723
  return 0;
4530
4724
  }
4531
4725
  const m = r.posted.message;
4532
- const what = m.replyTo ? `Replied to [${m.replyTo}]` : r.posted.kind === "task" ? "Commented" : `Posted [${m.n}]`;
4533
- out(plain(`${what} on ${chatWhere(r.posted)}${r.mentioned?.length ? `; told ${r.mentioned.join(", ")}` : ""}.`));
4726
+ const what = m.replyTo
4727
+ ? `Replied to [${m.replyTo}]`
4728
+ : r.posted.kind === "task"
4729
+ ? "Commented"
4730
+ : `Posted [${m.n}]`;
4731
+ out(
4732
+ plain(
4733
+ `${what} on ${chatWhere(r.posted)}${r.mentioned?.length ? `; told ${r.mentioned.join(", ")}` : ""}.`,
4734
+ ),
4735
+ );
4534
4736
  return 0;
4535
4737
  }
4536
4738
  if (values.reply && !body) throw new HarborError("--reply goes with the words to post.");
4537
- const read = (n) => client.call("read_chat", { ...where, limit: n }).catch((err) => {
4538
- if (err instanceof HarborError) throw new HarborError(hint(err.message));
4539
- throw err;
4540
- });
4739
+ const read = (n) =>
4740
+ client.call("read_chat", { ...where, limit: n }).catch((err) => {
4741
+ if (err instanceof HarborError) throw new HarborError(hint(err.message));
4742
+ throw err;
4743
+ });
4541
4744
  if (!values.watch) {
4542
4745
  const r = await read(limit ?? 50);
4543
4746
  out(asJson ? jsonText(r) : plain(chatText(r, quoted)));
@@ -4583,7 +4786,7 @@ export async function run(argv, io = {}) {
4583
4786
  }
4584
4787
  const reply = /^\/r(?:eply)?\s+(\d+)\s+([\s\S]+)$/.exec(text);
4585
4788
  if (/^\/r(?:eply)?\b/.test(text) && !reply) {
4586
- out('To reply: /r N text, where N is the message\'s number in [ ].');
4789
+ out("To reply: /r N text, where N is the message's number in [ ].");
4587
4790
  return;
4588
4791
  }
4589
4792
  post(reply ? reply[2] : text, reply ? reply[1] : undefined).then(
@@ -4592,7 +4795,8 @@ export async function run(argv, io = {}) {
4592
4795
  delay = CHAT_POLL_MS;
4593
4796
  out(plain(` (posted${r.posted.message.n ? ` as [${r.posted.message.n}]` : ""})`));
4594
4797
  },
4595
- (err) => out(plain(` Not posted: ${err instanceof Error ? err.message : String(err)}`)),
4798
+ (err) =>
4799
+ out(plain(` Not posted: ${err instanceof Error ? err.message : String(err)}`)),
4596
4800
  );
4597
4801
  });
4598
4802
  }
@@ -4704,7 +4908,9 @@ export async function run(argv, io = {}) {
4704
4908
  throw new HarborError(`--why goes with scuttling: harbor scuttle PROJECT --why "TEXT".`);
4705
4909
  const project = one(rest, "project");
4706
4910
  if (first === "sail" && (values.end !== undefined || values.note !== undefined))
4707
- throw new HarborError("--end and --note go with a refit: harbor scuttle refit PROJECT --end DATE.");
4911
+ throw new HarborError(
4912
+ "--end and --note go with a refit: harbor scuttle refit PROJECT --end DATE.",
4913
+ );
4708
4914
  if (first === "refit" && values.end === undefined && values.note === undefined)
4709
4915
  throw new HarborError('A refit needs --end DATE or --note "what changes".');
4710
4916
  return call(
@@ -4806,7 +5012,8 @@ export async function run(argv, io = {}) {
4806
5012
  const portfolio = text(positionals, "which portfolio");
4807
5013
  if (values.clear && values.order !== undefined)
4808
5014
  throw new HarborError("--order or --clear, not both.");
4809
- if (values.clear) return call("set_dock_order", { harbor, portfolio, clear: true }, setRankText);
5015
+ if (values.clear)
5016
+ return call("set_dock_order", { harbor, portfolio, clear: true }, setRankText);
4810
5017
  if (values.order !== undefined) {
4811
5018
  const projects = values.order
4812
5019
  .split(",")
@@ -4847,7 +5054,8 @@ export async function run(argv, io = {}) {
4847
5054
  'Say what for and the line: harbor thanks RR-42 "Caught it before launch" (or --milestone NAME, --decision TITLE).',
4848
5055
  );
4849
5056
  }
4850
- if (!line) throw new HarborError('Add the line of thanks in quotes: harbor thanks RR-42 "Thank you".');
5057
+ if (!line)
5058
+ throw new HarborError('Add the line of thanks in quotes: harbor thanks RR-42 "Thank you".');
4851
5059
  return call(
4852
5060
  "give_thanks",
4853
5061
  {
@@ -4897,8 +5105,47 @@ export async function run(argv, io = {}) {
4897
5105
  },
4898
5106
  );
4899
5107
  }
5108
+ case "agents": {
5109
+ const { positionals, values, harbor } = parse(spec([], ["agent", "project"]));
5110
+ none(positionals);
5111
+ return call(
5112
+ "agents_overview",
5113
+ { harbor, agent: values.agent, project: values.project },
5114
+ agentsText,
5115
+ );
5116
+ }
4900
5117
  case "agent": {
4901
- const { positionals, values, harbor } = parse(spec(["start"], ["agent"]));
5118
+ const { positionals, values, harbor } = parse(
5119
+ spec(["start"], ["agent", "project", "note", "link"]),
5120
+ );
5121
+ if (positionals[0] === "log") {
5122
+ const title = positionals.slice(1).join(" ").trim();
5123
+ const note = (values.note ?? "").trim();
5124
+ if (!title || !note)
5125
+ throw new HarborError(
5126
+ 'Give a title and what the agent did: harbor agent log "Rebuilt the pricing page" --note "Moved the plans into one table".',
5127
+ );
5128
+ // In a repository that ran harbor init, the work goes to that project.
5129
+ const plan = values.project ? null : repoPlanConfig(io.cwd ?? process.cwd());
5130
+ const project = values.project ?? plan?.project?.id;
5131
+ if (!project)
5132
+ throw new HarborError(
5133
+ 'Say which project: harbor agent log "TITLE" --note "TEXT" --project NAME (or run it in a folder that ran harbor init).',
5134
+ );
5135
+ return call(
5136
+ "agent_report",
5137
+ {
5138
+ harbor: harbor ?? plan?.harbor?.id,
5139
+ project,
5140
+ title,
5141
+ note,
5142
+ link: values.link,
5143
+ agent: values.agent,
5144
+ },
5145
+ (r) =>
5146
+ `${r.created.key ?? r.created.title} is in review for a person to check, with ${r.commentedAs}'s note.${r.toCheck ? ` ${r.toCheck}` : ""}`,
5147
+ );
5148
+ }
4902
5149
  if (positionals[0] !== "report") {
4903
5150
  none(positionals);
4904
5151
  return call("agent_work", { harbor, agent: values.agent }, agentWorkText);