create-egregore 0.7.1 → 0.8.0
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 +3 -2
- package/lib/setup.js +12 -0
- package/lib/ui.js +17 -2
- package/package.json +1 -1
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`,
|
|
@@ -525,7 +526,7 @@ async function localFounderFlow(ui) {
|
|
|
525
526
|
invSpin.stop(`Invited ${invUsername}`);
|
|
526
527
|
console.log("");
|
|
527
528
|
ui.info(`Tell them to run:`);
|
|
528
|
-
ui.
|
|
529
|
+
ui.commandBox("command", `npx create-egregore@latest join ${githubOrg}/${repoName}`);
|
|
529
530
|
} catch (err) {
|
|
530
531
|
invSpin.fail(`Could not invite ${invUsername}: ${err.message}`);
|
|
531
532
|
}
|
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
|
};
|