create-egregore 0.3.0 → 0.3.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/setup.js +18 -6
- package/package.json +1 -1
package/lib/setup.js
CHANGED
|
@@ -78,7 +78,7 @@ async function install(data, ui, targetDir) {
|
|
|
78
78
|
// 5. Register instance + shell alias
|
|
79
79
|
ui.step(5, totalSteps, "Registering instance...");
|
|
80
80
|
registerInstance(dirSlug, org_name, egregoreDir);
|
|
81
|
-
installShellAlias(egregoreDir, ui);
|
|
81
|
+
const aliasName = await installShellAlias(egregoreDir, ui);
|
|
82
82
|
|
|
83
83
|
// 6+. Clone managed repos (if any)
|
|
84
84
|
const clonedRepos = [];
|
|
@@ -108,7 +108,7 @@ async function install(data, ui, targetDir) {
|
|
|
108
108
|
ui.info(` ${ui.cyan(`./${repoName}/`)} — Managed repo`);
|
|
109
109
|
}
|
|
110
110
|
console.log("");
|
|
111
|
-
ui.info(`Next: type ${ui.bold(
|
|
111
|
+
ui.info(`Next: type ${ui.bold(aliasName)} in any terminal to start.`);
|
|
112
112
|
console.log("");
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -155,17 +155,29 @@ function registerInstance(slug, name, egregoreDir) {
|
|
|
155
155
|
fs.writeFileSync(registryFile, JSON.stringify(instances, null, 2) + "\n");
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
function installShellAlias(egregoreDir, ui) {
|
|
158
|
+
async function installShellAlias(egregoreDir, ui) {
|
|
159
159
|
const script = path.join(egregoreDir, "bin", "ensure-shell-function.sh");
|
|
160
160
|
if (!fs.existsSync(script)) {
|
|
161
161
|
ui.warn("Shell alias script not found — add alias manually.");
|
|
162
|
-
return;
|
|
162
|
+
return "egregore";
|
|
163
163
|
}
|
|
164
164
|
try {
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
// Get recommended name
|
|
166
|
+
const suggested = execSync(`bash "${script}" suggest`, { stdio: "pipe", encoding: "utf-8", timeout: 10000 }).trim();
|
|
167
|
+
const defaultName = suggested || "egregore";
|
|
168
|
+
|
|
169
|
+
// Ask user what they want to call it
|
|
170
|
+
const answer = await ui.prompt(`Shell command name [${defaultName}]:`);
|
|
171
|
+
const chosenName = answer || defaultName;
|
|
172
|
+
|
|
173
|
+
// Install with chosen name
|
|
174
|
+
const output = execSync(`bash "${script}" install "${chosenName}"`, { stdio: "pipe", encoding: "utf-8", timeout: 10000 }).trim();
|
|
175
|
+
const aliasName = output || chosenName;
|
|
176
|
+
ui.success(`Installed ${ui.dim(aliasName)} command`);
|
|
177
|
+
return aliasName;
|
|
167
178
|
} catch {
|
|
168
179
|
ui.warn("Could not install shell alias — add it manually.");
|
|
180
|
+
return "egregore";
|
|
169
181
|
}
|
|
170
182
|
}
|
|
171
183
|
|