@nanocollective/roster 0.1.0-beta.31 → 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.
@@ -194,3 +194,6 @@
194
194
  .homesetupsteps{margin:0 0 4px;padding-left:20px;display:flex;flex-direction:column;gap:10px;font-size:13.5px}
195
195
  .homesetupsteps li > span{display:block;margin-bottom:5px}
196
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}
@@ -60,6 +60,12 @@ const STEP_COMMANDS = {
60
60
  "add the agent credential": () => "credential --apply",
61
61
  "run once": (h) => `run ${h} --apply`,
62
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
+
63
69
  export function stepCommand(what, handle) {
64
70
  return STEP_COMMANDS[what]?.(handle) ?? "";
65
71
  }
@@ -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)
@@ -597,6 +597,9 @@ function team(staff) {
597
597
 
598
598
  /* ------------------------------- setup left ----------------------------- */
599
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
+
600
603
  let readinessAsked = false;
601
604
 
602
605
  /**
@@ -612,33 +615,66 @@ function setupLeft(staff) {
612
615
  if (S.view === "home") render();
613
616
  });
614
617
  }
618
+ // Each step: what, its command, and where to do it here when it is writing rather than wiring.
615
619
  const steps = [];
616
- for (const id of S.data?.unfinished ?? []) if (ORG_STEPS[id]) steps.push(ORG_STEPS[id]);
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
+ }
617
631
  for (const s of notReady()) {
618
632
  for (const what of S.readiness[s.handle]) {
619
- steps.push([`${s.name}: ${what}`, stepCommand(what, 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]);
620
641
  }
621
642
  }
622
643
  if (!steps.length) return null;
644
+ const wiring = steps.filter(([, , here]) => !here).length;
623
645
 
624
646
  const box = el("div", { className: "card homesetup" });
625
- box.append(
626
- el("b", { textContent: "Setup is not finished" }),
627
- el("p", {
628
- className: "sub",
629
- textContent: S.hosted
630
- ? "Nobody runs until these are done. They need your own machine: run each in your workspace, in order."
631
- : "Nobody runs until these are done.",
632
- }),
633
- );
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
+ }
634
664
  const seen = new Set();
635
665
  const list = el("ol", { className: "homesetupsteps" });
636
- for (const [what, cmd] of steps) {
666
+ for (const [what, cmd, here] of steps) {
637
667
  // The credential is the org's, so two staff members missing it is one step.
638
668
  if (cmd && seen.has(cmd)) continue;
639
669
  seen.add(cmd);
640
- const row = el("li", {}, [el("span", { textContent: cap(what) })]);
641
- if (S.hosted && cmd) row.append(commandLine(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));
642
678
  list.append(row);
643
679
  }
644
680
  box.append(list);
@@ -6,7 +6,7 @@
6
6
  * a hosted portal the command for each step, since setting up is only done on your machine. */
7
7
 
8
8
  import { el, toClipboard } from "../dom.js";
9
- import { canRun, ROSTER, sentence, stepCommand, whatsLeft } from "../readiness.js";
9
+ import { canRun, IN_PORTAL, ROSTER, sentence, stepCommand, whatsLeft } from "../readiness.js";
10
10
  import { go } from "../router.js";
11
11
  import { S } from "../state.js";
12
12
 
@@ -36,8 +36,18 @@ export function notReadyNote(s) {
36
36
  };
37
37
  box.append(el("div", { className: "row" }, [finish]));
38
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
+ }
39
48
  const seen = new Set();
40
49
  for (const what of left) {
50
+ if (IN_PORTAL.has(what)) continue;
41
51
  const cmd = stepCommand(what, s.handle);
42
52
  if (!cmd || seen.has(cmd)) continue;
43
53
  seen.add(cmd);
@@ -9,10 +9,10 @@ import { post } from "../api.js";
9
9
  import { askYes, sheet } from "../dialog.js";
10
10
  import { pending } from "../inflight.js";
11
11
  import { ago, el, esc } from "../dom.js";
12
- import { sentence, staffProgress, stepCommand, whatsLeft } from "../readiness.js";
12
+ import { IN_PORTAL, sentence, staffProgress, stepCommand, whatsLeft } from "../readiness.js";
13
13
  import { refreshAll } from "../refresh.js";
14
14
  import { S } from "../state.js";
15
- import { hireFlow, line, rolePicker } from "./hire.js";
15
+ import { charterModes, hireFlow, line, rolePicker } from "./hire.js";
16
16
  import { commandLine } from "./notready.js";
17
17
 
18
18
  /**
@@ -93,6 +93,10 @@ export function viewStaff(m, o = {}) {
93
93
  else pane.replaceChildren();
94
94
  S.staffOpen = null;
95
95
  if (empty && !S.hosted) pick();
96
+ // Home's "Write it here" on a charter lands here with the dialog open.
97
+ const asked = S.writeCharter && S.data.staff.find((s) => s.handle === S.writeCharter);
98
+ S.writeCharter = null;
99
+ if (asked) writeCharter(asked);
96
100
  }
97
101
 
98
102
  // With nobody hired the roles are the page. After that they are a dialog behind Hire someone.
@@ -205,11 +209,20 @@ export function viewStaff(m, o = {}) {
205
209
  warn.textContent =
206
210
  "Not ready to run. " + (p ? `${p.done} of ${p.total} done. ` : "") +
207
211
  "Still to do: " + sentence(left) + ".";
208
- // Hosted has no Finish setting up, so each step comes with what to run instead.
212
+ /* Hosted has no Finish setting up. The charter is writing, which works from here; the
213
+ rest is wiring, which needs your machine, so each of those comes with its command. */
209
214
  if (S.hosted) {
210
- const cmds = [...new Set(left.map((x) => stepCommand(x, s.handle)).filter(Boolean))];
215
+ const cmds = [
216
+ ...new Set(left.filter((x) => !IN_PORTAL.has(x)).map((x) => stepCommand(x, s.handle)).filter(Boolean)),
217
+ ];
211
218
  warn.classList.add("notready");
212
- warn.replaceChildren(el("span", { textContent: warn.textContent }), ...cmds.map(commandLine));
219
+ warn.replaceChildren(el("span", { textContent: warn.textContent }));
220
+ if (left.includes("write the charter")) {
221
+ const write = el("button", { className: "ghbtn primary", textContent: "Write the charter" });
222
+ write.onclick = () => writeCharter(s);
223
+ warn.append(el("div", { className: "row" }, [write]));
224
+ }
225
+ warn.append(...cmds.map(commandLine));
213
226
  }
214
227
  });
215
228
  d.append(warn);
@@ -225,6 +238,18 @@ export function viewStaff(m, o = {}) {
225
238
 
226
239
  /* ------------------------------- retiring ------------------------------- */
227
240
 
241
+ /** The charter's three ways in, in the dialog: the same ones hiring offers. */
242
+ function writeCharter(s) {
243
+ const host = el("div", { className: "charterpane" }, [el("h2", { textContent: s.name + "'s charter" })]);
244
+ host.append(
245
+ charterModes(s, undefined, () => {
246
+ dismiss();
247
+ refreshAll();
248
+ }),
249
+ );
250
+ present(host);
251
+ }
252
+
228
253
  async function retireForm(host, s, cardStatus) {
229
254
  cardStatus.textContent = "planning…";
230
255
  cardStatus.className = "meta";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanocollective/roster",
3
- "version": "0.1.0-beta.31",
3
+ "version": "0.1.0-beta.32",
4
4
  "description": "An agent-run org, powered by GitHub. Scaffold AI staff members whose brain is a repo.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -194,3 +194,6 @@
194
194
  .homesetupsteps{margin:0 0 4px;padding-left:20px;display:flex;flex-direction:column;gap:10px;font-size:13.5px}
195
195
  .homesetupsteps li > span{display:block;margin-bottom:5px}
196
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}
@@ -60,6 +60,12 @@ const STEP_COMMANDS = {
60
60
  "add the agent credential": () => "credential --apply",
61
61
  "run once": (h) => `run ${h} --apply`,
62
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
+
63
69
  export function stepCommand(what, handle) {
64
70
  return STEP_COMMANDS[what]?.(handle) ?? "";
65
71
  }
@@ -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)
@@ -597,6 +597,9 @@ function team(staff) {
597
597
 
598
598
  /* ------------------------------- setup left ----------------------------- */
599
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
+
600
603
  let readinessAsked = false;
601
604
 
602
605
  /**
@@ -612,33 +615,66 @@ function setupLeft(staff) {
612
615
  if (S.view === "home") render();
613
616
  });
614
617
  }
618
+ // Each step: what, its command, and where to do it here when it is writing rather than wiring.
615
619
  const steps = [];
616
- for (const id of S.data?.unfinished ?? []) if (ORG_STEPS[id]) steps.push(ORG_STEPS[id]);
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
+ }
617
631
  for (const s of notReady()) {
618
632
  for (const what of S.readiness[s.handle]) {
619
- steps.push([`${s.name}: ${what}`, stepCommand(what, 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]);
620
641
  }
621
642
  }
622
643
  if (!steps.length) return null;
644
+ const wiring = steps.filter(([, , here]) => !here).length;
623
645
 
624
646
  const box = el("div", { className: "card homesetup" });
625
- box.append(
626
- el("b", { textContent: "Setup is not finished" }),
627
- el("p", {
628
- className: "sub",
629
- textContent: S.hosted
630
- ? "Nobody runs until these are done. They need your own machine: run each in your workspace, in order."
631
- : "Nobody runs until these are done.",
632
- }),
633
- );
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
+ }
634
664
  const seen = new Set();
635
665
  const list = el("ol", { className: "homesetupsteps" });
636
- for (const [what, cmd] of steps) {
666
+ for (const [what, cmd, here] of steps) {
637
667
  // The credential is the org's, so two staff members missing it is one step.
638
668
  if (cmd && seen.has(cmd)) continue;
639
669
  seen.add(cmd);
640
- const row = el("li", {}, [el("span", { textContent: cap(what) })]);
641
- if (S.hosted && cmd) row.append(commandLine(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));
642
678
  list.append(row);
643
679
  }
644
680
  box.append(list);
@@ -6,7 +6,7 @@
6
6
  * a hosted portal the command for each step, since setting up is only done on your machine. */
7
7
 
8
8
  import { el, toClipboard } from "../dom.js";
9
- import { canRun, ROSTER, sentence, stepCommand, whatsLeft } from "../readiness.js";
9
+ import { canRun, IN_PORTAL, ROSTER, sentence, stepCommand, whatsLeft } from "../readiness.js";
10
10
  import { go } from "../router.js";
11
11
  import { S } from "../state.js";
12
12
 
@@ -36,8 +36,18 @@ export function notReadyNote(s) {
36
36
  };
37
37
  box.append(el("div", { className: "row" }, [finish]));
38
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
+ }
39
48
  const seen = new Set();
40
49
  for (const what of left) {
50
+ if (IN_PORTAL.has(what)) continue;
41
51
  const cmd = stepCommand(what, s.handle);
42
52
  if (!cmd || seen.has(cmd)) continue;
43
53
  seen.add(cmd);
@@ -9,10 +9,10 @@ import { post } from "../api.js";
9
9
  import { askYes, sheet } from "../dialog.js";
10
10
  import { pending } from "../inflight.js";
11
11
  import { ago, el, esc } from "../dom.js";
12
- import { sentence, staffProgress, stepCommand, whatsLeft } from "../readiness.js";
12
+ import { IN_PORTAL, sentence, staffProgress, stepCommand, whatsLeft } from "../readiness.js";
13
13
  import { refreshAll } from "../refresh.js";
14
14
  import { S } from "../state.js";
15
- import { hireFlow, line, rolePicker } from "./hire.js";
15
+ import { charterModes, hireFlow, line, rolePicker } from "./hire.js";
16
16
  import { commandLine } from "./notready.js";
17
17
 
18
18
  /**
@@ -93,6 +93,10 @@ export function viewStaff(m, o = {}) {
93
93
  else pane.replaceChildren();
94
94
  S.staffOpen = null;
95
95
  if (empty && !S.hosted) pick();
96
+ // Home's "Write it here" on a charter lands here with the dialog open.
97
+ const asked = S.writeCharter && S.data.staff.find((s) => s.handle === S.writeCharter);
98
+ S.writeCharter = null;
99
+ if (asked) writeCharter(asked);
96
100
  }
97
101
 
98
102
  // With nobody hired the roles are the page. After that they are a dialog behind Hire someone.
@@ -205,11 +209,20 @@ export function viewStaff(m, o = {}) {
205
209
  warn.textContent =
206
210
  "Not ready to run. " + (p ? `${p.done} of ${p.total} done. ` : "") +
207
211
  "Still to do: " + sentence(left) + ".";
208
- // Hosted has no Finish setting up, so each step comes with what to run instead.
212
+ /* Hosted has no Finish setting up. The charter is writing, which works from here; the
213
+ rest is wiring, which needs your machine, so each of those comes with its command. */
209
214
  if (S.hosted) {
210
- const cmds = [...new Set(left.map((x) => stepCommand(x, s.handle)).filter(Boolean))];
215
+ const cmds = [
216
+ ...new Set(left.filter((x) => !IN_PORTAL.has(x)).map((x) => stepCommand(x, s.handle)).filter(Boolean)),
217
+ ];
211
218
  warn.classList.add("notready");
212
- warn.replaceChildren(el("span", { textContent: warn.textContent }), ...cmds.map(commandLine));
219
+ warn.replaceChildren(el("span", { textContent: warn.textContent }));
220
+ if (left.includes("write the charter")) {
221
+ const write = el("button", { className: "ghbtn primary", textContent: "Write the charter" });
222
+ write.onclick = () => writeCharter(s);
223
+ warn.append(el("div", { className: "row" }, [write]));
224
+ }
225
+ warn.append(...cmds.map(commandLine));
213
226
  }
214
227
  });
215
228
  d.append(warn);
@@ -225,6 +238,18 @@ export function viewStaff(m, o = {}) {
225
238
 
226
239
  /* ------------------------------- retiring ------------------------------- */
227
240
 
241
+ /** The charter's three ways in, in the dialog: the same ones hiring offers. */
242
+ function writeCharter(s) {
243
+ const host = el("div", { className: "charterpane" }, [el("h2", { textContent: s.name + "'s charter" })]);
244
+ host.append(
245
+ charterModes(s, undefined, () => {
246
+ dismiss();
247
+ refreshAll();
248
+ }),
249
+ );
250
+ present(host);
251
+ }
252
+
228
253
  async function retireForm(host, s, cardStatus) {
229
254
  cardStatus.textContent = "planning…";
230
255
  cardStatus.className = "meta";