"use strict";exports.id=7029,exports.ids=[7029],exports.modules={"./src/commands/enable.ts"(e,r,s){s.r(r),s.d(r,{handleMcpEnable:()=>v});var n=s("node:os"),o=s("node:path"),t=s.n(o),i=s("../mcp-agent-exec/dist/index.js"),a=s("../../../../../../../../../../private/tmp/buildkite-job-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684/agent-cli-mac-macos-x64-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684.LshlV881/pnpm-virtual-store/chalk@5.6.2/node_modules/chalk/source/index.js"),c=s("./src/console-io.ts"),d=s("./src/mcp/disabled-store.ts"),l=s("./src/mcp/project-paths.ts");function p(e){const{text:r,isError:s}=function({identifier:e,wasEnabled:r,isNowEnabled:s,error:n}){return n?{text:a.Ay.red(`Failed to enable MCP server: ${n}`),isError:!0}:r?{text:a.Ay.yellow(`MCP server '${e}' is already enabled and approved`),isError:!1}:s?{text:a.Ay.green(`✓ Enabled and approved MCP server: ${e}`),isError:!1}:{text:a.Ay.red(`MCP server '${e}' not found in configuration`)+"\n"+a.Ay.dim("Check .cursor/mcp.json or ~/.cursor/mcp.json"),isError:!0}}(e);s?(0,c.p2)(r):(0,c.OT)(r)}function v(e,r){return s=this,o=void 0,c=function*(){var e;try{const e=process.cwd(),{projectRoot:s,approvalPath:o,disabledPath:a}=(0,l.C)(e),c=new i.mF(o,s),v=new d.P(a),u=t().join((0,n.homedir)(),".cursor","mcp.json"),m=t().join(s,".cursor","mcp.json"),[f,b]=yield Promise.all([(0,i.h1)(u).catch((()=>({mcpServers:{}}))),(0,i.h1)(m).catch((()=>({mcpServers:{}})))]),h=Object.assign(Object.assign({},f.mcpServers),b.mcpServers)[r];h||(p({identifier:r,wasEnabled:!1,isNowEnabled:!1}),process.exit(1));const x=r in b.mcpServers,y=yield v.isServerDisabled(r);let w;if(x){const e=(0,i.Ko)(r,h,s),n=(yield c.getApprovals()).includes(e);w=!y&&n,n||(yield c.addApproval(e))}else w=!y;y&&(yield v.removeDisabledServer(r)),p({identifier:r,wasEnabled:w,isNowEnabled:!0}),process.exit(0)}catch(s){const n=null!==(e=null==s?void 0:s.message)&&void 0!==e?e:String(s);p({identifier:r,wasEnabled:!1,isNowEnabled:!1,error:n}),process.exit(1)}},new((a=void 0)||(a=Promise))((function(e,r){function n(e){try{i(c.next(e))}catch(e){r(e)}}function t(e){try{i(c.throw(e))}catch(e){r(e)}}function i(r){var s;r.done?e(r.value):(s=r.value,s instanceof a?s:new a((function(e){e(s)}))).then(n,t)}i((c=c.apply(s,o||[])).next())}));var s,o,a,c}}};