@harborppm/cli 0.108.0 → 0.110.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 +5 -3
- package/dist/app.mjs +121 -41
- package/lib/cli.mjs +130 -1
- package/lib/format.mjs +36 -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
|
|
|
@@ -222,6 +222,8 @@ harbor premortem PROJECT ["WHAT WENT WRONG"] [--start]
|
|
|
222
222
|
harbor voyage PROJECT ["YOUR LINE"]
|
|
223
223
|
harbor messages PROJECT ["TEXT"] [--limit N] | messages PROJECT --edit "TEXT" [--message ID]
|
|
224
224
|
harbor chat TASK|PROJECT|PROGRAM ["TEXT"] [--reply N] [--watch]
|
|
225
|
+
harbor chat @NAME [@NAME…] ["TEXT"] [--watch]
|
|
226
|
+
harbor chats
|
|
225
227
|
harbor note PROJECT ["NOTE"] [--opens DATE|--milestone NAME|--off-track]
|
|
226
228
|
harbor sound TASK [--answer DAYS|--ask NAMES|--settle DAYS] [--why TEXT]
|
|
227
229
|
harbor soundings [PROJECT]
|
|
@@ -275,7 +277,7 @@ A task has one owner (`--assignee`), who answers for it and whose load it counts
|
|
|
275
277
|
|
|
276
278
|
`harbor limit RR` prints how many tasks each of a board's columns takes at once; `harbor limit RR doing 8` changes one (1 to 20, or `none` for no limit), if you own the harbor. `harbor projects --json` carries each board's `limits` too.
|
|
277
279
|
|
|
278
|
-
`harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor messages PROJECT` reads a project's Messages tab, one conversation for the whole project, and `harbor messages PROJECT "TEXT"` writes to it; `@Name` sends it to that person's Inbox. `harbor chat` is the same for any piece of work: `harbor chat RR-42` reads a task's comments, `harbor chat Footwear` a program's messages, `harbor chat Footwear "TEXT" --reply 2` replies under message [2], and `--watch` follows the conversation live, printing new lines as they come; in a terminal, type a line to post it. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor goals` lists each portfolio's goals, off track first, with each key result's progress. `harbor goal "TITLE" --new` sets one, and `harbor goal "GOAL"` reads or changes one: `--owner`, `--due`, `--why`, `--link "Ridge Runner"` to count a program, project or task toward it, `--kr "Stores signed" --target 40` to add a number key result and `--kr "Stores signed" --at 12` to move it. `harbor milestones` lists a program's milestones soonest first, with how many of their tasks are done, who signs them off and what they wait on; `harbor milestone "NAME" --new --program P --due DATE` adds one, and `harbor milestone "NAME"` moves (`--due`), renames, ticks (`--reached`), sets who signs it off (`--signs-off`), or, if it's yours to sign, `--approve`s it or asks for `--changes`. `harbor reports` prints the Reports page's dashboards, each chart as its numbers. `harbor messages PROJECT --edit "TEXT"` fixes your latest message there. `harbor ashore` lists the public holidays and time away in the next eight weeks; `--country US,GB` sets whose holidays the harbor takes and `--person NAME --country DE` one person's own, which the forecast and the weekly load then count as days off.
|
|
280
|
+
`harbor premortem` runs a pre-mortem with your crew: `--start` asks everyone "it's after the end date and this project failed: what happened?", each person adds answers alone for five minutes, and then the answers show together on the project's Risks & issues tab, where each becomes a risk in one click. On its own it prints the question and the answers you can see. Once a project is Done, `harbor voyage` prints its voyage log (planned against actual dates, the biggest slips, the risks that came true, who closed the most, and the crew's lines) and adds yours. `harbor messages PROJECT` reads a project's Messages tab, one conversation for the whole project, and `harbor messages PROJECT "TEXT"` writes to it; `@Name` sends it to that person's Inbox. `harbor chat` is the same for any piece of work: `harbor chat RR-42` reads a task's comments, `harbor chat Footwear` a program's messages, `harbor chat Footwear "TEXT" --reply 2` replies under message [2], and `--watch` follows the conversation live, printing new lines as they come; in a terminal, type a line to post it. `harbor chat @aya "TEXT"` writes a direct message (the Chat page's), `harbor chat @aya @ben "TEXT"` writes to a group of just them, `harbor chat @aya` reads it (and `--watch` follows it), and `harbor chats` lists your direct messages; only the people in a chat can read it. `harbor note` leaves a note for later on a project: it stays sealed (the crew sees only that it's there and who left it) until its day, until one of the program's milestones is reached, or until the project turns Off track, and then it opens at the top of the project and in the brief. `harbor sound TASK --ask crew` takes a sounding: it asks you, the task's owner and whoever has open work on its project how many working days the task will take (`--ask "Sam,Priya"` picks who). Each person answers alone with `harbor sound TASK --answer 4 --why "…"`, and nobody sees the others' numbers until everyone has; then `harbor sound TASK` shows the spread, an estimate when the guesses are close, or "talk about this first" when they're far apart, and `--settle DAYS` records what you agreed. `harbor soundings` lists them, the ones waiting on your answer first. `harbor goals` lists each portfolio's goals, off track first, with each key result's progress. `harbor goal "TITLE" --new` sets one, and `harbor goal "GOAL"` reads or changes one: `--owner`, `--due`, `--why`, `--link "Ridge Runner"` to count a program, project or task toward it, `--kr "Stores signed" --target 40` to add a number key result and `--kr "Stores signed" --at 12` to move it. `harbor milestones` lists a program's milestones soonest first, with how many of their tasks are done, who signs them off and what they wait on; `harbor milestone "NAME" --new --program P --due DATE` adds one, and `harbor milestone "NAME"` moves (`--due`), renames, ticks (`--reached`), sets who signs it off (`--signs-off`), or, if it's yours to sign, `--approve`s it or asks for `--changes`. `harbor reports` prints the Reports page's dashboards, each chart as its numbers. `harbor messages PROJECT --edit "TEXT"` fixes your latest message there. `harbor ashore` lists the public holidays and time away in the next eight weeks; `--country US,GB` sets whose holidays the harbor takes and `--person NAME --country DE` one person's own, which the forecast and the weekly load then count as days off.
|
|
279
281
|
|
|
280
282
|
`harbor brief --say` turns the brief into the BBC's Shipping Forecast: each program an area, wind for late work, visibility for health, gale warnings for anything off track. It prints the forecast and speaks it with your computer's own voice (`say` on a Mac, Windows' speech, or `espeak-ng` on Linux, which you may need to install). With `--json` it prints the forecast and stays quiet.
|
|
281
283
|
|
package/dist/app.mjs
CHANGED
|
@@ -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
|
-
|
|
6750
|
-
|
|
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
|
|
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
|
|
6752
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
|
];
|
|
@@ -17043,6 +17115,7 @@ init_format();
|
|
|
17043
17115
|
const PAGES = {
|
|
17044
17116
|
today: "/today",
|
|
17045
17117
|
inbox: "/inbox",
|
|
17118
|
+
chat: "/chat",
|
|
17046
17119
|
week: "/week",
|
|
17047
17120
|
brief: "/brief",
|
|
17048
17121
|
review: "/review",
|
|
@@ -33392,6 +33465,7 @@ function ProgramView({ programId, active, width, height, go, onBack }) {
|
|
|
33392
33465
|
if (input === "n") return go.create("project", { programId });
|
|
33393
33466
|
if (input === "m") return go.create("milestone", { programId });
|
|
33394
33467
|
if (input === "c") return go.openPanel("shore", programId);
|
|
33468
|
+
if (input === "M") return go.openMessages(programId, "program");
|
|
33395
33469
|
if (input === "R") return go.create("raid", {});
|
|
33396
33470
|
if (input === "D" && split.done.length > 0) {
|
|
33397
33471
|
setSide("projects");
|
|
@@ -36774,9 +36848,10 @@ function App({ ui, startIn }) {
|
|
|
36774
36848
|
kind: "portfolio",
|
|
36775
36849
|
id
|
|
36776
36850
|
}),
|
|
36777
|
-
openMessages: (id) => push({
|
|
36851
|
+
openMessages: (id, on = "project") => push({
|
|
36778
36852
|
kind: "messages",
|
|
36779
|
-
id
|
|
36853
|
+
id,
|
|
36854
|
+
on
|
|
36780
36855
|
}),
|
|
36781
36856
|
openBridge: (programIds) => push({
|
|
36782
36857
|
kind: "bridge",
|
|
@@ -37159,6 +37234,7 @@ function App({ ui, startIn }) {
|
|
|
37159
37234
|
] : page?.kind === "messages" ? [
|
|
37160
37235
|
["↑↓", "move"],
|
|
37161
37236
|
["n", "write"],
|
|
37237
|
+
["a", "answer"],
|
|
37162
37238
|
["e", "change yours"],
|
|
37163
37239
|
["d", "delete"],
|
|
37164
37240
|
["Esc", "back"]
|
|
@@ -37188,6 +37264,7 @@ function App({ ui, startIn }) {
|
|
|
37188
37264
|
...page.kind === "program" ? [
|
|
37189
37265
|
["m", "milestone"],
|
|
37190
37266
|
["c", "chat channel"],
|
|
37267
|
+
["M", "messages"],
|
|
37191
37268
|
["←→", "lists"]
|
|
37192
37269
|
] : [],
|
|
37193
37270
|
["Esc", "back"]
|
|
@@ -37219,9 +37296,12 @@ function App({ ui, startIn }) {
|
|
|
37219
37296
|
}, page.id);
|
|
37220
37297
|
else if (page?.kind === "messages") screenNode = /* @__PURE__ */ jsx(MessagesView, {
|
|
37221
37298
|
...viewProps,
|
|
37222
|
-
|
|
37299
|
+
place: {
|
|
37300
|
+
kind: page.on,
|
|
37301
|
+
id: page.id
|
|
37302
|
+
},
|
|
37223
37303
|
onBack: back
|
|
37224
|
-
}, page.id);
|
|
37304
|
+
}, `${page.on}-${page.id}`);
|
|
37225
37305
|
else if (page?.kind === "program") screenNode = /* @__PURE__ */ jsx(ProgramView, {
|
|
37226
37306
|
...viewProps,
|
|
37227
37307
|
programId: page.id,
|
package/lib/cli.mjs
CHANGED
|
@@ -38,6 +38,9 @@ import {
|
|
|
38
38
|
notesText,
|
|
39
39
|
messagesText,
|
|
40
40
|
chatText,
|
|
41
|
+
chatsText,
|
|
42
|
+
directLineText,
|
|
43
|
+
directText,
|
|
41
44
|
chatLineText,
|
|
42
45
|
chatWhere,
|
|
43
46
|
digestText,
|
|
@@ -285,6 +288,10 @@ export const HELP = `harbor: Harbor from the terminal
|
|
|
285
288
|
harbor messages PROJECT --edit "TEXT" [--message ID]
|
|
286
289
|
fix your latest message (or that
|
|
287
290
|
one) in its project
|
|
291
|
+
harbor chat @NAME [@NAME…] ["TEXT"] [--watch]
|
|
292
|
+
direct messages: to one person or
|
|
293
|
+
a few, private to them
|
|
294
|
+
harbor chats your direct messages
|
|
288
295
|
harbor charter PROJECT [--why T] [--in T] [--out T] [--done-when T]
|
|
289
296
|
[--calls NAME]
|
|
290
297
|
a project's five-line charter
|
|
@@ -1599,7 +1606,13 @@ const DETAIL = {
|
|
|
1599
1606
|
" they come; in a terminal, type a",
|
|
1600
1607
|
' line to post it, "/r N text" to',
|
|
1601
1608
|
" reply, Ctrl+C to stop",
|
|
1609
|
+
' harbor chat @aya "TEXT" writes a direct message to Aya',
|
|
1610
|
+
' harbor chat @aya @ben "TEXT" writes to a group of just them',
|
|
1611
|
+
" harbor chat @aya [--watch] reads (or follows) your chat with Aya",
|
|
1612
|
+
" harbor chats lists your direct messages",
|
|
1602
1613
|
"",
|
|
1614
|
+
" Direct messages are private: only the people in a chat can read it, and",
|
|
1615
|
+
" the Chat page on the website has the same ones.",
|
|
1603
1616
|
" A task key goes to its comments; a name to that project's messages, or",
|
|
1604
1617
|
" the program's when no project has it (--project or --program says which",
|
|
1605
1618
|
" when both do). Messages are numbered [1], [2]… with their replies under",
|
|
@@ -1607,6 +1620,13 @@ const DETAIL = {
|
|
|
1607
1620
|
" --limit N shows up to 500. --watch asks every 5 seconds while people are",
|
|
1608
1621
|
" talking and every 30 once it's quiet.",
|
|
1609
1622
|
],
|
|
1623
|
+
chats: [
|
|
1624
|
+
" harbor chats your direct messages, newest first",
|
|
1625
|
+
"",
|
|
1626
|
+
" Each with who it's with, what's unread and its last line, and the",
|
|
1627
|
+
" command that opens it. harbor chat @aya \"TEXT\" writes to someone;",
|
|
1628
|
+
" harbor chat @aya @ben \"TEXT\" to a group of just them.",
|
|
1629
|
+
],
|
|
1610
1630
|
messages: [
|
|
1611
1631
|
" harbor messages PROJECT reads a project's Messages tab",
|
|
1612
1632
|
' harbor messages PROJECT "TEXT" writes: posts to everyone on it',
|
|
@@ -4292,10 +4312,109 @@ export async function run(argv, io = {}) {
|
|
|
4292
4312
|
const { positionals, values, harbor } = parse(
|
|
4293
4313
|
spec(["watch", "task", "project", "program"], ["limit", "reply"]),
|
|
4294
4314
|
);
|
|
4315
|
+
// harbor chat @aya [@ben …] ["TEXT"]: direct messages, private to the people in them.
|
|
4316
|
+
const ats = [];
|
|
4317
|
+
while (ats.length < positionals.length && positionals[ats.length].startsWith("@"))
|
|
4318
|
+
ats.push(positionals[ats.length]);
|
|
4319
|
+
if (ats.length || /^chat_[\w-]+$/.test(positionals[0] ?? "")) {
|
|
4320
|
+
if (["task", "project", "program"].some((k) => values[k]) || values.reply)
|
|
4321
|
+
throw new HarborError(
|
|
4322
|
+
"--task, --project, --program and --reply are for the talk on the work, not direct messages.",
|
|
4323
|
+
);
|
|
4324
|
+
const who = ats.length
|
|
4325
|
+
? { harbor, with: ats.join(",") }
|
|
4326
|
+
: { harbor, chat: positionals[0] };
|
|
4327
|
+
const text = positionals.slice(ats.length || 1).join(" ").trim();
|
|
4328
|
+
const call = (name, args) =>
|
|
4329
|
+
client.call(name, { ...who, ...args }).catch((err) => {
|
|
4330
|
+
if (err instanceof HarborError) throw new HarborError(hint(err.message));
|
|
4331
|
+
throw err;
|
|
4332
|
+
});
|
|
4333
|
+
const n = values.limit ? Number(values.limit) : 30;
|
|
4334
|
+
if (!Number.isInteger(n) || n < 1 || n > 200)
|
|
4335
|
+
throw new HarborError("--limit is a whole number from 1 to 200 for direct messages.");
|
|
4336
|
+
if (text && !values.watch) {
|
|
4337
|
+
const r = await call("post_direct", { body: text });
|
|
4338
|
+
out(asJson ? jsonText(r) : plain(`Sent to ${r.chat.title}.`));
|
|
4339
|
+
return 0;
|
|
4340
|
+
}
|
|
4341
|
+
if (!values.watch) {
|
|
4342
|
+
const r = await call("read_direct", { limit: n, markRead: true });
|
|
4343
|
+
out(asJson ? jsonText(r) : plain(directText(r)));
|
|
4344
|
+
return 0;
|
|
4345
|
+
}
|
|
4346
|
+
if (asJson) throw new HarborError("--watch prints lines as they come; leave --json off.");
|
|
4347
|
+
if (text) await call("post_direct", { body: text });
|
|
4348
|
+
const firstRead = await call("read_direct", { limit: 20, markRead: true });
|
|
4349
|
+
out(plain(directText(firstRead)));
|
|
4350
|
+
const seenIds = new Set(firstRead.messages.map((m) => m.id));
|
|
4351
|
+
let last = firstRead.messages.at(-1)?.at;
|
|
4352
|
+
const tty = io.terminal ?? Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
4353
|
+
const nap = io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms)));
|
|
4354
|
+
out(
|
|
4355
|
+
plain(
|
|
4356
|
+
tty
|
|
4357
|
+
? `Watching your chat with ${firstRead.chat.title}. Type a line and Enter to send; Ctrl+C stops.`
|
|
4358
|
+
: `Watching your chat with ${firstRead.chat.title}; Ctrl+C stops.`,
|
|
4359
|
+
),
|
|
4360
|
+
);
|
|
4361
|
+
let lines = null;
|
|
4362
|
+
let done = false;
|
|
4363
|
+
let wait = CHAT_POLL_MS;
|
|
4364
|
+
if (tty && (io.stdin ?? process.stdin).isTTY !== false) {
|
|
4365
|
+
const { createInterface } = await import("node:readline");
|
|
4366
|
+
lines = createInterface({ input: io.stdin ?? process.stdin, terminal: false });
|
|
4367
|
+
lines.on("close", () => {
|
|
4368
|
+
done = true;
|
|
4369
|
+
});
|
|
4370
|
+
lines.on("line", (line) => {
|
|
4371
|
+
const said = line.trim();
|
|
4372
|
+
if (!said) return;
|
|
4373
|
+
if (said === "/q" || said === "/quit") return void lines.close();
|
|
4374
|
+
call("post_direct", { body: said }).then(
|
|
4375
|
+
(r) => {
|
|
4376
|
+
seenIds.add(r.message.id);
|
|
4377
|
+
wait = CHAT_POLL_MS;
|
|
4378
|
+
out(" (sent)");
|
|
4379
|
+
},
|
|
4380
|
+
(err) => out(plain(` Not sent: ${err instanceof Error ? err.message : String(err)}`)),
|
|
4381
|
+
);
|
|
4382
|
+
});
|
|
4383
|
+
}
|
|
4384
|
+
let turns = io.watchRounds ?? Infinity;
|
|
4385
|
+
try {
|
|
4386
|
+
while (!done && turns-- > 0) {
|
|
4387
|
+
await nap(wait);
|
|
4388
|
+
if (done) break;
|
|
4389
|
+
let r;
|
|
4390
|
+
try {
|
|
4391
|
+
r = await call("read_direct", {
|
|
4392
|
+
limit: 200,
|
|
4393
|
+
markRead: true,
|
|
4394
|
+
...(last ? { since: last } : {}),
|
|
4395
|
+
});
|
|
4396
|
+
} catch (err) {
|
|
4397
|
+
if (err instanceof HarborError) throw err;
|
|
4398
|
+
wait = CHAT_POLL_MAX_MS;
|
|
4399
|
+
continue;
|
|
4400
|
+
}
|
|
4401
|
+
const fresh = r.messages.filter((m) => !seenIds.has(m.id));
|
|
4402
|
+
for (const m of fresh) {
|
|
4403
|
+
seenIds.add(m.id);
|
|
4404
|
+
out(plain(directLineText(m)));
|
|
4405
|
+
}
|
|
4406
|
+
if (r.messages.length) last = r.messages.at(-1).at;
|
|
4407
|
+
wait = fresh.length ? CHAT_POLL_MS : Math.min(CHAT_POLL_MAX_MS, Math.round(wait * 1.5));
|
|
4408
|
+
}
|
|
4409
|
+
} finally {
|
|
4410
|
+
lines?.close();
|
|
4411
|
+
}
|
|
4412
|
+
return 0;
|
|
4413
|
+
}
|
|
4295
4414
|
const [on, ...words] = positionals;
|
|
4296
4415
|
if (!on)
|
|
4297
4416
|
throw new HarborError(
|
|
4298
|
-
'Give a task key, project or program, and a message if you\'re writing one: harbor chat RR-42 "TEXT".',
|
|
4417
|
+
'Give a task key, project or program, and a message if you\'re writing one: harbor chat RR-42 "TEXT". For a direct message: harbor chat @aya "TEXT".',
|
|
4299
4418
|
);
|
|
4300
4419
|
const kinds = ["task", "project", "program"].filter((k) => values[k]);
|
|
4301
4420
|
if (kinds.length > 1) throw new HarborError("Say one of --task, --project or --program.");
|
|
@@ -4413,6 +4532,16 @@ export async function run(argv, io = {}) {
|
|
|
4413
4532
|
}
|
|
4414
4533
|
return 0;
|
|
4415
4534
|
}
|
|
4535
|
+
case "chats": {
|
|
4536
|
+
const { positionals, harbor } = parse(spec([], []));
|
|
4537
|
+
none(positionals);
|
|
4538
|
+
const r = await client.call("direct_chats", { harbor }).catch((err) => {
|
|
4539
|
+
if (err instanceof HarborError) throw new HarborError(hint(err.message));
|
|
4540
|
+
throw err;
|
|
4541
|
+
});
|
|
4542
|
+
out(asJson ? jsonText(r) : plain(chatsText(r)));
|
|
4543
|
+
return 0;
|
|
4544
|
+
}
|
|
4416
4545
|
case "watch": {
|
|
4417
4546
|
const { positionals, values, harbor } = parse(spec(["bell", "once"], ["project", "since"]));
|
|
4418
4547
|
none(positionals);
|
package/lib/format.mjs
CHANGED
|
@@ -1586,3 +1586,39 @@ export function digestText(r, hours) {
|
|
|
1586
1586
|
if (r.quiet) return `Nothing changed on ${r.on} in ${span}.`;
|
|
1587
1587
|
return [`What changed on ${r.on} in ${span}`, ...r.lines.map((l) => ` • ${l}`)].join("\n");
|
|
1588
1588
|
}
|
|
1589
|
+
|
|
1590
|
+
const directWhen = (at) => at.slice(0, 16).replace("T", " ");
|
|
1591
|
+
|
|
1592
|
+
/** One line of a direct chat: "Aya Tan · 2026-11-08 14:10: see you there", or what happened to it. */
|
|
1593
|
+
export function directLineText(m) {
|
|
1594
|
+
const when = directWhen(m.at);
|
|
1595
|
+
if (m.event === "left") return `· ${m.who} left · ${when}`;
|
|
1596
|
+
if (m.event === "joined") return `· ${m.who} added ${m.detail ?? "someone"} · ${when}`;
|
|
1597
|
+
if (m.event === "renamed")
|
|
1598
|
+
return m.detail ? `· ${m.who} named it “${m.detail}” · ${when}` : `· ${m.who} took its name off · ${when}`;
|
|
1599
|
+
return `${m.who} · ${when}: ${(m.text ?? "").replace(/\s*\n\s*/g, " / ")}`;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
/** read_direct: the chat's messages, oldest first. */
|
|
1603
|
+
export function directText(r) {
|
|
1604
|
+
const head = r.chat.kind === "pair" ? `Chat with ${r.chat.title}` : `${r.chat.title} (${r.chat.with.join(", ")})`;
|
|
1605
|
+
const list = r.messages ?? [];
|
|
1606
|
+
if (!list.length) return `${head}\nNothing yet. Only the people in it can read it.`;
|
|
1607
|
+
return [head, ...(r.more ? ["Earlier messages left out (--limit N shows more)."] : []), ...list.map(directLineText)].join("\n");
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/** direct_chats: your direct messages, newest first. */
|
|
1611
|
+
export function chatsText(r) {
|
|
1612
|
+
const chats = r.chats ?? [];
|
|
1613
|
+
if (!chats.length) return 'No direct messages yet. harbor chat @NAME "TEXT" writes to someone; @a,@b starts a group.';
|
|
1614
|
+
const out = [`${chats.length} ${chats.length === 1 ? "chat" : "chats"} in ${r.harbor.name}`];
|
|
1615
|
+
for (const c of chats) {
|
|
1616
|
+
out.push(
|
|
1617
|
+
"",
|
|
1618
|
+
`${c.title}${c.kind === "group" ? ` (${c.with.join(", ")})` : ""}${c.unread ? ` · ${c.unread} unread` : ""}`,
|
|
1619
|
+
c.last ? ` ${directLineText(c.last)}` : " No messages yet",
|
|
1620
|
+
` harbor chat ${c.id}`,
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1623
|
+
return out.join("\n");
|
|
1624
|
+
}
|