create-egregore 0.17.2 → 0.17.4
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/api.js +1 -1
- package/lib/local.js +32 -18
- package/lib/setup.js +15 -1
- package/package.json +7 -2
package/lib/api.js
CHANGED
|
@@ -88,7 +88,7 @@ class EgregoreAPI {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
async joinOrg(githubToken, { github_org, repo_name = "egregore
|
|
91
|
+
async joinOrg(githubToken, { github_org, repo_name = "egregore" }) {
|
|
92
92
|
return request("POST", `${this.base}/api/org/join`, {
|
|
93
93
|
headers: { Authorization: `Bearer ${githubToken}` },
|
|
94
94
|
body: { github_org, repo_name },
|
package/lib/local.js
CHANGED
|
@@ -86,9 +86,7 @@ async function findEgregoreRepo(token, orgLogin, explicitRepo) {
|
|
|
86
86
|
if (explicitRepo) {
|
|
87
87
|
if (await repoExists(token, orgLogin, explicitRepo)) return explicitRepo;
|
|
88
88
|
} else {
|
|
89
|
-
|
|
90
|
-
if (await repoExists(token, orgLogin, candidate)) return candidate;
|
|
91
|
-
}
|
|
89
|
+
if (await repoExists(token, orgLogin, "egregore")) return "egregore";
|
|
92
90
|
}
|
|
93
91
|
return null;
|
|
94
92
|
}
|
|
@@ -134,7 +132,7 @@ async function listOrgRepos(token, owner, isOrg) {
|
|
|
134
132
|
}
|
|
135
133
|
|
|
136
134
|
return allRepos
|
|
137
|
-
.filter((r) => !r.archived && r.name !== "egregore" &&
|
|
135
|
+
.filter((r) => !r.archived && r.name !== "egregore" && !r.name.endsWith("-memory"))
|
|
138
136
|
.map((r) => ({ name: r.name, language: r.language || "", description: r.description || "" }));
|
|
139
137
|
}
|
|
140
138
|
|
|
@@ -414,7 +412,7 @@ async function localFounderFlow(ui, ctx = {}) {
|
|
|
414
412
|
s1.stop(`${githubOrg}/${repoName} already has Egregore set up`);
|
|
415
413
|
console.log("");
|
|
416
414
|
ui.info("To join it:");
|
|
417
|
-
ui.info(` ${ui.bold(`npx
|
|
415
|
+
ui.info(` ${ui.bold(`npx -y egregore-init@latest join ${githubOrg}/${repoName}`)}`);
|
|
418
416
|
console.log("");
|
|
419
417
|
ui.info("To set up a different one, choose a different team name.");
|
|
420
418
|
process.exit(0);
|
|
@@ -669,7 +667,7 @@ async function localFounderFlow(ui, ctx = {}) {
|
|
|
669
667
|
invSpin.stop(`Invited ${invUsername}`);
|
|
670
668
|
console.log("");
|
|
671
669
|
ui.info(`Tell them to run:`);
|
|
672
|
-
ui.commandBox("command", `npx
|
|
670
|
+
ui.commandBox("command", `npx -y egregore-init@latest join ${githubOrg}/${repoName}`);
|
|
673
671
|
} catch (err) {
|
|
674
672
|
invSpin.fail(`Could not invite ${invUsername}: ${err.message}`);
|
|
675
673
|
}
|
|
@@ -693,14 +691,34 @@ async function localFounderFlow(ui, ctx = {}) {
|
|
|
693
691
|
|
|
694
692
|
// ── Flow 2: Join (local mode) ──────────────────────────────────────
|
|
695
693
|
|
|
694
|
+
// Accepts: "org", "org/repo", "https://github.com/org/repo(.git)",
|
|
695
|
+
// "git@github.com:org/repo(.git)". Returns { orgLogin, explicitRepo }.
|
|
696
|
+
function parseJoinTarget(arg) {
|
|
697
|
+
if (!arg) return { orgLogin: null, explicitRepo: null };
|
|
698
|
+
let raw = String(arg).trim();
|
|
699
|
+
|
|
700
|
+
const ssh = raw.match(/^git@[^:]+:(.+)$/);
|
|
701
|
+
if (ssh) raw = ssh[1];
|
|
702
|
+
|
|
703
|
+
if (/^https?:\/\//i.test(raw)) {
|
|
704
|
+
try {
|
|
705
|
+
raw = new URL(raw).pathname;
|
|
706
|
+
} catch {
|
|
707
|
+
// fall through
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
raw = raw.replace(/\.git$/i, "").replace(/^\/+|\/+$/g, "");
|
|
712
|
+
const parts = raw.split("/").filter(Boolean);
|
|
713
|
+
if (parts.length === 0) return { orgLogin: null, explicitRepo: null };
|
|
714
|
+
return { orgLogin: parts[0], explicitRepo: parts[1] || null };
|
|
715
|
+
}
|
|
716
|
+
|
|
696
717
|
async function localJoinFlow(orgArg, ui, ctx = {}) {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
} else {
|
|
702
|
-
orgLogin = orgArg;
|
|
703
|
-
explicitRepo = null;
|
|
718
|
+
const { orgLogin, explicitRepo } = parseJoinTarget(orgArg);
|
|
719
|
+
if (!orgLogin) {
|
|
720
|
+
ui.error("Usage: npx create-egregore join <org>[/<repo>]");
|
|
721
|
+
process.exit(1);
|
|
704
722
|
}
|
|
705
723
|
|
|
706
724
|
// 1. GitHub auth — OAuth with repo:invite scope (narrow: just invitation acceptance)
|
|
@@ -725,10 +743,6 @@ async function localJoinFlow(orgArg, ui, ctx = {}) {
|
|
|
725
743
|
|
|
726
744
|
// 4. Determine repo name
|
|
727
745
|
const repoName = explicitRepo || "egregore";
|
|
728
|
-
if (!repoName) {
|
|
729
|
-
ui.error("Usage: npx create-egregore join <org>/<repo>");
|
|
730
|
-
process.exit(1);
|
|
731
|
-
}
|
|
732
746
|
|
|
733
747
|
// 5. Clone repos using git credentials (SSH keys / gh CLI / credential helper)
|
|
734
748
|
// The OAuth token only has repo:invite scope — cloning uses the joiner's own git setup.
|
|
@@ -870,4 +884,4 @@ async function localJoinFlow(orgArg, ui, ctx = {}) {
|
|
|
870
884
|
console.log("");
|
|
871
885
|
}
|
|
872
886
|
|
|
873
|
-
module.exports = { localFounderFlow, localJoinFlow, addCollaborator, getUser, repoExists, createRepo, waitForRepo };
|
|
887
|
+
module.exports = { localFounderFlow, localJoinFlow, parseJoinTarget, addCollaborator, getUser, repoExists, createRepo, waitForRepo };
|
package/lib/setup.js
CHANGED
|
@@ -112,7 +112,7 @@ async function install(data, ui, targetDir, opts = {}) {
|
|
|
112
112
|
const base = targetDir || process.cwd();
|
|
113
113
|
const skipRepos = opts.skipRepos instanceof Set ? opts.skipRepos : new Set();
|
|
114
114
|
|
|
115
|
-
// Directory name from fork URL (what git clone would use), e.g. "egregore
|
|
115
|
+
// Directory name from fork URL (what git clone would use), e.g. "egregore"
|
|
116
116
|
const forkDirName = fork_url.split("/").pop().replace(/\.git$/, "");
|
|
117
117
|
const egregoreDir = path.join(base, forkDirName);
|
|
118
118
|
const memoryDirName = memory_url
|
|
@@ -264,6 +264,20 @@ async function install(data, ui, targetDir, opts = {}) {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
// Warm the npx cache for egregore-artifacts so the first /view or
|
|
268
|
+
// publish-artifact call doesn't pay a cold npm download (~5-10s).
|
|
269
|
+
// Background + detached — we don't care about completion, and any
|
|
270
|
+
// failure is silent. The first real use benefits if this finishes in
|
|
271
|
+
// time, otherwise it costs nothing.
|
|
272
|
+
try {
|
|
273
|
+
const { spawn } = require("child_process");
|
|
274
|
+
const warm = spawn("npx", ["-y", "egregore-artifacts@latest", "--help"], {
|
|
275
|
+
detached: true,
|
|
276
|
+
stdio: "ignore",
|
|
277
|
+
});
|
|
278
|
+
warm.unref();
|
|
279
|
+
} catch { /* ignore — cosmetic warmup */ }
|
|
280
|
+
|
|
267
281
|
// Done
|
|
268
282
|
console.log("");
|
|
269
283
|
ui.success(`Egregore is ready for ${ui.bold(org_name)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-egregore",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"description": "Set up Egregore for your team in one command",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -18,5 +18,10 @@
|
|
|
18
18
|
"claude",
|
|
19
19
|
"ai",
|
|
20
20
|
"collaboration"
|
|
21
|
-
]
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/Curve-Labs/egregore.git",
|
|
25
|
+
"directory": "packages/create-egregore"
|
|
26
|
+
}
|
|
22
27
|
}
|