@platforma-sdk/block-tools 2.11.3 → 2.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cli.js +13 -13
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +634 -580
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/config-BmJWc8sR.js +3 -0
  6. package/dist/config-BmJWc8sR.js.map +1 -0
  7. package/dist/{config-DpfTzcgG.mjs → config-CiC347sB.mjs} +453 -398
  8. package/dist/config-CiC347sB.mjs.map +1 -0
  9. package/dist/index.js +1 -1
  10. package/dist/index.mjs +15 -15
  11. package/dist/structure/engine/discovery.d.ts +2 -3
  12. package/dist/structure/rules/block-package-json.d.ts +3 -3
  13. package/dist/structure/rules/shared/pascal-case.d.ts +1 -0
  14. package/dist/v2/index.d.ts +1 -0
  15. package/dist/v2/model/block_components.d.ts +11 -0
  16. package/dist/v2/model/block_meta.d.ts +7 -0
  17. package/dist/v2/registry/schema_public.d.ts +3600 -3600
  18. package/dist/v2/resolve_to_registry.d.ts +37 -0
  19. package/dist/v2/source_package.d.ts +12 -0
  20. package/package.json +8 -8
  21. package/src/cmd/publish.test.ts +35 -0
  22. package/src/cmd/publish.ts +20 -0
  23. package/src/structure/__tests__/discovery-shortname.test.ts +3 -0
  24. package/src/structure/__tests__/facade-end-state.test.ts +195 -0
  25. package/src/structure/__tests__/model-package-json.snapshot.test.ts +1 -1
  26. package/src/structure/engine/__tests__/discovery.test.ts +22 -26
  27. package/src/structure/engine/discovery.ts +12 -30
  28. package/src/structure/rules/block-package-json.ts +146 -64
  29. package/src/structure/rules/block.ts +40 -5
  30. package/src/structure/rules/model-package-json.ts +6 -1
  31. package/src/structure/rules/shared/pascal-case.ts +16 -0
  32. package/src/structure/rules/software-package-json.ts +6 -1
  33. package/src/structure/rules/test-package-json.ts +5 -1
  34. package/src/structure/rules/ui-package-json.ts +5 -1
  35. package/src/structure/rules/workflow-package-json.ts +5 -1
  36. package/src/structure/templates/static/block/src/AGENTS.ts +5 -0
  37. package/src/structure/templates/static/block/src/agents-extra.ts +8 -0
  38. package/src/structure/templates/static/block/src/block-extra.ts +9 -0
  39. package/src/structure/templates/static/block/tsconfig.json +4 -0
  40. package/src/structure/templates/text/block/src/index.tpl.ts +55 -0
  41. package/src/v2/from_pack_v2.test.ts +142 -0
  42. package/src/v2/index.ts +1 -0
  43. package/src/v2/model/block_components.ts +33 -0
  44. package/src/v2/model/block_meta.ts +18 -0
  45. package/src/v2/resolve_to_registry.ts +84 -0
  46. package/src/v2/source_package.ts +34 -1
  47. package/dist/config-DpfTzcgG.mjs.map +0 -1
  48. package/dist/config-xxVy3IQR.js +0 -3
  49. package/dist/config-xxVy3IQR.js.map +0 -1
  50. package/src/structure/templates/static/block/index.d.ts +0 -6
  51. package/src/structure/templates/static/block/index.js +0 -8
package/dist/cli.mjs CHANGED
@@ -1,52 +1,52 @@
1
- import { H as e, K as t, O as n, U as r, _ as i, _t as a, b as o, et as s, n as c, p as l, rt as ee } from "./config-DpfTzcgG.mjs";
2
- import { Command as u, Option as d } from "commander";
3
- import f from "node:path";
4
- import p from "node:fs";
1
+ import { H as e, O as t, Q as n, Tt as r, W as i, Y as a, _ as o, b as s, n as c, p as l, q as u, st as d, ut as ee } from "./config-CiC347sB.mjs";
2
+ import { Command as f, Option as p } from "commander";
3
+ import m from "node:path";
4
+ import h from "node:fs";
5
5
  import { BlockPackManifest as te, StableChannel as ne, overrideDescriptionVersion as re, overrideManifestVersion as ie } from "@milaboratories/pl-model-middle-layer";
6
- import { ConsoleLoggerAdapter as m } from "@milaboratories/ts-helpers";
6
+ import { ConsoleLoggerAdapter as g } from "@milaboratories/ts-helpers";
7
7
  import ae, { parse as oe, parseDocument as se, stringify as ce } from "yaml";
8
8
  import { setTimeout as le } from "node:timers/promises";
9
9
  import { confirm as ue, input as de, select as fe } from "@inquirer/prompts";
10
10
  //#region src/cmd/build-meta.ts
11
11
  function pe() {
12
- let e = new u("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.");
12
+ let e = new f("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.");
13
13
  return e.option("-i, --modulePath <path>", "input module path", "."), e.requiredOption("-o, --destination <path>", "output meta.json file"), e.action(async (e) => {
14
- let t = f.resolve(e.modulePath), n = await s(await ee((await r(t)).meta, t));
15
- await p.promises.writeFile(f.resolve(e.destination), JSON.stringify(n));
14
+ let t = m.resolve(e.modulePath), n = await d(await ee((await a(t)).meta, t));
15
+ await h.promises.writeFile(m.resolve(e.destination), JSON.stringify(n));
16
16
  }), e;
17
17
  }
18
18
  //#endregion
19
19
  //#region src/cmd/build-model.ts
20
20
  async function me(e) {
21
21
  try {
22
- return await p.promises.readFile(e, "utf8");
22
+ return await h.promises.readFile(e, "utf8");
23
23
  } catch (e) {
24
24
  if (e instanceof Error && "code" in e && e.code === "ENOENT") return;
25
25
  throw e;
26
26
  }
27
27
  }
28
28
  function he() {
29
- let e = new u("build-model").description("Extracts and outputs block model JSON from pre-built block model module");
29
+ let e = new f("build-model").description("Extracts and outputs block model JSON from pre-built block model module");
30
30
  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) => {
31
- let { model: t, platforma: n } = a(f.resolve(e.modulePath));
31
+ let { model: t, platforma: n } = r(m.resolve(e.modulePath));
32
32
  if (t ||= n, !t) throw Error("\"model\" export not found");
33
- let { config: r } = t;
34
- if (!r) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
35
- if (!("outputs" in r) || !("sections" in r)) throw Error("\"config\" has unexpected structure");
36
- let i = await me(e.sourceBundle);
37
- i !== void 0 && (r.code = {
33
+ let { config: i } = t;
34
+ if (!i) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
35
+ if (!("outputs" in i) || !("sections" in i)) throw Error("\"config\" has unexpected structure");
36
+ let a = await me(e.sourceBundle);
37
+ a !== void 0 && (i.code = {
38
38
  type: "plain",
39
- content: i
40
- }), await p.promises.writeFile(f.resolve(e.destination), JSON.stringify(r));
39
+ content: a
40
+ }), await h.promises.writeFile(m.resolve(e.destination), JSON.stringify(i));
41
41
  }), e;
42
42
  }
43
43
  //#endregion
44
44
  //#region src/cmd/pack.ts
45
45
  function ge() {
46
- let n = new u("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
47
- return n.option("-i, --modulePath <path>", "input module path", "."), n.option("-o, --destinationPath <path>", "output folder", "./block-pack"), n.action(async (n) => {
48
- await t(await e(f.resolve(n.modulePath)), f.resolve(n.destinationPath));
49
- }), n;
46
+ let e = new f("pack").description("Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder");
47
+ return e.option("-i, --modulePath <path>", "input module path", "."), e.option("-o, --destinationPath <path>", "output folder", "./block-pack"), e.action(async (e) => {
48
+ await n(await u(m.resolve(e.modulePath)), m.resolve(e.destinationPath));
49
+ }), e;
50
50
  }
51
51
  //#endregion
52
52
  //#region src/cmd/publish.ts
@@ -56,36 +56,39 @@ function _e(e, t) {
56
56
  return n;
57
57
  }
58
58
  function ve() {
59
- let e = new u("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
60
- return e.addOption(new d("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("-m, --manifest <path>", "manifest file path", `./block-pack/${n}`), e.option("-v, --version-override <path>", "override package version"), e.addOption(new d("--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 d("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), e.action(async (e) => {
61
- let t = new m(), n = f.resolve(e.manifest), r = JSON.parse(await p.promises.readFile(n, { encoding: "utf-8" })), a = te.parse(r);
62
- a = _e(r, a);
63
- let s = f.dirname(n);
64
- t.info(`Manifest root = ${s}`), e.versionOverride && (a = ie(a, e.versionOverride));
65
- let c = new o(i(e.registry), t);
66
- await c.publishPackage(a, async (e) => Buffer.from(await p.promises.readFile(f.resolve(s, e)))), e.unstable || (t.info(`Adding package to ${ne} channel...`), await c.addPackageToChannel(a.description.id, ne)), e.refresh && await c.updateIfNeeded();
67
- }), e;
59
+ let n = new f("publish").description("Publishes the block package and refreshes the registry (for v2 block-pack schema)");
60
+ return n.addOption(new p("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), n.addOption(new p("--registry-serve-url <url>", "CDN serve URL written into block-pack/published.json (npm-consumed blocks)").env("PL_REGISTRY_SERVE_URL").makeOptionMandatory()), n.option("-m, --manifest <path>", "manifest file path", `./block-pack/${t}`), n.option("-v, --version-override <path>", "override package version"), n.addOption(new p("--refresh", "refresh repository after adding the package").default(!0).env("PL_REGISTRY_REFRESH")), n.option("--no-refresh", "do not refresh repository after adding the package"), n.addOption(new p("--unstable", "do not add the published package to stable channel").default(!1).env("PL_PUBLISH_UNSTABLE")), n.action(async (t) => {
61
+ let n = new g(), r = m.resolve(t.manifest), a = JSON.parse(await h.promises.readFile(r, { encoding: "utf-8" })), c = te.parse(a);
62
+ c = _e(a, c);
63
+ let l = m.dirname(r);
64
+ n.info(`Manifest root = ${l}`), t.versionOverride && (c = ie(c, t.versionOverride));
65
+ let u = new s(o(t.registry), n);
66
+ await u.publishPackage(c, async (e) => Buffer.from(await h.promises.readFile(m.resolve(l, e)))), t.unstable || (n.info(`Adding package to ${ne} channel...`), await u.addPackageToChannel(c.description.id, ne)), await i(l, e({
67
+ registryUrl: t.registryServeUrl,
68
+ id: c.description.id
69
+ })), n.info(`Wrote published coordinates to ${m.resolve(l, "published.json")}`), t.refresh && await u.updateIfNeeded();
70
+ }), n;
68
71
  }
69
72
  //#endregion
70
73
  //#region src/cmd/refresh-registry.ts
71
74
  function ye() {
72
- let e = new u("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
73
- return e.addOption(new d("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new d("-m, --mode <mode>", "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")").choices([
75
+ let e = new f("refresh-registry").description("Refresh overview files based on published but not proecessed artefacts");
76
+ return e.addOption(new p("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new p("-m, --mode <mode>", "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")").choices([
74
77
  "force",
75
78
  "normal",
76
79
  "dry-run"
77
80
  ]).env("PL_REGISTRY_REFRESH_DRY_RUN").default("normal")), e.action(async (e) => {
78
- await new o(i(e.registry), new m()).updateIfNeeded(e.mode);
81
+ await new s(o(e.registry), new g()).updateIfNeeded(e.mode);
79
82
  }), e;
80
83
  }
81
84
  //#endregion
82
85
  //#region src/cmd/mark-stable.ts
83
86
  function be() {
84
- let e = new u("mark-stable").description("Mark target block stable");
85
- return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new d("-c, --channel <channel name>", "custom channel").default(ne).hideHelp()), e.option("-v, --version-override <path>", "override package version"), e.addOption(new d("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new d("--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) => {
86
- let t = await r(f.resolve(e.modulePath));
87
+ let e = new f("mark-stable").description("Mark target block stable");
88
+ return e.option("-i, --modulePath <path>", "input module path", "."), e.addOption(new p("-c, --channel <channel name>", "custom channel").default(ne).hideHelp()), e.option("-v, --version-override <path>", "override package version"), e.addOption(new p("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.addOption(new p("--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) => {
89
+ let t = await a(m.resolve(e.modulePath));
87
90
  e.versionOverride && (t = re(t, e.versionOverride));
88
- let n = new o(i(e.registry), new m());
91
+ let n = new s(o(e.registry), new g());
89
92
  e.unmark ? await n.removePackageFromChannel(t.id, e.channel) : await n.addPackageToChannel(t.id, e.channel), e.refresh && await n.updateIfNeeded();
90
93
  }), e;
91
94
  }
@@ -96,22 +99,22 @@ var xe = class {
96
99
  this.root = e;
97
100
  }
98
101
  abs(e) {
99
- return f.resolve(this.root, e);
102
+ return m.resolve(this.root, e);
100
103
  }
101
104
  read(e) {
102
- return p.readFileSync(this.abs(e), "utf-8");
105
+ return h.readFileSync(this.abs(e), "utf-8");
103
106
  }
104
107
  write(e, t) {
105
108
  let n = this.abs(e);
106
- p.mkdirSync(f.dirname(n), { recursive: !0 }), p.writeFileSync(n, t, "utf-8");
109
+ h.mkdirSync(m.dirname(n), { recursive: !0 }), h.writeFileSync(n, t, "utf-8");
107
110
  }
108
111
  writeBinary(e, t) {
109
112
  let n = this.abs(e);
110
- p.mkdirSync(f.dirname(n), { recursive: !0 }), p.writeFileSync(n, t);
113
+ h.mkdirSync(m.dirname(n), { recursive: !0 }), h.writeFileSync(n, t);
111
114
  }
112
115
  exists(e) {
113
116
  try {
114
- return p.statSync(this.abs(e)), !0;
117
+ return h.statSync(this.abs(e)), !0;
115
118
  } catch {
116
119
  return !1;
117
120
  }
@@ -119,15 +122,15 @@ var xe = class {
119
122
  list(e) {
120
123
  let t = this.abs(e);
121
124
  try {
122
- if (!p.statSync(t).isDirectory()) return [];
125
+ if (!h.statSync(t).isDirectory()) return [];
123
126
  } catch {
124
127
  return [];
125
128
  }
126
129
  let n = [];
127
130
  function r(e, t) {
128
- let i = p.readdirSync(t, { withFileTypes: !0 });
131
+ let i = h.readdirSync(t, { withFileTypes: !0 });
129
132
  for (let a of i) {
130
- let i = e ? `${e}/${a.name}` : a.name, o = f.join(t, a.name);
133
+ let i = e ? `${e}/${a.name}` : a.name, o = m.join(t, a.name);
131
134
  a.isDirectory() ? r(i, o) : a.isFile() && n.push(i);
132
135
  }
133
136
  }
@@ -136,7 +139,7 @@ var xe = class {
136
139
  listDir(e) {
137
140
  let t = this.abs(e), n;
138
141
  try {
139
- n = p.readdirSync(t, { withFileTypes: !0 });
142
+ n = h.readdirSync(t, { withFileTypes: !0 });
140
143
  } catch {
141
144
  return [];
142
145
  }
@@ -147,10 +150,10 @@ var xe = class {
147
150
  }
148
151
  move(e, t) {
149
152
  let n = this.abs(e), r = this.abs(t);
150
- p.mkdirSync(f.dirname(r), { recursive: !0 }), p.renameSync(n, r);
153
+ h.mkdirSync(m.dirname(r), { recursive: !0 }), h.renameSync(n, r);
151
154
  }
152
155
  delete(e) {
153
- p.rmSync(this.abs(e), {
156
+ h.rmSync(this.abs(e), {
154
157
  recursive: !0,
155
158
  force: !0
156
159
  });
@@ -160,13 +163,13 @@ var xe = class {
160
163
  this.root = e;
161
164
  }
162
165
  staticRead(e) {
163
- return p.readFileSync(f.resolve(this.root, "static", e), "utf-8");
166
+ return h.readFileSync(m.resolve(this.root, "static", e), "utf-8");
164
167
  }
165
168
  staticReadBinary(e) {
166
- return p.readFileSync(f.resolve(this.root, "static", e));
169
+ return h.readFileSync(m.resolve(this.root, "static", e));
167
170
  }
168
171
  textRead(e) {
169
- return p.readFileSync(f.resolve(this.root, "text", e), "utf-8");
172
+ return h.readFileSync(m.resolve(this.root, "text", e), "utf-8");
170
173
  }
171
174
  };
172
175
  function Ce(e, t) {
@@ -255,41 +258,41 @@ function Me(e, t) {
255
258
  }
256
259
  //#endregion
257
260
  //#region src/structure/engine/builders.ts
258
- var h, g;
261
+ var _, v;
259
262
  function Ne(e) {
260
- if (!h) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
261
- return h;
263
+ if (!_) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
264
+ return _;
262
265
  }
263
- function _(e, t) {
266
+ function y(e, t) {
264
267
  let n = Ne(e);
265
268
  n.stack[n.stack.length - 1].push(t);
266
269
  }
267
270
  function Pe(e, t) {
268
- let n = g;
269
- g = e;
271
+ let n = v;
272
+ v = e;
270
273
  try {
271
274
  return t();
272
275
  } finally {
273
- g = n;
276
+ v = n;
274
277
  }
275
278
  }
276
279
  function Fe() {
277
- return g;
280
+ return v;
278
281
  }
279
282
  function Ie(e) {
280
- if (h) throw Error("defineStructure() cannot be called from inside another defineStructure().");
283
+ if (_) throw Error("defineStructure() cannot be called from inside another defineStructure().");
281
284
  let t = [], n = {
282
285
  root: t,
283
286
  stack: [t],
284
287
  inScope: !1
285
288
  };
286
- h = n;
289
+ _ = n;
287
290
  try {
288
291
  if (e(), n.stack.length !== 1) throw Error(`defineStructure: builder body left ${n.stack.length - 1} unclosed group frame(s)`);
289
292
  let r = { children: t };
290
293
  return Le(r), r;
291
294
  } finally {
292
- h = void 0;
295
+ _ = void 0;
293
296
  }
294
297
  }
295
298
  function Le(e) {
@@ -315,7 +318,7 @@ function Le(e) {
315
318
  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.`);
316
319
  }
317
320
  }
318
- function v(e, t) {
321
+ function b(e, t) {
319
322
  let n = Ne("scope");
320
323
  if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
321
324
  let r = {
@@ -334,18 +337,18 @@ var Re;
334
337
  function ze(e) {
335
338
  Re = e;
336
339
  }
337
- function y(e, t, n) {
340
+ function x(e, t, n) {
338
341
  Be(e, t), n && Be((t) => !e(t), n);
339
342
  }
340
343
  function Be(e, t) {
341
- if (h) {
344
+ if (_) {
342
345
  Ve(e, t);
343
346
  return;
344
347
  }
345
348
  if (!(Re?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
346
349
  }
347
350
  function Ve(e, t) {
348
- let n = h, r = {
351
+ let n = _, r = {
349
352
  kind: "when",
350
353
  trigger: e,
351
354
  children: []
@@ -357,7 +360,7 @@ function Ve(e, t) {
357
360
  n.stack.pop();
358
361
  }
359
362
  }
360
- function b(e) {
363
+ function S(e) {
361
364
  return (t) => t.filesMatch(e);
362
365
  }
363
366
  function He(e, t, n) {
@@ -376,67 +379,67 @@ function He(e, t, n) {
376
379
  function Ue(e) {
377
380
  He("onInitOrUpdate", ["init", "updateDeps"], e);
378
381
  }
379
- function x(e, t) {
380
- _("fixed", {
382
+ function C(e, t) {
383
+ y("fixed", {
381
384
  kind: "fixed",
382
385
  path: e,
383
386
  content: t
384
387
  });
385
388
  }
386
- function S(e, t, n) {
387
- _("managed", {
389
+ function w(e, t, n) {
390
+ y("managed", {
388
391
  kind: "managed",
389
392
  path: e,
390
393
  initial: t,
391
394
  body: n
392
395
  });
393
396
  }
394
- function We(e, t) {
395
- _("scaffold", {
397
+ function T(e, t) {
398
+ y("scaffold", {
396
399
  kind: "scaffold",
397
400
  path: e,
398
401
  initial: t
399
402
  });
400
403
  }
401
- function C(e, t) {
402
- _("seed", {
404
+ function E(e, t) {
405
+ y("seed", {
403
406
  kind: "seed",
404
407
  path: e,
405
408
  initial: t
406
409
  });
407
410
  }
408
- function w(e) {
409
- _("remove", {
411
+ function D(e) {
412
+ y("remove", {
410
413
  kind: "remove",
411
414
  path: e
412
415
  });
413
416
  }
414
- function T(e) {
417
+ function O(e) {
415
418
  return {
416
419
  kind: "file",
417
420
  path: e
418
421
  };
419
422
  }
420
- function Ge(e) {
423
+ function We(e) {
421
424
  return {
422
425
  kind: "binary",
423
426
  path: e
424
427
  };
425
428
  }
426
- function Ke(e) {
429
+ function Ge(e) {
427
430
  return {
428
431
  kind: "text",
429
432
  value: e
430
433
  };
431
434
  }
432
- function E(e, t) {
435
+ function k(e, t) {
433
436
  return {
434
437
  kind: "tpl",
435
438
  path: e,
436
439
  vars: t
437
440
  };
438
441
  }
439
- function D(e) {
442
+ function A(e) {
440
443
  return {
441
444
  kind: "generate",
442
445
  fn: e
@@ -444,69 +447,69 @@ function D(e) {
444
447
  }
445
448
  //#endregion
446
449
  //#region src/structure/engine/parsers/json.ts
447
- function qe(e) {
450
+ function Ke(e) {
448
451
  return JSON.parse(e);
449
452
  }
450
- var Je = 100, Ye = 2;
451
- function Xe(e) {
452
- return e.length === 0 ? "[]" : "[" + e.map(Ze).join(", ") + "]";
453
+ var qe = 100, Je = 2;
454
+ function Ye(e) {
455
+ return e.length === 0 ? "[]" : "[" + e.map(Xe).join(", ") + "]";
453
456
  }
454
- function Ze(e) {
455
- if (Array.isArray(e)) return Xe(e);
456
- if (k(e)) {
457
+ function Xe(e) {
458
+ if (Array.isArray(e)) return Ye(e);
459
+ if (M(e)) {
457
460
  let t = Object.entries(e);
458
- return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${Ze(t)}`).join(", ") + " }";
461
+ return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${Xe(t)}`).join(", ") + " }";
459
462
  }
460
463
  return JSON.stringify(e);
461
464
  }
462
- function Qe(e, t, n, r) {
463
- let i = t + Ye, a = " ".repeat(i);
465
+ function Ze(e, t, n, r) {
466
+ let i = t + Je, a = " ".repeat(i);
464
467
  if (Array.isArray(e)) {
465
- let o = Xe(e);
466
- if (n + o.length + r <= Je) return o;
468
+ let o = Ye(e);
469
+ if (n + o.length + r <= qe) return o;
467
470
  let s = e.length - 1;
468
- return "[\n" + e.map((e, t) => a + Qe(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
471
+ return "[\n" + e.map((e, t) => a + Ze(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
469
472
  }
470
- if (k(e)) {
473
+ if (M(e)) {
471
474
  let n = Object.entries(e);
472
475
  if (n.length === 0) return "{}";
473
476
  let r = n.length - 1;
474
477
  return "{\n" + n.map(([e, t], n) => {
475
478
  let o = `${a}${JSON.stringify(e)}: `;
476
- return o + Qe(t, i, o.length, n === r ? 0 : 1);
479
+ return o + Ze(t, i, o.length, n === r ? 0 : 1);
477
480
  }).join(",\n") + "\n" + " ".repeat(t) + "}";
478
481
  }
479
482
  return JSON.stringify(e);
480
483
  }
481
- function $e(e, t) {
482
- return t?.collapse ? Qe(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
484
+ function Qe(e, t) {
485
+ return t?.collapse ? Ze(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
483
486
  }
484
- function O(e) {
487
+ function j(e) {
485
488
  return e === "" || e === void 0 ? [] : e.split(".");
486
489
  }
487
- function k(e) {
490
+ function M(e) {
488
491
  return typeof e == "object" && !!e && !Array.isArray(e);
489
492
  }
490
- function et(e, t) {
491
- let n = O(t), r = e;
493
+ function $e(e, t) {
494
+ let n = j(t), r = e;
492
495
  for (let e of n) {
493
- if (!k(r)) return;
496
+ if (!M(r)) return;
494
497
  r = r[e];
495
498
  }
496
499
  return r;
497
500
  }
498
- function tt(e, t) {
499
- let n = O(t);
501
+ function et(e, t) {
502
+ let n = j(t);
500
503
  if (n.length === 0) return !0;
501
504
  let r = e;
502
505
  for (let e = 0; e < n.length - 1; e++) {
503
- if (!k(r)) return !1;
506
+ if (!M(r)) return !1;
504
507
  r = r[n[e]];
505
508
  }
506
- return k(r) ? n[n.length - 1] in r : !1;
509
+ return M(r) ? n[n.length - 1] in r : !1;
507
510
  }
508
- function nt(e, t, n) {
509
- let r = O(t);
511
+ function tt(e, t, n) {
512
+ let r = j(t);
510
513
  if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
511
514
  let i = e;
512
515
  for (let e = 0; e < r.length - 1; e++) {
@@ -514,22 +517,22 @@ function nt(e, t, n) {
514
517
  if (n === void 0) {
515
518
  let e = {};
516
519
  i[t] = e, i = e;
517
- } else if (k(n)) i = n;
520
+ } else if (M(n)) i = n;
518
521
  else throw Error(`setAtPath: cannot descend into non-object at '${r.slice(0, e + 1).join(".")}'`);
519
522
  }
520
523
  i[r[r.length - 1]] = n;
521
524
  }
522
- function rt(e, t) {
523
- let n = O(t);
525
+ function nt(e, t) {
526
+ let n = j(t);
524
527
  if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
525
528
  let r = e;
526
529
  for (let e = 0; e < n.length - 1; e++) {
527
- if (!k(r)) return;
530
+ if (!M(r)) return;
528
531
  r = r[n[e]];
529
532
  }
530
- k(r) && delete r[n[n.length - 1]];
533
+ M(r) && delete r[n[n.length - 1]];
531
534
  }
532
- function it(e, t) {
535
+ function rt(e, t) {
533
536
  let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
534
537
  i.set("", []);
535
538
  let a = "";
@@ -544,72 +547,72 @@ function it(e, t) {
544
547
  }
545
548
  //#endregion
546
549
  //#region src/structure/engine/parsers/lines.ts
547
- function at(e) {
550
+ function it(e) {
548
551
  let t = e.split("\n");
549
552
  return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
550
553
  }
551
- function ot(e) {
554
+ function at(e) {
552
555
  return e.join("\n") + "\n";
553
556
  }
554
- function st(e) {
557
+ function ot(e) {
555
558
  return e.replace(/(^|\s)#.*$/, "$1").trim();
556
559
  }
557
- function ct(e, t) {
558
- let n = st(e);
560
+ function st(e, t) {
561
+ let n = ot(e);
559
562
  return n === "" ? !1 : n === t.trim();
560
563
  }
561
- function lt(e, t) {
562
- for (let n of e) if (ct(n, t)) return !0;
564
+ function ct(e, t) {
565
+ for (let n of e) if (st(n, t)) return !0;
563
566
  return !1;
564
567
  }
565
568
  //#endregion
566
569
  //#region src/structure/engine/content-rules.ts
567
- function ut(e, t) {
570
+ function lt(e, t) {
568
571
  return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
569
572
  }
570
- var dt = [
573
+ var ut = [
571
574
  "dependencies",
572
575
  "devDependencies",
573
576
  "peerDependencies",
574
577
  "optionalDependencies"
575
578
  ];
576
- function ft(e, t) {
577
- if (N(e)) for (let n of dt) {
579
+ function dt(e, t) {
580
+ if (I(e)) for (let n of ut) {
578
581
  let r = e[n];
579
- if (N(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
582
+ if (I(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
580
583
  }
581
584
  }
582
- var A;
583
- function pt(e) {
584
- if (!A) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
585
- return A;
585
+ var N;
586
+ function ft(e) {
587
+ if (!N) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
588
+ return N;
586
589
  }
587
- function j(e) {
588
- let t = pt(e);
590
+ function P(e) {
591
+ let t = ft(e);
589
592
  if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
590
593
  return t;
591
594
  }
592
- function M(e) {
593
- let t = pt(e);
595
+ function F(e) {
596
+ let t = ft(e);
594
597
  if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
595
598
  return t;
596
599
  }
597
- function mt(e) {
598
- let t = pt(e);
600
+ function pt(e) {
601
+ let t = ft(e);
599
602
  if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
600
603
  return t;
601
604
  }
602
- function ht(e, t) {
605
+ function mt(e, t) {
603
606
  let n = e.ctx ?? Fe();
604
607
  if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
605
608
  return n;
606
609
  }
607
- function N(e) {
610
+ function I(e) {
608
611
  return typeof e == "object" && !!e && !Array.isArray(e);
609
612
  }
610
- function gt(e, t, n = {}) {
611
- if (A) throw Error("Nested managed(...) body — engine bug.");
612
- A = {
613
+ function ht(e, t, n = {}) {
614
+ if (N) throw Error("Nested managed(...) body — engine bug.");
615
+ N = {
613
616
  kind: "json",
614
617
  obj: e,
615
618
  ctx: n.ctx,
@@ -618,12 +621,12 @@ function gt(e, t, n = {}) {
618
621
  try {
619
622
  return t(n.ctx ?? n.triggerContext?.ctx), e;
620
623
  } finally {
621
- A = void 0;
624
+ N = void 0;
622
625
  }
623
626
  }
624
- function _t(e, t, n = {}) {
625
- if (A) throw Error("Nested managed(...) body — engine bug.");
626
- A = {
627
+ function gt(e, t, n = {}) {
628
+ if (N) throw Error("Nested managed(...) body — engine bug.");
629
+ N = {
627
630
  kind: "yaml",
628
631
  doc: e,
629
632
  ctx: n.ctx,
@@ -634,12 +637,12 @@ function _t(e, t, n = {}) {
634
637
  try {
635
638
  return t(n.ctx ?? n.triggerContext?.ctx), e;
636
639
  } finally {
637
- A = void 0;
640
+ N = void 0;
638
641
  }
639
642
  }
640
- function vt(e, t, n = {}) {
641
- if (A) throw Error("Nested managed(...) body — engine bug.");
642
- A = {
643
+ function _t(e, t, n = {}) {
644
+ if (N) throw Error("Nested managed(...) body — engine bug.");
645
+ N = {
643
646
  kind: "lines",
644
647
  lines: e,
645
648
  ctx: n.ctx,
@@ -648,27 +651,31 @@ function vt(e, t, n = {}) {
648
651
  try {
649
652
  return t(n.ctx ?? n.triggerContext?.ctx), e;
650
653
  } finally {
651
- A = void 0;
654
+ N = void 0;
652
655
  }
653
656
  }
654
657
  ze((e, t) => {
655
- if (!A) return !1;
656
- let n = A.triggerContext;
658
+ if (!N) return !1;
659
+ let n = N.triggerContext;
657
660
  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.");
658
661
  return e(n) && t(), !0;
659
662
  });
660
- function P(e, t) {
661
- nt(j("ensureField").obj, e, t);
663
+ function L(e, t) {
664
+ tt(P("ensureField").obj, e, t);
665
+ }
666
+ function vt(e, t) {
667
+ let n = P("removeField").obj;
668
+ et(n, e) && (t && !t($e(n, e)) || nt(n, e));
662
669
  }
663
670
  function yt(e, t) {
664
- let n = j("removeField").obj;
665
- tt(n, e) && (t && !t(et(n, e)) || rt(n, e));
671
+ let n = P("requireField").obj;
672
+ if (!et(n, e)) throw Error(t ?? `requireField: missing field '${e}'`);
666
673
  }
667
- function F(e, t) {
668
- P(`scripts.${e}`, t);
674
+ function R(e, t) {
675
+ L(`scripts.${e}`, t);
669
676
  }
670
- function I(e) {
671
- yt(`scripts.${e}`);
677
+ function z(e) {
678
+ vt(`scripts.${e}`);
672
679
  }
673
680
  var bt = [
674
681
  "dependencies",
@@ -676,135 +683,138 @@ var bt = [
676
683
  "peerDependencies",
677
684
  "optionalDependencies"
678
685
  ];
679
- function L(e, t, n, r) {
680
- let i = j(e), a = i.obj, o = n === "sdk:" ? ut(n, ht(i, e).isSdkInternal) : n;
686
+ function B(e, t, n, r) {
687
+ let i = P(e), a = i.obj, o = n === "sdk:" ? lt(n, mt(i, e).isSdkInternal) : n;
681
688
  for (let e of bt) {
682
689
  if (e === r) continue;
683
690
  let n = a[e];
684
- N(n) && t in n && delete n[t];
691
+ I(n) && t in n && delete n[t];
685
692
  }
686
- let s = a[r], c = N(s) ? s : {};
687
- c[t] = o, N(s) || (a[r] = c);
693
+ let s = a[r], c = I(s) ? s : {};
694
+ c[t] = o, I(s) || (a[r] = c);
688
695
  }
689
- function R(e, t) {
690
- L("ensureDep", e, t, "dependencies");
696
+ function V(e, t) {
697
+ B("ensureDep", e, t, "dependencies");
691
698
  }
692
- function z(e, t) {
693
- L("ensureDevDep", e, t, "devDependencies");
699
+ function H(e, t) {
700
+ B("ensureDevDep", e, t, "devDependencies");
694
701
  }
695
702
  function xt(e, t) {
696
- L("ensurePeerDep", e, t, "peerDependencies");
703
+ B("ensurePeerDep", e, t, "peerDependencies");
697
704
  }
698
- function B(e) {
699
- let t = j("removeDep").obj;
705
+ function U(e) {
706
+ let t = P("removeDep").obj;
700
707
  for (let n of bt) {
701
708
  let r = t[n];
702
- N(r) && e in r && delete r[e];
709
+ I(r) && e in r && delete r[e];
703
710
  }
704
711
  }
705
- function V(e) {
706
- for (let [t, n] of Object.entries(e)) z(t, n);
712
+ function W(e) {
713
+ for (let [t, n] of Object.entries(e)) H(t, n);
707
714
  }
708
- function H(e) {
715
+ function G(e) {
709
716
  for (let [t, n] of Object.entries(e)) xt(t, n);
710
717
  }
711
718
  function St(e, t, n) {
712
- let r = ht(j(e), e);
713
- for (let i of r.modules) i.scope === t && L(e, i.name, "workspace:*", n);
719
+ let r = mt(P(e), e);
720
+ for (let i of r.modules) i.scope === t && B(e, i.name, "workspace:*", n);
714
721
  }
715
- function U(e) {
722
+ function Ct(e) {
716
723
  St("ensureWorkspaceScopeDeps", e, "dependencies");
717
724
  }
718
- function Ct(e) {
719
- let t = j("pruneKeysMatching").obj;
725
+ function wt(e) {
726
+ St("ensureWorkspaceScopeDevDeps", e, "devDependencies");
727
+ }
728
+ function Tt(e) {
729
+ let t = P("pruneKeysMatching").obj;
720
730
  for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
721
731
  }
722
- function wt(e, t) {
723
- let n = it(e, t);
732
+ function Et(e, t) {
733
+ let n = rt(e, t);
724
734
  for (let t of Object.keys(e)) delete e[t];
725
735
  for (let t of Object.keys(n)) e[t] = n[t];
726
736
  }
727
- function W(e) {
728
- wt(j("enforceFieldOrder").obj, e);
737
+ function K(e) {
738
+ Et(P("enforceFieldOrder").obj, e);
729
739
  }
730
- function Tt(e, t) {
740
+ function Dt(e, t) {
731
741
  let n = Object.keys(e).sort(), r = {};
732
742
  for (let t of n) r[t] = e[t];
733
743
  for (let t of Object.keys(e)) delete e[t];
734
- for (let i of n) e[i] = r[i], t && N(e[i]) && Tt(e[i], !0);
744
+ for (let i of n) e[i] = r[i], t && I(e[i]) && Dt(e[i], !0);
735
745
  }
736
- function G(e = "", t = {}) {
746
+ function q(e = "", t = {}) {
737
747
  let n = t.recursive ?? !1;
738
748
  if (e === "" && !n) return;
739
- let r = j("enforceAlphabeticalOrder").obj;
749
+ let r = P("enforceAlphabeticalOrder").obj;
740
750
  if (e === "") {
741
- Tt(r, !0);
751
+ Dt(r, !0);
742
752
  return;
743
753
  }
744
- let i = et(r, e);
745
- N(i) && Tt(i, n);
754
+ let i = $e(r, e);
755
+ I(i) && Dt(i, n);
746
756
  }
747
- function Et() {
748
- let e = M("ensureWorkspaceModulePaths"), t = ht(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
757
+ function Ot() {
758
+ let e = F("ensureWorkspaceModulePaths"), t = mt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
749
759
  Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
750
760
  }
751
- function Dt(e, t) {
761
+ function kt(e, t) {
752
762
  let n = e.doc.getIn(["catalog", t]);
753
763
  return typeof n == "string" ? n : void 0;
754
764
  }
755
- function Ot(e, t) {
756
- let n = M("ensureCatalogVersion");
757
- Dt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
765
+ function At(e, t) {
766
+ let n = F("ensureCatalogVersion");
767
+ kt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
758
768
  }
759
- function kt(e) {
760
- let t = M("ensureCatalogLatest");
769
+ function jt(e) {
770
+ let t = F("ensureCatalogLatest");
761
771
  if (!t.getLatestVersion) return;
762
772
  let n = t.getLatestVersion(e);
763
- n !== void 0 && Dt(t, e) !== n && t.doc.setIn(["catalog", e], n);
773
+ n !== void 0 && kt(t, e) !== n && t.doc.setIn(["catalog", e], n);
764
774
  }
765
- function At(e, t) {
766
- let n = M("pinCatalogToDependencyOf");
775
+ function Mt(e, t) {
776
+ let n = F("pinCatalogToDependencyOf");
767
777
  if (!n.getDerivedDependencyPin) return;
768
778
  let r = n.getDerivedDependencyPin(e);
769
- r !== void 0 && Dt(n, e) !== r && n.doc.setIn(["catalog", e], r);
779
+ r !== void 0 && kt(n, e) !== r && n.doc.setIn(["catalog", e], r);
770
780
  }
771
- function jt(e) {
772
- let t = M("ensureCatalogAbsent");
781
+ function Nt(e) {
782
+ let t = F("ensureCatalogAbsent");
773
783
  t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
774
784
  }
775
- function Mt(e) {
776
- let t = mt("ensureGitignoreEntries");
777
- for (let n of e) lt(t.lines, n) || t.lines.push(n);
785
+ function Pt(e) {
786
+ let t = pt("ensureGitignoreEntries");
787
+ for (let n of e) ct(t.lines, n) || t.lines.push(n);
778
788
  }
779
789
  //#endregion
780
790
  //#region src/structure/engine/parsers/yaml.ts
781
- function Nt(e) {
791
+ function Ft(e) {
782
792
  return se(e);
783
793
  }
784
- function Pt(e) {
794
+ function It(e) {
785
795
  return e.toString();
786
796
  }
787
- var Ft = ".structure";
788
- function It(e, t = 0) {
789
- if (e < t) throw new Lt(e, t);
797
+ var Lt = ".structure";
798
+ function Rt(e, t = 0) {
799
+ if (e < t) throw new zt(e, t);
790
800
  }
791
- var Lt = class extends Error {
801
+ var zt = class extends Error {
792
802
  constructor(e, t) {
793
803
  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";
794
804
  }
795
805
  };
796
- function Rt(e, t = 1) {
806
+ function Bt(e, t = 1) {
797
807
  let n = { version: t };
798
- e.write(Ft, JSON.stringify(n));
808
+ e.write(Lt, JSON.stringify(n));
799
809
  }
800
810
  //#endregion
801
811
  //#region src/structure/engine/runner.ts
802
- var zt = class extends Error {
812
+ var Vt = class extends Error {
803
813
  constructor(e) {
804
814
  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";
805
815
  }
806
816
  };
807
- function Bt(e, t, n, r) {
817
+ function Ht(e, t, n, r) {
808
818
  switch (e.kind) {
809
819
  case "text": return e.value;
810
820
  case "file":
@@ -815,7 +825,7 @@ function Bt(e, t, n, r) {
815
825
  return Ce(n.textRead(e.path), typeof e.vars == "function" ? e.vars(r) : e.vars);
816
826
  case "generate": {
817
827
  let n = e.fn(r);
818
- if (t.endsWith(".json")) return ft(n, r.isSdkInternal), $e(n, { collapse: !t.endsWith("package.json") });
828
+ if (t.endsWith(".json")) return dt(n, r.isSdkInternal), Qe(n, { collapse: !t.endsWith("package.json") });
819
829
  if (t.endsWith(".yaml") || t.endsWith(".yml")) return ce(n);
820
830
  if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
821
831
  return n;
@@ -823,36 +833,36 @@ function Bt(e, t, n, r) {
823
833
  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.`);
824
834
  }
825
835
  }
826
- function Vt(e, t, n, r, i) {
836
+ function Ut(e, t, n, r, i) {
827
837
  if (n.kind === "binary") {
828
838
  if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
829
839
  e.writeBinary(t, r.staticReadBinary(n.path));
830
840
  return;
831
841
  }
832
- e.write(t, Bt(n, t, r, i));
842
+ e.write(t, Ht(n, t, r, i));
833
843
  }
834
- function Ht(e, t, n, r, i, a) {
844
+ function Wt(e, t, n, r, i, a) {
835
845
  let o = e.split("/").pop() ?? e;
836
846
  if (e.endsWith(".json")) {
837
- let i = qe(t);
847
+ let i = Ke(t);
838
848
  if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
839
- return gt(i, n, { triggerContext: r }), $e(i, { collapse: o !== "package.json" });
849
+ return ht(i, n, { triggerContext: r }), Qe(i, { collapse: o !== "package.json" });
840
850
  }
841
851
  if (e.endsWith(".yaml") || e.endsWith(".yml")) {
842
- let e = Nt(t);
843
- return _t(e, n, {
852
+ let e = Ft(t);
853
+ return gt(e, n, {
844
854
  triggerContext: r,
845
855
  getLatestVersion: i,
846
856
  getDerivedDependencyPin: a
847
- }), Pt(e);
857
+ }), It(e);
848
858
  }
849
859
  if (o === ".gitignore" || o.endsWith(".gitignore")) {
850
- let e = at(t);
851
- return vt(e, n, { triggerContext: r }), ot(e);
860
+ let e = it(t);
861
+ return _t(e, n, { triggerContext: r }), at(e);
852
862
  }
853
863
  throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
854
864
  }
855
- function Ut(e) {
865
+ function Gt(e) {
856
866
  let t = e.list(""), n = /* @__PURE__ */ new Set();
857
867
  for (let e of t) {
858
868
  n.add(e);
@@ -861,16 +871,16 @@ function Ut(e) {
861
871
  }
862
872
  return n;
863
873
  }
864
- function Wt(e, t) {
874
+ function Kt(e, t) {
865
875
  let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
866
876
  return e.has(n);
867
877
  }
868
- function Gt(e, t, n) {
878
+ function qt(e, t, n) {
869
879
  return {
870
880
  ctx: t,
871
881
  version: t.version,
872
- pathExists: (t) => Wt(e, t),
873
- pathMissing: (t) => !Wt(e, t),
882
+ pathExists: (t) => Kt(e, t),
883
+ pathMissing: (t) => !Kt(e, t),
874
884
  filesMatch: (t) => {
875
885
  let r = n ? `${n}/${t}` : t;
876
886
  for (let t of e) if (Me(r, t)) return !0;
@@ -878,20 +888,20 @@ function Gt(e, t, n) {
878
888
  }
879
889
  };
880
890
  }
881
- function Kt(e, t) {
891
+ function Jt(e, t) {
882
892
  for (let n of e.triggers) if (!n(t)) return !1;
883
893
  return !0;
884
894
  }
885
- function qt(e, t) {
895
+ function Yt(e, t) {
886
896
  return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
887
897
  }
888
- function Jt(e, t) {
898
+ function Xt(e, t) {
889
899
  return e.filter((e) => e.modes.includes(t));
890
900
  }
891
- function Yt(e, t, n, r, i, a) {
901
+ function Zt(e, t, n, r, i, a) {
892
902
  let o = e.leaf;
893
903
  if (o.kind === "fixed") {
894
- let i = Bt(o.content, e.resolvedPath, r, a);
904
+ let i = Ht(o.content, e.resolvedPath, r, a);
895
905
  return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
896
906
  scope: e.scope,
897
907
  path: e.resolvedPath,
@@ -904,13 +914,13 @@ function Yt(e, t, n, r, i, a) {
904
914
  action: "create"
905
915
  });
906
916
  }
907
- if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Vt(t, e.resolvedPath, o.initial, r, a), {
917
+ if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Ut(t, e.resolvedPath, o.initial, r, a), {
908
918
  scope: e.scope,
909
919
  path: e.resolvedPath,
910
920
  primitive: "scaffold",
911
921
  action: "create"
912
922
  });
913
- if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Vt(t, e.resolvedPath, o.initial, r, a), {
923
+ if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Ut(t, e.resolvedPath, o.initial, r, a), {
914
924
  scope: e.scope,
915
925
  path: e.resolvedPath,
916
926
  primitive: "seed",
@@ -933,58 +943,58 @@ function Yt(e, t, n, r, i, a) {
933
943
  });
934
944
  }
935
945
  }
936
- function Xt(e, t, n, r, i, a, o, s) {
946
+ function Qt(e, t, n, r, i, a, o, s) {
937
947
  if (e.leaf.kind !== "managed") return;
938
- let c = e.leaf, l = e.resolvedPath, ee = t.exists(l), u, d = !1;
939
- ee ? u = t.read(l) : (u = Bt(c.initial, l, i, s), d = !0);
940
- let f = Ht(l, u, c.body, r, a, o);
941
- if (d) return n || t.write(l, f), {
948
+ let c = e.leaf, l = e.resolvedPath, u = t.exists(l), d, ee = !1;
949
+ u ? d = t.read(l) : (d = Ht(c.initial, l, i, s), ee = !0);
950
+ let f = Wt(l, d, c.body, r, a, o);
951
+ if (ee) return n || t.write(l, f), {
942
952
  scope: e.scope,
943
953
  path: l,
944
954
  primitive: "managed",
945
955
  action: "create"
946
956
  };
947
- if (f !== u) return n || t.write(l, f), {
957
+ if (f !== d) return n || t.write(l, f), {
948
958
  scope: e.scope,
949
959
  path: l,
950
960
  primitive: "managed",
951
961
  action: "update"
952
962
  };
953
963
  }
954
- function Zt(e, t, n, r, i, a, o, s) {
955
- let c = Jt(e, qt(n, a)), l = [], ee = Ut(t);
964
+ function $t(e, t, n, r, i, a, o, s) {
965
+ let c = Xt(e, Yt(n, a)), l = [], u = Gt(t);
956
966
  for (let e of c) {
957
- if (e.leaf.kind === "managed" || !Kt(e, Gt(ee, n, e.modulePath))) continue;
958
- let o = Yt(e, t, r, i, a, n);
967
+ if (e.leaf.kind === "managed" || !Jt(e, qt(u, n, e.modulePath))) continue;
968
+ let o = Zt(e, t, r, i, a, n);
959
969
  o && l.push(o);
960
970
  }
961
- let u = Ut(t);
971
+ let d = Gt(t);
962
972
  for (let e of c) {
963
973
  if (e.leaf.kind !== "managed") continue;
964
- let a = Gt(u, n, e.modulePath);
965
- if (!Kt(e, a)) continue;
966
- let c = Xt(e, t, r, a, i, o, s, n);
974
+ let a = qt(d, n, e.modulePath);
975
+ if (!Jt(e, a)) continue;
976
+ let c = Qt(e, t, r, a, i, o, s, n);
967
977
  c && l.push(c);
968
978
  }
969
979
  return l;
970
980
  }
971
- function Qt(e, t, n, r = {}) {
981
+ function en(e, t, n, r = {}) {
972
982
  return Pe(n, () => {
973
- let i = De(e, n), a = !!r.initMode, o = Zt(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
983
+ let i = De(e, n), a = !!r.initMode, o = $t(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
974
984
  if (!n.dryRun && !n.updateDepsOnly && !a) {
975
- Rt(t);
985
+ Bt(t);
976
986
  let i = {
977
987
  ...r.rediscover ? r.rediscover(t) : n,
978
988
  dryRun: !0
979
- }, a = Zt(De(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Ft);
980
- if (a.length > 0) throw new zt(a[0]);
989
+ }, a = $t(De(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Lt);
990
+ if (a.length > 0) throw new Vt(a[0]);
981
991
  }
982
- return a && !n.dryRun && Rt(t), { changes: o };
992
+ return a && !n.dryRun && Bt(t), { changes: o };
983
993
  });
984
994
  }
985
995
  //#endregion
986
996
  //#region src/structure/engine/discovery.ts
987
- var $t = [
997
+ var tn = [
988
998
  "root",
989
999
  "block",
990
1000
  "model",
@@ -992,12 +1002,12 @@ var $t = [
992
1002
  "workflow",
993
1003
  "test",
994
1004
  "software"
995
- ], en = class extends Error {
1005
+ ], nn = class extends Error {
996
1006
  constructor(e, t) {
997
1007
  super(e), this.path = t, this.name = "DiscoveryError";
998
1008
  }
999
1009
  };
1000
- function tn(e) {
1010
+ function rn(e) {
1001
1011
  let t = /* @__PURE__ */ new Set();
1002
1012
  for (let n of [
1003
1013
  e.dependencies,
@@ -1007,66 +1017,60 @@ function tn(e) {
1007
1017
  ]) if (n) for (let e of Object.keys(n)) t.add(e);
1008
1018
  return t;
1009
1019
  }
1010
- function nn(e) {
1020
+ function an(e) {
1011
1021
  return e === "" || e === ".";
1012
1022
  }
1013
- function rn(e, t) {
1014
- let n = e.pkg["block-scope"];
1015
- if (typeof n == "string") {
1016
- if (!$t.includes(n)) throw new en(`package.json "block-scope" must be one of ${$t.join(", ")}, got '${n}'`, e.path);
1017
- return n;
1023
+ function on(e) {
1024
+ let t = e.pkg["block-scope"];
1025
+ if (typeof t == "string") {
1026
+ if (!tn.includes(t)) throw new nn(`package.json "block-scope" must be one of ${tn.join(", ")}, got '${t}'`, e.path);
1027
+ return t;
1018
1028
  }
1019
- if (nn(e.path)) return "root";
1020
- let r = tn(e.pkg);
1029
+ if (an(e.path)) return "root";
1030
+ if (e.pkg.block !== void 0) return "block";
1031
+ let n = rn(e.pkg);
1021
1032
  if (e.pkg["block-software"] !== void 0) return "software";
1022
- if (r.has("@platforma-sdk/package-builder")) {
1023
- for (let e of r) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
1024
- }
1025
- if (r.has("@platforma-sdk/workflow-tengo")) return "workflow";
1026
- if ((r.has("@platforma-sdk/ui-vue") || r.has("vue")) && !e.pkg.main) return "ui";
1027
- if (r.has("@platforma-sdk/block-tools")) {
1028
- if ([...r].filter((e) => t.has(e) && (e.endsWith(".model") || e.endsWith(".ui") || e.endsWith(".workflow"))).length >= 2) return "block";
1029
- let n = e.pkg.files;
1030
- if (Array.isArray(n) && n.length === 2 && n.includes("index.d.ts") && n.includes("index.js")) return "block";
1031
- }
1032
- if (r.has("@platforma-sdk/model") && e.pkg.main) return "model";
1033
- if (r.has("@platforma-sdk/test")) return "test";
1034
- }
1035
- function an(e) {
1036
- let t = /* @__PURE__ */ new Set();
1037
- for (let n of e) typeof n.pkg.name == "string" && t.add(n.pkg.name);
1038
- let n = [];
1039
- for (let r of e) {
1040
- let e = rn(r, t);
1041
- if (!e) throw new en(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
1042
- n.push({
1033
+ if (n.has("@platforma-sdk/package-builder")) {
1034
+ for (let e of n) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
1035
+ }
1036
+ if (n.has("@platforma-sdk/workflow-tengo")) return "workflow";
1037
+ if ((n.has("@platforma-sdk/ui-vue") || n.has("vue")) && !e.pkg.main) return "ui";
1038
+ if (n.has("@platforma-sdk/model") && e.pkg.main) return "model";
1039
+ if (n.has("@platforma-sdk/test")) return "test";
1040
+ }
1041
+ function sn(e) {
1042
+ let t = [];
1043
+ for (let n of e) {
1044
+ let e = on(n);
1045
+ if (!e) throw new nn(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`, n.path);
1046
+ t.push({
1043
1047
  scope: e,
1044
- name: r.pkg.name ?? r.path,
1045
- path: nn(r.path) ? "" : r.path
1048
+ name: n.pkg.name ?? n.path,
1049
+ path: an(n.path) ? "" : n.path
1046
1050
  });
1047
1051
  }
1048
- return n;
1052
+ return t;
1049
1053
  }
1050
1054
  //#endregion
1051
1055
  //#region src/structure/engine/ctx.ts
1052
- function K(e, t) {
1056
+ function J(e, t) {
1053
1057
  return e.modules.filter((e) => e.scope === t);
1054
1058
  }
1055
- function on(e, t) {
1056
- let n = K(e, t);
1059
+ function cn(e, t) {
1060
+ let n = J(e, t);
1057
1061
  if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
1058
1062
  if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
1059
1063
  return n[0];
1060
1064
  }
1061
- function q(e, t) {
1062
- return { [on(e, t).name]: "workspace:*" };
1065
+ function ln(e, t) {
1066
+ return { [cn(e, t).name]: "workspace:*" };
1063
1067
  }
1064
- function sn(e, t) {
1068
+ function un(e, t) {
1065
1069
  let n = {};
1066
- for (let r of K(e, t)) n[r.name] = "workspace:*";
1070
+ for (let r of J(e, t)) n[r.name] = "workspace:*";
1067
1071
  return n;
1068
1072
  }
1069
- function cn(e) {
1073
+ function dn(e) {
1070
1074
  let t = e.facadeName, n = [
1071
1075
  {
1072
1076
  scope: "root",
@@ -1105,7 +1109,7 @@ function cn(e) {
1105
1109
  path: "software"
1106
1110
  }), n;
1107
1111
  }
1108
- function ln(e) {
1112
+ function fn(e) {
1109
1113
  return {
1110
1114
  isSdkInternal: e.isSdkInternal ?? !1,
1111
1115
  updateDepsOnly: e.updateDepsOnly ?? !1,
@@ -1117,41 +1121,41 @@ function ln(e) {
1117
1121
  }
1118
1122
  //#endregion
1119
1123
  //#region src/structure/engine/discovery-fs.ts
1120
- var J = class extends Error {
1124
+ var Y = class extends Error {
1121
1125
  constructor(e) {
1122
1126
  super(e), this.name = "StructureCliError";
1123
1127
  }
1124
1128
  };
1125
- function un(e, t) {
1129
+ function pn(e, t) {
1126
1130
  return e === "" ? t : `${e}/${t}`;
1127
1131
  }
1128
- function dn(e, t) {
1132
+ function mn(e, t) {
1129
1133
  try {
1130
1134
  return JSON.parse(e.read(t));
1131
1135
  } catch {
1132
1136
  return;
1133
1137
  }
1134
1138
  }
1135
- function fn(e) {
1136
- 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.`);
1139
+ function hn(e) {
1140
+ 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.`);
1137
1141
  let t = e.replace(/^\.\//, "").replace(/\/$/, "");
1138
1142
  return t === "." ? "" : t;
1139
1143
  }
1140
- function pn(e) {
1144
+ function gn(e) {
1141
1145
  let t;
1142
1146
  try {
1143
1147
  t = e.read("pnpm-workspace.yaml");
1144
1148
  } catch {
1145
- 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.");
1149
+ 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.");
1146
1150
  }
1147
1151
  let n = oe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1148
1152
  for (let t of r) {
1149
- let n = fn(t);
1153
+ let n = hn(t);
1150
1154
  (n === "" || e.exists(n)) && i.add(n);
1151
1155
  }
1152
1156
  let a = [];
1153
1157
  for (let t of i) {
1154
- let n = dn(e, un(t, "package.json"));
1158
+ let n = mn(e, pn(t, "package.json"));
1155
1159
  n && a.push({
1156
1160
  path: t,
1157
1161
  pkg: n
@@ -1159,7 +1163,7 @@ function pn(e) {
1159
1163
  }
1160
1164
  return a;
1161
1165
  }
1162
- function mn(e) {
1166
+ function _n(e) {
1163
1167
  let t = [], n = new Set([
1164
1168
  "node_modules",
1165
1169
  ".turbo",
@@ -1171,7 +1175,7 @@ function mn(e) {
1171
1175
  let o = e.listDir(i);
1172
1176
  for (let s of o) {
1173
1177
  if (!s.isDirectory || n.has(s.name)) continue;
1174
- let o = un(i, s.name), c = dn(e, un(o, "package.json"));
1178
+ let o = pn(i, s.name), c = mn(e, pn(o, "package.json"));
1175
1179
  c && t.push({
1176
1180
  path: o,
1177
1181
  pkg: c
@@ -1180,11 +1184,11 @@ function mn(e) {
1180
1184
  }
1181
1185
  return r("", 1), t;
1182
1186
  }
1183
- function hn(e) {
1187
+ function vn(e) {
1184
1188
  let t = e.indexOf("/");
1185
- if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1189
+ if (!e.startsWith("@") || t < 0) throw new Y(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1186
1190
  let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
1187
- if (i < 0) throw new J(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1191
+ if (i < 0) throw new Y(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1188
1192
  return {
1189
1193
  facadeName: e,
1190
1194
  baseName: r,
@@ -1193,23 +1197,23 @@ function hn(e) {
1193
1197
  shortName: r.slice(i + 1)
1194
1198
  };
1195
1199
  }
1196
- function gn(e) {
1200
+ function yn(e) {
1197
1201
  try {
1198
- let t = JSON.parse(e.read(Ft));
1202
+ let t = JSON.parse(e.read(Lt));
1199
1203
  return typeof t.version == "number" ? t.version : 0;
1200
1204
  } catch {
1201
1205
  return 0;
1202
1206
  }
1203
1207
  }
1204
- function _n(e) {
1205
- let { fs: t, isSdkInternal: n } = e, r = n ? mn(t) : pn(t);
1206
- if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1207
- let i = an(r), a = gn(t);
1208
- It(a, 0);
1208
+ function bn(e) {
1209
+ let { fs: t, isSdkInternal: n } = e, r = n ? _n(t) : gn(t);
1210
+ if (r.length === 0) throw new Y("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1211
+ let i = sn(r), a = yn(t);
1212
+ Rt(a, 0);
1209
1213
  let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
1210
- if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1211
- let s = hn(o.name.replace(/\.block$/, ""));
1212
- return ln({
1214
+ if (!o) throw new Y("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1215
+ let s = vn(o.name.replace(/\.block$/, ""));
1216
+ return fn({
1213
1217
  isSdkInternal: n,
1214
1218
  updateDepsOnly: e.updateDepsOnly ?? !1,
1215
1219
  modules: i,
@@ -1220,7 +1224,7 @@ function _n(e) {
1220
1224
  }
1221
1225
  //#endregion
1222
1226
  //#region src/structure/rules/shared/key-order.ts
1223
- var Y = [
1227
+ var X = [
1224
1228
  "name",
1225
1229
  "version",
1226
1230
  "private",
@@ -1244,7 +1248,7 @@ var Y = [
1244
1248
  ];
1245
1249
  //#endregion
1246
1250
  //#region src/structure/rules/root-package-json.ts
1247
- function vn(e) {
1251
+ function xn(e) {
1248
1252
  return {
1249
1253
  version: "1.0.0",
1250
1254
  private: !0,
@@ -1277,88 +1281,88 @@ function vn(e) {
1277
1281
  packageManager: "pnpm@9.12.0"
1278
1282
  };
1279
1283
  }
1280
- function yn() {
1281
- P("packageManager", "pnpm@9.12.0"), yt("name"), F("fmt", "turbo run fmt"), F("check", "turbo run check"), F("build", "turbo run build"), F("build:dev", "env PL_PKG_DEV=local turbo run build"), F("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), F("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), F("mark-stable", "turbo run mark-stable"), F("do-pack", "turbo run do-pack"), F("watch", "turbo watch build"), F("changeset", "changeset"), F("version-packages", "changeset version"), F("update-sdk", "block-tools structure refresh --update-deps-only"), I("update"), F("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), V({
1284
+ function Sn() {
1285
+ L("packageManager", "pnpm@9.12.0"), vt("name"), R("fmt", "turbo run fmt"), R("check", "turbo run check"), R("build", "turbo run build"), R("build:dev", "env PL_PKG_DEV=local turbo run build"), R("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), R("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), R("mark-stable", "turbo run mark-stable"), R("do-pack", "turbo run do-pack"), R("watch", "turbo watch build"), R("changeset", "changeset"), R("version-packages", "changeset version"), R("update-sdk", "block-tools structure refresh --update-deps-only"), z("update"), R("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), W({
1282
1286
  "@changesets/cli": "catalog:",
1283
1287
  "@milaboratories/ts-builder": "sdk:",
1284
1288
  "@platforma-sdk/block-tools": "sdk:",
1285
1289
  shx: "catalog:",
1286
1290
  turbo: "catalog:"
1287
- }), H({
1291
+ }), G({
1288
1292
  oxlint: "*",
1289
1293
  oxfmt: "*"
1290
- }), Ct((e, t) => {
1294
+ }), Tt((e, t) => {
1291
1295
  if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
1292
1296
  let n = t;
1293
1297
  return n.pnpm !== void 0 || n.overrides !== void 0;
1294
- }), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1298
+ }), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
1295
1299
  }
1296
1300
  //#endregion
1297
1301
  //#region src/structure/engine/registry-client.ts
1298
- var bn = 2, xn = 500, Sn = 3e4;
1299
- function Cn(e) {
1302
+ var Cn = 2, wn = 500, Tn = 3e4;
1303
+ function En(e) {
1300
1304
  if (!e) return null;
1301
1305
  let t = Number(e);
1302
1306
  if (Number.isFinite(t) && t > 0) return t * 1e3;
1303
1307
  let n = Date.parse(e);
1304
1308
  return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
1305
1309
  }
1306
- async function wn(e) {
1310
+ async function Dn(e) {
1307
1311
  for (let t = 1;; t++) {
1308
1312
  let n;
1309
1313
  try {
1310
- n = await fetch(e, { signal: AbortSignal.timeout(Sn) });
1314
+ n = await fetch(e, { signal: AbortSignal.timeout(Tn) });
1311
1315
  } catch (e) {
1312
- if (t > bn) throw e;
1313
- await le(xn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1316
+ if (t > Cn) throw e;
1317
+ await le(wn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1314
1318
  continue;
1315
1319
  }
1316
1320
  if (n.ok) return n;
1317
- if (!(n.status === 429 || n.status >= 500) || t > bn) throw Error(`registry returned HTTP ${n.status}`);
1318
- let r = Cn(n.headers.get("retry-after"));
1321
+ if (!(n.status === 429 || n.status >= 500) || t > Cn) throw Error(`registry returned HTTP ${n.status}`);
1322
+ let r = En(n.headers.get("retry-after"));
1319
1323
  if (r != null) {
1320
1324
  await le(r);
1321
1325
  continue;
1322
1326
  }
1323
- await le(xn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1327
+ await le(wn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1324
1328
  }
1325
1329
  }
1326
- function Tn() {
1330
+ function On() {
1327
1331
  return {
1328
1332
  async getLatestVersion(e) {
1329
- let t = (await (await wn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1333
+ let t = (await (await Dn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1330
1334
  if (!t) throw Error("no 'latest' dist-tag in registry response");
1331
1335
  return t;
1332
1336
  },
1333
1337
  async getDeclaredDependency(e, t, n) {
1334
- let r = await (await wn(`https://registry.npmjs.org/${e}/${t}`)).json();
1338
+ let r = await (await Dn(`https://registry.npmjs.org/${e}/${t}`)).json();
1335
1339
  return r.dependencies?.[n] ?? r.peerDependencies?.[n];
1336
1340
  }
1337
1341
  };
1338
1342
  }
1339
- async function En(e, t) {
1343
+ async function kn(e, t) {
1340
1344
  let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
1341
1345
  return new Map(n);
1342
1346
  }
1343
- function Dn(e) {
1347
+ function An(e) {
1344
1348
  return (t) => e.get(t);
1345
1349
  }
1346
- var On = [/^@platforma-sdk\//, /^@milaboratories\//];
1347
- function kn(e) {
1348
- return On.some((t) => t.test(e));
1350
+ var jn = [/^@platforma-sdk\//, /^@milaboratories\//];
1351
+ function Mn(e) {
1352
+ return jn.some((t) => t.test(e));
1349
1353
  }
1350
- async function An(e, t = Tn()) {
1351
- return e.length === 0 ? () => void 0 : Dn(await En(t, e));
1354
+ async function Nn(e, t = On()) {
1355
+ return e.length === 0 ? () => void 0 : An(await kn(t, e));
1352
1356
  }
1353
- function jn(e) {
1357
+ function Pn(e) {
1354
1358
  return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
1355
1359
  }
1356
- async function Mn(e, t = Tn()) {
1360
+ async function Fn(e, t = On()) {
1357
1361
  if (e.length === 0) return () => void 0;
1358
1362
  let n = await Promise.all(e.map(async (e) => {
1359
1363
  let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
1360
1364
  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.`);
1361
- if (!jn(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.`);
1365
+ if (!Pn(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.`);
1362
1366
  return [e.entry, n];
1363
1367
  })), r = new Map(n);
1364
1368
  return (e) => r.get(e);
@@ -1366,7 +1370,7 @@ async function Mn(e, t = Tn()) {
1366
1370
  //#endregion
1367
1371
  //#region src/structure/rules/shared/retired-deps.ts
1368
1372
  // @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
1369
- var Nn = [
1373
+ var In = [
1370
1374
  "vite",
1371
1375
  "tsup",
1372
1376
  "vue-tsc",
@@ -1374,8 +1378,8 @@ var Nn = [
1374
1378
  "vite-plugin-dts",
1375
1379
  "@platforma-sdk/eslint-config"
1376
1380
  ];
1377
- function X() {
1378
- for (let e of Nn) B(e);
1381
+ function Ln() {
1382
+ for (let e of In) U(e);
1379
1383
  }
1380
1384
  //#endregion
1381
1385
  //#region src/structure/rules/root-pnpm-workspace.ts
@@ -1389,32 +1393,32 @@ var Z = [
1389
1393
  "@platforma-sdk/package-builder",
1390
1394
  "@milaboratories/ts-builder",
1391
1395
  "@milaboratories/ts-configs"
1392
- ], Pn = "0.0.0-init-must-fetch";
1393
- for (let e of Z) if (!kn(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.`);
1394
- var Fn = {
1396
+ ], Rn = "0.0.0-init-must-fetch";
1397
+ for (let e of Z) if (!Mn(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.`);
1398
+ var zn = {
1395
1399
  turbo: "~2.8.11",
1396
1400
  shx: "~0.4.0",
1397
1401
  "@changesets/cli": "~2.29.8",
1398
1402
  vitest: "~4.0.18"
1399
- }, In = [{
1403
+ }, Bn = [{
1400
1404
  entry: "vue",
1401
1405
  of: "@platforma-sdk/ui-vue"
1402
- }], Ln = "@platforma-open/milaboratories.runenv-python-3", Rn = "1.8.2";
1403
- function zn(e) {
1406
+ }], Vn = "@platforma-open/milaboratories.runenv-python-3", Hn = "1.8.2";
1407
+ function Un(e) {
1404
1408
  let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
1405
- for (let e of Z) n[e] = Pn;
1406
- return Object.assign(n, Fn), e.modules.some((e) => e.scope === "software") && (n[Ln] = Rn), {
1409
+ for (let e of Z) n[e] = Rn;
1410
+ return Object.assign(n, zn), e.modules.some((e) => e.scope === "software") && (n[Vn] = Hn), {
1407
1411
  packages: t,
1408
1412
  catalog: n
1409
1413
  };
1410
1414
  }
1411
- function Bn() {
1412
- Et();
1413
- for (let e of Nn) jt(e);
1415
+ function Wn() {
1416
+ Ot();
1417
+ for (let e of In) Nt(e);
1414
1418
  }
1415
1419
  //#endregion
1416
1420
  //#region src/structure/rules/root-gitignore.ts
1417
- var Vn = [
1421
+ var Gn = [
1418
1422
  ".test_auth.json",
1419
1423
  "node_modules/",
1420
1424
  "dist/",
@@ -1429,52 +1433,92 @@ var Vn = [
1429
1433
  ".vscode/sftp.json",
1430
1434
  "test-dry-run.json"
1431
1435
  ];
1432
- function Hn() {
1433
- Mt(Vn);
1436
+ function Kn() {
1437
+ Pt(Gn);
1434
1438
  }
1435
1439
  //#endregion
1436
1440
  //#region src/structure/rules/root.ts
1437
- function Un() {
1438
- v("root", () => {
1439
- y(({ ctx: e }) => !e.isSdkInternal, () => {
1440
- x("turbo.json", T("root/turbo.json")), x(".vscode/settings.json", T("root/.vscode/settings.json")), S("package.json", D((e) => vn(e)), () => {
1441
- yn();
1442
- }), S("pnpm-workspace.yaml", D((e) => zn(e)), () => {
1443
- Bn();
1444
- }), S(".gitignore", T("root/.gitignore"), () => {
1445
- Hn();
1441
+ function qn() {
1442
+ b("root", () => {
1443
+ x(({ ctx: e }) => !e.isSdkInternal, () => {
1444
+ C("turbo.json", O("root/turbo.json")), C(".vscode/settings.json", O("root/.vscode/settings.json")), w("package.json", A((e) => xn(e)), () => {
1445
+ Sn();
1446
+ }), w("pnpm-workspace.yaml", A((e) => Un(e)), () => {
1447
+ Wn();
1448
+ }), w(".gitignore", O("root/.gitignore"), () => {
1449
+ Kn();
1446
1450
  });
1447
1451
  });
1448
1452
  });
1449
1453
  }
1450
1454
  //#endregion
1451
1455
  //#region src/structure/rules/root-ci.ts
1452
- function Wn(e) {
1456
+ function Jn(e) {
1453
1457
  return e.split(/[-_]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
1454
1458
  }
1455
- function Gn() {
1456
- v("root", () => {
1457
- y(({ ctx: e }) => !e.isSdkInternal, () => {
1458
- x(".github/workflows/build.yaml", E("workflows/build.tpl.yaml", (e) => {
1459
+ function Yn() {
1460
+ b("root", () => {
1461
+ x(({ ctx: e }) => !e.isSdkInternal, () => {
1462
+ C(".github/workflows/build.yaml", k("workflows/build.tpl.yaml", (e) => {
1459
1463
  let t = e.blockVars.shortName;
1460
1464
  return {
1461
- appName: `Block: ${Wn(t)}`,
1465
+ appName: `Block: ${Jn(t)}`,
1462
1466
  appNameSlug: `block-${t}`
1463
1467
  };
1464
- })), x(".github/workflows/mark-stable.yaml", E("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${Wn(e.blockVars.shortName)} - Mark Stable` })));
1468
+ })), C(".github/workflows/mark-stable.yaml", k("workflows/mark-stable.tpl.yaml", (e) => ({ appName: `Block: ${Jn(e.blockVars.shortName)} - Mark Stable` })));
1465
1469
  });
1466
1470
  });
1467
1471
  }
1468
1472
  //#endregion
1469
1473
  //#region src/structure/rules/block-package-json.ts
1470
- function Kn(e) {
1474
+ var Xn = {
1475
+ "@platforma-open": {
1476
+ s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
1477
+ serveUrl: "https://blocks.pl-open.science"
1478
+ },
1479
+ "@milaboratories": {
1480
+ s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
1481
+ serveUrl: "https://block.registry.platforma.bio/releases"
1482
+ }
1483
+ }, Zn = {
1484
+ s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1",
1485
+ serveUrl: "https://blocks.pl-open.science"
1486
+ }, Qn = {
1487
+ s3: "s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1",
1488
+ serveUrl: "https://aux-blocks.pl-open.science"
1489
+ };
1490
+ function $n(e, t) {
1491
+ let n = t ? Qn : Xn[e] ?? Zn;
1492
+ return `block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`;
1493
+ }
1494
+ function er(e) {
1471
1495
  let t = {};
1472
- for (let n of K(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
1473
- for (let n of K(e, "model")) t.model = `${n.name}/dist/model.json`;
1474
- for (let n of K(e, "ui")) t.ui = `${n.name}/dist`;
1496
+ for (let n of J(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
1497
+ for (let n of J(e, "model")) t.model = `${n.name}/dist/model.json`;
1498
+ for (let n of J(e, "ui")) t.ui = `${n.name}/dist`;
1475
1499
  return t;
1476
1500
  }
1477
- function qn(e) {
1501
+ function tr(e, t) {
1502
+ return {
1503
+ build: "ts-builder build --target block-facade && block-tools pack",
1504
+ check: "ts-builder type-check --target block-facade",
1505
+ prepublishOnly: $n(e, t),
1506
+ "do-pack": "pnpm pack && shx mv *.tgz package.tgz"
1507
+ };
1508
+ }
1509
+ var nr = {
1510
+ "@milaboratories/ts-builder": "sdk:",
1511
+ "@milaboratories/ts-configs": "sdk:",
1512
+ "@platforma-sdk/block-tools": "sdk:",
1513
+ "@platforma-sdk/model": "sdk:",
1514
+ shx: "catalog:",
1515
+ typescript: "catalog:"
1516
+ }, rr = { ".": {
1517
+ sources: "./src/index.ts",
1518
+ types: "./dist/index.d.ts",
1519
+ default: "./dist/index.js"
1520
+ } };
1521
+ function ir(e) {
1478
1522
  if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
1479
1523
  let t = e.meta, n = [
1480
1524
  ["block.meta.title", t.title],
@@ -1486,13 +1530,14 @@ function qn(e) {
1486
1530
  ];
1487
1531
  for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
1488
1532
  }
1489
- function Jn(e) {
1533
+ function ar(e) {
1490
1534
  let t = e.blockVars, n = {
1491
- ...q(e, "model"),
1492
- ...q(e, "ui"),
1493
- ...q(e, "workflow")
1535
+ ...nr,
1536
+ ...un(e, "model"),
1537
+ ...un(e, "ui"),
1538
+ ...un(e, "workflow")
1494
1539
  }, r = {
1495
- components: Kn(e),
1540
+ components: er(e),
1496
1541
  meta: {
1497
1542
  title: t.shortName,
1498
1543
  description: `${t.shortName} block`,
@@ -1504,33 +1549,43 @@ function Jn(e) {
1504
1549
  }
1505
1550
  }
1506
1551
  };
1507
- return qn(r), {
1552
+ return ir(r), {
1508
1553
  name: `${t.facadeName}.block`,
1509
1554
  version: "1.0.0",
1510
- files: ["index.d.ts", "index.js"],
1511
- scripts: {
1512
- build: "shx rm -rf ./block-pack && block-tools pack",
1513
- "mark-stable": "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'",
1514
- prepublishOnly: "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'",
1515
- "do-pack": "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"
1516
- },
1517
- dependencies: n,
1518
- devDependencies: {
1519
- "@platforma-sdk/block-tools": "sdk:",
1520
- shx: "catalog:"
1521
- },
1555
+ type: "module",
1556
+ files: ["dist", "block-pack"],
1557
+ main: "./dist/index.js",
1558
+ module: "./dist/index.js",
1559
+ types: "./dist/index.d.ts",
1560
+ exports: rr,
1561
+ scripts: tr(t.npmOrg, e.isSdkInternal),
1562
+ dependencies: {},
1563
+ devDependencies: n,
1522
1564
  block: r
1523
1565
  };
1524
1566
  }
1525
- function Yn(e) {
1526
- P("files", ["index.d.ts", "index.js"]), F("build", "shx rm -rf ./block-pack && block-tools pack"), F("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), F("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), F("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), U("model"), U("ui"), U("workflow"), z("@platforma-sdk/block-tools", "sdk:"), z("shx", "catalog:"), P("block.components", Kn(e)), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1567
+ function or(e) {
1568
+ let t = e.blockVars;
1569
+ 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", rr);
1570
+ let n = tr(t.npmOrg, e.isSdkInternal);
1571
+ for (let [e, t] of Object.entries(n)) R(e, t);
1572
+ z("mark-stable"), wt("model"), wt("ui"), wt("workflow"), H("@milaboratories/ts-builder", "sdk:"), H("@milaboratories/ts-configs", "sdk:"), H("@platforma-sdk/block-tools", "sdk:"), H("@platforma-sdk/model", "sdk:"), H("shx", "catalog:"), H("typescript", "catalog:"), L("block.components", er(e)), yt("version", "facade package.json must carry a 'version' (the facade publishes)"), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
1573
+ }
1574
+ //#endregion
1575
+ //#region src/structure/rules/shared/pascal-case.ts
1576
+ function sr(e) {
1577
+ let t = e.split(/[^A-Za-z0-9]+/).filter((e) => e.length > 0).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
1578
+ return /^[0-9]/.test(t) ? `_${t}` : t;
1527
1579
  }
1528
1580
  //#endregion
1529
1581
  //#region src/structure/rules/block.ts
1530
- function Xn() {
1531
- v("block", () => {
1532
- x("index.js", T("block/index.js")), x("index.d.ts", T("block/index.d.ts")), C("logos/block-logo.png", Ge("block/logos/block-logo.png")), C("logos/organization-logo.png", Ge("block/logos/organization-logo.png")), S("package.json", D((e) => Jn(e)), (e) => {
1533
- Yn(e);
1582
+ function cr() {
1583
+ b("block", () => {
1584
+ D("index.js"), D("index.d.ts"), C("src/index.ts", k("block/src/index.tpl.ts", (e) => ({
1585
+ facadeName: e.blockVars.facadeName,
1586
+ pascalName: sr(e.blockVars.shortName)
1587
+ }))), C("src/AGENTS.ts", O("block/src/AGENTS.ts")), T("src/block-extra.ts", O("block/src/block-extra.ts")), T("src/agents-extra.ts", O("block/src/agents-extra.ts")), C("tsconfig.json", O("block/tsconfig.json")), E("logos/block-logo.png", We("block/logos/block-logo.png")), E("logos/organization-logo.png", We("block/logos/organization-logo.png")), w("package.json", A((e) => ar(e)), (e) => {
1588
+ or(e);
1534
1589
  });
1535
1590
  });
1536
1591
  }
@@ -1539,10 +1594,10 @@ function Xn() {
1539
1594
  var Q = "src/**/*.test.ts";
1540
1595
  //#endregion
1541
1596
  //#region src/structure/rules/model-package-json.ts
1542
- function Zn(e) {
1597
+ function lr(e) {
1543
1598
  return {
1544
1599
  name: `${e.blockVars.facadeName}.model`,
1545
- version: "1.0.0",
1600
+ private: !0,
1546
1601
  type: "module",
1547
1602
  main: "dist/index.cjs",
1548
1603
  module: "dist/index.js",
@@ -1573,40 +1628,40 @@ function Zn(e) {
1573
1628
  }
1574
1629
  };
1575
1630
  }
1576
- function Qn() {
1577
- P("type", "module"), P("main", "dist/index.cjs"), P("module", "dist/index.js"), P("types", "dist/index.d.ts"), P("exports", {
1631
+ function ur() {
1632
+ L("private", !0), L("type", "module"), L("main", "dist/index.cjs"), L("module", "dist/index.js"), L("types", "dist/index.d.ts"), L("exports", {
1578
1633
  ".": {
1579
1634
  types: "./dist/index.d.ts",
1580
1635
  sources: "./src/index.ts",
1581
1636
  import: "./dist/index.js"
1582
1637
  },
1583
1638
  "./dist/*": "./dist/*"
1584
- }), F("fmt", "ts-builder format"), F("watch", "ts-builder build --target block-model --watch"), F("build", "ts-builder build --target block-model && block-tools build-model"), F("check", "ts-builder check --target block-model"), R("@platforma-sdk/model", "sdk:"), V({
1639
+ }), R("fmt", "ts-builder format"), R("watch", "ts-builder build --target block-model --watch"), R("build", "ts-builder build --target block-model && block-tools build-model"), R("check", "ts-builder check --target block-model"), V("@platforma-sdk/model", "sdk:"), W({
1585
1640
  "@milaboratories/ts-builder": "sdk:",
1586
1641
  "@milaboratories/ts-configs": "sdk:",
1587
1642
  "@platforma-sdk/block-tools": "sdk:"
1588
- }), H({
1643
+ }), G({
1589
1644
  "@types/node": "*",
1590
1645
  typescript: "*"
1591
- }), y(({ ctx: e }) => !e.isSdkInternal, () => y(b(Q), () => {
1592
- F("test", "vitest run --passWithNoTests"), z("vitest", "catalog:"), z("@types/node", "*");
1593
- }, () => B("vitest"))), X(), yt("tsup"), I("lint"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1646
+ }), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1647
+ R("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
1648
+ }, () => U("vitest"))), Ln(), vt("tsup"), z("lint"), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
1594
1649
  }
1595
1650
  //#endregion
1596
1651
  //#region src/structure/rules/model.ts
1597
- function $n() {
1598
- v("model", () => {
1599
- y(b(Q), () => x("tsconfig.json", T("model/tsconfig.node.json")), () => x("tsconfig.json", T("model/tsconfig.json"))), x(".oxlintrc.json", T("model/.oxlintrc.json")), x(".oxfmtrc.json", T("model/.oxfmtrc.json")), C("src/index.ts", T("model/src/index.ts")), S("package.json", D((e) => Zn(e)), () => {
1600
- Qn();
1652
+ function dr() {
1653
+ b("model", () => {
1654
+ x(S(Q), () => C("tsconfig.json", O("model/tsconfig.node.json")), () => C("tsconfig.json", O("model/tsconfig.json"))), C(".oxlintrc.json", O("model/.oxlintrc.json")), C(".oxfmtrc.json", O("model/.oxfmtrc.json")), E("src/index.ts", O("model/src/index.ts")), w("package.json", A((e) => lr(e)), () => {
1655
+ ur();
1601
1656
  });
1602
1657
  });
1603
1658
  }
1604
1659
  //#endregion
1605
1660
  //#region src/structure/rules/ui-package-json.ts
1606
- function er(e) {
1661
+ function fr(e) {
1607
1662
  return {
1608
1663
  name: `${e.blockVars.facadeName}.ui`,
1609
- version: "1.0.0",
1664
+ private: !0,
1610
1665
  type: "module",
1611
1666
  scripts: {
1612
1667
  fmt: "ts-builder format",
@@ -1618,7 +1673,7 @@ function er(e) {
1618
1673
  dependencies: {
1619
1674
  "@platforma-sdk/ui-vue": "sdk:",
1620
1675
  vue: "catalog:",
1621
- ...q(e, "model")
1676
+ ...ln(e, "model")
1622
1677
  },
1623
1678
  devDependencies: {
1624
1679
  "@milaboratories/ts-builder": "sdk:",
@@ -1630,32 +1685,32 @@ function er(e) {
1630
1685
  }
1631
1686
  };
1632
1687
  }
1633
- function tr() {
1634
- P("type", "module"), F("fmt", "ts-builder format"), F("dev", "ts-builder serve --target block-ui"), F("watch", "ts-builder build --target block-ui --watch"), F("build", "ts-builder build --target block-ui"), F("check", "ts-builder check --target block-ui"), R("@platforma-sdk/ui-vue", "sdk:"), R("vue", "catalog:"), U("model"), V({
1688
+ function pr() {
1689
+ L("private", !0), L("type", "module"), R("fmt", "ts-builder format"), R("dev", "ts-builder serve --target block-ui"), R("watch", "ts-builder build --target block-ui --watch"), R("build", "ts-builder build --target block-ui"), R("check", "ts-builder check --target block-ui"), V("@platforma-sdk/ui-vue", "sdk:"), V("vue", "catalog:"), Ct("model"), W({
1635
1690
  "@milaboratories/ts-builder": "sdk:",
1636
1691
  "@milaboratories/ts-configs": "sdk:"
1637
- }), X(), I("preview"), I("lint"), H({
1692
+ }), Ln(), z("preview"), z("lint"), G({
1638
1693
  "@types/node": "*",
1639
1694
  typescript: "*"
1640
- }), y(({ ctx: e }) => !e.isSdkInternal, () => y(b(Q), () => {
1641
- F("test", "vitest run --passWithNoTests"), z("vitest", "catalog:"), z("@types/node", "*");
1642
- }, () => B("vitest"))), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1695
+ }), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1696
+ R("test", "vitest run --passWithNoTests"), H("vitest", "catalog:"), H("@types/node", "*");
1697
+ }, () => U("vitest"))), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
1643
1698
  }
1644
1699
  //#endregion
1645
1700
  //#region src/structure/rules/ui.ts
1646
- function nr() {
1647
- v("ui", () => {
1648
- y(b(Q), () => x("tsconfig.json", T("ui/tsconfig.node.json")), () => x("tsconfig.json", T("ui/tsconfig.json"))), x(".oxlintrc.json", T("ui/.oxlintrc.json")), x(".oxfmtrc.json", T("ui/.oxfmtrc.json")), We("index.html", T("ui/index.html")), C("src/main.ts", T("ui/src/main.ts")), C("src/app.ts", E("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), C("src/MainPage.vue", E("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), S("package.json", D((e) => er(e)), () => {
1649
- tr();
1701
+ function mr() {
1702
+ b("ui", () => {
1703
+ x(S(Q), () => C("tsconfig.json", O("ui/tsconfig.node.json")), () => C("tsconfig.json", O("ui/tsconfig.json"))), C(".oxlintrc.json", O("ui/.oxlintrc.json")), C(".oxfmtrc.json", O("ui/.oxfmtrc.json")), T("index.html", O("ui/index.html")), E("src/main.ts", O("ui/src/main.ts")), E("src/app.ts", k("ui/src/app.tpl.ts", (e) => ({ modelPkg: `${e.blockVars.facadeName}.model` }))), E("src/MainPage.vue", k("ui/src/MainPage.tpl.vue", (e) => ({ shortName: e.blockVars.shortName }))), w("package.json", A((e) => fr(e)), () => {
1704
+ pr();
1650
1705
  });
1651
1706
  });
1652
1707
  }
1653
1708
  //#endregion
1654
1709
  //#region src/structure/rules/workflow-package-json.ts
1655
- function rr(e) {
1710
+ function hr(e) {
1656
1711
  return {
1657
1712
  name: `${e.blockVars.facadeName}.workflow`,
1658
- version: "1.0.0",
1713
+ private: !0,
1659
1714
  type: "module",
1660
1715
  scripts: {
1661
1716
  build: "shx rm -rf dist && pl-tengo build",
@@ -1664,7 +1719,7 @@ function rr(e) {
1664
1719
  },
1665
1720
  dependencies: {
1666
1721
  "@platforma-sdk/workflow-tengo": "sdk:",
1667
- ...sn(e, "software")
1722
+ ...un(e, "software")
1668
1723
  },
1669
1724
  devDependencies: {
1670
1725
  "@platforma-sdk/tengo-builder": "sdk:",
@@ -1673,34 +1728,33 @@ function rr(e) {
1673
1728
  }
1674
1729
  };
1675
1730
  }
1676
- function ir() {
1677
- P("type", "module"), F("build", "shx rm -rf dist && pl-tengo build"), F("check", "pl-tengo check"), F("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), y(({ ctx: e }) => !e.isSdkInternal, () => y(b(Q), () => {
1678
- F("test", "vitest run --passWithNoTests"), V({ vitest: "catalog:" });
1679
- }, () => B("vitest"))), R("@platforma-sdk/workflow-tengo", "sdk:"), U("software"), V({
1731
+ function gr() {
1732
+ L("private", !0), L("type", "module"), R("build", "shx rm -rf dist && pl-tengo build"), R("check", "pl-tengo check"), R("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1733
+ R("test", "vitest run --passWithNoTests"), W({ vitest: "catalog:" });
1734
+ }, () => U("vitest"))), V("@platforma-sdk/workflow-tengo", "sdk:"), Ct("software"), W({
1680
1735
  "@platforma-sdk/tengo-builder": "sdk:",
1681
1736
  "@platforma-sdk/test": "sdk:",
1682
1737
  shx: "catalog:"
1683
- }), X(), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1738
+ }), Ln(), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
1684
1739
  }
1685
1740
  //#endregion
1686
1741
  //#region src/structure/rules/workflow.ts
1687
- function ar() {
1688
- v("workflow", () => {
1689
- x("format.el", T("workflow/format.el")), y(({ ctx: e }) => !e.isSdkInternal, () => y(b(Q), () => {
1690
- x("tsconfig.json", T("workflow/tsconfig.json")), We("vitest.config.mts", T("workflow/vitest.config.mts"));
1742
+ function _r() {
1743
+ b("workflow", () => {
1744
+ C("format.el", O("workflow/format.el")), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1745
+ C("tsconfig.json", O("workflow/tsconfig.json")), T("vitest.config.mts", O("workflow/vitest.config.mts"));
1691
1746
  }, () => {
1692
- w("tsconfig.json"), w("vitest.config.mts");
1693
- })), w("index.js"), w("index.d.ts"), C("src/main.tpl.tengo", E("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), S("package.json", D((e) => rr(e)), () => {
1694
- ir();
1747
+ D("tsconfig.json"), D("vitest.config.mts");
1748
+ })), D("index.js"), D("index.d.ts"), E("src/main.tpl.tengo", k("workflow/src/main.tpl.tengo", (e) => ({ shortName: e.blockVars.shortName }))), w("package.json", A((e) => hr(e)), () => {
1749
+ gr();
1695
1750
  });
1696
1751
  });
1697
1752
  }
1698
1753
  //#endregion
1699
1754
  //#region src/structure/rules/test-package-json.ts
1700
- function or(e) {
1755
+ function vr(e) {
1701
1756
  return {
1702
1757
  name: `${e.blockVars.facadeName}.test`,
1703
- version: "1.0.0",
1704
1758
  private: !0,
1705
1759
  type: "module",
1706
1760
  scripts: {
@@ -1717,26 +1771,26 @@ function or(e) {
1717
1771
  }
1718
1772
  };
1719
1773
  }
1720
- function sr() {
1721
- P("type", "module"), F("fmt", "ts-builder format"), F("check", "ts-builder check --target block-test"), F("test", "vitest run --passWithNoTests"), I("lint"), V({
1774
+ function yr() {
1775
+ L("private", !0), L("type", "module"), R("fmt", "ts-builder format"), R("check", "ts-builder check --target block-test"), R("test", "vitest run --passWithNoTests"), z("lint"), W({
1722
1776
  "@platforma-sdk/test": "sdk:",
1723
1777
  "@milaboratories/ts-builder": "sdk:",
1724
1778
  "@milaboratories/ts-configs": "sdk:",
1725
1779
  vitest: "catalog:"
1726
- }), H({ typescript: "*" }), B("@types/node"), X(), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1780
+ }), G({ typescript: "*" }), U("@types/node"), Ln(), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
1727
1781
  }
1728
1782
  //#endregion
1729
1783
  //#region src/structure/rules/test.ts
1730
- function cr() {
1731
- v("test", () => {
1732
- x("tsconfig.json", T("test/tsconfig.json")), x(".oxlintrc.json", T("test/.oxlintrc.json")), x(".oxfmtrc.json", T("test/.oxfmtrc.json")), We("vitest.config.mts", T("test/vitest.config.mts")), C("src/demo.test.ts", Ke("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), S("package.json", D((e) => or(e)), () => {
1733
- sr();
1784
+ function br() {
1785
+ b("test", () => {
1786
+ C("tsconfig.json", O("test/tsconfig.json")), C(".oxlintrc.json", O("test/.oxlintrc.json")), C(".oxfmtrc.json", O("test/.oxfmtrc.json")), T("vitest.config.mts", O("test/vitest.config.mts")), E("src/demo.test.ts", Ge("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), w("package.json", A((e) => vr(e)), () => {
1787
+ yr();
1734
1788
  });
1735
1789
  });
1736
1790
  }
1737
1791
  //#endregion
1738
1792
  //#region src/structure/rules/software-package-json.ts
1739
- function lr() {
1793
+ function xr() {
1740
1794
  return { entrypoints: { main: { binary: {
1741
1795
  artifact: {
1742
1796
  type: "python",
@@ -1751,10 +1805,10 @@ function lr() {
1751
1805
  cmd: ["python", "{pkg}/main.py"]
1752
1806
  } } } };
1753
1807
  }
1754
- function ur(e) {
1808
+ function Sr(e) {
1755
1809
  return {
1756
1810
  name: `${e.blockVars.facadeName}.software`,
1757
- version: "1.0.0",
1811
+ private: !0,
1758
1812
  type: "module",
1759
1813
  description: "Block Software",
1760
1814
  files: ["./dist/**/*"],
@@ -1764,56 +1818,56 @@ function ur(e) {
1764
1818
  changeset: "changeset",
1765
1819
  "version-packages": "changeset version"
1766
1820
  },
1767
- "block-software": lr(),
1821
+ "block-software": xr(),
1768
1822
  devDependencies: {
1769
1823
  "@platforma-open/milaboratories.runenv-python-3": "catalog:",
1770
1824
  "@platforma-sdk/package-builder": "sdk:"
1771
1825
  }
1772
1826
  };
1773
1827
  }
1774
- function dr() {
1775
- P("type", "module"), P("files", ["./dist/**/*"]), F("build", "pl-pkg build"), F("prepublishOnly", "pl-pkg prepublish"), F("changeset", "changeset"), F("version-packages", "changeset version"), V({
1828
+ function Cr() {
1829
+ L("private", !0), L("type", "module"), L("files", ["./dist/**/*"]), R("build", "pl-pkg build"), R("prepublishOnly", "pl-pkg prepublish"), R("changeset", "changeset"), R("version-packages", "changeset version"), W({
1776
1830
  "@platforma-open/milaboratories.runenv-python-3": "catalog:",
1777
1831
  "@platforma-sdk/package-builder": "sdk:"
1778
- }), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1832
+ }), q("dependencies"), q("devDependencies"), q("peerDependencies"), q("optionalDependencies"), K([...X]);
1779
1833
  }
1780
1834
  //#endregion
1781
1835
  //#region src/structure/rules/software.ts
1782
- var fr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", pr = "# No dependencies specified for this script\n";
1783
- function mr() {
1784
- v("software", () => {
1785
- C("src/main.py", Ke(fr)), C("src/requirements.txt", Ke(pr)), S("package.json", D((e) => ur(e)), () => {
1786
- dr();
1836
+ var wr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", Tr = "# No dependencies specified for this script\n";
1837
+ function Er() {
1838
+ b("software", () => {
1839
+ E("src/main.py", Ge(wr)), E("src/requirements.txt", Ge(Tr)), w("package.json", A((e) => Sr(e)), () => {
1840
+ Cr();
1787
1841
  });
1788
1842
  });
1789
1843
  }
1790
- function hr() {
1791
- v("model", () => {
1792
- w("eslint.config.mjs"), w("vite.config.mts");
1793
- }), v("ui", () => {
1794
- w("eslint.config.mjs"), w("vite.config.ts"), w("tsconfig.app.json"), w("tsconfig.node.json");
1795
- }), v("test", () => {
1796
- w("eslint.config.mjs");
1797
- }), v("root", () => {
1798
- w(".prettierrc"), S("package.json", D((e) => vn(e)), () => {
1799
- I("pretty"), B("@platforma-sdk/blocks-deps-updater");
1844
+ function Dr() {
1845
+ b("model", () => {
1846
+ D("eslint.config.mjs"), D("vite.config.mts");
1847
+ }), b("ui", () => {
1848
+ D("eslint.config.mjs"), D("vite.config.ts"), D("tsconfig.app.json"), D("tsconfig.node.json");
1849
+ }), b("test", () => {
1850
+ D("eslint.config.mjs");
1851
+ }), b("root", () => {
1852
+ D(".prettierrc"), w("package.json", A((e) => xn(e)), () => {
1853
+ z("pretty"), U("@platforma-sdk/blocks-deps-updater");
1800
1854
  });
1801
1855
  });
1802
1856
  }
1803
1857
  //#endregion
1804
1858
  //#region src/structure/rules/root-catalog-bump.ts
1805
- function gr() {
1859
+ function Or() {
1806
1860
  Ue(() => {
1807
- v("root", () => {
1808
- y(({ ctx: e }) => !e.isSdkInternal, () => {
1809
- S("pnpm-workspace.yaml", D((e) => zn(e)), (e) => {
1810
- for (let e of Z) kt(e);
1811
- for (let e of In) At(e.entry, {
1861
+ b("root", () => {
1862
+ x(({ ctx: e }) => !e.isSdkInternal, () => {
1863
+ w("pnpm-workspace.yaml", A((e) => Un(e)), (e) => {
1864
+ for (let e of Z) jt(e);
1865
+ for (let e of Bn) Mt(e.entry, {
1812
1866
  of: e.of,
1813
1867
  ofVersion: e.ofVersion
1814
1868
  });
1815
- for (let [e, t] of Object.entries(Fn)) Ot(e, t);
1816
- e.modules.some((e) => e.scope === "software") && Ot(Ln, Rn);
1869
+ for (let [e, t] of Object.entries(zn)) At(e, t);
1870
+ e.modules.some((e) => e.scope === "software") && At(Vn, Hn);
1817
1871
  });
1818
1872
  });
1819
1873
  });
@@ -1821,25 +1875,25 @@ function gr() {
1821
1875
  }
1822
1876
  //#endregion
1823
1877
  //#region src/structure/structure-definition.ts
1824
- var _r = Ie(() => {
1825
- Un(), Gn(), Xn(), $n(), nr(), ar(), cr(), mr(), hr(), gr();
1878
+ var kr = Ie(() => {
1879
+ qn(), Yn(), cr(), dr(), mr(), _r(), br(), Er(), Dr(), Or();
1826
1880
  });
1827
1881
  //#endregion
1828
1882
  //#region src/structure/cli/run-structure.ts
1829
- async function vr() {
1830
- return An(Z.filter(kn));
1883
+ async function Ar() {
1884
+ return Nn(Z.filter(Mn));
1831
1885
  }
1832
- async function yr(e) {
1833
- let t = f.resolve(e.blockPath), n = e.mode === "check", r = new xe(t), i = new Se(e.templatesRoot), a = Qt(_r, r, _n({
1886
+ async function jr(e) {
1887
+ let t = m.resolve(e.blockPath), n = e.mode === "check", r = new xe(t), i = new Se(e.templatesRoot), a = en(kr, r, bn({
1834
1888
  fs: r,
1835
1889
  isSdkInternal: e.isSdkInternal,
1836
1890
  updateDepsOnly: e.updateDepsOnly,
1837
1891
  dryRun: n
1838
1892
  }), {
1839
1893
  templates: i,
1840
- registryLookup: e.updateDepsOnly ? await vr() : void 0,
1841
- derivedPinLookup: e.updateDepsOnly ? await Mn(In) : void 0,
1842
- rediscover: () => _n({
1894
+ registryLookup: e.updateDepsOnly ? await Ar() : void 0,
1895
+ derivedPinLookup: e.updateDepsOnly ? await Fn(Bn) : void 0,
1896
+ rediscover: () => bn({
1843
1897
  fs: r,
1844
1898
  isSdkInternal: e.isSdkInternal,
1845
1899
  updateDepsOnly: !1,
@@ -1851,16 +1905,16 @@ async function yr(e) {
1851
1905
  changes: a.changes
1852
1906
  };
1853
1907
  }
1854
- function br(e, t) {
1908
+ function Mr(e, t) {
1855
1909
  if (t.length === 0) return ` ${e}: up to date (0 changes)`;
1856
1910
  let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
1857
1911
  return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
1858
1912
  }
1859
1913
  //#endregion
1860
1914
  //#region src/cmd/structure/refresh.ts
1861
- async function xr(e) {
1915
+ async function Nr(e) {
1862
1916
  for (let t of e.paths) {
1863
- let n = await yr({
1917
+ let n = await jr({
1864
1918
  blockPath: t,
1865
1919
  isSdkInternal: e.isSdkInternal,
1866
1920
  updateDepsOnly: e.updateDepsOnly,
@@ -1868,43 +1922,43 @@ async function xr(e) {
1868
1922
  templatesRoot: e.templatesRoot,
1869
1923
  log: (t) => e.logger.info(t)
1870
1924
  });
1871
- e.logger.info(br(t, n.changes));
1925
+ e.logger.info(Mr(t, n.changes));
1872
1926
  }
1873
1927
  }
1874
- function Sr(e) {
1875
- let t = new u("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).");
1928
+ function Pr(e) {
1929
+ let t = new f("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).");
1876
1930
  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) => {
1877
- let r = t.length > 0 ? t : ["."], i = f.join(e, "src", "structure", "templates");
1878
- await xr({
1931
+ let r = t.length > 0 ? t : ["."], i = m.join(e, "src", "structure", "templates");
1932
+ await Nr({
1879
1933
  paths: r,
1880
1934
  isSdkInternal: !!n.sdkInternal,
1881
1935
  updateDepsOnly: !!n.updateDepsOnly,
1882
1936
  templatesRoot: i,
1883
- logger: new m()
1937
+ logger: new g()
1884
1938
  });
1885
1939
  }), t;
1886
1940
  }
1887
1941
  //#endregion
1888
1942
  //#region src/cmd/update-deps.ts
1889
- function Cr(e) {
1890
- let t = new u("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
1943
+ function Fr(e) {
1944
+ let t = new f("update-deps").description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");
1891
1945
  return t.action(async () => {
1892
- let t = new m();
1893
- 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 xr({
1946
+ let t = new g();
1947
+ 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 Nr({
1894
1948
  paths: ["."],
1895
1949
  isSdkInternal: !1,
1896
1950
  updateDepsOnly: !0,
1897
- templatesRoot: f.join(e, "src", "structure", "templates"),
1951
+ templatesRoot: m.join(e, "src", "structure", "templates"),
1898
1952
  logger: t
1899
1953
  });
1900
1954
  }), t;
1901
1955
  }
1902
1956
  //#endregion
1903
1957
  //#region src/cmd/list-overview-snapshots.ts
1904
- function wr() {
1905
- let e = new u("list-overview-snapshots").description("List all available global overview snapshots in the registry");
1906
- return e.addOption(new d("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
1907
- let t = new m(), n = await new o(i(e.registry), t).listGlobalOverviewSnapshots();
1958
+ function Ir() {
1959
+ let e = new f("list-overview-snapshots").description("List all available global overview snapshots in the registry");
1960
+ return e.addOption(new p("-r, --registry <address>", "full address of the registry").env("PL_REGISTRY").makeOptionMandatory()), e.option("--json", "output in JSON format", !1), e.action(async (e) => {
1961
+ let t = new g(), n = await new s(o(e.registry), t).listGlobalOverviewSnapshots();
1908
1962
  if (e.json) t.info(JSON.stringify(n, null, 2));
1909
1963
  else if (n.length === 0) t.info("No snapshots found.");
1910
1964
  else {
@@ -1915,10 +1969,10 @@ function wr() {
1915
1969
  }
1916
1970
  //#endregion
1917
1971
  //#region src/cmd/restore-overview-from-snapshot.ts
1918
- function Tr() {
1919
- let e = new u("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
1920
- return e.addOption(new d("-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) => {
1921
- let t = new m(), n = new o(i(e.registry), t), r = await n.listGlobalOverviewSnapshots();
1972
+ function Lr() {
1973
+ let e = new f("restore-overview-from-snapshot").description("Restore global overview from a snapshot");
1974
+ return e.addOption(new p("-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) => {
1975
+ let t = new g(), n = new s(o(e.registry), t), r = await n.listGlobalOverviewSnapshots();
1922
1976
  if (!r.find((t) => t.timestamp === e.snapshot)) throw Error(`Snapshot '${e.snapshot}' not found. Available snapshots:\n${r.map((e) => ` - ${e.timestamp}`).join("\n") || " (none)"}`);
1923
1977
  if (!e.skipConfirmation) {
1924
1978
  let n = (await import("node:readline")).createInterface({
@@ -1941,7 +1995,7 @@ function Tr() {
1941
1995
  }
1942
1996
  //#endregion
1943
1997
  //#region src/registry_v1/flags.ts
1944
- function Er(e) {
1998
+ function Rr(e) {
1945
1999
  let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
1946
2000
  if (t) {
1947
2001
  let { src: e, destName: n } = t.groups;
@@ -1951,33 +2005,33 @@ function Er(e) {
1951
2005
  };
1952
2006
  } else return {
1953
2007
  src: e,
1954
- destName: f.basename(e)
2008
+ destName: m.basename(e)
1955
2009
  };
1956
2010
  }
1957
- function Dr(e, t) {
1958
- return new d(e, t).argParser((e, t) => [...t ?? [], Er(e)]).default([]);
2011
+ function zr(e, t) {
2012
+ return new p(e, t).argParser((e, t) => [...t ?? [], Rr(e)]).default([]);
1959
2013
  }
1960
2014
  //#endregion
1961
2015
  //#region src/cmd/upload-package-v1.ts
1962
- var Or = [
2016
+ var Br = [
1963
2017
  "registry",
1964
2018
  "organization",
1965
2019
  "package",
1966
2020
  "version"
1967
2021
  ];
1968
- function kr() {
1969
- let e = new u("upload-package-v1").description("Uploads V1 package and refreshes the registry");
1970
- return e.addOption(new d("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new d("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new d("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new d("-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(Dr("-f, --file <file>", "package files")), e.addOption(new d("--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) => {
1971
- let t = new m(), n = l.parse({});
1972
- for (let t of Or) e[t] && (n[t] = e[t]);
1973
- e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await p.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = ae.parse(await p.promises.readFile(e.meta, { encoding: "utf-8" }))));
2022
+ function Vr() {
2023
+ let e = new f("upload-package-v1").description("Uploads V1 package and refreshes the registry");
2024
+ return e.addOption(new p("-r, --registry <address|alias>", "full address of the registry or alias from .pl.reg").env("PL_REGISTRY")), e.addOption(new p("-o, --organization <organization>", "target organisation").env("PL_PACKAGE_ORGANIZATION")), e.addOption(new p("-p, --package <package>", "target package").env("PL_PACKAGE_NAME")), e.addOption(new p("-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(zr("-f, --file <file>", "package files")), e.addOption(new p("--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) => {
2025
+ let t = new g(), n = l.parse({});
2026
+ for (let t of Br) e[t] && (n[t] = e[t]);
2027
+ e.meta && (e.meta.endsWith(".json") ? n.meta = JSON.parse(await h.promises.readFile(e.meta, { encoding: "utf-8" })) : e.meta.endsWith(".yaml") && (n.meta = ae.parse(await h.promises.readFile(e.meta, { encoding: "utf-8" }))));
1974
2028
  for (let t of e.file) n.files[t.destName] = t.src;
1975
2029
  let r = await c(n);
1976
2030
  t.info(ae.stringify(r.conf));
1977
2031
  let i = r.createRegistry(t), a = r.fullPackageName, o = i.constructNewPackage(a);
1978
2032
  for (let [e, n] of Object.entries(r.conf.files)) {
1979
2033
  t.info(`Uploading ${n} -> ${e} ...`);
1980
- let r = await p.promises.readFile(n);
2034
+ let r = await h.promises.readFile(n);
1981
2035
  await o.addFile(e, r);
1982
2036
  }
1983
2037
  t.info("Uploading meta information..."), await o.writeMeta(r.conf.meta), await o.finish(), e.refresh && await i.updateIfNeeded();
@@ -1985,12 +2039,12 @@ function kr() {
1985
2039
  }
1986
2040
  //#endregion
1987
2041
  //#region src/cmd/structure/check.ts
1988
- function Ar(e) {
1989
- let t = new u("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
2042
+ function Hr(e) {
2043
+ let t = new f("check").description("Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.");
1990
2044
  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) => {
1991
- let r = new m(), i = t.length > 0 ? t : ["."], a = f.join(e, "src", "structure", "templates"), o = !1;
2045
+ let r = new g(), i = t.length > 0 ? t : ["."], a = m.join(e, "src", "structure", "templates"), o = !1;
1992
2046
  for (let e of i) {
1993
- let t = await yr({
2047
+ let t = await jr({
1994
2048
  blockPath: e,
1995
2049
  isSdkInternal: !!n.sdkInternal,
1996
2050
  updateDepsOnly: !1,
@@ -1998,35 +2052,35 @@ function Ar(e) {
1998
2052
  templatesRoot: a,
1999
2053
  log: (e) => r.info(e)
2000
2054
  });
2001
- r.info(br(e, t.changes)), t.changes.length > 0 && (o = !0);
2055
+ r.info(Mr(e, t.changes)), t.changes.length > 0 && (o = !0);
2002
2056
  }
2003
2057
  if (o) throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.");
2004
2058
  }), t;
2005
2059
  }
2006
2060
  //#endregion
2007
2061
  //#region src/structure/init-block-constructor.ts
2008
- var $ = ["python"], jr = class extends Error {
2062
+ var $ = ["python"], Ur = class extends Error {
2009
2063
  constructor(e) {
2010
2064
  super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
2011
2065
  }
2012
2066
  };
2013
- async function Mr(e, t, n, r) {
2067
+ async function Wr(e, t, n, r) {
2014
2068
  if (e !== void 0 && e !== "") return e;
2015
- if (n) throw new jr(t);
2069
+ if (n) throw new Ur(t);
2016
2070
  return r();
2017
2071
  }
2018
- async function Nr(e) {
2019
- let t = await Mr(e.npmOrg, "npm-org", e.nonInteractive, () => de({
2072
+ async function Gr(e) {
2073
+ let t = await Wr(e.npmOrg, "npm-org", e.nonInteractive, () => de({
2020
2074
  message: "npm org (e.g. @platforma-open):",
2021
2075
  default: "@platforma-open"
2022
- })), n = await Mr(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await Mr(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2076
+ })), n = await Wr(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await Wr(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2023
2077
  i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
2024
2078
  message: "Include a software module?",
2025
2079
  default: !1
2026
2080
  }) : e.withSoftware;
2027
2081
  let a;
2028
2082
  if (i) {
2029
- if (a = await Mr(e.platform, "platform", e.nonInteractive, () => fe({
2083
+ if (a = await Wr(e.platform, "platform", e.nonInteractive, () => fe({
2030
2084
  message: "Software platform:",
2031
2085
  choices: $.map((e) => ({
2032
2086
  name: e,
@@ -2043,20 +2097,20 @@ async function Nr(e) {
2043
2097
  softwarePlatform: a
2044
2098
  };
2045
2099
  }
2046
- async function Pr(e) {
2047
- let t = e.vars, n = cn(t), r = new xe(e.blockPath), i = new Se(e.templatesRoot), a = ln({
2100
+ async function Kr(e) {
2101
+ let t = e.vars, n = dn(t), r = new xe(e.blockPath), i = new Se(e.templatesRoot), a = fn({
2048
2102
  blockVars: t,
2049
2103
  modules: n,
2050
2104
  isSdkInternal: !1,
2051
2105
  version: 1,
2052
2106
  dryRun: !1
2053
- }), o = Z.filter(kn), s, c;
2107
+ }), o = Z.filter(Mn), s, c;
2054
2108
  try {
2055
- s = await An(o), c = await Mn(In);
2109
+ s = await Nn(o), c = await Fn(Bn);
2056
2110
  } catch (e) {
2057
2111
  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)}`);
2058
2112
  }
2059
- return Qt(_r, r, a, {
2113
+ return en(kr, r, a, {
2060
2114
  templates: i,
2061
2115
  initMode: !0,
2062
2116
  registryLookup: s,
@@ -2065,12 +2119,12 @@ async function Pr(e) {
2065
2119
  }
2066
2120
  //#endregion
2067
2121
  //#region src/cmd/structure/init.ts
2068
- function Fr(e) {
2069
- let t = new u("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
2070
- 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 d("--platform <platform>", "software platform (single-valued)").choices([...$])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
2071
- let r = new m(), i = n.withSoftware === !0, a = n.software === !1;
2122
+ function qr(e) {
2123
+ let t = new f("init").description("Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.");
2124
+ 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 p("--platform <platform>", "software platform (single-valued)").choices([...$])), t.option("--non-interactive", "error on any missing flag instead of prompting"), t.action(async (t, n) => {
2125
+ let r = new g(), i = n.withSoftware === !0, a = n.software === !1;
2072
2126
  if (i && a) throw Error("--with-software and --no-software are mutually exclusive.");
2073
- let o = i ? !0 : a ? !1 : void 0, s = await Nr({
2127
+ let o = i ? !0 : a ? !1 : void 0, s = await Gr({
2074
2128
  npmOrg: n.npmOrg,
2075
2129
  orgScope: n.orgScope,
2076
2130
  shortName: n.shortName,
@@ -2078,26 +2132,26 @@ function Fr(e) {
2078
2132
  platform: n.platform,
2079
2133
  nonInteractive: n.nonInteractive
2080
2134
  });
2081
- await Pr({
2135
+ await Kr({
2082
2136
  vars: s,
2083
- blockPath: t ? f.resolve(t) : f.resolve(process.cwd(), s.shortName),
2084
- templatesRoot: f.join(e, "src", "structure", "templates"),
2137
+ blockPath: t ? m.resolve(t) : m.resolve(process.cwd(), s.shortName),
2138
+ templatesRoot: m.join(e, "src", "structure", "templates"),
2085
2139
  log: (e) => r.info(e)
2086
2140
  });
2087
2141
  }), t;
2088
2142
  }
2089
2143
  //#endregion
2090
2144
  //#region src/cli.ts
2091
- function Ir(e = process.cwd()) {
2092
- let t = new u();
2093
- t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(pe()), t.addCommand(he()), t.addCommand(ge()), t.addCommand(ve()), t.addCommand(ye()), t.addCommand(be()), t.addCommand(Cr(e)), t.addCommand(wr()), t.addCommand(Tr()), t.addCommand(kr());
2094
- let n = new u("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
2095
- return n.addCommand(Ar(e)), n.addCommand(Fr(e)), n.addCommand(Sr(e)), t.addCommand(n), t;
2145
+ function Jr(e = process.cwd()) {
2146
+ let t = new f();
2147
+ t.name("block-tools").description("Utility to manipulate Platforma Blocks and Block Registry"), t.addCommand(pe()), t.addCommand(he()), t.addCommand(ge()), t.addCommand(ve()), t.addCommand(ye()), t.addCommand(be()), t.addCommand(Fr(e)), t.addCommand(Ir()), t.addCommand(Lr()), t.addCommand(Vr());
2148
+ let n = new f("structure").description("Manage block scaffolding against the canonical structure (check / init / refresh)");
2149
+ return n.addCommand(Hr(e)), n.addCommand(qr(e)), n.addCommand(Pr(e)), t.addCommand(n), t;
2096
2150
  }
2097
- async function Lr(e, t) {
2098
- await Ir(t).parseAsync(e);
2151
+ async function Yr(e, t) {
2152
+ await Jr(t).parseAsync(e);
2099
2153
  }
2100
2154
  //#endregion
2101
- export { Ir as buildProgram, Lr as run };
2155
+ export { Jr as buildProgram, Yr as run };
2102
2156
 
2103
2157
  //# sourceMappingURL=cli.mjs.map