@pushpalsdev/cli 1.0.10 → 1.0.11

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.
@@ -11,7 +11,7 @@ import {
11
11
  readFileSync as readFileSync4,
12
12
  writeFileSync
13
13
  } from "fs";
14
- import { dirname, extname, join as join2, resolve as resolve4 } from "path";
14
+ import { basename, delimiter, dirname, extname, join as join2, resolve as resolve4 } from "path";
15
15
  import { createInterface } from "readline";
16
16
 
17
17
  // ../shared/src/client_preflight.ts
@@ -1637,6 +1637,7 @@ function buildEmbeddedRuntimeEnv(baseEnv, opts) {
1637
1637
  PUSHPALS_PROMPTS_ROOT_OVERRIDE: opts.repoRoot
1638
1638
  },
1639
1639
  PUSHPALS_PROTOCOL_SCHEMAS_DIR: join2(opts.runtimeRoot, "protocol", "schemas"),
1640
+ ...opts.forceLocalBuddyEnabled ? { LOCALBUDDY_ENABLED: "1" } : {},
1640
1641
  ...typeof env.PUSHPALS_GIT_BIN === "string" && env.PUSHPALS_GIT_BIN.trim() ? { PUSHPALS_GIT_BIN: env.PUSHPALS_GIT_BIN.trim() } : {}
1641
1642
  };
1642
1643
  }
@@ -1827,6 +1828,34 @@ function stopRuntimeServices(services) {
1827
1828
  } catch {}
1828
1829
  }
1829
1830
  }
1831
+ function prependExecutableDirToPath(env, executablePath, platform = process.platform) {
1832
+ const resolvedPath = String(executablePath ?? "").trim();
1833
+ if (!resolvedPath)
1834
+ return env;
1835
+ if (!resolvedPath.includes("/") && !resolvedPath.includes("\\")) {
1836
+ return env;
1837
+ }
1838
+ const executableDir = dirname(resolvedPath);
1839
+ const existingPath = platform === "win32" ? String(env.Path ?? env.PATH ?? "") : String(env.PATH ?? "");
1840
+ const pathEntries = existingPath.split(delimiter).map((entry) => entry.trim()).filter((entry) => entry.length > 0);
1841
+ const hasDir = pathEntries.some((entry) => entry.toLowerCase() === executableDir.toLowerCase());
1842
+ const nextPath = hasDir ? existingPath : [executableDir, ...pathEntries].join(delimiter);
1843
+ if (platform === "win32") {
1844
+ env.Path = nextPath;
1845
+ env.PATH = nextPath;
1846
+ } else {
1847
+ env.PATH = nextPath;
1848
+ }
1849
+ return env;
1850
+ }
1851
+ function applyResolvedGitBinaryToRuntimeEnv(env, resolvedGitBinary, platform = process.platform) {
1852
+ const resolvedPath = String(resolvedGitBinary ?? "").trim();
1853
+ if (!resolvedPath)
1854
+ return env;
1855
+ prependExecutableDirToPath(env, resolvedPath, platform);
1856
+ env.PUSHPALS_GIT_BIN = basename(resolvedPath);
1857
+ return env;
1858
+ }
1830
1859
  function isOptionalEmbeddedService(name) {
1831
1860
  return name === "source_control_manager";
1832
1861
  }
@@ -1915,8 +1944,8 @@ async function autoStartRuntimeServices(opts) {
1915
1944
  const { runtimePreflight } = opts.preparedRuntime;
1916
1945
  const runtimeRoot = opts.preparedRuntime.runtimeRoot;
1917
1946
  const runtimeTag = opts.preparedRuntime.runtimeTag || await resolveRuntimeReleaseTag(opts.requestedRuntimeTag);
1918
- const localBuddyEnabled = Boolean(runtimePreflight.config.localbuddy.enabled);
1919
1947
  const requireLocalBuddy = opts.requireLocalBuddy ?? true;
1948
+ const localBuddyEnabled = requireLocalBuddy || Boolean(runtimePreflight.config.localbuddy.enabled);
1920
1949
  console.log(`[pushpals] LocalBuddy unavailable. Auto-starting runtime for repo: ${opts.repoRoot}`);
1921
1950
  console.log(`[pushpals] runtimeRoot=${runtimeRoot}`);
1922
1951
  console.log(`[pushpals] runtimeTag=${runtimeTag}`);
@@ -1928,11 +1957,15 @@ async function autoStartRuntimeServices(opts) {
1928
1957
  const runtimeEnv = buildEmbeddedRuntimeEnv(process.env, {
1929
1958
  repoRoot: opts.repoRoot,
1930
1959
  runtimeRoot,
1931
- useRuntimeConfig: opts.preparedRuntime.preflightUsesEmbeddedRuntime
1960
+ useRuntimeConfig: opts.preparedRuntime.preflightUsesEmbeddedRuntime,
1961
+ forceLocalBuddyEnabled: requireLocalBuddy
1932
1962
  });
1963
+ if (runtimeEnv.PUSHPALS_GIT_BIN) {
1964
+ applyResolvedGitBinaryToRuntimeEnv(runtimeEnv, runtimeEnv.PUSHPALS_GIT_BIN);
1965
+ }
1933
1966
  const resolvedGitBinary = await resolveCommandPath("git", opts.repoRoot, normalizeChildProcessEnv(process.env));
1934
1967
  if (resolvedGitBinary) {
1935
- runtimeEnv.PUSHPALS_GIT_BIN = resolvedGitBinary;
1968
+ applyResolvedGitBinaryToRuntimeEnv(runtimeEnv, resolvedGitBinary);
1936
1969
  }
1937
1970
  const services = [];
1938
1971
  const runToken = timestampFileToken();
@@ -1973,6 +2006,9 @@ ${tail}` : ""}`);
1973
2006
  console.log("[pushpals] Server already healthy; skipping embedded server start.");
1974
2007
  }
1975
2008
  if (localBuddyEnabled) {
2009
+ if (requireLocalBuddy && !runtimePreflight.config.localbuddy.enabled) {
2010
+ console.log("[pushpals] LocalBuddy is disabled in config; forcing it on for this CLI session.");
2011
+ }
1976
2012
  console.log("[pushpals] Starting embedded LocalBuddy...");
1977
2013
  const localbuddyService = spawnRuntimeService("localbuddy", [runtimeBinaries.localbuddy], opts.repoRoot, runtimeEnv, logPathFor("localbuddy"));
1978
2014
  services.push(localbuddyService);
@@ -2911,5 +2947,6 @@ export {
2911
2947
  buildServiceStopCommand,
2912
2948
  buildOpenMonitoringHubCommand,
2913
2949
  buildEmbeddedRuntimeEnv,
2914
- buildEmbeddedMonitoringHubHtml
2950
+ buildEmbeddedMonitoringHubHtml,
2951
+ applyResolvedGitBinaryToRuntimeEnv
2915
2952
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushpalsdev/cli",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "PushPals terminal CLI for LocalBuddy -> RemoteBuddy orchestration",
5
5
  "license": "MIT",
6
6
  "repository": {