@hasna/machines 0.0.17 → 0.0.18

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
@@ -7914,6 +7914,9 @@ function resolveMachineRoute(machineId, options = {}) {
7914
7914
  }
7915
7915
 
7916
7916
  // src/commands/ssh.ts
7917
+ function shellQuote(value) {
7918
+ return `'${value.replace(/'/g, "'\\''")}'`;
7919
+ }
7917
7920
  function resolveSshTarget(machineId, options = {}) {
7918
7921
  const resolved = resolveMachineRoute(machineId, options);
7919
7922
  if (!resolved.ok || !resolved.target) {
@@ -7932,11 +7935,11 @@ function resolveSshTarget(machineId, options = {}) {
7932
7935
  }
7933
7936
  function buildSshCommand(machineId, remoteCommand, options = {}) {
7934
7937
  const resolved = resolveSshTarget(machineId, options);
7935
- return remoteCommand ? `ssh ${resolved.target} ${JSON.stringify(remoteCommand)}` : `ssh ${resolved.target}`;
7938
+ return remoteCommand ? `ssh ${resolved.target} ${shellQuote(remoteCommand)}` : `ssh ${resolved.target}`;
7936
7939
  }
7937
7940
 
7938
7941
  // src/remote.ts
7939
- function shellQuote(value) {
7942
+ function shellQuote2(value) {
7940
7943
  return `'${value.replace(/'/g, "'\\''")}'`;
7941
7944
  }
7942
7945
  function machineIsLocal(machineId, localMachineId) {
@@ -7954,7 +7957,7 @@ function resolveMachineCommand(machineId, command, localMachineId = getLocalMach
7954
7957
  } catch (error) {
7955
7958
  const message = String(error.message ?? error);
7956
7959
  if (message.includes("Machine route not found") || message.includes("Machine not found in manifest")) {
7957
- return { source: "ssh", shellCommand: `ssh ${shellQuote(machineId)} ${shellQuote(command)}` };
7960
+ return { source: "ssh", shellCommand: `ssh ${shellQuote2(machineId)} ${shellQuote2(command)}` };
7958
7961
  }
7959
7962
  throw error;
7960
7963
  }
@@ -7987,7 +7990,7 @@ function getAppManager(machine, app) {
7987
7990
  return "winget";
7988
7991
  return "apt";
7989
7992
  }
7990
- function shellQuote2(value) {
7993
+ function shellQuote3(value) {
7991
7994
  return `'${value.replace(/'/g, `'\\''`)}'`;
7992
7995
  }
7993
7996
  function buildAppCommand(machine, app) {
@@ -8008,7 +8011,7 @@ function buildAppCommand(machine, app) {
8008
8011
  return `sudo apt-get install -y ${packageName}`;
8009
8012
  }
8010
8013
  function buildAppProbeCommand(machine, app) {
8011
- const packageName = shellQuote2(getPackageName(app));
8014
+ const packageName = shellQuote3(getPackageName(app));
8012
8015
  const manager = getAppManager(machine, app);
8013
8016
  if (manager === "custom") {
8014
8017
  return `if command -v ${packageName} >/dev/null 2>&1; then printf 'installed=1\\nversion=custom\\n'; else printf 'installed=0\\n'; fi`;
@@ -8303,7 +8306,7 @@ var notificationConfigSchema = exports_external.object({
8303
8306
  function sortChannels(channels) {
8304
8307
  return [...channels].sort((left, right) => left.id.localeCompare(right.id));
8305
8308
  }
8306
- function shellQuote3(value) {
8309
+ function shellQuote4(value) {
8307
8310
  return `'${value.replace(/'/g, `'\\''`)}'`;
8308
8311
  }
8309
8312
  function hasCommand2(binary) {
@@ -8350,7 +8353,7 @@ ${message}
8350
8353
  };
8351
8354
  }
8352
8355
  if (hasCommand2("mail")) {
8353
- const command = `printf %s ${shellQuote3(message)} | mail -s ${shellQuote3(subject)} ${shellQuote3(channel.target)}`;
8356
+ const command = `printf %s ${shellQuote4(message)} | mail -s ${shellQuote4(subject)} ${shellQuote4(channel.target)}`;
8354
8357
  const result = Bun.spawnSync(["bash", "-lc", command], {
8355
8358
  stdout: "pipe",
8356
8359
  stderr: "pipe",
@@ -8785,7 +8788,7 @@ var DEFAULT_COMMANDS = [
8785
8788
  function defaultPackages() {
8786
8789
  return [{ name: "@hasna/machines", command: "machines", expectedVersion: getPackageVersion(), required: true }];
8787
8790
  }
8788
- function shellQuote4(value) {
8791
+ function shellQuote5(value) {
8789
8792
  return `'${value.replace(/'/g, "'\\''")}'`;
8790
8793
  }
8791
8794
  function commandId(value) {
@@ -8836,7 +8839,7 @@ function defaultRunner2(machineId, command) {
8836
8839
  return runMachineCommand(machineId, command);
8837
8840
  }
8838
8841
  function inspectCommand(machineId, spec, runner) {
8839
- const command = shellQuote4(spec.command);
8842
+ const command = shellQuote5(spec.command);
8840
8843
  const versionArgs = spec.versionArgs ?? "--version";
8841
8844
  const script = [
8842
8845
  `cmd=${command}`,
@@ -8865,7 +8868,7 @@ function fieldCommand(field) {
8865
8868
  }
8866
8869
  function inspectWorkspace(machineId, spec, runner) {
8867
8870
  const script = [
8868
- `path=${shellQuote4(spec.path)}`,
8871
+ `path=${shellQuote5(spec.path)}`,
8869
8872
  'printf "exists=%s\\n" "$(test -d "$path" && printf yes || printf no)"',
8870
8873
  'pkg="$path/package.json"',
8871
8874
  'printf "package_json=%s\\n" "$(test -f "$pkg" && printf yes || printf no)"',
@@ -1 +1 @@
1
- {"version":3,"file":"ssh.d.ts","sourceRoot":"","sources":["../../src/commands/ssh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,OAAO,GAAG,KAAK,CAAC;IAC7C,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACzD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,iBAAiB,CAexG;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAGpH"}
1
+ {"version":3,"file":"ssh.d.ts","sourceRoot":"","sources":["../../src/commands/ssh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,GAAG,WAAW,GAAG,OAAO,GAAG,KAAK,CAAC;IAC7C,UAAU,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACzD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAMD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,iBAAiB,CAexG;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAGpH"}
package/dist/consumer.js CHANGED
@@ -4663,6 +4663,9 @@ import { spawnSync as spawnSync2 } from "child_process";
4663
4663
  import { hostname as hostname4 } from "os";
4664
4664
 
4665
4665
  // src/commands/ssh.ts
4666
+ function shellQuote(value) {
4667
+ return `'${value.replace(/'/g, "'\\''")}'`;
4668
+ }
4666
4669
  function resolveSshTarget(machineId, options = {}) {
4667
4670
  const resolved = resolveMachineRoute(machineId, options);
4668
4671
  if (!resolved.ok || !resolved.target) {
@@ -4681,11 +4684,11 @@ function resolveSshTarget(machineId, options = {}) {
4681
4684
  }
4682
4685
  function buildSshCommand(machineId, remoteCommand, options = {}) {
4683
4686
  const resolved = resolveSshTarget(machineId, options);
4684
- return remoteCommand ? `ssh ${resolved.target} ${JSON.stringify(remoteCommand)}` : `ssh ${resolved.target}`;
4687
+ return remoteCommand ? `ssh ${resolved.target} ${shellQuote(remoteCommand)}` : `ssh ${resolved.target}`;
4685
4688
  }
4686
4689
 
4687
4690
  // src/remote.ts
4688
- function shellQuote(value) {
4691
+ function shellQuote2(value) {
4689
4692
  return `'${value.replace(/'/g, "'\\''")}'`;
4690
4693
  }
4691
4694
  function machineIsLocal(machineId, localMachineId) {
@@ -4703,7 +4706,7 @@ function resolveMachineCommand(machineId, command, localMachineId = getLocalMach
4703
4706
  } catch (error) {
4704
4707
  const message = String(error.message ?? error);
4705
4708
  if (message.includes("Machine route not found") || message.includes("Machine not found in manifest")) {
4706
- return { source: "ssh", shellCommand: `ssh ${shellQuote(machineId)} ${shellQuote(command)}` };
4709
+ return { source: "ssh", shellCommand: `ssh ${shellQuote2(machineId)} ${shellQuote2(command)}` };
4707
4710
  }
4708
4711
  throw error;
4709
4712
  }
@@ -4731,7 +4734,7 @@ var DEFAULT_COMMANDS = [
4731
4734
  function defaultPackages() {
4732
4735
  return [{ name: "@hasna/machines", command: "machines", expectedVersion: getPackageVersion(), required: true }];
4733
4736
  }
4734
- function shellQuote2(value) {
4737
+ function shellQuote3(value) {
4735
4738
  return `'${value.replace(/'/g, "'\\''")}'`;
4736
4739
  }
4737
4740
  function commandId(value) {
@@ -4782,7 +4785,7 @@ function defaultRunner2(machineId, command) {
4782
4785
  return runMachineCommand(machineId, command);
4783
4786
  }
4784
4787
  function inspectCommand(machineId, spec, runner) {
4785
- const command = shellQuote2(spec.command);
4788
+ const command = shellQuote3(spec.command);
4786
4789
  const versionArgs = spec.versionArgs ?? "--version";
4787
4790
  const script = [
4788
4791
  `cmd=${command}`,
@@ -4811,7 +4814,7 @@ function fieldCommand(field) {
4811
4814
  }
4812
4815
  function inspectWorkspace(machineId, spec, runner) {
4813
4816
  const script = [
4814
- `path=${shellQuote2(spec.path)}`,
4817
+ `path=${shellQuote3(spec.path)}`,
4815
4818
  'printf "exists=%s\\n" "$(test -d "$path" && printf yes || printf no)"',
4816
4819
  'pkg="$path/package.json"',
4817
4820
  'printf "package_json=%s\\n" "$(test -f "$pkg" && printf yes || printf no)"',
package/dist/index.js CHANGED
@@ -11463,6 +11463,9 @@ import { spawnSync as spawnSync2 } from "child_process";
11463
11463
  import { hostname as hostname4 } from "os";
11464
11464
 
11465
11465
  // src/commands/ssh.ts
11466
+ function shellQuote(value) {
11467
+ return `'${value.replace(/'/g, "'\\''")}'`;
11468
+ }
11466
11469
  function resolveSshTarget(machineId, options = {}) {
11467
11470
  const resolved = resolveMachineRoute(machineId, options);
11468
11471
  if (!resolved.ok || !resolved.target) {
@@ -11481,11 +11484,11 @@ function resolveSshTarget(machineId, options = {}) {
11481
11484
  }
11482
11485
  function buildSshCommand(machineId, remoteCommand, options = {}) {
11483
11486
  const resolved = resolveSshTarget(machineId, options);
11484
- return remoteCommand ? `ssh ${resolved.target} ${JSON.stringify(remoteCommand)}` : `ssh ${resolved.target}`;
11487
+ return remoteCommand ? `ssh ${resolved.target} ${shellQuote(remoteCommand)}` : `ssh ${resolved.target}`;
11485
11488
  }
11486
11489
 
11487
11490
  // src/remote.ts
11488
- function shellQuote(value) {
11491
+ function shellQuote2(value) {
11489
11492
  return `'${value.replace(/'/g, "'\\''")}'`;
11490
11493
  }
11491
11494
  function machineIsLocal(machineId, localMachineId) {
@@ -11503,7 +11506,7 @@ function resolveMachineCommand(machineId, command, localMachineId = getLocalMach
11503
11506
  } catch (error) {
11504
11507
  const message = String(error.message ?? error);
11505
11508
  if (message.includes("Machine route not found") || message.includes("Machine not found in manifest")) {
11506
- return { source: "ssh", shellCommand: `ssh ${shellQuote(machineId)} ${shellQuote(command)}` };
11509
+ return { source: "ssh", shellCommand: `ssh ${shellQuote2(machineId)} ${shellQuote2(command)}` };
11507
11510
  }
11508
11511
  throw error;
11509
11512
  }
@@ -11531,7 +11534,7 @@ var DEFAULT_COMMANDS = [
11531
11534
  function defaultPackages() {
11532
11535
  return [{ name: "@hasna/machines", command: "machines", expectedVersion: getPackageVersion(), required: true }];
11533
11536
  }
11534
- function shellQuote2(value) {
11537
+ function shellQuote3(value) {
11535
11538
  return `'${value.replace(/'/g, "'\\''")}'`;
11536
11539
  }
11537
11540
  function commandId(value) {
@@ -11582,7 +11585,7 @@ function defaultRunner2(machineId, command) {
11582
11585
  return runMachineCommand(machineId, command);
11583
11586
  }
11584
11587
  function inspectCommand(machineId, spec, runner) {
11585
- const command = shellQuote2(spec.command);
11588
+ const command = shellQuote3(spec.command);
11586
11589
  const versionArgs = spec.versionArgs ?? "--version";
11587
11590
  const script = [
11588
11591
  `cmd=${command}`,
@@ -11611,7 +11614,7 @@ function fieldCommand(field) {
11611
11614
  }
11612
11615
  function inspectWorkspace(machineId, spec, runner) {
11613
11616
  const script = [
11614
- `path=${shellQuote2(spec.path)}`,
11617
+ `path=${shellQuote3(spec.path)}`,
11615
11618
  'printf "exists=%s\\n" "$(test -d "$path" && printf yes || printf no)"',
11616
11619
  'pkg="$path/package.json"',
11617
11620
  'printf "package_json=%s\\n" "$(test -f "$pkg" && printf yes || printf no)"',
@@ -11867,7 +11870,7 @@ function getAppManager(machine, app) {
11867
11870
  return "winget";
11868
11871
  return "apt";
11869
11872
  }
11870
- function shellQuote3(value) {
11873
+ function shellQuote4(value) {
11871
11874
  return `'${value.replace(/'/g, `'\\''`)}'`;
11872
11875
  }
11873
11876
  function buildAppCommand(machine, app) {
@@ -11888,7 +11891,7 @@ function buildAppCommand(machine, app) {
11888
11891
  return `sudo apt-get install -y ${packageName}`;
11889
11892
  }
11890
11893
  function buildAppProbeCommand(machine, app) {
11891
- const packageName = shellQuote3(getPackageName(app));
11894
+ const packageName = shellQuote4(getPackageName(app));
11892
11895
  const manager = getAppManager(machine, app);
11893
11896
  if (manager === "custom") {
11894
11897
  return `if command -v ${packageName} >/dev/null 2>&1; then printf 'installed=1\\nversion=custom\\n'; else printf 'installed=0\\n'; fi`;
@@ -12424,7 +12427,7 @@ var notificationConfigSchema = exports_external.object({
12424
12427
  function sortChannels(channels) {
12425
12428
  return [...channels].sort((left, right) => left.id.localeCompare(right.id));
12426
12429
  }
12427
- function shellQuote4(value) {
12430
+ function shellQuote5(value) {
12428
12431
  return `'${value.replace(/'/g, `'\\''`)}'`;
12429
12432
  }
12430
12433
  function hasCommand2(binary) {
@@ -12471,7 +12474,7 @@ ${message}
12471
12474
  };
12472
12475
  }
12473
12476
  if (hasCommand2("mail")) {
12474
- const command = `printf %s ${shellQuote4(message)} | mail -s ${shellQuote4(subject)} ${shellQuote4(channel.target)}`;
12477
+ const command = `printf %s ${shellQuote5(message)} | mail -s ${shellQuote5(subject)} ${shellQuote5(channel.target)}`;
12475
12478
  const result = Bun.spawnSync(["bash", "-lc", command], {
12476
12479
  stdout: "pipe",
12477
12480
  stderr: "pipe",
package/dist/mcp/index.js CHANGED
@@ -4656,6 +4656,9 @@ function resolveMachineRoute(machineId, options = {}) {
4656
4656
  }
4657
4657
 
4658
4658
  // src/commands/ssh.ts
4659
+ function shellQuote(value) {
4660
+ return `'${value.replace(/'/g, "'\\''")}'`;
4661
+ }
4659
4662
  function resolveSshTarget(machineId, options = {}) {
4660
4663
  const resolved = resolveMachineRoute(machineId, options);
4661
4664
  if (!resolved.ok || !resolved.target) {
@@ -4674,11 +4677,11 @@ function resolveSshTarget(machineId, options = {}) {
4674
4677
  }
4675
4678
  function buildSshCommand(machineId, remoteCommand, options = {}) {
4676
4679
  const resolved = resolveSshTarget(machineId, options);
4677
- return remoteCommand ? `ssh ${resolved.target} ${JSON.stringify(remoteCommand)}` : `ssh ${resolved.target}`;
4680
+ return remoteCommand ? `ssh ${resolved.target} ${shellQuote(remoteCommand)}` : `ssh ${resolved.target}`;
4678
4681
  }
4679
4682
 
4680
4683
  // src/remote.ts
4681
- function shellQuote(value) {
4684
+ function shellQuote2(value) {
4682
4685
  return `'${value.replace(/'/g, "'\\''")}'`;
4683
4686
  }
4684
4687
  function machineIsLocal(machineId, localMachineId) {
@@ -4696,7 +4699,7 @@ function resolveMachineCommand(machineId, command, localMachineId = getLocalMach
4696
4699
  } catch (error) {
4697
4700
  const message = String(error.message ?? error);
4698
4701
  if (message.includes("Machine route not found") || message.includes("Machine not found in manifest")) {
4699
- return { source: "ssh", shellCommand: `ssh ${shellQuote(machineId)} ${shellQuote(command)}` };
4702
+ return { source: "ssh", shellCommand: `ssh ${shellQuote2(machineId)} ${shellQuote2(command)}` };
4700
4703
  }
4701
4704
  throw error;
4702
4705
  }
@@ -4729,7 +4732,7 @@ function getAppManager(machine, app) {
4729
4732
  return "winget";
4730
4733
  return "apt";
4731
4734
  }
4732
- function shellQuote2(value) {
4735
+ function shellQuote3(value) {
4733
4736
  return `'${value.replace(/'/g, `'\\''`)}'`;
4734
4737
  }
4735
4738
  function buildAppCommand(machine, app) {
@@ -4750,7 +4753,7 @@ function buildAppCommand(machine, app) {
4750
4753
  return `sudo apt-get install -y ${packageName}`;
4751
4754
  }
4752
4755
  function buildAppProbeCommand(machine, app) {
4753
- const packageName = shellQuote2(getPackageName(app));
4756
+ const packageName = shellQuote3(getPackageName(app));
4754
4757
  const manager = getAppManager(machine, app);
4755
4758
  if (manager === "custom") {
4756
4759
  return `if command -v ${packageName} >/dev/null 2>&1; then printf 'installed=1\\nversion=custom\\n'; else printf 'installed=0\\n'; fi`;
@@ -5260,7 +5263,7 @@ var notificationConfigSchema = exports_external.object({
5260
5263
  function sortChannels(channels) {
5261
5264
  return [...channels].sort((left, right) => left.id.localeCompare(right.id));
5262
5265
  }
5263
- function shellQuote3(value) {
5266
+ function shellQuote4(value) {
5264
5267
  return `'${value.replace(/'/g, `'\\''`)}'`;
5265
5268
  }
5266
5269
  function hasCommand2(binary) {
@@ -5307,7 +5310,7 @@ ${message}
5307
5310
  };
5308
5311
  }
5309
5312
  if (hasCommand2("mail")) {
5310
- const command = `printf %s ${shellQuote3(message)} | mail -s ${shellQuote3(subject)} ${shellQuote3(channel.target)}`;
5313
+ const command = `printf %s ${shellQuote4(message)} | mail -s ${shellQuote4(subject)} ${shellQuote4(channel.target)}`;
5311
5314
  const result = Bun.spawnSync(["bash", "-lc", command], {
5312
5315
  stdout: "pipe",
5313
5316
  stderr: "pipe",
@@ -6101,7 +6104,7 @@ var DEFAULT_COMMANDS = [
6101
6104
  function defaultPackages() {
6102
6105
  return [{ name: "@hasna/machines", command: "machines", expectedVersion: getPackageVersion(), required: true }];
6103
6106
  }
6104
- function shellQuote4(value) {
6107
+ function shellQuote5(value) {
6105
6108
  return `'${value.replace(/'/g, "'\\''")}'`;
6106
6109
  }
6107
6110
  function commandId(value) {
@@ -6152,7 +6155,7 @@ function defaultRunner2(machineId, command) {
6152
6155
  return runMachineCommand(machineId, command);
6153
6156
  }
6154
6157
  function inspectCommand(machineId, spec, runner) {
6155
- const command = shellQuote4(spec.command);
6158
+ const command = shellQuote5(spec.command);
6156
6159
  const versionArgs = spec.versionArgs ?? "--version";
6157
6160
  const script = [
6158
6161
  `cmd=${command}`,
@@ -6181,7 +6184,7 @@ function fieldCommand(field) {
6181
6184
  }
6182
6185
  function inspectWorkspace(machineId, spec, runner) {
6183
6186
  const script = [
6184
- `path=${shellQuote4(spec.path)}`,
6187
+ `path=${shellQuote5(spec.path)}`,
6185
6188
  'printf "exists=%s\\n" "$(test -d "$path" && printf yes || printf no)"',
6186
6189
  'pkg="$path/package.json"',
6187
6190
  'printf "package_json=%s\\n" "$(test -f "$pkg" && printf yes || printf no)"',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/machines",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "Machine fleet management CLI + MCP for developers",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",