bpmax-cli 0.2.1-beta.50 → 0.2.1-beta.51
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 +76 -21
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +6 -5
- package/skills/bpmax-e2e-flow-test-operator/references/ai-test-suite.md +3 -3
- package/skills/bpmax-e2e-flow-test-operator/references/browser-action-dsl.md +4 -2
- package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +6 -0
- package/skills/bpmax-e2e-flow-test-operator/references/full-detail-guide.md +3 -2
package/dist/bin.js
CHANGED
|
@@ -498,7 +498,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
|
|
|
498
498
|
// package.json
|
|
499
499
|
var package_default = {
|
|
500
500
|
name: "bpmax-cli",
|
|
501
|
-
version: "0.2.1-beta.
|
|
501
|
+
version: "0.2.1-beta.51",
|
|
502
502
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
503
503
|
type: "module",
|
|
504
504
|
bin: {
|
|
@@ -1397,12 +1397,24 @@ function lintDeviceAuthorizationUrl(urlValue, expectedOrigin, expectedWorkspace,
|
|
|
1397
1397
|
);
|
|
1398
1398
|
}
|
|
1399
1399
|
const actualWorkspace = firstPathSegment(url);
|
|
1400
|
-
|
|
1400
|
+
const acceptedWorkspaces = expectedWorkspace === "default" ? /* @__PURE__ */ new Set(["default", "w:default"]) : /* @__PURE__ */ new Set([expectedWorkspace]);
|
|
1401
|
+
if (!actualWorkspace || !acceptedWorkspaces.has(actualWorkspace)) {
|
|
1401
1402
|
throw new Error(
|
|
1402
1403
|
`Device authorization URL workspace mismatch for ${fieldName}: expected ${expectedWorkspace}, got ${actualWorkspace || "(missing)"}. Refusing to print a potentially wrong authorization link.`
|
|
1403
1404
|
);
|
|
1404
1405
|
}
|
|
1405
1406
|
}
|
|
1407
|
+
function normalizeDeviceAuthorizationUrl(urlValue, workspace) {
|
|
1408
|
+
if (workspace !== "default") {
|
|
1409
|
+
return urlValue;
|
|
1410
|
+
}
|
|
1411
|
+
const url = new URL(urlValue);
|
|
1412
|
+
const segments = url.pathname.split("/").filter(Boolean).map((segment) => decodeURIComponent(segment));
|
|
1413
|
+
if (segments.length === 2 && segments[0] === "default" && segments[1] === "cli-device") {
|
|
1414
|
+
url.pathname = "/w:default/cli-device";
|
|
1415
|
+
}
|
|
1416
|
+
return url.toString();
|
|
1417
|
+
}
|
|
1406
1418
|
function apiPath(path19) {
|
|
1407
1419
|
if (path19.startsWith("/api/")) {
|
|
1408
1420
|
return path19;
|
|
@@ -1458,12 +1470,14 @@ async function startDeviceLogin(options) {
|
|
|
1458
1470
|
});
|
|
1459
1471
|
const expiresIn = numberField(response.expires_in, "expires_in");
|
|
1460
1472
|
const now = options.now?.() || /* @__PURE__ */ new Date();
|
|
1461
|
-
const
|
|
1462
|
-
lintDeviceAuthorizationUrl(
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1473
|
+
const verificationUriRaw = stringField(response.verification_uri, "verification_uri");
|
|
1474
|
+
lintDeviceAuthorizationUrl(verificationUriRaw, origin, workspace, "verification_uri");
|
|
1475
|
+
const verificationUri = normalizeDeviceAuthorizationUrl(verificationUriRaw, workspace);
|
|
1476
|
+
const verificationUriCompleteRaw = typeof response.verification_uri_complete === "string" && response.verification_uri_complete.trim() ? response.verification_uri_complete : void 0;
|
|
1477
|
+
if (verificationUriCompleteRaw) {
|
|
1478
|
+
lintDeviceAuthorizationUrl(verificationUriCompleteRaw, origin, workspace, "verification_uri_complete");
|
|
1479
|
+
}
|
|
1480
|
+
const verificationUriComplete = verificationUriCompleteRaw ? normalizeDeviceAuthorizationUrl(verificationUriCompleteRaw, workspace) : void 0;
|
|
1467
1481
|
const authorizationUrl = verificationUriComplete || verificationUri;
|
|
1468
1482
|
return {
|
|
1469
1483
|
profile: options.profileName,
|
|
@@ -2573,7 +2587,7 @@ function validatePluginLintManifest(item, issues, context2) {
|
|
|
2573
2587
|
}
|
|
2574
2588
|
}
|
|
2575
2589
|
function isAllowedPluginConfigScanPath(scanPath) {
|
|
2576
|
-
return scanPath === "data.meta.<plugin_key>" || scanPath === "data.nodes[].<plugin_key>" || /^data\.nodes\[\]\.<plugin_key>\.[A-Za-z0-9_]+\[\]$/.test(scanPath) || /^data\.nodes\[\]\.[A-Za-z0-9_]+_(?:triggers|configs|plugins)\[\]$/.test(scanPath);
|
|
2590
|
+
return scanPath === "data.meta.<plugin_key>" || scanPath === "data.nodes[].<plugin_key>" || /^data\.nodes\[\]\.<plugin_key>\.[A-Za-z0-9_]+\[\]$/.test(scanPath) || /^data\.nodes\[\]\.[A-Za-z0-9_]+$/.test(scanPath) || /^data\.nodes\[\]\.[A-Za-z0-9_]+_(?:triggers|configs|plugins)\[\]$/.test(scanPath);
|
|
2577
2591
|
}
|
|
2578
2592
|
async function validatePluginLintRuleFiles(skillDir, files, issues) {
|
|
2579
2593
|
for (const file of files) {
|
|
@@ -3324,6 +3338,28 @@ function collectFlowTemplatePluginConfigsByPath(flowWork, scanPath, pluginKey) {
|
|
|
3324
3338
|
});
|
|
3325
3339
|
return occurrences2;
|
|
3326
3340
|
}
|
|
3341
|
+
const objectMatch = scanPath.match(/^data\.nodes\[\]\.([A-Za-z0-9_]+)$/);
|
|
3342
|
+
if (objectMatch) {
|
|
3343
|
+
const field2 = objectMatch[1];
|
|
3344
|
+
const data2 = typeof flowWork.data === "object" && flowWork.data !== null && !Array.isArray(flowWork.data) ? flowWork.data : {};
|
|
3345
|
+
const nodes2 = Array.isArray(data2.nodes) ? data2.nodes : [];
|
|
3346
|
+
const occurrences2 = [];
|
|
3347
|
+
nodes2.forEach((node, nodeIndex) => {
|
|
3348
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
3349
|
+
return;
|
|
3350
|
+
}
|
|
3351
|
+
const nodeRecord = node;
|
|
3352
|
+
if (!Object.prototype.hasOwnProperty.call(nodeRecord, field2)) {
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3355
|
+
const nodeName = typeof nodeRecord.name === "string" && nodeRecord.name.trim() ? nodeRecord.name.trim() : `nodes[${nodeIndex}]`;
|
|
3356
|
+
occurrences2.push({
|
|
3357
|
+
location: `${nodeName}.${field2}`,
|
|
3358
|
+
config: nodeRecord[field2]
|
|
3359
|
+
});
|
|
3360
|
+
});
|
|
3361
|
+
return occurrences2;
|
|
3362
|
+
}
|
|
3327
3363
|
const match = scanPath.match(/^data\.nodes\[\]\.([A-Za-z0-9_]+)\[\]$/);
|
|
3328
3364
|
if (!match) {
|
|
3329
3365
|
return [];
|
|
@@ -3459,8 +3495,11 @@ async function lintFlowTemplatePluginExtensions(options) {
|
|
|
3459
3495
|
...platformLintDeclarations.map((item) => item.lint.plugin_key),
|
|
3460
3496
|
...installedLintDeclarations.map((item) => item.lint.plugin_key)
|
|
3461
3497
|
]);
|
|
3498
|
+
const declaredExplicitNodeKeys = new Set(
|
|
3499
|
+
[...platformLintDeclarations, ...installedLintDeclarations].flatMap((item) => item.lint.paths || []).map((scanPath) => scanPath.match(/^data\.nodes\[\]\.([A-Za-z0-9_]+)$/)?.[1]).filter((key) => Boolean(key))
|
|
3500
|
+
);
|
|
3462
3501
|
for (const pluginKey of usedPluginKeys) {
|
|
3463
|
-
if (allPluginKeys.has(pluginKey)) {
|
|
3502
|
+
if (allPluginKeys.has(pluginKey) || declaredExplicitNodeKeys.has(pluginKey)) {
|
|
3464
3503
|
continue;
|
|
3465
3504
|
}
|
|
3466
3505
|
const occurrences = collectFlowTemplatePluginConfigs(options.flowWork, pluginKey);
|
|
@@ -3524,7 +3563,12 @@ async function lintFlowTemplatePluginExtensions(options) {
|
|
|
3524
3563
|
lintErrors.push(error instanceof Error ? error.message : String(error));
|
|
3525
3564
|
ruleFile = {};
|
|
3526
3565
|
}
|
|
3527
|
-
|
|
3566
|
+
const declarationOccurrences = collectFlowTemplatePluginConfigs(
|
|
3567
|
+
options.flowWork,
|
|
3568
|
+
pluginKey,
|
|
3569
|
+
[declaration.lint]
|
|
3570
|
+
);
|
|
3571
|
+
for (const occurrence of declarationOccurrences) {
|
|
3528
3572
|
if (shouldSkipPluginLint(occurrence.config, ruleFile.skipWhen)) {
|
|
3529
3573
|
continue;
|
|
3530
3574
|
}
|
|
@@ -3552,7 +3596,7 @@ async function lintFlowTemplatePluginExtensions(options) {
|
|
|
3552
3596
|
plugin_key: pluginKey,
|
|
3553
3597
|
domain: declaration.lint.domain,
|
|
3554
3598
|
rule_path: declaration.lint.path,
|
|
3555
|
-
checked_locations:
|
|
3599
|
+
checked_locations: declarationOccurrences.map((item) => item.location),
|
|
3556
3600
|
errors: lintErrors,
|
|
3557
3601
|
warnings: lintWarnings
|
|
3558
3602
|
});
|
|
@@ -7166,9 +7210,9 @@ function lintConsoleTemplateDataSource(dataSource, moduleLabel, errors) {
|
|
|
7166
7210
|
}
|
|
7167
7211
|
function lintConsoleTemplateWildcardFallback(value, path19, errors) {
|
|
7168
7212
|
if (typeof value === "string") {
|
|
7169
|
-
const scriptedWildcard = /(?:wildcard|value)\s*:\s*['\"](\*{1,2})[
|
|
7213
|
+
const scriptedWildcard = /(?:wildcard|value)\s*:\s*(['\"])(\*{1,2})\1(?=\s*(?:[,};)\]]|$))/i.exec(value);
|
|
7170
7214
|
if (scriptedWildcard) {
|
|
7171
|
-
errors.push(`${path19}.wildcard \u4E0D\u80FD\u7528 ${scriptedWildcard[
|
|
7215
|
+
errors.push(`${path19}.wildcard \u4E0D\u80FD\u7528 ${scriptedWildcard[2]} \u4F5C\u4E3A\u975E\u7A7A\u6216\u515C\u5E95\u7ED3\u679C\uFF1B\u8BF7\u5199\u660E\u786E\u7684\u7A7A\u6001\u3001\u6761\u4EF6\u6216\u805A\u5408\u7ED3\u679C\u3002`);
|
|
7172
7216
|
}
|
|
7173
7217
|
return;
|
|
7174
7218
|
}
|
|
@@ -7392,7 +7436,18 @@ function lintConsoleTemplateFrontendDetailCounting(script, dataSource, moduleLab
|
|
|
7392
7436
|
const hasControlledOuterPageSize = /ctx\.pageInfo[\s\S]*?(?:pageSize|page_size)/i.test(outerPageSizeBinding) && !/\b(?:total|count|length)\b/i.test(outerPageSizeBinding);
|
|
7393
7437
|
const hasControlledOuterPage = /ctx\.pageInfo[\s\S]*?(?:\.page\b|pageIndex|current)/i.test(outerPageBinding) && !/\b(?:total|count|length)\b/i.test(outerPageBinding);
|
|
7394
7438
|
const usesBodyInEsSearch = (code) => /\bctx\.\$searchByEs\s*\(\s*{\s*body(?:\s*:\s*body)?\s*[,}]/i.test(code);
|
|
7395
|
-
const
|
|
7439
|
+
const usesQueryObjectInEsSearch = (code, queryName) => {
|
|
7440
|
+
const escaped = queryName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7441
|
+
if (queryName === "body" && usesBodyInEsSearch(code)) return true;
|
|
7442
|
+
return new RegExp(`\\bctx\\.\\$searchByEs\\s*\\(\\s*\\{[^)]{0,1000}?\\bbody\\s*:\\s*${escaped}\\s*[,}]`, "i").test(code);
|
|
7443
|
+
};
|
|
7444
|
+
const hasCustomBpmaxAggregation = customServerCodes.some((code) => {
|
|
7445
|
+
const aggregationQueryPattern = /\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*{[\s\S]*?\bsize\s*:\s*0\b[\s\S]*?\b(?:aggs|aggregations)\s*:\s*{/gi;
|
|
7446
|
+
for (let match = aggregationQueryPattern.exec(code); match; match = aggregationQueryPattern.exec(code)) {
|
|
7447
|
+
if (usesQueryObjectInEsSearch(code, match[1])) return true;
|
|
7448
|
+
}
|
|
7449
|
+
return /\bctx\.\$searchByEs\s*\(\s*{[^)]{0,1000}?\bbody\s*:\s*{[\s\S]*?\bsize\s*:\s*0\b[\s\S]*?\b(?:aggs|aggregations)\s*:\s*{/i.test(code);
|
|
7450
|
+
});
|
|
7396
7451
|
const hasCustomBpmaxServerPagination = customServerCodes.some((code) => {
|
|
7397
7452
|
const pageSizeBinding = /\b(?:const|let)\s+pageSize\s*=\s*([^;]+)/i.exec(code)?.[1] || "";
|
|
7398
7453
|
const pageBinding = /\b(?:const|let)\s+page\s*=\s*([^;]+)/i.exec(code)?.[1] || "";
|
|
@@ -18218,7 +18273,7 @@ var IDENTITY_MOCK_VALUE_RE = /(mock|模拟).*(unmock|退出模拟|恢复)|bpmax-
|
|
|
18218
18273
|
var E2E_REUSABLE_ASSET_RE = /bpmax-cli\s+e2e|record-from-evidence|create-page-submit|step-run|browser-template|scenario\s+plan|data\s+profile|reusable\s+step|复用模板|可复用|首次运行沉淀|沉淀模板/;
|
|
18219
18274
|
var ERROR_CAPTURE_CASE_RE = /(negative|boundary|异常|错误|失败|报错|无效|非法|invalid|error|扫码.*(异常|错误|无效)|错误\s*SN|异常\s*SN|无效\s*SN)/i;
|
|
18220
18275
|
var ERROR_CAPTURE_EVIDENCE_RE = /(expected_error_text|error_capture_required|错误提示|提示文案|报错文案|toast|校验文案).*(screenshot|截图)|截图.*(错误提示|提示文案|报错文案|toast|校验文案)/i;
|
|
18221
|
-
var BROWSER_TOOL_RE = /(Chrome DevTools|DevTools|Playwright|AppleScript)/i;
|
|
18276
|
+
var BROWSER_TOOL_RE = /(Chrome Control|chrome:control-chrome|Chrome DevTools|DevTools|Playwright|AppleScript)/i;
|
|
18222
18277
|
var REPORT_EVIDENCE_PLACEHOLDER_RE = /^(?:n\/?a|none|null|todo|tbd|xxx|unknown|pending|待补|暂无|无|未执行|跳过|-+)$/i;
|
|
18223
18278
|
var LIVE_DRAFT_RE = /(live|draft|已发布|草稿|发布态|live_draft=)/i;
|
|
18224
18279
|
var MULTI_ROLE_VALUE_RE = /[,、/]\s*[^,、/\s]+|多角色|跨角色/;
|
|
@@ -18675,7 +18730,7 @@ function validatePreflightEvidence(filePath, caseId, row, steps, prepTokens) {
|
|
|
18675
18730
|
fail(`${filePath}:${caseId}: \`prep_data\` \u5FC5\u987B\u5305\u542B \`precondition_check=\`\uFF0C\u5426\u5219\u53EA\u80FD\u8FDB\u5165\u51C6\u5907\u9636\u6BB5\uFF0C\u4E0D\u80FD\u5F00\u59CB\u6B63\u5F0F E2E \u6267\u884C`, { rule_id: "test_suite.case.precondition_check" });
|
|
18676
18731
|
}
|
|
18677
18732
|
if (!prepTokens.browser_tool || !BROWSER_TOOL_RE.test(prepTokens.browser_tool)) {
|
|
18678
|
-
fail(`${filePath}:${caseId}: E2E \u7528\u4F8B\u5FC5\u987B\u58F0\u660E\u6D4F\u89C8\u5668\u5DE5\u5177\u8BC1\u636E\
|
|
18733
|
+
fail(`${filePath}:${caseId}: E2E \u7528\u4F8B\u5FC5\u987B\u58F0\u660E\u6D4F\u89C8\u5668\u5DE5\u5177\u8BC1\u636E\uFF1B\u9996\u6B21\u5F55\u5236\u548C\u5F02\u5E38\u63A2\u7D22\u4F18\u5148\u4F7F\u7528 \`browser_tool=Chrome Control\`\uFF0C\u7A33\u5B9A\u590D\u8DD1\u4F7F\u7528 Playwright`, { rule_id: "test_suite.case.browser_tool" });
|
|
18679
18734
|
}
|
|
18680
18735
|
if (!prepTokens.live_draft || !LIVE_DRAFT_RE.test(prepTokens.live_draft)) {
|
|
18681
18736
|
fail(`${filePath}:${caseId}: E2E \u7528\u4F8B\u5FC5\u987B\u58F0\u660E\u672C\u8F6E\u76EE\u6807\u662F live \u53D1\u5E03\u6001\u8FD8\u662F draft \u8349\u7A3F\u6001`, { rule_id: "test_suite.case.live_draft" });
|
|
@@ -19464,7 +19519,7 @@ async function syncTestSuiteRunReportUnlocked(manifestFile) {
|
|
|
19464
19519
|
report = replaceReportMetadata(report, "runtime_scope", evidence.scope || null);
|
|
19465
19520
|
report = replaceReportMetadata(report, "runtime_environment", evidence.environment || null);
|
|
19466
19521
|
report = replaceReportMetadata(report, "runtime_url", evidence.runtimeUrl || null);
|
|
19467
|
-
report = replaceReportMetadata(report, "browser_tool", evidence.browserTool || "Chrome
|
|
19522
|
+
report = replaceReportMetadata(report, "browser_tool", evidence.browserTool || "Chrome Control");
|
|
19468
19523
|
report = replaceReportMetadata(report, "browser_action_log", actions || null);
|
|
19469
19524
|
report = replaceReportMetadata(report, "visible_assertions", evidence.assertions.length ? evidence.assertions.join("\uFF1B") : null);
|
|
19470
19525
|
report = replaceReportMetadata(report, "project_id", evidence.scope === "project" || evidence.scope === "step" ? evidence.projectId || null : null);
|
|
@@ -19651,7 +19706,7 @@ async function startTestSuiteRun(options) {
|
|
|
19651
19706
|
`precondition_check: ${path12.join(reportDir, `precondition-${runId}.json`)}`,
|
|
19652
19707
|
`state_file: ${manifestPath}`,
|
|
19653
19708
|
`report_run: ${reportDir}`,
|
|
19654
|
-
"browser_tool: Chrome
|
|
19709
|
+
"browser_tool: Chrome Control",
|
|
19655
19710
|
"",
|
|
19656
19711
|
"## 1. \u6D4B\u8BD5\u8303\u56F4",
|
|
19657
19712
|
"",
|
|
@@ -20486,7 +20541,7 @@ function reportHasSupportedBrowserTool(value) {
|
|
|
20486
20541
|
return false;
|
|
20487
20542
|
}
|
|
20488
20543
|
const tools = value.split(/\s*(?:\+|,|,|、|\/|;|;)\s*/).map((item) => item.trim()).filter(Boolean);
|
|
20489
|
-
return tools.length > 0 && tools.every((item) => /^(?:Chrome DevTools(?: MCP)?|DevTools|Playwright|AppleScript)$/i.test(item));
|
|
20544
|
+
return tools.length > 0 && tools.every((item) => /^(?:Chrome Control|chrome:control-chrome|Chrome DevTools(?: MCP)?|DevTools|Playwright|AppleScript)$/i.test(item));
|
|
20490
20545
|
}
|
|
20491
20546
|
function reportRuntimeEvidenceMissing(text5) {
|
|
20492
20547
|
const missing = [];
|
|
@@ -20861,7 +20916,7 @@ async function lintUxAudit(text5, reportPath, runDir, runName) {
|
|
|
20861
20916
|
} else if (counts.P0 > 0 || counts.P1 > 0) {
|
|
20862
20917
|
if (resultValue !== "fail" && !preservesBlockedManifest) errors.push(`[test_suite.report.ux_result] ${reportPath}: \u5B58\u5728 P0/P1 UX BUG \u65F6 result \u5FC5\u987B\u662F fail\uFF1B\u5408\u6CD5 blocked manifest \u53EF\u4FDD\u7559 result=blocked`);
|
|
20863
20918
|
} else if (counts.P2 > 0 || counts.P3 > 0) {
|
|
20864
|
-
if (!["pass-with-warnings", "fail"].includes(resultValue)) errors.push(`[test_suite.report.ux_result] ${reportPath}: \u53EA\u6709 P2/P3 UX BUG \u65F6 result \u5FC5\u987B\u662F pass-with-warnings\uFF1B\u5B58\u5728\u5176\u4ED6\u5931\u8D25\u65F6\u53EF\u4E3A fail`);
|
|
20919
|
+
if (!["pass-with-warnings", "fail"].includes(resultValue) && !preservesBlockedManifest) errors.push(`[test_suite.report.ux_result] ${reportPath}: \u53EA\u6709 P2/P3 UX BUG \u65F6 result \u5FC5\u987B\u662F pass-with-warnings\uFF1B\u5B58\u5728\u5176\u4ED6\u5931\u8D25\u65F6\u53EF\u4E3A fail\uFF1B\u5408\u6CD5 blocked manifest \u53EF\u4FDD\u7559 result=blocked`);
|
|
20865
20920
|
} else if (reportAuditStatus === "completed" && resultValue === "pass-with-warnings") {
|
|
20866
20921
|
errors.push(`[test_suite.report.ux_result] ${reportPath}: \u65E0 UX BUG \u65F6\u4E0D\u80FD\u7528 pass-with-warnings \u89C4\u907F\u660E\u786E\u7ED3\u8BBA`);
|
|
20867
20922
|
}
|