@platforma-sdk/block-tools 2.17.7 → 2.17.8

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