create-egregore 0.19.29 → 0.19.30

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // egregore-launcher-version: 0.19.29
2
+ // egregore-launcher-version: 0.19.30
3
3
  //
4
4
  // egregore — launch and browse Egregore instances from your terminal.
5
5
  // Installed by create-egregore. Reads ~/.egregore/instances.json.
@@ -33,7 +33,7 @@ const crypto = require("node:crypto");
33
33
  const { spawnSync, spawn } = require("node:child_process");
34
34
  const readline = require("node:readline");
35
35
 
36
- const VERSION = "0.19.29";
36
+ const VERSION = "0.19.30";
37
37
  const REGISTRY = path.join(os.homedir(), ".egregore", "instances.json");
38
38
  const DEFAULT_FILE = path.join(os.homedir(), ".egregore", "default");
39
39
  const UPDATE_CACHE_FILE = path.join(os.homedir(), ".egregore", "update-check.json");
@@ -317,8 +317,12 @@ function writeDefault(slug) {
317
317
  }
318
318
 
319
319
  function resolveBySlug(registry, query) {
320
- // Exact slug → exact name → case-insensitive substring (slug ∪ name)
321
- let hit = registry.find((e) => e.slug === query);
320
+ // Exact path → exact slug → exact name → case-insensitive substring (slug ∪ name).
321
+ // Path first: slugs are repo dir names and can collide across orgs; the
322
+ // installer targets the instance it just created by absolute path.
323
+ let hit = registry.find((e) => e.path === query);
324
+ if (hit) return hit;
325
+ hit = registry.find((e) => e.slug === query);
322
326
  if (hit) return hit;
323
327
  hit = registry.find((e) => e.name === query);
324
328
  if (hit) return hit;
@@ -1407,9 +1411,11 @@ function backfillSummaryLines(summary) {
1407
1411
  }
1408
1412
 
1409
1413
  async function cmdConnect(args) {
1414
+ const fresh = args.includes("--fresh");
1415
+ const positional = args.filter((a) => !String(a).startsWith("--"));
1410
1416
  const registry = readRegistry();
1411
1417
  if (registry.length === 0) die("no egregores installed yet.\n run: npx -y create-egregore@latest");
1412
- const inst = resolveInviteInstance(registry, args[0] || "");
1418
+ const inst = resolveInviteInstance(registry, positional[0] || "");
1413
1419
  if (!inst) {
1414
1420
  die("multiple egregores installed; choose one:\n egregore connect <slug>\n run: egregore ls");
1415
1421
  }
@@ -1466,6 +1472,19 @@ async function cmdConnect(args) {
1466
1472
  !intentId ||
1467
1473
  !resumable
1468
1474
  ) {
1475
+ // Local installs may have skipped platform registration (DO_NOT_TRACK
1476
+ // gates it as telemetry). Connect requires it functionally, and choosing
1477
+ // Connect is the consent — register on demand. Idempotent for members of
1478
+ // already-registered orgs; a 409 (registered by someone else) falls
1479
+ // through to the billing-actor check on intent creation.
1480
+ const registration = await connectedApiRequest(githubToken, "POST", "/api/org/register", {
1481
+ org_name: cfg.org_name || inst.slug,
1482
+ github_org: cfg.github_org || "",
1483
+ slug: cfg.slug || inst.slug,
1484
+ });
1485
+ if (registration.status !== 200 && registration.status !== 409) {
1486
+ die(`could not register this Egregore with the platform: ${connectError(registration, `HTTP ${registration.status}`)}`);
1487
+ }
1469
1488
  console.log(` [1/5] ${DIM}Creating connection intent…${RESET}`);
1470
1489
  const checkout = await connectedApiRequest(
1471
1490
  githubToken,
@@ -1479,6 +1498,7 @@ async function cmdConnect(args) {
1479
1498
  mode: cfg.mode || "local",
1480
1499
  repo_name: cfg.repo_name || "",
1481
1500
  managed_repo_count: Array.isArray(cfg.repos) ? cfg.repos.length : 0,
1501
+ fresh,
1482
1502
  },
1483
1503
  },
1484
1504
  { "X-Idempotency-Key": `cli:${inst.slug}:${crypto.randomUUID()}` },
@@ -1570,24 +1590,30 @@ async function cmdConnect(args) {
1570
1590
  });
1571
1591
  console.log(` [4/5] ${GREEN}✓${RESET} Connected credential and graph node`);
1572
1592
 
1573
- const syncScript = path.join(inst.path, "bin", "sync-graph.sh");
1574
- if (!fs.existsSync(syncScript)) {
1575
- die("bin/sync-graph.sh is missing. Update the installed Egregore version, then run egregore connect again.");
1576
- }
1577
- console.log(` [5/5] ${CYAN}◦${RESET} Projecting existing memory into the graph…`);
1578
- console.log(` ${DIM}Scanning sessions, artifacts, quests, and ingest history${RESET}`);
1579
- const sync = spawnSync("bash", [syncScript], {
1580
- cwd: inst.path,
1581
- encoding: "utf-8",
1582
- stdio: "pipe",
1583
- timeout: 10 * 60 * 1000,
1584
- });
1585
- if (sync.status !== 0) {
1586
- const detail = (sync.stderr || sync.stdout || "graph replay failed").trim();
1587
- die(`Connected is configured, but graph replay did not finish.\n ${detail}\n Run egregore connect ${inst.slug} to retry; existing data is unchanged.`);
1588
- }
1589
1593
  let backfillSummary = { replayed: true };
1590
- try { backfillSummary = JSON.parse((sync.stdout || "").trim()); } catch {}
1594
+ if (fresh) {
1595
+ // Fresh install — no existing memory to project; skip the replay entirely.
1596
+ console.log(` [5/5] ${GREEN}✓${RESET} Fresh instance — nothing to project yet`);
1597
+ backfillSummary = { fresh: true, replayed: false };
1598
+ } else {
1599
+ const syncScript = path.join(inst.path, "bin", "sync-graph.sh");
1600
+ if (!fs.existsSync(syncScript)) {
1601
+ die("bin/sync-graph.sh is missing. Update the installed Egregore version, then run egregore connect again.");
1602
+ }
1603
+ console.log(` [5/5] ${CYAN}◦${RESET} Projecting existing memory into the graph…`);
1604
+ console.log(` ${DIM}Scanning sessions, artifacts, quests, and ingest history${RESET}`);
1605
+ const sync = spawnSync("bash", [syncScript], {
1606
+ cwd: inst.path,
1607
+ encoding: "utf-8",
1608
+ stdio: "pipe",
1609
+ timeout: 10 * 60 * 1000,
1610
+ });
1611
+ if (sync.status !== 0) {
1612
+ const detail = (sync.stderr || sync.stdout || "graph replay failed").trim();
1613
+ die(`Connected is configured, but graph replay did not finish.\n ${detail}\n Run egregore connect ${inst.slug} to retry; existing data is unchanged.`);
1614
+ }
1615
+ try { backfillSummary = JSON.parse((sync.stdout || "").trim()); } catch {}
1616
+ }
1591
1617
 
1592
1618
  let complete;
1593
1619
  for (let attempt = 0; attempt < 3; attempt += 1) {
@@ -1608,9 +1634,11 @@ async function cmdConnect(args) {
1608
1634
  connected_at: new Date().toISOString(),
1609
1635
  backfill_summary: backfillSummary,
1610
1636
  });
1611
- console.log(` [5/5] ${GREEN}✓${RESET} Existing memory projected into the graph`);
1612
- for (const line of backfillSummaryLines(backfillSummary)) {
1613
- console.log(` ${DIM}${line}${RESET}`);
1637
+ if (!fresh) {
1638
+ console.log(` [5/5] ${GREEN}✓${RESET} Existing memory projected into the graph`);
1639
+ for (const line of backfillSummaryLines(backfillSummary)) {
1640
+ console.log(` ${DIM}${line}${RESET}`);
1641
+ }
1614
1642
  }
1615
1643
  const runtimeRefresh = spawnSync(
1616
1644
  "npx",
package/lib/local.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  const fs = require("node:fs");
7
7
  const path = require("node:path");
8
- const { execFileSync } = require("node:child_process");
8
+ const { execFileSync, spawnSync } = require("node:child_process");
9
9
  const {
10
10
  GH_INSTALL_URL,
11
11
  ghCliExists,
@@ -1612,9 +1612,43 @@ async function localFounderFlow(ui, ctx = {}) {
1612
1612
  ]);
1613
1613
  }
1614
1614
 
1615
+ await offerConnectUpgrade(egregoreDir, ui, ctx);
1615
1616
  await launchOrInstruct(egregoreDir, alias, ui, ctx);
1616
1617
  }
1617
1618
 
1619
+ // ── End-of-setup Connect choice ────────────────────────────────────
1620
+ //
1621
+ // Same activation the launcher's `c` key runs — delegated to the launcher so
1622
+ // there is exactly one connect flow. `--fresh` skips graph backfill: a brand
1623
+ // new instance has no memory to project. Declining changes nothing; the
1624
+ // launcher offers connect anytime.
1625
+
1626
+ const LAUNCHER_JS = path.join(__dirname, "..", "assets", "egregore-launcher.js");
1627
+
1628
+ async function offerConnectUpgrade(egregoreDir, ui, ctx = {}) {
1629
+ if (ctx.noAutolaunch || !ui.canInteract()) return;
1630
+ console.log("");
1631
+ const choice = await ui.choose("How should this Egregore run?", [
1632
+ {
1633
+ label: "Local",
1634
+ description: "free · Markdown + Git · connect later anytime with egregore connect",
1635
+ value: "local",
1636
+ },
1637
+ {
1638
+ label: "Egregore Connect",
1639
+ description: "€500/month · shared graph + live notifications · Stripe checkout in your browser",
1640
+ value: "connect",
1641
+ },
1642
+ ]);
1643
+ if (!choice || choice.value !== "connect") return;
1644
+ const result = spawnSync(process.execPath, [LAUNCHER_JS, "connect", egregoreDir, "--fresh"], {
1645
+ stdio: "inherit",
1646
+ });
1647
+ if (result.status !== 0) {
1648
+ ui.warn("Connect didn't finish — your Egregore stays local. Run `egregore connect` to pick it back up.");
1649
+ }
1650
+ }
1651
+
1618
1652
  // ── Flow 2: Join (local mode) ──────────────────────────────────────
1619
1653
 
1620
1654
  // Accepts: "org", "org/repo", "https://github.com/org/repo(.git)",
@@ -1817,4 +1851,4 @@ async function localJoinFlow(orgArg, ui, ctx = {}) {
1817
1851
  }
1818
1852
  }
1819
1853
 
1820
- module.exports = { localFounderFlow, localJoinFlow, parseJoinTarget, addCollaborator, getUser, repoExists, createRepo, waitForRepo, retryAsync, ghFallbackNote };
1854
+ module.exports = { localFounderFlow, localJoinFlow, parseJoinTarget, addCollaborator, getUser, repoExists, createRepo, waitForRepo, retryAsync, ghFallbackNote, offerConnectUpgrade };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-egregore",
3
- "version": "0.19.29",
3
+ "version": "0.19.30",
4
4
  "description": "Set up Egregore for your team in one command — installs the egregore launcher and your choice of Claude Code, Codex, or Pi.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -12,7 +12,7 @@
12
12
  "scripts": {
13
13
  "build:runtime": "node ../../bin/capability-distribution.mjs generate-skill-view --root ../.. && node scripts/build-runtime-bundle.mjs && node scripts/build-pi-runtime-bundle.mjs && node ../../api/scripts/build-connect-runtime-pack.mjs",
14
14
  "build:pi-runtime": "node scripts/build-pi-runtime-bundle.mjs",
15
- "test": "node ../../bin/capability-distribution.mjs validate --root ../.. && node scripts/build-runtime-bundle.mjs --check && node scripts/build-pi-runtime-bundle.mjs --check && node ../../api/scripts/build-connect-runtime-pack.mjs --check && node --test test/capability-distribution.test.js test/connect-runtime.test.js test/context.test.js test/path-lookup.test.js test/nixos-portability.test.js test/parse-join-target.test.js test/skip-repos.test.js test/install-origin-guard.test.js test/onboarding-shortcircuit.test.js test/welcome-screen.test.js test/runtime-selection.test.js test/command-generation.test.js test/auth-gh.test.js test/gauntlet-fixes.test.js test/codex-runtime.test.js test/pi-runtime.test.js test/pi-product-workflows.test.js test/installer-runtime-source.test.js test/scroll-repro.test.js test/launcher-refocus-redraw.test.js test/multiselect-remote-search.test.js test/back-navigation.test.js test/manifest-form.test.js test/launcher-delete.test.js test/launcher-connect.test.js test/launcher-connected-status.test.js test/launcher-permissions.test.js test/launcher-update.test.js test/connected-config.test.js",
15
+ "test": "node ../../bin/capability-distribution.mjs validate --root ../.. && node scripts/build-runtime-bundle.mjs --check && node scripts/build-pi-runtime-bundle.mjs --check && node ../../api/scripts/build-connect-runtime-pack.mjs --check && node --test test/capability-distribution.test.js test/connect-runtime.test.js test/context.test.js test/path-lookup.test.js test/nixos-portability.test.js test/parse-join-target.test.js test/skip-repos.test.js test/install-origin-guard.test.js test/onboarding-shortcircuit.test.js test/welcome-screen.test.js test/runtime-selection.test.js test/command-generation.test.js test/auth-gh.test.js test/gauntlet-fixes.test.js test/codex-runtime.test.js test/pi-runtime.test.js test/pi-product-workflows.test.js test/installer-runtime-source.test.js test/scroll-repro.test.js test/launcher-refocus-redraw.test.js test/multiselect-remote-search.test.js test/back-navigation.test.js test/manifest-form.test.js test/launcher-delete.test.js test/launcher-connect.test.js test/installer-connect-choice.test.js test/launcher-connected-status.test.js test/launcher-permissions.test.js test/launcher-update.test.js test/connected-config.test.js",
16
16
  "test:e2e": "node --test test/e2e-local.test.js",
17
17
  "test:all": "node scripts/build-runtime-bundle.mjs --check && node scripts/build-pi-runtime-bundle.mjs --check && node --test test/"
18
18
  },