@pushpalsdev/cli 1.0.14 → 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.
- package/dist/pushpals-cli.js +73 -3
- package/package.json +1 -1
package/dist/pushpals-cli.js
CHANGED
|
@@ -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
|
});
|
|
@@ -1843,12 +1848,14 @@ async function ensureRuntimeBinaries(runtimeRoot, runtimeTag) {
|
|
|
1843
1848
|
server: join2(binDir, runtimeBinaryFilename("server", platformKey)),
|
|
1844
1849
|
localbuddy: join2(binDir, runtimeBinaryFilename("localbuddy", platformKey)),
|
|
1845
1850
|
remotebuddy: join2(binDir, runtimeBinaryFilename("remotebuddy", platformKey)),
|
|
1851
|
+
workerpals: join2(binDir, runtimeBinaryFilename("workerpals", platformKey)),
|
|
1846
1852
|
sourceControlManager: join2(binDir, runtimeBinaryFilename("source_control_manager", platformKey))
|
|
1847
1853
|
};
|
|
1848
1854
|
const requiredAssets = [
|
|
1849
1855
|
runtimeBinaries.server,
|
|
1850
1856
|
runtimeBinaries.localbuddy,
|
|
1851
1857
|
runtimeBinaries.remotebuddy,
|
|
1858
|
+
runtimeBinaries.workerpals,
|
|
1852
1859
|
runtimeBinaries.sourceControlManager
|
|
1853
1860
|
];
|
|
1854
1861
|
let downloadedCount = 0;
|
|
@@ -2019,6 +2026,52 @@ async function repoHasRemote(repoRoot, remote) {
|
|
|
2019
2026
|
const result = await runGit(["remote", "get-url", normalizedRemote], repoRoot);
|
|
2020
2027
|
return result.ok && Boolean(result.stdout);
|
|
2021
2028
|
}
|
|
2029
|
+
async function checkPushpalsBranchOnRemote(repoRoot, remote, branch) {
|
|
2030
|
+
const normalizedRemote = String(remote ?? "").trim();
|
|
2031
|
+
const normalizedBranch = String(branch ?? "").trim();
|
|
2032
|
+
if (!normalizedRemote || !normalizedBranch) {
|
|
2033
|
+
return { status: "ok" };
|
|
2034
|
+
}
|
|
2035
|
+
const hasRemote = await repoHasRemote(repoRoot, normalizedRemote);
|
|
2036
|
+
if (!hasRemote) {
|
|
2037
|
+
return { status: "missing_remote", remote: normalizedRemote };
|
|
2038
|
+
}
|
|
2039
|
+
const ref = `refs/heads/${normalizedBranch}`;
|
|
2040
|
+
const result = await runGit(["ls-remote", "--heads", normalizedRemote, ref], repoRoot);
|
|
2041
|
+
if (!result.ok) {
|
|
2042
|
+
const detail = result.stderr || result.stdout || `exit ${result.exitCode}`;
|
|
2043
|
+
return {
|
|
2044
|
+
status: "error",
|
|
2045
|
+
remote: normalizedRemote,
|
|
2046
|
+
branch: normalizedBranch,
|
|
2047
|
+
detail
|
|
2048
|
+
};
|
|
2049
|
+
}
|
|
2050
|
+
if (!result.stdout.trim()) {
|
|
2051
|
+
return {
|
|
2052
|
+
status: "missing_branch",
|
|
2053
|
+
remote: normalizedRemote,
|
|
2054
|
+
branch: normalizedBranch
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
return { status: "ok" };
|
|
2058
|
+
}
|
|
2059
|
+
async function enforcePushpalsRemoteBranchPrecheck(repoRoot, remote, branch) {
|
|
2060
|
+
const result = await checkPushpalsBranchOnRemote(repoRoot, remote, branch);
|
|
2061
|
+
if (result.status === "ok")
|
|
2062
|
+
return true;
|
|
2063
|
+
if (result.status === "missing_remote") {
|
|
2064
|
+
console.warn(`[pushpals] Precheck: git remote "${result.remote}" is not configured in this repo; cannot verify pushpals branch.`);
|
|
2065
|
+
return true;
|
|
2066
|
+
}
|
|
2067
|
+
if (result.status === "missing_branch") {
|
|
2068
|
+
console.error(`[pushpals] Precheck failed: remote branch "${result.remote}/${result.branch}" was not found.`);
|
|
2069
|
+
console.error("[pushpals] Precheck failed: create/push that branch first or set source_control_manager.pushpals_branch to an existing remote branch.");
|
|
2070
|
+
return false;
|
|
2071
|
+
}
|
|
2072
|
+
console.error(`[pushpals] Precheck failed: could not verify remote branch "${result.remote}/${result.branch}": ${result.detail}`);
|
|
2073
|
+
return false;
|
|
2074
|
+
}
|
|
2022
2075
|
async function probeServer(serverUrl) {
|
|
2023
2076
|
try {
|
|
2024
2077
|
const response = await fetchWithTimeout(`${serverUrl}/healthz`, {}, HTTP_TIMEOUT_MS);
|
|
@@ -2233,6 +2286,7 @@ async function autoStartRuntimeServices(opts) {
|
|
|
2233
2286
|
useRuntimeConfig: opts.preparedRuntime.preflightUsesEmbeddedRuntime,
|
|
2234
2287
|
sessionId: opts.sessionId
|
|
2235
2288
|
});
|
|
2289
|
+
runtimeEnv.PUSHPALS_WORKERPALS_BIN = runtimeBinaries.workerpals;
|
|
2236
2290
|
if (runtimeEnv.PUSHPALS_GIT_BIN) {
|
|
2237
2291
|
applyResolvedGitBinaryToRuntimeEnv(runtimeEnv, runtimeEnv.PUSHPALS_GIT_BIN);
|
|
2238
2292
|
}
|
|
@@ -2251,6 +2305,7 @@ async function autoStartRuntimeServices(opts) {
|
|
|
2251
2305
|
appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] runtimeRoot=${runtimeRoot}`);
|
|
2252
2306
|
appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] runtimeTag=${runtimeTag}`);
|
|
2253
2307
|
appendRuntimeServicesLogLine(runtimeServicesLogPath, `[pushpals] repoRoot=${opts.repoRoot}`);
|
|
2308
|
+
console.log(`[pushpals] pushpals log: ${runtimeServicesLogPath}`);
|
|
2254
2309
|
console.log(`[pushpals] runtime services log: ${runtimeServicesLogPath}`);
|
|
2255
2310
|
console.log(`[pushpals] service log (server)=${serviceLogPaths.server}`);
|
|
2256
2311
|
console.log(`[pushpals] service log (localbuddy)=${serviceLogPaths.localbuddy}`);
|
|
@@ -2409,7 +2464,10 @@ ${tail}` : ""}`);
|
|
|
2409
2464
|
}
|
|
2410
2465
|
console.log("[pushpals] Embedded runtime is ready.");
|
|
2411
2466
|
appendRuntimeServicesLogLine(runtimeServicesLogPath, "[pushpals] embedded runtime is ready.");
|
|
2412
|
-
return
|
|
2467
|
+
return {
|
|
2468
|
+
services,
|
|
2469
|
+
pushpalsLogPath: runtimeServicesLogPath
|
|
2470
|
+
};
|
|
2413
2471
|
}
|
|
2414
2472
|
await Bun.sleep(DEFAULT_RUNTIME_BOOT_POLL_MS);
|
|
2415
2473
|
}
|
|
@@ -2440,6 +2498,7 @@ function readCliState(pathValue) {
|
|
|
2440
2498
|
localAgentUrl: typeof parsed.localAgentUrl === "string" ? parsed.localAgentUrl : undefined,
|
|
2441
2499
|
sessionId: typeof parsed.sessionId === "string" ? parsed.sessionId : undefined,
|
|
2442
2500
|
repoRoot: typeof parsed.repoRoot === "string" ? parsed.repoRoot : undefined,
|
|
2501
|
+
pushpalsLogPath: typeof parsed.pushpalsLogPath === "string" ? parsed.pushpalsLogPath : undefined,
|
|
2443
2502
|
updatedAt: typeof parsed.updatedAt === "string" ? parsed.updatedAt : undefined
|
|
2444
2503
|
};
|
|
2445
2504
|
} catch {
|
|
@@ -2973,6 +3032,10 @@ async function main() {
|
|
|
2973
3032
|
} else {
|
|
2974
3033
|
console.warn("[pushpals] RemoteBuddy autonomy is disabled in config (remotebuddy.autonomy.enabled=false); continuing.");
|
|
2975
3034
|
}
|
|
3035
|
+
const precheckPassed = await enforcePushpalsRemoteBranchPrecheck(repoRoot, config.sourceControlManager.remote, config.sourceControlManager.mainBranch);
|
|
3036
|
+
if (!precheckPassed) {
|
|
3037
|
+
process.exit(1);
|
|
3038
|
+
}
|
|
2976
3039
|
const serverUrl = normalizeLoopbackUrl(parsed.serverUrl ?? process.env.PUSHPALS_SERVER_URL, config.server.url);
|
|
2977
3040
|
const localAgentUrl = normalizeLoopbackUrl(parsed.localAgentUrl ?? process.env.EXPO_PUBLIC_LOCAL_AGENT_URL, config.client.localAgentUrl);
|
|
2978
3041
|
const sessionId = String(parsed.sessionId ?? process.env.PUSHPALS_SESSION_ID ?? config.sessionId).trim();
|
|
@@ -2986,6 +3049,7 @@ async function main() {
|
|
|
2986
3049
|
repoRoot
|
|
2987
3050
|
};
|
|
2988
3051
|
let autoStartedServices = [];
|
|
3052
|
+
let pushpalsLogPath;
|
|
2989
3053
|
const stopAutoStartedServices = () => {
|
|
2990
3054
|
if (autoStartedServices.length === 0)
|
|
2991
3055
|
return;
|
|
@@ -3001,7 +3065,7 @@ async function main() {
|
|
|
3001
3065
|
if (!serverHealthy) {
|
|
3002
3066
|
if (!parsed.noAutoStart) {
|
|
3003
3067
|
try {
|
|
3004
|
-
|
|
3068
|
+
const startedRuntime = await autoStartRuntimeServices({
|
|
3005
3069
|
repoRoot,
|
|
3006
3070
|
serverUrl,
|
|
3007
3071
|
localAgentUrl,
|
|
@@ -3012,6 +3076,8 @@ async function main() {
|
|
|
3012
3076
|
requestedRuntimeTag: parsed.runtimeTag,
|
|
3013
3077
|
startLocalBuddy: resolveCliLocalBuddyAutostart(parsed.runtimeOnly, Boolean(config.localbuddy.enabled))
|
|
3014
3078
|
});
|
|
3079
|
+
autoStartedServices = startedRuntime.services;
|
|
3080
|
+
pushpalsLogPath = startedRuntime.pushpalsLogPath;
|
|
3015
3081
|
serverHealthy = await probeServer(serverUrl);
|
|
3016
3082
|
} catch (err) {
|
|
3017
3083
|
console.error(`[pushpals] Auto-start failed: ${String(err)}`);
|
|
@@ -3065,6 +3131,7 @@ async function main() {
|
|
|
3065
3131
|
}
|
|
3066
3132
|
const statePath = resolveCliStatePath(repoRoot);
|
|
3067
3133
|
const saved = statePath ? readCliState(statePath) : {};
|
|
3134
|
+
pushpalsLogPath = pushpalsLogPath || (typeof saved.pushpalsLogPath === "string" ? saved.pushpalsLogPath : undefined);
|
|
3068
3135
|
const preferredHubUrl = normalizeUrl(parsed.monitoringHubUrl ?? process.env.PUSHPALS_MONITOR_URL ?? saved.monitoringHubUrl ?? "");
|
|
3069
3136
|
const monitorPort = parsePositiveInt(process.env.PUSHPALS_CLIENT_PORT, DEFAULT_MONITOR_PORT);
|
|
3070
3137
|
const monitoringHub = await resolveMonitoringHub({
|
|
@@ -3080,7 +3147,8 @@ async function main() {
|
|
|
3080
3147
|
serverUrl,
|
|
3081
3148
|
localAgentUrl,
|
|
3082
3149
|
sessionId: activeSessionId,
|
|
3083
|
-
repoRoot
|
|
3150
|
+
repoRoot,
|
|
3151
|
+
pushpalsLogPath
|
|
3084
3152
|
});
|
|
3085
3153
|
} else {
|
|
3086
3154
|
console.warn("[pushpals] Could not resolve git metadata dir; skipping CLI state persistence.");
|
|
@@ -3097,6 +3165,7 @@ async function main() {
|
|
|
3097
3165
|
console.log(`[pushpals] serverUrl=${serverUrl}`);
|
|
3098
3166
|
console.log(`[pushpals] sessionId=${activeSessionId}`);
|
|
3099
3167
|
console.log(`[pushpals] repoRoot=${repoRoot}`);
|
|
3168
|
+
console.log(`[pushpals] pushpalsLog=${pushpalsLogPath ?? "unavailable"}`);
|
|
3100
3169
|
console.log(`[pushpals] cliStateFile=${statePath ?? "unavailable"}`);
|
|
3101
3170
|
if (parsed.runtimeOnly) {
|
|
3102
3171
|
console.log("[pushpals] runtimeOnly=true");
|
|
@@ -3197,6 +3266,7 @@ ${line}
|
|
|
3197
3266
|
console.log(`[pushpals] serverUrl=${serverUrl}`);
|
|
3198
3267
|
console.log(`[pushpals] sessionId=${activeSessionId}`);
|
|
3199
3268
|
console.log(`[pushpals] repoRoot=${repoRoot}`);
|
|
3269
|
+
console.log(`[pushpals] pushpalsLog=${pushpalsLogPath ?? "unavailable"}`);
|
|
3200
3270
|
console.log(monitoringHubUrl ? `[pushpals] monitoringHubUrl=${monitoringHubUrl}` : "[pushpals] monitoringHubUrl=unavailable");
|
|
3201
3271
|
rl.prompt();
|
|
3202
3272
|
continue;
|