@harborppm/cli 0.109.0 → 0.111.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 +11 -2
- package/dist/app.mjs +427 -41
- package/lib/cli.mjs +155 -1
- package/lib/format.mjs +107 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,12 +37,12 @@ harbor # name your harbor and its first project, and you're in
|
|
|
37
37
|
9. **Calendar**: the month with each day's tasks and milestones; arrows move the day, `[` `]` the month, Enter goes into the day's tasks.
|
|
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
|
-
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;
|
|
40
|
+
12. **Goals** (`G`): each portfolio's goals with how far along they are, off track in red, and their key results. Enter folds a goal open to read why it matters, what each key result counts and who last moved its number, and folds it shut again; it changes nothing, so a viewer can read too. `n` sets a goal; `e` 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; `e` on a number key result moves it; `d` removes the goal or key result.
|
|
41
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
|
|
|
45
|
-
A task changes in place too: title, status, owner, due date (`2026-10-14`, `today`, `+3`), priority, project, what it waits on (type a key or words), how it repeats, notes, checklist steps, comments (`C` changes or takes out one of yours). `s` adds a subtask under it and `T` saves it as one of its project's templates. On a project, `T` starts a task from a template and `M` opens its Messages: one conversation for the whole project, where `n` writes, `e` changes yours and `d` deletes.
|
|
45
|
+
A task changes in place too: title, status, owner, due date (`2026-10-14`, `today`, `+3`), priority, project, what it waits on (type a key or words), how it repeats, notes, checklist steps, comments (`C` changes or takes out one of yours). `s` adds a subtask under it and `T` saves it as one of its project's templates. On a project, `T` starts a task from a template and `M` opens its Messages: one conversation for the whole project, where `n` writes, `a` answers the message in the cursor (the answer sits under it), `e` changes yours and `d` deletes. `M` on a program opens the program's Messages the same way.
|
|
46
46
|
|
|
47
47
|
Keys: `↑↓` (or `j k`) and `←→` (or `h l`) move, Enter opens, Esc goes back, `:` finds anything (a screen, "new project", a project or program by name), `/` finds a task by its key or words, `n` makes something new, `e` changes what's open, `[` `]` move a card a column, `x` marks it done, `d` deletes (it asks first), `u` undoes your last change, `H` switches harbor, `?` lists them all.
|
|
48
48
|
|
|
@@ -253,6 +253,11 @@ harbor watch --once [--since TIME] [--json] the latest changes (or all since TIM
|
|
|
253
253
|
harbor lifeboats [--program P] work only one person knows, each with a second pair of hands
|
|
254
254
|
harbor lifeboats N [--person NAME] adds that second pair of hands
|
|
255
255
|
harbor follow TASK|"RISK" --person NAME someone follows it too
|
|
256
|
+
harbor convoys [PROGRAM] promises between programs, and how each stands
|
|
257
|
+
harbor convoy ask PROGRAM --to OTHER --by DATE "WHAT"
|
|
258
|
+
harbor convoy accept|decline|deliver|undeliver|move|withdraw CONVOY [--project P] [--note WHY] [--by DATE]
|
|
259
|
+
harbor salts PROJECT [--risk N|--task N|--put-away N] what finished projects like it ran into
|
|
260
|
+
harbor rank PORTFOLIO [--order "A, B, C"|--clear] which ship docks first
|
|
256
261
|
harbor agent [--agent NAME]
|
|
257
262
|
harbor agent report TASK "WHAT YOU DID" [--start] [--agent NAME]
|
|
258
263
|
```
|
|
@@ -263,6 +268,10 @@ harbor agent report TASK "WHAT YOU DID" [--start] [--agent NAME]
|
|
|
263
268
|
|
|
264
269
|
`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.
|
|
265
270
|
|
|
271
|
+
`harbor convoys` lists the promises between programs: one program's ask of another for a thing by a day, and how it stands (waiting for an answer, in time, late on the delivering project's forecast, declined, delivered); `harbor convoys Footwear` splits one program's into what it waits on and what others wait on it for. `harbor convoy ask "Member App" --to Footwear --by 2026-12-15 "Shoe photos"` asks; the asked side answers with `harbor convoy accept "shoe photos" --project "Ridge Runner"`, `decline … --note WHY` or `deliver`, and the asking side can `move … --by DATE` or `withdraw`. A convoy is named by its words; when they fit two, Harbor lists both.
|
|
272
|
+
|
|
273
|
+
`harbor salts "Ridge Runner"` shows up to three old salts: what finished projects like it ran into (risks that came true, issues, voyage log lines, tasks that finished long late), with what helped. `--risk 1` puts the first on the register, `--task 1` adds it as a task, `--put-away 1` stops showing it. `harbor rank "Summit Line"` shows the order a portfolio's projects dock in, who set it and how the newest ranking link stands; `--order "Daypack, Ridge Runner"` sets one (open projects of that portfolio, first to dock first) and `--clear` takes it off. The ranking link the crew answers in pairs is made on the portfolio page.
|
|
274
|
+
|
|
266
275
|
`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.
|
|
267
276
|
|
|
268
277
|
Agents on the crew: put an AI app on People with Add an agent and assign it tasks like anyone else. An agent working through the CLI (Claude Code, say) runs `harbor agent` for its tasks, in progress first, with their notes, checklists and latest comments. When it's done, `harbor agent report RR-4 "Drafted 12 questions; two need Dana"` adds its note as the agent's comment and moves the task to In review for a person to check. An agent never marks its own work Done.
|
package/dist/app.mjs
CHANGED
|
@@ -6707,8 +6707,22 @@ const STATUS_COLOR = {
|
|
|
6707
6707
|
"off-track": "bad",
|
|
6708
6708
|
achieved: "good"
|
|
6709
6709
|
};
|
|
6710
|
-
/**
|
|
6711
|
-
function
|
|
6710
|
+
/** What a work key result counts, by name: "Ridge Runner (program), Colorway refresh". */
|
|
6711
|
+
function linkedNames(kr, data) {
|
|
6712
|
+
return (kr.linkIds ?? []).map((id) => {
|
|
6713
|
+
const program = data.programs.find((p) => p.id === id);
|
|
6714
|
+
if (program) return `${program.name} (program)`;
|
|
6715
|
+
const project = data.projects.find((p) => p.id === id);
|
|
6716
|
+
if (project) return project.name;
|
|
6717
|
+
return data.tasks.find((t) => t.id === id)?.title ?? null;
|
|
6718
|
+
}).filter(Boolean).join(", ");
|
|
6719
|
+
}
|
|
6720
|
+
/**
|
|
6721
|
+
* Goals and their key results, as the Goals page lists them, one portfolio
|
|
6722
|
+
* after another. A goal in `open` also shows why it matters and what each
|
|
6723
|
+
* key result counts or who last moved it.
|
|
6724
|
+
*/
|
|
6725
|
+
function goalRows(data, today, open = /* @__PURE__ */ new Set()) {
|
|
6712
6726
|
const out = [];
|
|
6713
6727
|
const people = new Map(data.people.map((p) => [p.id, p.name]));
|
|
6714
6728
|
for (const portfolio of data.portfolios) {
|
|
@@ -6741,24 +6755,50 @@ function goalRows(data, today) {
|
|
|
6741
6755
|
goal
|
|
6742
6756
|
}
|
|
6743
6757
|
});
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
goal,
|
|
6750
|
-
kr
|
|
6751
|
-
}
|
|
6758
|
+
const unfolded = open.has(goal.id);
|
|
6759
|
+
if (unfolded) out.push({
|
|
6760
|
+
key: `${goal.id}-why`,
|
|
6761
|
+
text: goal.why?.trim() ? ` Why: ${goal.why.trim()}` : " No why yet. e adds one.",
|
|
6762
|
+
plain: true
|
|
6752
6763
|
});
|
|
6764
|
+
if (unfolded && !goal.keyResults.length) out.push({
|
|
6765
|
+
key: `${goal.id}-nokr`,
|
|
6766
|
+
text: " No key results yet. e adds one.",
|
|
6767
|
+
plain: true
|
|
6768
|
+
});
|
|
6769
|
+
for (const kr of goal.keyResults) {
|
|
6770
|
+
out.push({
|
|
6771
|
+
key: kr.id,
|
|
6772
|
+
text: ` ${kr.title} · ${keyResultText(kr, data)}`,
|
|
6773
|
+
item: {
|
|
6774
|
+
portfolio,
|
|
6775
|
+
goal,
|
|
6776
|
+
kr
|
|
6777
|
+
}
|
|
6778
|
+
});
|
|
6779
|
+
const names = unfolded && kr.kind === "work" ? linkedNames(kr, data) : "";
|
|
6780
|
+
if (names) out.push({
|
|
6781
|
+
key: `${kr.id}-links`,
|
|
6782
|
+
text: ` counts ${names}`,
|
|
6783
|
+
plain: true
|
|
6784
|
+
});
|
|
6785
|
+
const mover = kr.updatedBy ? people.get(kr.updatedBy) : void 0;
|
|
6786
|
+
if (unfolded && kr.kind === "number" && kr.updatedAt) out.push({
|
|
6787
|
+
key: `${kr.id}-moved`,
|
|
6788
|
+
text: ` moved ${kr.updatedAt.slice(0, 10)}${mover ? ` by ${mover}` : ""}`,
|
|
6789
|
+
plain: true
|
|
6790
|
+
});
|
|
6791
|
+
}
|
|
6753
6792
|
}
|
|
6754
6793
|
}
|
|
6755
6794
|
return out;
|
|
6756
6795
|
}
|
|
6757
6796
|
/**
|
|
6758
6797
|
* Goals: each portfolio's goals with how far along they are and their key
|
|
6759
|
-
* results.
|
|
6760
|
-
*
|
|
6761
|
-
*
|
|
6798
|
+
* results. Enter folds a goal open (why it matters, what each key result
|
|
6799
|
+
* counts). n sets a goal, e on a goal changes it (name, owner, due day, why,
|
|
6800
|
+
* a key result, work to count), e on a number key result moves it, d
|
|
6801
|
+
* removes the goal or key result in the cursor.
|
|
6762
6802
|
*/
|
|
6763
6803
|
function GoalsView({ active, width, height, go }) {
|
|
6764
6804
|
const { store, today } = useDeps();
|
|
@@ -6769,19 +6809,21 @@ function GoalsView({ active, width, height, go }) {
|
|
|
6769
6809
|
const people = useHarbor((s) => s.people);
|
|
6770
6810
|
const viewOnly = useHarbor((s) => s.myRole === "viewer" || s.keepPaused);
|
|
6771
6811
|
const day = today();
|
|
6812
|
+
const [open, setOpen] = useState(() => /* @__PURE__ */ new Set());
|
|
6772
6813
|
const rows = useMemo(() => goalRows({
|
|
6773
6814
|
portfolios,
|
|
6774
6815
|
programs,
|
|
6775
6816
|
projects,
|
|
6776
6817
|
tasks,
|
|
6777
6818
|
people
|
|
6778
|
-
}, day), [
|
|
6819
|
+
}, day, open), [
|
|
6779
6820
|
portfolios,
|
|
6780
6821
|
programs,
|
|
6781
6822
|
projects,
|
|
6782
6823
|
tasks,
|
|
6783
6824
|
people,
|
|
6784
|
-
day
|
|
6825
|
+
day,
|
|
6826
|
+
open
|
|
6785
6827
|
]);
|
|
6786
6828
|
const [at, setAt] = useState(0);
|
|
6787
6829
|
const here = standOn(rows, at);
|
|
@@ -6790,10 +6832,16 @@ function GoalsView({ active, width, height, go }) {
|
|
|
6790
6832
|
useInput((input, key) => {
|
|
6791
6833
|
if (key.upArrow || input === "k") return setAt(nextRow(rows, here, -1));
|
|
6792
6834
|
if (key.downArrow || input === "j") return setAt(nextRow(rows, here, 1));
|
|
6793
|
-
if (
|
|
6835
|
+
if (key.return && cursor) return setOpen((was) => {
|
|
6836
|
+
const next = new Set(was);
|
|
6837
|
+
if (next.has(cursor.goal.id)) next.delete(cursor.goal.id);
|
|
6838
|
+
else next.add(cursor.goal.id);
|
|
6839
|
+
return next;
|
|
6840
|
+
});
|
|
6841
|
+
if (viewOnly && (input === "n" || input === "d" || input === "e")) return go.notify("You can only view this harbor.");
|
|
6794
6842
|
if (input === "n") return newGoal(store, go, portfolios, cursor?.portfolio);
|
|
6795
6843
|
if (!cursor) return;
|
|
6796
|
-
if (
|
|
6844
|
+
if (input === "e") return cursor.kr ? moveKr(store, go, cursor) : goalMenu(store, go, cursor);
|
|
6797
6845
|
if (input === "d") {
|
|
6798
6846
|
const what = cursor.kr ? `the key result “${cursor.kr.title}”` : `the goal “${cursor.goal.title}”`;
|
|
6799
6847
|
return go.confirm(`Remove ${what}? u undoes it.`, () => save(store, go, cursor.portfolio, (g) => withoutGoal(g, cursor.goal.id, cursor.kr?.id)), "Remove");
|
|
@@ -6806,7 +6854,7 @@ function GoalsView({ active, width, height, go }) {
|
|
|
6806
6854
|
paddingX: 1,
|
|
6807
6855
|
children: [
|
|
6808
6856
|
/* @__PURE__ */ jsx(Heading, {
|
|
6809
|
-
right: "↑↓ goal · Enter change · n new goal · d remove",
|
|
6857
|
+
right: "↑↓ goal · Enter open · e change · n new goal · d remove",
|
|
6810
6858
|
children: "Goals"
|
|
6811
6859
|
}),
|
|
6812
6860
|
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
@@ -6845,7 +6893,7 @@ function newGoal(store, go, portfolios, near) {
|
|
|
6845
6893
|
id: uid("goal"),
|
|
6846
6894
|
now: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6847
6895
|
newId: () => uid("kr")
|
|
6848
|
-
}))) go.notify("Set.
|
|
6896
|
+
}))) go.notify("Set. e on it adds a key result.");
|
|
6849
6897
|
});
|
|
6850
6898
|
if (near || portfolios.length === 1) return ask(near ?? portfolios[0]);
|
|
6851
6899
|
go.pick("Which portfolio is it for?", portfolios.map((p) => ({
|
|
@@ -7075,19 +7123,26 @@ function when(iso) {
|
|
|
7075
7123
|
return `${d.toLocaleString("en-US", { month: "short" })} ${d.getDate()}, ${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`;
|
|
7076
7124
|
}
|
|
7077
7125
|
/**
|
|
7078
|
-
* A project's Messages tab
|
|
7079
|
-
*
|
|
7080
|
-
*
|
|
7126
|
+
* A project's Messages tab, or a program's Messages card: one conversation
|
|
7127
|
+
* for everyone on it, each message with its answers under it, oldest at the
|
|
7128
|
+
* top and the cursor on the newest. n writes (@Name tells them), a answers
|
|
7129
|
+
* the message in the cursor, e changes your own, d deletes your own (the
|
|
7130
|
+
* owner can take any down).
|
|
7081
7131
|
*/
|
|
7082
|
-
function MessagesView({ active, width, height, go,
|
|
7132
|
+
function MessagesView({ active, width, height, go, place, onBack }) {
|
|
7083
7133
|
const { store } = useDeps();
|
|
7084
|
-
const
|
|
7134
|
+
const placeName = useHarbor((s) => place.kind === "program" ? s.programs.find((p) => p.id === place.id)?.name : s.projects.find((p) => p.id === place.id)?.name);
|
|
7135
|
+
const fallback = place.kind === "program" ? "the program" : "the project";
|
|
7085
7136
|
const reflections = useHarbor((s) => s.reflections);
|
|
7086
7137
|
const people = useHarbor((s) => s.people);
|
|
7087
7138
|
const me = useHarbor((s) => s.currentUserId);
|
|
7088
7139
|
const role = useHarbor((s) => s.myRole);
|
|
7089
7140
|
const viewOnly = useHarbor((s) => s.myRole === "viewer" || s.keepPaused);
|
|
7090
|
-
const list = useMemo(() =>
|
|
7141
|
+
const list = useMemo(() => threadsOf(messagesIn(reflections, place)).flatMap((t) => [t.message, ...t.replies]), [
|
|
7142
|
+
reflections,
|
|
7143
|
+
place.kind,
|
|
7144
|
+
place.id
|
|
7145
|
+
]);
|
|
7091
7146
|
const [at, setAt] = useState(null);
|
|
7092
7147
|
const here = Math.min(at ?? list.length - 1, list.length - 1);
|
|
7093
7148
|
const message = list[here];
|
|
@@ -7096,15 +7151,26 @@ function MessagesView({ active, width, height, go, projectId, onBack }) {
|
|
|
7096
7151
|
if (key.escape || key.backspace) return onBack();
|
|
7097
7152
|
if (key.upArrow || input === "k") return setAt(Math.max(0, here - 1));
|
|
7098
7153
|
if (key.downArrow || input === "j") return setAt(Math.min(list.length - 1, here + 1));
|
|
7099
|
-
if (viewOnly && "
|
|
7100
|
-
|
|
7154
|
+
if (viewOnly && "naed".includes(input) && input) return go.notify("You can only view this harbor.");
|
|
7155
|
+
const write = (body, replyToId) => {
|
|
7101
7156
|
if (!body.trim()) return;
|
|
7102
7157
|
const problem = messageProblem(body);
|
|
7103
7158
|
if (problem) return go.notify(problem);
|
|
7104
|
-
store.getState()
|
|
7105
|
-
|
|
7106
|
-
|
|
7159
|
+
const s = store.getState();
|
|
7160
|
+
if (place.kind === "program") s.postProgramMessage(place.id, body, replyToId);
|
|
7161
|
+
else s.postMessage(place.id, body, replyToId);
|
|
7162
|
+
if (!replyToId) setAt(null);
|
|
7163
|
+
};
|
|
7164
|
+
if (input === "n") return go.ask(`A message to everyone on ${placeName ?? fallback}`, (body) => write(body));
|
|
7107
7165
|
if (!message) return;
|
|
7166
|
+
if (input === "a") {
|
|
7167
|
+
const root = replyRoot(reflections, place, message.id) ?? message.id;
|
|
7168
|
+
return go.ask(`Your answer to ${name(message.authorId)}`, (body) => {
|
|
7169
|
+
write(body, root);
|
|
7170
|
+
const t = threadsOf(messagesIn(store.getState().reflections, place)).flatMap((t) => [t.message, ...t.replies]).reduce((last, m, i) => m.replyToId === root ? i : last, -1);
|
|
7171
|
+
if (t >= 0) setAt(t);
|
|
7172
|
+
});
|
|
7173
|
+
}
|
|
7108
7174
|
if (input === "e") {
|
|
7109
7175
|
if (!mayChangeMessage(message, me, role, "edit")) return go.notify("Only the person who wrote it can change it.");
|
|
7110
7176
|
return go.ask("Your message", (body) => {
|
|
@@ -7119,10 +7185,12 @@ function MessagesView({ active, width, height, go, projectId, onBack }) {
|
|
|
7119
7185
|
}
|
|
7120
7186
|
}, { isActive: active });
|
|
7121
7187
|
const blocks = list.map((m, i) => {
|
|
7188
|
+
const answer = Boolean(m.replyToId && list.some((r) => r.id === m.replyToId));
|
|
7122
7189
|
return {
|
|
7123
7190
|
i,
|
|
7124
|
-
head: `${name(m.authorId)} · ${when(m.createdAt)}${m.editedAt ? " (edited)" : ""}`,
|
|
7125
|
-
|
|
7191
|
+
head: `${answer ? "↳ " : ""}${name(m.authorId)} · ${when(m.createdAt)}${m.editedAt ? " (edited)" : ""}`,
|
|
7192
|
+
answer,
|
|
7193
|
+
body: wrapLines(m.body, width - (answer ? 9 : 6))
|
|
7126
7194
|
};
|
|
7127
7195
|
});
|
|
7128
7196
|
const rows = Math.max(1, height - 2);
|
|
@@ -7147,8 +7215,8 @@ function MessagesView({ active, width, height, go, projectId, onBack }) {
|
|
|
7147
7215
|
paddingX: 1,
|
|
7148
7216
|
children: [
|
|
7149
7217
|
/* @__PURE__ */ jsxs(Heading, {
|
|
7150
|
-
right: "↑↓ · n write · e change yours · d delete · Esc back",
|
|
7151
|
-
children: [
|
|
7218
|
+
right: "↑↓ · n write · a answer · e change yours · d delete · Esc back",
|
|
7219
|
+
children: [placeName ?? (place.kind === "program" ? "Program" : "Project"), " · Messages"]
|
|
7152
7220
|
}),
|
|
7153
7221
|
/* @__PURE__ */ jsx(Text, { children: " " }),
|
|
7154
7222
|
list.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
@@ -7162,10 +7230,14 @@ function MessagesView({ active, width, height, go, projectId, onBack }) {
|
|
|
7162
7230
|
color: on ? theme.selected : theme.muted,
|
|
7163
7231
|
bold: on,
|
|
7164
7232
|
wrap: "truncate-end",
|
|
7165
|
-
children: [
|
|
7233
|
+
children: [
|
|
7234
|
+
on ? "› " : " ",
|
|
7235
|
+
b.answer ? " " : "",
|
|
7236
|
+
b.head
|
|
7237
|
+
]
|
|
7166
7238
|
}), b.body.map((line, j) => /* @__PURE__ */ jsxs(Text, {
|
|
7167
7239
|
wrap: "truncate-end",
|
|
7168
|
-
children: [" ", line]
|
|
7240
|
+
children: [b.answer ? " " : " ", line]
|
|
7169
7241
|
}, j))]
|
|
7170
7242
|
}, list[b.i].id);
|
|
7171
7243
|
})
|
|
@@ -16685,7 +16757,7 @@ const HELP$1 = [
|
|
|
16685
16757
|
["m R P t D", "milestone / risk / pre-mortem / dry dock / Done"],
|
|
16686
16758
|
["c a C S", "on a task: comment / step / yours / sounding"],
|
|
16687
16759
|
["s T", "on a task: add a subtask / save as a template"],
|
|
16688
|
-
["M T", "
|
|
16760
|
+
["M T", "messages (project, program) / from a template"],
|
|
16689
16761
|
["f c / f p", "Today: focus, check in · board: owner, priority"],
|
|
16690
16762
|
["q", "quit (saves first)"]
|
|
16691
16763
|
];
|
|
@@ -18009,7 +18081,239 @@ function shareOf(e, reading, by = "effort") {
|
|
|
18009
18081
|
return (by === "spend" ? e.spent : amountOf(e, reading.measure)) / whole;
|
|
18010
18082
|
}
|
|
18011
18083
|
|
|
18084
|
+
// src/lib/old-salts.ts
|
|
18085
|
+
init_date_fns();
|
|
18086
|
+
init_date_text();
|
|
18087
|
+
init_first_voyage();
|
|
18088
|
+
init_indexes();
|
|
18089
|
+
init_premortem();
|
|
18090
|
+
/** A slip shorter than this isn't a lesson, just a busy week. */
|
|
18091
|
+
const SLIP_DAYS = 7;
|
|
18092
|
+
/** Lessons one project offers, and the most a card shows at once. */
|
|
18093
|
+
const PER_PROJECT = 4;
|
|
18094
|
+
const SHOWN = 3;
|
|
18095
|
+
/** Finished projects a card draws on. */
|
|
18096
|
+
const SOURCES = 2;
|
|
18097
|
+
const days$3 = (from, to) => differenceInCalendarDays(parseIso(localDay(to)), parseIso(from.slice(0, 10)));
|
|
18098
|
+
const clip = (s, n) => {
|
|
18099
|
+
const flat = s.replace(/\s+/g, " ").trim();
|
|
18100
|
+
return flat.length <= n ? flat : `${flat.slice(0, n - 1).replace(/\s+\S*$/, "")}…`;
|
|
18101
|
+
};
|
|
18102
|
+
const lower = (s) => /^[A-Z][a-z]/.test(s) ? s[0].toLowerCase() + s.slice(1) : s;
|
|
18103
|
+
function slipText(task, late) {
|
|
18104
|
+
const weeks = Math.round(late / 7);
|
|
18105
|
+
const when = late >= 14 ? `${weeks} weeks` : `${late} days`;
|
|
18106
|
+
return `“${clip(task.title, 80)}” finished ${when} late`;
|
|
18107
|
+
}
|
|
18108
|
+
/** The lessons one finished project offers, the crew's own words first. */
|
|
18109
|
+
function lessonsOf(project, data, raid = data.raidItems.filter((r) => r.projectId === project.id), lines = (data.reflections ?? []).filter((r) => r.projectId === project.id && r.kind === "voyage")) {
|
|
18110
|
+
const from = {
|
|
18111
|
+
id: project.id,
|
|
18112
|
+
name: project.name
|
|
18113
|
+
};
|
|
18114
|
+
const out = [];
|
|
18115
|
+
for (const l of [...lines].sort((a, b) => a.createdAt.localeCompare(b.createdAt))) {
|
|
18116
|
+
if (!l.body.trim()) continue;
|
|
18117
|
+
out.push({
|
|
18118
|
+
id: `line:${l.id}`,
|
|
18119
|
+
kind: "line",
|
|
18120
|
+
from,
|
|
18121
|
+
text: clip(l.body, 200),
|
|
18122
|
+
helped: null,
|
|
18123
|
+
title: riskTitle(l.body)
|
|
18124
|
+
});
|
|
18125
|
+
}
|
|
18126
|
+
for (const r of raid) if (r.kind === "risk" && r.happened === true) out.push({
|
|
18127
|
+
id: `risk:${r.id}`,
|
|
18128
|
+
kind: "came-true",
|
|
18129
|
+
from,
|
|
18130
|
+
text: `${lower(clip(r.title, 120))} (a risk that came true)`,
|
|
18131
|
+
helped: r.contingency?.trim() || r.mitigation?.trim() || null,
|
|
18132
|
+
title: clip(r.title, 120)
|
|
18133
|
+
});
|
|
18134
|
+
else if (r.kind === "issue") out.push({
|
|
18135
|
+
id: `issue:${r.id}`,
|
|
18136
|
+
kind: "issue",
|
|
18137
|
+
from,
|
|
18138
|
+
text: lower(clip(r.title, 120)),
|
|
18139
|
+
helped: r.resolution?.trim() || null,
|
|
18140
|
+
title: clip(r.title, 120)
|
|
18141
|
+
});
|
|
18142
|
+
const slips = tasksOf(data.tasks, project.id).filter((t) => t.status === "done" && t.dueDate && t.completedAt && !t.parentTaskId).map((t) => ({
|
|
18143
|
+
t,
|
|
18144
|
+
late: days$3(t.dueDate, t.completedAt)
|
|
18145
|
+
})).filter((s) => s.late >= 7).sort((a, b) => b.late - a.late).slice(0, 2);
|
|
18146
|
+
for (const { t, late } of slips) out.push({
|
|
18147
|
+
id: `slip:${t.id}`,
|
|
18148
|
+
kind: "slip",
|
|
18149
|
+
from,
|
|
18150
|
+
text: slipText(t, late),
|
|
18151
|
+
helped: null,
|
|
18152
|
+
title: `Leave room for ${lower(clip(t.title, 100))}`
|
|
18153
|
+
});
|
|
18154
|
+
return out.slice(0, 4);
|
|
18155
|
+
}
|
|
18156
|
+
/**
|
|
18157
|
+
* The finished projects this one sounds like, best first: shared meaningful
|
|
18158
|
+
* words of name and description, with the same program counting as one
|
|
18159
|
+
* more (so a program's finished projects count even with no words shared).
|
|
18160
|
+
* Most recently finished first on a tie.
|
|
18161
|
+
*/
|
|
18162
|
+
function kindredProjects(data, project) {
|
|
18163
|
+
const want = contentWords(`${project.name} ${project.description}`);
|
|
18164
|
+
const scored = [];
|
|
18165
|
+
for (const p of data.projects) {
|
|
18166
|
+
if (p.id === project.id || p.health !== "done" || isVoyageProject(p.id)) continue;
|
|
18167
|
+
const theirs = contentWords(`${p.name} ${p.description}`);
|
|
18168
|
+
let score = 0;
|
|
18169
|
+
for (const w of want) if (theirs.has(w)) score += 1;
|
|
18170
|
+
if (p.programId === project.programId) score += 1;
|
|
18171
|
+
if (score === 0) continue;
|
|
18172
|
+
const done = [...p.healthHistory ?? []].reverse().find((h) => h.health === "done")?.at;
|
|
18173
|
+
scored.push({
|
|
18174
|
+
p,
|
|
18175
|
+
score,
|
|
18176
|
+
at: done ?? p.endDate
|
|
18177
|
+
});
|
|
18178
|
+
}
|
|
18179
|
+
return scored.sort((a, b) => b.score - a.score || b.at.localeCompare(a.at)).map((s) => s.p);
|
|
18180
|
+
}
|
|
18181
|
+
/**
|
|
18182
|
+
* What the old salts say to this project: lessons from the finished projects
|
|
18183
|
+
* it looks like, leaving out any put away (or already taken) here. Nothing
|
|
18184
|
+
* for a finished project.
|
|
18185
|
+
*/
|
|
18186
|
+
function oldSalts(data, project) {
|
|
18187
|
+
if (project.health === "done" || isVoyageProject(project.id)) return [];
|
|
18188
|
+
const heard = new Set(project.saltsHeard ?? []);
|
|
18189
|
+
const out = [];
|
|
18190
|
+
let sources = 0;
|
|
18191
|
+
for (const p of kindredProjects(data, project).slice(0, 10)) {
|
|
18192
|
+
const fresh = lessonsOf(p, data).filter((l) => !heard.has(l.id));
|
|
18193
|
+
if (fresh.length === 0) continue;
|
|
18194
|
+
out.push(...fresh);
|
|
18195
|
+
if (++sources >= SOURCES) break;
|
|
18196
|
+
}
|
|
18197
|
+
return out.slice(0, 3);
|
|
18198
|
+
}
|
|
18199
|
+
|
|
18012
18200
|
// src/lib/dock-order.ts
|
|
18201
|
+
/** The same key for a pair whichever way round it comes. */
|
|
18202
|
+
const pairKey = (a, b) => a < b ? `${a}|${b}` : `${b}|${a}`;
|
|
18203
|
+
/** Every vote that counts: answers about projects still in the ranking, each person's latest per pair. */
|
|
18204
|
+
function countedVotes(votes, projectIds) {
|
|
18205
|
+
const live = new Set(projectIds);
|
|
18206
|
+
const latest = /* @__PURE__ */ new Map();
|
|
18207
|
+
for (const v of votes) {
|
|
18208
|
+
if (v.a === v.b || !live.has(v.a) || !live.has(v.b)) continue;
|
|
18209
|
+
if (v.winner !== null && v.winner !== v.a && v.winner !== v.b) continue;
|
|
18210
|
+
const key = `${v.voter}\u0000${pairKey(v.a, v.b)}`;
|
|
18211
|
+
const was = latest.get(key);
|
|
18212
|
+
if (!was || was.at <= v.at) latest.set(key, v);
|
|
18213
|
+
}
|
|
18214
|
+
return [...latest.values()];
|
|
18215
|
+
}
|
|
18216
|
+
/** Bradley-Terry strengths, normalised to average 1. */
|
|
18217
|
+
function strengths(projectIds, votes) {
|
|
18218
|
+
const ids = [...projectIds];
|
|
18219
|
+
const wins = new Map(ids.map((id) => [id, .5]));
|
|
18220
|
+
const games = /* @__PURE__ */ new Map();
|
|
18221
|
+
for (const v of votes) {
|
|
18222
|
+
games.set(pairKey(v.a, v.b), (games.get(pairKey(v.a, v.b)) ?? 0) + 1);
|
|
18223
|
+
if (v.winner === null) {
|
|
18224
|
+
wins.set(v.a, wins.get(v.a) + .5);
|
|
18225
|
+
wins.set(v.b, wins.get(v.b) + .5);
|
|
18226
|
+
} else wins.set(v.winner, wins.get(v.winner) + 1);
|
|
18227
|
+
}
|
|
18228
|
+
let p = new Map(ids.map((id) => [id, 1]));
|
|
18229
|
+
for (let round = 0; round < 200; round++) {
|
|
18230
|
+
const next = /* @__PURE__ */ new Map();
|
|
18231
|
+
let change = 0;
|
|
18232
|
+
for (const i of ids) {
|
|
18233
|
+
let denom = 1 / (p.get(i) + 1);
|
|
18234
|
+
for (const j of ids) {
|
|
18235
|
+
if (i === j) continue;
|
|
18236
|
+
const n = games.get(pairKey(i, j));
|
|
18237
|
+
if (n) denom += n / (p.get(i) + p.get(j));
|
|
18238
|
+
}
|
|
18239
|
+
next.set(i, wins.get(i) / denom);
|
|
18240
|
+
}
|
|
18241
|
+
const mean = ids.reduce((s, id) => s + next.get(id), 0) / Math.max(1, ids.length);
|
|
18242
|
+
for (const id of ids) {
|
|
18243
|
+
const v = next.get(id) / mean;
|
|
18244
|
+
change = Math.max(change, Math.abs(v - p.get(id)));
|
|
18245
|
+
next.set(id, v);
|
|
18246
|
+
}
|
|
18247
|
+
p = next;
|
|
18248
|
+
if (change < 1e-9) break;
|
|
18249
|
+
}
|
|
18250
|
+
return p;
|
|
18251
|
+
}
|
|
18252
|
+
const AGREEMENT_LABEL = {
|
|
18253
|
+
clear: "Clear",
|
|
18254
|
+
leaning: "Leaning",
|
|
18255
|
+
"coin-toss": "Coin toss"
|
|
18256
|
+
};
|
|
18257
|
+
function agreementOf(sure) {
|
|
18258
|
+
return sure >= .8 ? "clear" : sure >= .65 ? "leaning" : "coin-toss";
|
|
18259
|
+
}
|
|
18260
|
+
/**
|
|
18261
|
+
* The order, strongest first (ties broken by name order of the ids given, so
|
|
18262
|
+
* it's stable), and for each place how sure people are it sits above the
|
|
18263
|
+
* next: the share of direct answers between the two when there are at least
|
|
18264
|
+
* two, otherwise what the strengths say.
|
|
18265
|
+
*/
|
|
18266
|
+
function dockOrder(projectIds, votes) {
|
|
18267
|
+
const counted = countedVotes(votes, projectIds);
|
|
18268
|
+
const p = strengths(projectIds, counted);
|
|
18269
|
+
const index = new Map(projectIds.map((id, i) => [id, i]));
|
|
18270
|
+
const sorted = [...projectIds].sort((a, b) => p.get(b) - p.get(a) || index.get(a) - index.get(b));
|
|
18271
|
+
const answers = /* @__PURE__ */ new Map();
|
|
18272
|
+
const direct = /* @__PURE__ */ new Map();
|
|
18273
|
+
for (const v of counted) {
|
|
18274
|
+
answers.set(v.a, (answers.get(v.a) ?? 0) + 1);
|
|
18275
|
+
answers.set(v.b, (answers.get(v.b) ?? 0) + 1);
|
|
18276
|
+
const key = pairKey(v.a, v.b);
|
|
18277
|
+
const d = direct.get(key) ?? {
|
|
18278
|
+
games: 0,
|
|
18279
|
+
firstWins: 0
|
|
18280
|
+
};
|
|
18281
|
+
d.games++;
|
|
18282
|
+
const first = v.a < v.b ? v.a : v.b;
|
|
18283
|
+
d.firstWins += v.winner === null ? .5 : v.winner === first ? 1 : 0;
|
|
18284
|
+
direct.set(key, d);
|
|
18285
|
+
}
|
|
18286
|
+
return {
|
|
18287
|
+
places: sorted.map((id, i) => {
|
|
18288
|
+
const below = sorted[i + 1];
|
|
18289
|
+
let overNext = null;
|
|
18290
|
+
if (below) {
|
|
18291
|
+
const d = direct.get(pairKey(id, below));
|
|
18292
|
+
if (d && d.games >= 2) overNext = (id < below ? d.firstWins : d.games - d.firstWins) / d.games;
|
|
18293
|
+
else overNext = p.get(id) / (p.get(id) + p.get(below));
|
|
18294
|
+
}
|
|
18295
|
+
return {
|
|
18296
|
+
projectId: id,
|
|
18297
|
+
place: i + 1,
|
|
18298
|
+
strength: p.get(id),
|
|
18299
|
+
overNext,
|
|
18300
|
+
agreement: overNext === null ? null : agreementOf(overNext),
|
|
18301
|
+
answers: answers.get(id) ?? 0
|
|
18302
|
+
};
|
|
18303
|
+
}),
|
|
18304
|
+
voters: new Set(counted.map((v) => v.voter)).size,
|
|
18305
|
+
answers: counted.length
|
|
18306
|
+
};
|
|
18307
|
+
}
|
|
18308
|
+
/** "1st", "2nd", "3rd", "4th", "11th", "21st". */
|
|
18309
|
+
function ordinal(n) {
|
|
18310
|
+
return `${n}${n % 100 >= 11 && n % 100 <= 13 ? "th" : [
|
|
18311
|
+
"th",
|
|
18312
|
+
"st",
|
|
18313
|
+
"nd",
|
|
18314
|
+
"rd"
|
|
18315
|
+
][n % 10] ?? "th"}`;
|
|
18316
|
+
}
|
|
18013
18317
|
/** An order once it's put on the portfolio: only projects still there, and still open, each once. */
|
|
18014
18318
|
function liveOrder(order, projects) {
|
|
18015
18319
|
const open = new Set(projects.filter((p) => p.health !== "done").map((p) => p.id));
|
|
@@ -26499,6 +26803,81 @@ const HARBOR_TOOLS = [
|
|
|
26499
26803
|
};
|
|
26500
26804
|
}
|
|
26501
26805
|
}),
|
|
26806
|
+
tool({
|
|
26807
|
+
name: "old_salts",
|
|
26808
|
+
title: "Old salts",
|
|
26809
|
+
description: "What finished projects like this one ran into (Old salts, at the top of a project's Risks & issues): risks that came true, issues, lines from their voyage logs and tasks that finished long late, each with the project it came from and what helped when that's known. Up to three, ones put away left out; none for a finished project. heed_old_salt turns one into a risk or a task here, or puts it away." + DATA_NOTE,
|
|
26810
|
+
input: object({
|
|
26811
|
+
harbor: harborArg,
|
|
26812
|
+
project: string().min(1).max(200).describe("Project id, key or name.")
|
|
26813
|
+
}),
|
|
26814
|
+
run: (ctx, input) => {
|
|
26815
|
+
const project = findOne(ctx.data.projects, input.project, "project");
|
|
26816
|
+
const lessons = oldSalts(ctx.data, project);
|
|
26817
|
+
return {
|
|
26818
|
+
project: project.name,
|
|
26819
|
+
...project.health === "done" ? { note: `${project.name} is finished; old salts are for the projects still sailing.` } : {},
|
|
26820
|
+
lessons: lessons.map((l, i) => ({
|
|
26821
|
+
n: i + 1,
|
|
26822
|
+
id: l.id,
|
|
26823
|
+
kind: l.kind,
|
|
26824
|
+
from: l.from.name,
|
|
26825
|
+
text: `Last time, on ${l.from.name}: ${l.text}.`,
|
|
26826
|
+
...l.helped ? { helped: l.helped } : {},
|
|
26827
|
+
title: l.title
|
|
26828
|
+
}))
|
|
26829
|
+
};
|
|
26830
|
+
}
|
|
26831
|
+
}),
|
|
26832
|
+
tool({
|
|
26833
|
+
name: "dock_order",
|
|
26834
|
+
title: "Which ship docks first",
|
|
26835
|
+
description: "A portfolio's projects in the order they matter, from Which ship docks first: the order put on the portfolio (who set it, when, from how many people's answers; finished or removed projects left out), and how the newest ranking link stands so far (each place with how sure people are it sits above the next: clear, leaning or coin toss). set_dock_order puts an order on it." + DATA_NOTE,
|
|
26836
|
+
input: object({
|
|
26837
|
+
harbor: harborArg,
|
|
26838
|
+
portfolio: string().min(1).max(200).describe("Portfolio id or name.")
|
|
26839
|
+
}),
|
|
26840
|
+
run: (ctx, input) => {
|
|
26841
|
+
const { data } = ctx;
|
|
26842
|
+
const portfolio = findOne(data.portfolios, input.portfolio, "portfolio");
|
|
26843
|
+
const programs = new Set(data.programs.filter((p) => p.portfolioId === portfolio.id).map((p) => p.id));
|
|
26844
|
+
const inIt = data.projects.filter((p) => programs.has(p.programId));
|
|
26845
|
+
const names = byId(data.projects);
|
|
26846
|
+
const name = (id) => names.get(id)?.name ?? null;
|
|
26847
|
+
const kept = portfolio.dockOrder;
|
|
26848
|
+
const order = kept ? liveOrder(kept.projectIds, inIt) : [];
|
|
26849
|
+
const open = inIt.filter((p) => p.health !== "done");
|
|
26850
|
+
const link = ctx.dockLink ?? null;
|
|
26851
|
+
const live = link ? link.projectIds.filter((id) => open.some((p) => p.id === id)) : [];
|
|
26852
|
+
const standing = link && live.length >= 2 ? dockOrder(live, link.votes) : null;
|
|
26853
|
+
return {
|
|
26854
|
+
portfolio: portfolio.name,
|
|
26855
|
+
openProjects: open.length,
|
|
26856
|
+
kept: kept ? {
|
|
26857
|
+
order: order.map((id, i) => ({
|
|
26858
|
+
place: ordinal(i + 1),
|
|
26859
|
+
project: name(id)
|
|
26860
|
+
})),
|
|
26861
|
+
at: kept.at,
|
|
26862
|
+
by: data.people.find((p) => p.id === kept.byId)?.name ?? null,
|
|
26863
|
+
voters: kept.voters,
|
|
26864
|
+
notRanked: open.filter((p) => !order.includes(p.id)).map((p) => p.name)
|
|
26865
|
+
} : null,
|
|
26866
|
+
...link ? { link: {
|
|
26867
|
+
...ctx.origin ? { url: `${ctx.origin}/dock/${link.token}` } : {},
|
|
26868
|
+
open: !link.closedAt,
|
|
26869
|
+
made: link.createdAt,
|
|
26870
|
+
voters: standing?.voters ?? 0,
|
|
26871
|
+
answers: standing?.answers ?? 0,
|
|
26872
|
+
standing: (standing?.places ?? []).map((p) => ({
|
|
26873
|
+
place: ordinal(p.place),
|
|
26874
|
+
project: name(p.projectId),
|
|
26875
|
+
...p.agreement ? { overNext: AGREEMENT_LABEL[p.agreement].toLowerCase() } : {}
|
|
26876
|
+
}))
|
|
26877
|
+
} } : {}
|
|
26878
|
+
};
|
|
26879
|
+
}
|
|
26880
|
+
}),
|
|
26502
26881
|
tool({
|
|
26503
26882
|
name: "list_dashboards",
|
|
26504
26883
|
title: "Dashboards",
|
|
@@ -33393,6 +33772,7 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
|
|
|
33393
33772
|
if (input === "n") return go.create("project", { programId });
|
|
33394
33773
|
if (input === "m") return go.create("milestone", { programId });
|
|
33395
33774
|
if (input === "c") return go.openPanel("shore", programId);
|
|
33775
|
+
if (input === "M") return go.openMessages(programId, "program");
|
|
33396
33776
|
if (input === "R") return go.create("raid", {});
|
|
33397
33777
|
if (input === "D" && split.done.length > 0) {
|
|
33398
33778
|
setSide("projects");
|
|
@@ -36775,9 +37155,10 @@ function App({ ui, startIn }) {
|
|
|
36775
37155
|
kind: "portfolio",
|
|
36776
37156
|
id
|
|
36777
37157
|
}),
|
|
36778
|
-
openMessages: (id) => push({
|
|
37158
|
+
openMessages: (id, on = "project") => push({
|
|
36779
37159
|
kind: "messages",
|
|
36780
|
-
id
|
|
37160
|
+
id,
|
|
37161
|
+
on
|
|
36781
37162
|
}),
|
|
36782
37163
|
openBridge: (programIds) => push({
|
|
36783
37164
|
kind: "bridge",
|
|
@@ -37160,6 +37541,7 @@ function App({ ui, startIn }) {
|
|
|
37160
37541
|
] : page?.kind === "messages" ? [
|
|
37161
37542
|
["↑↓", "move"],
|
|
37162
37543
|
["n", "write"],
|
|
37544
|
+
["a", "answer"],
|
|
37163
37545
|
["e", "change yours"],
|
|
37164
37546
|
["d", "delete"],
|
|
37165
37547
|
["Esc", "back"]
|
|
@@ -37189,6 +37571,7 @@ function App({ ui, startIn }) {
|
|
|
37189
37571
|
...page.kind === "program" ? [
|
|
37190
37572
|
["m", "milestone"],
|
|
37191
37573
|
["c", "chat channel"],
|
|
37574
|
+
["M", "messages"],
|
|
37192
37575
|
["←→", "lists"]
|
|
37193
37576
|
] : [],
|
|
37194
37577
|
["Esc", "back"]
|
|
@@ -37220,9 +37603,12 @@ function App({ ui, startIn }) {
|
|
|
37220
37603
|
}, page.id);
|
|
37221
37604
|
else if (page?.kind === "messages") screenNode = /* @__PURE__ */ jsx(MessagesView, {
|
|
37222
37605
|
...viewProps,
|
|
37223
|
-
|
|
37606
|
+
place: {
|
|
37607
|
+
kind: page.on,
|
|
37608
|
+
id: page.id
|
|
37609
|
+
},
|
|
37224
37610
|
onBack: back
|
|
37225
|
-
}, page.id);
|
|
37611
|
+
}, `${page.on}-${page.id}`);
|
|
37226
37612
|
else if (page?.kind === "program") screenNode = /* @__PURE__ */ jsx(ProgramView, {
|
|
37227
37613
|
...viewProps,
|
|
37228
37614
|
programId: page.id,
|
package/lib/cli.mjs
CHANGED
|
@@ -72,6 +72,12 @@ import {
|
|
|
72
72
|
fogText,
|
|
73
73
|
scuttleText,
|
|
74
74
|
scuttleCallText,
|
|
75
|
+
convoysText,
|
|
76
|
+
convoyText,
|
|
77
|
+
saltsText,
|
|
78
|
+
heedSaltText,
|
|
79
|
+
rankText,
|
|
80
|
+
setRankText,
|
|
75
81
|
agentWorkText,
|
|
76
82
|
raidDetail,
|
|
77
83
|
raidList,
|
|
@@ -364,6 +370,21 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
364
370
|
months out of the line-up
|
|
365
371
|
harbor scuttle PROJECT --why "TEXT" stop it on purpose: Done, on the
|
|
366
372
|
register, its tasks set free
|
|
373
|
+
harbor convoys [PROGRAM] promises between programs: what
|
|
374
|
+
each waits on, and who waits on it
|
|
375
|
+
harbor convoy ask PROGRAM --to OTHER --by DATE "WHAT"
|
|
376
|
+
one program asks another for
|
|
377
|
+
a thing by a day
|
|
378
|
+
harbor convoy accept|decline|deliver|undeliver|move|withdraw CONVOY
|
|
379
|
+
answer one, or move or take back
|
|
380
|
+
your ask
|
|
381
|
+
harbor salts PROJECT [--risk N|--task N|--put-away N]
|
|
382
|
+
old salts: what finished projects
|
|
383
|
+
like it ran into
|
|
384
|
+
harbor rank PORTFOLIO [--order "A, B, C"|--clear]
|
|
385
|
+
which ship docks first: the
|
|
386
|
+
order a portfolio's projects
|
|
387
|
+
matter in
|
|
367
388
|
harbor watch [--project P] [--bell] a live ticker of the harbor's
|
|
368
389
|
changes; yours bright, q stops
|
|
369
390
|
harbor watch --once [--since TIME] [--json] the latest changes (or all since
|
|
@@ -1452,6 +1473,54 @@ const DETAIL = {
|
|
|
1452
1473
|
" Nothing is deleted: harbor health auto --project P raises a scuttled project",
|
|
1453
1474
|
" again and gives its tasks back.",
|
|
1454
1475
|
],
|
|
1476
|
+
convoys: [
|
|
1477
|
+
" harbor convoys reads every convoy: one program's ask",
|
|
1478
|
+
" of another, by a day, and how it",
|
|
1479
|
+
" stands (waiting for an answer, in",
|
|
1480
|
+
" time, late on the forecast, declined,",
|
|
1481
|
+
" delivered)",
|
|
1482
|
+
" harbor convoys PROGRAM reads what it waits on, and what",
|
|
1483
|
+
" others wait on it for",
|
|
1484
|
+
"",
|
|
1485
|
+
" harbor convoy ask PROGRAM … and its answers write them (harbor help convoy).",
|
|
1486
|
+
],
|
|
1487
|
+
convoy: [
|
|
1488
|
+
" harbor convoy ask PROGRAM --to OTHER --by DATE \"WHAT\"",
|
|
1489
|
+
" writes: PROGRAM asks OTHER for WHAT",
|
|
1490
|
+
" harbor convoy accept CONVOY [--project P]",
|
|
1491
|
+
" writes: the asked program takes it on,",
|
|
1492
|
+
" P (one of its projects) delivering it",
|
|
1493
|
+
' harbor convoy decline CONVOY [--note "WHY"]',
|
|
1494
|
+
" writes: it can't, and why",
|
|
1495
|
+
" harbor convoy deliver CONVOY writes: delivered (undeliver takes it",
|
|
1496
|
+
" back)",
|
|
1497
|
+
" harbor convoy move CONVOY --by DATE writes: the asking side moves the day",
|
|
1498
|
+
" harbor convoy withdraw CONVOY writes: the asking side takes it back",
|
|
1499
|
+
"",
|
|
1500
|
+
" CONVOY is its words (a part is enough when only one matches) or its id from",
|
|
1501
|
+
" harbor convoys --json. harbor convoys lists them.",
|
|
1502
|
+
],
|
|
1503
|
+
salts: [
|
|
1504
|
+
" harbor salts PROJECT reads what finished projects like it",
|
|
1505
|
+
" ran into: risks that came true,",
|
|
1506
|
+
" issues, voyage log lines, tasks that",
|
|
1507
|
+
" ended long late (up to three)",
|
|
1508
|
+
" harbor salts PROJECT --risk N writes: lesson N as an open risk",
|
|
1509
|
+
" harbor salts PROJECT --task N writes: lesson N as a task in To do",
|
|
1510
|
+
" harbor salts PROJECT --put-away N writes: stop showing lesson N",
|
|
1511
|
+
],
|
|
1512
|
+
rank: [
|
|
1513
|
+
" harbor rank PORTFOLIO reads which ship docks first: the",
|
|
1514
|
+
" order kept on the portfolio, and how",
|
|
1515
|
+
" its newest ranking link stands",
|
|
1516
|
+
' harbor rank PORTFOLIO --order "A, B, C"',
|
|
1517
|
+
" writes: its open projects in order,",
|
|
1518
|
+
" first to dock first (commas between)",
|
|
1519
|
+
" harbor rank PORTFOLIO --clear writes: takes the order off",
|
|
1520
|
+
"",
|
|
1521
|
+
" The ranking link the crew answers in pairs is made by the harbor's owner on",
|
|
1522
|
+
" the portfolio page.",
|
|
1523
|
+
],
|
|
1455
1524
|
watch: [
|
|
1456
1525
|
" harbor watch reads, live: each change to the harbor",
|
|
1457
1526
|
" as it lands, one line with its time",
|
|
@@ -1844,8 +1913,12 @@ const OTHER_NAMES = {
|
|
|
1844
1913
|
dashboards: "harbor reports lists the Reports page's dashboards, each chart as its numbers.",
|
|
1845
1914
|
report: "harbor report PROGRAM is a program's status report; harbor reports lists the dashboards.",
|
|
1846
1915
|
decide: 'harbor decision "TITLE" --project P logs a decision.',
|
|
1847
|
-
dock: "harbor try PROJECT is the dry dock.",
|
|
1916
|
+
dock: "harbor try PROJECT is the dry dock; harbor rank PORTFOLIO says which ship docks first.",
|
|
1848
1917
|
"dry-dock": "harbor try PROJECT is the dry dock.",
|
|
1918
|
+
ranking: "harbor rank PORTFOLIO says which ship docks first.",
|
|
1919
|
+
salt: "harbor salts PROJECT lists its old salts.",
|
|
1920
|
+
"old-salts": "harbor salts PROJECT lists its old salts.",
|
|
1921
|
+
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.",
|
|
1849
1922
|
};
|
|
1850
1923
|
|
|
1851
1924
|
/** A mistyped command, with the one it was probably meant to be. */
|
|
@@ -4647,6 +4720,87 @@ export async function run(argv, io = {}) {
|
|
|
4647
4720
|
scuttleText,
|
|
4648
4721
|
);
|
|
4649
4722
|
}
|
|
4723
|
+
case "convoys": {
|
|
4724
|
+
const { positionals, harbor } = parse(spec());
|
|
4725
|
+
const program = positionals.join(" ").trim();
|
|
4726
|
+
return call("list_convoys", { harbor, ...(program ? { program } : {}) }, convoysText);
|
|
4727
|
+
}
|
|
4728
|
+
case "convoy": {
|
|
4729
|
+
const { positionals, values, harbor } = parse(spec([], ["to", "by", "project", "note"]));
|
|
4730
|
+
const [act, ...words] = positionals;
|
|
4731
|
+
const ACTS = ["ask", "accept", "decline", "deliver", "undeliver", "move", "withdraw"];
|
|
4732
|
+
if (act === undefined) {
|
|
4733
|
+
return call("list_convoys", { harbor }, convoysText);
|
|
4734
|
+
}
|
|
4735
|
+
if (!ACTS.includes(act))
|
|
4736
|
+
throw new HarborError(
|
|
4737
|
+
`harbor convoy ${act}? Say ask, accept, decline, deliver, undeliver, move or withdraw; harbor convoys lists them.`,
|
|
4738
|
+
);
|
|
4739
|
+
const only = (allowed) => {
|
|
4740
|
+
const extra = ["to", "by", "project", "note"].filter(
|
|
4741
|
+
(k) => values[k] !== undefined && !allowed.includes(k),
|
|
4742
|
+
);
|
|
4743
|
+
if (extra.length)
|
|
4744
|
+
throw new HarborError(`--${extra[0]} doesn't go with harbor convoy ${act}.`);
|
|
4745
|
+
};
|
|
4746
|
+
if (act === "ask") {
|
|
4747
|
+
only(["to", "by"]);
|
|
4748
|
+
const [program, ...what] = words;
|
|
4749
|
+
if (!program || !what.length || values.to === undefined || values.by === undefined)
|
|
4750
|
+
throw new HarborError('An ask: harbor convoy ask PROGRAM --to OTHER --by DATE "WHAT".');
|
|
4751
|
+
return call(
|
|
4752
|
+
"convoy",
|
|
4753
|
+
{ harbor, act, program, to: values.to, what: what.join(" "), by: dueDate(values.by) },
|
|
4754
|
+
convoyText,
|
|
4755
|
+
);
|
|
4756
|
+
}
|
|
4757
|
+
const convoy = text(words, "which convoy (its words or id)");
|
|
4758
|
+
only({ accept: ["project"], decline: ["note"], move: ["by"] }[act] ?? []);
|
|
4759
|
+
if (act === "move" && values.by === undefined)
|
|
4760
|
+
throw new HarborError("Moving it needs the new day: harbor convoy move CONVOY --by DATE.");
|
|
4761
|
+
return call(
|
|
4762
|
+
"convoy",
|
|
4763
|
+
{
|
|
4764
|
+
harbor,
|
|
4765
|
+
act,
|
|
4766
|
+
convoy,
|
|
4767
|
+
...(values.project !== undefined ? { project: values.project } : {}),
|
|
4768
|
+
...(values.note !== undefined ? { note: values.note } : {}),
|
|
4769
|
+
...(values.by !== undefined ? { by: dueDate(values.by) } : {}),
|
|
4770
|
+
},
|
|
4771
|
+
convoyText,
|
|
4772
|
+
);
|
|
4773
|
+
}
|
|
4774
|
+
case "salts": {
|
|
4775
|
+
const { positionals, values, harbor } = parse(spec([], ["risk", "task", "put-away"]));
|
|
4776
|
+
const project = text(positionals, "which project");
|
|
4777
|
+
const acts = ["risk", "task", "put-away"].filter((k) => values[k] !== undefined);
|
|
4778
|
+
if (acts.length > 1)
|
|
4779
|
+
throw new HarborError("One at a time: --risk N, --task N or --put-away N.");
|
|
4780
|
+
if (!acts.length) return call("old_salts", { harbor, project }, saltsText);
|
|
4781
|
+
const as = acts[0];
|
|
4782
|
+
const lesson = String(values[as]).trim();
|
|
4783
|
+
if (!/^[1-9]\d*$/.test(lesson))
|
|
4784
|
+
throw new HarborError(`--${as} takes the lesson's number from harbor salts "${project}".`);
|
|
4785
|
+
return call("heed_old_salt", { harbor, project, lesson, as }, heedSaltText);
|
|
4786
|
+
}
|
|
4787
|
+
case "rank": {
|
|
4788
|
+
const { positionals, values, harbor } = parse(spec(["clear"], ["order"]));
|
|
4789
|
+
const portfolio = text(positionals, "which portfolio");
|
|
4790
|
+
if (values.clear && values.order !== undefined)
|
|
4791
|
+
throw new HarborError("--order or --clear, not both.");
|
|
4792
|
+
if (values.clear) return call("set_dock_order", { harbor, portfolio, clear: true }, setRankText);
|
|
4793
|
+
if (values.order !== undefined) {
|
|
4794
|
+
const projects = values.order
|
|
4795
|
+
.split(",")
|
|
4796
|
+
.map((p) => p.trim())
|
|
4797
|
+
.filter(Boolean);
|
|
4798
|
+
if (projects.length < 2)
|
|
4799
|
+
throw new HarborError('Name at least two projects, commas between: --order "A, B".');
|
|
4800
|
+
return call("set_dock_order", { harbor, portfolio, projects }, setRankText);
|
|
4801
|
+
}
|
|
4802
|
+
return call("dock_order", { harbor, portfolio }, rankText);
|
|
4803
|
+
}
|
|
4650
4804
|
case "bridge": {
|
|
4651
4805
|
const { positionals, values, harbor } = parse(spec(["list"], ["program"]));
|
|
4652
4806
|
none(positionals);
|
package/lib/format.mjs
CHANGED
|
@@ -1622,3 +1622,110 @@ export function chatsText(r) {
|
|
|
1622
1622
|
}
|
|
1623
1623
|
return out.join("\n");
|
|
1624
1624
|
}
|
|
1625
|
+
const convoyLine = (c, side) =>
|
|
1626
|
+
side === "giver"
|
|
1627
|
+
? ` ${c.from} asks for “${c.what}” by ${c.by.slice(0, 10)} · ${c.text}`
|
|
1628
|
+
: ` “${c.what}” from ${c.to ?? "a deleted program"} by ${c.by.slice(0, 10)} · ${c.text}`;
|
|
1629
|
+
|
|
1630
|
+
/** harbor convoys: promises between programs, every one or one program's both ways. */
|
|
1631
|
+
export function convoysText(r) {
|
|
1632
|
+
if (!r.program) {
|
|
1633
|
+
if (!r.convoys.length)
|
|
1634
|
+
return 'No convoys yet. One program asks another with harbor convoy ask PROGRAM --to OTHER "WHAT" --by DATE.';
|
|
1635
|
+
const lines = [`${r.convoys.length} ${r.convoys.length === 1 ? "convoy" : "convoys"}:`, ""];
|
|
1636
|
+
for (const c of r.convoys)
|
|
1637
|
+
lines.push(` ${c.from} asks ${c.to ?? "a deleted program"} for “${c.what}” by ${c.by.slice(0, 10)}`, ` ${c.text}`);
|
|
1638
|
+
return lines.join("\n");
|
|
1639
|
+
}
|
|
1640
|
+
if (!r.waitingOn.length && !r.waitedOnBy.length)
|
|
1641
|
+
return `${r.program} has no convoys: it isn't waiting on another program, and none waits on it.`;
|
|
1642
|
+
const lines = [];
|
|
1643
|
+
if (r.waitingOn.length) {
|
|
1644
|
+
lines.push(`${r.program} waits on`);
|
|
1645
|
+
for (const c of r.waitingOn) lines.push(convoyLine(c, "asker"));
|
|
1646
|
+
}
|
|
1647
|
+
if (r.waitedOnBy.length) {
|
|
1648
|
+
if (lines.length) lines.push("");
|
|
1649
|
+
lines.push(`Others wait on ${r.program}`);
|
|
1650
|
+
for (const c of r.waitedOnBy) lines.push(convoyLine(c, "giver"));
|
|
1651
|
+
}
|
|
1652
|
+
return lines.join("\n");
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
/** What harbor convoy ask, accept, decline, deliver, move or withdraw did. */
|
|
1656
|
+
export function convoyText(r) {
|
|
1657
|
+
if (r.withdrawn)
|
|
1658
|
+
return r.what
|
|
1659
|
+
? `Withdrew ${r.from}'s ask of ${r.to ?? "a deleted program"} for “${r.what}”.`
|
|
1660
|
+
: "Withdrawn.";
|
|
1661
|
+
const c = r.convoy;
|
|
1662
|
+
const head = `${c.from} asks ${c.to ?? "a deleted program"} for “${c.what}” by ${c.by.slice(0, 10)}`;
|
|
1663
|
+
return `${head}.\n${c.text}.`;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
/** harbor salts PROJECT: what finished projects like it ran into. */
|
|
1667
|
+
export function saltsText(r) {
|
|
1668
|
+
if (r.note) return r.note;
|
|
1669
|
+
if (!r.lessons.length)
|
|
1670
|
+
return `No old salts for ${r.project}: no finished project like it left a lesson that's still out.`;
|
|
1671
|
+
const lines = [`Old salts for ${r.project}: what projects like it ran into`, ""];
|
|
1672
|
+
for (const l of r.lessons) {
|
|
1673
|
+
lines.push(` ${l.n}. ${l.text}`);
|
|
1674
|
+
if (l.helped) lines.push(` What helped: ${l.helped}`);
|
|
1675
|
+
}
|
|
1676
|
+
lines.push(
|
|
1677
|
+
"",
|
|
1678
|
+
`harbor salts "${r.project}" --risk N puts one on the register, --task N adds it as a task, --put-away N stops showing it.`,
|
|
1679
|
+
);
|
|
1680
|
+
return lines.join("\n");
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/** What harbor salts --risk, --task or --put-away did. */
|
|
1684
|
+
export function heedSaltText(r) {
|
|
1685
|
+
if (r.putAway) return `Put away “${r.putAway}” (from ${r.from}); it won't show on ${r.project} again.`;
|
|
1686
|
+
if (r.added === "risk") return `Added a risk to ${r.project}: “${r.title}” (from ${r.from}).`;
|
|
1687
|
+
return `Added a task to ${r.project}${r.key ? ` as ${r.key}` : ""}: “${r.title}” (from ${r.from}).`;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
/** harbor rank PORTFOLIO: the order kept on it, and how its ranking link stands. */
|
|
1691
|
+
export function rankText(r) {
|
|
1692
|
+
const lines = [];
|
|
1693
|
+
if (r.kept && r.kept.order.length) {
|
|
1694
|
+
const who = [r.kept.by ? `by ${r.kept.by}` : null, r.kept.at ? `on ${r.kept.at.slice(0, 10)}` : null]
|
|
1695
|
+
.filter(Boolean)
|
|
1696
|
+
.join(" ");
|
|
1697
|
+
const from = r.kept.voters > 1 ? `, from ${r.kept.voters} people's answers` : "";
|
|
1698
|
+
lines.push(`Which ship docks first in ${r.portfolio}${who ? ` (set ${who}${from})` : ""}`);
|
|
1699
|
+
for (const p of r.kept.order) lines.push(` ${p.place.padEnd(5)} ${p.project}`);
|
|
1700
|
+
if (r.kept.notRanked.length) lines.push(` Not ranked: ${r.kept.notRanked.join(", ")}`);
|
|
1701
|
+
} else {
|
|
1702
|
+
lines.push(
|
|
1703
|
+
r.openProjects < 2
|
|
1704
|
+
? `${r.portfolio} has ${r.openProjects ? "one open project" : "no open projects"}, so there's nothing to rank.`
|
|
1705
|
+
: `${r.portfolio} has no docking order yet (${r.openProjects} open projects).`,
|
|
1706
|
+
);
|
|
1707
|
+
}
|
|
1708
|
+
if (r.link) {
|
|
1709
|
+
lines.push("");
|
|
1710
|
+
const state = r.link.open ? "open" : "closed";
|
|
1711
|
+
const counted = `${r.link.voters} ${r.link.voters === 1 ? "person" : "people"}, ${r.link.answers} ${r.link.answers === 1 ? "answer" : "answers"}`;
|
|
1712
|
+
lines.push(`The ranking link made ${r.link.made.slice(0, 10)} is ${state}: ${counted}${r.link.url ? `\n ${r.link.url}` : ""}`);
|
|
1713
|
+
for (const p of r.link.standing)
|
|
1714
|
+
lines.push(` ${p.place.padEnd(5)} ${p.project}${p.overNext ? ` · ${p.overNext} over the next` : ""}`);
|
|
1715
|
+
}
|
|
1716
|
+
if (r.openProjects >= 2)
|
|
1717
|
+
lines.push(
|
|
1718
|
+
"",
|
|
1719
|
+
`harbor rank "${r.portfolio}" --order "First, Second, …" puts an order on it; --clear takes it off. A ranking link for the crew is made on the portfolio page.`,
|
|
1720
|
+
);
|
|
1721
|
+
return lines.join("\n");
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/** What harbor rank --order or --clear did. */
|
|
1725
|
+
export function setRankText(r) {
|
|
1726
|
+
if (r.cleared) return `Took the docking order off ${r.portfolio}.`;
|
|
1727
|
+
const lines = [`Docking order on ${r.portfolio}:`];
|
|
1728
|
+
r.order.forEach((name, i) => lines.push(` ${String(i + 1).padStart(2)}. ${name}`));
|
|
1729
|
+
if (r.notRanked.length) lines.push(` Not ranked: ${r.notRanked.join(", ")}`);
|
|
1730
|
+
return lines.join("\n");
|
|
1731
|
+
}
|