@harborppm/cli 0.77.0 → 0.78.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
@@ -215,6 +215,7 @@ harbor voyage PROJECT ["YOUR LINE"]
215
215
  harbor note PROJECT ["NOTE"] [--opens DATE|--milestone NAME|--off-track]
216
216
  harbor sound TASK [--answer DAYS|--ask NAMES|--settle DAYS] [--why TEXT]
217
217
  harbor soundings [PROJECT]
218
+ harbor goals [PORTFOLIO] each portfolio's goals, off track first
218
219
  harbor ashore [--weeks N] [--country CODES|none] [--person NAME]
219
220
  harbor limit PROJECT [COLUMN N|none]
220
221
  harbor week [--next|--last|--week DATE] [--review]
@@ -256,7 +257,7 @@ A task has one owner (`--assignee`), who answers for it and whose load it counts
256
257
 
257
258
  `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.
258
259
 
259
- `harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor 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.
260
+ `harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor goals` lists each portfolio's goals (set on the portfolio's page on the website), off track first, with each key result's progress. `harbor ashore` lists the public holidays and time away in the next eight weeks; `--country US,GB` sets whose holidays the harbor takes and `--person NAME --country DE` one person's own, which the forecast and the weekly load then count as days off.
260
261
 
261
262
  `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.
262
263
 
package/dist/app.mjs CHANGED
@@ -13219,6 +13219,7 @@ const PAGES = {
13219
13219
  programs: "/programs",
13220
13220
  projects: "/projects",
13221
13221
  risks: "/risks",
13222
+ goals: "/goals",
13222
13223
  calendar: "/calendar",
13223
13224
  people: "/people"
13224
13225
  };
@@ -13662,6 +13663,87 @@ function entriesNewestFirst(task) {
13662
13663
  return [...task.time ?? []].sort((a, b) => (b.on + b.at).localeCompare(a.on + a.at));
13663
13664
  }
13664
13665
 
13666
+ // src/lib/goals.ts
13667
+ init_indexes();
13668
+ const GOAL_STATUS_LABEL = {
13669
+ achieved: "Achieved",
13670
+ "on-track": "On track",
13671
+ "at-risk": "At risk",
13672
+ "off-track": "Off track",
13673
+ "not-started": "Not started"
13674
+ };
13675
+ const clamp = (n) => Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 0;
13676
+ /** The projects a work key result counts: those it names, and every project in a program it names. */
13677
+ function linkedProjects(kr, projects) {
13678
+ const ids = new Set(kr.linkIds ?? []);
13679
+ if (ids.size === 0) return [];
13680
+ return projects.filter((p) => ids.has(p.id) || ids.has(p.programId));
13681
+ }
13682
+ /** How far along one key result is, 0 to 1. */
13683
+ function keyResultProgress(kr, work) {
13684
+ if (kr.kind === "number") {
13685
+ const start = kr.start ?? 0;
13686
+ const span = (kr.target ?? 0) - start;
13687
+ if (span === 0) return (kr.current ?? start) >= (kr.target ?? 0) ? 1 : 0;
13688
+ return clamp(((kr.current ?? start) - start) / span);
13689
+ }
13690
+ let done = 0;
13691
+ let all = 0;
13692
+ for (const p of linkedProjects(kr, work.projects)) for (const t of tasksOf(work.tasks, p.id)) {
13693
+ all++;
13694
+ if (t.status === "done") done++;
13695
+ }
13696
+ return all === 0 ? 0 : done / all;
13697
+ }
13698
+ /** How far along a goal is: the average of its key results, 0 to 1. */
13699
+ function goalProgress(goal, work) {
13700
+ const krs = goal.keyResults ?? [];
13701
+ if (krs.length === 0) return 0;
13702
+ return krs.reduce((sum, kr) => sum + keyResultProgress(kr, work), 0) / krs.length;
13703
+ }
13704
+ /** How much of the goal's time has gone by, 0 to 1, from when it was set to its due day. */
13705
+ function timeGone(goal, today) {
13706
+ if (!goal.due) return null;
13707
+ const start = Date.parse(`${goal.createdAt.slice(0, 10)}T00:00:00Z`);
13708
+ const end = Date.parse(`${goal.due}T00:00:00Z`);
13709
+ const now = Date.parse(`${today}T00:00:00Z`);
13710
+ if (!Number.isFinite(start) || !Number.isFinite(end)) return null;
13711
+ if (end <= start) return now >= end ? 1 : 0;
13712
+ return clamp((now - start) / (end - start));
13713
+ }
13714
+ /**
13715
+ * Where a goal stands. Achieved at 100%. Otherwise, with a due day, progress
13716
+ * is held against the share of time gone by: within 10 points is on track,
13717
+ * within 25 at risk, further behind (or past due) off track. Without a due
13718
+ * day, any progress is on track.
13719
+ */
13720
+ function goalStatus(progress, goal, today) {
13721
+ if (progress >= 1) return "achieved";
13722
+ const gone = timeGone(goal, today);
13723
+ if (gone == null) return progress > 0 ? "on-track" : "not-started";
13724
+ if (goal.due && today > goal.due) return "off-track";
13725
+ if (progress === 0 && gone < .1) return "not-started";
13726
+ const behind = gone - progress;
13727
+ if (behind <= .1) return "on-track";
13728
+ if (behind <= .25) return "at-risk";
13729
+ return "off-track";
13730
+ }
13731
+ /** "12 of 40 stores", "8 of 20 tasks done". */
13732
+ function keyResultText(kr, work) {
13733
+ if (kr.kind === "number") {
13734
+ const unit = kr.unit ? ` ${kr.unit}` : "";
13735
+ return `${fmt(kr.current ?? kr.start ?? 0)} of ${fmt(kr.target ?? 0)}${unit}`;
13736
+ }
13737
+ let done = 0;
13738
+ let all = 0;
13739
+ for (const p of linkedProjects(kr, work.projects)) for (const t of tasksOf(work.tasks, p.id)) {
13740
+ all++;
13741
+ if (t.status === "done") done++;
13742
+ }
13743
+ return all === 0 ? "No tasks yet" : `${done} of ${all} tasks done`;
13744
+ }
13745
+ const fmt = (n) => Number.isInteger(n) ? n.toLocaleString("en-US") : String(Math.round(n * 100) / 100);
13746
+
13665
13747
  // node_modules/zod/v4/core/util.js
13666
13748
  function getEnumValues(entries) {
13667
13749
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -21290,6 +21372,54 @@ const HARBOR_TOOLS = [
21290
21372
  };
21291
21373
  }
21292
21374
  }),
21375
+ tool({
21376
+ name: "list_goals",
21377
+ title: "Goals",
21378
+ description: "Each portfolio's goals: what it should achieve by when, who owns it, and its key results (a number someone updates, or work in Harbor counted by finished tasks), with how far along each is and whether the goal is on track for its due day (progress held against the time gone by)." + DATA_NOTE,
21379
+ input: object({
21380
+ harbor: harborArg,
21381
+ portfolio: string().max(200).optional().describe("Portfolio id or name. Default: all.")
21382
+ }),
21383
+ run: (ctx, input) => {
21384
+ const { data } = ctx;
21385
+ const today = todayISO(ctx.now);
21386
+ const people = byId(data.people);
21387
+ const named = byId([...data.programs, ...data.projects]);
21388
+ return { portfolios: (input.portfolio ? [findOne(data.portfolios, input.portfolio, "portfolio")] : data.portfolios).map((pf) => ({
21389
+ id: pf.id,
21390
+ name: pf.name,
21391
+ goals: (pf.goals ?? []).map((g) => {
21392
+ const progress = goalProgress(g, data);
21393
+ const status = goalStatus(progress, g, today);
21394
+ return {
21395
+ id: g.id,
21396
+ title: g.title,
21397
+ owner: g.ownerId ? people.get(g.ownerId)?.name ?? null : null,
21398
+ due: g.due,
21399
+ ...g.why ? { why: g.why } : {},
21400
+ progress: Math.round(progress * 100),
21401
+ status,
21402
+ statusText: GOAL_STATUS_LABEL[status],
21403
+ keyResults: g.keyResults.map((kr) => ({
21404
+ id: kr.id,
21405
+ title: kr.title,
21406
+ kind: kr.kind,
21407
+ text: keyResultText(kr, data),
21408
+ progress: Math.round(keyResultProgress(kr, data) * 100),
21409
+ ...kr.kind === "number" ? {
21410
+ start: kr.start ?? 0,
21411
+ target: kr.target,
21412
+ current: kr.current ?? kr.start ?? 0
21413
+ } : {
21414
+ counts: (kr.linkIds ?? []).map((id) => named.get(id)?.name ?? id),
21415
+ projects: linkedProjects(kr, data.projects).length
21416
+ }
21417
+ }))
21418
+ };
21419
+ })
21420
+ })) };
21421
+ }
21422
+ }),
21293
21423
  tool({
21294
21424
  name: "long_pole",
21295
21425
  title: "What's holding this up",
package/lib/cli.mjs CHANGED
@@ -39,6 +39,7 @@ import {
39
39
  lifeboatsText,
40
40
  followedText,
41
41
  soundingsText,
42
+ goalsText,
42
43
  thanksText,
43
44
  ashoreText,
44
45
  voyageText,
@@ -260,6 +261,8 @@ export const HELP = `harbor: Harbor from the terminal
260
261
  your answer, or read the spread
261
262
  harbor soundings [PROJECT] open tasks with a sounding, and
262
263
  the ones waiting on your answer
264
+ harbor goals [PORTFOLIO] each portfolio's goals, how far
265
+ along and whether on track
263
266
  harbor ashore [--weeks N] [--country CODES|none] [--person NAME]
264
267
  public holidays and time away
265
268
  coming up, and whose holidays
@@ -1010,6 +1013,11 @@ const DETAIL = {
1010
1013
  " these as days nobody works. Countries: AU BR CA DE ES FR GB IE IT MX NL",
1011
1014
  " NZ US (national holidays only).",
1012
1015
  ],
1016
+ goals: [
1017
+ " harbor goals [PORTFOLIO] reads: each portfolio's goals (all when",
1018
+ " left out), off track first, with how far",
1019
+ " along each key result is",
1020
+ ],
1013
1021
  soundings: [
1014
1022
  " harbor soundings [PROJECT] reads: open tasks with a sounding",
1015
1023
  " (all projects when left out), and the",
@@ -3167,6 +3175,13 @@ export async function run(argv, io = {}) {
3167
3175
  soundingsText(r),
3168
3176
  );
3169
3177
  }
3178
+ case "goals": {
3179
+ const { positionals, harbor } = parse(spec());
3180
+ const portfolio = positionals.join(" ").trim();
3181
+ return call("list_goals", { harbor, ...(portfolio ? { portfolio } : {}) }, (r) =>
3182
+ goalsText(r),
3183
+ );
3184
+ }
3170
3185
  case "ashore": {
3171
3186
  const { positionals, values, harbor } = parse(spec([], ["weeks", "country", "person"]));
3172
3187
  none(positionals);
package/lib/format.mjs CHANGED
@@ -1229,3 +1229,29 @@ export function catchupText(r) {
1229
1229
  if (more) out.push("", `${r.handed.length} handed to you in all; harbor catchup --json lists them.`);
1230
1230
  return out.join("\n");
1231
1231
  }
1232
+
1233
+ /** list_goals as text: each portfolio's goals, what needs attention first, with their key results. */
1234
+ export function goalsText(r) {
1235
+ const order = ["off-track", "at-risk", "not-started", "on-track", "achieved"];
1236
+ const withGoals = (r.portfolios ?? []).filter((p) => p.goals?.length);
1237
+ if (!withGoals.length)
1238
+ return "No goals yet. Set one at the top of a portfolio's page on the website.";
1239
+ const lines = [];
1240
+ for (const p of withGoals) {
1241
+ if (lines.length) lines.push("");
1242
+ lines.push(p.name);
1243
+ const goals = [...p.goals].sort(
1244
+ (a, b) =>
1245
+ order.indexOf(a.status) - order.indexOf(b.status) ||
1246
+ (a.due ?? "9999").localeCompare(b.due ?? "9999"),
1247
+ );
1248
+ for (const g of goals) {
1249
+ const bits = [`${g.progress}%`, g.statusText.toLowerCase()];
1250
+ if (g.owner) bits.push(g.owner);
1251
+ if (g.due && g.status !== "achieved") bits.push(`by ${monthDay(g.due)}`);
1252
+ lines.push(` ${g.title} · ${bits.join(" · ")}`);
1253
+ for (const k of g.keyResults) lines.push(` ${k.title} · ${k.text}`);
1254
+ }
1255
+ }
1256
+ return lines.join("\n");
1257
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harborppm/cli",
3
- "version": "0.77.0",
3
+ "version": "0.78.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",