@platforma-sdk/block-tools 2.12.13 → 2.14.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 (69) hide show
  1. package/dist/cli.js +12 -12
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +804 -720
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/cmd/build-kind-manifest.d.ts +7 -0
  6. package/dist/config-CtXMWNgm.js +3 -0
  7. package/dist/config-CtXMWNgm.js.map +1 -0
  8. package/dist/{config-CiC347sB.mjs → config-Dx45aFJ_.mjs} +792 -456
  9. package/dist/config-Dx45aFJ_.mjs.map +1 -0
  10. package/dist/index.js +1 -1
  11. package/dist/index.mjs +15 -15
  12. package/dist/structure/engine/api.d.ts +1 -1
  13. package/dist/structure/rules/kind-package-json.d.ts +3 -0
  14. package/dist/structure/rules/kind.d.ts +1 -0
  15. package/dist/v2/build_kind_dist.d.ts +25 -0
  16. package/dist/v2/index.d.ts +4 -0
  17. package/dist/v2/kind/resolve-refs.d.ts +63 -0
  18. package/dist/v2/kind/version-match.d.ts +23 -0
  19. package/dist/v2/model/block_description.d.ts +8 -1
  20. package/dist/v2/publish-block.d.ts +23 -0
  21. package/dist/v2/registry/index.d.ts +2 -0
  22. package/dist/v2/registry/kind_resolver.d.ts +121 -0
  23. package/dist/v2/registry/registry.d.ts +23 -0
  24. package/dist/v2/registry/registry_reader.d.ts +34 -1
  25. package/dist/v2/registry/schema_kinds.d.ts +632 -0
  26. package/dist/v2/registry/schema_public.d.ts +72 -0
  27. package/package.json +9 -9
  28. package/src/cli.test.ts +2 -1
  29. package/src/cli.ts +2 -0
  30. package/src/cmd/build-kind-manifest.ts +41 -0
  31. package/src/cmd/publish.ts +10 -1
  32. package/src/cmd/software/build.ts +17 -1
  33. package/src/structure/__tests__/model-package-json.snapshot.test.ts +1 -0
  34. package/src/structure/engine/api.ts +1 -1
  35. package/src/structure/engine/ctx.ts +1 -0
  36. package/src/structure/engine/discovery.ts +16 -2
  37. package/src/structure/rules/block-package-json.ts +18 -0
  38. package/src/structure/rules/kind-package-json.ts +117 -0
  39. package/src/structure/rules/kind.ts +29 -0
  40. package/src/structure/rules/model-package-json.ts +8 -0
  41. package/src/structure/rules/model.ts +15 -13
  42. package/src/structure/rules/shared/pascal-case.ts +1 -1
  43. package/src/structure/structure-definition.ts +2 -0
  44. package/src/structure/templates/static/kind/.oxfmtrc.json +4 -0
  45. package/src/structure/templates/static/kind/.oxlintrc.json +3 -0
  46. package/src/structure/templates/static/kind/src/index.ts +49 -0
  47. package/src/structure/templates/static/kind/tsconfig.json +10 -0
  48. package/src/structure/templates/text/model/src/index.tpl.ts +18 -0
  49. package/src/v2/build_dist.ts +35 -0
  50. package/src/v2/build_kind_dist.ts +104 -0
  51. package/src/v2/from_pack_v2.test.ts +2 -2
  52. package/src/v2/index.ts +4 -0
  53. package/src/v2/kind/resolve-refs.ts +150 -0
  54. package/src/v2/kind/version-match.test.ts +60 -0
  55. package/src/v2/kind/version-match.ts +55 -0
  56. package/src/v2/model/block_description.ts +15 -4
  57. package/src/v2/publish-block.ts +60 -0
  58. package/src/v2/registry/index.ts +2 -0
  59. package/src/v2/registry/kind_resolver.test.ts +123 -0
  60. package/src/v2/registry/kind_resolver.ts +190 -0
  61. package/src/v2/registry/registry.test.ts +247 -1
  62. package/src/v2/registry/registry.ts +227 -4
  63. package/src/v2/registry/registry_reader.ts +68 -0
  64. package/src/v2/registry/schema_kinds.test.ts +65 -0
  65. package/src/v2/registry/schema_kinds.ts +169 -0
  66. package/dist/config-BmJWc8sR.js +0 -3
  67. package/dist/config-BmJWc8sR.js.map +0 -1
  68. package/dist/config-CiC347sB.mjs.map +0 -1
  69. package/src/structure/templates/static/model/src/index.ts +0 -13
package/dist/cli.mjs CHANGED
@@ -1,124 +1,136 @@
1
- import { H as e, O as t, Q as n, Tt as r, W as i, Y as a, _ as o, b as s, n as c, p as l, q as u, st as d, ut as f } from "./config-CiC347sB.mjs";
2
- import { Command as p, Option as m } from "commander";
3
- import h from "node:path";
4
- import g from "node:fs";
1
+ import { Ct as e, Ft as t, J as n, K as r, M as i, Mt as a, St as o, Xt as s, Y as c, _ as l, gt as u, n as d, p as f, vt as p, w as m } from "./config-Dx45aFJ_.mjs";
2
+ import { Command as h, Option as g } from "commander";
3
+ import _ from "node:path";
4
+ import v from "node:fs";
5
5
  import { BlockPackManifest as ee, StableChannel as te, overrideDescriptionVersion as ne, overrideManifestVersion as re } from "@milaboratories/pl-model-middle-layer";
6
- import { ConsoleLoggerAdapter as _ } from "@milaboratories/ts-helpers";
7
- import ie, { parse as ae, parseDocument as oe, stringify as se } from "yaml";
8
- import { setTimeout as ce } from "node:timers/promises";
9
- import * as le from "node:os";
10
- import { confirm as ue, input as de, select as fe } from "@inquirer/prompts";
11
- import { createBuilder as pe, defaults as me, envs as v, util as y } from "@platforma-sdk/package-builder-lib";
12
- import { spawnSync as he } from "node:child_process";
13
- import { ECRPUBLICClient as ge, GetAuthorizationTokenCommand as _e } from "@aws-sdk/client-ecr-public";
6
+ import { assertDockerPushIntent as ie, createBuilder as ae, defaults as oe, envs as y, util as b } from "@platforma-sdk/package-builder-lib";
7
+ import { ConsoleLoggerAdapter as x } from "@milaboratories/ts-helpers";
8
+ import se, { parse as ce, parseDocument as le, stringify as ue } from "yaml";
9
+ import { setTimeout as de } from "node:timers/promises";
10
+ import * as fe from "node:os";
11
+ import { confirm as pe, input as me, select as he } from "@inquirer/prompts";
12
+ import { spawnSync as ge } from "node:child_process";
13
+ import { ECRPUBLICClient as _e, GetAuthorizationTokenCommand as ve } from "@aws-sdk/client-ecr-public";
14
14
  //#region src/cmd/build-meta.ts
15
- function ve() {
16
- let e = new p("build-meta").description("Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section.");
15
+ function ye() {
16
+ let e = new h("build-meta").description("Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section.");
17
17
  return e.option("-i, --modulePath <path>", "input module path", "."), e.requiredOption("-o, --destination <path>", "output meta.json file"), e.action(async (e) => {
18
- let t = h.resolve(e.modulePath), n = await d(await f((await a(t)).meta, t));
19
- await g.promises.writeFile(h.resolve(e.destination), JSON.stringify(n));
18
+ let n = _.resolve(e.modulePath), r = await a(await t((await p(n)).meta, n));
19
+ await v.promises.writeFile(_.resolve(e.destination), JSON.stringify(r));
20
20
  }), e;
21
21
  }
22
22
  //#endregion
23
23
  //#region src/cmd/build-model.ts
24
- async function ye(e) {
24
+ async function be(e) {
25
25
  try {
26
- return await g.promises.readFile(e, "utf8");
26
+ return await v.promises.readFile(e, "utf8");
27
27
  } catch (e) {
28
28
  if (e instanceof Error && "code" in e && e.code === "ENOENT") return;
29
29
  throw e;
30
30
  }
31
31
  }
32
- function be() {
33
- let e = new p("build-model").description("Extracts and outputs block model JSON from pre-built block model module");
32
+ function xe() {
33
+ let e = new h("build-model").description("Extracts and outputs block model JSON from pre-built block model module");
34
34
  return e.option("-i, --modulePath <path>", "input module path", "."), e.option("-b, --sourceBundle <path>", "bundled model code to embed into the model for callback-based rendering to work", "./dist/bundle.js"), e.option("-o, --destination <path>", "output model file", "./dist/model.json"), e.action(async (e) => {
35
- let { model: t, platforma: n } = r(h.resolve(e.modulePath));
35
+ let { model: t, platforma: n } = s(_.resolve(e.modulePath));
36
36
  if (t ||= n, !t) throw Error("\"model\" export not found");
37
- let { config: i } = t;
38
- if (!i) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
39
- if (!("outputs" in i) || !("sections" in i)) throw Error("\"config\" has unexpected structure");
40
- let a = await ye(e.sourceBundle);
41
- a !== void 0 && (i.code = {
37
+ let { config: r } = t;
38
+ if (!r) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
39
+ if (!("outputs" in r) || !("sections" in r)) throw Error("\"config\" has unexpected structure");
40
+ let i = await be(e.sourceBundle);
41
+ i !== void 0 && (r.code = {
42
42
  type: "plain",
43
- content: a
44
- }), await g.promises.writeFile(h.resolve(e.destination), JSON.stringify(i));
43
+ content: i
44
+ }), await v.promises.writeFile(_.resolve(e.destination), JSON.stringify(r));
45
45
  }), e;
46
46
  }
47
47
  //#endregion
48
- //#region src/cmd/pack.ts
49
- function xe() {
50
- let e = new p("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
51
- return e.option("-i, --modulePath <path>", "input module path", "."), e.option("-o, --destinationPath <path>", "output folder", "./block-pack"), e.action(async (e) => {
52
- await n(await u(h.resolve(e.modulePath)), h.resolve(e.destinationPath));
48
+ //#region src/cmd/build-kind-manifest.ts
49
+ function Se() {
50
+ let e = new h("build-kind-manifest").description("Writes the block-kind dist manifest (identity + src source-hash) from a pre-built kind bundle");
51
+ return e.option("-i, --modulePath <path>", "kind package dir (contains package.json, src/, dist/)", "."), e.option("-s, --srcDir <path>", "source dir hashed into sourceHash, relative to modulePath", "src"), e.option("-o, --dst <path>", "output dir with the compiled bundle, relative to modulePath", "dist"), e.action(async (e) => {
52
+ await o({
53
+ modulePath: e.modulePath,
54
+ srcDir: e.srcDir,
55
+ dst: e.dst
56
+ });
53
57
  }), e;
54
58
  }
55
59
  //#endregion
60
+ //#region src/cmd/pack.ts
61
+ function Ce() {
62
+ let t = new h("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
63
+ return t.option("-i, --modulePath <path>", "input module path", "."), t.option("-o, --destinationPath <path>", "output folder", "./block-pack"), t.action(async (t) => {
64
+ await e(await u(_.resolve(t.modulePath)), _.resolve(t.destinationPath));
65
+ }), t;
66
+ }
67
+ //#endregion
56
68
  //#region src/cmd/publish.ts
57
- function Se(e, t) {
69
+ function we(e, t) {
58
70
  let n = { ...e };
59
- for (let e in t) t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ? n[e] = Se(n[e], t[e]) : n[e] = t[e];
71
+ for (let e in t) t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ? n[e] = we(n[e], t[e]) : n[e] = t[e];
60
72
  return n;
61
73
  }
62
- function Ce() {
63
- let n = new p("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
64
- return n.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), n.addOption(new m("--registry-serve-url <url>", "CDN serve URL written into block-pack/published.json (npm-consumed blocks)").env("PL_REGISTRY_SERVE_URL").makeOptionMandatory()), n.option("-m, --manifest <path>", "manifest file path", `./block-pack/${t}`), n.option("-v, --version-override <path>", "override package version"), n.addOption(new m("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), n.option("--no-refresh", "do not refresh repository after adding the package"), n.addOption(new m("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), n.action(async (t) => {
65
- let n = new _(), r = h.resolve(t.manifest), a = JSON.parse(await g.promises.readFile(r, { encoding: "utf-8" })), c = ee.parse(a);
66
- c = Se(a, c);
67
- let l = h.dirname(r);
68
- n.info(`Manifest root = ${l}`), t.versionOverride && (c = re(c, t.versionOverride));
69
- let u = new s(o(t.registry), n);
70
- await u.publishPackage(c, async (e) => Buffer.from(await g.promises.readFile(h.resolve(l, e)))), t.unstable || (n.info(`Adding package to ${te} channel...`), await u.addPackageToChannel(c.description.id, te)), await i(l, e({
71
- registryUrl: t.registryServeUrl,
72
- id: c.description.id
73
- })), n.info(`Wrote published coordinates to ${h.resolve(l, "published.json")}`), t.refresh && await u.updateIfNeeded();
74
- }), n;
74
+ function Te() {
75
+ let e = new h("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
76
+ return e.addOption(new g("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new g("--registry-serve-url <url>", "CDN serve URL written into block-pack/published.json (npm-consumed blocks)").env("PL_REGISTRY_SERVE_URL").makeOptionMandatory()), e.option("-m, --manifest <path>", "manifest file path", `./block-pack/${i}`), e.option("-v, --version-override <path>", "override package version"), e.addOption(new g("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.addOption(new g("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), e.action(async (e) => {
77
+ let t = new x(), i = _.resolve(e.manifest), a = JSON.parse(await v.promises.readFile(i, { encoding: "utf-8" })), o = ee.parse(a);
78
+ o = we(a, o);
79
+ let s = _.dirname(i), u = _.dirname(s);
80
+ t.info(`Manifest root = ${s}`), t.info(`Facade root = ${u}`), e.versionOverride && (o = re(o, e.versionOverride));
81
+ let d = new m(l(e.registry), t);
82
+ await c(d, o, u, async (e) => Buffer.from(await v.promises.readFile(_.resolve(s, e)))), e.unstable || (t.info(`Adding package to ${te} channel...`), await d.addPackageToChannel(o.description.id, te)), await n(s, r({
83
+ registryUrl: e.registryServeUrl,
84
+ id: o.description.id
85
+ })), t.info(`Wrote published coordinates to ${_.resolve(s, "published.json")}`), e.refresh && await d.updateIfNeeded();
86
+ }), e;
75
87
  }
76
88
  //#endregion
77
89
  //#region src/cmd/refresh-registry.ts
78
- function we() {
79
- let e = new p("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
80
- return e.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new m("-m, --mode <mode>", "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")").choices([
90
+ function Ee() {
91
+ let e = new h("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
92
+ return e.addOption(new g("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new g("-m, --mode <mode>", "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")").choices([
81
93
  "force",
82
94
  "normal",
83
95
  "dry-run"
84
96
  ]).env("PL_REGISTRY_REFRESH_DRY_RUN").default("normal")), e.action(async (e) => {
85
- await new s(o(e.registry), new _()).updateIfNeeded(e.mode);
97
+ await new m(l(e.registry), new x()).updateIfNeeded(e.mode);
86
98
  }), e;
87
99
  }
88
100
  //#endregion
89
101
  //#region src/cmd/mark-stable.ts
90
- function Te() {
91
- let e = new p("mark-stable").description("Mark target block stable");
92
- return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new m("-c, --channel <channel name>", "custom channel").default(te).hideHelp()), e.option("-v, --version-override <path>", "override package version"), e.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new m("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.option("--unmark", "reverses meaning of this command, flag can be used to remove \"stable\" flag from the package", !1), e.action(async (e) => {
93
- let t = await a(h.resolve(e.modulePath));
102
+ function De() {
103
+ let e = new h("mark-stable").description("Mark target block stable");
104
+ return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new g("-c, --channel <channel name>", "custom channel").default(te).hideHelp()), e.option("-v, --version-override <path>", "override package version"), e.addOption(new g("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new g("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.option("--unmark", "reverses meaning of this command, flag can be used to remove \"stable\" flag from the package", !1), e.action(async (e) => {
105
+ let t = await p(_.resolve(e.modulePath));
94
106
  e.versionOverride && (t = ne(t, e.versionOverride));
95
- let n = new s(o(e.registry), new _());
107
+ let n = new m(l(e.registry), new x());
96
108
  e.unmark ? await n.removePackageFromChannel(t.id, e.channel) : await n.addPackageToChannel(t.id, e.channel), e.refresh && await n.updateIfNeeded();
97
109
  }), e;
98
110
  }
99
111
  //#endregion
100
112
  //#region src/structure/engine/fs/node.ts
101
- var Ee = class {
113
+ var Oe = class {
102
114
  constructor(e) {
103
115
  this.root = e;
104
116
  }
105
117
  abs(e) {
106
- return h.resolve(this.root, e);
118
+ return _.resolve(this.root, e);
107
119
  }
108
120
  read(e) {
109
- return g.readFileSync(this.abs(e), "utf-8");
121
+ return v.readFileSync(this.abs(e), "utf-8");
110
122
  }
111
123
  write(e, t) {
112
124
  let n = this.abs(e);
113
- g.mkdirSync(h.dirname(n), { recursive: !0 }), g.writeFileSync(n, t, "utf-8");
125
+ v.mkdirSync(_.dirname(n), { recursive: !0 }), v.writeFileSync(n, t, "utf-8");
114
126
  }
115
127
  writeBinary(e, t) {
116
128
  let n = this.abs(e);
117
- g.mkdirSync(h.dirname(n), { recursive: !0 }), g.writeFileSync(n, t);
129
+ v.mkdirSync(_.dirname(n), { recursive: !0 }), v.writeFileSync(n, t);
118
130
  }
119
131
  exists(e) {
120
132
  try {
121
- return g.statSync(this.abs(e)), !0;
133
+ return v.statSync(this.abs(e)), !0;
122
134
  } catch {
123
135
  return !1;
124
136
  }
@@ -126,15 +138,15 @@ var Ee = class {
126
138
  list(e) {
127
139
  let t = this.abs(e);
128
140
  try {
129
- if (!g.statSync(t).isDirectory()) return [];
141
+ if (!v.statSync(t).isDirectory()) return [];
130
142
  } catch {
131
143
  return [];
132
144
  }
133
145
  let n = [];
134
146
  function r(e, t) {
135
- let i = g.readdirSync(t, { withFileTypes: !0 });
147
+ let i = v.readdirSync(t, { withFileTypes: !0 });
136
148
  for (let a of i) {
137
- let i = e ? `${e}/${a.name}` : a.name, o = h.join(t, a.name);
149
+ let i = e ? `${e}/${a.name}` : a.name, o = _.join(t, a.name);
138
150
  a.isDirectory() ? r(i, o) : a.isFile() && n.push(i);
139
151
  }
140
152
  }
@@ -143,7 +155,7 @@ var Ee = class {
143
155
  listDir(e) {
144
156
  let t = this.abs(e), n;
145
157
  try {
146
- n = g.readdirSync(t, { withFileTypes: !0 });
158
+ n = v.readdirSync(t, { withFileTypes: !0 });
147
159
  } catch {
148
160
  return [];
149
161
  }
@@ -154,48 +166,48 @@ var Ee = class {
154
166
  }
155
167
  move(e, t) {
156
168
  let n = this.abs(e), r = this.abs(t);
157
- g.mkdirSync(h.dirname(r), { recursive: !0 }), g.renameSync(n, r);
169
+ v.mkdirSync(_.dirname(r), { recursive: !0 }), v.renameSync(n, r);
158
170
  }
159
171
  delete(e) {
160
- g.rmSync(this.abs(e), {
172
+ v.rmSync(this.abs(e), {
161
173
  recursive: !0,
162
174
  force: !0
163
175
  });
164
176
  }
165
- }, De = class {
177
+ }, ke = class {
166
178
  constructor(e) {
167
179
  this.root = e;
168
180
  }
169
181
  staticRead(e) {
170
- return g.readFileSync(h.resolve(this.root, "static", e), "utf-8");
182
+ return v.readFileSync(_.resolve(this.root, "static", e), "utf-8");
171
183
  }
172
184
  staticReadBinary(e) {
173
- return g.readFileSync(h.resolve(this.root, "static", e));
185
+ return v.readFileSync(_.resolve(this.root, "static", e));
174
186
  }
175
187
  textRead(e) {
176
- return g.readFileSync(h.resolve(this.root, "text", e), "utf-8");
188
+ return v.readFileSync(_.resolve(this.root, "text", e), "utf-8");
177
189
  }
178
190
  };
179
- function Oe(e, t) {
191
+ function Ae(e, t) {
180
192
  return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => t[n] ?? `\${${n}}`);
181
193
  }
182
194
  //#endregion
183
195
  //#region src/structure/engine/flatten.ts
184
- var ke = ["default", "init"];
185
- function Ae(e, t) {
196
+ var je = ["default", "init"];
197
+ function Me(e, t) {
186
198
  if (!e) return t;
187
199
  if (!t) return e;
188
200
  let n = e.endsWith("/") ? e.slice(0, -1) : e, r = t.startsWith("/") ? t.slice(1) : t;
189
201
  return r ? `${n}/${r}` : n;
190
202
  }
191
- function je(e, t) {
203
+ function Ne(e, t) {
192
204
  return e.filter((e) => e.scope === t).slice().sort((e, t) => e.path.localeCompare(t.path));
193
205
  }
194
- function Me(e, t) {
206
+ function Pe(e, t) {
195
207
  let n = [];
196
208
  function r(e, i, a, o, s) {
197
209
  if (e.kind === "scope") {
198
- let n = je(t.modules, e.scope);
210
+ let n = Ne(t.modules, e.scope);
199
211
  for (let t of n) for (let n of e.children) r(n, e.scope, t.path, o, s);
200
212
  return;
201
213
  }
@@ -208,14 +220,14 @@ function Me(e, t) {
208
220
  for (let t of e.children) r(t, i, a, o, e.modes);
209
221
  return;
210
222
  }
211
- if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Pe(e)}' is not inside a scope() frame`);
223
+ if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Ie(e)}' is not inside a scope() frame`);
212
224
  if (e.kind === "rename") {
213
225
  n.push({
214
226
  leaf: e,
215
227
  scope: i,
216
228
  modulePath: a,
217
- resolvedPath: Ae(a, e.from),
218
- resolvedTo: Ae(a, e.to),
229
+ resolvedPath: Me(a, e.from),
230
+ resolvedTo: Me(a, e.to),
219
231
  triggers: o,
220
232
  modes: s
221
233
  });
@@ -225,15 +237,15 @@ function Me(e, t) {
225
237
  leaf: e,
226
238
  scope: i,
227
239
  modulePath: a,
228
- resolvedPath: Ae(a, Ne(e)),
240
+ resolvedPath: Me(a, Fe(e)),
229
241
  triggers: o,
230
242
  modes: s
231
243
  });
232
244
  }
233
- for (let t of e.children) r(t, void 0, void 0, [], ke);
245
+ for (let t of e.children) r(t, void 0, void 0, [], je);
234
246
  return n;
235
247
  }
236
- function Ne(e) {
248
+ function Fe(e) {
237
249
  switch (e.kind) {
238
250
  case "fixed":
239
251
  case "managed":
@@ -243,63 +255,63 @@ function Ne(e) {
243
255
  case "rename": return e.from;
244
256
  }
245
257
  }
246
- function Pe(e) {
258
+ function Ie(e) {
247
259
  return e.kind === "rename" ? `rename ${e.from} -> ${e.to}` : `${e.kind} ${e.path}`;
248
260
  }
249
261
  //#endregion
250
262
  //#region src/structure/engine/glob.ts
251
- var Fe = /[.+^${}()|[\]\\]/g;
252
- function Ie(e) {
263
+ var Le = /[.+^${}()|[\]\\]/g;
264
+ function Re(e) {
253
265
  let t = "";
254
266
  for (let n = 0; n < e.length; n++) {
255
267
  let r = e[n];
256
- r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(Fe, "\\$&");
268
+ r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(Le, "\\$&");
257
269
  }
258
270
  return RegExp(`^${t}$`);
259
271
  }
260
- function Le(e, t) {
261
- return Ie(e).test(t);
272
+ function ze(e, t) {
273
+ return Re(e).test(t);
262
274
  }
263
275
  //#endregion
264
276
  //#region src/structure/engine/builders.ts
265
- var b, Re;
266
- function ze(e) {
267
- if (!b) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
268
- return b;
277
+ var S, Be;
278
+ function Ve(e) {
279
+ if (!S) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
280
+ return S;
269
281
  }
270
- function x(e, t) {
271
- let n = ze(e);
282
+ function C(e, t) {
283
+ let n = Ve(e);
272
284
  n.stack[n.stack.length - 1].push(t);
273
285
  }
274
- function Be(e, t) {
275
- let n = Re;
276
- Re = e;
286
+ function He(e, t) {
287
+ let n = Be;
288
+ Be = e;
277
289
  try {
278
290
  return t();
279
291
  } finally {
280
- Re = n;
292
+ Be = n;
281
293
  }
282
294
  }
283
- function Ve() {
284
- return Re;
295
+ function Ue() {
296
+ return Be;
285
297
  }
286
- function He(e) {
287
- if (b) throw Error("defineStructure() cannot be called from inside another defineStructure().");
298
+ function We(e) {
299
+ if (S) throw Error("defineStructure() cannot be called from inside another defineStructure().");
288
300
  let t = [], n = {
289
301
  root: t,
290
302
  stack: [t],
291
303
  inScope: !1
292
304
  };
293
- b = n;
305
+ S = n;
294
306
  try {
295
307
  if (e(), n.stack.length !== 1) throw Error(`defineStructure: builder body left ${n.stack.length - 1} unclosed group frame(s)`);
296
308
  let r = { children: t };
297
- return Ue(r), r;
309
+ return Ge(r), r;
298
310
  } finally {
299
- b = void 0;
311
+ S = void 0;
300
312
  }
301
313
  }
302
- function Ue(e) {
314
+ function Ge(e) {
303
315
  let t = /* @__PURE__ */ new Map();
304
316
  function n(e, r) {
305
317
  if (e.kind === "scope") {
@@ -322,8 +334,8 @@ function Ue(e) {
322
334
  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.`);
323
335
  }
324
336
  }
325
- function S(e, t) {
326
- let n = ze("scope");
337
+ function w(e, t) {
338
+ let n = Ve("scope");
327
339
  if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
328
340
  let r = {
329
341
  kind: "scope",
@@ -337,22 +349,22 @@ function S(e, t) {
337
349
  n.stack.pop(), n.inScope = !1;
338
350
  }
339
351
  }
340
- var We;
341
- function Ge(e) {
342
- We = e;
352
+ var Ke;
353
+ function qe(e) {
354
+ Ke = e;
343
355
  }
344
- function C(e, t, n) {
345
- Ke(e, t), n && Ke((t) => !e(t), n);
356
+ function T(e, t, n) {
357
+ Je(e, t), n && Je((t) => !e(t), n);
346
358
  }
347
- function Ke(e, t) {
348
- if (b) {
349
- qe(e, t);
359
+ function Je(e, t) {
360
+ if (S) {
361
+ Ye(e, t);
350
362
  return;
351
363
  }
352
- if (!(We?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
364
+ if (!(Ke?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
353
365
  }
354
- function qe(e, t) {
355
- let n = b, r = {
366
+ function Ye(e, t) {
367
+ let n = S, r = {
356
368
  kind: "when",
357
369
  trigger: e,
358
370
  children: []
@@ -364,11 +376,11 @@ function qe(e, t) {
364
376
  n.stack.pop();
365
377
  }
366
378
  }
367
- function w(e) {
379
+ function E(e) {
368
380
  return (t) => t.filesMatch(e);
369
381
  }
370
- function Je(e, t, n) {
371
- let r = ze(e), i = {
382
+ function Xe(e, t, n) {
383
+ let r = Ve(e), i = {
372
384
  kind: "mode",
373
385
  modes: t,
374
386
  children: []
@@ -380,70 +392,70 @@ function Je(e, t, n) {
380
392
  r.stack.pop();
381
393
  }
382
394
  }
383
- function Ye(e) {
384
- Je("onInitOrUpdate", ["init", "updateDeps"], e);
395
+ function Ze(e) {
396
+ Xe("onInitOrUpdate", ["init", "updateDeps"], e);
385
397
  }
386
- function T(e, t) {
387
- x("fixed", {
398
+ function D(e, t) {
399
+ C("fixed", {
388
400
  kind: "fixed",
389
401
  path: e,
390
402
  content: t
391
403
  });
392
404
  }
393
- function E(e, t, n) {
394
- x("managed", {
405
+ function O(e, t, n) {
406
+ C("managed", {
395
407
  kind: "managed",
396
408
  path: e,
397
409
  initial: t,
398
410
  body: n
399
411
  });
400
412
  }
401
- function D(e, t) {
402
- x("scaffold", {
413
+ function Qe(e, t) {
414
+ C("scaffold", {
403
415
  kind: "scaffold",
404
416
  path: e,
405
417
  initial: t
406
418
  });
407
419
  }
408
- function O(e, t) {
409
- x("seed", {
420
+ function k(e, t) {
421
+ C("seed", {
410
422
  kind: "seed",
411
423
  path: e,
412
424
  initial: t
413
425
  });
414
426
  }
415
- function k(e) {
416
- x("remove", {
427
+ function A(e) {
428
+ C("remove", {
417
429
  kind: "remove",
418
430
  path: e
419
431
  });
420
432
  }
421
- function A(e) {
433
+ function j(e) {
422
434
  return {
423
435
  kind: "file",
424
436
  path: e
425
437
  };
426
438
  }
427
- function Xe(e) {
439
+ function $e(e) {
428
440
  return {
429
441
  kind: "binary",
430
442
  path: e
431
443
  };
432
444
  }
433
- function Ze(e) {
445
+ function et(e) {
434
446
  return {
435
447
  kind: "text",
436
448
  value: e
437
449
  };
438
450
  }
439
- function j(e, t) {
451
+ function M(e, t) {
440
452
  return {
441
453
  kind: "tpl",
442
454
  path: e,
443
455
  vars: t
444
456
  };
445
457
  }
446
- function M(e) {
458
+ function N(e) {
447
459
  return {
448
460
  kind: "generate",
449
461
  fn: e
@@ -451,69 +463,69 @@ function M(e) {
451
463
  }
452
464
  //#endregion
453
465
  //#region src/structure/engine/parsers/json.ts
454
- function Qe(e) {
466
+ function tt(e) {
455
467
  return JSON.parse(e);
456
468
  }
457
- var $e = 100, et = 2;
458
- function tt(e) {
459
- return e.length === 0 ? "[]" : "[" + e.map(nt).join(", ") + "]";
469
+ var nt = 100, rt = 2;
470
+ function it(e) {
471
+ return e.length === 0 ? "[]" : "[" + e.map(at).join(", ") + "]";
460
472
  }
461
- function nt(e) {
462
- if (Array.isArray(e)) return tt(e);
463
- if (N(e)) {
473
+ function at(e) {
474
+ if (Array.isArray(e)) return it(e);
475
+ if (P(e)) {
464
476
  let t = Object.entries(e);
465
- return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${nt(t)}`).join(", ") + " }";
477
+ return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${at(t)}`).join(", ") + " }";
466
478
  }
467
479
  return JSON.stringify(e);
468
480
  }
469
- function rt(e, t, n, r) {
470
- let i = t + et, a = " ".repeat(i);
481
+ function ot(e, t, n, r) {
482
+ let i = t + rt, a = " ".repeat(i);
471
483
  if (Array.isArray(e)) {
472
- let o = tt(e);
473
- if (n + o.length + r <= $e) return o;
484
+ let o = it(e);
485
+ if (n + o.length + r <= nt) return o;
474
486
  let s = e.length - 1;
475
- return "[\n" + e.map((e, t) => a + rt(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
487
+ return "[\n" + e.map((e, t) => a + ot(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
476
488
  }
477
- if (N(e)) {
489
+ if (P(e)) {
478
490
  let n = Object.entries(e);
479
491
  if (n.length === 0) return "{}";
480
492
  let r = n.length - 1;
481
493
  return "{\n" + n.map(([e, t], n) => {
482
494
  let o = `${a}${JSON.stringify(e)}: `;
483
- return o + rt(t, i, o.length, n === r ? 0 : 1);
495
+ return o + ot(t, i, o.length, n === r ? 0 : 1);
484
496
  }).join(",\n") + "\n" + " ".repeat(t) + "}";
485
497
  }
486
498
  return JSON.stringify(e);
487
499
  }
488
- function it(e, t) {
489
- return t?.collapse ? rt(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
500
+ function st(e, t) {
501
+ return t?.collapse ? ot(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
490
502
  }
491
- function at(e) {
503
+ function ct(e) {
492
504
  return e === "" || e === void 0 ? [] : e.split(".");
493
505
  }
494
- function N(e) {
506
+ function P(e) {
495
507
  return typeof e == "object" && !!e && !Array.isArray(e);
496
508
  }
497
- function ot(e, t) {
498
- let n = at(t), r = e;
509
+ function lt(e, t) {
510
+ let n = ct(t), r = e;
499
511
  for (let e of n) {
500
- if (!N(r)) return;
512
+ if (!P(r)) return;
501
513
  r = r[e];
502
514
  }
503
515
  return r;
504
516
  }
505
- function st(e, t) {
506
- let n = at(t);
517
+ function ut(e, t) {
518
+ let n = ct(t);
507
519
  if (n.length === 0) return !0;
508
520
  let r = e;
509
521
  for (let e = 0; e < n.length - 1; e++) {
510
- if (!N(r)) return !1;
522
+ if (!P(r)) return !1;
511
523
  r = r[n[e]];
512
524
  }
513
- return N(r) ? n[n.length - 1] in r : !1;
525
+ return P(r) ? n[n.length - 1] in r : !1;
514
526
  }
515
- function ct(e, t, n) {
516
- let r = at(t);
527
+ function dt(e, t, n) {
528
+ let r = ct(t);
517
529
  if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
518
530
  let i = e;
519
531
  for (let e = 0; e < r.length - 1; e++) {
@@ -521,22 +533,22 @@ function ct(e, t, n) {
521
533
  if (n === void 0) {
522
534
  let e = {};
523
535
  i[t] = e, i = e;
524
- } else if (N(n)) i = n;
536
+ } else if (P(n)) i = n;
525
537
  else throw Error(`setAtPath: cannot descend into non-object at '${r.slice(0, e + 1).join(".")}'`);
526
538
  }
527
539
  i[r[r.length - 1]] = n;
528
540
  }
529
- function lt(e, t) {
530
- let n = at(t);
541
+ function ft(e, t) {
542
+ let n = ct(t);
531
543
  if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
532
544
  let r = e;
533
545
  for (let e = 0; e < n.length - 1; e++) {
534
- if (!N(r)) return;
546
+ if (!P(r)) return;
535
547
  r = r[n[e]];
536
548
  }
537
- N(r) && delete r[n[n.length - 1]];
549
+ P(r) && delete r[n[n.length - 1]];
538
550
  }
539
- function ut(e, t) {
551
+ function pt(e, t) {
540
552
  let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
541
553
  i.set("", []);
542
554
  let a = "";
@@ -551,72 +563,72 @@ function ut(e, t) {
551
563
  }
552
564
  //#endregion
553
565
  //#region src/structure/engine/parsers/lines.ts
554
- function dt(e) {
566
+ function mt(e) {
555
567
  let t = e.split("\n");
556
568
  return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
557
569
  }
558
- function ft(e) {
570
+ function ht(e) {
559
571
  return e.join("\n") + "\n";
560
572
  }
561
- function pt(e) {
573
+ function gt(e) {
562
574
  return e.replace(/(^|\s)#.*$/, "$1").trim();
563
575
  }
564
- function mt(e, t) {
565
- let n = pt(e);
576
+ function _t(e, t) {
577
+ let n = gt(e);
566
578
  return n === "" ? !1 : n === t.trim();
567
579
  }
568
- function ht(e, t) {
569
- for (let n of e) if (mt(n, t)) return !0;
580
+ function vt(e, t) {
581
+ for (let n of e) if (_t(n, t)) return !0;
570
582
  return !1;
571
583
  }
572
584
  //#endregion
573
585
  //#region src/structure/engine/content-rules.ts
574
- function gt(e, t) {
586
+ function yt(e, t) {
575
587
  return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
576
588
  }
577
- var _t = [
589
+ var bt = [
578
590
  "dependencies",
579
591
  "devDependencies",
580
592
  "peerDependencies",
581
593
  "optionalDependencies"
582
594
  ];
583
- function vt(e, t) {
584
- if (L(e)) for (let n of _t) {
595
+ function xt(e, t) {
596
+ if (R(e)) for (let n of bt) {
585
597
  let r = e[n];
586
- if (L(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
598
+ if (R(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
587
599
  }
588
600
  }
589
- var P;
590
- function yt(e) {
591
- if (!P) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
592
- return P;
601
+ var F;
602
+ function St(e) {
603
+ if (!F) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
604
+ return F;
593
605
  }
594
- function F(e) {
595
- let t = yt(e);
606
+ function I(e) {
607
+ let t = St(e);
596
608
  if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
597
609
  return t;
598
610
  }
599
- function I(e) {
600
- let t = yt(e);
611
+ function L(e) {
612
+ let t = St(e);
601
613
  if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
602
614
  return t;
603
615
  }
604
- function bt(e) {
605
- let t = yt(e);
616
+ function Ct(e) {
617
+ let t = St(e);
606
618
  if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
607
619
  return t;
608
620
  }
609
- function xt(e, t) {
610
- let n = e.ctx ?? Ve();
621
+ function wt(e, t) {
622
+ let n = e.ctx ?? Ue();
611
623
  if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
612
624
  return n;
613
625
  }
614
- function L(e) {
626
+ function R(e) {
615
627
  return typeof e == "object" && !!e && !Array.isArray(e);
616
628
  }
617
- function St(e, t, n = {}) {
618
- if (P) throw Error("Nested managed(...) body — engine bug.");
619
- P = {
629
+ function Tt(e, t, n = {}) {
630
+ if (F) throw Error("Nested managed(...) body — engine bug.");
631
+ F = {
620
632
  kind: "json",
621
633
  obj: e,
622
634
  ctx: n.ctx,
@@ -625,12 +637,12 @@ function St(e, t, n = {}) {
625
637
  try {
626
638
  return t(n.ctx ?? n.triggerContext?.ctx), e;
627
639
  } finally {
628
- P = void 0;
640
+ F = void 0;
629
641
  }
630
642
  }
631
- function Ct(e, t, n = {}) {
632
- if (P) throw Error("Nested managed(...) body — engine bug.");
633
- P = {
643
+ function Et(e, t, n = {}) {
644
+ if (F) throw Error("Nested managed(...) body — engine bug.");
645
+ F = {
634
646
  kind: "yaml",
635
647
  doc: e,
636
648
  ctx: n.ctx,
@@ -641,12 +653,12 @@ function Ct(e, t, n = {}) {
641
653
  try {
642
654
  return t(n.ctx ?? n.triggerContext?.ctx), e;
643
655
  } finally {
644
- P = void 0;
656
+ F = void 0;
645
657
  }
646
658
  }
647
- function wt(e, t, n = {}) {
648
- if (P) throw Error("Nested managed(...) body — engine bug.");
649
- P = {
659
+ function Dt(e, t, n = {}) {
660
+ if (F) throw Error("Nested managed(...) body — engine bug.");
661
+ F = {
650
662
  kind: "lines",
651
663
  lines: e,
652
664
  ctx: n.ctx,
@@ -655,183 +667,183 @@ function wt(e, t, n = {}) {
655
667
  try {
656
668
  return t(n.ctx ?? n.triggerContext?.ctx), e;
657
669
  } finally {
658
- P = void 0;
670
+ F = void 0;
659
671
  }
660
672
  }
661
- Ge((e, t) => {
662
- if (!P) return !1;
663
- let n = P.triggerContext;
673
+ qe((e, t) => {
674
+ if (!F) return !1;
675
+ let n = F.triggerContext;
664
676
  if (!n) throw Error("when() inside a managed(...) body requires a triggerContext. The runner supplies it via the `triggerContext` opt to with-managed-*; ensure your test/test helper passes one.");
665
677
  return e(n) && t(), !0;
666
678
  });
667
- function R(e, t) {
668
- ct(F("ensureField").obj, e, t);
669
- }
670
679
  function z(e, t) {
671
- let n = F("removeField").obj;
672
- st(n, e) && (t && !t(ot(n, e)) || lt(n, e));
680
+ dt(I("ensureField").obj, e, t);
673
681
  }
674
- function Tt(e, t) {
675
- let n = F("requireField").obj;
676
- if (!st(n, e)) throw Error(t ?? `requireField: missing field '${e}'`);
682
+ function B(e, t) {
683
+ let n = I("removeField").obj;
684
+ ut(n, e) && (t && !t(lt(n, e)) || ft(n, e));
685
+ }
686
+ function Ot(e, t) {
687
+ let n = I("requireField").obj;
688
+ if (!ut(n, e)) throw Error(t ?? `requireField: missing field '${e}'`);
677
689
  }
678
- function Et(e, t) {
679
- let n = F("ensureFieldEntries").obj, r = st(n, e) ? ot(n, e) : void 0, i = L(r) ? r : {};
690
+ function kt(e, t) {
691
+ let n = I("ensureFieldEntries").obj, r = ut(n, e) ? lt(n, e) : void 0, i = R(r) ? r : {};
680
692
  for (let [e, n] of Object.entries(t)) i[e] = n;
681
- L(r) || ct(n, e, i);
693
+ R(r) || dt(n, e, i);
682
694
  }
683
- function B(e, t) {
684
- R(`scripts.${e}`, t);
695
+ function V(e, t) {
696
+ z(`scripts.${e}`, t);
685
697
  }
686
- function V(e) {
687
- z(`scripts.${e}`);
698
+ function H(e) {
699
+ B(`scripts.${e}`);
688
700
  }
689
- var Dt = [
701
+ var At = [
690
702
  "dependencies",
691
703
  "devDependencies",
692
704
  "peerDependencies",
693
705
  "optionalDependencies"
694
706
  ];
695
- function Ot(e, t, n, r) {
696
- let i = F(e), a = i.obj, o = n === "sdk:" ? gt(n, xt(i, e).isSdkInternal) : n;
697
- for (let e of Dt) {
707
+ function jt(e, t, n, r) {
708
+ let i = I(e), a = i.obj, o = n === "sdk:" ? yt(n, wt(i, e).isSdkInternal) : n;
709
+ for (let e of At) {
698
710
  if (e === r) continue;
699
711
  let n = a[e];
700
- L(n) && t in n && delete n[t];
712
+ R(n) && t in n && delete n[t];
701
713
  }
702
- let s = a[r], c = L(s) ? s : {};
703
- c[t] = o, L(s) || (a[r] = c);
714
+ let s = a[r], c = R(s) ? s : {};
715
+ c[t] = o, R(s) || (a[r] = c);
704
716
  }
705
- function kt(e, t) {
706
- Ot("ensureDep", e, t, "dependencies");
717
+ function U(e, t) {
718
+ jt("ensureDep", e, t, "dependencies");
707
719
  }
708
- function H(e, t) {
709
- Ot("ensureDevDep", e, t, "devDependencies");
720
+ function W(e, t) {
721
+ jt("ensureDevDep", e, t, "devDependencies");
710
722
  }
711
- function At(e, t) {
712
- Ot("ensurePeerDep", e, t, "peerDependencies");
723
+ function Mt(e, t) {
724
+ jt("ensurePeerDep", e, t, "peerDependencies");
713
725
  }
714
- function U(e) {
715
- let t = F("removeDep").obj;
716
- for (let n of Dt) {
726
+ function G(e) {
727
+ let t = I("removeDep").obj;
728
+ for (let n of At) {
717
729
  let r = t[n];
718
- L(r) && e in r && delete r[e];
730
+ R(r) && e in r && delete r[e];
719
731
  }
720
732
  }
721
- function W(e) {
722
- for (let [t, n] of Object.entries(e)) H(t, n);
723
- }
724
- function jt(e) {
725
- for (let [t, n] of Object.entries(e)) At(t, n);
726
- }
727
- function Mt(e, t, n) {
728
- let r = xt(F(e), e);
729
- for (let i of r.modules) i.scope === t && Ot(e, i.name, "workspace:*", n);
733
+ function K(e) {
734
+ for (let [t, n] of Object.entries(e)) W(t, n);
730
735
  }
731
736
  function Nt(e) {
732
- Mt("ensureWorkspaceScopeDeps", e, "dependencies");
737
+ for (let [t, n] of Object.entries(e)) Mt(t, n);
733
738
  }
734
- function Pt(e) {
735
- Mt("ensureWorkspaceScopeDevDeps", e, "devDependencies");
739
+ function Pt(e, t, n) {
740
+ let r = wt(I(e), e);
741
+ for (let i of r.modules) i.scope === t && jt(e, i.name, "workspace:*", n);
736
742
  }
737
743
  function Ft(e) {
738
- let t = F("pruneKeysMatching").obj;
744
+ Pt("ensureWorkspaceScopeDeps", e, "dependencies");
745
+ }
746
+ function It(e) {
747
+ Pt("ensureWorkspaceScopeDevDeps", e, "devDependencies");
748
+ }
749
+ function Lt(e) {
750
+ let t = I("pruneKeysMatching").obj;
739
751
  for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
740
752
  }
741
- function It(e, t) {
742
- let n = ut(e, t);
753
+ function Rt(e, t) {
754
+ let n = pt(e, t);
743
755
  for (let t of Object.keys(e)) delete e[t];
744
756
  for (let t of Object.keys(n)) e[t] = n[t];
745
757
  }
746
- function G(e) {
747
- It(F("enforceFieldOrder").obj, e);
758
+ function q(e) {
759
+ Rt(I("enforceFieldOrder").obj, e);
748
760
  }
749
- function Lt(e, t) {
761
+ function zt(e, t) {
750
762
  let n = Object.keys(e).sort(), r = {};
751
763
  for (let t of n) r[t] = e[t];
752
764
  for (let t of Object.keys(e)) delete e[t];
753
- for (let i of n) e[i] = r[i], t && L(e[i]) && Lt(e[i], !0);
765
+ for (let i of n) e[i] = r[i], t && R(e[i]) && zt(e[i], !0);
754
766
  }
755
- function K(e = "", t = {}) {
767
+ function J(e = "", t = {}) {
756
768
  let n = t.recursive ?? !1;
757
769
  if (e === "" && !n) return;
758
- let r = F("enforceAlphabeticalOrder").obj;
770
+ let r = I("enforceAlphabeticalOrder").obj;
759
771
  if (e === "") {
760
- Lt(r, !0);
772
+ zt(r, !0);
761
773
  return;
762
774
  }
763
- let i = ot(r, e);
764
- L(i) && Lt(i, n);
775
+ let i = lt(r, e);
776
+ R(i) && zt(i, n);
765
777
  }
766
- function Rt() {
767
- let e = I("ensureWorkspaceModulePaths"), t = xt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
778
+ function Bt() {
779
+ let e = L("ensureWorkspaceModulePaths"), t = wt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
768
780
  Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
769
781
  }
770
- function zt(e, t) {
782
+ function Vt(e, t) {
771
783
  let n = e.doc.getIn(["catalog", t]);
772
784
  return typeof n == "string" ? n : void 0;
773
785
  }
774
- function Bt(e, t) {
775
- let n = I("ensureCatalogVersion");
776
- zt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
786
+ function Ht(e, t) {
787
+ let n = L("ensureCatalogVersion");
788
+ Vt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
777
789
  }
778
- function Vt(e) {
779
- let t = I("ensureCatalogLatest");
790
+ function Ut(e) {
791
+ let t = L("ensureCatalogLatest");
780
792
  if (!t.getLatestVersion) return;
781
793
  let n = t.getLatestVersion(e);
782
- n !== void 0 && zt(t, e) !== n && t.doc.setIn(["catalog", e], n);
794
+ n !== void 0 && Vt(t, e) !== n && t.doc.setIn(["catalog", e], n);
783
795
  }
784
- function Ht(e, t) {
785
- let n = I("pinCatalogToDependencyOf");
796
+ function Wt(e, t) {
797
+ let n = L("pinCatalogToDependencyOf");
786
798
  if (!n.getDerivedDependencyPin) return;
787
799
  let r = n.getDerivedDependencyPin(e);
788
- r !== void 0 && zt(n, e) !== r && n.doc.setIn(["catalog", e], r);
800
+ r !== void 0 && Vt(n, e) !== r && n.doc.setIn(["catalog", e], r);
789
801
  }
790
- function Ut(e) {
791
- let t = I("ensureCatalogAbsent");
802
+ function Gt(e) {
803
+ let t = L("ensureCatalogAbsent");
792
804
  t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
793
805
  }
794
- function Wt(e) {
795
- let t = bt("ensureGitignoreEntries");
796
- for (let n of e) ht(t.lines, n) || t.lines.push(n);
806
+ function Kt(e) {
807
+ let t = Ct("ensureGitignoreEntries");
808
+ for (let n of e) vt(t.lines, n) || t.lines.push(n);
797
809
  }
798
810
  //#endregion
799
811
  //#region src/structure/engine/parsers/yaml.ts
800
- function Gt(e) {
801
- return oe(e);
812
+ function qt(e) {
813
+ return le(e);
802
814
  }
803
- function Kt(e) {
815
+ function Jt(e) {
804
816
  return e.toString();
805
817
  }
806
- var qt = ".structure";
807
- function Jt(e) {
818
+ var Yt = ".structure";
819
+ function Xt(e) {
808
820
  if (!e.exists(".structure")) return { version: 0 };
809
821
  try {
810
- let t = JSON.parse(e.read(qt));
822
+ let t = JSON.parse(e.read(Yt));
811
823
  return { version: typeof t?.version == "number" ? t.version : 0 };
812
824
  } catch {
813
825
  return { version: 0 };
814
826
  }
815
827
  }
816
- function Yt(e, t = 0) {
817
- if (e < t) throw new Xt(e, t);
828
+ function Zt(e, t = 0) {
829
+ if (e < t) throw new Qt(e, t);
818
830
  }
819
- var Xt = class extends Error {
831
+ var Qt = class extends Error {
820
832
  constructor(e, t) {
821
833
  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";
822
834
  }
823
835
  };
824
- function Zt(e, t) {
825
- e.write(qt, JSON.stringify(t));
836
+ function $t(e, t) {
837
+ e.write(Yt, JSON.stringify(t));
826
838
  }
827
839
  //#endregion
828
840
  //#region src/structure/engine/runner.ts
829
- var Qt = class extends Error {
841
+ var en = class extends Error {
830
842
  constructor(e) {
831
843
  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";
832
844
  }
833
845
  };
834
- function $t(e, t, n, r) {
846
+ function tn(e, t, n, r) {
835
847
  switch (e.kind) {
836
848
  case "text": return e.value;
837
849
  case "file":
@@ -839,47 +851,47 @@ function $t(e, t, n, r) {
839
851
  return n.staticRead(e.path);
840
852
  case "tpl":
841
853
  if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
842
- return Oe(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
854
+ return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
843
855
  case "generate": {
844
856
  let n = e.fn(r);
845
- if (t.endsWith(".json")) return vt(n, r.isSdkInternal), it(n, { collapse: !t.endsWith("package.json") });
846
- if (t.endsWith(".yaml") || t.endsWith(".yml")) return se(n);
857
+ if (t.endsWith(".json")) return xt(n, r.isSdkInternal), st(n, { collapse: !t.endsWith("package.json") });
858
+ if (t.endsWith(".yaml") || t.endsWith(".yml")) return ue(n);
847
859
  if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
848
860
  return n;
849
861
  }
850
862
  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.`);
851
863
  }
852
864
  }
853
- function en(e, t, n, r, i) {
865
+ function nn(e, t, n, r, i) {
854
866
  if (n.kind === "binary") {
855
867
  if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
856
868
  e.writeBinary(t, r.staticReadBinary(n.path));
857
869
  return;
858
870
  }
859
- e.write(t, $t(n, t, r, i));
871
+ e.write(t, tn(n, t, r, i));
860
872
  }
861
- function tn(e, t, n, r, i, a) {
873
+ function rn(e, t, n, r, i, a) {
862
874
  let o = e.split("/").pop() ?? e;
863
875
  if (e.endsWith(".json")) {
864
- let i = Qe(t);
876
+ let i = tt(t);
865
877
  if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
866
- return St(i, n, { triggerContext: r }), it(i, { collapse: o !== "package.json" });
878
+ return Tt(i, n, { triggerContext: r }), st(i, { collapse: o !== "package.json" });
867
879
  }
868
880
  if (e.endsWith(".yaml") || e.endsWith(".yml")) {
869
- let e = Gt(t);
870
- return Ct(e, n, {
881
+ let e = qt(t);
882
+ return Et(e, n, {
871
883
  triggerContext: r,
872
884
  getLatestVersion: i,
873
885
  getDerivedDependencyPin: a
874
- }), Kt(e);
886
+ }), Jt(e);
875
887
  }
876
888
  if (o === ".gitignore" || o.endsWith(".gitignore")) {
877
- let e = dt(t);
878
- return wt(e, n, { triggerContext: r }), ft(e);
889
+ let e = mt(t);
890
+ return Dt(e, n, { triggerContext: r }), ht(e);
879
891
  }
880
892
  throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
881
893
  }
882
- function nn(e) {
894
+ function an(e) {
883
895
  let t = e.list(""), n = /* @__PURE__ */ new Set();
884
896
  for (let e of t) {
885
897
  n.add(e);
@@ -888,37 +900,37 @@ function nn(e) {
888
900
  }
889
901
  return n;
890
902
  }
891
- function rn(e, t) {
903
+ function on(e, t) {
892
904
  let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
893
905
  return e.has(n);
894
906
  }
895
- function an(e, t, n) {
907
+ function sn(e, t, n) {
896
908
  return {
897
909
  ctx: t,
898
910
  version: t.version,
899
- pathExists: (t) => rn(e, t),
900
- pathMissing: (t) => !rn(e, t),
911
+ pathExists: (t) => on(e, t),
912
+ pathMissing: (t) => !on(e, t),
901
913
  filesMatch: (t) => {
902
914
  let r = n ? `${n}/${t}` : t;
903
- for (let t of e) if (Le(r, t)) return !0;
915
+ for (let t of e) if (ze(r, t)) return !0;
904
916
  return !1;
905
917
  }
906
918
  };
907
919
  }
908
- function on(e, t) {
920
+ function cn(e, t) {
909
921
  for (let n of e.triggers) if (!n(t)) return !1;
910
922
  return !0;
911
923
  }
912
- function sn(e, t) {
924
+ function ln(e, t) {
913
925
  return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
914
926
  }
915
- function cn(e, t) {
927
+ function un(e, t) {
916
928
  return e.filter((e) => e.modes.includes(t));
917
929
  }
918
- function ln(e, t, n, r, i, a) {
930
+ function dn(e, t, n, r, i, a) {
919
931
  let o = e.leaf;
920
932
  if (o.kind === "fixed") {
921
- let i = $t(o.content, e.resolvedPath, r, a);
933
+ let i = tn(o.content, e.resolvedPath, r, a);
922
934
  return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
923
935
  scope: e.scope,
924
936
  path: e.resolvedPath,
@@ -931,13 +943,13 @@ function ln(e, t, n, r, i, a) {
931
943
  action: "create"
932
944
  });
933
945
  }
934
- if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || en(t, e.resolvedPath, o.initial, r, a), {
946
+ if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || nn(t, e.resolvedPath, o.initial, r, a), {
935
947
  scope: e.scope,
936
948
  path: e.resolvedPath,
937
949
  primitive: "scaffold",
938
950
  action: "create"
939
951
  });
940
- if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || en(t, e.resolvedPath, o.initial, r, a), {
952
+ if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || nn(t, e.resolvedPath, o.initial, r, a), {
941
953
  scope: e.scope,
942
954
  path: e.resolvedPath,
943
955
  primitive: "seed",
@@ -960,11 +972,11 @@ function ln(e, t, n, r, i, a) {
960
972
  });
961
973
  }
962
974
  }
963
- function un(e, t, n, r, i, a, o, s) {
975
+ function fn(e, t, n, r, i, a, o, s) {
964
976
  if (e.leaf.kind !== "managed") return;
965
977
  let c = e.leaf, l = e.resolvedPath, u = t.exists(l), d, f = !1;
966
- u ? d = t.read(l) : (d = $t(c.initial, l, i, s), f = !0);
967
- let p = tn(l, d, c.body, r, a, o);
978
+ u ? d = t.read(l) : (d = tn(c.initial, l, i, s), f = !0);
979
+ let p = rn(l, d, c.body, r, a, o);
968
980
  if (f) return n || t.write(l, p), {
969
981
  scope: e.scope,
970
982
  path: l,
@@ -978,53 +990,54 @@ function un(e, t, n, r, i, a, o, s) {
978
990
  action: "update"
979
991
  };
980
992
  }
981
- function dn(e, t, n, r, i, a, o, s) {
982
- let c = cn(e, sn(n, a)), l = [], u = nn(t);
993
+ function pn(e, t, n, r, i, a, o, s) {
994
+ let c = un(e, ln(n, a)), l = [], u = an(t);
983
995
  for (let e of c) {
984
- if (e.leaf.kind === "managed" || !on(e, an(u, n, e.modulePath))) continue;
985
- let o = ln(e, t, r, i, a, n);
996
+ if (e.leaf.kind === "managed" || !cn(e, sn(u, n, e.modulePath))) continue;
997
+ let o = dn(e, t, r, i, a, n);
986
998
  o && l.push(o);
987
999
  }
988
- let d = nn(t);
1000
+ let d = an(t);
989
1001
  for (let e of c) {
990
1002
  if (e.leaf.kind !== "managed") continue;
991
- let a = an(d, n, e.modulePath);
992
- if (!on(e, a)) continue;
993
- let c = un(e, t, r, a, i, o, s, n);
1003
+ let a = sn(d, n, e.modulePath);
1004
+ if (!cn(e, a)) continue;
1005
+ let c = fn(e, t, r, a, i, o, s, n);
994
1006
  c && l.push(c);
995
1007
  }
996
1008
  return l;
997
1009
  }
998
- function fn(e, t, n, r = {}) {
999
- return Be(n, () => {
1000
- let i = Me(e, n), a = !!r.initMode, o = dn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
1010
+ function mn(e, t, n, r = {}) {
1011
+ return He(n, () => {
1012
+ let i = Pe(e, n), a = !!r.initMode, o = pn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
1001
1013
  if (!n.dryRun && !n.updateDepsOnly && !a) {
1002
- Zt(t, { version: 2 });
1014
+ $t(t, { version: 2 });
1003
1015
  let i = {
1004
1016
  ...r.rediscover ? r.rediscover(t) : n,
1005
1017
  dryRun: !0
1006
- }, a = dn(Me(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== qt);
1007
- if (a.length > 0) throw new Qt(a[0]);
1018
+ }, a = pn(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Yt);
1019
+ if (a.length > 0) throw new en(a[0]);
1008
1020
  }
1009
- return a && !n.dryRun && Zt(t, { version: 2 }), { changes: o };
1021
+ return a && !n.dryRun && $t(t, { version: 2 }), { changes: o };
1010
1022
  });
1011
1023
  }
1012
1024
  //#endregion
1013
1025
  //#region src/structure/engine/discovery.ts
1014
- var pn = [
1026
+ var hn = [
1015
1027
  "root",
1016
1028
  "block",
1017
1029
  "model",
1018
1030
  "ui",
1019
1031
  "workflow",
1020
1032
  "test",
1021
- "software"
1022
- ], mn = class extends Error {
1033
+ "software",
1034
+ "kind"
1035
+ ], gn = class extends Error {
1023
1036
  constructor(e, t) {
1024
1037
  super(e), this.path = t, this.name = "DiscoveryError";
1025
1038
  }
1026
1039
  };
1027
- function hn(e) {
1040
+ function _n(e) {
1028
1041
  let t = /* @__PURE__ */ new Set();
1029
1042
  for (let n of [
1030
1043
  e.dependencies,
@@ -1034,18 +1047,19 @@ function hn(e) {
1034
1047
  ]) if (n) for (let e of Object.keys(n)) t.add(e);
1035
1048
  return t;
1036
1049
  }
1037
- function gn(e) {
1050
+ function vn(e) {
1038
1051
  return e === "" || e === ".";
1039
1052
  }
1040
- function _n(e) {
1053
+ function yn(e) {
1041
1054
  let t = e.pkg["block-scope"];
1042
1055
  if (typeof t == "string") {
1043
- if (!pn.includes(t)) throw new mn(`package.json "block-scope" must be one of ${pn.join(", ")}, got '${t}'`, e.path);
1056
+ if (!hn.includes(t)) throw new gn(`package.json "block-scope" must be one of ${hn.join(", ")}, got '${t}'`, e.path);
1044
1057
  return t;
1045
1058
  }
1046
- if (gn(e.path)) return "root";
1059
+ if (vn(e.path)) return "root";
1047
1060
  if (e.pkg.block !== void 0) return "block";
1048
- let n = hn(e.pkg);
1061
+ let n = _n(e.pkg);
1062
+ if (n.has("@platforma-sdk/block-kind")) return "kind";
1049
1063
  if (e.pkg["block-software"] !== void 0) return "software";
1050
1064
  if (n.has("@platforma-sdk/package-builder")) {
1051
1065
  for (let e of n) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
@@ -1055,39 +1069,39 @@ function _n(e) {
1055
1069
  if (n.has("@platforma-sdk/model") && e.pkg.main) return "model";
1056
1070
  if (n.has("@platforma-sdk/test")) return "test";
1057
1071
  }
1058
- function vn(e) {
1072
+ function bn(e) {
1059
1073
  let t = [];
1060
1074
  for (let n of e) {
1061
- let e = _n(n);
1062
- if (!e) throw new mn(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`, n.path);
1075
+ let e = yn(n);
1076
+ if (!e) throw new gn(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`, n.path);
1063
1077
  t.push({
1064
1078
  scope: e,
1065
1079
  name: n.pkg.name ?? n.path,
1066
- path: gn(n.path) ? "" : n.path
1080
+ path: vn(n.path) ? "" : n.path
1067
1081
  });
1068
1082
  }
1069
1083
  return t;
1070
1084
  }
1071
1085
  //#endregion
1072
1086
  //#region src/structure/engine/ctx.ts
1073
- function q(e, t) {
1087
+ function Y(e, t) {
1074
1088
  return e.modules.filter((e) => e.scope === t);
1075
1089
  }
1076
- function yn(e, t) {
1077
- let n = q(e, t);
1090
+ function xn(e, t) {
1091
+ let n = Y(e, t);
1078
1092
  if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
1079
1093
  if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
1080
1094
  return n[0];
1081
1095
  }
1082
- function bn(e, t) {
1083
- return { [yn(e, t).name]: "workspace:*" };
1096
+ function Sn(e, t) {
1097
+ return { [xn(e, t).name]: "workspace:*" };
1084
1098
  }
1085
- function xn(e, t) {
1099
+ function X(e, t) {
1086
1100
  let n = {};
1087
- for (let r of q(e, t)) n[r.name] = "workspace:*";
1101
+ for (let r of Y(e, t)) n[r.name] = "workspace:*";
1088
1102
  return n;
1089
1103
  }
1090
- function Sn(e) {
1104
+ function Cn(e) {
1091
1105
  let t = e.facadeName, n = [
1092
1106
  {
1093
1107
  scope: "root",
@@ -1104,6 +1118,11 @@ function Sn(e) {
1104
1118
  name: `${t}.model`,
1105
1119
  path: "model"
1106
1120
  },
1121
+ {
1122
+ scope: "kind",
1123
+ name: `${t}.kind`,
1124
+ path: "kind"
1125
+ },
1107
1126
  {
1108
1127
  scope: "ui",
1109
1128
  name: `${t}.ui`,
@@ -1126,7 +1145,7 @@ function Sn(e) {
1126
1145
  path: "software"
1127
1146
  }), n;
1128
1147
  }
1129
- function Cn(e) {
1148
+ function wn(e) {
1130
1149
  return {
1131
1150
  isSdkInternal: e.isSdkInternal ?? !1,
1132
1151
  updateDepsOnly: e.updateDepsOnly ?? !1,
@@ -1138,41 +1157,41 @@ function Cn(e) {
1138
1157
  }
1139
1158
  //#endregion
1140
1159
  //#region src/structure/engine/discovery-fs.ts
1141
- var J = class extends Error {
1160
+ var Z = class extends Error {
1142
1161
  constructor(e) {
1143
1162
  super(e), this.name = "StructureCliError";
1144
1163
  }
1145
1164
  };
1146
- function wn(e, t) {
1165
+ function Tn(e, t) {
1147
1166
  return e === "" ? t : `${e}/${t}`;
1148
1167
  }
1149
- function Tn(e, t) {
1168
+ function En(e, t) {
1150
1169
  try {
1151
1170
  return JSON.parse(e.read(t));
1152
1171
  } catch {
1153
1172
  return;
1154
1173
  }
1155
1174
  }
1156
- function En(e) {
1157
- 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.`);
1175
+ function Dn(e) {
1176
+ if (e.includes("*")) throw new Z(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
1158
1177
  let t = e.replace(/^\.\//, "").replace(/\/$/, "");
1159
1178
  return t === "." ? "" : t;
1160
1179
  }
1161
- function Dn(e) {
1180
+ function On(e) {
1162
1181
  let t;
1163
1182
  try {
1164
1183
  t = e.read("pnpm-workspace.yaml");
1165
1184
  } catch {
1166
- 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.");
1185
+ throw new Z("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.");
1167
1186
  }
1168
- let n = ae(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1187
+ let n = ce(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1169
1188
  for (let t of r) {
1170
- let n = En(t);
1189
+ let n = Dn(t);
1171
1190
  (n === "" || e.exists(n)) && i.add(n);
1172
1191
  }
1173
1192
  let a = [];
1174
1193
  for (let t of i) {
1175
- let n = Tn(e, wn(t, "package.json"));
1194
+ let n = En(e, Tn(t, "package.json"));
1176
1195
  n && a.push({
1177
1196
  path: t,
1178
1197
  pkg: n
@@ -1180,7 +1199,7 @@ function Dn(e) {
1180
1199
  }
1181
1200
  return a;
1182
1201
  }
1183
- function On(e) {
1202
+ function kn(e) {
1184
1203
  let t = [], n = new Set([
1185
1204
  "node_modules",
1186
1205
  ".turbo",
@@ -1192,7 +1211,7 @@ function On(e) {
1192
1211
  let o = e.listDir(i);
1193
1212
  for (let s of o) {
1194
1213
  if (!s.isDirectory || n.has(s.name)) continue;
1195
- let o = wn(i, s.name), c = Tn(e, wn(o, "package.json"));
1214
+ let o = Tn(i, s.name), c = En(e, Tn(o, "package.json"));
1196
1215
  c && t.push({
1197
1216
  path: o,
1198
1217
  pkg: c
@@ -1201,11 +1220,11 @@ function On(e) {
1201
1220
  }
1202
1221
  return r("", 1), t;
1203
1222
  }
1204
- function kn(e) {
1223
+ function An(e) {
1205
1224
  let t = e.indexOf("/");
1206
- if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1225
+ if (!e.startsWith("@") || t < 0) throw new Z(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1207
1226
  let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
1208
- if (i < 0) throw new J(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1227
+ if (i < 0) throw new Z(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1209
1228
  return {
1210
1229
  facadeName: e,
1211
1230
  baseName: r,
@@ -1214,15 +1233,15 @@ function kn(e) {
1214
1233
  shortName: r.slice(i + 1)
1215
1234
  };
1216
1235
  }
1217
- function An(e) {
1218
- let { fs: t, isSdkInternal: n } = e, r = n ? On(t) : Dn(t);
1219
- if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1220
- let i = vn(r), a = Jt(t);
1221
- Yt(a.version, 0);
1236
+ function jn(e) {
1237
+ let { fs: t, isSdkInternal: n } = e, r = n ? kn(t) : On(t);
1238
+ if (r.length === 0) throw new Z("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1239
+ let i = bn(r), a = Xt(t);
1240
+ Zt(a.version, 0);
1222
1241
  let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
1223
- if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1224
- let s = kn(o.name.replace(/\.block$/, ""));
1225
- return Cn({
1242
+ if (!o) throw new Z("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1243
+ let s = An(o.name.replace(/\.block$/, ""));
1244
+ return wn({
1226
1245
  isSdkInternal: n,
1227
1246
  updateDepsOnly: e.updateDepsOnly ?? !1,
1228
1247
  modules: i,
@@ -1233,7 +1252,7 @@ function An(e) {
1233
1252
  }
1234
1253
  //#endregion
1235
1254
  //#region src/structure/rules/shared/key-order.ts
1236
- var Y = [
1255
+ var Q = [
1237
1256
  "name",
1238
1257
  "version",
1239
1258
  "private",
@@ -1254,25 +1273,25 @@ var Y = [
1254
1273
  "pnpm",
1255
1274
  "block",
1256
1275
  "block-software"
1257
- ], jn = {
1276
+ ], Mn = {
1258
1277
  "build:dev-local": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build",
1259
1278
  "build:dev-remote": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build",
1260
1279
  "build:dev-no-software": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build",
1261
1280
  "build:dev-binary-existing": "env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build",
1262
1281
  "build:release": "env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build"
1263
- }, Mn = {
1282
+ }, Nn = {
1264
1283
  test: "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1",
1265
1284
  "test:dry-run": "env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json"
1266
1285
  };
1267
- function Nn() {
1286
+ function Pn() {
1268
1287
  return {
1269
1288
  version: "1.0.0",
1270
1289
  private: !0,
1271
1290
  scripts: {
1272
1291
  fmt: "turbo run fmt",
1273
1292
  check: "turbo run check",
1274
- ...jn,
1275
1293
  ...Mn,
1294
+ ...Nn,
1276
1295
  "mark-stable": "turbo run mark-stable",
1277
1296
  "do-pack": "turbo run do-pack",
1278
1297
  watch: "turbo watch build",
@@ -1295,28 +1314,28 @@ function Nn() {
1295
1314
  packageManager: "pnpm@9.12.0"
1296
1315
  };
1297
1316
  }
1298
- function Pn() {
1299
- R("packageManager", "pnpm@9.12.0"), z("name"), B("fmt", "turbo run fmt"), B("check", "turbo run check");
1300
- for (let [e, t] of Object.entries(jn)) B(e, t);
1301
- for (let [e, t] of Object.entries(Mn)) B(e, t);
1302
- V("build"), V("build:dev"), B("mark-stable", "turbo run mark-stable"), B("do-pack", "turbo run do-pack"), B("watch", "turbo watch build"), B("changeset", "changeset"), B("version-packages", "changeset version"), B("update-sdk", "block-tools structure refresh --update-deps-only"), V("update"), B("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), W({
1317
+ function Fn() {
1318
+ z("packageManager", "pnpm@9.12.0"), B("name"), V("fmt", "turbo run fmt"), V("check", "turbo run check");
1319
+ for (let [e, t] of Object.entries(Mn)) V(e, t);
1320
+ for (let [e, t] of Object.entries(Nn)) V(e, t);
1321
+ H("build"), H("build:dev"), V("mark-stable", "turbo run mark-stable"), V("do-pack", "turbo run do-pack"), V("watch", "turbo watch build"), V("changeset", "changeset"), V("version-packages", "changeset version"), V("update-sdk", "block-tools structure refresh --update-deps-only"), H("update"), V("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), K({
1303
1322
  "@changesets/cli": "catalog:",
1304
1323
  "@milaboratories/ts-builder": "sdk:",
1305
1324
  "@platforma-sdk/block-tools": "sdk:",
1306
1325
  shx: "catalog:",
1307
1326
  turbo: "catalog:"
1308
- }), jt({
1327
+ }), Nt({
1309
1328
  oxlint: "*",
1310
1329
  oxfmt: "*"
1311
- }), Ft((e, t) => {
1330
+ }), Lt((e, t) => {
1312
1331
  if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
1313
1332
  let n = t;
1314
1333
  return n.pnpm !== void 0 || n.overrides !== void 0;
1315
- }), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1334
+ }), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1316
1335
  }
1317
1336
  //#endregion
1318
1337
  //#region src/structure/rules/root-turbo-json.ts
1319
- var Fn = "https://turbo.build/schema.json", In = ["tsconfig.json"], Ln = {
1338
+ var In = "https://turbo.build/schema.json", Ln = ["tsconfig.json"], Rn = {
1320
1339
  fmt: { cache: !1 },
1321
1340
  check: {
1322
1341
  dependsOn: ["^build"],
@@ -1365,15 +1384,15 @@ var Fn = "https://turbo.build/schema.json", In = ["tsconfig.json"], Ln = {
1365
1384
  cache: !1
1366
1385
  }
1367
1386
  };
1368
- function Rn() {
1387
+ function zn() {
1369
1388
  return {
1370
- $schema: Fn,
1371
- globalDependencies: In,
1372
- tasks: { ...Ln }
1389
+ $schema: In,
1390
+ globalDependencies: Ln,
1391
+ tasks: { ...Rn }
1373
1392
  };
1374
1393
  }
1375
- function zn() {
1376
- R("$schema", Fn), R("globalDependencies", In), Et("tasks", Ln), z("tasks.build:dev"), G([
1394
+ function Bn() {
1395
+ z("$schema", In), z("globalDependencies", Ln), kt("tasks", Rn), B("tasks.build:dev"), q([
1377
1396
  "$schema",
1378
1397
  "globalDependencies",
1379
1398
  "tasks"
@@ -1381,70 +1400,70 @@ function zn() {
1381
1400
  }
1382
1401
  //#endregion
1383
1402
  //#region src/structure/engine/registry-client.ts
1384
- var Bn = 2, Vn = 500, Hn = 3e4;
1385
- function Un(e) {
1403
+ var Vn = 2, Hn = 500, Un = 3e4;
1404
+ function Wn(e) {
1386
1405
  if (!e) return null;
1387
1406
  let t = Number(e);
1388
1407
  if (Number.isFinite(t) && t > 0) return t * 1e3;
1389
1408
  let n = Date.parse(e);
1390
1409
  return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
1391
1410
  }
1392
- async function Wn(e) {
1411
+ async function Gn(e) {
1393
1412
  for (let t = 1;; t++) {
1394
1413
  let n;
1395
1414
  try {
1396
- n = await fetch(e, { signal: AbortSignal.timeout(Hn) });
1415
+ n = await fetch(e, { signal: AbortSignal.timeout(Un) });
1397
1416
  } catch (e) {
1398
- if (t > Bn) throw e;
1399
- await ce(Vn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1417
+ if (t > Vn) throw e;
1418
+ await de(Hn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1400
1419
  continue;
1401
1420
  }
1402
1421
  if (n.ok) return n;
1403
- if (!(n.status === 429 || n.status >= 500) || t > Bn) throw Error(`registry returned HTTP ${n.status}`);
1404
- let r = Un(n.headers.get("retry-after"));
1422
+ if (!(n.status === 429 || n.status >= 500) || t > Vn) throw Error(`registry returned HTTP ${n.status}`);
1423
+ let r = Wn(n.headers.get("retry-after"));
1405
1424
  if (r != null) {
1406
- await ce(r);
1425
+ await de(r);
1407
1426
  continue;
1408
1427
  }
1409
- await ce(Vn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1428
+ await de(Hn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1410
1429
  }
1411
1430
  }
1412
- function Gn() {
1431
+ function Kn() {
1413
1432
  return {
1414
1433
  async getLatestVersion(e) {
1415
- let t = (await (await Wn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1434
+ let t = (await (await Gn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1416
1435
  if (!t) throw Error("no 'latest' dist-tag in registry response");
1417
1436
  return t;
1418
1437
  },
1419
1438
  async getDeclaredDependency(e, t, n) {
1420
- let r = await (await Wn(`https://registry.npmjs.org/${e}/${t}`)).json();
1439
+ let r = await (await Gn(`https://registry.npmjs.org/${e}/${t}`)).json();
1421
1440
  return r.dependencies?.[n] ?? r.peerDependencies?.[n];
1422
1441
  }
1423
1442
  };
1424
1443
  }
1425
- async function Kn(e, t) {
1444
+ async function qn(e, t) {
1426
1445
  let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
1427
1446
  return new Map(n);
1428
1447
  }
1429
- function qn(e) {
1448
+ function Jn(e) {
1430
1449
  return (t) => e.get(t);
1431
1450
  }
1432
- var Jn = [/^@platforma-sdk\//, /^@milaboratories\//];
1433
- function Yn(e) {
1434
- return Jn.some((t) => t.test(e));
1451
+ var Yn = [/^@platforma-sdk\//, /^@milaboratories\//];
1452
+ function Xn(e) {
1453
+ return Yn.some((t) => t.test(e));
1435
1454
  }
1436
- async function Xn(e, t = Gn()) {
1437
- return e.length === 0 ? () => void 0 : qn(await Kn(t, e));
1455
+ async function Zn(e, t = Kn()) {
1456
+ return e.length === 0 ? () => void 0 : Jn(await qn(t, e));
1438
1457
  }
1439
- function Zn(e) {
1458
+ function Qn(e) {
1440
1459
  return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
1441
1460
  }
1442
- async function Qn(e, t = Gn()) {
1461
+ async function $n(e, t = Kn()) {
1443
1462
  if (e.length === 0) return () => void 0;
1444
1463
  let n = await Promise.all(e.map(async (e) => {
1445
1464
  let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
1446
1465
  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.`);
1447
- 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.`);
1466
+ if (!Qn(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.`);
1448
1467
  return [e.entry, n];
1449
1468
  })), r = new Map(n);
1450
1469
  return (e) => r.get(e);
@@ -1452,7 +1471,7 @@ async function Qn(e, t = Gn()) {
1452
1471
  //#endregion
1453
1472
  //#region src/structure/rules/shared/retired-deps.ts
1454
1473
  // @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
1455
- var $n = [
1474
+ var er = [
1456
1475
  "vite",
1457
1476
  "tsup",
1458
1477
  "vue-tsc",
@@ -1460,12 +1479,12 @@ var $n = [
1460
1479
  "vite-plugin-dts",
1461
1480
  "@platforma-sdk/eslint-config"
1462
1481
  ];
1463
- function X() {
1464
- for (let e of $n) U(e);
1482
+ function tr() {
1483
+ for (let e of er) G(e);
1465
1484
  }
1466
1485
  //#endregion
1467
1486
  //#region src/structure/rules/root-pnpm-workspace.ts
1468
- var Z = [
1487
+ var nr = [
1469
1488
  "@platforma-sdk/model",
1470
1489
  "@platforma-sdk/ui-vue",
1471
1490
  "@platforma-sdk/workflow-tengo",
@@ -1475,35 +1494,35 @@ var Z = [
1475
1494
  "@platforma-sdk/package-builder",
1476
1495
  "@milaboratories/ts-builder",
1477
1496
  "@milaboratories/ts-configs"
1478
- ], er = "0.0.0-init-must-fetch";
1479
- for (let e of Z) if (!Yn(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.`);
1480
- var tr = {
1497
+ ], rr = "0.0.0-init-must-fetch";
1498
+ for (let e of nr) if (!Xn(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.`);
1499
+ var ir = {
1481
1500
  turbo: "~2.8.11",
1482
1501
  shx: "~0.4.0",
1483
1502
  "@changesets/cli": "~2.29.8",
1484
1503
  vitest: "~4.0.18"
1485
- }, nr = [{
1504
+ }, ar = [{
1486
1505
  entry: "vue",
1487
1506
  of: "@platforma-sdk/ui-vue"
1488
1507
  }, {
1489
1508
  entry: "@milaboratories/helpers",
1490
1509
  of: "@platforma-sdk/model"
1491
- }], rr = "@platforma-open/milaboratories.runenv-python-3", ir = "1.8.2";
1492
- function ar(e) {
1510
+ }], or = "@platforma-open/milaboratories.runenv-python-3", sr = "1.8.2";
1511
+ function cr(e) {
1493
1512
  let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
1494
- for (let e of Z) n[e] = er;
1495
- return Object.assign(n, tr), e.modules.some((e) => e.scope === "software") && (n[rr] = ir), {
1513
+ for (let e of nr) n[e] = rr;
1514
+ return Object.assign(n, ir), e.modules.some((e) => e.scope === "software") && (n[or] = sr), {
1496
1515
  packages: t,
1497
1516
  catalog: n
1498
1517
  };
1499
1518
  }
1500
- function or() {
1501
- Rt();
1502
- for (let e of $n) Ut(e);
1519
+ function lr() {
1520
+ Bt();
1521
+ for (let e of er) Gt(e);
1503
1522
  }
1504
1523
  //#endregion
1505
1524
  //#region src/structure/rules/root-gitignore.ts
1506
- var sr = [
1525
+ var ur = [
1507
1526
  ".test_auth.json",
1508
1527
  "node_modules/",
1509
1528
  "dist/",
@@ -1518,47 +1537,47 @@ var sr = [
1518
1537
  ".vscode/sftp.json",
1519
1538
  "test-dry-run.json"
1520
1539
  ];
1521
- function cr() {
1522
- Wt(sr);
1540
+ function dr() {
1541
+ Kt(ur);
1523
1542
  }
1524
1543
  //#endregion
1525
1544
  //#region src/structure/rules/root.ts
1526
- function lr() {
1527
- S("root", () => {
1528
- C(({ ctx: e }) => !e.isSdkInternal, () => {
1529
- E("turbo.json", M(() => Rn()), () => {
1530
- zn();
1531
- }), T(".vscode/settings.json", A("root/.vscode/settings.json")), E("package.json", M(() => Nn()), () => {
1532
- Pn();
1533
- }), E("pnpm-workspace.yaml", M((e) => ar(e)), () => {
1534
- or();
1535
- }), E(".gitignore", A("root/.gitignore"), () => {
1536
- cr();
1545
+ function fr() {
1546
+ w("root", () => {
1547
+ T(({ ctx: e }) => !e.isSdkInternal, () => {
1548
+ O("turbo.json", N(() => zn()), () => {
1549
+ Bn();
1550
+ }), D(".vscode/settings.json", j("root/.vscode/settings.json")), O("package.json", N(() => Pn()), () => {
1551
+ Fn();
1552
+ }), O("pnpm-workspace.yaml", N((e) => cr(e)), () => {
1553
+ lr();
1554
+ }), O(".gitignore", j("root/.gitignore"), () => {
1555
+ dr();
1537
1556
  });
1538
1557
  });
1539
1558
  });
1540
1559
  }
1541
1560
  //#endregion
1542
1561
  //#region src/structure/rules/root-ci.ts
1543
- function ur(e) {
1562
+ function pr(e) {
1544
1563
  return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
1545
1564
  }
1546
- function dr() {
1547
- S("root", () => {
1548
- C(({ ctx: e }) => !e.isSdkInternal, () => {
1549
- T(".github/workflows/build.yaml", j("workflows/build.tpl.yaml", (e) => {
1565
+ function mr() {
1566
+ w("root", () => {
1567
+ T(({ ctx: e }) => !e.isSdkInternal, () => {
1568
+ D(".github/workflows/build.yaml", M("workflows/build.tpl.yaml", (e) => {
1550
1569
  let t = e.blockVars.shortName;
1551
1570
  return {
1552
- appName: `Block: ${ur(t)}`,
1571
+ appName: `Block: ${pr(t)}`,
1553
1572
  appNameSlug: `block-${t}`
1554
1573
  };
1555
- })), T(".github/workflows/mark-stable.yaml", j("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${ur(e.blockVars.shortName)} - Mark Stable` })));
1574
+ })), D(".github/workflows/mark-stable.yaml", M("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${pr(e.blockVars.shortName)} - Mark Stable` })));
1556
1575
  });
1557
1576
  });
1558
1577
  }
1559
1578
  //#endregion
1560
1579
  //#region src/structure/rules/block-package-json.ts
1561
- var fr = {
1580
+ var hr = {
1562
1581
  "@platforma-open": {
1563
1582
  s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
1564
1583
  serveUrl: "https://blocks.pl-open.science"
@@ -1567,45 +1586,45 @@ var fr = {
1567
1586
  s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
1568
1587
  serveUrl: "https://block.registry.platforma.bio/releases"
1569
1588
  }
1570
- }, pr = {
1589
+ }, gr = {
1571
1590
  s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
1572
1591
  serveUrl: "https://blocks.pl-open.science"
1573
- }, mr = {
1592
+ }, _r = {
1574
1593
  s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1",
1575
1594
  serveUrl: "https://aux-blocks.pl-open.science"
1576
1595
  };
1577
- function hr(e, t) {
1578
- let n = t ? mr : fr[e] ?? pr;
1596
+ function vr(e, t) {
1597
+ let n = t ? _r : hr[e] ?? gr;
1579
1598
  return `block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`;
1580
1599
  }
1581
- function gr(e) {
1600
+ function yr(e) {
1582
1601
  let t = {};
1583
- for (let n of q(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
1584
- for (let n of q(e, "model")) t.model = `${n.name}/dist/model.json`;
1585
- for (let n of q(e, "ui")) t.ui = `${n.name}/dist`;
1602
+ for (let n of Y(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
1603
+ for (let n of Y(e, "model")) t.model = `${n.name}/dist/model.json`;
1604
+ for (let n of Y(e, "ui")) t.ui = `${n.name}/dist`;
1586
1605
  return t;
1587
1606
  }
1588
- function _r(e, t) {
1607
+ function br(e, t) {
1589
1608
  return {
1590
1609
  build: "ts-builder build --target block-facade && block-tools pack",
1591
1610
  check: "ts-builder type-check --target block-facade",
1592
- prepublishOnly: hr(e, t),
1611
+ prepublishOnly: vr(e, t),
1593
1612
  "do-pack": "shx rm -f package.tgz && pnpm pack && shx mv *.tgz package.tgz"
1594
1613
  };
1595
1614
  }
1596
- var vr = {
1615
+ var xr = {
1597
1616
  "@milaboratories/ts-builder": "sdk:",
1598
1617
  "@milaboratories/ts-configs": "sdk:",
1599
1618
  "@platforma-sdk/block-tools": "sdk:",
1600
1619
  "@platforma-sdk/model": "sdk:",
1601
1620
  shx: "catalog:",
1602
1621
  typescript: "catalog:"
1603
- }, yr = { ".": {
1622
+ }, Sr = { ".": {
1604
1623
  sources: "./src/index.ts",
1605
1624
  types: "./dist/index.d.ts",
1606
1625
  default: "./dist/index.js"
1607
1626
  } };
1608
- function br(e) {
1627
+ function Cr(e) {
1609
1628
  if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
1610
1629
  let t = e.meta, n = [
1611
1630
  ["block.meta.title", t.title],
@@ -1617,14 +1636,15 @@ function br(e) {
1617
1636
  ];
1618
1637
  for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
1619
1638
  }
1620
- function xr(e) {
1639
+ function wr(e) {
1621
1640
  let t = e.blockVars, n = {
1622
- ...vr,
1623
- ...xn(e, "model"),
1624
- ...xn(e, "ui"),
1625
- ...xn(e, "workflow")
1641
+ ...xr,
1642
+ ...X(e, "model"),
1643
+ ...X(e, "ui"),
1644
+ ...X(e, "workflow"),
1645
+ ...X(e, "kind")
1626
1646
  }, r = {
1627
- components: gr(e),
1647
+ components: yr(e),
1628
1648
  meta: {
1629
1649
  title: t.shortName,
1630
1650
  description: `${t.shortName} block`,
@@ -1636,7 +1656,7 @@ function xr(e) {
1636
1656
  }
1637
1657
  }
1638
1658
  };
1639
- return br(r), {
1659
+ return Cr(r), {
1640
1660
  name: `${t.facadeName}.block`,
1641
1661
  version: "1.0.0",
1642
1662
  type: "module",
@@ -1644,44 +1664,45 @@ function xr(e) {
1644
1664
  main: "./dist/index.js",
1645
1665
  module: "./dist/index.js",
1646
1666
  types: "./dist/index.d.ts",
1647
- exports: yr,
1648
- scripts: _r(t.npmOrg, e.isSdkInternal),
1667
+ exports: Sr,
1668
+ scripts: br(t.npmOrg, e.isSdkInternal),
1649
1669
  dependencies: {},
1650
1670
  devDependencies: n,
1651
1671
  block: r
1652
1672
  };
1653
1673
  }
1654
- function Sr(e) {
1655
- let t = e.blockVars;
1656
- R("type", "module"), R("files", ["dist", "block-pack"]), R("main", "./dist/index.js"), R("module", "./dist/index.js"), R("types", "./dist/index.d.ts"), R("exports", yr);
1657
- let n = _r(t.npmOrg, e.isSdkInternal);
1658
- for (let [e, t] of Object.entries(n)) B(e, t);
1659
- V("mark-stable"), Pt("model"), Pt("ui"), Pt("workflow"), H("@milaboratories/ts-builder", "sdk:"), H("@milaboratories/ts-configs", "sdk:"), H("@platforma-sdk/block-tools", "sdk:"), H("@platforma-sdk/model", "sdk:"), H("shx", "catalog:"), H("typescript", "catalog:"), R("block.components", gr(e)), Tt("version", "facade package.json must carry a 'version' (the facade publishes)"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1674
+ function Tr(e) {
1675
+ let t = e.blockVars, n = Y(e, "kind");
1676
+ if (n.length !== 1) throw Error(n.length === 0 ? `block '${t.facadeName}' declares no kind — every block must have a sibling kind/ package` : `block '${t.facadeName}' declares ${n.length} kinds; exactly one is required`);
1677
+ z("type", "module"), z("files", ["dist", "block-pack"]), z("main", "./dist/index.js"), z("module", "./dist/index.js"), z("types", "./dist/index.d.ts"), z("exports", Sr);
1678
+ let r = br(t.npmOrg, e.isSdkInternal);
1679
+ for (let [e, t] of Object.entries(r)) V(e, t);
1680
+ H("mark-stable"), It("model"), It("ui"), It("workflow"), It("kind"), W("@milaboratories/ts-builder", "sdk:"), W("@milaboratories/ts-configs", "sdk:"), W("@platforma-sdk/block-tools", "sdk:"), W("@platforma-sdk/model", "sdk:"), W("shx", "catalog:"), W("typescript", "catalog:"), z("block.components", yr(e)), Ot("version", "facade package.json must carry a 'version' (the facade publishes)"), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1660
1681
  }
1661
1682
  //#endregion
1662
1683
  //#region src/structure/rules/shared/pascal-case.ts
1663
- function Cr(e) {
1684
+ function Er(e) {
1664
1685
  let t = e.split(/[^A-Za-z0-9]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
1665
1686
  return /^[0-9]/.test(t) ? `_${t}` : t;
1666
1687
  }
1667
1688
  //#endregion
1668
1689
  //#region src/structure/rules/block.ts
1669
- function wr() {
1670
- S("block", () => {
1671
- k("index.js"), k("index.d.ts"), T("src/index.ts", j("block/src/index.tpl.ts", (e) => ({
1690
+ function Dr() {
1691
+ w("block", () => {
1692
+ A("index.js"), A("index.d.ts"), D("src/index.ts", M("block/src/index.tpl.ts", (e) => ({
1672
1693
  facadeName: e.blockVars.facadeName,
1673
- pascalName: Cr(e.blockVars.shortName)
1674
- }))), T("src/AGENTS.ts", A("block/src/AGENTS.ts")), D("src/block-extra.ts", A("block/src/block-extra.ts")), D("src/agents-extra.ts", A("block/src/agents-extra.ts")), T("tsconfig.json", A("block/tsconfig.json")), O("logos/block-logo.png", Xe("block/logos/block-logo.png")), O("logos/organization-logo.png", Xe("block/logos/organization-logo.png")), E("package.json", M((e) => xr(e)), (e) => {
1675
- Sr(e);
1694
+ pascalName: Er(e.blockVars.shortName)
1695
+ }))), D("src/AGENTS.ts", j("block/src/AGENTS.ts")), Qe("src/block-extra.ts", j("block/src/block-extra.ts")), Qe("src/agents-extra.ts", j("block/src/agents-extra.ts")), D("tsconfig.json", j("block/tsconfig.json")), k("logos/block-logo.png", $e("block/logos/block-logo.png")), k("logos/organization-logo.png", $e("block/logos/organization-logo.png")), O("package.json", N((e) => wr(e)), (e) => {
1696
+ Tr(e);
1676
1697
  });
1677
1698
  });
1678
1699
  }
1679
1700
  //#endregion
1680
1701
  //#region src/structure/rules/shared/colocated-tests.ts
1681
- var Q = "src/**/*.test.ts";
1702
+ var $ = "src/**/*.test.ts";
1682
1703
  //#endregion
1683
1704
  //#region src/structure/rules/model-package-json.ts
1684
- function Tr(e) {
1705
+ function Or(e) {
1685
1706
  return {
1686
1707
  name: `${e.blockVars.facadeName}.model`,
1687
1708
  private: !0,
@@ -1703,7 +1724,10 @@ function Tr(e) {
1703
1724
  build: "ts-builder build --target block-model && block-tools build-model",
1704
1725
  check: "ts-builder check --target block-model"
1705
1726
  },
1706
- dependencies: { "@platforma-sdk/model": "sdk:" },
1727
+ dependencies: {
1728
+ "@platforma-sdk/model": "sdk:",
1729
+ ...X(e, "kind")
1730
+ },
1707
1731
  devDependencies: {
1708
1732
  "@milaboratories/ts-builder": "sdk:",
1709
1733
  "@milaboratories/ts-configs": "sdk:",
@@ -1715,37 +1739,92 @@ function Tr(e) {
1715
1739
  }
1716
1740
  };
1717
1741
  }
1718
- function Er() {
1719
- R("private", !0), R("type", "module"), R("main", "dist/index.cjs"), R("module", "dist/index.js"), R("types", "dist/index.d.ts"), R("exports", {
1742
+ function kr() {
1743
+ z("private", !0), z("type", "module"), z("main", "dist/index.cjs"), z("module", "dist/index.js"), z("types", "dist/index.d.ts"), z("exports", {
1720
1744
  ".": {
1721
1745
  types: "./dist/index.d.ts",
1722
1746
  sources: "./src/index.ts",
1723
1747
  import: "./dist/index.js"
1724
1748
  },
1725
1749
  "./dist/*": "./dist/*"
1726
- }), B("fmt", "ts-builder format"), B("watch", "ts-builder build --target block-model --watch"), B("build", "ts-builder build --target block-model && block-tools build-model"), B("check", "ts-builder check --target block-model"), kt("@platforma-sdk/model", "sdk:"), W({
1750
+ }), V("fmt", "ts-builder format"), V("watch", "ts-builder build --target block-model --watch"), V("build", "ts-builder build --target block-model && block-tools build-model"), V("check", "ts-builder check --target block-model"), U("@platforma-sdk/model", "sdk:"), Ft("kind"), K({
1727
1751
  "@milaboratories/ts-builder": "sdk:",
1728
1752
  "@milaboratories/ts-configs": "sdk:",
1729
1753
  "@platforma-sdk/block-tools": "sdk:"
1730
- }), jt({
1754
+ }), Nt({
1731
1755
  "@types/node": "*",
1732
1756
  typescript: "*"
1733
- }), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1734
- B("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
1735
- }, () => U("vitest"))), X(), z("tsup"), V("lint"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1757
+ }), T(({ ctx: e }) => !e.isSdkInternal, () => T(E($), () => {
1758
+ V("test", "vitest run --passWithNoTests"), W("vitest", "catalog:"), W("@types/node", "*");
1759
+ }, () => G("vitest"))), tr(), B("tsup"), H("lint"), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1736
1760
  }
1737
1761
  //#endregion
1738
1762
  //#region src/structure/rules/model.ts
1739
- function Dr() {
1740
- S("model", () => {
1741
- C(w(Q), () => T("tsconfig.json", A("model/tsconfig.node.json")), () => T("tsconfig.json", A("model/tsconfig.json"))), T(".oxlintrc.json", A("model/.oxlintrc.json")), T(".oxfmtrc.json", A("model/.oxfmtrc.json")), O("src/index.ts", A("model/src/index.ts")), E("package.json", M((e) => Tr(e)), () => {
1742
- Er();
1763
+ function Ar() {
1764
+ w("model", () => {
1765
+ T(E($), () => D("tsconfig.json", j("model/tsconfig.node.json")), () => D("tsconfig.json", j("model/tsconfig.json"))), D(".oxlintrc.json", j("model/.oxlintrc.json")), D(".oxfmtrc.json", j("model/.oxfmtrc.json")), k("src/index.ts", M("model/src/index.tpl.ts", (e) => ({ kindPkg: `${e.blockVars.facadeName}.kind` }))), O("package.json", N((e) => Or(e)), () => {
1766
+ kr();
1767
+ });
1768
+ });
1769
+ }
1770
+ //#endregion
1771
+ //#region src/structure/rules/kind-package-json.ts
1772
+ var jr = { ".": {
1773
+ types: "./dist/index.d.ts",
1774
+ sources: "./src/index.ts",
1775
+ import: "./dist/index.js",
1776
+ require: "./dist/index.cjs",
1777
+ default: "./dist/index.js"
1778
+ } };
1779
+ function Mr(e) {
1780
+ return {
1781
+ name: `${e.blockVars.facadeName}.kind`,
1782
+ private: !0,
1783
+ type: "module",
1784
+ main: "./dist/index.cjs",
1785
+ module: "./dist/index.js",
1786
+ types: "./dist/index.d.ts",
1787
+ exports: jr,
1788
+ scripts: {
1789
+ fmt: "ts-builder format",
1790
+ watch: "ts-builder build --target block-kind --watch",
1791
+ build: "ts-builder build --target block-kind && block-tools build-kind-manifest",
1792
+ check: "ts-builder check --target block-kind"
1793
+ },
1794
+ dependencies: { "@platforma-sdk/block-kind": "sdk:" },
1795
+ devDependencies: {
1796
+ "@milaboratories/ts-builder": "sdk:",
1797
+ "@milaboratories/ts-configs": "sdk:",
1798
+ "@platforma-sdk/block-tools": "sdk:"
1799
+ },
1800
+ peerDependencies: {
1801
+ "@types/node": "*",
1802
+ typescript: "*"
1803
+ }
1804
+ };
1805
+ }
1806
+ function Nr() {
1807
+ z("private", !0), z("type", "module"), z("main", "./dist/index.cjs"), z("module", "./dist/index.js"), z("types", "./dist/index.d.ts"), z("exports", jr), V("fmt", "ts-builder format"), V("watch", "ts-builder build --target block-kind --watch"), V("build", "ts-builder build --target block-kind && block-tools build-kind-manifest"), V("check", "ts-builder check --target block-kind"), H("lint"), U("@platforma-sdk/block-kind", "sdk:"), K({
1808
+ "@milaboratories/ts-builder": "sdk:",
1809
+ "@milaboratories/ts-configs": "sdk:",
1810
+ "@platforma-sdk/block-tools": "sdk:"
1811
+ }), Nt({
1812
+ "@types/node": "*",
1813
+ typescript: "*"
1814
+ }), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1815
+ }
1816
+ //#endregion
1817
+ //#region src/structure/rules/kind.ts
1818
+ function Pr() {
1819
+ w("kind", () => {
1820
+ D("tsconfig.json", j("kind/tsconfig.json")), D(".oxlintrc.json", j("kind/.oxlintrc.json")), D(".oxfmtrc.json", j("kind/.oxfmtrc.json")), k("src/index.ts", j("kind/src/index.ts")), O("package.json", N((e) => Mr(e)), () => {
1821
+ Nr();
1743
1822
  });
1744
1823
  });
1745
1824
  }
1746
1825
  //#endregion
1747
1826
  //#region src/structure/rules/ui-package-json.ts
1748
- function Or(e) {
1827
+ function Fr(e) {
1749
1828
  return {
1750
1829
  name: `${e.blockVars.facadeName}.ui`,
1751
1830
  private: !0,
@@ -1760,7 +1839,7 @@ function Or(e) {
1760
1839
  dependencies: {
1761
1840
  "@platforma-sdk/ui-vue": "sdk:",
1762
1841
  vue: "catalog:",
1763
- ...bn(e, "model")
1842
+ ...Sn(e, "model")
1764
1843
  },
1765
1844
  devDependencies: {
1766
1845
  "@milaboratories/ts-builder": "sdk:",
@@ -1772,29 +1851,29 @@ function Or(e) {
1772
1851
  }
1773
1852
  };
1774
1853
  }
1775
- function kr() {
1776
- R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("dev", "ts-builder serve --target block-ui"), B("watch", "ts-builder build --target block-ui --watch"), B("build", "ts-builder build --target block-ui"), B("check", "ts-builder check --target block-ui"), kt("@platforma-sdk/ui-vue", "sdk:"), kt("vue", "catalog:"), Nt("model"), W({
1854
+ function Ir() {
1855
+ z("private", !0), z("type", "module"), V("fmt", "ts-builder format"), V("dev", "ts-builder serve --target block-ui"), V("watch", "ts-builder build --target block-ui --watch"), V("build", "ts-builder build --target block-ui"), V("check", "ts-builder check --target block-ui"), U("@platforma-sdk/ui-vue", "sdk:"), U("vue", "catalog:"), Ft("model"), K({
1777
1856
  "@milaboratories/ts-builder": "sdk:",
1778
1857
  "@milaboratories/ts-configs": "sdk:"
1779
- }), X(), V("preview"), V("lint"), jt({
1858
+ }), tr(), H("preview"), H("lint"), Nt({
1780
1859
  "@types/node": "*",
1781
1860
  typescript: "*"
1782
- }), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1783
- B("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
1784
- }, () => U("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1861
+ }), T(({ ctx: e }) => !e.isSdkInternal, () => T(E($), () => {
1862
+ V("test", "vitest run --passWithNoTests"), W("vitest", "catalog:"), W("@types/node", "*");
1863
+ }, () => G("vitest"))), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1785
1864
  }
1786
1865
  //#endregion
1787
1866
  //#region src/structure/rules/ui.ts
1788
- function Ar() {
1789
- S("ui", () => {
1790
- C(w(Q), () => T("tsconfig.json", A("ui/tsconfig.node.json")), () => T("tsconfig.json", A("ui/tsconfig.json"))), T(".oxlintrc.json", A("ui/.oxlintrc.json")), T(".oxfmtrc.json", A("ui/.oxfmtrc.json")), D("index.html", A("ui/index.html")), O("src/main.ts", A("ui/src/main.ts")), O("src/app.ts", j("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), O("src/MainPage.vue", j("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) => Or(e)), () => {
1791
- kr();
1867
+ function Lr() {
1868
+ w("ui", () => {
1869
+ T(E($), () => D("tsconfig.json", j("ui/tsconfig.node.json")), () => D("tsconfig.json", j("ui/tsconfig.json"))), D(".oxlintrc.json", j("ui/.oxlintrc.json")), D(".oxfmtrc.json", j("ui/.oxfmtrc.json")), Qe("index.html", j("ui/index.html")), k("src/main.ts", j("ui/src/main.ts")), k("src/app.ts", M("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), k("src/MainPage.vue", M("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), O("package.json", N((e) => Fr(e)), () => {
1870
+ Ir();
1792
1871
  });
1793
1872
  });
1794
1873
  }
1795
1874
  //#endregion
1796
1875
  //#region src/structure/rules/workflow-package-json.ts
1797
- function jr(e) {
1876
+ function Rr(e) {
1798
1877
  return {
1799
1878
  name: `${e.blockVars.facadeName}.workflow`,
1800
1879
  private: !0,
@@ -1806,7 +1885,7 @@ function jr(e) {
1806
1885
  },
1807
1886
  dependencies: {
1808
1887
  "@platforma-sdk/workflow-tengo": "sdk:",
1809
- ...xn(e, "software")
1888
+ ...X(e, "software")
1810
1889
  },
1811
1890
  devDependencies: {
1812
1891
  "@platforma-sdk/tengo-builder": "sdk:",
@@ -1815,31 +1894,31 @@ function jr(e) {
1815
1894
  }
1816
1895
  };
1817
1896
  }
1818
- function Mr() {
1819
- R("private", !0), R("type", "module"), B("build", "shx rm -rf dist && pl-tengo build"), B("check", "pl-tengo check"), B("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1820
- B("test", "vitest run --passWithNoTests"), W({ vitest: "catalog:" });
1821
- }, () => U("vitest"))), kt("@platforma-sdk/workflow-tengo", "sdk:"), Nt("software"), W({
1897
+ function zr() {
1898
+ z("private", !0), z("type", "module"), V("build", "shx rm -rf dist && pl-tengo build"), V("check", "pl-tengo check"), V("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), T(({ ctx: e }) => !e.isSdkInternal, () => T(E($), () => {
1899
+ V("test", "vitest run --passWithNoTests"), K({ vitest: "catalog:" });
1900
+ }, () => G("vitest"))), U("@platforma-sdk/workflow-tengo", "sdk:"), Ft("software"), K({
1822
1901
  "@platforma-sdk/tengo-builder": "sdk:",
1823
1902
  "@platforma-sdk/test": "sdk:",
1824
1903
  shx: "catalog:"
1825
- }), X(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1904
+ }), tr(), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1826
1905
  }
1827
1906
  //#endregion
1828
1907
  //#region src/structure/rules/workflow.ts
1829
- function Nr() {
1830
- S("workflow", () => {
1831
- T("format.el", A("workflow/format.el")), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1832
- T("tsconfig.json", A("workflow/tsconfig.json")), D("vitest.config.mts", A("workflow/vitest.config.mts"));
1908
+ function Br() {
1909
+ w("workflow", () => {
1910
+ D("format.el", j("workflow/format.el")), T(({ ctx: e }) => !e.isSdkInternal, () => T(E($), () => {
1911
+ D("tsconfig.json", j("workflow/tsconfig.json")), Qe("vitest.config.mts", j("workflow/vitest.config.mts"));
1833
1912
  }, () => {
1834
- k("tsconfig.json"), k("vitest.config.mts");
1835
- })), k("index.js"), k("index.d.ts"), O("src/main.tpl.tengo", j("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), E("package.json", M((e) => jr(e)), () => {
1836
- Mr();
1913
+ A("tsconfig.json"), A("vitest.config.mts");
1914
+ })), A("index.js"), A("index.d.ts"), k("src/main.tpl.tengo", M("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), O("package.json", N((e) => Rr(e)), () => {
1915
+ zr();
1837
1916
  });
1838
1917
  });
1839
1918
  }
1840
1919
  //#endregion
1841
1920
  //#region src/structure/rules/test-package-json.ts
1842
- function Pr(e) {
1921
+ function Vr(e) {
1843
1922
  return {
1844
1923
  name: `${e.blockVars.facadeName}.test`,
1845
1924
  private: !0,
@@ -1858,27 +1937,27 @@ function Pr(e) {
1858
1937
  }
1859
1938
  };
1860
1939
  }
1861
- function Fr() {
1862
- R("private", !0), R("type", "module"), B("fmt", "ts-builder format"), B("check", "ts-builder check --target block-test"), B("test", "vitest run --passWithNoTests"), V("lint"), W({
1940
+ function Hr() {
1941
+ z("private", !0), z("type", "module"), V("fmt", "ts-builder format"), V("check", "ts-builder check --target block-test"), V("test", "vitest run --passWithNoTests"), H("lint"), K({
1863
1942
  "@platforma-sdk/test": "sdk:",
1864
1943
  "@milaboratories/ts-builder": "sdk:",
1865
1944
  "@milaboratories/ts-configs": "sdk:",
1866
1945
  vitest: "catalog:"
1867
- }), jt({ typescript: "*" }), U("@types/node"), X(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1946
+ }), Nt({ typescript: "*" }), G("@types/node"), tr(), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1868
1947
  }
1869
1948
  //#endregion
1870
1949
  //#region src/structure/rules/test.ts
1871
- function Ir() {
1872
- S("test", () => {
1873
- T("tsconfig.json", A("test/tsconfig.json")), T(".oxlintrc.json", A("test/.oxlintrc.json")), T(".oxfmtrc.json", A("test/.oxfmtrc.json")), D("vitest.config.mts", A("test/vitest.config.mts")), O("src/demo.test.ts", Ze("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), E("package.json", M((e) => Pr(e)), () => {
1874
- Fr();
1950
+ function Ur() {
1951
+ w("test", () => {
1952
+ D("tsconfig.json", j("test/tsconfig.json")), D(".oxlintrc.json", j("test/.oxlintrc.json")), D(".oxfmtrc.json", j("test/.oxfmtrc.json")), Qe("vitest.config.mts", j("test/vitest.config.mts")), k("src/demo.test.ts", et("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), O("package.json", N((e) => Vr(e)), () => {
1953
+ Hr();
1875
1954
  });
1876
1955
  });
1877
1956
  }
1878
1957
  //#endregion
1879
1958
  //#region src/structure/rules/software-package-json.ts
1880
- var Lr = "block-tools software build", Rr = "shx rm -f *.tgz && block-tools software build && pnpm pack && shx mv platforma-open*.tgz package.tgz";
1881
- function zr() {
1959
+ var Wr = "block-tools software build", Gr = "shx rm -f *.tgz && block-tools software build && pnpm pack && shx mv platforma-open*.tgz package.tgz";
1960
+ function Kr() {
1882
1961
  return { entrypoints: { main: { binary: {
1883
1962
  artifact: {
1884
1963
  type: "python",
@@ -1893,65 +1972,65 @@ function zr() {
1893
1972
  cmd: ["python", "{pkg}/main.py"]
1894
1973
  } } } };
1895
1974
  }
1896
- function Br(e) {
1975
+ function qr(e) {
1897
1976
  return {
1898
1977
  name: `${e.blockVars.facadeName}.software`,
1899
1978
  type: "module",
1900
1979
  description: "Block Software",
1901
1980
  files: ["./dist/**/*"],
1902
1981
  scripts: {
1903
- build: Lr,
1904
- "do-pack": Rr,
1982
+ build: Wr,
1983
+ "do-pack": Gr,
1905
1984
  changeset: "changeset",
1906
1985
  "version-packages": "changeset version"
1907
1986
  },
1908
- "block-software": zr(),
1987
+ "block-software": Kr(),
1909
1988
  devDependencies: {
1910
1989
  "@platforma-open/milaboratories.runenv-python-3": "catalog:",
1911
1990
  "@platforma-sdk/block-tools": "sdk:"
1912
1991
  }
1913
1992
  };
1914
1993
  }
1915
- function Vr() {
1916
- z("private"), R("type", "module"), R("files", ["./dist/**/*"]), B("build", Lr), B("do-pack", Rr), V("prepublishOnly"), B("changeset", "changeset"), B("version-packages", "changeset version"), H("@platforma-open/milaboratories.runenv-python-3", "catalog:"), H("@platforma-sdk/block-tools", "sdk:"), U("@platforma-sdk/package-builder"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...Y]);
1994
+ function Jr() {
1995
+ B("private"), z("type", "module"), z("files", ["./dist/**/*"]), V("build", Wr), V("do-pack", Gr), H("prepublishOnly"), V("changeset", "changeset"), V("version-packages", "changeset version"), W("@platforma-open/milaboratories.runenv-python-3", "catalog:"), W("@platforma-sdk/block-tools", "sdk:"), G("@platforma-sdk/package-builder"), J("dependencies"), J("devDependencies"), J("peerDependencies"), J("optionalDependencies"), q([...Q]);
1917
1996
  }
1918
1997
  //#endregion
1919
1998
  //#region src/structure/rules/software.ts
1920
- var Hr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", Ur = "# No dependencies specified for this script\n";
1921
- function Wr() {
1922
- S("software", () => {
1923
- O("src/main.py", Ze(Hr)), O("src/requirements.txt", Ze(Ur)), E("package.json", M((e) => Br(e)), () => {
1924
- Vr();
1999
+ var Yr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", Xr = "# No dependencies specified for this script\n";
2000
+ function Zr() {
2001
+ w("software", () => {
2002
+ k("src/main.py", et(Yr)), k("src/requirements.txt", et(Xr)), O("package.json", N((e) => qr(e)), () => {
2003
+ Jr();
1925
2004
  });
1926
2005
  });
1927
2006
  }
1928
- function Gr() {
1929
- S("model", () => {
1930
- k("eslint.config.mjs"), k("vite.config.mts");
1931
- }), S("ui", () => {
1932
- k("eslint.config.mjs"), k("vite.config.ts"), k("tsconfig.app.json"), k("tsconfig.node.json");
1933
- }), S("test", () => {
1934
- k("eslint.config.mjs");
1935
- }), S("root", () => {
1936
- k(".prettierrc"), E("package.json", M(() => Nn()), () => {
1937
- V("pretty"), U("@platforma-sdk/blocks-deps-updater");
2007
+ function Qr() {
2008
+ w("model", () => {
2009
+ A("eslint.config.mjs"), A("vite.config.mts");
2010
+ }), w("ui", () => {
2011
+ A("eslint.config.mjs"), A("vite.config.ts"), A("tsconfig.app.json"), A("tsconfig.node.json");
2012
+ }), w("test", () => {
2013
+ A("eslint.config.mjs");
2014
+ }), w("root", () => {
2015
+ A(".prettierrc"), O("package.json", N(() => Pn()), () => {
2016
+ H("pretty"), G("@platforma-sdk/blocks-deps-updater");
1938
2017
  });
1939
2018
  });
1940
2019
  }
1941
2020
  //#endregion
1942
2021
  //#region src/structure/rules/root-catalog-bump.ts
1943
- function Kr() {
1944
- Ye(() => {
1945
- S("root", () => {
1946
- C(({ ctx: e }) => !e.isSdkInternal, () => {
1947
- E("pnpm-workspace.yaml", M((e) => ar(e)), (e) => {
1948
- for (let e of Z) Vt(e);
1949
- for (let e of nr) Ht(e.entry, {
2022
+ function $r() {
2023
+ Ze(() => {
2024
+ w("root", () => {
2025
+ T(({ ctx: e }) => !e.isSdkInternal, () => {
2026
+ O("pnpm-workspace.yaml", N((e) => cr(e)), (e) => {
2027
+ for (let e of nr) Ut(e);
2028
+ for (let e of ar) Wt(e.entry, {
1950
2029
  of: e.of,
1951
2030
  ofVersion: e.ofVersion
1952
2031
  });
1953
- for (let [e, t] of Object.entries(tr)) Bt(e, t);
1954
- e.modules.some((e) => e.scope === "software") && Bt(rr, ir);
2032
+ for (let [e, t] of Object.entries(ir)) Ht(e, t);
2033
+ e.modules.some((e) => e.scope === "software") && Ht(or, sr);
1955
2034
  });
1956
2035
  });
1957
2036
  });
@@ -1959,25 +2038,25 @@ function Kr() {
1959
2038
  }
1960
2039
  //#endregion
1961
2040
  //#region src/structure/structure-definition.ts
1962
- var qr = He(() => {
1963
- lr(), dr(), wr(), Dr(), Ar(), Nr(), Ir(), Wr(), Gr(), Kr();
2041
+ var ei = We(() => {
2042
+ fr(), mr(), Dr(), Ar(), Pr(), Lr(), Br(), Ur(), Zr(), Qr(), $r();
1964
2043
  });
1965
2044
  //#endregion
1966
2045
  //#region src/structure/cli/run-structure.ts
1967
- async function Jr() {
1968
- return Xn(Z.filter(Yn));
2046
+ async function ti() {
2047
+ return Zn(nr.filter(Xn));
1969
2048
  }
1970
- async function Yr(e) {
1971
- let t = h.resolve(e.blockPath), n = e.mode === "check", r = new Ee(t), i = new De(e.templatesRoot), a = fn(qr, r, An({
2049
+ async function ni(e) {
2050
+ let t = _.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = mn(ei, r, jn({
1972
2051
  fs: r,
1973
2052
  isSdkInternal: e.isSdkInternal,
1974
2053
  updateDepsOnly: e.updateDepsOnly,
1975
2054
  dryRun: n
1976
2055
  }), {
1977
2056
  templates: i,
1978
- registryLookup: e.updateDepsOnly ? await Jr() : void 0,
1979
- derivedPinLookup: e.updateDepsOnly ? await Qn(nr) : void 0,
1980
- rediscover: () => An({
2057
+ registryLookup: e.updateDepsOnly ? await ti() : void 0,
2058
+ derivedPinLookup: e.updateDepsOnly ? await $n(ar) : void 0,
2059
+ rediscover: () => jn({
1981
2060
  fs: r,
1982
2061
  isSdkInternal: e.isSdkInternal,
1983
2062
  updateDepsOnly: !1,
@@ -1989,16 +2068,16 @@ async function Yr(e) {
1989
2068
  changes: a.changes
1990
2069
  };
1991
2070
  }
1992
- function Xr(e, t) {
2071
+ function ri(e, t) {
1993
2072
  if (t.length === 0) return ` ${e}: up to date (0 changes)`;
1994
2073
  let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
1995
2074
  return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
1996
2075
  }
1997
2076
  //#endregion
1998
2077
  //#region src/cmd/structure/refresh.ts
1999
- async function Zr(e) {
2078
+ async function ii(e) {
2000
2079
  for (let t of e.paths) {
2001
- let n = await Yr({
2080
+ let n = await ni({
2002
2081
  blockPath: t,
2003
2082
  isSdkInternal: e.isSdkInternal,
2004
2083
  updateDepsOnly: e.updateDepsOnly,
@@ -2006,43 +2085,43 @@ async function Zr(e) {
2006
2085
  templatesRoot: e.templatesRoot,
2007
2086
  log: (t) => e.logger.info(t)
2008
2087
  });
2009
- e.logger.info(Xr(t, n.changes));
2088
+ e.logger.info(ri(t, n.changes));
2010
2089
  }
2011
2090
  }
2012
- function Qr(e) {
2013
- let t = new p("refresh").description("Bring block(s) up to date with the canonical structure. Applies rules, writes files, bumps .structure version. Default mode is offline; --update-deps-only fires only catalog-bump rules (network).");
2091
+ function ai(e) {
2092
+ let t = new h("refresh").description("Bring block(s) up to date with the canonical structure. Applies rules, writes files, bumps .structure version. Default mode is offline; --update-deps-only fires only catalog-bump rules (network).");
2014
2093
  return t.argument("[paths...]", "block path(s); defaults to the current directory"), t.option("--sdk-internal", "block(s) live inside the SDK monorepo; skip root-scope rules"), t.option("--update-deps-only", "fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh."), t.action(async (t, n) => {
2015
- let r = t.length > 0 ? t : ["."], i = h.join(e, "src", "structure", "templates");
2016
- await Zr({
2094
+ let r = t.length > 0 ? t : ["."], i = _.join(e, "src", "structure", "templates");
2095
+ await ii({
2017
2096
  paths: r,
2018
2097
  isSdkInternal: !!n.sdkInternal,
2019
2098
  updateDepsOnly: !!n.updateDepsOnly,
2020
2099
  templatesRoot: i,
2021
- logger: new _()
2100
+ logger: new x()
2022
2101
  });
2023
2102
  }), t;
2024
2103
  }
2025
2104
  //#endregion
2026
2105
  //#region src/cmd/update-deps.ts
2027
- function $r(e) {
2028
- let t = new p("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
2106
+ function oi(e) {
2107
+ let t = new h("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
2029
2108
  return t.action(async () => {
2030
- let t = new _();
2031
- t.warn("`block-tools update-deps` is deprecated and will be removed in a future release. Use `block-tools structure refresh --update-deps-only` instead. Delegating now."), await Zr({
2109
+ let t = new x();
2110
+ t.warn("`block-tools update-deps` is deprecated and will be removed in a future release. Use `block-tools structure refresh --update-deps-only` instead. Delegating now."), await ii({
2032
2111
  paths: ["."],
2033
2112
  isSdkInternal: !1,
2034
2113
  updateDepsOnly: !0,
2035
- templatesRoot: h.join(e, "src", "structure", "templates"),
2114
+ templatesRoot: _.join(e, "src", "structure", "templates"),
2036
2115
  logger: t
2037
2116
  });
2038
2117
  }), t;
2039
2118
  }
2040
2119
  //#endregion
2041
2120
  //#region src/cmd/list-overview-snapshots.ts
2042
- function ei() {
2043
- let e = new p("list-overview-snapshots").description("List all available global overview snapshots in the registry");
2044
- return e.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
2045
- let t = new _(), n = await new s(o(e.registry), t).listGlobalOverviewSnapshots();
2121
+ function si() {
2122
+ let e = new h("list-overview-snapshots").description("List all available global overview snapshots in the registry");
2123
+ return e.addOption(new g("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
2124
+ let t = new x(), n = await new m(l(e.registry), t).listGlobalOverviewSnapshots();
2046
2125
  if (e.json) t.info(JSON.stringify(n, null, 2));
2047
2126
  else if (n.length === 0) t.info("No snapshots found.");
2048
2127
  else {
@@ -2053,10 +2132,10 @@ function ei() {
2053
2132
  }
2054
2133
  //#endregion
2055
2134
  //#region src/cmd/restore-overview-from-snapshot.ts
2056
- function ti() {
2057
- let e = new p("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
2058
- return e.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.requiredOption("-s, --snapshot <timestamp>", "snapshot timestamp ID to restore from"), e.option("--skip-confirmation", "skip confirmation prompt (use with caution)", !1), e.action(async (e) => {
2059
- let t = new _(), n = new s(o(e.registry), t), r = await n.listGlobalOverviewSnapshots();
2135
+ function ci() {
2136
+ let e = new h("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
2137
+ return e.addOption(new g("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.requiredOption("-s, --snapshot <timestamp>", "snapshot timestamp ID to restore from"), e.option("--skip-confirmation", "skip confirmation prompt (use with caution)", !1), e.action(async (e) => {
2138
+ let t = new x(), n = new m(l(e.registry), t), r = await n.listGlobalOverviewSnapshots();
2060
2139
  if (!r.find((t) => t.timestamp === e.snapshot)) throw Error(`Snapshot '${e.snapshot}' not found. Available snapshots:\n${r.map((e) => ` - ${e.timestamp}`).join("\n") || " (none)"}`);
2061
2140
  if (!e.skipConfirmation) {
2062
2141
  let n = (await import("node:readline")).createInterface({
@@ -2079,7 +2158,7 @@ function ti() {
2079
2158
  }
2080
2159
  //#endregion
2081
2160
  //#region src/registry_v1/flags.ts
2082
- function ni(e) {
2161
+ function li(e) {
2083
2162
  let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
2084
2163
  if (t) {
2085
2164
  let { src: e, destName: n } = t.groups;
@@ -2089,33 +2168,33 @@ function ni(e) {
2089
2168
  };
2090
2169
  } else return {
2091
2170
  src: e,
2092
- destName: h.basename(e)
2171
+ destName: _.basename(e)
2093
2172
  };
2094
2173
  }
2095
- function ri(e, t) {
2096
- return new m(e, t).argParser((e, t) => [...t ?? [], ni(e)]).default([]);
2174
+ function ui(e, t) {
2175
+ return new g(e, t).argParser((e, t) => [...t ?? [], li(e)]).default([]);
2097
2176
  }
2098
2177
  //#endregion
2099
2178
  //#region src/cmd/upload-package-v1.ts
2100
- var ii = [
2179
+ var di = [
2101
2180
  "registry",
2102
2181
  "organization",
2103
2182
  "package",
2104
2183
  "version"
2105
2184
  ];
2106
- function ai() {
2107
- let e = new p("upload-package-v1").description("Uploads V1 package and refreshes the registry");
2108
- return e.addOption(new m("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new m("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new m("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new m("-v, --version <version>", "target version").env("PL_PACKAGE_VERSION")), e.option("-m, --meta <path>", "json file containing meta information to associate with tha package"), e.addOption(ri("-f, --file <file>", "package files")), e.addOption(new m("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.action(async (e) => {
2109
- let t = new _(), n = l.parse({});
2110
- for (let t of ii) e[t] && (n[t] = e[t]);
2111
- e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await g.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = ie.parse(await g.promises.readFile(e.meta, { encoding: "utf-8" }))));
2185
+ function fi() {
2186
+ let e = new h("upload-package-v1").description("Uploads V1 package and refreshes the registry");
2187
+ return e.addOption(new g("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new g("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new g("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new g("-v, --version <version>", "target version").env("PL_PACKAGE_VERSION")), e.option("-m, --meta <path>", "json file containing meta information to associate with tha package"), e.addOption(ui("-f, --file <file>", "package files")), e.addOption(new g("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), e.option("--no-refresh", "do not refresh repository after adding the package"), e.action(async (e) => {
2188
+ let t = new x(), n = f.parse({});
2189
+ for (let t of di) e[t] && (n[t] = e[t]);
2190
+ e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await v.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = se.parse(await v.promises.readFile(e.meta, { encoding: "utf-8" }))));
2112
2191
  for (let t of e.file) n.files[t.destName] = t.src;
2113
- let r = await c(n);
2114
- t.info(ie.stringify(r.conf));
2192
+ let r = await d(n);
2193
+ t.info(se.stringify(r.conf));
2115
2194
  let i = r.createRegistry(t), a = r.fullPackageName, o = i.constructNewPackage(a);
2116
2195
  for (let [e, n] of Object.entries(r.conf.files)) {
2117
2196
  t.info(`Uploading ${n} -> ${e} ...`);
2118
- let r = await g.promises.readFile(n);
2197
+ let r = await v.promises.readFile(n);
2119
2198
  await o.addFile(e, r);
2120
2199
  }
2121
2200
  t.info("Uploading meta information..."), await o.writeMeta(r.conf.meta), await o.finish(), e.refresh && await i.updateIfNeeded();
@@ -2123,12 +2202,12 @@ function ai() {
2123
2202
  }
2124
2203
  //#endregion
2125
2204
  //#region src/cmd/structure/check.ts
2126
- function oi(e) {
2127
- let t = new p("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
2205
+ function pi(e) {
2206
+ let t = new h("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
2128
2207
  return t.argument("[paths...]", "block path(s); defaults to the current directory"), t.option("--sdk-internal", "block(s) live inside the SDK monorepo; skip root-scope rules"), t.action(async (t, n) => {
2129
- let r = new _(), i = t.length > 0 ? t : ["."], a = h.join(e, "src", "structure", "templates"), o = !1;
2208
+ let r = new x(), i = t.length > 0 ? t : ["."], a = _.join(e, "src", "structure", "templates"), o = !1;
2130
2209
  for (let e of i) {
2131
- let t = await Yr({
2210
+ let t = await ni({
2132
2211
  blockPath: e,
2133
2212
  isSdkInternal: !!n.sdkInternal,
2134
2213
  updateDepsOnly: !1,
@@ -2136,41 +2215,41 @@ function oi(e) {
2136
2215
  templatesRoot: a,
2137
2216
  log: (e) => r.info(e)
2138
2217
  });
2139
- r.info(Xr(e, t.changes)), t.changes.length > 0 && (o = !0);
2218
+ r.info(ri(e, t.changes)), t.changes.length > 0 && (o = !0);
2140
2219
  }
2141
2220
  if (o) throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.");
2142
2221
  }), t;
2143
2222
  }
2144
2223
  //#endregion
2145
2224
  //#region src/structure/init-block-constructor.ts
2146
- var $ = ["python"], si = class extends Error {
2225
+ var mi = ["python"], hi = class extends Error {
2147
2226
  constructor(e) {
2148
2227
  super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
2149
2228
  }
2150
2229
  };
2151
- async function ci(e, t, n, r) {
2230
+ async function gi(e, t, n, r) {
2152
2231
  if (e !== void 0 && e !== "") return e;
2153
- if (n) throw new si(t);
2232
+ if (n) throw new hi(t);
2154
2233
  return r();
2155
2234
  }
2156
- async function li(e) {
2157
- let t = await ci(e.npmOrg, "npm-org", e.nonInteractive, () => de({
2235
+ async function _i(e) {
2236
+ let t = await gi(e.npmOrg, "npm-org", e.nonInteractive, () => me({
2158
2237
  message: "npm org (e.g. @platforma-open):",
2159
2238
  default: "@platforma-open"
2160
- })), n = await ci(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await ci(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2161
- i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
2239
+ })), n = await gi(e.orgScope, "org-scope", e.nonInteractive, () => me({ message: "org scope (e.g. my-org):" })), r = await gi(e.shortName, "short-name", e.nonInteractive, () => me({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2240
+ i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await pe({
2162
2241
  message: "Include a software module?",
2163
2242
  default: !1
2164
2243
  }) : e.withSoftware;
2165
2244
  let a;
2166
2245
  if (i) {
2167
- if (a = await ci(e.platform, "platform", e.nonInteractive, () => fe({
2246
+ if (a = await gi(e.platform, "platform", e.nonInteractive, () => he({
2168
2247
  message: "Software platform:",
2169
- choices: $.map((e) => ({
2248
+ choices: mi.map((e) => ({
2170
2249
  name: e,
2171
2250
  value: e
2172
2251
  }))
2173
- })), !$.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${$.join(", ")} ${$.length === 1 ? "is" : "are"} supported at v1.`);
2252
+ })), !mi.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${mi.join(", ")} ${mi.length === 1 ? "is" : "are"} supported at v1.`);
2174
2253
  } else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
2175
2254
  return {
2176
2255
  facadeName: `${t}/${n}.${r}`,
@@ -2181,20 +2260,20 @@ async function li(e) {
2181
2260
  softwarePlatform: a
2182
2261
  };
2183
2262
  }
2184
- async function ui(e) {
2185
- let t = e.vars, n = Sn(t), r = new Ee(e.blockPath), i = new De(e.templatesRoot), a = Cn({
2263
+ async function vi(e) {
2264
+ let t = e.vars, n = Cn(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = wn({
2186
2265
  blockVars: t,
2187
2266
  modules: n,
2188
2267
  isSdkInternal: !1,
2189
2268
  version: 2,
2190
2269
  dryRun: !1
2191
- }), o = Z.filter(Yn), s, c;
2270
+ }), o = nr.filter(Xn), s, c;
2192
2271
  try {
2193
- s = await Xn(o), c = await Qn(nr);
2272
+ s = await Zn(o), c = await $n(ar);
2194
2273
  } catch (e) {
2195
2274
  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)}`);
2196
2275
  }
2197
- return fn(qr, r, a, {
2276
+ return mn(ei, r, a, {
2198
2277
  templates: i,
2199
2278
  initMode: !0,
2200
2279
  registryLookup: s,
@@ -2203,12 +2282,12 @@ async function ui(e) {
2203
2282
  }
2204
2283
  //#endregion
2205
2284
  //#region src/cmd/structure/init.ts
2206
- function di(e) {
2207
- let t = new p("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
2208
- return t.argument("[path]", "target directory (default: <short-name> under the current directory)"), t.option("--npm-org <org>", "npm org, e.g. @platforma-open"), t.option("--org-scope <scope>", "org scope, e.g. my-org"), t.option("--short-name <name>", "block short name, e.g. mixcr-clonotyping"), t.option("--with-software", "include a software module"), t.option("--no-software", "omit the software module"), t.addOption(new m("--platform <platform>", "software platform (single-valued)").choices([...$])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
2209
- let r = new _(), i = n.withSoftware === !0, a = n.software === !1;
2285
+ function yi(e) {
2286
+ let t = new h("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
2287
+ return t.argument("[path]", "target directory (default: <short-name> under the current directory)"), t.option("--npm-org <org>", "npm org, e.g. @platforma-open"), t.option("--org-scope <scope>", "org scope, e.g. my-org"), t.option("--short-name <name>", "block short name, e.g. mixcr-clonotyping"), t.option("--with-software", "include a software module"), t.option("--no-software", "omit the software module"), t.addOption(new g("--platform <platform>", "software platform (single-valued)").choices([...mi])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
2288
+ let r = new x(), i = n.withSoftware === !0, a = n.software === !1;
2210
2289
  if (i && a) throw Error("--with-software and --no-software are mutually exclusive.");
2211
- let o = i ? !0 : a ? !1 : void 0, s = await li({
2290
+ let o = i ? !0 : a ? !1 : void 0, s = await _i({
2212
2291
  npmOrg: n.npmOrg,
2213
2292
  orgScope: n.orgScope,
2214
2293
  shortName: n.shortName,
@@ -2216,25 +2295,25 @@ function di(e) {
2216
2295
  platform: n.platform,
2217
2296
  nonInteractive: n.nonInteractive
2218
2297
  });
2219
- await ui({
2298
+ await vi({
2220
2299
  vars: s,
2221
- blockPath: t ? h.resolve(t) : h.resolve(process.cwd(), s.shortName),
2222
- templatesRoot: h.join(e, "src", "structure", "templates"),
2300
+ blockPath: t ? _.resolve(t) : _.resolve(process.cwd(), s.shortName),
2301
+ templatesRoot: _.join(e, "src", "structure", "templates"),
2223
2302
  log: (e) => r.info(e)
2224
2303
  });
2225
2304
  }), t;
2226
2305
  }
2227
2306
  //#endregion
2228
2307
  //#region src/cmd/software/knobs.ts
2229
- var fi = ["dev", "release"], pi = [
2308
+ var bi = ["dev", "release"], xi = [
2230
2309
  "docker",
2231
2310
  "binary",
2232
2311
  "all",
2233
2312
  "none"
2234
- ], mi = ["local", "remote"];
2235
- function hi(e) {
2313
+ ], Si = ["local", "remote"];
2314
+ function Ci(e) {
2236
2315
  if (e.usePublished) {
2237
- if (e.variant === "docker" || e.variant === "all") throw y.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
2316
+ if (e.variant === "docker" || e.variant === "all") throw b.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
2238
2317
  return { kind: "binary-existing" };
2239
2318
  }
2240
2319
  return e.variant === "none" ? { kind: "no-software" } : e.location === void 0 ? { kind: "bare" } : {
@@ -2246,33 +2325,33 @@ function hi(e) {
2246
2325
  }
2247
2326
  //#endregion
2248
2327
  //#region src/cmd/software/ecr-login.ts
2249
- var gi = "public.ecr.aws", _i = "us-east-1";
2250
- function vi(e) {
2328
+ var wi = "public.ecr.aws", Ti = "us-east-1";
2329
+ function Ei(e) {
2251
2330
  if (process.env.AWS_ACCESS_KEY_ID || process.env.AWS_PROFILE) return;
2252
- let t = process.env.PL_AWS_PROFILE ?? me.AWS_DEV_PROFILE;
2331
+ let t = process.env.PL_AWS_PROFILE ?? oe.AWS_DEV_PROFILE;
2253
2332
  process.env.AWS_PROFILE = t, e?.debug(`Using AWS profile '${t}' for dev push credentials`);
2254
2333
  }
2255
- function yi(e) {
2334
+ function Di(e) {
2256
2335
  return new URL(`https://${e}`).hostname;
2257
2336
  }
2258
- function bi() {
2259
- return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? me.AWS_DEV_PROFILE}`;
2337
+ function Oi() {
2338
+ return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? oe.AWS_DEV_PROFILE}`;
2260
2339
  }
2261
- async function xi(e, t) {
2262
- let n = yi(e);
2263
- if (n !== gi) throw y.CLIError(`automatic docker login is only supported for '${gi}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
2340
+ async function ki(e, t) {
2341
+ let n = Di(e);
2342
+ if (n !== wi) throw b.CLIError(`automatic docker login is only supported for '${wi}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
2264
2343
  t?.info(`Logging in to ECR registry '${n}'...`);
2265
2344
  let r, i;
2266
2345
  try {
2267
- let e = (await new ge({ region: _i }).send(new _e({}))).authorizationData?.authorizationToken;
2346
+ let e = (await new _e({ region: Ti }).send(new ve({}))).authorizationData?.authorizationToken;
2268
2347
  if (!e) throw Error("empty authorization token");
2269
2348
  let t = Buffer.from(e, "base64").toString("utf8"), n = t.indexOf(":");
2270
2349
  if (n < 0) throw Error("malformed authorization token (no ':' separator)");
2271
2350
  r = t.slice(0, n), i = t.slice(n + 1);
2272
2351
  } catch (e) {
2273
- throw y.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error ? e.message : String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n` + bi());
2352
+ throw b.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error ? e.message : String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n` + Oi());
2274
2353
  }
2275
- let a = he("docker", [
2354
+ let a = ge("docker", [
2276
2355
  "login",
2277
2356
  "--username",
2278
2357
  r,
@@ -2287,16 +2366,16 @@ async function xi(e, t) {
2287
2366
  ],
2288
2367
  env: {
2289
2368
  ...process.env,
2290
- HOME: process.env.HOME || le.homedir()
2369
+ HOME: process.env.HOME || fe.homedir()
2291
2370
  }
2292
2371
  });
2293
- if (a.error || a.status !== 0) throw y.CLIError(`'docker login ${n}' failed`);
2372
+ if (a.error || a.status !== 0) throw b.CLIError(`'docker login ${n}' failed`);
2294
2373
  }
2295
2374
  //#endregion
2296
2375
  //#region src/cmd/software/run-build.ts
2297
- async function Si(e) {
2376
+ async function Ai(e) {
2298
2377
  let { core: t, scenario: n, options: r = {}, logger: i } = e, a = r.ids;
2299
- t.buildMode = Ci(n);
2378
+ t.buildMode = ji(n);
2300
2379
  let o = () => t.buildSoftwareArchives({
2301
2380
  ids: a,
2302
2381
  forceBuild: !!r.force,
@@ -2313,94 +2392,99 @@ async function Si(e) {
2313
2392
  r.buildDocker && t.buildDockerImages({
2314
2393
  ids: a,
2315
2394
  registry: r.dockerRegistry,
2316
- strictPlatformMatching: v.isCI()
2395
+ strictPlatformMatching: y.isCI()
2317
2396
  }), await o(), r.pushDocker && t.publishDockerImages({
2318
2397
  ids: a,
2319
2398
  pushTo: r.dockerPushTo,
2320
- strictPlatformMatching: v.isCI()
2399
+ strictPlatformMatching: y.isCI()
2321
2400
  });
2322
2401
  break;
2323
2402
  case "target": {
2324
- let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f = Ei(e, r);
2403
+ let { channel: e, variant: s, location: c } = n, l = s !== "binary", u = s !== "docker", d = c === "remote", f = Pi(e, r);
2325
2404
  l && t.buildDockerImages({
2326
2405
  ids: a,
2327
2406
  registry: f.pull,
2328
- strictPlatformMatching: v.isCI()
2329
- }), u && await o(), d && e === "dev" && (l || u) && vi(i), l && d && (f.autoLogin && f.push && await xi(f.push, i), t.publishDockerImages({
2407
+ strictPlatformMatching: y.isCI()
2408
+ }), u && await o(), d && e === "dev" && (l || u) && Ei(i), l && d && (f.autoLogin && f.push && await ki(f.push, i), t.publishDockerImages({
2330
2409
  ids: a,
2331
2410
  pushTo: f.push,
2332
- strictPlatformMatching: v.isCI()
2411
+ strictPlatformMatching: y.isCI()
2333
2412
  })), u && d && await t.publishPackages({
2334
2413
  ids: a,
2335
2414
  storageURL: r.storageUrl
2336
2415
  });
2337
2416
  break;
2338
2417
  }
2339
- default: y.assertNever(n);
2418
+ default: b.assertNever(n);
2340
2419
  }
2341
2420
  t.buildSwJsonFiles({
2342
2421
  packageIds: a,
2343
2422
  noSoftware: n.kind === "no-software"
2344
2423
  });
2345
2424
  }
2346
- function Ci(e) {
2425
+ function ji(e) {
2347
2426
  return e.kind !== "target" || e.channel === "release" ? "release" : e.variant !== "docker" && e.location === "remote" ? "dev-remote" : "dev-local";
2348
2427
  }
2349
- function wi(e) {
2428
+ function Mi(e) {
2350
2429
  if (!e.includes("://")) return e;
2351
2430
  let t = new URL(e);
2352
2431
  return t.host + t.pathname;
2353
2432
  }
2354
- function Ti(e) {
2433
+ function Ni(e) {
2355
2434
  return {
2356
- registry: wi(e),
2435
+ registry: Mi(e),
2357
2436
  autoLogin: e.startsWith("ecr://")
2358
2437
  };
2359
2438
  }
2360
- function Ei(e, t) {
2361
- let n = e === "dev", r = process.env[n ? v.PL_DEV_DOCKER_PUSH_URL : v.PL_RELEASE_DOCKER_PUSH_URL], i = process.env[n ? v.PL_DEV_DOCKER_PULL_URL : v.PL_RELEASE_DOCKER_PULL_URL], a = t.dockerPushTo ?? r ?? (n ? me.DEV_DOCKER_PUSH_TARGET : void 0), o = a ? Ti(a) : {
2439
+ function Pi(e, t) {
2440
+ let n = e === "dev", r = process.env[n ? y.PL_DEV_DOCKER_PUSH_URL : y.PL_RELEASE_DOCKER_PUSH_URL], i = process.env[n ? y.PL_DEV_DOCKER_PULL_URL : y.PL_RELEASE_DOCKER_PULL_URL], a = t.dockerPushTo ?? r ?? (n ? oe.DEV_DOCKER_PUSH_TARGET : void 0), o = a ? Ni(a) : {
2362
2441
  registry: void 0,
2363
2442
  autoLogin: !1
2364
- }, s = t.dockerRegistry ?? i ?? (n ? a : me.DOCKER_REGISTRY);
2443
+ }, s = t.dockerRegistry ?? i ?? (n ? a : oe.DOCKER_REGISTRY);
2365
2444
  return {
2366
- pull: s ? wi(s) : void 0,
2445
+ pull: s ? Mi(s) : void 0,
2367
2446
  push: o.registry,
2368
2447
  autoLogin: o.autoLogin
2369
2448
  };
2370
2449
  }
2371
2450
  //#endregion
2372
2451
  //#region src/cmd/software/env.ts
2373
- var Di = "PL_BUILD_CHANNEL", Oi = "PL_BUILD_VARIANT", ki = "PL_BUILD_LOCATION", Ai = "PL_BUILD_USE_PUBLISHED";
2374
- v.PL_DOCKER_REGISTRY_PUSH_TO, v.PL_DEV_DOCKER_PUSH_URL, v.PL_DEV_DOCKER_PULL_URL, v.PL_DEV_BINARY_UPLOAD_URL, v.PL_RELEASE_DOCKER_PUSH_URL, v.PL_RELEASE_DOCKER_PULL_URL, v.PL_RELEASE_BINARY_UPLOAD_URL;
2452
+ var Fi = "PL_BUILD_CHANNEL", Ii = "PL_BUILD_VARIANT", Li = "PL_BUILD_LOCATION", Ri = "PL_BUILD_USE_PUBLISHED";
2453
+ y.PL_DOCKER_REGISTRY_PUSH_TO, y.PL_DEV_DOCKER_PUSH_URL, y.PL_DEV_DOCKER_PULL_URL, y.PL_DEV_BINARY_UPLOAD_URL, y.PL_RELEASE_DOCKER_PUSH_URL, y.PL_RELEASE_DOCKER_PULL_URL, y.PL_RELEASE_BINARY_UPLOAD_URL;
2375
2454
  //#endregion
2376
2455
  //#region src/cmd/software/build.ts
2377
- function ji() {
2378
- let e = new p("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
2379
- return e.addOption(new m("--channel <channel>", "registry channel to build for").choices([...fi]).env(Di)), e.addOption(new m("--variant <variant>", "artifact kind to build (default: all declared)").choices([...pi]).env(Oi)), e.addOption(new m("--location <location>", "where the artifact lands (local = no push)").choices([...mi]).env(ki)), e.addOption(new m("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(Ai)), e.addOption(new m("--log-level <level>", "logging level").choices([
2456
+ function zi() {
2457
+ let e = new h("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
2458
+ return e.addOption(new g("--channel <channel>", "registry channel to build for").choices([...bi]).env(Fi)), e.addOption(new g("--variant <variant>", "artifact kind to build (default: all declared)").choices([...xi]).env(Ii)), e.addOption(new g("--location <location>", "where the artifact lands (local = no push)").choices([...Si]).env(Li)), e.addOption(new g("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(Ri)), e.addOption(new g("--log-level <level>", "logging level").choices([
2380
2459
  "error",
2381
2460
  "warn",
2382
2461
  "info",
2383
2462
  "debug"
2384
- ]).default("info")), e.addOption(new m("--package-root <path>", "path to directory with package.json file")), e.addOption(new m("--force", "force action, ignoring automatic safety checks").default(!1)), e.addOption(new m("--version <value>", "override package version (ignore package.json)")), e.addOption(new m("--platform <os-arch>", "{os}-{arch} pair; no effect on cross-platform packages").choices([...y.AllPlatforms]).env(v.PL_PKG_OS)), e.addOption(new m("--all-platforms", "build for all supported platforms").default(!1)), e.addOption(new m("--full-dir-hash", "hash file contents (not metadata) for the dev content hash").env(v.PL_PKG_FULL_HASH).default(!1)), e.addOption(new m("--package-id <id...>", "act only on selected packages")), e.addOption(new m("--content-root <path>", "override software content root").env(v.PL_PKG_CONTENT_ROOT)), e.addOption(new m("--storage-url <url>", "override binary upload registry URL").env(v.PL_PKG_STORAGE_URL)), e.addOption(new m("--docker-registry <registry>", "docker pull registry embedded in the descriptor").env(v.PL_DOCKER_REGISTRY)), e.addOption(new m("--docker-push-to <registry>", "alternative registry for docker push").env(v.PL_DOCKER_REGISTRY_PUSH_TO)), e.addOption(new m("--docker-build", "build docker images").env(v.PL_DOCKER_BUILD).default(!1)), e.addOption(new m("--docker-no-build", "do not build docker images").env(v.PL_DOCKER_NO_BUILD).default(!1)), e.addOption(new m("--docker-autopush", "push docker images after build").env(v.PL_DOCKER_AUTOPUSH).default(!1)), e.addOption(new m("--docker-no-autopush", "do not push docker images").env(v.PL_DOCKER_NO_AUTOPUSH).default(!1)), e.addOption(new m("--conda-build", "build conda environment before packing").env(v.PL_CONDA_BUILD).default(!1)), e.addOption(new m("--conda-no-build", "do not build conda environment").env(v.PL_CONDA_NO_BUILD).default(!1)), e.action(async (e) => {
2385
- let t = y.createLogger(e.logLevel);
2463
+ ]).default("info")), e.addOption(new g("--package-root <path>", "path to directory with package.json file")), e.addOption(new g("--force", "force action, ignoring automatic safety checks").default(!1)), e.addOption(new g("--version <value>", "override package version (ignore package.json)")), e.addOption(new g("--platform <os-arch>", "{os}-{arch} pair; no effect on cross-platform packages").choices([...b.AllPlatforms]).env(y.PL_PKG_OS)), e.addOption(new g("--all-platforms", "build for all supported platforms").default(!1)), e.addOption(new g("--full-dir-hash", "hash file contents (not metadata) for the dev content hash").env(y.PL_PKG_FULL_HASH).default(!1)), e.addOption(new g("--package-id <id...>", "act only on selected packages")), e.addOption(new g("--content-root <path>", "override software content root").env(y.PL_PKG_CONTENT_ROOT)), e.addOption(new g("--storage-url <url>", "override binary upload registry URL").env(y.PL_PKG_STORAGE_URL)), e.addOption(new g("--docker-registry <registry>", "docker pull registry embedded in the descriptor").env(y.PL_DOCKER_REGISTRY)), e.addOption(new g("--docker-push-to <registry>", "alternative registry for docker push").env(y.PL_DOCKER_REGISTRY_PUSH_TO)), e.addOption(new g("--docker-build", "build docker images").env(y.PL_DOCKER_BUILD).default(!1)), e.addOption(new g("--docker-no-build", "do not build docker images").env(y.PL_DOCKER_NO_BUILD).default(!1)), e.addOption(new g("--docker-autopush", "push docker images after build").env(y.PL_DOCKER_AUTOPUSH).default(!1)), e.addOption(new g("--docker-no-autopush", "do not push docker images").env(y.PL_DOCKER_NO_AUTOPUSH).default(!1)), e.addOption(new g("--conda-build", "build conda environment before packing").env(y.PL_CONDA_BUILD).default(!1)), e.addOption(new g("--conda-no-build", "do not build conda environment").env(y.PL_CONDA_NO_BUILD).default(!1)), e.action(async (e) => {
2464
+ let t = b.createLogger(e.logLevel);
2386
2465
  try {
2387
- let n = hi({
2466
+ let n = Ci({
2388
2467
  channel: e.channel,
2389
2468
  variant: e.variant,
2390
2469
  location: e.location,
2391
2470
  usePublished: !!e.usePublished
2392
- }), r = pe(t, { packageRoot: e.packageRoot });
2471
+ }), r = ae(t, { packageRoot: e.packageRoot });
2393
2472
  r.version = e.version, r.targetPlatform = e.platform, r.allPlatforms = !!e.allPlatforms, r.fullDirHash = !!e.fullDirHash;
2394
- let i = y.shouldDoAction({
2395
- default: v.isCI(),
2473
+ let i = b.shouldDoAction({
2474
+ default: y.isCI(),
2396
2475
  enable: e.dockerBuild,
2397
2476
  disable: e.dockerNoBuild
2398
- }), a = i && y.shouldDoAction({
2399
- default: v.isCI() && !r.isPrivate,
2477
+ }), a = i && b.shouldDoAction({
2478
+ default: y.isCI() && !r.isPrivate,
2400
2479
  enable: e.dockerAutopush,
2401
2480
  disable: e.dockerNoAutopush
2402
2481
  });
2403
- await Si({
2482
+ n.kind === "bare" && ie({
2483
+ buildDocker: i,
2484
+ pushDocker: a,
2485
+ pushDisabledExplicitly: !!e.dockerNoAutopush,
2486
+ dockerPackageCount: r.selectedDockerPackages(e.packageId).length
2487
+ }), await Ai({
2404
2488
  core: r,
2405
2489
  scenario: n,
2406
2490
  logger: t,
@@ -2413,7 +2497,7 @@ function ji() {
2413
2497
  dockerPushTo: e.dockerPushTo,
2414
2498
  buildDocker: i,
2415
2499
  pushDocker: a,
2416
- condaBuild: y.shouldDoAction({
2500
+ condaBuild: b.shouldDoAction({
2417
2501
  default: !0,
2418
2502
  enable: e.condaBuild,
2419
2503
  disable: e.condaNoBuild
@@ -2427,22 +2511,22 @@ function ji() {
2427
2511
  }
2428
2512
  //#endregion
2429
2513
  //#region src/cmd/software/index.ts
2430
- function Mi() {
2431
- let e = new p("software").description("Build and publish a block's software modules");
2432
- return e.addCommand(ji()), e;
2514
+ function Bi() {
2515
+ let e = new h("software").description("Build and publish a block's software modules");
2516
+ return e.addCommand(zi()), e;
2433
2517
  }
2434
2518
  //#endregion
2435
2519
  //#region src/cli.ts
2436
- function Ni(e = process.cwd()) {
2437
- let t = new p();
2438
- t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(ve()), t.addCommand(be()), t.addCommand(xe()), t.addCommand(Ce()), t.addCommand(we()), t.addCommand(Te()), t.addCommand($r(e)), t.addCommand(ei()), t.addCommand(ti()), t.addCommand(ai()), t.addCommand(Mi());
2439
- let n = new p("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
2440
- return n.addCommand(oi(e)), n.addCommand(di(e)), n.addCommand(Qr(e)), t.addCommand(n), t;
2520
+ function Vi(e = process.cwd()) {
2521
+ let t = new h();
2522
+ t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(ye()), t.addCommand(xe()), t.addCommand(Se()), t.addCommand(Ce()), t.addCommand(Te()), t.addCommand(Ee()), t.addCommand(De()), t.addCommand(oi(e)), t.addCommand(si()), t.addCommand(ci()), t.addCommand(fi()), t.addCommand(Bi());
2523
+ let n = new h("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
2524
+ return n.addCommand(pi(e)), n.addCommand(yi(e)), n.addCommand(ai(e)), t.addCommand(n), t;
2441
2525
  }
2442
- async function Pi(e, t) {
2443
- await Ni(t).parseAsync(e);
2526
+ async function Hi(e, t) {
2527
+ await Vi(t).parseAsync(e);
2444
2528
  }
2445
2529
  //#endregion
2446
- export { Ni as buildProgram, Pi as run };
2530
+ export { Vi as buildProgram, Hi as run };
2447
2531
 
2448
2532
  //# sourceMappingURL=cli.mjs.map