@platforma-sdk/block-tools 2.10.17 → 2.10.19

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 (36) hide show
  1. package/dist/cli.js +13 -13
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +674 -615
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/structure/engine/api.d.ts +1 -1
  6. package/dist/structure/engine/content-rules.d.ts +17 -0
  7. package/dist/structure/engine/registry-client.d.ts +30 -2
  8. package/dist/structure/engine/runner.d.ts +6 -0
  9. package/dist/structure/rules/root-pnpm-workspace.d.ts +13 -0
  10. package/dist/structure/rules/shared/retired-deps.d.ts +7 -0
  11. package/dist/v2/registry/schema_public.d.ts +6177 -6177
  12. package/package.json +8 -8
  13. package/src/structure/CLAUDE.md +28 -0
  14. package/src/structure/__tests__/model-package-json.snapshot.test.ts +1 -2
  15. package/src/structure/cli/run-structure.ts +12 -2
  16. package/src/structure/engine/__tests__/content-rules/pin-catalog-to-dependency-of.test.ts +65 -0
  17. package/src/structure/engine/__tests__/derived-pin-lookup.test.ts +54 -0
  18. package/src/structure/engine/api.ts +1 -0
  19. package/src/structure/engine/content-rules.ts +29 -0
  20. package/src/structure/engine/registry-client.ts +116 -2
  21. package/src/structure/engine/runner.ts +18 -2
  22. package/src/structure/init-block-constructor.ts +16 -3
  23. package/src/structure/rules/migrations.ts +15 -16
  24. package/src/structure/rules/model-package-json.ts +34 -16
  25. package/src/structure/rules/root-catalog-bump.ts +12 -1
  26. package/src/structure/rules/root-package-json.ts +15 -11
  27. package/src/structure/rules/root-pnpm-workspace.ts +21 -8
  28. package/src/structure/rules/root.ts +0 -1
  29. package/src/structure/rules/shared/retired-deps.ts +42 -0
  30. package/src/structure/rules/test-package-json.ts +12 -9
  31. package/src/structure/rules/test.ts +4 -0
  32. package/src/structure/rules/ui-package-json.ts +33 -25
  33. package/src/structure/rules/workflow-package-json.ts +32 -14
  34. package/src/structure/rules/workflow.ts +32 -8
  35. package/src/structure/templates/static/test/.oxfmtrc.json +4 -0
  36. package/src/structure/templates/static/test/.oxlintrc.json +3 -0
package/dist/cli.mjs CHANGED
@@ -1,23 +1,23 @@
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 ee, rt as l } from "./config-DpfTzcgG.mjs";
2
- import { Args as te, Command as u, Flags as d } from "@oclif/core";
3
- import f from "node:path";
4
- import p from "node:fs";
5
- import { BlockPackManifest as ne, StableChannel as re, overrideDescriptionVersion as ie, overrideManifestVersion as ae } from "@milaboratories/pl-model-middle-layer";
6
- import { OclifLoggerAdapter as m } from "@milaboratories/ts-helpers-oclif";
7
- import oe, { parse as se, parseDocument as ce, stringify as le } from "yaml";
8
- import { setTimeout as ue } from "node:timers/promises";
9
- import { confirm as de, input as fe, select as pe } from "@inquirer/prompts";
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 { Args as u, Command as d, Flags as f } from "@oclif/core";
3
+ import p from "node:path";
4
+ import m from "node:fs";
5
+ import { BlockPackManifest as te, StableChannel as ne, overrideDescriptionVersion as re, overrideManifestVersion as ie } from "@milaboratories/pl-model-middle-layer";
6
+ import { OclifLoggerAdapter as h } from "@milaboratories/ts-helpers-oclif";
7
+ import ae, { parse as oe, parseDocument as se, stringify as ce } from "yaml";
8
+ import { setTimeout as le } from "node:timers/promises";
9
+ import { confirm as ue, input as de, select as fe } from "@inquirer/prompts";
10
10
  //#region src/cmd/build-meta.ts
11
- var me = class e extends u {
11
+ var pe = class e extends d {
12
12
  static 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
  static flags = {
14
- modulePath: d.string({
14
+ modulePath: f.string({
15
15
  char: "i",
16
16
  summary: "input module path",
17
17
  helpValue: "<path>",
18
18
  default: "."
19
19
  }),
20
- destination: d.string({
20
+ destination: f.string({
21
21
  char: "o",
22
22
  summary: "output meta.json file",
23
23
  helpValue: "<path>",
@@ -25,36 +25,36 @@ var me = class e extends u {
25
25
  })
26
26
  };
27
27
  async run() {
28
- let { flags: t } = await this.parse(e), n = f.resolve(t.modulePath), i = await s(await l((await r(n)).meta, n));
29
- await p.promises.writeFile(f.resolve(t.destination), JSON.stringify(i));
28
+ let { flags: t } = await this.parse(e), n = p.resolve(t.modulePath), i = await s(await ee((await r(n)).meta, n));
29
+ await m.promises.writeFile(p.resolve(t.destination), JSON.stringify(i));
30
30
  }
31
31
  };
32
32
  //#endregion
33
33
  //#region src/cmd/build-model.ts
34
- async function he(e) {
34
+ async function me(e) {
35
35
  try {
36
- return await p.promises.readFile(e, "utf8");
36
+ return await m.promises.readFile(e, "utf8");
37
37
  } catch (e) {
38
38
  if (e instanceof Error && "code" in e && e.code === "ENOENT") return;
39
39
  throw e;
40
40
  }
41
41
  }
42
- var ge = class e extends u {
42
+ var he = class e extends d {
43
43
  static description = "Extracts and outputs block model JSON from pre-built block model module";
44
44
  static flags = {
45
- modulePath: d.string({
45
+ modulePath: f.string({
46
46
  char: "i",
47
47
  summary: "input module path",
48
48
  helpValue: "<path>",
49
49
  default: "."
50
50
  }),
51
- sourceBundle: d.string({
51
+ sourceBundle: f.string({
52
52
  char: "b",
53
53
  summary: "bundled model code to embed into the model for callback-based rendering to work",
54
54
  helpValue: "<path>",
55
55
  default: "./dist/bundle.js"
56
56
  }),
57
- destination: d.string({
57
+ destination: f.string({
58
58
  char: "o",
59
59
  summary: "output model file",
60
60
  helpValue: "<path>",
@@ -62,34 +62,34 @@ var ge = class e extends u {
62
62
  })
63
63
  };
64
64
  async run() {
65
- let { flags: t } = await this.parse(e), { model: n, platforma: r } = a(f.resolve(t.modulePath));
65
+ let { flags: t } = await this.parse(e), { model: n, platforma: r } = a(p.resolve(t.modulePath));
66
66
  if (n ||= r, !n) throw Error("\"model\" export not found");
67
67
  let { config: i } = n;
68
68
  if (!i) throw Error("Malformed \"model\" object, check it is created with \"BlockModel\" and \".done()\" is executed as the call in the chain.");
69
69
  if (!("outputs" in i) || !("sections" in i)) throw Error("\"config\" has unexpected structure");
70
- let o = await he(t.sourceBundle);
70
+ let o = await me(t.sourceBundle);
71
71
  o !== void 0 && (i.code = {
72
72
  type: "plain",
73
73
  content: o
74
- }), await p.promises.writeFile(f.resolve(t.destination), JSON.stringify(i));
74
+ }), await m.promises.writeFile(p.resolve(t.destination), JSON.stringify(i));
75
75
  }
76
- }, _e = class e extends u {
76
+ }, ge = class e extends d {
77
77
  static description = "List all available global overview snapshots in the registry";
78
78
  static flags = {
79
- registry: d.string({
79
+ registry: f.string({
80
80
  char: "r",
81
81
  summary: "full address of the registry",
82
82
  helpValue: "<address>",
83
83
  env: "PL_REGISTRY",
84
84
  required: !0
85
85
  }),
86
- json: d.boolean({
86
+ json: f.boolean({
87
87
  summary: "output in JSON format",
88
88
  default: !1
89
89
  })
90
90
  };
91
91
  async run() {
92
- let { flags: t } = await this.parse(e), n = await new o(i(t.registry), new m(this)).listGlobalOverviewSnapshots();
92
+ let { flags: t } = await this.parse(e), n = await new o(i(t.registry), new h(this)).listGlobalOverviewSnapshots();
93
93
  if (t.json) this.log(JSON.stringify(n, null, 2));
94
94
  else if (n.length === 0) this.log("No snapshots found.");
95
95
  else {
@@ -97,60 +97,60 @@ var ge = class e extends u {
97
97
  for (let e of n) this.log(` ${e.timestamp}`), this.log(` Path: ${e.path}`), this.log("");
98
98
  }
99
99
  }
100
- }, ve = class e extends u {
100
+ }, _e = class e extends d {
101
101
  static description = "Mark target block stable";
102
102
  static flags = {
103
- modulePath: d.string({
103
+ modulePath: f.string({
104
104
  char: "i",
105
105
  summary: "input module path",
106
106
  helpValue: "<path>",
107
107
  default: "."
108
108
  }),
109
- channel: d.string({
109
+ channel: f.string({
110
110
  char: "c",
111
111
  hidden: !0,
112
112
  summary: "custom channel",
113
113
  helpValue: "<channel name>",
114
- default: re
114
+ default: ne
115
115
  }),
116
- "version-override": d.file({
116
+ "version-override": f.file({
117
117
  char: "v",
118
118
  summary: "override package version"
119
119
  }),
120
- registry: d.string({
120
+ registry: f.string({
121
121
  char: "r",
122
122
  summary: "full address of the registry",
123
123
  helpValue: "<address>",
124
124
  env: "PL_REGISTRY",
125
125
  required: !0
126
126
  }),
127
- refresh: d.boolean({
127
+ refresh: f.boolean({
128
128
  summary: "refresh repository after adding the package",
129
129
  default: !0,
130
130
  allowNo: !0,
131
131
  env: "PL_REGISTRY_REFRESH"
132
132
  }),
133
- unmark: d.boolean({
133
+ unmark: f.boolean({
134
134
  summary: "reverses meaning of this command, flag can be used to remove \"stable\" flag from the package",
135
135
  default: !1
136
136
  })
137
137
  };
138
138
  async run() {
139
- let { flags: t } = await this.parse(e), n = await r(f.resolve(t.modulePath));
140
- t["version-override"] && (n = ie(n, t["version-override"]));
141
- let a = new o(i(t.registry), new m(this));
139
+ let { flags: t } = await this.parse(e), n = await r(p.resolve(t.modulePath));
140
+ t["version-override"] && (n = re(n, t["version-override"]));
141
+ let a = new o(i(t.registry), new h(this));
142
142
  t.unmark ? await a.removePackageFromChannel(n.id, t.channel) : await a.addPackageToChannel(n.id, t.channel), t.refresh && await a.updateIfNeeded();
143
143
  }
144
- }, ye = class n extends u {
144
+ }, ve = class n extends d {
145
145
  static description = "Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder";
146
146
  static flags = {
147
- modulePath: d.string({
147
+ modulePath: f.string({
148
148
  char: "i",
149
149
  summary: "input module path",
150
150
  helpValue: "<path>",
151
151
  default: "."
152
152
  }),
153
- destinationPath: d.string({
153
+ destinationPath: f.string({
154
154
  char: "o",
155
155
  summary: "output folder",
156
156
  helpValue: "<path>",
@@ -159,67 +159,67 @@ var ge = class e extends u {
159
159
  };
160
160
  async run() {
161
161
  let { flags: r } = await this.parse(n);
162
- await t(await e(f.resolve(r.modulePath)), f.resolve(r.destinationPath));
162
+ await t(await e(p.resolve(r.modulePath)), p.resolve(r.destinationPath));
163
163
  }
164
164
  };
165
165
  //#endregion
166
166
  //#region src/cmd/publish.ts
167
- function be(e, t) {
167
+ function ye(e, t) {
168
168
  let n = { ...e };
169
- for (let e in t) t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ? n[e] = be(n[e], t[e]) : n[e] = t[e];
169
+ for (let e in t) t[e] && typeof t[e] == "object" && !Array.isArray(t[e]) && n[e] && typeof n[e] == "object" && !Array.isArray(n[e]) ? n[e] = ye(n[e], t[e]) : n[e] = t[e];
170
170
  return n;
171
171
  }
172
- var xe = class e extends u {
172
+ var be = class e extends d {
173
173
  static description = "Publishes the block package and refreshes the registry (for v2 block-pack schema)";
174
174
  static flags = {
175
- registry: d.string({
175
+ registry: f.string({
176
176
  char: "r",
177
177
  summary: "full address of the registry",
178
178
  helpValue: "<address>",
179
179
  env: "PL_REGISTRY",
180
180
  required: !0
181
181
  }),
182
- manifest: d.file({
182
+ manifest: f.file({
183
183
  char: "m",
184
184
  summary: "manifest file path",
185
185
  exists: !0,
186
186
  default: `./block-pack/${n}`
187
187
  }),
188
- "version-override": d.file({
188
+ "version-override": f.file({
189
189
  char: "v",
190
190
  summary: "override package version"
191
191
  }),
192
- refresh: d.boolean({
192
+ refresh: f.boolean({
193
193
  summary: "refresh repository after adding the package",
194
194
  default: !0,
195
195
  allowNo: !0,
196
196
  env: "PL_REGISTRY_REFRESH"
197
197
  }),
198
- unstable: d.boolean({
198
+ unstable: f.boolean({
199
199
  summary: "do not add the published package to stable channel",
200
200
  default: !1,
201
201
  env: "PL_PUBLISH_UNSTABLE"
202
202
  })
203
203
  };
204
204
  async run() {
205
- let { flags: t } = await this.parse(e), n = f.resolve(t.manifest), r = JSON.parse(await p.promises.readFile(n, { encoding: "utf-8" })), a = ne.parse(r);
206
- a = be(r, a);
207
- let s = f.dirname(n);
208
- this.log(`Manifest root = ${s}`), t["version-override"] && (a = ae(a, t["version-override"]));
209
- let c = new o(i(t.registry), new m(this));
210
- await c.publishPackage(a, async (e) => Buffer.from(await p.promises.readFile(f.resolve(s, e)))), t.unstable || (this.log(`Adding package to ${re} channel...`), await c.addPackageToChannel(a.description.id, re)), t.refresh && await c.updateIfNeeded();
211
- }
212
- }, Se = class e extends u {
205
+ let { flags: t } = await this.parse(e), n = p.resolve(t.manifest), r = JSON.parse(await m.promises.readFile(n, { encoding: "utf-8" })), a = te.parse(r);
206
+ a = ye(r, a);
207
+ let s = p.dirname(n);
208
+ this.log(`Manifest root = ${s}`), t["version-override"] && (a = ie(a, t["version-override"]));
209
+ let c = new o(i(t.registry), new h(this));
210
+ await c.publishPackage(a, async (e) => Buffer.from(await m.promises.readFile(p.resolve(s, e)))), t.unstable || (this.log(`Adding package to ${ne} channel...`), await c.addPackageToChannel(a.description.id, ne)), t.refresh && await c.updateIfNeeded();
211
+ }
212
+ }, xe = class e extends d {
213
213
  static description = "Refresh overview files based on published but not proecessed artefacts";
214
214
  static flags = {
215
- registry: d.string({
215
+ registry: f.string({
216
216
  char: "r",
217
217
  summary: "full address of the registry",
218
218
  helpValue: "<address>",
219
219
  env: "PL_REGISTRY",
220
220
  required: !0
221
221
  }),
222
- mode: d.string({
222
+ mode: f.string({
223
223
  char: "m",
224
224
  summary: "refresh mode (allowed valiues: \"force\", \"normal\", \"dry-run\")",
225
225
  helpValue: "<mode>",
@@ -234,31 +234,31 @@ var xe = class e extends u {
234
234
  };
235
235
  async run() {
236
236
  let { flags: t } = await this.parse(e);
237
- await new o(i(t.registry), new m(this)).updateIfNeeded(t.mode);
237
+ await new o(i(t.registry), new h(this)).updateIfNeeded(t.mode);
238
238
  }
239
- }, Ce = class e extends u {
239
+ }, Se = class e extends d {
240
240
  static description = "Restore global overview from a snapshot";
241
241
  static flags = {
242
- registry: d.string({
242
+ registry: f.string({
243
243
  char: "r",
244
244
  summary: "full address of the registry",
245
245
  helpValue: "<address>",
246
246
  env: "PL_REGISTRY",
247
247
  required: !0
248
248
  }),
249
- snapshot: d.string({
249
+ snapshot: f.string({
250
250
  char: "s",
251
251
  summary: "snapshot timestamp ID to restore from",
252
252
  helpValue: "<timestamp>",
253
253
  required: !0
254
254
  }),
255
- "skip-confirmation": d.boolean({
255
+ "skip-confirmation": f.boolean({
256
256
  summary: "skip confirmation prompt (use with caution)",
257
257
  default: !1
258
258
  })
259
259
  };
260
260
  async run() {
261
- let { flags: t } = await this.parse(e), n = new o(i(t.registry), new m(this)), r = await n.listGlobalOverviewSnapshots();
261
+ let { flags: t } = await this.parse(e), n = new o(i(t.registry), new h(this)), r = await n.listGlobalOverviewSnapshots();
262
262
  if (r.find((e) => e.timestamp === t.snapshot) || this.error(`Snapshot '${t.snapshot}' not found. Available snapshots:\n${r.map((e) => ` - ${e.timestamp}`).join("\n") || " (none)"}`), !t["skip-confirmation"]) {
263
263
  let e = (await import("node:readline")).createInterface({
264
264
  input: process.stdin,
@@ -277,7 +277,7 @@ var xe = class e extends u {
277
277
  this.error(`Failed to restore from snapshot: ${String(e)}`);
278
278
  }
279
279
  }
280
- }, we = class extends u {
280
+ }, Ce = class extends d {
281
281
  static description = "[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.";
282
282
  static examples = ["<%= config.bin %> <%= command.id %>"];
283
283
  async run() {
@@ -286,7 +286,7 @@ var xe = class e extends u {
286
286
  };
287
287
  //#endregion
288
288
  //#region src/registry_v1/flags.ts
289
- function Te(e) {
289
+ function we(e) {
290
290
  let t = e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);
291
291
  if (t) {
292
292
  let { src: e, destName: n } = t.groups;
@@ -296,54 +296,54 @@ function Te(e) {
296
296
  };
297
297
  } else return {
298
298
  src: e,
299
- destName: f.basename(e)
299
+ destName: p.basename(e)
300
300
  };
301
301
  }
302
- var Ee = d.custom({
302
+ var Te = f.custom({
303
303
  summary: "target files to upload",
304
304
  helpValue: "file_path | package_name=file_path",
305
- parse: async (e) => Te(e)
306
- }), De = [
305
+ parse: async (e) => we(e)
306
+ }), Ee = [
307
307
  "registry",
308
308
  "organization",
309
309
  "package",
310
310
  "version"
311
- ], Oe = class e extends u {
311
+ ], De = class e extends d {
312
312
  static description = "Uploads V1 package and refreshes the registry";
313
313
  static flags = {
314
- registry: d.string({
314
+ registry: f.string({
315
315
  char: "r",
316
316
  summary: "full address of the registry or alias from .pl.reg",
317
317
  helpValue: "<address|alias>",
318
318
  env: "PL_REGISTRY"
319
319
  }),
320
- organization: d.string({
320
+ organization: f.string({
321
321
  char: "o",
322
322
  summary: "target organisation",
323
323
  env: "PL_PACKAGE_ORGANIZATION"
324
324
  }),
325
- package: d.string({
325
+ package: f.string({
326
326
  char: "p",
327
327
  summary: "target package",
328
328
  env: "PL_PACKAGE_NAME"
329
329
  }),
330
- version: d.string({
330
+ version: f.string({
331
331
  char: "v",
332
332
  summary: "target version",
333
333
  env: "PL_PACKAGE_VERSION"
334
334
  }),
335
- meta: d.file({
335
+ meta: f.file({
336
336
  char: "m",
337
337
  summary: "json file containing meta information to associate with tha package",
338
338
  exists: !0
339
339
  }),
340
- file: Ee({
340
+ file: Te({
341
341
  char: "f",
342
342
  summary: "package files",
343
343
  multiple: !0,
344
344
  default: []
345
345
  }),
346
- refresh: d.boolean({
346
+ refresh: f.boolean({
347
347
  summary: "refresh repository after adding the package",
348
348
  default: !0,
349
349
  allowNo: !0,
@@ -351,41 +351,41 @@ var Ee = d.custom({
351
351
  })
352
352
  };
353
353
  async run() {
354
- let { flags: t } = await this.parse(e), n = ee.parse({});
355
- for (let e of De) t[e] && (n[e] = t[e]);
356
- t.meta && (t.meta.endsWith(".json") ? n.meta = JSON.parse(await p.promises.readFile(t.meta, { encoding: "utf-8" })) : t.meta.endsWith(".yaml") && (n.meta = oe.parse(await p.promises.readFile(t.meta, { encoding: "utf-8" }))));
354
+ let { flags: t } = await this.parse(e), n = l.parse({});
355
+ for (let e of Ee) t[e] && (n[e] = t[e]);
356
+ t.meta && (t.meta.endsWith(".json") ? n.meta = JSON.parse(await m.promises.readFile(t.meta, { encoding: "utf-8" })) : t.meta.endsWith(".yaml") && (n.meta = ae.parse(await m.promises.readFile(t.meta, { encoding: "utf-8" }))));
357
357
  for (let e of t.file) n.files[e.destName] = e.src;
358
358
  let r = await c(n);
359
- this.log(oe.stringify(r.conf));
360
- let i = r.createRegistry(new m(this)), a = r.fullPackageName, o = i.constructNewPackage(a);
359
+ this.log(ae.stringify(r.conf));
360
+ let i = r.createRegistry(new h(this)), a = r.fullPackageName, o = i.constructNewPackage(a);
361
361
  for (let [e, t] of Object.entries(r.conf.files)) {
362
362
  this.log(`Uploading ${t} -> ${e} ...`);
363
- let n = await p.promises.readFile(t);
363
+ let n = await m.promises.readFile(t);
364
364
  await o.addFile(e, n);
365
365
  }
366
366
  this.log("Uploading meta information..."), await o.writeMeta(r.conf.meta), await o.finish(), t.refresh && await i.updateIfNeeded();
367
367
  }
368
- }, ke = class {
368
+ }, Oe = class {
369
369
  constructor(e) {
370
370
  this.root = e;
371
371
  }
372
372
  abs(e) {
373
- return f.resolve(this.root, e);
373
+ return p.resolve(this.root, e);
374
374
  }
375
375
  read(e) {
376
- return p.readFileSync(this.abs(e), "utf-8");
376
+ return m.readFileSync(this.abs(e), "utf-8");
377
377
  }
378
378
  write(e, t) {
379
379
  let n = this.abs(e);
380
- p.mkdirSync(f.dirname(n), { recursive: !0 }), p.writeFileSync(n, t, "utf-8");
380
+ m.mkdirSync(p.dirname(n), { recursive: !0 }), m.writeFileSync(n, t, "utf-8");
381
381
  }
382
382
  writeBinary(e, t) {
383
383
  let n = this.abs(e);
384
- p.mkdirSync(f.dirname(n), { recursive: !0 }), p.writeFileSync(n, t);
384
+ m.mkdirSync(p.dirname(n), { recursive: !0 }), m.writeFileSync(n, t);
385
385
  }
386
386
  exists(e) {
387
387
  try {
388
- return p.statSync(this.abs(e)), !0;
388
+ return m.statSync(this.abs(e)), !0;
389
389
  } catch {
390
390
  return !1;
391
391
  }
@@ -393,15 +393,15 @@ var Ee = d.custom({
393
393
  list(e) {
394
394
  let t = this.abs(e);
395
395
  try {
396
- if (!p.statSync(t).isDirectory()) return [];
396
+ if (!m.statSync(t).isDirectory()) return [];
397
397
  } catch {
398
398
  return [];
399
399
  }
400
400
  let n = [];
401
401
  function r(e, t) {
402
- let i = p.readdirSync(t, { withFileTypes: !0 });
402
+ let i = m.readdirSync(t, { withFileTypes: !0 });
403
403
  for (let a of i) {
404
- let i = e ? `${e}/${a.name}` : a.name, o = f.join(t, a.name);
404
+ let i = e ? `${e}/${a.name}` : a.name, o = p.join(t, a.name);
405
405
  a.isDirectory() ? r(i, o) : a.isFile() && n.push(i);
406
406
  }
407
407
  }
@@ -410,7 +410,7 @@ var Ee = d.custom({
410
410
  listDir(e) {
411
411
  let t = this.abs(e), n;
412
412
  try {
413
- n = p.readdirSync(t, { withFileTypes: !0 });
413
+ n = m.readdirSync(t, { withFileTypes: !0 });
414
414
  } catch {
415
415
  return [];
416
416
  }
@@ -421,48 +421,48 @@ var Ee = d.custom({
421
421
  }
422
422
  move(e, t) {
423
423
  let n = this.abs(e), r = this.abs(t);
424
- p.mkdirSync(f.dirname(r), { recursive: !0 }), p.renameSync(n, r);
424
+ m.mkdirSync(p.dirname(r), { recursive: !0 }), m.renameSync(n, r);
425
425
  }
426
426
  delete(e) {
427
- p.rmSync(this.abs(e), {
427
+ m.rmSync(this.abs(e), {
428
428
  recursive: !0,
429
429
  force: !0
430
430
  });
431
431
  }
432
- }, Ae = class {
432
+ }, ke = class {
433
433
  constructor(e) {
434
434
  this.root = e;
435
435
  }
436
436
  staticRead(e) {
437
- return p.readFileSync(f.resolve(this.root, "static", e), "utf-8");
437
+ return m.readFileSync(p.resolve(this.root, "static", e), "utf-8");
438
438
  }
439
439
  staticReadBinary(e) {
440
- return p.readFileSync(f.resolve(this.root, "static", e));
440
+ return m.readFileSync(p.resolve(this.root, "static", e));
441
441
  }
442
442
  textRead(e) {
443
- return p.readFileSync(f.resolve(this.root, "text", e), "utf-8");
443
+ return m.readFileSync(p.resolve(this.root, "text", e), "utf-8");
444
444
  }
445
445
  };
446
- function je(e, t) {
446
+ function Ae(e, t) {
447
447
  return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (e, n) => t[n] ?? `\${${n}}`);
448
448
  }
449
449
  //#endregion
450
450
  //#region src/structure/engine/flatten.ts
451
- var Me = ["default", "init"];
452
- function Ne(e, t) {
451
+ var je = ["default", "init"];
452
+ function Me(e, t) {
453
453
  if (!e) return t;
454
454
  if (!t) return e;
455
455
  let n = e.endsWith("/") ? e.slice(0, -1) : e, r = t.startsWith("/") ? t.slice(1) : t;
456
456
  return r ? `${n}/${r}` : n;
457
457
  }
458
- function Pe(e, t) {
458
+ function Ne(e, t) {
459
459
  return e.filter((e) => e.scope === t).slice().sort((e, t) => e.path.localeCompare(t.path));
460
460
  }
461
- function Fe(e, t) {
461
+ function Pe(e, t) {
462
462
  let n = [];
463
463
  function r(e, i, a, o, s) {
464
464
  if (e.kind === "scope") {
465
- let n = Pe(t.modules, e.scope);
465
+ let n = Ne(t.modules, e.scope);
466
466
  for (let t of n) for (let n of e.children) r(n, e.scope, t.path, o, s);
467
467
  return;
468
468
  }
@@ -475,14 +475,14 @@ function Fe(e, t) {
475
475
  for (let t of e.children) r(t, i, a, o, e.modes);
476
476
  return;
477
477
  }
478
- if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Le(e)}' is not inside a scope() frame`);
478
+ if (i === void 0 || a === void 0) throw Error(`flatten: leaf '${Ie(e)}' is not inside a scope() frame`);
479
479
  if (e.kind === "rename") {
480
480
  n.push({
481
481
  leaf: e,
482
482
  scope: i,
483
483
  modulePath: a,
484
- resolvedPath: Ne(a, e.from),
485
- resolvedTo: Ne(a, e.to),
484
+ resolvedPath: Me(a, e.from),
485
+ resolvedTo: Me(a, e.to),
486
486
  triggers: o,
487
487
  modes: s
488
488
  });
@@ -492,15 +492,15 @@ function Fe(e, t) {
492
492
  leaf: e,
493
493
  scope: i,
494
494
  modulePath: a,
495
- resolvedPath: Ne(a, Ie(e)),
495
+ resolvedPath: Me(a, Fe(e)),
496
496
  triggers: o,
497
497
  modes: s
498
498
  });
499
499
  }
500
- for (let t of e.children) r(t, void 0, void 0, [], Me);
500
+ for (let t of e.children) r(t, void 0, void 0, [], je);
501
501
  return n;
502
502
  }
503
- function Ie(e) {
503
+ function Fe(e) {
504
504
  switch (e.kind) {
505
505
  case "fixed":
506
506
  case "managed":
@@ -510,67 +510,67 @@ function Ie(e) {
510
510
  case "rename": return e.from;
511
511
  }
512
512
  }
513
- function Le(e) {
513
+ function Ie(e) {
514
514
  return e.kind === "rename" ? `rename ${e.from} -> ${e.to}` : `${e.kind} ${e.path}`;
515
515
  }
516
516
  //#endregion
517
517
  //#region src/structure/engine/glob.ts
518
- var Re = /[.+^${}()|[\]\\]/g;
519
- function ze(e) {
518
+ var Le = /[.+^${}()|[\]\\]/g;
519
+ function Re(e) {
520
520
  let t = "";
521
521
  for (let n = 0; n < e.length; n++) {
522
522
  let r = e[n];
523
- r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(Re, "\\$&");
523
+ r === "*" ? e[n + 1] === "*" ? (n++, e[n + 1] === "/" ? (n++, t += "(?:.*/)?") : t += ".*") : t += "[^/]*" : r === "?" ? t += "[^/]" : t += r.replace(Le, "\\$&");
524
524
  }
525
525
  return RegExp(`^${t}$`);
526
526
  }
527
- function Be(e, t) {
528
- return ze(e).test(t);
527
+ function ze(e, t) {
528
+ return Re(e).test(t);
529
529
  }
530
530
  //#endregion
531
531
  //#region src/structure/engine/builders.ts
532
- var h, g;
533
- function Ve(e) {
534
- if (!h) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
535
- return h;
532
+ var g, _;
533
+ function Be(e) {
534
+ if (!g) throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);
535
+ return g;
536
536
  }
537
- function _(e, t) {
538
- let n = Ve(e);
537
+ function v(e, t) {
538
+ let n = Be(e);
539
539
  n.stack[n.stack.length - 1].push(t);
540
540
  }
541
- function He(e, t) {
542
- let n = g;
543
- g = e;
541
+ function Ve(e, t) {
542
+ let n = _;
543
+ _ = e;
544
544
  try {
545
545
  return t();
546
546
  } finally {
547
- g = n;
547
+ _ = n;
548
548
  }
549
549
  }
550
- function Ue() {
551
- return g;
550
+ function He() {
551
+ return _;
552
552
  }
553
- function v() {
554
- if (!g) throw Error("getActiveRunContext() called outside engine.run(). Generators only see the run context during a run.");
555
- return g;
553
+ function y() {
554
+ if (!_) throw Error("getActiveRunContext() called outside engine.run(). Generators only see the run context during a run.");
555
+ return _;
556
556
  }
557
- function We(e) {
558
- if (h) throw Error("defineStructure() cannot be called from inside another defineStructure().");
557
+ function Ue(e) {
558
+ if (g) throw Error("defineStructure() cannot be called from inside another defineStructure().");
559
559
  let t = [], n = {
560
560
  root: t,
561
561
  stack: [t],
562
562
  inScope: !1
563
563
  };
564
- h = n;
564
+ g = n;
565
565
  try {
566
566
  if (e(), n.stack.length !== 1) throw Error(`defineStructure: builder body left ${n.stack.length - 1} unclosed group frame(s)`);
567
567
  let r = { children: t };
568
- return Ge(r), r;
568
+ return We(r), r;
569
569
  } finally {
570
- h = void 0;
570
+ g = void 0;
571
571
  }
572
572
  }
573
- function Ge(e) {
573
+ function We(e) {
574
574
  let t = /* @__PURE__ */ new Map();
575
575
  function n(e, r) {
576
576
  if (e.kind === "scope") {
@@ -593,8 +593,8 @@ function Ge(e) {
593
593
  throw Error(`defineStructure validation: path '${t}' under scope '${e}' is declared as both seed and ${n}. Seeds are block-author territory (written once at init, untouched thereafter); engine-managed primitives (fixed/managed/scaffold) rewrite on every refresh. The two contracts cannot coexist on the same path.`);
594
594
  }
595
595
  }
596
- function y(e, t) {
597
- let n = Ve("scope");
596
+ function b(e, t) {
597
+ let n = Be("scope");
598
598
  if (n.inScope) throw Error("scope() cannot nest. Already inside a scope.");
599
599
  let r = {
600
600
  kind: "scope",
@@ -608,22 +608,22 @@ function y(e, t) {
608
608
  n.stack.pop(), n.inScope = !1;
609
609
  }
610
610
  }
611
- var Ke;
612
- function qe(e) {
613
- Ke = e;
611
+ var Ge;
612
+ function Ke(e) {
613
+ Ge = e;
614
614
  }
615
- function b(e, t, n) {
616
- Je(e, t), n && Je((t) => !e(t), n);
615
+ function x(e, t, n) {
616
+ qe(e, t), n && qe((t) => !e(t), n);
617
617
  }
618
- function Je(e, t) {
619
- if (h) {
620
- Ye(e, t);
618
+ function qe(e, t) {
619
+ if (g) {
620
+ Je(e, t);
621
621
  return;
622
622
  }
623
- if (!(Ke?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
623
+ if (!(Ge?.(e, t) ?? !1)) throw Error("when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.");
624
624
  }
625
- function Ye(e, t) {
626
- let n = h, r = {
625
+ function Je(e, t) {
626
+ let n = g, r = {
627
627
  kind: "when",
628
628
  trigger: e,
629
629
  children: []
@@ -635,11 +635,11 @@ function Ye(e, t) {
635
635
  n.stack.pop();
636
636
  }
637
637
  }
638
- function x(e) {
638
+ function S(e) {
639
639
  return (t) => t.filesMatch(e);
640
640
  }
641
- function Xe(e, t, n) {
642
- let r = Ve(e), i = {
641
+ function Ye(e, t, n) {
642
+ let r = Be(e), i = {
643
643
  kind: "mode",
644
644
  modes: t,
645
645
  children: []
@@ -651,144 +651,144 @@ function Xe(e, t, n) {
651
651
  r.stack.pop();
652
652
  }
653
653
  }
654
- function Ze(e) {
655
- Xe("onInitOrUpdate", ["init", "updateDeps"], e);
654
+ function Xe(e) {
655
+ Ye("onInitOrUpdate", ["init", "updateDeps"], e);
656
656
  }
657
- function S(e, t) {
658
- _("fixed", {
657
+ function C(e, t) {
658
+ v("fixed", {
659
659
  kind: "fixed",
660
660
  path: e,
661
661
  content: t
662
662
  });
663
663
  }
664
- function C(e, t, n) {
665
- _("managed", {
664
+ function w(e, t, n) {
665
+ v("managed", {
666
666
  kind: "managed",
667
667
  path: e,
668
668
  initial: t,
669
669
  body: n
670
670
  });
671
671
  }
672
- function Qe(e, t) {
673
- _("scaffold", {
672
+ function Ze(e, t) {
673
+ v("scaffold", {
674
674
  kind: "scaffold",
675
675
  path: e,
676
676
  initial: t
677
677
  });
678
678
  }
679
- function w(e, t) {
680
- _("seed", {
679
+ function T(e, t) {
680
+ v("seed", {
681
681
  kind: "seed",
682
682
  path: e,
683
683
  initial: t
684
684
  });
685
685
  }
686
- function T(e) {
687
- _("remove", {
686
+ function E(e) {
687
+ v("remove", {
688
688
  kind: "remove",
689
689
  path: e
690
690
  });
691
691
  }
692
- function E(e) {
692
+ function D(e) {
693
693
  return {
694
694
  kind: "file",
695
695
  path: e
696
696
  };
697
697
  }
698
- function $e(e) {
698
+ function Qe(e) {
699
699
  return {
700
700
  kind: "binary",
701
701
  path: e
702
702
  };
703
703
  }
704
- function et(e) {
704
+ function $e(e) {
705
705
  return {
706
706
  kind: "text",
707
707
  value: e
708
708
  };
709
709
  }
710
- function tt(e, t) {
710
+ function et(e, t) {
711
711
  return {
712
712
  kind: "tpl",
713
713
  path: e,
714
714
  vars: t
715
715
  };
716
716
  }
717
- function D(e) {
717
+ function O(e) {
718
718
  return {
719
719
  kind: "generate",
720
720
  fn: e
721
721
  };
722
722
  }
723
- function nt() {
724
- if (!g) throw Error("blockVars() called outside engine.run(). Generators and managed bodies only see BlockVars during a run.");
725
- return g.blockVars;
723
+ function tt() {
724
+ if (!_) throw Error("blockVars() called outside engine.run(). Generators and managed bodies only see BlockVars during a run.");
725
+ return _.blockVars;
726
726
  }
727
727
  //#endregion
728
728
  //#region src/structure/engine/parsers/json.ts
729
- function rt(e) {
729
+ function nt(e) {
730
730
  return JSON.parse(e);
731
731
  }
732
- var it = 100, at = 2;
733
- function ot(e) {
734
- return e.length === 0 ? "[]" : "[" + e.map(st).join(", ") + "]";
732
+ var rt = 100, it = 2;
733
+ function at(e) {
734
+ return e.length === 0 ? "[]" : "[" + e.map(ot).join(", ") + "]";
735
735
  }
736
- function st(e) {
737
- if (Array.isArray(e)) return ot(e);
738
- if (k(e)) {
736
+ function ot(e) {
737
+ if (Array.isArray(e)) return at(e);
738
+ if (A(e)) {
739
739
  let t = Object.entries(e);
740
- return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${st(t)}`).join(", ") + " }";
740
+ return t.length === 0 ? "{}" : "{ " + t.map(([e, t]) => `${JSON.stringify(e)}: ${ot(t)}`).join(", ") + " }";
741
741
  }
742
742
  return JSON.stringify(e);
743
743
  }
744
- function ct(e, t, n, r) {
745
- let i = t + at, a = " ".repeat(i);
744
+ function st(e, t, n, r) {
745
+ let i = t + it, a = " ".repeat(i);
746
746
  if (Array.isArray(e)) {
747
- let o = ot(e);
748
- if (n + o.length + r <= it) return o;
747
+ let o = at(e);
748
+ if (n + o.length + r <= rt) return o;
749
749
  let s = e.length - 1;
750
- return "[\n" + e.map((e, t) => a + ct(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
750
+ return "[\n" + e.map((e, t) => a + st(e, i, i, t === s ? 0 : 1)).join(",\n") + "\n" + " ".repeat(t) + "]";
751
751
  }
752
- if (k(e)) {
752
+ if (A(e)) {
753
753
  let n = Object.entries(e);
754
754
  if (n.length === 0) return "{}";
755
755
  let r = n.length - 1;
756
756
  return "{\n" + n.map(([e, t], n) => {
757
757
  let o = `${a}${JSON.stringify(e)}: `;
758
- return o + ct(t, i, o.length, n === r ? 0 : 1);
758
+ return o + st(t, i, o.length, n === r ? 0 : 1);
759
759
  }).join(",\n") + "\n" + " ".repeat(t) + "}";
760
760
  }
761
761
  return JSON.stringify(e);
762
762
  }
763
- function lt(e, t) {
764
- return t?.collapse ? ct(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
763
+ function ct(e, t) {
764
+ return t?.collapse ? st(JSON.parse(JSON.stringify(e ?? null)), 0, 0, 0) + "\n" : JSON.stringify(e, null, 2) + "\n";
765
765
  }
766
- function O(e) {
766
+ function k(e) {
767
767
  return e === "" || e === void 0 ? [] : e.split(".");
768
768
  }
769
- function k(e) {
769
+ function A(e) {
770
770
  return typeof e == "object" && !!e && !Array.isArray(e);
771
771
  }
772
- function ut(e, t) {
773
- let n = O(t), r = e;
772
+ function lt(e, t) {
773
+ let n = k(t), r = e;
774
774
  for (let e of n) {
775
- if (!k(r)) return;
775
+ if (!A(r)) return;
776
776
  r = r[e];
777
777
  }
778
778
  return r;
779
779
  }
780
- function dt(e, t) {
781
- let n = O(t);
780
+ function ut(e, t) {
781
+ let n = k(t);
782
782
  if (n.length === 0) return !0;
783
783
  let r = e;
784
784
  for (let e = 0; e < n.length - 1; e++) {
785
- if (!k(r)) return !1;
785
+ if (!A(r)) return !1;
786
786
  r = r[n[e]];
787
787
  }
788
- return k(r) ? n[n.length - 1] in r : !1;
788
+ return A(r) ? n[n.length - 1] in r : !1;
789
789
  }
790
- function ft(e, t, n) {
791
- let r = O(t);
790
+ function dt(e, t, n) {
791
+ let r = k(t);
792
792
  if (r.length === 0) throw Error("setAtPath: jsonPath must be non-empty");
793
793
  let i = e;
794
794
  for (let e = 0; e < r.length - 1; e++) {
@@ -796,22 +796,22 @@ function ft(e, t, n) {
796
796
  if (n === void 0) {
797
797
  let e = {};
798
798
  i[t] = e, i = e;
799
- } else if (k(n)) i = n;
799
+ } else if (A(n)) i = n;
800
800
  else throw Error(`setAtPath: cannot descend into non-object at '${r.slice(0, e + 1).join(".")}'`);
801
801
  }
802
802
  i[r[r.length - 1]] = n;
803
803
  }
804
- function pt(e, t) {
805
- let n = O(t);
804
+ function ft(e, t) {
805
+ let n = k(t);
806
806
  if (n.length === 0) throw Error("deleteAtPath: jsonPath must be non-empty");
807
807
  let r = e;
808
808
  for (let e = 0; e < n.length - 1; e++) {
809
- if (!k(r)) return;
809
+ if (!A(r)) return;
810
810
  r = r[n[e]];
811
811
  }
812
- k(r) && delete r[n[n.length - 1]];
812
+ A(r) && delete r[n[n.length - 1]];
813
813
  }
814
- function mt(e, t) {
814
+ function pt(e, t) {
815
815
  let n = new Set(t), r = Object.keys(e), i = /* @__PURE__ */ new Map();
816
816
  i.set("", []);
817
817
  let a = "";
@@ -826,63 +826,63 @@ function mt(e, t) {
826
826
  }
827
827
  //#endregion
828
828
  //#region src/structure/engine/parsers/lines.ts
829
- function ht(e) {
829
+ function mt(e) {
830
830
  let t = e.split("\n");
831
831
  return t.length > 0 && t[t.length - 1] === "" && t.pop(), t;
832
832
  }
833
- function gt(e) {
833
+ function ht(e) {
834
834
  return e.join("\n") + "\n";
835
835
  }
836
- function _t(e) {
836
+ function gt(e) {
837
837
  return e.replace(/(^|\s)#.*$/, "$1").trim();
838
838
  }
839
- function vt(e, t) {
840
- let n = _t(e);
839
+ function _t(e, t) {
840
+ let n = gt(e);
841
841
  return n === "" ? !1 : n === t.trim();
842
842
  }
843
- function yt(e, t) {
844
- for (let n of e) if (vt(n, t)) return !0;
843
+ function vt(e, t) {
844
+ for (let n of e) if (_t(n, t)) return !0;
845
845
  return !1;
846
846
  }
847
847
  //#endregion
848
848
  //#region src/structure/engine/content-rules.ts
849
- function bt(e, t) {
849
+ function yt(e, t) {
850
850
  return e === "sdk:" ? t ? "workspace:*" : "catalog:" : e;
851
851
  }
852
- var xt = [
852
+ var bt = [
853
853
  "dependencies",
854
854
  "devDependencies",
855
855
  "peerDependencies",
856
856
  "optionalDependencies"
857
857
  ];
858
- function St(e, t) {
859
- if (P(e)) for (let n of xt) {
858
+ function xt(e, t) {
859
+ if (P(e)) for (let n of bt) {
860
860
  let r = e[n];
861
861
  if (P(r)) for (let e of Object.keys(r)) r[e] === "sdk:" && (r[e] = t ? "workspace:*" : "catalog:");
862
862
  }
863
863
  }
864
- var A;
865
- function j(e) {
866
- if (!A) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
867
- return A;
864
+ var j;
865
+ function St(e) {
866
+ if (!j) throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);
867
+ return j;
868
868
  }
869
869
  function M(e) {
870
- let t = j(e);
870
+ let t = St(e);
871
871
  if (t.kind !== "json") throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);
872
872
  return t;
873
873
  }
874
874
  function N(e) {
875
- let t = j(e);
875
+ let t = St(e);
876
876
  if (t.kind !== "yaml") throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);
877
877
  return t;
878
878
  }
879
879
  function Ct(e) {
880
- let t = j(e);
880
+ let t = St(e);
881
881
  if (t.kind !== "lines") throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);
882
882
  return t;
883
883
  }
884
884
  function wt(e, t) {
885
- let n = e.ctx ?? Ue();
885
+ let n = e.ctx ?? He();
886
886
  if (!n) throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);
887
887
  return n;
888
888
  }
@@ -890,8 +890,8 @@ function P(e) {
890
890
  return typeof e == "object" && !!e && !Array.isArray(e);
891
891
  }
892
892
  function Tt(e, t, n = {}) {
893
- if (A) throw Error("Nested managed(...) body — engine bug.");
894
- A = {
893
+ if (j) throw Error("Nested managed(...) body — engine bug.");
894
+ j = {
895
895
  kind: "json",
896
896
  obj: e,
897
897
  ctx: n.ctx,
@@ -900,27 +900,28 @@ function Tt(e, t, n = {}) {
900
900
  try {
901
901
  return t(), e;
902
902
  } finally {
903
- A = void 0;
903
+ j = void 0;
904
904
  }
905
905
  }
906
906
  function Et(e, t, n = {}) {
907
- if (A) throw Error("Nested managed(...) body — engine bug.");
908
- A = {
907
+ if (j) throw Error("Nested managed(...) body — engine bug.");
908
+ j = {
909
909
  kind: "yaml",
910
910
  doc: e,
911
911
  ctx: n.ctx,
912
912
  triggerContext: n.triggerContext,
913
- getLatestVersion: n.getLatestVersion
913
+ getLatestVersion: n.getLatestVersion,
914
+ getDerivedDependencyPin: n.getDerivedDependencyPin
914
915
  };
915
916
  try {
916
917
  return t(), e;
917
918
  } finally {
918
- A = void 0;
919
+ j = void 0;
919
920
  }
920
921
  }
921
922
  function Dt(e, t, n = {}) {
922
- if (A) throw Error("Nested managed(...) body — engine bug.");
923
- A = {
923
+ if (j) throw Error("Nested managed(...) body — engine bug.");
924
+ j = {
924
925
  kind: "lines",
925
926
  lines: e,
926
927
  ctx: n.ctx,
@@ -929,37 +930,37 @@ function Dt(e, t, n = {}) {
929
930
  try {
930
931
  return t(), e;
931
932
  } finally {
932
- A = void 0;
933
+ j = void 0;
933
934
  }
934
935
  }
935
- qe((e, t) => {
936
- if (!A) return !1;
937
- let n = A.triggerContext;
936
+ Ke((e, t) => {
937
+ if (!j) return !1;
938
+ let n = j.triggerContext;
938
939
  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.");
939
940
  return e(n) && t(), !0;
940
941
  });
941
942
  function F(e, t) {
942
- ft(M("ensureField").obj, e, t);
943
+ dt(M("ensureField").obj, e, t);
943
944
  }
944
945
  function Ot(e, t) {
945
946
  let n = M("removeField").obj;
946
- dt(n, e) && (t && !t(ut(n, e)) || pt(n, e));
947
+ ut(n, e) && (t && !t(lt(n, e)) || ft(n, e));
947
948
  }
948
949
  function I(e, t) {
949
950
  F(`scripts.${e}`, t);
950
951
  }
951
- function kt(e) {
952
+ function L(e) {
952
953
  Ot(`scripts.${e}`);
953
954
  }
954
- var At = [
955
+ var kt = [
955
956
  "dependencies",
956
957
  "devDependencies",
957
958
  "peerDependencies",
958
959
  "optionalDependencies"
959
960
  ];
960
- function L(e, t, n, r) {
961
- let i = M(e), a = i.obj, o = n === "sdk:" ? bt(n, wt(i, e).isSdkInternal) : n;
962
- for (let e of At) {
961
+ function R(e, t, n, r) {
962
+ let i = M(e), a = i.obj, o = n === "sdk:" ? yt(n, wt(i, e).isSdkInternal) : n;
963
+ for (let e of kt) {
963
964
  if (e === r) continue;
964
965
  let n = a[e];
965
966
  P(n) && t in n && delete n[t];
@@ -967,115 +968,125 @@ function L(e, t, n, r) {
967
968
  let s = a[r], c = P(s) ? s : {};
968
969
  c[t] = o, P(s) || (a[r] = c);
969
970
  }
970
- function R(e, t) {
971
- L("ensureDep", e, t, "dependencies");
972
- }
973
971
  function z(e, t) {
974
- L("ensureDevDep", e, t, "devDependencies");
972
+ R("ensureDep", e, t, "dependencies");
973
+ }
974
+ function B(e, t) {
975
+ R("ensureDevDep", e, t, "devDependencies");
975
976
  }
976
- function jt(e, t) {
977
- L("ensurePeerDep", e, t, "peerDependencies");
977
+ function At(e, t) {
978
+ R("ensurePeerDep", e, t, "peerDependencies");
978
979
  }
979
- function B(e) {
980
+ function V(e) {
980
981
  let t = M("removeDep").obj;
981
- for (let n of At) {
982
+ for (let n of kt) {
982
983
  let r = t[n];
983
984
  P(r) && e in r && delete r[e];
984
985
  }
985
986
  }
986
- function V(e) {
987
- for (let [t, n] of Object.entries(e)) z(t, n);
988
- }
989
987
  function H(e) {
990
- for (let [t, n] of Object.entries(e)) jt(t, n);
988
+ for (let [t, n] of Object.entries(e)) B(t, n);
989
+ }
990
+ function U(e) {
991
+ for (let [t, n] of Object.entries(e)) At(t, n);
991
992
  }
992
- function Mt(e, t, n) {
993
+ function jt(e, t, n) {
993
994
  let r = wt(M(e), e);
994
- for (let i of r.modules) i.scope === t && L(e, i.name, "workspace:*", n);
995
+ for (let i of r.modules) i.scope === t && R(e, i.name, "workspace:*", n);
995
996
  }
996
- function U(e) {
997
- Mt("ensureWorkspaceScopeDeps", e, "dependencies");
997
+ function W(e) {
998
+ jt("ensureWorkspaceScopeDeps", e, "dependencies");
998
999
  }
999
- function Nt(e) {
1000
+ function Mt(e) {
1000
1001
  let t = M("pruneKeysMatching").obj;
1001
1002
  for (let n of Object.keys(t)) e(n, t[n]) && delete t[n];
1002
1003
  }
1003
- function Pt(e, t) {
1004
- let n = mt(e, t);
1004
+ function Nt(e, t) {
1005
+ let n = pt(e, t);
1005
1006
  for (let t of Object.keys(e)) delete e[t];
1006
1007
  for (let t of Object.keys(n)) e[t] = n[t];
1007
1008
  }
1008
- function W(e) {
1009
- Pt(M("enforceFieldOrder").obj, e);
1009
+ function G(e) {
1010
+ Nt(M("enforceFieldOrder").obj, e);
1010
1011
  }
1011
- function Ft(e, t) {
1012
+ function Pt(e, t) {
1012
1013
  let n = Object.keys(e).sort(), r = {};
1013
1014
  for (let t of n) r[t] = e[t];
1014
1015
  for (let t of Object.keys(e)) delete e[t];
1015
- for (let i of n) e[i] = r[i], t && P(e[i]) && Ft(e[i], !0);
1016
+ for (let i of n) e[i] = r[i], t && P(e[i]) && Pt(e[i], !0);
1016
1017
  }
1017
- function G(e = "", t = {}) {
1018
+ function K(e = "", t = {}) {
1018
1019
  let n = t.recursive ?? !1;
1019
1020
  if (e === "" && !n) return;
1020
1021
  let r = M("enforceAlphabeticalOrder").obj;
1021
1022
  if (e === "") {
1022
- Ft(r, !0);
1023
+ Pt(r, !0);
1023
1024
  return;
1024
1025
  }
1025
- let i = ut(r, e);
1026
- P(i) && Ft(i, n);
1026
+ let i = lt(r, e);
1027
+ P(i) && Pt(i, n);
1027
1028
  }
1028
- function It() {
1029
+ function Ft() {
1029
1030
  let e = N("ensureWorkspaceModulePaths"), t = wt(e, "ensureWorkspaceModulePaths").modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = e.doc.toJSON()?.packages;
1030
1031
  Array.isArray(n) && n.length === t.length && n.every((e, n) => e === t[n]) || e.doc.setIn(["packages"], t);
1031
1032
  }
1032
- function Lt(e, t) {
1033
+ function It(e, t) {
1033
1034
  let n = e.doc.getIn(["catalog", t]);
1034
1035
  return typeof n == "string" ? n : void 0;
1035
1036
  }
1036
- function Rt(e, t) {
1037
+ function Lt(e, t) {
1037
1038
  let n = N("ensureCatalogVersion");
1038
- Lt(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
1039
+ It(n, e) === void 0 && n.doc.setIn(["catalog", e], t);
1039
1040
  }
1040
- function zt(e) {
1041
+ function Rt(e) {
1041
1042
  let t = N("ensureCatalogLatest");
1042
1043
  if (!t.getLatestVersion) return;
1043
1044
  let n = t.getLatestVersion(e);
1044
- n !== void 0 && Lt(t, e) !== n && t.doc.setIn(["catalog", e], n);
1045
+ n !== void 0 && It(t, e) !== n && t.doc.setIn(["catalog", e], n);
1046
+ }
1047
+ function zt(e, t) {
1048
+ let n = N("pinCatalogToDependencyOf");
1049
+ if (!n.getDerivedDependencyPin) return;
1050
+ let r = n.getDerivedDependencyPin(e);
1051
+ r !== void 0 && It(n, e) !== r && n.doc.setIn(["catalog", e], r);
1045
1052
  }
1046
1053
  function Bt(e) {
1054
+ let t = N("ensureCatalogAbsent");
1055
+ t.doc.hasIn(["catalog", e]) && t.doc.deleteIn(["catalog", e]);
1056
+ }
1057
+ function Vt(e) {
1047
1058
  let t = Ct("ensureGitignoreEntries");
1048
- for (let n of e) yt(t.lines, n) || t.lines.push(n);
1059
+ for (let n of e) vt(t.lines, n) || t.lines.push(n);
1049
1060
  }
1050
1061
  //#endregion
1051
1062
  //#region src/structure/engine/parsers/yaml.ts
1052
- function Vt(e) {
1053
- return ce(e);
1054
- }
1055
1063
  function Ht(e) {
1064
+ return se(e);
1065
+ }
1066
+ function Ut(e) {
1056
1067
  return e.toString();
1057
1068
  }
1058
- var Ut = ".structure";
1059
- function Wt(e, t = 0) {
1060
- if (e < t) throw new Gt(e, t);
1069
+ var Wt = ".structure";
1070
+ function Gt(e, t = 0) {
1071
+ if (e < t) throw new Kt(e, t);
1061
1072
  }
1062
- var Gt = class extends Error {
1073
+ var Kt = class extends Error {
1063
1074
  constructor(e, t) {
1064
1075
  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";
1065
1076
  }
1066
1077
  };
1067
- function Kt(e, t = 1) {
1078
+ function qt(e, t = 1) {
1068
1079
  let n = { version: t };
1069
- e.write(Ut, JSON.stringify(n));
1080
+ e.write(Wt, JSON.stringify(n));
1070
1081
  }
1071
1082
  //#endregion
1072
1083
  //#region src/structure/engine/runner.ts
1073
- var qt = class extends Error {
1084
+ var Jt = class extends Error {
1074
1085
  constructor(e) {
1075
1086
  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";
1076
1087
  }
1077
1088
  };
1078
- function Jt(e, t, n, r) {
1089
+ function Yt(e, t, n, r) {
1079
1090
  switch (e.kind) {
1080
1091
  case "text": return e.value;
1081
1092
  case "file":
@@ -1083,46 +1094,47 @@ function Jt(e, t, n, r) {
1083
1094
  return n.staticRead(e.path);
1084
1095
  case "tpl":
1085
1096
  if (!n) throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
1086
- return je(n.textRead(e.path), typeof e.vars == "function" ? e.vars() : e.vars);
1097
+ return Ae(n.textRead(e.path), typeof e.vars == "function" ? e.vars() : e.vars);
1087
1098
  case "generate": {
1088
1099
  let n = e.fn();
1089
- if (t.endsWith(".json")) return St(n, r), lt(n, { collapse: !t.endsWith("package.json") });
1090
- if (t.endsWith(".yaml") || t.endsWith(".yml")) return le(n);
1100
+ if (t.endsWith(".json")) return xt(n, r), ct(n, { collapse: !t.endsWith("package.json") });
1101
+ if (t.endsWith(".yaml") || t.endsWith(".yml")) return ce(n);
1091
1102
  if (typeof n != "string") throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);
1092
1103
  return n;
1093
1104
  }
1094
1105
  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.`);
1095
1106
  }
1096
1107
  }
1097
- function Yt(e, t, n, r, i) {
1108
+ function Xt(e, t, n, r, i) {
1098
1109
  if (n.kind === "binary") {
1099
1110
  if (!r) throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);
1100
1111
  e.writeBinary(t, r.staticReadBinary(n.path));
1101
1112
  return;
1102
1113
  }
1103
- e.write(t, Jt(n, t, r, i));
1114
+ e.write(t, Yt(n, t, r, i));
1104
1115
  }
1105
- function Xt(e, t, n, r, i) {
1106
- let a = e.split("/").pop() ?? e;
1116
+ function Zt(e, t, n, r, i, a) {
1117
+ let o = e.split("/").pop() ?? e;
1107
1118
  if (e.endsWith(".json")) {
1108
- let i = rt(t);
1119
+ let i = nt(t);
1109
1120
  if (typeof i != "object" || !i || Array.isArray(i)) throw Error(`managed: parsed value at '${e}' is not a JSON object`);
1110
- return Tt(i, n, { triggerContext: r }), lt(i, { collapse: a !== "package.json" });
1121
+ return Tt(i, n, { triggerContext: r }), ct(i, { collapse: o !== "package.json" });
1111
1122
  }
1112
1123
  if (e.endsWith(".yaml") || e.endsWith(".yml")) {
1113
- let e = Vt(t);
1124
+ let e = Ht(t);
1114
1125
  return Et(e, n, {
1115
1126
  triggerContext: r,
1116
- getLatestVersion: i
1117
- }), Ht(e);
1127
+ getLatestVersion: i,
1128
+ getDerivedDependencyPin: a
1129
+ }), Ut(e);
1118
1130
  }
1119
- if (a === ".gitignore" || a.endsWith(".gitignore")) {
1120
- let e = ht(t);
1121
- return Dt(e, n, { triggerContext: r }), gt(e);
1131
+ if (o === ".gitignore" || o.endsWith(".gitignore")) {
1132
+ let e = mt(t);
1133
+ return Dt(e, n, { triggerContext: r }), ht(e);
1122
1134
  }
1123
1135
  throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`);
1124
1136
  }
1125
- function Zt(e) {
1137
+ function Qt(e) {
1126
1138
  let t = e.list(""), n = /* @__PURE__ */ new Set();
1127
1139
  for (let e of t) {
1128
1140
  n.add(e);
@@ -1131,37 +1143,37 @@ function Zt(e) {
1131
1143
  }
1132
1144
  return n;
1133
1145
  }
1134
- function Qt(e, t) {
1146
+ function $t(e, t) {
1135
1147
  let n = t === "" ? t : t.endsWith("/") ? t.slice(0, -1) : t;
1136
1148
  return e.has(n);
1137
1149
  }
1138
- function $t(e, t, n) {
1150
+ function en(e, t, n) {
1139
1151
  return {
1140
1152
  ctx: t,
1141
1153
  version: t.version,
1142
- pathExists: (t) => Qt(e, t),
1143
- pathMissing: (t) => !Qt(e, t),
1154
+ pathExists: (t) => $t(e, t),
1155
+ pathMissing: (t) => !$t(e, t),
1144
1156
  filesMatch: (t) => {
1145
1157
  let r = n ? `${n}/${t}` : t;
1146
- for (let t of e) if (Be(r, t)) return !0;
1158
+ for (let t of e) if (ze(r, t)) return !0;
1147
1159
  return !1;
1148
1160
  }
1149
1161
  };
1150
1162
  }
1151
- function en(e, t) {
1163
+ function tn(e, t) {
1152
1164
  for (let n of e.triggers) if (!n(t)) return !1;
1153
1165
  return !0;
1154
1166
  }
1155
- function tn(e, t) {
1167
+ function nn(e, t) {
1156
1168
  return t ? "init" : e.updateDepsOnly ? "updateDeps" : "default";
1157
1169
  }
1158
- function nn(e, t) {
1170
+ function rn(e, t) {
1159
1171
  return e.filter((e) => e.modes.includes(t));
1160
1172
  }
1161
- function rn(e, t, n, r, i, a) {
1173
+ function an(e, t, n, r, i, a) {
1162
1174
  let o = e.leaf;
1163
1175
  if (o.kind === "fixed") {
1164
- let i = Jt(o.content, e.resolvedPath, r, a);
1176
+ let i = Yt(o.content, e.resolvedPath, r, a);
1165
1177
  return t.exists(e.resolvedPath) ? t.read(e.resolvedPath) === i ? void 0 : (n || t.write(e.resolvedPath, i), {
1166
1178
  scope: e.scope,
1167
1179
  path: e.resolvedPath,
@@ -1174,13 +1186,13 @@ function rn(e, t, n, r, i, a) {
1174
1186
  action: "create"
1175
1187
  });
1176
1188
  }
1177
- if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Yt(t, e.resolvedPath, o.initial, r, a), {
1189
+ if (o.kind === "scaffold") return t.exists(e.resolvedPath) ? void 0 : (n || Xt(t, e.resolvedPath, o.initial, r, a), {
1178
1190
  scope: e.scope,
1179
1191
  path: e.resolvedPath,
1180
1192
  primitive: "scaffold",
1181
1193
  action: "create"
1182
1194
  });
1183
- if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Yt(t, e.resolvedPath, o.initial, r, a), {
1195
+ if (o.kind === "seed") return !i || t.exists(e.resolvedPath) ? void 0 : (n || Xt(t, e.resolvedPath, o.initial, r, a), {
1184
1196
  scope: e.scope,
1185
1197
  path: e.resolvedPath,
1186
1198
  primitive: "seed",
@@ -1203,58 +1215,58 @@ function rn(e, t, n, r, i, a) {
1203
1215
  });
1204
1216
  }
1205
1217
  }
1206
- function an(e, t, n, r, i, a, o) {
1218
+ function on(e, t, n, r, i, a, o, s) {
1207
1219
  if (e.leaf.kind !== "managed") return;
1208
- let s = e.leaf, c = e.resolvedPath, ee = t.exists(c), l, te = !1;
1209
- ee ? l = t.read(c) : (l = Jt(s.initial, c, i, o), te = !0);
1210
- let u = Xt(c, l, s.body, r, a);
1211
- if (te) return n || t.write(c, u), {
1220
+ let c = e.leaf, l = e.resolvedPath, ee = t.exists(l), u, d = !1;
1221
+ ee ? u = t.read(l) : (u = Yt(c.initial, l, i, s), d = !0);
1222
+ let f = Zt(l, u, c.body, r, a, o);
1223
+ if (d) return n || t.write(l, f), {
1212
1224
  scope: e.scope,
1213
- path: c,
1225
+ path: l,
1214
1226
  primitive: "managed",
1215
1227
  action: "create"
1216
1228
  };
1217
- if (u !== l) return n || t.write(c, u), {
1229
+ if (f !== u) return n || t.write(l, f), {
1218
1230
  scope: e.scope,
1219
- path: c,
1231
+ path: l,
1220
1232
  primitive: "managed",
1221
1233
  action: "update"
1222
1234
  };
1223
1235
  }
1224
- function on(e, t, n, r, i, a, o) {
1225
- let s = nn(e, tn(n, a)), c = [], ee = Zt(t);
1226
- for (let e of s) {
1227
- if (e.leaf.kind === "managed" || !en(e, $t(ee, n, e.modulePath))) continue;
1228
- let o = rn(e, t, r, i, a, n.isSdkInternal);
1229
- o && c.push(o);
1236
+ function sn(e, t, n, r, i, a, o, s) {
1237
+ let c = rn(e, nn(n, a)), l = [], ee = Qt(t);
1238
+ for (let e of c) {
1239
+ if (e.leaf.kind === "managed" || !tn(e, en(ee, n, e.modulePath))) continue;
1240
+ let o = an(e, t, r, i, a, n.isSdkInternal);
1241
+ o && l.push(o);
1230
1242
  }
1231
- let l = Zt(t);
1232
- for (let e of s) {
1243
+ let u = Qt(t);
1244
+ for (let e of c) {
1233
1245
  if (e.leaf.kind !== "managed") continue;
1234
- let a = $t(l, n, e.modulePath);
1235
- if (!en(e, a)) continue;
1236
- let s = an(e, t, r, a, i, o, n.isSdkInternal);
1237
- s && c.push(s);
1246
+ let a = en(u, n, e.modulePath);
1247
+ if (!tn(e, a)) continue;
1248
+ let c = on(e, t, r, a, i, o, s, n.isSdkInternal);
1249
+ c && l.push(c);
1238
1250
  }
1239
- return c;
1251
+ return l;
1240
1252
  }
1241
- function sn(e, t, n, r = {}) {
1242
- return He(n, () => {
1243
- let i = Fe(e, n), a = !!r.initMode, o = on(i, t, n, n.dryRun, r.templates, a, r.registryLookup);
1253
+ function cn(e, t, n, r = {}) {
1254
+ return Ve(n, () => {
1255
+ let i = Pe(e, n), a = !!r.initMode, o = sn(i, t, n, n.dryRun, r.templates, a, r.registryLookup, r.derivedPinLookup);
1244
1256
  if (!n.dryRun && !n.updateDepsOnly && !a) {
1245
- Kt(t);
1257
+ qt(t);
1246
1258
  let i = {
1247
1259
  ...r.rediscover ? r.rediscover(t) : n,
1248
1260
  dryRun: !0
1249
- }, a = on(Fe(e, i), t, i, !0, r.templates, !1, r.registryLookup).filter((e) => e.path !== Ut);
1250
- if (a.length > 0) throw new qt(a[0]);
1261
+ }, a = sn(Pe(e, i), t, i, !0, r.templates, !1, r.registryLookup, r.derivedPinLookup).filter((e) => e.path !== Wt);
1262
+ if (a.length > 0) throw new Jt(a[0]);
1251
1263
  }
1252
- return a && !n.dryRun && Kt(t), { changes: o };
1264
+ return a && !n.dryRun && qt(t), { changes: o };
1253
1265
  });
1254
1266
  }
1255
1267
  //#endregion
1256
1268
  //#region src/structure/engine/discovery.ts
1257
- var cn = [
1269
+ var ln = [
1258
1270
  "root",
1259
1271
  "block",
1260
1272
  "model",
@@ -1262,12 +1274,12 @@ var cn = [
1262
1274
  "workflow",
1263
1275
  "test",
1264
1276
  "software"
1265
- ], ln = class extends Error {
1277
+ ], un = class extends Error {
1266
1278
  constructor(e, t) {
1267
1279
  super(e), this.path = t, this.name = "DiscoveryError";
1268
1280
  }
1269
1281
  };
1270
- function un(e) {
1282
+ function dn(e) {
1271
1283
  let t = /* @__PURE__ */ new Set();
1272
1284
  for (let n of [
1273
1285
  e.dependencies,
@@ -1277,17 +1289,17 @@ function un(e) {
1277
1289
  ]) if (n) for (let e of Object.keys(n)) t.add(e);
1278
1290
  return t;
1279
1291
  }
1280
- function dn(e) {
1292
+ function fn(e) {
1281
1293
  return e === "" || e === ".";
1282
1294
  }
1283
- function fn(e, t) {
1295
+ function pn(e, t) {
1284
1296
  let n = e.pkg["block-scope"];
1285
1297
  if (typeof n == "string") {
1286
- if (!cn.includes(n)) throw new ln(`package.json "block-scope" must be one of ${cn.join(", ")}, got '${n}'`, e.path);
1298
+ if (!ln.includes(n)) throw new un(`package.json "block-scope" must be one of ${ln.join(", ")}, got '${n}'`, e.path);
1287
1299
  return n;
1288
1300
  }
1289
- if (dn(e.path)) return "root";
1290
- let r = un(e.pkg);
1301
+ if (fn(e.path)) return "root";
1302
+ let r = dn(e.pkg);
1291
1303
  if (e.pkg["block-software"] !== void 0) return "software";
1292
1304
  if (r.has("@platforma-sdk/package-builder")) {
1293
1305
  for (let e of r) if (/^@platforma-open\/.*runenv/.test(e)) return "software";
@@ -1302,41 +1314,41 @@ function fn(e, t) {
1302
1314
  if (r.has("@platforma-sdk/model") && e.pkg.main) return "model";
1303
1315
  if (r.has("@platforma-sdk/test")) return "test";
1304
1316
  }
1305
- function pn(e) {
1317
+ function mn(e) {
1306
1318
  let t = /* @__PURE__ */ new Set();
1307
1319
  for (let n of e) typeof n.pkg.name == "string" && t.add(n.pkg.name);
1308
1320
  let n = [];
1309
1321
  for (let r of e) {
1310
- let e = fn(r, t);
1311
- if (!e) throw new ln(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
1322
+ let e = pn(r, t);
1323
+ if (!e) throw new un(`Unclassified workspace package at '${r.path}'. Add a top-level "block-scope" string to its package.json.`, r.path);
1312
1324
  n.push({
1313
1325
  scope: e,
1314
1326
  name: r.pkg.name ?? r.path,
1315
- path: dn(r.path) ? "" : r.path
1327
+ path: fn(r.path) ? "" : r.path
1316
1328
  });
1317
1329
  }
1318
1330
  return n;
1319
1331
  }
1320
1332
  //#endregion
1321
1333
  //#region src/structure/engine/ctx.ts
1322
- function K(e, t) {
1334
+ function q(e, t) {
1323
1335
  return e.modules.filter((e) => e.scope === t);
1324
1336
  }
1325
- function mn(e, t) {
1326
- let n = K(e, t);
1337
+ function hn(e, t) {
1338
+ let n = q(e, t);
1327
1339
  if (n.length === 0) throw Error(`findModule: expected one '${t}' module, found none`);
1328
1340
  if (n.length > 1) throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);
1329
1341
  return n[0];
1330
1342
  }
1331
- function q(e, t) {
1332
- return { [mn(e, t).name]: "workspace:*" };
1343
+ function J(e, t) {
1344
+ return { [hn(e, t).name]: "workspace:*" };
1333
1345
  }
1334
- function hn(e, t) {
1346
+ function gn(e, t) {
1335
1347
  let n = {};
1336
- for (let r of K(e, t)) n[r.name] = "workspace:*";
1348
+ for (let r of q(e, t)) n[r.name] = "workspace:*";
1337
1349
  return n;
1338
1350
  }
1339
- function gn(e) {
1351
+ function _n(e) {
1340
1352
  let t = e.facadeName, n = [
1341
1353
  {
1342
1354
  scope: "root",
@@ -1375,7 +1387,7 @@ function gn(e) {
1375
1387
  path: "software"
1376
1388
  }), n;
1377
1389
  }
1378
- function _n(e) {
1390
+ function vn(e) {
1379
1391
  return {
1380
1392
  isSdkInternal: e.isSdkInternal ?? !1,
1381
1393
  updateDepsOnly: e.updateDepsOnly ?? !1,
@@ -1387,41 +1399,41 @@ function _n(e) {
1387
1399
  }
1388
1400
  //#endregion
1389
1401
  //#region src/structure/engine/discovery-fs.ts
1390
- var J = class extends Error {
1402
+ var Y = class extends Error {
1391
1403
  constructor(e) {
1392
1404
  super(e), this.name = "StructureCliError";
1393
1405
  }
1394
1406
  };
1395
- function vn(e, t) {
1407
+ function yn(e, t) {
1396
1408
  return e === "" ? t : `${e}/${t}`;
1397
1409
  }
1398
- function yn(e, t) {
1410
+ function bn(e, t) {
1399
1411
  try {
1400
1412
  return JSON.parse(e.read(t));
1401
1413
  } catch {
1402
1414
  return;
1403
1415
  }
1404
1416
  }
1405
- function bn(e) {
1406
- 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.`);
1417
+ function xn(e) {
1418
+ if (e.includes("*")) throw new Y(`pnpm-workspace.yaml 'packages:' entry '${e}' contains a glob. The structurer requires literal package paths — replace the glob with one entry per package directory.`);
1407
1419
  let t = e.replace(/^\.\//, "").replace(/\/$/, "");
1408
1420
  return t === "." ? "" : t;
1409
1421
  }
1410
- function xn(e) {
1422
+ function Sn(e) {
1411
1423
  let t;
1412
1424
  try {
1413
1425
  t = e.read("pnpm-workspace.yaml");
1414
1426
  } catch {
1415
- 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.");
1427
+ throw new Y("No pnpm-workspace.yaml found. This directory is empty or unrecognisable as a block — run 'block-tools structure init' instead, or pass --sdk-internal for an in-monorepo block.");
1416
1428
  }
1417
- let n = se(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1429
+ let n = oe(t) ?? {}, r = Array.isArray(n.packages) ? n.packages : [], i = new Set([""]);
1418
1430
  for (let t of r) {
1419
- let n = bn(t);
1431
+ let n = xn(t);
1420
1432
  (n === "" || e.exists(n)) && i.add(n);
1421
1433
  }
1422
1434
  let a = [];
1423
1435
  for (let t of i) {
1424
- let n = yn(e, vn(t, "package.json"));
1436
+ let n = bn(e, yn(t, "package.json"));
1425
1437
  n && a.push({
1426
1438
  path: t,
1427
1439
  pkg: n
@@ -1429,7 +1441,7 @@ function xn(e) {
1429
1441
  }
1430
1442
  return a;
1431
1443
  }
1432
- function Sn(e) {
1444
+ function Cn(e) {
1433
1445
  let t = [], n = new Set([
1434
1446
  "node_modules",
1435
1447
  ".turbo",
@@ -1441,7 +1453,7 @@ function Sn(e) {
1441
1453
  let o = e.listDir(i);
1442
1454
  for (let s of o) {
1443
1455
  if (!s.isDirectory || n.has(s.name)) continue;
1444
- let o = vn(i, s.name), c = yn(e, vn(o, "package.json"));
1456
+ let o = yn(i, s.name), c = bn(e, yn(o, "package.json"));
1445
1457
  c && t.push({
1446
1458
  path: o,
1447
1459
  pkg: c
@@ -1450,11 +1462,11 @@ function Sn(e) {
1450
1462
  }
1451
1463
  return r("", 1), t;
1452
1464
  }
1453
- function Cn(e) {
1465
+ function wn(e) {
1454
1466
  let t = e.indexOf("/");
1455
- if (!e.startsWith("@") || t < 0) throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1467
+ if (!e.startsWith("@") || t < 0) throw new Y(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);
1456
1468
  let n = e.slice(0, t), r = e.slice(t + 1), i = r.indexOf(".");
1457
- if (i < 0) throw new J(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1469
+ if (i < 0) throw new Y(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);
1458
1470
  return {
1459
1471
  facadeName: e,
1460
1472
  baseName: r,
@@ -1463,23 +1475,23 @@ function Cn(e) {
1463
1475
  shortName: r.slice(i + 1)
1464
1476
  };
1465
1477
  }
1466
- function wn(e) {
1478
+ function Tn(e) {
1467
1479
  try {
1468
- let t = JSON.parse(e.read(Ut));
1480
+ let t = JSON.parse(e.read(Wt));
1469
1481
  return typeof t.version == "number" ? t.version : 0;
1470
1482
  } catch {
1471
1483
  return 0;
1472
1484
  }
1473
1485
  }
1474
- function Tn(e) {
1475
- let { fs: t, isSdkInternal: n } = e, r = n ? Sn(t) : xn(t);
1476
- if (r.length === 0) throw new J("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1477
- let i = pn(r), a = wn(t);
1478
- Wt(a, 0);
1486
+ function En(e) {
1487
+ let { fs: t, isSdkInternal: n } = e, r = n ? Cn(t) : Sn(t);
1488
+ if (r.length === 0) throw new Y("No workspace packages found. Run 'block-tools structure init' to scaffold a block.");
1489
+ let i = mn(r), a = Tn(t);
1490
+ Gt(a, 0);
1479
1491
  let o = i.find((e) => e.scope === "block") ?? i.find((e) => e.scope === "root");
1480
- if (!o) throw new J("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1481
- let s = Cn(o.name);
1482
- return _n({
1492
+ if (!o) throw new Y("Could not find a 'block' (or root-as-block) package to derive BlockVars from.");
1493
+ let s = wn(o.name);
1494
+ return vn({
1483
1495
  isSdkInternal: n,
1484
1496
  updateDepsOnly: e.updateDepsOnly ?? !1,
1485
1497
  modules: i,
@@ -1490,7 +1502,7 @@ function Tn(e) {
1490
1502
  }
1491
1503
  //#endregion
1492
1504
  //#region src/structure/rules/shared/key-order.ts
1493
- var Y = [
1505
+ var X = [
1494
1506
  "name",
1495
1507
  "version",
1496
1508
  "private",
@@ -1514,7 +1526,7 @@ var Y = [
1514
1526
  ];
1515
1527
  //#endregion
1516
1528
  //#region src/structure/rules/root-package-json.ts
1517
- function En(e) {
1529
+ function Dn(e) {
1518
1530
  return {
1519
1531
  version: "1.0.0",
1520
1532
  private: !0,
@@ -1531,7 +1543,7 @@ function En(e) {
1531
1543
  changeset: "changeset",
1532
1544
  "version-packages": "changeset version",
1533
1545
  "update-sdk": "block-tools structure refresh --update-deps-only",
1534
- update: "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm fmt"
1546
+ "upgrade-sdk": "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"
1535
1547
  },
1536
1548
  peerDependencies: {
1537
1549
  oxlint: "*",
@@ -1547,76 +1559,109 @@ function En(e) {
1547
1559
  packageManager: "pnpm@9.12.0"
1548
1560
  };
1549
1561
  }
1550
- function Dn() {
1551
- F("packageManager", "pnpm@9.12.0"), Ot("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), I("update", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm fmt"), V({
1562
+ function On() {
1563
+ F("packageManager", "pnpm@9.12.0"), Ot("name"), I("fmt", "turbo run fmt"), I("check", "turbo run check"), I("build", "turbo run build"), I("build:dev", "env PL_PKG_DEV=local turbo run build"), I("test", "env PL_PKG_DEV=local turbo run test --concurrency 1"), I("test:dry-run", "env PL_PKG_DEV=local turbo run test --dry-run=json"), I("mark-stable", "turbo run mark-stable"), I("do-pack", "turbo run do-pack"), I("watch", "turbo watch build"), I("changeset", "changeset"), I("version-packages", "changeset version"), I("update-sdk", "block-tools structure refresh --update-deps-only"), L("update"), I("upgrade-sdk", "block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt"), H({
1552
1564
  "@changesets/cli": "catalog:",
1553
1565
  "@milaboratories/ts-builder": "sdk:",
1554
1566
  "@platforma-sdk/block-tools": "sdk:",
1555
1567
  shx: "catalog:",
1556
1568
  turbo: "catalog:"
1557
- }), H({
1569
+ }), U({
1558
1570
  oxlint: "*",
1559
1571
  oxfmt: "*"
1560
- }), Nt((e, t) => {
1572
+ }), Mt((e, t) => {
1561
1573
  if (!/^(\/\/|--)/.test(e) || typeof t != "object" || !t) return !1;
1562
1574
  let n = t;
1563
1575
  return n.pnpm !== void 0 || n.overrides !== void 0;
1564
- }), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1576
+ }), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1565
1577
  }
1566
1578
  //#endregion
1567
1579
  //#region src/structure/engine/registry-client.ts
1568
- var On = 2, kn = 500, An = 3e4;
1569
- function jn(e) {
1580
+ var kn = 2, An = 500, jn = 3e4;
1581
+ function Mn(e) {
1570
1582
  if (!e) return null;
1571
1583
  let t = Number(e);
1572
1584
  if (Number.isFinite(t) && t > 0) return t * 1e3;
1573
1585
  let n = Date.parse(e);
1574
1586
  return Number.isNaN(n) ? null : Math.max(0, n - Date.now());
1575
1587
  }
1576
- async function Mn(e) {
1588
+ async function Nn(e) {
1577
1589
  for (let t = 1;; t++) {
1578
1590
  let n;
1579
1591
  try {
1580
- n = await fetch(e, { signal: AbortSignal.timeout(An) });
1592
+ n = await fetch(e, { signal: AbortSignal.timeout(jn) });
1581
1593
  } catch (e) {
1582
- if (t > On) throw e;
1583
- await ue(kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1594
+ if (t > kn) throw e;
1595
+ await le(An * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1584
1596
  continue;
1585
1597
  }
1586
1598
  if (n.ok) return n;
1587
- if (!(n.status === 429 || n.status >= 500) || t > On) throw Error(`registry returned HTTP ${n.status}`);
1588
- let r = jn(n.headers.get("retry-after"));
1599
+ if (!(n.status === 429 || n.status >= 500) || t > kn) throw Error(`registry returned HTTP ${n.status}`);
1600
+ let r = Mn(n.headers.get("retry-after"));
1589
1601
  if (r != null) {
1590
- await ue(r);
1602
+ await le(r);
1591
1603
  continue;
1592
1604
  }
1593
- await ue(kn * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1605
+ await le(An * 2 ** (t - 1) * (.8 + .4 * Math.random()));
1594
1606
  }
1595
1607
  }
1596
- function Nn() {
1597
- return { async getLatestVersion(e) {
1598
- let t = (await (await Mn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1599
- if (!t) throw Error("no 'latest' dist-tag in registry response");
1600
- return t;
1601
- } };
1608
+ function Pn() {
1609
+ return {
1610
+ async getLatestVersion(e) {
1611
+ let t = (await (await Nn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;
1612
+ if (!t) throw Error("no 'latest' dist-tag in registry response");
1613
+ return t;
1614
+ },
1615
+ async getDeclaredDependency(e, t, n) {
1616
+ let r = await (await Nn(`https://registry.npmjs.org/${e}/${t}`)).json();
1617
+ return r.dependencies?.[n] ?? r.peerDependencies?.[n];
1618
+ }
1619
+ };
1602
1620
  }
1603
- async function Pn(e, t) {
1621
+ async function Fn(e, t) {
1604
1622
  let n = await Promise.all(t.map(async (t) => [t, await e.getLatestVersion(t)]));
1605
1623
  return new Map(n);
1606
1624
  }
1607
- function Fn(e) {
1625
+ function In(e) {
1608
1626
  return (t) => e.get(t);
1609
1627
  }
1610
- var In = [/^@platforma-sdk\//, /^@milaboratories\//];
1611
- function Ln(e) {
1612
- return In.some((t) => t.test(e));
1628
+ var Ln = [/^@platforma-sdk\//, /^@milaboratories\//];
1629
+ function Rn(e) {
1630
+ return Ln.some((t) => t.test(e));
1613
1631
  }
1614
- async function Rn(e, t = Nn()) {
1615
- return e.length === 0 ? () => void 0 : Fn(await Pn(t, e));
1632
+ async function zn(e, t = Pn()) {
1633
+ return e.length === 0 ? () => void 0 : In(await Fn(t, e));
1634
+ }
1635
+ function Bn(e) {
1636
+ return /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e);
1637
+ }
1638
+ async function Vn(e, t = Pn()) {
1639
+ if (e.length === 0) return () => void 0;
1640
+ let n = await Promise.all(e.map(async (e) => {
1641
+ let n = await t.getDeclaredDependency(e.of, e.ofVersion ?? "latest", e.entry);
1642
+ if (n === void 0) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares no dependency '${e.entry}'. A derived pin requires the source to declare the dep as an exact version.`);
1643
+ if (!Bn(n)) throw Error(`derived catalog pin '${e.entry}': package '${e.of}'${e.ofVersion ? `@${e.ofVersion}` : " (latest)"} declares '${e.entry}: ${n}', which is not an exact version. A derived pin requires an exact ('x.y.z') source dependency so the catalog can pin to it precisely.`);
1644
+ return [e.entry, n];
1645
+ })), r = new Map(n);
1646
+ return (e) => r.get(e);
1647
+ }
1648
+ //#endregion
1649
+ //#region src/structure/rules/shared/retired-deps.ts
1650
+ // @vitejs/plugin-vue — bundled by ts-builder's internal vite config.
1651
+ var Hn = [
1652
+ "vite",
1653
+ "tsup",
1654
+ "vue-tsc",
1655
+ "@vitejs/plugin-vue",
1656
+ "vite-plugin-dts",
1657
+ "@platforma-sdk/eslint-config"
1658
+ ];
1659
+ function Un() {
1660
+ for (let e of Hn) V(e);
1616
1661
  }
1617
1662
  //#endregion
1618
1663
  //#region src/structure/rules/root-pnpm-workspace.ts
1619
- var X = [
1664
+ var Z = [
1620
1665
  "@platforma-sdk/model",
1621
1666
  "@platforma-sdk/ui-vue",
1622
1667
  "@platforma-sdk/workflow-tengo",
@@ -1626,29 +1671,32 @@ var X = [
1626
1671
  "@platforma-sdk/package-builder",
1627
1672
  "@milaboratories/ts-builder",
1628
1673
  "@milaboratories/ts-configs"
1629
- ], zn = "0.0.0-init-must-fetch";
1630
- for (let e of X) if (!Ln(e)) throw Error(`SDK_CATALOG_PACKAGES entry '${e}' matches no catalog bump pattern; its placeholder would never be resolved to npm latest on init. Add it to CATALOG_BUMP_PATTERNS or move it to the infra floor.`);
1631
- var Bn = {
1674
+ ], Wn = "0.0.0-init-must-fetch";
1675
+ for (let e of Z) if (!Rn(e)) throw Error(`SDK_CATALOG_PACKAGES entry '${e}' matches no catalog bump pattern; its placeholder would never be resolved to npm latest on init. Add it to CATALOG_BUMP_PATTERNS or move it to the infra floor.`);
1676
+ var Gn = {
1632
1677
  turbo: "~2.8.11",
1633
1678
  shx: "~0.4.0",
1634
1679
  "@changesets/cli": "~2.29.8",
1635
- vitest: "~4.0.18",
1636
- vue: "3.5.24"
1637
- }, Vn = "@platforma-open/milaboratories.runenv-python-3", Hn = "1.8.2";
1638
- function Un(e) {
1680
+ vitest: "~4.0.18"
1681
+ }, Kn = [{
1682
+ entry: "vue",
1683
+ of: "@platforma-sdk/ui-vue"
1684
+ }], qn = "@platforma-open/milaboratories.runenv-python-3", Jn = "1.8.2";
1685
+ function Yn(e) {
1639
1686
  let t = e.modules.filter((e) => e.path !== "").map((e) => e.path).sort(), n = {};
1640
- for (let e of X) n[e] = zn;
1641
- return Object.assign(n, Bn), e.modules.some((e) => e.scope === "software") && (n[Vn] = Hn), {
1687
+ for (let e of Z) n[e] = Wn;
1688
+ return Object.assign(n, Gn), e.modules.some((e) => e.scope === "software") && (n[qn] = Jn), {
1642
1689
  packages: t,
1643
1690
  catalog: n
1644
1691
  };
1645
1692
  }
1646
- function Wn() {
1647
- It();
1693
+ function Xn() {
1694
+ Ft();
1695
+ for (let e of Hn) Bt(e);
1648
1696
  }
1649
1697
  //#endregion
1650
1698
  //#region src/structure/rules/root-gitignore.ts
1651
- var Gn = [
1699
+ var Zn = [
1652
1700
  ".test_auth.json",
1653
1701
  "node_modules/",
1654
1702
  "dist/",
@@ -1663,34 +1711,34 @@ var Gn = [
1663
1711
  ".vscode/sftp.json",
1664
1712
  "test-dry-run.json"
1665
1713
  ];
1666
- function Kn() {
1667
- Bt(Gn);
1714
+ function Qn() {
1715
+ Vt(Zn);
1668
1716
  }
1669
1717
  //#endregion
1670
1718
  //#region src/structure/rules/root.ts
1671
- function qn() {
1672
- y("root", () => {
1673
- b(({ ctx: e }) => !e.isSdkInternal, () => {
1674
- S("turbo.json", E("root/turbo.json")), S(".vscode/settings.json", E("root/.vscode/settings.json")), C("package.json", D(() => En(v())), () => {
1675
- Dn();
1676
- }), C("pnpm-workspace.yaml", D(() => Un(v())), () => {
1677
- Wn();
1678
- }), C(".gitignore", E("root/.gitignore"), () => {
1679
- Kn();
1719
+ function $n() {
1720
+ b("root", () => {
1721
+ x(({ ctx: e }) => !e.isSdkInternal, () => {
1722
+ C("turbo.json", D("root/turbo.json")), C(".vscode/settings.json", D("root/.vscode/settings.json")), w("package.json", O(() => Dn(y())), () => {
1723
+ On();
1724
+ }), w("pnpm-workspace.yaml", O(() => Yn(y())), () => {
1725
+ Xn();
1726
+ }), w(".gitignore", D("root/.gitignore"), () => {
1727
+ Qn();
1680
1728
  });
1681
1729
  });
1682
1730
  });
1683
1731
  }
1684
1732
  //#endregion
1685
1733
  //#region src/structure/rules/block-package-json.ts
1686
- function Jn(e) {
1734
+ function er(e) {
1687
1735
  let t = {};
1688
- for (let n of K(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
1689
- for (let n of K(e, "model")) t.model = `${n.name}/dist/model.json`;
1690
- for (let n of K(e, "ui")) t.ui = `${n.name}/dist`;
1736
+ for (let n of q(e, "workflow")) t.workflow = `${n.name}/dist/tengo/tpl/main.plj.gz`;
1737
+ for (let n of q(e, "model")) t.model = `${n.name}/dist/model.json`;
1738
+ for (let n of q(e, "ui")) t.ui = `${n.name}/dist`;
1691
1739
  return t;
1692
1740
  }
1693
- function Yn(e) {
1741
+ function tr(e) {
1694
1742
  if (Object.keys(e.components).length === 0) throw Error("block.components is empty — no workflow/model/ui module was discovered");
1695
1743
  let t = e.meta, n = [
1696
1744
  ["block.meta.title", t.title],
@@ -1702,13 +1750,13 @@ function Yn(e) {
1702
1750
  ];
1703
1751
  for (let [e, t] of n) if (typeof t != "string" || t === "") throw Error(`required block field '${e}' is empty`);
1704
1752
  }
1705
- function Xn(e) {
1753
+ function nr(e) {
1706
1754
  let t = e.blockVars, n = {
1707
- ...q(e, "model"),
1708
- ...q(e, "ui"),
1709
- ...q(e, "workflow")
1755
+ ...J(e, "model"),
1756
+ ...J(e, "ui"),
1757
+ ...J(e, "workflow")
1710
1758
  }, r = {
1711
- components: Jn(e),
1759
+ components: er(e),
1712
1760
  meta: {
1713
1761
  title: t.shortName,
1714
1762
  description: `${t.shortName} block`,
@@ -1720,7 +1768,7 @@ function Xn(e) {
1720
1768
  }
1721
1769
  }
1722
1770
  };
1723
- return Yn(r), {
1771
+ return tr(r), {
1724
1772
  name: `${t.facadeName}.block`,
1725
1773
  version: "1.0.0",
1726
1774
  files: ["index.d.ts", "index.js"],
@@ -1738,24 +1786,24 @@ function Xn(e) {
1738
1786
  block: r
1739
1787
  };
1740
1788
  }
1741
- function Zn() {
1742
- F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), U("model"), U("ui"), U("workflow"), z("@platforma-sdk/block-tools", "sdk:"), z("shx", "catalog:"), F("block.components", Jn(v())), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1789
+ function rr() {
1790
+ F("files", ["index.d.ts", "index.js"]), I("build", "shx rm -rf ./block-pack && block-tools pack"), I("mark-stable", "block-tools mark-stable -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("prepublishOnly", "block-tools pack && block-tools publish -r 's3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1'"), I("do-pack", "shx rm -f *.tgz && block-tools pack && pnpm pack && shx mv *.tgz package.tgz"), W("model"), W("ui"), W("workflow"), B("@platforma-sdk/block-tools", "sdk:"), B("shx", "catalog:"), F("block.components", er(y())), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1743
1791
  }
1744
1792
  //#endregion
1745
1793
  //#region src/structure/rules/block.ts
1746
- function Qn() {
1747
- y("block", () => {
1748
- S("index.js", E("block/index.js")), S("index.d.ts", E("block/index.d.ts")), w("logos/block-logo.png", $e("block/logos/block-logo.png")), w("logos/organization-logo.png", $e("block/logos/organization-logo.png")), C("package.json", D(() => Xn(v())), () => {
1749
- Zn();
1794
+ function ir() {
1795
+ b("block", () => {
1796
+ C("index.js", D("block/index.js")), C("index.d.ts", D("block/index.d.ts")), T("logos/block-logo.png", Qe("block/logos/block-logo.png")), T("logos/organization-logo.png", Qe("block/logos/organization-logo.png")), w("package.json", O(() => nr(y())), () => {
1797
+ rr();
1750
1798
  });
1751
1799
  });
1752
1800
  }
1753
1801
  //#endregion
1754
1802
  //#region src/structure/rules/shared/colocated-tests.ts
1755
- var Z = "src/**/*.test.ts";
1803
+ var Q = "src/**/*.test.ts";
1756
1804
  //#endregion
1757
1805
  //#region src/structure/rules/model-package-json.ts
1758
- function $n(e) {
1806
+ function ar(e) {
1759
1807
  return {
1760
1808
  name: `${e.blockVars.facadeName}.model`,
1761
1809
  version: "1.0.0",
@@ -1781,8 +1829,7 @@ function $n(e) {
1781
1829
  devDependencies: {
1782
1830
  "@milaboratories/ts-builder": "sdk:",
1783
1831
  "@milaboratories/ts-configs": "sdk:",
1784
- "@platforma-sdk/block-tools": "sdk:",
1785
- vitest: "catalog:"
1832
+ "@platforma-sdk/block-tools": "sdk:"
1786
1833
  },
1787
1834
  peerDependencies: {
1788
1835
  "@types/node": "*",
@@ -1790,7 +1837,7 @@ function $n(e) {
1790
1837
  }
1791
1838
  };
1792
1839
  }
1793
- function er() {
1840
+ function or() {
1794
1841
  F("type", "module"), F("main", "dist/index.cjs"), F("module", "dist/index.js"), F("types", "dist/index.d.ts"), F("exports", {
1795
1842
  ".": {
1796
1843
  types: "./dist/index.d.ts",
@@ -1798,30 +1845,29 @@ function er() {
1798
1845
  import: "./dist/index.js"
1799
1846
  },
1800
1847
  "./dist/*": "./dist/*"
1801
- }), I("fmt", "ts-builder format"), I("watch", "ts-builder build --target block-model --watch"), I("build", "ts-builder build --target block-model && block-tools build-model"), I("check", "ts-builder check --target block-model"), R("@platforma-sdk/model", "sdk:"), V({
1848
+ }), I("fmt", "ts-builder format"), I("watch", "ts-builder build --target block-model --watch"), I("build", "ts-builder build --target block-model && block-tools build-model"), I("check", "ts-builder check --target block-model"), z("@platforma-sdk/model", "sdk:"), H({
1802
1849
  "@milaboratories/ts-builder": "sdk:",
1803
1850
  "@milaboratories/ts-configs": "sdk:",
1804
- "@platforma-sdk/block-tools": "sdk:",
1805
- vitest: "catalog:"
1806
- }), H({
1851
+ "@platforma-sdk/block-tools": "sdk:"
1852
+ }), U({
1807
1853
  "@types/node": "*",
1808
1854
  typescript: "*"
1809
- }), b(x(Z), () => {
1810
- I("test", "vitest run --passWithNoTests"), z("@types/node", "*");
1811
- }), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1855
+ }), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1856
+ I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
1857
+ }, () => V("vitest"))), Un(), Ot("tsup"), L("lint"), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1812
1858
  }
1813
1859
  //#endregion
1814
1860
  //#region src/structure/rules/model.ts
1815
- function tr() {
1816
- y("model", () => {
1817
- b(x(Z), () => S("tsconfig.json", E("model/tsconfig.node.json")), () => S("tsconfig.json", E("model/tsconfig.json"))), S(".oxlintrc.json", E("model/.oxlintrc.json")), S(".oxfmtrc.json", E("model/.oxfmtrc.json")), w("src/index.ts", E("model/src/index.ts")), C("package.json", D(() => $n(v())), () => {
1818
- er();
1861
+ function sr() {
1862
+ b("model", () => {
1863
+ x(S(Q), () => C("tsconfig.json", D("model/tsconfig.node.json")), () => C("tsconfig.json", D("model/tsconfig.json"))), C(".oxlintrc.json", D("model/.oxlintrc.json")), C(".oxfmtrc.json", D("model/.oxfmtrc.json")), T("src/index.ts", D("model/src/index.ts")), w("package.json", O(() => ar(y())), () => {
1864
+ or();
1819
1865
  });
1820
1866
  });
1821
1867
  }
1822
1868
  //#endregion
1823
1869
  //#region src/structure/rules/ui-package-json.ts
1824
- function nr(e) {
1870
+ function cr(e) {
1825
1871
  return {
1826
1872
  name: `${e.blockVars.facadeName}.ui`,
1827
1873
  version: "1.0.0",
@@ -1836,37 +1882,41 @@ function nr(e) {
1836
1882
  dependencies: {
1837
1883
  "@platforma-sdk/ui-vue": "sdk:",
1838
1884
  vue: "catalog:",
1839
- ...q(e, "model")
1885
+ ...J(e, "model")
1840
1886
  },
1841
1887
  devDependencies: {
1842
1888
  "@milaboratories/ts-builder": "sdk:",
1843
- "@milaboratories/ts-configs": "sdk:",
1844
- vitest: "catalog:"
1889
+ "@milaboratories/ts-configs": "sdk:"
1845
1890
  },
1846
- peerDependencies: { typescript: "*" }
1891
+ peerDependencies: {
1892
+ "@types/node": "*",
1893
+ typescript: "*"
1894
+ }
1847
1895
  };
1848
1896
  }
1849
- function rr() {
1850
- F("type", "module"), I("fmt", "ts-builder format"), I("dev", "ts-builder serve --target block-ui"), I("watch", "ts-builder build --target block-ui --watch"), I("build", "ts-builder build --target block-ui"), I("check", "ts-builder check --target block-ui"), R("@platforma-sdk/ui-vue", "sdk:"), R("vue", "catalog:"), U("model"), V({
1897
+ function lr() {
1898
+ F("type", "module"), I("fmt", "ts-builder format"), I("dev", "ts-builder serve --target block-ui"), I("watch", "ts-builder build --target block-ui --watch"), I("build", "ts-builder build --target block-ui"), I("check", "ts-builder check --target block-ui"), z("@platforma-sdk/ui-vue", "sdk:"), z("vue", "catalog:"), W("model"), H({
1851
1899
  "@milaboratories/ts-builder": "sdk:",
1852
- "@milaboratories/ts-configs": "sdk:",
1853
- vitest: "catalog:"
1854
- }), B("vue-tsc"), H({ typescript: "*" }), B("@types/node"), b(x(Z), () => {
1855
- I("test", "vitest run --passWithNoTests"), z("@types/node", "*");
1856
- }), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1900
+ "@milaboratories/ts-configs": "sdk:"
1901
+ }), Un(), L("preview"), L("lint"), U({
1902
+ "@types/node": "*",
1903
+ typescript: "*"
1904
+ }), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1905
+ I("test", "vitest run --passWithNoTests"), B("vitest", "catalog:"), B("@types/node", "*");
1906
+ }, () => V("vitest"))), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1857
1907
  }
1858
1908
  //#endregion
1859
1909
  //#region src/structure/rules/ui.ts
1860
- function ir() {
1861
- y("ui", () => {
1862
- b(x(Z), () => S("tsconfig.json", E("ui/tsconfig.node.json")), () => S("tsconfig.json", E("ui/tsconfig.json"))), S(".oxlintrc.json", E("ui/.oxlintrc.json")), S(".oxfmtrc.json", E("ui/.oxfmtrc.json")), Qe("index.html", E("ui/index.html")), w("src/main.ts", E("ui/src/main.ts")), w("src/app.ts", tt("ui/src/app.tpl.ts", () => ({ modelPkg: `${nt().facadeName}.model` }))), w("src/MainPage.vue", tt("ui/src/MainPage.tpl.vue", () => ({ shortName: nt().shortName }))), C("package.json", D(() => nr(v())), () => {
1863
- rr();
1910
+ function ur() {
1911
+ b("ui", () => {
1912
+ x(S(Q), () => C("tsconfig.json", D("ui/tsconfig.node.json")), () => C("tsconfig.json", D("ui/tsconfig.json"))), C(".oxlintrc.json", D("ui/.oxlintrc.json")), C(".oxfmtrc.json", D("ui/.oxfmtrc.json")), Ze("index.html", D("ui/index.html")), T("src/main.ts", D("ui/src/main.ts")), T("src/app.ts", et("ui/src/app.tpl.ts", () => ({ modelPkg: `${tt().facadeName}.model` }))), T("src/MainPage.vue", et("ui/src/MainPage.tpl.vue", () => ({ shortName: tt().shortName }))), w("package.json", O(() => cr(y())), () => {
1913
+ lr();
1864
1914
  });
1865
1915
  });
1866
1916
  }
1867
1917
  //#endregion
1868
1918
  //#region src/structure/rules/workflow-package-json.ts
1869
- function ar(e) {
1919
+ function dr(e) {
1870
1920
  return {
1871
1921
  name: `${e.blockVars.facadeName}.workflow`,
1872
1922
  version: "1.0.0",
@@ -1878,45 +1928,48 @@ function ar(e) {
1878
1928
  },
1879
1929
  dependencies: {
1880
1930
  "@platforma-sdk/workflow-tengo": "sdk:",
1881
- ...hn(e, "software")
1931
+ ...gn(e, "software")
1882
1932
  },
1883
1933
  devDependencies: {
1884
1934
  "@platforma-sdk/tengo-builder": "sdk:",
1885
1935
  "@platforma-sdk/test": "sdk:",
1886
- vitest: "catalog:",
1887
1936
  shx: "catalog:"
1888
1937
  }
1889
1938
  };
1890
1939
  }
1891
- function or() {
1892
- F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), b(x(Z), () => {
1893
- I("test", "vitest run --passWithNoTests");
1894
- }), R("@platforma-sdk/workflow-tengo", "sdk:"), U("software"), V({
1940
+ function fr() {
1941
+ F("type", "module"), I("build", "shx rm -rf dist && pl-tengo build"), I("check", "pl-tengo check"), I("format", "/usr/bin/env emacs --script ./format.el || echo 'No emacs.'"), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1942
+ I("test", "vitest run --passWithNoTests"), H({ vitest: "catalog:" });
1943
+ }, () => V("vitest"))), z("@platforma-sdk/workflow-tengo", "sdk:"), W("software"), H({
1895
1944
  "@platforma-sdk/tengo-builder": "sdk:",
1896
1945
  "@platforma-sdk/test": "sdk:",
1897
- vitest: "catalog:",
1898
1946
  shx: "catalog:"
1899
- }), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1947
+ }), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1900
1948
  }
1901
1949
  //#endregion
1902
1950
  //#region src/structure/rules/workflow.ts
1903
- function sr() {
1904
- y("workflow", () => {
1905
- S("tsconfig.json", E("workflow/tsconfig.json")), S("format.el", E("workflow/format.el")), Qe("vitest.config.mts", E("workflow/vitest.config.mts")), T("index.js"), T("index.d.ts"), w("src/main.tpl.tengo", tt("workflow/src/main.tpl.tengo", () => ({ shortName: nt().shortName }))), C("package.json", D(() => ar(v())), () => {
1906
- or();
1951
+ function pr() {
1952
+ b("workflow", () => {
1953
+ C("format.el", D("workflow/format.el")), x(({ ctx: e }) => !e.isSdkInternal, () => x(S(Q), () => {
1954
+ C("tsconfig.json", D("workflow/tsconfig.json")), Ze("vitest.config.mts", D("workflow/vitest.config.mts"));
1955
+ }, () => {
1956
+ E("tsconfig.json"), E("vitest.config.mts");
1957
+ })), E("index.js"), E("index.d.ts"), T("src/main.tpl.tengo", et("workflow/src/main.tpl.tengo", () => ({ shortName: tt().shortName }))), w("package.json", O(() => dr(y())), () => {
1958
+ fr();
1907
1959
  });
1908
1960
  });
1909
1961
  }
1910
1962
  //#endregion
1911
1963
  //#region src/structure/rules/test-package-json.ts
1912
- function cr(e) {
1964
+ function mr(e) {
1913
1965
  return {
1914
1966
  name: `${e.blockVars.facadeName}.test`,
1915
1967
  version: "1.0.0",
1916
1968
  private: !0,
1917
1969
  type: "module",
1918
1970
  scripts: {
1919
- check: "ts-builder type-check --target block-test",
1971
+ fmt: "ts-builder format",
1972
+ check: "ts-builder check --target block-test",
1920
1973
  test: "vitest run --passWithNoTests"
1921
1974
  },
1922
1975
  peerDependencies: { typescript: "*" },
@@ -1928,26 +1981,26 @@ function cr(e) {
1928
1981
  }
1929
1982
  };
1930
1983
  }
1931
- function lr() {
1932
- F("type", "module"), I("check", "ts-builder type-check --target block-test"), I("test", "vitest run --passWithNoTests"), V({
1984
+ function hr() {
1985
+ F("type", "module"), I("fmt", "ts-builder format"), I("check", "ts-builder check --target block-test"), I("test", "vitest run --passWithNoTests"), L("lint"), H({
1933
1986
  "@platforma-sdk/test": "sdk:",
1934
1987
  "@milaboratories/ts-builder": "sdk:",
1935
1988
  "@milaboratories/ts-configs": "sdk:",
1936
1989
  vitest: "catalog:"
1937
- }), H({ typescript: "*" }), B("@types/node"), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
1990
+ }), U({ typescript: "*" }), V("@types/node"), Un(), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1938
1991
  }
1939
1992
  //#endregion
1940
1993
  //#region src/structure/rules/test.ts
1941
- function ur() {
1942
- y("test", () => {
1943
- S("tsconfig.json", E("test/tsconfig.json")), Qe("vitest.config.mts", E("test/vitest.config.mts")), w("src/demo.test.ts", et("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), C("package.json", D(() => cr(v())), () => {
1944
- lr();
1994
+ function gr() {
1995
+ b("test", () => {
1996
+ C("tsconfig.json", D("test/tsconfig.json")), C(".oxlintrc.json", D("test/.oxlintrc.json")), C(".oxfmtrc.json", D("test/.oxfmtrc.json")), Ze("vitest.config.mts", D("test/vitest.config.mts")), T("src/demo.test.ts", $e("import { expect, test } from \"vitest\";\n\ntest(\"scaffolded block sanity check\", () => {\n expect(true).toBe(true);\n});\n")), w("package.json", O(() => mr(y())), () => {
1997
+ hr();
1945
1998
  });
1946
1999
  });
1947
2000
  }
1948
2001
  //#endregion
1949
2002
  //#region src/structure/rules/software-package-json.ts
1950
- function dr() {
2003
+ function _r() {
1951
2004
  return { entrypoints: { main: { binary: {
1952
2005
  artifact: {
1953
2006
  type: "python",
@@ -1962,7 +2015,7 @@ function dr() {
1962
2015
  cmd: ["python", "{pkg}/main.py"]
1963
2016
  } } } };
1964
2017
  }
1965
- function fr(e) {
2018
+ function vr(e) {
1966
2019
  return {
1967
2020
  name: `${e.blockVars.facadeName}.software`,
1968
2021
  version: "1.0.0",
@@ -1975,52 +2028,56 @@ function fr(e) {
1975
2028
  changeset: "changeset",
1976
2029
  "version-packages": "changeset version"
1977
2030
  },
1978
- "block-software": dr(),
2031
+ "block-software": _r(),
1979
2032
  devDependencies: {
1980
2033
  "@platforma-open/milaboratories.runenv-python-3": "catalog:",
1981
2034
  "@platforma-sdk/package-builder": "sdk:"
1982
2035
  }
1983
2036
  };
1984
2037
  }
1985
- function pr() {
1986
- F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"), V({
2038
+ function yr() {
2039
+ F("type", "module"), F("files", ["./dist/**/*"]), I("build", "pl-pkg build"), I("prepublishOnly", "pl-pkg prepublish"), I("changeset", "changeset"), I("version-packages", "changeset version"), H({
1987
2040
  "@platforma-open/milaboratories.runenv-python-3": "catalog:",
1988
2041
  "@platforma-sdk/package-builder": "sdk:"
1989
- }), G("dependencies"), G("devDependencies"), G("peerDependencies"), G("optionalDependencies"), W([...Y]);
2042
+ }), K("dependencies"), K("devDependencies"), K("peerDependencies"), K("optionalDependencies"), G([...X]);
1990
2043
  }
1991
2044
  //#endregion
1992
2045
  //#region src/structure/rules/software.ts
1993
- var mr = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", hr = "# No dependencies specified for this script\n";
1994
- function gr() {
1995
- y("software", () => {
1996
- w("src/main.py", et(mr)), w("src/requirements.txt", et(hr)), C("package.json", D(() => fr(v())), () => {
1997
- pr();
2046
+ var br = "import sys\n\nprint(\"Hello from Python, \" + sys.argv[1] + \"!\")\n", xr = "# No dependencies specified for this script\n";
2047
+ function Sr() {
2048
+ b("software", () => {
2049
+ T("src/main.py", $e(br)), T("src/requirements.txt", $e(xr)), w("package.json", O(() => vr(y())), () => {
2050
+ yr();
1998
2051
  });
1999
2052
  });
2000
2053
  }
2001
- function _r() {
2002
- y("model", () => {
2003
- T("eslint.config.mjs"), T("vite.config.mts");
2004
- }), y("ui", () => {
2005
- T("eslint.config.mjs"), T("vite.config.ts"), T("tsconfig.app.json"), T("tsconfig.node.json");
2006
- }), y("test", () => {
2007
- T("eslint.config.mjs");
2008
- }), y("root", () => {
2009
- T(".prettierrc"), C("package.json", D(() => En(v())), () => {
2010
- kt("pretty"), B("@platforma-sdk/blocks-deps-updater");
2054
+ function Cr() {
2055
+ b("model", () => {
2056
+ E("eslint.config.mjs"), E("vite.config.mts");
2057
+ }), b("ui", () => {
2058
+ E("eslint.config.mjs"), E("vite.config.ts"), E("tsconfig.app.json"), E("tsconfig.node.json");
2059
+ }), b("test", () => {
2060
+ E("eslint.config.mjs");
2061
+ }), b("root", () => {
2062
+ E(".prettierrc"), w("package.json", O(() => Dn(y())), () => {
2063
+ L("pretty"), V("@platforma-sdk/blocks-deps-updater");
2011
2064
  });
2012
2065
  });
2013
2066
  }
2014
2067
  //#endregion
2015
2068
  //#region src/structure/rules/root-catalog-bump.ts
2016
- function vr() {
2017
- Ze(() => {
2018
- y("root", () => {
2019
- b(({ ctx: e }) => !e.isSdkInternal, () => {
2020
- C("pnpm-workspace.yaml", D(() => Un(v())), () => {
2021
- for (let e of X) zt(e);
2022
- for (let [e, t] of Object.entries(Bn)) Rt(e, t);
2023
- v().modules.some((e) => e.scope === "software") && Rt(Vn, Hn);
2069
+ function wr() {
2070
+ Xe(() => {
2071
+ b("root", () => {
2072
+ x(({ ctx: e }) => !e.isSdkInternal, () => {
2073
+ w("pnpm-workspace.yaml", O(() => Yn(y())), () => {
2074
+ for (let e of Z) Rt(e);
2075
+ for (let e of Kn) zt(e.entry, {
2076
+ of: e.of,
2077
+ ofVersion: e.ofVersion
2078
+ });
2079
+ for (let [e, t] of Object.entries(Gn)) Lt(e, t);
2080
+ y().modules.some((e) => e.scope === "software") && Lt(qn, Jn);
2024
2081
  });
2025
2082
  });
2026
2083
  });
@@ -2028,24 +2085,25 @@ function vr() {
2028
2085
  }
2029
2086
  //#endregion
2030
2087
  //#region src/structure/structure-definition.ts
2031
- var yr = We(() => {
2032
- qn(), Qn(), tr(), ir(), sr(), ur(), gr(), _r(), vr();
2088
+ var Tr = Ue(() => {
2089
+ $n(), ir(), sr(), ur(), pr(), gr(), Sr(), Cr(), wr();
2033
2090
  });
2034
2091
  //#endregion
2035
2092
  //#region src/structure/cli/run-structure.ts
2036
- async function br() {
2037
- return Rn(X.filter(Ln));
2093
+ async function Er() {
2094
+ return zn(Z.filter(Rn));
2038
2095
  }
2039
- async function xr(e) {
2040
- let t = f.resolve(e.blockPath), n = e.mode === "check", r = new ke(t), i = new Ae(e.templatesRoot), a = sn(yr, r, Tn({
2096
+ async function Dr(e) {
2097
+ let t = p.resolve(e.blockPath), n = e.mode === "check", r = new Oe(t), i = new ke(e.templatesRoot), a = cn(Tr, r, En({
2041
2098
  fs: r,
2042
2099
  isSdkInternal: e.isSdkInternal,
2043
2100
  updateDepsOnly: e.updateDepsOnly,
2044
2101
  dryRun: n
2045
2102
  }), {
2046
2103
  templates: i,
2047
- registryLookup: e.updateDepsOnly ? await br() : void 0,
2048
- rediscover: () => Tn({
2104
+ registryLookup: e.updateDepsOnly ? await Er() : void 0,
2105
+ derivedPinLookup: e.updateDepsOnly ? await Vn(Kn) : void 0,
2106
+ rediscover: () => En({
2049
2107
  fs: r,
2050
2108
  isSdkInternal: e.isSdkInternal,
2051
2109
  updateDepsOnly: !1,
@@ -2057,22 +2115,22 @@ async function xr(e) {
2057
2115
  changes: a.changes
2058
2116
  };
2059
2117
  }
2060
- function Sr(e, t) {
2118
+ function Or(e, t) {
2061
2119
  if (t.length === 0) return ` ${e}: up to date (0 changes)`;
2062
2120
  let n = t.map((e) => ` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);
2063
2121
  return ` ${e}: ${t.length} change(s)\n${n.join("\n")}`;
2064
2122
  }
2065
2123
  //#endregion
2066
2124
  //#region src/cmd/structure/check.ts
2067
- var Cr = class e extends u {
2125
+ var kr = class e extends d {
2068
2126
  static description = "Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.";
2069
2127
  static examples = ["<%= config.bin %> <%= command.id %> ./my-block", "<%= config.bin %> <%= command.id %> --sdk-internal etc/blocks/*"];
2070
2128
  static strict = !1;
2071
- static flags = { "sdk-internal": d.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }) };
2129
+ static flags = { "sdk-internal": f.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }) };
2072
2130
  async run() {
2073
- let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = f.join(this.config.root, "src", "structure", "templates"), a = !1;
2131
+ let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates"), a = !1;
2074
2132
  for (let e of r) {
2075
- let t = await xr({
2133
+ let t = await Dr({
2076
2134
  blockPath: e,
2077
2135
  isSdkInternal: n["sdk-internal"],
2078
2136
  updateDepsOnly: !1,
@@ -2080,38 +2138,38 @@ var Cr = class e extends u {
2080
2138
  templatesRoot: i,
2081
2139
  log: (e) => this.log(e)
2082
2140
  });
2083
- this.log(Sr(e, t.changes)), t.changes.length > 0 && (a = !0);
2141
+ this.log(Or(e, t.changes)), t.changes.length > 0 && (a = !0);
2084
2142
  }
2085
2143
  a && this.error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.", { exit: 1 });
2086
2144
  }
2087
- }, Q = ["python"], wr = class extends Error {
2145
+ }, $ = ["python"], Ar = class extends Error {
2088
2146
  constructor(e) {
2089
2147
  super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`), this.name = "InitFlagError";
2090
2148
  }
2091
2149
  };
2092
- async function $(e, t, n, r) {
2150
+ async function jr(e, t, n, r) {
2093
2151
  if (e !== void 0 && e !== "") return e;
2094
- if (n) throw new wr(t);
2152
+ if (n) throw new Ar(t);
2095
2153
  return r();
2096
2154
  }
2097
- async function Tr(e) {
2098
- let t = await $(e.npmOrg, "npm-org", e.nonInteractive, () => fe({
2155
+ async function Mr(e) {
2156
+ let t = await jr(e.npmOrg, "npm-org", e.nonInteractive, () => de({
2099
2157
  message: "npm org (e.g. @platforma-open):",
2100
2158
  default: "@platforma-open"
2101
- })), n = await $(e.orgScope, "org-scope", e.nonInteractive, () => fe({ message: "org scope (e.g. my-org):" })), r = await $(e.shortName, "short-name", e.nonInteractive, () => fe({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2102
- i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await de({
2159
+ })), n = await jr(e.orgScope, "org-scope", e.nonInteractive, () => de({ message: "org scope (e.g. my-org):" })), r = await jr(e.shortName, "short-name", e.nonInteractive, () => de({ message: "block short name (e.g. mixcr-clonotyping):" })), i;
2160
+ i = e.withSoftware === void 0 ? e.nonInteractive ? !1 : await ue({
2103
2161
  message: "Include a software module?",
2104
2162
  default: !1
2105
2163
  }) : e.withSoftware;
2106
2164
  let a;
2107
2165
  if (i) {
2108
- if (a = await $(e.platform, "platform", e.nonInteractive, () => pe({
2166
+ if (a = await jr(e.platform, "platform", e.nonInteractive, () => fe({
2109
2167
  message: "Software platform:",
2110
- choices: Q.map((e) => ({
2168
+ choices: $.map((e) => ({
2111
2169
  name: e,
2112
2170
  value: e
2113
2171
  }))
2114
- })), !Q.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${Q.join(", ")} ${Q.length === 1 ? "is" : "are"} supported at v1.`);
2172
+ })), !$.includes(a)) throw Error(`Unsupported --platform '${a}'. Only ${$.join(", ")} ${$.length === 1 ? "is" : "are"} supported at v1.`);
2115
2173
  } else if (e.platform) throw Error("--platform was given but software is disabled (--no-software).");
2116
2174
  return {
2117
2175
  facadeName: `${t}/${n}.${r}`,
@@ -2122,59 +2180,60 @@ async function Tr(e) {
2122
2180
  softwarePlatform: a
2123
2181
  };
2124
2182
  }
2125
- async function Er(e) {
2126
- let t = e.vars, n = gn(t), r = new ke(e.blockPath), i = new Ae(e.templatesRoot), a = _n({
2183
+ async function Nr(e) {
2184
+ let t = e.vars, n = _n(t), r = new Oe(e.blockPath), i = new ke(e.templatesRoot), a = vn({
2127
2185
  blockVars: t,
2128
2186
  modules: n,
2129
2187
  isSdkInternal: !1,
2130
2188
  version: 1,
2131
2189
  dryRun: !1
2132
- }), o = X.filter(Ln), s;
2190
+ }), o = Z.filter(Rn), s, c;
2133
2191
  try {
2134
- s = await Rn(o);
2192
+ s = await zn(o), c = await Vn(Kn);
2135
2193
  } catch (e) {
2136
2194
  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)}`);
2137
2195
  }
2138
- return sn(yr, r, a, {
2196
+ return cn(Tr, r, a, {
2139
2197
  templates: i,
2140
2198
  initMode: !0,
2141
- registryLookup: s
2199
+ registryLookup: s,
2200
+ derivedPinLookup: c
2142
2201
  }), e.log(`Initialised block '${t.facadeName}'${t.softwarePlatform ? ` (software: ${t.softwarePlatform})` : " (no software)"} at ${e.blockPath}`), t;
2143
2202
  }
2144
2203
  //#endregion
2145
2204
  //#region src/cmd/index.ts
2146
- var Dr = {
2147
- "build-meta": me,
2148
- "build-model": ge,
2149
- "list-overview-snapshots": _e,
2150
- "mark-stable": ve,
2151
- pack: ye,
2152
- publish: xe,
2153
- "refresh-registry": Se,
2154
- "restore-overview-from-snapshot": Ce,
2155
- "update-deps": we,
2156
- "upload-package-v1": Oe,
2157
- "structure:check": Cr,
2158
- "structure:init": class e extends u {
2205
+ var Pr = {
2206
+ "build-meta": pe,
2207
+ "build-model": he,
2208
+ "list-overview-snapshots": ge,
2209
+ "mark-stable": _e,
2210
+ pack: ve,
2211
+ publish: be,
2212
+ "refresh-registry": xe,
2213
+ "restore-overview-from-snapshot": Se,
2214
+ "update-deps": Ce,
2215
+ "upload-package-v1": De,
2216
+ "structure:check": kr,
2217
+ "structure:init": class e extends d {
2159
2218
  static description = "Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.";
2160
2219
  static examples = ["<%= config.bin %> <%= command.id %> --npm-org @platforma-open --org-scope my-org --short-name demo --no-software --non-interactive", "<%= config.bin %> <%= command.id %> ./demo --npm-org @platforma-open --org-scope my-org --short-name demo --with-software --platform python --non-interactive"];
2161
- static args = { path: te.string({ description: "target directory (default: <short-name> under the current directory)" }) };
2220
+ static args = { path: u.string({ description: "target directory (default: <short-name> under the current directory)" }) };
2162
2221
  static flags = {
2163
- "npm-org": d.string({ description: "npm org, e.g. @platforma-open" }),
2164
- "org-scope": d.string({ description: "org scope, e.g. my-org" }),
2165
- "short-name": d.string({ description: "block short name, e.g. mixcr-clonotyping" }),
2166
- "with-software": d.boolean({ description: "include a software module" }),
2167
- "no-software": d.boolean({ description: "omit the software module" }),
2168
- platform: d.string({
2222
+ "npm-org": f.string({ description: "npm org, e.g. @platforma-open" }),
2223
+ "org-scope": f.string({ description: "org scope, e.g. my-org" }),
2224
+ "short-name": f.string({ description: "block short name, e.g. mixcr-clonotyping" }),
2225
+ "with-software": f.boolean({ description: "include a software module" }),
2226
+ "no-software": f.boolean({ description: "omit the software module" }),
2227
+ platform: f.string({
2169
2228
  description: "software platform (single-valued)",
2170
- options: [...Q]
2229
+ options: [...$]
2171
2230
  }),
2172
- "non-interactive": d.boolean({ description: "error on any missing flag instead of prompting" })
2231
+ "non-interactive": f.boolean({ description: "error on any missing flag instead of prompting" })
2173
2232
  };
2174
2233
  async run() {
2175
2234
  let { args: t, flags: n } = await this.parse(e);
2176
2235
  n["with-software"] && n["no-software"] && this.error("--with-software and --no-software are mutually exclusive.");
2177
- let r = n["with-software"] ? !0 : n["no-software"] ? !1 : void 0, i = await Tr({
2236
+ let r = n["with-software"] ? !0 : n["no-software"] ? !1 : void 0, i = await Mr({
2178
2237
  npmOrg: n["npm-org"],
2179
2238
  orgScope: n["org-scope"],
2180
2239
  shortName: n["short-name"],
@@ -2182,15 +2241,15 @@ var Dr = {
2182
2241
  platform: n.platform,
2183
2242
  nonInteractive: n["non-interactive"]
2184
2243
  });
2185
- await Er({
2244
+ await Nr({
2186
2245
  vars: i,
2187
- blockPath: t.path ? f.resolve(t.path) : f.resolve(process.cwd(), i.shortName),
2188
- templatesRoot: f.join(this.config.root, "src", "structure", "templates"),
2246
+ blockPath: t.path ? p.resolve(t.path) : p.resolve(process.cwd(), i.shortName),
2247
+ templatesRoot: p.join(this.config.root, "src", "structure", "templates"),
2189
2248
  log: (e) => this.log(e)
2190
2249
  });
2191
2250
  }
2192
2251
  },
2193
- "structure:refresh": class e extends u {
2252
+ "structure:refresh": class e extends d {
2194
2253
  static 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).";
2195
2254
  static examples = [
2196
2255
  "<%= config.bin %> <%= command.id %> ./my-block",
@@ -2199,13 +2258,13 @@ var Dr = {
2199
2258
  ];
2200
2259
  static strict = !1;
2201
2260
  static flags = {
2202
- "sdk-internal": d.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }),
2203
- "update-deps-only": d.boolean({ description: "fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh." })
2261
+ "sdk-internal": f.boolean({ description: "block(s) live inside the SDK monorepo; skip root-scope rules" }),
2262
+ "update-deps-only": f.boolean({ description: "fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh." })
2204
2263
  };
2205
2264
  async run() {
2206
- let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = f.join(this.config.root, "src", "structure", "templates");
2265
+ let { argv: t, flags: n } = await this.parse(e), r = t.length > 0 ? t : ["."], i = p.join(this.config.root, "src", "structure", "templates");
2207
2266
  for (let e of r) {
2208
- let t = await xr({
2267
+ let t = await Dr({
2209
2268
  blockPath: e,
2210
2269
  isSdkInternal: n["sdk-internal"],
2211
2270
  updateDepsOnly: n["update-deps-only"],
@@ -2213,12 +2272,12 @@ var Dr = {
2213
2272
  templatesRoot: i,
2214
2273
  log: (e) => this.log(e)
2215
2274
  });
2216
- this.log(Sr(e, t.changes));
2275
+ this.log(Or(e, t.changes));
2217
2276
  }
2218
2277
  }
2219
2278
  }
2220
2279
  };
2221
2280
  //#endregion
2222
- export { Dr as COMMANDS };
2281
+ export { Pr as COMMANDS };
2223
2282
 
2224
2283
  //# sourceMappingURL=cli.mjs.map