@fugood/bricks-cli 2.25.0-beta.79 → 2.25.0-beta.80

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/lib/2486.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=2486;export const __rspack_esm_ids=[2486];export const __webpack_modules__={421(e,r,a){a.r(r),a.d(r,{buildDoctorReport:()=>h,renderDoctorReport:()=>v});var i,o,t=a(99436),s=a(85382),n=a(31802),c=a(8479),l=a(7586),p=a(47988),u=(i=t(function*(){try{return yield Promise.all([a.e(9866),a.e(6645),a.e(4479),a.e(7648),a.e(853),a.e(1010),a.e(7233)]).then(a.bind(a,63288)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),k=(e,r,a)=>({severity:e,code:r,message:a}),h=(o=t(function*({version:e="2.25.0-beta.79",mcpCheck:r=u}={}){var a=(0,p.getCurrentProfile)(),i=(0,p.getCurrentProfileSource)(),o=(0,n.getConnectionContext)(a),t=o.tokenInfo,h=o.auth,d=o.baseUrl,v=o.activityLogBaseUrl,m=[],w={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:p.CONFIG_PATH,baseUrl:d,activityLogBaseUrl:v},auth:{available:!!h,source:h?"config":"missing",kind:h?.kind||null,workspaceId:t?.workspaceId||null,workspaceName:t?.workspaceName||null,createdAt:t?.createdAt||null,tokenPreview:h?.kind==="token"?(0,l.$l)(h.token):null},connectivity:{workspace:{ok:!1,skipped:!h,error:null}},capabilities:{zeroArgMode:(0,c.isInteractiveTerminal)()?"interactive":"help",mcp:{available:!1,error:null}},issues:m};if(h)try{var b=yield(0,s.createClient)(d,h).workspace();w.connectivity.workspace={ok:!0,skipped:!1,error:null,id:b?._id||t.workspaceId||null,name:b?.name||t.workspaceName||null},w.auth.workspaceId=b?._id||w.auth.workspaceId,w.auth.workspaceName=b?.name||w.auth.workspaceName}catch(e){w.connectivity.workspace={ok:!1,skipped:!1,error:e.message},m.push(k("error","workspace_unreachable",`Workspace query failed for ${d}: ${e.message}`))}else m.push(k("warning","auth_missing","No usable credential for the current profile."));var f=yield r();return w.capabilities.mcp={available:f.available,error:f.error||null},f.available||m.push(k("warning","mcp_unavailable",`MCP stdio server is unavailable: ${f.error||"Unknown error"}`)),w.ok=0===m.length,w}),function(){return o.apply(this,arguments)}),d=(e,r,a)=>`${e.padEnd(14)} ${r}${a?` ${a}`:""}`,v=e=>{var r=[];if(r.push("BRICKS CLI Doctor"),r.push("─".repeat(60)),r.push(d("CLI","OK",`bricks v${e.cli.version}`)),r.push(d("Profile","OK",`${e.profile.name} (${e.profile.source})`)),r.push(d("BRICKS API","OK",e.config.baseUrl)),r.push(d("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace",i=[e.auth.source,e.auth.kind,e.auth.tokenPreview].filter(Boolean).join(", ");r.push(d("Auth","OK",i?`${a} (${i})`:a))}else r.push(d("Auth","WARN","No usable credential for the current profile"));if(e.connectivity.workspace.skipped)r.push(d("Workspace","WARN","Skipped because no credential is available"));else if(e.connectivity.workspace.ok){var o=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";r.push(d("Workspace","OK",o))}else r.push(d("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?r.push(d("MCP","OK","STDIO server import is available")):r.push(d("MCP","WARN",e.capabilities.mcp.error)),r.push(d("Zero-arg mode",((e,r=!1)=>e?"OK":r?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(r.push("─".repeat(60)),r.push("Issues"),e.issues.forEach(e=>{r.push(`- [${e.severity}] ${e.message}`)})),r.join("\n")}}};
1
+ export const __rspack_esm_id=2486;export const __rspack_esm_ids=[2486];export const __webpack_modules__={421(e,r,a){a.r(r),a.d(r,{buildDoctorReport:()=>h,renderDoctorReport:()=>v});var i,o,t=a(99436),s=a(85382),n=a(31802),c=a(8479),l=a(7586),p=a(47988),u=(i=t(function*(){try{return yield Promise.all([a.e(9866),a.e(6645),a.e(4479),a.e(7648),a.e(853),a.e(1010),a.e(7233)]).then(a.bind(a,63288)),{available:!0}}catch(e){return{available:!1,error:e.message}}}),function(){return i.apply(this,arguments)}),k=(e,r,a)=>({severity:e,code:r,message:a}),h=(o=t(function*({version:e="2.25.0-beta.80",mcpCheck:r=u}={}){var a=(0,p.getCurrentProfile)(),i=(0,p.getCurrentProfileSource)(),o=(0,n.getConnectionContext)(a),t=o.tokenInfo,h=o.auth,d=o.baseUrl,v=o.activityLogBaseUrl,m=[],w={ok:!1,timestamp:new Date().toISOString(),cli:{name:"bricks",version:e},profile:{name:a,source:i},config:{path:p.CONFIG_PATH,baseUrl:d,activityLogBaseUrl:v},auth:{available:!!h,source:h?"config":"missing",kind:h?.kind||null,workspaceId:t?.workspaceId||null,workspaceName:t?.workspaceName||null,createdAt:t?.createdAt||null,tokenPreview:h?.kind==="token"?(0,l.$l)(h.token):null},connectivity:{workspace:{ok:!1,skipped:!h,error:null}},capabilities:{zeroArgMode:(0,c.isInteractiveTerminal)()?"interactive":"help",mcp:{available:!1,error:null}},issues:m};if(h)try{var b=yield(0,s.createClient)(d,h).workspace();w.connectivity.workspace={ok:!0,skipped:!1,error:null,id:b?._id||t.workspaceId||null,name:b?.name||t.workspaceName||null},w.auth.workspaceId=b?._id||w.auth.workspaceId,w.auth.workspaceName=b?.name||w.auth.workspaceName}catch(e){w.connectivity.workspace={ok:!1,skipped:!1,error:e.message},m.push(k("error","workspace_unreachable",`Workspace query failed for ${d}: ${e.message}`))}else m.push(k("warning","auth_missing","No usable credential for the current profile."));var f=yield r();return w.capabilities.mcp={available:f.available,error:f.error||null},f.available||m.push(k("warning","mcp_unavailable",`MCP stdio server is unavailable: ${f.error||"Unknown error"}`)),w.ok=0===m.length,w}),function(){return o.apply(this,arguments)}),d=(e,r,a)=>`${e.padEnd(14)} ${r}${a?` ${a}`:""}`,v=e=>{var r=[];if(r.push("BRICKS CLI Doctor"),r.push("─".repeat(60)),r.push(d("CLI","OK",`bricks v${e.cli.version}`)),r.push(d("Profile","OK",`${e.profile.name} (${e.profile.source})`)),r.push(d("BRICKS API","OK",e.config.baseUrl)),r.push(d("Activity Log","OK",e.config.activityLogBaseUrl)),e.auth.available){var a=e.auth.workspaceName||e.auth.workspaceId||"Unknown workspace",i=[e.auth.source,e.auth.kind,e.auth.tokenPreview].filter(Boolean).join(", ");r.push(d("Auth","OK",i?`${a} (${i})`:a))}else r.push(d("Auth","WARN","No usable credential for the current profile"));if(e.connectivity.workspace.skipped)r.push(d("Workspace","WARN","Skipped because no credential is available"));else if(e.connectivity.workspace.ok){var o=e.connectivity.workspace.name||e.connectivity.workspace.id||"Unknown workspace";r.push(d("Workspace","OK",o))}else r.push(d("Workspace","FAIL",e.connectivity.workspace.error));return e.capabilities.mcp.available?r.push(d("MCP","OK","STDIO server import is available")):r.push(d("MCP","WARN",e.capabilities.mcp.error)),r.push(d("Zero-arg mode",((e,r=!1)=>e?"OK":r?"WARN":"FAIL")("interactive"===e.capabilities.zeroArgMode,"help"===e.capabilities.zeroArgMode),"interactive"===e.capabilities.zeroArgMode?"Starts Ink interactive mode on TTY":"Shows help outside TTY contexts")),e.issues.length>0&&(r.push("─".repeat(60)),r.push("Issues"),e.issues.forEach(e=>{r.push(`- [${e.severity}] ${e.message}`)})),r.join("\n")}}};
package/lib/3976.js CHANGED
@@ -2,11 +2,11 @@ export const __rspack_esm_id=3976;export const __rspack_esm_ids=[3976];export co
2
2
  # MCP entry-editing audit log
3
3
  ${l}
4
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),H=r(3540),q=e([N]);function K(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=function(){return!!e})()}N=(q.then?(await q)():q)[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,H.S)();try{var o=yield i();return yield(0,H.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,H.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(/export\s+(async\s+)?function\s+main\s*\(/.test(t)){var r=t.endsWith("\n")?t:`${t}
6
- `;if(!eg(r))throw new W("invalid_code","Sandbox code does not parse as a module (note: top-level await requires export async function main)");return r}var i=t.trim();if(!i)return"export function main() {\n}\n";for(var a of["","async "]){var n=`export ${a}function main() {
7
- ${i}
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
8
  }
9
- `;if(eg(n))return n}throw new W("invalid_code","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}
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
10
 
11
11
  export const dataCalculation = [
12
12
  ${a}
package/lib/6818.js CHANGED
@@ -1 +1 @@
1
- export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.79")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};
1
+ export const __rspack_esm_id=6818;export const __rspack_esm_ids=[6818];export const __webpack_modules__={53241(e,t,r){r.r(t),r.d(t,{detectChannel:()=>i,detectInstallMethod:()=>o});var a=r(73024),n=r(76760),s=r(48161),l=e=>{if(!e)return e;try{return a.realpathSync(e)}catch{return e}},i=({version:e,execPath:t}={})=>{var r=t||process.execPath;return r&&/[\\/]bricks-beta(?:\.exe)?$/i.test(r)||/-(beta|alpha|rc|next)\b/i.test(e||"2.25.0-beta.80")?"beta":"release"},o=({execPath:e=process.execPath,scriptPath:t=process.argv[1],homeDir:r=s.homedir(),realpath:a=l}={})=>{let i;var o=(i=e)?n.basename(i).replace(/\.exe$/i,""):"";if("bricks"===o||"bricks-beta"===o)return{method:"binary",execPath:e,installDir:n.dirname(e)};var c=a(t),p=((e,t)=>{if(!e)return null;var r=n.sep,a=`${r}node_modules${r}${t.replace(/\//g,r)}${r}`,s=e.indexOf(a);return -1===s?null:e.slice(0,s)})(c,"@fugood/bricks-cli");if(p){var b=n.sep,d=n.join(r,".bun","install","global");return p===d||p.startsWith(d+b)?{method:"bun",installRoot:p}:/[\\/](?:\.pnpm|pnpm[\\/]global)[\\/]/.test(p)?{method:"pnpm",installRoot:p}:/[\\/](?:\.yarn|yarn[\\/]global)[\\/]/.test(p)?{method:"yarn",installRoot:p}:{method:"npm",installRoot:p.endsWith(`${b}lib`)?p.slice(0,-`${b}lib`.length):p}}return{method:"unknown",execPath:e,scriptPath:c}}}};