@platforma-sdk/block-tools 2.13.0 → 2.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +12 -12
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +728 -648
- package/dist/cli.mjs.map +1 -1
- package/dist/cmd/build-kind-manifest.d.ts +7 -0
- package/dist/config-CtXMWNgm.js +3 -0
- package/dist/config-CtXMWNgm.js.map +1 -0
- package/dist/{config-CiC347sB.mjs → config-Dx45aFJ_.mjs} +792 -456
- package/dist/config-Dx45aFJ_.mjs.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +15 -15
- package/dist/structure/engine/api.d.ts +1 -1
- package/dist/structure/rules/kind-package-json.d.ts +3 -0
- package/dist/structure/rules/kind.d.ts +1 -0
- package/dist/v2/build_kind_dist.d.ts +25 -0
- package/dist/v2/index.d.ts +4 -0
- package/dist/v2/kind/resolve-refs.d.ts +63 -0
- package/dist/v2/kind/version-match.d.ts +23 -0
- package/dist/v2/model/block_description.d.ts +8 -1
- package/dist/v2/publish-block.d.ts +23 -0
- package/dist/v2/registry/index.d.ts +2 -0
- package/dist/v2/registry/kind_resolver.d.ts +121 -0
- package/dist/v2/registry/registry.d.ts +23 -0
- package/dist/v2/registry/registry_reader.d.ts +34 -1
- package/dist/v2/registry/schema_kinds.d.ts +632 -0
- package/dist/v2/registry/schema_public.d.ts +72 -0
- package/package.json +7 -7
- package/src/cli.test.ts +2 -1
- package/src/cli.ts +2 -0
- package/src/cmd/build-kind-manifest.ts +41 -0
- package/src/cmd/publish.ts +10 -1
- package/src/structure/__tests__/model-package-json.snapshot.test.ts +1 -0
- package/src/structure/engine/api.ts +1 -1
- package/src/structure/engine/ctx.ts +1 -0
- package/src/structure/engine/discovery.ts +16 -2
- package/src/structure/rules/block-package-json.ts +18 -0
- package/src/structure/rules/kind-package-json.ts +117 -0
- package/src/structure/rules/kind.ts +29 -0
- package/src/structure/rules/model-package-json.ts +8 -0
- package/src/structure/rules/model.ts +15 -13
- package/src/structure/rules/root-pnpm-workspace.ts +1 -0
- package/src/structure/rules/shared/pascal-case.ts +1 -1
- package/src/structure/structure-definition.ts +2 -0
- package/src/structure/templates/static/kind/.oxfmtrc.json +4 -0
- package/src/structure/templates/static/kind/.oxlintrc.json +3 -0
- package/src/structure/templates/static/kind/src/index.ts +49 -0
- package/src/structure/templates/static/kind/tsconfig.json +10 -0
- package/src/structure/templates/text/model/src/index.tpl.ts +18 -0
- package/src/v2/build_dist.ts +35 -0
- package/src/v2/build_kind_dist.ts +104 -0
- package/src/v2/from_pack_v2.test.ts +2 -2
- package/src/v2/index.ts +4 -0
- package/src/v2/kind/resolve-refs.ts +150 -0
- package/src/v2/kind/version-match.test.ts +60 -0
- package/src/v2/kind/version-match.ts +55 -0
- package/src/v2/model/block_description.ts +15 -4
- package/src/v2/publish-block.ts +60 -0
- package/src/v2/registry/index.ts +2 -0
- package/src/v2/registry/kind_resolver.test.ts +123 -0
- package/src/v2/registry/kind_resolver.ts +190 -0
- package/src/v2/registry/registry.test.ts +247 -1
- package/src/v2/registry/registry.ts +227 -4
- package/src/v2/registry/registry_reader.ts +68 -0
- package/src/v2/registry/schema_kinds.test.ts +65 -0
- package/src/v2/registry/schema_kinds.ts +169 -0
- package/dist/config-BmJWc8sR.js +0 -3
- package/dist/config-BmJWc8sR.js.map +0 -1
- package/dist/config-CiC347sB.mjs.map +0 -1
- package/src/structure/templates/static/model/src/index.ts +0 -13
package/dist/cli.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./config-BmJWc8sR.js`);let t=require(`commander`),n=require(`node:path`);n=e.Tt(n);let r=require(`node:fs`);r=e.Tt(r);let i=require(`@milaboratories/pl-model-middle-layer`),a=require(`@milaboratories/ts-helpers`),o=require(`yaml`);o=e.Tt(o);let s=require(`node:timers/promises`),c=require(`node:os`);c=e.Tt(c);let l=require(`@inquirer/prompts`),u=require(`@platforma-sdk/package-builder-lib`),d=require(`node:child_process`),f=require(`@aws-sdk/client-ecr-public`);function p(){let i=new t.Command(`build-meta`).description(`Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section.`);return i.option(`-i, --modulePath <path>`,`input module path`,`.`),i.requiredOption(`-o, --destination <path>`,`output meta.json file`),i.action(async t=>{let i=n.default.resolve(t.modulePath),a=await e.st(await e.ut((await e.Y(i)).meta,i));await r.default.promises.writeFile(n.default.resolve(t.destination),JSON.stringify(a))}),i}async function ee(e){try{return await r.default.promises.readFile(e,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}function te(){let e=new t.Command(`build-model`).description(`Extracts and outputs block model JSON from pre-built block model module`);return e.option(`-i, --modulePath <path>`,`input module path`,`.`),e.option(`-b, --sourceBundle <path>`,`bundled model code to embed into the model for callback-based rendering to work`,`./dist/bundle.js`),e.option(`-o, --destination <path>`,`output model file`,`./dist/model.json`),e.action(async e=>{let t=n.default.resolve(e.modulePath),{model:i,platforma:a}=require(t);if(i||=a,!i)throw Error(`"model" export not found`);let{config:o}=i;if(!o)throw Error(`Malformed "model" object, check it is created with "BlockModel" and ".done()" is executed as the call in the chain.`);if(!(`outputs`in o)||!(`sections`in o))throw Error(`"config" has unexpected structure`);let s=await ee(e.sourceBundle);s!==void 0&&(o.code={type:`plain`,content:s}),await r.default.promises.writeFile(n.default.resolve(e.destination),JSON.stringify(o))}),e}function ne(){let r=new t.Command(`pack`).description(`Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder`);return r.option(`-i, --modulePath <path>`,`input module path`,`.`),r.option(`-o, --destinationPath <path>`,`output folder`,`./block-pack`),r.action(async t=>{await e.Q(await e.q(n.default.resolve(t.modulePath)),n.default.resolve(t.destinationPath))}),r}function re(e,t){let n={...e};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]=re(n[e],t[e]):n[e]=t[e];return n}function ie(){let o=new t.Command(`publish`).description(`Publishes the block package and refreshes the registry (for v2 block-pack schema)`);return o.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),o.addOption(new t.Option(`--registry-serve-url <url>`,`CDN serve URL written into block-pack/published.json (npm-consumed blocks)`).env(`PL_REGISTRY_SERVE_URL`).makeOptionMandatory()),o.option(`-m, --manifest <path>`,`manifest file path`,`./block-pack/${e.O}`),o.option(`-v, --version-override <path>`,`override package version`),o.addOption(new t.Option(`--refresh`,`refresh repository after adding the package`).default(!0).env(`PL_REGISTRY_REFRESH`)),o.option(`--no-refresh`,`do not refresh repository after adding the package`),o.addOption(new t.Option(`--unstable`,`do not add the published package to stable channel`).default(!1).env(`PL_PUBLISH_UNSTABLE`)),o.action(async t=>{let o=new a.ConsoleLoggerAdapter,s=n.default.resolve(t.manifest),c=JSON.parse(await r.default.promises.readFile(s,{encoding:`utf-8`})),l=i.BlockPackManifest.parse(c);l=re(c,l);let u=n.default.dirname(s);o.info(`Manifest root = ${u}`),t.versionOverride&&(l=(0,i.overrideManifestVersion)(l,t.versionOverride));let d=new e.b(e._(t.registry),o);await d.publishPackage(l,async e=>Buffer.from(await r.default.promises.readFile(n.default.resolve(u,e)))),t.unstable||(o.info(`Adding package to ${i.StableChannel} channel...`),await d.addPackageToChannel(l.description.id,i.StableChannel)),await e.W(u,e.H({registryUrl:t.registryServeUrl,id:l.description.id})),o.info(`Wrote published coordinates to ${n.default.resolve(u,`published.json`)}`),t.refresh&&await d.updateIfNeeded()}),o}function ae(){let n=new t.Command(`refresh-registry`).description(`Refresh overview files based on published but not proecessed artefacts`);return n.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),n.addOption(new t.Option(`-m, --mode <mode>`,`refresh mode (allowed valiues: "force", "normal", "dry-run")`).choices([`force`,`normal`,`dry-run`]).env(`PL_REGISTRY_REFRESH_DRY_RUN`).default(`normal`)),n.action(async t=>{await new e.b(e._(t.registry),new a.ConsoleLoggerAdapter).updateIfNeeded(t.mode)}),n}function oe(){let r=new t.Command(`mark-stable`).description(`Mark target block stable`);return r.option(`-i, --modulePath <path>`,`input module path`,`.`),r.addOption(new t.Option(`-c, --channel <channel name>`,`custom channel`).default(i.StableChannel).hideHelp()),r.option(`-v, --version-override <path>`,`override package version`),r.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),r.addOption(new t.Option(`--refresh`,`refresh repository after adding the package`).default(!0).env(`PL_REGISTRY_REFRESH`)),r.option(`--no-refresh`,`do not refresh repository after adding the package`),r.option(`--unmark`,`reverses meaning of this command, flag can be used to remove "stable" flag from the package`,!1),r.action(async t=>{let r=await e.Y(n.default.resolve(t.modulePath));t.versionOverride&&(r=(0,i.overrideDescriptionVersion)(r,t.versionOverride));let o=new e.b(e._(t.registry),new a.ConsoleLoggerAdapter);t.unmark?await o.removePackageFromChannel(r.id,t.channel):await o.addPackageToChannel(r.id,t.channel),t.refresh&&await o.updateIfNeeded()}),r}var se=class{constructor(e){this.root=e}abs(e){return n.default.resolve(this.root,e)}read(e){return r.default.readFileSync(this.abs(e),`utf-8`)}write(e,t){let i=this.abs(e);r.default.mkdirSync(n.default.dirname(i),{recursive:!0}),r.default.writeFileSync(i,t,`utf-8`)}writeBinary(e,t){let i=this.abs(e);r.default.mkdirSync(n.default.dirname(i),{recursive:!0}),r.default.writeFileSync(i,t)}exists(e){try{return r.default.statSync(this.abs(e)),!0}catch{return!1}}list(e){let t=this.abs(e);try{if(!r.default.statSync(t).isDirectory())return[]}catch{return[]}let i=[];function a(e,t){let o=r.default.readdirSync(t,{withFileTypes:!0});for(let r of o){let o=e?`${e}/${r.name}`:r.name,s=n.default.join(t,r.name);r.isDirectory()?a(o,s):r.isFile()&&i.push(o)}}return a(e===``||e===`.`?``:e,t),i.sort()}listDir(e){let t=this.abs(e),n;try{n=r.default.readdirSync(t,{withFileTypes:!0})}catch{return[]}return n.map(e=>({name:e.name,isDirectory:e.isDirectory()})).sort((e,t)=>e.name.localeCompare(t.name))}move(e,t){let i=this.abs(e),a=this.abs(t);r.default.mkdirSync(n.default.dirname(a),{recursive:!0}),r.default.renameSync(i,a)}delete(e){r.default.rmSync(this.abs(e),{recursive:!0,force:!0})}},ce=class{constructor(e){this.root=e}staticRead(e){return r.default.readFileSync(n.default.resolve(this.root,`static`,e),`utf-8`)}staticReadBinary(e){return r.default.readFileSync(n.default.resolve(this.root,`static`,e))}textRead(e){return r.default.readFileSync(n.default.resolve(this.root,`text`,e),`utf-8`)}};function le(e,t){return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(e,n)=>t[n]??`\${${n}}`)}var ue=[`default`,`init`];function de(e,t){if(!e)return t;if(!t)return e;let n=e.endsWith(`/`)?e.slice(0,-1):e,r=t.startsWith(`/`)?t.slice(1):t;return r?`${n}/${r}`:n}function fe(e,t){return e.filter(e=>e.scope===t).slice().sort((e,t)=>e.path.localeCompare(t.path))}function pe(e,t){let n=[];function r(e,i,a,o,s){if(e.kind===`scope`){let n=fe(t.modules,e.scope);for(let t of n)for(let n of e.children)r(n,e.scope,t.path,o,s);return}if(e.kind===`when`){let t=o.concat(e.trigger);for(let n of e.children)r(n,i,a,t,s);return}if(e.kind===`mode`){for(let t of e.children)r(t,i,a,o,e.modes);return}if(i===void 0||a===void 0)throw Error(`flatten: leaf '${he(e)}' is not inside a scope() frame`);if(e.kind===`rename`){n.push({leaf:e,scope:i,modulePath:a,resolvedPath:de(a,e.from),resolvedTo:de(a,e.to),triggers:o,modes:s});return}n.push({leaf:e,scope:i,modulePath:a,resolvedPath:de(a,me(e)),triggers:o,modes:s})}for(let t of e.children)r(t,void 0,void 0,[],ue);return n}function me(e){switch(e.kind){case`fixed`:case`managed`:case`scaffold`:case`seed`:case`remove`:return e.path;case`rename`:return e.from}}function he(e){return e.kind===`rename`?`rename ${e.from} -> ${e.to}`:`${e.kind} ${e.path}`}var ge=/[.+^${}()|[\]\\]/g;function _e(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(n++,e[n+1]===`/`?(n++,t+=`(?:.*/)?`):t+=`.*`):t+=`[^/]*`:r===`?`?t+=`[^/]`:t+=r.replace(ge,`\\$&`)}return RegExp(`^${t}$`)}function ve(e,t){return _e(e).test(t)}var m,h;function ye(e){if(!m)throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);return m}function g(e,t){let n=ye(e);n.stack[n.stack.length-1].push(t)}function be(e,t){let n=h;h=e;try{return t()}finally{h=n}}function xe(){return h}function Se(e){if(m)throw Error(`defineStructure() cannot be called from inside another defineStructure().`);let t=[],n={root:t,stack:[t],inScope:!1};m=n;try{if(e(),n.stack.length!==1)throw Error(`defineStructure: builder body left ${n.stack.length-1} unclosed group frame(s)`);let r={children:t};return Ce(r),r}finally{m=void 0}}function Ce(e){let t=new Map;function n(e,r){if(e.kind===`scope`){for(let t of e.children)n(t,e.scope);return}if(e.kind===`when`||e.kind===`mode`){for(let t of e.children)n(t,r);return}if(e.kind===`rename`)return;let i=t.get(r);i||(i=new Map,t.set(r,i));let a=i.get(e.path);a||(a=new Set,i.set(e.path,a)),a.add(e.kind)}for(let t of e.children)n(t,`(top-level)`);for(let[e,n]of t)for(let[t,r]of n)if(r.has(`seed`)&&(r.has(`managed`)||r.has(`fixed`)||r.has(`scaffold`))){let n=[...r].filter(e=>e!==`seed`).sort().join(`, `);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.`)}}function _(e,t){let n=ye(`scope`);if(n.inScope)throw Error(`scope() cannot nest. Already inside a scope.`);let r={kind:`scope`,scope:e,children:[]};n.stack[n.stack.length-1].push(r),n.stack.push(r.children),n.inScope=!0;try{t()}finally{n.stack.pop(),n.inScope=!1}}var we;function Te(e){we=e}function v(e,t,n){Ee(e,t),n&&Ee(t=>!e(t),n)}function Ee(e,t){if(m){De(e,t);return}if(!(we?.(e,t)??!1))throw Error(`when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.`)}function De(e,t){let n=m,r={kind:`when`,trigger:e,children:[]};n.stack[n.stack.length-1].push(r),n.stack.push(r.children);try{t()}finally{n.stack.pop()}}function y(e){return t=>t.filesMatch(e)}function Oe(e,t,n){let r=ye(e),i={kind:`mode`,modes:t,children:[]};r.stack[r.stack.length-1].push(i),r.stack.push(i.children);try{n()}finally{r.stack.pop()}}function ke(e){Oe(`onInitOrUpdate`,[`init`,`updateDeps`],e)}function b(e,t){g(`fixed`,{kind:`fixed`,path:e,content:t})}function x(e,t,n){g(`managed`,{kind:`managed`,path:e,initial:t,body:n})}function S(e,t){g(`scaffold`,{kind:`scaffold`,path:e,initial:t})}function C(e,t){g(`seed`,{kind:`seed`,path:e,initial:t})}function w(e){g(`remove`,{kind:`remove`,path:e})}function T(e){return{kind:`file`,path:e}}function Ae(e){return{kind:`binary`,path:e}}function je(e){return{kind:`text`,value:e}}function E(e,t){return{kind:`tpl`,path:e,vars:t}}function D(e){return{kind:`generate`,fn:e}}function Me(e){return JSON.parse(e)}var Ne=100,Pe=2;function Fe(e){return e.length===0?`[]`:`[`+e.map(Ie).join(`, `)+`]`}function Ie(e){if(Array.isArray(e))return Fe(e);if(k(e)){let t=Object.entries(e);return t.length===0?`{}`:`{ `+t.map(([e,t])=>`${JSON.stringify(e)}: ${Ie(t)}`).join(`, `)+` }`}return JSON.stringify(e)}function Le(e,t,n,r){let i=t+Pe,a=` `.repeat(i);if(Array.isArray(e)){let o=Fe(e);if(n+o.length+r<=Ne)return o;let s=e.length-1;return`[
|
|
2
|
-
`+e.map((e,t)=>a+
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./config-CtXMWNgm.js`);let t=require(`commander`),n=require(`node:path`);n=e.Xt(n);let r=require(`node:fs`);r=e.Xt(r);let i=require(`@milaboratories/pl-model-middle-layer`),a=require(`@platforma-sdk/package-builder-lib`),o=require(`@milaboratories/ts-helpers`),s=require(`yaml`);s=e.Xt(s);let c=require(`node:timers/promises`),l=require(`node:os`);l=e.Xt(l);let u=require(`@inquirer/prompts`),d=require(`node:child_process`),f=require(`@aws-sdk/client-ecr-public`);function p(){let i=new t.Command(`build-meta`).description(`Extracts meta information from blocks package.json and outputs meta.json with embedded binary and textual information linked from the meta section.`);return i.option(`-i, --modulePath <path>`,`input module path`,`.`),i.requiredOption(`-o, --destination <path>`,`output meta.json file`),i.action(async t=>{let i=n.default.resolve(t.modulePath),a=await e.Mt(await e.Ft((await e.vt(i)).meta,i));await r.default.promises.writeFile(n.default.resolve(t.destination),JSON.stringify(a))}),i}async function ee(e){try{return await r.default.promises.readFile(e,`utf8`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`)return;throw e}}function te(){let e=new t.Command(`build-model`).description(`Extracts and outputs block model JSON from pre-built block model module`);return e.option(`-i, --modulePath <path>`,`input module path`,`.`),e.option(`-b, --sourceBundle <path>`,`bundled model code to embed into the model for callback-based rendering to work`,`./dist/bundle.js`),e.option(`-o, --destination <path>`,`output model file`,`./dist/model.json`),e.action(async e=>{let t=n.default.resolve(e.modulePath),{model:i,platforma:a}=require(t);if(i||=a,!i)throw Error(`"model" export not found`);let{config:o}=i;if(!o)throw Error(`Malformed "model" object, check it is created with "BlockModel" and ".done()" is executed as the call in the chain.`);if(!(`outputs`in o)||!(`sections`in o))throw Error(`"config" has unexpected structure`);let s=await ee(e.sourceBundle);s!==void 0&&(o.code={type:`plain`,content:s}),await r.default.promises.writeFile(n.default.resolve(e.destination),JSON.stringify(o))}),e}function ne(){let n=new t.Command(`build-kind-manifest`).description(`Writes the block-kind dist manifest (identity + src source-hash) from a pre-built kind bundle`);return n.option(`-i, --modulePath <path>`,`kind package dir (contains package.json, src/, dist/)`,`.`),n.option(`-s, --srcDir <path>`,`source dir hashed into sourceHash, relative to modulePath`,`src`),n.option(`-o, --dst <path>`,`output dir with the compiled bundle, relative to modulePath`,`dist`),n.action(async t=>{await e.St({modulePath:t.modulePath,srcDir:t.srcDir,dst:t.dst})}),n}function re(){let r=new t.Command(`pack`).description(`Builds block pack and outputs a block pack manifest consolidating all references assets into a single folder`);return r.option(`-i, --modulePath <path>`,`input module path`,`.`),r.option(`-o, --destinationPath <path>`,`output folder`,`./block-pack`),r.action(async t=>{await e.Ct(await e.gt(n.default.resolve(t.modulePath)),n.default.resolve(t.destinationPath))}),r}function ie(e,t){let n={...e};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]=ie(n[e],t[e]):n[e]=t[e];return n}function ae(){let a=new t.Command(`publish`).description(`Publishes the block package and refreshes the registry (for v2 block-pack schema)`);return a.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),a.addOption(new t.Option(`--registry-serve-url <url>`,`CDN serve URL written into block-pack/published.json (npm-consumed blocks)`).env(`PL_REGISTRY_SERVE_URL`).makeOptionMandatory()),a.option(`-m, --manifest <path>`,`manifest file path`,`./block-pack/${e.M}`),a.option(`-v, --version-override <path>`,`override package version`),a.addOption(new t.Option(`--refresh`,`refresh repository after adding the package`).default(!0).env(`PL_REGISTRY_REFRESH`)),a.option(`--no-refresh`,`do not refresh repository after adding the package`),a.addOption(new t.Option(`--unstable`,`do not add the published package to stable channel`).default(!1).env(`PL_PUBLISH_UNSTABLE`)),a.action(async t=>{let a=new o.ConsoleLoggerAdapter,s=n.default.resolve(t.manifest),c=JSON.parse(await r.default.promises.readFile(s,{encoding:`utf-8`})),l=i.BlockPackManifest.parse(c);l=ie(c,l);let u=n.default.dirname(s),d=n.default.dirname(u);a.info(`Manifest root = ${u}`),a.info(`Facade root = ${d}`),t.versionOverride&&(l=(0,i.overrideManifestVersion)(l,t.versionOverride));let f=new e.w(e._(t.registry),a);await e.Y(f,l,d,async e=>Buffer.from(await r.default.promises.readFile(n.default.resolve(u,e)))),t.unstable||(a.info(`Adding package to ${i.StableChannel} channel...`),await f.addPackageToChannel(l.description.id,i.StableChannel)),await e.J(u,e.K({registryUrl:t.registryServeUrl,id:l.description.id})),a.info(`Wrote published coordinates to ${n.default.resolve(u,`published.json`)}`),t.refresh&&await f.updateIfNeeded()}),a}function oe(){let n=new t.Command(`refresh-registry`).description(`Refresh overview files based on published but not proecessed artefacts`);return n.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),n.addOption(new t.Option(`-m, --mode <mode>`,`refresh mode (allowed valiues: "force", "normal", "dry-run")`).choices([`force`,`normal`,`dry-run`]).env(`PL_REGISTRY_REFRESH_DRY_RUN`).default(`normal`)),n.action(async t=>{await new e.w(e._(t.registry),new o.ConsoleLoggerAdapter).updateIfNeeded(t.mode)}),n}function se(){let r=new t.Command(`mark-stable`).description(`Mark target block stable`);return r.option(`-i, --modulePath <path>`,`input module path`,`.`),r.addOption(new t.Option(`-c, --channel <channel name>`,`custom channel`).default(i.StableChannel).hideHelp()),r.option(`-v, --version-override <path>`,`override package version`),r.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),r.addOption(new t.Option(`--refresh`,`refresh repository after adding the package`).default(!0).env(`PL_REGISTRY_REFRESH`)),r.option(`--no-refresh`,`do not refresh repository after adding the package`),r.option(`--unmark`,`reverses meaning of this command, flag can be used to remove "stable" flag from the package`,!1),r.action(async t=>{let r=await e.vt(n.default.resolve(t.modulePath));t.versionOverride&&(r=(0,i.overrideDescriptionVersion)(r,t.versionOverride));let a=new e.w(e._(t.registry),new o.ConsoleLoggerAdapter);t.unmark?await a.removePackageFromChannel(r.id,t.channel):await a.addPackageToChannel(r.id,t.channel),t.refresh&&await a.updateIfNeeded()}),r}var ce=class{constructor(e){this.root=e}abs(e){return n.default.resolve(this.root,e)}read(e){return r.default.readFileSync(this.abs(e),`utf-8`)}write(e,t){let i=this.abs(e);r.default.mkdirSync(n.default.dirname(i),{recursive:!0}),r.default.writeFileSync(i,t,`utf-8`)}writeBinary(e,t){let i=this.abs(e);r.default.mkdirSync(n.default.dirname(i),{recursive:!0}),r.default.writeFileSync(i,t)}exists(e){try{return r.default.statSync(this.abs(e)),!0}catch{return!1}}list(e){let t=this.abs(e);try{if(!r.default.statSync(t).isDirectory())return[]}catch{return[]}let i=[];function a(e,t){let o=r.default.readdirSync(t,{withFileTypes:!0});for(let r of o){let o=e?`${e}/${r.name}`:r.name,s=n.default.join(t,r.name);r.isDirectory()?a(o,s):r.isFile()&&i.push(o)}}return a(e===``||e===`.`?``:e,t),i.sort()}listDir(e){let t=this.abs(e),n;try{n=r.default.readdirSync(t,{withFileTypes:!0})}catch{return[]}return n.map(e=>({name:e.name,isDirectory:e.isDirectory()})).sort((e,t)=>e.name.localeCompare(t.name))}move(e,t){let i=this.abs(e),a=this.abs(t);r.default.mkdirSync(n.default.dirname(a),{recursive:!0}),r.default.renameSync(i,a)}delete(e){r.default.rmSync(this.abs(e),{recursive:!0,force:!0})}},le=class{constructor(e){this.root=e}staticRead(e){return r.default.readFileSync(n.default.resolve(this.root,`static`,e),`utf-8`)}staticReadBinary(e){return r.default.readFileSync(n.default.resolve(this.root,`static`,e))}textRead(e){return r.default.readFileSync(n.default.resolve(this.root,`text`,e),`utf-8`)}};function ue(e,t){return e.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g,(e,n)=>t[n]??`\${${n}}`)}var de=[`default`,`init`];function fe(e,t){if(!e)return t;if(!t)return e;let n=e.endsWith(`/`)?e.slice(0,-1):e,r=t.startsWith(`/`)?t.slice(1):t;return r?`${n}/${r}`:n}function pe(e,t){return e.filter(e=>e.scope===t).slice().sort((e,t)=>e.path.localeCompare(t.path))}function me(e,t){let n=[];function r(e,i,a,o,s){if(e.kind===`scope`){let n=pe(t.modules,e.scope);for(let t of n)for(let n of e.children)r(n,e.scope,t.path,o,s);return}if(e.kind===`when`){let t=o.concat(e.trigger);for(let n of e.children)r(n,i,a,t,s);return}if(e.kind===`mode`){for(let t of e.children)r(t,i,a,o,e.modes);return}if(i===void 0||a===void 0)throw Error(`flatten: leaf '${ge(e)}' is not inside a scope() frame`);if(e.kind===`rename`){n.push({leaf:e,scope:i,modulePath:a,resolvedPath:fe(a,e.from),resolvedTo:fe(a,e.to),triggers:o,modes:s});return}n.push({leaf:e,scope:i,modulePath:a,resolvedPath:fe(a,he(e)),triggers:o,modes:s})}for(let t of e.children)r(t,void 0,void 0,[],de);return n}function he(e){switch(e.kind){case`fixed`:case`managed`:case`scaffold`:case`seed`:case`remove`:return e.path;case`rename`:return e.from}}function ge(e){return e.kind===`rename`?`rename ${e.from} -> ${e.to}`:`${e.kind} ${e.path}`}var _e=/[.+^${}()|[\]\\]/g;function ve(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(n++,e[n+1]===`/`?(n++,t+=`(?:.*/)?`):t+=`.*`):t+=`[^/]*`:r===`?`?t+=`[^/]`:t+=r.replace(_e,`\\$&`)}return RegExp(`^${t}$`)}function ye(e,t){return ve(e).test(t)}var m,h;function be(e){if(!m)throw Error(`${e}() called outside defineStructure(). Builders must run inside the lambda passed to defineStructure(...).`);return m}function g(e,t){let n=be(e);n.stack[n.stack.length-1].push(t)}function xe(e,t){let n=h;h=e;try{return t()}finally{h=n}}function Se(){return h}function Ce(e){if(m)throw Error(`defineStructure() cannot be called from inside another defineStructure().`);let t=[],n={root:t,stack:[t],inScope:!1};m=n;try{if(e(),n.stack.length!==1)throw Error(`defineStructure: builder body left ${n.stack.length-1} unclosed group frame(s)`);let r={children:t};return we(r),r}finally{m=void 0}}function we(e){let t=new Map;function n(e,r){if(e.kind===`scope`){for(let t of e.children)n(t,e.scope);return}if(e.kind===`when`||e.kind===`mode`){for(let t of e.children)n(t,r);return}if(e.kind===`rename`)return;let i=t.get(r);i||(i=new Map,t.set(r,i));let a=i.get(e.path);a||(a=new Set,i.set(e.path,a)),a.add(e.kind)}for(let t of e.children)n(t,`(top-level)`);for(let[e,n]of t)for(let[t,r]of n)if(r.has(`seed`)&&(r.has(`managed`)||r.has(`fixed`)||r.has(`scaffold`))){let n=[...r].filter(e=>e!==`seed`).sort().join(`, `);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.`)}}function _(e,t){let n=be(`scope`);if(n.inScope)throw Error(`scope() cannot nest. Already inside a scope.`);let r={kind:`scope`,scope:e,children:[]};n.stack[n.stack.length-1].push(r),n.stack.push(r.children),n.inScope=!0;try{t()}finally{n.stack.pop(),n.inScope=!1}}var Te;function Ee(e){Te=e}function v(e,t,n){De(e,t),n&&De(t=>!e(t),n)}function De(e,t){if(m){Oe(e,t);return}if(!(Te?.(e,t)??!1))throw Error(`when() called outside defineStructure() and outside any managed(...) body. Place this call inside one of the two.`)}function Oe(e,t){let n=m,r={kind:`when`,trigger:e,children:[]};n.stack[n.stack.length-1].push(r),n.stack.push(r.children);try{t()}finally{n.stack.pop()}}function y(e){return t=>t.filesMatch(e)}function ke(e,t,n){let r=be(e),i={kind:`mode`,modes:t,children:[]};r.stack[r.stack.length-1].push(i),r.stack.push(i.children);try{n()}finally{r.stack.pop()}}function Ae(e){ke(`onInitOrUpdate`,[`init`,`updateDeps`],e)}function b(e,t){g(`fixed`,{kind:`fixed`,path:e,content:t})}function x(e,t,n){g(`managed`,{kind:`managed`,path:e,initial:t,body:n})}function S(e,t){g(`scaffold`,{kind:`scaffold`,path:e,initial:t})}function C(e,t){g(`seed`,{kind:`seed`,path:e,initial:t})}function w(e){g(`remove`,{kind:`remove`,path:e})}function T(e){return{kind:`file`,path:e}}function je(e){return{kind:`binary`,path:e}}function Me(e){return{kind:`text`,value:e}}function E(e,t){return{kind:`tpl`,path:e,vars:t}}function D(e){return{kind:`generate`,fn:e}}function Ne(e){return JSON.parse(e)}var Pe=100,Fe=2;function Ie(e){return e.length===0?`[]`:`[`+e.map(Le).join(`, `)+`]`}function Le(e){if(Array.isArray(e))return Ie(e);if(k(e)){let t=Object.entries(e);return t.length===0?`{}`:`{ `+t.map(([e,t])=>`${JSON.stringify(e)}: ${Le(t)}`).join(`, `)+` }`}return JSON.stringify(e)}function Re(e,t,n,r){let i=t+Fe,a=` `.repeat(i);if(Array.isArray(e)){let o=Ie(e);if(n+o.length+r<=Pe)return o;let s=e.length-1;return`[
|
|
2
|
+
`+e.map((e,t)=>a+Re(e,i,i,t===s?0:1)).join(`,
|
|
3
3
|
`)+`
|
|
4
4
|
`+` `.repeat(t)+`]`}if(k(e)){let n=Object.entries(e);if(n.length===0)return`{}`;let r=n.length-1;return`{
|
|
5
|
-
`+n.map(([e,t],n)=>{let o=`${a}${JSON.stringify(e)}: `;return o+
|
|
5
|
+
`+n.map(([e,t],n)=>{let o=`${a}${JSON.stringify(e)}: `;return o+Re(t,i,o.length,n===r?0:1)}).join(`,
|
|
6
6
|
`)+`
|
|
7
|
-
`+` `.repeat(t)+`}`}return JSON.stringify(e)}function
|
|
7
|
+
`+` `.repeat(t)+`}`}return JSON.stringify(e)}function ze(e,t){return t?.collapse?Re(JSON.parse(JSON.stringify(e??null)),0,0,0)+`
|
|
8
8
|
`:JSON.stringify(e,null,2)+`
|
|
9
|
-
`}function O(e){return e===``||e===void 0?[]:e.split(`.`)}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function
|
|
10
|
-
`);return t.length>0&&t[t.length-1]===``&&t.pop(),t}function
|
|
9
|
+
`}function O(e){return e===``||e===void 0?[]:e.split(`.`)}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Be(e,t){let n=O(t),r=e;for(let e of n){if(!k(r))return;r=r[e]}return r}function Ve(e,t){let n=O(t);if(n.length===0)return!0;let r=e;for(let e=0;e<n.length-1;e++){if(!k(r))return!1;r=r[n[e]]}return k(r)?n[n.length-1]in r:!1}function He(e,t,n){let r=O(t);if(r.length===0)throw Error(`setAtPath: jsonPath must be non-empty`);let i=e;for(let e=0;e<r.length-1;e++){let t=r[e],n=i[t];if(n===void 0){let e={};i[t]=e,i=e}else if(k(n))i=n;else throw Error(`setAtPath: cannot descend into non-object at '${r.slice(0,e+1).join(`.`)}'`)}i[r[r.length-1]]=n}function Ue(e,t){let n=O(t);if(n.length===0)throw Error(`deleteAtPath: jsonPath must be non-empty`);let r=e;for(let e=0;e<n.length-1;e++){if(!k(r))return;r=r[n[e]]}k(r)&&delete r[n[n.length-1]]}function We(e,t){let n=new Set(t),r=Object.keys(e),i=new Map;i.set(``,[]);let a=``;for(let e of r)n.has(e)?(a=e,i.set(a,[])):i.get(a).push(e);let o={};for(let t of i.get(``))o[t]=e[t];for(let n of t)if(n in e){o[n]=e[n];for(let t of i.get(n)??[])o[t]=e[t]}return o}function Ge(e){let t=e.split(`
|
|
10
|
+
`);return t.length>0&&t[t.length-1]===``&&t.pop(),t}function Ke(e){return e.join(`
|
|
11
11
|
`)+`
|
|
12
|
-
`}function Ke(e){return e.replace(/(^|\s)#.*$/,`$1`).trim()}function qe(e,t){let n=Ke(e);return n===``?!1:n===t.trim()}function Je(e,t){for(let n of e)if(qe(n,t))return!0;return!1}function Ye(e,t){return e===`sdk:`?t?`workspace:*`:`catalog:`:e}var Xe=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`];function Ze(e,t){if(N(e))for(let n of Xe){let r=e[n];if(N(r))for(let e of Object.keys(r))r[e]===`sdk:`&&(r[e]=t?`workspace:*`:`catalog:`)}}var A;function Qe(e){if(!A)throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);return A}function j(e){let t=Qe(e);if(t.kind!==`json`)throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);return t}function M(e){let t=Qe(e);if(t.kind!==`yaml`)throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);return t}function $e(e){let t=Qe(e);if(t.kind!==`lines`)throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);return t}function et(e,t){let n=e.ctx??xe();if(!n)throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);return n}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tt(e,t,n={}){if(A)throw Error(`Nested managed(...) body — engine bug.`);A={kind:`json`,obj:e,ctx:n.ctx,triggerContext:n.triggerContext};try{return t(n.ctx??n.triggerContext?.ctx),e}finally{A=void 0}}function nt(e,t,n={}){if(A)throw Error(`Nested managed(...) body — engine bug.`);A={kind:`yaml`,doc:e,ctx:n.ctx,triggerContext:n.triggerContext,getLatestVersion:n.getLatestVersion,getDerivedDependencyPin:n.getDerivedDependencyPin};try{return t(n.ctx??n.triggerContext?.ctx),e}finally{A=void 0}}function rt(e,t,n={}){if(A)throw Error(`Nested managed(...) body — engine bug.`);A={kind:`lines`,lines:e,ctx:n.ctx,triggerContext:n.triggerContext};try{return t(n.ctx??n.triggerContext?.ctx),e}finally{A=void 0}}Te((e,t)=>{if(!A)return!1;let n=A.triggerContext;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.");return e(n)&&t(),!0});function P(e,t){Ve(j(`ensureField`).obj,e,t)}function F(e,t){let n=j(`removeField`).obj;Be(n,e)&&(t&&!t(ze(n,e))||He(n,e))}function it(e,t){let n=j(`requireField`).obj;if(!Be(n,e))throw Error(t??`requireField: missing field '${e}'`)}function at(e,t){let n=j(`ensureFieldEntries`).obj,r=Be(n,e)?ze(n,e):void 0,i=N(r)?r:{};for(let[e,n]of Object.entries(t))i[e]=n;N(r)||Ve(n,e,i)}function I(e,t){P(`scripts.${e}`,t)}function L(e){F(`scripts.${e}`)}var ot=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`];function R(e,t,n,r){let i=j(e),a=i.obj,o=n===`sdk:`?Ye(n,et(i,e).isSdkInternal):n;for(let e of ot){if(e===r)continue;let n=a[e];N(n)&&t in n&&delete n[t]}let s=a[r],c=N(s)?s:{};c[t]=o,N(s)||(a[r]=c)}function z(e,t){R(`ensureDep`,e,t,`dependencies`)}function B(e,t){R(`ensureDevDep`,e,t,`devDependencies`)}function st(e,t){R(`ensurePeerDep`,e,t,`peerDependencies`)}function V(e){let t=j(`removeDep`).obj;for(let n of ot){let r=t[n];N(r)&&e in r&&delete r[e]}}function H(e){for(let[t,n]of Object.entries(e))B(t,n)}function U(e){for(let[t,n]of Object.entries(e))st(t,n)}function ct(e,t,n){let r=et(j(e),e);for(let i of r.modules)i.scope===t&&R(e,i.name,`workspace:*`,n)}function lt(e){ct(`ensureWorkspaceScopeDeps`,e,`dependencies`)}function ut(e){ct(`ensureWorkspaceScopeDevDeps`,e,`devDependencies`)}function dt(e){let t=j(`pruneKeysMatching`).obj;for(let n of Object.keys(t))e(n,t[n])&&delete t[n]}function ft(e,t){let n=Ue(e,t);for(let t of Object.keys(e))delete e[t];for(let t of Object.keys(n))e[t]=n[t]}function W(e){ft(j(`enforceFieldOrder`).obj,e)}function pt(e,t){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];for(let t of Object.keys(e))delete e[t];for(let i of n)e[i]=r[i],t&&N(e[i])&&pt(e[i],!0)}function G(e=``,t={}){let n=t.recursive??!1;if(e===``&&!n)return;let r=j(`enforceAlphabeticalOrder`).obj;if(e===``){pt(r,!0);return}let i=ze(r,e);N(i)&&pt(i,n)}function mt(){let e=M(`ensureWorkspaceModulePaths`),t=et(e,`ensureWorkspaceModulePaths`).modules.filter(e=>e.path!==``).map(e=>e.path).sort(),n=e.doc.toJSON()?.packages;Array.isArray(n)&&n.length===t.length&&n.every((e,n)=>e===t[n])||e.doc.setIn([`packages`],t)}function ht(e,t){let n=e.doc.getIn([`catalog`,t]);return typeof n==`string`?n:void 0}function gt(e,t){let n=M(`ensureCatalogVersion`);ht(n,e)===void 0&&n.doc.setIn([`catalog`,e],t)}function _t(e){let t=M(`ensureCatalogLatest`);if(!t.getLatestVersion)return;let n=t.getLatestVersion(e);n!==void 0&&ht(t,e)!==n&&t.doc.setIn([`catalog`,e],n)}function vt(e,t){let n=M(`pinCatalogToDependencyOf`);if(!n.getDerivedDependencyPin)return;let r=n.getDerivedDependencyPin(e);r!==void 0&&ht(n,e)!==r&&n.doc.setIn([`catalog`,e],r)}function yt(e){let t=M(`ensureCatalogAbsent`);t.doc.hasIn([`catalog`,e])&&t.doc.deleteIn([`catalog`,e])}function bt(e){let t=$e(`ensureGitignoreEntries`);for(let n of e)Je(t.lines,n)||t.lines.push(n)}function xt(e){return(0,o.parseDocument)(e)}function St(e){return e.toString()}var Ct=`.structure`;function wt(e){if(!e.exists(`.structure`))return{version:0};try{let t=JSON.parse(e.read(Ct));return{version:typeof t?.version==`number`?t.version:0}}catch{return{version:0}}}function Tt(e,t=0){if(e<t)throw new Et(e,t)}var Et=class extends Error{constructor(e,t){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`}};function Dt(e,t){e.write(Ct,JSON.stringify(t))}var Ot=class extends Error{constructor(e){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`}};function kt(e,t,n,r){switch(e.kind){case`text`:return e.value;case`file`:if(!n)throw Error(`file('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);return n.staticRead(e.path);case`tpl`:if(!n)throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);return le(n.textRead(e.path),typeof e.vars==`function`?e.vars(r):e.vars);case`generate`:{let n=e.fn(r);if(t.endsWith(`.json`))return Ze(n,r.isSdkInternal),Re(n,{collapse:!t.endsWith(`package.json`)});if(t.endsWith(`.yaml`)||t.endsWith(`.yml`))return(0,o.stringify)(n);if(typeof n!=`string`)throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);return n}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.`)}}function At(e,t,n,r,i){if(n.kind===`binary`){if(!r)throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);e.writeBinary(t,r.staticReadBinary(n.path));return}e.write(t,kt(n,t,r,i))}function jt(e,t,n,r,i,a){let o=e.split(`/`).pop()??e;if(e.endsWith(`.json`)){let i=Me(t);if(typeof i!=`object`||!i||Array.isArray(i))throw Error(`managed: parsed value at '${e}' is not a JSON object`);return tt(i,n,{triggerContext:r}),Re(i,{collapse:o!==`package.json`})}if(e.endsWith(`.yaml`)||e.endsWith(`.yml`)){let e=xt(t);return nt(e,n,{triggerContext:r,getLatestVersion:i,getDerivedDependencyPin:a}),St(e)}if(o===`.gitignore`||o.endsWith(`.gitignore`)){let e=We(t);return rt(e,n,{triggerContext:r}),Ge(e)}throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`)}function Mt(e){let t=e.list(``),n=new Set;for(let e of t){n.add(e);let t=e.split(`/`);for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`))}return n}function Nt(e,t){let n=t===``?t:t.endsWith(`/`)?t.slice(0,-1):t;return e.has(n)}function Pt(e,t,n){return{ctx:t,version:t.version,pathExists:t=>Nt(e,t),pathMissing:t=>!Nt(e,t),filesMatch:t=>{let r=n?`${n}/${t}`:t;for(let t of e)if(ve(r,t))return!0;return!1}}}function Ft(e,t){for(let n of e.triggers)if(!n(t))return!1;return!0}function It(e,t){return t?`init`:e.updateDepsOnly?`updateDeps`:`default`}function Lt(e,t){return e.filter(e=>e.modes.includes(t))}function Rt(e,t,n,r,i,a){let o=e.leaf;if(o.kind===`fixed`){let i=kt(o.content,e.resolvedPath,r,a);return t.exists(e.resolvedPath)?t.read(e.resolvedPath)===i?void 0:(n||t.write(e.resolvedPath,i),{scope:e.scope,path:e.resolvedPath,primitive:`fixed`,action:`update`}):(n||t.write(e.resolvedPath,i),{scope:e.scope,path:e.resolvedPath,primitive:`fixed`,action:`create`})}if(o.kind===`scaffold`)return t.exists(e.resolvedPath)?void 0:(n||At(t,e.resolvedPath,o.initial,r,a),{scope:e.scope,path:e.resolvedPath,primitive:`scaffold`,action:`create`});if(o.kind===`seed`)return!i||t.exists(e.resolvedPath)?void 0:(n||At(t,e.resolvedPath,o.initial,r,a),{scope:e.scope,path:e.resolvedPath,primitive:`seed`,action:`create`});if(o.kind===`remove`)return t.exists(e.resolvedPath)?(n||t.delete(e.resolvedPath),{scope:e.scope,path:e.resolvedPath,primitive:`remove`,action:`delete`}):void 0;if(o.kind===`rename`){if(!t.exists(e.resolvedPath))return;let r=e.resolvedTo;return t.exists(r)?void 0:(n||t.move(e.resolvedPath,r),{scope:e.scope,path:e.resolvedPath,primitive:`rename`,action:`rename`})}}function zt(e,t,n,r,i,a,o,s){if(e.leaf.kind!==`managed`)return;let c=e.leaf,l=e.resolvedPath,u=t.exists(l),d,f=!1;u?d=t.read(l):(d=kt(c.initial,l,i,s),f=!0);let p=jt(l,d,c.body,r,a,o);if(f)return n||t.write(l,p),{scope:e.scope,path:l,primitive:`managed`,action:`create`};if(p!==d)return n||t.write(l,p),{scope:e.scope,path:l,primitive:`managed`,action:`update`}}function Bt(e,t,n,r,i,a,o,s){let c=Lt(e,It(n,a)),l=[],u=Mt(t);for(let e of c){if(e.leaf.kind===`managed`||!Ft(e,Pt(u,n,e.modulePath)))continue;let o=Rt(e,t,r,i,a,n);o&&l.push(o)}let d=Mt(t);for(let e of c){if(e.leaf.kind!==`managed`)continue;let a=Pt(d,n,e.modulePath);if(!Ft(e,a))continue;let c=zt(e,t,r,a,i,o,s,n);c&&l.push(c)}return l}function Vt(e,t,n,r={}){return be(n,()=>{let i=pe(e,n),a=!!r.initMode,o=Bt(i,t,n,n.dryRun,r.templates,a,r.registryLookup,r.derivedPinLookup);if(!n.dryRun&&!n.updateDepsOnly&&!a){Dt(t,{version:2});let i={...r.rediscover?r.rediscover(t):n,dryRun:!0},a=Bt(pe(e,i),t,i,!0,r.templates,!1,r.registryLookup,r.derivedPinLookup).filter(e=>e.path!==Ct);if(a.length>0)throw new Ot(a[0])}return a&&!n.dryRun&&Dt(t,{version:2}),{changes:o}})}var Ht=[`root`,`block`,`model`,`ui`,`workflow`,`test`,`software`],Ut=class extends Error{constructor(e,t){super(e),this.path=t,this.name=`DiscoveryError`}};function Wt(e){let t=new Set;for(let n of[e.dependencies,e.devDependencies,e.peerDependencies,e.optionalDependencies])if(n)for(let e of Object.keys(n))t.add(e);return t}function Gt(e){return e===``||e===`.`}function Kt(e){let t=e.pkg[`block-scope`];if(typeof t==`string`){if(!Ht.includes(t))throw new Ut(`package.json "block-scope" must be one of ${Ht.join(`, `)}, got '${t}'`,e.path);return t}if(Gt(e.path))return`root`;if(e.pkg.block!==void 0)return`block`;let n=Wt(e.pkg);if(e.pkg[`block-software`]!==void 0)return`software`;if(n.has(`@platforma-sdk/package-builder`)){for(let e of n)if(/^@platforma-open\/.*runenv/.test(e))return`software`}if(n.has(`@platforma-sdk/workflow-tengo`))return`workflow`;if((n.has(`@platforma-sdk/ui-vue`)||n.has(`vue`))&&!e.pkg.main)return`ui`;if(n.has(`@platforma-sdk/model`)&&e.pkg.main)return`model`;if(n.has(`@platforma-sdk/test`))return`test`}function qt(e){let t=[];for(let n of e){let e=Kt(n);if(!e)throw new Ut(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`,n.path);t.push({scope:e,name:n.pkg.name??n.path,path:Gt(n.path)?``:n.path})}return t}function K(e,t){return e.modules.filter(e=>e.scope===t)}function Jt(e,t){let n=K(e,t);if(n.length===0)throw Error(`findModule: expected one '${t}' module, found none`);if(n.length>1)throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);return n[0]}function Yt(e,t){return{[Jt(e,t).name]:`workspace:*`}}function q(e,t){let n={};for(let r of K(e,t))n[r.name]=`workspace:*`;return n}function Xt(e){let t=e.facadeName,n=[{scope:`root`,name:t,path:``},{scope:`block`,name:`${t}.block`,path:`block`},{scope:`model`,name:`${t}.model`,path:`model`},{scope:`ui`,name:`${t}.ui`,path:`ui`},{scope:`workflow`,name:`${t}.workflow`,path:`workflow`},{scope:`test`,name:`${t}.test`,path:`test`}];return e.softwarePlatform&&n.push({scope:`software`,name:`${t}.software`,path:`software`}),n}function Zt(e){return{isSdkInternal:e.isSdkInternal??!1,updateDepsOnly:e.updateDepsOnly??!1,modules:e.modules,blockVars:e.blockVars,version:e.version??0,dryRun:e.dryRun??!1}}var J=class extends Error{constructor(e){super(e),this.name=`StructureCliError`}};function Qt(e,t){return e===``?t:`${e}/${t}`}function $t(e,t){try{return JSON.parse(e.read(t))}catch{return}}function en(e){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.`);let t=e.replace(/^\.\//,``).replace(/\/$/,``);return t===`.`?``:t}function tn(e){let t;try{t=e.read(`pnpm-workspace.yaml`)}catch{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.`)}let n=(0,o.parse)(t)??{},r=Array.isArray(n.packages)?n.packages:[],i=new Set([``]);for(let t of r){let n=en(t);(n===``||e.exists(n))&&i.add(n)}let a=[];for(let t of i){let n=$t(e,Qt(t,`package.json`));n&&a.push({path:t,pkg:n})}return a}function nn(e){let t=[],n=new Set([`node_modules`,`.turbo`,`dist`,`.git`,`block-pack`]);function r(i,a){let o=e.listDir(i);for(let s of o){if(!s.isDirectory||n.has(s.name))continue;let o=Qt(i,s.name),c=$t(e,Qt(o,`package.json`));c&&t.push({path:o,pkg:c}),a<2&&r(o,a+1)}}return r(``,1),t}function rn(e){let t=e.indexOf(`/`);if(!e.startsWith(`@`)||t<0)throw new J(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);let n=e.slice(0,t),r=e.slice(t+1),i=r.indexOf(`.`);if(i<0)throw new J(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);return{facadeName:e,baseName:r,npmOrg:n,orgScope:r.slice(0,i),shortName:r.slice(i+1)}}function an(e){let{fs:t,isSdkInternal:n}=e,r=n?nn(t):tn(t);if(r.length===0)throw new J(`No workspace packages found. Run 'block-tools structure init' to scaffold a block.`);let i=qt(r),a=wt(t);Tt(a.version,0);let o=i.find(e=>e.scope===`block`)??i.find(e=>e.scope===`root`);if(!o)throw new J(`Could not find a 'block' (or root-as-block) package to derive BlockVars from.`);let s=rn(o.name.replace(/\.block$/,``));return Zt({isSdkInternal:n,updateDepsOnly:e.updateDepsOnly??!1,modules:i,blockVars:s,version:a.version,dryRun:e.dryRun??!1})}var Y=[`name`,`version`,`private`,`description`,`keywords`,`files`,`type`,`main`,`module`,`types`,`exports`,`scripts`,`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`,`packageManager`,`pnpm`,`block`,`block-software`],on={"build:dev-local":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build`,"build:dev-remote":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build`,"build:dev-no-software":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build`,"build:dev-binary-existing":`env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build`,"build:release":`env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build`},sn={test:`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1`,"test:dry-run":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json`};function cn(){return{version:`1.0.0`,private:!0,scripts:{fmt:`turbo run fmt`,check:`turbo run check`,...on,...sn,"mark-stable":`turbo run mark-stable`,"do-pack":`turbo run do-pack`,watch:`turbo watch build`,changeset:`changeset`,"version-packages":`changeset version`,"update-sdk":`block-tools structure refresh --update-deps-only`,"upgrade-sdk":`block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt`},peerDependencies:{oxlint:`*`,oxfmt:`*`},devDependencies:{"@changesets/cli":`catalog:`,"@milaboratories/ts-builder":`sdk:`,"@platforma-sdk/block-tools":`sdk:`,shx:`catalog:`,turbo:`catalog:`},packageManager:`pnpm@9.12.0`}}function ln(){P(`packageManager`,`pnpm@9.12.0`),F(`name`),I(`fmt`,`turbo run fmt`),I(`check`,`turbo run check`);for(let[e,t]of Object.entries(on))I(e,t);for(let[e,t]of Object.entries(sn))I(e,t);L(`build`),L(`build:dev`),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({"@changesets/cli":`catalog:`,"@milaboratories/ts-builder":`sdk:`,"@platforma-sdk/block-tools":`sdk:`,shx:`catalog:`,turbo:`catalog:`}),U({oxlint:`*`,oxfmt:`*`}),dt((e,t)=>{if(!/^(\/\/|--)/.test(e)||typeof t!=`object`||!t)return!1;let n=t;return n.pnpm!==void 0||n.overrides!==void 0}),G(`dependencies`),G(`devDependencies`),G(`peerDependencies`),G(`optionalDependencies`),W([...Y])}var un=`https://turbo.build/schema.json`,dn=[`tsconfig.json`],fn={fmt:{cache:!1},check:{dependsOn:[`^build`],outputs:[]},build:{dependsOn:[`^build`,`check`],inputs:[`$TURBO_DEFAULT$`],env:[`PL_DOCKER_REGISTRY_PUSH_TO`,`PL_BUILD_CHANNEL`,`PL_BUILD_VARIANT`,`PL_BUILD_LOCATION`,`PL_BUILD_USE_PUBLISHED`,`PL_DEV_DOCKER_PUSH_URL`,`PL_DEV_DOCKER_PULL_URL`,`PL_DEV_BINARY_UPLOAD_URL`,`PL_RELEASE_DOCKER_PUSH_URL`,`PL_RELEASE_DOCKER_PULL_URL`,`PL_RELEASE_BINARY_UPLOAD_URL`,`PL_REGISTRY_PLATFORMA_OPEN_UPLOAD_URL`],passThroughEnv:[`AWS_*`,`PL_AWS_*`],outputs:[`./dist/**`,`./block-pack/**`,`./pkg-*.tgz`]},"do-pack":{dependsOn:[`build`],outputs:[`package.tgz`]},test:{dependsOn:[`build`,`check`],passThroughEnv:[`PL_ADDRESS`,`PL_TEST_PASSWORD`,`PL_TEST_USER`,`PL_TEST_PROXY`,`DEBUG`]},"mark-stable":{passThroughEnv:[`PL_REGISTRY`,`AWS_*`],cache:!1}};function pn(){return{$schema:un,globalDependencies:dn,tasks:{...fn}}}function mn(){P(`$schema`,un),P(`globalDependencies`,dn),at(`tasks`,fn),F(`tasks.build:dev`),W([`$schema`,`globalDependencies`,`tasks`])}var hn=2,gn=500,_n=3e4;function vn(e){if(!e)return null;let t=Number(e);if(Number.isFinite(t)&&t>0)return t*1e3;let n=Date.parse(e);return Number.isNaN(n)?null:Math.max(0,n-Date.now())}async function yn(e){for(let t=1;;t++){let n;try{n=await fetch(e,{signal:AbortSignal.timeout(_n)})}catch(e){if(t>hn)throw e;await(0,s.setTimeout)(gn*2**(t-1)*(.8+.4*Math.random()));continue}if(n.ok)return n;if(!(n.status===429||n.status>=500)||t>hn)throw Error(`registry returned HTTP ${n.status}`);let r=vn(n.headers.get(`retry-after`));if(r!=null){await(0,s.setTimeout)(r);continue}await(0,s.setTimeout)(gn*2**(t-1)*(.8+.4*Math.random()))}}function bn(){return{async getLatestVersion(e){let t=(await(await yn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;if(!t)throw Error(`no 'latest' dist-tag in registry response`);return t},async getDeclaredDependency(e,t,n){let r=await(await yn(`https://registry.npmjs.org/${e}/${t}`)).json();return r.dependencies?.[n]??r.peerDependencies?.[n]}}}async function xn(e,t){let n=await Promise.all(t.map(async t=>[t,await e.getLatestVersion(t)]));return new Map(n)}function Sn(e){return t=>e.get(t)}var Cn=[/^@platforma-sdk\//,/^@milaboratories\//];function wn(e){return Cn.some(t=>t.test(e))}async function Tn(e,t=bn()){return e.length===0?()=>void 0:Sn(await xn(t,e))}function En(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e)}async function Dn(e,t=bn()){if(e.length===0)return()=>void 0;let n=await Promise.all(e.map(async e=>{let n=await t.getDeclaredDependency(e.of,e.ofVersion??`latest`,e.entry);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.`);if(!En(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.`);return[e.entry,n]})),r=new Map(n);return e=>r.get(e)}var On=[`vite`,`tsup`,`vue-tsc`,`@vitejs/plugin-vue`,`vite-plugin-dts`,`@platforma-sdk/eslint-config`];function X(){for(let e of On)V(e)}var Z=[`@platforma-sdk/model`,`@platforma-sdk/ui-vue`,`@platforma-sdk/workflow-tengo`,`@platforma-sdk/test`,`@platforma-sdk/block-tools`,`@platforma-sdk/tengo-builder`,`@platforma-sdk/package-builder`,`@milaboratories/ts-builder`,`@milaboratories/ts-configs`],kn=`0.0.0-init-must-fetch`;for(let e of Z)if(!wn(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.`);var An={turbo:`~2.8.11`,shx:`~0.4.0`,"@changesets/cli":`~2.29.8`,vitest:`~4.0.18`},jn=[{entry:`vue`,of:`@platforma-sdk/ui-vue`},{entry:`@milaboratories/helpers`,of:`@platforma-sdk/model`}],Mn=`@platforma-open/milaboratories.runenv-python-3`,Nn=`1.8.2`;function Pn(e){let t=e.modules.filter(e=>e.path!==``).map(e=>e.path).sort(),n={};for(let e of Z)n[e]=kn;return Object.assign(n,An),e.modules.some(e=>e.scope===`software`)&&(n[Mn]=Nn),{packages:t,catalog:n}}function Fn(){mt();for(let e of On)yt(e)}var In=[`.test_auth.json`,`node_modules/`,`dist/`,`block-pack/`,`dev/`,`work/`,`log/`,`.turbo`,`vite.config.*.timestamp-*`,`software/**/*.tgz`,`.DS_Store`,`.vscode/sftp.json`,`test-dry-run.json`];function Ln(){bt(In)}function Rn(){_(`root`,()=>{v(({ctx:e})=>!e.isSdkInternal,()=>{x(`turbo.json`,D(()=>pn()),()=>{mn()}),b(`.vscode/settings.json`,T(`root/.vscode/settings.json`)),x(`package.json`,D(()=>cn()),()=>{ln()}),x(`pnpm-workspace.yaml`,D(e=>Pn(e)),()=>{Fn()}),x(`.gitignore`,T(`root/.gitignore`),()=>{Ln()})})})}function zn(e){return e.split(/[-_]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Bn(){_(`root`,()=>{v(({ctx:e})=>!e.isSdkInternal,()=>{b(`.github/workflows/build.yaml`,E(`workflows/build.tpl.yaml`,e=>{let t=e.blockVars.shortName;return{appName:`Block: ${zn(t)}`,appNameSlug:`block-${t}`}})),b(`.github/workflows/mark-stable.yaml`,E(`workflows/mark-stable.tpl.yaml`,e=>({appName:`Block: ${zn(e.blockVars.shortName)} - Mark Stable`})))})})}var Vn={"@platforma-open":{s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1`,serveUrl:`https://blocks.pl-open.science`},"@milaboratories":{s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1`,serveUrl:`https://block.registry.platforma.bio/releases`}},Hn={s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1`,serveUrl:`https://blocks.pl-open.science`},Un={s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1`,serveUrl:`https://aux-blocks.pl-open.science`};function Wn(e,t){let n=t?Un:Vn[e]??Hn;return`block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`}function Gn(e){let t={};for(let n of K(e,`workflow`))t.workflow=`${n.name}/dist/tengo/tpl/main.plj.gz`;for(let n of K(e,`model`))t.model=`${n.name}/dist/model.json`;for(let n of K(e,`ui`))t.ui=`${n.name}/dist`;return t}function Kn(e,t){return{build:`ts-builder build --target block-facade && block-tools pack`,check:`ts-builder type-check --target block-facade`,prepublishOnly:Wn(e,t),"do-pack":`shx rm -f package.tgz && pnpm pack && shx mv *.tgz package.tgz`}}var qn={"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`,"@platforma-sdk/model":`sdk:`,shx:`catalog:`,typescript:`catalog:`},Jn={".":{sources:`./src/index.ts`,types:`./dist/index.d.ts`,default:`./dist/index.js`}};function Yn(e){if(Object.keys(e.components).length===0)throw Error(`block.components is empty — no workflow/model/ui module was discovered`);let t=e.meta,n=[[`block.meta.title`,t.title],[`block.meta.description`,t.description],[`block.meta.logo`,t.logo],[`block.meta.organization.name`,t.organization?.name],[`block.meta.organization.url`,t.organization?.url],[`block.meta.organization.logo`,t.organization?.logo]];for(let[e,t]of n)if(typeof t!=`string`||t===``)throw Error(`required block field '${e}' is empty`)}function Xn(e){let t=e.blockVars,n={...qn,...q(e,`model`),...q(e,`ui`),...q(e,`workflow`)},r={components:Gn(e),meta:{title:t.shortName,description:`${t.shortName} block`,logo:`file:logos/block-logo.png`,organization:{name:t.orgScope,url:`https://example.com`,logo:`file:logos/organization-logo.png`}}};return Yn(r),{name:`${t.facadeName}.block`,version:`1.0.0`,type:`module`,files:[`dist`,`block-pack`],main:`./dist/index.js`,module:`./dist/index.js`,types:`./dist/index.d.ts`,exports:Jn,scripts:Kn(t.npmOrg,e.isSdkInternal),dependencies:{},devDependencies:n,block:r}}function Zn(e){let t=e.blockVars;P(`type`,`module`),P(`files`,[`dist`,`block-pack`]),P(`main`,`./dist/index.js`),P(`module`,`./dist/index.js`),P(`types`,`./dist/index.d.ts`),P(`exports`,Jn);let n=Kn(t.npmOrg,e.isSdkInternal);for(let[e,t]of Object.entries(n))I(e,t);L(`mark-stable`),ut(`model`),ut(`ui`),ut(`workflow`),B(`@milaboratories/ts-builder`,`sdk:`),B(`@milaboratories/ts-configs`,`sdk:`),B(`@platforma-sdk/block-tools`,`sdk:`),B(`@platforma-sdk/model`,`sdk:`),B(`shx`,`catalog:`),B(`typescript`,`catalog:`),P(`block.components`,Gn(e)),it(`version`,`facade package.json must carry a 'version' (the facade publishes)`),G(`dependencies`),G(`devDependencies`),G(`peerDependencies`),G(`optionalDependencies`),W([...Y])}function Qn(e){let t=e.split(/[^A-Za-z0-9]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);return/^[0-9]/.test(t)?`_${t}`:t}function $n(){_(`block`,()=>{w(`index.js`),w(`index.d.ts`),b(`src/index.ts`,E(`block/src/index.tpl.ts`,e=>({facadeName:e.blockVars.facadeName,pascalName:Qn(e.blockVars.shortName)}))),b(`src/AGENTS.ts`,T(`block/src/AGENTS.ts`)),S(`src/block-extra.ts`,T(`block/src/block-extra.ts`)),S(`src/agents-extra.ts`,T(`block/src/agents-extra.ts`)),b(`tsconfig.json`,T(`block/tsconfig.json`)),C(`logos/block-logo.png`,Ae(`block/logos/block-logo.png`)),C(`logos/organization-logo.png`,Ae(`block/logos/organization-logo.png`)),x(`package.json`,D(e=>Xn(e)),e=>{Zn(e)})})}var Q=`src/**/*.test.ts`;function er(e){return{name:`${e.blockVars.facadeName}.model`,private:!0,type:`module`,main:`dist/index.cjs`,module:`dist/index.js`,types:`dist/index.d.ts`,exports:{".":{types:`./dist/index.d.ts`,sources:`./src/index.ts`,import:`./dist/index.js`},"./dist/*":`./dist/*`},scripts:{fmt:`ts-builder format`,watch:`ts-builder build --target block-model --watch`,build:`ts-builder build --target block-model && block-tools build-model`,check:`ts-builder check --target block-model`},dependencies:{"@platforma-sdk/model":`sdk:`},devDependencies:{"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`},peerDependencies:{"@types/node":`*`,typescript:`*`}}}function tr(){P(`private`,!0),P(`type`,`module`),P(`main`,`dist/index.cjs`),P(`module`,`dist/index.js`),P(`types`,`dist/index.d.ts`),P(`exports`,{".":{types:`./dist/index.d.ts`,sources:`./src/index.ts`,import:`./dist/index.js`},"./dist/*":`./dist/*`}),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({"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`}),U({"@types/node":`*`,typescript:`*`}),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{I(`test`,`vitest run --passWithNoTests`),B(`vitest`,`catalog:`),B(`@types/node`,`*`)},()=>V(`vitest`))),X(),F(`tsup`),L(`lint`),G(`dependencies`),G(`devDependencies`),G(`peerDependencies`),G(`optionalDependencies`),W([...Y])}function nr(){_(`model`,()=>{v(y(Q),()=>b(`tsconfig.json`,T(`model/tsconfig.node.json`)),()=>b(`tsconfig.json`,T(`model/tsconfig.json`))),b(`.oxlintrc.json`,T(`model/.oxlintrc.json`)),b(`.oxfmtrc.json`,T(`model/.oxfmtrc.json`)),C(`src/index.ts`,T(`model/src/index.ts`)),x(`package.json`,D(e=>er(e)),()=>{tr()})})}function rr(e){return{name:`${e.blockVars.facadeName}.ui`,private:!0,type:`module`,scripts:{fmt:`ts-builder format`,dev:`ts-builder serve --target block-ui`,watch:`ts-builder build --target block-ui --watch`,build:`ts-builder build --target block-ui`,check:`ts-builder check --target block-ui`},dependencies:{"@platforma-sdk/ui-vue":`sdk:`,vue:`catalog:`,...Yt(e,`model`)},devDependencies:{"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`},peerDependencies:{"@types/node":`*`,typescript:`*`}}}function ir(){P(`private`,!0),P(`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:`),lt(`model`),H({"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`}),X(),L(`preview`),L(`lint`),U({"@types/node":`*`,typescript:`*`}),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{I(`test`,`vitest run --passWithNoTests`),B(`vitest`,`catalog:`),B(`@types/node`,`*`)},()=>V(`vitest`))),G(`dependencies`),G(`devDependencies`),G(`peerDependencies`),G(`optionalDependencies`),W([...Y])}function ar(){_(`ui`,()=>{v(y(Q),()=>b(`tsconfig.json`,T(`ui/tsconfig.node.json`)),()=>b(`tsconfig.json`,T(`ui/tsconfig.json`))),b(`.oxlintrc.json`,T(`ui/.oxlintrc.json`)),b(`.oxfmtrc.json`,T(`ui/.oxfmtrc.json`)),S(`index.html`,T(`ui/index.html`)),C(`src/main.ts`,T(`ui/src/main.ts`)),C(`src/app.ts`,E(`ui/src/app.tpl.ts`,e=>({modelPkg:`${e.blockVars.facadeName}.model`}))),C(`src/MainPage.vue`,E(`ui/src/MainPage.tpl.vue`,e=>({shortName:e.blockVars.shortName}))),x(`package.json`,D(e=>rr(e)),()=>{ir()})})}function or(e){return{name:`${e.blockVars.facadeName}.workflow`,private:!0,type:`module`,scripts:{build:`shx rm -rf dist && pl-tengo build`,check:`pl-tengo check`,format:`/usr/bin/env emacs --script ./format.el || echo 'No emacs.'`},dependencies:{"@platforma-sdk/workflow-tengo":`sdk:`,...q(e,`software`)},devDependencies:{"@platforma-sdk/tengo-builder":`sdk:`,"@platforma-sdk/test":`sdk:`,shx:`catalog:`}}}function sr(){P(`private`,!0),P(`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.'`),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{I(`test`,`vitest run --passWithNoTests`),H({vitest:`catalog:`})},()=>V(`vitest`))),z(`@platforma-sdk/workflow-tengo`,`sdk:`),lt(`software`),H({"@platforma-sdk/tengo-builder":`sdk:`,"@platforma-sdk/test":`sdk:`,shx:`catalog:`}),X(),G(`dependencies`),G(`devDependencies`),G(`peerDependencies`),G(`optionalDependencies`),W([...Y])}function cr(){_(`workflow`,()=>{b(`format.el`,T(`workflow/format.el`)),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{b(`tsconfig.json`,T(`workflow/tsconfig.json`)),S(`vitest.config.mts`,T(`workflow/vitest.config.mts`))},()=>{w(`tsconfig.json`),w(`vitest.config.mts`)})),w(`index.js`),w(`index.d.ts`),C(`src/main.tpl.tengo`,E(`workflow/src/main.tpl.tengo`,e=>({shortName:e.blockVars.shortName}))),x(`package.json`,D(e=>or(e)),()=>{sr()})})}function lr(e){return{name:`${e.blockVars.facadeName}.test`,private:!0,type:`module`,scripts:{fmt:`ts-builder format`,check:`ts-builder check --target block-test`,test:`vitest run --passWithNoTests`},peerDependencies:{typescript:`*`},devDependencies:{"@platforma-sdk/test":`sdk:`,"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,vitest:`catalog:`}}}function ur(){P(`private`,!0),P(`type`,`module`),I(`fmt`,`ts-builder format`),I(`check`,`ts-builder check --target block-test`),I(`test`,`vitest run --passWithNoTests`),L(`lint`),H({"@platforma-sdk/test":`sdk:`,"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,vitest:`catalog:`}),U({typescript:`*`}),V(`@types/node`),X(),G(`dependencies`),G(`devDependencies`),G(`peerDependencies`),G(`optionalDependencies`),W([...Y])}function dr(){_(`test`,()=>{b(`tsconfig.json`,T(`test/tsconfig.json`)),b(`.oxlintrc.json`,T(`test/.oxlintrc.json`)),b(`.oxfmtrc.json`,T(`test/.oxfmtrc.json`)),S(`vitest.config.mts`,T(`test/vitest.config.mts`)),C(`src/demo.test.ts`,je(`import { expect, test } from "vitest";
|
|
12
|
+
`}function qe(e){return e.replace(/(^|\s)#.*$/,`$1`).trim()}function Je(e,t){let n=qe(e);return n===``?!1:n===t.trim()}function Ye(e,t){for(let n of e)if(Je(n,t))return!0;return!1}function Xe(e,t){return e===`sdk:`?t?`workspace:*`:`catalog:`:e}var Ze=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`];function Qe(e,t){if(N(e))for(let n of Ze){let r=e[n];if(N(r))for(let e of Object.keys(r))r[e]===`sdk:`&&(r[e]=t?`workspace:*`:`catalog:`)}}var A;function $e(e){if(!A)throw Error(`${e}() only valid inside a managed(...) body. Move this call inside managed(path, initial, () => {...}).`);return A}function j(e){let t=$e(e);if(t.kind!==`json`)throw Error(`${e}() requires a JSON-managed body; got '${t.kind}'.`);return t}function M(e){let t=$e(e);if(t.kind!==`yaml`)throw Error(`${e}() requires a YAML-managed body; got '${t.kind}'.`);return t}function et(e){let t=$e(e);if(t.kind!==`lines`)throw Error(`${e}() requires a lines-managed body; got '${t.kind}'.`);return t}function tt(e,t){let n=e.ctx??Se();if(!n)throw Error(`${t}() needs a RunContext but none is active. Pass { ctx } via the with-managed-* helper or run inside engine.run(...).`);return n}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nt(e,t,n={}){if(A)throw Error(`Nested managed(...) body — engine bug.`);A={kind:`json`,obj:e,ctx:n.ctx,triggerContext:n.triggerContext};try{return t(n.ctx??n.triggerContext?.ctx),e}finally{A=void 0}}function rt(e,t,n={}){if(A)throw Error(`Nested managed(...) body — engine bug.`);A={kind:`yaml`,doc:e,ctx:n.ctx,triggerContext:n.triggerContext,getLatestVersion:n.getLatestVersion,getDerivedDependencyPin:n.getDerivedDependencyPin};try{return t(n.ctx??n.triggerContext?.ctx),e}finally{A=void 0}}function it(e,t,n={}){if(A)throw Error(`Nested managed(...) body — engine bug.`);A={kind:`lines`,lines:e,ctx:n.ctx,triggerContext:n.triggerContext};try{return t(n.ctx??n.triggerContext?.ctx),e}finally{A=void 0}}Ee((e,t)=>{if(!A)return!1;let n=A.triggerContext;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.");return e(n)&&t(),!0});function P(e,t){He(j(`ensureField`).obj,e,t)}function F(e,t){let n=j(`removeField`).obj;Ve(n,e)&&(t&&!t(Be(n,e))||Ue(n,e))}function at(e,t){let n=j(`requireField`).obj;if(!Ve(n,e))throw Error(t??`requireField: missing field '${e}'`)}function ot(e,t){let n=j(`ensureFieldEntries`).obj,r=Ve(n,e)?Be(n,e):void 0,i=N(r)?r:{};for(let[e,n]of Object.entries(t))i[e]=n;N(r)||He(n,e,i)}function I(e,t){P(`scripts.${e}`,t)}function L(e){F(`scripts.${e}`)}var st=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`];function R(e,t,n,r){let i=j(e),a=i.obj,o=n===`sdk:`?Xe(n,tt(i,e).isSdkInternal):n;for(let e of st){if(e===r)continue;let n=a[e];N(n)&&t in n&&delete n[t]}let s=a[r],c=N(s)?s:{};c[t]=o,N(s)||(a[r]=c)}function z(e,t){R(`ensureDep`,e,t,`dependencies`)}function B(e,t){R(`ensureDevDep`,e,t,`devDependencies`)}function ct(e,t){R(`ensurePeerDep`,e,t,`peerDependencies`)}function V(e){let t=j(`removeDep`).obj;for(let n of st){let r=t[n];N(r)&&e in r&&delete r[e]}}function H(e){for(let[t,n]of Object.entries(e))B(t,n)}function U(e){for(let[t,n]of Object.entries(e))ct(t,n)}function lt(e,t,n){let r=tt(j(e),e);for(let i of r.modules)i.scope===t&&R(e,i.name,`workspace:*`,n)}function ut(e){lt(`ensureWorkspaceScopeDeps`,e,`dependencies`)}function W(e){lt(`ensureWorkspaceScopeDevDeps`,e,`devDependencies`)}function dt(e){let t=j(`pruneKeysMatching`).obj;for(let n of Object.keys(t))e(n,t[n])&&delete t[n]}function ft(e,t){let n=We(e,t);for(let t of Object.keys(e))delete e[t];for(let t of Object.keys(n))e[t]=n[t]}function G(e){ft(j(`enforceFieldOrder`).obj,e)}function pt(e,t){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];for(let t of Object.keys(e))delete e[t];for(let i of n)e[i]=r[i],t&&N(e[i])&&pt(e[i],!0)}function K(e=``,t={}){let n=t.recursive??!1;if(e===``&&!n)return;let r=j(`enforceAlphabeticalOrder`).obj;if(e===``){pt(r,!0);return}let i=Be(r,e);N(i)&&pt(i,n)}function mt(){let e=M(`ensureWorkspaceModulePaths`),t=tt(e,`ensureWorkspaceModulePaths`).modules.filter(e=>e.path!==``).map(e=>e.path).sort(),n=e.doc.toJSON()?.packages;Array.isArray(n)&&n.length===t.length&&n.every((e,n)=>e===t[n])||e.doc.setIn([`packages`],t)}function ht(e,t){let n=e.doc.getIn([`catalog`,t]);return typeof n==`string`?n:void 0}function gt(e,t){let n=M(`ensureCatalogVersion`);ht(n,e)===void 0&&n.doc.setIn([`catalog`,e],t)}function _t(e){let t=M(`ensureCatalogLatest`);if(!t.getLatestVersion)return;let n=t.getLatestVersion(e);n!==void 0&&ht(t,e)!==n&&t.doc.setIn([`catalog`,e],n)}function vt(e,t){let n=M(`pinCatalogToDependencyOf`);if(!n.getDerivedDependencyPin)return;let r=n.getDerivedDependencyPin(e);r!==void 0&&ht(n,e)!==r&&n.doc.setIn([`catalog`,e],r)}function yt(e){let t=M(`ensureCatalogAbsent`);t.doc.hasIn([`catalog`,e])&&t.doc.deleteIn([`catalog`,e])}function bt(e){let t=et(`ensureGitignoreEntries`);for(let n of e)Ye(t.lines,n)||t.lines.push(n)}function xt(e){return(0,s.parseDocument)(e)}function St(e){return e.toString()}var Ct=`.structure`;function wt(e){if(!e.exists(`.structure`))return{version:0};try{let t=JSON.parse(e.read(Ct));return{version:typeof t?.version==`number`?t.version:0}}catch{return{version:0}}}function Tt(e,t=0){if(e<t)throw new Et(e,t)}var Et=class extends Error{constructor(e,t){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`}};function Dt(e,t){e.write(Ct,JSON.stringify(t))}var Ot=class extends Error{constructor(e){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`}};function kt(e,t,n,r){switch(e.kind){case`text`:return e.value;case`file`:if(!n)throw Error(`file('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);return n.staticRead(e.path);case`tpl`:if(!n)throw Error(`tpl('${e.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);return ue(n.textRead(e.path),typeof e.vars==`function`?e.vars(r):e.vars);case`generate`:{let n=e.fn(r);if(t.endsWith(`.json`))return Qe(n,r.isSdkInternal),ze(n,{collapse:!t.endsWith(`package.json`)});if(t.endsWith(`.yaml`)||t.endsWith(`.yml`))return(0,s.stringify)(n);if(typeof n!=`string`)throw Error(`generate() for '${t}' must return a string for non-JSON/YAML files; got ${typeof n}`);return n}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.`)}}function At(e,t,n,r,i){if(n.kind===`binary`){if(!r)throw Error(`binary('${n.path}'): no TemplateProvider configured. Pass opts.templates to engine.run(...).`);e.writeBinary(t,r.staticReadBinary(n.path));return}e.write(t,kt(n,t,r,i))}function jt(e,t,n,r,i,a){let o=e.split(`/`).pop()??e;if(e.endsWith(`.json`)){let i=Ne(t);if(typeof i!=`object`||!i||Array.isArray(i))throw Error(`managed: parsed value at '${e}' is not a JSON object`);return nt(i,n,{triggerContext:r}),ze(i,{collapse:o!==`package.json`})}if(e.endsWith(`.yaml`)||e.endsWith(`.yml`)){let e=xt(t);return rt(e,n,{triggerContext:r,getLatestVersion:i,getDerivedDependencyPin:a}),St(e)}if(o===`.gitignore`||o.endsWith(`.gitignore`)){let e=Ge(t);return it(e,n,{triggerContext:r}),Ke(e)}throw Error(`managed('${e}'): unsupported file kind. Only .json, .yaml, .yml, .gitignore are dispatched.`)}function Mt(e){let t=e.list(``),n=new Set;for(let e of t){n.add(e);let t=e.split(`/`);for(let e=1;e<t.length;e++)n.add(t.slice(0,e).join(`/`))}return n}function Nt(e,t){let n=t===``?t:t.endsWith(`/`)?t.slice(0,-1):t;return e.has(n)}function Pt(e,t,n){return{ctx:t,version:t.version,pathExists:t=>Nt(e,t),pathMissing:t=>!Nt(e,t),filesMatch:t=>{let r=n?`${n}/${t}`:t;for(let t of e)if(ye(r,t))return!0;return!1}}}function Ft(e,t){for(let n of e.triggers)if(!n(t))return!1;return!0}function It(e,t){return t?`init`:e.updateDepsOnly?`updateDeps`:`default`}function Lt(e,t){return e.filter(e=>e.modes.includes(t))}function Rt(e,t,n,r,i,a){let o=e.leaf;if(o.kind===`fixed`){let i=kt(o.content,e.resolvedPath,r,a);return t.exists(e.resolvedPath)?t.read(e.resolvedPath)===i?void 0:(n||t.write(e.resolvedPath,i),{scope:e.scope,path:e.resolvedPath,primitive:`fixed`,action:`update`}):(n||t.write(e.resolvedPath,i),{scope:e.scope,path:e.resolvedPath,primitive:`fixed`,action:`create`})}if(o.kind===`scaffold`)return t.exists(e.resolvedPath)?void 0:(n||At(t,e.resolvedPath,o.initial,r,a),{scope:e.scope,path:e.resolvedPath,primitive:`scaffold`,action:`create`});if(o.kind===`seed`)return!i||t.exists(e.resolvedPath)?void 0:(n||At(t,e.resolvedPath,o.initial,r,a),{scope:e.scope,path:e.resolvedPath,primitive:`seed`,action:`create`});if(o.kind===`remove`)return t.exists(e.resolvedPath)?(n||t.delete(e.resolvedPath),{scope:e.scope,path:e.resolvedPath,primitive:`remove`,action:`delete`}):void 0;if(o.kind===`rename`){if(!t.exists(e.resolvedPath))return;let r=e.resolvedTo;return t.exists(r)?void 0:(n||t.move(e.resolvedPath,r),{scope:e.scope,path:e.resolvedPath,primitive:`rename`,action:`rename`})}}function zt(e,t,n,r,i,a,o,s){if(e.leaf.kind!==`managed`)return;let c=e.leaf,l=e.resolvedPath,u=t.exists(l),d,f=!1;u?d=t.read(l):(d=kt(c.initial,l,i,s),f=!0);let p=jt(l,d,c.body,r,a,o);if(f)return n||t.write(l,p),{scope:e.scope,path:l,primitive:`managed`,action:`create`};if(p!==d)return n||t.write(l,p),{scope:e.scope,path:l,primitive:`managed`,action:`update`}}function Bt(e,t,n,r,i,a,o,s){let c=Lt(e,It(n,a)),l=[],u=Mt(t);for(let e of c){if(e.leaf.kind===`managed`||!Ft(e,Pt(u,n,e.modulePath)))continue;let o=Rt(e,t,r,i,a,n);o&&l.push(o)}let d=Mt(t);for(let e of c){if(e.leaf.kind!==`managed`)continue;let a=Pt(d,n,e.modulePath);if(!Ft(e,a))continue;let c=zt(e,t,r,a,i,o,s,n);c&&l.push(c)}return l}function Vt(e,t,n,r={}){return xe(n,()=>{let i=me(e,n),a=!!r.initMode,o=Bt(i,t,n,n.dryRun,r.templates,a,r.registryLookup,r.derivedPinLookup);if(!n.dryRun&&!n.updateDepsOnly&&!a){Dt(t,{version:2});let i={...r.rediscover?r.rediscover(t):n,dryRun:!0},a=Bt(me(e,i),t,i,!0,r.templates,!1,r.registryLookup,r.derivedPinLookup).filter(e=>e.path!==Ct);if(a.length>0)throw new Ot(a[0])}return a&&!n.dryRun&&Dt(t,{version:2}),{changes:o}})}var Ht=[`root`,`block`,`model`,`ui`,`workflow`,`test`,`software`,`kind`],Ut=class extends Error{constructor(e,t){super(e),this.path=t,this.name=`DiscoveryError`}};function Wt(e){let t=new Set;for(let n of[e.dependencies,e.devDependencies,e.peerDependencies,e.optionalDependencies])if(n)for(let e of Object.keys(n))t.add(e);return t}function Gt(e){return e===``||e===`.`}function Kt(e){let t=e.pkg[`block-scope`];if(typeof t==`string`){if(!Ht.includes(t))throw new Ut(`package.json "block-scope" must be one of ${Ht.join(`, `)}, got '${t}'`,e.path);return t}if(Gt(e.path))return`root`;if(e.pkg.block!==void 0)return`block`;let n=Wt(e.pkg);if(n.has(`@platforma-sdk/block-kind`))return`kind`;if(e.pkg[`block-software`]!==void 0)return`software`;if(n.has(`@platforma-sdk/package-builder`)){for(let e of n)if(/^@platforma-open\/.*runenv/.test(e))return`software`}if(n.has(`@platforma-sdk/workflow-tengo`))return`workflow`;if((n.has(`@platforma-sdk/ui-vue`)||n.has(`vue`))&&!e.pkg.main)return`ui`;if(n.has(`@platforma-sdk/model`)&&e.pkg.main)return`model`;if(n.has(`@platforma-sdk/test`))return`test`}function qt(e){let t=[];for(let n of e){let e=Kt(n);if(!e)throw new Ut(`Unclassified workspace package at '${n.path}'. Add a top-level "block-scope" string to its package.json.`,n.path);t.push({scope:e,name:n.pkg.name??n.path,path:Gt(n.path)?``:n.path})}return t}function q(e,t){return e.modules.filter(e=>e.scope===t)}function Jt(e,t){let n=q(e,t);if(n.length===0)throw Error(`findModule: expected one '${t}' module, found none`);if(n.length>1)throw Error(`findModule: expected exactly one '${t}' module, found ${n.length}`);return n[0]}function Yt(e,t){return{[Jt(e,t).name]:`workspace:*`}}function J(e,t){let n={};for(let r of q(e,t))n[r.name]=`workspace:*`;return n}function Xt(e){let t=e.facadeName,n=[{scope:`root`,name:t,path:``},{scope:`block`,name:`${t}.block`,path:`block`},{scope:`model`,name:`${t}.model`,path:`model`},{scope:`kind`,name:`${t}.kind`,path:`kind`},{scope:`ui`,name:`${t}.ui`,path:`ui`},{scope:`workflow`,name:`${t}.workflow`,path:`workflow`},{scope:`test`,name:`${t}.test`,path:`test`}];return e.softwarePlatform&&n.push({scope:`software`,name:`${t}.software`,path:`software`}),n}function Zt(e){return{isSdkInternal:e.isSdkInternal??!1,updateDepsOnly:e.updateDepsOnly??!1,modules:e.modules,blockVars:e.blockVars,version:e.version??0,dryRun:e.dryRun??!1}}var Y=class extends Error{constructor(e){super(e),this.name=`StructureCliError`}};function Qt(e,t){return e===``?t:`${e}/${t}`}function $t(e,t){try{return JSON.parse(e.read(t))}catch{return}}function en(e){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.`);let t=e.replace(/^\.\//,``).replace(/\/$/,``);return t===`.`?``:t}function tn(e){let t;try{t=e.read(`pnpm-workspace.yaml`)}catch{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.`)}let n=(0,s.parse)(t)??{},r=Array.isArray(n.packages)?n.packages:[],i=new Set([``]);for(let t of r){let n=en(t);(n===``||e.exists(n))&&i.add(n)}let a=[];for(let t of i){let n=$t(e,Qt(t,`package.json`));n&&a.push({path:t,pkg:n})}return a}function nn(e){let t=[],n=new Set([`node_modules`,`.turbo`,`dist`,`.git`,`block-pack`]);function r(i,a){let o=e.listDir(i);for(let s of o){if(!s.isDirectory||n.has(s.name))continue;let o=Qt(i,s.name),c=$t(e,Qt(o,`package.json`));c&&t.push({path:o,pkg:c}),a<2&&r(o,a+1)}}return r(``,1),t}function rn(e){let t=e.indexOf(`/`);if(!e.startsWith(`@`)||t<0)throw new Y(`Cannot parse block name '${e}': expected '@npm-org/org-scope.short-name'.`);let n=e.slice(0,t),r=e.slice(t+1),i=r.indexOf(`.`);if(i<0)throw new Y(`Cannot parse block name '${e}': base name '${r}' has no '.' separating org-scope from short-name.`);return{facadeName:e,baseName:r,npmOrg:n,orgScope:r.slice(0,i),shortName:r.slice(i+1)}}function an(e){let{fs:t,isSdkInternal:n}=e,r=n?nn(t):tn(t);if(r.length===0)throw new Y(`No workspace packages found. Run 'block-tools structure init' to scaffold a block.`);let i=qt(r),a=wt(t);Tt(a.version,0);let o=i.find(e=>e.scope===`block`)??i.find(e=>e.scope===`root`);if(!o)throw new Y(`Could not find a 'block' (or root-as-block) package to derive BlockVars from.`);let s=rn(o.name.replace(/\.block$/,``));return Zt({isSdkInternal:n,updateDepsOnly:e.updateDepsOnly??!1,modules:i,blockVars:s,version:a.version,dryRun:e.dryRun??!1})}var X=[`name`,`version`,`private`,`description`,`keywords`,`files`,`type`,`main`,`module`,`types`,`exports`,`scripts`,`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`,`packageManager`,`pnpm`,`block`,`block-software`],on={"build:dev-local":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=local turbo run build`,"build:dev-remote":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build`,"build:dev-no-software":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=none turbo run build`,"build:dev-binary-existing":`env PL_BUILD_CHANNEL=dev PL_BUILD_USE_PUBLISHED=true turbo run build`,"build:release":`env PL_BUILD_CHANNEL=release PL_BUILD_VARIANT=all PL_BUILD_LOCATION=remote turbo run build`},sn={test:`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --concurrency 1`,"test:dry-run":`env PL_BUILD_CHANNEL=dev PL_BUILD_VARIANT=binary PL_BUILD_LOCATION=local turbo run test --dry-run=json`};function cn(){return{version:`1.0.0`,private:!0,scripts:{fmt:`turbo run fmt`,check:`turbo run check`,...on,...sn,"mark-stable":`turbo run mark-stable`,"do-pack":`turbo run do-pack`,watch:`turbo watch build`,changeset:`changeset`,"version-packages":`changeset version`,"update-sdk":`block-tools structure refresh --update-deps-only`,"upgrade-sdk":`block-tools structure refresh --update-deps-only && pnpm i && block-tools structure refresh && pnpm i && pnpm fmt`},peerDependencies:{oxlint:`*`,oxfmt:`*`},devDependencies:{"@changesets/cli":`catalog:`,"@milaboratories/ts-builder":`sdk:`,"@platforma-sdk/block-tools":`sdk:`,shx:`catalog:`,turbo:`catalog:`},packageManager:`pnpm@9.12.0`}}function ln(){P(`packageManager`,`pnpm@9.12.0`),F(`name`),I(`fmt`,`turbo run fmt`),I(`check`,`turbo run check`);for(let[e,t]of Object.entries(on))I(e,t);for(let[e,t]of Object.entries(sn))I(e,t);L(`build`),L(`build:dev`),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({"@changesets/cli":`catalog:`,"@milaboratories/ts-builder":`sdk:`,"@platforma-sdk/block-tools":`sdk:`,shx:`catalog:`,turbo:`catalog:`}),U({oxlint:`*`,oxfmt:`*`}),dt((e,t)=>{if(!/^(\/\/|--)/.test(e)||typeof t!=`object`||!t)return!1;let n=t;return n.pnpm!==void 0||n.overrides!==void 0}),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}var un=`https://turbo.build/schema.json`,dn=[`tsconfig.json`],fn={fmt:{cache:!1},check:{dependsOn:[`^build`],outputs:[]},build:{dependsOn:[`^build`,`check`],inputs:[`$TURBO_DEFAULT$`],env:[`PL_DOCKER_REGISTRY_PUSH_TO`,`PL_BUILD_CHANNEL`,`PL_BUILD_VARIANT`,`PL_BUILD_LOCATION`,`PL_BUILD_USE_PUBLISHED`,`PL_DEV_DOCKER_PUSH_URL`,`PL_DEV_DOCKER_PULL_URL`,`PL_DEV_BINARY_UPLOAD_URL`,`PL_RELEASE_DOCKER_PUSH_URL`,`PL_RELEASE_DOCKER_PULL_URL`,`PL_RELEASE_BINARY_UPLOAD_URL`,`PL_REGISTRY_PLATFORMA_OPEN_UPLOAD_URL`],passThroughEnv:[`AWS_*`,`PL_AWS_*`],outputs:[`./dist/**`,`./block-pack/**`,`./pkg-*.tgz`]},"do-pack":{dependsOn:[`build`],outputs:[`package.tgz`]},test:{dependsOn:[`build`,`check`],passThroughEnv:[`PL_ADDRESS`,`PL_TEST_PASSWORD`,`PL_TEST_USER`,`PL_TEST_PROXY`,`DEBUG`]},"mark-stable":{passThroughEnv:[`PL_REGISTRY`,`AWS_*`],cache:!1}};function pn(){return{$schema:un,globalDependencies:dn,tasks:{...fn}}}function mn(){P(`$schema`,un),P(`globalDependencies`,dn),ot(`tasks`,fn),F(`tasks.build:dev`),G([`$schema`,`globalDependencies`,`tasks`])}var hn=2,gn=500,_n=3e4;function vn(e){if(!e)return null;let t=Number(e);if(Number.isFinite(t)&&t>0)return t*1e3;let n=Date.parse(e);return Number.isNaN(n)?null:Math.max(0,n-Date.now())}async function yn(e){for(let t=1;;t++){let n;try{n=await fetch(e,{signal:AbortSignal.timeout(_n)})}catch(e){if(t>hn)throw e;await(0,c.setTimeout)(gn*2**(t-1)*(.8+.4*Math.random()));continue}if(n.ok)return n;if(!(n.status===429||n.status>=500)||t>hn)throw Error(`registry returned HTTP ${n.status}`);let r=vn(n.headers.get(`retry-after`));if(r!=null){await(0,c.setTimeout)(r);continue}await(0,c.setTimeout)(gn*2**(t-1)*(.8+.4*Math.random()))}}function bn(){return{async getLatestVersion(e){let t=(await(await yn(`https://registry.npmjs.org/-/package/${e}/dist-tags`)).json()).latest;if(!t)throw Error(`no 'latest' dist-tag in registry response`);return t},async getDeclaredDependency(e,t,n){let r=await(await yn(`https://registry.npmjs.org/${e}/${t}`)).json();return r.dependencies?.[n]??r.peerDependencies?.[n]}}}async function xn(e,t){let n=await Promise.all(t.map(async t=>[t,await e.getLatestVersion(t)]));return new Map(n)}function Sn(e){return t=>e.get(t)}var Cn=[/^@platforma-sdk\//,/^@milaboratories\//];function wn(e){return Cn.some(t=>t.test(e))}async function Tn(e,t=bn()){return e.length===0?()=>void 0:Sn(await xn(t,e))}function En(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(e)}async function Dn(e,t=bn()){if(e.length===0)return()=>void 0;let n=await Promise.all(e.map(async e=>{let n=await t.getDeclaredDependency(e.of,e.ofVersion??`latest`,e.entry);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.`);if(!En(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.`);return[e.entry,n]})),r=new Map(n);return e=>r.get(e)}var On=[`vite`,`tsup`,`vue-tsc`,`@vitejs/plugin-vue`,`vite-plugin-dts`,`@platforma-sdk/eslint-config`];function kn(){for(let e of On)V(e)}var Z=[`@platforma-sdk/model`,`@platforma-sdk/ui-vue`,`@platforma-sdk/workflow-tengo`,`@platforma-sdk/test`,`@platforma-sdk/block-tools`,`@platforma-sdk/block-kind`,`@platforma-sdk/tengo-builder`,`@platforma-sdk/package-builder`,`@milaboratories/ts-builder`,`@milaboratories/ts-configs`],An=`0.0.0-init-must-fetch`;for(let e of Z)if(!wn(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.`);var jn={turbo:`~2.8.11`,shx:`~0.4.0`,"@changesets/cli":`~2.29.8`,vitest:`~4.0.18`},Mn=[{entry:`vue`,of:`@platforma-sdk/ui-vue`},{entry:`@milaboratories/helpers`,of:`@platforma-sdk/model`}],Nn=`@platforma-open/milaboratories.runenv-python-3`,Pn=`1.8.2`;function Fn(e){let t=e.modules.filter(e=>e.path!==``).map(e=>e.path).sort(),n={};for(let e of Z)n[e]=An;return Object.assign(n,jn),e.modules.some(e=>e.scope===`software`)&&(n[Nn]=Pn),{packages:t,catalog:n}}function In(){mt();for(let e of On)yt(e)}var Ln=[`.test_auth.json`,`node_modules/`,`dist/`,`block-pack/`,`dev/`,`work/`,`log/`,`.turbo`,`vite.config.*.timestamp-*`,`software/**/*.tgz`,`.DS_Store`,`.vscode/sftp.json`,`test-dry-run.json`];function Rn(){bt(Ln)}function zn(){_(`root`,()=>{v(({ctx:e})=>!e.isSdkInternal,()=>{x(`turbo.json`,D(()=>pn()),()=>{mn()}),b(`.vscode/settings.json`,T(`root/.vscode/settings.json`)),x(`package.json`,D(()=>cn()),()=>{ln()}),x(`pnpm-workspace.yaml`,D(e=>Fn(e)),()=>{In()}),x(`.gitignore`,T(`root/.gitignore`),()=>{Rn()})})})}function Bn(e){return e.split(/[-_]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Vn(){_(`root`,()=>{v(({ctx:e})=>!e.isSdkInternal,()=>{b(`.github/workflows/build.yaml`,E(`workflows/build.tpl.yaml`,e=>{let t=e.blockVars.shortName;return{appName:`Block: ${Bn(t)}`,appNameSlug:`block-${t}`}})),b(`.github/workflows/mark-stable.yaml`,E(`workflows/mark-stable.tpl.yaml`,e=>({appName:`Block: ${Bn(e.blockVars.shortName)} - Mark Stable`})))})})}var Hn={"@platforma-open":{s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1`,serveUrl:`https://blocks.pl-open.science`},"@milaboratories":{s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1`,serveUrl:`https://block.registry.platforma.bio/releases`}},Un={s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/pub/releases/?region=eu-central-1`,serveUrl:`https://blocks.pl-open.science`},Wn={s3:`s3://milab-euce1-prod-pkgs-s3-block-registry/aux/dev/?region=eu-central-1`,serveUrl:`https://aux-blocks.pl-open.science`};function Gn(e,t){let n=t?Wn:Hn[e]??Un;return`block-tools publish -r ${n.s3} --registry-serve-url ${n.serveUrl}`}function Kn(e){let t={};for(let n of q(e,`workflow`))t.workflow=`${n.name}/dist/tengo/tpl/main.plj.gz`;for(let n of q(e,`model`))t.model=`${n.name}/dist/model.json`;for(let n of q(e,`ui`))t.ui=`${n.name}/dist`;return t}function qn(e,t){return{build:`ts-builder build --target block-facade && block-tools pack`,check:`ts-builder type-check --target block-facade`,prepublishOnly:Gn(e,t),"do-pack":`shx rm -f package.tgz && pnpm pack && shx mv *.tgz package.tgz`}}var Jn={"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`,"@platforma-sdk/model":`sdk:`,shx:`catalog:`,typescript:`catalog:`},Yn={".":{sources:`./src/index.ts`,types:`./dist/index.d.ts`,default:`./dist/index.js`}};function Xn(e){if(Object.keys(e.components).length===0)throw Error(`block.components is empty — no workflow/model/ui module was discovered`);let t=e.meta,n=[[`block.meta.title`,t.title],[`block.meta.description`,t.description],[`block.meta.logo`,t.logo],[`block.meta.organization.name`,t.organization?.name],[`block.meta.organization.url`,t.organization?.url],[`block.meta.organization.logo`,t.organization?.logo]];for(let[e,t]of n)if(typeof t!=`string`||t===``)throw Error(`required block field '${e}' is empty`)}function Zn(e){let t=e.blockVars,n={...Jn,...J(e,`model`),...J(e,`ui`),...J(e,`workflow`),...J(e,`kind`)},r={components:Kn(e),meta:{title:t.shortName,description:`${t.shortName} block`,logo:`file:logos/block-logo.png`,organization:{name:t.orgScope,url:`https://example.com`,logo:`file:logos/organization-logo.png`}}};return Xn(r),{name:`${t.facadeName}.block`,version:`1.0.0`,type:`module`,files:[`dist`,`block-pack`],main:`./dist/index.js`,module:`./dist/index.js`,types:`./dist/index.d.ts`,exports:Yn,scripts:qn(t.npmOrg,e.isSdkInternal),dependencies:{},devDependencies:n,block:r}}function Qn(e){let t=e.blockVars,n=q(e,`kind`);if(n.length!==1)throw Error(n.length===0?`block '${t.facadeName}' declares no kind — every block must have a sibling kind/ package`:`block '${t.facadeName}' declares ${n.length} kinds; exactly one is required`);P(`type`,`module`),P(`files`,[`dist`,`block-pack`]),P(`main`,`./dist/index.js`),P(`module`,`./dist/index.js`),P(`types`,`./dist/index.d.ts`),P(`exports`,Yn);let r=qn(t.npmOrg,e.isSdkInternal);for(let[e,t]of Object.entries(r))I(e,t);L(`mark-stable`),W(`model`),W(`ui`),W(`workflow`),W(`kind`),B(`@milaboratories/ts-builder`,`sdk:`),B(`@milaboratories/ts-configs`,`sdk:`),B(`@platforma-sdk/block-tools`,`sdk:`),B(`@platforma-sdk/model`,`sdk:`),B(`shx`,`catalog:`),B(`typescript`,`catalog:`),P(`block.components`,Kn(e)),at(`version`,`facade package.json must carry a 'version' (the facade publishes)`),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}function $n(e){let t=e.split(/[^A-Za-z0-9]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);return/^[0-9]/.test(t)?`_${t}`:t}function er(){_(`block`,()=>{w(`index.js`),w(`index.d.ts`),b(`src/index.ts`,E(`block/src/index.tpl.ts`,e=>({facadeName:e.blockVars.facadeName,pascalName:$n(e.blockVars.shortName)}))),b(`src/AGENTS.ts`,T(`block/src/AGENTS.ts`)),S(`src/block-extra.ts`,T(`block/src/block-extra.ts`)),S(`src/agents-extra.ts`,T(`block/src/agents-extra.ts`)),b(`tsconfig.json`,T(`block/tsconfig.json`)),C(`logos/block-logo.png`,je(`block/logos/block-logo.png`)),C(`logos/organization-logo.png`,je(`block/logos/organization-logo.png`)),x(`package.json`,D(e=>Zn(e)),e=>{Qn(e)})})}var Q=`src/**/*.test.ts`;function tr(e){return{name:`${e.blockVars.facadeName}.model`,private:!0,type:`module`,main:`dist/index.cjs`,module:`dist/index.js`,types:`dist/index.d.ts`,exports:{".":{types:`./dist/index.d.ts`,sources:`./src/index.ts`,import:`./dist/index.js`},"./dist/*":`./dist/*`},scripts:{fmt:`ts-builder format`,watch:`ts-builder build --target block-model --watch`,build:`ts-builder build --target block-model && block-tools build-model`,check:`ts-builder check --target block-model`},dependencies:{"@platforma-sdk/model":`sdk:`,...J(e,`kind`)},devDependencies:{"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`},peerDependencies:{"@types/node":`*`,typescript:`*`}}}function nr(){P(`private`,!0),P(`type`,`module`),P(`main`,`dist/index.cjs`),P(`module`,`dist/index.js`),P(`types`,`dist/index.d.ts`),P(`exports`,{".":{types:`./dist/index.d.ts`,sources:`./src/index.ts`,import:`./dist/index.js`},"./dist/*":`./dist/*`}),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:`),ut(`kind`),H({"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`}),U({"@types/node":`*`,typescript:`*`}),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{I(`test`,`vitest run --passWithNoTests`),B(`vitest`,`catalog:`),B(`@types/node`,`*`)},()=>V(`vitest`))),kn(),F(`tsup`),L(`lint`),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}function rr(){_(`model`,()=>{v(y(Q),()=>b(`tsconfig.json`,T(`model/tsconfig.node.json`)),()=>b(`tsconfig.json`,T(`model/tsconfig.json`))),b(`.oxlintrc.json`,T(`model/.oxlintrc.json`)),b(`.oxfmtrc.json`,T(`model/.oxfmtrc.json`)),C(`src/index.ts`,E(`model/src/index.tpl.ts`,e=>({kindPkg:`${e.blockVars.facadeName}.kind`}))),x(`package.json`,D(e=>tr(e)),()=>{nr()})})}var ir={".":{types:`./dist/index.d.ts`,sources:`./src/index.ts`,import:`./dist/index.js`,require:`./dist/index.cjs`,default:`./dist/index.js`}};function ar(e){return{name:`${e.blockVars.facadeName}.kind`,private:!0,type:`module`,main:`./dist/index.cjs`,module:`./dist/index.js`,types:`./dist/index.d.ts`,exports:ir,scripts:{fmt:`ts-builder format`,watch:`ts-builder build --target block-kind --watch`,build:`ts-builder build --target block-kind && block-tools build-kind-manifest`,check:`ts-builder check --target block-kind`},dependencies:{"@platforma-sdk/block-kind":`sdk:`},devDependencies:{"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`},peerDependencies:{"@types/node":`*`,typescript:`*`}}}function or(){P(`private`,!0),P(`type`,`module`),P(`main`,`./dist/index.cjs`),P(`module`,`./dist/index.js`),P(`types`,`./dist/index.d.ts`),P(`exports`,ir),I(`fmt`,`ts-builder format`),I(`watch`,`ts-builder build --target block-kind --watch`),I(`build`,`ts-builder build --target block-kind && block-tools build-kind-manifest`),I(`check`,`ts-builder check --target block-kind`),L(`lint`),z(`@platforma-sdk/block-kind`,`sdk:`),H({"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,"@platforma-sdk/block-tools":`sdk:`}),U({"@types/node":`*`,typescript:`*`}),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}function sr(){_(`kind`,()=>{b(`tsconfig.json`,T(`kind/tsconfig.json`)),b(`.oxlintrc.json`,T(`kind/.oxlintrc.json`)),b(`.oxfmtrc.json`,T(`kind/.oxfmtrc.json`)),C(`src/index.ts`,T(`kind/src/index.ts`)),x(`package.json`,D(e=>ar(e)),()=>{or()})})}function cr(e){return{name:`${e.blockVars.facadeName}.ui`,private:!0,type:`module`,scripts:{fmt:`ts-builder format`,dev:`ts-builder serve --target block-ui`,watch:`ts-builder build --target block-ui --watch`,build:`ts-builder build --target block-ui`,check:`ts-builder check --target block-ui`},dependencies:{"@platforma-sdk/ui-vue":`sdk:`,vue:`catalog:`,...Yt(e,`model`)},devDependencies:{"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`},peerDependencies:{"@types/node":`*`,typescript:`*`}}}function lr(){P(`private`,!0),P(`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:`),ut(`model`),H({"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`}),kn(),L(`preview`),L(`lint`),U({"@types/node":`*`,typescript:`*`}),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{I(`test`,`vitest run --passWithNoTests`),B(`vitest`,`catalog:`),B(`@types/node`,`*`)},()=>V(`vitest`))),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}function ur(){_(`ui`,()=>{v(y(Q),()=>b(`tsconfig.json`,T(`ui/tsconfig.node.json`)),()=>b(`tsconfig.json`,T(`ui/tsconfig.json`))),b(`.oxlintrc.json`,T(`ui/.oxlintrc.json`)),b(`.oxfmtrc.json`,T(`ui/.oxfmtrc.json`)),S(`index.html`,T(`ui/index.html`)),C(`src/main.ts`,T(`ui/src/main.ts`)),C(`src/app.ts`,E(`ui/src/app.tpl.ts`,e=>({modelPkg:`${e.blockVars.facadeName}.model`}))),C(`src/MainPage.vue`,E(`ui/src/MainPage.tpl.vue`,e=>({shortName:e.blockVars.shortName}))),x(`package.json`,D(e=>cr(e)),()=>{lr()})})}function dr(e){return{name:`${e.blockVars.facadeName}.workflow`,private:!0,type:`module`,scripts:{build:`shx rm -rf dist && pl-tengo build`,check:`pl-tengo check`,format:`/usr/bin/env emacs --script ./format.el || echo 'No emacs.'`},dependencies:{"@platforma-sdk/workflow-tengo":`sdk:`,...J(e,`software`)},devDependencies:{"@platforma-sdk/tengo-builder":`sdk:`,"@platforma-sdk/test":`sdk:`,shx:`catalog:`}}}function fr(){P(`private`,!0),P(`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.'`),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{I(`test`,`vitest run --passWithNoTests`),H({vitest:`catalog:`})},()=>V(`vitest`))),z(`@platforma-sdk/workflow-tengo`,`sdk:`),ut(`software`),H({"@platforma-sdk/tengo-builder":`sdk:`,"@platforma-sdk/test":`sdk:`,shx:`catalog:`}),kn(),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}function pr(){_(`workflow`,()=>{b(`format.el`,T(`workflow/format.el`)),v(({ctx:e})=>!e.isSdkInternal,()=>v(y(Q),()=>{b(`tsconfig.json`,T(`workflow/tsconfig.json`)),S(`vitest.config.mts`,T(`workflow/vitest.config.mts`))},()=>{w(`tsconfig.json`),w(`vitest.config.mts`)})),w(`index.js`),w(`index.d.ts`),C(`src/main.tpl.tengo`,E(`workflow/src/main.tpl.tengo`,e=>({shortName:e.blockVars.shortName}))),x(`package.json`,D(e=>dr(e)),()=>{fr()})})}function mr(e){return{name:`${e.blockVars.facadeName}.test`,private:!0,type:`module`,scripts:{fmt:`ts-builder format`,check:`ts-builder check --target block-test`,test:`vitest run --passWithNoTests`},peerDependencies:{typescript:`*`},devDependencies:{"@platforma-sdk/test":`sdk:`,"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,vitest:`catalog:`}}}function hr(){P(`private`,!0),P(`type`,`module`),I(`fmt`,`ts-builder format`),I(`check`,`ts-builder check --target block-test`),I(`test`,`vitest run --passWithNoTests`),L(`lint`),H({"@platforma-sdk/test":`sdk:`,"@milaboratories/ts-builder":`sdk:`,"@milaboratories/ts-configs":`sdk:`,vitest:`catalog:`}),U({typescript:`*`}),V(`@types/node`),kn(),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}function gr(){_(`test`,()=>{b(`tsconfig.json`,T(`test/tsconfig.json`)),b(`.oxlintrc.json`,T(`test/.oxlintrc.json`)),b(`.oxfmtrc.json`,T(`test/.oxfmtrc.json`)),S(`vitest.config.mts`,T(`test/vitest.config.mts`)),C(`src/demo.test.ts`,Me(`import { expect, test } from "vitest";
|
|
13
13
|
|
|
14
14
|
test("scaffolded block sanity check", () => {
|
|
15
15
|
expect(true).toBe(true);
|
|
16
16
|
});
|
|
17
|
-
`)),x(`package.json`,D(e=>
|
|
17
|
+
`)),x(`package.json`,D(e=>mr(e)),()=>{hr()})})}var _r=`block-tools software build`,vr=`shx rm -f *.tgz && block-tools software build && pnpm pack && shx mv platforma-open*.tgz package.tgz`;function yr(){return{entrypoints:{main:{binary:{artifact:{type:`python`,registry:`platforma-open`,environment:`@platforma-open/milaboratories.runenv-python-3:3.12.10`,dependencies:{toolset:`pip`,requirements:`requirements.txt`},root:`./src`},cmd:[`python`,`{pkg}/main.py`]}}}}}function br(e){return{name:`${e.blockVars.facadeName}.software`,type:`module`,description:`Block Software`,files:[`./dist/**/*`],scripts:{build:_r,"do-pack":vr,changeset:`changeset`,"version-packages":`changeset version`},"block-software":yr(),devDependencies:{"@platforma-open/milaboratories.runenv-python-3":`catalog:`,"@platforma-sdk/block-tools":`sdk:`}}}function xr(){F(`private`),P(`type`,`module`),P(`files`,[`./dist/**/*`]),I(`build`,_r),I(`do-pack`,vr),L(`prepublishOnly`),I(`changeset`,`changeset`),I(`version-packages`,`changeset version`),B(`@platforma-open/milaboratories.runenv-python-3`,`catalog:`),B(`@platforma-sdk/block-tools`,`sdk:`),V(`@platforma-sdk/package-builder`),K(`dependencies`),K(`devDependencies`),K(`peerDependencies`),K(`optionalDependencies`),G([...X])}var Sr=`import sys
|
|
18
18
|
|
|
19
19
|
print("Hello from Python, " + sys.argv[1] + "!")
|
|
20
|
-
`,
|
|
21
|
-
`;function
|
|
22
|
-
`)}`}async function
|
|
23
|
-
`)||` (none)`}`);if(!t.skipConfirmation){let e=(await import(`node:readline`)).createInterface({input:process.stdin,output:process.stdout}),r=await new Promise(n=>{e.question(`⚠️ This will overwrite the current global overview with snapshot '${t.snapshot}'.\nAre you sure you want to continue? (y/N): `,n)});if(e.close(),r.toLowerCase()!==`y`&&r.toLowerCase()!==`yes`){n.info(`Restore cancelled.`);return}}try{await r.restoreGlobalOverviewFromSnapshot(t.snapshot),n.info(`✅ Successfully restored global overview from snapshot '${t.snapshot}'`)}catch(e){throw Error(`Failed to restore from snapshot: ${String(e)}`)}}),n}function jr(e){let t=e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);if(t){let{src:e,destName:n}=t.groups;return{src:e,destName:n}}else return{src:e,destName:n.default.basename(e)}}function Mr(e,n){return new t.Option(e,n).argParser((e,t)=>[...t??[],jr(e)]).default([])}var Nr=[`registry`,`organization`,`package`,`version`];function Pr(){let n=new t.Command(`upload-package-v1`).description(`Uploads V1 package and refreshes the registry`);return n.addOption(new t.Option(`-r, --registry <address|alias>`,`full address of the registry or alias from .pl.reg`).env(`PL_REGISTRY`)),n.addOption(new t.Option(`-o, --organization <organization>`,`target organisation`).env(`PL_PACKAGE_ORGANIZATION`)),n.addOption(new t.Option(`-p, --package <package>`,`target package`).env(`PL_PACKAGE_NAME`)),n.addOption(new t.Option(`-v, --version <version>`,`target version`).env(`PL_PACKAGE_VERSION`)),n.option(`-m, --meta <path>`,`json file containing meta information to associate with tha package`),n.addOption(Mr(`-f, --file <file>`,`package files`)),n.addOption(new t.Option(`--refresh`,`refresh repository after adding the package`).default(!0).env(`PL_REGISTRY_REFRESH`)),n.option(`--no-refresh`,`do not refresh repository after adding the package`),n.action(async t=>{let n=new a.ConsoleLoggerAdapter,i=e.p.parse({});for(let e of Nr)t[e]&&(i[e]=t[e]);t.meta&&(t.meta.endsWith(`.json`)?i.meta=JSON.parse(await r.default.promises.readFile(t.meta,{encoding:`utf-8`})):t.meta.endsWith(`.yaml`)&&(i.meta=o.default.parse(await r.default.promises.readFile(t.meta,{encoding:`utf-8`}))));for(let e of t.file)i.files[e.destName]=e.src;let s=await e.n(i);n.info(o.default.stringify(s.conf));let c=s.createRegistry(n),l=s.fullPackageName,u=c.constructNewPackage(l);for(let[e,t]of Object.entries(s.conf.files)){n.info(`Uploading ${t} -> ${e} ...`);let i=await r.default.promises.readFile(t);await u.addFile(e,i)}n.info(`Uploading meta information...`),await u.writeMeta(s.conf.meta),await u.finish(),t.refresh&&await c.updateIfNeeded()}),n}function Fr(e){let r=new t.Command(`check`).description(`Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.`);return r.argument(`[paths...]`,`block path(s); defaults to the current directory`),r.option(`--sdk-internal`,`block(s) live inside the SDK monorepo; skip root-scope rules`),r.action(async(t,r)=>{let i=new a.ConsoleLoggerAdapter,o=t.length>0?t:[`.`],s=n.default.join(e,`src`,`structure`,`templates`),c=!1;for(let e of o){let t=await wr({blockPath:e,isSdkInternal:!!r.sdkInternal,updateDepsOnly:!1,mode:`check`,templatesRoot:s,log:e=>i.info(e)});i.info(Tr(e,t.changes)),t.changes.length>0&&(c=!0)}if(c)throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.")}),r}var $=[`python`],Ir=class extends Error{constructor(e){super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`),this.name=`InitFlagError`}};async function Lr(e,t,n,r){if(e!==void 0&&e!==``)return e;if(n)throw new Ir(t);return r()}async function Rr(e){let t=await Lr(e.npmOrg,`npm-org`,e.nonInteractive,()=>(0,l.input)({message:`npm org (e.g. @platforma-open):`,default:`@platforma-open`})),n=await Lr(e.orgScope,`org-scope`,e.nonInteractive,()=>(0,l.input)({message:`org scope (e.g. my-org):`})),r=await Lr(e.shortName,`short-name`,e.nonInteractive,()=>(0,l.input)({message:`block short name (e.g. mixcr-clonotyping):`})),i;i=e.withSoftware===void 0?e.nonInteractive?!1:await(0,l.confirm)({message:`Include a software module?`,default:!1}):e.withSoftware;let a;if(i){if(a=await Lr(e.platform,`platform`,e.nonInteractive,()=>(0,l.select)({message:`Software platform:`,choices:$.map(e=>({name:e,value:e}))})),!$.includes(a))throw Error(`Unsupported --platform '${a}'. Only ${$.join(`, `)} ${$.length===1?`is`:`are`} supported at v1.`)}else if(e.platform)throw Error(`--platform was given but software is disabled (--no-software).`);return{facadeName:`${t}/${n}.${r}`,baseName:`${n}.${r}`,npmOrg:t,orgScope:n,shortName:r,softwarePlatform:a}}async function zr(e){let t=e.vars,n=Xt(t),r=new se(e.blockPath),i=new ce(e.templatesRoot),a=Zt({blockVars:t,modules:n,isSdkInternal:!1,version:2,dryRun:!1}),o=Z.filter(wn),s,c;try{s=await Tn(o),c=await Dn(jn)}catch(e){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)}`)}return Vt(Sr,r,a,{templates:i,initMode:!0,registryLookup:s,derivedPinLookup:c}),e.log(`Initialised block '${t.facadeName}'${t.softwarePlatform?` (software: ${t.softwarePlatform})`:` (no software)`} at ${e.blockPath}`),t}function Br(e){let r=new t.Command(`init`).description(`Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.`);return r.argument(`[path]`,`target directory (default: <short-name> under the current directory)`),r.option(`--npm-org <org>`,`npm org, e.g. @platforma-open`),r.option(`--org-scope <scope>`,`org scope, e.g. my-org`),r.option(`--short-name <name>`,`block short name, e.g. mixcr-clonotyping`),r.option(`--with-software`,`include a software module`),r.option(`--no-software`,`omit the software module`),r.addOption(new t.Option(`--platform <platform>`,`software platform (single-valued)`).choices([...$])),r.option(`--non-interactive`,`error on any missing flag instead of prompting`),r.action(async(t,r)=>{let i=new a.ConsoleLoggerAdapter,o=r.withSoftware===!0,s=r.software===!1;if(o&&s)throw Error(`--with-software and --no-software are mutually exclusive.`);let c=o?!0:s?!1:void 0,l=await Rr({npmOrg:r.npmOrg,orgScope:r.orgScope,shortName:r.shortName,withSoftware:c,platform:r.platform,nonInteractive:r.nonInteractive});await zr({vars:l,blockPath:t?n.default.resolve(t):n.default.resolve(process.cwd(),l.shortName),templatesRoot:n.default.join(e,`src`,`structure`,`templates`),log:e=>i.info(e)})}),r}var Vr=[`dev`,`release`],Hr=[`docker`,`binary`,`all`,`none`],Ur=[`local`,`remote`];function Wr(e){if(e.usePublished){if(e.variant===`docker`||e.variant===`all`)throw u.util.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);return{kind:`binary-existing`}}return e.variant===`none`?{kind:`no-software`}:e.location===void 0?{kind:`bare`}:{kind:`target`,channel:e.channel??`release`,variant:e.variant??`all`,location:e.location}}var Gr=`public.ecr.aws`,Kr=`us-east-1`;function qr(e){if(process.env.AWS_ACCESS_KEY_ID||process.env.AWS_PROFILE)return;let t=process.env.PL_AWS_PROFILE??u.defaults.AWS_DEV_PROFILE;process.env.AWS_PROFILE=t,e?.debug(`Using AWS profile '${t}' for dev push credentials`)}function Jr(e){return new URL(`https://${e}`).hostname}function Yr(){return` aws sso login --profile ${process.env.AWS_PROFILE??process.env.PL_AWS_PROFILE??u.defaults.AWS_DEV_PROFILE}`}async function Xr(e,t){let n=Jr(e);if(n!==Gr)throw u.util.CLIError(`automatic docker login is only supported for '${Gr}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);t?.info(`Logging in to ECR registry '${n}'...`);let r,i;try{let e=(await new f.ECRPUBLICClient({region:Kr}).send(new f.GetAuthorizationTokenCommand({}))).authorizationData?.authorizationToken;if(!e)throw Error(`empty authorization token`);let t=Buffer.from(e,`base64`).toString(`utf8`),n=t.indexOf(`:`);if(n<0)throw Error(`malformed authorization token (no ':' separator)`);r=t.slice(0,n),i=t.slice(n+1)}catch(e){throw u.util.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error?e.message:String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n`+Yr())}let a=(0,d.spawnSync)(`docker`,[`login`,`--username`,r,`--password-stdin`,n],{input:i,stdio:[`pipe`,`inherit`,`inherit`],env:{...process.env,HOME:process.env.HOME||c.homedir()}});if(a.error||a.status!==0)throw u.util.CLIError(`'docker login ${n}' failed`)}async function Zr(e){let{core:t,scenario:n,options:r={},logger:i}=e,a=r.ids;t.buildMode=Qr(n);let o=()=>t.buildSoftwareArchives({ids:a,forceBuild:!!r.force,contentRoot:r.contentRoot,skipIfEmpty:!a,condaBuild:r.condaBuild});switch(n.kind){case`binary-existing`:t.writePublishedArtifactInfo({ids:a});break;case`no-software`:break;case`bare`:r.buildDocker&&t.buildDockerImages({ids:a,registry:r.dockerRegistry,strictPlatformMatching:u.envs.isCI()}),await o(),r.pushDocker&&t.publishDockerImages({ids:a,pushTo:r.dockerPushTo,strictPlatformMatching:u.envs.isCI()});break;case`target`:{let{channel:e,variant:s,location:c}=n,l=s!==`binary`,d=s!==`docker`,f=c===`remote`,p=ti(e,r);l&&t.buildDockerImages({ids:a,registry:p.pull,strictPlatformMatching:u.envs.isCI()}),d&&await o(),f&&e===`dev`&&(l||d)&&qr(i),l&&f&&(p.autoLogin&&p.push&&await Xr(p.push,i),t.publishDockerImages({ids:a,pushTo:p.push,strictPlatformMatching:u.envs.isCI()})),d&&f&&await t.publishPackages({ids:a,storageURL:r.storageUrl});break}default:u.util.assertNever(n)}t.buildSwJsonFiles({packageIds:a,noSoftware:n.kind===`no-software`})}function Qr(e){return e.kind!==`target`||e.channel===`release`?`release`:e.variant!==`docker`&&e.location===`remote`?`dev-remote`:`dev-local`}function $r(e){if(!e.includes(`://`))return e;let t=new URL(e);return t.host+t.pathname}function ei(e){return{registry:$r(e),autoLogin:e.startsWith(`ecr://`)}}function ti(e,t){let n=e===`dev`,r=process.env[n?u.envs.PL_DEV_DOCKER_PUSH_URL:u.envs.PL_RELEASE_DOCKER_PUSH_URL],i=process.env[n?u.envs.PL_DEV_DOCKER_PULL_URL:u.envs.PL_RELEASE_DOCKER_PULL_URL],a=t.dockerPushTo??r??(n?u.defaults.DEV_DOCKER_PUSH_TARGET:void 0),o=a?ei(a):{registry:void 0,autoLogin:!1},s=t.dockerRegistry??i??(n?a:u.defaults.DOCKER_REGISTRY);return{pull:s?$r(s):void 0,push:o.registry,autoLogin:o.autoLogin}}var ni=`PL_BUILD_CHANNEL`,ri=`PL_BUILD_VARIANT`,ii=`PL_BUILD_LOCATION`,ai=`PL_BUILD_USE_PUBLISHED`;u.envs.PL_DOCKER_REGISTRY_PUSH_TO,u.envs.PL_DEV_DOCKER_PUSH_URL,u.envs.PL_DEV_DOCKER_PULL_URL,u.envs.PL_DEV_BINARY_UPLOAD_URL,u.envs.PL_RELEASE_DOCKER_PUSH_URL,u.envs.PL_RELEASE_DOCKER_PULL_URL,u.envs.PL_RELEASE_BINARY_UPLOAD_URL;function oi(){let e=new t.Command(`build`).description(`Build a software module for a target and write its .sw.json descriptor (build + push in one pass)`);return e.addOption(new t.Option(`--channel <channel>`,`registry channel to build for`).choices([...Vr]).env(ni)),e.addOption(new t.Option(`--variant <variant>`,`artifact kind to build (default: all declared)`).choices([...Hr]).env(ri)),e.addOption(new t.Option(`--location <location>`,`where the artifact lands (local = no push)`).choices([...Ur]).env(ii)),e.addOption(new t.Option(`--use-published`,`do not build or push; emit a descriptor pointing at the already-published release artifact`).env(ai)),e.addOption(new t.Option(`--log-level <level>`,`logging level`).choices([`error`,`warn`,`info`,`debug`]).default(`info`)),e.addOption(new t.Option(`--package-root <path>`,`path to directory with package.json file`)),e.addOption(new t.Option(`--force`,`force action, ignoring automatic safety checks`).default(!1)),e.addOption(new t.Option(`--version <value>`,`override package version (ignore package.json)`)),e.addOption(new t.Option(`--platform <os-arch>`,`{os}-{arch} pair; no effect on cross-platform packages`).choices([...u.util.AllPlatforms]).env(u.envs.PL_PKG_OS)),e.addOption(new t.Option(`--all-platforms`,`build for all supported platforms`).default(!1)),e.addOption(new t.Option(`--full-dir-hash`,`hash file contents (not metadata) for the dev content hash`).env(u.envs.PL_PKG_FULL_HASH).default(!1)),e.addOption(new t.Option(`--package-id <id...>`,`act only on selected packages`)),e.addOption(new t.Option(`--content-root <path>`,`override software content root`).env(u.envs.PL_PKG_CONTENT_ROOT)),e.addOption(new t.Option(`--storage-url <url>`,`override binary upload registry URL`).env(u.envs.PL_PKG_STORAGE_URL)),e.addOption(new t.Option(`--docker-registry <registry>`,`docker pull registry embedded in the descriptor`).env(u.envs.PL_DOCKER_REGISTRY)),e.addOption(new t.Option(`--docker-push-to <registry>`,`alternative registry for docker push`).env(u.envs.PL_DOCKER_REGISTRY_PUSH_TO)),e.addOption(new t.Option(`--docker-build`,`build docker images`).env(u.envs.PL_DOCKER_BUILD).default(!1)),e.addOption(new t.Option(`--docker-no-build`,`do not build docker images`).env(u.envs.PL_DOCKER_NO_BUILD).default(!1)),e.addOption(new t.Option(`--docker-autopush`,`push docker images after build`).env(u.envs.PL_DOCKER_AUTOPUSH).default(!1)),e.addOption(new t.Option(`--docker-no-autopush`,`do not push docker images`).env(u.envs.PL_DOCKER_NO_AUTOPUSH).default(!1)),e.addOption(new t.Option(`--conda-build`,`build conda environment before packing`).env(u.envs.PL_CONDA_BUILD).default(!1)),e.addOption(new t.Option(`--conda-no-build`,`do not build conda environment`).env(u.envs.PL_CONDA_NO_BUILD).default(!1)),e.action(async e=>{let t=u.util.createLogger(e.logLevel);try{let n=Wr({channel:e.channel,variant:e.variant,location:e.location,usePublished:!!e.usePublished}),r=(0,u.createBuilder)(t,{packageRoot:e.packageRoot});r.version=e.version,r.targetPlatform=e.platform,r.allPlatforms=!!e.allPlatforms,r.fullDirHash=!!e.fullDirHash;let i=u.util.shouldDoAction({default:u.envs.isCI(),enable:e.dockerBuild,disable:e.dockerNoBuild}),a=i&&u.util.shouldDoAction({default:u.envs.isCI()&&!r.isPrivate,enable:e.dockerAutopush,disable:e.dockerNoAutopush});n.kind===`bare`&&(0,u.assertDockerPushIntent)({buildDocker:i,pushDocker:a,pushDisabledExplicitly:!!e.dockerNoAutopush,dockerPackageCount:r.selectedDockerPackages(e.packageId).length}),await Zr({core:r,scenario:n,logger:t,options:{ids:e.packageId,force:e.force,contentRoot:e.contentRoot,storageUrl:e.storageUrl,dockerRegistry:e.dockerRegistry,dockerPushTo:e.dockerPushTo,buildDocker:i,pushDocker:a,condaBuild:u.util.shouldDoAction({default:!0,enable:e.condaBuild,disable:e.condaNoBuild})}})}catch(e){throw t.debug(e),e instanceof Error&&t.debug(e.stack),e}}),e}function si(){let e=new t.Command(`software`).description(`Build and publish a block's software modules`);return e.addCommand(oi()),e}function ci(e=process.cwd()){let n=new t.Command;n.name(`block-tools`).description(`Utility to manipulate Platforma Blocks and Block Registry`),n.addCommand(p()),n.addCommand(te()),n.addCommand(ne()),n.addCommand(ie()),n.addCommand(ae()),n.addCommand(oe()),n.addCommand(Or(e)),n.addCommand(kr()),n.addCommand(Ar()),n.addCommand(Pr()),n.addCommand(si());let r=new t.Command(`structure`).description(`Manage block scaffolding against the canonical structure (check / init / refresh)`);return r.addCommand(Fr(e)),r.addCommand(Br(e)),r.addCommand(Dr(e)),n.addCommand(r),n}async function li(e,t){await ci(t).parseAsync(e)}exports.buildProgram=ci,exports.run=li;
|
|
20
|
+
`,Cr=`# No dependencies specified for this script
|
|
21
|
+
`;function wr(){_(`software`,()=>{C(`src/main.py`,Me(Sr)),C(`src/requirements.txt`,Me(Cr)),x(`package.json`,D(e=>br(e)),()=>{xr()})})}function Tr(){_(`model`,()=>{w(`eslint.config.mjs`),w(`vite.config.mts`)}),_(`ui`,()=>{w(`eslint.config.mjs`),w(`vite.config.ts`),w(`tsconfig.app.json`),w(`tsconfig.node.json`)}),_(`test`,()=>{w(`eslint.config.mjs`)}),_(`root`,()=>{w(`.prettierrc`),x(`package.json`,D(()=>cn()),()=>{L(`pretty`),V(`@platforma-sdk/blocks-deps-updater`)})})}function Er(){Ae(()=>{_(`root`,()=>{v(({ctx:e})=>!e.isSdkInternal,()=>{x(`pnpm-workspace.yaml`,D(e=>Fn(e)),e=>{for(let e of Z)_t(e);for(let e of Mn)vt(e.entry,{of:e.of,ofVersion:e.ofVersion});for(let[e,t]of Object.entries(jn))gt(e,t);e.modules.some(e=>e.scope===`software`)&>(Nn,Pn)})})})})}var Dr=Ce(()=>{zn(),Vn(),er(),rr(),sr(),ur(),pr(),gr(),wr(),Tr(),Er()});async function Or(){return Tn(Z.filter(wn))}async function kr(e){let t=n.default.resolve(e.blockPath),r=e.mode===`check`,i=new ce(t),a=new le(e.templatesRoot),o=Vt(Dr,i,an({fs:i,isSdkInternal:e.isSdkInternal,updateDepsOnly:e.updateDepsOnly,dryRun:r}),{templates:a,registryLookup:e.updateDepsOnly?await Or():void 0,derivedPinLookup:e.updateDepsOnly?await Dn(Mn):void 0,rediscover:()=>an({fs:i,isSdkInternal:e.isSdkInternal,updateDepsOnly:!1,dryRun:!0})});return{blockPath:e.blockPath,changes:o.changes}}function Ar(e,t){if(t.length===0)return` ${e}: up to date (0 changes)`;let n=t.map(e=>` ${e.action.padEnd(6)} ${e.primitive.padEnd(8)} ${e.path} [${e.scope}]`);return` ${e}: ${t.length} change(s)\n${n.join(`
|
|
22
|
+
`)}`}async function jr(e){for(let t of e.paths){let n=await kr({blockPath:t,isSdkInternal:e.isSdkInternal,updateDepsOnly:e.updateDepsOnly,mode:`refresh`,templatesRoot:e.templatesRoot,log:t=>e.logger.info(t)});e.logger.info(Ar(t,n.changes))}}function Mr(e){let r=new t.Command(`refresh`).description(`Bring block(s) up to date with the canonical structure. Applies rules, writes files, bumps .structure version. Default mode is offline; --update-deps-only fires only catalog-bump rules (network).`);return r.argument(`[paths...]`,`block path(s); defaults to the current directory`),r.option(`--sdk-internal`,`block(s) live inside the SDK monorepo; skip root-scope rules`),r.option(`--update-deps-only`,"fire ONLY catalog-bump rules (npm network). Follow with `pnpm install` then a plain refresh."),r.action(async(t,r)=>{let i=t.length>0?t:[`.`],a=n.default.join(e,`src`,`structure`,`templates`);await jr({paths:i,isSdkInternal:!!r.sdkInternal,updateDepsOnly:!!r.updateDepsOnly,templatesRoot:a,logger:new o.ConsoleLoggerAdapter})}),r}function Nr(e){let r=new t.Command(`update-deps`).description("[DEPRECATED] Use `block-tools structure refresh --update-deps-only`. This alias delegates to it.");return r.action(async()=>{let t=new o.ConsoleLoggerAdapter;t.warn("`block-tools update-deps` is deprecated and will be removed in a future release. Use `block-tools structure refresh --update-deps-only` instead. Delegating now."),await jr({paths:[`.`],isSdkInternal:!1,updateDepsOnly:!0,templatesRoot:n.default.join(e,`src`,`structure`,`templates`),logger:t})}),r}function Pr(){let n=new t.Command(`list-overview-snapshots`).description(`List all available global overview snapshots in the registry`);return n.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),n.option(`--json`,`output in JSON format`,!1),n.action(async t=>{let n=new o.ConsoleLoggerAdapter,r=await new e.w(e._(t.registry),n).listGlobalOverviewSnapshots();if(t.json)n.info(JSON.stringify(r,null,2));else if(r.length===0)n.info(`No snapshots found.`);else{n.info(`Found ${r.length} snapshot(s):\n`);for(let e of r)n.info(` ${e.timestamp}`),n.info(` Path: ${e.path}`),n.info(``)}}),n}function Fr(){let n=new t.Command(`restore-overview-from-snapshot`).description(`Restore global overview from a snapshot`);return n.addOption(new t.Option(`-r, --registry <address>`,`full address of the registry`).env(`PL_REGISTRY`).makeOptionMandatory()),n.requiredOption(`-s, --snapshot <timestamp>`,`snapshot timestamp ID to restore from`),n.option(`--skip-confirmation`,`skip confirmation prompt (use with caution)`,!1),n.action(async t=>{let n=new o.ConsoleLoggerAdapter,r=new e.w(e._(t.registry),n),i=await r.listGlobalOverviewSnapshots();if(!i.find(e=>e.timestamp===t.snapshot))throw Error(`Snapshot '${t.snapshot}' not found. Available snapshots:\n${i.map(e=>` - ${e.timestamp}`).join(`
|
|
23
|
+
`)||` (none)`}`);if(!t.skipConfirmation){let e=(await import(`node:readline`)).createInterface({input:process.stdin,output:process.stdout}),r=await new Promise(n=>{e.question(`⚠️ This will overwrite the current global overview with snapshot '${t.snapshot}'.\nAre you sure you want to continue? (y/N): `,n)});if(e.close(),r.toLowerCase()!==`y`&&r.toLowerCase()!==`yes`){n.info(`Restore cancelled.`);return}}try{await r.restoreGlobalOverviewFromSnapshot(t.snapshot),n.info(`✅ Successfully restored global overview from snapshot '${t.snapshot}'`)}catch(e){throw Error(`Failed to restore from snapshot: ${String(e)}`)}}),n}function Ir(e){let t=e.match(/(?<destName>[^/\\]+)=(?<src>.*)/);if(t){let{src:e,destName:n}=t.groups;return{src:e,destName:n}}else return{src:e,destName:n.default.basename(e)}}function Lr(e,n){return new t.Option(e,n).argParser((e,t)=>[...t??[],Ir(e)]).default([])}var Rr=[`registry`,`organization`,`package`,`version`];function zr(){let n=new t.Command(`upload-package-v1`).description(`Uploads V1 package and refreshes the registry`);return n.addOption(new t.Option(`-r, --registry <address|alias>`,`full address of the registry or alias from .pl.reg`).env(`PL_REGISTRY`)),n.addOption(new t.Option(`-o, --organization <organization>`,`target organisation`).env(`PL_PACKAGE_ORGANIZATION`)),n.addOption(new t.Option(`-p, --package <package>`,`target package`).env(`PL_PACKAGE_NAME`)),n.addOption(new t.Option(`-v, --version <version>`,`target version`).env(`PL_PACKAGE_VERSION`)),n.option(`-m, --meta <path>`,`json file containing meta information to associate with tha package`),n.addOption(Lr(`-f, --file <file>`,`package files`)),n.addOption(new t.Option(`--refresh`,`refresh repository after adding the package`).default(!0).env(`PL_REGISTRY_REFRESH`)),n.option(`--no-refresh`,`do not refresh repository after adding the package`),n.action(async t=>{let n=new o.ConsoleLoggerAdapter,i=e.p.parse({});for(let e of Rr)t[e]&&(i[e]=t[e]);t.meta&&(t.meta.endsWith(`.json`)?i.meta=JSON.parse(await r.default.promises.readFile(t.meta,{encoding:`utf-8`})):t.meta.endsWith(`.yaml`)&&(i.meta=s.default.parse(await r.default.promises.readFile(t.meta,{encoding:`utf-8`}))));for(let e of t.file)i.files[e.destName]=e.src;let a=await e.n(i);n.info(s.default.stringify(a.conf));let c=a.createRegistry(n),l=a.fullPackageName,u=c.constructNewPackage(l);for(let[e,t]of Object.entries(a.conf.files)){n.info(`Uploading ${t} -> ${e} ...`);let i=await r.default.promises.readFile(t);await u.addFile(e,i)}n.info(`Uploading meta information...`),await u.writeMeta(a.conf.meta),await u.finish(),t.refresh&&await c.updateIfNeeded()}),n}function Br(e){let r=new t.Command(`check`).description(`Check block(s) against the canonical structure (read-only). Exits non-zero if any diff would land — used as the CI gate.`);return r.argument(`[paths...]`,`block path(s); defaults to the current directory`),r.option(`--sdk-internal`,`block(s) live inside the SDK monorepo; skip root-scope rules`),r.action(async(t,r)=>{let i=new o.ConsoleLoggerAdapter,a=t.length>0?t:[`.`],s=n.default.join(e,`src`,`structure`,`templates`),c=!1;for(let e of a){let t=await kr({blockPath:e,isSdkInternal:!!r.sdkInternal,updateDepsOnly:!1,mode:`check`,templatesRoot:s,log:e=>i.info(e)});i.info(Ar(e,t.changes)),t.changes.length>0&&(c=!0)}if(c)throw Error("Structure check failed: one or more blocks are out of date. Run `structure refresh`.")}),r}var $=[`python`],Vr=class extends Error{constructor(e){super(`Missing required flag --${e} in --non-interactive mode. Supply every BlockVars flag, or drop --non-interactive to be prompted.`),this.name=`InitFlagError`}};async function Hr(e,t,n,r){if(e!==void 0&&e!==``)return e;if(n)throw new Vr(t);return r()}async function Ur(e){let t=await Hr(e.npmOrg,`npm-org`,e.nonInteractive,()=>(0,u.input)({message:`npm org (e.g. @platforma-open):`,default:`@platforma-open`})),n=await Hr(e.orgScope,`org-scope`,e.nonInteractive,()=>(0,u.input)({message:`org scope (e.g. my-org):`})),r=await Hr(e.shortName,`short-name`,e.nonInteractive,()=>(0,u.input)({message:`block short name (e.g. mixcr-clonotyping):`})),i;i=e.withSoftware===void 0?e.nonInteractive?!1:await(0,u.confirm)({message:`Include a software module?`,default:!1}):e.withSoftware;let a;if(i){if(a=await Hr(e.platform,`platform`,e.nonInteractive,()=>(0,u.select)({message:`Software platform:`,choices:$.map(e=>({name:e,value:e}))})),!$.includes(a))throw Error(`Unsupported --platform '${a}'. Only ${$.join(`, `)} ${$.length===1?`is`:`are`} supported at v1.`)}else if(e.platform)throw Error(`--platform was given but software is disabled (--no-software).`);return{facadeName:`${t}/${n}.${r}`,baseName:`${n}.${r}`,npmOrg:t,orgScope:n,shortName:r,softwarePlatform:a}}async function Wr(e){let t=e.vars,n=Xt(t),r=new ce(e.blockPath),i=new le(e.templatesRoot),a=Zt({blockVars:t,modules:n,isSdkInternal:!1,version:2,dryRun:!1}),o=Z.filter(wn),s,c;try{s=await Tn(o),c=await Dn(Mn)}catch(e){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)}`)}return Vt(Dr,r,a,{templates:i,initMode:!0,registryLookup:s,derivedPinLookup:c}),e.log(`Initialised block '${t.facadeName}'${t.softwarePlatform?` (software: ${t.softwarePlatform})`:` (no software)`} at ${e.blockPath}`),t}function Gr(e){let r=new t.Command(`init`).description(`Scaffold a fresh Platforma block from the canonical structure. Missing flags are prompted unless --non-interactive.`);return r.argument(`[path]`,`target directory (default: <short-name> under the current directory)`),r.option(`--npm-org <org>`,`npm org, e.g. @platforma-open`),r.option(`--org-scope <scope>`,`org scope, e.g. my-org`),r.option(`--short-name <name>`,`block short name, e.g. mixcr-clonotyping`),r.option(`--with-software`,`include a software module`),r.option(`--no-software`,`omit the software module`),r.addOption(new t.Option(`--platform <platform>`,`software platform (single-valued)`).choices([...$])),r.option(`--non-interactive`,`error on any missing flag instead of prompting`),r.action(async(t,r)=>{let i=new o.ConsoleLoggerAdapter,a=r.withSoftware===!0,s=r.software===!1;if(a&&s)throw Error(`--with-software and --no-software are mutually exclusive.`);let c=a?!0:s?!1:void 0,l=await Ur({npmOrg:r.npmOrg,orgScope:r.orgScope,shortName:r.shortName,withSoftware:c,platform:r.platform,nonInteractive:r.nonInteractive});await Wr({vars:l,blockPath:t?n.default.resolve(t):n.default.resolve(process.cwd(),l.shortName),templatesRoot:n.default.join(e,`src`,`structure`,`templates`),log:e=>i.info(e)})}),r}var Kr=[`dev`,`release`],qr=[`docker`,`binary`,`all`,`none`],Jr=[`local`,`remote`];function Yr(e){if(e.usePublished){if(e.variant===`docker`||e.variant===`all`)throw a.util.CLIError(`--use-published is binary-only and cannot be combined with --variant ${e.variant}`);return{kind:`binary-existing`}}return e.variant===`none`?{kind:`no-software`}:e.location===void 0?{kind:`bare`}:{kind:`target`,channel:e.channel??`release`,variant:e.variant??`all`,location:e.location}}var Xr=`public.ecr.aws`,Zr=`us-east-1`;function Qr(e){if(process.env.AWS_ACCESS_KEY_ID||process.env.AWS_PROFILE)return;let t=process.env.PL_AWS_PROFILE??a.defaults.AWS_DEV_PROFILE;process.env.AWS_PROFILE=t,e?.debug(`Using AWS profile '${t}' for dev push credentials`)}function $r(e){return new URL(`https://${e}`).hostname}function ei(){return` aws sso login --profile ${process.env.AWS_PROFILE??process.env.PL_AWS_PROFILE??a.defaults.AWS_DEV_PROFILE}`}async function ti(e,t){let n=$r(e);if(n!==Xr)throw a.util.CLIError(`automatic docker login is only supported for '${Xr}', not '${n}'.\nLog in manually, or drop the ecr:// scheme from the push target to opt out.`);t?.info(`Logging in to ECR registry '${n}'...`);let r,i;try{let e=(await new f.ECRPUBLICClient({region:Zr}).send(new f.GetAuthorizationTokenCommand({}))).authorizationData?.authorizationToken;if(!e)throw Error(`empty authorization token`);let t=Buffer.from(e,`base64`).toString(`utf8`),n=t.indexOf(`:`);if(n<0)throw Error(`malformed authorization token (no ':' separator)`);r=t.slice(0,n),i=t.slice(n+1)}catch(e){throw a.util.CLIError(`failed to obtain an ECR login token for '${n}': ${e instanceof Error?e.message:String(e)}\nYour AWS/SSO session is likely expired or absent — log in and retry:\n`+ei())}let o=(0,d.spawnSync)(`docker`,[`login`,`--username`,r,`--password-stdin`,n],{input:i,stdio:[`pipe`,`inherit`,`inherit`],env:{...process.env,HOME:process.env.HOME||l.homedir()}});if(o.error||o.status!==0)throw a.util.CLIError(`'docker login ${n}' failed`)}async function ni(e){let{core:t,scenario:n,options:r={},logger:i}=e,o=r.ids;t.buildMode=ri(n);let s=()=>t.buildSoftwareArchives({ids:o,forceBuild:!!r.force,contentRoot:r.contentRoot,skipIfEmpty:!o,condaBuild:r.condaBuild});switch(n.kind){case`binary-existing`:t.writePublishedArtifactInfo({ids:o});break;case`no-software`:break;case`bare`:r.buildDocker&&t.buildDockerImages({ids:o,registry:r.dockerRegistry,strictPlatformMatching:a.envs.isCI()}),await s(),r.pushDocker&&t.publishDockerImages({ids:o,pushTo:r.dockerPushTo,strictPlatformMatching:a.envs.isCI()});break;case`target`:{let{channel:e,variant:c,location:l}=n,u=c!==`binary`,d=c!==`docker`,f=l===`remote`,p=oi(e,r);u&&t.buildDockerImages({ids:o,registry:p.pull,strictPlatformMatching:a.envs.isCI()}),d&&await s(),f&&e===`dev`&&(u||d)&&Qr(i),u&&f&&(p.autoLogin&&p.push&&await ti(p.push,i),t.publishDockerImages({ids:o,pushTo:p.push,strictPlatformMatching:a.envs.isCI()})),d&&f&&await t.publishPackages({ids:o,storageURL:r.storageUrl});break}default:a.util.assertNever(n)}t.buildSwJsonFiles({packageIds:o,noSoftware:n.kind===`no-software`})}function ri(e){return e.kind!==`target`||e.channel===`release`?`release`:e.variant!==`docker`&&e.location===`remote`?`dev-remote`:`dev-local`}function ii(e){if(!e.includes(`://`))return e;let t=new URL(e);return t.host+t.pathname}function ai(e){return{registry:ii(e),autoLogin:e.startsWith(`ecr://`)}}function oi(e,t){let n=e===`dev`,r=process.env[n?a.envs.PL_DEV_DOCKER_PUSH_URL:a.envs.PL_RELEASE_DOCKER_PUSH_URL],i=process.env[n?a.envs.PL_DEV_DOCKER_PULL_URL:a.envs.PL_RELEASE_DOCKER_PULL_URL],o=t.dockerPushTo??r??(n?a.defaults.DEV_DOCKER_PUSH_TARGET:void 0),s=o?ai(o):{registry:void 0,autoLogin:!1},c=t.dockerRegistry??i??(n?o:a.defaults.DOCKER_REGISTRY);return{pull:c?ii(c):void 0,push:s.registry,autoLogin:s.autoLogin}}var si=`PL_BUILD_CHANNEL`,ci=`PL_BUILD_VARIANT`,li=`PL_BUILD_LOCATION`,ui=`PL_BUILD_USE_PUBLISHED`;a.envs.PL_DOCKER_REGISTRY_PUSH_TO,a.envs.PL_DEV_DOCKER_PUSH_URL,a.envs.PL_DEV_DOCKER_PULL_URL,a.envs.PL_DEV_BINARY_UPLOAD_URL,a.envs.PL_RELEASE_DOCKER_PUSH_URL,a.envs.PL_RELEASE_DOCKER_PULL_URL,a.envs.PL_RELEASE_BINARY_UPLOAD_URL;function di(){let e=new t.Command(`build`).description(`Build a software module for a target and write its .sw.json descriptor (build + push in one pass)`);return e.addOption(new t.Option(`--channel <channel>`,`registry channel to build for`).choices([...Kr]).env(si)),e.addOption(new t.Option(`--variant <variant>`,`artifact kind to build (default: all declared)`).choices([...qr]).env(ci)),e.addOption(new t.Option(`--location <location>`,`where the artifact lands (local = no push)`).choices([...Jr]).env(li)),e.addOption(new t.Option(`--use-published`,`do not build or push; emit a descriptor pointing at the already-published release artifact`).env(ui)),e.addOption(new t.Option(`--log-level <level>`,`logging level`).choices([`error`,`warn`,`info`,`debug`]).default(`info`)),e.addOption(new t.Option(`--package-root <path>`,`path to directory with package.json file`)),e.addOption(new t.Option(`--force`,`force action, ignoring automatic safety checks`).default(!1)),e.addOption(new t.Option(`--version <value>`,`override package version (ignore package.json)`)),e.addOption(new t.Option(`--platform <os-arch>`,`{os}-{arch} pair; no effect on cross-platform packages`).choices([...a.util.AllPlatforms]).env(a.envs.PL_PKG_OS)),e.addOption(new t.Option(`--all-platforms`,`build for all supported platforms`).default(!1)),e.addOption(new t.Option(`--full-dir-hash`,`hash file contents (not metadata) for the dev content hash`).env(a.envs.PL_PKG_FULL_HASH).default(!1)),e.addOption(new t.Option(`--package-id <id...>`,`act only on selected packages`)),e.addOption(new t.Option(`--content-root <path>`,`override software content root`).env(a.envs.PL_PKG_CONTENT_ROOT)),e.addOption(new t.Option(`--storage-url <url>`,`override binary upload registry URL`).env(a.envs.PL_PKG_STORAGE_URL)),e.addOption(new t.Option(`--docker-registry <registry>`,`docker pull registry embedded in the descriptor`).env(a.envs.PL_DOCKER_REGISTRY)),e.addOption(new t.Option(`--docker-push-to <registry>`,`alternative registry for docker push`).env(a.envs.PL_DOCKER_REGISTRY_PUSH_TO)),e.addOption(new t.Option(`--docker-build`,`build docker images`).env(a.envs.PL_DOCKER_BUILD).default(!1)),e.addOption(new t.Option(`--docker-no-build`,`do not build docker images`).env(a.envs.PL_DOCKER_NO_BUILD).default(!1)),e.addOption(new t.Option(`--docker-autopush`,`push docker images after build`).env(a.envs.PL_DOCKER_AUTOPUSH).default(!1)),e.addOption(new t.Option(`--docker-no-autopush`,`do not push docker images`).env(a.envs.PL_DOCKER_NO_AUTOPUSH).default(!1)),e.addOption(new t.Option(`--conda-build`,`build conda environment before packing`).env(a.envs.PL_CONDA_BUILD).default(!1)),e.addOption(new t.Option(`--conda-no-build`,`do not build conda environment`).env(a.envs.PL_CONDA_NO_BUILD).default(!1)),e.action(async e=>{let t=a.util.createLogger(e.logLevel);try{let n=Yr({channel:e.channel,variant:e.variant,location:e.location,usePublished:!!e.usePublished}),r=(0,a.createBuilder)(t,{packageRoot:e.packageRoot});r.version=e.version,r.targetPlatform=e.platform,r.allPlatforms=!!e.allPlatforms,r.fullDirHash=!!e.fullDirHash;let i=a.util.shouldDoAction({default:a.envs.isCI(),enable:e.dockerBuild,disable:e.dockerNoBuild}),o=i&&a.util.shouldDoAction({default:a.envs.isCI()&&!r.isPrivate,enable:e.dockerAutopush,disable:e.dockerNoAutopush});n.kind===`bare`&&(0,a.assertDockerPushIntent)({buildDocker:i,pushDocker:o,pushDisabledExplicitly:!!e.dockerNoAutopush,dockerPackageCount:r.selectedDockerPackages(e.packageId).length}),await ni({core:r,scenario:n,logger:t,options:{ids:e.packageId,force:e.force,contentRoot:e.contentRoot,storageUrl:e.storageUrl,dockerRegistry:e.dockerRegistry,dockerPushTo:e.dockerPushTo,buildDocker:i,pushDocker:o,condaBuild:a.util.shouldDoAction({default:!0,enable:e.condaBuild,disable:e.condaNoBuild})}})}catch(e){throw t.debug(e),e instanceof Error&&t.debug(e.stack),e}}),e}function fi(){let e=new t.Command(`software`).description(`Build and publish a block's software modules`);return e.addCommand(di()),e}function pi(e=process.cwd()){let n=new t.Command;n.name(`block-tools`).description(`Utility to manipulate Platforma Blocks and Block Registry`),n.addCommand(p()),n.addCommand(te()),n.addCommand(ne()),n.addCommand(re()),n.addCommand(ae()),n.addCommand(oe()),n.addCommand(se()),n.addCommand(Nr(e)),n.addCommand(Pr()),n.addCommand(Fr()),n.addCommand(zr()),n.addCommand(fi());let r=new t.Command(`structure`).description(`Manage block scaffolding against the canonical structure (check / init / refresh)`);return r.addCommand(Br(e)),r.addCommand(Gr(e)),r.addCommand(Mr(e)),n.addCommand(r),n}async function mi(e,t){await pi(t).parseAsync(e)}exports.buildProgram=pi,exports.run=mi;
|
|
24
24
|
//# sourceMappingURL=cli.js.map
|