@rudderhq/cli 0.2.1-canary.5 → 0.2.2-canary.0

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/index.js CHANGED
@@ -6242,6 +6242,38 @@ function createDesktopProgressFactory() {
6242
6242
  };
6243
6243
  };
6244
6244
  }
6245
+ async function waitForDesktopApplySignal() {
6246
+ process.stdin.setEncoding("utf8");
6247
+ process.stdin.resume();
6248
+ await new Promise((resolve, reject) => {
6249
+ let buffer = "";
6250
+ const cleanup = () => {
6251
+ process.stdin.off("data", onData);
6252
+ process.stdin.off("end", onEnd);
6253
+ process.stdin.off("error", onError);
6254
+ };
6255
+ const onData = (chunk) => {
6256
+ buffer += chunk;
6257
+ const lines = buffer.split(/\r?\n/);
6258
+ buffer = lines.pop() ?? "";
6259
+ if (lines.some((line) => line.trim() === "apply")) {
6260
+ cleanup();
6261
+ resolve();
6262
+ }
6263
+ };
6264
+ const onEnd = () => {
6265
+ cleanup();
6266
+ reject(new Error("Desktop update apply signal ended before confirmation."));
6267
+ };
6268
+ const onError = (error) => {
6269
+ cleanup();
6270
+ reject(error);
6271
+ };
6272
+ process.stdin.on("data", onData);
6273
+ process.stdin.on("end", onEnd);
6274
+ process.stdin.on("error", onError);
6275
+ });
6276
+ }
6245
6277
  function resolveCurrentCliVersion(env = process.env) {
6246
6278
  const version = resolveCliVersion(import.meta.url, env);
6247
6279
  return version === "0.0.0" ? "latest" : version;
@@ -6972,6 +7004,18 @@ async function startCommand(opts) {
6972
7004
  () => assertChecksumMatch(installerPath, expectedChecksum),
6973
7005
  desktopProgressJson ? "verifying_checksum" : null
6974
7006
  );
7007
+ if (desktopProgressJson && opts.desktopWaitForApply === true) {
7008
+ writeDesktopProgress({
7009
+ phase: "ready_to_install",
7010
+ message: "Desktop update is downloaded and verified.",
7011
+ percent: 100
7012
+ });
7013
+ await waitForDesktopApplySignal();
7014
+ writeDesktopProgress({
7015
+ phase: "preparing_restart",
7016
+ message: "Applying Desktop update..."
7017
+ });
7018
+ }
6975
7019
  await runStartPhase(
6976
7020
  "Replacing existing Rudder Desktop if needed...",
6977
7021
  "Existing Desktop install is ready for replacement.",
@@ -11555,7 +11599,7 @@ function createProgram() {
11555
11599
  });
11556
11600
  loadRudderEnvFile(options.config);
11557
11601
  });
11558
- program.command("start").description("Start Rudder Desktop and prepare the matching persistent CLI").option("--no-cli", "Skip persistent CLI installation").option("--no-runtime", "Skip Rudder runtime installation").option("--no-desktop", "Skip desktop app installation").option("--version <version>", "Rudder version to start (default: current CLI version)").option("--target-version <version>", "Rudder version to start; avoids the root CLI version flag").option("--repo <owner/repo>", "GitHub repository that hosts desktop releases").option("--output-dir <path>", "Directory for downloaded desktop release assets").option("--desktop-install-dir <path>", "Directory for the portable Desktop install").option("--no-open", "Install Desktop without launching it").option("--wait-for-active-runs", "Wait for active Rudder runs to finish before replacing Desktop", false).option("--desktop-progress-json", "Emit newline-delimited Desktop update progress events").option("--no-version-check", "Skip checking npm for a newer Rudder CLI version").option("--dry-run", "Print the start actions without changing the machine", false).action(startCommand);
11602
+ program.command("start").description("Start Rudder Desktop and prepare the matching persistent CLI").option("--no-cli", "Skip persistent CLI installation").option("--no-runtime", "Skip Rudder runtime installation").option("--no-desktop", "Skip desktop app installation").option("--version <version>", "Rudder version to start (default: current CLI version)").option("--target-version <version>", "Rudder version to start; avoids the root CLI version flag").option("--repo <owner/repo>", "GitHub repository that hosts desktop releases").option("--output-dir <path>", "Directory for downloaded desktop release assets").option("--desktop-install-dir <path>", "Directory for the portable Desktop install").option("--no-open", "Install Desktop without launching it").option("--wait-for-active-runs", "Wait for active Rudder runs to finish before replacing Desktop", false).option("--desktop-progress-json", "Emit newline-delimited Desktop update progress events").option("--desktop-wait-for-apply", "Wait for an apply signal after downloading and verifying the Desktop update", false).option("--no-version-check", "Skip checking npm for a newer Rudder CLI version").option("--dry-run", "Print the start actions without changing the machine", false).action(startCommand);
11559
11603
  program.command("onboard").description("Interactive first-run setup wizard").option("-c, --config <path>", "Path to config file").option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP).option("-y, --yes", "Accept defaults (quickstart + start immediately)", false).option("--run", "Start Rudder immediately after saving config", false).action(onboard);
11560
11604
  program.command("doctor").description("Run diagnostic checks on your Rudder setup").option("-c, --config <path>", "Path to config file").option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP).option("--repair", "Attempt to repair issues automatically").alias("--fix").option("-y, --yes", "Skip repair confirmation prompts").action(async (opts) => {
11561
11605
  await doctor(opts);