create-egregore 0.9.0 → 0.10.2
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 +29 -14
- package/package.json +1 -1
package/lib/local.js
CHANGED
|
@@ -18,10 +18,9 @@ const {
|
|
|
18
18
|
run,
|
|
19
19
|
} = require("./setup");
|
|
20
20
|
|
|
21
|
-
// Template repo for new egregore instances
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const TEMPLATE_REPO = "egregore-core";
|
|
21
|
+
// Template repo for new egregore instances (OSS)
|
|
22
|
+
const TEMPLATE_OWNER = "egregore-labs";
|
|
23
|
+
const TEMPLATE_REPO = "egregore";
|
|
25
24
|
|
|
26
25
|
// ── GitHub API helpers ──────────────────────────────────────────────
|
|
27
26
|
|
|
@@ -105,10 +104,23 @@ async function putFileContent(token, owner, repo, filePath, content, message) {
|
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
async function listOrgRepos(token, owner, isOrg) {
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
// Fetch all repos (public + private). Paginate to get beyond the first 100.
|
|
108
|
+
const baseUrl = isOrg
|
|
109
|
+
? `/orgs/${owner}/repos?per_page=100&sort=updated&type=all`
|
|
110
|
+
: `/users/${owner}/repos?per_page=100&sort=updated&type=owner`;
|
|
111
|
+
|
|
112
|
+
let allRepos = [];
|
|
113
|
+
let page = 1;
|
|
114
|
+
while (page <= 5) { // cap at 500 repos
|
|
115
|
+
const url = `${baseUrl}&page=${page}`;
|
|
116
|
+
const { status, data } = await ghApi("GET", url, token);
|
|
117
|
+
if (status !== 200 || !Array.isArray(data) || data.length === 0) break;
|
|
118
|
+
allRepos = allRepos.concat(data);
|
|
119
|
+
if (data.length < 100) break; // last page
|
|
120
|
+
page++;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return allRepos
|
|
112
124
|
.filter((r) => !r.archived && r.name !== "egregore" && r.name !== "egregore-core" && !r.name.endsWith("-memory"))
|
|
113
125
|
.map((r) => ({ name: r.name, language: r.language || "", description: r.description || "" }));
|
|
114
126
|
}
|
|
@@ -213,7 +225,7 @@ async function localFounderFlow(ui) {
|
|
|
213
225
|
let orgName, description, selectedRepos = [], newProjectRepo = null;
|
|
214
226
|
|
|
215
227
|
if (isNewProject) {
|
|
216
|
-
const nameInput = await ui.prompt("
|
|
228
|
+
const nameInput = await ui.prompt("Name your Egregore (your team or group name):");
|
|
217
229
|
orgName = nameInput || githubOrg;
|
|
218
230
|
|
|
219
231
|
const descInput = await ui.prompt("What are you building? (one line)");
|
|
@@ -221,10 +233,10 @@ async function localFounderFlow(ui) {
|
|
|
221
233
|
|
|
222
234
|
// Ask about project repo
|
|
223
235
|
console.log("");
|
|
224
|
-
ui.info("Egregore
|
|
225
|
-
ui.info("
|
|
236
|
+
ui.info("Your Egregore is set up. It has its own repo for memory and config.");
|
|
237
|
+
ui.info("If you also have a code project to work on, we can create a repo for it.");
|
|
226
238
|
console.log("");
|
|
227
|
-
const projectName = await ui.prompt("
|
|
239
|
+
const projectName = await ui.prompt("Code project repo name (Enter to skip):");
|
|
228
240
|
if (projectName) {
|
|
229
241
|
newProjectRepo = projectName.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
230
242
|
}
|
|
@@ -317,8 +329,8 @@ async function localFounderFlow(ui) {
|
|
|
317
329
|
if (newProjectRepo) {
|
|
318
330
|
// Re-prompt if name conflicts with core/memory repo
|
|
319
331
|
while (newProjectRepo === repoName || newProjectRepo === memoryRepoName) {
|
|
320
|
-
ui.warn(`
|
|
321
|
-
const retry = await ui.prompt(
|
|
332
|
+
ui.warn(`"${newProjectRepo}" is already taken by your Egregore repo. Your code project needs a different name.`);
|
|
333
|
+
const retry = await ui.prompt(`Code project name (e.g. "${newProjectRepo}-app", or Enter to skip):`);
|
|
322
334
|
if (!retry) { newProjectRepo = null; break; }
|
|
323
335
|
newProjectRepo = retry.trim().toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
324
336
|
}
|
|
@@ -353,6 +365,9 @@ async function localFounderFlow(ui) {
|
|
|
353
365
|
slug: slug,
|
|
354
366
|
repo_name: repoName,
|
|
355
367
|
repos: selectedRepos,
|
|
368
|
+
upstream_url: "https://github.com/egregore-labs/egregore.git",
|
|
369
|
+
report_url: "https://xgksfrirtdumacvmfkzj.supabase.co",
|
|
370
|
+
report_key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Inhna3NmcmlydGR1bWFjdm1ma3pqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzA5OTA1ODksImV4cCI6MjA4NjU2NjU4OX0.1UWNgER6nQazrayly1KDrswClURUkGKxeirZg5L8uk4",
|
|
356
371
|
};
|
|
357
372
|
try {
|
|
358
373
|
await putFileContent(
|