@nanocollective/roster 0.1.0-beta.6 → 0.1.0-beta.8

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/dist/cli.js CHANGED
@@ -2122,6 +2122,7 @@ function buildPlan(ws, org, handle, opts, parseYaml3) {
2122
2122
  handle,
2123
2123
  ...ASK_KINDS,
2124
2124
  "keep-open",
2125
+ "status",
2125
2126
  "build",
2126
2127
  "blocked",
2127
2128
  ...peers.map((p) => `from-${p.handle}`)
@@ -2381,12 +2382,15 @@ async function applyPlan(ws, plan2, opts) {
2381
2382
  "-X",
2382
2383
  "POST",
2383
2384
  "-f",
2384
- "title=\u{1F4CD} Where we are (living status - always current)",
2385
+ `title=${statusTitle(/* @__PURE__ */ new Date())}`,
2385
2386
  "-f",
2386
2387
  `body=${statusBody(staff)}`,
2387
- // A sweep closes anything with nothing left to do on it. This one never runs out.
2388
+ // A sweep closes anything with nothing left to do on it. This one never runs out, until
2389
+ // next week's replaces it.
2388
2390
  "-f",
2389
- "labels[]=keep-open"
2391
+ "labels[]=keep-open",
2392
+ "-f",
2393
+ "labels[]=status"
2390
2394
  ]);
2391
2395
  if (issue.ok && issue.data?.number) {
2392
2396
  await ghJson([
@@ -2499,9 +2503,20 @@ ${line.trimEnd()}
2499
2503
  lines.splice(i, 0, line.trimEnd());
2500
2504
  return lines.join("\n");
2501
2505
  }
2506
+ function statusTitle(now) {
2507
+ const monday = new Date(
2508
+ Date.UTC(
2509
+ now.getUTCFullYear(),
2510
+ now.getUTCMonth(),
2511
+ now.getUTCDate() - (now.getUTCDay() + 6) % 7
2512
+ )
2513
+ );
2514
+ const month = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")[monday.getUTCMonth()];
2515
+ return `\u{1F4CD} Where we are: week of ${monday.getUTCDate()} ${month}`;
2516
+ }
2502
2517
  function statusBody(staff) {
2503
2518
  return [
2504
- `**${staff.name}'s living status. Always current \u2014 this issue is rewritten, never appended to.**`,
2519
+ `**${staff.name}'s status this week. Rewritten every run; a new issue opens each Monday.**`,
2505
2520
  "",
2506
2521
  "| | The ask |",
2507
2522
  "|---|---|",
@@ -5633,7 +5648,7 @@ Nothing to fix. \`roster doctor\` is clean.
5633
5648
  "them is reverted by the next `roster upgrade`, and the mistake is invisible until it is",
5634
5649
  "expensive. Do not touch:",
5635
5650
  "",
5636
- `- \`${ws.opsName}/compose.mjs\`, \`agents.mjs\`, \`runner-plan.mjs\`, \`inflight.mjs\`, \`run-record.mjs\` \u2014 vendored from the framework.`,
5651
+ `- \`${ws.opsName}/compose.mjs\`, \`agents.mjs\`, \`runner-plan.mjs\`, \`inflight.mjs\`, \`run-record.mjs\`, \`status-week.mjs\` \u2014 vendored from the framework.`,
5637
5652
  `- \`${ws.opsName}/.github/workflows/\` and any brain's \`.github/workflows/\` \u2014 generated, and`,
5638
5653
  " GitHub App tokens cannot push changes there in any case.",
5639
5654
  `- \`${ws.opsName}/.roster/\` \u2014 the recorded merge base.`,
@@ -67,8 +67,8 @@
67
67
  .homerunlog .ghbtn{min-height:28px;padding:3px 12px}
68
68
  @media (max-width:640px){
69
69
  .homerun{grid-template-columns:1fr auto;grid-template-areas:"who state" "what what" "log log"}
70
- .homewho2{grid-area:who}.homestate{grid-area:state;justify-self:end}
71
- .homerunwhat{grid-area:what}.homerunlog{grid-area:log}
70
+ .homerun .homewho2{grid-area:who}.homerun .homestate{grid-area:state;justify-self:end}
71
+ .homerun .homerunwhat{grid-area:what}.homerun .homerunlog{grid-area:log}
72
72
  }
73
73
 
74
74
  .homerest{margin-top:26px}
@@ -88,6 +88,8 @@
88
88
  .homereport:focus-visible{outline:2px solid var(--accent);outline-offset:0}
89
89
  .homereportwho{display:flex;flex-direction:column;gap:2px;min-width:0}
90
90
  .homereportwho .meta{padding-left:21px}
91
+ .homereportask{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding-left:21px;margin-top:6px}
92
+ .homereportask .meta{padding-left:0}
91
93
  .homereportbody p{margin:0 0 4px;color:var(--ink-dim);font-size:13px;line-height:1.5}
92
94
  .homereportbody p:first-child{color:var(--ink)}
93
95
  .homereportbody a{color:var(--accent)}
@@ -102,3 +104,11 @@
102
104
  .homeline:hover .homerowtitle{text-decoration:underline}
103
105
  .homeline:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}
104
106
  .homerowtitle{font-weight:600;color:var(--ink)}
107
+
108
+ /* On a phone the lists use the width: last in the file, so it wins over each list's own padding. */
109
+ @media (max-width:640px){
110
+ .homelist,.homeworking,.homereports{padding-left:14px;padding-right:14px}
111
+ .homeline{grid-template-columns:8px minmax(0,1fr)}
112
+ .homeline .homerunlog{grid-column:2}
113
+ .homeline .homerunlog:empty{display:none}
114
+ }
@@ -150,6 +150,12 @@ main{padding:36px 44px 96px;max-width:1220px;overflow-x:clip}
150
150
  .side{position:static;height:auto;border-right:none;border-bottom:1px solid var(--line)}
151
151
  .sidefoot{margin-top:0}
152
152
  }
153
+ /* A phone: the page uses its width. 44px a side was a desktop gutter, and on a phone it took
154
+ a quarter of the screen, with a card's own padding inside it again. */
155
+ @media (max-width:640px){
156
+ main{padding:20px 16px 64px}
157
+ .card{padding:14px}
158
+ }
153
159
 
154
160
  /* A staff member who cannot run yet (readiness.js). */
155
161
  .readydot{width:7px;height:7px;border-radius:50%;background:var(--warn);flex:none;margin-left:4px}
@@ -55,35 +55,10 @@ export function viewHome(m) {
55
55
  const page = el("div", { className: "home" });
56
56
  page.append(askBox(staff));
57
57
 
58
- if (h.reports.length) {
58
+ const reporters = staff.filter((x) => x.brain && x.statusIssue);
59
+ if (reporters.length) {
59
60
  page.append(section("Latest reports"));
60
- const box = el("div", { className: "card homereports" });
61
- for (const r of h.reports) {
62
- /* The report is markdown the staff member wrote, with links to the work it names. The
63
- whole report opens their status issue, where it was posted; a link inside it goes
64
- where it points. */
65
- const row = el("div", { className: "homereport homeclick", tabIndex: 0, role: "button" }, [
66
- el("div", { className: "homereportwho" }, [
67
- el("span", { className: "homewho2" }, [icon(staffIcon(r.staff), "ic"), el("b", { textContent: r.staff.name })]),
68
- el("span", { className: "meta", textContent: ago(r.at) }),
69
- ]),
70
- el("div", {
71
- className: "md homereportbody",
72
- innerHTML: mdlite(r.lines.join("\n\n"), { repo: r.staff.brain }),
73
- }),
74
- ]);
75
- row.onclick = (ev) => {
76
- if (!ev.target.closest("a, button")) openThread(r.item);
77
- };
78
- row.onkeydown = (ev) => {
79
- if (ev.target === row && (ev.key === "Enter" || ev.key === " ")) {
80
- ev.preventDefault();
81
- openThread(r.item);
82
- }
83
- };
84
- box.append(row);
85
- }
86
- page.append(box);
61
+ page.append(el("div", { className: "card homereports" }, reporters.map((s) => reportRow(s, h.reports))));
87
62
  }
88
63
 
89
64
  page.append(section("Needs you", h.needs.length));
@@ -116,6 +91,61 @@ export function viewHome(m) {
116
91
  m.append(page);
117
92
  }
118
93
 
94
+ /* ------------------------------- reports -------------------------------- */
95
+
96
+ /**
97
+ * One staff member's last report, or a line saying there is none today, with a button that asks
98
+ * for one. The report is markdown the staff member wrote, with links to the work it names. The
99
+ * whole row opens their status issue, where it was posted; a link inside it goes where it points.
100
+ */
101
+ function reportRow(s, reports) {
102
+ const r = reports.find((x) => x.staff.handle === s.handle);
103
+ const item = r?.item ?? { repo: s.brain, number: s.statusIssue, kind: "issue" };
104
+ const note = el("span", { className: "meta" });
105
+ const ask = el("button", { className: "ghbtn", textContent: "Ask for a report" });
106
+ ask.onclick = async () => {
107
+ ask.disabled = true;
108
+ note.className = "meta";
109
+ note.textContent = "Asking…";
110
+ try {
111
+ await post({
112
+ action: "comment",
113
+ repo: s.brain,
114
+ number: s.statusIssue,
115
+ body: `${s.mention ?? "@" + s.handle} Report, please.`,
116
+ });
117
+ ask.remove();
118
+ note.textContent = `Asked. ${s.name} replies in a few minutes.`;
119
+ refreshSoon();
120
+ } catch (e) {
121
+ note.textContent = String(e.message || e);
122
+ note.className = "meta err";
123
+ ask.disabled = false;
124
+ }
125
+ };
126
+
127
+ const row = el("div", { className: "homereport homeclick", tabIndex: 0, role: "button" }, [
128
+ el("div", { className: "homereportwho" }, [
129
+ el("span", { className: "homewho2" }, [icon(staffIcon(s), "ic"), el("b", { textContent: s.name })]),
130
+ el("span", { className: "meta", textContent: r ? ago(r.at) : "No report today" }),
131
+ el("div", { className: "homereportask" }, [ask, note]),
132
+ ]),
133
+ r
134
+ ? el("div", { className: "md homereportbody", innerHTML: mdlite(r.lines.join("\n\n"), { repo: s.brain }) })
135
+ : el("div"),
136
+ ]);
137
+ row.onclick = (ev) => {
138
+ if (!ev.target.closest("a, button")) openThread(item);
139
+ };
140
+ row.onkeydown = (ev) => {
141
+ if (ev.target === row && (ev.key === "Enter" || ev.key === " ")) {
142
+ ev.preventDefault();
143
+ openThread(item);
144
+ }
145
+ };
146
+ return row;
147
+ }
148
+
119
149
  /* ------------------------------- asking -------------------------------- */
120
150
 
121
151
  function askBox(staff) {