@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
|
@@ -8,28 +8,34 @@
|
|
|
8
8
|
import {
|
|
9
9
|
checkOrg,
|
|
10
10
|
createTenant,
|
|
11
|
-
fileUrl,
|
|
12
11
|
getAccess,
|
|
13
12
|
getOrg,
|
|
14
13
|
getSetup,
|
|
15
14
|
joinOrg,
|
|
16
15
|
planTenant,
|
|
17
|
-
saveFile,
|
|
18
16
|
setAccess,
|
|
19
17
|
} from "../api.js";
|
|
20
|
-
import { $, el, esc,
|
|
18
|
+
import { $, el, esc, toClipboard } from "../dom.js";
|
|
21
19
|
import { go } from "../router.js";
|
|
22
20
|
import { S as App } from "../state.js";
|
|
21
|
+
import { checkAll, notReady, progress, sentence } from "../readiness.js";
|
|
23
22
|
import { checklist } from "./checklist.js";
|
|
23
|
+
import { businessForm, prioritiesForm } from "./orgedit.js";
|
|
24
24
|
import { credentialPanel } from "./credential.js";
|
|
25
25
|
import { repoPicker } from "./repos.js";
|
|
26
|
-
import {
|
|
26
|
+
import { todo } from "./todo.js";
|
|
27
27
|
|
|
28
28
|
let S = null; // /api/setup/status, refreshed after anything that changes the world
|
|
29
29
|
|
|
30
30
|
/* Where the doctor checklist is drawn on this screen, so a save can re-run it. Left stale, it
|
|
31
31
|
went on saying business.stub after business.md had been saved, until "Check again". */
|
|
32
32
|
let healthHost = null;
|
|
33
|
+
let healthStep = null;
|
|
34
|
+
|
|
35
|
+
/* What the "What is left" cards already ask for. Doctor reporting them as well, right after a
|
|
36
|
+
successful create, read as the create having failed. */
|
|
37
|
+
const COVERED = ["business", "business.stub", "priorities", "priorities.stub", "actions-access", "secrets", "agent"];
|
|
38
|
+
const HEALTH = { skip: COVERED, hideWhenClean: true };
|
|
33
39
|
|
|
34
40
|
/* Each "what is left" step that is a file, by id, so a save can mark it done in place rather
|
|
35
41
|
than repainting the page and throwing away the diff somebody is still reading. */
|
|
@@ -55,46 +61,52 @@ export async function viewGettingStarted(main) {
|
|
|
55
61
|
S = await getSetup();
|
|
56
62
|
// Somebody may have clicked elsewhere while GitHub was answering.
|
|
57
63
|
if (App.view !== "setup") return;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
);
|
|
74
|
-
|
|
64
|
+
await checkAll();
|
|
65
|
+
if (App.view !== "setup") return;
|
|
66
|
+
const p = progress();
|
|
67
|
+
sub.textContent = (p ? `${p.done} of ${p.total} done. ` : "") + "Work through these in order.";
|
|
68
|
+
const list = afterCreate();
|
|
69
|
+
|
|
70
|
+
// Somebody hired but not ready to run is the most important thing left, so it comes first.
|
|
71
|
+
for (const s of notReady().reverse()) {
|
|
72
|
+
const t = todo("!", "Finish setting up " + s.name, false);
|
|
73
|
+
t.hint("Still to do: " + sentence(App.readiness?.[s.handle] ?? []) + ".");
|
|
74
|
+
const cont = el("button", { className: "btn primary", textContent: "Continue" });
|
|
75
|
+
cont.onclick = () => {
|
|
76
|
+
App.staffOpen = { handle: s.handle, name: s.name, dir: s.dir };
|
|
77
|
+
go({ view: "staff" });
|
|
78
|
+
};
|
|
79
|
+
t.body.append(el("div", { className: "row" }, [cont]));
|
|
80
|
+
list.prepend(t.card);
|
|
75
81
|
}
|
|
82
|
+
main.append(list);
|
|
76
83
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const health = step(App.data?.staff?.length ? 2 : 3, "What doctor still says", false);
|
|
84
|
+
const health = step("!", "Other problems", false);
|
|
80
85
|
healthHost = el("div", { style: "margin-top:12px" });
|
|
81
86
|
health.append(healthHost);
|
|
82
87
|
main.append(health);
|
|
83
|
-
|
|
88
|
+
healthStep = health;
|
|
89
|
+
checklist(healthHost, { ...HEALTH, onEmpty: () => health.remove() });
|
|
84
90
|
}
|
|
85
91
|
|
|
86
92
|
/** Whether the sidebar offers Getting started: while anything is left, or while it is open. */
|
|
87
93
|
export function paintSetupNav() {
|
|
88
94
|
const nav = $("#setupnav");
|
|
89
95
|
if (!nav) return;
|
|
90
|
-
|
|
96
|
+
// Hosted, there is no setting up from here: that is done in roster portal on your machine.
|
|
97
|
+
nav.hidden =
|
|
98
|
+
Boolean(App.hosted) ||
|
|
99
|
+
(!App.data?.unfinished?.length && !notReady().length && App.view !== "setup");
|
|
100
|
+
const count = $("#setupcount");
|
|
101
|
+
const p = progress();
|
|
102
|
+
if (count) count.textContent = p ? `${p.done}/${p.total}` : "";
|
|
91
103
|
}
|
|
92
104
|
|
|
93
105
|
/* After a save: the checklist and the step list are both derived from disk, so both are asked
|
|
94
106
|
again rather than updated by hand. The sidebar's list comes from /api/org, which is the one
|
|
95
107
|
the portal already reads. */
|
|
96
108
|
async function recheck() {
|
|
97
|
-
if (healthHost) checklist(healthHost, {});
|
|
109
|
+
if (healthHost) checklist(healthHost, { ...HEALTH, onEmpty: () => healthStep?.remove() });
|
|
98
110
|
try {
|
|
99
111
|
S = await getSetup();
|
|
100
112
|
for (const [id, mark] of fileSteps) mark(!(S.tenant.left ?? []).includes(id));
|
|
@@ -120,9 +132,7 @@ function render(main) {
|
|
|
120
132
|
el("p", {
|
|
121
133
|
className: "sub",
|
|
122
134
|
textContent:
|
|
123
|
-
"
|
|
124
|
-
"roster tries for you, the agent's credential, the repos your staff work in, and the two " +
|
|
125
|
-
"files only you can write. Nothing is created until you have read the plan.",
|
|
135
|
+
"Choose an organisation and a coding agent. Nothing is created until you press Create it.",
|
|
126
136
|
}),
|
|
127
137
|
);
|
|
128
138
|
|
|
@@ -132,7 +142,11 @@ function render(main) {
|
|
|
132
142
|
|
|
133
143
|
/* Drawn whenever a tenant exists, not only in the seconds after creating one. Setup takes
|
|
134
144
|
days: the repo picker and the two manual steps have to still be here tomorrow. */
|
|
135
|
-
if (S.tenant.found)
|
|
145
|
+
if (S.tenant.found) {
|
|
146
|
+
const rest = step(3, "Finish setting up", false);
|
|
147
|
+
rest.append(afterCreate());
|
|
148
|
+
main.append(rest);
|
|
149
|
+
}
|
|
136
150
|
}
|
|
137
151
|
|
|
138
152
|
/* ---------------------------------- 1 · gh ---------------------------------- */
|
|
@@ -148,8 +162,7 @@ function stepGh() {
|
|
|
148
162
|
el("p", {
|
|
149
163
|
className: "sub",
|
|
150
164
|
textContent:
|
|
151
|
-
"
|
|
152
|
-
"in a terminal, then reload:",
|
|
165
|
+
"Run this in a terminal, then reload:",
|
|
153
166
|
}),
|
|
154
167
|
el("pre", { className: "cmd", textContent: "gh auth login" }),
|
|
155
168
|
);
|
|
@@ -170,13 +183,9 @@ function stepOrg(main) {
|
|
|
170
183
|
el("p", {
|
|
171
184
|
className: "sub",
|
|
172
185
|
textContent:
|
|
173
|
-
"
|
|
174
|
-
"Getting started in the sidebar until it is.",
|
|
186
|
+
"Finish the steps below. They stay under Getting started in the sidebar until they're done.",
|
|
175
187
|
}),
|
|
176
188
|
);
|
|
177
|
-
healthHost = el("div", { style: "margin-top:12px" });
|
|
178
|
-
card.append(healthHost);
|
|
179
|
-
checklist(healthHost, {});
|
|
180
189
|
return card;
|
|
181
190
|
}
|
|
182
191
|
|
|
@@ -206,8 +215,7 @@ function stepOrg(main) {
|
|
|
206
215
|
orgWrap.append(
|
|
207
216
|
el("small", {
|
|
208
217
|
textContent:
|
|
209
|
-
"
|
|
210
|
-
"github.com first if you need to.",
|
|
218
|
+
"Don't have one? Create it on github.com first.",
|
|
211
219
|
}),
|
|
212
220
|
);
|
|
213
221
|
form.append(orgWrap);
|
|
@@ -250,8 +258,8 @@ function stepOrg(main) {
|
|
|
250
258
|
});
|
|
251
259
|
other.input.addEventListener("change", look);
|
|
252
260
|
|
|
253
|
-
const name = field("name", "What the business is called", "", "
|
|
254
|
-
const human = field("human", "Your GitHub login", S.gh.login ?? "", "The person the
|
|
261
|
+
const name = field("name", "What the business is called", "", "Defaults to the organisation name.");
|
|
262
|
+
const human = field("human", "Your GitHub login", S.gh.login ?? "", "The person the staff report to.");
|
|
255
263
|
|
|
256
264
|
card.append(form);
|
|
257
265
|
const agentHead = el("h3", { textContent: "Which coding agent runs a session" });
|
|
@@ -264,7 +272,7 @@ function stepOrg(main) {
|
|
|
264
272
|
const opt = el("label", { className: "choice" });
|
|
265
273
|
const radio = el("input", { name: "agent", value: a.id, checked: i === 0 });
|
|
266
274
|
radio.setAttribute("type", "radio");
|
|
267
|
-
opt.append(radio, el("b", { textContent: a.label })
|
|
275
|
+
opt.append(radio, el("b", { textContent: a.label }));
|
|
268
276
|
opt.append(el("code", { textContent: a.tokenEnv }));
|
|
269
277
|
agents.append(opt);
|
|
270
278
|
});
|
|
@@ -272,8 +280,7 @@ function stepOrg(main) {
|
|
|
272
280
|
const agentNote = el("p", {
|
|
273
281
|
className: "sub",
|
|
274
282
|
textContent:
|
|
275
|
-
"
|
|
276
|
-
"the secret holding its credential. Write those three into org.yaml afterwards.",
|
|
283
|
+
"Using a different agent? Pick any of these, then set it in org.yaml afterwards.",
|
|
277
284
|
});
|
|
278
285
|
card.append(agentNote);
|
|
279
286
|
|
|
@@ -349,26 +356,20 @@ function stepOrg(main) {
|
|
|
349
356
|
out.replaceChildren(el("p", { className: "sub", textContent: "Working…" }));
|
|
350
357
|
try {
|
|
351
358
|
const result = await planTenant(p);
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
el("
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}),
|
|
360
|
-
);
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
className: "sub",
|
|
367
|
-
textContent:
|
|
368
|
-
"org/business.md arrives as questions, not prose. Answering it is the next step and " +
|
|
369
|
-
"it is the one that decides whether any of this is worth running.",
|
|
370
|
-
}),
|
|
371
|
-
);
|
|
359
|
+
const steps = el("ol", { className: "plansteps" }, [
|
|
360
|
+
el("li", { textContent: `Create a private repo, ${p.org}/roster-ops, to hold the org's shared settings.` }),
|
|
361
|
+
el("li", { textContent: `Put a copy of it in ${result.dir}.` }),
|
|
362
|
+
el("li", { textContent: `Let the other repos in ${p.org} run its workflow.` }),
|
|
363
|
+
]);
|
|
364
|
+
const files = el("details", { className: "planfiles" }, [
|
|
365
|
+
el("summary", { textContent: `The ${result.files.length} files it writes` }),
|
|
366
|
+
el("div", { className: "filelist" }, result.files.map((f) => el("code", { textContent: f }))),
|
|
367
|
+
]);
|
|
368
|
+
const next = el("p", {
|
|
369
|
+
className: "sub",
|
|
370
|
+
textContent: "After that: describe the business, set this month's priorities, and hire your first staff member.",
|
|
371
|
+
});
|
|
372
|
+
out.replaceChildren(el("p", { textContent: "Create it will:" }), steps, files, next);
|
|
372
373
|
go.hidden = false;
|
|
373
374
|
} catch (err) {
|
|
374
375
|
out.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) }));
|
|
@@ -398,42 +399,66 @@ function stepOrg(main) {
|
|
|
398
399
|
|
|
399
400
|
/* ------------------------- 5 · the two GitHub insists on ------------------------- */
|
|
400
401
|
|
|
401
|
-
function afterCreate(
|
|
402
|
+
function afterCreate() {
|
|
402
403
|
fileSteps.clear();
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
"The first is a setting roster tries for you. The last two are the files that decide " +
|
|
408
|
-
"whether any of this is worth running, and only you can write them.",
|
|
409
|
-
}),
|
|
410
|
-
);
|
|
411
|
-
card.append(accessStep());
|
|
412
|
-
card.append(credentialPanel());
|
|
404
|
+
const list = el("div", { className: "todos" });
|
|
405
|
+
const left = S.tenant.left ?? [];
|
|
406
|
+
const staffCount = App.data?.staff?.length ?? 0;
|
|
407
|
+
let n = 0;
|
|
413
408
|
|
|
414
409
|
if (S.tenant.org) {
|
|
415
|
-
|
|
410
|
+
const repos = todo(++n, "Choose the repos your staff work on", (S.tenant.products ?? []).length > 0);
|
|
411
|
+
repos.hint("Pick at least one. Staff open pull requests there, and you review them.");
|
|
412
|
+
repos.body.append(
|
|
413
|
+
repoPicker({ org: S.tenant.org, known: S.tenant.repos ?? [], bare: true, onAdded: () => repos.setDone(true) }),
|
|
414
|
+
);
|
|
415
|
+
list.append(repos.card);
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
const business =
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
418
|
+
const business = todo(++n, "Describe the business", !left.includes("business"));
|
|
419
|
+
business.hint("A few short answers. Every staff member reads them before they start work.");
|
|
420
|
+
business.body.append(
|
|
421
|
+
businessForm({
|
|
422
|
+
path: opsName() + "/org/business.md",
|
|
423
|
+
name: App.data?.name ?? S.tenant.name ?? S.tenant.org,
|
|
424
|
+
onSaved: () => (business.setDone(true), recheck()),
|
|
425
|
+
}),
|
|
423
426
|
);
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
427
|
+
fileSteps.set("business", business.setDone);
|
|
428
|
+
list.append(business.card);
|
|
429
|
+
|
|
430
|
+
const priorities = todo(++n, "Set this month's priorities", !left.includes("priorities"));
|
|
431
|
+
priorities.hint("Up to three, in order. Staff pick work that serves them.");
|
|
432
|
+
priorities.body.append(
|
|
433
|
+
prioritiesForm({
|
|
434
|
+
path: opsName() + "/org/priorities.md",
|
|
435
|
+
onSaved: () => (priorities.setDone(true), recheck()),
|
|
436
|
+
}),
|
|
433
437
|
);
|
|
434
|
-
priorities.
|
|
435
|
-
|
|
436
|
-
|
|
438
|
+
fileSteps.set("priorities", priorities.setDone);
|
|
439
|
+
list.append(priorities.card);
|
|
440
|
+
|
|
441
|
+
const hire = todo(++n, "Hire your first staff member", staffCount > 0);
|
|
442
|
+
hire.hint("Pick a role. The Staff screen then lists each step to set them up.");
|
|
443
|
+
const hireBtn = el("button", { className: "btn primary", textContent: "Hire someone" });
|
|
444
|
+
hireBtn.onclick = () => {
|
|
445
|
+
// Before the org has loaded, this screen is the whole app, so the Staff screen needs a reload.
|
|
446
|
+
if (App.data) go({ view: "staff" });
|
|
447
|
+
else location.assign("/#/-/staff") || location.reload();
|
|
448
|
+
};
|
|
449
|
+
hire.body.append(el("div", { className: "row" }, [hireBtn]));
|
|
450
|
+
list.append(hire.card);
|
|
451
|
+
|
|
452
|
+
const cred = todo(++n, "Add your agent credential", false);
|
|
453
|
+
cred.hint(staffCount ? "Staff use it to run. You only add it once." : "Do this after your first hire.");
|
|
454
|
+
cred.body.append(credentialPanel({ bare: true, onStatus: (ok) => cred.setDone(ok) }));
|
|
455
|
+
list.append(cred.card);
|
|
456
|
+
|
|
457
|
+
const access = todo(++n, "Let staff repos use the shared workflow", false);
|
|
458
|
+
access.body.append(accessStep({ onStatus: (ok) => access.setDone(ok) }));
|
|
459
|
+
list.append(access.card);
|
|
460
|
+
|
|
461
|
+
return list;
|
|
437
462
|
}
|
|
438
463
|
|
|
439
464
|
/**
|
|
@@ -442,18 +467,6 @@ function afterCreate(n) {
|
|
|
442
467
|
* Read from the status rather than from the click that saved it, so a file written in an
|
|
443
468
|
* editor, or by a coding agent, shows as done here too.
|
|
444
469
|
*/
|
|
445
|
-
function fileStep(id, title, why) {
|
|
446
|
-
const box = el("div", { className: "manual" });
|
|
447
|
-
const tag = el("span", { className: "meta" });
|
|
448
|
-
const mark = (done) => {
|
|
449
|
-
tag.textContent = done ? "Written." : "Still the stub it shipped as.";
|
|
450
|
-
box.classList[done ? "add" : "remove"]("done");
|
|
451
|
-
};
|
|
452
|
-
mark(!(S.tenant.left ?? []).includes(id));
|
|
453
|
-
fileSteps.set(id, mark);
|
|
454
|
-
box.append(el("div", {}, [el("b", { textContent: title }), tag]), el("p", { textContent: why }));
|
|
455
|
-
return box;
|
|
456
|
-
}
|
|
457
470
|
|
|
458
471
|
/**
|
|
459
472
|
* org/priorities.md, edited in place.
|
|
@@ -463,57 +476,11 @@ function fileStep(id, title, why) {
|
|
|
463
476
|
* quicker to type than to explain to a model. So the file opens as it is on disk, stub and
|
|
464
477
|
* all, and saving it is the same commit-and-push as every other editor here.
|
|
465
478
|
*/
|
|
466
|
-
function prioritiesEditor() {
|
|
467
|
-
const box = el("div", { style: "margin-top:9px" });
|
|
468
|
-
const path = opsName() + "/org/priorities.md";
|
|
469
|
-
const ta = el("textarea", { className: "pastebox" });
|
|
470
|
-
ta.rows = 12;
|
|
471
|
-
const save = el("button", { className: "btn primary", textContent: "Save and commit" });
|
|
472
|
-
const out = el("div");
|
|
473
|
-
box.append(ta, el("div", { className: "row", style: "margin-top:9px" }, [save]), out);
|
|
474
|
-
|
|
475
|
-
let before = "";
|
|
476
|
-
save.disabled = true;
|
|
477
|
-
// Not getFile: an absent file answers 404 with a message, and that is not what to edit.
|
|
478
|
-
fetch(fileUrl(path), { cache: "no-store" })
|
|
479
|
-
.then((r) => (r.ok ? r.text() : ""))
|
|
480
|
-
.then((text) => {
|
|
481
|
-
before = text;
|
|
482
|
-
ta.value = text;
|
|
483
|
-
grow(ta);
|
|
484
|
-
save.disabled = false;
|
|
485
|
-
})
|
|
486
|
-
.catch((err) => out.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) })));
|
|
487
|
-
ta.addEventListener("input", () => grow(ta));
|
|
488
479
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
494
|
-
save.disabled = true;
|
|
495
|
-
save.textContent = "Saving…";
|
|
496
|
-
try {
|
|
497
|
-
const r = await saveFile(path, ta.value, "portal: write org/priorities.md");
|
|
498
|
-
before = ta.value;
|
|
499
|
-
out.replaceChildren(
|
|
500
|
-
el("p", {
|
|
501
|
-
className: r.pushed ? "sub" : "err",
|
|
502
|
-
textContent: r.pushed
|
|
503
|
-
? "Committed and pushed. Every daily run reads it from the next one."
|
|
504
|
-
: "Committed, but the push failed: " + (r.note ?? ""),
|
|
505
|
-
}),
|
|
506
|
-
);
|
|
507
|
-
recheck();
|
|
508
|
-
} catch (err) {
|
|
509
|
-
out.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) }));
|
|
510
|
-
} finally {
|
|
511
|
-
save.disabled = false;
|
|
512
|
-
save.textContent = "Save and commit";
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
return box;
|
|
516
|
-
}
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
517
484
|
|
|
518
485
|
/** The ops repo's directory name, which is what every workspace-relative path starts with. */
|
|
519
486
|
function opsName() {
|
|
@@ -527,9 +494,8 @@ function opsName() {
|
|
|
527
494
|
*
|
|
528
495
|
* Skipped, every workflow fails with "workflow not found", which reads like a typo in a path.
|
|
529
496
|
*/
|
|
530
|
-
function accessStep() {
|
|
531
|
-
const box = el("div"
|
|
532
|
-
box.append(el("b", { textContent: "Let every repo in the org call the ops repo's workflow" }));
|
|
497
|
+
function accessStep(opts = {}) {
|
|
498
|
+
const box = el("div");
|
|
533
499
|
const out = el("div");
|
|
534
500
|
box.append(out);
|
|
535
501
|
const say = (text, cls) => el("p", { className: cls ?? "sub", textContent: text });
|
|
@@ -539,8 +505,7 @@ function accessStep() {
|
|
|
539
505
|
out.replaceChildren(
|
|
540
506
|
say(
|
|
541
507
|
(why ? why + " " : "") +
|
|
542
|
-
"
|
|
543
|
-
"with “workflow not found”.",
|
|
508
|
+
"Roster tried to set this when it created the org, and GitHub didn't allow it.",
|
|
544
509
|
),
|
|
545
510
|
el("div", { className: "row" }, [go]),
|
|
546
511
|
);
|
|
@@ -549,7 +514,8 @@ function accessStep() {
|
|
|
549
514
|
try {
|
|
550
515
|
const r = await setAccess();
|
|
551
516
|
if (r.ok) {
|
|
552
|
-
out.replaceChildren(say("
|
|
517
|
+
out.replaceChildren(say("Done."));
|
|
518
|
+
opts.onStatus?.(true);
|
|
553
519
|
return;
|
|
554
520
|
}
|
|
555
521
|
out.replaceChildren(
|
|
@@ -567,7 +533,8 @@ function accessStep() {
|
|
|
567
533
|
out.replaceChildren(say("Checking…"));
|
|
568
534
|
getAccess()
|
|
569
535
|
.then((r) => {
|
|
570
|
-
|
|
536
|
+
opts.onStatus?.(Boolean(r.ok));
|
|
537
|
+
if (r.ok) out.replaceChildren(say("Done."));
|
|
571
538
|
else offer(r.level ? "It is set to “" + r.level + "”." : "");
|
|
572
539
|
})
|
|
573
540
|
.catch(() => offer(""));
|