@fugood/bricks-cli 2.25.0-beta.8 → 2.25.0-beta.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +115 -28
  2. package/lib/1001.js +1 -0
  3. package/lib/1010.js +1 -0
  4. package/lib/1178.js +1 -0
  5. package/lib/1215.js +1 -0
  6. package/lib/1708.js +9 -0
  7. package/lib/1759.js +1 -0
  8. package/lib/1936.js +1 -0
  9. package/lib/1946.js +1 -0
  10. package/lib/2151.js +1 -0
  11. package/lib/2247.js +1 -0
  12. package/lib/2486.js +1 -0
  13. package/lib/2557.js +1 -0
  14. package/lib/3223.js +4 -0
  15. package/lib/3332.js +13 -0
  16. package/lib/3593.js +1 -0
  17. package/lib/3690.js +1 -0
  18. package/lib/3774.js +44 -0
  19. package/lib/3976.js +14 -0
  20. package/lib/4305.js +1 -0
  21. package/lib/4456.js +3 -0
  22. package/lib/4479.js +30 -0
  23. package/lib/4530.js +22 -0
  24. package/lib/4642.js +9 -0
  25. package/lib/4685.js +1202 -0
  26. package/lib/5212.js +1 -0
  27. package/lib/563.js +4 -0
  28. package/lib/5658.js +2 -0
  29. package/lib/6194.js +3 -0
  30. package/lib/6645.js +1 -0
  31. package/lib/6818.js +1 -0
  32. package/lib/7111.js +2 -0
  33. package/lib/7233.js +2546 -0
  34. package/lib/7294.js +19 -0
  35. package/lib/7456.js +1 -0
  36. package/lib/7494.js +18 -0
  37. package/lib/7511.js +1 -0
  38. package/lib/7574.js +1 -0
  39. package/lib/7648.js +1 -0
  40. package/lib/8166.js +1 -0
  41. package/lib/8295.js +109 -0
  42. package/lib/831.js +1 -0
  43. package/lib/853.js +1 -0
  44. package/lib/907.js +918 -0
  45. package/lib/9215.js +1 -0
  46. package/lib/9320.js +3 -0
  47. package/lib/9387.js +32 -0
  48. package/lib/9405.js +1 -0
  49. package/lib/9430.js +1 -0
  50. package/lib/9583.js +19 -0
  51. package/lib/9590.js +7 -0
  52. package/lib/9663.js +1 -0
  53. package/lib/9866.js +7 -0
  54. package/lib/index.js +165 -974
  55. package/lib/lib.js +1121 -0
  56. package/lib/simulator-host-bridge.cjs +1 -0
  57. package/lib/simulator-main.mjs +23 -0
  58. package/lib/simulator-preload.cjs +1 -0
  59. package/package.json +28 -8
  60. package/lib/10.js +0 -1
  61. package/lib/117.js +0 -2543
  62. package/lib/166.js +0 -1
  63. package/lib/178.js +0 -1
  64. package/lib/3.js +0 -1
  65. package/lib/456.js +0 -1
  66. package/lib/511.js +0 -1
  67. package/lib/587.js +0 -7
  68. package/lib/602.js +0 -3
  69. package/lib/647.js +0 -30
  70. package/lib/940.js +0 -1
package/lib/3976.js ADDED
@@ -0,0 +1,14 @@
1
+ export const __rspack_esm_id=3976;export const __rspack_esm_ids=[3976];export const __webpack_modules__={79491(e){e.exports=import("oxfmt").then(function(e){return e})},48875(e,t){let r=["title","update_timestamp"],i=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),a=e=>void 0===e||"function"==typeof e||"symbol"==typeof e,n=e=>"number"!=typeof e||Number.isFinite(e)?e:null,o=e=>{if(!a(e))return Array.isArray(e)?e.map(e=>a(e)?null:o(e)):i(e)?Object.entries(e).reduce((e,[t,r])=>(a(r)||(e[t]=o(r)),e),{}):n(e)},s=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)&&!a(e[t]),l=(e,t)=>{let r=e[t];return a(r)?null:r},c=(e,t)=>{if((e=n(e))===(t=n(t)))return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(!c(l(e,r),l(t,r)))return!1;return!0}if(i(e)&&i(t)){let r=0;for(let i of Object.keys(e))if(!a(e[i])&&(r+=1,!s(t,i)||!c(e[i],t[i])))return!1;let i=0;for(let e of Object.keys(t))a(t[e])||(i+=1);return r===i}return!1},u=e=>{if(!i(e))return e;let t={...e};for(let e of r)delete t[e];return t},d=(e,t,r,a)=>{if(!c(e,t)){if(i(e)&&i(t)){for(let i of new Set([...Object.keys(e),...Object.keys(t)])){let n=s(e,i),l=s(t,i);if(!n&&!l)continue;let c=[...r,i];l?n?d(e[i],t[i],c,a):a.push({op:"set",path:c,value:o(t[i])}):a.push({op:"unset",path:c})}return}if(Array.isArray(e)&&Array.isArray(t)&&e.length===t.length){for(let i=0;i<t.length;i+=1)d(l(e,i),l(t,i),[...r,i],a);return}a.push({op:"set",path:r,value:o(t)})}};t.O2=(e,t)=>{let r=[];return d(u(e),u(t),[],r),r}},2985(e,t,r){r.d(t,{Re:()=>c,m4:()=>l});var i,a=r(99436),n=r(51455),o=r(76760),s=r(48875),l=(e,t)=>{if(null==e)return{status:"no_baseline"};if(null==t)return{status:"unavailable"};var r=(0,s.O2)(e,t);return{status:"ok",ops:r,opCount:r.length}},c=(i=a(function*(e){try{return JSON.parse((yield(0,n.readFile)(o.join(e,".bricks/build/application-config.json"),"utf8")))}catch{return null}}),function(e){return i.apply(this,arguments)})},3540(e,t,r){r.d(t,{S:()=>d,a:()=>u});var i,a,n=r(99436),o=r(51455),s=r(76760),l=".bricks/edits.jsonl",c=(i=n(function*(e){var t=s.join(e,".gitignore"),r=yield(0,o.readFile)(t,"utf8").catch(e=>{if(e?.code==="ENOENT")return"";throw e});if(!r.split(/\r?\n/).map(e=>e.trim()).some(e=>e===l||".bricks/"===e||".bricks"===e)){var i=r&&!r.endsWith("\n")?"\n":"";yield(0,o.writeFile)(t,`${r}${i}
2
+ # MCP entry-editing audit log
3
+ ${l}
4
+ `)}}),function(e){return i.apply(this,arguments)}),u=(a=n(function*(e,t){var r=s.join(e,".bricks");yield(0,o.mkdir)(r,{recursive:!0}),yield c(e),yield(0,o.appendFile)(s.join(r,"edits.jsonl"),`${JSON.stringify(t)}
5
+ `)}),function(e,t){return a.apply(this,arguments)}),d=()=>({session:process.env.BRICKS_CTOR_SESSION_ID||process.env.CODEX_SESSION_ID,agent:process.env.BRICKS_CTOR_AGENT_ID||process.env.USER})},98009(e,t,r){r.d(t,{Gp:()=>l,HJ:()=>p,Hn:()=>n,JJ:()=>d,Kx:()=>m,Pb:()=>y,RI:()=>s,bf:()=>u,jc:()=>f,u4:()=>o,zu:()=>c});var i=r(58135),a=r(76760),n={trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100},o=e=>!!e&&"object"==typeof e&&!Array.isArray(e),s=(e,t)=>a.relative(e,t).replace(/\\/g,"/").replace(/^\.\/+/,""),l=e=>i.isIdentifier(e)?e.name:i.isStringLiteral(e)||i.isNumericLiteral(e)?String(e.value):null,c=e=>/^[$A-Z_a-z][$\w]*$/.test(e)?i.identifier(e):i.stringLiteral(e),u=(e,t)=>e.properties.find(e=>!!i.isObjectProperty(e)&&l(e.key)===t),d=(e,t)=>{var r=u(e,t);if(r&&i.isStringLiteral(r.value))return r.value.value},p=(e,t,r)=>{var a=u(e,t);if(a){a.value=r;return}e.properties.push(i.objectProperty(c(t),r))},f=(e,t)=>{var r=e.properties.findIndex(e=>!!i.isObjectProperty(e)&&l(e.key)===t);r>=0&&e.properties.splice(r,1)},y=(e,t)=>{var r=e.program.body,a=r.findLastIndex(e=>i.isImportDeclaration(e));r.splice(a+1,0,t)},m=(e,t,r)=>{var a=new Set(Array.from(r).filter(Boolean));if(0!==a.size){var n,o=function(e){return i.isImportDeclaration(e)&&"bricks-ctor"===e.source.value&&"type"===t==("type"===e.importKind)?(e.specifiers.forEach(e=>{if(i.isImportSpecifier(e)){var t=e.imported;i.isIdentifier(t)&&a.delete(t.name),i.isStringLiteral(t)&&a.delete(t.value)}}),a.forEach(t=>{e.specifiers.push(i.importSpecifier(i.identifier(t),i.identifier(t)))}),{v:void 0}):0};for(var s of e.program.body)if(0!==(n=o(s))&&n)return n.v;var l=i.importDeclaration(Array.from(a).map(e=>i.importSpecifier(i.identifier(e),i.identifier(e))),i.stringLiteral("bricks-ctor"));"type"===t&&(l.importKind="type"),y(e,l)}}},54452(e,t,r){r.d(t,{H:()=>u});var i,a,n=r(99436),o=r(75720),s=r(2985),l={FORCE_COLOR:"0",NO_COLOR:"1"},c=(i=n(function*(e){var t=yield(0,s.Re)(e);try{yield(0,o.sh)`bun compile`.cwd(e).env({...l,BRICKS_CTOR_ENABLE_EDITING_TOOLS:"0"}).text()}catch(e){var r=[e.stdout?.toString()??"",e.stderr?.toString()??"",e.message].filter(Boolean).join("\n").trim();return{status:"compile:failed",errors:r?[r]:["bun compile failed"]}}var i=yield(0,s.Re)(e);return{status:"compile:ok",errors:[],configChange:(0,s.m4)(t,i)}}),function(e){return i.apply(this,arguments)}),u=(a=n(function*(e,t){return(void 0!==t?t:!["0","false","no","off"].includes((process.env.BRICKS_CTOR_MCP_EDIT_VERIFY??"true").toLowerCase()))?c(e):{status:"skipped",errors:[]}}),function(e,t){return a.apply(this,arguments)})},69899(e,t,r){r.a(e,async function(e,i){try{r.r(t),r.d(t,{__test__:()=>eJ,register:()=>eT});var a,n,o,s,l,c,u,d,p,f,y,m,b,v,h,g,x,_,w,j,k,I=r(68832),S=r(99436),$=r(44668),E=r(5018),O=r(63315),P=r(30409),C=r(40906),D=r(59410),A=r(2235),L=r(46773),R=r(58135),F=r(11978),N=r(79491),T=r(51455),J=r(76760),Y=r(84867),M=r(54452),z=r(98009),q=r(3540),H=e([N]);function K(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=function(){return!!e})()}N=(H.then?(await H)():H)[0];var B=A.default||A,W=function(e){function t(e,r,i,a=!1){var n,o,s;return E(this,t),o=t,s=[r],o=P(o),(n=O(this,K()?Reflect.construct(o,s||[],P(this).constructor):o.apply(this,s))).name="DataCalcEditingError",n.code=e,n.details=i,n.isMcpError=a,n}return C(t,e),$(t)}(D(Error)),U=(e,t)=>{if(J.isAbsolute(t))throw new W("invalid_file","File must be project-relative",{file:t});var r=J.resolve(e,t),i=J.relative(e,r);if(i.startsWith("..")||J.isAbsolute(i))throw new W("invalid_file","File must stay inside the project directory",{file:t});return r},V=(e,t)=>{try{return(0,L.parse)(e,{sourceType:"module",plugins:["typescript","topLevelAwait"],errorRecovery:!1})}catch(e){throw new W("parse_failed",`Cannot parse ${t} as TypeScript: ${e.message}. Edit this file directly.`,{file:t},!0)}},G=(a=S(function*(e,t){var r=yield(0,T.readFile)(t,"utf8"),i=(0,z.RI)(e,t);return{source:r,ast:V(r,i),absPath:t,relPath:i}}),function(e,t){return a.apply(this,arguments)}),Z=e=>e.program.body.flatMap(e=>R.isExportNamedDeclaration(e)&&R.isVariableDeclaration(e.declaration)?e.declaration.declarations.flatMap(e=>{if(!R.isIdentifier(e.id))return[];var t,r=e.id.typeAnnotation;R.isTSTypeAnnotation(r)&&R.isTSTypeReference(r.typeAnnotation)&&R.isIdentifier(r.typeAnnotation.typeName)&&(t=r.typeAnnotation.typeName.name);var i=R.isObjectExpression(e.init)?e.init:void 0;return[{name:e.id.name,object:i,id:i?(0,z.JJ)(i,"id"):void 0,alias:i?(0,z.JJ)(i,"alias"):void 0,typeName:t}]}):[]),Q=(e,t)=>{if(null==t||""===t)return J.join(e,"subspaces/subspace-0");if("number"==typeof t)return J.join(e,"subspaces",`subspace-${t}`);var r=String(t);if(/^\d+$/.test(r))return J.join(e,"subspaces",`subspace-${r}`);if(/^subspace-\d+$/.test(r))return J.join(e,"subspaces",r);if(r.includes("/"))return U(e,r);throw new W("unsupported_subspace",`Unsupported subspace locator: ${r}`,{subspace:r})},X=e=>{var t=J.basename(e),r=/^data-calculation-(.+)\.ts$/.exec(t);if(!r)throw new W("invalid_file","Expected data-calculation-{slug}.ts file",{file:e});return r[1]},ee=(n=S(function*(e){return(yield(0,T.readdir)(e,{withFileTypes:!0}).catch(()=>[])).filter(e=>e.isFile()&&/^data-calculation-.+\.ts$/.test(e.name)&&!e.name.endsWith(".sandbox.ts")).map(t=>J.join(e,t.name)).sort()}),function(e){return n.apply(this,arguments)}),et=e=>{var t=(0,z.bf)(e,"code")?.value;return t&&R.isExpression(t)?t:null},er=e=>{var t=R.isAwaitExpression(e)?e.argument:e;if(!R.isCallExpression(t))return null;var r=t.arguments[0];if(!R.isNewExpression(r)||!R.isIdentifier(r.callee)||"URL"!==r.callee.name)return null;var i=r.arguments[0];return R.isStringLiteral(i)?i.value:null},ei=(o=S(function*(e,t){if(t.file)a=U(e,t.file);else{var r,i,a,n=Q(e,t.subspace),o=J.join(n,"data-calc"),s=yield ee(o),l=t.calc;if(!l)throw new W("missing_calc","Provide file or subspace+calc");for(var c of s){if(l===X(c)){a=c;break}try{var u=yield G(e,c),d=Z(u.ast).find(e=>"dataCalculation"===e.name);if(d&&(l===d.alias||l===d.id)){a=c;break}}catch{continue}}}if(!a)throw new W("calc_not_found",`Data calc not found: ${t.calc}`,{calc:t.calc,subspace:t.subspace??"subspace-0"});var p=yield G(e,a),f=(e=>{var t=Z(e.ast).find(e=>"dataCalculation"===e.name);if(!t||!t.object)throw new W("fallback_recommended",`Data calc ${e.relPath} is not a single exported object literal. Edit this file directly for this one.`,{file:e.relPath,check:"export const dataCalculation object literal"});var r=(0,z.JJ)(t.object,"__typename");if("DataCalculationScript"!==r)throw new W("fallback_recommended",`Data calc ${e.relPath} is ${r||"not DataCalculationScript"}. DataCalculationMap is out of scope; edit this file directly.`,{file:e.relPath,typename:r});return t.object})(p),y=X(a),m=(r=et(f),(i=er(r))&&/^(\.\/)?[^/\\]+\.sandbox\.js$/.test(i)?i.replace(/^\.\//,""):`data-calculation-${y}.sandbox.js`);return{parsed:p,object:f,slug:y,sandboxFile:m}}),function(e,t){return o.apply(this,arguments)}),ea=e=>{for(var t of e.program.body)if(R.isImportDeclaration(t)&&"node:fs/promises"===t.source.value){t.specifiers.some(e=>R.isImportSpecifier(e)&&R.isIdentifier(e.imported)&&"readFile"===e.imported.name)||t.specifiers.push(R.importSpecifier(R.identifier("readFile"),R.identifier("readFile")));return}(0,z.Pb)(e,R.importDeclaration([R.importSpecifier(R.identifier("readFile"),R.identifier("readFile"))],R.stringLiteral("node:fs/promises")))},en=e=>{(0,z.Kx)(e.parsed.ast,"type",e.typeImports),(0,z.Kx)(e.parsed.ast,"value",e.valueImports)},eo=(s=S(function*(e,t,r,i){var a,n=(e=>{var t=e.split(J.sep),r=t.findIndex(e=>/^subspace-\d+$/.test(e));if(r<0)throw new W("invalid_file","Data-calc file must be inside subspaces/subspace-N/data-calc",{file:e});return t.slice(0,r+1).join(J.sep)})(t),o=null==i?n:Q(e,i),s=J.join(o,"data.ts"),l=yield G(e,s),c=Z(l.ast).filter(e=>e.name===r||e.id===r||e.alias===r);if(0===c.length)throw new W("reference_not_found",`Data reference not found: ${r}`,{ref:r,subspace:J.basename(o)});if(c.length>1)throw new W("ambiguous_reference",`Data reference is ambiguous: ${r}`,{ref:r,matches:c.map(t=>({file:(0,z.RI)(e,s),entry:t.name,id:t.id,alias:t.alias}))});var u=J.resolve(s)===J.resolve(t);return{input:r,id:c[0].id,alias:c[0].alias,varName:c[0].name,sameFile:u,importSource:u?void 0:((a=J.relative(J.dirname(t),s).replace(/\\/g,"/")).startsWith(".")||(a=`./${a}`),a.replace(/\.(ts|tsx|js|jsx)$/,""))}}),function(e,t,r,i){return s.apply(this,arguments)}),es=(l=S(function*(e,t){if((0,z.u4)(e)&&"string"==typeof e.expr)return(0,L.parseExpression)(e.expr,{plugins:["typescript"]});var r="string"==typeof e?e:(0,z.u4)(e)?e.ref:void 0;if("string"!=typeof r||!r)throw new W("invalid_ref","Data getter requires a data ref string");var i=yield eo(t.projectDir,t.parsed.absPath,r,(0,z.u4)(e)?e.subspace:void 0),a=i.sameFile?"data":((e,t,r)=>{for(var i of e.ast.program.body)if(R.isImportDeclaration(i)&&i.source.value===t){var a=i.specifiers.find(e=>R.isImportNamespaceSpecifier(e));if(a)return a.local.name}var n=(e=>{var t=new Set;for(var r of e.program.body){if(R.isImportDeclaration(r)){r.specifiers.forEach(e=>t.add(e.local.name));continue}R.isExportNamedDeclaration(r)&&R.isVariableDeclaration(r.declaration)&&r.declaration.declarations.forEach(e=>{R.isIdentifier(e.id)&&t.add(e.id.name)})}return t})(e.ast),o=r;if(n.has(o)){for(var s=1;n.has(`${o}${s}`);)s+=1;o=`${o}${s}`}var l=R.importDeclaration([R.importNamespaceSpecifier(R.identifier(o))],R.stringLiteral(t));return(0,z.Pb)(e.ast,l),o})(t.parsed,i.importSource||"../data","data");return t.references.push(i),R.arrowFunctionExpression([],R.memberExpression(R.identifier(a),R.identifier(i.varName)))}),function(e,t){return l.apply(this,arguments)}),el=(c=S(function*(e,t){return null==e?R.nullLiteral():es(e,t)}),function(e,t){return c.apply(this,arguments)}),ec=(u=S(function*(e,t){var r=J.join(e,"subspaces");for(var i of yield(0,T.readdir)(r,{withFileTypes:!0}).catch(()=>[]))if(i.isDirectory()&&/^subspace-\d+$/.test(i.name))for(var a of yield ee(J.join(r,i.name,"data-calc")))try{var n=yield G(e,a),o=Z(n.ast).find(e=>"dataCalculation"===e.name);if(o?.alias===t)return!0}catch{continue}return!1}),function(e,t){return u.apply(this,arguments)}),eu=new Set(["__typename","id","code","enableAsync","inputs","output","outputs","error"]),ed=e=>R.awaitExpression(R.callExpression(R.identifier("readFile"),[R.newExpression(R.identifier("URL"),[R.stringLiteral(`./${e}`),R.memberExpression(R.metaProperty(R.identifier("import"),R.identifier("meta")),R.identifier("url"))]),R.stringLiteral("utf8")])),ep=(d=S(function*(e,t){if((0,z.u4)(e)){if("string"==typeof e.expr)return(0,L.parseExpression)(e.expr,{plugins:["typescript"]});if("string"==typeof e.ref)return es(e,t)}if(null===e)return R.nullLiteral();if(void 0===e)return R.identifier("undefined");if("string"==typeof e)return R.stringLiteral(e);if("number"==typeof e)return R.numericLiteral(e);if("boolean"==typeof e)return R.booleanLiteral(e);if(Array.isArray(e))return R.arrayExpression((yield Promise.all(e.map(e=>ep(e,t)))));if((0,z.u4)(e)){var r,i=yield Promise.all(Object.entries(e).map((r=S(function*([e,r]){return R.objectProperty((0,z.zu)(e),(yield ep(r,t)))}),function(e){return r.apply(this,arguments)})));return R.objectExpression(i)}throw new W("invalid_value",`Unsupported value: ${String(e)}`)}),function(e,t){return d.apply(this,arguments)}),ef=(p=S(function*(e){var t=B(e.ast,{comments:!0},e.source).code,r=yield(0,N.format)(e.absPath,t,z.Hn);if(r.errors.length>0)throw new W("format_failed",`oxfmt failed for ${e.relPath}`,{file:e.relPath,errors:r.errors});return r.code}),function(e){return p.apply(this,arguments)}),ey=(f=S(function*(e){var t=yield ef(e);return V(t,e.relPath),yield(0,T.writeFile)(e.absPath,t),t}),function(e){return f.apply(this,arguments)}),em=e=>({content:[{type:"text",text:JSON.stringify(e,null,2)}],isError:e.isError||void 0}),eb=e=>e.map(e=>({input:e.input,id:e.id,alias:e.alias,entry:e.varName})),ev=(y=S(function*(e,t,r,i){var a=new Date().toISOString(),n=(0,q.S)();try{var o=yield i();return yield(0,q.a)(e,{ts:a,tool:t,input:r,provenance:n,outcome:o.outcome,summary:o.summary,result:o}),o}catch(i){var s=i instanceof W,l=s&&"fallback_recommended"===i.code?"fallback_recommended":"error",c={outcome:l,isError:"error"===l,error:{code:s?i.code:"unexpected_error",message:i.message,details:s?i.details:void 0},summary:`${t} failed: ${i.message}`};return yield(0,q.a)(e,{ts:a,tool:t,input:r,provenance:n,outcome:c.outcome,summary:c.summary,error:c.error}).catch(()=>void 0),c}}),function(e,t,r,i){return y.apply(this,arguments)}),eh=(m=S(function*(e,t){var r=new Set((yield ee(e)).map(X));if(t){var i=t.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"calc";if(!r.has(i))return i;for(var a=1;r.has(`${i}-${a}`);)a+=1;return`${i}-${a}`}for(var n=0;r.has(String(n));)n+=1;return String(n)}),function(e,t){return m.apply(this,arguments)}),eg=e=>{try{return(0,F.qg)(e,{sourceType:"module",ecmaVersion:2020}),!0}catch{return!1}},ex=e=>{var t=e??"";if((e=>{try{var t=(0,F.qg)(e,{sourceType:"module",ecmaVersion:2020}).body[0];return t?.type==="ExportNamedDeclaration"&&t.declaration?.type==="FunctionDeclaration"&&t.declaration.id?.name==="main"}catch{return!1}})(t))return t.endsWith("\n")?t:`${t}
6
+ `;var r=t.trim();if(!r)return"export function main() {\n}\n";for(var i of["","async "]){var a=`export ${i}function main() {
7
+ ${r}
8
+ }
9
+ `;if(eg(a))return a}throw new W("invalid_code",/export\s+(async\s+)?function\s+main\s*\(/.test(t)?"Sandbox code does not parse as a module (note: top-level await requires export async function main)":"Sandbox code does not parse as a script body (statements with top-level return)")},e_=(b=S(function*(e,t){yield(0,T.mkdir)(t,{recursive:!0});var r=yield ee(t),i=r.map((e,t)=>{var r=X(e);return`import { dataCalculation as dataCalculation${t} } from './data-calculation-${r}'`}).join("\n"),a=r.map((e,t)=>`dataCalculation${t}`).join(",\n "),n=`${i}
10
+
11
+ export const dataCalculation = [
12
+ ${a}
13
+ ]
14
+ `,o=J.join(t,"index.ts"),s={absPath:o,relPath:(0,z.RI)(e,o),source:n,ast:V(n,(0,z.RI)(e,o))};return yield ey(s),(0,z.RI)(e,o)}),function(e,t){return b.apply(this,arguments)}),ew=(v=S(function*(e,t){var r=J.join(t,"index.ts"),i=(0,z.RI)(e,r),a=yield(0,T.readFile)(r,"utf8").catch(e=>{if(e?.code==="ENOENT")return null;throw e});if(null==a)return{warning:`${i} not found; wire the data-calc import manually`};var n=yield G(e,r),o=(e=>{for(var t of e.program.body)if(R.isExportDefaultDeclaration(t)){var r=t.declaration;if(R.isObjectExpression(r))return r;if(R.isTSAsExpression(r)&&R.isObjectExpression(r.expression))return r.expression}return null})(n.ast);if(!o)return{warning:`${i} has no default-export object; wire the data-calc import manually`};var s=(0,z.bf)(o,"dataCalculation");if(s&&R.isIdentifier(s.value))return null;if(s&&!(R.isArrayExpression(s.value)&&0===s.value.elements.length))return{warning:`${i} has a non-empty dataCalculation value; wire the data-calc import manually`};if(n.ast.program.body.some(e=>R.isImportDeclaration(e)&&("./data-calc"===e.source.value||"./data-calc/index"===e.source.value))||(0,z.Pb)(n.ast,R.importDeclaration([R.importSpecifier(R.identifier("dataCalculation"),R.identifier("dataCalculation"))],R.stringLiteral("./data-calc"))),s)s.value=R.identifier("dataCalculation"),R.isIdentifier(s.key)&&(s.shorthand=!0);else{var l=R.objectProperty(R.identifier("dataCalculation"),R.identifier("dataCalculation"));l.shorthand=!0,o.properties.push(l)}return yield ey(n),{touched:n.relPath}}),function(e,t){return v.apply(this,arguments)}),ej=(h=S(function*(e,t,r){if(!t.key)throw new W("missing_key",`${e} item requires key`);if(null==t.data)throw new W("missing_data",`${e} item requires data`);var i=[R.objectProperty(R.identifier("key"),R.stringLiteral(t.key)),R.objectProperty(R.identifier("data"),(yield es(t.data,r)))];return"inputs"===e&&i.push(R.objectProperty(R.identifier("trigger"),R.booleanLiteral(!1!==t.trigger))),R.objectExpression(i)}),function(e,t,r){return h.apply(this,arguments)}),ek=(g=S(function*(e,t,r){if("inputs"===e){var i=new Set;for(var a of t){if(i.has(a?.key))throw new W("duplicate_key",`Input key already exists: ${a.key}`,{key:a.key});i.add(a?.key)}}return R.arrayExpression((yield Promise.all(t.map(t=>ej(e,t,r)))))}),function(e,t,r){return g.apply(this,arguments)}),eI=(e,t)=>{if("number"==typeof t.index)return t.index;if(!t.key)return -1;var r=e.elements.map((e,t)=>({element:e,index:t})).filter(({element:e})=>R.isObjectExpression(e)&&(0,z.JJ)(e,"key")===t.key);if(r.length>1)throw new W("ambiguous_key",`IO key is ambiguous: ${t.key}`,{key:t.key,count:r.length});return r[0]?.index??-1},eS=(x=S(function*(e,t,r,i){let a;r.typeImports.add("DataCalculationScript"),r.valueImports.add("makeId"),ea(r.parsed.ast);var n=[R.objectProperty(R.identifier("__typename"),R.stringLiteral("DataCalculationScript")),R.objectProperty(R.identifier("id"),e.id?R.stringLiteral(e.id):(a="property_bank_calc",R.callExpression(R.identifier("makeId"),i?[R.stringLiteral(a),R.stringLiteral(i)]:[R.stringLiteral(a)])))];return e.alias&&n.push(R.objectProperty(R.identifier("alias"),R.stringLiteral(e.alias))),null!=e.title&&n.push(R.objectProperty(R.identifier("title"),R.stringLiteral(e.title))),null!=e.description&&n.push(R.objectProperty(R.identifier("description"),R.stringLiteral(e.description))),null!=e.note&&n.push(R.objectProperty(R.identifier("note"),R.stringLiteral(e.note))),n.push(R.objectProperty(R.identifier("code"),ed(t))),n.push(R.objectProperty(R.identifier("enableAsync"),R.booleanLiteral(!!e.enableAsync))),null!=e.triggerMode&&n.push(R.objectProperty(R.identifier("triggerMode"),R.stringLiteral(e.triggerMode))),n.push(R.objectProperty(R.identifier("inputs"),(yield ek("inputs",e.inputs||[],r)))),n.push(R.objectProperty(R.identifier("output"),(yield el(e.output,r)))),n.push(R.objectProperty(R.identifier("outputs"),(yield ek("outputs",e.outputs||[],r)))),n.push(R.objectProperty(R.identifier("error"),(yield el(e.error,r)))),R.objectExpression(n)}),function(e,t,r,i){return x.apply(this,arguments)}),e$=(_=S(function*(e,t){return ev(e,"new_data_calc",t,S(function*(){var r,i,a,n=Q(e,t.subspace),o=J.join(n,"data-calc");yield(0,T.mkdir)(o,{recursive:!0});var s=yield eh(o,t.alias),l=`data-calculation-${s}.sandbox.js`,c=J.join(o,`data-calculation-${s}.ts`),u=J.join(o,l),d=(r=(0,z.RI)(e,c),i="export const dataCalculation = {}\n",(a=V(i,r)).program.body=[],{ast:a,source:i,absPath:c,relPath:r}),p={projectDir:e,parsed:d,references:[],typeImports:new Set,valueImports:new Set},f=t.id||"string"!=typeof t.alias||!t.alias||(yield ec(e,t.alias))?void 0:t.alias,y=yield eS(t,l,p,f),m=R.variableDeclarator(R.identifier("dataCalculation"),y);m.id.typeAnnotation=R.tsTypeAnnotation(R.tsTypeReference(R.identifier("DataCalculationScript"))),d.ast.program.body.push(R.exportNamedDeclaration(R.variableDeclaration("const",[m]))),en(p),yield(0,T.writeFile)(u,ex(t.code)),yield ey(d);var b=[{file:(0,z.RI)(e,c),action:"create_calc"},{file:(0,z.RI)(e,u),action:"write_sandbox"}];b.push({file:yield e_(e,o),action:"regenerate_index"});var v=yield ew(e,n);v?.touched&&b.push({file:v.touched,action:"wire_subspace_index"});var h=yield(0,M.H)(e,t.verify);return{file:(0,z.RI)(e,c),subspace:J.basename(n),calc:s,idExpression:t.id??(f?`makeId('property_bank_calc', '${f}')`:"makeId('property_bank_calc')"),outcome:"compile:failed"===h.status?"verify_failed":"ok",touchedSites:b,...v?.warning?{warnings:[v.warning]}:{},verify:h,references:eb(p.references),summary:`created data calc ${s} in ${J.basename(n)} -> ${h.status}`}}))}),function(e,t){return _.apply(this,arguments)}),eE=(w=S(function*(e,t){return ev(e,"edit_data_calc",t,S(function*(){var r=yield ei(e,t),i={projectDir:e,parsed:r.parsed,references:[],typeImports:new Set,valueImports:new Set},a=[];for(var n of Object.entries(t.set||{})){var o=I(n,2),s=o[0],l=o[1];if("output"===s||"error"===s)(0,z.HJ)(r.object,s,(yield el(l,i)));else if("inputs"===s||"outputs"===s){if(!Array.isArray(l))throw new W("invalid_value",`${s} must be an array of IO items`);(0,z.HJ)(r.object,s,(yield ek(s,l,i)))}else if("code"===s)throw new W("invalid_field","Set code via the dedicated code parameter so it stays normalized to the sandbox file");else(0,z.HJ)(r.object,s,(yield ep(l,i)))}for(var c of t.unset||[]){if(eu.has(c))throw new W("invalid_field",`Cannot unset required field: ${c}`,{field:c});(0,z.jc)(r.object,c)}if(null!=t.code){var u=et(r.object);if(!(e=>{if(!e)return!1;if(R.isStringLiteral(e)||R.isTemplateLiteral(e))return!0;var t=er(e);return null!=t&&/^(\.\/)?[^/\\]+\.sandbox\.js$/.test(t)})(u))throw new W("fallback_recommended",`Data calc ${r.parsed.relPath} has an unsupported code expression. Edit this file directly for this one.`,{file:r.parsed.relPath,field:"code"});var d=r.sandboxFile,p=J.join(J.dirname(r.parsed.absPath),d);yield(0,T.writeFile)(p,ex(t.code)),ea(r.parsed.ast),(0,z.HJ)(r.object,"code",ed(d)),a.push({file:(0,z.RI)(e,p),action:"write_sandbox"})}en(i),yield ey(r.parsed),a.unshift({file:r.parsed.relPath,action:"edit_calc"});var f=yield(0,M.H)(e,t.verify);return{file:r.parsed.relPath,calc:r.slug,outcome:"compile:failed"===f.status?"verify_failed":"ok",touchedSites:a,verify:f,references:eb(i.references),summary:`edited data calc ${r.slug} -> ${f.status}`}}))}),function(e,t){return w.apply(this,arguments)}),eO=(j=S(function*(e,t){return ev(e,"edit_data_calc_io",t,S(function*(){var r=yield ei(e,t),i={projectDir:e,parsed:r.parsed,references:[],typeImports:new Set,valueImports:new Set},a=t.field,n=((e,t)=>{var r=(0,z.bf)(e,t);if(r){if(!R.isArrayExpression(r.value))throw new W("fallback_recommended",`${t} is not an array. Edit this file directly.`);return r.value}var i=R.arrayExpression([]);return e.properties.push(R.objectProperty(R.identifier(t),i)),i})(r.object,a),o=t.op;if("clear"===o)n.elements=[];else if("remove"===o){var s=eI(n,t);if(s<0||s>=n.elements.length)throw new W("invalid_index","remove requires a valid key or index");n.elements.splice(s,1)}else if("add"===o||"replace"===o){var l="replace"===o?eI(n,t):t.index;if("replace"===o&&(l<0||l>=n.elements.length))throw new W("invalid_index","replace requires a valid key or index");if("add"===o&&"number"==typeof l&&(l<0||l>n.elements.length))throw new W("invalid_index","add index out of range",{index:l});"inputs"===a&&((e,t,r)=>{if(e.elements.some((e,i)=>i!==r&&R.isObjectExpression(e)&&(0,z.JJ)(e,"key")===t))throw new W("duplicate_key",`Input key already exists: ${t}`,{key:t})})(n,t.key,"replace"===o?l:void 0);var c=yield ej(a,t,i);"replace"===o?n.elements[l]=c:n.elements.splice("number"==typeof l?l:n.elements.length,0,c)}else throw new W("invalid_op",`Unsupported edit_data_calc_io op: ${o}`);en(i),yield ey(r.parsed);var u=yield(0,M.H)(e,t.verify);return{file:r.parsed.relPath,calc:r.slug,outcome:"compile:failed"===u.status?"verify_failed":"ok",change:{field:a,op:o,key:t.key,index:t.index},verify:u,references:eb(i.references),summary:`${o} ${a} on data calc ${r.slug} -> ${u.status}`}}))}),function(e,t){return j.apply(this,arguments)}),eP=(k=S(function*(e,t){return ev(e,"remove_data_calc",t,S(function*(){var r=yield ei(e,t),i=J.dirname(r.parsed.absPath),a=J.join(i,r.sandboxFile);yield(0,T.rm)(r.parsed.absPath,{force:!0}),yield(0,T.rm)(a,{force:!0});var n=yield e_(e,i),o=yield(0,M.H)(e,t.verify);return{file:r.parsed.relPath,calc:r.slug,outcome:"compile:failed"===o.status?"verify_failed":"ok",touchedSites:[{file:r.parsed.relPath,action:"delete_calc"},{file:(0,z.RI)(e,a),action:"delete_sandbox"},{file:n,action:"regenerate_index"}],verify:o,summary:`removed data calc ${r.slug} -> ${o.status}`}}))}),function(e,t){return k.apply(this,arguments)}),eC=Y.bz().describe('Value grammar: JSON literals, bare data ref strings for output/error/IO data, { ref, subspace }, or { expr: "raw TypeScript expression" }.'),eD=Y.Yj().describe("Project-relative data-calc file path, for example subspaces/subspace-0/data-calc/data-calculation-total.ts."),eA=Y.KC([Y.Yj(),Y.ai()]).describe('Subspace locator. Defaults to subspace-0; accepts 0, "0", "subspace-0", or a project-relative subspace path.'),eL=Y.Yj().describe("Data calc locator inside the subspace: alias, explicit string id, or filename slug."),eR=Y.zM().describe("Override compile verification. Defaults to BRICKS_CTOR_MCP_EDIT_VERIFY, otherwise true."),eF={file:eD.optional(),subspace:eA.optional(),calc:eL.optional(),verify:eR.optional()},eN=Y.Ik({key:Y.Yj().describe('Sandbox input/output key, for example "price" or "total".'),data:eC.describe("Data ref as alias/id/varName, { ref, subspace }, or { expr }."),trigger:Y.zM().describe("Inputs only; defaults true.").optional()}).describe("DataCalculationScript IO item.");function eT(e,t){var r,i,a,n;e.tool("new_data_calc","Create a standard DataCalculationScript in data-calc/{calc}.ts plus its sandbox JS file, regenerate data-calc/index.ts, and wire minimal subspace indexes.",{subspace:eA.optional(),alias:Y.Yj().describe("Optional alias; also drives the filename slug.").optional(),title:Y.Yj().describe("Optional title.").optional(),description:Y.Yj().describe("Optional description.").optional(),note:Y.Yj().describe("Optional script note.").optional(),triggerMode:Y.k5(["auto","manual"]).describe("Optional trigger mode; omitted by default.").optional(),enableAsync:Y.zM().describe("Whether the sandbox main may be async. Defaults false.").optional(),code:Y.Yj().describe("Sandbox body. The tool wraps it as export function main() { ... } unless already wrapped.").optional(),inputs:Y.YO(eN).describe("Initial script inputs. Input keys must be unique.").optional(),outputs:Y.YO(eN).describe("Initial fan-out outputs. Output keys may repeat.").optional(),output:eC.describe("Single output data ref or null.").optional(),error:eC.describe("Error output data ref or null.").optional(),id:Y.Yj().describe("Optional explicit id. Defaults to source expression makeId('property_bank_calc').").optional(),verify:eR.optional()},(r=S(function*(e){return em((yield e$(t,e)))}),function(e){return r.apply(this,arguments)})),e.tool("edit_data_calc","Edit DataCalculationScript scalar fields, output/error refs, or sandbox code. Code edits normalize inline code to sandbox file-form.",{...eF,set:Y.g1(Y.Yj().describe("Top-level field path such as title, description, note, alias, triggerMode, enableAsync, output, or error."),eC).describe("Fields to set. output/error accept bare data ref strings, { ref, subspace }, { expr }, or null; inputs/outputs accept whole replacement arrays of { key, data, trigger? }. Use the code parameter for code.").optional(),unset:Y.YO(Y.Yj()).describe("Top-level fields to remove.").optional(),code:Y.Yj().describe("Replacement sandbox body. The tool wraps it as export function main() { ... } unless already wrapped.").optional()},(i=S(function*(e){return em((yield eE(t,e)))}),function(e){return i.apply(this,arguments)})),e.tool("edit_data_calc_io","Edit DataCalculationScript inputs or outputs arrays. Inputs require unique keys; outputs may repeat keys for fan-out.",{...eF,field:Y.k5(["inputs","outputs"]).describe("Which IO array to edit."),op:Y.k5(["add","remove","replace","clear"]).describe("Array operation."),key:Y.Yj().describe("IO key target. Ambiguous repeated output keys must use index.").optional(),index:Y.ai().describe("Zero-based IO index target or add insertion index.").optional(),data:eC.describe("For add/replace: data ref as string, { ref, subspace }, or { expr }.").optional(),trigger:Y.zM().describe("Inputs only; defaults true.").optional()},(a=S(function*(e){return em((yield eO(t,e)))}),function(e){return a.apply(this,arguments)})),e.tool("remove_data_calc","Remove a standard DataCalculationScript .ts file plus its sandbox file and regenerate data-calc/index.ts. No reverse cascade is needed.",eF,(n=S(function*(e){return em((yield eP(t,e)))}),function(e){return n.apply(this,arguments)}))}var eJ={newDataCalc:e$,editDataCalc:eE,editDataCalcIo:eO,removeDataCalc:eP,resolveCalcTarget:ei};i()}catch(e){i(e)}})}};
package/lib/4305.js ADDED
@@ -0,0 +1 @@
1
+ export const __rspack_esm_id=4305;export const __rspack_esm_ids=[4305];export const __webpack_modules__={7944(e,o,r){r.r(o),r.d(o,{DEVTOOLS_TOKEN_REFRESH_AHEAD_MS:()=>a,getOrIssueDevtoolsToken:()=>l,issueDevtoolsAccessTokenCore:()=>c});var t,s,i=r(99436),n=r(47988),a=6048e5,c=(t=i(function*({client:e,ttlSeconds:o}={}){if(!e?.issueDevtoolsAccessToken)throw Error("A BRICKS workspace client is required to issue a DevTools access token.");return e.issueDevtoolsAccessToken({ttlSeconds:o})}),function(){return t.apply(this,arguments)}),l=(s=i(function*({profile:e,client:o,workspaceId:r,ttlSeconds:t,force:s=!1,now:i=Date.now()}={}){var l=e||(0,n.getCurrentProfile)(),f=yield(0,n.getProfileCredentialSnapshotAsync)(l),p=f.tokenInfo,k=f.fingerprint,u=f.devtoolsTokens;if(p?.type==="oauth"&&!k)throw Error(`OAuth profile ${l} belongs to a different account.`);if(!k)throw Error(`Profile ${l} is not logged in or has no workspace id.`);var w=p?.workspaceId,d=r||w;if(!d)throw Error(`Profile ${l} is not logged in or has no workspace id.`);var h=u[d];if(!s&&((e,o=Date.now())=>{if(!e?.token||!e?.expiresAt)return!1;var r=new Date(e.expiresAt).getTime();return Number.isFinite(r)&&r-o>a})(h,i))return h;if(String(d)!==String(w))throw Error(`Profile ${l} has no usable DevTools token for workspace ${d}.`);var v=yield c({client:o,ttlSeconds:t});if(!v?.token||!v?.expiresAt)throw Error("DevTools access token response was incomplete.");if(v.workspaceId&&String(v.workspaceId)!==String(d))throw Error("DevTools access token was issued for a different workspace.");var _={token:v.token,expiresAt:v.expiresAt,jti:v.jti,workspaceId:v.workspaceId||d};if(!(yield(0,n.setDevtoolsTokenIfProfileCurrentAsync)(l,k,d,_)))throw Error(`Profile ${l} changed while issuing the DevTools token. Retry.`);return _}),function(){return s.apply(this,arguments)})}};
package/lib/4456.js ADDED
@@ -0,0 +1,3 @@
1
+ export const __rspack_esm_id=4456;export const __rspack_esm_ids=[4456];export const __webpack_modules__={65650(e,t,r){e.exports=r(78942).Symbol},65111(e){e.exports=function(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}},44187(e){e.exports=function(e,t,r,i){var n=-1,o=null==e?0:e.length;for(i&&o&&(r=e[++n]);++n<o;)r=t(r,e[n],n,e);return r}},39546(e){var t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;e.exports=function(e){return e.match(t)||[]}},87379(e,t,r){var i=r(65650),n=r(8870),o=r(29005),u=i?i.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":u&&u in Object(e)?n(e):o(e)}},51035(e){e.exports=function(e){return function(t){return null==e?void 0:e[t]}}},52291(e,t,r){var i=r(65650),n=r(65111),o=r(53142),u=r(51187),a=1/0,l=i?i.prototype:void 0,c=l?l.toString:void 0;e.exports=function e(t){if("string"==typeof t)return t;if(o(t))return n(t,e)+"";if(u(t))return c?c.call(t):"";var r=t+"";return"0"==r&&1/t==-a?"-0":r}},93640(e,t,r){var i=r(44187),n=r(45881),o=r(39850),u=RegExp("['’]","g");e.exports=function(e){return function(t){return i(o(n(t).replace(u,"")),e,"")}}},69968(e,t,r){e.exports=r(51035)({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"})},74967(e){e.exports="object"==typeof global&&global&&global.Object===Object&&global},8870(e,t,r){var i=r(65650),n=Object.prototype,o=n.hasOwnProperty,u=n.toString,a=i?i.toStringTag:void 0;e.exports=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var i=!0}catch(e){}var n=u.call(e);return i&&(t?e[a]=r:delete e[a]),n}},15813(e){var t=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;e.exports=function(e){return t.test(e)}},29005(e){var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},78942(e,t,r){var i=r(74967),n="object"==typeof self&&self&&self.Object===Object&&self;e.exports=i||n||Function("return this")()},10482(e){var t="\\ud800-\\udfff",r="\\u2700-\\u27bf",i="a-z\\xdf-\\xf6\\xf8-\\xff",n="A-Z\\xc0-\\xd6\\xd8-\\xde",o="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",u="['’]",a="["+o+"]",l="["+i+"]",c="[^"+t+o+"\\d+"+r+i+n+"]",s="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",f="["+n+"]",p="(?:"+l+"|"+c+")",g="(?:"+f+"|"+c+")",y="(?:"+u+"(?:d|ll|m|re|s|t|ve))?",x="(?:"+u+"(?:D|LL|M|RE|S|T|VE))?",h="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",m="[\\ufe0e\\ufe0f]?",b="(?:\\u200d(?:"+["[^"+t+"]",s,d].join("|")+")"+m+h+")*",v="(?:"+["["+r+"]",s,d].join("|")+")"+(m+h+b),j=RegExp([f+"?"+l+"+"+y+"(?="+[a,f,"$"].join("|")+")",g+"+"+x+"(?="+[a,f+p,"$"].join("|")+")",f+"?"+p+"+"+y,f+"+"+x,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",v].join("|"),"g");e.exports=function(e){return e.match(j)||[]}},45881(e,t,r){var i=r(69968),n=r(95243),o=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,u=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");e.exports=function(e){return(e=n(e))&&e.replace(o,i).replace(u,"")}},53142(e){e.exports=Array.isArray},80547(e){e.exports=function(e){return null!=e&&"object"==typeof e}},51187(e,t,r){var i=r(87379),n=r(80547);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==i(e)}},10750(e,t,r){e.exports=r(93640)(function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})},95243(e,t,r){var i=r(52291);e.exports=function(e){return null==e?"":i(e)}},39850(e,t,r){var i=r(39546),n=r(15813),o=r(95243),u=r(10482);e.exports=function(e,t,r){return(e=o(e),void 0===(t=r?void 0:t))?n(e)?u(e):i(e):e.match(t)||[]}},58891(e,t,r){r.r(t),r.d(t,{initProject:()=>p});var i,n,o=r(99436),u=r(16928),a=r(73284),l=r(30155),c=r(27521),s=r(56493),d=r(77768),f=(i=o(function*(e,t){console.log(a.default.bold.cyan(`
2
+ Initialize BRICKS Project: ${t}
3
+ `));var r=yield(0,c.checkbox)({message:"Select files to include:",choices:[{name:"GitHub Actions workflow (.github/workflows/ci.yml)",value:"githubActions",checked:!1!==e.githubActions},{name:"AGENTS.md",value:"agents",checked:!1!==e.agents},{name:"CLAUDE.md",value:"claude",checked:!1!==e.claude},{name:"GEMINI.md",value:"gemini",checked:!0===e.gemini}]}),i=yield(0,c.checkbox)({message:"Select post-generation steps:",choices:[{name:"Run bun install",value:"install",checked:!1!==e.install},{name:"Initialize git repository",value:"git",checked:!1!==e.git}]}),n=e.output?u.resolve(e.output):u.join(process.cwd(),t),o=yield(0,c.input)({message:"Output directory:",default:n});return{githubActions:r.includes("githubActions"),agents:r.includes("agents"),claude:r.includes("claude"),gemini:r.includes("gemini"),install:i.includes("install"),git:i.includes("git"),output:o,outputAsTarget:!0}}),function(e,t){return i.apply(this,arguments)}),p=(n=o(function*(e,t,r){var i=(0,s.requireAuth)(),n=r.json,o=r.yes||n,c="application"===e?i.applicationProject:i.moduleProject,p=n?null:(0,l.default)(`Fetching ${e} info...`).start(),g="bricks-ctor";try{var y=yield c({id:t,buildApplicationOnly:!0});y?.files&&(g=(0,d.kU)(y.files)),p&&p.stop()}catch{p&&p.stop()}var x={...r};if(!o)try{var h=yield f(r,g);x={...r,...h}}catch{console.log(a.default.yellow("\nCancelled")),process.exit(0)}p=n?null:(0,l.default)(`Fetching ${e} project...`).start();var m=!!x.output;try{var b=yield(0,d.BZ)(e,t,{client:i,output:m?x.output:process.cwd(),outputAsTarget:m||!0===x.outputAsTarget,install:x.install,git:x.git,githubActions:x.githubActions,agents:x.agents,claude:x.claude,gemini:x.gemini});p&&p.succeed(`Project created: ${a.default.green(b.path)} (${b.files} files)`),n?console.log(JSON.stringify(b)):(console.log(""),console.log(a.default.bold.green("Project initialized successfully!")),console.log(""),console.log(a.default.bold("Next steps:")),console.log(a.default.gray(` cd ${u.basename(b.path)}`)),b.bunInstalled||console.log(a.default.gray(" bun install")),console.log(a.default.gray(" bun invoke-simulator")),console.log(""),console.log(a.default.gray(`For more information, see ${u.basename(b.path)}/README.md`)))}catch(t){n?console.error(JSON.stringify({error:t.message})):p?p.fail(`Failed to initialize ${e} project: ${t.message}`):console.error(a.default.red(`Failed to initialize ${e} project: ${t.message}`)),process.exit(1)}}),function(e,t,r){return n.apply(this,arguments)})},77768(e,t,r){r.d(t,{BZ:()=>b,KN:()=>x,kU:()=>y,o0:()=>m,oz:()=>h});var i,n,o,u,a=r(99436),l=r(16928),c=r(79896),s=r(35317),d=r(10750),f=e=>{try{return(0,s.execSync)(`which ${e}`,{stdio:"ignore"}),!0}catch{return!1}},p=(e,t,r)=>new Promise((i,n)=>{var o=[e,...t].join(" "),u=(0,s.spawn)(o,[],{cwd:r,stdio:"pipe",shell:!0}),a=[];u.stderr.on("data",e=>a.push(e)),u.on("close",e=>{0===e?i():n(Error(Buffer.concat(a).toString().trim()||`Command failed with code ${e}`))}),u.on("error",n)}),g=(i=a(function*(e,t){try{var i=(yield r.e(7456).then(r.bind(r,79491))).format;return(yield i(t,e,{trailingComma:"all",tabWidth:2,semi:!1,singleQuote:!0,printWidth:100})).code}catch{}return e}),function(e,t){return i.apply(this,arguments)}),y=(e=[])=>{var t=e.find(e=>"application.json"===e.name);if(!t)return"bricks-ctor";try{var r=JSON.parse(t.input);return d(r.name||"bricks-ctor")}catch{return"bricks-ctor"}},x=(n=a(function*(e,t){var r;return Promise.all(e.map((r=a(function*(e){var r=l.join(t,e.name),i=e.input;return e.formatable&&(i=yield g(i,r)),{...e,filePath:r,content:i}}),function(e){return r.apply(this,arguments)})))}),function(e,t){return n.apply(this,arguments)}),h=e=>{e.forEach(e=>{c.mkdirSync(l.dirname(e.filePath),{recursive:!0}),c.writeFileSync(e.filePath,e.content)})},m=(o=a(function*(e,t={}){var r="function"==typeof t.onStatus?t.onStatus:()=>{},i=!1,n=!1;if(!1!==t.install&&f("bun")){r("Installing dependencies (bun install)...");try{yield p("bun",["install"],e),i=!0}catch{}}if(!1!==t.git&&f("git")){r("Initializing git repository...");try{yield p("git",["init"],e),yield p("git",["add","."],e),yield p("git",["-c 'user.name=BRICKS CLI'","-c 'user.email=cli@bricks.tools'","commit","-m 'chore: initialize commit'"],e),n=!0}catch{}}return{bunInstalled:i,gitInitialized:n}}),function(e){return o.apply(this,arguments)}),b=(u=a(function*(e,t,r){var i=r.client,n=r.output,o=r.outputAsTarget;if(!i)throw Error("client is required");if(!n)throw Error("output directory is required");var u=(e=>{for(var t=l.resolve(e);;){if(c.existsSync(l.join(t,"application.json"))||c.existsSync(l.join(t,"module.json")))return t;var r=l.dirname(t);if(r===t)return null;t=r}})(o?l.dirname(l.resolve(n)):n);if(u)throw Error(`Cannot initialize a new BRICKS project inside an existing project (${u}). Choose a directory outside the project.`);var a="application"===e?i.applicationProject:i.moduleProject,s=yield a({id:t,buildApplicationOnly:!1,setupGitHubActions:!1!==r.githubActions,setupAgents:!1!==r.agents,setupClaudeCode:!1!==r.claude,setupGeminiCLI:!0===r.gemini});if(!s?.files)throw Error(`${e} project not found`);var d=y(s.files),f=o?l.resolve(n):l.resolve(n,d);if(c.existsSync(f))throw Error(`Directory already exists: ${f}`);c.mkdirSync(f,{recursive:!0}),h((yield x(s.files,f)));var p=yield m(f,r),g=p.bunInstalled,b=p.gitInitialized;return{success:!0,path:f,files:s.files.length,bunInstalled:g,gitInitialized:b}}),function(e,t,r){return u.apply(this,arguments)})}};