@nanocollective/roster 0.1.0-beta.22 → 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.
package/docs/portal.md CHANGED
@@ -107,7 +107,10 @@ Where the portal opens. A card for each staff member at the top, then these, in
107
107
  their `@handle`, to bring it up to date now, which takes a few minutes. It comes after Unread
108
108
  and Your requests.
109
109
  - **Needs you.** Every ask a staff member has put on you, and every pull request ready to
110
- merge, oldest first. Each card has one action on its right:
110
+ merge, oldest first. An ask is on you when it is assigned to you, carries your label, or its
111
+ newest comment @mentions you: a staff member who asks for your OK by name puts it here, not
112
+ only in your GitHub notifications. Mentioning the person whose own request it is does not
113
+ count, and whoever wrote the newest comment has passed it on. Each card has one action on its right:
111
114
  - a `decision` has **Reply**, and **Go with the default** when it carries one. The default
112
115
  and its date are shown, and turn amber once the date has passed.
113
116
  - a `review` has **Approve**.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanocollective/roster",
3
- "version": "0.1.0-beta.22",
3
+ "version": "0.1.0-beta.23",
4
4
  "description": "An agent-run org, powered by GitHub. Scaffold AI staff members whose brain is a repo.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,8 +4,9 @@
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. -->
11
12
  <!-- Astryx's neutral theme and its components, under the portal's own class names. First, so
@@ -20,6 +20,30 @@ const CHORE_WORDS = ["setup", "submit", "data", "blocked"];
20
20
 
21
21
  const lower = (s) => String(s ?? "").toLowerCase();
22
22
 
23
+ /** An @login in prose, not in an email address or a path. As GitHub links them. */
24
+ const MENTION = /(?<![\w@/.-])@([a-z\d](?:[a-z\d-]{0,38}))/gi;
25
+
26
+ /** Who wrote the newest word on an item: its last comment, or the issue itself. */
27
+ const writerOf = (item) => lower(item.lastComment ? item.lastComment.author : item.author);
28
+
29
+ /**
30
+ * The people the newest word on an item asks for something, by login: whoever it @mentions,
31
+ * from the last comment, or from the body when nobody has replied. A mention is how a staff
32
+ * member pulls somebody in ("@ben this costs money, so it needs your OK too"), and it used to
33
+ * reach their GitHub notifications and nowhere on Home.
34
+ *
35
+ * Never the writer, and never the item's own author: staff mention the person whose request
36
+ * they are answering on every reply, and that is an answer to a request, not a new ask.
37
+ */
38
+ export function askedIn(item, people) {
39
+ const last = item.lastComment;
40
+ const said = last
41
+ ? (last.mentions ?? [...String(last.body ?? "").matchAll(MENTION)].map((m) => m[1]))
42
+ : [...String(item.body ?? "").matchAll(MENTION)].map((m) => m[1]);
43
+ const skip = new Set([writerOf(item), lower(item.author)]);
44
+ return [...new Set(said.map(lower))].filter((l) => people.has(l) && !skip.has(l));
45
+ }
46
+
23
47
 
24
48
  /**
25
49
  * @param items the inbox list: open and recently closed issues and pull requests
@@ -106,9 +130,11 @@ export function placeOf(item, owner, people, markers) {
106
130
  }
107
131
 
108
132
  const labels = (item.labels ?? []).map(lower);
133
+ const asked = askedIn(item, people);
109
134
  const onPerson =
110
135
  (item.assignees ?? []).some((a) => people.has(lower(a))) ||
111
- labels.some((l) => markers.has(l));
136
+ labels.some((l) => markers.has(l)) ||
137
+ asked.length > 0;
112
138
  const byPerson = people.has(lower(item.author));
113
139
  /* You had the last word on an ask: approved it, answered it, said go with the default. It is
114
140
  waiting on them now, so it is one of your requests until they reply or close it. If they
@@ -119,11 +145,14 @@ export function placeOf(item, owner, people, markers) {
119
145
  if (!onPerson || byPerson) {
120
146
  return { place: "elsewhere", why: item.role === "product" ? "contributor" : "other" };
121
147
  }
148
+ if (asked.length) return { place: "needs", kind: kindOf(labels) };
122
149
  return youAnswered ? { place: "requests" } : { place: "needs", kind: kindOf(labels) };
123
150
  }
124
151
  if (item.number === owner.statusIssue || labels.includes("keep-open")) {
125
152
  return { place: "staff", why: "status" };
126
153
  }
154
+ // Somebody was asked by the newest word on it, whoever started it: it is on them now.
155
+ if (asked.length) return { place: "needs", kind: kindOf(labels) };
127
156
  if (byPerson) return { place: "requests" };
128
157
  if (onPerson) return youAnswered ? { place: "requests" } : { place: "needs", kind: kindOf(labels) };
129
158
  return {
@@ -133,14 +162,24 @@ export function placeOf(item, owner, people, markers) {
133
162
  }
134
163
 
135
164
  /**
136
- * The people an ask is on, by login: whoever it is assigned to, and whoever's label it carries.
137
- * Empty means nobody in particular, such as a pull request nobody was asked to look at.
165
+ * The people an ask is on, by login: whoever it is assigned to, whoever's label it carries, and
166
+ * whoever its newest word @mentions. Not whoever wrote that word, who has passed it on. Empty
167
+ * means nobody in particular, such as a pull request nobody was asked to look at.
138
168
  */
139
169
  export function whoFor(item, humans) {
140
170
  const labels = new Set((item.labels ?? []).map(lower));
141
171
  const assigned = new Set((item.assignees ?? []).map(lower));
172
+ const asked = new Set(askedIn(item, new Set(humans.map((h) => lower(h.github)).filter(Boolean))));
173
+ // Whoever had the last word has passed it on: an ask they answered is not on them any more.
174
+ const writer = writerOf(item);
142
175
  return humans
143
- .filter((h) => (h.github && assigned.has(lower(h.github))) || (h.marker && labels.has(lower(h.marker))))
176
+ .filter(
177
+ (h) =>
178
+ (h.github && assigned.has(lower(h.github))) ||
179
+ (h.marker && labels.has(lower(h.marker))) ||
180
+ (h.github && asked.has(lower(h.github))),
181
+ )
182
+ .filter((h) => !item.lastComment || lower(h.github) !== writer)
144
183
  .map((h) => h.github);
145
184
  }
146
185