bpmax-cli 0.1.44-beta.17 → 0.1.44-beta.18
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/bin.js +51 -8
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -449,7 +449,7 @@ function normalizePath2(path11) {
|
|
|
449
449
|
// package.json
|
|
450
450
|
var package_default = {
|
|
451
451
|
name: "bpmax-cli",
|
|
452
|
-
version: "0.1.44-beta.
|
|
452
|
+
version: "0.1.44-beta.18",
|
|
453
453
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
454
454
|
type: "module",
|
|
455
455
|
bin: {
|
|
@@ -6591,6 +6591,8 @@ import { password, text } from "@clack/prompts";
|
|
|
6591
6591
|
import axios5 from "axios";
|
|
6592
6592
|
var execFileAsync = promisify(execFile);
|
|
6593
6593
|
var PLATFORM_SYSCONFIG_BRANCH = "master";
|
|
6594
|
+
var LATEST_EXEC_MAX_BUFFER = 64 * 1024 * 1024;
|
|
6595
|
+
var LATEST_OUTPUT_PREVIEW_CHARS = 4e3;
|
|
6594
6596
|
async function ensureConfigCapability2(profile, capability) {
|
|
6595
6597
|
if (capabilityEnabled(profile.config.capabilities_cache, capability)) {
|
|
6596
6598
|
return;
|
|
@@ -6826,6 +6828,31 @@ function sanitizeConfigRepositoryValue(value) {
|
|
|
6826
6828
|
const redacted = redactAuditValue(value);
|
|
6827
6829
|
return sanitizeGitUrls(redacted);
|
|
6828
6830
|
}
|
|
6831
|
+
function outputText(value) {
|
|
6832
|
+
if (typeof value === "string") {
|
|
6833
|
+
return value;
|
|
6834
|
+
}
|
|
6835
|
+
try {
|
|
6836
|
+
return JSON.stringify(value) ?? String(value);
|
|
6837
|
+
} catch {
|
|
6838
|
+
return String(value);
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
function redactLatestOutputText(value) {
|
|
6842
|
+
return value.replace(/\b(https?:\/\/)([^/\s:@]+):([^/\s@]+)@/gi, "$1[REDACTED]@").replace(/authorization\s*:?\s*bearer\s+[^\s,;]+/gi, "Authorization Bearer [REDACTED]").replace(/authorization\s*:?\s*basic\s+[^\s,;]+/gi, "Authorization Basic [REDACTED]").replace(/\b(cookie|set-cookie|x-api-key)\s*[:=]\s*[^\n\r]+/gi, "$1 [REDACTED]").replace(/(sk-|npm_)[A-Za-z0-9_-]{8,}/g, "$1[REDACTED]").replace(/\b1[3-9]\d{9}\b/g, "[REDACTED_PHONE]").replace(/\b(password|passwd|pwd|token|secret|credential|api[-_]?key|x[-_]?api[-_]?key|access[-_]?token|refresh[-_]?token|client[-_]?secret|session[-_]?id)\s*[:= ]\s*[^\s,;]+/gi, "$1 [REDACTED]").replace(/("(?:[^"]*(?:authorization|auth|api[-_]?key|x[-_]?api[-_]?key|access[-_]?token|refresh[-_]?token|token|password|passwd|pwd|secret|credential|cookie|set[-_]?cookie|session|phone|mobile|device[-_]?code|verification[-_]?code|sms[-_]?code|captcha|手机号|验证码)[^"]*)"\s*:\s*")([^"]*)(")/gi, "$1[REDACTED]$3");
|
|
6843
|
+
}
|
|
6844
|
+
function summarizeLatestOutput(value) {
|
|
6845
|
+
const rawText = outputText(value);
|
|
6846
|
+
const textValue = typeof value === "string" ? redactLatestOutputText(rawText) : outputText(sanitizeConfigRepositoryValue(value));
|
|
6847
|
+
const preview = textValue.slice(0, LATEST_OUTPUT_PREVIEW_CHARS);
|
|
6848
|
+
return {
|
|
6849
|
+
ok: true,
|
|
6850
|
+
bytes: Buffer.byteLength(rawText),
|
|
6851
|
+
lines: rawText ? rawText.split(/\r?\n/).length : 0,
|
|
6852
|
+
truncated: textValue.length > LATEST_OUTPUT_PREVIEW_CHARS,
|
|
6853
|
+
preview
|
|
6854
|
+
};
|
|
6855
|
+
}
|
|
6829
6856
|
function sanitizeGitUrls(value) {
|
|
6830
6857
|
if (Array.isArray(value)) {
|
|
6831
6858
|
return value.map((item) => sanitizeGitUrls(item));
|
|
@@ -7129,14 +7156,20 @@ async function pullLatestConfigEnvironment(env, options) {
|
|
|
7129
7156
|
}
|
|
7130
7157
|
const platformEnvironment = await fetchPlatformConfigRepositoryEnvironment(profile, env);
|
|
7131
7158
|
const gitCredentials = platformGitCredentials(platformEnvironment);
|
|
7132
|
-
const before = (await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
7133
|
-
|
|
7159
|
+
const before = (await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
7160
|
+
cwd: repo,
|
|
7161
|
+
maxBuffer: LATEST_EXEC_MAX_BUFFER
|
|
7162
|
+
})).stdout.trim();
|
|
7163
|
+
const dirty = (await execFileAsync("git", ["status", "--porcelain"], {
|
|
7164
|
+
cwd: repo,
|
|
7165
|
+
maxBuffer: LATEST_EXEC_MAX_BUFFER
|
|
7166
|
+
})).stdout.trim();
|
|
7134
7167
|
if (dirty && !options.allowDirty && hasBlockingDirtyStatus(dirty)) {
|
|
7135
7168
|
throw new Error("Working tree is not clean. Re-run with --allow-dirty only if you accept local changes.");
|
|
7136
7169
|
}
|
|
7137
7170
|
const steps = {};
|
|
7138
7171
|
for (const step of ["pullcommit", "extract", "pushcommit"]) {
|
|
7139
|
-
steps[step] =
|
|
7172
|
+
steps[step] = summarizeLatestOutput(await callPlatformSysconfigStep(platformEnvironment, env, step));
|
|
7140
7173
|
}
|
|
7141
7174
|
const gitRemote = environment.git_remote || "origin";
|
|
7142
7175
|
const gitBranch = environment.git_branch || PLATFORM_SYSCONFIG_BRANCH;
|
|
@@ -7144,12 +7177,22 @@ async function pullLatestConfigEnvironment(env, options) {
|
|
|
7144
7177
|
gitCredentials,
|
|
7145
7178
|
(envVars) => execFileAsync("git", ["pull", "--ff-only", gitRemote, gitBranch], {
|
|
7146
7179
|
cwd: repo,
|
|
7180
|
+
maxBuffer: LATEST_EXEC_MAX_BUFFER,
|
|
7147
7181
|
...envVars ? { env: envVars } : {}
|
|
7148
7182
|
})
|
|
7149
7183
|
);
|
|
7150
|
-
const after = (await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
7151
|
-
|
|
7152
|
-
|
|
7184
|
+
const after = (await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
7185
|
+
cwd: repo,
|
|
7186
|
+
maxBuffer: LATEST_EXEC_MAX_BUFFER
|
|
7187
|
+
})).stdout.trim();
|
|
7188
|
+
const changedFiles = before === after ? "" : (await execFileAsync("git", ["diff", "--name-status", before, after], {
|
|
7189
|
+
cwd: repo,
|
|
7190
|
+
maxBuffer: LATEST_EXEC_MAX_BUFFER
|
|
7191
|
+
})).stdout;
|
|
7192
|
+
const numstat = before === after ? "" : (await execFileAsync("git", ["diff", "--numstat", before, after], {
|
|
7193
|
+
cwd: repo,
|
|
7194
|
+
maxBuffer: LATEST_EXEC_MAX_BUFFER
|
|
7195
|
+
})).stdout;
|
|
7153
7196
|
return {
|
|
7154
7197
|
profile: profile.name,
|
|
7155
7198
|
env,
|
|
@@ -7158,7 +7201,7 @@ async function pullLatestConfigEnvironment(env, options) {
|
|
|
7158
7201
|
after,
|
|
7159
7202
|
changed: before !== after,
|
|
7160
7203
|
steps,
|
|
7161
|
-
git_pull:
|
|
7204
|
+
git_pull: summarizeLatestOutput(pull.stdout || pull.stderr),
|
|
7162
7205
|
changed_files: changedFiles.trim(),
|
|
7163
7206
|
numstat: numstat.trim(),
|
|
7164
7207
|
graph_refresh: options.withGraph && !options.fast ? "requested_external_step" : "skipped"
|