@hasna/machines 0.0.1 → 0.0.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.
@@ -2084,13 +2084,17 @@ var {
2084
2084
  } = import__.default;
2085
2085
 
2086
2086
  // src/version.ts
2087
- import { readFileSync } from "fs";
2087
+ import { existsSync, readFileSync } from "fs";
2088
2088
  import { dirname, join } from "path";
2089
2089
  import { fileURLToPath } from "url";
2090
2090
  function getPackageVersion() {
2091
2091
  try {
2092
2092
  const here = dirname(fileURLToPath(import.meta.url));
2093
- const pkgPath = join(here, "..", "package.json");
2093
+ const candidates = [join(here, "..", "package.json"), join(here, "..", "..", "package.json")];
2094
+ const pkgPath = candidates.find((candidate) => existsSync(candidate));
2095
+ if (!pkgPath) {
2096
+ return "0.0.0";
2097
+ }
2094
2098
  return JSON.parse(readFileSync(pkgPath, "utf8")).version || "0.0.0";
2095
2099
  } catch {
2096
2100
  return "0.0.0";
@@ -2104,14 +2108,14 @@ import { hostname } from "os";
2104
2108
  import { createRequire } from "module";
2105
2109
  import { Database } from "bun:sqlite";
2106
2110
  import {
2107
- existsSync,
2111
+ existsSync as existsSync2,
2108
2112
  mkdirSync,
2109
2113
  readdirSync,
2110
2114
  copyFileSync
2111
2115
  } from "fs";
2112
2116
  import { homedir } from "os";
2113
2117
  import { join as join2, relative } from "path";
2114
- import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
2118
+ import { existsSync as existsSync22, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
2115
2119
  import { homedir as homedir2 } from "os";
2116
2120
  import { join as join22 } from "path";
2117
2121
  import { readdirSync as readdirSync2, existsSync as existsSync3 } from "fs";
@@ -11313,7 +11317,7 @@ function getConfigPath() {
11313
11317
  return CONFIG_PATH;
11314
11318
  }
11315
11319
  function getCloudConfig() {
11316
- if (!existsSync2(CONFIG_PATH)) {
11320
+ if (!existsSync22(CONFIG_PATH)) {
11317
11321
  return CloudConfigSchema.parse({});
11318
11322
  }
11319
11323
  try {
package/dist/cli/index.js CHANGED
@@ -2586,13 +2586,17 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
2586
2586
  var source_default = chalk;
2587
2587
 
2588
2588
  // src/version.ts
2589
- import { readFileSync } from "fs";
2589
+ import { existsSync, readFileSync } from "fs";
2590
2590
  import { dirname, join } from "path";
2591
2591
  import { fileURLToPath } from "url";
2592
2592
  function getPackageVersion() {
2593
2593
  try {
2594
2594
  const here = dirname(fileURLToPath(import.meta.url));
2595
- const pkgPath = join(here, "..", "package.json");
2595
+ const candidates = [join(here, "..", "package.json"), join(here, "..", "..", "package.json")];
2596
+ const pkgPath = candidates.find((candidate) => existsSync(candidate));
2597
+ if (!pkgPath) {
2598
+ return "0.0.0";
2599
+ }
2596
2600
  return JSON.parse(readFileSync(pkgPath, "utf8")).version || "0.0.0";
2597
2601
  } catch {
2598
2602
  return "0.0.0";
@@ -2600,7 +2604,7 @@ function getPackageVersion() {
2600
2604
  }
2601
2605
 
2602
2606
  // src/manifests.ts
2603
- import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
2607
+ import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync } from "fs";
2604
2608
  import { arch, homedir, hostname, platform, userInfo } from "os";
2605
2609
  import { dirname as dirname3 } from "path";
2606
2610
 
@@ -6578,7 +6582,7 @@ var coerce = {
6578
6582
  };
6579
6583
  var NEVER = INVALID;
6580
6584
  // src/paths.ts
6581
- import { existsSync, mkdirSync } from "fs";
6585
+ import { existsSync as existsSync2, mkdirSync } from "fs";
6582
6586
  import { dirname as dirname2, join as join2, resolve } from "path";
6583
6587
  function homeDir() {
6584
6588
  return process.env["HOME"] || process.env["USERPROFILE"] || "~";
@@ -6599,7 +6603,7 @@ function ensureParentDir(filePath) {
6599
6603
  if (filePath === ":memory:")
6600
6604
  return;
6601
6605
  const dir = dirname2(resolve(filePath));
6602
- if (!existsSync(dir)) {
6606
+ if (!existsSync2(dir)) {
6603
6607
  mkdirSync(dir, { recursive: true });
6604
6608
  }
6605
6609
  }
@@ -6664,7 +6668,7 @@ function getDefaultManifest() {
6664
6668
  };
6665
6669
  }
6666
6670
  function readManifest(path = getManifestPath()) {
6667
- if (!existsSync2(path)) {
6671
+ if (!existsSync3(path)) {
6668
6672
  return getDefaultManifest();
6669
6673
  }
6670
6674
  const raw = JSON.parse(readFileSync2(path, "utf8"));
@@ -6748,7 +6752,7 @@ import { hostname as hostname2 } from "os";
6748
6752
  import { createRequire } from "module";
6749
6753
  import { Database } from "bun:sqlite";
6750
6754
  import {
6751
- existsSync as existsSync3,
6755
+ existsSync as existsSync4,
6752
6756
  mkdirSync as mkdirSync2,
6753
6757
  readdirSync,
6754
6758
  copyFileSync
@@ -16610,14 +16614,14 @@ function runCertPlan(domains, options = {}) {
16610
16614
  }
16611
16615
 
16612
16616
  // src/commands/dns.ts
16613
- import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
16617
+ import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
16614
16618
  import { join as join8 } from "path";
16615
16619
  function getDnsPath() {
16616
16620
  return join8(getDataDir(), "dns.json");
16617
16621
  }
16618
16622
  function readMappings() {
16619
16623
  const path = getDnsPath();
16620
- if (!existsSync4(path))
16624
+ if (!existsSync5(path))
16621
16625
  return [];
16622
16626
  return JSON.parse(readFileSync4(path, "utf8"));
16623
16627
  }
@@ -16899,7 +16903,7 @@ function runTailscaleInstall(machineId, options = {}) {
16899
16903
  }
16900
16904
 
16901
16905
  // src/commands/notifications.ts
16902
- import { existsSync as existsSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
16906
+ import { existsSync as existsSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
16903
16907
  var notificationChannelSchema = exports_external.object({
16904
16908
  id: exports_external.string(),
16905
16909
  type: exports_external.enum(["email", "webhook", "command"]),
@@ -16923,7 +16927,7 @@ function getDefaultNotificationConfig() {
16923
16927
  };
16924
16928
  }
16925
16929
  function readNotificationConfig(path = getNotificationsPath()) {
16926
- if (!existsSync5(path)) {
16930
+ if (!existsSync6(path)) {
16927
16931
  return getDefaultNotificationConfig();
16928
16932
  }
16929
16933
  return notificationConfigSchema.parse(JSON.parse(readFileSync5(path, "utf8")));
@@ -17102,7 +17106,7 @@ function listPorts(machineId) {
17102
17106
  }
17103
17107
 
17104
17108
  // src/commands/sync.ts
17105
- import { existsSync as existsSync6, lstatSync, readFileSync as readFileSync6, symlinkSync, copyFileSync as copyFileSync2 } from "fs";
17109
+ import { existsSync as existsSync7, lstatSync, readFileSync as readFileSync6, symlinkSync, copyFileSync as copyFileSync2 } from "fs";
17106
17110
  function quote4(value) {
17107
17111
  return `'${value.replace(/'/g, `'\\''`)}'`;
17108
17112
  }
@@ -17150,8 +17154,8 @@ function detectPackageActions(machine) {
17150
17154
  }
17151
17155
  function detectFileActions(machine) {
17152
17156
  return (machine.files || []).map((file, index) => {
17153
- const sourceExists = existsSync6(file.source);
17154
- const targetExists = existsSync6(file.target);
17157
+ const sourceExists = existsSync7(file.source);
17158
+ const targetExists = existsSync7(file.target);
17155
17159
  let status = "missing";
17156
17160
  if (sourceExists && targetExists) {
17157
17161
  if (file.mode === "symlink") {
package/dist/index.js CHANGED
@@ -30467,13 +30467,17 @@ function createMcpServer(version2) {
30467
30467
  return server;
30468
30468
  }
30469
30469
  // src/version.ts
30470
- import { readFileSync as readFileSync6 } from "fs";
30470
+ import { existsSync as existsSync9, readFileSync as readFileSync6 } from "fs";
30471
30471
  import { dirname as dirname4, join as join9 } from "path";
30472
30472
  import { fileURLToPath } from "url";
30473
30473
  function getPackageVersion() {
30474
30474
  try {
30475
30475
  const here = dirname4(fileURLToPath(import.meta.url));
30476
- const pkgPath = join9(here, "..", "package.json");
30476
+ const candidates = [join9(here, "..", "package.json"), join9(here, "..", "..", "package.json")];
30477
+ const pkgPath = candidates.find((candidate) => existsSync9(candidate));
30478
+ if (!pkgPath) {
30479
+ return "0.0.0";
30480
+ }
30477
30481
  return JSON.parse(readFileSync6(pkgPath, "utf8")).version || "0.0.0";
30478
30482
  } catch {
30479
30483
  return "0.0.0";
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,IAAI,MAAM,CAQ1C"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAIA,wBAAgB,iBAAiB,IAAI,MAAM,CAY1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/machines",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Machine fleet management CLI + MCP for developers",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",