create-egregore 0.7.1 → 0.8.1

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/lib/local.js CHANGED
@@ -197,7 +197,7 @@ async function localFounderFlow(ui) {
197
197
  for (const o of orgs) {
198
198
  orgChoices.push({ label: o.login, description: "Organization" });
199
199
  }
200
- const orgChoice = await ui.choose("Where do you want to set up Egregore?", orgChoices);
200
+ const orgChoice = await ui.choose("Where do you want to set up Egregore?", orgChoices, "Don't see your org? Grant access on the GitHub authorization page and re-run.");
201
201
  githubOrg = orgChoice.label;
202
202
  isOrg = githubOrg !== user.login;
203
203
  }
@@ -346,6 +346,7 @@ async function localFounderFlow(ui) {
346
346
 
347
347
  // 8. Write egregore.json to remote repo (so joiners can read it)
348
348
  const egreConfig = {
349
+ mode: "local",
349
350
  org_name: orgName,
350
351
  github_org: githubOrg,
351
352
  memory_repo: `https://github.com/${githubOrg}/${memoryRepoName}.git`,
@@ -462,34 +463,7 @@ async function localFounderFlow(ui) {
462
463
  registerInstance(repoName, orgName, egregoreDir);
463
464
  const alias = await installShellAlias(egregoreDir, ui);
464
465
 
465
- // 18. Telegram group setup (optional)
466
- console.log("");
467
- ui.info("Want notifications? Set up a Telegram group:");
468
- ui.info("");
469
- ui.info(` 1. Create a Telegram group for your team`);
470
- ui.info(` 2. Add the bot: ${ui.cyan("https://t.me/egregore_bot")}`);
471
- ui.info(` 3. Paste the group invite link below`);
472
- console.log("");
473
- const telegramLink = await ui.prompt("Group invite link (Enter to skip):");
474
- if (telegramLink) {
475
- egreConfig.telegram_group_link = telegramLink;
476
- // Update local egregore.json
477
- fs.writeFileSync(path.join(egregoreDir, "egregore.json"), JSON.stringify(egreConfig, null, 2) + "\n");
478
- // Push to remote so joiners see it
479
- try {
480
- await putFileContent(
481
- githubToken,
482
- githubOrg,
483
- repoName,
484
- "egregore.json",
485
- JSON.stringify(egreConfig, null, 2) + "\n",
486
- "Add Telegram group link",
487
- );
488
- } catch {}
489
- ui.success("Telegram group link saved");
490
- }
491
-
492
- // 19. Optional invite
466
+ // 18. Optional invite
493
467
  console.log("");
494
468
  const invUsername = await ui.prompt("Invite a teammate? Enter their GitHub username (or press Enter to skip):");
495
469
  if (invUsername) {
@@ -525,7 +499,7 @@ async function localFounderFlow(ui) {
525
499
  invSpin.stop(`Invited ${invUsername}`);
526
500
  console.log("");
527
501
  ui.info(`Tell them to run:`);
528
- ui.info(` ${ui.bold(`npx create-egregore@latest join ${githubOrg}/${repoName}`)}`);
502
+ ui.commandBox("command", `npx create-egregore@latest join ${githubOrg}/${repoName}`);
529
503
  } catch (err) {
530
504
  invSpin.fail(`Could not invite ${invUsername}: ${err.message}`);
531
505
  }
@@ -687,14 +661,7 @@ async function localJoinFlow(orgArg, ui) {
687
661
  }
688
662
  }
689
663
 
690
- // 12. Show Telegram group link if available
691
- if (config.telegram_group_link) {
692
- console.log("");
693
- ui.info("Join the team's Telegram group for notifications:");
694
- ui.info(` ${ui.cyan(config.telegram_group_link)}`);
695
- }
696
-
697
- // 13. Check for welcome note
664
+ // 12. Check for welcome note
698
665
  const welcomeFile = path.join(memoryDir, "people", `${user.login}.md`);
699
666
  if (fs.existsSync(welcomeFile)) {
700
667
  try {
package/lib/setup.js CHANGED
@@ -212,6 +212,18 @@ async function install(data, ui, targetDir) {
212
212
  }
213
213
  fs.writeFileSync(statePath, JSON.stringify(state, null, 2) + "\n");
214
214
 
215
+ // 4c. Ensure mode is set in egregore.json (connected mode for API-based setup)
216
+ const configPath = path.join(egregoreDir, "egregore.json");
217
+ if (fs.existsSync(configPath)) {
218
+ try {
219
+ const config = JSON.parse(fs.readFileSync(configPath, "utf-8"));
220
+ if (!config.mode) {
221
+ config.mode = "connected";
222
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
223
+ }
224
+ } catch {}
225
+ }
226
+
215
227
  // 5. Register instance + shell alias
216
228
  ui.step(5, totalSteps, "Registering instance...");
217
229
  registerInstance(forkDirName, org_name, egregoreDir);
package/lib/ui.js CHANGED
@@ -93,12 +93,13 @@ function prompt(question) {
93
93
  }
94
94
 
95
95
  // Prompt with numbered choices
96
- async function choose(question, options) {
96
+ async function choose(question, options, hint) {
97
97
  console.log(`\n ${question}\n`);
98
98
  for (let i = 0; i < options.length; i++) {
99
99
  const { label, description } = options[i];
100
100
  console.log(` ${BOLD}${i + 1}.${RESET} ${label}${description ? ` ${DIM}— ${description}${RESET}` : ""}`);
101
101
  }
102
+ if (hint) console.log(`\n ${DIM}${hint}${RESET}`);
102
103
  console.log();
103
104
 
104
105
  while (true) {
@@ -137,7 +138,21 @@ async function multiSelect(question, options) {
137
138
  return selected;
138
139
  }
139
140
 
141
+ function commandBox(label, cmd) {
142
+ const inner = ` ${cmd} `;
143
+ const width = Math.max(inner.length, label.length + 5);
144
+ const pad = (s) => s + " ".repeat(Math.max(0, width - s.length));
145
+ const top = `┌─ ${label} ${"─".repeat(Math.max(0, width - label.length - 4))}┐`;
146
+ const blank = `│${" ".repeat(width)}│`;
147
+ const bot = `└${"─".repeat(width)}┘`;
148
+ console.log(`\n ${DIM}${top}${RESET}`);
149
+ console.log(` ${DIM}${blank}${RESET}`);
150
+ console.log(` ${DIM}│${RESET}${BOLD}${pad(inner)}${RESET}${DIM}│${RESET}`);
151
+ console.log(` ${DIM}${blank}${RESET}`);
152
+ console.log(` ${DIM}${bot}${RESET}\n`);
153
+ }
154
+
140
155
  module.exports = {
141
156
  banner, info, success, warn, error, step, dim, bold, cyan,
142
- spinner, prompt, choose, multiSelect,
157
+ spinner, prompt, choose, multiSelect, commandBox,
143
158
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-egregore",
3
- "version": "0.7.1",
3
+ "version": "0.8.1",
4
4
  "description": "Set up Egregore for your team in one command",
5
5
  "license": "MIT",
6
6
  "bin": {