@pushpalsdev/cli 1.0.13 → 1.0.15

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.
@@ -1361,6 +1361,11 @@ function jsonHtmlBootstrap(value) {
1361
1361
  async function runGit(args, cwd) {
1362
1362
  const proc = Bun.spawn(["git", ...args], {
1363
1363
  cwd,
1364
+ env: {
1365
+ ...process.env,
1366
+ GIT_TERMINAL_PROMPT: "0",
1367
+ GCM_INTERACTIVE: "Never"
1368
+ },
1364
1369
  stdout: "pipe",
1365
1370
  stderr: "pipe"
1366
1371
  });
@@ -2019,6 +2024,52 @@ async function repoHasRemote(repoRoot, remote) {
2019
2024
  const result = await runGit(["remote", "get-url", normalizedRemote], repoRoot);
2020
2025
  return result.ok && Boolean(result.stdout);
2021
2026
  }
2027
+ async function checkPushpalsBranchOnRemote(repoRoot, remote, branch) {
2028
+ const normalizedRemote = String(remote ?? "").trim();
2029
+ const normalizedBranch = String(branch ?? "").trim();
2030
+ if (!normalizedRemote || !normalizedBranch) {
2031
+ return { status: "ok" };
2032
+ }
2033
+ const hasRemote = await repoHasRemote(repoRoot, normalizedRemote);
2034
+ if (!hasRemote) {
2035
+ return { status: "missing_remote", remote: normalizedRemote };
2036
+ }
2037
+ const ref = `refs/heads/${normalizedBranch}`;
2038
+ const result = await runGit(["ls-remote", "--heads", normalizedRemote, ref], repoRoot);
2039
+ if (!result.ok) {
2040
+ const detail = result.stderr || result.stdout || `exit ${result.exitCode}`;
2041
+ return {
2042
+ status: "error",
2043
+ remote: normalizedRemote,
2044
+ branch: normalizedBranch,
2045
+ detail
2046
+ };
2047
+ }
2048
+ if (!result.stdout.trim()) {
2049
+ return {
2050
+ status: "missing_branch",
2051
+ remote: normalizedRemote,
2052
+ branch: normalizedBranch
2053
+ };
2054
+ }
2055
+ return { status: "ok" };
2056
+ }
2057
+ async function enforcePushpalsRemoteBranchPrecheck(repoRoot, remote, branch) {
2058
+ const result = await checkPushpalsBranchOnRemote(repoRoot, remote, branch);
2059
+ if (result.status === "ok")
2060
+ return true;
2061
+ if (result.status === "missing_remote") {
2062
+ console.warn(`[pushpals] Precheck: git remote "${result.remote}" is not configured in this repo; cannot verify pushpals branch.`);
2063
+ return true;
2064
+ }
2065
+ if (result.status === "missing_branch") {
2066
+ console.error(`[pushpals] Precheck failed: remote branch "${result.remote}/${result.branch}" was not found.`);
2067
+ console.error("[pushpals] Precheck failed: create/push that branch first or set source_control_manager.pushpals_branch to an existing remote branch.");
2068
+ return false;
2069
+ }
2070
+ console.error(`[pushpals] Precheck failed: could not verify remote branch "${result.remote}/${result.branch}": ${result.detail}`);
2071
+ return false;
2072
+ }
2022
2073
  async function probeServer(serverUrl) {
2023
2074
  try {
2024
2075
  const response = await fetchWithTimeout(`${serverUrl}/healthz`, {}, HTTP_TIMEOUT_MS);
@@ -2251,6 +2302,7 @@ async function autoStartRuntimeServices(opts) {
2251
2302
  appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] runtimeRoot=${runtimeRoot}`);
2252
2303
  appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] runtimeTag=${runtimeTag}`);
2253
2304
  appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] repoRoot=${opts.repoRoot}`);
2305
+ console.log(`[pushpals] pushpals log: ${runtimeServicesLogPath}`);
2254
2306
  console.log(`[pushpals] runtime services log: ${runtimeServicesLogPath}`);
2255
2307
  console.log(`[pushpals] service log (server)=${serviceLogPaths.server}`);
2256
2308
  console.log(`[pushpals] service log (localbuddy)=${serviceLogPaths.localbuddy}`);
@@ -2323,7 +2375,7 @@ ${tail}` : ""}`);
2323
2375
  reportRemoteBuddyAutonomousEngineState();
2324
2376
  const scmHealthy = await probeSourceControlManager(opts.sourceControlManagerPort);
2325
2377
  const scmRemoteAvailable = await repoHasRemote(opts.repoRoot, opts.sourceControlManagerRemote);
2326
- const gitForScm = typeof runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE === "string" && runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE.trim() ? runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE.trim() : typeof runtimeEnv.PUSHPALS_GIT_BIN === "string" && runtimeEnv.PUSHPALS_GIT_BIN.trim() ? runtimeEnv.PUSHPALS_GIT_BIN.trim() : "git";
2378
+ const gitForScm = typeof runtimeEnv.PUSHPALS_GIT_BIN === "string" && runtimeEnv.PUSHPALS_GIT_BIN.trim() ? runtimeEnv.PUSHPALS_GIT_BIN.trim() : typeof runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE === "string" && runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE.trim() ? runtimeEnv.PUSHPALS_GIT_BIN_ABSOLUTE.trim() : "git";
2327
2379
  const gitProbeCommand = [gitForScm, "--version"];
2328
2380
  const gitAvailableForScm = await canSpawnCommand(gitProbeCommand, opts.repoRoot, runtimeEnv);
2329
2381
  if (!scmHealthy && scmRemoteAvailable) {
@@ -2973,6 +3025,10 @@ async function main() {
2973
3025
  } else {
2974
3026
  console.warn("[pushpals] RemoteBuddy autonomy is disabled in config (remotebuddy.autonomy.enabled=false); continuing.");
2975
3027
  }
3028
+ const precheckPassed = await enforcePushpalsRemoteBranchPrecheck(repoRoot, config.sourceControlManager.remote, config.sourceControlManager.mainBranch);
3029
+ if (!precheckPassed) {
3030
+ process.exit(1);
3031
+ }
2976
3032
  const serverUrl = normalizeLoopbackUrl(parsed.serverUrl ?? process.env.PUSHPALS_SERVER_URL, config.server.url);
2977
3033
  const localAgentUrl = normalizeLoopbackUrl(parsed.localAgentUrl ?? process.env.EXPO_PUBLIC_LOCAL_AGENT_URL, config.client.localAgentUrl);
2978
3034
  const sessionId = String(parsed.sessionId ?? process.env.PUSHPALS_SESSION_ID ?? config.sessionId).trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushpalsdev/cli",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "PushPals terminal CLI for LocalBuddy -> RemoteBuddy orchestration",
5
5
  "license": "MIT",
6
6
  "repository": {