@hasna/machines 0.0.47 → 0.0.48

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
@@ -9660,12 +9660,13 @@ ${after}` : `
9660
9660
  return `${prefix}${block}
9661
9661
  `;
9662
9662
  }
9663
- function loadTailscale(runner, warnings) {
9664
- if (runner("command -v tailscale >/dev/null 2>&1").exitCode !== 0) {
9665
- warnings.push("tailscale_not_available");
9663
+ function loadTailscaleStatus(runner, binary, warnings) {
9664
+ if (!binary) {
9665
+ if (!warnings.includes("tailscale_not_available"))
9666
+ warnings.push("tailscale_not_available");
9666
9667
  return null;
9667
9668
  }
9668
- const result = runner("tailscale status --json");
9669
+ const result = runner(`"${binary}" status --json`);
9669
9670
  if (result.exitCode !== 0) {
9670
9671
  warnings.push("tailscale_status_failed");
9671
9672
  return null;
@@ -9694,9 +9695,23 @@ function collectPingTargets(tailscale, localSubnets) {
9694
9695
  }
9695
9696
  return targets;
9696
9697
  }
9697
- function warmDirectPaths(runner, targets, timeoutSeconds = 2) {
9698
+ var TAILSCALE_CANDIDATES = [
9699
+ "tailscale",
9700
+ "/usr/local/bin/tailscale",
9701
+ "/opt/homebrew/bin/tailscale",
9702
+ "/Applications/Tailscale.app/Contents/MacOS/Tailscale"
9703
+ ];
9704
+ function resolveTailscaleBinary(runner) {
9705
+ for (const candidate of TAILSCALE_CANDIDATES) {
9706
+ const check = candidate.includes("/") ? `test -x "${candidate}"` : `command -v ${candidate} >/dev/null 2>&1`;
9707
+ if (runner(check).exitCode === 0)
9708
+ return candidate;
9709
+ }
9710
+ return null;
9711
+ }
9712
+ function warmDirectPaths(runner, targets, binary, timeoutSeconds = 2) {
9698
9713
  for (const target of targets) {
9699
- runner(`tailscale ping --c 1 --timeout ${timeoutSeconds}s ${target} >/dev/null 2>&1 || true`);
9714
+ runner(`"${binary}" ping --c 1 --timeout ${timeoutSeconds}s ${target} >/dev/null 2>&1 || true`);
9700
9715
  }
9701
9716
  }
9702
9717
  function resolveLocalMachineId(tailscale, explicit) {
@@ -9707,14 +9722,15 @@ function resolveLocalMachineId(tailscale, explicit) {
9707
9722
  function planFleetHosts(options = {}) {
9708
9723
  const runner = options.runner ?? defaultRunner2;
9709
9724
  const warnings = [];
9710
- let tailscale = loadTailscale(runner, warnings);
9725
+ const binary = resolveTailscaleBinary(runner);
9726
+ let tailscale = loadTailscaleStatus(runner, binary, warnings);
9711
9727
  const manifest = readManifest();
9712
9728
  const localSubnets = options.localSubnets ?? localPrivateSubnets();
9713
- if (options.warm !== false && tailscale && localSubnets.length > 0) {
9729
+ if (options.warm !== false && tailscale && binary && localSubnets.length > 0) {
9714
9730
  const targets = collectPingTargets(tailscale, localSubnets);
9715
9731
  if (targets.length > 0) {
9716
- warmDirectPaths(runner, targets, options.warmTimeoutSeconds);
9717
- tailscale = loadTailscale(runner, warnings) ?? tailscale;
9732
+ warmDirectPaths(runner, targets, binary, options.warmTimeoutSeconds);
9733
+ tailscale = loadTailscaleStatus(runner, binary, warnings) ?? tailscale;
9718
9734
  }
9719
9735
  }
9720
9736
  const localMachineId = resolveLocalMachineId(tailscale, options.localMachineId);
@@ -76,6 +76,7 @@ export declare function mergeHostsContent(existing: string, block: string): stri
76
76
  * becomes resolvable.
77
77
  */
78
78
  export declare function collectPingTargets(tailscale: RawTailscaleStatus | null, localSubnets: string[]): string[];
79
- export declare function warmDirectPaths(runner: HostsCommandRunner, targets: string[], timeoutSeconds?: number): void;
79
+ export declare function resolveTailscaleBinary(runner: HostsCommandRunner): string | null;
80
+ export declare function warmDirectPaths(runner: HostsCommandRunner, targets: string[], binary: string, timeoutSeconds?: number): void;
80
81
  export declare function planFleetHosts(options?: FleetHostsOptions): FleetHostsPlan;
81
82
  export declare function applyFleetHosts(options?: FleetHostsOptions): ApplyFleetHostsResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/machines",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "Machine fleet management CLI + MCP for developers",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",