@ha-bits/cortex 1.0.1 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ha-bits/cortex",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Cortex - Habits Workflow Executor CLI",
5
5
  "main": "./server/main.cjs",
6
6
  "bin": {
package/server/main.cjs CHANGED
@@ -308,9 +308,17 @@ async function installNpmModule(moduleDefinition, targetDir) {
308
308
  installedPackagePath = path2.join(tempDir, "node_modules", packageName);
309
309
  }
310
310
  if (fs.existsSync(installedPackagePath)) {
311
+ const parentDir = path2.dirname(modulePath);
312
+ if (!fs.existsSync(parentDir)) {
313
+ fs.mkdirSync(parentDir, { recursive: true });
314
+ }
311
315
  fs.renameSync(installedPackagePath, modulePath);
312
316
  } else {
313
317
  const nodeModulesPath = path2.join(tempDir, "node_modules");
318
+ const parentDir = path2.dirname(modulePath);
319
+ if (!fs.existsSync(parentDir)) {
320
+ fs.mkdirSync(parentDir, { recursive: true });
321
+ }
314
322
  if (packageName.startsWith("@")) {
315
323
  const [scope] = packageName.split("/");
316
324
  const scopedDir = path2.join(nodeModulesPath, scope);
@@ -4994,6 +5002,19 @@ Health: /health`);
4994
5002
  }
4995
5003
  resolve5();
4996
5004
  });
5005
+ this.server.on("error", (error) => {
5006
+ if (error.code === "EADDRINUSE") {
5007
+ console.error(`
5008
+ \u274C Port ${port} is already in use!`);
5009
+ console.error(` Please stop the process using port ${port} or use a different port.`);
5010
+ console.error(` Try: lsof -ti:${port} | xargs kill -9`);
5011
+ reject(new Error(`Port ${port} is already in use`));
5012
+ } else {
5013
+ console.error(`
5014
+ \u274C Server error:`, error.message);
5015
+ reject(error);
5016
+ }
5017
+ });
4997
5018
  } catch (error) {
4998
5019
  reject(error);
4999
5020
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ha-bits/cortex",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Cortex - Habits Workflow Executor CLI",
5
5
  "main": "./server/main.cjs",
6
6
  "bin": {