bpmax-cli 0.2.1-beta.6 → 0.2.1-beta.7

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
@@ -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.6",
472
+ version: "0.2.1-beta.7",
473
473
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
474
474
  type: "module",
475
475
  bin: {
@@ -5605,6 +5605,118 @@ function validateFormTemplateValueValidateMaps(payload, errors) {
5605
5605
  }
5606
5606
  }
5607
5607
  }
5608
+ var FORM_TEMPLATE_VISUAL_WIDE_TYPES = /* @__PURE__ */ new Set([
5609
+ "sub_form",
5610
+ "i_textarea",
5611
+ "textarea",
5612
+ "rich_text",
5613
+ "editor",
5614
+ "upload",
5615
+ "file",
5616
+ "image",
5617
+ "images",
5618
+ "raw"
5619
+ ]);
5620
+ function shouldRunFormTemplateVisualLint(payload) {
5621
+ const lintHints = isRecord3(payload.lintHints) ? payload.lintHints : {};
5622
+ const visualReview = isRecord3(lintHints.visualReview) ? lintHints.visualReview : {};
5623
+ return visualReview.enabled === true || visualReview.required === true || payload.mode === "visual_review";
5624
+ }
5625
+ function formTemplateVisualReviewHints(payload) {
5626
+ const lintHints = isRecord3(payload.lintHints) ? payload.lintHints : {};
5627
+ return isRecord3(lintHints.visualReview) ? lintHints.visualReview : {};
5628
+ }
5629
+ function numericHint(value, fallback) {
5630
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
5631
+ }
5632
+ function formTemplateRuleTitle(rule, value) {
5633
+ const title = rule.title ?? value?.title ?? rule.label ?? value?.label;
5634
+ return typeof title === "string" ? title.trim() : "";
5635
+ }
5636
+ function formTemplateRuleWidth(rule) {
5637
+ const props = isRecord3(rule.props) ? rule.props : {};
5638
+ const candidates = [
5639
+ rule.span,
5640
+ rule.colSpan,
5641
+ rule.width,
5642
+ props.span,
5643
+ props.colSpan,
5644
+ props.width
5645
+ ];
5646
+ for (const candidate of candidates) {
5647
+ if (typeof candidate === "number" && Number.isFinite(candidate) && candidate > 0) {
5648
+ return candidate;
5649
+ }
5650
+ if (typeof candidate === "string" && /^\d+$/.test(candidate.trim())) {
5651
+ return Number(candidate.trim());
5652
+ }
5653
+ }
5654
+ return void 0;
5655
+ }
5656
+ function validateStructuredFormTemplateVisualReview(payload, errors) {
5657
+ if (!shouldRunFormTemplateVisualLint(payload)) {
5658
+ return;
5659
+ }
5660
+ const hints = formTemplateVisualReviewHints(payload);
5661
+ if (hints.confirmedNonBehavioralProps !== true) {
5662
+ errors.push(
5663
+ "form-template visual lint requires lintHints.visualReview.confirmedNonBehavioralProps=true after confirming the diff only changes layout, label/control width, spacing, or other non-behavioral display props."
5664
+ );
5665
+ }
5666
+ if (!Array.isArray(payload.layout) || !isRecord3(payload.fields)) {
5667
+ errors.push("form-template visual lint requires structured work with layout and fields.");
5668
+ return;
5669
+ }
5670
+ const maxColumnsPerRow = Math.floor(numericHint(hints.maxColumnsPerRow, 2));
5671
+ const maxRowTitleChars = Math.floor(numericHint(hints.maxRowTitleChars, 24));
5672
+ const maxTitleCharsInMultiColumn = Math.floor(numericHint(hints.maxTitleCharsInMultiColumn, 12));
5673
+ for (const [rowIndex, row] of payload.layout.entries()) {
5674
+ if (!Array.isArray(row)) {
5675
+ errors.push(`form-template visual lint layout row ${rowIndex} must be an array.`);
5676
+ continue;
5677
+ }
5678
+ if (!row.length) {
5679
+ errors.push(`form-template visual lint layout row ${rowIndex} is empty; remove empty visual rows before submit.`);
5680
+ continue;
5681
+ }
5682
+ if (row.length > maxColumnsPerRow) {
5683
+ errors.push(`form-template visual lint layout row ${rowIndex} has ${row.length} fields; maxColumnsPerRow=${maxColumnsPerRow} for readable desktop data entry.`);
5684
+ }
5685
+ let rowTitleChars = 0;
5686
+ for (const ref of row) {
5687
+ if (typeof ref !== "string" || !ref) {
5688
+ continue;
5689
+ }
5690
+ const bundle = payload.fields[ref];
5691
+ if (!isRecord3(bundle) || !isRecord3(bundle.rule)) {
5692
+ continue;
5693
+ }
5694
+ const value = isRecord3(bundle.value) ? bundle.value : void 0;
5695
+ const rule = bundle.rule;
5696
+ const title = formTemplateRuleTitle(rule, value);
5697
+ rowTitleChars += title.length;
5698
+ const type = typeof rule.type === "string" ? rule.type : typeof value?.field_type === "string" ? value.field_type : "";
5699
+ if (row.length > 1 && FORM_TEMPLATE_VISUAL_WIDE_TYPES.has(type)) {
5700
+ errors.push(`form-template visual lint field ${ref} (${title || type}) type=${type} must be in a single-field row for readable editing.`);
5701
+ }
5702
+ if (row.length > 1 && title.length > maxTitleCharsInMultiColumn) {
5703
+ errors.push(`form-template visual lint field ${ref} title is too long for a multi-column row (${title.length} > ${maxTitleCharsInMultiColumn}); move it to a single row or shorten the visible label.`);
5704
+ }
5705
+ const width = formTemplateRuleWidth(rule);
5706
+ if (row.length > 1 && typeof width === "number" && width > 12) {
5707
+ errors.push(`form-template visual lint field ${ref} declares width/span=${width} inside a multi-column row; wide controls must be single-row or use <=12 grid width.`);
5708
+ }
5709
+ }
5710
+ if (row.length > 1 && rowTitleChars > maxRowTitleChars) {
5711
+ errors.push(`form-template visual lint layout row ${rowIndex} title length total is ${rowTitleChars}; maxRowTitleChars=${maxRowTitleChars}. Split the row for readability.`);
5712
+ }
5713
+ }
5714
+ }
5715
+ function validateFormTemplateWorkLint(payload, errors) {
5716
+ validateFormTemplateNameLength(payload, errors);
5717
+ validateFormTemplateValueValidateMaps(payload, errors);
5718
+ validateStructuredFormTemplateVisualReview(payload, errors);
5719
+ }
5608
5720
  function stripFormTemplateCreateIds(payload) {
5609
5721
  const next = { ...payload };
5610
5722
  if (Array.isArray(next.rule)) {
@@ -7579,7 +7691,7 @@ async function buildConfigSubmitPayload(domain, workFile, outFile, metaFile, opt
7579
7691
  }
7580
7692
  if (domain === "form-template" && isRecord3(work)) {
7581
7693
  const errors = [];
7582
- validateFormTemplateValueValidateMaps(work, errors);
7694
+ validateFormTemplateWorkLint(work, errors);
7583
7695
  if (errors.length) {
7584
7696
  throw new Error(`form-template lint failed: ${errors.join("; ")}`);
7585
7697
  }
@@ -7658,8 +7770,7 @@ async function lintConfigWorkFile(file, options = {}) {
7658
7770
  }
7659
7771
  const shouldLintFormTemplate = options.domain ? options.domain === "form-template" : looksLikeFormTemplateWork(value);
7660
7772
  if (shouldLintFormTemplate) {
7661
- validateFormTemplateNameLength(value, errors);
7662
- validateFormTemplateValueValidateMaps(value, errors);
7773
+ validateFormTemplateWorkLint(value, errors);
7663
7774
  }
7664
7775
  if ((Object.prototype.hasOwnProperty.call(value, "content") || isRecord3(value.basic)) && pageTemplateType(value) === 1) {
7665
7776
  validateListTemplateActionGate(value, errors);