@platforma-sdk/block-tools 2.14.4 → 2.14.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,53 +1,53 @@
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 ee } from "./config-Dx45aFJ_.mjs";
2
- import { Command as m, Option as h } from "commander";
3
- import g from "node:path";
4
- import _ from "node:fs";
5
- import { BlockPackManifest as te, StableChannel as ne, overrideDescriptionVersion as re, overrideManifestVersion as ie } from "@milaboratories/pl-model-middle-layer";
6
- import { assertDockerPushIntent as ae, createBuilder as oe, defaults as se, envs as v, util as y } from "@platforma-sdk/package-builder-lib";
7
- import { ConsoleLoggerAdapter as b } from "@milaboratories/ts-helpers";
8
- import ce, { parse as le, parseDocument as ue, stringify as de } from "yaml";
9
- import { setTimeout as fe } from "node:timers/promises";
10
- import * as pe from "node:os";
11
- import { confirm as me, input as he, select as ge } from "@inquirer/prompts";
12
- import { spawnSync as _e } from "node:child_process";
13
- import { ECRPUBLICClient as ve, GetAuthorizationTokenCommand as ye } from "@aws-sdk/client-ecr-public";
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 ee, w as te } from "./config-Dx45aFJ_.mjs";
2
+ import { Command as p, Option as m } from "commander";
3
+ import h from "node:path";
4
+ import g from "node:fs";
5
+ import { BlockPackManifest as ne, StableChannel as re, overrideDescriptionVersion as ie, overrideManifestVersion as ae } from "@milaboratories/pl-model-middle-layer";
6
+ import { assertDockerPushIntent as oe, createBuilder as se, defaults as ce, envs as _, util as v } from "@platforma-sdk/package-builder-lib";
7
+ import { ConsoleLoggerAdapter as y } from "@milaboratories/ts-helpers";
8
+ import le, { parse as ue, parseDocument as de, stringify as fe } from "yaml";
9
+ import { setTimeout as pe } from "node:timers/promises";
10
+ import * as me from "node:os";
11
+ import { confirm as he, input as ge, select as _e } from "@inquirer/prompts";
12
+ import { spawnSync as ve } from "node:child_process";
13
+ import { ECRPUBLICClient as ye, GetAuthorizationTokenCommand as be } from "@aws-sdk/client-ecr-public";
14
14
  //#region src/cmd/build-meta.ts
15
- function be() {
16
- let e = new m("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 xe() {
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.");
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 n = g.resolve(e.modulePath), r = await a(await t((await p(n)).meta, n));
19
- await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(r));
18
+ let n = h.resolve(e.modulePath), r = await a(await t((await ee(n)).meta, n));
19
+ await g.promises.writeFile(h.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 xe(e) {
24
+ async function Se(e) {
25
25
  try {
26
- return await _.promises.readFile(e, "utf8");
26
+ return await g.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 Se() {
33
- let e = new m("build-model").description("Extracts and outputs block model JSON from pre-built block model module");
32
+ function Ce() {
33
+ let e = new p("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 } = s(g.resolve(e.modulePath));
35
+ let { model: t, platforma: n } = s(h.resolve(e.modulePath));
36
36
  if (t ||= n, !t) throw Error("\"model\" export not found");
37
37
  let { config: r } = t;
38
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
39
  if (!("outputs" in r) || !("sections" in r)) throw Error("\"config\" has unexpected structure");
40
- let i = await xe(e.sourceBundle);
40
+ let i = await Se(e.sourceBundle);
41
41
  i !== void 0 && (r.code = {
42
42
  type: "plain",
43
43
  content: i
44
- }), await _.promises.writeFile(g.resolve(e.destination), JSON.stringify(r));
44
+ }), await g.promises.writeFile(h.resolve(e.destination), JSON.stringify(r));
45
45
  }), e;
46
46
  }
47
47
  //#endregion
48
48
  //#region src/cmd/build-kind-manifest.ts
49
- function Ce() {
50
- let e = new m("build-kind-manifest").description("Writes the block-kind dist manifest (identity + src source-hash) from a pre-built kind bundle");
49
+ function we() {
50
+ let e = new p("build-kind-manifest").description("Writes the block-kind dist manifest (identity + src source-hash) from a pre-built kind bundle");
51
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
52
  await o({
53
53
  modulePath: e.modulePath,
@@ -58,79 +58,79 @@ function Ce() {
58
58
  }
59
59
  //#endregion
60
60
  //#region src/cmd/pack.ts
61
- function we() {
62
- let t = new m("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
61
+ function Te() {
62
+ let t = new p("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
63
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(g.resolve(t.modulePath)), g.resolve(t.destinationPath));
64
+ await e(await u(h.resolve(t.modulePath)), h.resolve(t.destinationPath));
65
65
  }), t;
66
66
  }
67
67
  //#endregion
68
68
  //#region src/cmd/publish.ts
69
- function Te(e, t) {
69
+ function Ee(e, t) {
70
70
  let n = { ...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] = Te(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] = Ee(n[e], t[e]) : n[e] = t[e];
72
72
  return n;
73
73
  }
74
- function Ee() {
75
- let e = new m("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
76
- return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("--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 h("--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 h("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), e.action(async (e) => {
77
- let t = new b(), i = g.resolve(e.manifest), a = JSON.parse(await _.promises.readFile(i, { encoding: "utf-8" })), o = te.parse(a);
78
- o = Te(a, o);
79
- let s = g.dirname(i), u = g.dirname(s);
80
- t.info(`Manifest root = ${s}`), t.info(`Facade root = ${u}`), e.versionOverride && (o = ie(o, e.versionOverride));
81
- let d = new ee(l(e.registry), t);
82
- await c(d, o, u, async (e) => Buffer.from(await _.promises.readFile(g.resolve(s, e)))), e.unstable || (t.info(`Adding package to ${ne} channel...`), await d.addPackageToChannel(o.description.id, ne)), await n(s, r({
74
+ function De() {
75
+ let e = new p("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
76
+ return e.addOption(new m("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.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()), e.option("-m, --manifest <path>", "manifest file path", `./block-pack/${i}`), e.option("-v, --version-override <path>", "override package version"), 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.addOption(new m("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), e.action(async (e) => {
77
+ let t = new y(), i = h.resolve(e.manifest), a = JSON.parse(await g.promises.readFile(i, { encoding: "utf-8" })), o = ne.parse(a);
78
+ o = Ee(a, o);
79
+ let s = h.dirname(i), u = h.dirname(s);
80
+ t.info(`Manifest root = ${s}`), t.info(`Facade root = ${u}`), e.versionOverride && (o = ae(o, e.versionOverride));
81
+ let d = new te(l(e.registry), t);
82
+ await c(d, o, u, async (e) => Buffer.from(await g.promises.readFile(h.resolve(s, e)))), e.unstable || (t.info(`Adding package to ${re} channel...`), await d.addPackageToChannel(o.description.id, re)), await n(s, r({
83
83
  registryUrl: e.registryServeUrl,
84
84
  id: o.description.id
85
- })), t.info(`Wrote published coordinates to ${g.resolve(s, "published.json")}`), e.refresh && await d.updateIfNeeded();
85
+ })), t.info(`Wrote published coordinates to ${h.resolve(s, "published.json")}`), e.refresh && await d.updateIfNeeded();
86
86
  }), e;
87
87
  }
88
88
  //#endregion
89
89
  //#region src/cmd/refresh-registry.ts
90
- function De() {
91
- let e = new m("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
92
- return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("-m, --mode <mode>", "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")").choices([
90
+ function Oe() {
91
+ let e = new p("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
92
+ 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([
93
93
  "force",
94
94
  "normal",
95
95
  "dry-run"
96
96
  ]).env("PL_REGISTRY_REFRESH_DRY_RUN").default("normal")), e.action(async (e) => {
97
- await new ee(l(e.registry), new b()).updateIfNeeded(e.mode);
97
+ await new te(l(e.registry), new y()).updateIfNeeded(e.mode);
98
98
  }), e;
99
99
  }
100
100
  //#endregion
101
101
  //#region src/cmd/mark-stable.ts
102
- function Oe() {
103
- let e = new m("mark-stable").description("Mark target block stable");
104
- return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new h("-c, --channel <channel name>", "custom channel").default(ne).hideHelp()), e.option("-v, --version-override <path>", "override package version"), e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new h("--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(g.resolve(e.modulePath));
106
- e.versionOverride && (t = re(t, e.versionOverride));
107
- let n = new ee(l(e.registry), new b());
102
+ function ke() {
103
+ let e = new p("mark-stable").description("Mark target block stable");
104
+ return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new m("-c, --channel <channel name>", "custom channel").default(re).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) => {
105
+ let t = await ee(h.resolve(e.modulePath));
106
+ e.versionOverride && (t = ie(t, e.versionOverride));
107
+ let n = new te(l(e.registry), new y());
108
108
  e.unmark ? await n.removePackageFromChannel(t.id, e.channel) : await n.addPackageToChannel(t.id, e.channel), e.refresh && await n.updateIfNeeded();
109
109
  }), e;
110
110
  }
111
111
  //#endregion
112
112
  //#region src/structure/engine/fs/node.ts
113
- var ke = class {
113
+ var Ae = class {
114
114
  constructor(e) {
115
115
  this.root = e;
116
116
  }
117
117
  abs(e) {
118
- return g.resolve(this.root, e);
118
+ return h.resolve(this.root, e);
119
119
  }
120
120
  read(e) {
121
- return _.readFileSync(this.abs(e), "utf-8");
121
+ return g.readFileSync(this.abs(e), "utf-8");
122
122
  }
123
123
  write(e, t) {
124
124
  let n = this.abs(e);
125
- _.mkdirSync(g.dirname(n), { recursive: !0 }), _.writeFileSync(n, t, "utf-8");
125
+ g.mkdirSync(h.dirname(n), { recursive: !0 }), g.writeFileSync(n, t, "utf-8");
126
126
  }
127
127
  writeBinary(e, t) {
128
128
  let n = this.abs(e);
129
- _.mkdirSync(g.dirname(n), { recursive: !0 }), _.writeFileSync(n, t);
129
+ g.mkdirSync(h.dirname(n), { recursive: !0 }), g.writeFileSync(n, t);
130
130
  }
131
131
  exists(e) {
132
132
  try {
133
- return _.statSync(this.abs(e)), !0;
133
+ return g.statSync(this.abs(e)), !0;
134
134
  } catch {
135
135
  return !1;
136
136
  }
@@ -138,15 +138,15 @@ var ke = class {
138
138
  list(e) {
139
139
  let t = this.abs(e);
140
140
  try {
141
- if (!_.statSync(t).isDirectory()) return [];
141
+ if (!g.statSync(t).isDirectory()) return [];
142
142
  } catch {
143
143
  return [];
144
144
  }
145
145
  let n = [];
146
146
  function r(e, t) {
147
- let i = _.readdirSync(t, { withFileTypes: !0 });
147
+ let i = g.readdirSync(t, { withFileTypes: !0 });
148
148
  for (let a of i) {
149
- let i = e ? `${e}/${a.name}` : a.name, o = g.join(t, a.name);
149
+ let i = e ? `${e}/${a.name}` : a.name, o = h.join(t, a.name);
150
150
  a.isDirectory() ? r(i, o) : a.isFile() && n.push(i);
151
151
  }
152
152
  }
@@ -155,7 +155,7 @@ var ke = class {
155
155
  listDir(e) {
156
156
  let t = this.abs(e), n;
157
157
  try {
158
- n = _.readdirSync(t, { withFileTypes: !0 });
158
+ n = g.readdirSync(t, { withFileTypes: !0 });
159
159
  } catch {
160
160
  return [];
161
161
  }
@@ -166,48 +166,48 @@ var ke = class {
166
166
  }
167
167
  move(e, t) {
168
168
  let n = this.abs(e), r = this.abs(t);
169
- _.mkdirSync(g.dirname(r), { recursive: !0 }), _.renameSync(n, r);
169
+ g.mkdirSync(h.dirname(r), { recursive: !0 }), g.renameSync(n, r);
170
170
  }
171
171
  delete(e) {
172
- _.rmSync(this.abs(e), {
172
+ g.rmSync(this.abs(e), {
173
173
  recursive: !0,
174
174
  force: !0
175
175
  });
176
176
  }
177
- }, Ae = class {
177
+ }, je = class {
178
178
  constructor(e) {
179
179
  this.root = e;
180
180
  }
181
181
  staticRead(e) {
182
- return _.readFileSync(g.resolve(this.root, "static", e), "utf-8");
182
+ return g.readFileSync(h.resolve(this.root, "static", e), "utf-8");
183
183
  }
184
184
  staticReadBinary(e) {
185
- return _.readFileSync(g.resolve(this.root, "static", e));
185
+ return g.readFileSync(h.resolve(this.root, "static", e));
186
186
  }
187
187
  textRead(e) {
188
- return _.readFileSync(g.resolve(this.root, "text", e), "utf-8");
188
+ return g.readFileSync(h.resolve(this.root, "text", e), "utf-8");
189
189
  }
190
190
  };
191
- function je(e, t) {
191
+ function Me(e, t) {
192
192
  return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => t[n] ?? `\${${n}}`);
193
193
  }
194
194
  //#endregion
195
195
  //#region src/structure/engine/flatten.ts
196
- var Me = ["default", "init"];
197
- function Ne(e, t) {
196
+ var Ne = ["default", "init"];
197
+ function Pe(e, t) {
198
198
  if (!e) return t;
199
199
  if (!t) return e;
200
200
  let n = e.endsWith("/") ? e.slice(0, -1) : e, r = t.startsWith("/") ? t.slice(1) : t;
201
201
  return r ? `${n}/${r}` : n;
202
202
  }
203
- function Pe(e, t) {
203
+ function Fe(e, t) {
204
204
  return e.filter((e) => e.scope === t).slice().sort((e, t) => e.path.localeCompare(t.path));
205
205
  }
206
- function Fe(e, t) {
206
+ function Ie(e, t) {
207
207
  let n = [];
208
208
  function r(e, i, a, o, s) {
209
209
  if (e.kind === "scope") {
210
- let n = Pe(t.modules, e.scope);
210
+ let n = Fe(t.modules, e.scope);
211
211
  for (let t of n) for (let n of e.children) r(n, e.scope, t.path, o, s);
212
212
  return;
213
213
  }
@@ -220,14 +220,14 @@ function Fe(e, t) {
220
220
  for (let t of e.children) r(t, i, a, o, e.modes);
221
221
  return;
222
222
  }
223
- if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Le(e)}' is not inside a scope() frame`);
223
+ if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Re(e)}' is not inside a scope() frame`);
224
224
  if (e.kind === "rename") {
225
225
  n.push({
226
226
  leaf: e,
227
227
  scope: i,
228
228
  modulePath: a,
229
- resolvedPath: Ne(a, e.from),
230
- resolvedTo: Ne(a, e.to),
229
+ resolvedPath: Pe(a, e.from),
230
+ resolvedTo: Pe(a, e.to),
231
231
  triggers: o,
232
232
  modes: s
233
233
  });
@@ -237,15 +237,15 @@ function Fe(e, t) {
237
237
  leaf: e,
238
238
  scope: i,
239
239
  modulePath: a,
240
- resolvedPath: Ne(a, Ie(e)),
240
+ resolvedPath: Pe(a, Le(e)),
241
241
  triggers: o,
242
242
  modes: s
243
243
  });
244
244
  }
245
- for (let t of e.children) r(t, void 0, void 0, [], Me);
245
+ for (let t of e.children) r(t, void 0, void 0, [], Ne);
246
246
  return n;
247
247
  }
248
- function Ie(e) {
248
+ function Le(e) {
249
249
  switch (e.kind) {
250
250
  case "fixed":
251
251
  case "managed":
@@ -255,63 +255,63 @@ function Ie(e) {
255
255
  case "rename": return e.from;
256
256
  }
257
257
  }
258
- function Le(e) {
258
+ function Re(e) {
259
259
  return e.kind === "rename" ? `rename ${e.from} -> ${e.to}` : `${e.kind} ${e.path}`;
260
260
  }
261
261
  //#endregion
262
262
  //#region src/structure/engine/glob.ts
263
- var Re = /[.+^${}()|[\]\\]/g;
264
- function ze(e) {
263
+ var ze = /[.+^${}()|[\]\\]/g;
264
+ function Be(e) {
265
265
  let t = "";
266
266
  for (let n = 0; n < e.length; n++) {
267
267
  let r = e[n];
268
- r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(Re, "\\$&");
268
+ r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(ze, "\\$&");
269
269
  }
270
270
  return RegExp(`^${t}$`);
271
271
  }
272
- function Be(e, t) {
273
- return ze(e).test(t);
272
+ function Ve(e, t) {
273
+ return Be(e).test(t);
274
274
  }
275
275
  //#endregion
276
276
  //#region src/structure/engine/builders.ts
277
- var x, Ve;
278
- function He(e) {
279
- if (!x) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
280
- return x;
277
+ var b, He;
278
+ function Ue(e) {
279
+ if (!b) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
280
+ return b;
281
281
  }
282
- function S(e, t) {
283
- let n = He(e);
282
+ function x(e, t) {
283
+ let n = Ue(e);
284
284
  n.stack[n.stack.length - 1].push(t);
285
285
  }
286
- function Ue(e, t) {
287
- let n = Ve;
288
- Ve = e;
286
+ function We(e, t) {
287
+ let n = He;
288
+ He = e;
289
289
  try {
290
290
  return t();
291
291
  } finally {
292
- Ve = n;
292
+ He = n;
293
293
  }
294
294
  }
295
- function We() {
296
- return Ve;
295
+ function Ge() {
296
+ return He;
297
297
  }
298
- function Ge(e) {
299
- if (x) throw Error("defineStructure() cannot be called from inside another defineStructure().");
298
+ function Ke(e) {
299
+ if (b) throw Error("defineStructure() cannot be called from inside another defineStructure().");
300
300
  let t = [], n = {
301
301
  root: t,
302
302
  stack: [t],
303
303
  inScope: !1
304
304
  };
305
- x = n;
305
+ b = n;
306
306
  try {
307
307
  if (e(), n.stack.length !== 1) throw Error(`defineStructure: builder body left ${n.stack.length - 1} unclosed group frame(s)`);
308
308
  let r = { children: t };
309
- return Ke(r), r;
309
+ return qe(r), r;
310
310
  } finally {
311
- x = void 0;
311
+ b = void 0;
312
312
  }
313
313
  }
314
- function Ke(e) {
314
+ function qe(e) {
315
315
  let t = /* @__PURE__ */ new Map();
316
316
  function n(e, r) {
317
317
  if (e.kind === "scope") {
@@ -334,8 +334,8 @@ function Ke(e) {
334
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.`);
335
335
  }
336
336
  }
337
- function C(e, t) {
338
- let n = He("scope");
337
+ function S(e, t) {
338
+ let n = Ue("scope");
339
339
  if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
340
340
  let r = {
341
341
  kind: "scope",
@@ -349,22 +349,22 @@ function C(e, t) {
349
349
  n.stack.pop(), n.inScope = !1;
350
350
  }
351
351
  }
352
- var qe;
353
- function Je(e) {
354
- qe = e;
352
+ var Je;
353
+ function Ye(e) {
354
+ Je = e;
355
355
  }
356
- function w(e, t, n) {
357
- Ye(e, t), n && Ye((t) => !e(t), n);
356
+ function C(e, t, n) {
357
+ Xe(e, t), n && Xe((t) => !e(t), n);
358
358
  }
359
- function Ye(e, t) {
360
- if (x) {
361
- Xe(e, t);
359
+ function Xe(e, t) {
360
+ if (b) {
361
+ Ze(e, t);
362
362
  return;
363
363
  }
364
- if (!(qe?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
364
+ if (!(Je?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
365
365
  }
366
- function Xe(e, t) {
367
- let n = x, r = {
366
+ function Ze(e, t) {
367
+ let n = b, r = {
368
368
  kind: "when",
369
369
  trigger: e,
370
370
  children: []
@@ -376,11 +376,11 @@ function Xe(e, t) {
376
376
  n.stack.pop();
377
377
  }
378
378
  }
379
- function T(e) {
379
+ function w(e) {
380
380
  return (t) => t.filesMatch(e);
381
381
  }
382
- function Ze(e, t, n) {
383
- let r = He(e), i = {
382
+ function Qe(e, t, n) {
383
+ let r = Ue(e), i = {
384
384
  kind: "mode",
385
385
  modes: t,
386
386
  children: []
@@ -392,40 +392,40 @@ function Ze(e, t, n) {
392
392
  r.stack.pop();
393
393
  }
394
394
  }
395
- function Qe(e) {
396
- Ze("onInitOrUpdate", ["init", "updateDeps"], e);
395
+ function $e(e) {
396
+ Qe("onInitOrUpdate", ["init", "updateDeps"], e);
397
397
  }
398
- function E(e, t) {
399
- S("fixed", {
398
+ function T(e, t) {
399
+ x("fixed", {
400
400
  kind: "fixed",
401
401
  path: e,
402
402
  content: t
403
403
  });
404
404
  }
405
- function D(e, t, n) {
406
- S("managed", {
405
+ function E(e, t, n) {
406
+ x("managed", {
407
407
  kind: "managed",
408
408
  path: e,
409
409
  initial: t,
410
410
  body: n
411
411
  });
412
412
  }
413
- function $e(e, t) {
414
- S("scaffold", {
413
+ function D(e, t) {
414
+ x("scaffold", {
415
415
  kind: "scaffold",
416
416
  path: e,
417
417
  initial: t
418
418
  });
419
419
  }
420
420
  function O(e, t) {
421
- S("seed", {
421
+ x("seed", {
422
422
  kind: "seed",
423
423
  path: e,
424
424
  initial: t
425
425
  });
426
426
  }
427
427
  function k(e) {
428
- S("remove", {
428
+ x("remove", {
429
429
  kind: "remove",
430
430
  path: e
431
431
  });
@@ -619,7 +619,7 @@ function wt(e) {
619
619
  return t;
620
620
  }
621
621
  function Tt(e, t) {
622
- let n = e.ctx ?? We();
622
+ let n = e.ctx ?? Ge();
623
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(...).`);
624
624
  return n;
625
625
  }
@@ -670,7 +670,7 @@ function Ot(e, t, n = {}) {
670
670
  P = void 0;
671
671
  }
672
672
  }
673
- Je((e, t) => {
673
+ Ye((e, t) => {
674
674
  if (!P) return !1;
675
675
  let n = P.triggerContext;
676
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.");
@@ -814,7 +814,7 @@ function Xt(e) {
814
814
  //#endregion
815
815
  //#region src/structure/engine/parsers/yaml.ts
816
816
  function Zt(e) {
817
- return ue(e);
817
+ return de(e);
818
818
  }
819
819
  function Qt(e) {
820
820
  return e.toString();
@@ -855,11 +855,11 @@ function on(e, t, n, r) {
855
855
  return n.staticRead(e.path);
856
856
  case "tpl":
857
857
  if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
858
- return je(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
858
+ return Me(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
859
859
  case "generate": {
860
860
  let n = e.fn(r);
861
861
  if (t.endsWith(".json")) return St(n, r.isSdkInternal), ct(n, { collapse: !t.endsWith("package.json") });
862
- if (t.endsWith(".yaml") || t.endsWith(".yml")) return de(n);
862
+ if (t.endsWith(".yaml") || t.endsWith(".yml")) return fe(n);
863
863
  if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
864
864
  return n;
865
865
  }
@@ -916,7 +916,7 @@ function dn(e, t, n) {
916
916
  pathMissing: (t) => !un(e, t),
917
917
  filesMatch: (t) => {
918
918
  let r = n ? `${n}/${t}` : t;
919
- for (let t of e) if (Be(r, t)) return !0;
919
+ for (let t of e) if (Ve(r, t)) return !0;
920
920
  return !1;
921
921
  }
922
922
  };
@@ -980,14 +980,14 @@ function gn(e, t, n, r, i, a, o, s) {
980
980
  if (e.leaf.kind !== "managed") return;
981
981
  let c = e.leaf, l = e.resolvedPath, u = t.exists(l), d, f = !1;
982
982
  u ? d = t.read(l) : (d = on(c.initial, l, i, s), f = !0);
983
- let p = cn(l, d, c.body, r, a, o);
984
- if (f) return n || t.write(l, p), {
983
+ let ee = cn(l, d, c.body, r, a, o);
984
+ if (f) return n || t.write(l, ee), {
985
985
  scope: e.scope,
986
986
  path: l,
987
987
  primitive: "managed",
988
988
  action: "create"
989
989
  };
990
- if (p !== d) return n || t.write(l, p), {
990
+ if (ee !== d) return n || t.write(l, ee), {
991
991
  scope: e.scope,
992
992
  path: l,
993
993
  primitive: "managed",
@@ -1012,14 +1012,14 @@ function _n(e, t, n, r, i, a, o, s) {
1012
1012
  return l;
1013
1013
  }
1014
1014
  function vn(e, t, n, r = {}) {
1015
- return Ue(n, () => {
1016
- let i = Fe(e, n), a = !!r.initMode, o = _n(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
1015
+ return We(n, () => {
1016
+ let i = Ie(e, n), a = !!r.initMode, o = _n(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
1017
1017
  if (!n.dryRun && !n.updateDepsOnly && !a) {
1018
1018
  rn(t, { version: 2 });
1019
1019
  let i = {
1020
1020
  ...r.rediscover ? r.rediscover(t) : n,
1021
1021
  dryRun: !0
1022
- }, a = _n(Fe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== $t);
1022
+ }, a = _n(Ie(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== $t);
1023
1023
  if (a.length > 0) throw new an(a[0]);
1024
1024
  }
1025
1025
  return a && !n.dryRun && rn(t, { version: 2 }), { changes: o };
@@ -1188,7 +1188,7 @@ function Mn(e) {
1188
1188
  } catch {
1189
1189
  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.");
1190
1190
  }
1191
- let n = le(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1191
+ let n = ue(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1192
1192
  for (let t of r) {
1193
1193
  let n = jn(t);
1194
1194
  (n === "" || e.exists(n)) && i.add(n);
@@ -1244,12 +1244,16 @@ function Fn(e) {
1244
1244
  tn(a.version, 0);
1245
1245
  let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
1246
1246
  if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1247
- let s = Pn(o.name.replace(/\.block$/, ""));
1248
- return On({
1247
+ let s = o.name.replace(/\.block$/, ""), c = Pn(s);
1248
+ return i.some((e) => e.scope === "kind") || i.push({
1249
+ scope: "kind",
1250
+ name: `${s}.kind`,
1251
+ path: "kind"
1252
+ }), On({
1249
1253
  isSdkInternal: n,
1250
1254
  updateDepsOnly: e.updateDepsOnly ?? !1,
1251
1255
  modules: i,
1252
- blockVars: s,
1256
+ blockVars: c,
1253
1257
  version: a.version,
1254
1258
  dryRun: e.dryRun ?? !1
1255
1259
  });
@@ -1425,17 +1429,17 @@ async function Yn(e) {
1425
1429
  n = await fetch(e, { signal: AbortSignal.timeout(qn) });
1426
1430
  } catch (e) {
1427
1431
  if (t > Gn) throw e;
1428
- await fe(Kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1432
+ await pe(Kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1429
1433
  continue;
1430
1434
  }
1431
1435
  if (n.ok) return n;
1432
1436
  if (!(n.status === 429 || n.status >= 500) || t > Gn) throw Error(`registry returned HTTP ${n.status}`);
1433
1437
  let r = Jn(n.headers.get("retry-after"));
1434
1438
  if (r != null) {
1435
- await fe(r);
1439
+ await pe(r);
1436
1440
  continue;
1437
1441
  }
1438
- await fe(Kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1442
+ await pe(Kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1439
1443
  }
1440
1444
  }
1441
1445
  function Xn() {
@@ -1585,17 +1589,17 @@ function Cr() {
1585
1589
  //#endregion
1586
1590
  //#region src/structure/rules/root.ts
1587
1591
  function wr() {
1588
- C("root", () => {
1589
- w(({ ctx: e }) => !e.isSdkInternal, () => {
1590
- D("turbo.json", M(() => Un()), () => {
1592
+ S("root", () => {
1593
+ C(({ ctx: e }) => !e.isSdkInternal, () => {
1594
+ E("turbo.json", M(() => Un()), () => {
1591
1595
  Wn();
1592
- }), E(".vscode/settings.json", A("root/.vscode/settings.json")), D("package.json", M(() => Rn()), () => {
1596
+ }), T(".vscode/settings.json", A("root/.vscode/settings.json")), E("package.json", M(() => Rn()), () => {
1593
1597
  zn();
1594
- }), D("pnpm-workspace.yaml", M((e) => fr(e)), () => {
1598
+ }), E("pnpm-workspace.yaml", M((e) => fr(e)), () => {
1595
1599
  pr();
1596
- }), D(".gitignore", A("root/.gitignore"), () => {
1600
+ }), E(".gitignore", A("root/.gitignore"), () => {
1597
1601
  hr();
1598
- }), D(".changeset/config.json", M(() => Sr()), () => {
1602
+ }), E(".changeset/config.json", M(() => Sr()), () => {
1599
1603
  Cr();
1600
1604
  }), O(".changeset/scaffold.md", tt(gr));
1601
1605
  });
@@ -1607,15 +1611,15 @@ function Tr(e) {
1607
1611
  return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
1608
1612
  }
1609
1613
  function Er() {
1610
- C("root", () => {
1611
- w(({ ctx: e }) => !e.isSdkInternal, () => {
1612
- E(".github/workflows/build.yaml", j("workflows/build.tpl.yaml", (e) => {
1614
+ S("root", () => {
1615
+ C(({ ctx: e }) => !e.isSdkInternal, () => {
1616
+ T(".github/workflows/build.yaml", j("workflows/build.tpl.yaml", (e) => {
1613
1617
  let t = e.blockVars.shortName;
1614
1618
  return {
1615
1619
  appName: `Block: ${Tr(t)}`,
1616
1620
  appNameSlug: `block-${t}`
1617
1621
  };
1618
- })), E(".github/workflows/mark-stable.yaml", j("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${Tr(e.blockVars.shortName)} - Mark Stable` })));
1622
+ })), T(".github/workflows/mark-stable.yaml", j("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${Tr(e.blockVars.shortName)} - Mark Stable` })));
1619
1623
  });
1620
1624
  });
1621
1625
  }
@@ -1732,11 +1736,11 @@ function Rr(e) {
1732
1736
  //#endregion
1733
1737
  //#region src/structure/rules/block.ts
1734
1738
  function zr() {
1735
- C("block", () => {
1736
- k("index.js"), k("index.d.ts"), E("src/index.ts", j("block/src/index.tpl.ts", (e) => ({
1739
+ S("block", () => {
1740
+ k("index.js"), k("index.d.ts"), T("src/index.ts", j("block/src/index.tpl.ts", (e) => ({
1737
1741
  facadeName: e.blockVars.facadeName,
1738
1742
  pascalName: Rr(e.blockVars.shortName)
1739
- }))), E("src/AGENTS.ts", A("block/src/AGENTS.ts")), $e("src/block-extra.ts", A("block/src/block-extra.ts")), $e("src/agents-extra.ts", A("block/src/agents-extra.ts")), E("tsconfig.json", A("block/tsconfig.json")), O("logos/block-logo.png", et("block/logos/block-logo.png")), O("logos/organization-logo.png", et("block/logos/organization-logo.png")), D("package.json", M((e) => Ir(e)), (e) => {
1743
+ }))), 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", et("block/logos/block-logo.png")), O("logos/organization-logo.png", et("block/logos/organization-logo.png")), E("package.json", M((e) => Ir(e)), (e) => {
1740
1744
  Lr(e);
1741
1745
  });
1742
1746
  });
@@ -1799,15 +1803,15 @@ function Vr() {
1799
1803
  }), It({
1800
1804
  "@types/node": "*",
1801
1805
  typescript: "*"
1802
- }), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
1806
+ }), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1803
1807
  z("test", "vitest run --passWithNoTests"), V("vitest", "catalog:"), V("@types/node", "*");
1804
1808
  }, () => H("vitest"))), ar(), kt("tsup"), B("lint"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1805
1809
  }
1806
1810
  //#endregion
1807
1811
  //#region src/structure/rules/model.ts
1808
1812
  function Hr() {
1809
- C("model", () => {
1810
- w(T(Q), () => E("tsconfig.json", A("model/tsconfig.node.json")), () => E("tsconfig.json", A("model/tsconfig.json"))), E(".oxlintrc.json", A("model/.oxlintrc.json")), E(".oxfmtrc.json", A("model/.oxfmtrc.json")), O("src/index.ts", j("model/src/index.tpl.ts", (e) => ({ kindPkg: `${e.blockVars.facadeName}.kind` }))), D("package.json", M((e) => Br(e)), () => {
1813
+ S("model", () => {
1814
+ 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", j("model/src/index.tpl.ts", (e) => ({ kindPkg: `${e.blockVars.facadeName}.kind` }))), E("package.json", M((e) => Br(e)), () => {
1811
1815
  Vr();
1812
1816
  });
1813
1817
  });
@@ -1862,8 +1866,8 @@ function Gr() {
1862
1866
  //#endregion
1863
1867
  //#region src/structure/rules/kind.ts
1864
1868
  function Kr() {
1865
- C("kind", () => {
1866
- E("tsconfig.json", A("kind/tsconfig.json")), E(".oxlintrc.json", A("kind/.oxlintrc.json")), E(".oxfmtrc.json", A("kind/.oxfmtrc.json")), O("src/index.ts", A("kind/src/index.ts")), D("package.json", M((e) => Wr(e)), () => {
1869
+ S("kind", () => {
1870
+ T("tsconfig.json", A("kind/tsconfig.json")), T(".oxlintrc.json", A("kind/.oxlintrc.json")), T(".oxfmtrc.json", A("kind/.oxfmtrc.json")), D("src/index.ts", A("kind/src/index.ts")), E("package.json", M((e) => Wr(e)), () => {
1867
1871
  Gr();
1868
1872
  });
1869
1873
  });
@@ -1905,15 +1909,15 @@ function Jr() {
1905
1909
  }), ar(), B("preview"), B("lint"), It({
1906
1910
  "@types/node": "*",
1907
1911
  typescript: "*"
1908
- }), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
1912
+ }), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1909
1913
  z("test", "vitest run --passWithNoTests"), V("vitest", "catalog:"), V("@types/node", "*");
1910
1914
  }, () => H("vitest"))), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1911
1915
  }
1912
1916
  //#endregion
1913
1917
  //#region src/structure/rules/ui.ts
1914
1918
  function Yr() {
1915
- C("ui", () => {
1916
- w(T(Q), () => E("tsconfig.json", A("ui/tsconfig.node.json")), () => E("tsconfig.json", A("ui/tsconfig.json"))), E(".oxlintrc.json", A("ui/.oxlintrc.json")), E(".oxfmtrc.json", A("ui/.oxfmtrc.json")), $e("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 }))), D("package.json", M((e) => qr(e)), () => {
1919
+ S("ui", () => {
1920
+ 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) => qr(e)), () => {
1917
1921
  Jr();
1918
1922
  });
1919
1923
  });
@@ -1943,7 +1947,7 @@ function Xr(e) {
1943
1947
  };
1944
1948
  }
1945
1949
  function Zr() {
1946
- Z(), R("private", !0), R("type", "module"), z("build", "shx rm -rf dist && pl-tengo build"), z("check", "pl-tengo check"), z("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
1950
+ Z(), R("private", !0), R("type", "module"), z("build", "shx rm -rf dist && pl-tengo build"), z("check", "pl-tengo check"), z("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1947
1951
  z("test", "vitest run --passWithNoTests"), U({ vitest: "catalog:" });
1948
1952
  }, () => H("vitest"))), Pt("@platforma-sdk/workflow-tengo", "sdk:"), Rt("software"), U({
1949
1953
  "@platforma-sdk/tengo-builder": "sdk:",
@@ -1954,12 +1958,12 @@ function Zr() {
1954
1958
  //#endregion
1955
1959
  //#region src/structure/rules/workflow.ts
1956
1960
  function Qr() {
1957
- C("workflow", () => {
1958
- E("format.el", A("workflow/format.el")), w(({ ctx: e }) => !e.isSdkInternal, () => w(T(Q), () => {
1959
- E("tsconfig.json", A("workflow/tsconfig.json")), $e("vitest.config.mts", A("workflow/vitest.config.mts"));
1961
+ S("workflow", () => {
1962
+ T("format.el", A("workflow/format.el")), C(({ ctx: e }) => !e.isSdkInternal, () => C(w(Q), () => {
1963
+ T("tsconfig.json", A("workflow/tsconfig.json")), D("vitest.config.mts", A("workflow/vitest.config.mts"));
1960
1964
  }, () => {
1961
1965
  k("tsconfig.json"), k("vitest.config.mts");
1962
- })), k("index.js"), k("index.d.ts"), O("src/main.tpl.tengo", j("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), D("package.json", M((e) => Xr(e)), () => {
1966
+ })), 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) => Xr(e)), () => {
1963
1967
  Zr();
1964
1968
  });
1965
1969
  });
@@ -1997,8 +2001,8 @@ function ei() {
1997
2001
  //#endregion
1998
2002
  //#region src/structure/rules/test.ts
1999
2003
  function ti() {
2000
- C("test", () => {
2001
- E("tsconfig.json", A("test/tsconfig.json")), E(".oxlintrc.json", A("test/.oxlintrc.json")), E(".oxfmtrc.json", A("test/.oxfmtrc.json")), $e("vitest.config.mts", A("test/vitest.config.mts")), O("src/demo.test.ts", tt("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), D("package.json", M((e) => $r(e)), () => {
2004
+ S("test", () => {
2005
+ 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", tt("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), E("package.json", M((e) => $r(e)), () => {
2002
2006
  ei();
2003
2007
  });
2004
2008
  });
@@ -2048,21 +2052,21 @@ function oi() {
2048
2052
  //#region src/structure/rules/software.ts
2049
2053
  var si = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", ci = "# No dependencies specified for this script\n";
2050
2054
  function li() {
2051
- C("software", () => {
2052
- O("src/main.py", tt(si)), O("src/requirements.txt", tt(ci)), D("package.json", M((e) => ai(e)), () => {
2055
+ S("software", () => {
2056
+ O("src/main.py", tt(si)), O("src/requirements.txt", tt(ci)), E("package.json", M((e) => ai(e)), () => {
2053
2057
  oi();
2054
2058
  });
2055
2059
  });
2056
2060
  }
2057
2061
  function ui() {
2058
- C("model", () => {
2062
+ S("model", () => {
2059
2063
  k("eslint.config.mjs"), k("vite.config.mts");
2060
- }), C("ui", () => {
2064
+ }), S("ui", () => {
2061
2065
  k("eslint.config.mjs"), k("vite.config.ts"), k("tsconfig.app.json"), k("tsconfig.node.json");
2062
- }), C("test", () => {
2066
+ }), S("test", () => {
2063
2067
  k("eslint.config.mjs");
2064
- }), C("root", () => {
2065
- k(".prettierrc"), D("package.json", M(() => Rn()), () => {
2068
+ }), S("root", () => {
2069
+ k(".prettierrc"), E("package.json", M(() => Rn()), () => {
2066
2070
  B("pretty"), H("@platforma-sdk/blocks-deps-updater");
2067
2071
  });
2068
2072
  });
@@ -2070,10 +2074,10 @@ function ui() {
2070
2074
  //#endregion
2071
2075
  //#region src/structure/rules/root-catalog-bump.ts
2072
2076
  function di() {
2073
- Qe(() => {
2074
- C("root", () => {
2075
- w(({ ctx: e }) => !e.isSdkInternal, () => {
2076
- D("pnpm-workspace.yaml", M((e) => fr(e)), (e) => {
2077
+ $e(() => {
2078
+ S("root", () => {
2079
+ C(({ ctx: e }) => !e.isSdkInternal, () => {
2080
+ E("pnpm-workspace.yaml", M((e) => fr(e)), (e) => {
2077
2081
  for (let e of or) qt(e);
2078
2082
  for (let e of lr) Jt(e.entry, {
2079
2083
  of: e.of,
@@ -2088,7 +2092,7 @@ function di() {
2088
2092
  }
2089
2093
  //#endregion
2090
2094
  //#region src/structure/structure-definition.ts
2091
- var fi = Ge(() => {
2095
+ var fi = Ke(() => {
2092
2096
  wr(), Er(), zr(), Hr(), Kr(), Yr(), Qr(), ti(), li(), ui(), di();
2093
2097
  });
2094
2098
  //#endregion
@@ -2097,7 +2101,7 @@ async function pi() {
2097
2101
  return tr(or.filter(er));
2098
2102
  }
2099
2103
  async function mi(e) {
2100
- let t = g.resolve(e.blockPath), n = e.mode === "check", r = new ke(t), i = new Ae(e.templatesRoot), a = vn(fi, r, Fn({
2104
+ let t = h.resolve(e.blockPath), n = e.mode === "check", r = new Ae(t), i = new je(e.templatesRoot), a = vn(fi, r, Fn({
2101
2105
  fs: r,
2102
2106
  isSdkInternal: e.isSdkInternal,
2103
2107
  updateDepsOnly: e.updateDepsOnly,
@@ -2139,29 +2143,29 @@ async function gi(e) {
2139
2143
  }
2140
2144
  }
2141
2145
  function _i(e) {
2142
- let t = new m("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).");
2146
+ 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).");
2143
2147
  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) => {
2144
- let r = t.length > 0 ? t : ["."], i = g.join(e, "src", "structure", "templates");
2148
+ let r = t.length > 0 ? t : ["."], i = h.join(e, "src", "structure", "templates");
2145
2149
  await gi({
2146
2150
  paths: r,
2147
2151
  isSdkInternal: !!n.sdkInternal,
2148
2152
  updateDepsOnly: !!n.updateDepsOnly,
2149
2153
  templatesRoot: i,
2150
- logger: new b()
2154
+ logger: new y()
2151
2155
  });
2152
2156
  }), t;
2153
2157
  }
2154
2158
  //#endregion
2155
2159
  //#region src/cmd/update-deps.ts
2156
2160
  function vi(e) {
2157
- let t = new m("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
2161
+ let t = new p("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
2158
2162
  return t.action(async () => {
2159
- let t = new b();
2163
+ let t = new y();
2160
2164
  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 gi({
2161
2165
  paths: ["."],
2162
2166
  isSdkInternal: !1,
2163
2167
  updateDepsOnly: !0,
2164
- templatesRoot: g.join(e, "src", "structure", "templates"),
2168
+ templatesRoot: h.join(e, "src", "structure", "templates"),
2165
2169
  logger: t
2166
2170
  });
2167
2171
  }), t;
@@ -2169,9 +2173,9 @@ function vi(e) {
2169
2173
  //#endregion
2170
2174
  //#region src/cmd/list-overview-snapshots.ts
2171
2175
  function yi() {
2172
- let e = new m("list-overview-snapshots").description("List all available global overview snapshots in the registry");
2173
- return e.addOption(new h("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
2174
- let t = new b(), n = await new ee(l(e.registry), t).listGlobalOverviewSnapshots();
2176
+ let e = new p("list-overview-snapshots").description("List all available global overview snapshots in the registry");
2177
+ 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) => {
2178
+ let t = new y(), n = await new te(l(e.registry), t).listGlobalOverviewSnapshots();
2175
2179
  if (e.json) t.info(JSON.stringify(n, null, 2));
2176
2180
  else if (n.length === 0) t.info("No snapshots found.");
2177
2181
  else {
@@ -2183,9 +2187,9 @@ function yi() {
2183
2187
  //#endregion
2184
2188
  //#region src/cmd/restore-overview-from-snapshot.ts
2185
2189
  function bi() {
2186
- let e = new m("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
2187
- return e.addOption(new h("-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) => {
2188
- let t = new b(), n = new ee(l(e.registry), t), r = await n.listGlobalOverviewSnapshots();
2190
+ let e = new p("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
2191
+ 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) => {
2192
+ let t = new y(), n = new te(l(e.registry), t), r = await n.listGlobalOverviewSnapshots();
2189
2193
  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)"}`);
2190
2194
  if (!e.skipConfirmation) {
2191
2195
  let n = (await import("node:readline")).createInterface({
@@ -2218,11 +2222,11 @@ function xi(e) {
2218
2222
  };
2219
2223
  } else return {
2220
2224
  src: e,
2221
- destName: g.basename(e)
2225
+ destName: h.basename(e)
2222
2226
  };
2223
2227
  }
2224
2228
  function Si(e, t) {
2225
- return new h(e, t).argParser((e, t) => [...t ?? [], xi(e)]).default([]);
2229
+ return new m(e, t).argParser((e, t) => [...t ?? [], xi(e)]).default([]);
2226
2230
  }
2227
2231
  //#endregion
2228
2232
  //#region src/cmd/upload-package-v1.ts
@@ -2233,18 +2237,18 @@ var Ci = [
2233
2237
  "version"
2234
2238
  ];
2235
2239
  function wi() {
2236
- let e = new m("upload-package-v1").description("Uploads V1 package and refreshes the registry");
2237
- return e.addOption(new h("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new h("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new h("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new h("-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(Si("-f, --file <file>", "package files")), e.addOption(new h("--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) => {
2238
- let t = new b(), n = f.parse({});
2240
+ let e = new p("upload-package-v1").description("Uploads V1 package and refreshes the registry");
2241
+ 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(Si("-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) => {
2242
+ let t = new y(), n = f.parse({});
2239
2243
  for (let t of Ci) e[t] && (n[t] = e[t]);
2240
- e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await _.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = ce.parse(await _.promises.readFile(e.meta, { encoding: "utf-8" }))));
2244
+ 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 = le.parse(await g.promises.readFile(e.meta, { encoding: "utf-8" }))));
2241
2245
  for (let t of e.file) n.files[t.destName] = t.src;
2242
2246
  let r = await d(n);
2243
- t.info(ce.stringify(r.conf));
2247
+ t.info(le.stringify(r.conf));
2244
2248
  let i = r.createRegistry(t), a = r.fullPackageName, o = i.constructNewPackage(a);
2245
2249
  for (let [e, n] of Object.entries(r.conf.files)) {
2246
2250
  t.info(`Uploading ${n} -> ${e} ...`);
2247
- let r = await _.promises.readFile(n);
2251
+ let r = await g.promises.readFile(n);
2248
2252
  await o.addFile(e, r);
2249
2253
  }
2250
2254
  t.info("Uploading meta information..."), await o.writeMeta(r.conf.meta), await o.finish(), e.refresh && await i.updateIfNeeded();
@@ -2253,9 +2257,9 @@ function wi() {
2253
2257
  //#endregion
2254
2258
  //#region src/cmd/structure/check.ts
2255
2259
  function Ti(e) {
2256
- let t = new m("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
2260
+ 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.");
2257
2261
  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) => {
2258
- let r = new b(), i = t.length > 0 ? t : ["."], a = g.join(e, "src", "structure", "templates"), o = !1;
2262
+ let r = new y(), i = t.length > 0 ? t : ["."], a = h.join(e, "src", "structure", "templates"), o = !1;
2259
2263
  for (let e of i) {
2260
2264
  let t = await mi({
2261
2265
  blockPath: e,
@@ -2283,17 +2287,17 @@ async function Di(e, t, n, r) {
2283
2287
  return r();
2284
2288
  }
2285
2289
  async function Oi(e) {
2286
- let t = await Di(e.npmOrg, "npm-org", e.nonInteractive, () => he({
2290
+ let t = await Di(e.npmOrg, "npm-org", e.nonInteractive, () => ge({
2287
2291
  message: "npm org (e.g. @platforma-open):",
2288
2292
  default: "@platforma-open"
2289
- })), n = await Di(e.orgScope, "org-scope", e.nonInteractive, () => he({ message: "org scope (e.g. my-org):" })), r = await Di(e.shortName, "short-name", e.nonInteractive, () => he({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2290
- i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await me({
2293
+ })), n = await Di(e.orgScope, "org-scope", e.nonInteractive, () => ge({ message: "org scope (e.g. my-org):" })), r = await Di(e.shortName, "short-name", e.nonInteractive, () => ge({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2294
+ i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await he({
2291
2295
  message: "Include a software module?",
2292
2296
  default: !1
2293
2297
  }) : e.withSoftware;
2294
2298
  let a;
2295
2299
  if (i) {
2296
- if (a = await Di(e.platform, "platform", e.nonInteractive, () => ge({
2300
+ if (a = await Di(e.platform, "platform", e.nonInteractive, () => _e({
2297
2301
  message: "Software platform:",
2298
2302
  choices: $.map((e) => ({
2299
2303
  name: e,
@@ -2311,7 +2315,7 @@ async function Oi(e) {
2311
2315
  };
2312
2316
  }
2313
2317
  async function ki(e) {
2314
- let t = e.vars, n = Dn(t), r = new ke(e.blockPath), i = new Ae(e.templatesRoot), a = On({
2318
+ let t = e.vars, n = Dn(t), r = new Ae(e.blockPath), i = new je(e.templatesRoot), a = On({
2315
2319
  blockVars: t,
2316
2320
  modules: n,
2317
2321
  isSdkInternal: !1,
@@ -2333,9 +2337,9 @@ async function ki(e) {
2333
2337
  //#endregion
2334
2338
  //#region src/cmd/structure/init.ts
2335
2339
  function Ai(e) {
2336
- let t = new m("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
2337
- 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 h("--platform <platform>", "software platform (single-valued)").choices([...$])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
2338
- let r = new b(), i = n.withSoftware === !0, a = n.software === !1;
2340
+ let t = new p("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
2341
+ 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) => {
2342
+ let r = new y(), i = n.withSoftware === !0, a = n.software === !1;
2339
2343
  if (i && a) throw Error("--with-software and --no-software are mutually exclusive.");
2340
2344
  let o = i ? !0 : a ? !1 : void 0, s = await Oi({
2341
2345
  npmOrg: n.npmOrg,
@@ -2347,8 +2351,8 @@ function Ai(e) {
2347
2351
  });
2348
2352
  await ki({
2349
2353
  vars: s,
2350
- blockPath: t ? g.resolve(t) : g.resolve(process.cwd(), s.shortName),
2351
- templatesRoot: g.join(e, "src", "structure", "templates"),
2354
+ blockPath: t ? h.resolve(t) : h.resolve(process.cwd(), s.shortName),
2355
+ templatesRoot: h.join(e, "src", "structure", "templates"),
2352
2356
  log: (e) => r.info(e)
2353
2357
  });
2354
2358
  }), t;
@@ -2363,7 +2367,7 @@ var ji = ["dev", "release"], Mi = [
2363
2367
  ], Ni = ["local", "remote"];
2364
2368
  function Pi(e) {
2365
2369
  if (e.usePublished) {
2366
- if (e.variant === "docker" || e.variant === "all") throw y.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
2370
+ if (e.variant === "docker" || e.variant === "all") throw v.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);
2367
2371
  return { kind: "binary-existing" };
2368
2372
  }
2369
2373
  return e.variant === "none" ? { kind: "no-software" } : e.location === void 0 ? { kind: "bare" } : {
@@ -2378,30 +2382,30 @@ function Pi(e) {
2378
2382
  var Fi = "public.ecr.aws", Ii = "us-east-1";
2379
2383
  function Li(e) {
2380
2384
  if (process.env.AWS_ACCESS_KEY_ID || process.env.AWS_PROFILE) return;
2381
- let t = process.env.PL_AWS_PROFILE ?? se.AWS_DEV_PROFILE;
2385
+ let t = process.env.PL_AWS_PROFILE ?? ce.AWS_DEV_PROFILE;
2382
2386
  process.env.AWS_PROFILE = t, e?.debug(`Using AWS profile '${t}' for dev push credentials`);
2383
2387
  }
2384
2388
  function Ri(e) {
2385
2389
  return new URL(`https://${e}`).hostname;
2386
2390
  }
2387
2391
  function zi() {
2388
- return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? se.AWS_DEV_PROFILE}`;
2392
+ return ` aws sso login --profile ${process.env.AWS_PROFILE ?? process.env.PL_AWS_PROFILE ?? ce.AWS_DEV_PROFILE}`;
2389
2393
  }
2390
2394
  async function Bi(e, t) {
2391
2395
  let n = Ri(e);
2392
- if (n !== Fi) throw y.CLIError(`automatic docker login is only supported for '${Fi}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
2396
+ if (n !== Fi) throw v.CLIError(`automatic docker login is only supported for '${Fi}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);
2393
2397
  t?.info(`Logging in to ECR registry '${n}'...`);
2394
2398
  let r, i;
2395
2399
  try {
2396
- let e = (await new ve({ region: Ii }).send(new ye({}))).authorizationData?.authorizationToken;
2400
+ let e = (await new ye({ region: Ii }).send(new be({}))).authorizationData?.authorizationToken;
2397
2401
  if (!e) throw Error("empty authorization token");
2398
2402
  let t = Buffer.from(e, "base64").toString("utf8"), n = t.indexOf(":");
2399
2403
  if (n < 0) throw Error("malformed authorization token (no ':' separator)");
2400
2404
  r = t.slice(0, n), i = t.slice(n + 1);
2401
2405
  } catch (e) {
2402
- 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` + zi());
2406
+ throw v.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` + zi());
2403
2407
  }
2404
- let a = _e("docker", [
2408
+ let a = ve("docker", [
2405
2409
  "login",
2406
2410
  "--username",
2407
2411
  r,
@@ -2416,10 +2420,10 @@ async function Bi(e, t) {
2416
2420
  ],
2417
2421
  env: {
2418
2422
  ...process.env,
2419
- HOME: process.env.HOME || pe.homedir()
2423
+ HOME: process.env.HOME || me.homedir()
2420
2424
  }
2421
2425
  });
2422
- if (a.error || a.status !== 0) throw y.CLIError(`'docker login ${n}' failed`);
2426
+ if (a.error || a.status !== 0) throw v.CLIError(`'docker login ${n}' failed`);
2423
2427
  }
2424
2428
  //#endregion
2425
2429
  //#region src/cmd/software/run-build.ts
@@ -2442,11 +2446,11 @@ async function Vi(e) {
2442
2446
  r.buildDocker && t.buildDockerImages({
2443
2447
  ids: a,
2444
2448
  registry: r.dockerRegistry,
2445
- strictPlatformMatching: v.isCI()
2449
+ strictPlatformMatching: _.isCI()
2446
2450
  }), await o(), r.pushDocker && t.publishDockerImages({
2447
2451
  ids: a,
2448
2452
  pushTo: r.dockerPushTo,
2449
- strictPlatformMatching: v.isCI()
2453
+ strictPlatformMatching: _.isCI()
2450
2454
  });
2451
2455
  break;
2452
2456
  case "target": {
@@ -2454,18 +2458,18 @@ async function Vi(e) {
2454
2458
  l && t.buildDockerImages({
2455
2459
  ids: a,
2456
2460
  registry: f.pull,
2457
- strictPlatformMatching: v.isCI()
2461
+ strictPlatformMatching: _.isCI()
2458
2462
  }), u && await o(), d && e === "dev" && (l || u) && Li(i), l && d && (f.autoLogin && f.push && await Bi(f.push, i), t.publishDockerImages({
2459
2463
  ids: a,
2460
2464
  pushTo: f.push,
2461
- strictPlatformMatching: v.isCI()
2465
+ strictPlatformMatching: _.isCI()
2462
2466
  })), u && d && await t.publishPackages({
2463
2467
  ids: a,
2464
2468
  storageURL: r.storageUrl
2465
2469
  });
2466
2470
  break;
2467
2471
  }
2468
- default: y.assertNever(n);
2472
+ default: v.assertNever(n);
2469
2473
  }
2470
2474
  t.buildSwJsonFiles({
2471
2475
  packageIds: a,
@@ -2487,10 +2491,10 @@ function Wi(e) {
2487
2491
  };
2488
2492
  }
2489
2493
  function Gi(e, t) {
2490
- 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 ? se.DEV_DOCKER_PUSH_TARGET : void 0), o = a ? Wi(a) : {
2494
+ let n = e === "dev", r = process.env[n ? _.PL_DEV_DOCKER_PUSH_URL : _.PL_RELEASE_DOCKER_PUSH_URL], i = process.env[n ? _.PL_DEV_DOCKER_PULL_URL : _.PL_RELEASE_DOCKER_PULL_URL], a = t.dockerPushTo ?? r ?? (n ? ce.DEV_DOCKER_PUSH_TARGET : void 0), o = a ? Wi(a) : {
2491
2495
  registry: void 0,
2492
2496
  autoLogin: !1
2493
- }, s = t.dockerRegistry ?? i ?? (n ? a : se.DOCKER_REGISTRY);
2497
+ }, s = t.dockerRegistry ?? i ?? (n ? a : ce.DOCKER_REGISTRY);
2494
2498
  return {
2495
2499
  pull: s ? Ui(s) : void 0,
2496
2500
  push: o.registry,
@@ -2500,36 +2504,36 @@ function Gi(e, t) {
2500
2504
  //#endregion
2501
2505
  //#region src/cmd/software/env.ts
2502
2506
  var Ki = "PL_BUILD_CHANNEL", qi = "PL_BUILD_VARIANT", Ji = "PL_BUILD_LOCATION", Yi = "PL_BUILD_USE_PUBLISHED";
2503
- 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;
2507
+ _.PL_DOCKER_REGISTRY_PUSH_TO, _.PL_DEV_DOCKER_PUSH_URL, _.PL_DEV_DOCKER_PULL_URL, _.PL_DEV_BINARY_UPLOAD_URL, _.PL_RELEASE_DOCKER_PUSH_URL, _.PL_RELEASE_DOCKER_PULL_URL, _.PL_RELEASE_BINARY_UPLOAD_URL;
2504
2508
  //#endregion
2505
2509
  //#region src/cmd/software/build.ts
2506
2510
  function Xi() {
2507
- let e = new m("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
2508
- return e.addOption(new h("--channel <channel>", "registry channel to build for").choices([...ji]).env(Ki)), e.addOption(new h("--variant <variant>", "artifact kind to build (default: all declared)").choices([...Mi]).env(qi)), e.addOption(new h("--location <location>", "where the artifact lands (local = no push)").choices([...Ni]).env(Ji)), e.addOption(new h("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(Yi)), e.addOption(new h("--log-level <level>", "logging level").choices([
2511
+ let e = new p("build").description("Build a software module for a target and write its .sw.json descriptor (build + push in one pass)");
2512
+ return e.addOption(new m("--channel <channel>", "registry channel to build for").choices([...ji]).env(Ki)), e.addOption(new m("--variant <variant>", "artifact kind to build (default: all declared)").choices([...Mi]).env(qi)), e.addOption(new m("--location <location>", "where the artifact lands (local = no push)").choices([...Ni]).env(Ji)), e.addOption(new m("--use-published", "do not build or push; emit a descriptor pointing at the already-published release artifact").env(Yi)), e.addOption(new m("--log-level <level>", "logging level").choices([
2509
2513
  "error",
2510
2514
  "warn",
2511
2515
  "info",
2512
2516
  "debug"
2513
- ]).default("info")), e.addOption(new h("--package-root <path>", "path to directory with package.json file")), e.addOption(new h("--force", "force action, ignoring automatic safety checks").default(!1)), e.addOption(new h("--version <value>", "override package version (ignore package.json)")), e.addOption(new h("--platform <os-arch>", "{os}-{arch} pair; no effect on cross-platform packages").choices([...y.AllPlatforms]).env(v.PL_PKG_OS)), e.addOption(new h("--all-platforms", "build for all supported platforms").default(!1)), e.addOption(new h("--full-dir-hash", "hash file contents (not metadata) for the dev content hash").env(v.PL_PKG_FULL_HASH).default(!1)), e.addOption(new h("--package-id <id...>", "act only on selected packages")), e.addOption(new h("--content-root <path>", "override software content root").env(v.PL_PKG_CONTENT_ROOT)), e.addOption(new h("--storage-url <url>", "override binary upload registry URL").env(v.PL_PKG_STORAGE_URL)), e.addOption(new h("--docker-registry <registry>", "docker pull registry embedded in the descriptor").env(v.PL_DOCKER_REGISTRY)), e.addOption(new h("--docker-push-to <registry>", "alternative registry for docker push").env(v.PL_DOCKER_REGISTRY_PUSH_TO)), e.addOption(new h("--docker-build", "build docker images").env(v.PL_DOCKER_BUILD).default(!1)), e.addOption(new h("--docker-no-build", "do not build docker images").env(v.PL_DOCKER_NO_BUILD).default(!1)), e.addOption(new h("--docker-autopush", "push docker images after build").env(v.PL_DOCKER_AUTOPUSH).default(!1)), e.addOption(new h("--docker-no-autopush", "do not push docker images").env(v.PL_DOCKER_NO_AUTOPUSH).default(!1)), e.addOption(new h("--conda-build", "build conda environment before packing").env(v.PL_CONDA_BUILD).default(!1)), e.addOption(new h("--conda-no-build", "do not build conda environment").env(v.PL_CONDA_NO_BUILD).default(!1)), e.action(async (e) => {
2514
- let t = y.createLogger(e.logLevel);
2517
+ ]).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([...v.AllPlatforms]).env(_.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(_.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(_.PL_PKG_CONTENT_ROOT)), e.addOption(new m("--storage-url <url>", "override binary upload registry URL").env(_.PL_PKG_STORAGE_URL)), e.addOption(new m("--docker-registry <registry>", "docker pull registry embedded in the descriptor").env(_.PL_DOCKER_REGISTRY)), e.addOption(new m("--docker-push-to <registry>", "alternative registry for docker push").env(_.PL_DOCKER_REGISTRY_PUSH_TO)), e.addOption(new m("--docker-build", "build docker images").env(_.PL_DOCKER_BUILD).default(!1)), e.addOption(new m("--docker-no-build", "do not build docker images").env(_.PL_DOCKER_NO_BUILD).default(!1)), e.addOption(new m("--docker-autopush", "push docker images after build").env(_.PL_DOCKER_AUTOPUSH).default(!1)), e.addOption(new m("--docker-no-autopush", "do not push docker images").env(_.PL_DOCKER_NO_AUTOPUSH).default(!1)), e.addOption(new m("--conda-build", "build conda environment before packing").env(_.PL_CONDA_BUILD).default(!1)), e.addOption(new m("--conda-no-build", "do not build conda environment").env(_.PL_CONDA_NO_BUILD).default(!1)), e.action(async (e) => {
2518
+ let t = v.createLogger(e.logLevel);
2515
2519
  try {
2516
2520
  let n = Pi({
2517
2521
  channel: e.channel,
2518
2522
  variant: e.variant,
2519
2523
  location: e.location,
2520
2524
  usePublished: !!e.usePublished
2521
- }), r = oe(t, { packageRoot: e.packageRoot });
2525
+ }), r = se(t, { packageRoot: e.packageRoot });
2522
2526
  r.version = e.version, r.targetPlatform = e.platform, r.allPlatforms = !!e.allPlatforms, r.fullDirHash = !!e.fullDirHash;
2523
- let i = y.shouldDoAction({
2524
- default: v.isCI(),
2527
+ let i = v.shouldDoAction({
2528
+ default: _.isCI(),
2525
2529
  enable: e.dockerBuild,
2526
2530
  disable: e.dockerNoBuild
2527
- }), a = i && y.shouldDoAction({
2528
- default: v.isCI() && !r.isPrivate,
2531
+ }), a = i && v.shouldDoAction({
2532
+ default: _.isCI() && !r.isPrivate,
2529
2533
  enable: e.dockerAutopush,
2530
2534
  disable: e.dockerNoAutopush
2531
2535
  });
2532
- n.kind === "bare" && ae({
2536
+ n.kind === "bare" && oe({
2533
2537
  buildDocker: i,
2534
2538
  pushDocker: a,
2535
2539
  pushDisabledExplicitly: !!e.dockerNoAutopush,
@@ -2547,7 +2551,7 @@ function Xi() {
2547
2551
  dockerPushTo: e.dockerPushTo,
2548
2552
  buildDocker: i,
2549
2553
  pushDocker: a,
2550
- condaBuild: y.shouldDoAction({
2554
+ condaBuild: v.shouldDoAction({
2551
2555
  default: !0,
2552
2556
  enable: e.condaBuild,
2553
2557
  disable: e.condaNoBuild
@@ -2562,15 +2566,15 @@ function Xi() {
2562
2566
  //#endregion
2563
2567
  //#region src/cmd/software/index.ts
2564
2568
  function Zi() {
2565
- let e = new m("software").description("Build and publish a block's software modules");
2569
+ let e = new p("software").description("Build and publish a block's software modules");
2566
2570
  return e.addCommand(Xi()), e;
2567
2571
  }
2568
2572
  //#endregion
2569
2573
  //#region src/cli.ts
2570
2574
  function Qi(e = process.cwd()) {
2571
- let t = new m();
2572
- t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(be()), t.addCommand(Se()), t.addCommand(Ce()), t.addCommand(we()), t.addCommand(Ee()), t.addCommand(De()), t.addCommand(Oe()), t.addCommand(vi(e)), t.addCommand(yi()), t.addCommand(bi()), t.addCommand(wi()), t.addCommand(Zi());
2573
- let n = new m("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
2575
+ let t = new p();
2576
+ t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(xe()), t.addCommand(Ce()), t.addCommand(we()), t.addCommand(Te()), t.addCommand(De()), t.addCommand(Oe()), t.addCommand(ke()), t.addCommand(vi(e)), t.addCommand(yi()), t.addCommand(bi()), t.addCommand(wi()), t.addCommand(Zi());
2577
+ let n = new p("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
2574
2578
  return n.addCommand(Ti(e)), n.addCommand(Ai(e)), n.addCommand(_i(e)), t.addCommand(n), t;
2575
2579
  }
2576
2580
  async function $i(e, t) {