learnhouse 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/dist/bin/learnhouse.js +282 -209
  2. package/package.json +2 -1
@@ -3204,9 +3204,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3204
3204
  helpWidth: context.helpWidth,
3205
3205
  outputHasColors: context.hasColors
3206
3206
  });
3207
- const text = helper.formatHelp(this, helper);
3208
- if (context.hasColors) return text;
3209
- return this._outputConfiguration.stripColor(text);
3207
+ const text2 = helper.formatHelp(this, helper);
3208
+ if (context.hasColors) return text2;
3209
+ return this._outputConfiguration.stripColor(text2);
3210
3210
  }
3211
3211
  /**
3212
3212
  * @typedef HelpContext
@@ -3366,7 +3366,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3366
3366
  * @param {(string | Function)} text - string to add, or a function returning a string
3367
3367
  * @return {Command} `this` command for chaining
3368
3368
  */
3369
- addHelpText(position, text) {
3369
+ addHelpText(position, text2) {
3370
3370
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
3371
3371
  if (!allowedValues.includes(position)) {
3372
3372
  throw new Error(`Unexpected value for position to addHelpText.
@@ -3375,10 +3375,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
3375
3375
  const helpEvent = `${position}Help`;
3376
3376
  this.on(helpEvent, (context) => {
3377
3377
  let helpStr;
3378
- if (typeof text === "function") {
3379
- helpStr = text({ error: context.error, command: context.command });
3378
+ if (typeof text2 === "function") {
3379
+ helpStr = text2({ error: context.error, command: context.command });
3380
3380
  } else {
3381
- helpStr = text;
3381
+ helpStr = text2;
3382
3382
  }
3383
3383
  if (helpStr) {
3384
3384
  context.write(`${helpStr}
@@ -3613,10 +3613,10 @@ var {
3613
3613
  } = import_index.default;
3614
3614
 
3615
3615
  // bin/learnhouse.ts
3616
- var import_picocolors17 = __toESM(require_picocolors(), 1);
3616
+ var import_picocolors18 = __toESM(require_picocolors(), 1);
3617
3617
 
3618
3618
  // src/constants.ts
3619
- var VERSION = "1.1.0";
3619
+ var VERSION = "1.2.0";
3620
3620
  var APP_IMAGE = "ghcr.io/learnhouse/app:latest";
3621
3621
  var DEV_IMAGE = "ghcr.io/learnhouse/app:dev";
3622
3622
  var POSTGRES_IMAGE = "postgres:16-alpine";
@@ -4753,41 +4753,74 @@ ${n}
4753
4753
  } }).prompt();
4754
4754
  };
4755
4755
  var Qt = `${import_picocolors4.default.gray(d)} `;
4756
- var Ze = (t) => new $t({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, output: t.output, signal: t.signal, input: t.input, render() {
4757
- const r = t?.withGuide ?? _.withGuide, s = `${`${r ? `${import_picocolors4.default.gray(d)}
4758
- ` : ""}${W2(this.state)} `}${t.message}
4759
- `, i = t.placeholder ? import_picocolors4.default.inverse(t.placeholder[0]) + import_picocolors4.default.dim(t.placeholder.slice(1)) : import_picocolors4.default.inverse(import_picocolors4.default.hidden("_")), a = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
4760
- switch (this.state) {
4761
- case "error": {
4762
- const u = this.error ? ` ${import_picocolors4.default.yellow(this.error)}` : "", l = r ? `${import_picocolors4.default.yellow(d)} ` : "", n = r ? import_picocolors4.default.yellow(x2) : "";
4763
- return `${s.trim()}
4764
- ${l}${a}
4765
- ${n}${u}
4756
+
4757
+ // src/utils/prompt.ts
4758
+ var import_picocolors5 = __toESM(require_picocolors(), 1);
4759
+ function text(opts) {
4760
+ const fillValue = opts.defaultValue ?? opts.placeholder;
4761
+ const prompt = new $t({
4762
+ placeholder: opts.placeholder,
4763
+ defaultValue: opts.defaultValue,
4764
+ initialValue: opts.initialValue,
4765
+ validate: opts.validate ? (value) => {
4766
+ const effective = value || opts.defaultValue || "";
4767
+ return opts.validate(effective);
4768
+ } : void 0,
4769
+ render() {
4770
+ const withGuide = _.withGuide;
4771
+ const head = `${withGuide ? `${import_picocolors5.default.gray(d)}
4772
+ ` : ""}${W2(this.state)} ${opts.message}
4766
4773
  `;
4767
- }
4768
- case "submit": {
4769
- const u = o ? ` ${import_picocolors4.default.dim(o)}` : "", l = r ? import_picocolors4.default.gray(d) : "";
4770
- return `${s}${l}${u}`;
4771
- }
4772
- case "cancel": {
4773
- const u = o ? ` ${import_picocolors4.default.strikethrough(import_picocolors4.default.dim(o))}` : "", l = r ? import_picocolors4.default.gray(d) : "";
4774
- return `${s}${l}${u}${o.trim() ? `
4775
- ${l}` : ""}`;
4776
- }
4777
- default: {
4778
- const u = r ? `${import_picocolors4.default.cyan(d)} ` : "", l = r ? import_picocolors4.default.cyan(x2) : "";
4779
- return `${s}${u}${a}
4780
- ${l}
4774
+ const placeholderDisplay = opts.placeholder ? import_picocolors5.default.inverse(opts.placeholder[0]) + import_picocolors5.default.dim(opts.placeholder.slice(1)) : import_picocolors5.default.inverse(import_picocolors5.default.hidden("_"));
4775
+ const input = this.userInput ? this.userInputWithCursor : placeholderDisplay;
4776
+ const value = this.value ?? "";
4777
+ switch (this.state) {
4778
+ case "error": {
4779
+ const errorMsg = this.error ? ` ${import_picocolors5.default.yellow(this.error)}` : "";
4780
+ const bar = withGuide ? `${import_picocolors5.default.yellow(d)} ` : "";
4781
+ const barEnd = withGuide ? import_picocolors5.default.yellow(x2) : "";
4782
+ return `${head.trim()}
4783
+ ${bar}${input}
4784
+ ${barEnd}${errorMsg}
4785
+ `;
4786
+ }
4787
+ case "submit": {
4788
+ const val = value ? ` ${import_picocolors5.default.dim(value)}` : "";
4789
+ const bar = withGuide ? import_picocolors5.default.gray(d) : "";
4790
+ return `${head}${bar}${val}`;
4791
+ }
4792
+ case "cancel": {
4793
+ const val = value ? ` ${import_picocolors5.default.strikethrough(import_picocolors5.default.dim(value))}` : "";
4794
+ const bar = withGuide ? import_picocolors5.default.gray(d) : "";
4795
+ return `${head}${bar}${val}${value.trim() ? `
4796
+ ${bar}` : ""}`;
4797
+ }
4798
+ default: {
4799
+ const bar = withGuide ? `${import_picocolors5.default.cyan(d)} ` : "";
4800
+ const barEnd = withGuide ? import_picocolors5.default.cyan(x2) : "";
4801
+ return `${head}${bar}${input}
4802
+ ${barEnd}
4781
4803
  `;
4804
+ }
4805
+ }
4782
4806
  }
4807
+ });
4808
+ if (fillValue) {
4809
+ prompt.on("key", (_key, info) => {
4810
+ if (info?.name === "tab" && !prompt.userInput) {
4811
+ ;
4812
+ prompt._setUserInput(fillValue, true);
4813
+ }
4814
+ });
4783
4815
  }
4784
- } }).prompt();
4816
+ return prompt.prompt();
4817
+ }
4785
4818
 
4786
4819
  // src/commands/setup.ts
4787
- var import_picocolors7 = __toESM(require_picocolors(), 1);
4820
+ var import_picocolors8 = __toESM(require_picocolors(), 1);
4788
4821
 
4789
4822
  // src/prompts/prerequisites.ts
4790
- var import_picocolors5 = __toESM(require_picocolors(), 1);
4823
+ var import_picocolors6 = __toESM(require_picocolors(), 1);
4791
4824
 
4792
4825
  // src/services/docker.ts
4793
4826
  import { execSync, spawn, spawnSync } from "child_process";
@@ -4958,12 +4991,12 @@ async function checkPrerequisites() {
4958
4991
  {
4959
4992
  name: "Docker Engine",
4960
4993
  check: isDockerInstalled,
4961
- failMsg: `Docker is not installed. Install it from ${import_picocolors5.default.underline("https://docs.docker.com/get-docker/")}`
4994
+ failMsg: `Docker is not installed. Install it from ${import_picocolors6.default.underline("https://docs.docker.com/get-docker/")}`
4962
4995
  },
4963
4996
  {
4964
4997
  name: "Docker Compose v2",
4965
4998
  check: isDockerComposeV2,
4966
- failMsg: `Docker Compose v2 is required. Install it from ${import_picocolors5.default.underline("https://docs.docker.com/compose/install/")}`
4999
+ failMsg: `Docker Compose v2 is required. Install it from ${import_picocolors6.default.underline("https://docs.docker.com/compose/install/")}`
4967
5000
  },
4968
5001
  {
4969
5002
  name: "Docker daemon",
@@ -4974,7 +5007,7 @@ async function checkPrerequisites() {
4974
5007
  const failed = [];
4975
5008
  for (const { name, check, failMsg } of checks) {
4976
5009
  if (!check()) {
4977
- failed.push(`${import_picocolors5.default.red("x")} ${name}: ${failMsg}`);
5010
+ failed.push(`${import_picocolors6.default.red("x")} ${name}: ${failMsg}`);
4978
5011
  }
4979
5012
  }
4980
5013
  if (failed.length > 0) {
@@ -5020,7 +5053,7 @@ function validateRequired(value) {
5020
5053
 
5021
5054
  // src/prompts/domain.ts
5022
5055
  async function promptDomain() {
5023
- const domain = await Ze({
5056
+ const domain = await text({
5024
5057
  message: "What domain will LearnHouse be hosted on?",
5025
5058
  placeholder: "localhost",
5026
5059
  defaultValue: "localhost",
@@ -5049,7 +5082,7 @@ async function promptDomain() {
5049
5082
  if (httpsChoice === "auto") {
5050
5083
  useHttps = true;
5051
5084
  autoSsl = true;
5052
- const email = await Ze({
5085
+ const email = await text({
5053
5086
  message: "Email for Let's Encrypt notifications?",
5054
5087
  placeholder: "admin@example.com",
5055
5088
  validate: validateEmail
@@ -5065,7 +5098,7 @@ async function promptDomain() {
5065
5098
  }
5066
5099
  const defaultPort = autoSsl ? 443 : 80;
5067
5100
  const portMessage = autoSsl ? "HTTPS port? (Caddy needs 443 for auto SSL, and will also listen on 80 for redirect)" : "HTTP port for the web server?";
5068
- const port = await Ze({
5101
+ const port = await text({
5069
5102
  message: portMessage,
5070
5103
  placeholder: String(defaultPort),
5071
5104
  defaultValue: String(defaultPort),
@@ -5086,7 +5119,7 @@ async function promptDomain() {
5086
5119
 
5087
5120
  // src/prompts/database.ts
5088
5121
  import crypto from "crypto";
5089
- var import_picocolors6 = __toESM(require_picocolors(), 1);
5122
+ var import_picocolors7 = __toESM(require_picocolors(), 1);
5090
5123
 
5091
5124
  // src/utils/network.ts
5092
5125
  import net from "net";
@@ -5138,7 +5171,7 @@ function parseRedisUrl(connString) {
5138
5171
  // src/prompts/database.ts
5139
5172
  async function promptAndVerifyPostgres() {
5140
5173
  while (true) {
5141
- const connString = await Ze({
5174
+ const connString = await text({
5142
5175
  message: "PostgreSQL connection string?",
5143
5176
  placeholder: "postgresql://user:password@host:5432/learnhouse",
5144
5177
  validate: (value) => {
@@ -5163,10 +5196,10 @@ async function promptAndVerifyPostgres() {
5163
5196
  s.start(`Checking connection to ${parsed.host}:${parsed.port}`);
5164
5197
  const reachable = await checkTcpConnection(parsed.host, parsed.port);
5165
5198
  if (reachable) {
5166
- s.stop(`${import_picocolors6.default.green("Connected")} to ${parsed.host}:${parsed.port}`);
5199
+ s.stop(`${import_picocolors7.default.green("Connected")} to ${parsed.host}:${parsed.port}`);
5167
5200
  return connString;
5168
5201
  }
5169
- s.stop(`${import_picocolors6.default.red("Connection failed")} to ${parsed.host}:${parsed.port}`);
5202
+ s.stop(`${import_picocolors7.default.red("Connection failed")} to ${parsed.host}:${parsed.port}`);
5170
5203
  const retry = await Re({
5171
5204
  message: "Could not reach the database. Try a different connection string?",
5172
5205
  initialValue: true
@@ -5179,7 +5212,7 @@ async function promptAndVerifyPostgres() {
5179
5212
  }
5180
5213
  async function promptAndVerifyRedis() {
5181
5214
  while (true) {
5182
- const connString = await Ze({
5215
+ const connString = await text({
5183
5216
  message: "Redis connection string?",
5184
5217
  placeholder: "redis://user:password@host:6379/0",
5185
5218
  validate: (value) => {
@@ -5204,10 +5237,10 @@ async function promptAndVerifyRedis() {
5204
5237
  s.start(`Checking connection to ${parsed.host}:${parsed.port}`);
5205
5238
  const reachable = await checkTcpConnection(parsed.host, parsed.port);
5206
5239
  if (reachable) {
5207
- s.stop(`${import_picocolors6.default.green("Connected")} to ${parsed.host}:${parsed.port}`);
5240
+ s.stop(`${import_picocolors7.default.green("Connected")} to ${parsed.host}:${parsed.port}`);
5208
5241
  return connString;
5209
5242
  }
5210
- s.stop(`${import_picocolors6.default.red("Connection failed")} to ${parsed.host}:${parsed.port}`);
5243
+ s.stop(`${import_picocolors7.default.red("Connection failed")} to ${parsed.host}:${parsed.port}`);
5211
5244
  const retry = await Re({
5212
5245
  message: "Could not reach Redis. Try a different connection string?",
5213
5246
  initialValue: true
@@ -5252,15 +5285,15 @@ async function promptDatabase() {
5252
5285
  useAiDatabase = dbImageChoice === "ai";
5253
5286
  dbPassword = crypto.randomBytes(24).toString("base64url");
5254
5287
  R2.message("");
5255
- R2.info(import_picocolors6.default.bold("Database credentials generated:"));
5288
+ R2.info(import_picocolors7.default.bold("Database credentials generated:"));
5256
5289
  R2.message([
5257
5290
  "",
5258
- ` ${import_picocolors6.default.dim("User:")} learnhouse`,
5259
- ` ${import_picocolors6.default.dim("Password:")} ${import_picocolors6.default.cyan(dbPassword)}`,
5260
- ` ${import_picocolors6.default.dim("Database:")} learnhouse`,
5261
- ` ${import_picocolors6.default.dim("Host:")} db:5432 (internal)`,
5291
+ ` ${import_picocolors7.default.dim("User:")} learnhouse`,
5292
+ ` ${import_picocolors7.default.dim("Password:")} ${import_picocolors7.default.cyan(dbPassword)}`,
5293
+ ` ${import_picocolors7.default.dim("Database:")} learnhouse`,
5294
+ ` ${import_picocolors7.default.dim("Host:")} db:5432 (internal)`,
5262
5295
  "",
5263
- ` ${import_picocolors6.default.yellow("Copy the password now if needed \u2014 it will be saved in .env")}`,
5296
+ ` ${import_picocolors7.default.yellow("Copy the password now if needed \u2014 it will be saved in .env")}`,
5264
5297
  ""
5265
5298
  ].join("\n"));
5266
5299
  const ack = await Re({ message: "Continue?", initialValue: true });
@@ -5298,9 +5331,10 @@ async function promptDatabase() {
5298
5331
 
5299
5332
  // src/prompts/organization.ts
5300
5333
  async function promptOrganization() {
5301
- const orgName = await Ze({
5334
+ const orgName = await text({
5302
5335
  message: "Organization name?",
5303
5336
  placeholder: "My School",
5337
+ defaultValue: "My School",
5304
5338
  validate: validateRequired
5305
5339
  });
5306
5340
  if (Ct(orgName)) {
@@ -5314,7 +5348,7 @@ async function promptOrganization() {
5314
5348
 
5315
5349
  // src/prompts/admin.ts
5316
5350
  async function promptAdmin() {
5317
- const email = await Ze({
5351
+ const email = await text({
5318
5352
  message: "Admin email address?",
5319
5353
  placeholder: "admin@example.com",
5320
5354
  validate: validateEmail
@@ -5364,7 +5398,7 @@ async function promptFeatures() {
5364
5398
  };
5365
5399
  if (config.aiEnabled) {
5366
5400
  R2.info("Configure AI (Gemini)");
5367
- const key = await Ze({
5401
+ const key = await text({
5368
5402
  message: "Gemini API key?",
5369
5403
  placeholder: "AIza...",
5370
5404
  validate: validateRequired
@@ -5390,7 +5424,7 @@ async function promptFeatures() {
5390
5424
  config.emailProvider = provider;
5391
5425
  if (config.emailProvider === "resend") {
5392
5426
  R2.info("Configure Email (Resend)");
5393
- const key = await Ze({
5427
+ const key = await text({
5394
5428
  message: "Resend API key?",
5395
5429
  placeholder: "re_...",
5396
5430
  validate: validateRequired
@@ -5402,7 +5436,7 @@ async function promptFeatures() {
5402
5436
  config.resendApiKey = key;
5403
5437
  } else {
5404
5438
  R2.info("Configure Email (SMTP)");
5405
- const host = await Ze({
5439
+ const host = await text({
5406
5440
  message: "SMTP host?",
5407
5441
  placeholder: "smtp.gmail.com",
5408
5442
  validate: validateRequired
@@ -5412,7 +5446,7 @@ async function promptFeatures() {
5412
5446
  process.exit(0);
5413
5447
  }
5414
5448
  config.smtpHost = host;
5415
- const port = await Ze({
5449
+ const port = await text({
5416
5450
  message: "SMTP port?",
5417
5451
  initialValue: "587",
5418
5452
  validate: validateRequired
@@ -5422,7 +5456,7 @@ async function promptFeatures() {
5422
5456
  process.exit(0);
5423
5457
  }
5424
5458
  config.smtpPort = parseInt(port, 10);
5425
- const username = await Ze({
5459
+ const username = await text({
5426
5460
  message: "SMTP username?",
5427
5461
  validate: validateRequired
5428
5462
  });
@@ -5450,7 +5484,7 @@ async function promptFeatures() {
5450
5484
  }
5451
5485
  config.smtpUseTls = useTls;
5452
5486
  }
5453
- const email = await Ze({
5487
+ const email = await text({
5454
5488
  message: "System email address (From)?",
5455
5489
  placeholder: "noreply@yourdomain.com",
5456
5490
  validate: validateRequired
@@ -5463,7 +5497,7 @@ async function promptFeatures() {
5463
5497
  }
5464
5498
  if (config.s3Enabled) {
5465
5499
  R2.info("Configure S3 Storage");
5466
- const bucket = await Ze({
5500
+ const bucket = await text({
5467
5501
  message: "S3 bucket name?",
5468
5502
  validate: validateRequired
5469
5503
  });
@@ -5472,7 +5506,7 @@ async function promptFeatures() {
5472
5506
  process.exit(0);
5473
5507
  }
5474
5508
  config.s3BucketName = bucket;
5475
- const endpoint = await Ze({
5509
+ const endpoint = await text({
5476
5510
  message: "S3 endpoint URL? (leave empty for AWS S3)",
5477
5511
  placeholder: "https://s3.amazonaws.com"
5478
5512
  });
@@ -5484,7 +5518,7 @@ async function promptFeatures() {
5484
5518
  }
5485
5519
  if (config.googleOAuthEnabled) {
5486
5520
  R2.info("Configure Google OAuth");
5487
- const clientId = await Ze({
5521
+ const clientId = await text({
5488
5522
  message: "Google Client ID?",
5489
5523
  validate: validateRequired
5490
5524
  });
@@ -5493,7 +5527,7 @@ async function promptFeatures() {
5493
5527
  process.exit(0);
5494
5528
  }
5495
5529
  config.googleClientId = clientId;
5496
- const clientSecret = await Ze({
5530
+ const clientSecret = await text({
5497
5531
  message: "Google Client Secret?",
5498
5532
  validate: validateRequired
5499
5533
  });
@@ -5505,7 +5539,7 @@ async function promptFeatures() {
5505
5539
  }
5506
5540
  if (config.unsplashEnabled) {
5507
5541
  R2.info("Configure Unsplash");
5508
- const key = await Ze({
5542
+ const key = await text({
5509
5543
  message: "Unsplash Access Key?",
5510
5544
  validate: validateRequired
5511
5545
  });
@@ -5931,8 +5965,19 @@ function collectCandidates(dir, depth, results) {
5931
5965
  }
5932
5966
  function pickBest(candidates) {
5933
5967
  if (candidates.length === 0) return null;
5934
- const complete = candidates.find(isCompleteInstall);
5935
- if (complete) return complete;
5968
+ const completeInstalls = candidates.filter(isCompleteInstall);
5969
+ if (completeInstalls.length > 0) {
5970
+ completeInstalls.sort((a, b) => {
5971
+ try {
5972
+ const configA = JSON.parse(fs.readFileSync(path.join(a, CONFIG_FILENAME), "utf-8"));
5973
+ const configB = JSON.parse(fs.readFileSync(path.join(b, CONFIG_FILENAME), "utf-8"));
5974
+ return (configB.createdAt || "").localeCompare(configA.createdAt || "");
5975
+ } catch {
5976
+ return 0;
5977
+ }
5978
+ });
5979
+ return completeInstalls[0];
5980
+ }
5936
5981
  return candidates[0];
5937
5982
  }
5938
5983
  function findInstallDir() {
@@ -5945,15 +5990,19 @@ function findInstallDir() {
5945
5990
  const best = pickBest(candidates);
5946
5991
  if (best) return best;
5947
5992
  let current = cwd;
5993
+ let fallbackDir = null;
5948
5994
  while (true) {
5949
5995
  const parent = path.dirname(current);
5950
5996
  if (parent === current) break;
5951
5997
  if (isCompleteInstall(parent)) return parent;
5952
5998
  const parentSub = path.join(parent, "learnhouse");
5953
5999
  if (isCompleteInstall(parentSub)) return parentSub;
5954
- if (fs.existsSync(path.join(parent, CONFIG_FILENAME))) return parent;
6000
+ if (!fallbackDir && fs.existsSync(path.join(parent, CONFIG_FILENAME))) {
6001
+ fallbackDir = parent;
6002
+ }
5955
6003
  current = parent;
5956
6004
  }
6005
+ if (fallbackDir) return fallbackDir;
5957
6006
  return cwd;
5958
6007
  }
5959
6008
 
@@ -5988,7 +6037,7 @@ async function confirmOrBack(message) {
5988
6037
  message,
5989
6038
  options: [
5990
6039
  { value: "continue", label: "Continue" },
5991
- { value: "back", label: import_picocolors7.default.dim("Go back to previous step") }
6040
+ { value: "back", label: import_picocolors8.default.dim("Go back to previous step") }
5992
6041
  ]
5993
6042
  });
5994
6043
  if (Ct(result)) {
@@ -5998,19 +6047,32 @@ async function confirmOrBack(message) {
5998
6047
  return result === "back" ? BACK : true;
5999
6048
  }
6000
6049
  async function stepInstallDir() {
6001
- const installDir = await Ze({
6050
+ const defaultDir = fs2.existsSync(path2.join(process.cwd(), "learnhouse", "learnhouse.config.json")) ? "./learnhouse-new" : "./learnhouse";
6051
+ const installDir = await text({
6002
6052
  message: "Where should LearnHouse be installed?",
6003
- placeholder: "./learnhouse",
6004
- defaultValue: "./learnhouse"
6053
+ placeholder: defaultDir,
6054
+ defaultValue: defaultDir
6005
6055
  });
6006
6056
  if (Ct(installDir)) {
6007
6057
  Ne();
6008
6058
  process.exit(0);
6009
6059
  }
6010
- return path2.resolve(installDir);
6060
+ const resolved = path2.resolve(installDir);
6061
+ if (fs2.existsSync(path2.join(resolved, "learnhouse.config.json"))) {
6062
+ R2.warn(`${resolved} already contains a LearnHouse installation.`);
6063
+ const overwrite = await Re({
6064
+ message: "Overwrite existing installation?",
6065
+ initialValue: false
6066
+ });
6067
+ if (Ct(overwrite) || !overwrite) {
6068
+ Ne("Setup cancelled.");
6069
+ process.exit(0);
6070
+ }
6071
+ }
6072
+ return resolved;
6011
6073
  }
6012
6074
  async function stepDomain() {
6013
- R2.step(import_picocolors7.default.cyan(`Step 2/6`) + " Domain Configuration");
6075
+ R2.step(import_picocolors8.default.cyan(`Step 2/6`) + " Domain Configuration");
6014
6076
  const config = await promptDomain();
6015
6077
  const portAvailable = await checkPort(config.httpPort);
6016
6078
  if (!portAvailable) {
@@ -6019,24 +6081,24 @@ async function stepDomain() {
6019
6081
  return config;
6020
6082
  }
6021
6083
  async function stepDatabase() {
6022
- R2.step(import_picocolors7.default.cyan(`Step 3/6`) + " Database & Redis");
6084
+ R2.step(import_picocolors8.default.cyan(`Step 3/6`) + " Database & Redis");
6023
6085
  return await promptDatabase();
6024
6086
  }
6025
6087
  async function stepOrganization() {
6026
- R2.step(import_picocolors7.default.cyan(`Step 4/6`) + " Organization Setup");
6088
+ R2.step(import_picocolors8.default.cyan(`Step 4/6`) + " Organization Setup");
6027
6089
  return await promptOrganization();
6028
6090
  }
6029
6091
  async function stepAdmin() {
6030
- R2.step(import_picocolors7.default.cyan(`Step 5/6`) + " Admin Account");
6092
+ R2.step(import_picocolors8.default.cyan(`Step 5/6`) + " Admin Account");
6031
6093
  return await promptAdmin();
6032
6094
  }
6033
6095
  async function stepFeatures() {
6034
- R2.step(import_picocolors7.default.cyan(`Step 6/6`) + " Optional Features");
6096
+ R2.step(import_picocolors8.default.cyan(`Step 6/6`) + " Optional Features");
6035
6097
  return await promptFeatures();
6036
6098
  }
6037
6099
  async function setupCommand() {
6038
6100
  await printBanner();
6039
- We(import_picocolors7.default.cyan("LearnHouse Setup Wizard"));
6101
+ We(import_picocolors8.default.cyan("LearnHouse Setup Wizard"));
6040
6102
  await checkPrerequisites();
6041
6103
  const channelChoice = await Je({
6042
6104
  message: "Which release channel do you want to use?",
@@ -6069,7 +6131,7 @@ async function setupCommand() {
6069
6131
  while (step < totalSteps) {
6070
6132
  switch (step) {
6071
6133
  case 0: {
6072
- R2.step(import_picocolors7.default.cyan(`Step 1/${totalSteps}`) + " Install Directory");
6134
+ R2.step(import_picocolors8.default.cyan(`Step 1/${totalSteps}`) + " Install Directory");
6073
6135
  const result = await stepInstallDir();
6074
6136
  if (result === BACK) {
6075
6137
  step = Math.max(0, step - 1);
@@ -6142,19 +6204,19 @@ async function setupCommand() {
6142
6204
  const url = `${protocol}://${config.domain}${portSuffix}`;
6143
6205
  R2.step("Configuration Summary");
6144
6206
  R2.message([
6145
- ` ${import_picocolors7.default.dim("Directory:")} ${resolvedDir}`,
6146
- ` ${import_picocolors7.default.dim("Channel:")} ${config.channel === "dev" ? import_picocolors7.default.yellow("Dev (:dev)") : import_picocolors7.default.green("Stable")}`,
6147
- ` ${import_picocolors7.default.dim("URL:")} ${url}`,
6148
- ` ${import_picocolors7.default.dim("HTTPS:")} ${config.autoSsl ? "Auto SSL (Caddy)" : config.useHttps ? "Manual" : "Disabled"}`,
6149
- ` ${import_picocolors7.default.dim("Database:")} ${config.useExternalDb ? "External" : config.useAiDatabase ? "Local (Docker, AI-enabled)" : "Local (Docker)"}`,
6150
- ` ${import_picocolors7.default.dim("Redis:")} ${config.useExternalRedis ? "External" : "Local (Docker)"}`,
6151
- ` ${import_picocolors7.default.dim("Organization:")} ${config.orgName}`,
6152
- ` ${import_picocolors7.default.dim("Admin:")} ${config.adminEmail}`,
6153
- ` ${import_picocolors7.default.dim("AI:")} ${config.aiEnabled ? "Enabled" : "Disabled"}`,
6154
- ` ${import_picocolors7.default.dim("Email:")} ${config.emailEnabled ? "Enabled" : "Disabled"}`,
6155
- ` ${import_picocolors7.default.dim("S3 Storage:")} ${config.s3Enabled ? "Enabled" : "Disabled"}`,
6156
- ` ${import_picocolors7.default.dim("Google OAuth:")} ${config.googleOAuthEnabled ? "Enabled" : "Disabled"}`,
6157
- ` ${import_picocolors7.default.dim("Unsplash:")} ${config.unsplashEnabled ? "Enabled" : "Disabled"}`
6207
+ ` ${import_picocolors8.default.dim("Directory:")} ${resolvedDir}`,
6208
+ ` ${import_picocolors8.default.dim("Channel:")} ${config.channel === "dev" ? import_picocolors8.default.yellow("Dev (:dev)") : import_picocolors8.default.green("Stable")}`,
6209
+ ` ${import_picocolors8.default.dim("URL:")} ${url}`,
6210
+ ` ${import_picocolors8.default.dim("HTTPS:")} ${config.autoSsl ? "Auto SSL (Caddy)" : config.useHttps ? "Manual" : "Disabled"}`,
6211
+ ` ${import_picocolors8.default.dim("Database:")} ${config.useExternalDb ? "External" : config.useAiDatabase ? "Local (Docker, AI-enabled)" : "Local (Docker)"}`,
6212
+ ` ${import_picocolors8.default.dim("Redis:")} ${config.useExternalRedis ? "External" : "Local (Docker)"}`,
6213
+ ` ${import_picocolors8.default.dim("Organization:")} ${config.orgName}`,
6214
+ ` ${import_picocolors8.default.dim("Admin:")} ${config.adminEmail}`,
6215
+ ` ${import_picocolors8.default.dim("AI:")} ${config.aiEnabled ? "Enabled" : "Disabled"}`,
6216
+ ` ${import_picocolors8.default.dim("Email:")} ${config.emailEnabled ? "Enabled" : "Disabled"}`,
6217
+ ` ${import_picocolors8.default.dim("S3 Storage:")} ${config.s3Enabled ? "Enabled" : "Disabled"}`,
6218
+ ` ${import_picocolors8.default.dim("Google OAuth:")} ${config.googleOAuthEnabled ? "Enabled" : "Disabled"}`,
6219
+ ` ${import_picocolors8.default.dim("Unsplash:")} ${config.unsplashEnabled ? "Enabled" : "Disabled"}`
6158
6220
  ].join("\n"));
6159
6221
  let confirmed = false;
6160
6222
  while (!confirmed) {
@@ -6162,8 +6224,8 @@ async function setupCommand() {
6162
6224
  message: "What would you like to do?",
6163
6225
  options: [
6164
6226
  { value: "confirm", label: "Proceed with this configuration" },
6165
- { value: "edit", label: import_picocolors7.default.dim("Go back and edit a step") },
6166
- { value: "cancel", label: import_picocolors7.default.dim("Cancel setup") }
6227
+ { value: "edit", label: import_picocolors8.default.dim("Go back and edit a step") },
6228
+ { value: "cancel", label: import_picocolors8.default.dim("Cancel setup") }
6167
6229
  ]
6168
6230
  });
6169
6231
  if (Ct(action) || action === "cancel") {
@@ -6179,7 +6241,7 @@ async function setupCommand() {
6179
6241
  const idx = stepChoice;
6180
6242
  switch (idx) {
6181
6243
  case 0: {
6182
- R2.step(import_picocolors7.default.cyan(`Step 1/${totalSteps}`) + " Install Directory");
6244
+ R2.step(import_picocolors8.default.cyan(`Step 1/${totalSteps}`) + " Install Directory");
6183
6245
  const result = await stepInstallDir();
6184
6246
  if (result !== BACK) {
6185
6247
  resolvedDir = result;
@@ -6218,19 +6280,19 @@ async function setupCommand() {
6218
6280
  const url2 = `${p2}://${config.domain}${ps2}`;
6219
6281
  R2.step("Updated Configuration Summary");
6220
6282
  R2.message([
6221
- ` ${import_picocolors7.default.dim("Directory:")} ${config.installDir}`,
6222
- ` ${import_picocolors7.default.dim("Channel:")} ${config.channel === "dev" ? import_picocolors7.default.yellow("Dev (:dev)") : import_picocolors7.default.green("Stable")}`,
6223
- ` ${import_picocolors7.default.dim("URL:")} ${url2}`,
6224
- ` ${import_picocolors7.default.dim("HTTPS:")} ${config.autoSsl ? "Auto SSL (Caddy)" : config.useHttps ? "Manual" : "Disabled"}`,
6225
- ` ${import_picocolors7.default.dim("Database:")} ${config.useExternalDb ? "External" : config.useAiDatabase ? "Local (Docker, AI-enabled)" : "Local (Docker)"}`,
6226
- ` ${import_picocolors7.default.dim("Redis:")} ${config.useExternalRedis ? "External" : "Local (Docker)"}`,
6227
- ` ${import_picocolors7.default.dim("Organization:")} ${config.orgName}`,
6228
- ` ${import_picocolors7.default.dim("Admin:")} ${config.adminEmail}`,
6229
- ` ${import_picocolors7.default.dim("AI:")} ${config.aiEnabled ? "Enabled" : "Disabled"}`,
6230
- ` ${import_picocolors7.default.dim("Email:")} ${config.emailEnabled ? "Enabled" : "Disabled"}`,
6231
- ` ${import_picocolors7.default.dim("S3 Storage:")} ${config.s3Enabled ? "Enabled" : "Disabled"}`,
6232
- ` ${import_picocolors7.default.dim("Google OAuth:")} ${config.googleOAuthEnabled ? "Enabled" : "Disabled"}`,
6233
- ` ${import_picocolors7.default.dim("Unsplash:")} ${config.unsplashEnabled ? "Enabled" : "Disabled"}`
6283
+ ` ${import_picocolors8.default.dim("Directory:")} ${config.installDir}`,
6284
+ ` ${import_picocolors8.default.dim("Channel:")} ${config.channel === "dev" ? import_picocolors8.default.yellow("Dev (:dev)") : import_picocolors8.default.green("Stable")}`,
6285
+ ` ${import_picocolors8.default.dim("URL:")} ${url2}`,
6286
+ ` ${import_picocolors8.default.dim("HTTPS:")} ${config.autoSsl ? "Auto SSL (Caddy)" : config.useHttps ? "Manual" : "Disabled"}`,
6287
+ ` ${import_picocolors8.default.dim("Database:")} ${config.useExternalDb ? "External" : config.useAiDatabase ? "Local (Docker, AI-enabled)" : "Local (Docker)"}`,
6288
+ ` ${import_picocolors8.default.dim("Redis:")} ${config.useExternalRedis ? "External" : "Local (Docker)"}`,
6289
+ ` ${import_picocolors8.default.dim("Organization:")} ${config.orgName}`,
6290
+ ` ${import_picocolors8.default.dim("Admin:")} ${config.adminEmail}`,
6291
+ ` ${import_picocolors8.default.dim("AI:")} ${config.aiEnabled ? "Enabled" : "Disabled"}`,
6292
+ ` ${import_picocolors8.default.dim("Email:")} ${config.emailEnabled ? "Enabled" : "Disabled"}`,
6293
+ ` ${import_picocolors8.default.dim("S3 Storage:")} ${config.s3Enabled ? "Enabled" : "Disabled"}`,
6294
+ ` ${import_picocolors8.default.dim("Google OAuth:")} ${config.googleOAuthEnabled ? "Enabled" : "Disabled"}`,
6295
+ ` ${import_picocolors8.default.dim("Unsplash:")} ${config.unsplashEnabled ? "Enabled" : "Disabled"}`
6234
6296
  ].join("\n"));
6235
6297
  } else {
6236
6298
  confirmed = true;
@@ -6297,33 +6359,33 @@ async function setupCommand() {
6297
6359
  R2.warn("LearnHouse may still be starting. Check status with:");
6298
6360
  R2.message(` cd ${finalDir} && docker compose ps`);
6299
6361
  }
6300
- R2.success(import_picocolors7.default.green(import_picocolors7.default.bold("LearnHouse is installed!")));
6362
+ R2.success(import_picocolors8.default.green(import_picocolors8.default.bold("LearnHouse is installed!")));
6301
6363
  R2.message([
6302
6364
  "",
6303
- ` ${import_picocolors7.default.cyan("URL:")} ${finalUrl}`,
6304
- ` ${import_picocolors7.default.cyan("Admin:")} ${config.adminEmail}`,
6305
- ` ${import_picocolors7.default.cyan("Password:")} ${config.adminPassword}`,
6365
+ ` ${import_picocolors8.default.cyan("URL:")} ${finalUrl}`,
6366
+ ` ${import_picocolors8.default.cyan("Admin:")} ${config.adminEmail}`,
6367
+ ` ${import_picocolors8.default.cyan("Password:")} ${config.adminPassword}`,
6306
6368
  "",
6307
- ` ${import_picocolors7.default.dim("Management commands:")}`,
6308
- ` ${import_picocolors7.default.dim("$")} npx learnhouse start ${import_picocolors7.default.dim("Start services")}`,
6309
- ` ${import_picocolors7.default.dim("$")} npx learnhouse stop ${import_picocolors7.default.dim("Stop services")}`,
6310
- ` ${import_picocolors7.default.dim("$")} npx learnhouse logs ${import_picocolors7.default.dim("View logs")}`,
6311
- ` ${import_picocolors7.default.dim("$")} npx learnhouse config ${import_picocolors7.default.dim("Show configuration")}`,
6312
- ` ${import_picocolors7.default.dim("$")} npx learnhouse backup ${import_picocolors7.default.dim("Backup & restore")}`,
6313
- ` ${import_picocolors7.default.dim("$")} npx learnhouse deployments ${import_picocolors7.default.dim("Manage deployments")}`,
6314
- ` ${import_picocolors7.default.dim("$")} npx learnhouse doctor ${import_picocolors7.default.dim("Diagnose issues")}`,
6315
- ` ${import_picocolors7.default.dim("$")} npx learnhouse shell ${import_picocolors7.default.dim("Container shell")}`,
6369
+ ` ${import_picocolors8.default.dim("Management commands:")}`,
6370
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse start ${import_picocolors8.default.dim("Start services")}`,
6371
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse stop ${import_picocolors8.default.dim("Stop services")}`,
6372
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse logs ${import_picocolors8.default.dim("View logs")}`,
6373
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse config ${import_picocolors8.default.dim("Show configuration")}`,
6374
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse backup ${import_picocolors8.default.dim("Backup & restore")}`,
6375
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse deployments ${import_picocolors8.default.dim("Manage deployments")}`,
6376
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse doctor ${import_picocolors8.default.dim("Diagnose issues")}`,
6377
+ ` ${import_picocolors8.default.dim("$")} npx learnhouse shell ${import_picocolors8.default.dim("Container shell")}`,
6316
6378
  ""
6317
6379
  ].join("\n"));
6318
6380
  } else {
6319
6381
  R2.info(`Files have been generated in ${finalDir}`);
6320
6382
  R2.message(` Start later with: cd ${finalDir} && docker compose up -d`);
6321
6383
  }
6322
- Le(import_picocolors7.default.dim("Happy teaching!"));
6384
+ Le(import_picocolors8.default.dim("Happy teaching!"));
6323
6385
  }
6324
6386
 
6325
6387
  // src/commands/start.ts
6326
- var import_picocolors8 = __toESM(require_picocolors(), 1);
6388
+ var import_picocolors9 = __toESM(require_picocolors(), 1);
6327
6389
  async function startCommand() {
6328
6390
  const dir = findInstallDir();
6329
6391
  const config = readConfig(dir);
@@ -6332,7 +6394,7 @@ async function startCommand() {
6332
6394
  R2.info("Run `npx learnhouse` to set up a new installation.");
6333
6395
  process.exit(1);
6334
6396
  }
6335
- We(import_picocolors8.default.cyan("Starting LearnHouse"));
6397
+ We(import_picocolors9.default.cyan("Starting LearnHouse"));
6336
6398
  try {
6337
6399
  dockerComposeUp(config.installDir);
6338
6400
  R2.success("LearnHouse is running!");
@@ -6343,7 +6405,7 @@ async function startCommand() {
6343
6405
  }
6344
6406
 
6345
6407
  // src/commands/stop.ts
6346
- var import_picocolors9 = __toESM(require_picocolors(), 1);
6408
+ var import_picocolors10 = __toESM(require_picocolors(), 1);
6347
6409
  async function stopCommand() {
6348
6410
  const dir = findInstallDir();
6349
6411
  const config = readConfig(dir);
@@ -6351,7 +6413,7 @@ async function stopCommand() {
6351
6413
  R2.error("No LearnHouse installation found in the current directory.");
6352
6414
  process.exit(1);
6353
6415
  }
6354
- We(import_picocolors9.default.cyan("Stopping LearnHouse"));
6416
+ We(import_picocolors10.default.cyan("Stopping LearnHouse"));
6355
6417
  try {
6356
6418
  dockerComposeDown(config.installDir);
6357
6419
  R2.success("LearnHouse stopped.");
@@ -6391,7 +6453,7 @@ async function logsCommand() {
6391
6453
  }
6392
6454
 
6393
6455
  // src/commands/config.ts
6394
- var import_picocolors10 = __toESM(require_picocolors(), 1);
6456
+ var import_picocolors11 = __toESM(require_picocolors(), 1);
6395
6457
  async function configCommand() {
6396
6458
  const dir = findInstallDir();
6397
6459
  const config = readConfig(dir);
@@ -6399,27 +6461,28 @@ async function configCommand() {
6399
6461
  R2.error("No LearnHouse installation found in the current directory.");
6400
6462
  process.exit(1);
6401
6463
  }
6402
- We(import_picocolors10.default.cyan("LearnHouse Configuration"));
6464
+ We(import_picocolors11.default.cyan("LearnHouse Configuration"));
6403
6465
  const protocol = config.useHttps ? "https" : "http";
6404
6466
  const portSuffix = config.useHttps && config.httpPort === 443 || !config.useHttps && config.httpPort === 80 ? "" : `:${config.httpPort}`;
6405
6467
  R2.message([
6406
- ` ${import_picocolors10.default.dim("Version:")} ${config.version}`,
6407
- ` ${import_picocolors10.default.dim("Created:")} ${config.createdAt}`,
6408
- ` ${import_picocolors10.default.dim("Directory:")} ${config.installDir}`,
6409
- ` ${import_picocolors10.default.dim("URL:")} ${protocol}://${config.domain}${portSuffix}`,
6410
- ` ${import_picocolors10.default.dim("Org slug:")} ${config.orgSlug}`
6468
+ ` ${import_picocolors11.default.dim("Version:")} ${config.version}`,
6469
+ ` ${import_picocolors11.default.dim("Created:")} ${config.createdAt}`,
6470
+ ` ${import_picocolors11.default.dim("Directory:")} ${config.installDir}`,
6471
+ ` ${import_picocolors11.default.dim("URL:")} ${protocol}://${config.domain}${portSuffix}`,
6472
+ ` ${import_picocolors11.default.dim("Org slug:")} ${config.orgSlug}`
6411
6473
  ].join("\n"));
6412
- R2.info(import_picocolors10.default.dim(`Full config: ${dir}/learnhouse.config.json`));
6413
- R2.info(import_picocolors10.default.dim(`Environment: ${config.installDir}/.env (contains secrets)`));
6474
+ R2.info(import_picocolors11.default.dim(`Full config: ${dir}/learnhouse.config.json`));
6475
+ R2.info(import_picocolors11.default.dim(`Environment: ${config.installDir}/.env (contains secrets)`));
6414
6476
  }
6415
6477
 
6416
6478
  // src/commands/backup.ts
6417
6479
  import fs3 from "fs";
6418
6480
  import path3 from "path";
6419
6481
  import { execSync as execSync2 } from "child_process";
6420
- var import_picocolors11 = __toESM(require_picocolors(), 1);
6482
+ var import_picocolors12 = __toESM(require_picocolors(), 1);
6421
6483
  function resolveDbContainer(config) {
6422
6484
  const id = config.deploymentId || autoDetectDeploymentId();
6485
+ if (!id) return null;
6423
6486
  return `learnhouse-db-${id}`;
6424
6487
  }
6425
6488
  async function createBackup() {
@@ -6435,7 +6498,7 @@ async function createBackup() {
6435
6498
  process.exit(1);
6436
6499
  }
6437
6500
  const dbContainer = resolveDbContainer(config);
6438
- if (!isContainerRunning(dbContainer)) {
6501
+ if (!dbContainer || !isContainerRunning(dbContainer)) {
6439
6502
  R2.error("Database container is not running. Start services first.");
6440
6503
  process.exit(1);
6441
6504
  }
@@ -6480,13 +6543,13 @@ async function createBackup() {
6480
6543
  fs3.rmSync(tmpDir, { recursive: true, force: true });
6481
6544
  const stats = fs3.statSync(archivePath);
6482
6545
  const sizeMb = (stats.size / (1024 * 1024)).toFixed(1);
6483
- R2.success(import_picocolors11.default.green(import_picocolors11.default.bold("Backup complete!")));
6546
+ R2.success(import_picocolors12.default.green(import_picocolors12.default.bold("Backup complete!")));
6484
6547
  R2.message([
6485
6548
  "",
6486
- ` ${import_picocolors11.default.dim("File:")} ${archivePath}`,
6487
- ` ${import_picocolors11.default.dim("Size:")} ${sizeMb} MB`,
6549
+ ` ${import_picocolors12.default.dim("File:")} ${archivePath}`,
6550
+ ` ${import_picocolors12.default.dim("Size:")} ${sizeMb} MB`,
6488
6551
  "",
6489
- ` ${import_picocolors11.default.dim("Restore with:")} npx learnhouse backup --restore ${archivePath}`,
6552
+ ` ${import_picocolors12.default.dim("Restore with:")} npx learnhouse backup --restore ${archivePath}`,
6490
6553
  ""
6491
6554
  ].join("\n"));
6492
6555
  }
@@ -6507,11 +6570,11 @@ async function restoreBackup(archivePath) {
6507
6570
  process.exit(1);
6508
6571
  }
6509
6572
  const dbContainer = resolveDbContainer(config);
6510
- if (!isContainerRunning(dbContainer)) {
6573
+ if (!dbContainer || !isContainerRunning(dbContainer)) {
6511
6574
  R2.error("Database container is not running. Start services first.");
6512
6575
  process.exit(1);
6513
6576
  }
6514
- R2.warn(import_picocolors11.default.yellow("This will overwrite the current database with the backup data."));
6577
+ R2.warn(import_picocolors12.default.yellow("This will overwrite the current database with the backup data."));
6515
6578
  const confirm = await Re({
6516
6579
  message: "Are you sure you want to restore from this backup?",
6517
6580
  initialValue: false
@@ -6570,16 +6633,16 @@ async function restoreBackup(archivePath) {
6570
6633
  }
6571
6634
  }
6572
6635
  fs3.rmSync(tmpDir, { recursive: true, force: true });
6573
- R2.success(import_picocolors11.default.green(import_picocolors11.default.bold("Restore complete!")));
6636
+ R2.success(import_picocolors12.default.green(import_picocolors12.default.bold("Restore complete!")));
6574
6637
  R2.info("You may want to restart services: npx learnhouse stop && npx learnhouse start");
6575
6638
  }
6576
6639
  async function backupCommand(archivePath, options) {
6577
6640
  if (options?.restore && archivePath) {
6578
- We(import_picocolors11.default.cyan("LearnHouse Restore"));
6641
+ We(import_picocolors12.default.cyan("LearnHouse Restore"));
6579
6642
  await restoreBackup(archivePath);
6580
6643
  return;
6581
6644
  }
6582
- We(import_picocolors11.default.cyan("LearnHouse Backup"));
6645
+ We(import_picocolors12.default.cyan("LearnHouse Backup"));
6583
6646
  const action = await Je({
6584
6647
  message: "What would you like to do?",
6585
6648
  options: [
@@ -6594,7 +6657,7 @@ async function backupCommand(archivePath, options) {
6594
6657
  if (action === "create") {
6595
6658
  await createBackup();
6596
6659
  } else {
6597
- const filePath = await Ze({
6660
+ const filePath = await text({
6598
6661
  message: "Path to backup archive (.tar.gz)",
6599
6662
  placeholder: "./backups/learnhouse-backup-*.tar.gz"
6600
6663
  });
@@ -6610,7 +6673,7 @@ async function backupCommand(archivePath, options) {
6610
6673
  import fs4 from "fs";
6611
6674
  import path4 from "path";
6612
6675
  import { execSync as execSync3 } from "child_process";
6613
- var import_picocolors12 = __toESM(require_picocolors(), 1);
6676
+ var import_picocolors13 = __toESM(require_picocolors(), 1);
6614
6677
  var SERVICES = ["learnhouse-app", "db", "redis"];
6615
6678
  function showDeployments() {
6616
6679
  let psOutput;
@@ -6625,7 +6688,7 @@ function showDeployments() {
6625
6688
  }
6626
6689
  if (!psOutput) {
6627
6690
  R2.info("No LearnHouse deployments found.");
6628
- R2.message(import_picocolors12.default.dim(" Run npx learnhouse setup to create one."));
6691
+ R2.message(import_picocolors13.default.dim(" Run npx learnhouse setup to create one."));
6629
6692
  return;
6630
6693
  }
6631
6694
  const deployments = /* @__PURE__ */ new Map();
@@ -6649,20 +6712,20 @@ function showDeployments() {
6649
6712
  }
6650
6713
  deployments.get(id).containers.push({ name, status, image });
6651
6714
  }
6652
- R2.info(`Found ${import_picocolors12.default.bold(String(deployments.size))} deployment${deployments.size === 1 ? "" : "s"}`);
6715
+ R2.info(`Found ${import_picocolors13.default.bold(String(deployments.size))} deployment${deployments.size === 1 ? "" : "s"}`);
6653
6716
  console.log();
6654
6717
  for (const [id, dep] of deployments) {
6655
6718
  const running = dep.containers.filter((c) => c.status.toLowerCase().startsWith("up")).length;
6656
6719
  const total = dep.containers.length;
6657
- const statusColor = running === total ? import_picocolors12.default.green : running > 0 ? import_picocolors12.default.yellow : import_picocolors12.default.red;
6720
+ const statusColor = running === total ? import_picocolors13.default.green : running > 0 ? import_picocolors13.default.yellow : import_picocolors13.default.red;
6658
6721
  const statusText = statusColor(`${running}/${total} running`);
6659
- console.log(` ${import_picocolors12.default.bold(import_picocolors12.default.white(`Deployment ${id}`))} ${statusText}`);
6722
+ console.log(` ${import_picocolors13.default.bold(import_picocolors13.default.white(`Deployment ${id}`))} ${statusText}`);
6660
6723
  console.log();
6661
6724
  for (const c of dep.containers) {
6662
6725
  const isUp = c.status.toLowerCase().startsWith("up");
6663
- const icon = isUp ? import_picocolors12.default.green("\u25CF") : import_picocolors12.default.red("\u25CF");
6726
+ const icon = isUp ? import_picocolors13.default.green("\u25CF") : import_picocolors13.default.red("\u25CF");
6664
6727
  const svcName = c.name.replace(`-${id}`, "");
6665
- console.log(` ${icon} ${import_picocolors12.default.white(svcName.padEnd(24))} ${import_picocolors12.default.dim(c.status)}`);
6728
+ console.log(` ${icon} ${import_picocolors13.default.white(svcName.padEnd(24))} ${import_picocolors13.default.dim(c.status)}`);
6666
6729
  }
6667
6730
  console.log();
6668
6731
  }
@@ -6735,13 +6798,14 @@ async function scaleResources() {
6735
6798
  R2.step("Current Resource Usage");
6736
6799
  try {
6737
6800
  const stats = dockerStats(config.installDir);
6738
- R2.message(import_picocolors12.default.dim(stats.trim()));
6801
+ R2.message(import_picocolors13.default.dim(stats.trim()));
6739
6802
  } catch {
6740
6803
  try {
6741
- const running = listDeploymentContainers(config.deploymentId).filter((c) => c.status.toLowerCase().startsWith("up")).map((c) => c.name);
6804
+ const id = config.deploymentId || autoDetectDeploymentId();
6805
+ const running = listDeploymentContainers(id || void 0).filter((c) => c.status.toLowerCase().startsWith("up")).map((c) => c.name);
6742
6806
  if (running.length > 0) {
6743
6807
  const stats = dockerStatsForContainers(running);
6744
- R2.message(import_picocolors12.default.dim(stats.trim()));
6808
+ R2.message(import_picocolors13.default.dim(stats.trim()));
6745
6809
  } else {
6746
6810
  R2.warn("No running containers found.");
6747
6811
  }
@@ -6749,7 +6813,7 @@ async function scaleResources() {
6749
6813
  R2.warn("Could not retrieve current stats. Services may not be running.");
6750
6814
  }
6751
6815
  }
6752
- const composePath = path4.join(config.installDir, "docker-compose.yml");
6816
+ const composePath = path4.join(config.installDir || dir, "docker-compose.yml");
6753
6817
  if (!fs4.existsSync(composePath)) {
6754
6818
  R2.error("docker-compose.yml not found.");
6755
6819
  process.exit(1);
@@ -6757,12 +6821,12 @@ async function scaleResources() {
6757
6821
  let composeContent = fs4.readFileSync(composePath, "utf-8");
6758
6822
  const currentLimits = parseMemLimit(composePath);
6759
6823
  R2.step("Set Memory Limits");
6760
- R2.info(import_picocolors12.default.dim("Examples: 256m, 512m, 1g, 2g (leave empty to skip)"));
6824
+ R2.info(import_picocolors13.default.dim("Examples: 256m, 512m, 1g, 2g (leave empty to skip)"));
6761
6825
  let changed = false;
6762
6826
  for (const service of SERVICES) {
6763
6827
  const current = currentLimits.get(service);
6764
- const label = current ? `Memory limit for ${import_picocolors12.default.bold(service)} (current: ${current})` : `Memory limit for ${import_picocolors12.default.bold(service)} (not set)`;
6765
- const value = await Ze({
6828
+ const label = current ? `Memory limit for ${import_picocolors13.default.bold(service)} (current: ${current})` : `Memory limit for ${import_picocolors13.default.bold(service)} (not set)`;
6829
+ const value = await text({
6766
6830
  message: label,
6767
6831
  placeholder: current ? void 0 : "e.g. 512m",
6768
6832
  defaultValue: current || ""
@@ -6804,7 +6868,7 @@ async function scaleResources() {
6804
6868
  }
6805
6869
  }
6806
6870
  async function deploymentsCommand() {
6807
- We(import_picocolors12.default.cyan("LearnHouse Deployments"));
6871
+ We(import_picocolors13.default.cyan("LearnHouse Deployments"));
6808
6872
  const action = await Je({
6809
6873
  message: "What would you like to do?",
6810
6874
  options: [
@@ -6821,24 +6885,24 @@ async function deploymentsCommand() {
6821
6885
  } else {
6822
6886
  await scaleResources();
6823
6887
  }
6824
- Le(import_picocolors12.default.dim("Done"));
6888
+ Le(import_picocolors13.default.dim("Done"));
6825
6889
  }
6826
6890
 
6827
6891
  // src/commands/doctor.ts
6828
6892
  import fs5 from "fs";
6829
6893
  import path5 from "path";
6830
6894
  import { execSync as execSync4 } from "child_process";
6831
- var import_picocolors13 = __toESM(require_picocolors(), 1);
6895
+ var import_picocolors14 = __toESM(require_picocolors(), 1);
6832
6896
  function pass(msg) {
6833
- console.log(` ${import_picocolors13.default.green("\u2713")} ${msg}`);
6897
+ console.log(` ${import_picocolors14.default.green("\u2713")} ${msg}`);
6834
6898
  }
6835
6899
  function warn(msg, fix) {
6836
- console.log(` ${import_picocolors13.default.yellow("!")} ${msg}`);
6837
- if (fix) console.log(` ${import_picocolors13.default.dim(`Fix: ${fix}`)}`);
6900
+ console.log(` ${import_picocolors14.default.yellow("!")} ${msg}`);
6901
+ if (fix) console.log(` ${import_picocolors14.default.dim(`Fix: ${fix}`)}`);
6838
6902
  }
6839
6903
  function fail(msg, fix) {
6840
- console.log(` ${import_picocolors13.default.red("\u2717")} ${msg}`);
6841
- if (fix) console.log(` ${import_picocolors13.default.dim(`Fix: ${fix}`)}`);
6904
+ console.log(` ${import_picocolors14.default.red("\u2717")} ${msg}`);
6905
+ if (fix) console.log(` ${import_picocolors14.default.dim(`Fix: ${fix}`)}`);
6842
6906
  }
6843
6907
  var REQUIRED_ENV_VARS = [
6844
6908
  "LEARNHOUSE_DOMAIN",
@@ -6856,17 +6920,17 @@ var SECRET_ENV_VARS = [
6856
6920
  async function doctorCommand() {
6857
6921
  const dir = findInstallDir();
6858
6922
  const config = readConfig(dir);
6859
- We(import_picocolors13.default.cyan("LearnHouse Doctor"));
6923
+ We(import_picocolors14.default.cyan("LearnHouse Doctor"));
6860
6924
  R2.step("Docker Environment");
6861
6925
  if (!isDockerInstalled()) {
6862
6926
  fail("Docker not installed", "Install Docker: https://docs.docker.com/get-docker/");
6863
- Le(import_picocolors13.default.red("Cannot continue without Docker"));
6927
+ Le(import_picocolors14.default.red("Cannot continue without Docker"));
6864
6928
  process.exit(1);
6865
6929
  }
6866
6930
  pass("Docker installed");
6867
6931
  if (!isDockerRunning()) {
6868
6932
  fail("Docker daemon not running", "Start Docker Desktop or run: sudo systemctl start docker");
6869
- Le(import_picocolors13.default.red("Cannot continue without Docker running"));
6933
+ Le(import_picocolors14.default.red("Cannot continue without Docker running"));
6870
6934
  process.exit(1);
6871
6935
  }
6872
6936
  pass("Docker daemon running");
@@ -6877,11 +6941,16 @@ async function doctorCommand() {
6877
6941
  }
6878
6942
  if (!config) {
6879
6943
  R2.warn("No LearnHouse installation found. Skipping deployment checks.");
6880
- Le(import_picocolors13.default.dim("Done"));
6944
+ Le(import_picocolors14.default.dim("Done"));
6881
6945
  return;
6882
6946
  }
6883
6947
  const id = config.deploymentId || autoDetectDeploymentId();
6884
6948
  const installDir = dir;
6949
+ if (!id) {
6950
+ R2.warn("No deployment ID found. Skipping container checks.");
6951
+ Le(import_picocolors14.default.dim("Done"));
6952
+ return;
6953
+ }
6885
6954
  R2.step("Containers");
6886
6955
  const containers = listDeploymentContainers(id);
6887
6956
  if (containers.length === 0) {
@@ -6950,7 +7019,7 @@ async function doctorCommand() {
6950
7019
  }
6951
7020
  try {
6952
7021
  const diskUsage = getDockerDiskUsage();
6953
- R2.message(import_picocolors13.default.dim(diskUsage.trim()));
7022
+ R2.message(import_picocolors14.default.dim(diskUsage.trim()));
6954
7023
  } catch {
6955
7024
  }
6956
7025
  R2.step("Log Analysis");
@@ -6964,7 +7033,7 @@ async function doctorCommand() {
6964
7033
  if (errorLines.length > 0) {
6965
7034
  warn(`${svcName} \u2014 ${errorLines.length} error(s) in last 50 log lines`);
6966
7035
  for (const line of errorLines.slice(0, 3)) {
6967
- console.log(` ${import_picocolors13.default.dim(line.trim().slice(0, 120))}`);
7036
+ console.log(` ${import_picocolors14.default.dim(line.trim().slice(0, 120))}`);
6968
7037
  }
6969
7038
  } else {
6970
7039
  pass(`${svcName} \u2014 no errors in recent logs`);
@@ -7018,11 +7087,11 @@ async function doctorCommand() {
7018
7087
  }
7019
7088
  }
7020
7089
  console.log();
7021
- Le(import_picocolors13.default.dim("Diagnosis complete"));
7090
+ Le(import_picocolors14.default.dim("Diagnosis complete"));
7022
7091
  }
7023
7092
 
7024
7093
  // src/commands/shell.ts
7025
- var import_picocolors14 = __toESM(require_picocolors(), 1);
7094
+ var import_picocolors15 = __toESM(require_picocolors(), 1);
7026
7095
  async function shellCommand() {
7027
7096
  const dir = findInstallDir();
7028
7097
  const config = readConfig(dir);
@@ -7031,7 +7100,11 @@ async function shellCommand() {
7031
7100
  process.exit(1);
7032
7101
  }
7033
7102
  const id = config.deploymentId || autoDetectDeploymentId();
7034
- const containers = listDeploymentContainers(id || void 0).filter((c) => c.status.toLowerCase().startsWith("up"));
7103
+ if (!id) {
7104
+ R2.error("No deployment found. Start services first.");
7105
+ process.exit(1);
7106
+ }
7107
+ const containers = listDeploymentContainers(id).filter((c) => c.status.toLowerCase().startsWith("up"));
7035
7108
  if (containers.length === 0) {
7036
7109
  R2.error("No running containers found. Start services first.");
7037
7110
  process.exit(1);
@@ -7040,7 +7113,7 @@ async function shellCommand() {
7040
7113
  message: "Select a container",
7041
7114
  options: containers.map((c) => ({
7042
7115
  value: c.name,
7043
- label: `${c.name.replace(`-${id}`, "")} ${import_picocolors14.default.dim(`(${c.name})`)}`
7116
+ label: `${c.name.replace(`-${id}`, "")} ${import_picocolors15.default.dim(`(${c.name})`)}`
7044
7117
  }))
7045
7118
  });
7046
7119
  if (Ct(selected)) {
@@ -7053,7 +7126,7 @@ async function shellCommand() {
7053
7126
 
7054
7127
  // src/commands/dev.ts
7055
7128
  import { spawn as spawn2, spawnSync as spawnSync2, execSync as execSync5 } from "child_process";
7056
- var import_picocolors16 = __toESM(require_picocolors(), 1);
7129
+ var import_picocolors17 = __toESM(require_picocolors(), 1);
7057
7130
  import * as path7 from "path";
7058
7131
  import * as fs7 from "fs";
7059
7132
 
@@ -7061,7 +7134,7 @@ import * as fs7 from "fs";
7061
7134
  import * as fs6 from "fs";
7062
7135
  import * as path6 from "path";
7063
7136
  import * as crypto4 from "crypto";
7064
- var import_picocolors15 = __toESM(require_picocolors(), 1);
7137
+ var import_picocolors16 = __toESM(require_picocolors(), 1);
7065
7138
  function generateJwtSecret() {
7066
7139
  return crypto4.randomBytes(32).toString("base64url");
7067
7140
  }
@@ -7188,9 +7261,9 @@ async function checkDevEnv(root) {
7188
7261
  byApp.set(m.app.label, list);
7189
7262
  }
7190
7263
  for (const [label, vars] of byApp) {
7191
- console.log(` ${import_picocolors15.default.bold(label)} ${import_picocolors15.default.dim(`(${vars[0].app.envFile})`)}`);
7264
+ console.log(` ${import_picocolors16.default.bold(label)} ${import_picocolors16.default.dim(`(${vars[0].app.envFile})`)}`);
7192
7265
  for (const m of vars) {
7193
- console.log(` ${import_picocolors15.default.red("\u2717")} ${import_picocolors15.default.cyan(m.envVar.name)} \u2014 ${import_picocolors15.default.dim(m.envVar.description)}`);
7266
+ console.log(` ${import_picocolors16.default.red("\u2717")} ${import_picocolors16.default.cyan(m.envVar.name)} \u2014 ${import_picocolors16.default.dim(m.envVar.description)}`);
7194
7267
  }
7195
7268
  console.log();
7196
7269
  }
@@ -7226,8 +7299,8 @@ async function checkDevEnv(root) {
7226
7299
  }
7227
7300
  if (toWrite.size > 0) {
7228
7301
  appendToEnvFile(filePath, toWrite);
7229
- const names = [...toWrite.keys()].map((k2) => import_picocolors15.default.cyan(k2)).join(", ");
7230
- R2.success(`${import_picocolors15.default.bold(app.label)}: wrote ${names} \u2192 ${import_picocolors15.default.dim(app.envFile)}`);
7302
+ const names = [...toWrite.keys()].map((k2) => import_picocolors16.default.cyan(k2)).join(", ");
7303
+ R2.success(`${import_picocolors16.default.bold(app.label)}: wrote ${names} \u2192 ${import_picocolors16.default.dim(app.envFile)}`);
7231
7304
  }
7232
7305
  }
7233
7306
  console.log();
@@ -7308,7 +7381,7 @@ async function waitForHealth2(label, command, args, maxAttempts = 30) {
7308
7381
  }
7309
7382
  return false;
7310
7383
  }
7311
- var CONTROLS_BAR = import_picocolors16.default.dim("\u2500".repeat(60)) + "\n" + import_picocolors16.default.dim(" ") + import_picocolors16.default.bold("ra") + import_picocolors16.default.dim(" restart api ") + import_picocolors16.default.bold("rw") + import_picocolors16.default.dim(" restart web ") + import_picocolors16.default.bold("rc") + import_picocolors16.default.dim(" restart collab ") + import_picocolors16.default.bold("rb") + import_picocolors16.default.dim(" restart all ") + import_picocolors16.default.bold("q") + import_picocolors16.default.dim(" quit") + "\n" + import_picocolors16.default.dim("\u2500".repeat(60));
7384
+ var CONTROLS_BAR = import_picocolors17.default.dim("\u2500".repeat(60)) + "\n" + import_picocolors17.default.dim(" ") + import_picocolors17.default.bold("ra") + import_picocolors17.default.dim(" restart api ") + import_picocolors17.default.bold("rw") + import_picocolors17.default.dim(" restart web ") + import_picocolors17.default.bold("rc") + import_picocolors17.default.dim(" restart collab ") + import_picocolors17.default.bold("rb") + import_picocolors17.default.dim(" restart all ") + import_picocolors17.default.bold("q") + import_picocolors17.default.dim(" quit") + "\n" + import_picocolors17.default.dim("\u2500".repeat(60));
7312
7385
  var lineCount = 0;
7313
7386
  var CONTROLS_INTERVAL = 50;
7314
7387
  function printControls() {
@@ -7389,7 +7462,7 @@ async function devCommand(opts) {
7389
7462
  R2.info("Run this command from within the learnhouse monorepo (must contain dev/docker-compose.yml, apps/api/, and apps/web/).");
7390
7463
  process.exit(1);
7391
7464
  }
7392
- We(import_picocolors16.default.cyan("LearnHouse Dev Mode"));
7465
+ We(import_picocolors17.default.cyan("LearnHouse Dev Mode"));
7393
7466
  const envOk = await checkDevEnv(root);
7394
7467
  if (!envOk) process.exit(1);
7395
7468
  const eePath = path7.join(root, "apps", "api", "ee");
@@ -7403,7 +7476,7 @@ async function devCommand(opts) {
7403
7476
  eeWasHidden = true;
7404
7477
  } else if (opts.ee) {
7405
7478
  if (fs7.existsSync(eePath)) {
7406
- R2.info(`Running in ${import_picocolors16.default.bold("EE")} mode`);
7479
+ R2.info(`Running in ${import_picocolors17.default.bold("EE")} mode`);
7407
7480
  } else {
7408
7481
  R2.warning("--ee was passed but no ee/ folder found \u2014 running in OSS mode");
7409
7482
  }
@@ -7423,7 +7496,7 @@ async function devCommand(opts) {
7423
7496
  R2.success("Existing DB and Redis containers detected \u2014 reusing them");
7424
7497
  }
7425
7498
  if (!alreadyRunning) {
7426
- const email = await Ze({
7499
+ const email = await text({
7427
7500
  message: "Admin email",
7428
7501
  placeholder: "admin@school.dev",
7429
7502
  defaultValue: "admin@school.dev"
@@ -7502,27 +7575,27 @@ async function devCommand(opts) {
7502
7575
  let webProc = null;
7503
7576
  let collabProc = null;
7504
7577
  const startApi = () => {
7505
- return spawnService("uv", ["run", "python", "app.py"], path7.join(root, "apps", "api"), "api", import_picocolors16.default.magenta);
7578
+ return spawnService("uv", ["run", "python", "app.py"], path7.join(root, "apps", "api"), "api", import_picocolors17.default.magenta);
7506
7579
  };
7507
7580
  const startWeb = () => {
7508
- return spawnService("next", ["dev", "--turbopack"], path7.join(root, "apps", "web"), "web", import_picocolors16.default.cyan);
7581
+ return spawnService("next", ["dev", "--turbopack"], path7.join(root, "apps", "web"), "web", import_picocolors17.default.cyan);
7509
7582
  };
7510
7583
  const startCollab = () => {
7511
- return spawnService("tsx", ["watch", "src/index.ts"], path7.join(root, "apps", "collab"), "collab", import_picocolors16.default.yellow);
7584
+ return spawnService("tsx", ["watch", "src/index.ts"], path7.join(root, "apps", "collab"), "collab", import_picocolors17.default.yellow);
7512
7585
  };
7513
7586
  apiProc = startApi();
7514
7587
  webProc = startWeb();
7515
7588
  collabProc = startCollab();
7516
7589
  R2.success("API, Web, and Collab servers started");
7517
7590
  console.log();
7518
- console.log(import_picocolors16.default.dim(" Thank you for contributing to LearnHouse!"));
7591
+ console.log(import_picocolors17.default.dim(" Thank you for contributing to LearnHouse!"));
7519
7592
  console.log();
7520
7593
  printControls();
7521
7594
  let shuttingDown = false;
7522
7595
  const shutdown = async () => {
7523
7596
  if (shuttingDown) return;
7524
7597
  shuttingDown = true;
7525
- console.log("\n" + import_picocolors16.default.dim("Shutting down dev servers..."));
7598
+ console.log("\n" + import_picocolors17.default.dim("Shutting down dev servers..."));
7526
7599
  if (process.stdin.isTTY && process.stdin.isRaw) {
7527
7600
  process.stdin.setRawMode(false);
7528
7601
  }
@@ -7531,9 +7604,9 @@ async function devCommand(opts) {
7531
7604
  if (eeWasHidden && fs7.existsSync(eeDisabledPath) && !fs7.existsSync(eePath)) {
7532
7605
  fs7.renameSync(eeDisabledPath, eePath);
7533
7606
  }
7534
- console.log(import_picocolors16.default.dim("DB and Redis containers are still running for next session."));
7535
- console.log(import_picocolors16.default.dim("To stop them: docker compose -f .learnhouse/docker-compose.dev.yml -p learnhouse-dev down"));
7536
- console.log(import_picocolors16.default.dim("Thanks for building with LearnHouse!"));
7607
+ console.log(import_picocolors17.default.dim("DB and Redis containers are still running for next session."));
7608
+ console.log(import_picocolors17.default.dim("To stop them: docker compose -f .learnhouse/docker-compose.dev.yml -p learnhouse-dev down"));
7609
+ console.log(import_picocolors17.default.dim("Thanks for building with LearnHouse!"));
7537
7610
  process.exit(0);
7538
7611
  };
7539
7612
  process.on("SIGINT", shutdown);
@@ -7562,22 +7635,22 @@ async function devCommand(opts) {
7562
7635
  if (pendingR) {
7563
7636
  pendingR = false;
7564
7637
  if (key === "a") {
7565
- console.log(import_picocolors16.default.magenta("\n Restarting API...\n"));
7638
+ console.log(import_picocolors17.default.magenta("\n Restarting API...\n"));
7566
7639
  await killProcess(apiProc);
7567
7640
  apiProc = startApi();
7568
7641
  printControls();
7569
7642
  } else if (key === "w") {
7570
- console.log(import_picocolors16.default.cyan("\n Restarting Web...\n"));
7643
+ console.log(import_picocolors17.default.cyan("\n Restarting Web...\n"));
7571
7644
  await killProcess(webProc);
7572
7645
  webProc = startWeb();
7573
7646
  printControls();
7574
7647
  } else if (key === "c") {
7575
- console.log(import_picocolors16.default.yellow("\n Restarting Collab...\n"));
7648
+ console.log(import_picocolors17.default.yellow("\n Restarting Collab...\n"));
7576
7649
  await killProcess(collabProc);
7577
7650
  collabProc = startCollab();
7578
7651
  printControls();
7579
7652
  } else if (key === "b") {
7580
- console.log(import_picocolors16.default.yellow("\n Restarting all...\n"));
7653
+ console.log(import_picocolors17.default.yellow("\n Restarting all...\n"));
7581
7654
  await Promise.all([killProcess(apiProc), killProcess(webProc), killProcess(collabProc)]);
7582
7655
  apiProc = startApi();
7583
7656
  webProc = startWeb();
@@ -7606,13 +7679,13 @@ var COMMANDS = [
7606
7679
  ];
7607
7680
  async function showWelcome() {
7608
7681
  await printBanner();
7609
- console.log(import_picocolors17.default.bold(import_picocolors17.default.white(" Available commands:\n")));
7682
+ console.log(import_picocolors18.default.bold(import_picocolors18.default.white(" Available commands:\n")));
7610
7683
  for (const cmd of COMMANDS) {
7611
- console.log(` ${import_picocolors17.default.cyan(cmd.name.padEnd(14))} ${import_picocolors17.default.dim(cmd.desc)}`);
7684
+ console.log(` ${import_picocolors18.default.cyan(cmd.name.padEnd(14))} ${import_picocolors18.default.dim(cmd.desc)}`);
7612
7685
  }
7613
7686
  console.log();
7614
- console.log(import_picocolors17.default.dim(" Run a command with: npx learnhouse <command>"));
7615
- console.log(import_picocolors17.default.dim(" Get started with: npx learnhouse setup"));
7687
+ console.log(import_picocolors18.default.dim(" Run a command with: npx learnhouse <command>"));
7688
+ console.log(import_picocolors18.default.dim(" Get started with: npx learnhouse setup"));
7616
7689
  console.log();
7617
7690
  }
7618
7691
  var program2 = new Command();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "learnhouse",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "The official LearnHouse CLI — deploy, manage, and operate your LearnHouse instance",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,6 +42,7 @@
42
42
  "typescript": "^5.3.3"
43
43
  },
44
44
  "dependencies": {
45
+ "@clack/core": "^1.0.1",
45
46
  "@clack/prompts": "^1.0.0",
46
47
  "commander": "^14.0.0",
47
48
  "picocolors": "^1.1.1"