bpmax-cli 0.1.44-beta.16 → 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 CHANGED
@@ -449,7 +449,7 @@ function normalizePath2(path11) {
449
449
  // package.json
450
450
  var package_default = {
451
451
  name: "bpmax-cli",
452
- version: "0.1.44-beta.16",
452
+ version: "0.1.44-beta.17",
453
453
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
454
454
  type: "module",
455
455
  bin: {
@@ -4812,6 +4812,90 @@ function buildNavConfigSubmitPayload(work, raw, options = {}) {
4812
4812
  all_records: Boolean(options.allRecords)
4813
4813
  };
4814
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
+ }
4815
4899
  async function collectNavConfigAggregate(profile, id) {
4816
4900
  const definition = CONFIG_DOMAINS["nav-config"];
4817
4901
  await ensureConfigCapability(profile, `${definition.capability}.export`);
@@ -5697,6 +5781,9 @@ async function lintConfigWorkFile(file) {
5697
5781
  if ((Object.prototype.hasOwnProperty.call(value, "content") || isRecord3(value.basic)) && pageTemplateType(value) === 1) {
5698
5782
  validateListTemplateActionGate(value, errors);
5699
5783
  }
5784
+ if (value.domain === "nav-config" || Object.prototype.hasOwnProperty.call(value, "configs")) {
5785
+ lintNavConfigWork(value, errors);
5786
+ }
5700
5787
  if (isFlowTemplateWork(value)) {
5701
5788
  const flowWork = value;
5702
5789
  validateFlowTemplateRemoteTemplateRefs(flowWork, errors);
@@ -10637,6 +10724,8 @@ var REQUIRED_TASKBOOK_TERMS = [
10637
10724
  "\u5BF9\u8C61\u9501\u8868",
10638
10725
  "AI \u6700\u5C0F\u4EFB\u52A1\u5355\u5143",
10639
10726
  "\u9A8C\u6536\u95E8\u7981",
10727
+ "\u5BFC\u822A\u5165\u53E3\u7B56\u7565",
10728
+ "\u5217\u8868 lint",
10640
10729
  "\u505C\u673A\u70B9",
10641
10730
  "\u5BF9\u8C61\u9501\u91CD\u590D",
10642
10731
  "\u53EA\u8BFB\u4EFB\u52A1",
@@ -10670,6 +10759,8 @@ var PROMPT_REQUIRED_TERMS = [
10670
10759
  "\u8F93\u5165\u4F9D\u8D56",
10671
10760
  "\u8F93\u51FA\u7269",
10672
10761
  "\u9A8C\u6536\u65B9\u5F0F",
10762
+ "\u5BFC\u822A\u5165\u53E3\u7B56\u7565",
10763
+ "\u5217\u8868 lint",
10673
10764
  "\u8FDB\u5EA6 CSV"
10674
10765
  ];
10675
10766
  var BPMAX_SKILL_PATTERN = /bpmax-[a-z0-9-]+|form-control-library|bpmax-memory-protocol/;
@@ -10705,6 +10796,75 @@ function uniqueErrors(errors) {
10705
10796
  function missingTermErrors(text5, terms, prefix) {
10706
10797
  return terms.filter((term) => !text5.includes(term)).map((term) => `${prefix}: ${term}`);
10707
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
+ }
10708
10868
  async function lintTaskbook(file, options = {}) {
10709
10869
  const text5 = await readTaskbookText(file);
10710
10870
  const errors = [
@@ -10721,6 +10881,7 @@ async function lintTaskbook(file, options = {}) {
10721
10881
  }
10722
10882
  errors.push(...uuidErrors(text5, "taskbooks"));
10723
10883
  errors.push(...missingTermErrors(text5, SUBAGENT_TERMS, "missing subagent rule term"));
10884
+ validateTaskbookNavigationAndListGates(text5, errors);
10724
10885
  for (const match of text5.matchAll(FLOW_LOCK_PATTERN)) {
10725
10886
  const value = match[1] || "";
10726
10887
  if (value.startsWith("flow") && /^flow\d+$/.test(value)) {
@@ -10745,6 +10906,7 @@ async function lintTaskPrompt(file, options = {}) {
10745
10906
  errors.push("prompt missing BPMAX related skill name in required_skills");
10746
10907
  }
10747
10908
  errors.push(...uuidErrors(text5, "task prompts"));
10909
+ validatePromptNavigationAndListGates(text5, errors);
10748
10910
  for (const term of options.forbidTerms || []) {
10749
10911
  if (term && text5.includes(term)) {
10750
10912
  errors.push(`prompt forbidden term present: ${term}`);
@@ -10818,9 +10980,19 @@ function taskbookTemplate(title = "BPMAX AI \u5B9E\u65BD\u7F16\u6392\u4EFB\u52A1
10818
10980
  "## \u9A8C\u6536\u95E8\u7981",
10819
10981
  "",
10820
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",
10821
10985
  "- \u6D4F\u89C8\u5668 E2E \u9A8C\u8BC1\u901A\u8FC7\u3002",
10822
10986
  "- \u6D4B\u8BD5\u62A5\u544A\u548C\u622A\u56FE\u8BC1\u636E\u5B8C\u6574\u3002",
10823
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
+ "",
10824
10996
  "## \u505C\u673A\u70B9",
10825
10997
  "",
10826
10998
  "- \u65E0\u6CD5\u786E\u8BA4\u7EBF\u4E0A\u57FA\u7EBF\u3002",