@nanocollective/roster 0.1.0-beta.21 → 0.1.0-beta.23

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.
Files changed (61) hide show
  1. package/dist/cli.js +10 -1
  2. package/dist/worker/assets/assets/css/astryx.css +948 -0
  3. package/dist/worker/assets/assets/css/base.css +47 -112
  4. package/dist/worker/assets/assets/css/brain.css +15 -11
  5. package/dist/worker/assets/assets/css/graph.css +9 -12
  6. package/dist/worker/assets/assets/css/health.css +4 -7
  7. package/dist/worker/assets/assets/css/home.css +27 -29
  8. package/dist/worker/assets/assets/css/layout.css +10 -20
  9. package/dist/worker/assets/assets/css/markdown.css +1 -1
  10. package/dist/worker/assets/assets/css/runs.css +5 -3
  11. package/dist/worker/assets/assets/css/search.css +3 -6
  12. package/dist/worker/assets/assets/css/setup.css +3 -15
  13. package/dist/worker/assets/assets/js/app.js +2 -0
  14. package/dist/worker/assets/assets/js/astryx-ui.js +34 -0
  15. package/dist/worker/assets/assets/js/homesort.js +43 -4
  16. package/dist/worker/assets/assets/js/icons.js +2 -0
  17. package/dist/worker/assets/assets/js/select.js +362 -0
  18. package/dist/worker/assets/assets/js/views/graph.js +67 -28
  19. package/dist/worker/assets/assets/js/views/home.js +98 -112
  20. package/dist/worker/assets/assets/js/views/people.js +8 -2
  21. package/dist/worker/assets/assets/js/views/runs.js +3 -1
  22. package/dist/worker/assets/docs-images/brain.jpg +0 -0
  23. package/dist/worker/assets/docs-images/home.jpg +0 -0
  24. package/dist/worker/assets/docs-images/org.jpg +0 -0
  25. package/dist/worker/assets/docs-images/prompt.jpg +0 -0
  26. package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
  27. package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
  28. package/dist/worker/assets/docs-images/staff.jpg +0 -0
  29. package/dist/worker/assets/index.html +11 -3
  30. package/dist/worker/index.js +28 -4
  31. package/docs/getting-started.md +1 -1
  32. package/docs/images/brain.jpg +0 -0
  33. package/docs/images/home.jpg +0 -0
  34. package/docs/images/org.jpg +0 -0
  35. package/docs/images/prompt.jpg +0 -0
  36. package/docs/images/setup-org.jpg +0 -0
  37. package/docs/images/setup-plan.jpg +0 -0
  38. package/docs/images/staff.jpg +0 -0
  39. package/docs/portal.md +16 -11
  40. package/package.json +7 -1
  41. package/templates/portal/css/astryx.css +948 -0
  42. package/templates/portal/css/base.css +47 -112
  43. package/templates/portal/css/brain.css +15 -11
  44. package/templates/portal/css/graph.css +9 -12
  45. package/templates/portal/css/health.css +4 -7
  46. package/templates/portal/css/home.css +27 -29
  47. package/templates/portal/css/layout.css +10 -20
  48. package/templates/portal/css/markdown.css +1 -1
  49. package/templates/portal/css/runs.css +5 -3
  50. package/templates/portal/css/search.css +3 -6
  51. package/templates/portal/css/setup.css +3 -15
  52. package/templates/portal/index.html +11 -3
  53. package/templates/portal/js/app.js +2 -0
  54. package/templates/portal/js/astryx-ui.js +34 -0
  55. package/templates/portal/js/homesort.js +43 -4
  56. package/templates/portal/js/icons.js +2 -0
  57. package/templates/portal/js/select.js +362 -0
  58. package/templates/portal/js/views/graph.js +67 -28
  59. package/templates/portal/js/views/home.js +98 -112
  60. package/templates/portal/js/views/people.js +8 -2
  61. package/templates/portal/js/views/runs.js +3 -1
@@ -6,7 +6,7 @@
6
6
  * sheet, the same thread view Trackers has, with the reply box in it. */
7
7
 
8
8
  import { getLive, post } from "../api.js";
9
- import { sheet } from "../dialog.js";
9
+ import { askText, sheet } from "../dialog.js";
10
10
  import { ago, el, skeleton } from "../dom.js";
11
11
  import { daysUntil, isFor, sortHome } from "../homesort.js";
12
12
  import { mdlite } from "../md.js";
@@ -56,7 +56,6 @@ export function viewHome(m) {
56
56
 
57
57
  const page = el("div", { className: "home" });
58
58
  page.append(team(staff));
59
- page.append(askBox(staff));
60
59
 
61
60
  /* With more than one person, each sees what is on them, plus anything on nobody in
62
61
  particular. Everyone's is one click away, so nothing is hidden for good. */
@@ -75,12 +74,7 @@ export function viewHome(m) {
75
74
  );
76
75
  } else page.append(el("p", { className: "homeempty", textContent: "Nothing needs you." }));
77
76
 
78
- const reporters = staff.filter((x) => x.brain && x.statusIssue);
79
- if (reporters.length) {
80
- page.append(section("Progress"));
81
- page.append(el("div", { className: "homereports" }, reporters.map((s) => reportRow(s, h.reports))));
82
- }
83
-
77
+ // What is waiting on you, or was asked by you, comes before how the staff say it is going.
84
78
  if (h.unread.length) {
85
79
  page.append(section("Unread", h.unread.length));
86
80
  page.append(listBox(h.unread.map(unreadRow)));
@@ -91,6 +85,12 @@ export function viewHome(m) {
91
85
  page.append(listBox(h.requests.map(requestRow)));
92
86
  }
93
87
 
88
+ const reporters = staff.filter((x) => x.brain && x.statusIssue);
89
+ if (reporters.length) {
90
+ page.append(section("Progress"));
91
+ page.append(el("div", { className: "card homereports" }, reporters.map((s) => reportRow(s, h.reports))));
92
+ }
93
+
94
94
  if (h.closedToday.length) {
95
95
  page.append(section("Closed today", h.closedToday.length));
96
96
  page.append(listBox(h.closedToday.map(closedRow)));
@@ -109,15 +109,15 @@ const openReports = new Set();
109
109
  const STATUS_TONE = { "on track": "ok", "needs you": "warm", stuck: "hot", blocked: "hot" };
110
110
 
111
111
  /**
112
- * One staff member's report: the body of their status issue, which every run rewrites, as a
113
- * card. Its status and one line on how it is going, what got done and what is next, with the
114
- * rest a click away. There is a button to ask for a fresh one.
112
+ * One staff member's report, as a row: who, their status, and when it was written; then the
113
+ * one line on how it is going and what is next. What got done, and the rest of the report,
114
+ * open under it. Their status issue is rewritten by every run, so this is always the latest.
115
115
  */
116
116
  function reportRow(s, reports) {
117
117
  const r = reports.find((x) => x.staff.handle === s.handle);
118
118
  const item = r?.item ?? { repo: s.brain, number: s.statusIssue, kind: "issue" };
119
119
  const note = el("span", { className: "meta" });
120
- const ask = el("button", { className: "ghbtn", textContent: "Ask for an update" });
120
+ const ask = el("button", { className: "ghbtn sm", textContent: "Ask for an update" });
121
121
  ask.onclick = async () => {
122
122
  ask.disabled = true;
123
123
  note.className = "meta";
@@ -140,10 +140,12 @@ function reportRow(s, reports) {
140
140
  };
141
141
 
142
142
  const full = openReports.has(s.handle);
143
- const card = el("div", { className: "card homereport" + (full ? " full" : "") });
143
+ const row = el("div", { className: "homereport" + (full ? " full" : "") });
144
144
  const issue = el("button", { className: "homereportissue", textContent: "#" + item.number });
145
145
  issue.onclick = () => openThread(item);
146
146
  const p = r ? parseReport(r.body) : null;
147
+ const needs = p?.sections.needs?.length ?? 0;
148
+
147
149
  const head = el("div", { className: "homereporthead" }, [
148
150
  el("span", { className: "homewho2" }, [icon(staffIcon(s), "ic"), el("b", { textContent: s.name })]),
149
151
  ]);
@@ -151,7 +153,8 @@ function reportRow(s, reports) {
151
153
  head.append(
152
154
  el("span", {
153
155
  className: "chip homereportstatus " + (STATUS_TONE[p.status] ?? ""),
154
- textContent: cap(p.status),
156
+ textContent: cap(p.status) + (needs ? ` · ${needs}` : ""),
157
+ title: needs ? `Waiting on a person: ${needs} thing${needs === 1 ? "" : "s"}` : "",
155
158
  }),
156
159
  );
157
160
  }
@@ -161,48 +164,53 @@ function reportRow(s, reports) {
161
164
  issue,
162
165
  ]),
163
166
  );
164
- card.append(head);
167
+ const acts = el("span", { className: "homereportacts" }, [note]);
168
+ if (r) {
169
+ const more = el("button", { className: "ghbtn sm", textContent: full ? "Show less" : "Full report" });
170
+ more.onclick = () => {
171
+ if (openReports.has(s.handle)) openReports.delete(s.handle);
172
+ else openReports.add(s.handle);
173
+ repaintInPlace();
174
+ };
175
+ acts.append(more);
176
+ }
177
+ acts.append(ask);
178
+ head.append(acts);
179
+ row.append(head);
165
180
 
166
- if (p) {
167
- if (p.headline) {
168
- card.append(el("div", { className: "md homereportline", innerHTML: mdlite(p.headline, { repo: s.brain }) }));
169
- }
181
+ if (!p) return row;
182
+ if (p.headline) {
183
+ row.append(el("div", { className: "md homereportline", innerHTML: mdlite(p.headline, { repo: s.brain }) }));
184
+ }
185
+ const next = p.sections.next?.[0];
186
+ if (next && !full) {
187
+ row.append(
188
+ el("div", { className: "homereportnext" }, [
189
+ el("b", { textContent: "Next" }),
190
+ el("span", { className: "md", innerHTML: mdlite(next, { repo: s.brain }) }),
191
+ ]),
192
+ );
193
+ }
194
+ if (full) {
170
195
  const cols = [
171
196
  ["done", "Done"],
172
197
  ["next", "Next"],
198
+ ["needs", "Waiting on a person"],
173
199
  ].filter(([k]) => p.sections[k]?.length);
174
- if (cols.length && !full) {
175
- card.append(
200
+ if (cols.length) {
201
+ row.append(
176
202
  el(
177
203
  "div",
178
204
  { className: "homereportcols" },
179
- cols.map(([k, label]) => bullets(label, p.sections[k], s.brain, 3)),
205
+ cols.map(([k, label]) => bullets(label, p.sections[k], s.brain, 99)),
180
206
  ),
181
207
  );
208
+ } else {
209
+ // A report in the old shape has no sections, so the whole of it stands in.
210
+ row.append(el("div", { className: "md homereportbody", innerHTML: mdlite(r.body, { repo: s.brain }) }));
182
211
  }
183
- const needs = p.sections.needs?.length ?? 0;
184
- if (needs && !full) {
185
- card.append(
186
- el("p", {
187
- className: "homereportneeds",
188
- textContent: `Waiting on a person: ${needs} thing${needs === 1 ? "" : "s"}.`,
189
- }),
190
- );
191
- }
192
- // A report in the old shape has no sections to show, so its opening lines stand in.
193
- const body = el("div", { className: "md homereportbody", innerHTML: mdlite(r.body, { repo: s.brain }) });
194
- if (full || !cols.length) card.append(body);
195
- if (!cols.length && !full) body.classList.add("fade");
196
212
  }
197
-
198
- const more = el("button", { className: "ghbtn", textContent: full ? "Show less" : "Read the full report" });
199
- more.onclick = () => {
200
- if (openReports.has(s.handle)) openReports.delete(s.handle);
201
- else openReports.add(s.handle);
202
- repaintInPlace();
203
- };
204
- card.append(el("div", { className: "row homereportacts" }, [...(r ? [more] : []), ask, note]));
205
- return card;
213
+ return row;
206
214
  }
207
215
 
208
216
  /** A short list under a label, with how many more there are once it runs past `max`. */
@@ -219,72 +227,44 @@ function bullets(label, items, repo, max) {
219
227
 
220
228
  /* ------------------------------- asking -------------------------------- */
221
229
 
222
- /** What is in the ask box, kept across repaints. */
223
- const askDraft = { who: "", text: "" };
230
+ /** What each staff member is being asked, kept if the dialog is closed before sending. */
231
+ const askDrafts = {};
232
+ /** When each was last asked, so their card can say so until they pick it up. */
233
+ const askedAt = {};
224
234
 
225
- function askBox(staff) {
226
- const people = staff.filter((x) => x.brain);
227
- const who = el("select", { className: "homewho", id: "homewho" });
228
- for (const s of people) {
229
- who.append(el("option", { value: s.handle, textContent: s.name }));
230
- }
231
- if (askDraft.who && people.some((x) => x.handle === askDraft.who)) who.value = askDraft.who;
232
- const text = el("textarea", {
233
- className: "homeask",
234
- rows: 3,
235
- ariaLabel: "What you need",
235
+ /**
236
+ * Asking one staff member to do something: their card's button opens this, already addressed
237
+ * to them. It becomes a new issue on their tracker that mentions them, which starts a run.
238
+ */
239
+ async function askStaff(s, error = "") {
240
+ const said = await askText({
241
+ title: `Ask ${s.name}`,
242
+ hint: error,
243
+ value: askDrafts[s.handle] ?? "",
236
244
  placeholder: "What do you need? For example: write a post about the new pricing page.",
237
- value: askDraft.text,
238
- });
239
- // Home repaints as runs start and finish, and what you were typing must survive that.
240
- text.oninput = () => {
241
- askDraft.text = text.value;
242
- };
243
- const send = el("button", { className: "ghbtn primary" });
244
- const label = () => {
245
- const s = people.find((x) => x.handle === who.value);
246
- send.textContent = s ? `Send to ${s.name}` : "Send";
247
- };
248
- label();
249
- who.onchange = () => {
250
- askDraft.who = who.value;
251
- label();
252
- };
253
- const note = el("span", { className: "meta" });
254
- send.onclick = async () => {
255
- const s = staff.find((x) => x.handle === who.value);
256
- const said = text.value.trim();
257
- if (!s || !said) {
258
- text.focus();
259
- return;
260
- }
261
- send.disabled = true;
262
- note.className = "meta";
263
- note.textContent = "Sending…";
264
- try {
265
- await post({
266
- action: "create",
267
- repo: s.brain,
268
- title: titleOf(said),
269
- body: `${s.mention ?? "@" + s.handle} ${said}`,
245
+ confirm: "Send",
246
+ decorate: (ta) => {
247
+ ta.addEventListener("input", () => {
248
+ askDrafts[s.handle] = ta.value;
270
249
  });
271
- text.value = "";
272
- askDraft.text = "";
273
- note.textContent = `Sent. ${s.name} starts in about a minute.`;
274
- refreshSoon();
275
- } catch (e) {
276
- note.textContent = String(e.message || e);
277
- note.className = "meta err";
278
- } finally {
279
- send.disabled = false;
280
- }
281
- };
282
- return el("div", { className: "card homeaskcard" }, [
283
- el("h2", { className: "homeasktitle", textContent: "Ask a staff member to do something" }),
284
- el("div", { className: "row homeaskto" }, [el("label", { htmlFor: "homewho", textContent: "To" }), who]),
285
- text,
286
- el("div", { className: "row" }, [send, note]),
287
- ]);
250
+ },
251
+ });
252
+ if (!said) return;
253
+ try {
254
+ await post({
255
+ action: "create",
256
+ repo: s.brain,
257
+ title: titleOf(said),
258
+ body: `${s.mention ?? "@" + s.handle} ${said}`,
259
+ });
260
+ delete askDrafts[s.handle];
261
+ askedAt[s.handle] = Date.now();
262
+ repaintInPlace();
263
+ refreshSoon();
264
+ } catch (e) {
265
+ askDrafts[s.handle] = said;
266
+ await askStaff(s, String(e.message || e));
267
+ }
288
268
  }
289
269
 
290
270
  /** The first line, short enough to be an issue title. */
@@ -543,6 +523,10 @@ function team(staff) {
543
523
  } else if (last) {
544
524
  line = `Last finished ${ago(last.updatedAt)}`;
545
525
  }
526
+ // A run takes about a minute to start, and until then the card would say nothing happened.
527
+ if (!busy && !queued && Date.now() - (askedAt[s.handle] ?? 0) < 120_000) {
528
+ line = "Sent. Starts in about a minute";
529
+ }
546
530
 
547
531
  const issue = (busy || queued) && runs[0].issue && s.brain ? runs[0].issue : null;
548
532
  const card = el("div", {
@@ -567,10 +551,15 @@ function team(staff) {
567
551
  el("a", { className: "orblog", href: log, target: "_blank", rel: "noopener", textContent: "View log" }),
568
552
  );
569
553
  }
554
+ if (s.brain) {
555
+ const ask = el("button", { className: "ghbtn orbask", textContent: "Ask a question" });
556
+ ask.onclick = () => askStaff(s);
557
+ card.append(el("span", { className: "orbgap" }), ask);
558
+ }
570
559
  if (issue) {
571
560
  const open = () => openThread({ repo: s.brain, number: issue, kind: "issue" });
572
561
  card.onclick = (ev) => {
573
- if (!ev.target.closest("a")) open();
562
+ if (!ev.target.closest("a, button")) open();
574
563
  };
575
564
  card.onkeydown = (ev) => {
576
565
  if (ev.target === card && (ev.key === "Enter" || ev.key === " ")) {
@@ -619,10 +608,7 @@ function poll() {
619
608
  issuesAt = Date.now();
620
609
  refreshSoon(false);
621
610
  } else if (changed && S.view === "home" && !document.querySelector("dialog[open]")) {
622
- /* Typing in the ask box is not interrupted by a run starting: only the orbs move. */
623
- const row = document.querySelector(".hometeam");
624
- if (row && document.activeElement?.closest?.(".homeaskcard")) row.replaceWith(team(S.data.staff));
625
- else repaintInPlace();
611
+ repaintInPlace();
626
612
  }
627
613
  })
628
614
  .catch(() => {})
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { post } from "../api.js";
8
8
  import { el } from "../dom.js";
9
+ import { icon } from "../icons.js";
9
10
  import { refreshAll } from "../refresh.js";
10
11
  import { S } from "../state.js";
11
12
 
@@ -36,7 +37,7 @@ export function peopleCard() {
36
37
  el("span", { textContent: "Name" }),
37
38
  el("span", { textContent: "GitHub login" }),
38
39
  el("span", { textContent: "Looks after" }),
39
- el("span", { textContent: "Read only" }),
40
+ el("span", { className: "peopleonlyhead", textContent: "Read only" }),
40
41
  el("span"),
41
42
  ]),
42
43
  ...rows.map((p, i) => row(p, i)),
@@ -58,7 +59,12 @@ export function peopleCard() {
58
59
  p.view_only = only.checked;
59
60
  stamp();
60
61
  };
61
- const remove = el("button", { className: "ghbtn danger", textContent: "Remove" });
62
+ // Quiet on purpose: one per row, and a column of red buttons outshouts the list it edits.
63
+ const remove = el("button", {
64
+ className: "iconbtn peopleremove",
65
+ title: "Remove",
66
+ ariaLabel: `Remove ${p.name || "this person"}`,
67
+ }, [icon("trash", "ic")]);
62
68
  remove.onclick = () => {
63
69
  rows.splice(i, 1);
64
70
  paint();
@@ -142,7 +142,9 @@ function row(r) {
142
142
  tr.innerHTML =
143
143
  '<td title="' + esc(r.createdAt) + '">' + esc(ago(r.createdAt)) + "</td>" +
144
144
  "<td>" + esc(r.kind) + "</td>" +
145
- '<td><span class="chip ' + out.tone + '">' + esc(out.word) + "</span></td>" +
145
+ (out.tone === "ok"
146
+ ? '<td><span class="runok"><i></i>' + esc(out.word) + "</span></td>"
147
+ : '<td><span class="chip ' + out.tone + '">' + esc(out.word) + "</span></td>") +
146
148
  "<td>" + (mins != null ? Math.round(mins) + "m" : "–") + "</td>" +
147
149
  "<td>" + (rec.turns ?? "–") + "</td>" +
148
150
  "<td>" + (typeof rec.cost_usd === "number" ? "$" + rec.cost_usd.toFixed(2) : "–") + "</td>" +
@@ -1,13 +1,21 @@
1
1
  <!doctype html>
2
- <html lang="en">
2
+ <html lang="en" data-astryx-theme="neutral">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>roster</title>
7
- <!-- Inline, so a local page with no network still has a tab icon and the console stays clean. -->
8
- <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='8' fill='%2334c759'/%3E%3C/svg%3E">
7
+ <!-- Inline, so a local page with no network still has a tab icon and the console stays clean.
8
+ The mark in the theme's accent, light or dark as the system is, like the one in the sidebar. -->
9
+ <link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2032%2032'%3E%3Cstyle%3Erect%7Bfill:%231b1b1b%7Dpath%7Bstroke:%23fff%7D%40media%20%28prefers-color-scheme:dark%29%7Brect%7Bfill:%23f1f1f1%7Dpath%7Bstroke:%23111%7D%7D%3C/style%3E%3Crect%20width='32'%20height='32'%20rx='8'/%3E%3Cpath%20d='M11%2023V10h6a4%204%200%200%201%200%208h-6m6%200%204.5%205'%20fill='none'%20stroke-width='2.6'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E">
9
10
  <!-- Stylesheets and modules are served from /assets by `roster portal`. No build step:
10
11
  editing one of these files and reloading is the whole edit loop. -->
12
+ <!-- Astryx's neutral theme and its components, under the portal's own class names. First, so
13
+ it is the floor every stylesheet below builds on. Generated by scripts/astryx.mjs. -->
14
+ <link rel="stylesheet" href="/assets/css/astryx.css">
15
+ <!-- Figtree is the theme's face. Offline, the system font it names next stands in. -->
16
+ <link rel="preconnect" href="https://fonts.googleapis.com">
17
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
18
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap">
11
19
  <link rel="stylesheet" href="/assets/css/base.css">
12
20
  <link rel="stylesheet" href="/assets/css/layout.css">
13
21
  <link rel="stylesheet" href="/assets/css/markdown.css">