@platforma-sdk/block-tools 2.10.19 → 2.11.0

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.
Files changed (33) hide show
  1. package/dist/cli.js +11 -11
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +362 -352
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/structure/engine/builders.d.ts +7 -6
  6. package/dist/structure/engine/content-rules.d.ts +4 -4
  7. package/dist/structure/engine/ir.d.ts +11 -6
  8. package/dist/structure/rules/block-package-json.d.ts +1 -1
  9. package/dist/structure/rules/root-ci.d.ts +1 -0
  10. package/dist/v2/registry/schema_public.d.ts +150 -150
  11. package/package.json +4 -4
  12. package/src/structure/CLAUDE.md +2 -0
  13. package/src/structure/__tests__/discovery-shortname.test.ts +50 -0
  14. package/src/structure/__tests__/root-ci-workflows.test.ts +68 -0
  15. package/src/structure/engine/builders.ts +7 -6
  16. package/src/structure/engine/content-rules.ts +7 -7
  17. package/src/structure/engine/discovery-fs.ts +9 -1
  18. package/src/structure/engine/ir.ts +11 -6
  19. package/src/structure/engine/runner.ts +14 -14
  20. package/src/structure/rules/block-package-json.ts +2 -3
  21. package/src/structure/rules/block.ts +3 -4
  22. package/src/structure/rules/migrations.ts +1 -2
  23. package/src/structure/rules/model.ts +1 -2
  24. package/src/structure/rules/root-catalog-bump.ts +3 -4
  25. package/src/structure/rules/root-ci.ts +55 -0
  26. package/src/structure/rules/root.ts +2 -3
  27. package/src/structure/rules/software.ts +1 -2
  28. package/src/structure/rules/test.ts +1 -2
  29. package/src/structure/rules/ui.ts +3 -5
  30. package/src/structure/rules/workflow.ts +3 -5
  31. package/src/structure/structure-definition.ts +2 -0
  32. package/src/structure/templates/text/workflows/build.tpl.yaml +67 -0
  33. package/src/structure/templates/text/workflows/mark-stable.tpl.yaml +34 -0
package/dist/cli.mjs CHANGED
@@ -550,10 +550,6 @@ function Ve(e, t) {
550
550
  function He() {
551
551
  return _;
552
552
  }
553
- function y() {
554
- if (!_) throw Error("getActiveRunContext() called outside engine.run(). Generators only see the run context during a run.");
555
- return _;
556
- }
557
553
  function Ue(e) {
558
554
  if (g) throw Error("defineStructure() cannot be called from inside another defineStructure().");
559
555
  let t = [], n = {
@@ -593,7 +589,7 @@ function We(e) {
593
589
  throw Error(`defineStructure validation: path '${t}' under scope '${e}' is declared as both seed and ${n}. Seeds are block-author territory (written once at init, untouched thereafter); engine-managed primitives (fixed/managed/scaffold) rewrite on every refresh. The two contracts cannot coexist on the same path.`);
594
590
  }
595
591
  }
596
- function b(e, t) {
592
+ function y(e, t) {
597
593
  let n = Be("scope");
598
594
  if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
599
595
  let r = {
@@ -612,7 +608,7 @@ var Ge;
612
608
  function Ke(e) {
613
609
  Ge = e;
614
610
  }
615
- function x(e, t, n) {
611
+ function b(e, t, n) {
616
612
  qe(e, t), n && qe((t) => !e(t), n);
617
613
  }
618
614
  function qe(e, t) {
@@ -635,7 +631,7 @@ function Je(e, t) {
635
631
  n.stack.pop();
636
632
  }
637
633
  }
638
- function S(e) {
634
+ function x(e) {
639
635
  return (t) => t.filesMatch(e);
640
636
  }
641
637
  function Ye(e, t, n) {
@@ -654,14 +650,14 @@ function Ye(e, t, n) {
654
650
  function Xe(e) {
655
651
  Ye("onInitOrUpdate", ["init", "updateDeps"], e);
656
652
  }
657
- function C(e, t) {
653
+ function S(e, t) {
658
654
  v("fixed", {
659
655
  kind: "fixed",
660
656
  path: e,
661
657
  content: t
662
658
  });
663
659
  }
664
- function w(e, t, n) {
660
+ function C(e, t, n) {
665
661
  v("managed", {
666
662
  kind: "managed",
667
663
  path: e,
@@ -676,20 +672,20 @@ function Ze(e, t) {
676
672
  initial: t
677
673
  });
678
674
  }
679
- function T(e, t) {
675
+ function w(e, t) {
680
676
  v("seed", {
681
677
  kind: "seed",
682
678
  path: e,
683
679
  initial: t
684
680
  });
685
681
  }
686
- function E(e) {
682
+ function T(e) {
687
683
  v("remove", {
688
684
  kind: "remove",
689
685
  path: e
690
686
  });
691
687
  }
692
- function D(e) {
688
+ function E(e) {
693
689
  return {
694
690
  kind: "file",
695
691
  path: e
@@ -707,7 +703,7 @@ function $e(e) {
707
703
  value: e
708
704
  };
709
705
  }
710
- function et(e, t) {
706
+ function D(e, t) {
711
707
  return {
712
708
  kind: "tpl",
713
709
  path: e,
@@ -720,34 +716,30 @@ function O(e) {
720
716
  fn: e
721
717
  };
722
718
  }
723
- function tt() {
724
- if (!_) throw Error("blockVars() called outside engine.run(). Generators and managed bodies only see BlockVars during a run.");
725
- return _.blockVars;
726
- }
727
719
  //#endregion
728
720
  //#region src/structure/engine/parsers/json.ts
729
- function nt(e) {
721
+ function et(e) {
730
722
  return JSON.parse(e);
731
723
  }
732
- var rt = 100, it = 2;
733
- function at(e) {
734
- return e.length === 0 ? "[]" : "[" + e.map(ot).join(", ") + "]";
724
+ var tt = 100, nt = 2;
725
+ function rt(e) {
726
+ return e.length === 0 ? "[]" : "[" + e.map(it).join(", ") + "]";
735
727
  }
736
- function ot(e) {
737
- if (Array.isArray(e)) return at(e);
728
+ function it(e) {
729
+ if (Array.isArray(e)) return rt(e);
738
730
  if (A(e)) {
739
731
  let t = Object.entries(e);
740
- return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${ot(t)}`).join(", ") + " }";
732
+ return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${it(t)}`).join(", ") + " }";
741
733
  }
742
734
  return JSON.stringify(e);
743
735
  }
744
- function st(e, t, n, r) {
745
- let i = t + it, a = " ".repeat(i);
736
+ function at(e, t, n, r) {
737
+ let i = t + nt, a = " ".repeat(i);
746
738
  if (Array.isArray(e)) {
747
- let o = at(e);
748
- if (n + o.length + r <= rt) return o;
739
+ let o = rt(e);
740
+ if (n + o.length + r <= tt) return o;
749
741
  let s = e.length - 1;
750
- return "[\n" + e.map((e, t) => a + st(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
742
+ return "[\n" + e.map((e, t) => a + at(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
751
743
  }
752
744
  if (A(e)) {
753
745
  let n = Object.entries(e);
@@ -755,13 +747,13 @@ function st(e, t, n, r) {
755
747
  let r = n.length - 1;
756
748
  return "{\n" + n.map(([e, t], n) => {
757
749
  let o = `${a}${JSON.stringify(e)}: `;
758
- return o + st(t, i, o.length, n === r ? 0 : 1);
750
+ return o + at(t, i, o.length, n === r ? 0 : 1);
759
751
  }).join(",\n") + "\n" + " ".repeat(t) + "}";
760
752
  }
761
753
  return JSON.stringify(e);
762
754
  }
763
- function ct(e, t) {
764
- return t?.collapse ? st(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
755
+ function ot(e, t) {
756
+ return t?.collapse ? at(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
765
757
  }
766
758
  function k(e) {
767
759
  return e === "" || e === void 0 ? [] : e.split(".");
@@ -769,7 +761,7 @@ function k(e) {
769
761
  function A(e) {
770
762
  return typeof e == "object" && !!e && !Array.isArray(e);
771
763
  }
772
- function lt(e, t) {
764
+ function st(e, t) {
773
765
  let n = k(t), r = e;
774
766
  for (let e of n) {
775
767
  if (!A(r)) return;
@@ -777,7 +769,7 @@ function lt(e, t) {
777
769
  }
778
770
  return r;
779
771
  }
780
- function ut(e, t) {
772
+ function ct(e, t) {
781
773
  let n = k(t);
782
774
  if (n.length === 0) return !0;
783
775
  let r = e;
@@ -787,7 +779,7 @@ function ut(e, t) {
787
779
  }
788
780
  return A(r) ? n[n.length - 1] in r : !1;
789
781
  }
790
- function dt(e, t, n) {
782
+ function lt(e, t, n) {
791
783
  let r = k(t);
792
784
  if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
793
785
  let i = e;
@@ -801,7 +793,7 @@ function dt(e, t, n) {
801
793
  }
802
794
  i[r[r.length - 1]] = n;
803
795
  }
804
- function ft(e, t) {
796
+ function ut(e, t) {
805
797
  let n = k(t);
806
798
  if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
807
799
  let r = e;
@@ -811,7 +803,7 @@ function ft(e, t) {
811
803
  }
812
804
  A(r) && delete r[n[n.length - 1]];
813
805
  }
814
- function pt(e, t) {
806
+ function dt(e, t) {
815
807
  let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
816
808
  i.set("", []);
817
809
  let a = "";
@@ -826,62 +818,62 @@ function pt(e, t) {
826
818
  }
827
819
  //#endregion
828
820
  //#region src/structure/engine/parsers/lines.ts
829
- function mt(e) {
821
+ function ft(e) {
830
822
  let t = e.split("\n");
831
823
  return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
832
824
  }
833
- function ht(e) {
825
+ function pt(e) {
834
826
  return e.join("\n") + "\n";
835
827
  }
836
- function gt(e) {
828
+ function mt(e) {
837
829
  return e.replace(/(^|\s)#.*$/, "$1").trim();
838
830
  }
839
- function _t(e, t) {
840
- let n = gt(e);
831
+ function ht(e, t) {
832
+ let n = mt(e);
841
833
  return n === "" ? !1 : n === t.trim();
842
834
  }
843
- function vt(e, t) {
844
- for (let n of e) if (_t(n, t)) return !0;
835
+ function gt(e, t) {
836
+ for (let n of e) if (ht(n, t)) return !0;
845
837
  return !1;
846
838
  }
847
839
  //#endregion
848
840
  //#region src/structure/engine/content-rules.ts
849
- function yt(e, t) {
841
+ function _t(e, t) {
850
842
  return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
851
843
  }
852
- var bt = [
844
+ var vt = [
853
845
  "dependencies",
854
846
  "devDependencies",
855
847
  "peerDependencies",
856
848
  "optionalDependencies"
857
849
  ];
858
- function xt(e, t) {
859
- if (P(e)) for (let n of bt) {
850
+ function yt(e, t) {
851
+ if (P(e)) for (let n of vt) {
860
852
  let r = e[n];
861
853
  if (P(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
862
854
  }
863
855
  }
864
856
  var j;
865
- function St(e) {
857
+ function bt(e) {
866
858
  if (!j) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
867
859
  return j;
868
860
  }
869
861
  function M(e) {
870
- let t = St(e);
862
+ let t = bt(e);
871
863
  if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
872
864
  return t;
873
865
  }
874
866
  function N(e) {
875
- let t = St(e);
867
+ let t = bt(e);
876
868
  if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
877
869
  return t;
878
870
  }
879
- function Ct(e) {
880
- let t = St(e);
871
+ function xt(e) {
872
+ let t = bt(e);
881
873
  if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
882
874
  return t;
883
875
  }
884
- function wt(e, t) {
876
+ function St(e, t) {
885
877
  let n = e.ctx ?? He();
886
878
  if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
887
879
  return n;
@@ -889,7 +881,7 @@ function wt(e, t) {
889
881
  function P(e) {
890
882
  return typeof e == "object" && !!e && !Array.isArray(e);
891
883
  }
892
- function Tt(e, t, n = {}) {
884
+ function Ct(e, t, n = {}) {
893
885
  if (j) throw Error("Nested managed(...) body — engine bug.");
894
886
  j = {
895
887
  kind: "json",
@@ -898,12 +890,12 @@ function Tt(e, t, n = {}) {
898
890
  triggerContext: n.triggerContext
899
891
  };
900
892
  try {
901
- return t(), e;
893
+ return t(n.ctx ?? n.triggerContext?.ctx), e;
902
894
  } finally {
903
895
  j = void 0;
904
896
  }
905
897
  }
906
- function Et(e, t, n = {}) {
898
+ function wt(e, t, n = {}) {
907
899
  if (j) throw Error("Nested managed(...) body — engine bug.");
908
900
  j = {
909
901
  kind: "yaml",
@@ -914,12 +906,12 @@ function Et(e, t, n = {}) {
914
906
  getDerivedDependencyPin: n.getDerivedDependencyPin
915
907
  };
916
908
  try {
917
- return t(), e;
909
+ return t(n.ctx ?? n.triggerContext?.ctx), e;
918
910
  } finally {
919
911
  j = void 0;
920
912
  }
921
913
  }
922
- function Dt(e, t, n = {}) {
914
+ function Tt(e, t, n = {}) {
923
915
  if (j) throw Error("Nested managed(...) body — engine bug.");
924
916
  j = {
925
917
  kind: "lines",
@@ -928,7 +920,7 @@ function Dt(e, t, n = {}) {
928
920
  triggerContext: n.triggerContext
929
921
  };
930
922
  try {
931
- return t(), e;
923
+ return t(n.ctx ?? n.triggerContext?.ctx), e;
932
924
  } finally {
933
925
  j = void 0;
934
926
  }
@@ -940,27 +932,27 @@ Ke((e, t) => {
940
932
  return e(n) && t(), !0;
941
933
  });
942
934
  function F(e, t) {
943
- dt(M("ensureField").obj, e, t);
935
+ lt(M("ensureField").obj, e, t);
944
936
  }
945
- function Ot(e, t) {
937
+ function Et(e, t) {
946
938
  let n = M("removeField").obj;
947
- ut(n, e) && (t && !t(lt(n, e)) || ft(n, e));
939
+ ct(n, e) && (t && !t(st(n, e)) || ut(n, e));
948
940
  }
949
941
  function I(e, t) {
950
942
  F(`scripts.${e}`, t);
951
943
  }
952
944
  function L(e) {
953
- Ot(`scripts.${e}`);
945
+ Et(`scripts.${e}`);
954
946
  }
955
- var kt = [
947
+ var Dt = [
956
948
  "dependencies",
957
949
  "devDependencies",
958
950
  "peerDependencies",
959
951
  "optionalDependencies"
960
952
  ];
961
953
  function R(e, t, n, r) {
962
- let i = M(e), a = i.obj, o = n === "sdk:" ? yt(n, wt(i, e).isSdkInternal) : n;
963
- for (let e of kt) {
954
+ let i = M(e), a = i.obj, o = n === "sdk:" ? _t(n, St(i, e).isSdkInternal) : n;
955
+ for (let e of Dt) {
964
956
  if (e === r) continue;
965
957
  let n = a[e];
966
958
  P(n) && t in n && delete n[t];
@@ -974,12 +966,12 @@ function z(e, t) {
974
966
  function B(e, t) {
975
967
  R("ensureDevDep", e, t, "devDependencies");
976
968
  }
977
- function At(e, t) {
969
+ function Ot(e, t) {
978
970
  R("ensurePeerDep", e, t, "peerDependencies");
979
971
  }
980
972
  function V(e) {
981
973
  let t = M("removeDep").obj;
982
- for (let n of kt) {
974
+ for (let n of Dt) {
983
975
  let r = t[n];
984
976
  P(r) && e in r && delete r[e];
985
977
  }
@@ -988,105 +980,105 @@ function H(e) {
988
980
  for (let [t, n] of Object.entries(e)) B(t, n);
989
981
  }
990
982
  function U(e) {
991
- for (let [t, n] of Object.entries(e)) At(t, n);
983
+ for (let [t, n] of Object.entries(e)) Ot(t, n);
992
984
  }
993
- function jt(e, t, n) {
994
- let r = wt(M(e), e);
985
+ function kt(e, t, n) {
986
+ let r = St(M(e), e);
995
987
  for (let i of r.modules) i.scope === t && R(e, i.name, "workspace:*", n);
996
988
  }
997
989
  function W(e) {
998
- jt("ensureWorkspaceScopeDeps", e, "dependencies");
990
+ kt("ensureWorkspaceScopeDeps", e, "dependencies");
999
991
  }
1000
- function Mt(e) {
992
+ function At(e) {
1001
993
  let t = M("pruneKeysMatching").obj;
1002
994
  for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
1003
995
  }
1004
- function Nt(e, t) {
1005
- let n = pt(e, t);
996
+ function jt(e, t) {
997
+ let n = dt(e, t);
1006
998
  for (let t of Object.keys(e)) delete e[t];
1007
999
  for (let t of Object.keys(n)) e[t] = n[t];
1008
1000
  }
1009
1001
  function G(e) {
1010
- Nt(M("enforceFieldOrder").obj, e);
1002
+ jt(M("enforceFieldOrder").obj, e);
1011
1003
  }
1012
- function Pt(e, t) {
1004
+ function Mt(e, t) {
1013
1005
  let n = Object.keys(e).sort(), r = {};
1014
1006
  for (let t of n) r[t] = e[t];
1015
1007
  for (let t of Object.keys(e)) delete e[t];
1016
- for (let i of n) e[i] = r[i], t && P(e[i]) && Pt(e[i], !0);
1008
+ for (let i of n) e[i] = r[i], t && P(e[i]) && Mt(e[i], !0);
1017
1009
  }
1018
1010
  function K(e = "", t = {}) {
1019
1011
  let n = t.recursive ?? !1;
1020
1012
  if (e === "" && !n) return;
1021
1013
  let r = M("enforceAlphabeticalOrder").obj;
1022
1014
  if (e === "") {
1023
- Pt(r, !0);
1015
+ Mt(r, !0);
1024
1016
  return;
1025
1017
  }
1026
- let i = lt(r, e);
1027
- P(i) && Pt(i, n);
1018
+ let i = st(r, e);
1019
+ P(i) && Mt(i, n);
1028
1020
  }
1029
- function Ft() {
1030
- let e = N("ensureWorkspaceModulePaths"), t = wt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
1021
+ function Nt() {
1022
+ let e = N("ensureWorkspaceModulePaths"), t = St(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
1031
1023
  Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
1032
1024
  }
1033
- function It(e, t) {
1025
+ function Pt(e, t) {
1034
1026
  let n = e.doc.getIn(["catalog", t]);
1035
1027
  return typeof n == "string" ? n : void 0;
1036
1028
  }
1037
- function Lt(e, t) {
1029
+ function Ft(e, t) {
1038
1030
  let n = N("ensureCatalogVersion");
1039
- It(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
1031
+ Pt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
1040
1032
  }
1041
- function Rt(e) {
1033
+ function It(e) {
1042
1034
  let t = N("ensureCatalogLatest");
1043
1035
  if (!t.getLatestVersion) return;
1044
1036
  let n = t.getLatestVersion(e);
1045
- n !== void 0 && It(t, e) !== n && t.doc.setIn(["catalog", e], n);
1037
+ n !== void 0 && Pt(t, e) !== n && t.doc.setIn(["catalog", e], n);
1046
1038
  }
1047
- function zt(e, t) {
1039
+ function Lt(e, t) {
1048
1040
  let n = N("pinCatalogToDependencyOf");
1049
1041
  if (!n.getDerivedDependencyPin) return;
1050
1042
  let r = n.getDerivedDependencyPin(e);
1051
- r !== void 0 && It(n, e) !== r && n.doc.setIn(["catalog", e], r);
1043
+ r !== void 0 && Pt(n, e) !== r && n.doc.setIn(["catalog", e], r);
1052
1044
  }
1053
- function Bt(e) {
1045
+ function Rt(e) {
1054
1046
  let t = N("ensureCatalogAbsent");
1055
1047
  t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
1056
1048
  }
1057
- function Vt(e) {
1058
- let t = Ct("ensureGitignoreEntries");
1059
- for (let n of e) vt(t.lines, n) || t.lines.push(n);
1049
+ function zt(e) {
1050
+ let t = xt("ensureGitignoreEntries");
1051
+ for (let n of e) gt(t.lines, n) || t.lines.push(n);
1060
1052
  }
1061
1053
  //#endregion
1062
1054
  //#region src/structure/engine/parsers/yaml.ts
1063
- function Ht(e) {
1055
+ function Bt(e) {
1064
1056
  return se(e);
1065
1057
  }
1066
- function Ut(e) {
1058
+ function Vt(e) {
1067
1059
  return e.toString();
1068
1060
  }
1069
- var Wt = ".structure";
1070
- function Gt(e, t = 0) {
1071
- if (e < t) throw new Kt(e, t);
1061
+ var Ht = ".structure";
1062
+ function Ut(e, t = 0) {
1063
+ if (e < t) throw new Wt(e, t);
1072
1064
  }
1073
- var Kt = class extends Error {
1065
+ var Wt = class extends Error {
1074
1066
  constructor(e, t) {
1075
1067
  super(`Block .structure version is ${e}, below floor ${t}. Bootstrap via the legacy-migration skill, then re-run.`), this.version = e, this.floor = t, this.name = "StructureVersionFloorError";
1076
1068
  }
1077
1069
  };
1078
- function qt(e, t = 1) {
1070
+ function Gt(e, t = 1) {
1079
1071
  let n = { version: t };
1080
- e.write(Wt, JSON.stringify(n));
1072
+ e.write(Ht, JSON.stringify(n));
1081
1073
  }
1082
1074
  //#endregion
1083
1075
  //#region src/structure/engine/runner.ts
1084
- var Jt = class extends Error {
1076
+ var Kt = class extends Error {
1085
1077
  constructor(e) {
1086
1078
  super(`Post-run recheck: rule set not idempotent. Failing item: ${e.primitive} '${e.path}' (scope=${e.scope}, action=${e.action}). Engine bug.`), this.failing = e, this.name = "RecheckError";
1087
1079
  }
1088
1080
  };
1089
- function Yt(e, t, n, r) {
1081
+ function qt(e, t, n, r) {
1090
1082
  switch (e.kind) {
1091
1083
  case "text": return e.value;
1092
1084
  case "file":
@@ -1094,10 +1086,10 @@ function Yt(e, t, n, r) {
1094
1086
  return n.staticRead(e.path);
1095
1087
  case "tpl":
1096
1088
  if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
1097
- return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars() : e.vars);
1089
+ return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
1098
1090
  case "generate": {
1099
- let n = e.fn();
1100
- if (t.endsWith(".json")) return xt(n, r), ct(n, { collapse: !t.endsWith("package.json") });
1091
+ let n = e.fn(r);
1092
+ if (t.endsWith(".json")) return yt(n, r.isSdkInternal), ot(n, { collapse: !t.endsWith("package.json") });
1101
1093
  if (t.endsWith(".yaml") || t.endsWith(".yml")) return ce(n);
1102
1094
  if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
1103
1095
  return n;
@@ -1105,36 +1097,36 @@ function Yt(e, t, n, r) {
1105
1097
  case "binary": throw Error(`binary('${e.path}') cannot be resolved to a string; it is only valid inside seed()/scaffold(), which copy it verbatim via fs.writeBinary.`);
1106
1098
  }
1107
1099
  }
1108
- function Xt(e, t, n, r, i) {
1100
+ function Jt(e, t, n, r, i) {
1109
1101
  if (n.kind === "binary") {
1110
1102
  if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
1111
1103
  e.writeBinary(t, r.staticReadBinary(n.path));
1112
1104
  return;
1113
1105
  }
1114
- e.write(t, Yt(n, t, r, i));
1106
+ e.write(t, qt(n, t, r, i));
1115
1107
  }
1116
- function Zt(e, t, n, r, i, a) {
1108
+ function Yt(e, t, n, r, i, a) {
1117
1109
  let o = e.split("/").pop() ?? e;
1118
1110
  if (e.endsWith(".json")) {
1119
- let i = nt(t);
1111
+ let i = et(t);
1120
1112
  if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
1121
- return Tt(i, n, { triggerContext: r }), ct(i, { collapse: o !== "package.json" });
1113
+ return Ct(i, n, { triggerContext: r }), ot(i, { collapse: o !== "package.json" });
1122
1114
  }
1123
1115
  if (e.endsWith(".yaml") || e.endsWith(".yml")) {
1124
- let e = Ht(t);
1125
- return Et(e, n, {
1116
+ let e = Bt(t);
1117
+ return wt(e, n, {
1126
1118
  triggerContext: r,
1127
1119
  getLatestVersion: i,
1128
1120
  getDerivedDependencyPin: a
1129
- }), Ut(e);
1121
+ }), Vt(e);
1130
1122
  }
1131
1123
  if (o === ".gitignore" || o.endsWith(".gitignore")) {
1132
- let e = mt(t);
1133
- return Dt(e, n, { triggerContext: r }), ht(e);
1124
+ let e = ft(t);
1125
+ return Tt(e, n, { triggerContext: r }), pt(e);
1134
1126
  }
1135
1127
  throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
1136
1128
  }
1137
- function Qt(e) {
1129
+ function Xt(e) {
1138
1130
  let t = e.list(""), n = /* @__PURE__ */ new Set();
1139
1131
  for (let e of t) {
1140
1132
  n.add(e);
@@ -1143,16 +1135,16 @@ function Qt(e) {
1143
1135
  }
1144
1136
  return n;
1145
1137
  }
1146
- function $t(e, t) {
1138
+ function Zt(e, t) {
1147
1139
  let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
1148
1140
  return e.has(n);
1149
1141
  }
1150
- function en(e, t, n) {
1142
+ function Qt(e, t, n) {
1151
1143
  return {
1152
1144
  ctx: t,
1153
1145
  version: t.version,
1154
- pathExists: (t) => $t(e, t),
1155
- pathMissing: (t) => !$t(e, t),
1146
+ pathExists: (t) => Zt(e, t),
1147
+ pathMissing: (t) => !Zt(e, t),
1156
1148
  filesMatch: (t) => {
1157
1149
  let r = n ? `${n}/${t}` : t;
1158
1150
  for (let t of e) if (ze(r, t)) return !0;
@@ -1160,20 +1152,20 @@ function en(e, t, n) {
1160
1152
  }
1161
1153
  };
1162
1154
  }
1163
- function tn(e, t) {
1155
+ function $t(e, t) {
1164
1156
  for (let n of e.triggers) if (!n(t)) return !1;
1165
1157
  return !0;
1166
1158
  }
1167
- function nn(e, t) {
1159
+ function en(e, t) {
1168
1160
  return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
1169
1161
  }
1170
- function rn(e, t) {
1162
+ function tn(e, t) {
1171
1163
  return e.filter((e) => e.modes.includes(t));
1172
1164
  }
1173
- function an(e, t, n, r, i, a) {
1165
+ function nn(e, t, n, r, i, a) {
1174
1166
  let o = e.leaf;
1175
1167
  if (o.kind === "fixed") {
1176
- let i = Yt(o.content, e.resolvedPath, r, a);
1168
+ let i = qt(o.content, e.resolvedPath, r, a);
1177
1169
  return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
1178
1170
  scope: e.scope,
1179
1171
  path: e.resolvedPath,
@@ -1186,13 +1178,13 @@ function an(e, t, n, r, i, a) {
1186
1178
  action: "create"
1187
1179
  });
1188
1180
  }
1189
- if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Xt(t, e.resolvedPath, o.initial, r, a), {
1181
+ if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Jt(t, e.resolvedPath, o.initial, r, a), {
1190
1182
  scope: e.scope,
1191
1183
  path: e.resolvedPath,
1192
1184
  primitive: "scaffold",
1193
1185
  action: "create"
1194
1186
  });
1195
- if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Xt(t, e.resolvedPath, o.initial, r, a), {
1187
+ if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Jt(t, e.resolvedPath, o.initial, r, a), {
1196
1188
  scope: e.scope,
1197
1189
  path: e.resolvedPath,
1198
1190
  primitive: "seed",
@@ -1215,11 +1207,11 @@ function an(e, t, n, r, i, a) {
1215
1207
  });
1216
1208
  }
1217
1209
  }
1218
- function on(e, t, n, r, i, a, o, s) {
1210
+ function rn(e, t, n, r, i, a, o, s) {
1219
1211
  if (e.leaf.kind !== "managed") return;
1220
1212
  let c = e.leaf, l = e.resolvedPath, ee = t.exists(l), u, d = !1;
1221
- ee ? u = t.read(l) : (u = Yt(c.initial, l, i, s), d = !0);
1222
- let f = Zt(l, u, c.body, r, a, o);
1213
+ ee ? u = t.read(l) : (u = qt(c.initial, l, i, s), d = !0);
1214
+ let f = Yt(l, u, c.body, r, a, o);
1223
1215
  if (d) return n || t.write(l, f), {
1224
1216
  scope: e.scope,
1225
1217
  path: l,
@@ -1233,40 +1225,40 @@ function on(e, t, n, r, i, a, o, s) {
1233
1225
  action: "update"
1234
1226
  };
1235
1227
  }
1236
- function sn(e, t, n, r, i, a, o, s) {
1237
- let c = rn(e, nn(n, a)), l = [], ee = Qt(t);
1228
+ function an(e, t, n, r, i, a, o, s) {
1229
+ let c = tn(e, en(n, a)), l = [], ee = Xt(t);
1238
1230
  for (let e of c) {
1239
- if (e.leaf.kind === "managed" || !tn(e, en(ee, n, e.modulePath))) continue;
1240
- let o = an(e, t, r, i, a, n.isSdkInternal);
1231
+ if (e.leaf.kind === "managed" || !$t(e, Qt(ee, n, e.modulePath))) continue;
1232
+ let o = nn(e, t, r, i, a, n);
1241
1233
  o && l.push(o);
1242
1234
  }
1243
- let u = Qt(t);
1235
+ let u = Xt(t);
1244
1236
  for (let e of c) {
1245
1237
  if (e.leaf.kind !== "managed") continue;
1246
- let a = en(u, n, e.modulePath);
1247
- if (!tn(e, a)) continue;
1248
- let c = on(e, t, r, a, i, o, s, n.isSdkInternal);
1238
+ let a = Qt(u, n, e.modulePath);
1239
+ if (!$t(e, a)) continue;
1240
+ let c = rn(e, t, r, a, i, o, s, n);
1249
1241
  c && l.push(c);
1250
1242
  }
1251
1243
  return l;
1252
1244
  }
1253
- function cn(e, t, n, r = {}) {
1245
+ function on(e, t, n, r = {}) {
1254
1246
  return Ve(n, () => {
1255
- let i = Pe(e, n), a = !!r.initMode, o = sn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
1247
+ let i = Pe(e, n), a = !!r.initMode, o = an(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
1256
1248
  if (!n.dryRun && !n.updateDepsOnly && !a) {
1257
- qt(t);
1249
+ Gt(t);
1258
1250
  let i = {
1259
1251
  ...r.rediscover ? r.rediscover(t) : n,
1260
1252
  dryRun: !0
1261
- }, a = sn(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Wt);
1262
- if (a.length > 0) throw new Jt(a[0]);
1253
+ }, a = an(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Ht);
1254
+ if (a.length > 0) throw new Kt(a[0]);
1263
1255
  }
1264
- return a && !n.dryRun && qt(t), { changes: o };
1256
+ return a && !n.dryRun && Gt(t), { changes: o };
1265
1257
  });
1266
1258
  }
1267
1259
  //#endregion
1268
1260
  //#region src/structure/engine/discovery.ts
1269
- var ln = [
1261
+ var sn = [
1270
1262
  "root",
1271
1263
  "block",
1272
1264
  "model",
@@ -1274,12 +1266,12 @@ var ln = [
1274
1266
  "workflow",
1275
1267
  "test",
1276
1268
  "software"
1277
- ], un = class extends Error {
1269
+ ], cn = class extends Error {
1278
1270
  constructor(e, t) {
1279
1271
  super(e), this.path = t, this.name = "DiscoveryError";
1280
1272
  }
1281
1273
  };
1282
- function dn(e) {
1274
+ function ln(e) {
1283
1275
  let t = /* @__PURE__ */ new Set();
1284
1276
  for (let n of [
1285
1277
  e.dependencies,
@@ -1289,17 +1281,17 @@ function dn(e) {
1289
1281
  ]) if (n) for (let e of Object.keys(n)) t.add(e);
1290
1282
  return t;
1291
1283
  }
1292
- function fn(e) {
1284
+ function un(e) {
1293
1285
  return e === "" || e === ".";
1294
1286
  }
1295
- function pn(e, t) {
1287
+ function dn(e, t) {
1296
1288
  let n = e.pkg["block-scope"];
1297
1289
  if (typeof n == "string") {
1298
- if (!ln.includes(n)) throw new un(`package.json "block-scope" must be one of ${ln.join(", ")}, got '${n}'`, e.path);
1290
+ if (!sn.includes(n)) throw new cn(`package.json "block-scope" must be one of ${sn.join(", ")}, got '${n}'`, e.path);
1299
1291
  return n;
1300
1292
  }
1301
- if (fn(e.path)) return "root";
1302
- let r = dn(e.pkg);
1293
+ if (un(e.path)) return "root";
1294
+ let r = ln(e.pkg);
1303
1295
  if (e.pkg["block-software"] !== void 0) return "software";
1304
1296
  if (r.has("@platforma-sdk/package-builder")) {
1305
1297
  for (let e of r) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
@@ -1314,17 +1306,17 @@ function pn(e, t) {
1314
1306
  if (r.has("@platforma-sdk/model") && e.pkg.main) return "model";
1315
1307
  if (r.has("@platforma-sdk/test")) return "test";
1316
1308
  }
1317
- function mn(e) {
1309
+ function fn(e) {
1318
1310
  let t = /* @__PURE__ */ new Set();
1319
1311
  for (let n of e) typeof n.pkg.name == "string" && t.add(n.pkg.name);
1320
1312
  let n = [];
1321
1313
  for (let r of e) {
1322
- let e = pn(r, t);
1323
- if (!e) throw new un(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
1314
+ let e = dn(r, t);
1315
+ if (!e) throw new cn(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
1324
1316
  n.push({
1325
1317
  scope: e,
1326
1318
  name: r.pkg.name ?? r.path,
1327
- path: fn(r.path) ? "" : r.path
1319
+ path: un(r.path) ? "" : r.path
1328
1320
  });
1329
1321
  }
1330
1322
  return n;
@@ -1334,21 +1326,21 @@ function mn(e) {
1334
1326
  function q(e, t) {
1335
1327
  return e.modules.filter((e) => e.scope === t);
1336
1328
  }
1337
- function hn(e, t) {
1329
+ function pn(e, t) {
1338
1330
  let n = q(e, t);
1339
1331
  if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
1340
1332
  if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
1341
1333
  return n[0];
1342
1334
  }
1343
- function J(e, t) {
1344
- return { [hn(e, t).name]: "workspace:*" };
1335
+ function mn(e, t) {
1336
+ return { [pn(e, t).name]: "workspace:*" };
1345
1337
  }
1346
- function gn(e, t) {
1338
+ function hn(e, t) {
1347
1339
  let n = {};
1348
1340
  for (let r of q(e, t)) n[r.name] = "workspace:*";
1349
1341
  return n;
1350
1342
  }
1351
- function _n(e) {
1343
+ function gn(e) {
1352
1344
  let t = e.facadeName, n = [
1353
1345
  {
1354
1346
  scope: "root",
@@ -1387,7 +1379,7 @@ function _n(e) {
1387
1379
  path: "software"
1388
1380
  }), n;
1389
1381
  }
1390
- function vn(e) {
1382
+ function _n(e) {
1391
1383
  return {
1392
1384
  isSdkInternal: e.isSdkInternal ?? !1,
1393
1385
  updateDepsOnly: e.updateDepsOnly ?? !1,
@@ -1399,41 +1391,41 @@ function vn(e) {
1399
1391
  }
1400
1392
  //#endregion
1401
1393
  //#region src/structure/engine/discovery-fs.ts
1402
- var Y = class extends Error {
1394
+ var J = class extends Error {
1403
1395
  constructor(e) {
1404
1396
  super(e), this.name = "StructureCliError";
1405
1397
  }
1406
1398
  };
1407
- function yn(e, t) {
1399
+ function vn(e, t) {
1408
1400
  return e === "" ? t : `${e}/${t}`;
1409
1401
  }
1410
- function bn(e, t) {
1402
+ function yn(e, t) {
1411
1403
  try {
1412
1404
  return JSON.parse(e.read(t));
1413
1405
  } catch {
1414
1406
  return;
1415
1407
  }
1416
1408
  }
1417
- function xn(e) {
1418
- if (e.includes("*")) throw new Y(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
1409
+ function bn(e) {
1410
+ if (e.includes("*")) throw new J(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
1419
1411
  let t = e.replace(/^\.\//, "").replace(/\/$/, "");
1420
1412
  return t === "." ? "" : t;
1421
1413
  }
1422
- function Sn(e) {
1414
+ function xn(e) {
1423
1415
  let t;
1424
1416
  try {
1425
1417
  t = e.read("pnpm-workspace.yaml");
1426
1418
  } catch {
1427
- throw new Y("No pnpm-workspace.yaml found. This directory is empty or unrecognisable as a block — run 'block-tools structure init' instead, or pass --sdk-internal for an in-monorepo block.");
1419
+ throw new J("No pnpm-workspace.yaml found. This directory is empty or unrecognisable as a block — run 'block-tools structure init' instead, or pass --sdk-internal for an in-monorepo block.");
1428
1420
  }
1429
1421
  let n = oe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1430
1422
  for (let t of r) {
1431
- let n = xn(t);
1423
+ let n = bn(t);
1432
1424
  (n === "" || e.exists(n)) && i.add(n);
1433
1425
  }
1434
1426
  let a = [];
1435
1427
  for (let t of i) {
1436
- let n = bn(e, yn(t, "package.json"));
1428
+ let n = yn(e, vn(t, "package.json"));
1437
1429
  n && a.push({
1438
1430
  path: t,
1439
1431
  pkg: n
@@ -1441,7 +1433,7 @@ function Sn(e) {
1441
1433
  }
1442
1434
  return a;
1443
1435
  }
1444
- function Cn(e) {
1436
+ function Sn(e) {
1445
1437
  let t = [], n = new Set([
1446
1438
  "node_modules",
1447
1439
  ".turbo",
@@ -1453,7 +1445,7 @@ function Cn(e) {
1453
1445
  let o = e.listDir(i);
1454
1446
  for (let s of o) {
1455
1447
  if (!s.isDirectory || n.has(s.name)) continue;
1456
- let o = yn(i, s.name), c = bn(e, yn(o, "package.json"));
1448
+ let o = vn(i, s.name), c = yn(e, vn(o, "package.json"));
1457
1449
  c && t.push({
1458
1450
  path: o,
1459
1451
  pkg: c
@@ -1462,11 +1454,11 @@ function Cn(e) {
1462
1454
  }
1463
1455
  return r("", 1), t;
1464
1456
  }
1465
- function wn(e) {
1457
+ function Cn(e) {
1466
1458
  let t = e.indexOf("/");
1467
- if (!e.startsWith("@") || t < 0) throw new Y(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1459
+ if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1468
1460
  let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
1469
- if (i < 0) throw new Y(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1461
+ if (i < 0) throw new J(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1470
1462
  return {
1471
1463
  facadeName: e,
1472
1464
  baseName: r,
@@ -1475,23 +1467,23 @@ function wn(e) {
1475
1467
  shortName: r.slice(i + 1)
1476
1468
  };
1477
1469
  }
1478
- function Tn(e) {
1470
+ function wn(e) {
1479
1471
  try {
1480
- let t = JSON.parse(e.read(Wt));
1472
+ let t = JSON.parse(e.read(Ht));
1481
1473
  return typeof t.version == "number" ? t.version : 0;
1482
1474
  } catch {
1483
1475
  return 0;
1484
1476
  }
1485
1477
  }
1486
- function En(e) {
1487
- let { fs: t, isSdkInternal: n } = e, r = n ? Cn(t) : Sn(t);
1488
- if (r.length === 0) throw new Y("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1489
- let i = mn(r), a = Tn(t);
1490
- Gt(a, 0);
1478
+ function Tn(e) {
1479
+ let { fs: t, isSdkInternal: n } = e, r = n ? Sn(t) : xn(t);
1480
+ if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1481
+ let i = fn(r), a = wn(t);
1482
+ Ut(a, 0);
1491
1483
  let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
1492
- if (!o) throw new Y("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1493
- let s = wn(o.name);
1494
- return vn({
1484
+ if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1485
+ let s = Cn(o.name.replace(/\.block$/, ""));
1486
+ return _n({
1495
1487
  isSdkInternal: n,
1496
1488
  updateDepsOnly: e.updateDepsOnly ?? !1,
1497
1489
  modules: i,
@@ -1502,7 +1494,7 @@ function En(e) {
1502
1494
  }
1503
1495
  //#endregion
1504
1496
  //#region src/structure/rules/shared/key-order.ts
1505
- var X = [
1497
+ var Y = [
1506
1498
  "name",
1507
1499
  "version",
1508
1500
  "private",
@@ -1526,7 +1518,7 @@ var X = [
1526
1518
  ];
1527
1519
  //#endregion
1528
1520
  //#region src/structure/rules/root-package-json.ts
1529
- function Dn(e) {
1521
+ function En(e) {
1530
1522
  return {
1531
1523
  version: "1.0.0",
1532
1524
  private: !0,
@@ -1559,8 +1551,8 @@ function Dn(e) {
1559
1551
  packageManager: "pnpm@9.12.0"
1560
1552
  };
1561
1553
  }
1562
- function On() {
1563
- F("packageManager", "pnpm@9.12.0"), Ot("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), L("update"), I("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), H({
1554
+ function Dn() {
1555
+ F("packageManager", "pnpm@9.12.0"), Et("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), L("update"), I("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), H({
1564
1556
  "@changesets/cli": "catalog:",
1565
1557
  "@milaboratories/ts-builder": "sdk:",
1566
1558
  "@platforma-sdk/block-tools": "sdk:",
@@ -1569,78 +1561,78 @@ function On() {
1569
1561
  }), U({
1570
1562
  oxlint: "*",
1571
1563
  oxfmt: "*"
1572
- }), Mt((e, t) => {
1564
+ }), At((e, t) => {
1573
1565
  if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
1574
1566
  let n = t;
1575
1567
  return n.pnpm !== void 0 || n.overrides !== void 0;
1576
- }), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1568
+ }), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1577
1569
  }
1578
1570
  //#endregion
1579
1571
  //#region src/structure/engine/registry-client.ts
1580
- var kn = 2, An = 500, jn = 3e4;
1581
- function Mn(e) {
1572
+ var On = 2, kn = 500, An = 3e4;
1573
+ function jn(e) {
1582
1574
  if (!e) return null;
1583
1575
  let t = Number(e);
1584
1576
  if (Number.isFinite(t) && t > 0) return t * 1e3;
1585
1577
  let n = Date.parse(e);
1586
1578
  return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
1587
1579
  }
1588
- async function Nn(e) {
1580
+ async function Mn(e) {
1589
1581
  for (let t = 1;; t++) {
1590
1582
  let n;
1591
1583
  try {
1592
- n = await fetch(e, { signal: AbortSignal.timeout(jn) });
1584
+ n = await fetch(e, { signal: AbortSignal.timeout(An) });
1593
1585
  } catch (e) {
1594
- if (t > kn) throw e;
1595
- await le(An * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1586
+ if (t > On) throw e;
1587
+ await le(kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1596
1588
  continue;
1597
1589
  }
1598
1590
  if (n.ok) return n;
1599
- if (!(n.status === 429 || n.status >= 500) || t > kn) throw Error(`registry returned HTTP ${n.status}`);
1600
- let r = Mn(n.headers.get("retry-after"));
1591
+ if (!(n.status === 429 || n.status >= 500) || t > On) throw Error(`registry returned HTTP ${n.status}`);
1592
+ let r = jn(n.headers.get("retry-after"));
1601
1593
  if (r != null) {
1602
1594
  await le(r);
1603
1595
  continue;
1604
1596
  }
1605
- await le(An * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1597
+ await le(kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1606
1598
  }
1607
1599
  }
1608
- function Pn() {
1600
+ function Nn() {
1609
1601
  return {
1610
1602
  async getLatestVersion(e) {
1611
- let t = (await (await Nn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1603
+ let t = (await (await Mn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1612
1604
  if (!t) throw Error("no 'latest' dist-tag in registry response");
1613
1605
  return t;
1614
1606
  },
1615
1607
  async getDeclaredDependency(e, t, n) {
1616
- let r = await (await Nn(`https://registry.npmjs.org/${e}/${t}`)).json();
1608
+ let r = await (await Mn(`https://registry.npmjs.org/${e}/${t}`)).json();
1617
1609
  return r.dependencies?.[n] ?? r.peerDependencies?.[n];
1618
1610
  }
1619
1611
  };
1620
1612
  }
1621
- async function Fn(e, t) {
1613
+ async function Pn(e, t) {
1622
1614
  let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
1623
1615
  return new Map(n);
1624
1616
  }
1625
- function In(e) {
1617
+ function Fn(e) {
1626
1618
  return (t) => e.get(t);
1627
1619
  }
1628
- var Ln = [/^@platforma-sdk\//, /^@milaboratories\//];
1629
- function Rn(e) {
1630
- return Ln.some((t) => t.test(e));
1620
+ var In = [/^@platforma-sdk\//, /^@milaboratories\//];
1621
+ function Ln(e) {
1622
+ return In.some((t) => t.test(e));
1631
1623
  }
1632
- async function zn(e, t = Pn()) {
1633
- return e.length === 0 ? () => void 0 : In(await Fn(t, e));
1624
+ async function Rn(e, t = Nn()) {
1625
+ return e.length === 0 ? () => void 0 : Fn(await Pn(t, e));
1634
1626
  }
1635
- function Bn(e) {
1627
+ function zn(e) {
1636
1628
  return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
1637
1629
  }
1638
- async function Vn(e, t = Pn()) {
1630
+ async function Bn(e, t = Nn()) {
1639
1631
  if (e.length === 0) return () => void 0;
1640
1632
  let n = await Promise.all(e.map(async (e) => {
1641
1633
  let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
1642
1634
  if (n === void 0) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares no dependency '${e.entry}'. A derived pin requires the source to declare the dep as an exact version.`);
1643
- if (!Bn(n)) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares '${e.entry}: ${n}', which is not an exact version. A derived pin requires an exact ('x.y.z') source dependency so the catalog can pin to it precisely.`);
1635
+ if (!zn(n)) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares '${e.entry}: ${n}', which is not an exact version. A derived pin requires an exact ('x.y.z') source dependency so the catalog can pin to it precisely.`);
1644
1636
  return [e.entry, n];
1645
1637
  })), r = new Map(n);
1646
1638
  return (e) => r.get(e);
@@ -1648,7 +1640,7 @@ async function Vn(e, t = Pn()) {
1648
1640
  //#endregion
1649
1641
  //#region src/structure/rules/shared/retired-deps.ts
1650
1642
  // @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
1651
- var Hn = [
1643
+ var Vn = [
1652
1644
  "vite",
1653
1645
  "tsup",
1654
1646
  "vue-tsc",
@@ -1656,12 +1648,12 @@ var Hn = [
1656
1648
  "vite-plugin-dts",
1657
1649
  "@platforma-sdk/eslint-config"
1658
1650
  ];
1659
- function Un() {
1660
- for (let e of Hn) V(e);
1651
+ function Hn() {
1652
+ for (let e of Vn) V(e);
1661
1653
  }
1662
1654
  //#endregion
1663
1655
  //#region src/structure/rules/root-pnpm-workspace.ts
1664
- var Z = [
1656
+ var X = [
1665
1657
  "@platforma-sdk/model",
1666
1658
  "@platforma-sdk/ui-vue",
1667
1659
  "@platforma-sdk/workflow-tengo",
@@ -1671,32 +1663,32 @@ var Z = [
1671
1663
  "@platforma-sdk/package-builder",
1672
1664
  "@milaboratories/ts-builder",
1673
1665
  "@milaboratories/ts-configs"
1674
- ], Wn = "0.0.0-init-must-fetch";
1675
- for (let e of Z) if (!Rn(e)) throw Error(`SDK_CATALOG_PACKAGES entry '${e}' matches no catalog bump pattern; its placeholder would never be resolved to npm latest on init. Add it to CATALOG_BUMP_PATTERNS or move it to the infra floor.`);
1676
- var Gn = {
1666
+ ], Un = "0.0.0-init-must-fetch";
1667
+ for (let e of X) if (!Ln(e)) throw Error(`SDK_CATALOG_PACKAGES entry '${e}' matches no catalog bump pattern; its placeholder would never be resolved to npm latest on init. Add it to CATALOG_BUMP_PATTERNS or move it to the infra floor.`);
1668
+ var Wn = {
1677
1669
  turbo: "~2.8.11",
1678
1670
  shx: "~0.4.0",
1679
1671
  "@changesets/cli": "~2.29.8",
1680
1672
  vitest: "~4.0.18"
1681
- }, Kn = [{
1673
+ }, Gn = [{
1682
1674
  entry: "vue",
1683
1675
  of: "@platforma-sdk/ui-vue"
1684
- }], qn = "@platforma-open/milaboratories.runenv-python-3", Jn = "1.8.2";
1685
- function Yn(e) {
1676
+ }], Kn = "@platforma-open/milaboratories.runenv-python-3", qn = "1.8.2";
1677
+ function Jn(e) {
1686
1678
  let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
1687
- for (let e of Z) n[e] = Wn;
1688
- return Object.assign(n, Gn), e.modules.some((e) => e.scope === "software") && (n[qn] = Jn), {
1679
+ for (let e of X) n[e] = Un;
1680
+ return Object.assign(n, Wn), e.modules.some((e) => e.scope === "software") && (n[Kn] = qn), {
1689
1681
  packages: t,
1690
1682
  catalog: n
1691
1683
  };
1692
1684
  }
1693
- function Xn() {
1694
- Ft();
1695
- for (let e of Hn) Bt(e);
1685
+ function Yn() {
1686
+ Nt();
1687
+ for (let e of Vn) Rt(e);
1696
1688
  }
1697
1689
  //#endregion
1698
1690
  //#region src/structure/rules/root-gitignore.ts
1699
- var Zn = [
1691
+ var Xn = [
1700
1692
  ".test_auth.json",
1701
1693
  "node_modules/",
1702
1694
  "dist/",
@@ -1711,34 +1703,52 @@ var Zn = [
1711
1703
  ".vscode/sftp.json",
1712
1704
  "test-dry-run.json"
1713
1705
  ];
1714
- function Qn() {
1715
- Vt(Zn);
1706
+ function Zn() {
1707
+ zt(Xn);
1716
1708
  }
1717
1709
  //#endregion
1718
1710
  //#region src/structure/rules/root.ts
1719
- function $n() {
1720
- b("root", () => {
1721
- x(({ ctx: e }) => !e.isSdkInternal, () => {
1722
- C("turbo.json", D("root/turbo.json")), C(".vscode/settings.json", D("root/.vscode/settings.json")), w("package.json", O(() => Dn(y())), () => {
1723
- On();
1724
- }), w("pnpm-workspace.yaml", O(() => Yn(y())), () => {
1725
- Xn();
1726
- }), w(".gitignore", D("root/.gitignore"), () => {
1727
- Qn();
1711
+ function Qn() {
1712
+ y("root", () => {
1713
+ b(({ ctx: e }) => !e.isSdkInternal, () => {
1714
+ S("turbo.json", E("root/turbo.json")), S(".vscode/settings.json", E("root/.vscode/settings.json")), C("package.json", O((e) => En(e)), () => {
1715
+ Dn();
1716
+ }), C("pnpm-workspace.yaml", O((e) => Jn(e)), () => {
1717
+ Yn();
1718
+ }), C(".gitignore", E("root/.gitignore"), () => {
1719
+ Zn();
1728
1720
  });
1729
1721
  });
1730
1722
  });
1731
1723
  }
1732
1724
  //#endregion
1725
+ //#region src/structure/rules/root-ci.ts
1726
+ function $n(e) {
1727
+ return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
1728
+ }
1729
+ function er() {
1730
+ y("root", () => {
1731
+ b(({ ctx: e }) => !e.isSdkInternal, () => {
1732
+ S(".github/workflows/build.yaml", D("workflows/build.tpl.yaml", (e) => {
1733
+ let t = e.blockVars.shortName;
1734
+ return {
1735
+ appName: `Block: ${$n(t)}`,
1736
+ appNameSlug: `block-${t}`
1737
+ };
1738
+ })), S(".github/workflows/mark-stable.yaml", D("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${$n(e.blockVars.shortName)} - Mark Stable` })));
1739
+ });
1740
+ });
1741
+ }
1742
+ //#endregion
1733
1743
  //#region src/structure/rules/block-package-json.ts
1734
- function er(e) {
1744
+ function tr(e) {
1735
1745
  let t = {};
1736
1746
  for (let n of q(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
1737
1747
  for (let n of q(e, "model")) t.model = `${n.name}/dist/model.json`;
1738
1748
  for (let n of q(e, "ui")) t.ui = `${n.name}/dist`;
1739
1749
  return t;
1740
1750
  }
1741
- function tr(e) {
1751
+ function nr(e) {
1742
1752
  if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
1743
1753
  let t = e.meta, n = [
1744
1754
  ["block.meta.title", t.title],
@@ -1750,13 +1760,13 @@ function tr(e) {
1750
1760
  ];
1751
1761
  for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
1752
1762
  }
1753
- function nr(e) {
1763
+ function rr(e) {
1754
1764
  let t = e.blockVars, n = {
1755
- ...J(e, "model"),
1756
- ...J(e, "ui"),
1757
- ...J(e, "workflow")
1765
+ ...mn(e, "model"),
1766
+ ...mn(e, "ui"),
1767
+ ...mn(e, "workflow")
1758
1768
  }, r = {
1759
- components: er(e),
1769
+ components: tr(e),
1760
1770
  meta: {
1761
1771
  title: t.shortName,
1762
1772
  description: `${t.shortName} block`,
@@ -1768,7 +1778,7 @@ function nr(e) {
1768
1778
  }
1769
1779
  }
1770
1780
  };
1771
- return tr(r), {
1781
+ return nr(r), {
1772
1782
  name: `${t.facadeName}.block`,
1773
1783
  version: "1.0.0",
1774
1784
  files: ["index.d.ts", "index.js"],
@@ -1786,24 +1796,24 @@ function nr(e) {
1786
1796
  block: r
1787
1797
  };
1788
1798
  }
1789
- function rr() {
1790
- F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), W("model"), W("ui"), W("workflow"), B("@platforma-sdk/block-tools", "sdk:"), B("shx", "catalog:"), F("block.components", er(y())), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1799
+ function ir(e) {
1800
+ F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), W("model"), W("ui"), W("workflow"), B("@platforma-sdk/block-tools", "sdk:"), B("shx", "catalog:"), F("block.components", tr(e)), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1791
1801
  }
1792
1802
  //#endregion
1793
1803
  //#region src/structure/rules/block.ts
1794
- function ir() {
1795
- b("block", () => {
1796
- C("index.js", D("block/index.js")), C("index.d.ts", D("block/index.d.ts")), T("logos/block-logo.png", Qe("block/logos/block-logo.png")), T("logos/organization-logo.png", Qe("block/logos/organization-logo.png")), w("package.json", O(() => nr(y())), () => {
1797
- rr();
1804
+ function ar() {
1805
+ y("block", () => {
1806
+ S("index.js", E("block/index.js")), S("index.d.ts", E("block/index.d.ts")), w("logos/block-logo.png", Qe("block/logos/block-logo.png")), w("logos/organization-logo.png", Qe("block/logos/organization-logo.png")), C("package.json", O((e) => rr(e)), (e) => {
1807
+ ir(e);
1798
1808
  });
1799
1809
  });
1800
1810
  }
1801
1811
  //#endregion
1802
1812
  //#region src/structure/rules/shared/colocated-tests.ts
1803
- var Q = "src/**/*.test.ts";
1813
+ var Z = "src/**/*.test.ts";
1804
1814
  //#endregion
1805
1815
  //#region src/structure/rules/model-package-json.ts
1806
- function ar(e) {
1816
+ function or(e) {
1807
1817
  return {
1808
1818
  name: `${e.blockVars.facadeName}.model`,
1809
1819
  version: "1.0.0",
@@ -1837,7 +1847,7 @@ function ar(e) {
1837
1847
  }
1838
1848
  };
1839
1849
  }
1840
- function or() {
1850
+ function sr() {
1841
1851
  F("type", "module"), F("main", "dist/index.cjs"), F("module", "dist/index.js"), F("types", "dist/index.d.ts"), F("exports", {
1842
1852
  ".": {
1843
1853
  types: "./dist/index.d.ts",
@@ -1852,22 +1862,22 @@ function or() {
1852
1862
  }), U({
1853
1863
  "@types/node": "*",
1854
1864
  typescript: "*"
1855
- }), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1865
+ }), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
1856
1866
  I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
1857
- }, () => V("vitest"))), Un(), Ot("tsup"), L("lint"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1867
+ }, () => V("vitest"))), Hn(), Et("tsup"), L("lint"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1858
1868
  }
1859
1869
  //#endregion
1860
1870
  //#region src/structure/rules/model.ts
1861
- function sr() {
1862
- b("model", () => {
1863
- x(S(Q), () => C("tsconfig.json", D("model/tsconfig.node.json")), () => C("tsconfig.json", D("model/tsconfig.json"))), C(".oxlintrc.json", D("model/.oxlintrc.json")), C(".oxfmtrc.json", D("model/.oxfmtrc.json")), T("src/index.ts", D("model/src/index.ts")), w("package.json", O(() => ar(y())), () => {
1864
- or();
1871
+ function cr() {
1872
+ y("model", () => {
1873
+ b(x(Z), () => S("tsconfig.json", E("model/tsconfig.node.json")), () => S("tsconfig.json", E("model/tsconfig.json"))), S(".oxlintrc.json", E("model/.oxlintrc.json")), S(".oxfmtrc.json", E("model/.oxfmtrc.json")), w("src/index.ts", E("model/src/index.ts")), C("package.json", O((e) => or(e)), () => {
1874
+ sr();
1865
1875
  });
1866
1876
  });
1867
1877
  }
1868
1878
  //#endregion
1869
1879
  //#region src/structure/rules/ui-package-json.ts
1870
- function cr(e) {
1880
+ function lr(e) {
1871
1881
  return {
1872
1882
  name: `${e.blockVars.facadeName}.ui`,
1873
1883
  version: "1.0.0",
@@ -1882,7 +1892,7 @@ function cr(e) {
1882
1892
  dependencies: {
1883
1893
  "@platforma-sdk/ui-vue": "sdk:",
1884
1894
  vue: "catalog:",
1885
- ...J(e, "model")
1895
+ ...mn(e, "model")
1886
1896
  },
1887
1897
  devDependencies: {
1888
1898
  "@milaboratories/ts-builder": "sdk:",
@@ -1894,29 +1904,29 @@ function cr(e) {
1894
1904
  }
1895
1905
  };
1896
1906
  }
1897
- function lr() {
1907
+ function ur() {
1898
1908
  F("type", "module"), I("fmt", "ts-builder format"), I("dev", "ts-builder serve --target block-ui"), I("watch", "ts-builder build --target block-ui --watch"), I("build", "ts-builder build --target block-ui"), I("check", "ts-builder check --target block-ui"), z("@platforma-sdk/ui-vue", "sdk:"), z("vue", "catalog:"), W("model"), H({
1899
1909
  "@milaboratories/ts-builder": "sdk:",
1900
1910
  "@milaboratories/ts-configs": "sdk:"
1901
- }), Un(), L("preview"), L("lint"), U({
1911
+ }), Hn(), L("preview"), L("lint"), U({
1902
1912
  "@types/node": "*",
1903
1913
  typescript: "*"
1904
- }), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1914
+ }), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
1905
1915
  I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
1906
- }, () => V("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1916
+ }, () => V("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1907
1917
  }
1908
1918
  //#endregion
1909
1919
  //#region src/structure/rules/ui.ts
1910
- function ur() {
1911
- b("ui", () => {
1912
- x(S(Q), () => C("tsconfig.json", D("ui/tsconfig.node.json")), () => C("tsconfig.json", D("ui/tsconfig.json"))), C(".oxlintrc.json", D("ui/.oxlintrc.json")), C(".oxfmtrc.json", D("ui/.oxfmtrc.json")), Ze("index.html", D("ui/index.html")), T("src/main.ts", D("ui/src/main.ts")), T("src/app.ts", et("ui/src/app.tpl.ts", () => ({ modelPkg: `${tt().facadeName}.model` }))), T("src/MainPage.vue", et("ui/src/MainPage.tpl.vue", () => ({ shortName: tt().shortName }))), w("package.json", O(() => cr(y())), () => {
1913
- lr();
1920
+ function dr() {
1921
+ y("ui", () => {
1922
+ b(x(Z), () => S("tsconfig.json", E("ui/tsconfig.node.json")), () => S("tsconfig.json", E("ui/tsconfig.json"))), S(".oxlintrc.json", E("ui/.oxlintrc.json")), S(".oxfmtrc.json", E("ui/.oxfmtrc.json")), Ze("index.html", E("ui/index.html")), w("src/main.ts", E("ui/src/main.ts")), w("src/app.ts", D("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), w("src/MainPage.vue", D("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), C("package.json", O((e) => lr(e)), () => {
1923
+ ur();
1914
1924
  });
1915
1925
  });
1916
1926
  }
1917
1927
  //#endregion
1918
1928
  //#region src/structure/rules/workflow-package-json.ts
1919
- function dr(e) {
1929
+ function fr(e) {
1920
1930
  return {
1921
1931
  name: `${e.blockVars.facadeName}.workflow`,
1922
1932
  version: "1.0.0",
@@ -1928,7 +1938,7 @@ function dr(e) {
1928
1938
  },
1929
1939
  dependencies: {
1930
1940
  "@platforma-sdk/workflow-tengo": "sdk:",
1931
- ...gn(e, "software")
1941
+ ...hn(e, "software")
1932
1942
  },
1933
1943
  devDependencies: {
1934
1944
  "@platforma-sdk/tengo-builder": "sdk:",
@@ -1937,31 +1947,31 @@ function dr(e) {
1937
1947
  }
1938
1948
  };
1939
1949
  }
1940
- function fr() {
1941
- F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1950
+ function pr() {
1951
+ F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
1942
1952
  I("test", "vitest run --passWithNoTests"), H({ vitest: "catalog:" });
1943
1953
  }, () => V("vitest"))), z("@platforma-sdk/workflow-tengo", "sdk:"), W("software"), H({
1944
1954
  "@platforma-sdk/tengo-builder": "sdk:",
1945
1955
  "@platforma-sdk/test": "sdk:",
1946
1956
  shx: "catalog:"
1947
- }), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1957
+ }), Hn(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1948
1958
  }
1949
1959
  //#endregion
1950
1960
  //#region src/structure/rules/workflow.ts
1951
- function pr() {
1952
- b("workflow", () => {
1953
- C("format.el", D("workflow/format.el")), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1954
- C("tsconfig.json", D("workflow/tsconfig.json")), Ze("vitest.config.mts", D("workflow/vitest.config.mts"));
1961
+ function mr() {
1962
+ y("workflow", () => {
1963
+ S("format.el", E("workflow/format.el")), b(({ ctx: e }) => !e.isSdkInternal, () => b(x(Z), () => {
1964
+ S("tsconfig.json", E("workflow/tsconfig.json")), Ze("vitest.config.mts", E("workflow/vitest.config.mts"));
1955
1965
  }, () => {
1956
- E("tsconfig.json"), E("vitest.config.mts");
1957
- })), E("index.js"), E("index.d.ts"), T("src/main.tpl.tengo", et("workflow/src/main.tpl.tengo", () => ({ shortName: tt().shortName }))), w("package.json", O(() => dr(y())), () => {
1958
- fr();
1966
+ T("tsconfig.json"), T("vitest.config.mts");
1967
+ })), T("index.js"), T("index.d.ts"), w("src/main.tpl.tengo", D("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), C("package.json", O((e) => fr(e)), () => {
1968
+ pr();
1959
1969
  });
1960
1970
  });
1961
1971
  }
1962
1972
  //#endregion
1963
1973
  //#region src/structure/rules/test-package-json.ts
1964
- function mr(e) {
1974
+ function hr(e) {
1965
1975
  return {
1966
1976
  name: `${e.blockVars.facadeName}.test`,
1967
1977
  version: "1.0.0",
@@ -1981,26 +1991,26 @@ function mr(e) {
1981
1991
  }
1982
1992
  };
1983
1993
  }
1984
- function hr() {
1994
+ function gr() {
1985
1995
  F("type", "module"), I("fmt", "ts-builder format"), I("check", "ts-builder check --target block-test"), I("test", "vitest run --passWithNoTests"), L("lint"), H({
1986
1996
  "@platforma-sdk/test": "sdk:",
1987
1997
  "@milaboratories/ts-builder": "sdk:",
1988
1998
  "@milaboratories/ts-configs": "sdk:",
1989
1999
  vitest: "catalog:"
1990
- }), U({ typescript: "*" }), V("@types/node"), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
2000
+ }), U({ typescript: "*" }), V("@types/node"), Hn(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1991
2001
  }
1992
2002
  //#endregion
1993
2003
  //#region src/structure/rules/test.ts
1994
- function gr() {
1995
- b("test", () => {
1996
- C("tsconfig.json", D("test/tsconfig.json")), C(".oxlintrc.json", D("test/.oxlintrc.json")), C(".oxfmtrc.json", D("test/.oxfmtrc.json")), Ze("vitest.config.mts", D("test/vitest.config.mts")), T("src/demo.test.ts", $e("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), w("package.json", O(() => mr(y())), () => {
1997
- hr();
2004
+ function _r() {
2005
+ y("test", () => {
2006
+ S("tsconfig.json", E("test/tsconfig.json")), S(".oxlintrc.json", E("test/.oxlintrc.json")), S(".oxfmtrc.json", E("test/.oxfmtrc.json")), Ze("vitest.config.mts", E("test/vitest.config.mts")), w("src/demo.test.ts", $e("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), C("package.json", O((e) => hr(e)), () => {
2007
+ gr();
1998
2008
  });
1999
2009
  });
2000
2010
  }
2001
2011
  //#endregion
2002
2012
  //#region src/structure/rules/software-package-json.ts
2003
- function _r() {
2013
+ function vr() {
2004
2014
  return { entrypoints: { main: { binary: {
2005
2015
  artifact: {
2006
2016
  type: "python",
@@ -2015,7 +2025,7 @@ function _r() {
2015
2025
  cmd: ["python", "{pkg}/main.py"]
2016
2026
  } } } };
2017
2027
  }
2018
- function vr(e) {
2028
+ function yr(e) {
2019
2029
  return {
2020
2030
  name: `${e.blockVars.facadeName}.software`,
2021
2031
  version: "1.0.0",
@@ -2028,56 +2038,56 @@ function vr(e) {
2028
2038
  changeset: "changeset",
2029
2039
  "version-packages": "changeset version"
2030
2040
  },
2031
- "block-software": _r(),
2041
+ "block-software": vr(),
2032
2042
  devDependencies: {
2033
2043
  "@platforma-open/milaboratories.runenv-python-3": "catalog:",
2034
2044
  "@platforma-sdk/package-builder": "sdk:"
2035
2045
  }
2036
2046
  };
2037
2047
  }
2038
- function yr() {
2048
+ function br() {
2039
2049
  F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"), H({
2040
2050
  "@platforma-open/milaboratories.runenv-python-3": "catalog:",
2041
2051
  "@platforma-sdk/package-builder": "sdk:"
2042
- }), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
2052
+ }), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
2043
2053
  }
2044
2054
  //#endregion
2045
2055
  //#region src/structure/rules/software.ts
2046
- var br = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", xr = "# No dependencies specified for this script\n";
2047
- function Sr() {
2048
- b("software", () => {
2049
- T("src/main.py", $e(br)), T("src/requirements.txt", $e(xr)), w("package.json", O(() => vr(y())), () => {
2050
- yr();
2056
+ var xr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", Sr = "# No dependencies specified for this script\n";
2057
+ function Cr() {
2058
+ y("software", () => {
2059
+ w("src/main.py", $e(xr)), w("src/requirements.txt", $e(Sr)), C("package.json", O((e) => yr(e)), () => {
2060
+ br();
2051
2061
  });
2052
2062
  });
2053
2063
  }
2054
- function Cr() {
2055
- b("model", () => {
2056
- E("eslint.config.mjs"), E("vite.config.mts");
2057
- }), b("ui", () => {
2058
- E("eslint.config.mjs"), E("vite.config.ts"), E("tsconfig.app.json"), E("tsconfig.node.json");
2059
- }), b("test", () => {
2060
- E("eslint.config.mjs");
2061
- }), b("root", () => {
2062
- E(".prettierrc"), w("package.json", O(() => Dn(y())), () => {
2064
+ function wr() {
2065
+ y("model", () => {
2066
+ T("eslint.config.mjs"), T("vite.config.mts");
2067
+ }), y("ui", () => {
2068
+ T("eslint.config.mjs"), T("vite.config.ts"), T("tsconfig.app.json"), T("tsconfig.node.json");
2069
+ }), y("test", () => {
2070
+ T("eslint.config.mjs");
2071
+ }), y("root", () => {
2072
+ T(".prettierrc"), C("package.json", O((e) => En(e)), () => {
2063
2073
  L("pretty"), V("@platforma-sdk/blocks-deps-updater");
2064
2074
  });
2065
2075
  });
2066
2076
  }
2067
2077
  //#endregion
2068
2078
  //#region src/structure/rules/root-catalog-bump.ts
2069
- function wr() {
2079
+ function Tr() {
2070
2080
  Xe(() => {
2071
- b("root", () => {
2072
- x(({ ctx: e }) => !e.isSdkInternal, () => {
2073
- w("pnpm-workspace.yaml", O(() => Yn(y())), () => {
2074
- for (let e of Z) Rt(e);
2075
- for (let e of Kn) zt(e.entry, {
2081
+ y("root", () => {
2082
+ b(({ ctx: e }) => !e.isSdkInternal, () => {
2083
+ C("pnpm-workspace.yaml", O((e) => Jn(e)), (e) => {
2084
+ for (let e of X) It(e);
2085
+ for (let e of Gn) Lt(e.entry, {
2076
2086
  of: e.of,
2077
2087
  ofVersion: e.ofVersion
2078
2088
  });
2079
- for (let [e, t] of Object.entries(Gn)) Lt(e, t);
2080
- y().modules.some((e) => e.scope === "software") && Lt(qn, Jn);
2089
+ for (let [e, t] of Object.entries(Wn)) Ft(e, t);
2090
+ e.modules.some((e) => e.scope === "software") && Ft(Kn, qn);
2081
2091
  });
2082
2092
  });
2083
2093
  });
@@ -2085,25 +2095,25 @@ function wr() {
2085
2095
  }
2086
2096
  //#endregion
2087
2097
  //#region src/structure/structure-definition.ts
2088
- var Tr = Ue(() => {
2089
- $n(), ir(), sr(), ur(), pr(), gr(), Sr(), Cr(), wr();
2098
+ var Er = Ue(() => {
2099
+ Qn(), er(), ar(), cr(), dr(), mr(), _r(), Cr(), wr(), Tr();
2090
2100
  });
2091
2101
  //#endregion
2092
2102
  //#region src/structure/cli/run-structure.ts
2093
- async function Er() {
2094
- return zn(Z.filter(Rn));
2103
+ async function Dr() {
2104
+ return Rn(X.filter(Ln));
2095
2105
  }
2096
- async function Dr(e) {
2097
- let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = cn(Tr, r, En({
2106
+ async function Or(e) {
2107
+ let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = on(Er, r, Tn({
2098
2108
  fs: r,
2099
2109
  isSdkInternal: e.isSdkInternal,
2100
2110
  updateDepsOnly: e.updateDepsOnly,
2101
2111
  dryRun: n
2102
2112
  }), {
2103
2113
  templates: i,
2104
- registryLookup: e.updateDepsOnly ? await Er() : void 0,
2105
- derivedPinLookup: e.updateDepsOnly ? await Vn(Kn) : void 0,
2106
- rediscover: () => En({
2114
+ registryLookup: e.updateDepsOnly ? await Dr() : void 0,
2115
+ derivedPinLookup: e.updateDepsOnly ? await Bn(Gn) : void 0,
2116
+ rediscover: () => Tn({
2107
2117
  fs: r,
2108
2118
  isSdkInternal: e.isSdkInternal,
2109
2119
  updateDepsOnly: !1,
@@ -2115,14 +2125,14 @@ async function Dr(e) {
2115
2125
  changes: a.changes
2116
2126
  };
2117
2127
  }
2118
- function Or(e, t) {
2128
+ function kr(e, t) {
2119
2129
  if (t.length === 0) return ` ${e}: up to date (0 changes)`;
2120
2130
  let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
2121
2131
  return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
2122
2132
  }
2123
2133
  //#endregion
2124
2134
  //#region src/cmd/structure/check.ts
2125
- var kr = class e extends d {
2135
+ var Ar = class e extends d {
2126
2136
  static description = "Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.";
2127
2137
  static examples = ["<%= config.bin %> <%= command.id %> ./my-block", "<%= config.bin %> <%= command.id %> --sdk-internal etc/blocks/*"];
2128
2138
  static strict = !1;
@@ -2130,7 +2140,7 @@ var kr = class e extends d {
2130
2140
  async run() {
2131
2141
  let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates"), a = !1;
2132
2142
  for (let e of r) {
2133
- let t = await Dr({
2143
+ let t = await Or({
2134
2144
  blockPath: e,
2135
2145
  isSdkInternal: n["sdk-internal"],
2136
2146
  updateDepsOnly: !1,
@@ -2138,38 +2148,38 @@ var kr = class e extends d {
2138
2148
  templatesRoot: i,
2139
2149
  log: (e) => this.log(e)
2140
2150
  });
2141
- this.log(Or(e, t.changes)), t.changes.length > 0 && (a = !0);
2151
+ this.log(kr(e, t.changes)), t.changes.length > 0 && (a = !0);
2142
2152
  }
2143
2153
  a && this.error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.", { exit: 1 });
2144
2154
  }
2145
- }, $ = ["python"], Ar = class extends Error {
2155
+ }, Q = ["python"], jr = class extends Error {
2146
2156
  constructor(e) {
2147
2157
  super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
2148
2158
  }
2149
2159
  };
2150
- async function jr(e, t, n, r) {
2160
+ async function $(e, t, n, r) {
2151
2161
  if (e !== void 0 && e !== "") return e;
2152
- if (n) throw new Ar(t);
2162
+ if (n) throw new jr(t);
2153
2163
  return r();
2154
2164
  }
2155
2165
  async function Mr(e) {
2156
- let t = await jr(e.npmOrg, "npm-org", e.nonInteractive, () => de({
2166
+ let t = await $(e.npmOrg, "npm-org", e.nonInteractive, () => de({
2157
2167
  message: "npm org (e.g. @platforma-open):",
2158
2168
  default: "@platforma-open"
2159
- })), n = await jr(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await jr(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2169
+ })), n = await $(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await $(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2160
2170
  i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
2161
2171
  message: "Include a software module?",
2162
2172
  default: !1
2163
2173
  }) : e.withSoftware;
2164
2174
  let a;
2165
2175
  if (i) {
2166
- if (a = await jr(e.platform, "platform", e.nonInteractive, () => fe({
2176
+ if (a = await $(e.platform, "platform", e.nonInteractive, () => fe({
2167
2177
  message: "Software platform:",
2168
- choices: $.map((e) => ({
2178
+ choices: Q.map((e) => ({
2169
2179
  name: e,
2170
2180
  value: e
2171
2181
  }))
2172
- })), !$.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${$.join(", ")} ${$.length === 1 ? "is" : "are"} supported at v1.`);
2182
+ })), !Q.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${Q.join(", ")} ${Q.length === 1 ? "is" : "are"} supported at v1.`);
2173
2183
  } else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
2174
2184
  return {
2175
2185
  facadeName: `${t}/${n}.${r}`,
@@ -2181,19 +2191,19 @@ async function Mr(e) {
2181
2191
  };
2182
2192
  }
2183
2193
  async function Nr(e) {
2184
- let t = e.vars, n = _n(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = vn({
2194
+ let t = e.vars, n = gn(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = _n({
2185
2195
  blockVars: t,
2186
2196
  modules: n,
2187
2197
  isSdkInternal: !1,
2188
2198
  version: 1,
2189
2199
  dryRun: !1
2190
- }), o = Z.filter(Rn), s, c;
2200
+ }), o = X.filter(Ln), s, c;
2191
2201
  try {
2192
- s = await zn(o), c = await Vn(Kn);
2202
+ s = await Rn(o), c = await Bn(Gn);
2193
2203
  } catch (e) {
2194
2204
  throw Error(`init requires network access to resolve SDK catalog versions from npm, but the registry lookup failed: ${e instanceof Error ? e.message : String(e)}`);
2195
2205
  }
2196
- return cn(Tr, r, a, {
2206
+ return on(Er, r, a, {
2197
2207
  templates: i,
2198
2208
  initMode: !0,
2199
2209
  registryLookup: s,
@@ -2213,7 +2223,7 @@ var Pr = {
2213
2223
  "restore-overview-from-snapshot": Se,
2214
2224
  "update-deps": Ce,
2215
2225
  "upload-package-v1": De,
2216
- "structure:check": kr,
2226
+ "structure:check": Ar,
2217
2227
  "structure:init": class e extends d {
2218
2228
  static description = "Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.";
2219
2229
  static examples = ["<%= config.bin %> <%= command.id %> --npm-org @platforma-open --org-scope my-org --short-name demo --no-software --non-interactive", "<%= config.bin %> <%= command.id %> ./demo --npm-org @platforma-open --org-scope my-org --short-name demo --with-software --platform python --non-interactive"];
@@ -2226,7 +2236,7 @@ var Pr = {
2226
2236
  "no-software": f.boolean({ description: "omit the software module" }),
2227
2237
  platform: f.string({
2228
2238
  description: "software platform (single-valued)",
2229
- options: [...$]
2239
+ options: [...Q]
2230
2240
  }),
2231
2241
  "non-interactive": f.boolean({ description: "error on any missing flag instead of prompting" })
2232
2242
  };
@@ -2264,7 +2274,7 @@ var Pr = {
2264
2274
  async run() {
2265
2275
  let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates");
2266
2276
  for (let e of r) {
2267
- let t = await Dr({
2277
+ let t = await Or({
2268
2278
  blockPath: e,
2269
2279
  isSdkInternal: n["sdk-internal"],
2270
2280
  updateDepsOnly: n["update-deps-only"],
@@ -2272,7 +2282,7 @@ var Pr = {
2272
2282
  templatesRoot: i,
2273
2283
  log: (e) => this.log(e)
2274
2284
  });
2275
- this.log(Or(e, t.changes));
2285
+ this.log(kr(e, t.changes));
2276
2286
  }
2277
2287
  }
2278
2288
  }