@nanocollective/roster 0.1.0-alpha.9 → 0.1.0-beta.10
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 +6 -0
- package/dist/cli.js +4189 -1971
- package/dist/worker/assets/assets/css/base.css +327 -0
- package/dist/worker/assets/assets/css/brain.css +116 -0
- package/dist/worker/assets/assets/css/diff.css +33 -0
- package/dist/worker/assets/assets/css/graph.css +39 -0
- package/dist/worker/assets/assets/css/health.css +75 -0
- package/dist/worker/assets/assets/css/home.css +114 -0
- package/dist/worker/assets/assets/css/inbox.css +199 -0
- package/dist/worker/assets/assets/css/layout.css +181 -0
- package/dist/worker/assets/assets/css/markdown.css +96 -0
- package/dist/worker/assets/assets/css/runs.css +13 -0
- package/dist/worker/assets/assets/css/search.css +48 -0
- package/dist/worker/assets/assets/css/setup.css +194 -0
- package/dist/worker/assets/assets/js/api.js +191 -0
- package/dist/worker/assets/assets/js/app.js +500 -0
- package/dist/worker/assets/assets/js/dialog.js +196 -0
- package/dist/worker/assets/assets/js/dom.js +131 -0
- package/dist/worker/assets/assets/js/homesort.js +174 -0
- package/dist/worker/assets/assets/js/icons.js +142 -0
- package/dist/worker/assets/assets/js/inflight.js +18 -0
- package/dist/worker/assets/assets/js/lightbox.js +273 -0
- package/dist/worker/assets/assets/js/md.js +406 -0
- package/dist/worker/assets/assets/js/mdedit.js +84 -0
- package/dist/worker/assets/assets/js/mention.js +264 -0
- package/dist/worker/assets/assets/js/readiness.js +70 -0
- package/dist/worker/assets/assets/js/refresh.js +197 -0
- package/dist/worker/assets/assets/js/router.js +20 -0
- package/dist/worker/assets/assets/js/search.js +366 -0
- package/dist/worker/assets/assets/js/state.js +213 -0
- package/dist/worker/assets/assets/js/textdiff.js +96 -0
- package/dist/worker/assets/assets/js/views/app.js +145 -0
- package/dist/worker/assets/assets/js/views/brain.js +260 -0
- package/dist/worker/assets/assets/js/views/changed.js +157 -0
- package/dist/worker/assets/assets/js/views/checklist.js +115 -0
- package/dist/worker/assets/assets/js/views/credential.js +84 -0
- package/dist/worker/assets/assets/js/views/docs.js +174 -0
- package/dist/worker/assets/assets/js/views/files.js +139 -0
- package/dist/worker/assets/assets/js/views/graph.js +436 -0
- package/dist/worker/assets/assets/js/views/health.js +304 -0
- package/dist/worker/assets/assets/js/views/hire.js +593 -0
- package/dist/worker/assets/assets/js/views/home.js +621 -0
- package/dist/worker/assets/assets/js/views/inbox.js +1558 -0
- package/dist/worker/assets/assets/js/views/memory.js +150 -0
- package/dist/worker/assets/assets/js/views/org.js +195 -0
- package/dist/worker/assets/assets/js/views/orgedit.js +240 -0
- package/dist/worker/assets/assets/js/views/paste.js +216 -0
- package/dist/worker/assets/assets/js/views/prompt.js +457 -0
- package/dist/worker/assets/assets/js/views/repos.js +97 -0
- package/dist/worker/assets/assets/js/views/runonce.js +94 -0
- package/dist/worker/assets/assets/js/views/runs.js +182 -0
- package/dist/worker/assets/assets/js/views/setup.js +557 -0
- package/dist/worker/assets/assets/js/views/staff.js +291 -0
- package/dist/worker/assets/assets/js/views/todo.js +62 -0
- package/dist/worker/assets/assets/js/yaml.js +134 -0
- package/dist/worker/assets/docs-images/brain.jpg +0 -0
- package/dist/worker/assets/docs-images/home.jpg +0 -0
- package/dist/worker/assets/docs-images/org.jpg +0 -0
- package/dist/worker/assets/docs-images/prompt.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-org.jpg +0 -0
- package/dist/worker/assets/docs-images/setup-plan.jpg +0 -0
- package/dist/worker/assets/docs-images/staff.jpg +0 -0
- package/dist/worker/assets/index.html +82 -0
- package/dist/worker/index.js +5143 -0
- package/docs/README.md +2 -2
- package/docs/architecture.md +23 -4
- package/docs/charters/analyst.md +65 -0
- package/docs/charters/community.md +63 -0
- package/docs/charters/designer.md +65 -0
- package/docs/charters/devops.md +65 -0
- package/docs/charters/pm.md +70 -0
- package/docs/charters/qa.md +65 -0
- package/docs/charters/writer.md +63 -0
- package/docs/commands.md +36 -9
- package/docs/concepts.md +34 -21
- package/docs/cost.md +3 -3
- package/docs/developing.md +28 -10
- package/docs/doctor-codes.md +3 -1
- package/docs/export.md +2 -0
- package/docs/getting-started.md +49 -29
- package/docs/hosting.md +114 -43
- package/docs/images/brain.jpg +0 -0
- package/docs/images/home.jpg +0 -0
- package/docs/images/org.jpg +0 -0
- package/docs/images/prompt.jpg +0 -0
- package/docs/images/staff.jpg +0 -0
- package/docs/manual-steps.md +3 -2
- package/docs/memory.md +2 -1
- package/docs/org-yaml.md +3 -0
- package/docs/portal.md +144 -45
- package/docs/prompts.md +6 -0
- package/docs/security.md +70 -11
- package/docs/session-workflow.md +24 -6
- package/docs/staff-yaml.md +21 -2
- package/docs/upgrading.md +3 -3
- package/docs/writing-a-charter.md +19 -6
- package/package.json +4 -3
- package/templates/brain/.github/workflows/%%STAFF%%-daily.yaml +20 -1
- package/templates/brain/.github/workflows/%%STAFF%%-mention.yaml +53 -13
- package/templates/brain/CHARTER.md +2 -2
- package/templates/brain/STATE.md +16 -0
- package/templates/brain/memory/INDEX.md +1 -1
- package/templates/brain/staff.yaml +4 -1
- package/templates/briefs/amend.md +4 -3
- package/templates/briefs/priorities.md +46 -0
- package/templates/ops/.github/workflows/session.yaml +150 -3
- package/templates/ops/compose.mjs +35 -8
- package/templates/ops/org/operating.md +29 -10
- package/templates/ops/org/voice.md +2 -1
- package/templates/ops/prompts/daily.md +51 -14
- package/templates/ops/prompts/mention.md +24 -2
- package/templates/ops/run-record.mjs +5 -3
- package/templates/ops/status-week.mjs +169 -0
- package/templates/portal/css/base.css +49 -0
- package/templates/portal/css/health.css +14 -1
- package/templates/portal/css/home.css +114 -0
- package/templates/portal/css/inbox.css +21 -4
- package/templates/portal/css/layout.css +35 -3
- package/templates/portal/css/markdown.css +19 -0
- package/templates/portal/css/search.css +48 -0
- package/templates/portal/css/setup.css +79 -4
- package/templates/portal/index.html +15 -9
- package/templates/portal/js/api.js +60 -4
- package/templates/portal/js/app.js +125 -7
- package/templates/portal/js/dialog.js +36 -0
- package/templates/portal/js/homesort.js +174 -0
- package/templates/portal/js/icons.js +41 -0
- package/templates/portal/js/inflight.js +18 -0
- package/templates/portal/js/md.js +5 -2
- package/templates/portal/js/mdedit.js +84 -0
- package/templates/portal/js/readiness.js +70 -0
- package/templates/portal/js/refresh.js +10 -2
- package/templates/portal/js/search.js +366 -0
- package/templates/portal/js/state.js +11 -5
- package/templates/portal/js/views/app.js +1 -2
- package/templates/portal/js/views/brain.js +1 -1
- package/templates/portal/js/views/checklist.js +19 -4
- package/templates/portal/js/views/credential.js +42 -51
- package/templates/portal/js/views/health.js +11 -6
- package/templates/portal/js/views/hire.js +593 -0
- package/templates/portal/js/views/home.js +621 -0
- package/templates/portal/js/views/inbox.js +237 -68
- package/templates/portal/js/views/org.js +31 -111
- package/templates/portal/js/views/orgedit.js +240 -0
- package/templates/portal/js/views/paste.js +111 -66
- package/templates/portal/js/views/prompt.js +94 -40
- package/templates/portal/js/views/repos.js +10 -10
- package/templates/portal/js/views/runs.js +21 -4
- package/templates/portal/js/views/setup.js +130 -163
- package/templates/portal/js/views/staff.js +181 -301
- package/templates/portal/js/views/todo.js +62 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/* The Staff screen: a card per staff member, retiring, and the way in to hiring.
|
|
2
|
+
*
|
|
3
|
+
* Hiring itself is in hire.js. Retiring runs the CLI's own `buildRetirePlan` and
|
|
4
|
+
* `applyRetirePlan` on the server, plan then apply: you see what it stops and what it keeps,
|
|
5
|
+
* and nothing happens until you say so.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { post } from "../api.js";
|
|
9
|
+
import { askYes, sheet } from "../dialog.js";
|
|
10
|
+
import { pending } from "../inflight.js";
|
|
11
|
+
import { ago, el, esc } from "../dom.js";
|
|
12
|
+
import { sentence, staffProgress, whatsLeft } from "../readiness.js";
|
|
13
|
+
import { refreshAll } from "../refresh.js";
|
|
14
|
+
import { S } from "../state.js";
|
|
15
|
+
import { hireFlow, line, rolePicker } from "./hire.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Resolves once nothing is loading and `node` has stopped changing for a moment, or after a few
|
|
19
|
+
* seconds regardless. Quiet alone was not enough: while GitHub was still answering, nothing
|
|
20
|
+
* changed, and the half-built list was shown.
|
|
21
|
+
*/
|
|
22
|
+
function settled(node, quiet = 250, most = 6000) {
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
if (typeof MutationObserver !== "function") return resolve();
|
|
25
|
+
let lastChange = Date.now();
|
|
26
|
+
const obs = new MutationObserver(() => {
|
|
27
|
+
lastChange = Date.now();
|
|
28
|
+
});
|
|
29
|
+
obs.observe(node, { childList: true, subtree: true, attributes: true, characterData: true });
|
|
30
|
+
const started = Date.now();
|
|
31
|
+
const tick = setInterval(() => {
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
if ((pending() === 0 && now - lastChange >= quiet) || now - started >= most) {
|
|
34
|
+
clearInterval(tick);
|
|
35
|
+
obs.disconnect();
|
|
36
|
+
resolve();
|
|
37
|
+
}
|
|
38
|
+
}, 50);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* The open dialog, if any. It lives on <body>, so it outlives a repaint of this screen, and a
|
|
43
|
+
background refresh leaves whatever was typed into it alone. */
|
|
44
|
+
let current = null;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {{open?: string, result?: object}} [o] `open` keeps one staff member's steps on
|
|
48
|
+
* screen across a repaint, which is how a finished hire lands on step 2.
|
|
49
|
+
*/
|
|
50
|
+
export function viewStaff(m, o = {}) {
|
|
51
|
+
m.append(el("h1", { textContent: "Staff" }));
|
|
52
|
+
const empty = !S.data.staff.length;
|
|
53
|
+
if (empty) m.append(el("p", { className: "sub", textContent: "No staff yet. Pick a role to hire your first." }));
|
|
54
|
+
|
|
55
|
+
const pane = el("div", { className: "hirepane" });
|
|
56
|
+
|
|
57
|
+
/* Tasks open in a dialog. Where there is no dialog element (the test shim) they draw into
|
|
58
|
+
the pane instead, which is how this screen always drew them. */
|
|
59
|
+
function present(node) {
|
|
60
|
+
const spin = el("div", { className: "sheetloading" }, [el("span", { className: "spinner" })]);
|
|
61
|
+
if (current?.isOpen()) current.set(spin);
|
|
62
|
+
else {
|
|
63
|
+
current = sheet({
|
|
64
|
+
node: spin,
|
|
65
|
+
onClose: () => {
|
|
66
|
+
current = null;
|
|
67
|
+
S.staffOpen = null;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
if (!current) {
|
|
71
|
+
pane.replaceChildren(node);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/* The list is built from half a dozen answers arriving one by one, and showing each as it
|
|
76
|
+
landed meant the dialog reflowed four times. It is shown once it has stopped changing. */
|
|
77
|
+
const mine = current;
|
|
78
|
+
settled(node).then(() => {
|
|
79
|
+
if (mine.isOpen() && current === mine) mine.set(node);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function dismiss() {
|
|
83
|
+
if (current) current.close();
|
|
84
|
+
else pane.replaceChildren();
|
|
85
|
+
S.staffOpen = null;
|
|
86
|
+
if (empty) pick();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// With nobody hired the roles are the page. After that they are a dialog behind Hire someone.
|
|
90
|
+
function pick() {
|
|
91
|
+
if (empty) {
|
|
92
|
+
pane.replaceChildren(rolePicker({ onPick: (role) => open(role) }));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const cancel = el("button", { className: "ghbtn", textContent: "Cancel" });
|
|
96
|
+
cancel.onclick = dismiss;
|
|
97
|
+
present(
|
|
98
|
+
el("div", {}, [
|
|
99
|
+
el("h2", { className: "sheettitle", textContent: "Pick a role" }),
|
|
100
|
+
rolePicker({ onPick: (role) => open(role) }),
|
|
101
|
+
el("div", { className: "row", style: "margin-top:14px" }, [cancel]),
|
|
102
|
+
]),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* One staff member's steps, hired or not yet. A hire repaints the whole screen, so the new
|
|
107
|
+
card is in the list and the steps reopen on the same person. */
|
|
108
|
+
function open(role, result) {
|
|
109
|
+
// Remembered, so a refresh after a trip to GitHub (creating the App) reopens it.
|
|
110
|
+
S.staffOpen = role;
|
|
111
|
+
present(
|
|
112
|
+
hireFlow({
|
|
113
|
+
role,
|
|
114
|
+
result,
|
|
115
|
+
onHired: (handle, r) => {
|
|
116
|
+
m.replaceChildren();
|
|
117
|
+
viewStaff(m, { open: handle, result: r });
|
|
118
|
+
},
|
|
119
|
+
onClose: dismiss,
|
|
120
|
+
}),
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!empty) {
|
|
125
|
+
const list = el("div", { className: "grid", style: "margin-bottom:18px" });
|
|
126
|
+
for (const s of S.data.staff) list.append(card(s));
|
|
127
|
+
// In the grid, where the next person would go, rather than a button under it.
|
|
128
|
+
if (!S.hosted) {
|
|
129
|
+
const hire = el("button", { className: "hirecard", textContent: "Hire someone" });
|
|
130
|
+
hire.onclick = pick;
|
|
131
|
+
list.append(hire);
|
|
132
|
+
}
|
|
133
|
+
m.append(list);
|
|
134
|
+
// Hiring creates repos and Apps and writes secrets, which is done from your own machine.
|
|
135
|
+
if (S.hosted) {
|
|
136
|
+
m.append(
|
|
137
|
+
el("p", {
|
|
138
|
+
className: "sub",
|
|
139
|
+
textContent: "Hire, retire and finish setting up in roster portal on your machine.",
|
|
140
|
+
}),
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
m.append(pane);
|
|
145
|
+
|
|
146
|
+
const opened = o.open && S.data.staff.find((s) => s.handle === o.open);
|
|
147
|
+
const kept = !opened && S.staffOpen;
|
|
148
|
+
const keptStaff = kept && S.data.staff.find((s) => s.handle === kept.handle);
|
|
149
|
+
if (empty) pick();
|
|
150
|
+
if (opened) open(roleOf(opened), o.result);
|
|
151
|
+
// An open dialog is still open; only the inline fallback has to be drawn again.
|
|
152
|
+
else if (kept && !current?.isOpen()) open(keptStaff ? roleOf(keptStaff) : kept);
|
|
153
|
+
|
|
154
|
+
/* --------------------------- one staff member --------------------------- */
|
|
155
|
+
|
|
156
|
+
/** " · works with Chief Marketing Officer". The labels and wiring behind it are roster's. */
|
|
157
|
+
function worksWith(s) {
|
|
158
|
+
const names = (s.peers ?? [])
|
|
159
|
+
.map((p) => S.data.staff.find((x) => x.handle === p.handle)?.name ?? p.handle)
|
|
160
|
+
.filter(Boolean);
|
|
161
|
+
return names.length ? " · works with " + esc(names.join(", ")) : "";
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function card(s) {
|
|
165
|
+
const d = el("div", { className: "kv staffcard" });
|
|
166
|
+
const rig = s.rig ?? {};
|
|
167
|
+
d.innerHTML =
|
|
168
|
+
'<div class="k">' + esc(s.handle) + "</div>" +
|
|
169
|
+
'<div class="v">' + esc(s.name) +
|
|
170
|
+
"<small>" + esc(s.brain ?? s.dir) + " · " + s.facts.length + " facts · " +
|
|
171
|
+
(rig.lastCommit ? "last commit " + esc(ago(rig.lastCommit.date)) : "no commits") +
|
|
172
|
+
worksWith(s) +
|
|
173
|
+
"</small></div>";
|
|
174
|
+
|
|
175
|
+
const status = el("span", { className: "meta" });
|
|
176
|
+
const go = el("button", { className: "ghbtn", textContent: "Retire" });
|
|
177
|
+
go.onclick = () => {
|
|
178
|
+
const host = el("div");
|
|
179
|
+
present(host);
|
|
180
|
+
retireForm(host, s, status);
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/* Every setup step (the App, the charter, the credential, a run) is in the one list, so the
|
|
184
|
+
card has one way in. It says Finish setting up until setup looks finished: the charter
|
|
185
|
+
from disk at once, and the App's secrets and a first run from GitHub when it answers. */
|
|
186
|
+
const finish = el("button", { className: "ghbtn", textContent: "Set up" });
|
|
187
|
+
finish.onclick = () => open(roleOf(s));
|
|
188
|
+
const warn = el("p", { className: "warnline", hidden: true });
|
|
189
|
+
whatsLeft(s).then((left) => {
|
|
190
|
+
if (!left.length) return;
|
|
191
|
+
finish.textContent = "Finish setting up";
|
|
192
|
+
finish.className = "ghbtn primary";
|
|
193
|
+
d.classList.add("notready");
|
|
194
|
+
warn.hidden = false;
|
|
195
|
+
const p = staffProgress(s.handle);
|
|
196
|
+
warn.textContent =
|
|
197
|
+
"Not ready to run. " + (p ? `${p.done} of ${p.total} done. ` : "") +
|
|
198
|
+
"Still to do: " + sentence(left) + ".";
|
|
199
|
+
});
|
|
200
|
+
d.append(warn);
|
|
201
|
+
|
|
202
|
+
// Both create or delete things only your own machine can: Apps, secrets, repos.
|
|
203
|
+
if (!S.hosted) {
|
|
204
|
+
d.append(
|
|
205
|
+
el("div", { className: "row", style: "margin-top:10px" }, [finish, go, status]),
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
return d;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* ------------------------------- retiring ------------------------------- */
|
|
212
|
+
|
|
213
|
+
async function retireForm(host, s, cardStatus) {
|
|
214
|
+
cardStatus.textContent = "planning…";
|
|
215
|
+
cardStatus.className = "meta";
|
|
216
|
+
let data;
|
|
217
|
+
try {
|
|
218
|
+
data = await (
|
|
219
|
+
await fetch("/api/staff/plan?action=retire&handle=" + encodeURIComponent(s.handle), {
|
|
220
|
+
cache: "no-store",
|
|
221
|
+
})
|
|
222
|
+
).json();
|
|
223
|
+
if (data.error) throw new Error(data.error);
|
|
224
|
+
} catch (e) {
|
|
225
|
+
cardStatus.textContent = e.message;
|
|
226
|
+
cardStatus.className = "meta err";
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
cardStatus.textContent = "";
|
|
230
|
+
|
|
231
|
+
const plan = data.plan;
|
|
232
|
+
const box = el("div", { className: "plan" });
|
|
233
|
+
box.append(el("h3", { textContent: "Retire " + plan.name + "?" }));
|
|
234
|
+
box.append(el("div", { className: "planhead", textContent: "This would stop" }));
|
|
235
|
+
for (const w of plan.workflows) box.append(line("stop", plan.dir + "/" + w + " disabled"));
|
|
236
|
+
box.append(line("stop", "removed from org.yaml"));
|
|
237
|
+
for (const p of plan.peers) {
|
|
238
|
+
box.append(
|
|
239
|
+
line("stop", "removed from " + p.dir + "/staff.yaml"),
|
|
240
|
+
line("stop", p.label + " deleted from " + (p.brain ?? p.dir)),
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* The point of retiring rather than deleting. Said as loudly as what it stops, because
|
|
245
|
+
"this is not destructive" is the thing somebody needs to believe before clicking. */
|
|
246
|
+
box.append(el("div", { className: "planhead keep", textContent: "This would keep" }));
|
|
247
|
+
for (const k of plan.keeps) box.append(line("keep", k));
|
|
248
|
+
for (const w of plan.warnings ?? []) box.append(line("warn", w));
|
|
249
|
+
|
|
250
|
+
const status = el("span", { className: "meta" });
|
|
251
|
+
const go = el("button", { className: "ghbtn", textContent: "Retire " + plan.handle });
|
|
252
|
+
const cancel = el("button", { className: "ghbtn", textContent: "Cancel" });
|
|
253
|
+
cancel.onclick = dismiss;
|
|
254
|
+
go.onclick = () =>
|
|
255
|
+
apply(
|
|
256
|
+
{ action: "retire", handle: plan.handle },
|
|
257
|
+
{ title: "Retire " + plan.name + "?", hint: (plan.brain ?? plan.dir) + " is not touched.", confirm: "Retire " + plan.handle },
|
|
258
|
+
go,
|
|
259
|
+
status,
|
|
260
|
+
box,
|
|
261
|
+
);
|
|
262
|
+
box.append(el("div", { className: "row", style: "margin-top:14px" }, [go, cancel, status]));
|
|
263
|
+
host.replaceChildren(box);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/* -------------------------------- apply -------------------------------- */
|
|
267
|
+
|
|
268
|
+
async function apply(payload, ask, btn, status, box) {
|
|
269
|
+
if (!(await askYes(ask))) return;
|
|
270
|
+
btn.disabled = true;
|
|
271
|
+
status.textContent = "working…";
|
|
272
|
+
status.className = "meta";
|
|
273
|
+
try {
|
|
274
|
+
const r = await post(payload, "/api/staff/apply");
|
|
275
|
+
status.textContent = r.ok ? "done" : "finished with problems";
|
|
276
|
+
status.className = r.ok ? "meta ok" : "meta warn";
|
|
277
|
+
// What the terminal would have printed, because that is the useful account of it.
|
|
278
|
+
if (r.output) box.append(el("pre", { className: "code planout", textContent: r.output }));
|
|
279
|
+
await refreshAll(true);
|
|
280
|
+
} catch (e) {
|
|
281
|
+
status.textContent = e.message;
|
|
282
|
+
status.className = "meta err";
|
|
283
|
+
btn.disabled = false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** The flow's view of somebody already hired. */
|
|
289
|
+
function roleOf(s) {
|
|
290
|
+
return { handle: s.handle, name: s.name, dir: s.dir };
|
|
291
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* The numbered step card shared by Getting started and the hiring flow on the Staff screen. */
|
|
2
|
+
|
|
3
|
+
import { el } from "../dom.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* One numbered thing to do. Done ones fold to a single ticked line, and Change opens them again,
|
|
7
|
+
* so the list shows what is left without hiding what was done.
|
|
8
|
+
*
|
|
9
|
+
* `setLocked(reason)` greys a step that cannot start yet and says why in the pill; `null`
|
|
10
|
+
* unlocks it. A locked step shows no body, because a form you cannot use yet is a trap.
|
|
11
|
+
*/
|
|
12
|
+
export function todo(n, title, done) {
|
|
13
|
+
const card = el("section", { className: "todo" });
|
|
14
|
+
const num = el("span", { className: "todon" });
|
|
15
|
+
const pill = el("span", { className: "todopill" });
|
|
16
|
+
const change = el("button", { className: "ghbtn todochange", textContent: "Change" });
|
|
17
|
+
const head = el("div", { className: "todohead" }, [num, el("h3", { textContent: title }), pill, change]);
|
|
18
|
+
const hintEl = el("p", { className: "sub todohint" });
|
|
19
|
+
const body = el("div", { className: "todobody" });
|
|
20
|
+
card.append(head, hintEl, body);
|
|
21
|
+
let open = false;
|
|
22
|
+
let locked = null;
|
|
23
|
+
let isDone = done;
|
|
24
|
+
const paint = () => {
|
|
25
|
+
card.classList.toggle("done", isDone && !locked);
|
|
26
|
+
card.classList.toggle("locked", Boolean(locked));
|
|
27
|
+
num.textContent = isDone && !locked ? "✓" : String(n);
|
|
28
|
+
pill.textContent = locked ?? (isDone ? "Done" : "To do");
|
|
29
|
+
change.hidden = !isDone || Boolean(locked);
|
|
30
|
+
const shown = !locked && (!isDone || open);
|
|
31
|
+
body.hidden = !shown;
|
|
32
|
+
hintEl.hidden = !shown || !hintEl.textContent;
|
|
33
|
+
};
|
|
34
|
+
const setDone = (d) => {
|
|
35
|
+
isDone = Boolean(d);
|
|
36
|
+
paint();
|
|
37
|
+
};
|
|
38
|
+
change.onclick = () => {
|
|
39
|
+
open = !open;
|
|
40
|
+
change.textContent = open ? "Close" : "Change";
|
|
41
|
+
paint();
|
|
42
|
+
};
|
|
43
|
+
paint();
|
|
44
|
+
return {
|
|
45
|
+
card,
|
|
46
|
+
body,
|
|
47
|
+
setDone,
|
|
48
|
+
isDone: () => isDone,
|
|
49
|
+
setLocked: (reason) => {
|
|
50
|
+
locked = reason || null;
|
|
51
|
+
paint();
|
|
52
|
+
},
|
|
53
|
+
renumber: (m) => {
|
|
54
|
+
n = m;
|
|
55
|
+
paint();
|
|
56
|
+
},
|
|
57
|
+
hint: (text) => {
|
|
58
|
+
hintEl.textContent = text;
|
|
59
|
+
paint();
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/* Colour for YAML.
|
|
2
|
+
*
|
|
3
|
+
* `org.yaml` and `staff.yaml` are the two files here a person actually reads closely, and they
|
|
4
|
+
* were served as one flat grey wall: the comments, the keys and the values all the same weight,
|
|
5
|
+
* so finding `mention_timeout_minutes` meant reading every line. Structure is the thing YAML has
|
|
6
|
+
* and prose does not, and showing it costs about eighty lines.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately not a parser. It is a per-line tokeniser that knows comments, keys, quoted
|
|
9
|
+
* strings, numbers and the three keywords — enough to read by, and it cannot fail on a file it
|
|
10
|
+
* does not understand, because anything it does not recognise is left as plain text.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { el, esc } from "./dom.js";
|
|
14
|
+
|
|
15
|
+
/** A `<pre>` holding the highlighted source. */
|
|
16
|
+
export function yamlPre(text, className = "code yaml") {
|
|
17
|
+
const pre = el("pre", { className });
|
|
18
|
+
pre.innerHTML = yamlHTML(text);
|
|
19
|
+
return pre;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Escaped, highlighted HTML. Takes raw text: it does its own escaping. */
|
|
23
|
+
export function yamlHTML(text) {
|
|
24
|
+
return String(text ?? "")
|
|
25
|
+
.split("\n")
|
|
26
|
+
.map(colourLine)
|
|
27
|
+
.join("\n");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The same, for text that is already HTML-escaped.
|
|
32
|
+
*
|
|
33
|
+
* The markdown renderer escapes a fenced block before it knows what language it is, and
|
|
34
|
+
* un-escaping four entities to escape them again is exact and cheaper than restructuring
|
|
35
|
+
* the renderer around one case.
|
|
36
|
+
*/
|
|
37
|
+
export function yamlHTMLFromEscaped(escaped) {
|
|
38
|
+
return yamlHTML(
|
|
39
|
+
String(escaped ?? "")
|
|
40
|
+
.replace(/</g, "<")
|
|
41
|
+
.replace(/>/g, ">")
|
|
42
|
+
.replace(/"/g, '"')
|
|
43
|
+
.replace(/&/g, "&"),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const span = (cls, text) => '<span class="' + cls + '">' + esc(text) + "</span>";
|
|
48
|
+
|
|
49
|
+
function colourLine(raw) {
|
|
50
|
+
const [code, comment] = splitComment(raw);
|
|
51
|
+
return (code ? colourCode(code) : "") + (comment ? span("yc", comment) : "");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Split a trailing comment off, without cutting a `#` that is inside a string.
|
|
56
|
+
*
|
|
57
|
+
* `marker: will # the provenance tag` is a comment; `name: "a # b"` is not. YAML also only
|
|
58
|
+
* starts a comment at the beginning of a line or after whitespace, which is what keeps a
|
|
59
|
+
* `#hashtag` in a value intact.
|
|
60
|
+
*/
|
|
61
|
+
function splitComment(raw) {
|
|
62
|
+
let quote = null;
|
|
63
|
+
for (let i = 0; i < raw.length; i++) {
|
|
64
|
+
const c = raw[i];
|
|
65
|
+
if (quote) {
|
|
66
|
+
if (c === quote && raw[i - 1] !== "\\") quote = null;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (c === '"' || c === "'") {
|
|
70
|
+
quote = c;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (c === "#" && (i === 0 || /\s/.test(raw[i - 1]))) return [raw.slice(0, i), raw.slice(i)];
|
|
74
|
+
}
|
|
75
|
+
return [raw, ""];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const DOC = /^\s*(---|\.\.\.)\s*$/;
|
|
79
|
+
/** Indent, then any run of list dashes: ` - - name: x` is two levels of list. */
|
|
80
|
+
const LEAD = /^(\s*)((?:-\s+)*)/;
|
|
81
|
+
/** A key is everything up to the first colon that is followed by a space or the end of line. */
|
|
82
|
+
const KEY = /^([^\s"'#][^:]*?)(:)(\s|$)/;
|
|
83
|
+
|
|
84
|
+
function colourCode(code) {
|
|
85
|
+
if (DOC.test(code)) return span("yp", code);
|
|
86
|
+
|
|
87
|
+
const lead = LEAD.exec(code);
|
|
88
|
+
const indent = lead[1];
|
|
89
|
+
const dashes = lead[2];
|
|
90
|
+
let rest = code.slice(indent.length + dashes.length);
|
|
91
|
+
let out = indent + (dashes ? span("yd", dashes) : "");
|
|
92
|
+
|
|
93
|
+
/* A line that opens a flow collection has no key of its own: `- { handle: cto }` is a list
|
|
94
|
+
item whose keys are all inside the braces, and taking "{ handle" for a key marked the
|
|
95
|
+
brace as part of the name. */
|
|
96
|
+
const key = /^[{[]/.test(rest) ? null : KEY.exec(rest);
|
|
97
|
+
if (key) {
|
|
98
|
+
out += span("yk", key[1]) + span("yp", key[2]) + key[3];
|
|
99
|
+
rest = rest.slice(key[1].length + 1 + key[3].length);
|
|
100
|
+
}
|
|
101
|
+
return out + colourValue(rest);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Strings, inline-map keys, the three keywords, numbers, and the punctuation that holds a flow
|
|
105
|
+
collection together. Ordered: a quoted string wins over everything inside it. */
|
|
106
|
+
const TOKEN = new RegExp(
|
|
107
|
+
[
|
|
108
|
+
/("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/, // 1 quoted string
|
|
109
|
+
/([A-Za-z_][\w.-]*)(\s*:)(?=\s|$)/, // 2,3 a key inside an inline map
|
|
110
|
+
/(\b(?:true|false|null|yes|no|on|off)\b|~)/, // 4 keywords
|
|
111
|
+
/(-?\d+(?:\.\d+)?\b)/, // 5 numbers
|
|
112
|
+
/([{}[\],])/, // 6 flow punctuation
|
|
113
|
+
]
|
|
114
|
+
.map((r) => r.source)
|
|
115
|
+
.join("|"),
|
|
116
|
+
"g",
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
function colourValue(value) {
|
|
120
|
+
if (!value) return "";
|
|
121
|
+
let out = "";
|
|
122
|
+
let at = 0;
|
|
123
|
+
TOKEN.lastIndex = 0;
|
|
124
|
+
for (let m = TOKEN.exec(value); m; m = TOKEN.exec(value)) {
|
|
125
|
+
out += esc(value.slice(at, m.index));
|
|
126
|
+
if (m[1]) out += span("ys", m[1]);
|
|
127
|
+
else if (m[2]) out += span("yk", m[2]) + span("yp", m[3]);
|
|
128
|
+
else if (m[4]) out += span("yb", m[4]);
|
|
129
|
+
else if (m[5]) out += span("yn", m[5]);
|
|
130
|
+
else out += span("yp", m[6]);
|
|
131
|
+
at = m.index + m[0].length;
|
|
132
|
+
}
|
|
133
|
+
return out + esc(value.slice(at));
|
|
134
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
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">
|
|
9
|
+
<!-- Stylesheets and modules are served from /assets by `roster portal`. No build step:
|
|
10
|
+
editing one of these files and reloading is the whole edit loop. -->
|
|
11
|
+
<link rel="stylesheet" href="/assets/css/base.css">
|
|
12
|
+
<link rel="stylesheet" href="/assets/css/layout.css">
|
|
13
|
+
<link rel="stylesheet" href="/assets/css/markdown.css">
|
|
14
|
+
<link rel="stylesheet" href="/assets/css/brain.css">
|
|
15
|
+
<link rel="stylesheet" href="/assets/css/inbox.css">
|
|
16
|
+
<link rel="stylesheet" href="/assets/css/home.css">
|
|
17
|
+
<link rel="stylesheet" href="/assets/css/search.css">
|
|
18
|
+
<link rel="stylesheet" href="/assets/css/graph.css">
|
|
19
|
+
<link rel="stylesheet" href="/assets/css/diff.css">
|
|
20
|
+
<link rel="stylesheet" href="/assets/css/health.css">
|
|
21
|
+
<link rel="stylesheet" href="/assets/css/runs.css">
|
|
22
|
+
<link rel="stylesheet" href="/assets/css/setup.css">
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<div class="app">
|
|
26
|
+
<aside class="side">
|
|
27
|
+
<div class="brand"><span class="mark"></span>roster<small id="orgname">loading…</small></div>
|
|
28
|
+
<button class="refreshall" id="refreshall" title="Reload everything from GitHub (r)">
|
|
29
|
+
<span class="sync" data-icon="refresh"></span><span id="loaded">data now</span>
|
|
30
|
+
</button>
|
|
31
|
+
|
|
32
|
+
<button class="sidesearch" id="sidesearch" title="Search everything (⌘K)">
|
|
33
|
+
<span class="ic" data-icon="search"></span><span class="t">Search</span><kbd id="searchkey">⌘K</kbd>
|
|
34
|
+
</button>
|
|
35
|
+
|
|
36
|
+
<!-- Only while something is left to set up; app.js decides. -->
|
|
37
|
+
<button class="nav top" id="setupnav" data-view="setup" hidden>
|
|
38
|
+
<span class="ic" data-icon="task-done"></span> Getting started
|
|
39
|
+
<span class="n" id="setupcount"></span>
|
|
40
|
+
</button>
|
|
41
|
+
<button class="nav top" id="homenav" data-view="home" title="What needs you, and who is working">
|
|
42
|
+
<span class="ic" data-icon="inbox"></span> Home
|
|
43
|
+
<span class="n" id="homecount"></span>
|
|
44
|
+
</button>
|
|
45
|
+
<button class="nav" id="inboxnav" data-view="inbox" title="Every open issue on each staff member's tracker">
|
|
46
|
+
<span class="ic" data-icon="issue-open"></span> Trackers
|
|
47
|
+
<span class="n" id="inboxcount"></span>
|
|
48
|
+
</button>
|
|
49
|
+
<div class="staffviews" id="inboxsub" hidden></div>
|
|
50
|
+
<button class="nav" id="runsnav" data-view="runs" title="What ran, how it ended, and what it cost">
|
|
51
|
+
<span class="ic" data-icon="play"></span> Runs
|
|
52
|
+
</button>
|
|
53
|
+
<button class="nav" id="orgnav" data-view="org">
|
|
54
|
+
<span class="ic" data-icon="file"></span> Org
|
|
55
|
+
</button>
|
|
56
|
+
<button class="nav" id="staffnav" data-view="staff">
|
|
57
|
+
<span class="ic" data-icon="person"></span> Staff
|
|
58
|
+
</button>
|
|
59
|
+
<button class="nav" id="docsnav" data-view="docs">
|
|
60
|
+
<span class="ic" data-icon="docs"></span> Docs
|
|
61
|
+
</button>
|
|
62
|
+
|
|
63
|
+
<!-- The heading is the fold. Collapsed, it carries the count, because a hidden list still
|
|
64
|
+
has to say how much it is hiding. -->
|
|
65
|
+
<!-- Named apart from the Staff screen above it: two controls both called "Staff" is how a
|
|
66
|
+
click meant for the screen landed on the fold, for people and for automation alike. -->
|
|
67
|
+
<button class="sect sectfold" id="stafffold" aria-expanded="false" aria-controls="stafflist"
|
|
68
|
+
aria-label="Staff list" title="Show or hide each staff member's own screens">
|
|
69
|
+
<span class="caret" data-icon="chevron"></span>Staff<span class="n" id="staffcount" hidden></span>
|
|
70
|
+
</button>
|
|
71
|
+
<div id="stafflist"></div>
|
|
72
|
+
|
|
73
|
+
<div class="sidefoot">
|
|
74
|
+
<button class="nav" id="theme">Theme</button>
|
|
75
|
+
</div>
|
|
76
|
+
</aside>
|
|
77
|
+
<main id="main"><p class="sub">Loading…</p></main>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<script type="module" src="/assets/js/app.js"></script>
|
|
81
|
+
</body>
|
|
82
|
+
</html>
|