bpmax-cli 0.1.44-beta.15 → 0.1.44-beta.17
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 +585 -59
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-ai-taskbook/SKILL.md +18 -2
- package/skills/bpmax-approval-matrix/SKILL.md +7 -0
- package/skills/bpmax-dataset-field-template-editor/SKILL.md +3 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +5 -0
- package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +4 -1
- package/skills/bpmax-e2e-flow-test-operator/SKILL.md +7 -0
- package/skills/bpmax-nav-config-editor/SKILL.md +3 -2
- package/skills/bpmax-nav-config-editor/references/api-workflow.md +6 -4
- package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +5 -0
- package/skills/bpmax-project/SKILL.md +4 -0
package/dist/bin.js
CHANGED
|
@@ -337,6 +337,7 @@ function capabilityForRequest(method, path11) {
|
|
|
337
337
|
if (normalizedMethod === "PUT" && /^\/configuration\/[^/]+$/.test(normalizedPath)) return "config.nav_config.submit";
|
|
338
338
|
if (normalizedMethod === "DELETE" && /^\/configuration\/[^/]+$/.test(normalizedPath)) return "config.nav_config.delete";
|
|
339
339
|
if (normalizedMethod === "POST" && normalizedPath === "/project_staging/prefill") return "project.create";
|
|
340
|
+
if (normalizedMethod === "GET" && /^\/project_staging\/prefill\/[^/]+$/.test(normalizedPath)) return "project.create";
|
|
340
341
|
if (normalizedMethod === "POST" && normalizedPath === "/project/search") return "project.search";
|
|
341
342
|
if (normalizedMethod === "POST" && normalizedPath === "/project/list") return "project.list";
|
|
342
343
|
if (normalizedMethod === "POST" && normalizedPath === "/project") return "project.create";
|
|
@@ -448,7 +449,7 @@ function normalizePath2(path11) {
|
|
|
448
449
|
// package.json
|
|
449
450
|
var package_default = {
|
|
450
451
|
name: "bpmax-cli",
|
|
451
|
-
version: "0.1.44-beta.
|
|
452
|
+
version: "0.1.44-beta.17",
|
|
452
453
|
description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
|
|
453
454
|
type: "module",
|
|
454
455
|
bin: {
|
|
@@ -3975,6 +3976,19 @@ function normalizeDatasetFieldPayload(work) {
|
|
|
3975
3976
|
payload.source_field = source.field ?? source.sourceField ?? source.source_field ?? "";
|
|
3976
3977
|
payload.source_fk = source.fk ?? source.sourceFk ?? source.source_fk ?? "";
|
|
3977
3978
|
}
|
|
3979
|
+
payload.sourceTable = payload.source_table;
|
|
3980
|
+
payload.sourceField = payload.source_field;
|
|
3981
|
+
payload.sourceFk = payload.source_fk;
|
|
3982
|
+
if (mode === "create") {
|
|
3983
|
+
const missingSource = [
|
|
3984
|
+
["source_table", payload.source_table],
|
|
3985
|
+
["source_field", payload.source_field],
|
|
3986
|
+
["source_fk", payload.source_fk]
|
|
3987
|
+
].filter(([, value]) => typeof value !== "string" || value.trim() === "");
|
|
3988
|
+
if (missingSource.length > 0) {
|
|
3989
|
+
throw new Error(`dataset-field create requires source mapping fields: ${missingSource.map(([key]) => key).join(", ")}.`);
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3978
3992
|
const advanced = isRecord3(work.advanced) ? work.advanced : {};
|
|
3979
3993
|
if (Object.prototype.hasOwnProperty.call(advanced, "sourceComputed")) {
|
|
3980
3994
|
payload.source_computed = normalizeOptionalText(advanced.sourceComputed);
|
|
@@ -4798,6 +4812,90 @@ function buildNavConfigSubmitPayload(work, raw, options = {}) {
|
|
|
4798
4812
|
all_records: Boolean(options.allRecords)
|
|
4799
4813
|
};
|
|
4800
4814
|
}
|
|
4815
|
+
function lintNavConfigWork(work, errors) {
|
|
4816
|
+
if (work.domain !== void 0 && work.domain !== "nav-config") {
|
|
4817
|
+
errors.push(`nav-config work domain must be nav-config, got ${JSON.stringify(work.domain)}.`);
|
|
4818
|
+
}
|
|
4819
|
+
if (typeof work.workspace !== "string" || !work.workspace.trim()) {
|
|
4820
|
+
errors.push("nav-config work requires workspace.");
|
|
4821
|
+
}
|
|
4822
|
+
if (!isRecord3(work.configs)) {
|
|
4823
|
+
errors.push("nav-config work requires configs object.");
|
|
4824
|
+
return;
|
|
4825
|
+
}
|
|
4826
|
+
for (const type of NAV_CONFIG_TYPES) {
|
|
4827
|
+
const config = work.configs[type];
|
|
4828
|
+
if (!isRecord3(config)) {
|
|
4829
|
+
errors.push(`nav-config work is missing ${type}.`);
|
|
4830
|
+
continue;
|
|
4831
|
+
}
|
|
4832
|
+
try {
|
|
4833
|
+
const payload = navConfigToSubmitRecord(type, config);
|
|
4834
|
+
const content = isRecord3(payload.content) ? payload.content : {};
|
|
4835
|
+
const contentKey = NAV_CONTENT_KEY_BY_TYPE[type];
|
|
4836
|
+
if (!Array.isArray(content[contentKey])) {
|
|
4837
|
+
errors.push(`nav-config ${type} content.${contentKey} must be an array.`);
|
|
4838
|
+
}
|
|
4839
|
+
const name = typeof payload.name === "string" ? payload.name.trim() : "";
|
|
4840
|
+
if (!name) {
|
|
4841
|
+
errors.push(`nav-config ${type} requires name.`);
|
|
4842
|
+
}
|
|
4843
|
+
const items = Array.isArray(content[contentKey]) ? content[contentKey] : [];
|
|
4844
|
+
lintNavConfigNodes(type, items, `${type}.${contentKey}`, errors);
|
|
4845
|
+
} catch (error) {
|
|
4846
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
4847
|
+
}
|
|
4848
|
+
}
|
|
4849
|
+
}
|
|
4850
|
+
function lintNavConfigNodes(type, nodes, pathPrefix, errors) {
|
|
4851
|
+
const mobile = type === "navmenu_mobile" || type === "shortcut_mobile";
|
|
4852
|
+
const shortcut = type === "shortcut" || type === "shortcut_mobile";
|
|
4853
|
+
nodes.forEach((node, index) => {
|
|
4854
|
+
const nodePath = `${pathPrefix}[${index}]`;
|
|
4855
|
+
if (!isRecord3(node)) {
|
|
4856
|
+
errors.push(`${nodePath} must be an object.`);
|
|
4857
|
+
return;
|
|
4858
|
+
}
|
|
4859
|
+
const name = typeof node.name === "string" ? node.name.trim() : "";
|
|
4860
|
+
if (!name) {
|
|
4861
|
+
errors.push(`${nodePath}.name must be a non-empty string.`);
|
|
4862
|
+
}
|
|
4863
|
+
if (name.length > 6) {
|
|
4864
|
+
errors.push(`${nodePath}.name exceeds the 6 Hanzi limit.`);
|
|
4865
|
+
}
|
|
4866
|
+
const icon = typeof node.icon === "string" ? node.icon.trim() : "";
|
|
4867
|
+
if (!/^(ri ri_[A-Za-z0-9_-]+|el-icon-[A-Za-z0-9_-]+)$/.test(icon)) {
|
|
4868
|
+
errors.push(`${nodePath}.icon must be a full icon class such as ri ri_home-5-line.`);
|
|
4869
|
+
}
|
|
4870
|
+
const nodePathValue = typeof node.path === "string" ? node.path.trim() : "";
|
|
4871
|
+
if (mobile && (nodePathValue.startsWith("/project") || nodePathValue.startsWith("/myProject"))) {
|
|
4872
|
+
errors.push(`${nodePath}.path must use an H5 path; got PC route instead of H5 route.`);
|
|
4873
|
+
}
|
|
4874
|
+
if (!mobile && nodePathValue.startsWith("/pages/")) {
|
|
4875
|
+
errors.push(`${nodePath}.path must stay on PC routing; got H5 route instead of PC route.`);
|
|
4876
|
+
}
|
|
4877
|
+
const explicitFlowKey = typeof node.flow_key === "string" ? node.flow_key.trim() : typeof node.flowKey === "string" ? node.flowKey.trim() : "";
|
|
4878
|
+
if (explicitFlowKey && /[?&]flow_type=/.test(nodePathValue) && !/[?&]flow_key=/.test(nodePathValue)) {
|
|
4879
|
+
errors.push(`${nodePath}.path must preserve non-empty flow_key for flow navigation.`);
|
|
4880
|
+
}
|
|
4881
|
+
if (/[?&]flow_key=(&|$)/.test(nodePathValue)) {
|
|
4882
|
+
errors.push(`${nodePath}.path has an empty flow_key parameter.`);
|
|
4883
|
+
}
|
|
4884
|
+
const permissionType = typeof node.permissionType === "string" ? node.permissionType : "";
|
|
4885
|
+
if (permissionType && !["PERMISSION_POINT", "VISIBILITY_SCOPE", "PUBLIC"].includes(permissionType)) {
|
|
4886
|
+
errors.push(`${nodePath}.permissionType must be PERMISSION_POINT, VISIBILITY_SCOPE, or PUBLIC.`);
|
|
4887
|
+
}
|
|
4888
|
+
const sub = node.sub;
|
|
4889
|
+
if (!Array.isArray(sub)) {
|
|
4890
|
+
errors.push(`${nodePath}.sub must be an array.`);
|
|
4891
|
+
return;
|
|
4892
|
+
}
|
|
4893
|
+
if (shortcut && sub.length > 0) {
|
|
4894
|
+
errors.push(`${nodePath}.sub must stay empty for shortcut configs.`);
|
|
4895
|
+
}
|
|
4896
|
+
lintNavConfigNodes(type, sub, `${nodePath}.sub`, errors);
|
|
4897
|
+
});
|
|
4898
|
+
}
|
|
4801
4899
|
async function collectNavConfigAggregate(profile, id) {
|
|
4802
4900
|
const definition = CONFIG_DOMAINS["nav-config"];
|
|
4803
4901
|
await ensureConfigCapability(profile, `${definition.capability}.export`);
|
|
@@ -5683,6 +5781,9 @@ async function lintConfigWorkFile(file) {
|
|
|
5683
5781
|
if ((Object.prototype.hasOwnProperty.call(value, "content") || isRecord3(value.basic)) && pageTemplateType(value) === 1) {
|
|
5684
5782
|
validateListTemplateActionGate(value, errors);
|
|
5685
5783
|
}
|
|
5784
|
+
if (value.domain === "nav-config" || Object.prototype.hasOwnProperty.call(value, "configs")) {
|
|
5785
|
+
lintNavConfigWork(value, errors);
|
|
5786
|
+
}
|
|
5686
5787
|
if (isFlowTemplateWork(value)) {
|
|
5687
5788
|
const flowWork = value;
|
|
5688
5789
|
validateFlowTemplateRemoteTemplateRefs(flowWork, errors);
|
|
@@ -7065,6 +7166,51 @@ async function pullLatestConfigEnvironment(env, options) {
|
|
|
7065
7166
|
}
|
|
7066
7167
|
|
|
7067
7168
|
// src/commands/config.ts
|
|
7169
|
+
var isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7170
|
+
function stringValue(value) {
|
|
7171
|
+
return typeof value === "string" && value.trim() ? value : void 0;
|
|
7172
|
+
}
|
|
7173
|
+
function arrayValue(value) {
|
|
7174
|
+
return Array.isArray(value) ? value : [];
|
|
7175
|
+
}
|
|
7176
|
+
function flowTemplateNodes(work) {
|
|
7177
|
+
const data = isRecord4(work.data) ? work.data : void 0;
|
|
7178
|
+
return arrayValue(data?.nodes).filter(isRecord4);
|
|
7179
|
+
}
|
|
7180
|
+
function summarizeFlowTemplateWork(work) {
|
|
7181
|
+
if (!isRecord4(work)) {
|
|
7182
|
+
return { available: false, reason: "flow-template work file is not a JSON object" };
|
|
7183
|
+
}
|
|
7184
|
+
const data = isRecord4(work.data) ? work.data : {};
|
|
7185
|
+
const meta = isRecord4(data.meta) ? data.meta : {};
|
|
7186
|
+
const nodes = flowTemplateNodes(work);
|
|
7187
|
+
const matrixOwnerNodes = nodes.filter((node) => JSON.stringify(node).includes("matrix_owner")).map((node) => ({
|
|
7188
|
+
id: stringValue(node.id),
|
|
7189
|
+
name: stringValue(node.name),
|
|
7190
|
+
type: stringValue(node.type)
|
|
7191
|
+
}));
|
|
7192
|
+
const ccMatrixNodes = nodes.filter((node) => JSON.stringify(node).includes("cc_matrix")).map((node) => ({
|
|
7193
|
+
id: stringValue(node.id),
|
|
7194
|
+
name: stringValue(node.name),
|
|
7195
|
+
type: stringValue(node.type)
|
|
7196
|
+
}));
|
|
7197
|
+
const publish = isRecord4(work.publish) ? work.publish : void 0;
|
|
7198
|
+
return {
|
|
7199
|
+
available: true,
|
|
7200
|
+
name: stringValue(work.name),
|
|
7201
|
+
flow_type: stringValue(work.flow_type),
|
|
7202
|
+
key: stringValue(work.key) ?? "",
|
|
7203
|
+
type: stringValue(work.type),
|
|
7204
|
+
status: work.status,
|
|
7205
|
+
publish_status: publish?.status ?? work.publish_status,
|
|
7206
|
+
meta_form_id: work.meta_form_id ?? meta.form_template,
|
|
7207
|
+
node_count: nodes.length,
|
|
7208
|
+
matrix_owner_node_count: matrixOwnerNodes.length,
|
|
7209
|
+
matrix_owner_nodes: matrixOwnerNodes,
|
|
7210
|
+
cc_matrix_node_count: ccMatrixNodes.length,
|
|
7211
|
+
cc_matrix_nodes: ccMatrixNodes
|
|
7212
|
+
};
|
|
7213
|
+
}
|
|
7068
7214
|
async function ensureValue(current, label, placeholder) {
|
|
7069
7215
|
if (current) {
|
|
7070
7216
|
return current;
|
|
@@ -7146,7 +7292,8 @@ function registerConfigCommands(program2) {
|
|
|
7146
7292
|
user: target.user || null
|
|
7147
7293
|
});
|
|
7148
7294
|
});
|
|
7149
|
-
config.command("adapters").description("Show typed config domain adapter coverage and verified API surfaces").option("--format <format>", "Output format", "table").action(async (options) => {
|
|
7295
|
+
config.command("adapters").description("Show typed config domain adapter coverage and verified API surfaces").option("--profile <profile>", "Profile name (accepted for consistency; adapter coverage is local and profile-independent)").option("--format <format>", "Output format", "table").action(async (options) => {
|
|
7296
|
+
void options.profile;
|
|
7150
7297
|
printResult(options.format, configAdapterMatrix());
|
|
7151
7298
|
});
|
|
7152
7299
|
const latest = config.command("latest").description("Sync latest BPMAX sysconfig repositories");
|
|
@@ -7250,11 +7397,21 @@ function registerConfigCommands(program2) {
|
|
|
7250
7397
|
await saveConfig(configData);
|
|
7251
7398
|
printResult(options.format, result);
|
|
7252
7399
|
});
|
|
7253
|
-
domainCommand.command("export").description(`Export remote ${domain} configuration into raw/work/meta files`).requiredOption("--id <id>", "Remote config id").option("--profile <profile>", "Profile name").option("--out <outDir>", "Output directory", `.codex/tmp/${domain}-editor`).option("--work-format <format>", "Work file format for supported domains: raw | structured", "raw").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
7400
|
+
domainCommand.command("export").description(`Export remote ${domain} configuration into raw/work/meta files`).requiredOption("--id <id>", "Remote config id").option("--profile <profile>", "Profile name").option("--out <outDir>", "Output directory", `.codex/tmp/${domain}-editor`).option("--work-format <format>", "Work file format for supported domains: raw | structured", "raw").option("--summary", "For flow-template, include a compact configuration summary in command output").option("--inline", "For flow-template, include the exported work JSON inline in command output").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
7254
7401
|
const configData = await loadConfig();
|
|
7255
7402
|
const resolved = resolveProfile(configData, options.profile);
|
|
7256
7403
|
const workFormat = options.workFormat === "structured" ? "structured" : "raw";
|
|
7257
7404
|
const result = await exportConfigDomain(configData, resolved, domain, options.id, options.out, { workFormat });
|
|
7405
|
+
if (domain === "flow-template" && (options.summary || options.inline)) {
|
|
7406
|
+
const workFile = typeof result.work_file === "string" ? result.work_file : void 0;
|
|
7407
|
+
const work = workFile ? await readJsonFile(workFile) : void 0;
|
|
7408
|
+
if (options.summary) {
|
|
7409
|
+
result.summary = summarizeFlowTemplateWork(work);
|
|
7410
|
+
}
|
|
7411
|
+
if (options.inline) {
|
|
7412
|
+
result.work = work;
|
|
7413
|
+
}
|
|
7414
|
+
}
|
|
7258
7415
|
await saveConfig(configData);
|
|
7259
7416
|
printResult(options.format, result);
|
|
7260
7417
|
});
|
|
@@ -7359,11 +7516,11 @@ function registerConfigCommands(program2) {
|
|
|
7359
7516
|
}
|
|
7360
7517
|
|
|
7361
7518
|
// src/core/project-search.ts
|
|
7362
|
-
function
|
|
7519
|
+
function isRecord5(value) {
|
|
7363
7520
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7364
7521
|
}
|
|
7365
7522
|
function hasRawProjectSearchBody(value) {
|
|
7366
|
-
return
|
|
7523
|
+
return isRecord5(value) && Object.prototype.hasOwnProperty.call(value, "body");
|
|
7367
7524
|
}
|
|
7368
7525
|
function assertProjectSearchBody(value) {
|
|
7369
7526
|
if (hasRawProjectSearchBody(value)) {
|
|
@@ -7923,6 +8080,38 @@ function isEmptyApproverValue(value) {
|
|
|
7923
8080
|
function shellQuote6(value) {
|
|
7924
8081
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
7925
8082
|
}
|
|
8083
|
+
var isRecord6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8084
|
+
function dataArray(value) {
|
|
8085
|
+
if (Array.isArray(value)) return value;
|
|
8086
|
+
if (isRecord6(value) && Array.isArray(value.data)) return value.data;
|
|
8087
|
+
return [];
|
|
8088
|
+
}
|
|
8089
|
+
function collectMatrixOwnerPaths(value, path11 = "$") {
|
|
8090
|
+
if (Array.isArray(value)) {
|
|
8091
|
+
return value.flatMap((item, index) => collectMatrixOwnerPaths(item, `${path11}[${index}]`));
|
|
8092
|
+
}
|
|
8093
|
+
if (!isRecord6(value)) {
|
|
8094
|
+
return [];
|
|
8095
|
+
}
|
|
8096
|
+
const matches = [];
|
|
8097
|
+
Object.entries(value).forEach(([key, child]) => {
|
|
8098
|
+
const childPath = `${path11}.${key}`;
|
|
8099
|
+
if (key.includes("matrix_owner") || typeof child === "string" && child.includes("matrix_owner")) {
|
|
8100
|
+
matches.push({ path: childPath, value: child });
|
|
8101
|
+
}
|
|
8102
|
+
matches.push(...collectMatrixOwnerPaths(child, childPath));
|
|
8103
|
+
});
|
|
8104
|
+
return matches;
|
|
8105
|
+
}
|
|
8106
|
+
function projectFormKeys(project) {
|
|
8107
|
+
const metaForm = isRecord6(project.metaForm) ? project.metaForm : {};
|
|
8108
|
+
const values = dataArray(metaForm.value ?? project.formList);
|
|
8109
|
+
return values.filter(isRecord6).map((item) => String(item.key ?? item.field_key ?? "")).filter(Boolean);
|
|
8110
|
+
}
|
|
8111
|
+
function findFlowNode(flow, nodeId) {
|
|
8112
|
+
const data = isRecord6(flow.data) ? flow.data : {};
|
|
8113
|
+
return dataArray(data.nodes).filter(isRecord6).find((node) => String(node.id ?? node.key ?? node.flow_step_id ?? "") === nodeId);
|
|
8114
|
+
}
|
|
7926
8115
|
function registerMatrixCommands(program2) {
|
|
7927
8116
|
const matrix = program2.command("matrix").description("Plan and validate BPMAX approval matrix operations");
|
|
7928
8117
|
matrix.command("seed <flowType>").description("Validate approval matrix seed rule records and print safe project create commands").requiredOption("--rules <jsonOrFile>", "Seed rule object/array JSON or @file").option("--profile <profile>", "Profile name").option("--approver-field <field...>", "Required approver field key(s) inside each rule form").option("--format <format>", "Output format", "pretty").action(async (flowType, options) => {
|
|
@@ -7975,6 +8164,49 @@ ${errors.map((error) => `- [${error.rule_index}] ${error.code}${error.path ? ` $
|
|
|
7975
8164
|
]
|
|
7976
8165
|
});
|
|
7977
8166
|
});
|
|
8167
|
+
matrix.command("owner-resolve").description("Inspect matrix_owner configuration inputs for one flow node and project").requiredOption("--flow-type <flowType>", "Business flow type").requiredOption("--node <nodeId>", "Flow node id/key to inspect").requiredOption("--project-id <projectId>", "Runtime project id used as matrix input context").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
8168
|
+
const config = await loadConfig();
|
|
8169
|
+
const profile = resolveProfile(config, options.profile);
|
|
8170
|
+
const client = createApiClient(profile);
|
|
8171
|
+
const [project, flow] = await Promise.all([
|
|
8172
|
+
apiRequest(client, "GET", `/project/${encodeURIComponent(options.projectId)}`),
|
|
8173
|
+
apiRequest(client, "GET", "/flow", {
|
|
8174
|
+
params: {
|
|
8175
|
+
flow_type: options.flowType,
|
|
8176
|
+
draft: 0,
|
|
8177
|
+
skip_i18n: true
|
|
8178
|
+
}
|
|
8179
|
+
})
|
|
8180
|
+
]);
|
|
8181
|
+
const node = findFlowNode(flow, options.node);
|
|
8182
|
+
const matrixOwnerConfig = node ? collectMatrixOwnerPaths(node) : [];
|
|
8183
|
+
printResult(options.format, {
|
|
8184
|
+
domain: "approval-matrix",
|
|
8185
|
+
action: "owner-resolve",
|
|
8186
|
+
flow_type: options.flowType,
|
|
8187
|
+
node: options.node,
|
|
8188
|
+
project_id: options.projectId,
|
|
8189
|
+
config_found: matrixOwnerConfig.length > 0,
|
|
8190
|
+
runtime_owner_verified: false,
|
|
8191
|
+
flow_node: node ? {
|
|
8192
|
+
id: node.id,
|
|
8193
|
+
name: node.name,
|
|
8194
|
+
type: node.type
|
|
8195
|
+
} : null,
|
|
8196
|
+
matrix_owner_config: matrixOwnerConfig,
|
|
8197
|
+
project_context: {
|
|
8198
|
+
id: project.id,
|
|
8199
|
+
name: project.name,
|
|
8200
|
+
form_keys: projectFormKeys(project)
|
|
8201
|
+
},
|
|
8202
|
+
notes: [
|
|
8203
|
+
"This command is read-only and does not write matrix rule records.",
|
|
8204
|
+
"If matrix_owner_config is empty, the target node is not configured for matrix owner resolution or the node id is wrong.",
|
|
8205
|
+
"config_found only means matrix_owner-like config exists on the node; it does not prove runtime owner resolution.",
|
|
8206
|
+
"Use bpmax-cli matrix seed to validate rule seed data before creating matrix rule project records."
|
|
8207
|
+
]
|
|
8208
|
+
});
|
|
8209
|
+
});
|
|
7978
8210
|
}
|
|
7979
8211
|
|
|
7980
8212
|
// src/core/form-schema.ts
|
|
@@ -7996,7 +8228,7 @@ var OPTION_NAMES = ["options", "items", "choices", "values"];
|
|
|
7996
8228
|
var REQUIRED_NAMES = ["required", "is_required", "isRequired", "require", "must", "validateRequired"];
|
|
7997
8229
|
var HIDDEN_NAMES = ["hidden", "is_hidden", "isHidden", "hide", "hideInForm"];
|
|
7998
8230
|
var VISIBLE_NAMES = ["visible", "display", "show"];
|
|
7999
|
-
function
|
|
8231
|
+
function isRecord7(value) {
|
|
8000
8232
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8001
8233
|
}
|
|
8002
8234
|
function pickString(source, keys) {
|
|
@@ -8023,10 +8255,10 @@ function pickBoolean(source, keys) {
|
|
|
8023
8255
|
}
|
|
8024
8256
|
const rules = source.rules;
|
|
8025
8257
|
if (Array.isArray(rules)) {
|
|
8026
|
-
return rules.some((rule) =>
|
|
8258
|
+
return rules.some((rule) => isRecord7(rule) && pickBoolean(rule, REQUIRED_NAMES));
|
|
8027
8259
|
}
|
|
8028
8260
|
const validateMap = source.validateMap;
|
|
8029
|
-
if (
|
|
8261
|
+
if (isRecord7(validateMap) && pickBoolean(validateMap, REQUIRED_NAMES)) {
|
|
8030
8262
|
return true;
|
|
8031
8263
|
}
|
|
8032
8264
|
return false;
|
|
@@ -8050,7 +8282,7 @@ function optionValue(option) {
|
|
|
8050
8282
|
if (typeof option === "string" || typeof option === "number") {
|
|
8051
8283
|
return String(option);
|
|
8052
8284
|
}
|
|
8053
|
-
if (!
|
|
8285
|
+
if (!isRecord7(option)) {
|
|
8054
8286
|
return null;
|
|
8055
8287
|
}
|
|
8056
8288
|
return pickString(option, ["value", "key", "id", "name", "label", "title"]) ?? null;
|
|
@@ -8115,7 +8347,7 @@ function collectFieldCandidates(value, fields, depth = 0) {
|
|
|
8115
8347
|
}
|
|
8116
8348
|
return;
|
|
8117
8349
|
}
|
|
8118
|
-
if (!
|
|
8350
|
+
if (!isRecord7(value)) {
|
|
8119
8351
|
return;
|
|
8120
8352
|
}
|
|
8121
8353
|
const field = fieldFromRecord(value);
|
|
@@ -8123,7 +8355,7 @@ function collectFieldCandidates(value, fields, depth = 0) {
|
|
|
8123
8355
|
if (isSubFormField(field)) {
|
|
8124
8356
|
const childFields = /* @__PURE__ */ new Map();
|
|
8125
8357
|
for (const child of Object.values(value)) {
|
|
8126
|
-
if (
|
|
8358
|
+
if (isRecord7(child) || Array.isArray(child)) {
|
|
8127
8359
|
collectFieldCandidates(child, childFields, depth + 1);
|
|
8128
8360
|
}
|
|
8129
8361
|
}
|
|
@@ -8137,7 +8369,7 @@ function collectFieldCandidates(value, fields, depth = 0) {
|
|
|
8137
8369
|
fields.set(field.key, mergeField(fields.get(field.key), field));
|
|
8138
8370
|
}
|
|
8139
8371
|
for (const child of Object.values(value)) {
|
|
8140
|
-
if (
|
|
8372
|
+
if (isRecord7(child) || Array.isArray(child)) {
|
|
8141
8373
|
collectFieldCandidates(child, fields, depth + 1);
|
|
8142
8374
|
}
|
|
8143
8375
|
}
|
|
@@ -8155,7 +8387,7 @@ function validateComplexSelector(field, value) {
|
|
|
8155
8387
|
if (!isComplexSelectorType(type)) {
|
|
8156
8388
|
return null;
|
|
8157
8389
|
}
|
|
8158
|
-
const validObject = (item) =>
|
|
8390
|
+
const validObject = (item) => isRecord7(item);
|
|
8159
8391
|
if (Array.isArray(value)) {
|
|
8160
8392
|
return value.every(validObject) ? null : `${field.key} must contain selector option object(s), not scalar values`;
|
|
8161
8393
|
}
|
|
@@ -8171,7 +8403,7 @@ function isEnumSelectType(type) {
|
|
|
8171
8403
|
return /enum_select/.test(type);
|
|
8172
8404
|
}
|
|
8173
8405
|
function optionComparableValue(value) {
|
|
8174
|
-
if (
|
|
8406
|
+
if (isRecord7(value) && ("value" in value || "label" in value)) {
|
|
8175
8407
|
return value.value ?? value.label;
|
|
8176
8408
|
}
|
|
8177
8409
|
return value;
|
|
@@ -8185,7 +8417,7 @@ function validateType(field, value) {
|
|
|
8185
8417
|
if (!Array.isArray(value)) {
|
|
8186
8418
|
return `${field.key} must be a JSON array of row objects`;
|
|
8187
8419
|
}
|
|
8188
|
-
const invalidRowIndex = value.findIndex((row) => !
|
|
8420
|
+
const invalidRowIndex = value.findIndex((row) => !isRecord7(row));
|
|
8189
8421
|
return invalidRowIndex >= 0 ? `${field.key}[${invalidRowIndex}] must be a row object` : null;
|
|
8190
8422
|
}
|
|
8191
8423
|
const selectorError = validateComplexSelector(field, value);
|
|
@@ -8211,7 +8443,7 @@ function validateType(field, value) {
|
|
|
8211
8443
|
if (/(array|multi|multiple)/.test(type) && !Array.isArray(value)) {
|
|
8212
8444
|
return `${field.key} must be an array`;
|
|
8213
8445
|
}
|
|
8214
|
-
if (isEnumSelectType(type) &&
|
|
8446
|
+
if (isEnumSelectType(type) && isRecord7(value)) {
|
|
8215
8447
|
const optionValue2 = value.value ?? value.label;
|
|
8216
8448
|
return typeof optionValue2 === "string" || typeof optionValue2 === "number" ? null : `${field.key} must be an enum option object with a scalar value`;
|
|
8217
8449
|
}
|
|
@@ -8241,7 +8473,7 @@ function validateFormEntries(form, fields, prefix = "") {
|
|
|
8241
8473
|
}
|
|
8242
8474
|
if (isSubFormField(field) && Array.isArray(value) && field.children?.length) {
|
|
8243
8475
|
for (const [index, row] of value.entries()) {
|
|
8244
|
-
if (
|
|
8476
|
+
if (isRecord7(row)) {
|
|
8245
8477
|
errors.push(...validateFormEntries(row, field.children, `${prefix}${field.key}[${index}].`));
|
|
8246
8478
|
}
|
|
8247
8479
|
}
|
|
@@ -8464,15 +8696,15 @@ async function promptProjectCreateForm(input) {
|
|
|
8464
8696
|
}
|
|
8465
8697
|
|
|
8466
8698
|
// src/core/project-form.ts
|
|
8467
|
-
function
|
|
8699
|
+
function isRecord8(value) {
|
|
8468
8700
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8469
8701
|
}
|
|
8470
8702
|
function clone(value) {
|
|
8471
8703
|
return JSON.parse(JSON.stringify(value));
|
|
8472
8704
|
}
|
|
8473
8705
|
function getFlowFormTemplateId(flowDetail) {
|
|
8474
|
-
const data =
|
|
8475
|
-
const meta =
|
|
8706
|
+
const data = isRecord8(flowDetail?.data) ? flowDetail.data : void 0;
|
|
8707
|
+
const meta = isRecord8(data?.meta) ? data.meta : void 0;
|
|
8476
8708
|
const templateId = meta?.form_template;
|
|
8477
8709
|
if (typeof templateId === "number" && Number.isFinite(templateId)) {
|
|
8478
8710
|
return templateId;
|
|
@@ -8497,7 +8729,7 @@ function hasAutoInitLambda(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
8497
8729
|
if (Array.isArray(value)) {
|
|
8498
8730
|
return value.some((item) => hasAutoInitLambda(item, seen));
|
|
8499
8731
|
}
|
|
8500
|
-
if (!
|
|
8732
|
+
if (!isRecord8(value)) {
|
|
8501
8733
|
return false;
|
|
8502
8734
|
}
|
|
8503
8735
|
if (seen.has(value)) {
|
|
@@ -8512,14 +8744,14 @@ function hasAutoInitLambda(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
8512
8744
|
function setControlValue(control, value) {
|
|
8513
8745
|
const next = clone(control);
|
|
8514
8746
|
next.value = {
|
|
8515
|
-
...
|
|
8747
|
+
...isRecord8(next.value) ? next.value : {},
|
|
8516
8748
|
type: next.value?.type ?? next.field_type,
|
|
8517
8749
|
value
|
|
8518
8750
|
};
|
|
8519
8751
|
return next;
|
|
8520
8752
|
}
|
|
8521
8753
|
function applyRowValues(rowTemplate, rowValue) {
|
|
8522
|
-
const source =
|
|
8754
|
+
const source = isRecord8(rowValue) ? rowValue : {};
|
|
8523
8755
|
return rowTemplate.map((control) => {
|
|
8524
8756
|
if (control.key && Object.prototype.hasOwnProperty.call(source, control.key)) {
|
|
8525
8757
|
return setControlValue(control, source[control.key]);
|
|
@@ -8581,6 +8813,12 @@ async function parseProjectJson(input, label = "--json") {
|
|
|
8581
8813
|
}
|
|
8582
8814
|
return parseJsonInput(input, label);
|
|
8583
8815
|
}
|
|
8816
|
+
function errorMessage2(error) {
|
|
8817
|
+
return error instanceof Error ? error.message : String(error || "");
|
|
8818
|
+
}
|
|
8819
|
+
function isUnsupportedPrefillStatusError(message) {
|
|
8820
|
+
return /(^|[^0-9])404([^0-9]|$)/.test(message) || /not found/i.test(message) || /unsupported/i.test(message) || /Cannot GET \/api\/project_staging\/prefill/i.test(message);
|
|
8821
|
+
}
|
|
8584
8822
|
async function resolveFlowIdentifiers(client, options, resolveOptions = {}) {
|
|
8585
8823
|
if (options.flowType) {
|
|
8586
8824
|
const flowKey = options.flowKey ?? "";
|
|
@@ -8802,8 +9040,8 @@ function fieldsForValidation(flowDetail, projectFormTemplate) {
|
|
|
8802
9040
|
}));
|
|
8803
9041
|
}
|
|
8804
9042
|
function metaUsesTemplateProjectName(flowDetail) {
|
|
8805
|
-
const data =
|
|
8806
|
-
const meta =
|
|
9043
|
+
const data = isRecord9(flowDetail?.data) ? flowDetail.data : void 0;
|
|
9044
|
+
const meta = isRecord9(data?.meta) ? data.meta : void 0;
|
|
8807
9045
|
const hideFields = Array.isArray(meta?.hide_fields) ? meta.hide_fields.map(String) : [];
|
|
8808
9046
|
return meta?.use_template_project_name === true || hideFields.includes("project.name");
|
|
8809
9047
|
}
|
|
@@ -8893,7 +9131,7 @@ function collectPrefillContextForFields(fields, form, result, options = {}) {
|
|
|
8893
9131
|
result.filled_fields.push(contextField(field, "prefilled", fieldOptions));
|
|
8894
9132
|
if (isSubFormField(field) && Array.isArray(value) && field.children?.length) {
|
|
8895
9133
|
value.forEach((row, index) => {
|
|
8896
|
-
if (
|
|
9134
|
+
if (isRecord9(row)) {
|
|
8897
9135
|
collectPrefillContextForFields(field.children ?? [], row, result, {
|
|
8898
9136
|
prefix: `${field.key}[${index}]`,
|
|
8899
9137
|
rootKey: field.key,
|
|
@@ -8920,7 +9158,7 @@ function buildPrefillContext(fields, form) {
|
|
|
8920
9158
|
}
|
|
8921
9159
|
};
|
|
8922
9160
|
}
|
|
8923
|
-
function
|
|
9161
|
+
function isRecord9(value) {
|
|
8924
9162
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8925
9163
|
}
|
|
8926
9164
|
function isEndedStep(step) {
|
|
@@ -8943,7 +9181,7 @@ function stepIdOf(step) {
|
|
|
8943
9181
|
function pickStepFormPayload(step) {
|
|
8944
9182
|
const formList = Array.isArray(step.formList) ? step.formList : [];
|
|
8945
9183
|
const forms = Array.isArray(step.forms) ? step.forms : [];
|
|
8946
|
-
const metaForm =
|
|
9184
|
+
const metaForm = isRecord9(step.metaForm) ? step.metaForm : void 0;
|
|
8947
9185
|
return {
|
|
8948
9186
|
step_id: step.id,
|
|
8949
9187
|
flow_step_id: step.flow_step_id,
|
|
@@ -8960,7 +9198,7 @@ function pickStepFormPayload(step) {
|
|
|
8960
9198
|
}
|
|
8961
9199
|
async function buildApprovalContext(client, projectId, options) {
|
|
8962
9200
|
const projectDetail = await apiRequest(client, "GET", `/project/${projectId}`);
|
|
8963
|
-
const steps = Array.isArray(projectDetail.steps) ? projectDetail.steps.filter(
|
|
9201
|
+
const steps = Array.isArray(projectDetail.steps) ? projectDetail.steps.filter(isRecord9) : [];
|
|
8964
9202
|
const targetStepIds = /* @__PURE__ */ new Set();
|
|
8965
9203
|
for (const step of steps) {
|
|
8966
9204
|
const id = stepIdOf(step);
|
|
@@ -8986,7 +9224,7 @@ async function buildApprovalContext(client, projectId, options) {
|
|
|
8986
9224
|
}
|
|
8987
9225
|
return {
|
|
8988
9226
|
project: projectDetail,
|
|
8989
|
-
project_form:
|
|
9227
|
+
project_form: isRecord9(projectDetail.metaForm) ? projectDetail.metaForm : null,
|
|
8990
9228
|
inspected_step_count: stepForms.length,
|
|
8991
9229
|
step_forms: stepForms,
|
|
8992
9230
|
failed_steps: failedSteps
|
|
@@ -9042,13 +9280,14 @@ function registerProjectCommands(program2) {
|
|
|
9042
9280
|
);
|
|
9043
9281
|
printResult(options.format, attachProjectDetailUrl(profile, result));
|
|
9044
9282
|
});
|
|
9045
|
-
project.command("my-step").description("List my pending project steps").option("--profile <profile>", "Profile name").option("--finished <finished>", "Finished flag", "0").option("--flow-type <flowType>", "Flow type filter").option("--flow-key <flowKey>", "Flow key filter").option("--key-of-flow-node <keyOfFlowNode>", "Flow/node filter, e.g. flow_type:flow_key or flow_type:flow_key:node_id").option("--flow-step-id <flowStepId>", "Flow node id filter").option("--page <page>", "Page number", "1").option("--page-size <pageSize>", "Page size", "20").option("--format <format>", "Output format", "table").action(async (options) => {
|
|
9283
|
+
project.command("my-step").description("List my pending project steps").option("--profile <profile>", "Profile name").option("--finished <finished>", "Finished flag", "0").option("--flow-type <flowType>", "Flow type filter").option("--flow-key <flowKey>", "Flow key filter").option("--key-of-flow-node <keyOfFlowNode>", "Flow/node filter, e.g. flow_type:flow_key or flow_type:flow_key:node_id").option("--flow-step-id <flowStepId>", "Flow node id filter").option("--workspace <workspace>", "Workspace filter, defaults to the active profile workspace").option("--page <page>", "Page number", "1").option("--page-size <pageSize>", "Page size", "20").option("--format <format>", "Output format", "table").action(async (options) => {
|
|
9046
9284
|
const config = await loadConfig();
|
|
9047
9285
|
const profile = resolveProfile(config, options.profile);
|
|
9048
9286
|
const params = {
|
|
9049
9287
|
finished: options.finished,
|
|
9050
9288
|
page: Number(options.page),
|
|
9051
|
-
page_size: Number(options.pageSize)
|
|
9289
|
+
page_size: Number(options.pageSize),
|
|
9290
|
+
$workspace: normalizeWorkspaceForApi(options.workspace ?? profile.config.workspace)
|
|
9052
9291
|
};
|
|
9053
9292
|
if (options.flowType) {
|
|
9054
9293
|
params.flow_type = options.flowType;
|
|
@@ -9083,7 +9322,44 @@ function registerProjectCommands(program2) {
|
|
|
9083
9322
|
project: attachProjectDetailUrl(profile, context.project)
|
|
9084
9323
|
});
|
|
9085
9324
|
});
|
|
9086
|
-
|
|
9325
|
+
const handoff = project.command("handoff").description("Inspect BPMAX project create-page handoff state");
|
|
9326
|
+
handoff.command("status").description("Check whether a create-page prefill token is still readable by the platform").requiredOption("--prefill-token <token>", "Prefill token returned by project create handoff output").option("--profile <profile>", "Profile name").option("--format <format>", "Output format", "pretty").action(async (options) => {
|
|
9327
|
+
const config = await loadConfig();
|
|
9328
|
+
const profile = resolveProfile(config, options.profile);
|
|
9329
|
+
const client = createApiClient(profile);
|
|
9330
|
+
const token = options.prefillToken.trim();
|
|
9331
|
+
if (!token) {
|
|
9332
|
+
throw new Error("--prefill-token cannot be empty.");
|
|
9333
|
+
}
|
|
9334
|
+
try {
|
|
9335
|
+
const result = await apiRequest(
|
|
9336
|
+
client,
|
|
9337
|
+
"GET",
|
|
9338
|
+
`/project_staging/prefill/${encodeURIComponent(token)}`
|
|
9339
|
+
);
|
|
9340
|
+
printResult(options.format, {
|
|
9341
|
+
ok: true,
|
|
9342
|
+
prefill_token: token,
|
|
9343
|
+
supported: true,
|
|
9344
|
+
browser_verified: false,
|
|
9345
|
+
result,
|
|
9346
|
+
next_action: "Token lookup only proves the prefill payload is readable; open the returned handoff URL in a real browser page before claiming creation succeeded."
|
|
9347
|
+
});
|
|
9348
|
+
} catch (error) {
|
|
9349
|
+
const message = errorMessage2(error);
|
|
9350
|
+
if (!isUnsupportedPrefillStatusError(message)) {
|
|
9351
|
+
throw error;
|
|
9352
|
+
}
|
|
9353
|
+
printResult(options.format, {
|
|
9354
|
+
ok: false,
|
|
9355
|
+
prefill_token: token,
|
|
9356
|
+
supported: false,
|
|
9357
|
+
error: message,
|
|
9358
|
+
next_action: "If this platform does not expose prefill token status, verify the returned handoff URL in a real browser page before claiming creation succeeded."
|
|
9359
|
+
});
|
|
9360
|
+
}
|
|
9361
|
+
});
|
|
9362
|
+
project.command("create").description("Minimal project create shortcut").option("--profile <profile>", "Profile name").option("--flow-id <flowId>", "Flow id").option("--flow-type <flowType>", "Flow type").option("--flow-key <flowKey>", "Flow key", "").option("--name <name>", "Project name").option("--json <json>", "Additional request JSON").option("--body <body>", "Full request body JSON override").option("--unsafe-direct-create", "Allow raw --body direct project creation without form-template safety checks").option("--interactive", "Guide the user through filling project form fields").option("--no-interactive", "Disable the project create guide and submit directly when safe").option("--allow-form-handoff", "Allow interactive mode to hand off to the BPMAX web create form").option("--handoff-only", "Return a prefilled BPMAX create-page handoff URL without prompting or direct project creation").option("--skip-form-validation", "Skip local form schema validation before submit").option("--format <format>", "Output format", "pretty").action(async (options, command) => {
|
|
9087
9363
|
const interactiveSource = command.getOptionValueSource("interactive");
|
|
9088
9364
|
if (options.body && options.interactive === true && interactiveSource === "cli") {
|
|
9089
9365
|
throw new Error("--body and --interactive cannot be used together.");
|
|
@@ -9118,6 +9394,19 @@ function registerProjectCommands(program2) {
|
|
|
9118
9394
|
return projectFormTemplate;
|
|
9119
9395
|
};
|
|
9120
9396
|
const usesTemplateProjectName = metaUsesTemplateProjectName(flowDetail);
|
|
9397
|
+
if (options.handoffOnly) {
|
|
9398
|
+
projectFormTemplate = await loadProjectFormTemplate();
|
|
9399
|
+
const handoffFields2 = fieldsForValidation(flowDetail, projectFormTemplate);
|
|
9400
|
+
assertHandoffFormCompatible(handoffFields2, form);
|
|
9401
|
+
await printCreateFormHandoff(client, options.format, profile, flowIdentifiers, {
|
|
9402
|
+
name: name ?? "",
|
|
9403
|
+
form,
|
|
9404
|
+
fields: handoffFields2,
|
|
9405
|
+
reason: "handoff_only",
|
|
9406
|
+
message: "\u5DF2\u751F\u6210 BPMAX \u521B\u5EFA\u9875\u94FE\u63A5\uFF0C\u8BF7\u70B9\u51FB\u7EE7\u7EED\u586B\u5199\u5E76\u63D0\u4EA4\u3002"
|
|
9407
|
+
});
|
|
9408
|
+
return;
|
|
9409
|
+
}
|
|
9121
9410
|
if (useInteractive) {
|
|
9122
9411
|
if (!flowDetail) {
|
|
9123
9412
|
throw new Error("Interactive project creation requires --flow-id so the form schema can be discovered.");
|
|
@@ -9265,7 +9554,7 @@ function getRecipesDir(options) {
|
|
|
9265
9554
|
const workspaceDirName = normalizeWorkspaceForPath(options.workspace || DEFAULT_WORKSPACE);
|
|
9266
9555
|
return path7.join((options.getProfileDir || getProfileDataDir)(options.profileName), "recipes", workspaceDirName);
|
|
9267
9556
|
}
|
|
9268
|
-
function
|
|
9557
|
+
function isRecord10(value) {
|
|
9269
9558
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9270
9559
|
}
|
|
9271
9560
|
function asString(value, fieldName) {
|
|
@@ -9275,7 +9564,7 @@ function asString(value, fieldName) {
|
|
|
9275
9564
|
return value;
|
|
9276
9565
|
}
|
|
9277
9566
|
function parseRecipeDefinition(input) {
|
|
9278
|
-
if (!
|
|
9567
|
+
if (!isRecord10(input)) {
|
|
9279
9568
|
throw new Error("recipe.json must be a JSON object.");
|
|
9280
9569
|
}
|
|
9281
9570
|
if (input.version !== 1) {
|
|
@@ -9283,7 +9572,7 @@ function parseRecipeDefinition(input) {
|
|
|
9283
9572
|
}
|
|
9284
9573
|
const name = asString(input.name, "recipe.name");
|
|
9285
9574
|
assertSafeName("Recipe name", name);
|
|
9286
|
-
if (!
|
|
9575
|
+
if (!isRecord10(input.command)) {
|
|
9287
9576
|
throw new Error("recipe.command must be an object.");
|
|
9288
9577
|
}
|
|
9289
9578
|
const argv = input.command.argv;
|
|
@@ -9291,7 +9580,7 @@ function parseRecipeDefinition(input) {
|
|
|
9291
9580
|
throw new Error("recipe.command.argv must be a non-empty string array.");
|
|
9292
9581
|
}
|
|
9293
9582
|
const variables = Array.isArray(input.variables) ? input.variables.map((item, index) => {
|
|
9294
|
-
if (!
|
|
9583
|
+
if (!isRecord10(item)) {
|
|
9295
9584
|
throw new Error(`recipe.variables[${index}] must be an object.`);
|
|
9296
9585
|
}
|
|
9297
9586
|
const variableName = asString(item.name, `recipe.variables[${index}].name`);
|
|
@@ -9367,7 +9656,7 @@ function parseVarsJson(input) {
|
|
|
9367
9656
|
return {};
|
|
9368
9657
|
}
|
|
9369
9658
|
const parsed = JSON.parse(input);
|
|
9370
|
-
if (!
|
|
9659
|
+
if (!isRecord10(parsed)) {
|
|
9371
9660
|
throw new Error("--vars must be a JSON object.");
|
|
9372
9661
|
}
|
|
9373
9662
|
const variables = {};
|
|
@@ -9866,10 +10155,10 @@ function registerSetupCommand(program2, deps = {}) {
|
|
|
9866
10155
|
}
|
|
9867
10156
|
|
|
9868
10157
|
// src/commands/step.ts
|
|
9869
|
-
function
|
|
10158
|
+
function isRecord11(value) {
|
|
9870
10159
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9871
10160
|
}
|
|
9872
|
-
function
|
|
10161
|
+
function stringValue2(value) {
|
|
9873
10162
|
if (value === void 0 || value === null) {
|
|
9874
10163
|
return void 0;
|
|
9875
10164
|
}
|
|
@@ -9877,7 +10166,7 @@ function stringValue(value) {
|
|
|
9877
10166
|
return next ? next : void 0;
|
|
9878
10167
|
}
|
|
9879
10168
|
function idValue(value) {
|
|
9880
|
-
const next =
|
|
10169
|
+
const next = stringValue2(value);
|
|
9881
10170
|
return next && /^\d+$/.test(next) ? next : void 0;
|
|
9882
10171
|
}
|
|
9883
10172
|
function hasMeaningfulValue(value) {
|
|
@@ -9893,7 +10182,7 @@ function hasMeaningfulValue(value) {
|
|
|
9893
10182
|
if (Array.isArray(value)) {
|
|
9894
10183
|
return value.some(hasMeaningfulValue);
|
|
9895
10184
|
}
|
|
9896
|
-
if (
|
|
10185
|
+
if (isRecord11(value)) {
|
|
9897
10186
|
return Object.values(value).some(hasMeaningfulValue);
|
|
9898
10187
|
}
|
|
9899
10188
|
return false;
|
|
@@ -9902,11 +10191,11 @@ function isEmptyValue2(value) {
|
|
|
9902
10191
|
return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
|
|
9903
10192
|
}
|
|
9904
10193
|
function projectIdOfStep(step) {
|
|
9905
|
-
const nestedProjectId =
|
|
10194
|
+
const nestedProjectId = isRecord11(step.project) ? step.project.id : void 0;
|
|
9906
10195
|
return idValue(step.project_id ?? step.projectId ?? nestedProjectId);
|
|
9907
10196
|
}
|
|
9908
10197
|
function stepFlowNodeId(step) {
|
|
9909
|
-
return
|
|
10198
|
+
return stringValue2(step.flow_step_id ?? step.flowStepId ?? step.flow_node_id ?? step.flowNodeId);
|
|
9910
10199
|
}
|
|
9911
10200
|
function isStepFinished(step) {
|
|
9912
10201
|
if (step.real_end_time || step.end_time) {
|
|
@@ -9930,18 +10219,18 @@ function collectRecords(value, output = [], seen = /* @__PURE__ */ new Set()) {
|
|
|
9930
10219
|
value.forEach((item) => collectRecords(item, output, seen));
|
|
9931
10220
|
return output;
|
|
9932
10221
|
}
|
|
9933
|
-
if (!
|
|
10222
|
+
if (!isRecord11(value)) {
|
|
9934
10223
|
return output;
|
|
9935
10224
|
}
|
|
9936
10225
|
output.push(value);
|
|
9937
10226
|
for (const child of Object.values(value)) {
|
|
9938
|
-
if (Array.isArray(child) ||
|
|
10227
|
+
if (Array.isArray(child) || isRecord11(child)) {
|
|
9939
10228
|
collectRecords(child, output, seen);
|
|
9940
10229
|
}
|
|
9941
10230
|
}
|
|
9942
10231
|
return output;
|
|
9943
10232
|
}
|
|
9944
|
-
function
|
|
10233
|
+
function findFlowNode2(project, step) {
|
|
9945
10234
|
const flowStepId = stepFlowNodeId(step);
|
|
9946
10235
|
if (!flowStepId) {
|
|
9947
10236
|
return null;
|
|
@@ -9957,7 +10246,7 @@ function findFlowNode(project, step) {
|
|
|
9957
10246
|
project.config
|
|
9958
10247
|
];
|
|
9959
10248
|
for (const candidate of candidates) {
|
|
9960
|
-
const match = collectRecords(candidate).find((item) =>
|
|
10249
|
+
const match = collectRecords(candidate).find((item) => stringValue2(item.id) === flowStepId);
|
|
9961
10250
|
if (match) {
|
|
9962
10251
|
return match;
|
|
9963
10252
|
}
|
|
@@ -10019,7 +10308,7 @@ function formListOfStep(step) {
|
|
|
10019
10308
|
return values.filter(hasMeaningfulValue);
|
|
10020
10309
|
}
|
|
10021
10310
|
function unwrapFormValue(value) {
|
|
10022
|
-
if (!
|
|
10311
|
+
if (!isRecord11(value)) {
|
|
10023
10312
|
return value;
|
|
10024
10313
|
}
|
|
10025
10314
|
if ("value" in value && Object.keys(value).length <= 3) {
|
|
@@ -10036,10 +10325,10 @@ function collectFormValues(value, output = {}, seen = /* @__PURE__ */ new Set())
|
|
|
10036
10325
|
value.forEach((item) => collectFormValues(item, output, seen));
|
|
10037
10326
|
return output;
|
|
10038
10327
|
}
|
|
10039
|
-
if (!
|
|
10328
|
+
if (!isRecord11(value)) {
|
|
10040
10329
|
return output;
|
|
10041
10330
|
}
|
|
10042
|
-
const key =
|
|
10331
|
+
const key = stringValue2(value.key ?? value.field_key ?? value.fieldKey ?? value.name);
|
|
10043
10332
|
if (key && "value" in value) {
|
|
10044
10333
|
const nextValue = unwrapFormValue(value.value);
|
|
10045
10334
|
if (hasMeaningfulValue(nextValue)) {
|
|
@@ -10047,7 +10336,7 @@ function collectFormValues(value, output = {}, seen = /* @__PURE__ */ new Set())
|
|
|
10047
10336
|
}
|
|
10048
10337
|
}
|
|
10049
10338
|
for (const child of Object.values(value)) {
|
|
10050
|
-
if (Array.isArray(child) ||
|
|
10339
|
+
if (Array.isArray(child) || isRecord11(child)) {
|
|
10051
10340
|
collectFormValues(child, output, seen);
|
|
10052
10341
|
}
|
|
10053
10342
|
}
|
|
@@ -10094,7 +10383,7 @@ function collectMissingRequiredInputs(fields, values) {
|
|
|
10094
10383
|
continue;
|
|
10095
10384
|
}
|
|
10096
10385
|
value.forEach((row, index) => {
|
|
10097
|
-
if (!
|
|
10386
|
+
if (!isRecord11(row)) {
|
|
10098
10387
|
return;
|
|
10099
10388
|
}
|
|
10100
10389
|
for (const child of field.children ?? []) {
|
|
@@ -10149,7 +10438,7 @@ function ownerIdsFromStep(step) {
|
|
|
10149
10438
|
];
|
|
10150
10439
|
const ids = /* @__PURE__ */ new Set();
|
|
10151
10440
|
for (const owner of owners) {
|
|
10152
|
-
if (
|
|
10441
|
+
if (isRecord11(owner)) {
|
|
10153
10442
|
const id = idValue(owner.owner_id ?? owner.user_id ?? owner.id);
|
|
10154
10443
|
if (id) {
|
|
10155
10444
|
ids.add(id);
|
|
@@ -10163,6 +10452,47 @@ function ownerIdsFromStep(step) {
|
|
|
10163
10452
|
}
|
|
10164
10453
|
return [...ids];
|
|
10165
10454
|
}
|
|
10455
|
+
function ownerDiagnosticsFromStep(step, currentUser) {
|
|
10456
|
+
const sources = [
|
|
10457
|
+
{ source: "owner_id", value: step.owner_id },
|
|
10458
|
+
{ source: "ownerId", value: step.ownerId },
|
|
10459
|
+
{ source: "user_id", value: step.user_id },
|
|
10460
|
+
{ source: "userId", value: step.userId },
|
|
10461
|
+
{ source: "owners", value: step.owners },
|
|
10462
|
+
{ source: "owner_list", value: step.owner_list },
|
|
10463
|
+
{ source: "step_owners", value: step.step_owners }
|
|
10464
|
+
];
|
|
10465
|
+
const ownerIds = /* @__PURE__ */ new Set();
|
|
10466
|
+
const ownerSources = /* @__PURE__ */ new Set();
|
|
10467
|
+
const emptyOwnerArrays = [];
|
|
10468
|
+
for (const { source, value } of sources) {
|
|
10469
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
10470
|
+
emptyOwnerArrays.push(source);
|
|
10471
|
+
}
|
|
10472
|
+
const values = Array.isArray(value) ? value : [value];
|
|
10473
|
+
for (const item of values) {
|
|
10474
|
+
let id;
|
|
10475
|
+
if (isRecord11(item)) {
|
|
10476
|
+
id = idValue(item.owner_id ?? item.user_id ?? item.id);
|
|
10477
|
+
} else {
|
|
10478
|
+
id = idValue(item);
|
|
10479
|
+
}
|
|
10480
|
+
if (id) {
|
|
10481
|
+
ownerIds.add(id);
|
|
10482
|
+
ownerSources.add(source);
|
|
10483
|
+
}
|
|
10484
|
+
}
|
|
10485
|
+
}
|
|
10486
|
+
const currentUserId = currentUser ? idValue(currentUser.id ?? currentUser.user_id ?? currentUser.owner_id) : void 0;
|
|
10487
|
+
return {
|
|
10488
|
+
explicit_owner_ids: [...ownerIds],
|
|
10489
|
+
owner_sources: [...ownerSources],
|
|
10490
|
+
...currentUserId ? { current_user_id: currentUserId } : {},
|
|
10491
|
+
current_user_matched_explicit_owner: currentUserId ? ownerIds.has(currentUserId) : null,
|
|
10492
|
+
empty_owner_arrays: emptyOwnerArrays,
|
|
10493
|
+
...ownerIds.size === 0 ? { note: "No explicit step owner ids were returned; processability may come from admin fallback, permission fallback, or unresolved matrix owner behavior." } : {}
|
|
10494
|
+
};
|
|
10495
|
+
}
|
|
10166
10496
|
function checkCurrentUserCanProcess(step, currentUser) {
|
|
10167
10497
|
const ownerIds = ownerIdsFromStep(step);
|
|
10168
10498
|
if (ownerIds.length === 0) {
|
|
@@ -10193,11 +10523,12 @@ async function buildStepContext(profile, client, stepId, projectId) {
|
|
|
10193
10523
|
if (actualProjectId && actualProjectId !== projectId) {
|
|
10194
10524
|
throw new Error(`Step ${stepId} belongs to project ${actualProjectId}, not project ${projectId}.`);
|
|
10195
10525
|
}
|
|
10196
|
-
const flowNode =
|
|
10526
|
+
const flowNode = findFlowNode2(project, step);
|
|
10197
10527
|
const formSummary = buildFormSummary(project, step);
|
|
10198
10528
|
const requirements = buildStepRequirements(step, flowNode);
|
|
10199
10529
|
const identityUnverified = !formSummary.has_identity_evidence;
|
|
10200
10530
|
const userCheck = checkCurrentUserCanProcess(step, currentUser);
|
|
10531
|
+
const ownerDiagnostics = ownerDiagnosticsFromStep(step, currentUser);
|
|
10201
10532
|
const stepFinished = isStepFinished(step);
|
|
10202
10533
|
const riskWarnings = [];
|
|
10203
10534
|
if (identityUnverified) {
|
|
@@ -10222,6 +10553,7 @@ async function buildStepContext(profile, client, stepId, projectId) {
|
|
|
10222
10553
|
url: buildBpmaxUrl(profile, "project-step", { projectId, stepId }).url,
|
|
10223
10554
|
current_user: currentUser,
|
|
10224
10555
|
...userCheck,
|
|
10556
|
+
owner_diagnostics: ownerDiagnostics,
|
|
10225
10557
|
step_finished: stepFinished,
|
|
10226
10558
|
form_summary: formSummary,
|
|
10227
10559
|
requirements,
|
|
@@ -10252,12 +10584,12 @@ function extractSubmitInputValues(data) {
|
|
|
10252
10584
|
const candidates = [data.form, data.form_data, data.formData, data.fields, data.values];
|
|
10253
10585
|
const values = {};
|
|
10254
10586
|
for (const candidate of candidates) {
|
|
10255
|
-
if (
|
|
10587
|
+
if (isRecord11(candidate)) {
|
|
10256
10588
|
Object.assign(values, candidate);
|
|
10257
10589
|
}
|
|
10258
10590
|
}
|
|
10259
10591
|
for (const [key, value] of Object.entries(data)) {
|
|
10260
|
-
if (!SUBMIT_NON_FORM_KEYS.has(key) && !
|
|
10592
|
+
if (!SUBMIT_NON_FORM_KEYS.has(key) && !isRecord11(value) && !Array.isArray(value)) {
|
|
10261
10593
|
values[key] = value;
|
|
10262
10594
|
}
|
|
10263
10595
|
}
|
|
@@ -10392,6 +10724,8 @@ var REQUIRED_TASKBOOK_TERMS = [
|
|
|
10392
10724
|
"\u5BF9\u8C61\u9501\u8868",
|
|
10393
10725
|
"AI \u6700\u5C0F\u4EFB\u52A1\u5355\u5143",
|
|
10394
10726
|
"\u9A8C\u6536\u95E8\u7981",
|
|
10727
|
+
"\u5BFC\u822A\u5165\u53E3\u7B56\u7565",
|
|
10728
|
+
"\u5217\u8868 lint",
|
|
10395
10729
|
"\u505C\u673A\u70B9",
|
|
10396
10730
|
"\u5BF9\u8C61\u9501\u91CD\u590D",
|
|
10397
10731
|
"\u53EA\u8BFB\u4EFB\u52A1",
|
|
@@ -10425,6 +10759,8 @@ var PROMPT_REQUIRED_TERMS = [
|
|
|
10425
10759
|
"\u8F93\u5165\u4F9D\u8D56",
|
|
10426
10760
|
"\u8F93\u51FA\u7269",
|
|
10427
10761
|
"\u9A8C\u6536\u65B9\u5F0F",
|
|
10762
|
+
"\u5BFC\u822A\u5165\u53E3\u7B56\u7565",
|
|
10763
|
+
"\u5217\u8868 lint",
|
|
10428
10764
|
"\u8FDB\u5EA6 CSV"
|
|
10429
10765
|
];
|
|
10430
10766
|
var BPMAX_SKILL_PATTERN = /bpmax-[a-z0-9-]+|form-control-library|bpmax-memory-protocol/;
|
|
@@ -10460,6 +10796,75 @@ function uniqueErrors(errors) {
|
|
|
10460
10796
|
function missingTermErrors(text5, terms, prefix) {
|
|
10461
10797
|
return terms.filter((term) => !text5.includes(term)).map((term) => `${prefix}: ${term}`);
|
|
10462
10798
|
}
|
|
10799
|
+
function findNavigationStrategy(text5) {
|
|
10800
|
+
const matches = [...text5.matchAll(/导航入口策略\s*[::]\s*(nav-config:(?:included|skipped:[^\s|,。]+|deferred:[^\s|,。]+))/gi)];
|
|
10801
|
+
return matches.at(-1)?.[1] || null;
|
|
10802
|
+
}
|
|
10803
|
+
function validateNavigationStrategy(text5, errors, prefix = "") {
|
|
10804
|
+
const strategy = findNavigationStrategy(text5);
|
|
10805
|
+
if (!strategy) {
|
|
10806
|
+
errors.push(`${prefix}missing concrete navigation strategy: use \u5BFC\u822A\u5165\u53E3\u7B56\u7565\uFF1Anav-config:included, nav-config:skipped:<reason>, or nav-config:deferred:<reason>`);
|
|
10807
|
+
return null;
|
|
10808
|
+
}
|
|
10809
|
+
if (/nav-config:(skipped|deferred):$/i.test(strategy)) {
|
|
10810
|
+
errors.push(`${prefix}navigation strategy requires a non-empty reason when skipped or deferred.`);
|
|
10811
|
+
}
|
|
10812
|
+
if (/(待完成范围确认后回填|待确认|TODO|TBD|占位)/i.test(strategy)) {
|
|
10813
|
+
errors.push(`${prefix}navigation strategy is still a placeholder; replace it with included, skipped:<real reason>, or deferred:<real reason>.`);
|
|
10814
|
+
}
|
|
10815
|
+
return strategy;
|
|
10816
|
+
}
|
|
10817
|
+
function promptObjectLockText(text5) {
|
|
10818
|
+
const match = text5.match(/(?:^|\n)\s*对象锁\s*[::]\s*([^\n]+)/);
|
|
10819
|
+
return match?.[1] || "";
|
|
10820
|
+
}
|
|
10821
|
+
function hasStrongListEvidence(value) {
|
|
10822
|
+
return /bpmax-cli config list-template lint/.test(value) && /(真实列表页|浏览器|runtime|E2E|渲染)/i.test(value);
|
|
10823
|
+
}
|
|
10824
|
+
function validateTaskbookNavigationAndListGates(text5, errors) {
|
|
10825
|
+
const strategy = validateNavigationStrategy(text5, errors);
|
|
10826
|
+
const rows = extractTaskRows(text5);
|
|
10827
|
+
const navRows = rows.filter((row) => /bpmax-nav-config-editor/.test(row.required_skills || ""));
|
|
10828
|
+
const listRows = rows.filter((row) => /bpmax-list-template-editor/.test(row.required_skills || ""));
|
|
10829
|
+
if (strategy === "nav-config:included" && navRows.length === 0) {
|
|
10830
|
+
errors.push("navigation strategy is included but AI task table has no bpmax-nav-config-editor task.");
|
|
10831
|
+
}
|
|
10832
|
+
navRows.forEach((row) => {
|
|
10833
|
+
if (!/nav-config:[A-Za-z0-9_-]+/.test(row.object_lock || "")) {
|
|
10834
|
+
errors.push(`navigation task ${row.task_id || "<unknown>"} must use object_lock nav-config:<workspace>.`);
|
|
10835
|
+
}
|
|
10836
|
+
if (!/(入口|导航).*(浏览器|点击|打开|可见|readback|回读)/i.test(row.evidence || "")) {
|
|
10837
|
+
errors.push(`navigation task ${row.task_id || "<unknown>"} evidence must include readback and browser navigation-entry proof.`);
|
|
10838
|
+
}
|
|
10839
|
+
});
|
|
10840
|
+
listRows.forEach((row) => {
|
|
10841
|
+
if (!/list-template:(?:\d+|new-[A-Za-z0-9_-]+)/.test(row.object_lock || "")) {
|
|
10842
|
+
errors.push(`list-template task ${row.task_id || "<unknown>"} must use object_lock list-template:<id> or list-template:new-<name>.`);
|
|
10843
|
+
}
|
|
10844
|
+
if (!hasStrongListEvidence(row.evidence || "")) {
|
|
10845
|
+
errors.push(`list-template task ${row.task_id || "<unknown>"} evidence must include bpmax-cli config list-template lint and real browser list-page verification.`);
|
|
10846
|
+
}
|
|
10847
|
+
});
|
|
10848
|
+
}
|
|
10849
|
+
function validatePromptNavigationAndListGates(text5, errors) {
|
|
10850
|
+
const strategy = validateNavigationStrategy(text5, errors, "prompt ");
|
|
10851
|
+
const hasNavSkill = /bpmax-nav-config-editor/.test(text5);
|
|
10852
|
+
const objectLock = promptObjectLockText(text5);
|
|
10853
|
+
if ((strategy === "nav-config:included" || hasNavSkill) && !/nav-config:[A-Za-z0-9_-]+/.test(objectLock)) {
|
|
10854
|
+
errors.push("prompt navigation work must include object lock nav-config:<workspace>.");
|
|
10855
|
+
}
|
|
10856
|
+
if ((strategy === "nav-config:included" || hasNavSkill) && !/(入口|导航).*(浏览器|点击|打开|可见|readback|回读)/i.test(text5)) {
|
|
10857
|
+
errors.push("prompt navigation work must require readback and browser navigation-entry proof.");
|
|
10858
|
+
}
|
|
10859
|
+
if (/bpmax-list-template-editor/.test(text5)) {
|
|
10860
|
+
if (!/list-template:(?:\d+|new-[A-Za-z0-9_-]+)/.test(objectLock)) {
|
|
10861
|
+
errors.push("prompt list-template work must include object lock list-template:<id> or list-template:new-<name>.");
|
|
10862
|
+
}
|
|
10863
|
+
if (!hasStrongListEvidence(text5)) {
|
|
10864
|
+
errors.push("prompt list-template work must include bpmax-cli config list-template lint and real browser list-page verification.");
|
|
10865
|
+
}
|
|
10866
|
+
}
|
|
10867
|
+
}
|
|
10463
10868
|
async function lintTaskbook(file, options = {}) {
|
|
10464
10869
|
const text5 = await readTaskbookText(file);
|
|
10465
10870
|
const errors = [
|
|
@@ -10476,6 +10881,7 @@ async function lintTaskbook(file, options = {}) {
|
|
|
10476
10881
|
}
|
|
10477
10882
|
errors.push(...uuidErrors(text5, "taskbooks"));
|
|
10478
10883
|
errors.push(...missingTermErrors(text5, SUBAGENT_TERMS, "missing subagent rule term"));
|
|
10884
|
+
validateTaskbookNavigationAndListGates(text5, errors);
|
|
10479
10885
|
for (const match of text5.matchAll(FLOW_LOCK_PATTERN)) {
|
|
10480
10886
|
const value = match[1] || "";
|
|
10481
10887
|
if (value.startsWith("flow") && /^flow\d+$/.test(value)) {
|
|
@@ -10500,6 +10906,7 @@ async function lintTaskPrompt(file, options = {}) {
|
|
|
10500
10906
|
errors.push("prompt missing BPMAX related skill name in required_skills");
|
|
10501
10907
|
}
|
|
10502
10908
|
errors.push(...uuidErrors(text5, "task prompts"));
|
|
10909
|
+
validatePromptNavigationAndListGates(text5, errors);
|
|
10503
10910
|
for (const term of options.forbidTerms || []) {
|
|
10504
10911
|
if (term && text5.includes(term)) {
|
|
10505
10912
|
errors.push(`prompt forbidden term present: ${term}`);
|
|
@@ -10573,9 +10980,19 @@ function taskbookTemplate(title = "BPMAX AI \u5B9E\u65BD\u7F16\u6392\u4EFB\u52A1
|
|
|
10573
10980
|
"## \u9A8C\u6536\u95E8\u7981",
|
|
10574
10981
|
"",
|
|
10575
10982
|
"- \u914D\u7F6E\u5BF9\u8C61\u7EBF\u4E0A\u56DE\u8BFB\u901A\u8FC7\u3002",
|
|
10983
|
+
"- \u5217\u8868\u6A21\u677F\u5FC5\u987B\u901A\u8FC7 `bpmax-cli config list-template lint`\uFF0C\u5E76\u8986\u76D6\u64CD\u4F5C\u5217\u3001\u8BE6\u60C5\u52A8\u4F5C\u3001\u5220\u9664\u52A8\u4F5C\u3001\u5220\u9664\u53EF\u7528\u6027 guard\u3001icon \u5339\u914D\u548C\u67E5\u8BE2\u5B89\u5168\u3002",
|
|
10984
|
+
"- \u5982\u679C\u914D\u7F6E\u6216\u53D8\u66F4\u4E86\u5BFC\u822A\u5165\u53E3\uFF0C\u5FC5\u987B\u901A\u8FC7 `bpmax-cli config nav-config lint/build/submit` \u95ED\u73AF\uFF0C\u5E76\u5728\u6D4F\u89C8\u5668\u786E\u8BA4\u5165\u53E3\u53EF\u89C1\u4E14\u80FD\u8FDB\u5165\u76EE\u6807\u9875\u9762\u3002",
|
|
10576
10985
|
"- \u6D4F\u89C8\u5668 E2E \u9A8C\u8BC1\u901A\u8FC7\u3002",
|
|
10577
10986
|
"- \u6D4B\u8BD5\u62A5\u544A\u548C\u622A\u56FE\u8BC1\u636E\u5B8C\u6574\u3002",
|
|
10578
10987
|
"",
|
|
10988
|
+
"## \u5BFC\u822A\u5165\u53E3\u7B56\u7565\u4E0E\u5217\u8868 lint",
|
|
10989
|
+
"",
|
|
10990
|
+
"\u5BFC\u822A\u5165\u53E3\u7B56\u7565\uFF1Anav-config:deferred:\u5F85\u5B8C\u6210\u8303\u56F4\u786E\u8BA4\u540E\u56DE\u586B\u3002",
|
|
10991
|
+
"",
|
|
10992
|
+
"- \u6BCF\u4E2A\u5B8C\u6574\u6D41\u7A0B\u914D\u7F6E\u4EFB\u52A1\u90FD\u5FC5\u987B\u58F0\u660E\u5BFC\u822A\u5165\u53E3\u7B56\u7565\uFF1A`nav-config:included`\u3001`nav-config:skipped:<reason>` \u6216 `nav-config:deferred:<reason>`\u3002",
|
|
10993
|
+
"- \u82E5\u5305\u542B\u5BFC\u822A\u914D\u7F6E\uFF0C\u4EFB\u52A1\u4E66\u5FC5\u987B\u6709\u72EC\u7ACB\u4EFB\u52A1\u6216\u9A8C\u6536\u9879\uFF0C`required_skills` \u5305\u542B `bpmax-nav-config-editor`\uFF0C\u5BF9\u8C61\u9501\u4F7F\u7528 `nav-config:<workspace>`\u3002",
|
|
10994
|
+
"- \u82E5\u5305\u542B\u5217\u8868\u914D\u7F6E\uFF0C\u4EFB\u52A1\u4E66\u5FC5\u987B\u6709\u72EC\u7ACB lint/\u9A8C\u6536\u9879\uFF0C`required_skills` \u5305\u542B `bpmax-list-template-editor`\uFF0C\u8BC1\u636E\u5305\u542B list-template lint \u7ED3\u679C\u548C\u771F\u5B9E\u5217\u8868\u9875\u9A8C\u6536\u3002",
|
|
10995
|
+
"",
|
|
10579
10996
|
"## \u505C\u673A\u70B9",
|
|
10580
10997
|
"",
|
|
10581
10998
|
"- \u65E0\u6CD5\u786E\u8BA4\u7EBF\u4E0A\u57FA\u7EBF\u3002",
|
|
@@ -11858,6 +12275,7 @@ async function setupNotices(argv = process.argv) {
|
|
|
11858
12275
|
|
|
11859
12276
|
// src/bin.ts
|
|
11860
12277
|
var program = new Command();
|
|
12278
|
+
program.exitOverride();
|
|
11861
12279
|
function configDirFromArgv(argv) {
|
|
11862
12280
|
const option = "--config-dir";
|
|
11863
12281
|
for (let index = 0; index < argv.length; index += 1) {
|
|
@@ -11871,7 +12289,111 @@ function configDirFromArgv(argv) {
|
|
|
11871
12289
|
}
|
|
11872
12290
|
return void 0;
|
|
11873
12291
|
}
|
|
12292
|
+
function formatFromArgv(argv) {
|
|
12293
|
+
const option = "--format";
|
|
12294
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
12295
|
+
const arg = argv[index];
|
|
12296
|
+
if (arg === option) {
|
|
12297
|
+
return argv[index + 1];
|
|
12298
|
+
}
|
|
12299
|
+
if (arg.startsWith(`${option}=`)) {
|
|
12300
|
+
return arg.slice(option.length + 1);
|
|
12301
|
+
}
|
|
12302
|
+
}
|
|
12303
|
+
return void 0;
|
|
12304
|
+
}
|
|
12305
|
+
var OPTIONS_WITH_VALUES = /* @__PURE__ */ new Set([
|
|
12306
|
+
"--action-key",
|
|
12307
|
+
"--config-dir",
|
|
12308
|
+
"--confirm",
|
|
12309
|
+
"--execution-token",
|
|
12310
|
+
"--format",
|
|
12311
|
+
"--id",
|
|
12312
|
+
"--out",
|
|
12313
|
+
"--payload",
|
|
12314
|
+
"--profile",
|
|
12315
|
+
"--session-key",
|
|
12316
|
+
"--trace-id",
|
|
12317
|
+
"--work-format"
|
|
12318
|
+
]);
|
|
12319
|
+
function commandTokensFromArgv(argv) {
|
|
12320
|
+
const tokens = [];
|
|
12321
|
+
const args = argv.slice(2);
|
|
12322
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
12323
|
+
const arg = args[index];
|
|
12324
|
+
if (arg === "--") {
|
|
12325
|
+
break;
|
|
12326
|
+
}
|
|
12327
|
+
if (arg.startsWith("--")) {
|
|
12328
|
+
const [option] = arg.split("=", 1);
|
|
12329
|
+
if (!arg.includes("=") && OPTIONS_WITH_VALUES.has(option)) {
|
|
12330
|
+
index += 1;
|
|
12331
|
+
}
|
|
12332
|
+
continue;
|
|
12333
|
+
}
|
|
12334
|
+
tokens.push(arg);
|
|
12335
|
+
}
|
|
12336
|
+
return tokens;
|
|
12337
|
+
}
|
|
12338
|
+
function commandDomainFromArgv(argv) {
|
|
12339
|
+
const args = commandTokensFromArgv(argv);
|
|
12340
|
+
if (args[0] === "config" && args[1]) {
|
|
12341
|
+
return args[1];
|
|
12342
|
+
}
|
|
12343
|
+
return args[0];
|
|
12344
|
+
}
|
|
12345
|
+
function commandEndpointHint(argv) {
|
|
12346
|
+
const args = commandTokensFromArgv(argv);
|
|
12347
|
+
if (args[0] === "config" && args[2] === "create" && args[1]) {
|
|
12348
|
+
const endpointByDomain = {
|
|
12349
|
+
"dataset-field": "/data_set_field",
|
|
12350
|
+
dataset: "/data_set",
|
|
12351
|
+
workspace: "/workspace",
|
|
12352
|
+
"form-template": "/form_template",
|
|
12353
|
+
"list-template": "/flow_page_template",
|
|
12354
|
+
"filter-template": "/flow_page_template",
|
|
12355
|
+
"project-detail-template": "/flow_page_template",
|
|
12356
|
+
"console-template": "/flow_page_template"
|
|
12357
|
+
};
|
|
12358
|
+
return endpointByDomain[args[1]];
|
|
12359
|
+
}
|
|
12360
|
+
return void 0;
|
|
12361
|
+
}
|
|
12362
|
+
function printCommandError(error) {
|
|
12363
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
12364
|
+
if (formatFromArgv(process.argv) === "json") {
|
|
12365
|
+
console.log(JSON.stringify({
|
|
12366
|
+
ok: false,
|
|
12367
|
+
error: message,
|
|
12368
|
+
...commandDomainFromArgv(process.argv) ? { domain: commandDomainFromArgv(process.argv) } : {},
|
|
12369
|
+
...commandEndpointHint(process.argv) ? { endpoint: commandEndpointHint(process.argv) } : {}
|
|
12370
|
+
}, null, 2));
|
|
12371
|
+
return;
|
|
12372
|
+
}
|
|
12373
|
+
console.error(message);
|
|
12374
|
+
}
|
|
12375
|
+
function commanderExitCode(error) {
|
|
12376
|
+
if (typeof error === "object" && error !== null && "exitCode" in error && typeof error.exitCode === "number") {
|
|
12377
|
+
return error.exitCode;
|
|
12378
|
+
}
|
|
12379
|
+
return void 0;
|
|
12380
|
+
}
|
|
12381
|
+
function isCommanderDisplayOnlyExit(error) {
|
|
12382
|
+
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
12383
|
+
return false;
|
|
12384
|
+
}
|
|
12385
|
+
const code = error.code;
|
|
12386
|
+
return code === "commander.helpDisplayed" || code === "commander.version";
|
|
12387
|
+
}
|
|
11874
12388
|
program.name(CLI_NAME).description("BPMAX multi-environment CLI").version(VERSION).option("--config-dir <dir>", "Root directory for bpmax-cli local state").option("--execution-token <token>", "Short-lived BPMAX AI execution token").option("--action-key <actionKey>", "AI action key for execution audit").option("--session-key <sessionKey>", "AI conversation session key").option("--trace-id <traceId>", "AI execution trace id");
|
|
12389
|
+
program.configureOutput({
|
|
12390
|
+
writeErr: (str) => {
|
|
12391
|
+
if (formatFromArgv(process.argv) === "json") {
|
|
12392
|
+
return;
|
|
12393
|
+
}
|
|
12394
|
+
process.stderr.write(str);
|
|
12395
|
+
}
|
|
12396
|
+
});
|
|
11875
12397
|
program.hook("preAction", (thisCommand) => {
|
|
11876
12398
|
const options = thisCommand.optsWithGlobals();
|
|
11877
12399
|
setConfigDir(options.configDir);
|
|
@@ -11916,9 +12438,13 @@ registerUpdateCommands(program);
|
|
|
11916
12438
|
var isCompletion = process.argv.includes("completion") || process.argv.includes("__complete");
|
|
11917
12439
|
setConfigDir(configDirFromArgv(process.argv));
|
|
11918
12440
|
(isCompletion ? Promise.resolve() : setupNotices()).then(() => program.parseAsync(process.argv)).catch((error) => {
|
|
12441
|
+
if (isCommanderDisplayOnlyExit(error)) {
|
|
12442
|
+
process.exitCode = commanderExitCode(error) ?? 0;
|
|
12443
|
+
return;
|
|
12444
|
+
}
|
|
11919
12445
|
finishCommandAuditScope("failed", error).catch(() => void 0).finally(() => {
|
|
11920
|
-
|
|
11921
|
-
process.exitCode = 1;
|
|
12446
|
+
printCommandError(error);
|
|
12447
|
+
process.exitCode = commanderExitCode(error) ?? 1;
|
|
11922
12448
|
});
|
|
11923
12449
|
});
|
|
11924
12450
|
//# sourceMappingURL=bin.js.map
|