create-egregore 0.19.28 → 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.28
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.28";
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;
@@ -670,27 +674,6 @@ async function renderCodexStartupCard(egregoreDir) {
670
674
  return false;
671
675
  }
672
676
 
673
- function renderClaudeGreetingCard(egregoreDir) {
674
- // Claude Code counterpart of renderCodexStartupCard: prints the card the
675
- // previous boot cached (bin/greeting-card.sh) instead of re-rendering —
676
- // must stay instant. Never fatal: a miss (first boot, stale cache, old
677
- // core) just means the session renders the full greeting itself.
678
- const script = path.join(egregoreDir, "bin", "greeting-card.sh");
679
- if (!fs.existsSync(script)) return false;
680
- try {
681
- const result = spawnSync("bash", [script], {
682
- cwd: egregoreDir,
683
- encoding: "utf8",
684
- stdio: ["ignore", "pipe", "pipe"],
685
- });
686
- if (result.status === 0 && result.stdout) {
687
- process.stdout.write(result.stdout);
688
- return true;
689
- }
690
- } catch {}
691
- return false;
692
- }
693
-
694
677
  function codexSupportMessage(egregoreDir) {
695
678
  return [
696
679
  "Codex harness support is missing from this Egregore checkout.",
@@ -823,10 +806,9 @@ async function launch(inst, runtimeOverride) {
823
806
  } else if (runtime === "pi") {
824
807
  if (!hasPiCoreSupport(inst.path)) die(piSupportMessage(inst.path));
825
808
  }
826
- // Print the cached greeting card for Claude Code (instant; at most one
827
- // session stale) and tell the session to skip the in-chat re-render.
828
- const claudeCardShown =
829
- runtime === "claude-code" && renderClaudeGreetingCard(inst.path);
809
+ // Claude Code renders the greeting in-chat — no pre-launch card. Claude Code
810
+ // ≥2.1.89 boots into the alternate screen buffer, which hides anything
811
+ // printed here; the launcher-card fast path is parked in PR #1493.
830
812
  // Replace the current process with the selected assistant in the instance dir.
831
813
  // spawn + detached + exit-on-exit replicates exec() in Node.
832
814
  const launchEnv = {
@@ -834,7 +816,6 @@ async function launch(inst, runtimeOverride) {
834
816
  EGREGORE_RUNTIME: runtime,
835
817
  EGREGORE_CODEX_TRUSTED: runtime === "codex" ? "1" : process.env.EGREGORE_CODEX_TRUSTED,
836
818
  };
837
- if (claudeCardShown) launchEnv.EGREGORE_CARD_SHOWN = "1";
838
819
  const child = spawn(binary, runtimeLaunchArgs(runtime, inst.path), {
839
820
  cwd: inst.path,
840
821
  stdio: "inherit",
@@ -1430,9 +1411,11 @@ function backfillSummaryLines(summary) {
1430
1411
  }
1431
1412
 
1432
1413
  async function cmdConnect(args) {
1414
+ const fresh = args.includes("--fresh");
1415
+ const positional = args.filter((a) => !String(a).startsWith("--"));
1433
1416
  const registry = readRegistry();
1434
1417
  if (registry.length === 0) die("no egregores installed yet.\n run: npx -y create-egregore@latest");
1435
- const inst = resolveInviteInstance(registry, args[0] || "");
1418
+ const inst = resolveInviteInstance(registry, positional[0] || "");
1436
1419
  if (!inst) {
1437
1420
  die("multiple egregores installed; choose one:\n egregore connect <slug>\n run: egregore ls");
1438
1421
  }
@@ -1489,6 +1472,19 @@ async function cmdConnect(args) {
1489
1472
  !intentId ||
1490
1473
  !resumable
1491
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
+ }
1492
1488
  console.log(` [1/5] ${DIM}Creating connection intent…${RESET}`);
1493
1489
  const checkout = await connectedApiRequest(
1494
1490
  githubToken,
@@ -1502,6 +1498,7 @@ async function cmdConnect(args) {
1502
1498
  mode: cfg.mode || "local",
1503
1499
  repo_name: cfg.repo_name || "",
1504
1500
  managed_repo_count: Array.isArray(cfg.repos) ? cfg.repos.length : 0,
1501
+ fresh,
1505
1502
  },
1506
1503
  },
1507
1504
  { "X-Idempotency-Key": `cli:${inst.slug}:${crypto.randomUUID()}` },
@@ -1593,24 +1590,30 @@ async function cmdConnect(args) {
1593
1590
  });
1594
1591
  console.log(` [4/5] ${GREEN}✓${RESET} Connected credential and graph node`);
1595
1592
 
1596
- const syncScript = path.join(inst.path, "bin", "sync-graph.sh");
1597
- if (!fs.existsSync(syncScript)) {
1598
- die("bin/sync-graph.sh is missing. Update the installed Egregore version, then run egregore connect again.");
1599
- }
1600
- console.log(` [5/5] ${CYAN}◦${RESET} Projecting existing memory into the graph…`);
1601
- console.log(` ${DIM}Scanning sessions, artifacts, quests, and ingest history${RESET}`);
1602
- const sync = spawnSync("bash", [syncScript], {
1603
- cwd: inst.path,
1604
- encoding: "utf-8",
1605
- stdio: "pipe",
1606
- timeout: 10 * 60 * 1000,
1607
- });
1608
- if (sync.status !== 0) {
1609
- const detail = (sync.stderr || sync.stdout || "graph replay failed").trim();
1610
- die(`Connected is configured, but graph replay did not finish.\n ${detail}\n Run egregore connect ${inst.slug} to retry; existing data is unchanged.`);
1611
- }
1612
1593
  let backfillSummary = { replayed: true };
1613
- 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
+ }
1614
1617
 
1615
1618
  let complete;
1616
1619
  for (let attempt = 0; attempt < 3; attempt += 1) {
@@ -1631,9 +1634,11 @@ async function cmdConnect(args) {
1631
1634
  connected_at: new Date().toISOString(),
1632
1635
  backfill_summary: backfillSummary,
1633
1636
  });
1634
- console.log(` [5/5] ${GREEN}✓${RESET} Existing memory projected into the graph`);
1635
- for (const line of backfillSummaryLines(backfillSummary)) {
1636
- 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
+ }
1637
1642
  }
1638
1643
  const runtimeRefresh = spawnSync(
1639
1644
  "npx",
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # egregore-launcher-version: 0.4.11
2
+ # egregore-launcher-version: 0.4.12
3
3
  # egregore — launch an Egregore instance in Claude Code.
4
4
  # Reads ~/.egregore/instances.json for the registry of installed egregores.
5
5
  #
@@ -22,7 +22,7 @@
22
22
 
23
23
  set -u
24
24
 
25
- VERSION="0.4.11"
25
+ VERSION="0.4.12"
26
26
  REGISTRY="${HOME}/.egregore/instances.json"
27
27
  DEFAULT_FILE="${HOME}/.egregore/default"
28
28
 
@@ -97,14 +97,9 @@ launch() {
97
97
  if [ -d "$target_path/memory" ]; then
98
98
  claude_args+=("--add-dir" "$target_path/memory")
99
99
  fi
100
- # Print the cached greeting card (instant; at most one session stale) and
101
- # tell the session to skip the in-chat re-render. greeting-card.sh exits
102
- # non-zero silently on a miss (first boot, stale cache, old core) — the
103
- # session then renders the full greeting itself, exactly as before.
104
- if [ -f "$target_path/bin/greeting-card.sh" ] \
105
- && bash "$target_path/bin/greeting-card.sh" 2>/dev/null; then
106
- export EGREGORE_CARD_SHOWN=1
107
- fi
100
+ # The greeting renders in-chat — no pre-launch card. Claude Code ≥2.1.89
101
+ # boots into the alternate screen buffer, which hides anything printed
102
+ # here; the launcher-card fast path is parked in PR #1493.
108
103
  exec claude "${claude_args[@]}"
109
104
  }
110
105
 
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.28",
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
  },
@@ -495,11 +495,7 @@ if [ "$FIRST_SESSION" = "true" ]; then
495
495
  echo ""
496
496
  echo " Welcome! This is your first session."
497
497
  echo ""
498
- if [ "${EGREGORE_CARD_SHOWN:-}" = "1" ]; then
499
- echo "IMPORTANT: The greeting card is already on screen (rendered by the launcher) — do NOT re-render it. Reply with the greeting-reply block contents, then ask the user if they'd like a quick onboarding tour (run /onboarding), or if they want to jump straight in."
500
- else
501
- echo "IMPORTANT: Display the above greeting exactly as-is (ASCII art + ornamented status). Then ask the user if they'd like a quick onboarding tour (run /onboarding), or if they want to jump straight in."
502
- fi
498
+ echo "IMPORTANT: Display the above greeting exactly as-is (ASCII art + ornamented status). Then ask the user if they'd like a quick onboarding tour (run /onboarding), or if they want to jump straight in."
503
499
  # Clear the flag so it only shows once
504
500
  jq '.first_session = false' "$STATE_FILE" > "$STATE_FILE.tmp" && mv "$STATE_FILE.tmp" "$STATE_FILE"
505
501
  else
@@ -514,11 +510,7 @@ else
514
510
  fi
515
511
 
516
512
  echo ""
517
- if [ "${EGREGORE_CARD_SHOWN:-}" = "1" ]; then
518
- echo "IMPORTANT: The greeting card is already on screen (rendered by the launcher) — do NOT re-render it. Reply with the greeting-reply block contents exactly as-is (it may be empty), then ask: What are you working on?"
519
- else
520
- echo "IMPORTANT: Display the above greeting to the user exactly as-is (preserve the ASCII art formatting and ornamented status) on their first message. Then ask: What are you working on?"
521
- fi
513
+ echo "IMPORTANT: Display the above greeting to the user exactly as-is (preserve the ASCII art formatting and ornamented status) on their first message. Then ask: What are you working on?"
522
514
  echo ""
523
515
  echo "BRANCH RULE: When the user responds with what they're working on, your FIRST action is to create a working branch: git fetch origin develop --quiet && git checkout -b dev/{author}/{topic-slug} origin/develop. Do this BEFORE any other work. Derive the topic slug from their description. If they ask a pure question with no work intent, skip branching."
524
516
  fi
@@ -495,11 +495,7 @@ if [ "$FIRST_SESSION" = "true" ]; then
495
495
  echo ""
496
496
  echo " Welcome! This is your first session."
497
497
  echo ""
498
- if [ "${EGREGORE_CARD_SHOWN:-}" = "1" ]; then
499
- echo "IMPORTANT: The greeting card is already on screen (rendered by the launcher) — do NOT re-render it. Reply with the greeting-reply block contents, then ask the user if they'd like a quick onboarding tour (run /onboarding), or if they want to jump straight in."
500
- else
501
- echo "IMPORTANT: Display the above greeting exactly as-is (ASCII art + ornamented status). Then ask the user if they'd like a quick onboarding tour (run /onboarding), or if they want to jump straight in."
502
- fi
498
+ echo "IMPORTANT: Display the above greeting exactly as-is (ASCII art + ornamented status). Then ask the user if they'd like a quick onboarding tour (run /onboarding), or if they want to jump straight in."
503
499
  # Clear the flag so it only shows once
504
500
  jq '.first_session = false' "$STATE_FILE" > "$STATE_FILE.tmp" && mv "$STATE_FILE.tmp" "$STATE_FILE"
505
501
  else
@@ -514,11 +510,7 @@ else
514
510
  fi
515
511
 
516
512
  echo ""
517
- if [ "${EGREGORE_CARD_SHOWN:-}" = "1" ]; then
518
- echo "IMPORTANT: The greeting card is already on screen (rendered by the launcher) — do NOT re-render it. Reply with the greeting-reply block contents exactly as-is (it may be empty), then ask: What are you working on?"
519
- else
520
- echo "IMPORTANT: Display the above greeting to the user exactly as-is (preserve the ASCII art formatting and ornamented status) on their first message. Then ask: What are you working on?"
521
- fi
513
+ echo "IMPORTANT: Display the above greeting to the user exactly as-is (preserve the ASCII art formatting and ornamented status) on their first message. Then ask: What are you working on?"
522
514
  echo ""
523
515
  echo "BRANCH RULE: When the user responds with what they're working on, your FIRST action is to create a working branch: git fetch origin develop --quiet && git checkout -b dev/{author}/{topic-slug} origin/develop. Do this BEFORE any other work. Derive the topic slug from their description. If they ask a pure question with no work intent, skip branching."
524
516
  fi