@nanocollective/roster 0.1.0-beta.17 → 0.1.0-beta.19
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 +172 -7
- package/dist/worker/assets/assets/css/brain.css +20 -0
- package/dist/worker/assets/assets/css/home.css +7 -3
- package/dist/worker/assets/assets/js/homesort.js +7 -3
- package/dist/worker/assets/assets/js/views/home.js +4 -2
- package/dist/worker/assets/assets/js/views/org.js +2 -0
- package/dist/worker/assets/assets/js/views/people.js +103 -0
- package/dist/worker/index.js +145 -9
- package/docs/doctor-codes.md +2 -0
- package/docs/export.md +2 -1
- package/docs/org-yaml.md +13 -7
- package/package.json +1 -1
- package/templates/brain/.github/workflows/%%STAFF%%-mention.yaml +4 -4
- package/templates/portal/css/brain.css +20 -0
- package/templates/portal/css/home.css +7 -3
- package/templates/portal/js/homesort.js +7 -3
- package/templates/portal/js/views/home.js +4 -2
- package/templates/portal/js/views/org.js +2 -0
- package/templates/portal/js/views/people.js +103 -0
package/docs/doctor-codes.md
CHANGED
|
@@ -68,6 +68,8 @@ ran at all.
|
|
|
68
68
|
| `secrets` | Every secret the callers reference exists on the brain repo, or is an organisation secret shared with it. Derived from the callers themselves, not a fixed list. |
|
|
69
69
|
| `labels` | Every label declared in `staff.yaml` exists. An agent applying a label that does not exist gets an API error mid-run. |
|
|
70
70
|
| `owned-labels` | Roster's own labels exist on the tracker: `decision`, `review`, `chore` and `keep-open`. Checked whatever `staff.yaml` declares, since the prompts apply them. The fix is the `gh label create` lines. |
|
|
71
|
+
| `person-labels` | Every person's label (their `marker` in `org.yaml`) exists on the tracker. Staff send an ask to someone by labelling it for them, and `gh` refuses a label that does not exist. The portal's People form creates them; the fix is the `gh label create` lines. |
|
|
72
|
+
| `humans-variable` | **fail.** The `ROSTER_HUMANS` Actions variable on the tracker names different people from `org.yaml`. The mention callers prefer the variable, which the portal's People form sets, so a person added to `org.yaml` by hand cannot wake anybody until it matches. Not checked when the variable is unset. The fix is the `gh variable set` line, or saving People in the portal. |
|
|
71
73
|
| `ask-kind` | An open issue assigned to a human has no ask kind, or more than one. Home sorts what needs you by kind, so an ask without one lands nowhere. |
|
|
72
74
|
| `peer-labels` | The `from-<handle>` label exists on the *peer's* tracker, which is where this staff member's asks land. |
|
|
73
75
|
| `status-issue` | The declared status issue is actually pinned. If not, the place you look is not the place the agent maintains. |
|
package/docs/export.md
CHANGED
|
@@ -22,8 +22,9 @@ that reads it gets the same view without reimplementing the memory grammar.
|
|
|
22
22
|
| `org` | the GitHub organisation |
|
|
23
23
|
| `name` | the business name |
|
|
24
24
|
| `opsName` | the ops repo's directory, so a consumer can address `org.yaml` and `org/*.md` by path |
|
|
25
|
-
| `human` | the first human, normalised: `{ github, name, marker, role }`. Kept for consumers written when an org had exactly one |
|
|
25
|
+
| `human` | the first human, normalised: `{ github, name, marker, role, handles }`. Kept for consumers written when an org had exactly one |
|
|
26
26
|
| `humans[]` | everyone the staff answer to, in order, read from `humans` or the singular `human`, leaving out anyone `view_only`. `human` is `humans[0]` |
|
|
27
|
+
| `people[]` | everyone in `org.yaml`, `view_only` included (as `viewOnly: true`), with `handles` where set. What the portal's People form edits |
|
|
27
28
|
| `generatedAt` | ISO timestamp |
|
|
28
29
|
| `staff[]` | one entry per staff member |
|
|
29
30
|
|
package/docs/org-yaml.md
CHANGED
|
@@ -115,7 +115,9 @@ appended rather than dropped.
|
|
|
115
115
|
here"), and a list of two cannot go in that sentence, so the first one goes there, their
|
|
116
116
|
`marker` is what `%%HUMAN_MARKER%%` renders, and the rest are named by
|
|
117
117
|
`{{humans_extra}}` in the identity fragment. Everything that *gates* on identity reads all of
|
|
118
|
-
them: the mention caller's `if:` is
|
|
118
|
+
them: the mention caller's `if:` is
|
|
119
|
+
`contains(fromJSON(vars.ROSTER_HUMANS || '["will-lamerton","sam-x"]'), …)`, the list baked in when
|
|
120
|
+
the caller was generated unless the tracker has a `ROSTER_HUMANS` variable.
|
|
119
121
|
|
|
120
122
|
**Who handles what.** With more than one person, give each a `handles` list:
|
|
121
123
|
|
|
@@ -127,9 +129,9 @@ humans:
|
|
|
127
129
|
|
|
128
130
|
The staff are told who looks after what, and send each ask (an issue with a person's label, or
|
|
129
131
|
a pull request) to that one person: their label, assigned to them. On Home, **Needs you** then
|
|
130
|
-
shows the signed-in person what is on them,
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
shows the signed-in person what is on them, with a **Yours / Everyone's** switch beside the
|
|
133
|
+
heading. Something that fits nobody's area goes to the first person, and so does anything on
|
|
134
|
+
Home that nobody was assigned, such as a pull request opened before `handles` was set.
|
|
133
135
|
|
|
134
136
|
**View-only.** `{ name: Ben, github: ben-x, view_only: true }` signs in to the portal and the
|
|
135
137
|
Claude connector like anyone in the list, and reads everything there. They are not in the mention
|
|
@@ -138,9 +140,13 @@ them waiting. The staff prompts name them only to say that nothing they write is
|
|
|
138
140
|
that nothing needing a human goes to them. A view-only person is never the primary, wherever they
|
|
139
141
|
are in the list. What they can do on GitHub itself is still whatever their access there allows.
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
**The easy way to add, change or remove someone is People on the portal's Org screen.** It
|
|
144
|
+
writes this list, creates each person's label on every tracker, and sets the `ROSTER_HUMANS`
|
|
145
|
+
Actions variable on every tracker, which the mention callers read in place of the list baked into
|
|
146
|
+
them, so a new person can wake staff at once. Editing `org.yaml` by hand works too, but then it
|
|
147
|
+
takes a `roster upgrade --apply` (and a push of the brain repos) to reach the callers, and if the
|
|
148
|
+
portal has ever set `ROSTER_HUMANS` it has to be updated as well: `roster doctor` says so
|
|
149
|
+
(`humans-variable`) and prints the command.
|
|
144
150
|
|
|
145
151
|
### `agent`
|
|
146
152
|
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ name: %%STAFF_UPPER%% on a mention
|
|
|
16
16
|
# skipped.
|
|
17
17
|
run-name: >-
|
|
18
18
|
%%STAFF%% ${{
|
|
19
|
-
(contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
19
|
+
(contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
20
20
|
(contains(github.event.comment.body, '%%MENTION%%') ||
|
|
21
21
|
(github.event_name == 'issues' && contains(github.event.issue.body, '%%MENTION%%'))))
|
|
22
22
|
&& 'mention'
|
|
@@ -72,10 +72,10 @@ jobs:
|
|
|
72
72
|
cancel-in-progress: false
|
|
73
73
|
if: >-
|
|
74
74
|
(
|
|
75
|
-
contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
75
|
+
contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.sender.login) &&
|
|
76
76
|
(
|
|
77
77
|
(github.event_name == 'issue_comment' &&
|
|
78
|
-
contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.comment.user.login) &&
|
|
78
|
+
contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.comment.user.login) &&
|
|
79
79
|
contains(github.event.comment.body, '%%MENTION%%')) ||
|
|
80
80
|
(github.event_name == 'issues' &&
|
|
81
81
|
contains(github.event.issue.body, '%%MENTION%%'))
|
|
@@ -102,7 +102,7 @@ jobs:
|
|
|
102
102
|
with:
|
|
103
103
|
staff: %%STAFF%%
|
|
104
104
|
kind: mention
|
|
105
|
-
trigger: ${{ contains(fromJSON('%%HUMAN_LOGINS%%'), github.event.sender.login) && 'mention' || 'peer' }}
|
|
105
|
+
trigger: ${{ contains(fromJSON(vars.ROSTER_HUMANS || '%%HUMAN_LOGINS%%'), github.event.sender.login) && 'mention' || 'peer' }}
|
|
106
106
|
max_runs_per_day: %%MAX_RUNS%%
|
|
107
107
|
ops_repo: %%OPS_REPO%%
|
|
108
108
|
model: %%MODEL%%
|
|
@@ -114,3 +114,23 @@
|
|
|
114
114
|
.effect{border:1px solid color-mix(in srgb,var(--accent) 35%,transparent);
|
|
115
115
|
background:color-mix(in srgb,var(--accent) 7%,transparent);
|
|
116
116
|
border-radius:var(--r);padding:11px 13px;margin-bottom:14px}
|
|
117
|
+
|
|
118
|
+
/* People on the Org screen: one row per person, edited in place. */
|
|
119
|
+
.peoplecard{margin-bottom:18px;display:flex;flex-direction:column;gap:12px}
|
|
120
|
+
.peoplecard h2{margin:0;font:600 15px var(--sans);color:var(--ink);text-transform:none;letter-spacing:-.01em}
|
|
121
|
+
.peoplelist{display:flex;flex-direction:column;gap:8px}
|
|
122
|
+
.peoplerow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1.6fr) 72px auto;
|
|
123
|
+
gap:8px;align-items:center}
|
|
124
|
+
.peoplerow input[type=text]{width:100%;box-sizing:border-box;font:13px var(--sans);color:var(--ink);
|
|
125
|
+
background:var(--surface-2);border:1px solid transparent;border-radius:8px;padding:7px 9px}
|
|
126
|
+
.peoplerow input[type=text]:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
|
|
127
|
+
.peoplehead span{font:600 11.5px var(--sans);color:var(--ink-dim)}
|
|
128
|
+
.peopleonly{display:flex;justify-content:center}
|
|
129
|
+
.peoplerow .ghbtn{min-height:30px;padding:3px 12px;font-size:12.5px}
|
|
130
|
+
@media (max-width:720px){
|
|
131
|
+
.peoplehead{display:none}
|
|
132
|
+
.peoplerow{grid-template-columns:1fr 1fr;padding-bottom:10px;border-bottom:1px solid var(--line)}
|
|
133
|
+
.peoplerow > :nth-child(3){grid-column:1 / -1}
|
|
134
|
+
.peopleonly::after{content:"Read only";font:12.5px var(--sans);color:var(--ink-dim);margin-left:6px}
|
|
135
|
+
.peopleonly{justify-content:flex-start;align-items:center}
|
|
136
|
+
}
|
|
@@ -145,9 +145,13 @@
|
|
|
145
145
|
.orbcard.busy .orbglow{animation:orbbreathe 2.6s ease-in-out infinite}
|
|
146
146
|
.orbcard.busy .orbswirl{opacity:1;animation:orbspin 5s linear infinite}
|
|
147
147
|
.orbcard.busy .orbbody{animation:orbfloat 3.2s ease-in-out infinite}
|
|
148
|
-
|
|
149
|
-
.
|
|
150
|
-
.orbcard.queued
|
|
148
|
+
/* Waiting to start: yellow whoever it is, lit but slow, so it reads as "about to" rather than
|
|
149
|
+
"at work". GitHub has the run queued and no runner has picked it up yet. */
|
|
150
|
+
.orbcard.queued{--hue:#ffd60a!important;border-color:color-mix(in srgb,#ffd60a 35%,var(--line))}
|
|
151
|
+
.orbcard.queued .orbglow{animation:orbbreathe 2.2s ease-in-out infinite}
|
|
152
|
+
.orbcard.queued .orbswirl{opacity:.45;animation:orbspin 14s linear infinite}
|
|
153
|
+
.orbcard.queued .orbicon{color:#5c4a00;filter:none}
|
|
154
|
+
.orbcard.queued .orbstate{color:color-mix(in srgb,#ffd60a 70%,var(--ink))}
|
|
151
155
|
/* Free: the same orb, still and drained of colour. */
|
|
152
156
|
.orbcard.idle .orbbody,.orbcard.failed .orbbody,.orbcard.wait .orbbody{filter:saturate(.12) brightness(.95);opacity:.6}
|
|
153
157
|
.orbcard.failed .orb::after{content:"";position:absolute;top:4px;right:4px;width:12px;height:12px;border-radius:50%;
|
|
@@ -80,7 +80,12 @@ export function sortHome(items, staff, humans, live = [], now = new Date()) {
|
|
|
80
80
|
? "answered"
|
|
81
81
|
: "waiting";
|
|
82
82
|
}
|
|
83
|
-
if (place.place === "needs")
|
|
83
|
+
if (place.place === "needs") {
|
|
84
|
+
/* On nobody in particular, such as a pull request nobody was assigned: the first person's,
|
|
85
|
+
as the staff are told "something that fits nobody's area goes to" them. */
|
|
86
|
+
entry.for = whoFor(item, humans);
|
|
87
|
+
if (!entry.for.length && humans[0]?.github) entry.for = [humans[0].github];
|
|
88
|
+
}
|
|
84
89
|
out[place.place].push(entry);
|
|
85
90
|
}
|
|
86
91
|
|
|
@@ -129,8 +134,7 @@ export function placeOf(item, owner, people, markers) {
|
|
|
129
134
|
|
|
130
135
|
/**
|
|
131
136
|
* The people an ask is on, by login: whoever it is assigned to, and whoever's label it carries.
|
|
132
|
-
* Empty means nobody in particular, such as a pull request nobody was asked to look at
|
|
133
|
-
* it is everybody's.
|
|
137
|
+
* Empty means nobody in particular, such as a pull request nobody was asked to look at.
|
|
134
138
|
*/
|
|
135
139
|
export function whoFor(item, humans) {
|
|
136
140
|
const labels = new Set((item.labels ?? []).map(lower));
|
|
@@ -532,8 +532,10 @@ function team(staff) {
|
|
|
532
532
|
line = "Could not check on them";
|
|
533
533
|
} else if (busy || queued) {
|
|
534
534
|
const r = { ...runs[0], handle: s.handle };
|
|
535
|
-
word = busy ? "Working" : "
|
|
536
|
-
line = busy
|
|
535
|
+
word = busy ? "Working" : "Waiting to start";
|
|
536
|
+
line = busy
|
|
537
|
+
? `${whatRun(r)} · ${minutes(r.createdAt)} so far`
|
|
538
|
+
: `${whatRun(r)} · queued ${minutes(r.createdAt)} ago`;
|
|
537
539
|
} else if (failed) {
|
|
538
540
|
word = "Free";
|
|
539
541
|
line = `Their last session stopped with a problem, ${ago(last.updatedAt)}`;
|
|
@@ -20,6 +20,7 @@ import { mdlite } from "../md.js";
|
|
|
20
20
|
import { humansOf, S, writeHash } from "../state.js";
|
|
21
21
|
import { yamlPre } from "../yaml.js";
|
|
22
22
|
import { businessForm, fileModes, prioritiesForm } from "./orgedit.js";
|
|
23
|
+
import { peopleCard } from "./people.js";
|
|
23
24
|
import { repoPicker } from "./repos.js";
|
|
24
25
|
|
|
25
26
|
/* What the files roster itself ships are for, in one line each. A filename says nothing about
|
|
@@ -72,6 +73,7 @@ export function viewOrg(m) {
|
|
|
72
73
|
kv("Staff", String(org.staff.length), org.staff.map((s) => s.handle).join(", ")),
|
|
73
74
|
);
|
|
74
75
|
m.append(facts);
|
|
76
|
+
m.append(peopleCard());
|
|
75
77
|
|
|
76
78
|
/* Marking a product repo after setup. The picker only lived on the setup screen, so a repo
|
|
77
79
|
created later meant typing `role: product` into org.yaml by hand. Folded, because it asks
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/* People: who the staff answer to, and what each of them looks after. On the Org screen.
|
|
2
|
+
*
|
|
3
|
+
* Saving writes the humans list in org.yaml, and the server then puts each person's label on
|
|
4
|
+
* every tracker and tells the mention callers who may wake a staff member, so somebody added
|
|
5
|
+
* here can send work straight away. */
|
|
6
|
+
|
|
7
|
+
import { post } from "../api.js";
|
|
8
|
+
import { el } from "../dom.js";
|
|
9
|
+
import { refreshAll } from "../refresh.js";
|
|
10
|
+
import { S } from "../state.js";
|
|
11
|
+
|
|
12
|
+
export function peopleCard() {
|
|
13
|
+
const start = (S.data?.people?.length ? S.data.people : (S.data?.humans ?? [])).map((h) => ({
|
|
14
|
+
name: h.name ?? "",
|
|
15
|
+
github: h.github ?? "",
|
|
16
|
+
marker: h.marker ?? "",
|
|
17
|
+
role: h.role ?? "",
|
|
18
|
+
handles: (h.handles ?? []).join(", "),
|
|
19
|
+
view_only: Boolean(h.viewOnly),
|
|
20
|
+
}));
|
|
21
|
+
const rows = start.map((p) => ({ ...p }));
|
|
22
|
+
|
|
23
|
+
const list = el("div", { className: "peoplelist" });
|
|
24
|
+
const note = el("span", { className: "meta" });
|
|
25
|
+
const save = el("button", { className: "ghbtn primary", textContent: "Save" });
|
|
26
|
+
const add = el("button", { className: "ghbtn", textContent: "Add a person" });
|
|
27
|
+
|
|
28
|
+
const changed = () => JSON.stringify(rows) !== JSON.stringify(start);
|
|
29
|
+
const stamp = () => {
|
|
30
|
+
save.disabled = !changed();
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function paint() {
|
|
34
|
+
list.replaceChildren(
|
|
35
|
+
el("div", { className: "peoplerow peoplehead", ariaHidden: "true" }, [
|
|
36
|
+
el("span", { textContent: "Name" }),
|
|
37
|
+
el("span", { textContent: "GitHub login" }),
|
|
38
|
+
el("span", { textContent: "Looks after" }),
|
|
39
|
+
el("span", { textContent: "Read only" }),
|
|
40
|
+
el("span"),
|
|
41
|
+
]),
|
|
42
|
+
...rows.map((p, i) => row(p, i)),
|
|
43
|
+
);
|
|
44
|
+
stamp();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function row(p, i) {
|
|
48
|
+
const input = (key, placeholder, label) => {
|
|
49
|
+
const box = el("input", { type: "text", value: p[key], placeholder, ariaLabel: label });
|
|
50
|
+
box.oninput = () => {
|
|
51
|
+
p[key] = box.value;
|
|
52
|
+
stamp();
|
|
53
|
+
};
|
|
54
|
+
return box;
|
|
55
|
+
};
|
|
56
|
+
const only = el("input", { type: "checkbox", checked: p.view_only, ariaLabel: "Read only" });
|
|
57
|
+
only.onchange = () => {
|
|
58
|
+
p.view_only = only.checked;
|
|
59
|
+
stamp();
|
|
60
|
+
};
|
|
61
|
+
const remove = el("button", { className: "ghbtn danger", textContent: "Remove" });
|
|
62
|
+
remove.onclick = () => {
|
|
63
|
+
rows.splice(i, 1);
|
|
64
|
+
paint();
|
|
65
|
+
};
|
|
66
|
+
return el("div", { className: "peoplerow" }, [
|
|
67
|
+
input("name", "Name", "Name"),
|
|
68
|
+
input("github", "login", "GitHub login"),
|
|
69
|
+
input("handles", "e.g. marketing, content", "Looks after"),
|
|
70
|
+
el("label", { className: "peopleonly" }, [only]),
|
|
71
|
+
remove,
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
add.onclick = () => {
|
|
76
|
+
rows.push({ name: "", github: "", marker: "", role: "", handles: "", view_only: false });
|
|
77
|
+
paint();
|
|
78
|
+
list.querySelector(".peoplerow:last-child input")?.focus();
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
save.onclick = async () => {
|
|
82
|
+
save.disabled = true;
|
|
83
|
+
note.className = "meta";
|
|
84
|
+
note.textContent = "Saving…";
|
|
85
|
+
try {
|
|
86
|
+
const r = await post({ people: rows.filter((p) => p.github.trim() || p.name.trim()) }, "/api/people");
|
|
87
|
+
note.textContent = r.warnings?.length ? "Saved, but: " + r.warnings.join("; ") : "Saved.";
|
|
88
|
+
if (r.warnings?.length) note.className = "meta warn";
|
|
89
|
+
await refreshAll(false);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
note.textContent = String(e.message || e);
|
|
92
|
+
note.className = "meta err";
|
|
93
|
+
stamp();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
paint();
|
|
98
|
+
return el("div", { className: "card peoplecard" }, [
|
|
99
|
+
el("h2", { textContent: "People" }),
|
|
100
|
+
list,
|
|
101
|
+
el("div", { className: "row" }, [add, save, note]),
|
|
102
|
+
]);
|
|
103
|
+
}
|