bpmax-cli 0.2.1-beta.25 → 0.2.1-beta.26
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 +271 -16
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-cli/SKILL.md +3 -0
- package/skills/bpmax-config-latest/SKILL.md +4 -0
package/dist/bin.js
CHANGED
|
@@ -469,7 +469,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
|
|
|
469
469
|
// package.json
|
|
470
470
|
var package_default = {
|
|
471
471
|
name: "bpmax-cli",
|
|
472
|
-
version: "0.2.1-beta.
|
|
472
|
+
version: "0.2.1-beta.26",
|
|
473
473
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
474
474
|
type: "module",
|
|
475
475
|
bin: {
|
|
@@ -7178,6 +7178,24 @@ function validateFormTemplateControlContracts(payload, errors) {
|
|
|
7178
7178
|
if (type === "radio") {
|
|
7179
7179
|
validateRadioFormTemplateControl(field, rule, value, errors);
|
|
7180
7180
|
}
|
|
7181
|
+
if (rule?.lambda === "ctx.$PROJECT?.owner?.name || ''") {
|
|
7182
|
+
const props = isRecord3(rule.props) ? rule.props : {};
|
|
7183
|
+
if (type !== "i_input" || props.disabled !== true) {
|
|
7184
|
+
errors.push(`form-template applicant-name lambda field ${field} must use disabled i_input.`);
|
|
7185
|
+
}
|
|
7186
|
+
if (rule.lambda_version !== "1.0" || rule.lambdaInit !== true) {
|
|
7187
|
+
errors.push(`form-template applicant-name lambda field ${field} must use lambda_version=1.0 and lambdaInit=true.`);
|
|
7188
|
+
}
|
|
7189
|
+
}
|
|
7190
|
+
if (rule?.lambda === "ctx.$PROJECT?.owner?.id || null") {
|
|
7191
|
+
const props = isRecord3(rule.props) ? rule.props : {};
|
|
7192
|
+
if (type !== "i_input" || props.disabled !== true || rule.hidden !== true) {
|
|
7193
|
+
errors.push(`form-template applicant-id lambda field ${field} must use hidden disabled i_input.`);
|
|
7194
|
+
}
|
|
7195
|
+
if (rule.lambda_version !== "1.0" || rule.lambdaInit !== true) {
|
|
7196
|
+
errors.push(`form-template applicant-id lambda field ${field} must use lambda_version=1.0 and lambdaInit=true.`);
|
|
7197
|
+
}
|
|
7198
|
+
}
|
|
7181
7199
|
};
|
|
7182
7200
|
if (isRecord3(payload.fields)) {
|
|
7183
7201
|
for (const [field, bundle] of Object.entries(payload.fields)) {
|
|
@@ -7209,6 +7227,37 @@ function validateFormTemplateControlContracts(payload, errors) {
|
|
|
7209
7227
|
}
|
|
7210
7228
|
}
|
|
7211
7229
|
}
|
|
7230
|
+
function validateFormTemplateHeaderContract(payload, errors) {
|
|
7231
|
+
const basic = isRecord3(payload.basic) ? payload.basic : {};
|
|
7232
|
+
const option = isRecord3(basic.option) ? basic.option : isRecord3(payload.option) ? payload.option : {};
|
|
7233
|
+
const form = isRecord3(option.form) ? option.form : {};
|
|
7234
|
+
const headerBar = isRecord3(form.headerBar) ? form.headerBar : {};
|
|
7235
|
+
let headerFieldCount = 0;
|
|
7236
|
+
const countRule = (rule) => {
|
|
7237
|
+
if (rule.displayArea === "header") {
|
|
7238
|
+
headerFieldCount += 1;
|
|
7239
|
+
} else if (rule.displayArea !== void 0 && rule.displayArea !== "body") {
|
|
7240
|
+
errors.push(`form-template field ${String(rule.field || "")} displayArea must be header or body.`);
|
|
7241
|
+
}
|
|
7242
|
+
};
|
|
7243
|
+
if (isRecord3(payload.fields)) {
|
|
7244
|
+
for (const bundle of Object.values(payload.fields)) {
|
|
7245
|
+
if (isRecord3(bundle) && isRecord3(bundle.rule)) countRule(bundle.rule);
|
|
7246
|
+
}
|
|
7247
|
+
}
|
|
7248
|
+
if (Array.isArray(payload.rule)) {
|
|
7249
|
+
for (const row of payload.rule) {
|
|
7250
|
+
if (!Array.isArray(row)) continue;
|
|
7251
|
+
for (const rule of row) if (isRecord3(rule)) countRule(rule);
|
|
7252
|
+
}
|
|
7253
|
+
}
|
|
7254
|
+
if (headerFieldCount > 0 && headerBar.enabled !== true) {
|
|
7255
|
+
errors.push("form-template fields with displayArea=header require option.form.headerBar.enabled=true.");
|
|
7256
|
+
}
|
|
7257
|
+
if (headerBar.enabled === true && headerFieldCount === 0) {
|
|
7258
|
+
errors.push("form-template option.form.headerBar.enabled=true requires at least one displayArea=header field.");
|
|
7259
|
+
}
|
|
7260
|
+
}
|
|
7212
7261
|
var FORM_TEMPLATE_VISUAL_WIDE_TYPES = /* @__PURE__ */ new Set([
|
|
7213
7262
|
"sub_form",
|
|
7214
7263
|
"i_textarea",
|
|
@@ -7320,6 +7369,7 @@ function validateFormTemplateWorkLint(payload, errors) {
|
|
|
7320
7369
|
validateFormTemplateNameLength(payload, errors);
|
|
7321
7370
|
validateFormTemplateValueValidateMaps(payload, errors);
|
|
7322
7371
|
validateFormTemplateControlContracts(payload, errors);
|
|
7372
|
+
validateFormTemplateHeaderContract(payload, errors);
|
|
7323
7373
|
validateStructuredFormTemplateVisualReview(payload, errors);
|
|
7324
7374
|
}
|
|
7325
7375
|
function stripFormTemplateCreateIds(payload) {
|
|
@@ -10568,9 +10618,35 @@ async function runConfigBatchReadback(config, profile, manifestFile, options = {
|
|
|
10568
10618
|
}
|
|
10569
10619
|
|
|
10570
10620
|
// src/core/config-workspace.ts
|
|
10571
|
-
import { mkdir as mkdir6, readFile as readFile9, writeFile as writeFile6 } from "fs/promises";
|
|
10621
|
+
import { mkdir as mkdir6, readFile as readFile9, realpath, stat as stat4, writeFile as writeFile6 } from "fs/promises";
|
|
10572
10622
|
import path6 from "path";
|
|
10573
10623
|
var DEFAULT_AGENT_GUIDE_FILE = "AGENTS.md";
|
|
10624
|
+
var CONFIG_WORKSPACE_REQUIRED_ENTRIES = [
|
|
10625
|
+
"AGENTS.md",
|
|
10626
|
+
"think_configuration",
|
|
10627
|
+
"think_flow",
|
|
10628
|
+
"think_form_template"
|
|
10629
|
+
];
|
|
10630
|
+
var ConfigWorkspaceError = class extends Error {
|
|
10631
|
+
code;
|
|
10632
|
+
rule_id;
|
|
10633
|
+
path;
|
|
10634
|
+
suggestion;
|
|
10635
|
+
missing;
|
|
10636
|
+
profile;
|
|
10637
|
+
env;
|
|
10638
|
+
constructor(message, options) {
|
|
10639
|
+
super(message);
|
|
10640
|
+
this.name = "ConfigWorkspaceError";
|
|
10641
|
+
this.code = options.code || "config_workspace_required";
|
|
10642
|
+
this.rule_id = options.rule_id || "config.workspace.cwd";
|
|
10643
|
+
this.path = options.path;
|
|
10644
|
+
this.suggestion = options.suggestion || "\u8BF7\u6267\u884C bpmax-cli config workspace init \u4FEE\u590D\u672C\u5730\u914D\u7F6E\u76EE\u5F55\u53CA profile \u7ED1\u5B9A\uFF0C\u7136\u540E\u8FDB\u5165\u8BE5\u76EE\u5F55\u91CD\u8BD5\u3002";
|
|
10645
|
+
this.missing = options.missing;
|
|
10646
|
+
this.profile = options.profile;
|
|
10647
|
+
this.env = options.env;
|
|
10648
|
+
}
|
|
10649
|
+
};
|
|
10574
10650
|
var CONFIG_DOMAINS2 = [
|
|
10575
10651
|
["form-template", "bpmax-form-template-editor", "\u8868\u5355\u6A21\u677F"],
|
|
10576
10652
|
["flow-template", "bpmax-flow-template-editor", "\u6D41\u7A0B\u6A21\u677F"],
|
|
@@ -10597,6 +10673,126 @@ var CONFIG_DIRECTORY_PURPOSES = [
|
|
|
10597
10673
|
["think_role/", "Role definitions"],
|
|
10598
10674
|
["think_category/", "Category definitions"]
|
|
10599
10675
|
];
|
|
10676
|
+
async function hasExpectedWorkspaceEntry(root, entry) {
|
|
10677
|
+
try {
|
|
10678
|
+
const entryPath = path6.join(root, entry);
|
|
10679
|
+
const value = await stat4(entryPath);
|
|
10680
|
+
const canonicalEntry = await realpath(entryPath);
|
|
10681
|
+
const relative = path6.relative(root, canonicalEntry);
|
|
10682
|
+
const staysInsideRoot = relative !== ".." && !relative.startsWith(`..${path6.sep}`) && !path6.isAbsolute(relative);
|
|
10683
|
+
return staysInsideRoot && (entry === DEFAULT_AGENT_GUIDE_FILE ? value.isFile() : value.isDirectory());
|
|
10684
|
+
} catch (error) {
|
|
10685
|
+
if (error.code === "ENOENT") {
|
|
10686
|
+
return false;
|
|
10687
|
+
}
|
|
10688
|
+
throw error;
|
|
10689
|
+
}
|
|
10690
|
+
}
|
|
10691
|
+
async function inspectWorkspaceEntries(root) {
|
|
10692
|
+
const checks = await Promise.all(
|
|
10693
|
+
CONFIG_WORKSPACE_REQUIRED_ENTRIES.map(async (entry) => ({
|
|
10694
|
+
entry,
|
|
10695
|
+
present: await hasExpectedWorkspaceEntry(root, entry)
|
|
10696
|
+
}))
|
|
10697
|
+
);
|
|
10698
|
+
return {
|
|
10699
|
+
present: checks.filter((item) => item.present).map((item) => item.entry),
|
|
10700
|
+
missing: checks.filter((item) => !item.present).map((item) => item.entry)
|
|
10701
|
+
};
|
|
10702
|
+
}
|
|
10703
|
+
async function findConfigWorkspaceRoot(cwd = process.cwd()) {
|
|
10704
|
+
let current;
|
|
10705
|
+
try {
|
|
10706
|
+
current = await realpath(cwd);
|
|
10707
|
+
} catch (error) {
|
|
10708
|
+
throw new ConfigWorkspaceError(`\u5F53\u524D\u76EE\u5F55\u4E0D\u5B58\u5728\u6216\u65E0\u6CD5\u8BBF\u95EE\uFF1A${cwd}`, {
|
|
10709
|
+
path: path6.resolve(cwd),
|
|
10710
|
+
code: "config_workspace_invalid_cwd",
|
|
10711
|
+
rule_id: "config.workspace.cwd_invalid"
|
|
10712
|
+
});
|
|
10713
|
+
}
|
|
10714
|
+
let closestPartial;
|
|
10715
|
+
while (true) {
|
|
10716
|
+
const entries = await inspectWorkspaceEntries(current);
|
|
10717
|
+
if (entries.missing.length === 0) {
|
|
10718
|
+
return current;
|
|
10719
|
+
}
|
|
10720
|
+
if (entries.present.length > 0 && (!closestPartial || entries.present.length > closestPartial.present.length)) {
|
|
10721
|
+
closestPartial = { root: current, ...entries };
|
|
10722
|
+
}
|
|
10723
|
+
const parent = path6.dirname(current);
|
|
10724
|
+
if (parent === current) {
|
|
10725
|
+
break;
|
|
10726
|
+
}
|
|
10727
|
+
current = parent;
|
|
10728
|
+
}
|
|
10729
|
+
const diagnosticRoot = closestPartial?.root || await realpath(cwd);
|
|
10730
|
+
const missing = closestPartial?.missing || [...CONFIG_WORKSPACE_REQUIRED_ENTRIES];
|
|
10731
|
+
throw new ConfigWorkspaceError(
|
|
10732
|
+
`\u5F53\u524D\u8DEF\u5F84\u4E0D\u5728\u6709\u6548\u7684 BPMAX \u672C\u5730\u914D\u7F6E\u76EE\u5F55\u4E2D\uFF1B\u7F3A\u5C11\uFF1A${missing.join("\u3001")}\u3002`,
|
|
10733
|
+
{ path: diagnosticRoot, missing }
|
|
10734
|
+
);
|
|
10735
|
+
}
|
|
10736
|
+
async function canonicalConfiguredPath(value) {
|
|
10737
|
+
const configuredPath = value.trim();
|
|
10738
|
+
if (!configuredPath || !path6.isAbsolute(configuredPath)) {
|
|
10739
|
+
return void 0;
|
|
10740
|
+
}
|
|
10741
|
+
try {
|
|
10742
|
+
return await realpath(configuredPath);
|
|
10743
|
+
} catch (error) {
|
|
10744
|
+
if (error.code === "ENOENT") {
|
|
10745
|
+
return void 0;
|
|
10746
|
+
}
|
|
10747
|
+
throw error;
|
|
10748
|
+
}
|
|
10749
|
+
}
|
|
10750
|
+
async function assertConfigWorkspace(options) {
|
|
10751
|
+
const currentDirectory = await realpath(options.cwd || process.cwd());
|
|
10752
|
+
const root = options.root ? await realpath(options.root) : await findConfigWorkspaceRoot(currentDirectory);
|
|
10753
|
+
const relative = path6.relative(root, currentDirectory);
|
|
10754
|
+
if (relative === ".." || relative.startsWith(`..${path6.sep}`) || path6.isAbsolute(relative)) {
|
|
10755
|
+
throw new ConfigWorkspaceError("\u5F53\u524D\u76EE\u5F55\u4E0D\u5728\u8BC6\u522B\u51FA\u7684 BPMAX \u914D\u7F6E\u76EE\u5F55\u5185\u3002", {
|
|
10756
|
+
path: currentDirectory,
|
|
10757
|
+
profile: options.profile.name,
|
|
10758
|
+
env: options.env
|
|
10759
|
+
});
|
|
10760
|
+
}
|
|
10761
|
+
const environments = options.profile.config.config_environments || {};
|
|
10762
|
+
const entries = options.env ? Object.entries(environments).filter(([env]) => env === options.env) : Object.entries(environments);
|
|
10763
|
+
if (options.env && entries.length === 0) {
|
|
10764
|
+
throw new ConfigWorkspaceError(`\u5F53\u524D profile \u672A\u521D\u59CB\u5316\u914D\u7F6E\u73AF\u5883 ${options.env}\u3002`, {
|
|
10765
|
+
path: root,
|
|
10766
|
+
profile: options.profile.name,
|
|
10767
|
+
env: options.env,
|
|
10768
|
+
code: "config_workspace_environment_unbound",
|
|
10769
|
+
rule_id: "config.workspace.environment_binding"
|
|
10770
|
+
});
|
|
10771
|
+
}
|
|
10772
|
+
for (const [env, environment] of entries) {
|
|
10773
|
+
const configuredRoot = await canonicalConfiguredPath(environment.sysconfig_repo_path || "");
|
|
10774
|
+
if (configuredRoot === root) {
|
|
10775
|
+
return {
|
|
10776
|
+
root,
|
|
10777
|
+
profile: options.profile.name,
|
|
10778
|
+
env,
|
|
10779
|
+
current_directory: currentDirectory
|
|
10780
|
+
};
|
|
10781
|
+
}
|
|
10782
|
+
}
|
|
10783
|
+
const expected = entries.map(([env, environment]) => `${env}=${environment.sysconfig_repo_path || "<\u672A\u8BBE\u7F6E>"}`).join("\uFF0C");
|
|
10784
|
+
throw new ConfigWorkspaceError(
|
|
10785
|
+
options.env ? `\u5F53\u524D\u76EE\u5F55\u4E0E profile ${options.profile.name} \u7684\u914D\u7F6E\u73AF\u5883 ${options.env} \u7ED1\u5B9A\u4E0D\u4E00\u81F4\u3002` : `\u5F53\u524D\u76EE\u5F55\u672A\u7ED1\u5B9A\u5230 profile ${options.profile.name} \u7684\u4EFB\u4F55\u914D\u7F6E\u73AF\u5883\u3002`,
|
|
10786
|
+
{
|
|
10787
|
+
path: root,
|
|
10788
|
+
profile: options.profile.name,
|
|
10789
|
+
env: options.env,
|
|
10790
|
+
code: "config_workspace_profile_mismatch",
|
|
10791
|
+
rule_id: options.env ? "config.workspace.environment_binding" : "config.workspace.profile_binding",
|
|
10792
|
+
suggestion: `\u5DF2\u914D\u7F6E\u8DEF\u5F84\uFF1A${expected || "<\u65E0>"}\u3002\u8BF7\u6267\u884C bpmax-cli config workspace init \u4FEE\u590D\u7ED1\u5B9A\uFF0C\u7136\u540E\u8FDB\u5165\u8BE5\u76EE\u5F55\u91CD\u8BD5\u3002`
|
|
10793
|
+
}
|
|
10794
|
+
);
|
|
10795
|
+
}
|
|
10600
10796
|
function escapeRegExp(value) {
|
|
10601
10797
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
10602
10798
|
}
|
|
@@ -11283,7 +11479,7 @@ async function testPluginConfigDomain(profile, domain, id, message, agent = "cod
|
|
|
11283
11479
|
|
|
11284
11480
|
// src/commands/config-env.ts
|
|
11285
11481
|
import { execFile } from "child_process";
|
|
11286
|
-
import { mkdir as mkdir7, rm as rm3, stat as
|
|
11482
|
+
import { mkdir as mkdir7, rm as rm3, stat as stat5, writeFile as writeFile7 } from "fs/promises";
|
|
11287
11483
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
11288
11484
|
import { tmpdir as tmpdir2 } from "os";
|
|
11289
11485
|
import path8 from "path";
|
|
@@ -11578,7 +11774,7 @@ function hasBlockingDirtyStatus(status, allowedPaths = /* @__PURE__ */ new Set([
|
|
|
11578
11774
|
}
|
|
11579
11775
|
async function pathExists(targetPath) {
|
|
11580
11776
|
try {
|
|
11581
|
-
await
|
|
11777
|
+
await stat5(targetPath);
|
|
11582
11778
|
return true;
|
|
11583
11779
|
} catch (error) {
|
|
11584
11780
|
if (error.code === "ENOENT") {
|
|
@@ -12020,8 +12216,64 @@ async function ensureValue(current, label, placeholder) {
|
|
|
12020
12216
|
}
|
|
12021
12217
|
return result.trim();
|
|
12022
12218
|
}
|
|
12219
|
+
function configCommandPath(actionCommand) {
|
|
12220
|
+
const names = [];
|
|
12221
|
+
let current = actionCommand;
|
|
12222
|
+
while (current) {
|
|
12223
|
+
names.unshift(current.name());
|
|
12224
|
+
if (current.name() === "config") {
|
|
12225
|
+
break;
|
|
12226
|
+
}
|
|
12227
|
+
current = current.parent;
|
|
12228
|
+
}
|
|
12229
|
+
return names;
|
|
12230
|
+
}
|
|
12231
|
+
function configCommandGate(actionCommand) {
|
|
12232
|
+
const commandPath = configCommandPath(actionCommand);
|
|
12233
|
+
const [, group, operation] = commandPath;
|
|
12234
|
+
if (group === "profile") {
|
|
12235
|
+
return { required: false };
|
|
12236
|
+
}
|
|
12237
|
+
if (group === "adapters" && !operation) {
|
|
12238
|
+
return { required: false };
|
|
12239
|
+
}
|
|
12240
|
+
if (group === "repository" && ["list", "show", "sync"].includes(operation || "")) {
|
|
12241
|
+
return { required: false };
|
|
12242
|
+
}
|
|
12243
|
+
if (group === "workspace" && operation === "init") {
|
|
12244
|
+
return { required: false };
|
|
12245
|
+
}
|
|
12246
|
+
if (group === "init" && operation === "workspace") {
|
|
12247
|
+
return { required: false };
|
|
12248
|
+
}
|
|
12249
|
+
if (group === "plugin") {
|
|
12250
|
+
const [domain, pluginOperation] = actionCommand.processedArgs;
|
|
12251
|
+
if (!domain || !pluginOperation) {
|
|
12252
|
+
return { required: false };
|
|
12253
|
+
}
|
|
12254
|
+
}
|
|
12255
|
+
if (group === "latest" && (operation === "pull" || operation === "diff")) {
|
|
12256
|
+
const [env] = actionCommand.processedArgs;
|
|
12257
|
+
return { required: true, env: typeof env === "string" ? env : void 0 };
|
|
12258
|
+
}
|
|
12259
|
+
return { required: true };
|
|
12260
|
+
}
|
|
12023
12261
|
function registerConfigCommands(program2) {
|
|
12024
12262
|
const config = program2.command("config").description("Manage local bpmax-cli profiles");
|
|
12263
|
+
config.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
12264
|
+
const gate = configCommandGate(actionCommand);
|
|
12265
|
+
if (!gate.required) {
|
|
12266
|
+
return;
|
|
12267
|
+
}
|
|
12268
|
+
const root = await findConfigWorkspaceRoot();
|
|
12269
|
+
const options = actionCommand.optsWithGlobals();
|
|
12270
|
+
const configData = await loadConfig();
|
|
12271
|
+
await assertConfigWorkspace({
|
|
12272
|
+
profile: resolveProfile(configData, options.profile),
|
|
12273
|
+
env: gate.env,
|
|
12274
|
+
root
|
|
12275
|
+
});
|
|
12276
|
+
});
|
|
12025
12277
|
const profile = config.command("profile").description("Manage named environment profiles");
|
|
12026
12278
|
profile.command("add").description("Add or update a profile").option("--name <name>", "Profile name").option("--origin <origin>", "Profile origin").option("--api-key <apiKey>", "API key").option("--workspace <workspace>", "Default workspace", DEFAULT_WORKSPACE).option("--language <language>", "Default language", DEFAULT_LANGUAGE).action(async (options) => {
|
|
12027
12279
|
const name = await ensureValue(options.name, "Profile name", "default");
|
|
@@ -12526,7 +12778,7 @@ function registerConfigCommands(program2) {
|
|
|
12526
12778
|
|
|
12527
12779
|
// src/commands/e2e.ts
|
|
12528
12780
|
import { createHash as createHash6 } from "crypto";
|
|
12529
|
-
import { mkdir as mkdir10, readFile as readFile12, readdir as readdir4, stat as
|
|
12781
|
+
import { mkdir as mkdir10, readFile as readFile12, readdir as readdir4, stat as stat7, writeFile as writeFile10 } from "fs/promises";
|
|
12530
12782
|
import path11 from "path";
|
|
12531
12783
|
|
|
12532
12784
|
// src/core/test-suite.ts
|
|
@@ -12541,7 +12793,7 @@ import {
|
|
|
12541
12793
|
readFile as readFile11,
|
|
12542
12794
|
rename,
|
|
12543
12795
|
rm as rm4,
|
|
12544
|
-
stat as
|
|
12796
|
+
stat as stat6,
|
|
12545
12797
|
unlink,
|
|
12546
12798
|
writeFile as writeFile9
|
|
12547
12799
|
} from "fs/promises";
|
|
@@ -12704,7 +12956,7 @@ var TestSuiteError = class extends Error {
|
|
|
12704
12956
|
};
|
|
12705
12957
|
async function exists3(filePath) {
|
|
12706
12958
|
try {
|
|
12707
|
-
await
|
|
12959
|
+
await stat6(filePath);
|
|
12708
12960
|
return true;
|
|
12709
12961
|
} catch {
|
|
12710
12962
|
return false;
|
|
@@ -13471,7 +13723,7 @@ async function assertExecutionManifestFresh(manifest, manifestPath) {
|
|
|
13471
13723
|
}
|
|
13472
13724
|
}
|
|
13473
13725
|
async function evidenceContainsDiagnostic(evidencePath) {
|
|
13474
|
-
const info = await
|
|
13726
|
+
const info = await stat6(evidencePath);
|
|
13475
13727
|
if (info.isDirectory()) {
|
|
13476
13728
|
const entries = await readdir3(evidencePath, { withFileTypes: true });
|
|
13477
13729
|
for (const entry of entries) {
|
|
@@ -13497,7 +13749,7 @@ async function assertCurrentRunArtifact(manifest, artifactPath) {
|
|
|
13497
13749
|
if (!await exists3(artifactPath)) {
|
|
13498
13750
|
fail(`execution evidence artifact not found: ${artifactPath}`, { rule_id: "test_suite.run.evidence_missing", path: artifactPath });
|
|
13499
13751
|
}
|
|
13500
|
-
const info = await
|
|
13752
|
+
const info = await stat6(artifactPath);
|
|
13501
13753
|
if (info.mtime.getTime() + 1e3 < new Date(manifest.started_at).getTime()) {
|
|
13502
13754
|
fail("execution evidence artifact predates the current run", { rule_id: "test_suite.run.evidence_stale", path: artifactPath });
|
|
13503
13755
|
}
|
|
@@ -13508,7 +13760,7 @@ async function assertCurrentRunEvidence(manifest, manifestPath, evidencePath) {
|
|
|
13508
13760
|
if (!pathInside(runDir, evidencePath)) {
|
|
13509
13761
|
fail("formal execution evidence must stay inside the current report run directory", { rule_id: "test_suite.run.evidence_scope", path: evidencePath });
|
|
13510
13762
|
}
|
|
13511
|
-
const info = await
|
|
13763
|
+
const info = await stat6(evidencePath);
|
|
13512
13764
|
if (info.mtime.getTime() + 1e3 < new Date(manifest.started_at).getTime()) {
|
|
13513
13765
|
fail("execution evidence predates the current run", { rule_id: "test_suite.run.evidence_stale", path: evidencePath });
|
|
13514
13766
|
}
|
|
@@ -13517,7 +13769,7 @@ async function assertCurrentRunEvidence(manifest, manifestPath, evidencePath) {
|
|
|
13517
13769
|
}
|
|
13518
13770
|
}
|
|
13519
13771
|
async function evidenceTexts(evidencePath) {
|
|
13520
|
-
const info = await
|
|
13772
|
+
const info = await stat6(evidencePath);
|
|
13521
13773
|
if (!info.isDirectory()) return [await readText(evidencePath).catch(() => "")];
|
|
13522
13774
|
const entries = await readdir3(evidencePath, { withFileTypes: true });
|
|
13523
13775
|
const texts = [];
|
|
@@ -13528,7 +13780,7 @@ async function evidenceTexts(evidencePath) {
|
|
|
13528
13780
|
return texts;
|
|
13529
13781
|
}
|
|
13530
13782
|
async function evidenceJsonRecords(evidencePath) {
|
|
13531
|
-
const info = await
|
|
13783
|
+
const info = await stat6(evidencePath);
|
|
13532
13784
|
const paths = info.isDirectory() ? (await readdir3(evidencePath, { withFileTypes: true })).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => path10.join(evidencePath, entry.name)) : [evidencePath];
|
|
13533
13785
|
const records = [];
|
|
13534
13786
|
for (const source of paths) {
|
|
@@ -14784,7 +15036,7 @@ async function lintReport(root = DEFAULT_REPORT_ROOT) {
|
|
|
14784
15036
|
}
|
|
14785
15037
|
validCurrentRunImages.push(imageRef);
|
|
14786
15038
|
if (isFullRerun) {
|
|
14787
|
-
const imageStat = await
|
|
15039
|
+
const imageStat = await stat6(imagePath);
|
|
14788
15040
|
if (!isWithinWindow(imageStat.mtime, window)) {
|
|
14789
15041
|
errors.push(`[test_suite.report.current_run_screenshot] ${reportPath}: full_rerun \u622A\u56FE\u5FC5\u987B\u5728\u672C\u8F6E\u6267\u884C\u65F6\u95F4\u5185\u751F\u6210\uFF0C\u4E0D\u80FD\u590D\u7528\u5386\u53F2\u622A\u56FE: ${imageRef}`);
|
|
14790
15042
|
}
|
|
@@ -16314,7 +16566,7 @@ function registerE2eCommands(program2) {
|
|
|
16314
16566
|
const profile = resolveProfile(await loadConfig(), options.profile);
|
|
16315
16567
|
const file = flowCachePath(profile.name, options.flowId);
|
|
16316
16568
|
const cached = await readOptionalJson(file);
|
|
16317
|
-
const fileStat = await
|
|
16569
|
+
const fileStat = await stat7(file).catch(() => null);
|
|
16318
16570
|
printResult(options.format, {
|
|
16319
16571
|
ok: true,
|
|
16320
16572
|
profile: profile.name,
|
|
@@ -20194,7 +20446,7 @@ function registerTestSuiteCommands(program2) {
|
|
|
20194
20446
|
}
|
|
20195
20447
|
|
|
20196
20448
|
// src/core/update.ts
|
|
20197
|
-
import { access as access2, mkdir as mkdir13, readFile as readFile18, realpath, writeFile as writeFile13 } from "fs/promises";
|
|
20449
|
+
import { access as access2, mkdir as mkdir13, readFile as readFile18, realpath as realpath2, writeFile as writeFile13 } from "fs/promises";
|
|
20198
20450
|
import path15 from "path";
|
|
20199
20451
|
var DEFAULT_REGISTRY_URL = "https://registry.npmjs.org/";
|
|
20200
20452
|
var UPDATE_STATE_FILE = "update-state.json";
|
|
@@ -20360,7 +20612,7 @@ async function executablePath() {
|
|
|
20360
20612
|
return "";
|
|
20361
20613
|
}
|
|
20362
20614
|
try {
|
|
20363
|
-
return await
|
|
20615
|
+
return await realpath2(candidate);
|
|
20364
20616
|
} catch {
|
|
20365
20617
|
return candidate;
|
|
20366
20618
|
}
|
|
@@ -20790,6 +21042,9 @@ function printCommandError(error) {
|
|
|
20790
21042
|
...typeof structured.rule_id === "string" ? { rule_id: structured.rule_id } : {},
|
|
20791
21043
|
...typeof structured.path === "string" ? { path: structured.path } : {},
|
|
20792
21044
|
...typeof structured.suggestion === "string" ? { suggestion: structured.suggestion } : {},
|
|
21045
|
+
...Array.isArray(structured.missing) ? { missing: structured.missing } : {},
|
|
21046
|
+
...typeof structured.profile === "string" ? { profile: structured.profile } : {},
|
|
21047
|
+
...typeof structured.env === "string" ? { env: structured.env } : {},
|
|
20793
21048
|
...commandDomainFromArgv(process.argv) ? { domain: commandDomainFromArgv(process.argv) } : {},
|
|
20794
21049
|
...commandEndpointHint(process.argv) ? { endpoint: commandEndpointHint(process.argv) } : {}
|
|
20795
21050
|
}, null, 2));
|