learnhouse 1.4.0 → 1.4.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/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # LearnHouse CLI
2
2
 
3
- The official LearnHouse CLI — deploy, manage, and operate your LearnHouse instance.
3
+ The official [LearnHouse](https://learnhouse.app) CLI — deploy, manage, and operate your LearnHouse instance.
4
+
5
+ [Website](https://learnhouse.app) | [Documentation](https://docs.learnhouse.app) | [GitHub](https://github.com/learnhouse/learnhouse)
4
6
 
5
7
  <img width="915" height="871" alt="image" src="https://github.com/user-attachments/assets/957c6cea-3efb-4cab-a643-55df3ac4c6aa" />
6
8
 
@@ -3616,7 +3616,7 @@ var {
3616
3616
  var import_picocolors23 = __toESM(require_picocolors(), 1);
3617
3617
 
3618
3618
  // src/constants.ts
3619
- var VERSION = "1.4.0";
3619
+ var VERSION = "1.4.2";
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 = "pgvector/pgvector:pg16";
@@ -4850,7 +4850,13 @@ function isDockerRunning() {
4850
4850
  try {
4851
4851
  execSync("docker info", { stdio: "pipe" });
4852
4852
  return true;
4853
- } catch {
4853
+ } catch (err) {
4854
+ const stderr = err instanceof Error && "stderr" in err ? err.stderr?.toString() ?? "" : "";
4855
+ if (stderr.includes("permission denied")) {
4856
+ throw new Error(
4857
+ "Docker permission denied. Run: sudo usermod -aG docker $USER && newgrp docker"
4858
+ );
4859
+ }
4854
4860
  return false;
4855
4861
  }
4856
4862
  }
@@ -5020,8 +5026,13 @@ async function checkPrerequisites() {
5020
5026
  ];
5021
5027
  const failed = [];
5022
5028
  for (const { name, check, failMsg } of checks) {
5023
- if (!check()) {
5024
- failed.push(`${import_picocolors6.default.red("x")} ${name}: ${failMsg}`);
5029
+ try {
5030
+ if (!check()) {
5031
+ failed.push(`${import_picocolors6.default.red("x")} ${name}: ${failMsg}`);
5032
+ }
5033
+ } catch (err) {
5034
+ const msg = err instanceof Error ? err.message : failMsg;
5035
+ failed.push(`${import_picocolors6.default.red("x")} ${name}: ${msg}`);
5025
5036
  }
5026
5037
  }
5027
5038
  if (failed.length > 0) {
@@ -7519,15 +7530,7 @@ async function devCommand(opts) {
7519
7530
  const envOk = await checkDevEnv(root);
7520
7531
  if (!envOk) process.exit(1);
7521
7532
  const eePath = path7.join(root, "apps", "api", "ee");
7522
- const eeDisabledPath = path7.join(root, "apps", "api", ".ee-disabled");
7523
- let eeWasHidden = false;
7524
- if (fs7.existsSync(eeDisabledPath) && !fs7.existsSync(eePath)) {
7525
- fs7.renameSync(eeDisabledPath, eePath);
7526
- }
7527
- if (!opts.ee && fs7.existsSync(eePath)) {
7528
- fs7.renameSync(eePath, eeDisabledPath);
7529
- eeWasHidden = true;
7530
- } else if (opts.ee) {
7533
+ if (opts.ee) {
7531
7534
  if (fs7.existsSync(eePath)) {
7532
7535
  R2.info(`Running in ${import_picocolors17.default.bold("EE")} mode`);
7533
7536
  } else {
@@ -7548,26 +7551,29 @@ async function devCommand(opts) {
7548
7551
  if (alreadyRunning) {
7549
7552
  R2.success("Existing DB and Redis containers detected \u2014 reusing them");
7550
7553
  }
7554
+ let adminEmail = opts.adminEmail;
7555
+ let adminPassword = opts.adminPassword;
7551
7556
  if (!alreadyRunning) {
7552
- const email = await text({
7553
- message: "Admin email",
7554
- placeholder: "admin@school.dev",
7555
- defaultValue: "admin@school.dev"
7556
- });
7557
- if (Ct(email)) process.exit(0);
7558
- const password = await He({
7559
- message: "Admin password"
7560
- });
7561
- if (Ct(password)) process.exit(0);
7562
- if (!password) {
7557
+ if (!adminEmail) {
7558
+ const emailInput = await text({
7559
+ message: "Admin email",
7560
+ placeholder: "admin@school.dev",
7561
+ defaultValue: "admin@school.dev"
7562
+ });
7563
+ if (Ct(emailInput)) process.exit(0);
7564
+ adminEmail = emailInput;
7565
+ }
7566
+ if (!adminPassword) {
7567
+ const passwordInput = await He({
7568
+ message: "Admin password"
7569
+ });
7570
+ if (Ct(passwordInput)) process.exit(0);
7571
+ adminPassword = passwordInput;
7572
+ }
7573
+ if (!adminPassword) {
7563
7574
  R2.error("Password is required.");
7564
7575
  process.exit(1);
7565
7576
  }
7566
- serviceEnv = {
7567
- FORCE_COLOR: "1",
7568
- LEARNHOUSE_INITIAL_ADMIN_EMAIL: email,
7569
- LEARNHOUSE_INITIAL_ADMIN_PASSWORD: password
7570
- };
7571
7577
  const infraSpinner = bt2();
7572
7578
  infraSpinner.start("Starting DB and Redis containers...");
7573
7579
  try {
@@ -7581,11 +7587,13 @@ async function devCommand(opts) {
7581
7587
  R2.error(e2.stderr?.toString() || "docker compose up failed");
7582
7588
  process.exit(1);
7583
7589
  }
7584
- } else {
7585
- serviceEnv = {
7586
- FORCE_COLOR: "1"
7587
- };
7588
7590
  }
7591
+ serviceEnv = {
7592
+ FORCE_COLOR: "1",
7593
+ ...adminEmail && { LEARNHOUSE_INITIAL_ADMIN_EMAIL: adminEmail },
7594
+ ...adminPassword && { LEARNHOUSE_INITIAL_ADMIN_PASSWORD: adminPassword },
7595
+ ...!opts.ee && { LEARNHOUSE_DISABLE_EE: "1" }
7596
+ };
7589
7597
  const healthSpinner = bt2();
7590
7598
  healthSpinner.start("Waiting for DB and Redis to be healthy...");
7591
7599
  const [dbReady, redisReady] = await Promise.all([
@@ -7654,9 +7662,6 @@ async function devCommand(opts) {
7654
7662
  }
7655
7663
  process.stdin.pause();
7656
7664
  await Promise.all([killProcess(apiProc), killProcess(webProc), killProcess(collabProc)]);
7657
- if (eeWasHidden && fs7.existsSync(eeDisabledPath) && !fs7.existsSync(eePath)) {
7658
- fs7.renameSync(eeDisabledPath, eePath);
7659
- }
7660
7665
  console.log(import_picocolors17.default.dim("DB and Redis containers are still running for next session."));
7661
7666
  console.log(import_picocolors17.default.dim("To stop them: docker compose -f .learnhouse/docker-compose.dev.yml -p learnhouse-dev down"));
7662
7667
  console.log(import_picocolors17.default.dim("Thanks for building with LearnHouse!"));
@@ -8353,7 +8358,7 @@ program2.command("status").description("Show service status").action(statusComma
8353
8358
  program2.command("health").description("Run health checks").action(healthCommand);
8354
8359
  program2.command("env").description("Edit environment variables").action(envCommand);
8355
8360
  program2.command("restore").description("Restore database from a backup archive").argument("<archive>", "Path to backup archive").action(restoreCommand);
8356
- program2.command("dev").description("Start development environment (DB + Redis in Docker, API + Web locally)").option("--ee", "Enable Enterprise Edition features (keeps ee/ folder)").action(devCommand);
8361
+ program2.command("dev").description("Start development environment (DB + Redis in Docker, API + Web locally)").option("--ee", "Enable Enterprise Edition features (keeps ee/ folder)").option("--admin-email <email>", "Admin email (default: admin@school.dev)").option("--admin-password <password>", "Admin password (skips interactive prompt)").action(devCommand);
8357
8362
  var updateCheck = checkForUpdates();
8358
8363
  program2.parseAsync().then(() => updateCheck.catch(() => {
8359
8364
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "learnhouse",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "The official LearnHouse CLI — deploy, manage, and operate your LearnHouse instance",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/learnhouse/learnhouse.git",
26
26
  "directory": "apps/cli"
27
27
  },
28
- "homepage": "https://github.com/learnhouse/learnhouse/tree/main/apps/cli",
28
+ "homepage": "https://learnhouse.app",
29
29
  "bugs": {
30
30
  "url": "https://github.com/learnhouse/learnhouse/issues"
31
31
  },