create-insight 0.27.1 → 0.27.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.
@@ -279,11 +279,13 @@ var readEnv = () => Object.fromEntries(readFileSync3(envFile, "utf8").split("\n"
279
279
  if (upgrading && !existsSync3(envFile)) stop("There\u2019s no Insight here to upgrade (no insight.env). Run npx create-insight to set it up.");
280
280
  if (!upgrading && existsSync3(envFile)) stop("Insight is already set up here (insight.env exists). To bring it up to date: npx create-insight upgrade");
281
281
  var saved = upgrading ? readEnv() : {};
282
+ if (!upgrading && values.project !== void 0 && !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,50}$/.test(values.project)) stop(`--project ${values.project}: use letters, numbers, - and _ only.`);
283
+ var project = upgrading ? null : projectName(values.project ?? appName(dir));
284
+ if (project) say(`Setting up Insight for this app as ${project}: its containers and database are named after it.${values.project === void 0 ? " To call it something else, stop now (Ctrl+C) and run this again with --project <name>." : ""}`);
282
285
  var key = (values.key ?? process.env.KALEYLA_KEY ?? saved.INSIGHT_LICENCE_KEY ?? "").trim();
283
286
  if (!key && !values.yes && process.stdin.isTTY) key = (await askHidden("Your Kaleyla key (KLY-\u2026): ")).trim();
284
287
  if (!key) stop("Insight needs your Kaleyla key: give it with --key, or run this again and paste it when asked.");
285
288
  if (!key.startsWith("KLY-")) stop("That isn\u2019t a Kaleyla key: those start with KLY-.");
286
- if (!upgrading && values.project !== void 0 && !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,50}$/.test(values.project)) stop(`--project ${values.project}: use letters, numbers, - and _ only.`);
287
289
  if (!upgrading && !values["no-package"]) {
288
290
  for (const d of [dir, ...(values.also ?? []).map((a) => resolve(dir, a))]) {
289
291
  if (!existsSync3(join3(d, "package.json"))) stop(`${relative2(dir, d) || "This folder"} has no package.json. Run this from your app\u2019s folder, or add --no-package for an app that isn\u2019t on Node.js.`);
@@ -293,7 +295,6 @@ var engine = detectEngine();
293
295
  var cli = engine.cli;
294
296
  var tool = engine.compose.join(" ");
295
297
  done(`${engine.name === "podman" ? "Podman" : "Docker"} is running (${tool}${engine.selinux ? ", SELinux on" : ""})`);
296
- var project = upgrading ? null : projectName(values.project ?? appName(dir));
297
298
  var names = project ? containerNames(project) : null;
298
299
  var taken = project ? takenBy(project, names) : void 0;
299
300
  if (taken) stop(`${taken}, so this app's Insight can't be called ${project}: it would take over that one's containers and database. Choose another name with --project <name> (this app's own name, say).`);
@@ -376,7 +377,8 @@ writeFileSync2(
376
377
  `INSIGHT_READ_URL=${appUrl.replace(/\/+$/, "")}/api/insight/read`,
377
378
  // Watches: the secret Insight sends your app's token route (the same as keys/insight-app-secret).
378
379
  `INSIGHT_APP_SECRET=${appSecret}`,
379
- // Insight's model, through Kaleyla, opened by the Kaleyla key below. Another model: the console, Settings › AI models.
380
+ // Only a default: nothing reaches a model until the console's Connection page says which model answers (Kaleyla's,
381
+ // through the Kaleyla key below, or your own), and the choice made there wins over these lines.
380
382
  `INSIGHT_MODEL_URL=${init_defaults_default.modelUrl}`,
381
383
  `INSIGHT_MODEL=${init_defaults_default.model}`,
382
384
  `INSIGHT_REVIEW_MODEL=${init_defaults_default.reviewModel}`,
@@ -455,7 +457,7 @@ async function download(file) {
455
457
  done(`${file.name} (already downloaded)`);
456
458
  return target;
457
459
  }
458
- const partial = `${target}.part`;
460
+ const partial = `${target}.${process.pid}.${randomBytes2(4).toString("hex")}.part`;
459
461
  const r = await fetch(file.url);
460
462
  if (!r.ok || !r.body) stop(`${file.name} couldn\u2019t be downloaded (${r.status}). Run this again for fresh links.`);
461
463
  let got = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-insight",
3
- "version": "0.27.1",
3
+ "version": "0.27.2",
4
4
  "description": "Sets Insight up beside your app, with your Kaleyla key: npx create-insight",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",