@hasna/sandboxes 0.1.16 → 0.1.17

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/dist/cli/index.js CHANGED
@@ -2083,7 +2083,7 @@ var require_commander = __commonJS((exports) => {
2083
2083
 
2084
2084
  // src/db/database.ts
2085
2085
  import { Database } from "bun:sqlite";
2086
- import { existsSync, mkdirSync } from "fs";
2086
+ import { existsSync, mkdirSync, cpSync } from "fs";
2087
2087
  import { dirname, join, resolve } from "path";
2088
2088
  import { randomUUID } from "crypto";
2089
2089
  function isInMemoryDb(path) {
@@ -2103,15 +2103,23 @@ function findNearestDb(startDir) {
2103
2103
  return null;
2104
2104
  }
2105
2105
  function getDbPath() {
2106
- if (process.env["SANDBOXES_DB_PATH"]) {
2107
- return process.env["SANDBOXES_DB_PATH"];
2108
- }
2106
+ const envPath = process.env["HASNA_SANDBOXES_DB_PATH"] ?? process.env["SANDBOXES_DB_PATH"];
2107
+ if (envPath)
2108
+ return envPath;
2109
2109
  const cwd = process.cwd();
2110
2110
  const nearest = findNearestDb(cwd);
2111
2111
  if (nearest)
2112
2112
  return nearest;
2113
2113
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
2114
- return join(home, ".sandboxes", "sandboxes.db");
2114
+ const newDir = join(home, ".hasna", "sandboxes");
2115
+ const oldDir = join(home, ".sandboxes");
2116
+ if (!existsSync(newDir) && existsSync(oldDir)) {
2117
+ try {
2118
+ mkdirSync(join(home, ".hasna"), { recursive: true });
2119
+ cpSync(oldDir, newDir, { recursive: true });
2120
+ } catch {}
2121
+ }
2122
+ return join(newDir, "sandboxes.db");
2115
2123
  }
2116
2124
  function ensureDir(filePath) {
2117
2125
  if (isInMemoryDb(filePath))
@@ -2553,11 +2561,19 @@ var init_events = __esm(() => {
2553
2561
  });
2554
2562
 
2555
2563
  // src/lib/config.ts
2556
- import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
2564
+ import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2, cpSync as cpSync2 } from "fs";
2557
2565
  import { dirname as dirname2, join as join2 } from "path";
2558
2566
  function getConfigPath() {
2559
2567
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
2560
- return join2(home, ".sandboxes", "config.json");
2568
+ const newDir = join2(home, ".hasna", "sandboxes");
2569
+ const oldDir = join2(home, ".sandboxes");
2570
+ if (!existsSync2(newDir) && existsSync2(oldDir)) {
2571
+ try {
2572
+ mkdirSync2(join2(home, ".hasna"), { recursive: true });
2573
+ cpSync2(oldDir, newDir, { recursive: true });
2574
+ } catch {}
2575
+ }
2576
+ return join2(newDir, "config.json");
2561
2577
  }
2562
2578
  function loadConfig() {
2563
2579
  const configPath = getConfigPath();
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAmNtC,wBAAgB,WAAW,IAAI,QAAQ,CAYtC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAcf"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAkOtC,wBAAgB,WAAW,IAAI,QAAQ,CAYtC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAKpC;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAcf"}
package/dist/index.js CHANGED
@@ -726,7 +726,7 @@ init_types();
726
726
 
727
727
  // src/db/database.ts
728
728
  import { Database } from "bun:sqlite";
729
- import { existsSync, mkdirSync } from "fs";
729
+ import { existsSync, mkdirSync, cpSync } from "fs";
730
730
  import { dirname, join, resolve } from "path";
731
731
  import { randomUUID } from "crypto";
732
732
  function isInMemoryDb(path) {
@@ -746,15 +746,23 @@ function findNearestDb(startDir) {
746
746
  return null;
747
747
  }
748
748
  function getDbPath() {
749
- if (process.env["SANDBOXES_DB_PATH"]) {
750
- return process.env["SANDBOXES_DB_PATH"];
751
- }
749
+ const envPath = process.env["HASNA_SANDBOXES_DB_PATH"] ?? process.env["SANDBOXES_DB_PATH"];
750
+ if (envPath)
751
+ return envPath;
752
752
  const cwd = process.cwd();
753
753
  const nearest = findNearestDb(cwd);
754
754
  if (nearest)
755
755
  return nearest;
756
756
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
757
- return join(home, ".sandboxes", "sandboxes.db");
757
+ const newDir = join(home, ".hasna", "sandboxes");
758
+ const oldDir = join(home, ".sandboxes");
759
+ if (!existsSync(newDir) && existsSync(oldDir)) {
760
+ try {
761
+ mkdirSync(join(home, ".hasna"), { recursive: true });
762
+ cpSync(oldDir, newDir, { recursive: true });
763
+ } catch {}
764
+ }
765
+ return join(newDir, "sandboxes.db");
758
766
  }
759
767
  function ensureDir(filePath) {
760
768
  if (isInMemoryDb(filePath))
@@ -1445,7 +1453,7 @@ function deleteSnapshot(id) {
1445
1453
  db2.query("DELETE FROM snapshots WHERE id = ?").run(resolvedId);
1446
1454
  }
1447
1455
  // src/lib/config.ts
1448
- import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
1456
+ import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2, cpSync as cpSync2 } from "fs";
1449
1457
  import { dirname as dirname2, join as join2 } from "path";
1450
1458
  var ENV_KEYS = {
1451
1459
  e2b: "E2B_API_KEY",
@@ -1454,7 +1462,15 @@ var ENV_KEYS = {
1454
1462
  };
1455
1463
  function getConfigPath() {
1456
1464
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
1457
- return join2(home, ".sandboxes", "config.json");
1465
+ const newDir = join2(home, ".hasna", "sandboxes");
1466
+ const oldDir = join2(home, ".sandboxes");
1467
+ if (!existsSync2(newDir) && existsSync2(oldDir)) {
1468
+ try {
1469
+ mkdirSync2(join2(home, ".hasna"), { recursive: true });
1470
+ cpSync2(oldDir, newDir, { recursive: true });
1471
+ } catch {}
1472
+ }
1473
+ return join2(newDir, "config.json");
1458
1474
  }
1459
1475
  function loadConfig() {
1460
1476
  const configPath = getConfigPath();
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAa9E,wBAAgB,UAAU,IAAI,eAAe,CAU5C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAOxD;AAED,wBAAgB,kBAAkB,IAAI,mBAAmB,CAGxD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAGpD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAYnF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAuB/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkB9D"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA0B9E,wBAAgB,UAAU,IAAI,eAAe,CAU5C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAOxD;AAED,wBAAgB,kBAAkB,IAAI,mBAAmB,CAGxD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAG1C;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAGpD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAYnF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAuB/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkB9D"}
package/dist/mcp/index.js CHANGED
@@ -4673,7 +4673,7 @@ var coerce = {
4673
4673
  var NEVER = INVALID;
4674
4674
  // src/db/database.ts
4675
4675
  import { Database } from "bun:sqlite";
4676
- import { existsSync, mkdirSync } from "fs";
4676
+ import { existsSync, mkdirSync, cpSync } from "fs";
4677
4677
  import { dirname, join, resolve } from "path";
4678
4678
  import { randomUUID } from "crypto";
4679
4679
  function isInMemoryDb(path) {
@@ -4693,15 +4693,23 @@ function findNearestDb(startDir) {
4693
4693
  return null;
4694
4694
  }
4695
4695
  function getDbPath() {
4696
- if (process.env["SANDBOXES_DB_PATH"]) {
4697
- return process.env["SANDBOXES_DB_PATH"];
4698
- }
4696
+ const envPath = process.env["HASNA_SANDBOXES_DB_PATH"] ?? process.env["SANDBOXES_DB_PATH"];
4697
+ if (envPath)
4698
+ return envPath;
4699
4699
  const cwd = process.cwd();
4700
4700
  const nearest = findNearestDb(cwd);
4701
4701
  if (nearest)
4702
4702
  return nearest;
4703
4703
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
4704
- return join(home, ".sandboxes", "sandboxes.db");
4704
+ const newDir = join(home, ".hasna", "sandboxes");
4705
+ const oldDir = join(home, ".sandboxes");
4706
+ if (!existsSync(newDir) && existsSync(oldDir)) {
4707
+ try {
4708
+ mkdirSync(join(home, ".hasna"), { recursive: true });
4709
+ cpSync(oldDir, newDir, { recursive: true });
4710
+ } catch {}
4711
+ }
4712
+ return join(newDir, "sandboxes.db");
4705
4713
  }
4706
4714
  function ensureDir(filePath) {
4707
4715
  if (isInMemoryDb(filePath))
@@ -5289,7 +5297,7 @@ function deleteSnapshot(id) {
5289
5297
  init_types();
5290
5298
 
5291
5299
  // src/lib/config.ts
5292
- import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
5300
+ import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2, cpSync as cpSync2 } from "fs";
5293
5301
  import { dirname as dirname2, join as join2 } from "path";
5294
5302
  var ENV_KEYS = {
5295
5303
  e2b: "E2B_API_KEY",
@@ -5298,7 +5306,15 @@ var ENV_KEYS = {
5298
5306
  };
5299
5307
  function getConfigPath() {
5300
5308
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
5301
- return join2(home, ".sandboxes", "config.json");
5309
+ const newDir = join2(home, ".hasna", "sandboxes");
5310
+ const oldDir = join2(home, ".sandboxes");
5311
+ if (!existsSync2(newDir) && existsSync2(oldDir)) {
5312
+ try {
5313
+ mkdirSync2(join2(home, ".hasna"), { recursive: true });
5314
+ cpSync2(oldDir, newDir, { recursive: true });
5315
+ } catch {}
5316
+ }
5317
+ return join2(newDir, "config.json");
5302
5318
  }
5303
5319
  function loadConfig() {
5304
5320
  const configPath = getConfigPath();
@@ -699,7 +699,7 @@ import { parseArgs } from "util";
699
699
 
700
700
  // src/db/database.ts
701
701
  import { Database } from "bun:sqlite";
702
- import { existsSync, mkdirSync } from "fs";
702
+ import { existsSync, mkdirSync, cpSync } from "fs";
703
703
  import { dirname, join, resolve } from "path";
704
704
  import { randomUUID } from "crypto";
705
705
  function isInMemoryDb(path) {
@@ -719,15 +719,23 @@ function findNearestDb(startDir) {
719
719
  return null;
720
720
  }
721
721
  function getDbPath() {
722
- if (process.env["SANDBOXES_DB_PATH"]) {
723
- return process.env["SANDBOXES_DB_PATH"];
724
- }
722
+ const envPath = process.env["HASNA_SANDBOXES_DB_PATH"] ?? process.env["SANDBOXES_DB_PATH"];
723
+ if (envPath)
724
+ return envPath;
725
725
  const cwd = process.cwd();
726
726
  const nearest = findNearestDb(cwd);
727
727
  if (nearest)
728
728
  return nearest;
729
729
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
730
- return join(home, ".sandboxes", "sandboxes.db");
730
+ const newDir = join(home, ".hasna", "sandboxes");
731
+ const oldDir = join(home, ".sandboxes");
732
+ if (!existsSync(newDir) && existsSync(oldDir)) {
733
+ try {
734
+ mkdirSync(join(home, ".hasna"), { recursive: true });
735
+ cpSync(oldDir, newDir, { recursive: true });
736
+ } catch {}
737
+ }
738
+ return join(newDir, "sandboxes.db");
731
739
  }
732
740
  function ensureDir(filePath) {
733
741
  if (isInMemoryDb(filePath))
@@ -1291,7 +1299,7 @@ function deleteWebhook(id) {
1291
1299
  init_types();
1292
1300
 
1293
1301
  // src/lib/config.ts
1294
- import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2 } from "fs";
1302
+ import { existsSync as existsSync2, readFileSync, writeFileSync, mkdirSync as mkdirSync2, cpSync as cpSync2 } from "fs";
1295
1303
  import { dirname as dirname2, join as join2 } from "path";
1296
1304
  var ENV_KEYS = {
1297
1305
  e2b: "E2B_API_KEY",
@@ -1300,7 +1308,15 @@ var ENV_KEYS = {
1300
1308
  };
1301
1309
  function getConfigPath() {
1302
1310
  const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
1303
- return join2(home, ".sandboxes", "config.json");
1311
+ const newDir = join2(home, ".hasna", "sandboxes");
1312
+ const oldDir = join2(home, ".sandboxes");
1313
+ if (!existsSync2(newDir) && existsSync2(oldDir)) {
1314
+ try {
1315
+ mkdirSync2(join2(home, ".hasna"), { recursive: true });
1316
+ cpSync2(oldDir, newDir, { recursive: true });
1317
+ } catch {}
1318
+ }
1319
+ return join2(newDir, "config.json");
1304
1320
  }
1305
1321
  function loadConfig() {
1306
1322
  const configPath = getConfigPath();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/sandboxes",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "author": "Andrei Hasna <andrei@hasna.com>",
5
5
  "repository": {
6
6
  "type": "git",