@nanocollective/roster 0.1.0-beta.30 → 0.1.0-beta.32
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/worker/assets/assets/css/brain.css +2 -0
- package/dist/worker/assets/assets/css/home.css +17 -4
- package/dist/worker/assets/assets/css/routines.css +3 -0
- package/dist/worker/assets/assets/css/setup.css +5 -0
- package/dist/worker/assets/assets/js/app.js +3 -0
- package/dist/worker/assets/assets/js/mention.js +2 -1
- package/dist/worker/assets/assets/js/readiness.js +42 -0
- package/dist/worker/assets/assets/js/refresh.js +4 -0
- package/dist/worker/assets/assets/js/views/connectors.js +5 -0
- package/dist/worker/assets/assets/js/views/health.js +11 -5
- package/dist/worker/assets/assets/js/views/hire.js +1 -1
- package/dist/worker/assets/assets/js/views/home.js +117 -4
- package/dist/worker/assets/assets/js/views/inbox.js +14 -1
- package/dist/worker/assets/assets/js/views/notready.js +70 -0
- package/dist/worker/assets/assets/js/views/org.js +14 -1
- package/dist/worker/assets/assets/js/views/routines.js +19 -2
- package/dist/worker/assets/assets/js/views/runonce.js +5 -0
- package/dist/worker/assets/assets/js/views/runs.js +11 -1
- package/dist/worker/assets/assets/js/views/staff.js +44 -4
- package/package.json +1 -1
- package/templates/portal/css/brain.css +2 -0
- package/templates/portal/css/home.css +17 -4
- package/templates/portal/css/routines.css +3 -0
- package/templates/portal/css/setup.css +5 -0
- package/templates/portal/js/app.js +3 -0
- package/templates/portal/js/mention.js +2 -1
- package/templates/portal/js/readiness.js +42 -0
- package/templates/portal/js/refresh.js +4 -0
- package/templates/portal/js/views/connectors.js +5 -0
- package/templates/portal/js/views/health.js +11 -5
- package/templates/portal/js/views/hire.js +1 -1
- package/templates/portal/js/views/home.js +117 -4
- package/templates/portal/js/views/inbox.js +14 -1
- package/templates/portal/js/views/notready.js +70 -0
- package/templates/portal/js/views/org.js +14 -1
- package/templates/portal/js/views/routines.js +19 -2
- package/templates/portal/js/views/runonce.js +5 -0
- package/templates/portal/js/views/runs.js +11 -1
- package/templates/portal/js/views/staff.js +44 -4
|
@@ -138,3 +138,5 @@
|
|
|
138
138
|
.peopleonly::after{content:"Read only";font:12.5px var(--sans);color:var(--ink-dim);margin-left:6px}
|
|
139
139
|
.peopleonly{justify-content:flex-start;align-items:center}
|
|
140
140
|
}
|
|
141
|
+
/* An org file setup is still waiting on: a small tag under its name, not a bar. */
|
|
142
|
+
.tlayer .t > .chip{align-self:flex-start;margin-top:4px;height:auto;padding-block:1px;font-size:11px}
|
|
@@ -66,13 +66,14 @@
|
|
|
66
66
|
/* Progress: a card per staff member. Status and one line, then Done and Next side by side. */
|
|
67
67
|
/* Progress: one card, a row per staff member. The line on how it is going is what you read;
|
|
68
68
|
everything else is quieter, and what got done waits behind Full report. */
|
|
69
|
-
.homereports{display:flex;flex-direction:column;padding-top:
|
|
70
|
-
.homereport{display:flex;flex-direction:column;gap:
|
|
69
|
+
.homereports{display:flex;flex-direction:column;padding-top:6px;padding-bottom:6px}
|
|
70
|
+
.homereport{display:flex;flex-direction:column;gap:8px;padding:14px 0;min-width:0}
|
|
71
71
|
.homereport + .homereport{border-top:1px solid var(--line)}
|
|
72
|
-
.homereporthead{display:flex;align-items:center;flex-wrap:wrap;gap:
|
|
72
|
+
.homereporthead{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;min-height:28px}
|
|
73
73
|
.homereportstatus{font-weight:600}
|
|
74
74
|
.homereportwhen{font-size:12px}
|
|
75
|
-
.homereportacts{margin-left:auto;display:flex;align-items:center;gap:
|
|
75
|
+
.homereportacts{margin-left:auto;display:flex;align-items:center;gap:8px}
|
|
76
|
+
.homereportacts .ghbtn{min-height:28px;padding:3px 12px;font-size:12.5px}
|
|
76
77
|
.homereportline{font-size:var(--text-body-size);line-height:var(--text-body-leading);color:var(--ink);
|
|
77
78
|
padding-left:23px}
|
|
78
79
|
.homereportline p{margin:0}
|
|
@@ -184,3 +185,15 @@
|
|
|
184
185
|
.homeline .homerunlog{grid-column:2}
|
|
185
186
|
.homeline .homerunlog:empty{display:none}
|
|
186
187
|
}
|
|
188
|
+
|
|
189
|
+
/* Setup that is not finished, above everything else on Home. */
|
|
190
|
+
.homesetup{padding:14px 16px;margin:20px 0 22px;border-color:color-mix(in srgb,var(--warn) 45%,var(--line));
|
|
191
|
+
background:color-mix(in srgb,var(--warn) 7%,var(--panel))}
|
|
192
|
+
.homesetup > b{font:600 15px var(--sans)}
|
|
193
|
+
.homesetup .sub{margin:4px 0 10px}
|
|
194
|
+
.homesetupsteps{margin:0 0 4px;padding-left:20px;display:flex;flex-direction:column;gap:10px;font-size:13.5px}
|
|
195
|
+
.homesetupsteps li > span{display:block;margin-bottom:5px}
|
|
196
|
+
.homesetup .row{margin-top:10px}
|
|
197
|
+
.homesetup > .connline{margin:0 0 4px}
|
|
198
|
+
.homesetup .homesetupor{margin:14px 0 10px}
|
|
199
|
+
.homesetupsteps li > span .ghbtn{margin-left:6px;min-height:24px;padding:1px 10px;font-size:12px}
|
|
@@ -38,3 +38,6 @@
|
|
|
38
38
|
}
|
|
39
39
|
.routwhenpick select{width:auto}
|
|
40
40
|
.routhead + div > .connhead:first-child{margin-top:20px}
|
|
41
|
+
/* What is left before they can run, as wide as the list it sits over. */
|
|
42
|
+
.connhead + .readyslot{max-width:880px}
|
|
43
|
+
.connhead + .readyslot:not(:empty){margin:0 0 10px}
|
|
@@ -180,3 +180,8 @@ a.btn{text-decoration:none}
|
|
|
180
180
|
.credform{display:grid;gap:10px}
|
|
181
181
|
.credform .row{margin:0}
|
|
182
182
|
.okline{margin:0 0 8px;color:var(--accent);font:600 13px var(--sans)}
|
|
183
|
+
/* A staff member who cannot run yet, on any screen that would start them. */
|
|
184
|
+
.warnline.notready{display:flex;flex-direction:column;gap:10px;padding:12px 14px}
|
|
185
|
+
/* Wherever it is dropped in, it keeps clear of what is above and below it. */
|
|
186
|
+
.readyslot:not(:empty){margin:16px 0 18px}
|
|
187
|
+
.readyslot > .warnline{margin:0}
|
|
@@ -404,6 +404,9 @@ function render() {
|
|
|
404
404
|
export and a portal can go stale under a page that is already open. */
|
|
405
405
|
const missing = NEEDS.filter((k) => S.data?.[k] === undefined);
|
|
406
406
|
if (missing.length) return stale(missing);
|
|
407
|
+
/* A staff member's screen with nobody hired threw on the missing staff member and left the
|
|
408
|
+
page blank. A hash like #/-/brain still lands here, so it gets Home, which says what to do. */
|
|
409
|
+
if (!S.data.staff.length && !ORG_WIDE.has(S.view)) S.view = "home";
|
|
407
410
|
|
|
408
411
|
// A refresh can add or remove a staff member, and the sidebar is built once.
|
|
409
412
|
const roster = S.data.staff.map((s) => s.handle).join(" ");
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { el, esc } from "./dom.js";
|
|
15
|
+
import { canRun } from "./readiness.js";
|
|
15
16
|
import { humansOf, S } from "./state.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -37,7 +38,7 @@ export function mentionable() {
|
|
|
37
38
|
out.push({
|
|
38
39
|
text: at,
|
|
39
40
|
label: s.name ?? s.handle,
|
|
40
|
-
note: "wakes them, usually within a minute",
|
|
41
|
+
note: canRun(s.handle) ? "wakes them, usually within a minute" : "not set up yet, so nothing wakes them",
|
|
41
42
|
kind: "staff",
|
|
42
43
|
terms: [at.replace(/^@/, ""), s.handle, s.name ?? ""],
|
|
43
44
|
});
|
|
@@ -28,6 +28,48 @@ export function notReady() {
|
|
|
28
28
|
return (S.data?.staff ?? []).filter((s) => (S.readiness?.[s.handle] ?? []).length);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Whether a run started now could work: nothing left but the first run itself. Unknown counts
|
|
33
|
+
* as able, so a slow answer from GitHub never greys out a working org's buttons.
|
|
34
|
+
*/
|
|
35
|
+
export function canRun(handle) {
|
|
36
|
+
return !(S.readiness?.[handle] ?? []).some((x) => x !== "run once");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Whether they have never finished a run, as far as is known. */
|
|
40
|
+
export function neverRan(handle) {
|
|
41
|
+
return (S.readiness?.[handle] ?? []).includes("run once");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Forget every answer, so the next screen asks again: after a refresh, or a step finishing. */
|
|
45
|
+
export function forgetReadiness() {
|
|
46
|
+
S.readiness = null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The roster command for each step: the only way to do them from a hosted portal. */
|
|
50
|
+
export const ROSTER = "npx @nanocollective/roster@latest";
|
|
51
|
+
export const ORG_STEPS = {
|
|
52
|
+
hire: ["Hire someone", "hire cto --apply"],
|
|
53
|
+
business: ["Say what the business is, in org/business.md", "brief discover"],
|
|
54
|
+
priorities: ["Say what matters this month, in org/priorities.md", "brief priorities"],
|
|
55
|
+
};
|
|
56
|
+
const STEP_COMMANDS = {
|
|
57
|
+
"write the charter": (h) => `brief charter ${h}`,
|
|
58
|
+
"create the GitHub App": (h) => `app ${h} --apply`,
|
|
59
|
+
"install the GitHub App": (h) => `app ${h} --apply`,
|
|
60
|
+
"add the agent credential": () => "credential --apply",
|
|
61
|
+
"run once": (h) => `run ${h} --apply`,
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The steps that are writing, not wiring: a hosted portal can do these itself (the org's two
|
|
65
|
+
* files on Org, the charter on Staff), so it offers that rather than a command.
|
|
66
|
+
*/
|
|
67
|
+
export const IN_PORTAL = new Set(["business", "priorities", "write the charter"]);
|
|
68
|
+
|
|
69
|
+
export function stepCommand(what, handle) {
|
|
70
|
+
return STEP_COMMANDS[what]?.(handle) ?? "";
|
|
71
|
+
}
|
|
72
|
+
|
|
31
73
|
/** "install the GitHub App, add the agent credential and run once" */
|
|
32
74
|
export function sentence(left) {
|
|
33
75
|
if (left.length < 2) return left.join("");
|
|
@@ -11,6 +11,7 @@ import { getInbox, getOrg, getSync } from "./api.js";
|
|
|
11
11
|
import { $, ago, el, esc } from "./dom.js";
|
|
12
12
|
import { render } from "./router.js";
|
|
13
13
|
import { isFor, sortHome } from "./homesort.js";
|
|
14
|
+
import { checkAll, forgetReadiness } from "./readiness.js";
|
|
14
15
|
import { humansOf, openCount, S, unreadCount } from "./state.js";
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -98,6 +99,9 @@ export async function refreshAll(soft) {
|
|
|
98
99
|
S.inbox = null; // the inbox re-fetches itself on next paint
|
|
99
100
|
inflight = null;
|
|
100
101
|
S.loadedAt = new Date();
|
|
102
|
+
// A step may have been finished since: a first run, a credential added on another machine.
|
|
103
|
+
forgetReadiness();
|
|
104
|
+
checkAll(() => !soft && render());
|
|
101
105
|
if (!soft) render();
|
|
102
106
|
stampLoaded();
|
|
103
107
|
// The badges are now claiming a count from before the sync. Re-ask, and say so meanwhile.
|
|
@@ -244,6 +244,11 @@ function customForm(d, close) {
|
|
|
244
244
|
|
|
245
245
|
function staffPicker(d, picked) {
|
|
246
246
|
const who = el("div", { className: "connstaff" });
|
|
247
|
+
// An empty picker and then "Pick at least one staff member." had no way out.
|
|
248
|
+
if (!d.staff.length) {
|
|
249
|
+
who.append(el("p", { className: "sub", textContent: "Nobody is hired yet, so there is nobody to give it to. Hire someone first." }));
|
|
250
|
+
return who;
|
|
251
|
+
}
|
|
247
252
|
for (const s of d.staff) {
|
|
248
253
|
const box = el("input", { type: "checkbox", checked: picked.has(s.handle) });
|
|
249
254
|
box.onchange = () => (box.checked ? picked.add(s.handle) : picked.delete(s.handle));
|
|
@@ -8,6 +8,7 @@ import { render } from "../router.js";
|
|
|
8
8
|
import { S, staff } from "../state.js";
|
|
9
9
|
import { checklist } from "./checklist.js";
|
|
10
10
|
import { amendSheet } from "./prompt.js";
|
|
11
|
+
import { notReadyNote, whenKnown } from "./notready.js";
|
|
11
12
|
import { runOnce } from "./runonce.js";
|
|
12
13
|
|
|
13
14
|
const DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
@@ -86,12 +87,17 @@ export function viewHealth(m) {
|
|
|
86
87
|
/* A workflow that has never run is unproven, and the way to prove it is to run it. Here
|
|
87
88
|
because Health is where "unproven" is read; a success re-runs the checks below. */
|
|
88
89
|
let doctor = null;
|
|
90
|
+
/* Only once a run could work. With the App or the credential missing, it started a run that
|
|
91
|
+
could only fail; until then the note says what is left instead. */
|
|
89
92
|
m.append(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
whenKnown(s, () =>
|
|
94
|
+
notReadyNote(s) ??
|
|
95
|
+
runOnce({
|
|
96
|
+
staff: s.handle,
|
|
97
|
+
name: s.name,
|
|
98
|
+
onDone: (ok) => ok && doctor && checklist(doctor.body, { shell: doctor }),
|
|
99
|
+
}),
|
|
100
|
+
),
|
|
95
101
|
);
|
|
96
102
|
|
|
97
103
|
doctor = section(m, "The org, from roster doctor", "doctor");
|
|
@@ -296,7 +296,7 @@ export function hireFlow(o) {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
/** Three ways to write CHARTER.md. The template is offered only when a worked example fits. */
|
|
299
|
-
function charterModes(s, about, onSaved) {
|
|
299
|
+
export function charterModes(s, about, onSaved) {
|
|
300
300
|
const box = el("div", {}, [el("p", { className: "sub", textContent: "Loading…" })]);
|
|
301
301
|
const path = s.dir + "/CHARTER.md";
|
|
302
302
|
getCharterExample(s.handle)
|
|
@@ -10,6 +10,8 @@ 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";
|
|
13
|
+
import { checkAll, notReady, ORG_STEPS, stepCommand } from "../readiness.js";
|
|
14
|
+
import { commandLine } from "./notready.js";
|
|
13
15
|
import { parseReport } from "../report.js";
|
|
14
16
|
import { icon, iconHTML, staffIcon } from "../icons.js";
|
|
15
17
|
import { ensureInbox, stampCounts } from "../refresh.js";
|
|
@@ -56,6 +58,8 @@ export function viewHome(m) {
|
|
|
56
58
|
|
|
57
59
|
const page = el("div", { className: "home" });
|
|
58
60
|
page.append(team(staff));
|
|
61
|
+
const unset = setupLeft(staff);
|
|
62
|
+
if (unset) page.append(unset);
|
|
59
63
|
|
|
60
64
|
/* With more than one person, each sees what is on them, plus anything on nobody in
|
|
61
65
|
particular. Everyone's is one click away, so nothing is hidden for good. */
|
|
@@ -114,7 +118,12 @@ const STATUS_TONE = { "on track": "ok", "needs you": "warm", stuck: "hot", block
|
|
|
114
118
|
* open under it. Their status issue is rewritten by every run, so this is always the latest.
|
|
115
119
|
*/
|
|
116
120
|
function reportRow(s, reports) {
|
|
117
|
-
|
|
121
|
+
/* Before a first run the status issue holds the scaffold hire wrote, which read as a report
|
|
122
|
+
from 36 minutes ago. And asking for one wakes somebody who cannot run yet. */
|
|
123
|
+
const left = S.readiness?.[s.handle] ?? [];
|
|
124
|
+
const neverRan = left.includes("run once");
|
|
125
|
+
const unready = left.some((x) => x !== "run once");
|
|
126
|
+
const r = neverRan ? null : reports.find((x) => x.staff.handle === s.handle);
|
|
118
127
|
const item = r?.item ?? { repo: s.brain, number: s.statusIssue, kind: "issue" };
|
|
119
128
|
const note = el("span", { className: "meta" });
|
|
120
129
|
const ask = el("button", { className: "ghbtn sm", textContent: "Ask for an update" });
|
|
@@ -160,7 +169,10 @@ function reportRow(s, reports) {
|
|
|
160
169
|
}
|
|
161
170
|
head.append(
|
|
162
171
|
el("span", { className: "meta homereportwhen" }, [
|
|
163
|
-
document.createTextNode(
|
|
172
|
+
document.createTextNode(
|
|
173
|
+
(r ? "Updated " + ago(r.at) : neverRan ? "No report yet: the first comes with their first run" : "No report yet") +
|
|
174
|
+
" · ",
|
|
175
|
+
),
|
|
164
176
|
issue,
|
|
165
177
|
]),
|
|
166
178
|
);
|
|
@@ -174,7 +186,7 @@ function reportRow(s, reports) {
|
|
|
174
186
|
};
|
|
175
187
|
acts.append(more);
|
|
176
188
|
}
|
|
177
|
-
acts.append(ask);
|
|
189
|
+
if (!unready) acts.append(ask);
|
|
178
190
|
head.append(acts);
|
|
179
191
|
row.append(head);
|
|
180
192
|
|
|
@@ -523,6 +535,15 @@ function team(staff) {
|
|
|
523
535
|
} else if (last) {
|
|
524
536
|
line = `Last finished ${ago(last.updatedAt)}`;
|
|
525
537
|
}
|
|
538
|
+
/* Somebody who cannot run yet looked exactly like somebody free. A run in progress, the
|
|
539
|
+
first one included, still says what it is doing. */
|
|
540
|
+
const left = S.readiness?.[s.handle] ?? [];
|
|
541
|
+
const unready = left.length > 0 && !busy && !queued;
|
|
542
|
+
if (unready) {
|
|
543
|
+
// The card is narrow; the steps themselves are in the panel under it.
|
|
544
|
+
word = "Not set up yet";
|
|
545
|
+
line = left.length === 1 ? "One step left: " + left[0] : `${left.length} steps left, below`;
|
|
546
|
+
}
|
|
526
547
|
// A run takes about a minute to start, and until then the card would say nothing happened.
|
|
527
548
|
if (!busy && !queued && Date.now() - (askedAt[s.handle] ?? 0) < 120_000) {
|
|
528
549
|
line = "Sent. Starts in about a minute";
|
|
@@ -551,7 +572,8 @@ function team(staff) {
|
|
|
551
572
|
el("a", { className: "orblog", href: log, target: "_blank", rel: "noopener", textContent: "View log" }),
|
|
552
573
|
);
|
|
553
574
|
}
|
|
554
|
-
|
|
575
|
+
// Asking wakes them, which proves nothing until the rest is done. A first run is fine.
|
|
576
|
+
if (s.brain && !(unready && left.some((x) => x !== "run once"))) {
|
|
555
577
|
const ask = el("button", { className: "ghbtn orbask", textContent: "Ask a question" });
|
|
556
578
|
ask.onclick = () => askStaff(s);
|
|
557
579
|
card.append(el("span", { className: "orbgap" }), ask);
|
|
@@ -573,6 +595,97 @@ function team(staff) {
|
|
|
573
595
|
return box;
|
|
574
596
|
}
|
|
575
597
|
|
|
598
|
+
/* ------------------------------- setup left ----------------------------- */
|
|
599
|
+
|
|
600
|
+
/** The org files a step is about, which can be written on the Org screen. */
|
|
601
|
+
const ORG_FILES = { business: "org/business.md", priorities: "org/priorities.md" };
|
|
602
|
+
|
|
603
|
+
let readinessAsked = false;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* What is left of setting up, at the top of Home. Home said a staff member who could not run
|
|
607
|
+
* was "Free" with a button to ask them something, and nothing on it said setup was unfinished.
|
|
608
|
+
* Hosted, the steps are commands, since that is the only place they can be done.
|
|
609
|
+
*/
|
|
610
|
+
function setupLeft(staff) {
|
|
611
|
+
if (staff.some((s) => !S.readiness?.[s.handle]) && !readinessAsked) {
|
|
612
|
+
readinessAsked = true;
|
|
613
|
+
checkAll(() => {
|
|
614
|
+
readinessAsked = false;
|
|
615
|
+
if (S.view === "home") render();
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
// Each step: what, its command, and where to do it here when it is writing rather than wiring.
|
|
619
|
+
const steps = [];
|
|
620
|
+
for (const id of S.data?.unfinished ?? []) {
|
|
621
|
+
if (!ORG_STEPS[id]) continue;
|
|
622
|
+
const file = ORG_FILES[id];
|
|
623
|
+
const here = file
|
|
624
|
+
? () => {
|
|
625
|
+
S.orgOpen = file;
|
|
626
|
+
go({ view: "org" });
|
|
627
|
+
}
|
|
628
|
+
: null;
|
|
629
|
+
steps.push([...ORG_STEPS[id], here]);
|
|
630
|
+
}
|
|
631
|
+
for (const s of notReady()) {
|
|
632
|
+
for (const what of S.readiness[s.handle]) {
|
|
633
|
+
const here =
|
|
634
|
+
what === "write the charter"
|
|
635
|
+
? () => {
|
|
636
|
+
S.writeCharter = s.handle;
|
|
637
|
+
go({ view: "staff" });
|
|
638
|
+
}
|
|
639
|
+
: null;
|
|
640
|
+
steps.push([`${s.name}: ${what}`, stepCommand(what, s.handle), here]);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (!steps.length) return null;
|
|
644
|
+
const wiring = steps.filter(([, , here]) => !here).length;
|
|
645
|
+
|
|
646
|
+
const box = el("div", { className: "card homesetup" });
|
|
647
|
+
box.append(el("b", { textContent: "Setup is not finished" }));
|
|
648
|
+
/* Hosted, writing is done here and wiring needs your machine. The portal there has every
|
|
649
|
+
wiring step as a button, which beats a list of commands, so it is offered first; the
|
|
650
|
+
commands stay for anyone who would rather not open it. */
|
|
651
|
+
if (S.hosted && wiring) {
|
|
652
|
+
box.append(
|
|
653
|
+
el("p", {
|
|
654
|
+
className: "sub",
|
|
655
|
+
textContent:
|
|
656
|
+
"Nobody runs until these are done. Writing can be done here. The rest needs your own machine, and the quickest way is the portal there, where each step is a button:",
|
|
657
|
+
}),
|
|
658
|
+
commandLine(`portal --org ${S.data.org}`),
|
|
659
|
+
el("p", { className: "sub homesetupor", textContent: "Or one at a time, in order:" }),
|
|
660
|
+
);
|
|
661
|
+
} else {
|
|
662
|
+
box.append(el("p", { className: "sub", textContent: "Nobody runs until these are done." }));
|
|
663
|
+
}
|
|
664
|
+
const seen = new Set();
|
|
665
|
+
const list = el("ol", { className: "homesetupsteps" });
|
|
666
|
+
for (const [what, cmd, here] of steps) {
|
|
667
|
+
// The credential is the org's, so two staff members missing it is one step.
|
|
668
|
+
if (cmd && seen.has(cmd)) continue;
|
|
669
|
+
seen.add(cmd);
|
|
670
|
+
const label = el("span", { textContent: cap(what) });
|
|
671
|
+
const row = el("li", {}, [label]);
|
|
672
|
+
if (S.hosted && here) {
|
|
673
|
+
// Writing works from here, and with an AI interviewing you it beats a brief in a terminal.
|
|
674
|
+
const write = el("button", { className: "ghbtn sm", textContent: "Write it here" });
|
|
675
|
+
write.onclick = here;
|
|
676
|
+
label.append(" ", write);
|
|
677
|
+
} else if (S.hosted && cmd) row.append(commandLine(cmd));
|
|
678
|
+
list.append(row);
|
|
679
|
+
}
|
|
680
|
+
box.append(list);
|
|
681
|
+
if (!S.hosted) {
|
|
682
|
+
const cont = el("button", { className: "btn primary", textContent: "Continue setting up" });
|
|
683
|
+
cont.onclick = () => go({ view: "setup" });
|
|
684
|
+
box.append(el("div", { className: "row" }, [cont]));
|
|
685
|
+
}
|
|
686
|
+
return box;
|
|
687
|
+
}
|
|
688
|
+
|
|
576
689
|
const cap = (t) => t.charAt(0).toUpperCase() + t.slice(1);
|
|
577
690
|
|
|
578
691
|
function minutes(since) {
|
|
@@ -6,6 +6,7 @@ import { ago, el, esc, markCurrent, skeleton } from "../dom.js";
|
|
|
6
6
|
import { icon, iconHTML, staffIcon } from "../icons.js";
|
|
7
7
|
import { mdlite } from "../md.js";
|
|
8
8
|
import { attachMentions } from "../mention.js";
|
|
9
|
+
import { canRun } from "../readiness.js";
|
|
9
10
|
import { ensureInbox, refreshAll, stampCounts } from "../refresh.js";
|
|
10
11
|
import { humanLabel, humansOf, isHuman, S, writeHash } from "../state.js";
|
|
11
12
|
import { renderDiff } from "./changed.js";
|
|
@@ -342,7 +343,13 @@ function inboxScreen(m, opts) {
|
|
|
342
343
|
String(b.updatedAt).localeCompare(String(a.updatedAt)),
|
|
343
344
|
);
|
|
344
345
|
if (!items.length) {
|
|
345
|
-
|
|
346
|
+
// With nobody hired there is nothing to match yet, and that is setup, not a filter.
|
|
347
|
+
list.append(
|
|
348
|
+
el("p", {
|
|
349
|
+
className: "empty",
|
|
350
|
+
textContent: S.data.staff.length ? "Nothing matches." : "Nothing here yet: nobody is hired. Home says what setup has left.",
|
|
351
|
+
}),
|
|
352
|
+
);
|
|
346
353
|
return;
|
|
347
354
|
}
|
|
348
355
|
|
|
@@ -1391,6 +1398,12 @@ function newIssueForm(viewer) {
|
|
|
1391
1398
|
return;
|
|
1392
1399
|
}
|
|
1393
1400
|
create.disabled = false;
|
|
1401
|
+
// The issue is worth filing either way; it waits. What it must not do is promise a reply.
|
|
1402
|
+
if (!canRun(s.handle)) {
|
|
1403
|
+
forWhom.textContent =
|
|
1404
|
+
"Goes to " + s.brain + ". " + s.name + " is not set up yet, so nothing will wake them: it waits for their first run.";
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1394
1407
|
forWhom.textContent =
|
|
1395
1408
|
"Goes to " + s.brain + ". " +
|
|
1396
1409
|
(String(body.value ?? "").includes(mentionOf(s))
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* What a screen says about a staff member who cannot run yet.
|
|
2
|
+
*
|
|
3
|
+
* Every screen with a button that wakes somebody (Run now, Run once now, a new issue, a
|
|
4
|
+
* mention) used to offer it to a staff member with no App or no credential, and the run it
|
|
5
|
+
* started failed where nobody was looking. One note, the same everywhere: what is left, and on
|
|
6
|
+
* a hosted portal the command for each step, since setting up is only done on your machine. */
|
|
7
|
+
|
|
8
|
+
import { el, toClipboard } from "../dom.js";
|
|
9
|
+
import { canRun, IN_PORTAL, ROSTER, sentence, stepCommand, whatsLeft } from "../readiness.js";
|
|
10
|
+
import { go } from "../router.js";
|
|
11
|
+
import { S } from "../state.js";
|
|
12
|
+
|
|
13
|
+
/** One roster command, with a Copy button. */
|
|
14
|
+
export function commandLine(cmd) {
|
|
15
|
+
const text = `${ROSTER} ${cmd}`;
|
|
16
|
+
const copy = el("button", { className: "ghbtn", textContent: "Copy" });
|
|
17
|
+
copy.onclick = () => toClipboard(text, copy, "Copy");
|
|
18
|
+
return el("div", { className: "connline" }, [el("code", { textContent: text }), copy]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The note, or null when they can run (or it is not known yet). */
|
|
22
|
+
export function notReadyNote(s) {
|
|
23
|
+
if (canRun(s.handle)) return null;
|
|
24
|
+
const left = S.readiness[s.handle];
|
|
25
|
+
const box = el("div", { className: "warnline notready" }, [
|
|
26
|
+
el("span", {
|
|
27
|
+
textContent: `${s.name} is not set up yet, so nothing will start them. Still to do: ${sentence(left)}.`,
|
|
28
|
+
}),
|
|
29
|
+
]);
|
|
30
|
+
if (!S.hosted) {
|
|
31
|
+
// On your machine the steps are a click away, on Staff.
|
|
32
|
+
const finish = el("button", { className: "ghbtn primary", textContent: "Finish setting up" });
|
|
33
|
+
finish.onclick = () => {
|
|
34
|
+
S.staffOpen = { handle: s.handle, name: s.name, dir: s.dir };
|
|
35
|
+
go({ view: "staff" });
|
|
36
|
+
};
|
|
37
|
+
box.append(el("div", { className: "row" }, [finish]));
|
|
38
|
+
} else {
|
|
39
|
+
// The charter is writing, which works from here; the rest needs your machine.
|
|
40
|
+
if (left.includes("write the charter")) {
|
|
41
|
+
const write = el("button", { className: "ghbtn primary", textContent: "Write the charter" });
|
|
42
|
+
write.onclick = () => {
|
|
43
|
+
S.writeCharter = s.handle;
|
|
44
|
+
go({ view: "staff" });
|
|
45
|
+
};
|
|
46
|
+
box.append(el("div", { className: "row" }, [write]));
|
|
47
|
+
}
|
|
48
|
+
const seen = new Set();
|
|
49
|
+
for (const what of left) {
|
|
50
|
+
if (IN_PORTAL.has(what)) continue;
|
|
51
|
+
const cmd = stepCommand(what, s.handle);
|
|
52
|
+
if (!cmd || seen.has(cmd)) continue;
|
|
53
|
+
seen.add(cmd);
|
|
54
|
+
box.append(commandLine(cmd));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return box;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A slot filled once their readiness is known: at once when it is, or when GitHub answers.
|
|
62
|
+
* Landing straight on a screen used to find nothing known yet and nothing that asked.
|
|
63
|
+
*/
|
|
64
|
+
export function whenKnown(s, fill) {
|
|
65
|
+
const slot = el("div", { className: "readyslot" });
|
|
66
|
+
const paint = () => slot.replaceChildren(...[fill()].flat().filter(Boolean));
|
|
67
|
+
if (S.readiness?.[s.handle]) paint();
|
|
68
|
+
else whatsLeft(s).then(paint, paint);
|
|
69
|
+
return slot;
|
|
70
|
+
}
|
|
@@ -102,13 +102,23 @@ export function viewOrg(m) {
|
|
|
102
102
|
.then(({ files }) => {
|
|
103
103
|
S.orgFiles = files ?? [];
|
|
104
104
|
paintTree();
|
|
105
|
-
|
|
105
|
+
// A file still the questions it shipped with is the thing to do here, so it opens first.
|
|
106
|
+
const first = unwritten().find((p) => S.orgFiles.some((f) => f.path === p)) ?? S.orgFiles[0]?.path;
|
|
106
107
|
open(S.orgFiles.some((f) => f.path === S.orgOpen) ? S.orgOpen : first);
|
|
107
108
|
})
|
|
108
109
|
.catch((e) => {
|
|
109
110
|
tree.replaceChildren(el("p", { className: "empty err", textContent: e.message }));
|
|
110
111
|
});
|
|
111
112
|
|
|
113
|
+
/** The org files setup is still waiting on, by path. */
|
|
114
|
+
function unwritten() {
|
|
115
|
+
const ids = S.data.unfinished ?? [];
|
|
116
|
+
return [
|
|
117
|
+
ids.includes("business") && "org/business.md",
|
|
118
|
+
ids.includes("priorities") && "org/priorities.md",
|
|
119
|
+
].filter(Boolean);
|
|
120
|
+
}
|
|
121
|
+
|
|
112
122
|
function why(file) {
|
|
113
123
|
return KNOWN[file.path] ?? file.title ?? "";
|
|
114
124
|
}
|
|
@@ -132,6 +142,9 @@ export function viewOrg(m) {
|
|
|
132
142
|
el("span", { className: "lname", textContent: f.path.replace(/^(org|prompts)\//, "") }),
|
|
133
143
|
el("span", { className: "lrepo", textContent: why(f) }),
|
|
134
144
|
);
|
|
145
|
+
if (unwritten().includes(f.path)) {
|
|
146
|
+
t.append(el("span", { className: "chip warm", textContent: "Not written yet" }));
|
|
147
|
+
}
|
|
135
148
|
b.append(t);
|
|
136
149
|
b.onclick = () => open(f.path);
|
|
137
150
|
group.append(b);
|
|
@@ -9,7 +9,10 @@ import { post } from "../api.js";
|
|
|
9
9
|
import { sheet } from "../dialog.js";
|
|
10
10
|
import { el, grow } from "../dom.js";
|
|
11
11
|
import { icon } from "../icons.js";
|
|
12
|
+
import { canRun, whatsLeft } from "../readiness.js";
|
|
12
13
|
import { render } from "../router.js";
|
|
14
|
+
import { S } from "../state.js";
|
|
15
|
+
import { commandLine, notReadyNote, whenKnown } from "./notready.js";
|
|
13
16
|
|
|
14
17
|
/* The last answer, so a repaint after Save does not flash an empty screen. */
|
|
15
18
|
let last = null;
|
|
@@ -36,7 +39,8 @@ function draw(body, d, add) {
|
|
|
36
39
|
add.onclick = () => edit(d, null, null);
|
|
37
40
|
add.disabled = !d.staff.length;
|
|
38
41
|
if (!d.staff.length) {
|
|
39
|
-
body.append(el("p", { className: "sub", textContent: "Hire a staff member first." }));
|
|
42
|
+
body.append(el("p", { className: "sub", textContent: S.hosted ? "Hire a staff member first, on your machine:" : "Hire a staff member first, under Staff." }));
|
|
43
|
+
if (S.hosted) body.append(commandLine("hire cto --apply"));
|
|
40
44
|
return;
|
|
41
45
|
}
|
|
42
46
|
for (const s of d.staff) {
|
|
@@ -46,7 +50,9 @@ function draw(body, d, add) {
|
|
|
46
50
|
const more = el("button", { className: "routadd" }, [icon("plus"), el("span", { textContent: "Add a routine for " + s.name })]);
|
|
47
51
|
more.onclick = () => edit(d, s, null);
|
|
48
52
|
list.append(more);
|
|
49
|
-
|
|
53
|
+
// Routines run on the same App and credential as everything else, so they wait on setup too.
|
|
54
|
+
const who = whole(s);
|
|
55
|
+
body.append(el("h2", { className: "connhead", textContent: s.name }), whenKnown(who, () => notReadyNote(who)), list);
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
|
|
@@ -66,6 +72,12 @@ function dailyRow(s, d) {
|
|
|
66
72
|
function routineRow(s, r, d) {
|
|
67
73
|
const run = el("button", { className: "ghbtn", textContent: "Run now" });
|
|
68
74
|
run.onclick = () => runNow(s, r, run);
|
|
75
|
+
const who = whole(s);
|
|
76
|
+
whatsLeft(who).then(() => {
|
|
77
|
+
if (canRun(s.handle)) return;
|
|
78
|
+
run.disabled = true;
|
|
79
|
+
run.title = `${s.name} is not set up yet`;
|
|
80
|
+
}, () => {});
|
|
69
81
|
const change = el("button", { className: "ghbtn", textContent: "Edit" });
|
|
70
82
|
change.onclick = () => edit(d, s, r);
|
|
71
83
|
const remove = el("button", { className: "ghbtn", textContent: "Remove" });
|
|
@@ -81,6 +93,11 @@ function routineRow(s, r, d) {
|
|
|
81
93
|
]);
|
|
82
94
|
}
|
|
83
95
|
|
|
96
|
+
/** The staff member as the org export has them, which is what readiness reads. */
|
|
97
|
+
function whole(s) {
|
|
98
|
+
return (S.data?.staff ?? []).find((x) => x.handle === s.handle) ?? s;
|
|
99
|
+
}
|
|
100
|
+
|
|
84
101
|
async function runNow(s, r, btn) {
|
|
85
102
|
btn.disabled = true;
|
|
86
103
|
btn.textContent = "Starting…";
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
import { runStatus, startRun } from "../api.js";
|
|
8
8
|
import { askYes } from "../dialog.js";
|
|
9
9
|
import { el } from "../dom.js";
|
|
10
|
+
import { whatsLeft } from "../readiness.js";
|
|
11
|
+
import { S } from "../state.js";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* @param {{staff: string, name: string, onDone?: (ok: boolean) => void}} opts
|
|
@@ -86,6 +88,9 @@ export function runOnce(opts) {
|
|
|
86
88
|
for (const f of now.failedAt ?? []) done.append(el("p", { className: "sub", textContent: "Failed at " + f }));
|
|
87
89
|
if (!ok) done.append(el("p", { className: "sub", textContent: "Troubleshooting, in the docs, has what each failure usually means." }));
|
|
88
90
|
out.replaceChildren(done);
|
|
91
|
+
// "Run once" is done now, and every screen that said otherwise should stop saying it.
|
|
92
|
+
const who = (S.data?.staff ?? []).find((x) => x.handle === opts.staff);
|
|
93
|
+
if (ok && who) whatsLeft(who, true).catch(() => {});
|
|
89
94
|
opts.onDone?.(ok);
|
|
90
95
|
};
|
|
91
96
|
tick();
|
|
@@ -7,6 +7,7 @@ import { getRuns } from "../api.js";
|
|
|
7
7
|
import { ago, el, esc, skeleton } from "../dom.js";
|
|
8
8
|
import { render } from "../router.js";
|
|
9
9
|
import { S } from "../state.js";
|
|
10
|
+
import { notReadyNote, whenKnown } from "./notready.js";
|
|
10
11
|
|
|
11
12
|
/** How many runs a staff member's table shows. The spend covers all of the last 30 days. */
|
|
12
13
|
const SHOWN = 15;
|
|
@@ -89,6 +90,9 @@ function paint(m, data) {
|
|
|
89
90
|
}, 3000);
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
if (!(data.staff ?? []).length) {
|
|
94
|
+
m.append(el("p", { className: "hnote", textContent: "Nobody hired yet, so nothing has run. Home says what is left." }));
|
|
95
|
+
}
|
|
92
96
|
for (const s of data.staff ?? []) m.append(...staffSection(s));
|
|
93
97
|
|
|
94
98
|
m.append(
|
|
@@ -111,7 +115,13 @@ function staffSection(s) {
|
|
|
111
115
|
const body = el("div", { className: "hbody runs" });
|
|
112
116
|
for (const e of s.errors ?? []) body.append(el("p", { className: "hnote err", textContent: e }));
|
|
113
117
|
if (!(s.runs ?? []).length) {
|
|
114
|
-
|
|
118
|
+
// "No runs" read as idle, when the truth was that they could not run at all.
|
|
119
|
+
const who = (S.data?.staff ?? []).find((x) => x.handle === s.handle) ?? s;
|
|
120
|
+
body.append(
|
|
121
|
+
whenKnown(who, () =>
|
|
122
|
+
notReadyNote(who) ?? el("p", { className: "hnote", textContent: "No runs in the last 30 days." }),
|
|
123
|
+
),
|
|
124
|
+
);
|
|
115
125
|
return [head, body];
|
|
116
126
|
}
|
|
117
127
|
|