@vibelet/cli 1.0.15 → 1.0.16

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.
@@ -1,2 +1,2 @@
1
- var s=require("node:fs"),n=require("node:path"),c="@vibelet/cli";function a(e){try{let r=JSON.parse((0,s.readFileSync)(e,"utf8"));if(r.name===c&&typeof r.version=="string"&&r.version.length>0)return r.version}catch{}return null}function p(){return"1.0.15"}var i=p();process.stdout.write(`${i}
1
+ var s=require("node:fs"),n=require("node:path"),c="@vibelet/cli";function a(e){try{let r=JSON.parse((0,s.readFileSync)(e,"utf8"));if(r.name===c&&typeof r.version=="string"&&r.version.length>0)return r.version}catch{}return null}function p(){return"1.0.16"}var i=p();process.stdout.write(`${i}
2
2
  `);
package/dist/vibelet.mjs CHANGED
@@ -6491,6 +6491,57 @@ function canUseSystemdUserManager({ spawnSyncImpl = node_child_process__WEBPACK_
6491
6491
  }
6492
6492
 
6493
6493
 
6494
+ /***/ }),
6495
+
6496
+ /***/ 3428:
6497
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __nccwpck_require__) => {
6498
+
6499
+ /* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
6500
+ /* harmony export */ AW: () => (/* binding */ readNpmConfigFlag),
6501
+ /* harmony export */ PC: () => (/* binding */ consumeFlag),
6502
+ /* harmony export */ nE: () => (/* binding */ parseNamedArg)
6503
+ /* harmony export */ });
6504
+ /* unused harmony export readNpmConfigArg */
6505
+ function consumeFlag(argv, name) {
6506
+ const idx = argv.indexOf(`--${name}`);
6507
+ if (idx === -1) return false;
6508
+ argv.splice(idx, 1);
6509
+ return true;
6510
+ }
6511
+
6512
+ function readNpmConfigFlag(name, env = process.env) {
6513
+ const value = env[`npm_config_${name.replace(/-/g, '_')}`];
6514
+ return value === '' || value === 'true';
6515
+ }
6516
+
6517
+ function readNpmConfigArg(name, env = process.env) {
6518
+ const value = env[`npm_config_${name.replace(/-/g, '_')}`];
6519
+ return typeof value === 'string' ? value : null;
6520
+ }
6521
+
6522
+ function parseNamedArg(argv, name, errorHint, fail, env = process.env) {
6523
+ const inlinePrefix = `--${name}=`;
6524
+ const inlineArg = argv.find((arg) => arg.startsWith(inlinePrefix));
6525
+ if (inlineArg) {
6526
+ const idx = argv.indexOf(inlineArg);
6527
+ argv.splice(idx, 1);
6528
+ return inlineArg.slice(inlinePrefix.length);
6529
+ }
6530
+
6531
+ const idx = argv.indexOf(`--${name}`);
6532
+ if (idx !== -1) {
6533
+ const value = argv[idx + 1];
6534
+ if (!value || value.startsWith('-')) {
6535
+ fail(`--${name} requires an argument${errorHint ? ` (e.g. --${name} ${errorHint})` : ''}`);
6536
+ }
6537
+ argv.splice(idx, 2);
6538
+ return value;
6539
+ }
6540
+
6541
+ return readNpmConfigArg(name, env);
6542
+ }
6543
+
6544
+
6494
6545
  /***/ }),
6495
6546
 
6496
6547
  /***/ 6067:
@@ -6524,16 +6575,23 @@ function doesHealthMatchRequestedConnectionConfig({
6524
6575
  return currentRelayUrl === relayUrl;
6525
6576
  }
6526
6577
 
6527
- if (localMode) {
6528
- return currentRelayUrl === '';
6578
+ const directConnectionRequested = localMode || Boolean(canonicalHost) || Boolean(fallbackHosts);
6579
+ if (directConnectionRequested && currentRelayUrl !== '') {
6580
+ return false;
6529
6581
  }
6530
6582
 
6531
- if (canonicalHost) {
6532
- if (fallbackHosts) return false;
6533
- return currentRelayUrl === '' && health.canonicalHost === canonicalHost;
6583
+ if (canonicalHost && health.canonicalHost !== canonicalHost) {
6584
+ return false;
6585
+ }
6586
+
6587
+ if (fallbackHosts) {
6588
+ return false;
6589
+ }
6590
+
6591
+ if (localMode || canonicalHost) {
6592
+ return true;
6534
6593
  }
6535
6594
 
6536
- if (fallbackHosts) return false;
6537
6595
  return currentRelayUrl === '';
6538
6596
  }
6539
6597
 
@@ -6550,10 +6608,12 @@ __nccwpck_require__.a(__webpack_module__, async (__webpack_handle_async_dependen
6550
6608
  /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_3__ = __nccwpck_require__(6760);
6551
6609
  /* harmony import */ var node_url__WEBPACK_IMPORTED_MODULE_4__ = __nccwpck_require__(3136);
6552
6610
  /* harmony import */ var qrcode__WEBPACK_IMPORTED_MODULE_5__ = __nccwpck_require__(1302);
6553
- /* harmony import */ var _cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(1932);
6611
+ /* harmony import */ var _vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__ = __nccwpck_require__(3428);
6612
+ /* harmony import */ var _cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_9__ = __nccwpck_require__(1932);
6554
6613
  /* harmony import */ var _cloudflared_resolver_mjs__WEBPACK_IMPORTED_MODULE_6__ = __nccwpck_require__(3006);
6555
6614
  /* harmony import */ var _linux_systemd_mjs__WEBPACK_IMPORTED_MODULE_7__ = __nccwpck_require__(5400);
6556
- /* harmony import */ var _vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_9__ = __nccwpck_require__(6067);
6615
+ /* harmony import */ var _vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_10__ = __nccwpck_require__(6067);
6616
+
6557
6617
 
6558
6618
 
6559
6619
 
@@ -6574,6 +6634,7 @@ const daemonDistDir = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.resolve)(rootDir
6574
6634
  const daemonEntryPath = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.resolve)(daemonDistDir, 'index.cjs');
6575
6635
  const vibeletDir = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.join)((0,node_os__WEBPACK_IMPORTED_MODULE_2__.homedir)(), '.vibelet');
6576
6636
  const pairingQrPngPath = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.join)(vibeletDir, 'pairing-qr.png');
6637
+ const pairingCodePath = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.join)(vibeletDir, 'pairing-code.txt');
6577
6638
  const logDir = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.join)(vibeletDir, 'logs');
6578
6639
  const runtimeDir = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.join)(vibeletDir, 'runtime');
6579
6640
  const runtimeCurrentDir = (0,node_path__WEBPACK_IMPORTED_MODULE_3__.join)(runtimeDir, 'current');
@@ -7476,8 +7537,13 @@ function formatConnectionSummary(target) {
7476
7537
  return `${target.host}:${target.port} [${formatConnectionSourceLabel(target.source)}, ${stabilityLabel}]`;
7477
7538
  }
7478
7539
 
7540
+ function buildPairingDeepLink(pairingPayloadText) {
7541
+ return `vibelet://pair?data=${encodeURIComponent(pairingPayloadText)}`;
7542
+ }
7543
+
7479
7544
  async function printPairingQr(pairingPayload) {
7480
7545
  const payload = JSON.stringify(createCompactPairingPayload(pairingPayload));
7546
+ const deepLink = buildPairingDeepLink(payload);
7481
7547
  (0,node_fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync)(vibeletDir, { recursive: true });
7482
7548
  await qrcode__WEBPACK_IMPORTED_MODULE_5__.toFile(pairingQrPngPath, payload, {
7483
7549
  type: 'png',
@@ -7490,8 +7556,12 @@ async function printPairingQr(pairingPayload) {
7490
7556
  small: true,
7491
7557
  errorCorrectionLevel: 'M',
7492
7558
  });
7559
+ (0,node_fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync)(pairingCodePath, `${payload}\n`, 'utf8');
7493
7560
  process.stdout.write(`\nScan this QR code with the Vibelet app:\n\n${qr}\n`);
7494
7561
  process.stdout.write(`If Vibelet app can't scan the terminal QR, open this PNG instead:\n${pairingQrPngPath}\n`);
7562
+ process.stdout.write(`If this device can't scan, paste this pairing code in Vibelet:\n${payload}\n`);
7563
+ process.stdout.write(`Pairing code saved to:\n${pairingCodePath}\n`);
7564
+ process.stdout.write(`Or open this deep link on a device with Vibelet installed:\n${deepLink}\n`);
7495
7565
  }
7496
7566
 
7497
7567
  // ─── Commands ───────────────────────────────────────────────────────────────────
@@ -7560,35 +7630,8 @@ function printHelp() {
7560
7630
  process.stdout.write(` npx ${packageJson.name} --host=<tailscale-ip>\n`);
7561
7631
  }
7562
7632
 
7563
- function consumeFlag(name) {
7564
- const idx = process.argv.indexOf(`--${name}`);
7565
- if (idx === -1) return false;
7566
- process.argv.splice(idx, 1);
7567
- return true;
7568
- }
7569
-
7570
- function readNpmConfigFlag(name) {
7571
- const value = process.env[`npm_config_${name.replace(/-/g, '_')}`];
7572
- return value === '' || value === 'true';
7573
- }
7574
-
7575
7633
  function parseNamedArg(name, errorHint) {
7576
- const inlinePrefix = `--${name}=`;
7577
- const inlineArg = process.argv.find((arg) => arg.startsWith(inlinePrefix));
7578
- if (inlineArg) {
7579
- const idx = process.argv.indexOf(inlineArg);
7580
- process.argv.splice(idx, 1);
7581
- return inlineArg.slice(inlinePrefix.length);
7582
- }
7583
-
7584
- const idx = process.argv.indexOf(`--${name}`);
7585
- if (idx === -1) return null;
7586
- const value = process.argv[idx + 1];
7587
- if (!value || value.startsWith('-')) {
7588
- fail(`--${name} requires an argument${errorHint ? ` (e.g. --${name} ${errorHint})` : ''}`);
7589
- }
7590
- process.argv.splice(idx, 2);
7591
- return value;
7634
+ return (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .parseNamedArg */ .nE)(process.argv, name, errorHint, fail);
7592
7635
  }
7593
7636
 
7594
7637
  function parseRelayArg() {
@@ -7723,7 +7766,7 @@ function startTunnel() {
7723
7766
  const poll = setInterval(() => {
7724
7767
  try {
7725
7768
  const content = (0,node_fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync)(logPath, 'utf8');
7726
- const tunnelUrl = (0,_cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_8__/* .extractQuickTunnelUrl */ .k)(content);
7769
+ const tunnelUrl = (0,_cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_9__/* .extractQuickTunnelUrl */ .k)(content);
7727
7770
  if (tunnelUrl) {
7728
7771
  url = tunnelUrl;
7729
7772
  saveTunnelState(pid, url);
@@ -7745,7 +7788,7 @@ function startTunnel() {
7745
7788
  childExited = true;
7746
7789
  if (!url) {
7747
7790
  const content = readCloudflaredLog(logPath);
7748
- const tunnelUrl = (0,_cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_8__/* .extractQuickTunnelUrl */ .k)(content);
7791
+ const tunnelUrl = (0,_cloudflared_quick_tunnel_mjs__WEBPACK_IMPORTED_MODULE_9__/* .extractQuickTunnelUrl */ .k)(content);
7749
7792
  if (tunnelUrl) {
7750
7793
  url = tunnelUrl;
7751
7794
  saveTunnelState(pid, url);
@@ -7784,9 +7827,9 @@ async function main() {
7784
7827
  process.env.VIBE_PORT = String(portArg);
7785
7828
  }
7786
7829
 
7787
- consumeFlag('remote') || consumeFlag('tunnel') || readNpmConfigFlag('remote') || readNpmConfigFlag('tunnel');
7788
- const localFlag = consumeFlag('local') || readNpmConfigFlag('local');
7789
- const forceFlag = consumeFlag('force') || readNpmConfigFlag('force');
7830
+ (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .consumeFlag */ .PC)(process.argv, 'remote') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .consumeFlag */ .PC)(process.argv, 'tunnel') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .readNpmConfigFlag */ .AW)('remote') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .readNpmConfigFlag */ .AW)('tunnel');
7831
+ const localFlag = (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .consumeFlag */ .PC)(process.argv, 'local') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .readNpmConfigFlag */ .AW)('local');
7832
+ const forceFlag = (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .consumeFlag */ .PC)(process.argv, 'force') || (0,_vibelet_cli_args_mjs__WEBPACK_IMPORTED_MODULE_8__/* .readNpmConfigFlag */ .AW)('force');
7790
7833
  const relayArg = parseRelayArg();
7791
7834
  const hostArg = parseNamedArg('host', '100.x.x.x');
7792
7835
  const fallbackHostsArg = parseNamedArg('fallback-hosts', '100.x.x.x,192.168.1.x');
@@ -7927,7 +7970,7 @@ async function main() {
7927
7970
 
7928
7971
  if (command === 'reset') {
7929
7972
  const healthyDaemon = await probeHealth(1_500);
7930
- const hasExplicitConfigOverrides = !(0,_vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_9__/* .doesHealthMatchRequestedConnectionConfig */ .n)({
7973
+ const hasExplicitConfigOverrides = !(0,_vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_10__/* .doesHealthMatchRequestedConnectionConfig */ .n)({
7931
7974
  health: healthyDaemon,
7932
7975
  relayUrl,
7933
7976
  canonicalHost: hostArg || '',
@@ -7953,14 +7996,14 @@ async function main() {
7953
7996
  }
7954
7997
 
7955
7998
  const healthyDaemon = await probeHealth(1_500);
7956
- const hasExplicitConfigOverrides = !(0,_vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_9__/* .doesHealthMatchRequestedConnectionConfig */ .n)({
7999
+ const hasExplicitConfigOverrides = !(0,_vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_10__/* .doesHealthMatchRequestedConnectionConfig */ .n)({
7957
8000
  health: healthyDaemon,
7958
8001
  relayUrl,
7959
8002
  canonicalHost: hostArg || '',
7960
8003
  fallbackHosts: fallbackHostsArg || '',
7961
8004
  localMode: localFlag,
7962
8005
  }) && (localFlag || Boolean(relayUrl) || Boolean(hostArg) || Boolean(fallbackHostsArg));
7963
- const existingHealth = (0,_vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_9__/* .shouldReuseHealthyDaemon */ .Z)({
8006
+ const existingHealth = (0,_vibelet_runtime_policy_mjs__WEBPACK_IMPORTED_MODULE_10__/* .shouldReuseHealthyDaemon */ .Z)({
7964
8007
  command,
7965
8008
  daemonHealthy: Boolean(healthyDaemon),
7966
8009
  hasExplicitConfigOverrides,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibelet/cli",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "macOS CLI for installing and running the Vibelet daemon",
5
5
  "homepage": "https://vibelet.icu",
6
6
  "files": [