@nanocollective/roster 0.1.0-beta.19 → 0.1.0-beta.21
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 +8 -0
- package/dist/{agents-Q2DSTLOQ.js → agents-POITEZRI.js} +1 -1
- package/dist/{chunk-JH3LQ34C.js → chunk-FF2WBNNW.js} +18 -1
- package/dist/{chunk-UEZPQ5PV.js → chunk-GDAJPOHK.js} +2 -2
- package/dist/cli.js +1089 -211
- package/dist/{compose-H43W3QI5.js → compose-5DBEHSEV.js} +1 -1
- package/dist/{connectors-U5VT5W2I.js → connectors-5E5ZMGZV.js} +1 -1
- package/dist/worker/assets/assets/css/routines.css +40 -0
- package/dist/worker/assets/assets/js/app.js +4 -1
- package/dist/worker/assets/assets/js/icons.js +2 -0
- package/dist/worker/assets/assets/js/state.js +1 -0
- package/dist/worker/assets/assets/js/views/home.js +1 -0
- package/dist/worker/assets/assets/js/views/routines.js +378 -0
- package/dist/worker/assets/index.html +4 -0
- package/dist/worker/index.js +415 -50
- package/docs/README.md +1 -0
- package/docs/commands.md +45 -0
- package/docs/concepts.md +1 -0
- package/docs/getting-started.md +14 -0
- package/docs/hosting.md +2 -2
- package/docs/portal.md +11 -0
- package/docs/routines.md +65 -0
- package/docs/security.md +5 -3
- package/docs/session-workflow.md +2 -1
- package/docs/staff-yaml.md +1 -0
- package/package.json +1 -1
- package/templates/brain/.gitattributes +3 -0
- package/templates/brain/.github/workflows/%%STAFF%%-daily.yaml +16 -9
- package/templates/brain/staff.yaml +3 -0
- package/templates/ops/.gitattributes +3 -0
- package/templates/ops/.github/workflows/session.yaml +8 -1
- package/templates/ops/compose.mjs +20 -0
- package/templates/ops/prompts/daily.md +21 -0
- package/templates/portal/css/routines.css +40 -0
- package/templates/portal/index.html +4 -0
- package/templates/portal/js/app.js +4 -1
- package/templates/portal/js/icons.js +2 -0
- package/templates/portal/js/state.js +1 -0
- package/templates/portal/js/views/home.js +1 -0
- package/templates/portal/js/views/routines.js +378 -0
- package/templates/skill/SKILL.md +115 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/* The Routines screen: when each staff member wakes, and what they do then.
|
|
2
|
+
*
|
|
3
|
+
* Every staff member has a daily round. A routine is one more wake-up with its own job: a time,
|
|
4
|
+
* a name, and what to do in the person's own words. Saving writes the staff member's
|
|
5
|
+
* staff.yaml, routines/<id>.md and the daily caller in one commit, as you.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { post } from "../api.js";
|
|
9
|
+
import { sheet } from "../dialog.js";
|
|
10
|
+
import { el, grow } from "../dom.js";
|
|
11
|
+
import { icon } from "../icons.js";
|
|
12
|
+
import { render } from "../router.js";
|
|
13
|
+
|
|
14
|
+
/* The last answer, so a repaint after Save does not flash an empty screen. */
|
|
15
|
+
let last = null;
|
|
16
|
+
|
|
17
|
+
export function viewRoutines(m) {
|
|
18
|
+
const add = el("button", { className: "ghbtn primary", textContent: "New routine" });
|
|
19
|
+
m.append(el("div", { className: "routhead" }, [el("h1", { textContent: "Routines" }), add]));
|
|
20
|
+
const body = el("div");
|
|
21
|
+
m.append(body);
|
|
22
|
+
if (last) draw(body, last, add);
|
|
23
|
+
else body.append(el("p", { className: "sub", textContent: "Loading…" }));
|
|
24
|
+
fetch("/api/routines")
|
|
25
|
+
.then((r) => r.json())
|
|
26
|
+
.then((d) => {
|
|
27
|
+
if (d.error) throw new Error(d.error);
|
|
28
|
+
last = d;
|
|
29
|
+
body.replaceChildren();
|
|
30
|
+
draw(body, d, add);
|
|
31
|
+
})
|
|
32
|
+
.catch((err) => body.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) })));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function draw(body, d, add) {
|
|
36
|
+
add.onclick = () => edit(d, null, null);
|
|
37
|
+
add.disabled = !d.staff.length;
|
|
38
|
+
if (!d.staff.length) {
|
|
39
|
+
body.append(el("p", { className: "sub", textContent: "Hire a staff member first." }));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
for (const s of d.staff) {
|
|
43
|
+
const list = el("div", { className: "connlist routlist" });
|
|
44
|
+
list.append(dailyRow(s, d));
|
|
45
|
+
for (const r of s.routines) list.append(routineRow(s, r, d));
|
|
46
|
+
const more = el("button", { className: "routadd" }, [icon("plus"), el("span", { textContent: "Add a routine for " + s.name })]);
|
|
47
|
+
more.onclick = () => edit(d, s, null);
|
|
48
|
+
list.append(more);
|
|
49
|
+
body.append(el("h2", { className: "connhead", textContent: s.name }), list);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function dailyRow(s, d) {
|
|
54
|
+
const change = el("button", { className: "ghbtn", textContent: "Change time" });
|
|
55
|
+
change.onclick = () => editDaily(d, s);
|
|
56
|
+
return el("div", { className: "connrow routrow" }, [
|
|
57
|
+
el("span", { className: "connicon" }, [icon("refresh")]),
|
|
58
|
+
el("div", { className: "conntext" }, [
|
|
59
|
+
el("b", { textContent: "Daily round" }),
|
|
60
|
+
el("span", { className: "routwhen", textContent: s.dailyWhen }),
|
|
61
|
+
]),
|
|
62
|
+
el("div", { className: "row connacts" }, [change]),
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function routineRow(s, r, d) {
|
|
67
|
+
const run = el("button", { className: "ghbtn", textContent: "Run now" });
|
|
68
|
+
run.onclick = () => runNow(s, r, run);
|
|
69
|
+
const change = el("button", { className: "ghbtn", textContent: "Edit" });
|
|
70
|
+
change.onclick = () => edit(d, s, r);
|
|
71
|
+
const remove = el("button", { className: "ghbtn", textContent: "Remove" });
|
|
72
|
+
remove.onclick = () => confirmRemove(s, r, remove);
|
|
73
|
+
return el("div", { className: "connrow routrow" }, [
|
|
74
|
+
el("span", { className: "connicon" }, [icon("clock")]),
|
|
75
|
+
el("div", { className: "conntext" }, [
|
|
76
|
+
el("b", { textContent: r.title }),
|
|
77
|
+
el("span", { className: "routwhen", textContent: r.when }),
|
|
78
|
+
r.body ? el("span", { className: "routbody", textContent: r.body }) : null,
|
|
79
|
+
].filter(Boolean)),
|
|
80
|
+
el("div", { className: "row connacts" }, [run, change, remove]),
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async function runNow(s, r, btn) {
|
|
85
|
+
btn.disabled = true;
|
|
86
|
+
btn.textContent = "Starting…";
|
|
87
|
+
try {
|
|
88
|
+
const res = await post({ staff: s.handle, routine: r.id }, "/api/run/start");
|
|
89
|
+
btn.replaceWith(el("a", { className: "ghbtn", href: res.url, target: "_blank", rel: "noopener", textContent: "Started" }));
|
|
90
|
+
} catch (err) {
|
|
91
|
+
btn.disabled = false;
|
|
92
|
+
btn.textContent = "Run now";
|
|
93
|
+
btn.title = String(err.message || err);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async function confirmRemove(s, r, btn) {
|
|
98
|
+
if (btn.dataset.sure !== "1") {
|
|
99
|
+
btn.dataset.sure = "1";
|
|
100
|
+
btn.textContent = "Remove " + r.title + "?";
|
|
101
|
+
btn.classList.add("danger");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
btn.disabled = true;
|
|
105
|
+
btn.textContent = "Removing…";
|
|
106
|
+
try {
|
|
107
|
+
await save(s, s.daily, s.routines.filter((x) => x.id !== r.id));
|
|
108
|
+
last = null;
|
|
109
|
+
render();
|
|
110
|
+
} catch (err) {
|
|
111
|
+
btn.textContent = String(err.message || err);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** One staff member's whole schedule, as the server wants it. */
|
|
116
|
+
function save(s, daily, routines) {
|
|
117
|
+
return post(
|
|
118
|
+
{
|
|
119
|
+
staff: s.handle,
|
|
120
|
+
daily,
|
|
121
|
+
routines: routines.map((r) => ({ id: r.id, title: r.title, body: r.body, schedule: r.schedule })),
|
|
122
|
+
},
|
|
123
|
+
"/api/routines/save",
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* --------------------------------- editors --------------------------------- */
|
|
128
|
+
|
|
129
|
+
function edit(d, s, r) {
|
|
130
|
+
let box = null;
|
|
131
|
+
const node = routineForm(d, s, r, () => box?.close());
|
|
132
|
+
box = sheet({ node, onClose: () => {} });
|
|
133
|
+
if (!box) document.querySelector("#main")?.append(node);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function editDaily(d, s) {
|
|
137
|
+
let box = null;
|
|
138
|
+
const close = () => box?.close();
|
|
139
|
+
const out = el("div", { className: "routform" });
|
|
140
|
+
out.append(el("h2", { className: "sheettitle", textContent: s.name + "'s daily round" }));
|
|
141
|
+
const when = whenField(s.daily);
|
|
142
|
+
out.append(when.node);
|
|
143
|
+
const status = el("div");
|
|
144
|
+
const ok = el("button", { className: "ghbtn primary", textContent: "Save" });
|
|
145
|
+
const cancel = el("button", { className: "ghbtn", textContent: "Cancel" });
|
|
146
|
+
cancel.onclick = close;
|
|
147
|
+
ok.onclick = async () => {
|
|
148
|
+
ok.disabled = true;
|
|
149
|
+
ok.textContent = "Saving…";
|
|
150
|
+
try {
|
|
151
|
+
await save(s, when.value(), s.routines);
|
|
152
|
+
last = null;
|
|
153
|
+
close();
|
|
154
|
+
render();
|
|
155
|
+
} catch (err) {
|
|
156
|
+
ok.disabled = false;
|
|
157
|
+
ok.textContent = "Save";
|
|
158
|
+
status.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) }));
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
out.append(status, el("div", { className: "row connfoot" }, [ok, cancel]));
|
|
162
|
+
box = sheet({ node: out, onClose: () => {} });
|
|
163
|
+
if (!box) document.querySelector("#main")?.append(out);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function routineForm(d, s, r, close) {
|
|
167
|
+
const out = el("div", { className: "routform" });
|
|
168
|
+
out.append(el("h2", { className: "sheettitle", textContent: r ? r.title : "New routine" }));
|
|
169
|
+
|
|
170
|
+
let who = s ?? d.staff[0];
|
|
171
|
+
const pick = el("div", { className: "routwho" });
|
|
172
|
+
if (!r) {
|
|
173
|
+
for (const p of d.staff) {
|
|
174
|
+
const chip = el("button", { className: "routchip" + (p === who ? " on" : ""), textContent: p.name, type: "button" });
|
|
175
|
+
chip.onclick = () => {
|
|
176
|
+
who = p;
|
|
177
|
+
for (const c of pick.children) c.classList.toggle("on", c === chip);
|
|
178
|
+
say();
|
|
179
|
+
};
|
|
180
|
+
pick.append(chip);
|
|
181
|
+
}
|
|
182
|
+
out.append(field("Who", pick));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const name = el("input", { type: "text", value: r?.title ?? "", placeholder: "Monday plan", spellcheck: true });
|
|
186
|
+
out.append(field("Name", name));
|
|
187
|
+
|
|
188
|
+
const when = whenField(r?.schedule ?? "0 9 * * 1");
|
|
189
|
+
out.append(when.node);
|
|
190
|
+
|
|
191
|
+
const todo = el("textarea", {
|
|
192
|
+
className: "routtodo",
|
|
193
|
+
value: r?.body ?? "",
|
|
194
|
+
rows: 8,
|
|
195
|
+
placeholder: "Plan the week. Read last week's status issue and this month's priorities, then open one issue per thing to ship this week, ranked.",
|
|
196
|
+
});
|
|
197
|
+
out.append(field("What to do", todo));
|
|
198
|
+
|
|
199
|
+
const preview = el("div", { className: "routpreview" });
|
|
200
|
+
out.append(preview);
|
|
201
|
+
const say = () => {
|
|
202
|
+
const text = todo.value.trim();
|
|
203
|
+
preview.replaceChildren(
|
|
204
|
+
el("span", { className: "connicon" }, [icon("clock")]),
|
|
205
|
+
el("div", {}, [
|
|
206
|
+
el("b", { textContent: describe(when.value()) + ", " + who.name + " wakes up and:" }),
|
|
207
|
+
el("p", { textContent: text || "…" }),
|
|
208
|
+
]),
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
name.oninput = say;
|
|
212
|
+
todo.oninput = () => {
|
|
213
|
+
grow(todo);
|
|
214
|
+
say();
|
|
215
|
+
};
|
|
216
|
+
when.onchange(say);
|
|
217
|
+
say();
|
|
218
|
+
|
|
219
|
+
const status = el("div");
|
|
220
|
+
const ok = el("button", { className: "ghbtn primary", textContent: "Save" });
|
|
221
|
+
const cancel = el("button", { className: "ghbtn", textContent: "Cancel" });
|
|
222
|
+
cancel.onclick = close;
|
|
223
|
+
ok.onclick = async () => {
|
|
224
|
+
const next = { id: r?.id, title: name.value.trim(), body: todo.value, schedule: when.value() };
|
|
225
|
+
if (!next.title) return status.replaceChildren(el("p", { className: "err", textContent: "Give it a name." }));
|
|
226
|
+
if (!next.body.trim()) return status.replaceChildren(el("p", { className: "err", textContent: "Say what to do." }));
|
|
227
|
+
ok.disabled = true;
|
|
228
|
+
ok.textContent = "Saving…";
|
|
229
|
+
try {
|
|
230
|
+
const routines = r ? who.routines.map((x) => (x.id === r.id ? next : x)) : [...who.routines, next];
|
|
231
|
+
await save(who, who.daily, routines);
|
|
232
|
+
last = null;
|
|
233
|
+
close();
|
|
234
|
+
render();
|
|
235
|
+
} catch (err) {
|
|
236
|
+
ok.disabled = false;
|
|
237
|
+
ok.textContent = "Save";
|
|
238
|
+
status.replaceChildren(el("p", { className: "err", textContent: String(err.message || err) }));
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
out.append(status, el("div", { className: "row connfoot" }, [ok, cancel]));
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function field(label, control) {
|
|
246
|
+
return el("div", { className: "field routfield" }, [el("span", { textContent: label }), control]);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* --------------------------------- the time --------------------------------- */
|
|
250
|
+
|
|
251
|
+
const DAYS = [
|
|
252
|
+
["1", "Mon"],
|
|
253
|
+
["2", "Tue"],
|
|
254
|
+
["3", "Wed"],
|
|
255
|
+
["4", "Thu"],
|
|
256
|
+
["5", "Fri"],
|
|
257
|
+
["6", "Sat"],
|
|
258
|
+
["0", "Sun"],
|
|
259
|
+
];
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* When, as days and a time, or a day of the month, rather than as cron. The value is still a
|
|
263
|
+
* cron, because that is what goes in the workflow. A cron the picker cannot show is kept as
|
|
264
|
+
* typed, in a box of its own.
|
|
265
|
+
*/
|
|
266
|
+
function whenField(cron) {
|
|
267
|
+
const parsed = parseCron(cron);
|
|
268
|
+
const listeners = [];
|
|
269
|
+
const changed = () => {
|
|
270
|
+
for (const f of listeners) f();
|
|
271
|
+
said.textContent = describe(value()) + local(time.value);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const repeat = el("select");
|
|
275
|
+
repeat.append(
|
|
276
|
+
el("option", { value: "week", textContent: "Days of the week" }),
|
|
277
|
+
el("option", { value: "month", textContent: "Day of the month" }),
|
|
278
|
+
el("option", { value: "cron", textContent: "Cron" }),
|
|
279
|
+
);
|
|
280
|
+
repeat.value = parsed.kind;
|
|
281
|
+
|
|
282
|
+
const days = new Set(parsed.days);
|
|
283
|
+
const dayRow = el("div", { className: "routdays" });
|
|
284
|
+
for (const [v, label] of DAYS) {
|
|
285
|
+
const chip = el("button", { className: "routchip" + (days.has(v) ? " on" : ""), textContent: label, type: "button" });
|
|
286
|
+
chip.onclick = () => {
|
|
287
|
+
days.has(v) ? days.delete(v) : days.add(v);
|
|
288
|
+
chip.classList.toggle("on", days.has(v));
|
|
289
|
+
changed();
|
|
290
|
+
};
|
|
291
|
+
dayRow.append(chip);
|
|
292
|
+
}
|
|
293
|
+
const dom = el("input", { type: "number", min: "1", max: "28", value: String(parsed.dom), style: "width:80px" });
|
|
294
|
+
const time = el("input", { type: "time", step: "60", value: parsed.time, style: "width:130px" });
|
|
295
|
+
const raw = el("input", { type: "text", value: cron, spellcheck: false, placeholder: "0 9 * * 1" });
|
|
296
|
+
const said = el("small", { className: "routsaid" });
|
|
297
|
+
|
|
298
|
+
const domRow = el("div", { className: "row" }, [el("span", { className: "meta", textContent: "Day" }), dom]);
|
|
299
|
+
const timeRow = el("div", { className: "row" }, [time, el("span", { className: "meta", textContent: "UTC" })]);
|
|
300
|
+
const show = () => {
|
|
301
|
+
dayRow.hidden = repeat.value !== "week";
|
|
302
|
+
domRow.hidden = repeat.value !== "month";
|
|
303
|
+
timeRow.hidden = repeat.value === "cron";
|
|
304
|
+
raw.hidden = repeat.value !== "cron";
|
|
305
|
+
};
|
|
306
|
+
repeat.onchange = () => {
|
|
307
|
+
show();
|
|
308
|
+
changed();
|
|
309
|
+
};
|
|
310
|
+
for (const input of [dom, time, raw]) input.oninput = changed;
|
|
311
|
+
|
|
312
|
+
function value() {
|
|
313
|
+
if (repeat.value === "cron") return raw.value.trim();
|
|
314
|
+
const [h, m] = (time.value || "09:00").split(":").map(Number);
|
|
315
|
+
if (repeat.value === "month") return `${m} ${h} ${Math.min(28, Math.max(1, Number(dom.value) || 1))} * *`;
|
|
316
|
+
const picked = DAYS.map(([v]) => v).filter((v) => days.has(v));
|
|
317
|
+
return `${m} ${h} * * ${dayList(picked)}`;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
show();
|
|
321
|
+
said.textContent = describe(value()) + local(time.value);
|
|
322
|
+
const node = el("div", { className: "field routfield" }, [
|
|
323
|
+
el("span", { textContent: "When" }),
|
|
324
|
+
el("div", { className: "routwhenpick" }, [repeat, dayRow, domRow, timeRow, raw, said]),
|
|
325
|
+
]);
|
|
326
|
+
return { node, value, onchange: (f) => listeners.push(f) };
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** Days for cron, in its own short forms where there is one. */
|
|
330
|
+
function dayList(picked) {
|
|
331
|
+
const set = new Set(picked);
|
|
332
|
+
if (set.size === 0 || set.size === 7) return "*";
|
|
333
|
+
if (set.size === 5 && ["1", "2", "3", "4", "5"].every((d) => set.has(d))) return "1-5";
|
|
334
|
+
return [...set].map(Number).sort((a, b) => a - b).join(",");
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
export function parseCron(cron) {
|
|
338
|
+
const [min, hour, dom, mon, dow] = String(cron).trim().split(/\s+/);
|
|
339
|
+
const plain = /^\d+$/.test(min ?? "") && /^\d+$/.test(hour ?? "") && mon === "*";
|
|
340
|
+
const time = plain ? `${hour.padStart(2, "0")}:${min.padStart(2, "0")}` : "09:00";
|
|
341
|
+
if (plain && dom === "*") {
|
|
342
|
+
const days =
|
|
343
|
+
dow === "*" ? ["0", "1", "2", "3", "4", "5", "6"] : dow === "1-5" ? ["1", "2", "3", "4", "5"] : /^[0-6](,[0-6])*$/.test(dow) ? dow.split(",") : null;
|
|
344
|
+
if (days) return { kind: "week", days, time, dom: 1 };
|
|
345
|
+
}
|
|
346
|
+
if (plain && /^\d+$/.test(dom ?? "") && dow === "*") return { kind: "month", days: ["1"], time, dom: Number(dom) };
|
|
347
|
+
return { kind: "cron", days: ["1"], time, dom: 1 };
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const DAY_NAME = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
351
|
+
|
|
352
|
+
/** The same words the server gives a schedule, so the preview and the list agree. */
|
|
353
|
+
export function describe(cron) {
|
|
354
|
+
const p = parseCron(cron);
|
|
355
|
+
const at = "at " + p.time + " UTC";
|
|
356
|
+
if (p.kind === "month") return `On the ${ordinal(p.dom)} of each month ${at}`;
|
|
357
|
+
if (p.kind === "cron") return cron || "No time yet";
|
|
358
|
+
const d = cron.trim().split(/\s+/)[4];
|
|
359
|
+
if (d === "*") return "Every day " + at;
|
|
360
|
+
if (d === "1-5") return "Weekdays " + at;
|
|
361
|
+
if (d === "0,6" || d === "6,0") return "Weekends " + at;
|
|
362
|
+
const names = p.days.map((x) => DAY_NAME[Number(x)] + "s");
|
|
363
|
+
return (names.length > 1 ? names.slice(0, -1).join(", ") + " and " + names.at(-1) : names[0]) + " " + at;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function ordinal(n) {
|
|
367
|
+
const tens = n % 100;
|
|
368
|
+
return n + (tens >= 11 && tens <= 13 ? "th" : (["th", "st", "nd", "rd"][n % 10] ?? "th"));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** What that UTC time is where the person reading it is, when the two differ. */
|
|
372
|
+
function local(hhmm) {
|
|
373
|
+
if (!hhmm) return "";
|
|
374
|
+
const [h, m] = hhmm.split(":").map(Number);
|
|
375
|
+
const at = new Date(Date.UTC(2026, 0, 5, h, m));
|
|
376
|
+
const here = at.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });
|
|
377
|
+
return here === hhmm ? "" : " · " + here + " where you are";
|
|
378
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: roster
|
|
3
|
+
description: >
|
|
4
|
+
Set up and run Roster, an organisation run by AI staff who live in GitHub. Use this when the
|
|
5
|
+
person asks to set up Roster, hire AI staff (a CTO, a CMO, support), add a staff member, or
|
|
6
|
+
check on, talk to or fix their Roster org. Setup creates a GitHub org's ops repo, hires staff
|
|
7
|
+
whose brains are repos and who run on GitHub Actions, writes the business and priorities with
|
|
8
|
+
the person, and opens the portal where they talk to their staff.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Roster
|
|
12
|
+
|
|
13
|
+
Roster runs an organisation on AI staff. Each staff member is a repo (their brain: charter,
|
|
14
|
+
memory, workflows) and a GitHub App (their identity). They run on GitHub Actions on a schedule,
|
|
15
|
+
wake when someone @mentions them, and message each other through issues. The person talks to
|
|
16
|
+
them in the Roster portal.
|
|
17
|
+
|
|
18
|
+
Pasting this file means the person wants Roster set up on this machine, and has authorised the
|
|
19
|
+
setup commands below. If your runtime asks permission for shell commands, ask once and work
|
|
20
|
+
straight through.
|
|
21
|
+
|
|
22
|
+
## Check where you are first
|
|
23
|
+
|
|
24
|
+
- **A hosted chat** (claude.ai, ChatGPT, Gemini, even with a code sandbox): it runs in the
|
|
25
|
+
provider's cloud, not on the person's machine, and Roster needs their own `gh` and a local
|
|
26
|
+
checkout. Do not install anything. Tell them to paste the same line into a coding agent on
|
|
27
|
+
their computer (Claude Code, Codex, Cursor, Gemini CLI), then stop.
|
|
28
|
+
- **A coding agent on their machine**: continue.
|
|
29
|
+
|
|
30
|
+
Never ask the person to paste a token, key or password into the chat. Every credential goes in
|
|
31
|
+
through their own terminal.
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
roster --version 2>/dev/null || npm install -g @nanocollective/roster@latest
|
|
37
|
+
roster skill install
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Roster needs Node 20 or later and the GitHub CLI (`gh`). If `gh` is missing, install it
|
|
41
|
+
(`brew install gh` on a Mac; otherwise https://cli.github.com). `roster skill install` saves this
|
|
42
|
+
file for the coding agents it finds, so future sessions know Roster without being told.
|
|
43
|
+
|
|
44
|
+
Work in the directory the person wants their Roster workspace in. Ask if it is not obvious;
|
|
45
|
+
their home directory or a projects folder is usual, and their product's own repo is not.
|
|
46
|
+
|
|
47
|
+
## Setup is one loop
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
roster setup --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
It reads GitHub and the disk and returns every step, whether each is done, and `next`: the one
|
|
54
|
+
thing to do now. Do `next`, then run `roster setup --json` again. Repeat until `ready` is true.
|
|
55
|
+
It is always safe to run again; it stores nothing.
|
|
56
|
+
|
|
57
|
+
Each step has:
|
|
58
|
+
|
|
59
|
+
- `who: "agent"`: run `command` yourself. Where it says `confirm: true`, ask the person first:
|
|
60
|
+
the step decides something about their business or costs money.
|
|
61
|
+
- `who: "human"`: something only they can do (sign in, confirm on GitHub, paste a credential in
|
|
62
|
+
their own terminal). Give them `do` and `command` exactly, then wait for them to say it is done.
|
|
63
|
+
- `do`: what the step needs, in words you can pass on as they stand.
|
|
64
|
+
|
|
65
|
+
Rules for the loop:
|
|
66
|
+
|
|
67
|
+
- **Do not skip ahead or reorder.** Each step needs the ones before it.
|
|
68
|
+
- **Do not reword the questions.** The briefs Roster prints (`roster brief discover`,
|
|
69
|
+
`roster brief priorities`, `roster brief charter <handle>`) carry the questions. Follow the
|
|
70
|
+
brief: read what you can about their project first, then ask its questions one at a time, in
|
|
71
|
+
its order, and write the file it asks for. Show the person the file before you commit it.
|
|
72
|
+
- **These files are the point.** `org/business.md`, `org/priorities.md` and each `CHARTER.md`
|
|
73
|
+
are what make the staff useful rather than generic. Do not fill them from guesses to get
|
|
74
|
+
through setup faster; ask.
|
|
75
|
+
- **Commands that wait for a browser** (`roster app`): run them in the background, relay the
|
|
76
|
+
link they print, keep reading their output, and relay the install link that follows.
|
|
77
|
+
- **Plans before changes.** `init`, `hire`, `app`, `credential` and `run` print a plan without
|
|
78
|
+
`--apply`. Where a step has `confirm: true`, show the person the plan, then run it again with
|
|
79
|
+
`--apply`.
|
|
80
|
+
|
|
81
|
+
If a command fails, read its output: it says what is wrong and usually the command that fixes
|
|
82
|
+
it. `roster doctor` checks the whole org and gives a fix for every finding. Do not retry the
|
|
83
|
+
same failing command in a loop.
|
|
84
|
+
|
|
85
|
+
## When setup is done
|
|
86
|
+
|
|
87
|
+
Start the portal in the background and give the person its address:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
roster --no-open
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
It prints a localhost URL (4300 unless that is taken). Then, in a few sentences: their staff are
|
|
94
|
+
hired and have run once, they run on their own each day and when @mentioned, and the portal's
|
|
95
|
+
Home is where staff ask them things. Routines, in the portal, wake them at more times. Offer three things they could ask their first staff
|
|
96
|
+
member, based on what you learned about their business in the interview.
|
|
97
|
+
|
|
98
|
+
Do not report versions, paths or package-manager output. Report what is working and what, if
|
|
99
|
+
anything, is left.
|
|
100
|
+
|
|
101
|
+
## After setup
|
|
102
|
+
|
|
103
|
+
| To | Run |
|
|
104
|
+
|---|---|
|
|
105
|
+
| See where setup is | `roster setup` |
|
|
106
|
+
| Open the portal | `roster` |
|
|
107
|
+
| Check everything is wired up | `roster doctor` |
|
|
108
|
+
| Every problem, as one brief to fix | `roster fix` |
|
|
109
|
+
| Hire another staff member | `roster hire <handle> --name "<role>"` then `roster app <handle>` |
|
|
110
|
+
| Start a run now | `roster run <handle> --apply` |
|
|
111
|
+
| Wake them at more times, each with its own job | `roster routine <handle> add --name "<name>" --at "<cron, UTC>" --do "<what to do>" --apply` |
|
|
112
|
+
| Give staff an outside service | `roster connector` |
|
|
113
|
+
| Take framework updates | `npm install -g @nanocollective/roster@latest && roster upgrade --apply` |
|
|
114
|
+
|
|
115
|
+
Docs: https://roster.nanocollective.org/docs/
|