@lovrabet/cli 1.2.5-beta.4 → 1.2.5-beta.5
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/add-page/input-page-router.js +1 -1
- package/lib/add-page/main.js +1 -1
- package/lib/add-page/select-page-template.js +1 -1
- package/lib/ai-setup/AISetupUI.js +1 -1
- package/lib/ai-setup/config.js +1 -1
- package/lib/api/api-doc-ui.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-pull-ui.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/main.js +1 -1
- package/lib/api/pull-silent.js +1 -1
- package/lib/app-menu/app-menu-sync-ui.js +1 -1
- package/lib/app-menu/create-menu.js +1 -1
- package/lib/app-menu/get-local-pages.js +1 -1
- package/lib/app-menu/get-online-menu-list.js +1 -1
- package/lib/app-menu/use-get-online-menu-list.js +1 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-update-cdn/current-content.js +1 -1
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
- package/lib/app-menu-update-cdn/main.js +1 -1
- package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cmd/build-watch.js +1 -1
- package/lib/cmd/build.js +1 -1
- package/lib/cmd/logs.js +1 -1
- package/lib/cmd/preview.js +1 -1
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/McpInstallUI.js +1 -1
- package/lib/mcp/claude.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/skills/SkillInstallUI.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/router-updater.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +1 -1
package/lib/create-app/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a43_0x2754f5=a43_0x5158;function a43_0x33ac(){const _0x2ada43=['开始创建项目:\x20','71695tpvurI','aiSetup','Claude\x20Code','.lovrabetrc','lovrabet\x20api\x20pull\x20--appcode\x20[app-code]','1.\x20配置\x20Lovrabet\x20MCP\x20和\x20Skill','\x20配置应用AppCode:\x20','√\x20API\x20配置拉取完成','manual','2.\x20','!\x20API\x20配置拉取异常,项目已创建,可稍后手动执行:\x20lovrabet\x20api\x20pull','../..','repeat','test','1.0.0','5882XCqxUO','claude','version','×\x20项目名过长,最多支持\x20100\x20个字符','filter','yellow','status','skill','项目名称:\x20','API\x20配置拉取失败:\x20','拉取API配置:\x20','280643txTjSh','\x20\x20✗\x20MCP\x20','dirname','length','配置应用AppCode:\x20','trim','accessSync','5887084fcuUqj','100uRQnnz','message','existsSync','ide','warn','log','info','create','\x20√\x20','constants','\x20\x20•\x20Skill:\x20','error','\x20创建配置文件','appCode','✓\x20MCP\x20服务器配置完成:','gray','×\x20项目目录\x20','env','3.\x20','*\x20正在为项目\x20','utf8','42075clZaIm','mcp','\x20|\x20应用AppCode:\x20','mcp-','清理项目目录失败:\x20','toLocaleString','cursor','projectCode','white','cwd','741XZEZTN','description','\x20\x20•\x20MCP\x20服务器:\x20','5577300dKfKtt','cyan','cd\x20','lovrabet\x20skill\x20install','lovrabet\x20mcp\x20install','stringify','map','join','启动项目:\x20','doTask','API\x20配置拉取异常','success','parse','name','93256eFoNof','selectedIDEs','push','lovrabet\x20api\x20pull','项目创建完成:\x20','W_OK','√\x20package.json\x20已更新:\x20name=','\x20Generated\x20by\x20lovrabet\x20cli\x20','online','🚀\x20接下来:','\x20\x20✗\x20Skill\x20','!\x20API\x20配置拉取失败,可稍后手动执行:\x20lovrabet\x20api\x20pull','711GRphdr','package.json','readFileSync','projectName','590zkwrKn','*\x20正在配置\x20Lovrabet\x20MCP\x20和\x20Skill...','√\x20配置文件已创建,应用AppCode:\x20','column','√\x20配置文件已创建,可稍后使用\x20\x27lovrabet\x20config\x20set\x20appcode\x20<app-code>\x27\x20配置','API\x20配置拉取成功:\x20','配置AppCode:\x20','red','pullApi','Cursor','green','resolve','\x20Skill\x20','\x20&&\x20lovrabet\x20start','writeFileSync'];a43_0x33ac=function(){return _0x2ada43;};return a43_0x33ac();}(function(_0x3a0798,_0x22aac6){const _0x31b342=a43_0x5158,_0x2f885e=_0x3a0798();while(!![]){try{const _0x54bfdf=parseInt(_0x31b342(0x1e4))/0x1+-parseInt(_0x31b342(0x22e))/0x2*(-parseInt(_0x31b342(0x1ee))/0x3)+-parseInt(_0x31b342(0x241))/0x4*(-parseInt(_0x31b342(0x21f))/0x5)+parseInt(_0x31b342(0x1f1))/0x6+-parseInt(_0x31b342(0x240))/0x7+parseInt(_0x31b342(0x1ff))/0x8*(parseInt(_0x31b342(0x20b))/0x9)+parseInt(_0x31b342(0x20f))/0xa*(-parseInt(_0x31b342(0x239))/0xb);if(_0x54bfdf===_0x22aac6)break;else _0x2f885e['push'](_0x2f885e['shift']());}catch(_0x5e6bbe){_0x2f885e['push'](_0x2f885e['shift']());}}}(a43_0x33ac,0x9a16f));import{jsx as a43_0xbc8784,Fragment as a43_0x4fb693,jsxs as a43_0x558d49}from'react/jsx-runtime';import a43_0x3424e0 from'path';import a43_0x25e17f from'fs';import{fileURLToPath}from'node:url';import{Box,Text}from'ink';import{useEffect,useState}from'react';import{EnhancedGuidedCreate}from'./enhanced-guided-create.js';import{pullApiSilent}from'../api/pull-silent.js';import{readConfig}from'../utils/config.js';import{useCopyProjectTemplate}from'./use-copy-project-template.js';function a43_0x5158(_0x3234b3,_0x5574fe){_0x3234b3=_0x3234b3-0x1db;const _0x33acd3=a43_0x33ac();let _0x515825=_0x33acd3[_0x3234b3];return _0x515825;}import{useInstallDependencies}from'./use-install-dependencies.js';import{useFormatCode}from'./use-format-code.js';import{TaskFinished}from'./task-finished.js';import{TaskRunning}from'./task-running.js';import{logger}from'../utils/logger.js';import{configureMcp,copySharedSkills,installSkill,createSkillManifest}from'../ai-setup/config.js';const MCP_IDES=new Set([a43_0x2754f5(0x1ea),a43_0x2754f5(0x22f)]);export function CreateApp(_0xe2f9){const _0x234667=a43_0x2754f5,[_0x563e8a,_0x24ec72]=useState(![]),[_0x246388,_0xf707ee]=useState(![]),[_0x350165,_0x1c5578]=useState(null),[_0x13304a,_0x4c1cd5]=useState(null),_0x57893d=useCopyProjectTemplate(),_0x2ebfc0=useInstallDependencies(),_0x513dc3=useFormatCode(),_0x4e7edb=async _0x573b20=>{const _0x555cff=a43_0x5158;if(!_0x573b20['projectName']||_0x573b20[_0x555cff(0x20e)][_0x555cff(0x23e)]()===''){console[_0x555cff(0x24c)]('×\x20项目名不能为空');return;}const _0x564154=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x564154[_0x555cff(0x22c)](_0x573b20[_0x555cff(0x20e)])){console[_0x555cff(0x24c)]('×\x20项目名包含非法字符,不允许使用:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20及控制字符');return;}if(_0x573b20['projectName'][_0x555cff(0x23c)]>0x64){console[_0x555cff(0x24c)](_0x555cff(0x231));return;}const _0xe107bd=a43_0x3424e0[_0x555cff(0x21a)](process[_0x555cff(0x1ed)](),_0x573b20[_0x555cff(0x20e)]);if(a43_0x25e17f[_0x555cff(0x243)](_0xe107bd)){console['error'](_0x555cff(0x1df)+_0x573b20['projectName']+'\x20已存在,请使用其他项目名');return;}try{const _0x2fd902=a43_0x3424e0[_0x555cff(0x23b)](_0xe107bd);a43_0x25e17f[_0x555cff(0x23f)](_0x2fd902,a43_0x25e17f[_0x555cff(0x24a)][_0x555cff(0x204)]);}catch(_0xc7bbb6){console[_0x555cff(0x24c)]('×\x20无法在当前目录创建项目,请检查目录权限');return;}_0x1c5578(_0x573b20),_0x24ec72(!![]),logger['setLogPath'](_0xe107bd),logger[_0x555cff(0x247)]('create',_0x555cff(0x21e)+_0x573b20[_0x555cff(0x20e)],{'projectDir':_0xe107bd,'appCode':_0x573b20[_0x555cff(0x1dc)]});try{await _0x57893d[_0x555cff(0x1fa)](_0x573b20[_0x555cff(0x20e)]),await _0xc7999e(_0x573b20['projectName']),await _0x2ebfc0['doTask'](_0x573b20[_0x555cff(0x20e)]),await _0x513dc3['doTask'](_0x573b20[_0x555cff(0x20e)]),await _0x22c23e(_0x573b20['projectName'],_0x573b20[_0x555cff(0x1dc)]||'',_0x573b20[_0x555cff(0x1e0)]);if(_0x573b20['pullApi']&&_0x573b20['appCode']){console['log']('*\x20正在拉取\x20API\x20配置...');try{const _0x2ef475=await pullApiSilent(_0x573b20['appCode'],undefined,_0xe107bd,_0x573b20[_0x555cff(0x1e0)]);_0x2ef475?(console[_0x555cff(0x246)](_0x555cff(0x226)),logger['info'](_0x555cff(0x248),_0x555cff(0x214)+_0x573b20[_0x555cff(0x1dc)])):(console[_0x555cff(0x246)](_0x555cff(0x20a)),logger[_0x555cff(0x245)]('create',_0x555cff(0x237)+_0x573b20[_0x555cff(0x1dc)]));}catch(_0xce9afc){console[_0x555cff(0x246)](_0x555cff(0x229)),logger['warn'](_0x555cff(0x248),_0x555cff(0x1fb),{'error':_0xce9afc instanceof Error?_0xce9afc[_0x555cff(0x242)]:String(_0xce9afc)});}}if(_0x573b20[_0x555cff(0x220)]&&_0x573b20[_0x555cff(0x200)]&&_0x573b20[_0x555cff(0x200)][_0x555cff(0x23c)]>0x0&&_0x573b20[_0x555cff(0x1dc)]){console['log'](_0x555cff(0x210));const _0xa9b46c=[],_0x2bd1d8=[],_0x116eda=_0x573b20[_0x555cff(0x200)][_0x555cff(0x232)](_0x210f8a=>MCP_IDES['has'](_0x210f8a)),_0x2214ee=_0x573b20[_0x555cff(0x200)];for(const _0x3b0bbb of _0x116eda){try{const _0x878751=await configureMcp(_0x3b0bbb,_0xe107bd);_0xa9b46c[_0x555cff(0x201)]({'ide':_0x3b0bbb===_0x555cff(0x1ea)?_0x555cff(0x218):_0x555cff(0x221),'status':_0x878751[_0x555cff(0x234)],'message':_0x878751['message']}),console[_0x555cff(0x246)]('\x20\x20'+(_0x878751['status']===_0x555cff(0x1fc)?'✓':_0x878751[_0x555cff(0x234)]===_0x555cff(0x227)?'⚠️':'✗')+'\x20MCP\x20'+_0x3b0bbb+':\x20'+_0x878751[_0x555cff(0x242)]);}catch(_0x3ec0ec){_0xa9b46c['push']({'ide':_0x3b0bbb==='cursor'?_0x555cff(0x218):_0x555cff(0x221),'status':'error','message':_0x3ec0ec instanceof Error?_0x3ec0ec[_0x555cff(0x242)]:String(_0x3ec0ec)}),console[_0x555cff(0x246)](_0x555cff(0x23a)+_0x3b0bbb+':\x20'+(_0x3ec0ec instanceof Error?_0x3ec0ec[_0x555cff(0x242)]:String(_0x3ec0ec)));}}await copySharedSkills(_0xe107bd);for(const _0x373a6f of _0x2214ee){try{const _0x38ef11=await installSkill(_0x373a6f,_0xe107bd);_0x2bd1d8[_0x555cff(0x201)]({'ide':_0x38ef11[_0x555cff(0x244)],'status':_0x38ef11[_0x555cff(0x234)],'message':_0x38ef11[_0x555cff(0x242)]}),console[_0x555cff(0x246)]('\x20\x20'+(_0x38ef11[_0x555cff(0x234)]===_0x555cff(0x1fc)?'✓':'✗')+_0x555cff(0x21b)+_0x38ef11[_0x555cff(0x244)]+':\x20'+_0x38ef11[_0x555cff(0x242)]);}catch(_0x5c822a){_0x2bd1d8[_0x555cff(0x201)]({'ide':_0x373a6f,'status':_0x555cff(0x24c),'message':_0x5c822a instanceof Error?_0x5c822a[_0x555cff(0x242)]:String(_0x5c822a)}),console['log'](_0x555cff(0x209)+_0x373a6f+':\x20'+(_0x5c822a instanceof Error?_0x5c822a['message']:String(_0x5c822a)));}}if(_0x2bd1d8[_0x555cff(0x23c)]>0x0){const _0x514334=_0x2bd1d8[_0x555cff(0x232)](_0x4536e0=>_0x4536e0[_0x555cff(0x234)]===_0x555cff(0x1fc))[_0x555cff(0x1f7)](_0x3db71f=>_0x3db71f[_0x555cff(0x244)]);_0x514334[_0x555cff(0x23c)]>0x0&&createSkillManifest(_0xe107bd,_0x514334);}_0x4c1cd5({'mcp':_0xa9b46c,'skill':_0x2bd1d8}),console[_0x555cff(0x246)]('√\x20Lovrabet\x20MCP\x20和\x20Skill\x20配置完成');}logger[_0x555cff(0x1fc)](_0x555cff(0x248),_0x555cff(0x203)+_0x573b20[_0x555cff(0x20e)]),_0xf707ee(!![]),_0x24ec72(![]);}catch(_0xc3fe7f){logger[_0x555cff(0x24c)](_0x555cff(0x248),'项目创建失败:\x20'+_0x573b20[_0x555cff(0x20e)],{'error':_0xc3fe7f instanceof Error?_0xc3fe7f[_0x555cff(0x242)]:String(_0xc3fe7f)});try{a43_0x25e17f[_0x555cff(0x243)](_0xe107bd)&&(console['log']('*\x20清理失败的项目目录:\x20'+_0xe107bd),a43_0x25e17f['rmSync'](_0xe107bd,{'recursive':!![],'force':!![]}));}catch(_0x16b7e8){logger[_0x555cff(0x245)](_0x555cff(0x248),_0x555cff(0x1e8)+_0xe107bd);}_0x24ec72(![]),console[_0x555cff(0x24c)]('×\x20项目创建失败:\x20'+(_0xc3fe7f instanceof Error?_0xc3fe7f['message']:String(_0xc3fe7f)));}},_0x3a114b=async _0x451115=>{const _0x4b21b7=a43_0x5158;await _0x4e7edb({'projectName':_0x451115,'env':_0xe2f9[_0x4b21b7(0x1e0)]});},_0xc7999e=async _0x350132=>{const _0x1062f6=a43_0x5158,_0x4e6463=a43_0x3424e0[_0x1062f6(0x21a)](process[_0x1062f6(0x1ed)](),_0x350132),_0x29df97=a43_0x3424e0[_0x1062f6(0x1f8)](_0x4e6463,_0x1062f6(0x20c));try{console[_0x1062f6(0x246)]('*\x20正在更新\x20package.json\x20的\x20name\x20和\x20description\x20字段');const _0x2f53b1=fileURLToPath(import.meta.url),_0xe7f63e=a43_0x3424e0[_0x1062f6(0x21a)](a43_0x3424e0['dirname'](_0x2f53b1),_0x1062f6(0x22a)),_0x35939d=a43_0x3424e0['join'](_0xe7f63e,_0x1062f6(0x20c));let _0xcb18aa=_0x1062f6(0x22d);try{const _0x2c5a3c=JSON[_0x1062f6(0x1fd)](a43_0x25e17f[_0x1062f6(0x20d)](_0x35939d,'utf8'));_0xcb18aa=_0x2c5a3c[_0x1062f6(0x230)]||'1.0.0';}catch(_0x1c973d){}const _0x246253=a43_0x25e17f[_0x1062f6(0x20d)](_0x29df97,_0x1062f6(0x1e3)),_0x5d2223=JSON[_0x1062f6(0x1fd)](_0x246253);_0x5d2223[_0x1062f6(0x1fe)]=_0x350132,_0x5d2223[_0x1062f6(0x1ef)]=_0x350132+_0x1062f6(0x206)+_0xcb18aa,a43_0x25e17f[_0x1062f6(0x21d)](_0x29df97,JSON[_0x1062f6(0x1f6)](_0x5d2223,null,0x2)+'\x0a',_0x1062f6(0x1e3)),console['log'](_0x1062f6(0x205)+_0x350132),logger[_0x1062f6(0x247)](_0x1062f6(0x248),'更新\x20package.json\x20name');}catch(_0x52ec4b){logger[_0x1062f6(0x24c)](_0x1062f6(0x248),'更新\x20package.json\x20失败');throw _0x52ec4b;}},_0x22c23e=async(_0xea41c7,_0x408112,_0x264ed9)=>{const _0x20b7ea=a43_0x5158,_0x309484=a43_0x3424e0[_0x20b7ea(0x21a)](process['cwd'](),_0xea41c7),_0x33d7fb=a43_0x3424e0['join'](_0x309484,_0x20b7ea(0x222));try{_0x408112?console[_0x20b7ea(0x246)](_0x20b7ea(0x1e2)+_0xea41c7+_0x20b7ea(0x225)+_0x408112):console['log']('*\x20正在为项目\x20'+_0xea41c7+_0x20b7ea(0x1db));const _0x5ed6e7=fileURLToPath(import.meta.url),_0x292465=a43_0x3424e0['resolve'](a43_0x3424e0[_0x20b7ea(0x23b)](_0x5ed6e7),_0x20b7ea(0x22a)),_0x301279=a43_0x3424e0[_0x20b7ea(0x1f8)](_0x292465,_0x20b7ea(0x20c));let _0x37bfcf=_0x20b7ea(0x22d);try{const _0x2629ec=JSON[_0x20b7ea(0x1fd)](a43_0x25e17f['readFileSync'](_0x301279,_0x20b7ea(0x1e3)));_0x37bfcf=_0x2629ec['version']||'1.0.0';}catch(_0x85dc3e){}const _0x4e107e=readConfig(),_0x171f27=typeof _0x4e107e[_0x20b7ea(0x1e0)]==='string'?_0x4e107e[_0x20b7ea(0x1e0)]:undefined,{app:_0x4b0ebc,appcode:_0x2fa254,..._0x300d89}=_0x4e107e,_0x5ba3cf={..._0x300d89,'appcode':_0x408112||'','env':_0x264ed9||_0x171f27||_0x20b7ea(0x207),'createdAt':new Date()[_0x20b7ea(0x1e9)](),'version':_0x37bfcf};a43_0x25e17f[_0x20b7ea(0x21d)](_0x33d7fb,JSON[_0x20b7ea(0x1f6)](_0x5ba3cf,null,0x2),_0x20b7ea(0x1e3)),_0x408112?console[_0x20b7ea(0x246)](_0x20b7ea(0x211)+_0x408112):console[_0x20b7ea(0x246)](_0x20b7ea(0x213)),logger[_0x20b7ea(0x247)](_0x20b7ea(0x248),_0x20b7ea(0x23d)+_0x408112);}catch(_0x1bd00c){logger[_0x20b7ea(0x24c)]('create','配置应用AppCode失败');}};useEffect(()=>{const _0x7bbc5f=a43_0x5158;_0xe2f9[_0x7bbc5f(0x1eb)]&&_0x3a114b(_0xe2f9['projectCode']);},[_0xe2f9[_0x234667(0x1eb)]]);if(!_0x563e8a&&!_0x246388&&!_0xe2f9[_0x234667(0x1eb)])return a43_0xbc8784(EnhancedGuidedCreate,{'onCreate':_0x4e7edb,'env':_0xe2f9[_0x234667(0x1e0)]});if(_0x563e8a)return a43_0x558d49(a43_0x4fb693,{'children':[a43_0x558d49(Box,{'marginTop':0x1,'children':[a43_0xbc8784(Box,{'width':'1'}),a43_0xbc8784(Text,{'color':_0x234667(0x219),'children':'\x20√\x20'}),a43_0xbc8784(Text,{'children':'项目名称:\x20'}),a43_0xbc8784(Text,{'color':_0x234667(0x219),'children':_0x350165?.[_0x234667(0x20e)]}),_0x350165?.['appCode']&&a43_0x558d49(a43_0x4fb693,{'children':[a43_0xbc8784(Text,{'children':_0x234667(0x1e6)}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'children':_0x350165[_0x234667(0x1dc)]})]})]}),a43_0xbc8784(TaskRunning,{..._0x57893d}),a43_0xbc8784(TaskRunning,{..._0x2ebfc0}),a43_0xbc8784(TaskRunning,{..._0x513dc3})]});if(_0x246388){const _0x43c494=_0x13304a&&(_0x13304a[_0x234667(0x1e5)][_0x234667(0x23c)]>0x0||_0x13304a[_0x234667(0x235)]['length']>0x0);return a43_0x558d49(a43_0x4fb693,{'children':[a43_0x558d49(Box,{'marginTop':0x1,'children':[a43_0xbc8784(Box,{'width':'1'}),a43_0xbc8784(Text,{'color':'green','children':_0x234667(0x249)}),a43_0xbc8784(Text,{'children':_0x234667(0x236)}),a43_0xbc8784(Text,{'color':_0x234667(0x219),'children':_0x350165?.[_0x234667(0x20e)]}),_0x350165?.[_0x234667(0x1dc)]&&a43_0x558d49(a43_0x4fb693,{'children':[a43_0xbc8784(Text,{'children':_0x234667(0x1e6)}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'children':_0x350165[_0x234667(0x1dc)]})]})]}),a43_0xbc8784(TaskFinished,{..._0x57893d}),a43_0xbc8784(TaskFinished,{..._0x2ebfc0}),a43_0xbc8784(TaskFinished,{..._0x513dc3}),a43_0xbc8784(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a43_0xbc8784(Text,{'color':_0x234667(0x219),'children':'─'['repeat'](0x3c)})}),_0x43c494&&a43_0x558d49(a43_0x4fb693,{'children':[_0x13304a['mcp']['length']>0x0&&a43_0x558d49(a43_0x4fb693,{'children':[a43_0xbc8784(Box,{'marginTop':0x1,'children':a43_0xbc8784(Text,{'color':_0x234667(0x219),'bold':!![],'children':_0x234667(0x1dd)})}),_0x13304a[_0x234667(0x1e5)][_0x234667(0x1f7)]((_0x72cf70,_0x19515b)=>a43_0xbc8784(Box,{'marginLeft':0x2,'children':a43_0x558d49(Text,{'color':_0x72cf70[_0x234667(0x234)]===_0x234667(0x1fc)?_0x234667(0x1ec):_0x72cf70[_0x234667(0x234)]===_0x234667(0x227)?_0x234667(0x233):_0x234667(0x216),'children':[_0x72cf70['ide'],':\x20',_0x72cf70[_0x234667(0x242)]]})},_0x234667(0x1e7)+_0x19515b))]}),_0x13304a[_0x234667(0x235)][_0x234667(0x23c)]>0x0&&a43_0x558d49(a43_0x4fb693,{'children':[a43_0xbc8784(Box,{'marginTop':_0x13304a[_0x234667(0x1e5)][_0x234667(0x23c)]>0x0?0x1:0x0,'children':a43_0xbc8784(Text,{'color':'green','bold':!![],'children':'✓\x20Skill\x20安装完成:'})}),_0x13304a[_0x234667(0x235)]['map']((_0x67d48f,_0x314d15)=>a43_0xbc8784(Box,{'marginLeft':0x2,'children':a43_0x558d49(Text,{'color':_0x67d48f[_0x234667(0x234)]==='success'?_0x234667(0x1ec):_0x234667(0x216),'children':[_0x67d48f[_0x234667(0x244)],':\x20',_0x67d48f[_0x234667(0x242)]]})},'skill-'+_0x314d15))]}),a43_0xbc8784(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a43_0xbc8784(Text,{'color':_0x234667(0x219),'children':'─'[_0x234667(0x22b)](0x3c)})})]}),a43_0xbc8784(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':_0x234667(0x208)})}),a43_0x558d49(Box,{'marginLeft':0x2,'flexDirection':_0x234667(0x212),'children':[_0x43c494?a43_0x558d49(a43_0x4fb693,{'children':[a43_0x558d49(Box,{'children':[a43_0xbc8784(Text,{'color':'green','children':'1.\x20'}),a43_0xbc8784(Text,{'color':_0x234667(0x1ec),'children':_0x234667(0x1f9)}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':'cd\x20'+_0x350165?.[_0x234667(0x20e)]+_0x234667(0x21c)})]}),_0x350165?.['appCode']&&!_0x350165?.['pullApi']&&a43_0x558d49(Box,{'children':[a43_0xbc8784(Text,{'color':_0x234667(0x233),'children':'2.\x20'}),a43_0xbc8784(Text,{'color':_0x234667(0x1ec),'children':'拉取API配置:\x20'}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':_0x234667(0x202)})]})]}):a43_0x558d49(a43_0x4fb693,{'children':[a43_0xbc8784(Box,{'children':a43_0xbc8784(Text,{'color':_0x234667(0x233),'bold':!![],'children':_0x234667(0x224)})}),a43_0x558d49(Box,{'marginLeft':0x2,'marginTop':0x1,'children':[a43_0xbc8784(Text,{'color':_0x234667(0x1ec),'children':_0x234667(0x24b)}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':_0x234667(0x1f4)})]}),a43_0x558d49(Box,{'marginLeft':0x2,'children':[a43_0xbc8784(Text,{'color':'white','children':_0x234667(0x1f0)}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':_0x234667(0x1f5)})]}),a43_0x558d49(Box,{'marginTop':0x1,'children':[a43_0xbc8784(Text,{'color':_0x234667(0x219),'children':_0x234667(0x228)}),a43_0xbc8784(Text,{'color':_0x234667(0x1ec),'children':_0x234667(0x1f9)}),a43_0xbc8784(Text,{'color':'cyan','bold':!![],'children':_0x234667(0x1f3)+_0x350165?.[_0x234667(0x20e)]+_0x234667(0x21c)})]}),_0x350165?.['appCode']&&!_0x350165?.[_0x234667(0x217)]&&a43_0x558d49(Box,{'children':[a43_0xbc8784(Text,{'color':_0x234667(0x233),'children':'3.\x20'}),a43_0xbc8784(Text,{'color':_0x234667(0x1ec),'children':_0x234667(0x238)}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':_0x234667(0x202)})]})]}),!_0x350165?.['appCode']&&a43_0x558d49(a43_0x4fb693,{'children':[a43_0x558d49(Box,{'children':[a43_0xbc8784(Text,{'color':_0x234667(0x1de),'children':'2.\x20'}),a43_0xbc8784(Text,{'color':_0x234667(0x1ec),'children':_0x234667(0x215)}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':'lovrabet\x20config\x20set\x20appcode\x20[app-code]'})]}),a43_0x558d49(Box,{'children':[a43_0xbc8784(Text,{'color':_0x234667(0x1de),'children':_0x234667(0x1e1)}),a43_0xbc8784(Text,{'color':_0x234667(0x1ec),'children':'拉取API配置:\x20'}),a43_0xbc8784(Text,{'color':_0x234667(0x1f2),'bold':!![],'children':_0x234667(0x223)})]})]})]}),a43_0xbc8784(Box,{'marginTop':0x1,'children':a43_0xbc8784(Text,{'color':_0x234667(0x219),'children':'─'['repeat'](0x3c)})})]});}return null;}
|
|
1
|
+
const a43_0x2470e9=a43_0x3e88;(function(_0x426d5c,_0x236baa){const _0x5a6116=a43_0x3e88,_0xdee892=_0x426d5c();while(!![]){try{const _0x357a49=parseInt(_0x5a6116(0x129))/0x1+-parseInt(_0x5a6116(0xf6))/0x2*(-parseInt(_0x5a6116(0xe8))/0x3)+parseInt(_0x5a6116(0x117))/0x4*(-parseInt(_0x5a6116(0x10e))/0x5)+parseInt(_0x5a6116(0xd8))/0x6+parseInt(_0x5a6116(0xf5))/0x7*(-parseInt(_0x5a6116(0x102))/0x8)+parseInt(_0x5a6116(0xdc))/0x9*(-parseInt(_0x5a6116(0x131))/0xa)+-parseInt(_0x5a6116(0xc7))/0xb;if(_0x357a49===_0x236baa)break;else _0xdee892['push'](_0xdee892['shift']());}catch(_0x3ca35f){_0xdee892['push'](_0xdee892['shift']());}}}(a43_0x2f24,0x8fb0f));import{jsx as a43_0x363f9b,Fragment as a43_0x184f42,jsxs as a43_0x30de4b}from'react/jsx-runtime';import a43_0x2ad365 from'path';import a43_0x94b180 from'fs';import{fileURLToPath}from'node:url';import{Box,Text}from'ink';import{useEffect,useState}from'react';import{EnhancedGuidedCreate}from'./enhanced-guided-create.js';import{pullApiSilent}from'../api/pull-silent.js';import{readConfig}from'../utils/config.js';import{useCopyProjectTemplate}from'./use-copy-project-template.js';import{useInstallDependencies}from'./use-install-dependencies.js';import{useFormatCode}from'./use-format-code.js';import{TaskFinished}from'./task-finished.js';function a43_0x2f24(){const _0x3a46b9=['项目创建失败:\x20','\x20|\x20应用AppCode:\x20','×\x20无法在当前目录创建项目,请检查目录权限','×\x20项目创建失败:\x20','*\x20正在拉取\x20API\x20配置...','lovrabet\x20skill\x20install','\x20\x20•\x20MCP\x20服务器:\x20','aiSetup','40gCzwtr','√\x20Lovrabet\x20MCP\x20和\x20Skill\x20配置完成','API\x20配置拉取失败:\x20','×\x20项目名过长,最多支持\x20100\x20个字符','dirname','lovrabet\x20api\x20pull\x20--appcode\x20[app-code]','\x20创建配置文件','配置AppCode:\x20','gray','×\x20项目目录\x20','repeat','manual','writeFileSync','mcp-','join','create','string','×\x20项目名不能为空','640770HhmjOz','配置应用AppCode:\x20','W_OK','Claude\x20Code','开始创建项目:\x20','doTask','push','setLogPath','6050490MTTxkx','\x20配置应用AppCode:\x20','online','项目创建完成:\x20','name','utf8','yellow','\x20\x20•\x20Skill:\x20','清理项目目录失败:\x20','*\x20正在更新\x20package.json\x20的\x20name\x20和\x20description\x20字段','cwd','success','package.json','8932407iLdjoV','×\x20项目名包含非法字符,不允许使用:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20及控制字符','lovrabet\x20api\x20pull','启动项目:\x20','\x20Generated\x20by\x20lovrabet\x20cli\x20','error','info','Cursor','version','*\x20正在为项目\x20','status','red','cursor','env','√\x20配置文件已创建,可稍后使用\x20\x27lovrabet\x20config\x20set\x20appcode\x20<app-code>\x27\x20配置','skill-','更新\x20package.json\x20name','5281224INHYLe','1.\x20配置\x20Lovrabet\x20MCP\x20和\x20Skill','../..','length','9wfBnlC','ide','\x20Skill\x20','log','拉取API配置:\x20','filter','white','map','\x20MCP\x20','warn','✓\x20Skill\x20安装完成:','readFileSync','3bUsEeI','mcp','projectName','项目名称:\x20','parse','\x20&&\x20lovrabet\x20start','API\x20配置拉取异常','green','accessSync','cyan','\x20\x20✗\x20MCP\x20','existsSync','skill','14805tpdtWp','2351212HcgvAx','2.\x20','!\x20API\x20配置拉取异常,项目已创建,可稍后手动执行:\x20lovrabet\x20api\x20pull','\x20√\x20','cd\x20','message','配置应用AppCode失败','1.0.0','pullApi','appCode','projectCode','toLocaleString','664LcoSll','API\x20配置拉取成功:\x20','has','column','description','\x20\x20✗\x20Skill\x20','claude','3.\x20','selectedIDEs','*\x20清理失败的项目目录:\x20','√\x20package.json\x20已更新:\x20name=','resolve','257695moWMFE'];a43_0x2f24=function(){return _0x3a46b9;};return a43_0x2f24();}import{TaskRunning}from'./task-running.js';function a43_0x3e88(_0x2eb3e0,_0x3ba027){_0x2eb3e0=_0x2eb3e0-0xc2;const _0x2f241b=a43_0x2f24();let _0x3e8890=_0x2f241b[_0x2eb3e0];return _0x3e8890;}import{logger}from'../utils/logger.js';import{configureMcp,copySharedSkills,installSkill,createSkillManifest}from'../ai-setup/config.js';const MCP_IDES=new Set([a43_0x2470e9(0xd3),a43_0x2470e9(0x108)]);export function CreateApp(_0x50f233){const _0x597ed2=a43_0x2470e9,[_0x306d42,_0x22f89d]=useState(![]),[_0x36a201,_0x78886c]=useState(![]),[_0x4394fd,_0x50c712]=useState(null),[_0x30a20f,_0x1ca78e]=useState(null),_0x5b9bc6=useCopyProjectTemplate(),_0x3b797b=useInstallDependencies(),_0x282712=useFormatCode(),_0x4b855c=async _0x238b58=>{const _0x1eb7f4=a43_0x3e88;if(!_0x238b58[_0x1eb7f4(0xea)]||_0x238b58[_0x1eb7f4(0xea)]['trim']()===''){console[_0x1eb7f4(0xcc)](_0x1eb7f4(0x128));return;}const _0x24f5c0=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x24f5c0['test'](_0x238b58[_0x1eb7f4(0xea)])){console[_0x1eb7f4(0xcc)](_0x1eb7f4(0xc8));return;}if(_0x238b58[_0x1eb7f4(0xea)]['length']>0x64){console[_0x1eb7f4(0xcc)](_0x1eb7f4(0x11a));return;}const _0xc6972d=a43_0x2ad365[_0x1eb7f4(0x10d)](process[_0x1eb7f4(0xc4)](),_0x238b58[_0x1eb7f4(0xea)]);if(a43_0x94b180['existsSync'](_0xc6972d)){console[_0x1eb7f4(0xcc)](_0x1eb7f4(0x120)+_0x238b58['projectName']+'\x20已存在,请使用其他项目名');return;}try{const _0x341f8c=a43_0x2ad365[_0x1eb7f4(0x11b)](_0xc6972d);a43_0x94b180[_0x1eb7f4(0xf0)](_0x341f8c,a43_0x94b180['constants'][_0x1eb7f4(0x12b)]);}catch(_0x42c54c){console[_0x1eb7f4(0xcc)](_0x1eb7f4(0x111));return;}_0x50c712(_0x238b58),_0x22f89d(!![]),logger[_0x1eb7f4(0x130)](_0xc6972d),logger[_0x1eb7f4(0xcd)](_0x1eb7f4(0x126),_0x1eb7f4(0x12d)+_0x238b58[_0x1eb7f4(0xea)],{'projectDir':_0xc6972d,'appCode':_0x238b58[_0x1eb7f4(0xff)]});try{await _0x5b9bc6[_0x1eb7f4(0x12e)](_0x238b58['projectName']),await _0x43044b(_0x238b58['projectName']),await _0x3b797b[_0x1eb7f4(0x12e)](_0x238b58[_0x1eb7f4(0xea)]),await _0x282712[_0x1eb7f4(0x12e)](_0x238b58[_0x1eb7f4(0xea)]),await _0xd65882(_0x238b58[_0x1eb7f4(0xea)],_0x238b58[_0x1eb7f4(0xff)]||'',_0x238b58[_0x1eb7f4(0xd4)]);if(_0x238b58[_0x1eb7f4(0xfe)]&&_0x238b58[_0x1eb7f4(0xff)]){console['log'](_0x1eb7f4(0x113));try{const _0x296f0c=await pullApiSilent(_0x238b58[_0x1eb7f4(0xff)],undefined,_0xc6972d,_0x238b58['env']);_0x296f0c?(console[_0x1eb7f4(0xdf)]('√\x20API\x20配置拉取完成'),logger['info'](_0x1eb7f4(0x126),_0x1eb7f4(0x103)+_0x238b58[_0x1eb7f4(0xff)])):(console['log']('!\x20API\x20配置拉取失败,可稍后手动执行:\x20lovrabet\x20api\x20pull'),logger[_0x1eb7f4(0xe5)](_0x1eb7f4(0x126),_0x1eb7f4(0x119)+_0x238b58['appCode']));}catch(_0x4a2938){console[_0x1eb7f4(0xdf)](_0x1eb7f4(0xf8)),logger[_0x1eb7f4(0xe5)](_0x1eb7f4(0x126),_0x1eb7f4(0xee),{'error':_0x4a2938 instanceof Error?_0x4a2938[_0x1eb7f4(0xfb)]:String(_0x4a2938)});}}if(_0x238b58[_0x1eb7f4(0x116)]&&_0x238b58[_0x1eb7f4(0x10a)]&&_0x238b58[_0x1eb7f4(0x10a)]['length']>0x0&&_0x238b58[_0x1eb7f4(0xff)]){console['log']('*\x20正在配置\x20Lovrabet\x20MCP\x20和\x20Skill...');const _0x22d5e2=[],_0x549b7e=[],_0x4c97a9=_0x238b58[_0x1eb7f4(0x10a)][_0x1eb7f4(0xe1)](_0x33e4f9=>MCP_IDES[_0x1eb7f4(0x104)](_0x33e4f9)),_0x4f815c=_0x238b58[_0x1eb7f4(0x10a)];for(const _0x1f27ac of _0x4c97a9){try{const _0x3f1c4c=await configureMcp(_0x1f27ac,_0xc6972d);_0x22d5e2[_0x1eb7f4(0x12f)]({'ide':_0x1f27ac==='cursor'?_0x1eb7f4(0xce):_0x1eb7f4(0x12c),'status':_0x3f1c4c[_0x1eb7f4(0xd1)],'message':_0x3f1c4c[_0x1eb7f4(0xfb)]}),console[_0x1eb7f4(0xdf)]('\x20\x20'+(_0x3f1c4c[_0x1eb7f4(0xd1)]==='success'?'✓':_0x3f1c4c['status']===_0x1eb7f4(0x122)?'⚠️':'✗')+_0x1eb7f4(0xe4)+_0x1f27ac+':\x20'+_0x3f1c4c[_0x1eb7f4(0xfb)]);}catch(_0x26b490){_0x22d5e2[_0x1eb7f4(0x12f)]({'ide':_0x1f27ac===_0x1eb7f4(0xd3)?_0x1eb7f4(0xce):_0x1eb7f4(0x12c),'status':'error','message':_0x26b490 instanceof Error?_0x26b490[_0x1eb7f4(0xfb)]:String(_0x26b490)}),console[_0x1eb7f4(0xdf)](_0x1eb7f4(0xf2)+_0x1f27ac+':\x20'+(_0x26b490 instanceof Error?_0x26b490[_0x1eb7f4(0xfb)]:String(_0x26b490)));}}await copySharedSkills(_0xc6972d);for(const _0x1be20e of _0x4f815c){try{const _0x51f6dc=await installSkill(_0x1be20e,_0xc6972d);_0x549b7e[_0x1eb7f4(0x12f)]({'ide':_0x51f6dc['ide'],'status':_0x51f6dc['status'],'message':_0x51f6dc[_0x1eb7f4(0xfb)]}),console[_0x1eb7f4(0xdf)]('\x20\x20'+(_0x51f6dc[_0x1eb7f4(0xd1)]==='success'?'✓':'✗')+_0x1eb7f4(0xde)+_0x51f6dc[_0x1eb7f4(0xdd)]+':\x20'+_0x51f6dc['message']);}catch(_0x2500e1){_0x549b7e[_0x1eb7f4(0x12f)]({'ide':_0x1be20e,'status':_0x1eb7f4(0xcc),'message':_0x2500e1 instanceof Error?_0x2500e1['message']:String(_0x2500e1)}),console[_0x1eb7f4(0xdf)](_0x1eb7f4(0x107)+_0x1be20e+':\x20'+(_0x2500e1 instanceof Error?_0x2500e1[_0x1eb7f4(0xfb)]:String(_0x2500e1)));}}if(_0x549b7e[_0x1eb7f4(0xdb)]>0x0){const _0x119518=_0x549b7e['filter'](_0x441de6=>_0x441de6[_0x1eb7f4(0xd1)]===_0x1eb7f4(0xc5))[_0x1eb7f4(0xe3)](_0xcad9ae=>_0xcad9ae['ide']);_0x119518[_0x1eb7f4(0xdb)]>0x0&&createSkillManifest(_0xc6972d,_0x119518);}_0x1ca78e({'mcp':_0x22d5e2,'skill':_0x549b7e}),console[_0x1eb7f4(0xdf)](_0x1eb7f4(0x118));}logger[_0x1eb7f4(0xc5)](_0x1eb7f4(0x126),_0x1eb7f4(0x134)+_0x238b58[_0x1eb7f4(0xea)]),_0x78886c(!![]),_0x22f89d(![]);}catch(_0x354733){logger['error'](_0x1eb7f4(0x126),_0x1eb7f4(0x10f)+_0x238b58[_0x1eb7f4(0xea)],{'error':_0x354733 instanceof Error?_0x354733['message']:String(_0x354733)});try{a43_0x94b180[_0x1eb7f4(0xf3)](_0xc6972d)&&(console['log'](_0x1eb7f4(0x10b)+_0xc6972d),a43_0x94b180['rmSync'](_0xc6972d,{'recursive':!![],'force':!![]}));}catch(_0x58da11){logger['warn']('create',_0x1eb7f4(0xc2)+_0xc6972d);}_0x22f89d(![]),console['error'](_0x1eb7f4(0x112)+(_0x354733 instanceof Error?_0x354733[_0x1eb7f4(0xfb)]:String(_0x354733)));}},_0x58e681=async _0x9c5ed=>{const _0x1c3741=a43_0x3e88;await _0x4b855c({'projectName':_0x9c5ed,'env':_0x50f233[_0x1c3741(0xd4)]});},_0x43044b=async _0x1cb484=>{const _0x1f4747=a43_0x3e88,_0x303fce=a43_0x2ad365[_0x1f4747(0x10d)](process[_0x1f4747(0xc4)](),_0x1cb484),_0x39ba40=a43_0x2ad365[_0x1f4747(0x125)](_0x303fce,'package.json');try{console[_0x1f4747(0xdf)](_0x1f4747(0xc3));const _0x286886=fileURLToPath(import.meta.url),_0xf86b1d=a43_0x2ad365['resolve'](a43_0x2ad365[_0x1f4747(0x11b)](_0x286886),_0x1f4747(0xda)),_0x226357=a43_0x2ad365[_0x1f4747(0x125)](_0xf86b1d,'package.json');let _0x3b5496=_0x1f4747(0xfd);try{const _0x1d270e=JSON[_0x1f4747(0xec)](a43_0x94b180[_0x1f4747(0xe7)](_0x226357,_0x1f4747(0x136)));_0x3b5496=_0x1d270e[_0x1f4747(0xcf)]||_0x1f4747(0xfd);}catch(_0x4b7197){}const _0x5a757a=a43_0x94b180['readFileSync'](_0x39ba40,_0x1f4747(0x136)),_0x219c24=JSON['parse'](_0x5a757a);_0x219c24[_0x1f4747(0x135)]=_0x1cb484,_0x219c24[_0x1f4747(0x106)]=_0x1cb484+_0x1f4747(0xcb)+_0x3b5496,a43_0x94b180['writeFileSync'](_0x39ba40,JSON['stringify'](_0x219c24,null,0x2)+'\x0a',_0x1f4747(0x136)),console[_0x1f4747(0xdf)](_0x1f4747(0x10c)+_0x1cb484),logger[_0x1f4747(0xcd)]('create',_0x1f4747(0xd7));}catch(_0x4c9230){logger['error'](_0x1f4747(0x126),'更新\x20package.json\x20失败');throw _0x4c9230;}},_0xd65882=async(_0x226197,_0x33b6a0,_0x583485)=>{const _0xad138a=a43_0x3e88,_0x5b751c=a43_0x2ad365['resolve'](process[_0xad138a(0xc4)](),_0x226197),_0x1e3c9e=a43_0x2ad365[_0xad138a(0x125)](_0x5b751c,'.lovrabetrc');try{_0x33b6a0?console[_0xad138a(0xdf)](_0xad138a(0xd0)+_0x226197+_0xad138a(0x132)+_0x33b6a0):console['log'](_0xad138a(0xd0)+_0x226197+_0xad138a(0x11d));const _0x32e1d0=fileURLToPath(import.meta.url),_0x5632ce=a43_0x2ad365['resolve'](a43_0x2ad365[_0xad138a(0x11b)](_0x32e1d0),_0xad138a(0xda)),_0x12886a=a43_0x2ad365['join'](_0x5632ce,_0xad138a(0xc6));let _0x4545f3=_0xad138a(0xfd);try{const _0x59a7a3=JSON[_0xad138a(0xec)](a43_0x94b180[_0xad138a(0xe7)](_0x12886a,_0xad138a(0x136)));_0x4545f3=_0x59a7a3[_0xad138a(0xcf)]||'1.0.0';}catch(_0x2693a2){}const _0x23f8b9=readConfig(),_0x21387c=typeof _0x23f8b9[_0xad138a(0xd4)]===_0xad138a(0x127)?_0x23f8b9['env']:undefined,{app:_0x4da923,appcode:_0xcc4a03,..._0x39349c}=_0x23f8b9,_0x28ee33={..._0x39349c,'appcode':_0x33b6a0||'','env':_0x583485||_0x21387c||_0xad138a(0x133),'createdAt':new Date()[_0xad138a(0x101)](),'version':_0x4545f3};a43_0x94b180[_0xad138a(0x123)](_0x1e3c9e,JSON['stringify'](_0x28ee33,null,0x2),_0xad138a(0x136)),_0x33b6a0?console[_0xad138a(0xdf)]('√\x20配置文件已创建,应用AppCode:\x20'+_0x33b6a0):console[_0xad138a(0xdf)](_0xad138a(0xd5)),logger[_0xad138a(0xcd)](_0xad138a(0x126),_0xad138a(0x12a)+_0x33b6a0);}catch(_0x188716){logger[_0xad138a(0xcc)](_0xad138a(0x126),_0xad138a(0xfc));}};useEffect(()=>{const _0x359bd2=a43_0x3e88;_0x50f233[_0x359bd2(0x100)]&&_0x58e681(_0x50f233['projectCode']);},[_0x50f233[_0x597ed2(0x100)]]);if(!_0x306d42&&!_0x36a201&&!_0x50f233[_0x597ed2(0x100)])return a43_0x363f9b(EnhancedGuidedCreate,{'onCreate':_0x4b855c,'env':_0x50f233[_0x597ed2(0xd4)]});if(_0x306d42)return a43_0x30de4b(a43_0x184f42,{'children':[a43_0x30de4b(Box,{'marginTop':0x1,'children':[a43_0x363f9b(Box,{'width':'1'}),a43_0x363f9b(Text,{'color':_0x597ed2(0xef),'children':_0x597ed2(0xf9)}),a43_0x363f9b(Text,{'children':_0x597ed2(0xeb)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xef),'children':_0x4394fd?.['projectName']}),_0x4394fd?.['appCode']&&a43_0x30de4b(a43_0x184f42,{'children':[a43_0x363f9b(Text,{'children':_0x597ed2(0x110)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'children':_0x4394fd[_0x597ed2(0xff)]})]})]}),a43_0x363f9b(TaskRunning,{..._0x5b9bc6}),a43_0x363f9b(TaskRunning,{..._0x3b797b}),a43_0x363f9b(TaskRunning,{..._0x282712})]});if(_0x36a201){const _0x1ff13a=_0x30a20f&&(_0x30a20f[_0x597ed2(0xe9)]['length']>0x0||_0x30a20f[_0x597ed2(0xf4)][_0x597ed2(0xdb)]>0x0);return a43_0x30de4b(a43_0x184f42,{'children':[a43_0x30de4b(Box,{'marginTop':0x1,'children':[a43_0x363f9b(Box,{'width':'1'}),a43_0x363f9b(Text,{'color':'green','children':_0x597ed2(0xf9)}),a43_0x363f9b(Text,{'children':_0x597ed2(0xeb)}),a43_0x363f9b(Text,{'color':'green','children':_0x4394fd?.['projectName']}),_0x4394fd?.[_0x597ed2(0xff)]&&a43_0x30de4b(a43_0x184f42,{'children':[a43_0x363f9b(Text,{'children':_0x597ed2(0x110)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'children':_0x4394fd[_0x597ed2(0xff)]})]})]}),a43_0x363f9b(TaskFinished,{..._0x5b9bc6}),a43_0x363f9b(TaskFinished,{..._0x3b797b}),a43_0x363f9b(TaskFinished,{..._0x282712}),a43_0x363f9b(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a43_0x363f9b(Text,{'color':'green','children':'─'[_0x597ed2(0x121)](0x3c)})}),_0x1ff13a&&a43_0x30de4b(a43_0x184f42,{'children':[_0x30a20f[_0x597ed2(0xe9)][_0x597ed2(0xdb)]>0x0&&a43_0x30de4b(a43_0x184f42,{'children':[a43_0x363f9b(Box,{'marginTop':0x1,'children':a43_0x363f9b(Text,{'color':_0x597ed2(0xef),'bold':!![],'children':'✓\x20MCP\x20服务器配置完成:'})}),_0x30a20f[_0x597ed2(0xe9)][_0x597ed2(0xe3)]((_0x2d21ae,_0xe8453e)=>a43_0x363f9b(Box,{'marginLeft':0x2,'children':a43_0x30de4b(Text,{'color':_0x2d21ae[_0x597ed2(0xd1)]==='success'?_0x597ed2(0xe2):_0x2d21ae[_0x597ed2(0xd1)]==='manual'?'yellow':'red','children':[_0x2d21ae[_0x597ed2(0xdd)],':\x20',_0x2d21ae[_0x597ed2(0xfb)]]})},_0x597ed2(0x124)+_0xe8453e))]}),_0x30a20f[_0x597ed2(0xf4)][_0x597ed2(0xdb)]>0x0&&a43_0x30de4b(a43_0x184f42,{'children':[a43_0x363f9b(Box,{'marginTop':_0x30a20f['mcp'][_0x597ed2(0xdb)]>0x0?0x1:0x0,'children':a43_0x363f9b(Text,{'color':'green','bold':!![],'children':_0x597ed2(0xe6)})}),_0x30a20f['skill']['map']((_0x41a511,_0x107dd6)=>a43_0x363f9b(Box,{'marginLeft':0x2,'children':a43_0x30de4b(Text,{'color':_0x41a511['status']===_0x597ed2(0xc5)?_0x597ed2(0xe2):_0x597ed2(0xd2),'children':[_0x41a511[_0x597ed2(0xdd)],':\x20',_0x41a511[_0x597ed2(0xfb)]]})},_0x597ed2(0xd6)+_0x107dd6))]}),a43_0x363f9b(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a43_0x363f9b(Text,{'color':_0x597ed2(0xef),'children':'─'[_0x597ed2(0x121)](0x3c)})})]}),a43_0x363f9b(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'bold':!![],'children':'🚀\x20接下来:'})}),a43_0x30de4b(Box,{'marginLeft':0x2,'flexDirection':_0x597ed2(0x105),'children':[_0x1ff13a?a43_0x30de4b(a43_0x184f42,{'children':[a43_0x30de4b(Box,{'children':[a43_0x363f9b(Text,{'color':'green','children':'1.\x20'}),a43_0x363f9b(Text,{'color':_0x597ed2(0xe2),'children':_0x597ed2(0xca)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'bold':!![],'children':'cd\x20'+_0x4394fd?.[_0x597ed2(0xea)]+_0x597ed2(0xed)})]}),_0x4394fd?.[_0x597ed2(0xff)]&&!_0x4394fd?.['pullApi']&&a43_0x30de4b(Box,{'children':[a43_0x363f9b(Text,{'color':'yellow','children':_0x597ed2(0xf7)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xe2),'children':_0x597ed2(0xe0)}),a43_0x363f9b(Text,{'color':'cyan','bold':!![],'children':_0x597ed2(0xc9)})]})]}):a43_0x30de4b(a43_0x184f42,{'children':[a43_0x363f9b(Box,{'children':a43_0x363f9b(Text,{'color':_0x597ed2(0x137),'bold':!![],'children':_0x597ed2(0xd9)})}),a43_0x30de4b(Box,{'marginLeft':0x2,'marginTop':0x1,'children':[a43_0x363f9b(Text,{'color':_0x597ed2(0xe2),'children':_0x597ed2(0x138)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'bold':!![],'children':_0x597ed2(0x114)})]}),a43_0x30de4b(Box,{'marginLeft':0x2,'children':[a43_0x363f9b(Text,{'color':'white','children':_0x597ed2(0x115)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'bold':!![],'children':'lovrabet\x20mcp\x20install'})]}),a43_0x30de4b(Box,{'marginTop':0x1,'children':[a43_0x363f9b(Text,{'color':_0x597ed2(0xef),'children':'2.\x20'}),a43_0x363f9b(Text,{'color':_0x597ed2(0xe2),'children':'启动项目:\x20'}),a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'bold':!![],'children':_0x597ed2(0xfa)+_0x4394fd?.[_0x597ed2(0xea)]+_0x597ed2(0xed)})]}),_0x4394fd?.[_0x597ed2(0xff)]&&!_0x4394fd?.['pullApi']&&a43_0x30de4b(Box,{'children':[a43_0x363f9b(Text,{'color':_0x597ed2(0x137),'children':'3.\x20'}),a43_0x363f9b(Text,{'color':'white','children':_0x597ed2(0xe0)}),a43_0x363f9b(Text,{'color':'cyan','bold':!![],'children':_0x597ed2(0xc9)})]})]}),!_0x4394fd?.[_0x597ed2(0xff)]&&a43_0x30de4b(a43_0x184f42,{'children':[a43_0x30de4b(Box,{'children':[a43_0x363f9b(Text,{'color':_0x597ed2(0x11f),'children':_0x597ed2(0xf7)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xe2),'children':_0x597ed2(0x11e)}),a43_0x363f9b(Text,{'color':'cyan','bold':!![],'children':'lovrabet\x20config\x20set\x20appcode\x20[app-code]'})]}),a43_0x30de4b(Box,{'children':[a43_0x363f9b(Text,{'color':_0x597ed2(0x11f),'children':_0x597ed2(0x109)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xe2),'children':_0x597ed2(0xe0)}),a43_0x363f9b(Text,{'color':_0x597ed2(0xf1),'bold':!![],'children':_0x597ed2(0x11c)})]})]})]}),a43_0x363f9b(Box,{'marginTop':0x1,'children':a43_0x363f9b(Text,{'color':'green','children':'─'[_0x597ed2(0x121)](0x3c)})})]});}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x30b493,_0x483ebe){var _0x38de0e=a44_0xf16d,_0x449888=_0x30b493();while(!![]){try{var _0x51c981=parseInt(_0x38de0e(0x1a9))/0x1+-parseInt(_0x38de0e(0x1a7))/0x2*(-parseInt(_0x38de0e(0x1a3))/0x3)+-parseInt(_0x38de0e(0x19d))/0x4*(-parseInt(_0x38de0e(0x1a1))/0x5)+-parseInt(_0x38de0e(0x1a2))/0x6*(parseInt(_0x38de0e(0x19e))/0x7)+parseInt(_0x38de0e(0x19f))/0x8+parseInt(_0x38de0e(0x1a4))/0x9*(-parseInt(_0x38de0e(0x1a6))/0xa)+-parseInt(_0x38de0e(0x1a0))/0xb;if(_0x51c981===_0x483ebe)break;else _0x449888['push'](_0x449888['shift']());}catch(_0x25747f){_0x449888['push'](_0x449888['shift']());}}}(a44_0x12cc,0xd0b36));function a44_0x12cc(){var _0x17aea9=['47992AFVwQt','699853BjrjHz','3305kpfCJz','2348724gnTfII','24FxayEB','18NBpPbo','\x20√\x20','102540PYsLKb','309436beygpy','green','387200cHzXCr','5288OaAQPi','28tzXpmp'];a44_0x12cc=function(){return _0x17aea9;};return a44_0x12cc();}import{jsx as a44_0x123137,jsxs as a44_0x40b35b}from'react/jsx-runtime';function a44_0xf16d(_0x2d53ee,_0x179bb0){_0x2d53ee=_0x2d53ee-0x19d;var _0x12ccf5=a44_0x12cc();var _0xf16d33=_0x12ccf5[_0x2d53ee];return _0xf16d33;}import{Box,Text}from'ink';import{TaskTime}from'./task-time.js';export function TaskFinished(_0x29a7b2){var _0x895623=a44_0xf16d;return a44_0x40b35b(Box,{'children':[a44_0x123137(Box,{'width':'1'}),a44_0x123137(Text,{'color':_0x895623(0x1a8),'children':_0x895623(0x1a5)}),a44_0x123137(Text,{'children':_0x29a7b2['taskName']}),a44_0x123137(TaskTime,{'elapsed':_0x29a7b2['elapsed']})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x492cf6,_0x2eed4a){var _0x53b079=a45_0x8f6b,_0x5be593=_0x492cf6();while(!![]){try{var _0x543454=-parseInt(_0x53b079(0x191))/0x1*(parseInt(_0x53b079(0x18c))/0x2)+parseInt(_0x53b079(0x18b))/0x3+parseInt(_0x53b079(0x18e))/0x4*(parseInt(_0x53b079(0x193))/0x5)+-parseInt(_0x53b079(0x185))/0x6*(-parseInt(_0x53b079(0x18a))/0x7)+parseInt(_0x53b079(0x18d))/0x8*(parseInt(_0x53b079(0x18f))/0x9)+-parseInt(_0x53b079(0x183))/0xa*(-parseInt(_0x53b079(0x186))/0xb)+-parseInt(_0x53b079(0x187))/0xc;if(_0x543454===_0x2eed4a)break;else _0x5be593['push'](_0x5be593['shift']());}catch(_0x810818){_0x5be593['push'](_0x5be593['shift']());}}}(a45_0x2e29,0xb1ab4));import{jsx as a45_0x69c2a0,jsxs as a45_0xcd3e39}from'react/jsx-runtime';function a45_0x2e29(){var _0x3aea12=['310zMzlqH','70UpRYlh','loading','570630VjvqFA','930479IXoYyS','28481868qSTwLL','green','\x20\x20\x20','21hhlUrT','3217869DwErGU','1826dHMQzF','56SudmBt','93188uOAIuz','1021023JYhHdN','dots','1191eMXoLN','finished'];a45_0x2e29=function(){return _0x3aea12;};return a45_0x2e29();}function a45_0x8f6b(_0x3182e0,_0x5c453a){_0x3182e0=_0x3182e0-0x183;var _0x2e296b=a45_0x2e29();var _0x8f6b0b=_0x2e296b[_0x3182e0];return _0x8f6b0b;}import{Text}from'ink';import a45_0x54caab from'ink-spinner';export function TaskLoading(_0x30a097){var _0x4b9c5f=a45_0x8f6b;if(_0x30a097[_0x4b9c5f(0x192)])return a45_0x69c2a0(Text,{'color':_0x4b9c5f(0x188),'children':'\x20√\x20'});if(_0x30a097[_0x4b9c5f(0x184)])return a45_0xcd3e39(Text,{'color':'green','children':['\x20',a45_0x69c2a0(a45_0x54caab,{'type':_0x4b9c5f(0x190)}),'\x20']});return a45_0x69c2a0(Text,{'children':_0x4b9c5f(0x189)});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3b6690,_0x4ee1d7){var _0x263608=a46_0x5bc9,_0x2f444b=_0x3b6690();while(!![]){try{var _0x48bbe2=parseInt(_0x263608(0xe5))/0x1*(-parseInt(_0x263608(0xee))/0x2)+parseInt(_0x263608(0xe8))/0x3+parseInt(_0x263608(0xf0))/0x4*(-parseInt(_0x263608(0xef))/0x5)+parseInt(_0x263608(0xea))/0x6*(parseInt(_0x263608(0xeb))/0x7)+parseInt(_0x263608(0xe7))/0x8+-parseInt(_0x263608(0xec))/0x9+-parseInt(_0x263608(0xed))/0xa*(parseInt(_0x263608(0xe6))/0xb);if(_0x48bbe2===_0x4ee1d7)break;else _0x2f444b['push'](_0x2f444b['shift']());}catch(_0x4accd8){_0x2f444b['push'](_0x2f444b['shift']());}}}(a46_0x1283,0x85e61));import{jsx as a46_0x383bcb,jsxs as a46_0xae9926}from'react/jsx-runtime';import{Box,Text}from'ink';import{TaskLoading}from'./task-loading.js';import{TaskTime}from'./task-time.js';function a46_0x1283(){var _0xc390cd=['257jzZqdy','22yVkjiV','4022632xiQnCt','3059697yTyyEh','taskName','6fBqrrd','5824945wTuSQu','3384135MLaTzv','3553020lIvXpO','2092RjMibt','5buqmAO','1803892EGUMMF'];a46_0x1283=function(){return _0xc390cd;};return a46_0x1283();}function a46_0x5bc9(_0x2a7cb6,_0x2e9a92){_0x2a7cb6=_0x2a7cb6-0xe5;var _0x1283ef=a46_0x1283();var _0x5bc969=_0x1283ef[_0x2a7cb6];return _0x5bc969;}export function TaskRunning(_0x5627d3){var _0x1c3e93=a46_0x5bc9;return a46_0xae9926(Box,{'children':[a46_0x383bcb(Box,{'width':'1'}),a46_0x383bcb(TaskLoading,{..._0x5627d3}),a46_0x383bcb(Text,{'children':_0x5627d3[_0x1c3e93(0xe9)]}),a46_0x383bcb(TaskTime,{'elapsed':_0x5627d3['elapsed']})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a47_0x59f4(_0x2810cf,_0x2aa529){_0x2810cf=_0x2810cf-0x183;var _0x481734=a47_0x4817();var _0x59f441=_0x481734[_0x2810cf];return _0x59f441;}function a47_0x4817(){var _0x4860f8=['gray','251685UVFYoU','6730497hGivdO','2060495YLnYoe','110753xRcyDv','6YLxJfD','1160940oFmIbe','2gSQujG','21659790SoYZMJ','elapsed','128Lzybms','2733705BNpNUY'];a47_0x4817=function(){return _0x4860f8;};return a47_0x4817();}(function(_0x38b52d,_0x52e662){var _0xd70bb8=a47_0x59f4,_0x528e33=_0x38b52d();while(!![]){try{var _0x5db7fb=-parseInt(_0xd70bb8(0x18b))/0x1*(-parseInt(_0xd70bb8(0x18e))/0x2)+-parseInt(_0xd70bb8(0x186))/0x3+-parseInt(_0xd70bb8(0x18d))/0x4+-parseInt(_0xd70bb8(0x18a))/0x5*(parseInt(_0xd70bb8(0x18c))/0x6)+-parseInt(_0xd70bb8(0x188))/0x7*(-parseInt(_0xd70bb8(0x185))/0x8)+-parseInt(_0xd70bb8(0x189))/0x9+parseInt(_0xd70bb8(0x183))/0xa;if(_0x5db7fb===_0x52e662)break;else _0x528e33['push'](_0x528e33['shift']());}catch(_0x21c941){_0x528e33['push'](_0x528e33['shift']());}}}(a47_0x4817,0x77c72));import{jsx as a47_0x360f43,Fragment as a47_0x5c4f4f,jsxs as a47_0x5eb653}from'react/jsx-runtime';import{Text}from'ink';export function TaskTime(_0x55d857){var _0x2dda8b=a47_0x59f4;if(_0x55d857[_0x2dda8b(0x184)])return a47_0x5eb653(a47_0x5c4f4f,{'children':[a47_0x360f43(Text,{'color':_0x2dda8b(0x187),'children':'\x20['}),a47_0x360f43(Text,{'color':_0x2dda8b(0x187),'bold':!![],'children':_0x55d857['elapsed']}),a47_0x360f43(Text,{'color':_0x2dda8b(0x187),'children':']'})]});return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a48_0x577f24=a48_0x432a;(function(_0x1a42b1,_0x35d2ff){const _0x4d4f86=a48_0x432a,_0x7c0323=_0x1a42b1();while(!![]){try{const _0x364faa=parseInt(_0x4d4f86(0x179))/0x1+parseInt(_0x4d4f86(0x174))/0x2+parseInt(_0x4d4f86(0x169))/0x3*(parseInt(_0x4d4f86(0x16b))/0x4)+parseInt(_0x4d4f86(0x171))/0x5+-parseInt(_0x4d4f86(0x16e))/0x6*(parseInt(_0x4d4f86(0x175))/0x7)+-parseInt(_0x4d4f86(0x16c))/0x8*(parseInt(_0x4d4f86(0x166))/0x9)+parseInt(_0x4d4f86(0x176))/0xa*(parseInt(_0x4d4f86(0x16f))/0xb);if(_0x364faa===_0x35d2ff)break;else _0x7c0323['push'](_0x7c0323['shift']());}catch(_0x4ed645){_0x7c0323['push'](_0x7c0323['shift']());}}}(a48_0x4f21,0x6f3fa));import a48_0x17c859 from'node:path';import{fileURLToPath}from'node:url';import{useCallback,useState}from'react';import{copyDirectory}from'../utils/copy-directory.js';function a48_0x4f21(){const _0x8e24da=['572532jPatky','3179920uQXCpa','复制项目文件','52236OzyjAf','629915deMrDL','info','4231975ZRdQlh','dirname','resolve','308346dSBjgZ','539ROpFJV','10bBuvOX','success','copy','36294BHqieb','now','error','开始复制项目模板','9DYVdzy','cwd','项目模板复制失败','9HogKGE','../../templates/projects/sub-app-react-demo'];a48_0x4f21=function(){return _0x8e24da;};return a48_0x4f21();}function a48_0x432a(_0x13c199,_0x19263f){_0x13c199=_0x13c199-0x165;const _0x4f21f7=a48_0x4f21();let _0x432aaa=_0x4f21f7[_0x13c199];return _0x432aaa;}import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';const __dirname=a48_0x17c859[a48_0x577f24(0x172)](fileURLToPath(import.meta.url)),templateDir=a48_0x17c859['resolve'](__dirname,a48_0x577f24(0x16a));export function useCopyProjectTemplate(){const _0x5744ad=a48_0x577f24,[_0x1d5f63,_0x4d79fb]=useState(![]),[_0x396e81,_0x1a1cae]=useState(![]),[_0x1ae028,_0x3f32a6]=useState(''),_0xcdb1c=useCallback(async _0x443115=>{const _0x2660f2=a48_0x432a,_0x279793=Date[_0x2660f2(0x17a)](),_0x3b3736=a48_0x17c859[_0x2660f2(0x173)](process[_0x2660f2(0x167)](),_0x443115);_0x4d79fb(!![]);try{logger[_0x2660f2(0x170)](_0x2660f2(0x178),_0x2660f2(0x165),{'projectCode':_0x443115,'templateDir':templateDir}),await copyDirectory(templateDir,_0x3b3736);const _0x3c54fb=Date[_0x2660f2(0x17a)]()-_0x279793;logger[_0x2660f2(0x177)](_0x2660f2(0x178),'项目模板复制完成',_0x3c54fb,{'projectCode':_0x443115});}catch(_0x473fa2){const _0x106a2e=Date[_0x2660f2(0x17a)]()-_0x279793;logger[_0x2660f2(0x17b)]('copy',_0x2660f2(0x168),{'projectCode':_0x443115,'error':_0x473fa2 instanceof Error?_0x473fa2['message']:String(_0x473fa2),'duration':_0x106a2e});throw _0x473fa2;}finally{_0x4d79fb(![]),_0x1a1cae(!![]),_0x3f32a6(formatElapsed(_0x279793));}},[]);return{'taskName':_0x5744ad(0x16d),'finished':_0x396e81,'loading':_0x1d5f63,'elapsed':_0x1ae028,'doTask':_0xcdb1c};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a49_0x3e61(){const _0x38c20f=['10YfVXGT','message','format','19179TCIVLk','4792fjaslL','3235dorUCd','1264GDmeIN','info','success','5577774APwWiO','error','25462aRUdGa','--write','43zlkfmU','npx','16573623UwbYll','格式化代码','代码格式化完成','开始格式化代码','771777dlqRzv','resolve','1738226OFfsms'];a49_0x3e61=function(){return _0x38c20f;};return a49_0x3e61();}(function(_0x33d516,_0x5747d8){const _0x230e43=a49_0x312e,_0x475e8c=_0x33d516();while(!![]){try{const _0x188c3b=-parseInt(_0x230e43(0x168))/0x1*(parseInt(_0x230e43(0x166))/0x2)+parseInt(_0x230e43(0x16e))/0x3+parseInt(_0x230e43(0x15f))/0x4*(parseInt(_0x230e43(0x160))/0x5)+-parseInt(_0x230e43(0x164))/0x6+-parseInt(_0x230e43(0x170))/0x7+-parseInt(_0x230e43(0x161))/0x8*(parseInt(_0x230e43(0x15e))/0x9)+parseInt(_0x230e43(0x171))/0xa*(parseInt(_0x230e43(0x16a))/0xb);if(_0x188c3b===_0x5747d8)break;else _0x475e8c['push'](_0x475e8c['shift']());}catch(_0x1aa4a1){_0x475e8c['push'](_0x475e8c['shift']());}}}(a49_0x3e61,0x74734));import a49_0x41900f from'node:path';import{useCallback,useState}from'react';function a49_0x312e(_0x5d8d70,_0x502ea5){_0x5d8d70=_0x5d8d70-0x15e;const _0x3e61e6=a49_0x3e61();let _0x312e5c=_0x3e61e6[_0x5d8d70];return _0x312e5c;}import{execa}from'execa';import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';export function useFormatCode(){const _0x4e9242=a49_0x312e,[_0x121cb,_0x3235ed]=useState(![]),[_0x5943e0,_0x40afc2]=useState(![]),[_0x2d6c60,_0x80faeb]=useState(''),_0x5845f2=useCallback(async _0x37e79d=>{const _0x3cbaf0=a49_0x312e,_0x27421b=Date['now'](),_0x59e067=a49_0x41900f[_0x3cbaf0(0x16f)](process['cwd'](),_0x37e79d);_0x3235ed(!![]);try{logger[_0x3cbaf0(0x162)](_0x3cbaf0(0x173),_0x3cbaf0(0x16d),{'projectCode':_0x37e79d}),await execa(_0x3cbaf0(0x169),['prettier',_0x3cbaf0(0x167),'.'],{'cwd':_0x59e067});const _0x5c9d79=Date['now']()-_0x27421b;logger[_0x3cbaf0(0x163)]('format',_0x3cbaf0(0x16c),_0x5c9d79,{'projectCode':_0x37e79d});}catch(_0x59af3b){const _0xd9bb93=Date['now']()-_0x27421b;logger[_0x3cbaf0(0x165)]('format','代码格式化失败',{'projectCode':_0x37e79d,'error':_0x59af3b instanceof Error?_0x59af3b[_0x3cbaf0(0x172)]:String(_0x59af3b),'duration':_0xd9bb93});throw _0x59af3b;}finally{_0x3235ed(![]),_0x40afc2(!![]),_0x80faeb(formatElapsed(_0x27421b));}},[]);return{'taskName':_0x4e9242(0x16b),'finished':_0x5943e0,'loading':_0x121cb,'elapsed':_0x2d6c60,'doTask':_0x5845f2};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a50_0x3249(){const _0x3227c8=['1717508UjlUql','10555356laGMXY','resolve','success','2002555ZTqSED','安装依赖','now','157368qPAwtd','依赖安装完成','npm','3054330yYutaR','install','84itIjjC','依赖安装失败','5891008QoAEcP','cwd','https://registry.npmmirror.com','message','开始安装依赖','933999oDBxhp'];a50_0x3249=function(){return _0x3227c8;};return a50_0x3249();}(function(_0x4a637b,_0x17d2cb){const _0x220785=a50_0x2419,_0x55dddb=_0x4a637b();while(!![]){try{const _0x1bbff4=-parseInt(_0x220785(0x17b))/0x1+-parseInt(_0x220785(0x17c))/0x2+parseInt(_0x220785(0x174))/0x3*(parseInt(_0x220785(0x16f))/0x4)+parseInt(_0x220785(0x16c))/0x5+parseInt(_0x220785(0x172))/0x6+parseInt(_0x220785(0x17d))/0x7+-parseInt(_0x220785(0x176))/0x8;if(_0x1bbff4===_0x17d2cb)break;else _0x55dddb['push'](_0x55dddb['shift']());}catch(_0x1185e7){_0x55dddb['push'](_0x55dddb['shift']());}}}(a50_0x3249,0xf1ae1));import a50_0x3ca48f from'node:path';import{useCallback,useState}from'react';import{execa}from'execa';function a50_0x2419(_0x54d16f,_0x2e78bb){_0x54d16f=_0x54d16f-0x16a;const _0x324917=a50_0x3249();let _0x2419b5=_0x324917[_0x54d16f];return _0x2419b5;}import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';export function useInstallDependencies(){const _0x5e5db3=a50_0x2419,[_0x695b25,_0x25289a]=useState(![]),[_0x403f6d,_0x3e5f19]=useState(![]),[_0x3a5b9a,_0x101d61]=useState(''),_0x56c361=useCallback(async _0x43b458=>{const _0x5b8046=a50_0x2419,_0x5a13f8=Date[_0x5b8046(0x16e)](),_0x19c4a5=a50_0x3ca48f[_0x5b8046(0x16a)](process[_0x5b8046(0x177)](),_0x43b458);_0x25289a(!![]),_0x3e5f19(![]);const _0xc30e0=async(_0x4842e7,_0x45c60d)=>{await execa(_0x4842e7,_0x45c60d,{'cwd':_0x19c4a5});};try{logger['info'](_0x5b8046(0x173),_0x5b8046(0x17a),{'projectCode':_0x43b458,'registry':_0x5b8046(0x178)}),await _0xc30e0(_0x5b8046(0x171),[_0x5b8046(0x173),'--registry','https://registry.npmmirror.com']);const _0x595eaf=Date[_0x5b8046(0x16e)]()-_0x5a13f8;logger[_0x5b8046(0x16b)](_0x5b8046(0x173),_0x5b8046(0x170),_0x595eaf,{'projectCode':_0x43b458});}catch(_0x44d268){const _0x223d32=Date[_0x5b8046(0x16e)]()-_0x5a13f8;logger['error'](_0x5b8046(0x173),_0x5b8046(0x175),{'projectCode':_0x43b458,'error':_0x44d268 instanceof Error?_0x44d268[_0x5b8046(0x179)]:String(_0x44d268),'duration':_0x223d32});throw _0x44d268;}finally{_0x25289a(![]),_0x3e5f19(!![]),_0x101d61(formatElapsed(_0x5a13f8));}},[]);return{'taskName':_0x5e5db3(0x16d),'finished':_0x403f6d,'loading':_0x695b25,'elapsed':_0x3a5b9a,'doTask':_0x56c361};}
|
package/lib/help.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0xf477eb,_0x2612b3){var _0x23656a=a51_0x521b,_0x38c6f3=_0xf477eb();while(!![]){try{var _0x4f0456=-parseInt(_0x23656a(0x103))/0x1+parseInt(_0x23656a(0x107))/0x2+parseInt(_0x23656a(0x109))/0x3+parseInt(_0x23656a(0x108))/0x4+-parseInt(_0x23656a(0x102))/0x5*(-parseInt(_0x23656a(0x105))/0x6)+parseInt(_0x23656a(0x101))/0x7+-parseInt(_0x23656a(0x104))/0x8;if(_0x4f0456===_0x2612b3)break;else _0x38c6f3['push'](_0x38c6f3['shift']());}catch(_0x306aaa){_0x38c6f3['push'](_0x38c6f3['shift']());}}}(a51_0x548e,0xdbe68));function a51_0x521b(_0x206133,_0x410b09){_0x206133=_0x206133-0x100;var _0x548efa=a51_0x548e();var _0x521bf7=_0x548efa[_0x206133];return _0x521bf7;}function a51_0x548e(){var _0x5896ad=['green','7486045CoktGN','5dmbcsg','563295uSZqnu','18993152nrigMF','9894774cDymig','!\x20请指定一个有效的命令。','912256gylyhJ','1336844EYRvVd','987744jNPLZq','lovrabet\x20--help'];a51_0x548e=function(){return _0x5896ad;};return a51_0x548e();}import{jsx as a51_0x3e2322,jsxs as a51_0x40377f}from'react/jsx-runtime';import{Box,Text}from'ink';export function Help(){var _0x51b2d3=a51_0x521b;return a51_0x40377f(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[a51_0x40377f(Box,{'children':[a51_0x3e2322(Box,{'width':'1'}),a51_0x3e2322(Text,{'children':_0x51b2d3(0x106)})]}),a51_0x40377f(Box,{'marginTop':0x1,'children':[a51_0x3e2322(Box,{'width':'1'}),a51_0x40377f(Text,{'children':['\x20\x20','使用']}),a51_0x40377f(Text,{'bold':!![],'color':_0x51b2d3(0x100),'children':['\x20',_0x51b2d3(0x10a),'\x20']}),a51_0x3e2322(Text,{'children':'查看可用命令。'})]})]});}
|
package/lib/init/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a52_0x309c(){const _0x4fd82c=['应用代码用于标识您的项目,只能包含字母、数字、-\x20和\x20_','online','backspace','414031enJoZi','应用代码不合法','green','cyan','delete','应用代码长度不能超过\x20100\x20个字符','14701480GupZIT','length','AppCode:\x20','exit','✓\x20成功在当前目录初始化\x20.lovrabetrc\x20文件','97932SyeGsD','env','utf8','\x20←\x20','1260780qfaYZR','2985740gDDFUF','red','1230831CxVruP','78cSiZzH','请输入应用代码\x20(AppCode):\x20','stringify','初始化项目配置文件成功','slice','9yDuTLQ','setLogPath','return','version','现在您可以使用\x20lovrabet\x20api\x20doc\x20和\x20lovrabet\x20api\x20pull\x20等命令了','1.0.0','../..','package.json','trim','1858072tpxRiM','gray','正在初始化配置文件...','应用代码只能包含字母、数字、-\x20和\x20_','2hwxZVI','cwd','error','column','info','应用代码不能为空','ctrl','创建配置文件失败','message','创建配置文件失败:\x20'];a52_0x309c=function(){return _0x4fd82c;};return a52_0x309c();}(function(_0x52b0fd,_0x337995){const _0x4cdd66=a52_0x1aac,_0x493a7c=_0x52b0fd();while(!![]){try{const _0x1a8be3=parseInt(_0x4cdd66(0xee))/0x1*(parseInt(_0x4cdd66(0xe1))/0x2)+parseInt(_0x4cdd66(0x101))/0x3*(parseInt(_0x4cdd66(0xf9))/0x4)+parseInt(_0x4cdd66(0xfe))/0x5+parseInt(_0x4cdd66(0xfd))/0x6+-parseInt(_0x4cdd66(0x100))/0x7+parseInt(_0x4cdd66(0xdd))/0x8*(parseInt(_0x4cdd66(0x106))/0x9)+-parseInt(_0x4cdd66(0xf4))/0xa;if(_0x1a8be3===_0x337995)break;else _0x493a7c['push'](_0x493a7c['shift']());}catch(_0x54009c){_0x493a7c['push'](_0x493a7c['shift']());}}}(a52_0x309c,0x6c6f1));import{jsxs as a52_0x4ff1ac,jsx as a52_0x1f1558}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Box,Text,useInput}from'ink';function a52_0x1aac(_0x24f8e3,_0x55fb36){_0x24f8e3=_0x24f8e3-0xda;const _0x309c93=a52_0x309c();let _0x1aacca=_0x309c93[_0x24f8e3];return _0x1aacca;}import{existsSync,writeFileSync,readFileSync}from'node:fs';import{resolve,join,dirname}from'node:path';import{fileURLToPath}from'node:url';import{logger}from'../utils/logger.js';import{readConfig}from'../utils/config.js';export function Init({appcode:_0x7d1330,env:_0x26fbdd}){const _0x4da5b9=a52_0x1aac,[_0x146d02,_0x3eb3eb]=useState(null),[_0x306ebe,_0xc3edf9]=useState(![]),[_0x3d803c,_0x348780]=useState(!_0x7d1330),[_0x290150,_0x602cf4]=useState(''),[_0x4162f6,_0x248ba6]=useState(''),[_0x18d880,_0x3608fe]=useState(_0x7d1330||''),[_0x14797a]=useState(_0x26fbdd);function _0x41332a(_0x3f0d22){const _0x55a8c0=a52_0x1aac;if(_0x3f0d22['length']===0x0)return{'valid':![],'message':''};if(_0x3f0d22[_0x55a8c0(0xf5)]>0x64)return{'valid':![],'message':_0x55a8c0(0xf3)};const _0x4f14c2=/^[A-Za-z0-9_-]+$/;if(!_0x4f14c2['test'](_0x3f0d22))return{'valid':![],'message':_0x55a8c0(0xe0)};return{'valid':!![]};}useInput((_0x454ba4,_0x2c333b)=>{const _0xfd2847=a52_0x1aac;if(!_0x3d803c)return;if(_0x2c333b[_0xfd2847(0x108)]){if(_0x4162f6||!_0x290150['trim']()){_0x248ba6(_0xfd2847(0xe6));return;}const _0x31b0a8=_0x290150[_0xfd2847(0xdc)](),{valid:_0xafd2ac,message:_0x23bb73}=_0x41332a(_0x31b0a8);if(!_0xafd2ac){_0x248ba6(_0x23bb73||_0xfd2847(0xef));return;}_0x3608fe(_0x31b0a8),_0x348780(![]);}else{if(_0x2c333b[_0xfd2847(0xed)]||_0x2c333b[_0xfd2847(0xf2)])_0x602cf4(_0x47f705=>{const _0x44ee13=_0xfd2847,_0x5c2ade=_0x47f705[_0x44ee13(0x105)](0x0,-0x1);if(_0x5c2ade[_0x44ee13(0xf5)]===0x0)_0x248ba6('');else{const {valid:_0x30c655,message:_0x4300a6}=_0x41332a(_0x5c2ade);_0x248ba6(_0x30c655?'':_0x4300a6||'应用代码不合法');}return _0x5c2ade;});else _0x2c333b[_0xfd2847(0xe7)]&&_0x454ba4==='c'?process[_0xfd2847(0xf7)](0x0):_0x602cf4(_0x27c05e=>{const _0x55345f=_0xfd2847,_0xc072a=_0x27c05e+_0x454ba4,{valid:_0x51ea6,message:_0x175efa}=_0x41332a(_0xc072a);return _0x248ba6(_0x51ea6?'':_0x175efa||_0x55345f(0xef)),_0xc072a;});}},{'isActive':_0x3d803c}),useEffect(()=>{const _0x57d5d8=a52_0x1aac;if(!_0x18d880||_0x3d803c)return;const _0x421cab=resolve(process[_0x57d5d8(0xe2)](),'.lovrabetrc');if(existsSync(_0x421cab)){_0x3eb3eb('当前目录已存在\x20.lovrabetrc\x20文件'),setTimeout(()=>process[_0x57d5d8(0xf7)](0x1),0x64);return;}try{const _0x1551f8=fileURLToPath(import.meta.url),_0x2076bd=resolve(dirname(_0x1551f8),_0x57d5d8(0xda)),_0x2e1fbf=join(_0x2076bd,_0x57d5d8(0xdb));let _0x123c53=_0x57d5d8(0x10b);try{const _0x4ad5bc=JSON['parse'](readFileSync(_0x2e1fbf,_0x57d5d8(0xfb)));_0x123c53=_0x4ad5bc[_0x57d5d8(0x109)]||'1.0.0';}catch(_0x448737){}const _0x599261=readConfig(),_0x140fd8=typeof _0x599261[_0x57d5d8(0xfa)]==='string'?_0x599261['env']:undefined,{app:_0x5a87cf,appcode:_0x5c88ac,..._0x3fd6a6}=_0x599261,_0x36d823={..._0x3fd6a6,'appcode':_0x18d880,'env':_0x14797a||_0x140fd8||_0x57d5d8(0xec),'createdAt':new Date()['toLocaleString'](),'version':_0x123c53};writeFileSync(_0x421cab,JSON[_0x57d5d8(0x103)](_0x36d823,null,0x2),{'encoding':_0x57d5d8(0xfb),'mode':0x180}),logger[_0x57d5d8(0x107)](process[_0x57d5d8(0xe2)]()),logger[_0x57d5d8(0xe5)]('init',_0x57d5d8(0x104),{'appcode':_0x18d880,'env':_0x36d823[_0x57d5d8(0xfa)],'version':_0x36d823[_0x57d5d8(0x109)],'configPath':_0x421cab}),_0xc3edf9(!![]),setTimeout(()=>process[_0x57d5d8(0xf7)](0x0),0x64);}catch(_0xf4dadd){logger[_0x57d5d8(0xe3)]('init',_0x57d5d8(0xe8),{'error':_0xf4dadd instanceof Error?_0xf4dadd[_0x57d5d8(0xe9)]:String(_0xf4dadd)}),_0x3eb3eb(_0x57d5d8(0xea)+(_0xf4dadd instanceof Error?_0xf4dadd[_0x57d5d8(0xe9)]:String(_0xf4dadd))),setTimeout(()=>process['exit'](0x1),0x64);}},[_0x18d880,_0x3d803c,_0x14797a]);if(_0x146d02)return a52_0x1f1558(Box,{'flexDirection':'column','children':a52_0x4ff1ac(Text,{'color':'red','children':['✗\x20',_0x146d02]})});if(_0x3d803c)return a52_0x4ff1ac(Box,{'flexDirection':_0x4da5b9(0xe4),'children':[a52_0x4ff1ac(Box,{'children':[a52_0x1f1558(Text,{'color':_0x4da5b9(0xf1),'children':_0x4da5b9(0x102)}),_0x290150?a52_0x1f1558(Text,{'color':_0x4da5b9(0xf0),'children':_0x290150}):a52_0x1f1558(Text,{'color':_0x4da5b9(0xde),'children':'_'}),_0x4162f6&&a52_0x4ff1ac(Text,{'color':_0x4da5b9(0xff),'children':[_0x4da5b9(0xfc),_0x4162f6]})]}),!_0x4162f6&&!_0x290150&&a52_0x1f1558(Box,{'children':a52_0x1f1558(Text,{'color':_0x4da5b9(0xde),'children':_0x4da5b9(0xeb)})})]});if(_0x306ebe)return a52_0x4ff1ac(Box,{'flexDirection':_0x4da5b9(0xe4),'children':[a52_0x1f1558(Text,{'color':_0x4da5b9(0xf0),'children':_0x4da5b9(0xf8)}),a52_0x4ff1ac(Text,{'color':_0x4da5b9(0xf1),'children':[_0x4da5b9(0xf6),_0x18d880]}),a52_0x1f1558(Text,{'children':_0x4da5b9(0x10a)})]});return a52_0x1f1558(Box,{'children':a52_0x1f1558(Text,{'children':_0x4da5b9(0xdf)})});}
|
package/lib/mcp/McpInstallUI.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a53_0x2c5c33=a53_0x4435;(function(_0x3d63b8,_0x4e9f9e){const _0x2e6fae=a53_0x4435,_0x509945=_0x3d63b8();while(!![]){try{const _0x573cb7=parseInt(_0x2e6fae(0x136))/0x1+parseInt(_0x2e6fae(0x127))/0x2*(-parseInt(_0x2e6fae(0x130))/0x3)+parseInt(_0x2e6fae(0x155))/0x4*(parseInt(_0x2e6fae(0x183))/0x5)+-parseInt(_0x2e6fae(0x191))/0x6+parseInt(_0x2e6fae(0x160))/0x7*(-parseInt(_0x2e6fae(0x15a))/0x8)+-parseInt(_0x2e6fae(0x18c))/0x9+-parseInt(_0x2e6fae(0x17b))/0xa*(-parseInt(_0x2e6fae(0x15e))/0xb);if(_0x573cb7===_0x4e9f9e)break;else _0x509945['push'](_0x509945['shift']());}catch(_0x530450){_0x509945['push'](_0x509945['shift']());}}}(a53_0x4ffc,0xd19d2));import{jsx as a53_0x406ca3,jsxs as a53_0xf9a21b,Fragment as a53_0x285acc}from'react/jsx-runtime';import{useState,useEffect}from'react';function a53_0x4435(_0x234b57,_0x3ae40e){_0x234b57=_0x234b57-0x126;const _0x4ffc2f=a53_0x4ffc();let _0x443590=_0x4ffc2f[_0x234b57];return _0x443590;}import{Text,Box,useInput,useApp}from'ink';function a53_0x4ffc(){const _0x4f60f0=['add','mcp.json','Cursor','21cIcpHa','from','size','join','cyan','⚠️\x20部分配置需要手动完成','523156laltrf','配置信息:','cursor','\x22:\x20{','manual','\x20\x20✗','Claude\x20Code\x20MCP\x20命令已生成','message','has','yellow',',\x20env=','.cursor','blue','error','info','app','\x20-e\x20LOVRABET_ENV=','done','delete','mcp-install','online','\x20\x20⚠️','status','claude','gray','\x20\x20\x20\x20\x22','utf-8','agents.md','配置指引已显示','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','env','1729664ohDTOB','未找到\x20appcode\x20配置','请手动执行上述命令','创建\x20Cursor\x20Rules\x20文件','已写入\x20.cursor/mcp.json','2642504VYlNwJ','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','\x20\x20AppCode:\x20','ide','601084pKLiXj','✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc','14nSxDst','cwd','some','name','length','white','push','*\x20请选择要配置的\x20IDE:','\x20\x20\x22mcpServers\x22:\x20{','\x20\x20}','red','LOVRABET_ENV','filter','return','📚\x20详细配置指南:\x20https://help.yuntoo.com/mcp/config-guide\x0a','\x20-e\x20LOVRABET_APP_CODE=','column','配置信息:\x20appcode=','需要先配置\x20appcode','\x20\x20重启\x20Cursor\x20后生效\x0a','\x20\x20agents.md\x20已存在,跳过\x0a','configuring','npx','label','[\x20]','includes','lovrabet-dataset','430yQGddg','\x20\x20\x20\x20}','value','请至少选择一个\x20IDE','log','\x20\x20Cursor\x20Rules\x20文件已存在,跳过\x0a','../../templates/rules/lovrabet_rules.mdc.tpl','\x20\x20环境:\x20','10PxXdLu','appcode','⚠️\x20配置需要手动完成','*\x20配置\x20Lovrabet\x20MCP\x20服务器','⚠️\x20\x20未找到\x20appcode\x20配置','rules','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','Claude\x20Code\x20CLI','Cursor\x20Rules\x20模板文件不存在','4241394BSWPUF','[✓]','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','mcpServers','green','8706702Phwkmq','description','\x20\x20✓','claude\x20mcp\x20add\x20','其他\x20IDE\x20配置指引','✓\x20创建\x20agents.md\x20到项目根目录\x0a','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','lovrabet_rules.mdc','selecting','请手动执行','agents.md\x20模板文件不存在','map','复制\x20agents.md\x20文件失败','\x20\x20\x20请先运行\x20\x27lovrabet\x20init\x20--appcode\x20<your-app-code>\x27\x20初始化项目配置\x0a','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20q:\x20退出\x20Enter:\x20确认','success','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','不支持的\x20IDE:\x20','✓\x20已写入\x20.cursor/mcp.json','84598Wqgscq','@lovrabet/dataset-mcp-server@latest','upArrow','indexOf','warn','其他\x20IDE\x20配置指引已显示'];a53_0x4ffc=function(){return _0x4f60f0;};return a53_0x4ffc();}import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{join,resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';const __dirname=dirname(fileURLToPath(import.meta.url)),IDE_CONFIGS={'cursor':{'name':a53_0x2c5c33(0x12f),'description':'Cursor\x20IDE'},'claude':{'name':'Claude\x20Code','description':a53_0x2c5c33(0x18a)},'other':{'name':'其他\x20IDE','description':a53_0x2c5c33(0x195)}},IDE_LIST=[a53_0x2c5c33(0x138),a53_0x2c5c33(0x14d),'other'],MCP_SERVER_NAME=a53_0x2c5c33(0x17a),MCP_COMMAND=a53_0x2c5c33(0x176),MCP_ARGS=[a53_0x2c5c33(0x128)];export function McpInstallUI({preselectedIDEs:preselectedIDEs=[]}){const _0x4088f2=a53_0x2c5c33,{exit:_0x82225e}=useApp(),[_0x486441,_0x43e46a]=useState('selecting'),[_0x4b3ac,_0x3fb134]=useState(new Set(preselectedIDEs[_0x4088f2(0x19c)](_0x356b94=>IDE_LIST[_0x4088f2(0x12a)](_0x356b94))[_0x4088f2(0x16c)](_0x17fc5c=>_0x17fc5c>=0x0))),[_0x57b1c7,_0x366652]=useState(0x0),[_0x355ccc,_0x51ad5f]=useState([]),[_0x496c12,_0x1fc9fd]=useState([]),[_0x778363,_0x117ae6]=useState('');useEffect(()=>{const _0x409a4e=_0x4088f2;preselectedIDEs[_0x409a4e(0x164)]>0x0&&_0x4b3ac['size']>0x0&&_0x29dafe();},[]),useInput((_0x221bca,_0x471edc)=>{const _0x17b31e=_0x4088f2;if(_0x486441===_0x17b31e(0x199)){if(_0x471edc[_0x17b31e(0x129)]){_0x366652(_0x556f6f=>_0x556f6f>0x0?_0x556f6f-0x1:IDE_LIST[_0x17b31e(0x164)]-0x1);return;}if(_0x471edc['downArrow']){_0x366652(_0x238428=>_0x238428<IDE_LIST[_0x17b31e(0x164)]-0x1?_0x238428+0x1:0x0);return;}if(_0x221bca==='\x20'){_0x3fb134(_0x508911=>{const _0x295e35=_0x17b31e,_0x4cf846=new Set(_0x508911);return _0x4cf846[_0x295e35(0x13e)](_0x57b1c7)?_0x4cf846[_0x295e35(0x148)](_0x57b1c7):_0x4cf846['add'](_0x57b1c7),_0x4cf846;});return;}if(_0x221bca==='a'||_0x221bca==='A'){_0x3fb134(new Set(IDE_LIST[_0x17b31e(0x19c)]((_0x4b5899,_0x185b9d)=>_0x185b9d)));return;}if(_0x221bca==='i'||_0x221bca==='I'||_0x221bca==='r'||_0x221bca==='R'){_0x3fb134(_0x2a7aa4=>{const _0x8ea413=_0x17b31e,_0x43df5d=new Set();for(let _0x4b7c7a=0x0;_0x4b7c7a<IDE_LIST[_0x8ea413(0x164)];_0x4b7c7a++){!_0x2a7aa4['has'](_0x4b7c7a)&&_0x43df5d[_0x8ea413(0x12d)](_0x4b7c7a);}return _0x43df5d;});return;}if(_0x221bca==='q'||_0x221bca==='Q'){_0x82225e();return;}if(_0x471edc[_0x17b31e(0x16d)]){if(_0x4b3ac['size']===0x0){_0x117ae6(_0x17b31e(0x17e));return;}_0x29dafe();return;}}if(_0x486441===_0x17b31e(0x147)){_0x82225e();return;}});async function _0x29dafe(){const _0x2ddb78=_0x4088f2,_0x142825=Array[_0x2ddb78(0x131)](_0x4b3ac)[_0x2ddb78(0x19c)](_0x2f7ba4=>IDE_LIST[_0x2f7ba4])[_0x2ddb78(0x16c)](_0x374480=>_0x374480!==undefined);_0x51ad5f([{'label':'已选择\x20IDE','value':_0x4b3ac[_0x2ddb78(0x132)]+'\x20个'}]),_0x43e46a(_0x2ddb78(0x175));const _0x2c30cc=[];for(const _0x2bc82d of _0x142825){try{const _0x24975a=await configureMcp(_0x2bc82d),_0x3a5907=_0x24975a[_0x2ddb78(0x179)](_0x2ddb78(0x19a));_0x2c30cc[_0x2ddb78(0x166)]({'ide':IDE_CONFIGS[_0x2bc82d][_0x2ddb78(0x163)],'status':_0x3a5907?_0x2ddb78(0x13a):_0x2ddb78(0x1a0),'message':_0x24975a});}catch(_0x32634c){_0x2c30cc[_0x2ddb78(0x166)]({'ide':IDE_CONFIGS[_0x2bc82d][_0x2ddb78(0x163)],'status':_0x2ddb78(0x143),'message':_0x32634c instanceof Error?_0x32634c[_0x2ddb78(0x13d)]:String(_0x32634c)});}}_0x1fc9fd(_0x2c30cc),_0x43e46a(_0x2ddb78(0x147)),setTimeout(()=>{_0x82225e();},0x1388);}return a53_0xf9a21b(Box,{'flexDirection':_0x4088f2(0x170),'marginTop':0x1,'children':[_0x486441===_0x4088f2(0x199)&&a53_0xf9a21b(a53_0x285acc,{'children':[a53_0x406ca3(Box,{'children':a53_0x406ca3(Text,{'color':_0x4088f2(0x134),'children':_0x4088f2(0x186)})}),_0x778363&&a53_0x406ca3(Box,{'marginTop':0x1,'children':a53_0xf9a21b(Text,{'color':_0x4088f2(0x16a),'children':['✗\x20',_0x778363]})}),a53_0xf9a21b(Box,{'marginTop':0x1,'flexDirection':_0x4088f2(0x170),'children':[a53_0x406ca3(Text,{'bold':!![],'children':_0x4088f2(0x167)}),IDE_LIST[_0x4088f2(0x19c)]((_0x44eb01,_0x29e5b2)=>{const _0x154e36=_0x4088f2,_0x5a95e0=_0x57b1c7===_0x29e5b2,_0x49d565=_0x4b3ac[_0x154e36(0x13e)](_0x29e5b2);return a53_0x406ca3(Box,{'children':a53_0xf9a21b(Text,{'backgroundColor':_0x5a95e0?_0x154e36(0x142):undefined,'color':_0x5a95e0?'white':undefined,'children':['\x20\x20',_0x49d565?_0x154e36(0x18d):_0x154e36(0x178),'\x20',IDE_CONFIGS[_0x44eb01][_0x154e36(0x163)],'\x20',a53_0xf9a21b(Text,{'color':_0x5a95e0?_0x154e36(0x165):_0x154e36(0x14e),'dimColor':!_0x5a95e0,'children':['-\x20',IDE_CONFIGS[_0x44eb01][_0x154e36(0x192)]]})]})},_0x44eb01);}),a53_0x406ca3(Box,{'marginTop':0x1,'children':a53_0xf9a21b(Text,{'color':_0x4088f2(0x14e),'children':['\x20',_0x4088f2(0x19f)]})})]})]}),_0x486441===_0x4088f2(0x175)&&a53_0xf9a21b(a53_0x285acc,{'children':[_0x355ccc[_0x4088f2(0x19c)]((_0x537953,_0x49424d)=>a53_0xf9a21b(Box,{'children':[a53_0xf9a21b(Text,{'color':_0x4088f2(0x190),'children':['√\x20',_0x537953[_0x4088f2(0x177)],':\x20']}),a53_0x406ca3(Text,{'color':_0x4088f2(0x134),'children':_0x537953[_0x4088f2(0x17d)]})]},_0x49424d)),a53_0x406ca3(Box,{'marginTop':0x1,'children':a53_0x406ca3(Text,{'children':'正在配置\x20MCP\x20服务器...'})})]}),_0x486441===_0x4088f2(0x147)&&a53_0xf9a21b(a53_0x285acc,{'children':[a53_0x406ca3(Box,{'children':_0x496c12['every'](_0x220356=>_0x220356['status']===_0x4088f2(0x1a0))?a53_0x406ca3(Text,{'color':'green','children':'✓\x20MCP\x20配置完成!'}):_0x496c12[_0x4088f2(0x162)](_0x64585d=>_0x64585d[_0x4088f2(0x14c)]==='success')?a53_0x406ca3(Text,{'color':'yellow','children':_0x4088f2(0x135)}):a53_0x406ca3(Text,{'color':'yellow','children':_0x4088f2(0x185)})}),_0x496c12[_0x4088f2(0x19c)]((_0x78430e,_0x527aa3)=>a53_0xf9a21b(Box,{'children':[a53_0xf9a21b(Text,{'color':_0x78430e[_0x4088f2(0x14c)]===_0x4088f2(0x1a0)?'green':_0x78430e[_0x4088f2(0x14c)]===_0x4088f2(0x13a)?_0x4088f2(0x13f):_0x4088f2(0x16a),'children':[_0x78430e[_0x4088f2(0x14c)]===_0x4088f2(0x1a0)?_0x4088f2(0x193):_0x78430e['status']===_0x4088f2(0x13a)?_0x4088f2(0x14b):_0x4088f2(0x13b),'\x20',_0x78430e[_0x4088f2(0x15d)],':','\x20']}),a53_0x406ca3(Text,{'color':_0x78430e['status']==='success'?'white':_0x78430e[_0x4088f2(0x14c)]===_0x4088f2(0x13a)?_0x4088f2(0x13f):_0x4088f2(0x16a),'children':_0x78430e[_0x4088f2(0x13d)]})]},_0x527aa3)),a53_0x406ca3(Box,{'marginTop':0x1,'children':a53_0x406ca3(Text,{'color':_0x4088f2(0x14e),'children':'按任意键退出...'})})]})]});}async function configureMcp(_0x413a2e){const _0x16baea=a53_0x2c5c33;switch(_0x413a2e){case _0x16baea(0x138):return await configureCursorMcp();case _0x16baea(0x14d):return await configureClaudeMcp();case'other':return await showOtherGuide();default:throw new Error(_0x16baea(0x1a2)+_0x413a2e);}}async function configureCursorMcp(){const _0x31f5e3=a53_0x2c5c33,_0x33ae0e=readConfig(),_0x554838=_0x33ae0e[_0x31f5e3(0x184)]||_0x33ae0e[_0x31f5e3(0x145)],_0x14b5b5=_0x33ae0e[_0x31f5e3(0x154)]||'online';if(!_0x554838)return console[_0x31f5e3(0x17f)](_0x31f5e3(0x187)),console[_0x31f5e3(0x17f)]('\x20\x20\x20请先运行\x20\x27lovrabet\x20init\x20--appcode\x20<your-app-code>\x27\x20初始化项目配置\x0a'),logger[_0x31f5e3(0x12b)](_0x31f5e3(0x149),_0x31f5e3(0x156)),_0x31f5e3(0x172);const _0x5e5fcb={'LOVRABET_APP_CODE':String(_0x554838)};_0x14b5b5!==_0x31f5e3(0x14a)&&(_0x5e5fcb[_0x31f5e3(0x16b)]=String(_0x14b5b5));const _0x59ecd2={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x5e5fcb},_0x1e30ed=join(process[_0x31f5e3(0x161)](),_0x31f5e3(0x141),_0x31f5e3(0x12e)),_0x4506c1=join(process['cwd'](),'.cursor');!existsSync(_0x4506c1)&&mkdirSync(_0x4506c1,{'recursive':!![]});let _0x25c096={'mcpServers':{}};if(existsSync(_0x1e30ed))try{const _0x27263b=readFileSync(_0x1e30ed,'utf-8');_0x25c096=JSON['parse'](_0x27263b);}catch{}(!_0x25c096['mcpServers']||typeof _0x25c096[_0x31f5e3(0x18f)]!=='object')&&(_0x25c096[_0x31f5e3(0x18f)]={});_0x25c096['mcpServers'][MCP_SERVER_NAME]=_0x59ecd2,writeFileSync(_0x1e30ed,JSON['stringify'](_0x25c096,null,0x2),_0x31f5e3(0x150)),logger[_0x31f5e3(0x144)]('mcp-install','Cursor\x20MCP\x20配置成功',{'appcode':_0x554838,'env':_0x14b5b5,'path':_0x1e30ed}),console[_0x31f5e3(0x17f)](_0x31f5e3(0x126)),console[_0x31f5e3(0x17f)](_0x31f5e3(0x15c)+_0x554838);_0x14b5b5!=='online'&&console[_0x31f5e3(0x17f)](_0x31f5e3(0x182)+_0x14b5b5);console[_0x31f5e3(0x17f)](_0x31f5e3(0x173));const _0x3acbad=join(_0x4506c1,_0x31f5e3(0x188)),_0x3946cc=join(_0x3acbad,_0x31f5e3(0x198));if(!existsSync(_0x3946cc))try{!existsSync(_0x3acbad)&&mkdirSync(_0x3acbad,{'recursive':!![]});const _0x5997c9=resolve(__dirname,_0x31f5e3(0x181));existsSync(_0x5997c9)?(copyFileSync(_0x5997c9,_0x3946cc),logger[_0x31f5e3(0x144)](_0x31f5e3(0x149),_0x31f5e3(0x158),{'from':_0x5997c9,'to':_0x3946cc}),console[_0x31f5e3(0x17f)](_0x31f5e3(0x15f))):logger['warn'](_0x31f5e3(0x149),_0x31f5e3(0x18b),{'templatePath':_0x5997c9});}catch(_0x5a23cb){logger[_0x31f5e3(0x143)](_0x31f5e3(0x149),'复制\x20Cursor\x20Rules\x20文件失败',{'error':_0x5a23cb instanceof Error?_0x5a23cb[_0x31f5e3(0x13d)]:String(_0x5a23cb)});}else console[_0x31f5e3(0x17f)](_0x31f5e3(0x180));return _0x31f5e3(0x159);}async function configureClaudeMcp(){const _0xad6858=a53_0x2c5c33,_0x4feba0=readConfig(),_0x2ccee4=_0x4feba0['appcode']||_0x4feba0[_0xad6858(0x145)],_0x123486=_0x4feba0['env']||'online';if(!_0x2ccee4)return console[_0xad6858(0x17f)]('⚠️\x20\x20未找到\x20appcode\x20配置'),console['log'](_0xad6858(0x19e)),logger[_0xad6858(0x12b)](_0xad6858(0x149),_0xad6858(0x156)),_0xad6858(0x172);let _0x109eac=_0xad6858(0x194)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0xad6858(0x133)]('\x20')+_0xad6858(0x16f)+_0x2ccee4;_0x123486!==_0xad6858(0x14a)&&(_0x109eac+=_0xad6858(0x146)+_0x123486);console[_0xad6858(0x17f)](_0xad6858(0x18e)),console[_0xad6858(0x17f)]('\x20\x20'+_0x109eac+'\x0a'),console['log'](_0xad6858(0x137)),console[_0xad6858(0x17f)](_0xad6858(0x15c)+_0x2ccee4);_0x123486!==_0xad6858(0x14a)&&console[_0xad6858(0x17f)](_0xad6858(0x182)+_0x123486);console[_0xad6858(0x17f)](_0xad6858(0x15b)),logger[_0xad6858(0x144)](_0xad6858(0x149),_0xad6858(0x13c),{'command':_0x109eac,'appcode':_0x2ccee4,'env':_0x123486});const _0x10b66c=join(process[_0xad6858(0x161)](),_0xad6858(0x151));if(!existsSync(_0x10b66c))try{const _0x3bc00b=resolve(__dirname,_0xad6858(0x181));if(existsSync(_0x3bc00b)){const _0x3a7c80=readFileSync(_0x3bc00b,_0xad6858(0x150));writeFileSync(_0x10b66c,_0x3a7c80,_0xad6858(0x150)),logger[_0xad6858(0x144)](_0xad6858(0x149),'创建\x20agents.md\x20文件',{'from':_0x3bc00b,'to':_0x10b66c}),console[_0xad6858(0x17f)](_0xad6858(0x196));}else logger[_0xad6858(0x12b)](_0xad6858(0x149),_0xad6858(0x19b),{'templatePath':_0x3bc00b});}catch(_0x1d76bc){logger[_0xad6858(0x143)](_0xad6858(0x149),_0xad6858(0x19d),{'error':_0x1d76bc instanceof Error?_0x1d76bc[_0xad6858(0x13d)]:String(_0x1d76bc)});}else console['log'](_0xad6858(0x174));return _0xad6858(0x157);}async function showOtherGuide(){const _0x1b76b7=a53_0x2c5c33,_0x3429af=readConfig(),_0x1c48a0=_0x3429af[_0x1b76b7(0x184)]||_0x3429af[_0x1b76b7(0x145)],_0x3fda50=_0x3429af[_0x1b76b7(0x154)]||_0x1b76b7(0x14a);if(!_0x1c48a0)return console[_0x1b76b7(0x17f)](_0x1b76b7(0x187)),console['log'](_0x1b76b7(0x19e)),logger[_0x1b76b7(0x12b)]('mcp-install',_0x1b76b7(0x156)),_0x1b76b7(0x172);return console[_0x1b76b7(0x17f)]('\x0a📋\x20Lovrabet\x20MCP\x20服务器配置\x0a'),console[_0x1b76b7(0x17f)](_0x1b76b7(0x171)+_0x1c48a0+_0x1b76b7(0x140)+_0x3fda50+'\x0a'),console['log']('{'),console[_0x1b76b7(0x17f)](_0x1b76b7(0x168)),console[_0x1b76b7(0x17f)](_0x1b76b7(0x14f)+MCP_SERVER_NAME+_0x1b76b7(0x139)),console['log']('\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22'+MCP_COMMAND+'\x22,'),console['log'](_0x1b76b7(0x1a1)+MCP_ARGS['map'](_0x1ec53a=>'\x22'+_0x1ec53a+'\x22')['join'](',\x20')+'],'),console['log'](_0x1b76b7(0x189)),console[_0x1b76b7(0x17f)](_0x1b76b7(0x153)+_0x1c48a0+'\x22,'),_0x3fda50!==_0x1b76b7(0x14a)&&console[_0x1b76b7(0x17f)](_0x1b76b7(0x197)+_0x3fda50+'\x22,'),console[_0x1b76b7(0x17f)]('\x20\x20\x20\x20\x20\x20}'),console['log'](_0x1b76b7(0x17c)),console[_0x1b76b7(0x17f)](_0x1b76b7(0x169)),console[_0x1b76b7(0x17f)]('}\x0a'),console[_0x1b76b7(0x17f)](_0x1b76b7(0x16e)),logger[_0x1b76b7(0x144)]('mcp-install',_0x1b76b7(0x12c),{'appcode':_0x1c48a0,'env':_0x3fda50}),_0x1b76b7(0x152);}
|
|
1
|
+
const a53_0x118ca4=a53_0x51a0;function a53_0x5f55(){const _0x3f7280=['message','\x20\x20\x20\x20\x22','1505786mbFnjV','npx','agents.md','configuring','⚠️\x20\x20未找到\x20appcode\x20配置','done','upArrow','red','app','✓\x20已写入\x20.cursor/mcp.json','\x20\x20}','Claude\x20Code','every','downArrow','19180746MJEsqv','return','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','utf-8','other','6676943zGUwgW','配置信息:','3575520cPidzG','column','has','@lovrabet/dataset-mcp-server@latest','Claude\x20Code\x20CLI','../../templates/rules/lovrabet_rules.mdc.tpl','\x20\x20\x20请先运行\x20\x27lovrabet\x20init\x20--appcode\x20<your-app-code>\x27\x20初始化项目配置\x0a','\x20\x20⚠️','warn','mcp.json','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','复制\x20Cursor\x20Rules\x20文件失败','请手动执行上述命令','\x22:\x20{','配置信息:\x20appcode=','195bjcwIY','✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc','info','2925072rAllXU','name','yellow','filter','rules','selecting','cyan','delete','复制\x20agents.md\x20文件失败','正在配置\x20MCP\x20服务器...','size','按任意键退出...','\x20\x20\x20\x20\x20\x20}','配置指引已显示','*\x20请选择要配置的\x20IDE:','indexOf','appcode','lovrabet-dataset','\x20\x20✓','mcp-install','claude','需要先配置\x20appcode','add','log','其他\x20IDE\x20配置指引已显示','LOVRABET_ENV','parse','env','lovrabet_rules.mdc','\x20\x20AppCode:\x20','↑/↓:\x20移动光标\x20空格:\x20切换选中\x20a:\x20全选\x20i/r:\x20反选\x20q:\x20退出\x20Enter:\x20确认',',\x20env=','manual','已写入\x20.cursor/mcp.json','gray','\x20\x20环境:\x20','\x20\x20重启\x20Cursor\x20后生效\x0a','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','join','已选择\x20IDE','\x20\x20Cursor\x20Rules\x20文件已存在,跳过\x0a','cwd','[\x20]','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','description','length','mcpServers','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','9956FQINYb','\x20-e\x20LOVRABET_ENV=','⚠️\x20部分配置需要手动完成','white','Claude\x20Code\x20MCP\x20命令已生成','includes','\x20\x20agents.md\x20已存在,跳过\x0a','\x0a📋\x20Lovrabet\x20MCP\x20服务器配置\x0a','创建\x20agents.md\x20文件','Cursor\x20Rules\x20模板文件不存在','✓\x20创建\x20agents.md\x20到项目根目录\x0a','请手动执行','.cursor','green','error','其他\x20IDE','map','ide','未找到\x20appcode\x20配置','3410271MSdqHM','push','claude\x20mcp\x20add\x20','success','online','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','agents.md\x20模板文件不存在','1yPvxZM','📚\x20详细配置指南:\x20https://help.yuntoo.com/mcp/config-guide\x0a','cursor','\x20\x20\x22mcpServers\x22:\x20{','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','Cursor','some','status','不支持的\x20IDE:\x20','✓\x20MCP\x20配置完成!'];a53_0x5f55=function(){return _0x3f7280;};return a53_0x5f55();}(function(_0x4b64dc,_0x45aa79){const _0x390850=a53_0x51a0,_0x29f0d9=_0x4b64dc();while(!![]){try{const _0x2e31e3=-parseInt(_0x390850(0xe3))/0x1*(-parseInt(_0x390850(0xef))/0x2)+-parseInt(_0x390850(0xdc))/0x3+-parseInt(_0x390850(0x146))/0x4*(parseInt(_0x390850(0x113))/0x5)+-parseInt(_0x390850(0x116))/0x6+-parseInt(_0x390850(0x102))/0x7+parseInt(_0x390850(0x104))/0x8+parseInt(_0x390850(0xfd))/0x9;if(_0x2e31e3===_0x45aa79)break;else _0x29f0d9['push'](_0x29f0d9['shift']());}catch(_0x344e4f){_0x29f0d9['push'](_0x29f0d9['shift']());}}}(a53_0x5f55,0xa01de));import{jsx as a53_0x19a9a2,jsxs as a53_0x275275,Fragment as a53_0x5b3226}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput,useApp}from'ink';import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{join,resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';function a53_0x51a0(_0x2a0208,_0x138709){_0x2a0208=_0x2a0208-0xd8;const _0x5f5539=a53_0x5f55();let _0x51a0ef=_0x5f5539[_0x2a0208];return _0x51a0ef;}import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';const __dirname=dirname(fileURLToPath(import.meta.url)),IDE_CONFIGS={'cursor':{'name':a53_0x118ca4(0xe8),'description':'Cursor\x20IDE'},'claude':{'name':a53_0x118ca4(0xfa),'description':a53_0x118ca4(0x108)},'other':{'name':a53_0x118ca4(0xd8),'description':'其他\x20IDE\x20配置指引'}},IDE_LIST=[a53_0x118ca4(0xe5),'claude',a53_0x118ca4(0x101)],MCP_SERVER_NAME=a53_0x118ca4(0x127),MCP_COMMAND=a53_0x118ca4(0xf0),MCP_ARGS=[a53_0x118ca4(0x107)];export function McpInstallUI({preselectedIDEs:preselectedIDEs=[]}){const _0x372885=a53_0x118ca4,{exit:_0x2cdc05}=useApp(),[_0x5e5bce,_0x5a1dd6]=useState(_0x372885(0x11b)),[_0x180e48,_0x16a7de]=useState(new Set(preselectedIDEs[_0x372885(0xd9)](_0x17710c=>IDE_LIST[_0x372885(0x125)](_0x17710c))[_0x372885(0x119)](_0xdb866=>_0xdb866>=0x0))),[_0x301999,_0x3a4826]=useState(0x0),[_0x43090a,_0x21f037]=useState([]),[_0x3437f4,_0x2c326e]=useState([]),[_0x3c6f04,_0xf6e3f3]=useState('');useEffect(()=>{const _0x2ec654=_0x372885;preselectedIDEs[_0x2ec654(0x143)]>0x0&&_0x180e48[_0x2ec654(0x120)]>0x0&&_0x50f831();},[]),useInput((_0x149236,_0x380da0)=>{const _0x3f417f=_0x372885;if(_0x5e5bce===_0x3f417f(0x11b)){if(_0x380da0[_0x3f417f(0xf5)]){_0x3a4826(_0x3f8887=>_0x3f8887>0x0?_0x3f8887-0x1:IDE_LIST[_0x3f417f(0x143)]-0x1);return;}if(_0x380da0[_0x3f417f(0xfc)]){_0x3a4826(_0x38791d=>_0x38791d<IDE_LIST[_0x3f417f(0x143)]-0x1?_0x38791d+0x1:0x0);return;}if(_0x149236==='\x20'){_0x16a7de(_0x1bfdcb=>{const _0x46ffb3=_0x3f417f,_0x456b68=new Set(_0x1bfdcb);return _0x456b68[_0x46ffb3(0x106)](_0x301999)?_0x456b68[_0x46ffb3(0x11d)](_0x301999):_0x456b68[_0x46ffb3(0x12c)](_0x301999),_0x456b68;});return;}if(_0x149236==='a'||_0x149236==='A'){_0x16a7de(new Set(IDE_LIST[_0x3f417f(0xd9)]((_0x135543,_0xfac4df)=>_0xfac4df)));return;}if(_0x149236==='i'||_0x149236==='I'||_0x149236==='r'||_0x149236==='R'){_0x16a7de(_0x4fe4d5=>{const _0x59f67a=_0x3f417f,_0x30006b=new Set();for(let _0x2dd9d4=0x0;_0x2dd9d4<IDE_LIST[_0x59f67a(0x143)];_0x2dd9d4++){!_0x4fe4d5['has'](_0x2dd9d4)&&_0x30006b[_0x59f67a(0x12c)](_0x2dd9d4);}return _0x30006b;});return;}if(_0x149236==='q'||_0x149236==='Q'){_0x2cdc05();return;}if(_0x380da0[_0x3f417f(0xfe)]){if(_0x180e48[_0x3f417f(0x120)]===0x0){_0xf6e3f3('请至少选择一个\x20IDE');return;}_0x50f831();return;}}if(_0x5e5bce===_0x3f417f(0xf4)){_0x2cdc05();return;}});async function _0x50f831(){const _0x4c6de4=_0x372885,_0x4e511d=Array['from'](_0x180e48)[_0x4c6de4(0xd9)](_0x1b8b33=>IDE_LIST[_0x1b8b33])[_0x4c6de4(0x119)](_0xa964b9=>_0xa964b9!==undefined);_0x21f037([{'label':_0x4c6de4(0x13d),'value':_0x180e48[_0x4c6de4(0x120)]+'\x20个'}]),_0x5a1dd6(_0x4c6de4(0xf2));const _0x51bcac=[];for(const _0x5f260e of _0x4e511d){try{const _0x592747=await configureMcp(_0x5f260e),_0x3c8a8f=_0x592747[_0x4c6de4(0x14b)](_0x4c6de4(0x151));_0x51bcac[_0x4c6de4(0xdd)]({'ide':IDE_CONFIGS[_0x5f260e]['name'],'status':_0x3c8a8f?_0x4c6de4(0x136):_0x4c6de4(0xdf),'message':_0x592747});}catch(_0x509c2){_0x51bcac[_0x4c6de4(0xdd)]({'ide':IDE_CONFIGS[_0x5f260e][_0x4c6de4(0x117)],'status':_0x4c6de4(0x154),'message':_0x509c2 instanceof Error?_0x509c2[_0x4c6de4(0xed)]:String(_0x509c2)});}}_0x2c326e(_0x51bcac),_0x5a1dd6(_0x4c6de4(0xf4)),setTimeout(()=>{_0x2cdc05();},0x1388);}return a53_0x275275(Box,{'flexDirection':_0x372885(0x105),'marginTop':0x1,'children':[_0x5e5bce===_0x372885(0x11b)&&a53_0x275275(a53_0x5b3226,{'children':[a53_0x19a9a2(Box,{'children':a53_0x19a9a2(Text,{'color':_0x372885(0x11c),'children':'*\x20配置\x20Lovrabet\x20MCP\x20服务器'})}),_0x3c6f04&&a53_0x19a9a2(Box,{'marginTop':0x1,'children':a53_0x275275(Text,{'color':_0x372885(0xf6),'children':['✗\x20',_0x3c6f04]})}),a53_0x275275(Box,{'marginTop':0x1,'flexDirection':_0x372885(0x105),'children':[a53_0x19a9a2(Text,{'bold':!![],'children':_0x372885(0x124)}),IDE_LIST['map']((_0xf5f087,_0x37162e)=>{const _0x551fbb=_0x372885,_0x51b484=_0x301999===_0x37162e,_0x29958f=_0x180e48['has'](_0x37162e);return a53_0x19a9a2(Box,{'children':a53_0x275275(Text,{'backgroundColor':_0x51b484?'blue':undefined,'color':_0x51b484?'white':undefined,'children':['\x20\x20',_0x29958f?'[✓]':_0x551fbb(0x140),'\x20',IDE_CONFIGS[_0xf5f087][_0x551fbb(0x117)],'\x20',a53_0x275275(Text,{'color':_0x51b484?_0x551fbb(0x149):'gray','dimColor':!_0x51b484,'children':['-\x20',IDE_CONFIGS[_0xf5f087][_0x551fbb(0x142)]]})]})},_0xf5f087);}),a53_0x19a9a2(Box,{'marginTop':0x1,'children':a53_0x275275(Text,{'color':_0x372885(0x138),'children':['\x20',_0x372885(0x134)]})})]})]}),_0x5e5bce==='configuring'&&a53_0x275275(a53_0x5b3226,{'children':[_0x43090a['map']((_0xe2bd8d,_0x4f801e)=>a53_0x275275(Box,{'children':[a53_0x275275(Text,{'color':_0x372885(0x153),'children':['√\x20',_0xe2bd8d['label'],':\x20']}),a53_0x19a9a2(Text,{'color':_0x372885(0x11c),'children':_0xe2bd8d['value']})]},_0x4f801e)),a53_0x19a9a2(Box,{'marginTop':0x1,'children':a53_0x19a9a2(Text,{'children':_0x372885(0x11f)})})]}),_0x5e5bce==='done'&&a53_0x275275(a53_0x5b3226,{'children':[a53_0x19a9a2(Box,{'children':_0x3437f4[_0x372885(0xfb)](_0x5a4e6d=>_0x5a4e6d[_0x372885(0xea)]==='success')?a53_0x19a9a2(Text,{'color':'green','children':_0x372885(0xec)}):_0x3437f4[_0x372885(0xe9)](_0x45540e=>_0x45540e[_0x372885(0xea)]==='success')?a53_0x19a9a2(Text,{'color':'yellow','children':_0x372885(0x148)}):a53_0x19a9a2(Text,{'color':_0x372885(0x118),'children':'⚠️\x20配置需要手动完成'})}),_0x3437f4[_0x372885(0xd9)]((_0x20d859,_0x27815c)=>a53_0x275275(Box,{'children':[a53_0x275275(Text,{'color':_0x20d859[_0x372885(0xea)]===_0x372885(0xdf)?_0x372885(0x153):_0x20d859['status']==='manual'?_0x372885(0x118):'red','children':[_0x20d859[_0x372885(0xea)]==='success'?_0x372885(0x128):_0x20d859[_0x372885(0xea)]===_0x372885(0x136)?_0x372885(0x10b):'\x20\x20✗','\x20',_0x20d859[_0x372885(0xda)],':','\x20']}),a53_0x19a9a2(Text,{'color':_0x20d859['status']===_0x372885(0xdf)?_0x372885(0x149):_0x20d859[_0x372885(0xea)]===_0x372885(0x136)?_0x372885(0x118):_0x372885(0xf6),'children':_0x20d859[_0x372885(0xed)]})]},_0x27815c)),a53_0x19a9a2(Box,{'marginTop':0x1,'children':a53_0x19a9a2(Text,{'color':_0x372885(0x138),'children':_0x372885(0x121)})})]})]});}async function configureMcp(_0x280e9c){const _0x22095d=a53_0x118ca4;switch(_0x280e9c){case _0x22095d(0xe5):return await configureCursorMcp();case _0x22095d(0x12a):return await configureClaudeMcp();case'other':return await showOtherGuide();default:throw new Error(_0x22095d(0xeb)+_0x280e9c);}}async function configureCursorMcp(){const _0x537b56=a53_0x118ca4,_0x4e4e69=readConfig(),_0x1042b5=_0x4e4e69[_0x537b56(0x126)]||_0x4e4e69[_0x537b56(0xf7)],_0x1212fb=_0x4e4e69[_0x537b56(0x131)]||_0x537b56(0xe0);if(!_0x1042b5)return console[_0x537b56(0x12d)](_0x537b56(0xf3)),console[_0x537b56(0x12d)](_0x537b56(0x10a)),logger[_0x537b56(0x10c)](_0x537b56(0x129),_0x537b56(0xdb)),_0x537b56(0x12b);const _0x2c726f={'LOVRABET_APP_CODE':String(_0x1042b5)};_0x1212fb!==_0x537b56(0xe0)&&(_0x2c726f[_0x537b56(0x12f)]=String(_0x1212fb));const _0x572fd7={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x2c726f},_0x15f29b=join(process['cwd'](),_0x537b56(0x152),_0x537b56(0x10d)),_0x3a206f=join(process[_0x537b56(0x13f)](),_0x537b56(0x152));!existsSync(_0x3a206f)&&mkdirSync(_0x3a206f,{'recursive':!![]});let _0x260b9d={'mcpServers':{}};if(existsSync(_0x15f29b))try{const _0x5c572c=readFileSync(_0x15f29b,_0x537b56(0x100));_0x260b9d=JSON[_0x537b56(0x130)](_0x5c572c);}catch{}(!_0x260b9d['mcpServers']||typeof _0x260b9d[_0x537b56(0x144)]!=='object')&&(_0x260b9d['mcpServers']={});_0x260b9d[_0x537b56(0x144)][MCP_SERVER_NAME]=_0x572fd7,writeFileSync(_0x15f29b,JSON['stringify'](_0x260b9d,null,0x2),_0x537b56(0x100)),logger['info']('mcp-install','Cursor\x20MCP\x20配置成功',{'appcode':_0x1042b5,'env':_0x1212fb,'path':_0x15f29b}),console['log'](_0x537b56(0xf8)),console['log'](_0x537b56(0x133)+_0x1042b5);_0x1212fb!=='online'&&console[_0x537b56(0x12d)](_0x537b56(0x139)+_0x1212fb);console['log'](_0x537b56(0x13a));const _0x4932f1=join(_0x3a206f,_0x537b56(0x11a)),_0x34eec0=join(_0x4932f1,_0x537b56(0x132));if(!existsSync(_0x34eec0))try{!existsSync(_0x4932f1)&&mkdirSync(_0x4932f1,{'recursive':!![]});const _0xa98b3f=resolve(__dirname,_0x537b56(0x109));existsSync(_0xa98b3f)?(copyFileSync(_0xa98b3f,_0x34eec0),logger[_0x537b56(0x115)]('mcp-install','创建\x20Cursor\x20Rules\x20文件',{'from':_0xa98b3f,'to':_0x34eec0}),console[_0x537b56(0x12d)](_0x537b56(0x114))):logger[_0x537b56(0x10c)](_0x537b56(0x129),_0x537b56(0x14f),{'templatePath':_0xa98b3f});}catch(_0x12f136){logger[_0x537b56(0x154)](_0x537b56(0x129),_0x537b56(0x10f),{'error':_0x12f136 instanceof Error?_0x12f136[_0x537b56(0xed)]:String(_0x12f136)});}else console['log'](_0x537b56(0x13e));return _0x537b56(0x137);}async function configureClaudeMcp(){const _0x275ac5=a53_0x118ca4,_0x238742=readConfig(),_0x284b3f=_0x238742[_0x275ac5(0x126)]||_0x238742[_0x275ac5(0xf7)],_0x2cf0dd=_0x238742[_0x275ac5(0x131)]||_0x275ac5(0xe0);if(!_0x284b3f)return console[_0x275ac5(0x12d)](_0x275ac5(0xf3)),console[_0x275ac5(0x12d)]('\x20\x20\x20请先运行\x20\x27lovrabet\x20init\x20--appcode\x20<your-app-code>\x27\x20初始化项目配置\x0a'),logger[_0x275ac5(0x10c)](_0x275ac5(0x129),_0x275ac5(0xdb)),_0x275ac5(0x12b);let _0x3ddd07=_0x275ac5(0xde)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x275ac5(0x13c)]('\x20')+'\x20-e\x20LOVRABET_APP_CODE='+_0x284b3f;_0x2cf0dd!==_0x275ac5(0xe0)&&(_0x3ddd07+=_0x275ac5(0x147)+_0x2cf0dd);console[_0x275ac5(0x12d)](_0x275ac5(0x13b)),console[_0x275ac5(0x12d)]('\x20\x20'+_0x3ddd07+'\x0a'),console[_0x275ac5(0x12d)](_0x275ac5(0x103)),console[_0x275ac5(0x12d)]('\x20\x20AppCode:\x20'+_0x284b3f);_0x2cf0dd!=='online'&&console[_0x275ac5(0x12d)](_0x275ac5(0x139)+_0x2cf0dd);console[_0x275ac5(0x12d)](_0x275ac5(0x145)),logger['info'](_0x275ac5(0x129),_0x275ac5(0x14a),{'command':_0x3ddd07,'appcode':_0x284b3f,'env':_0x2cf0dd});const _0x6d54f2=join(process[_0x275ac5(0x13f)](),_0x275ac5(0xf1));if(!existsSync(_0x6d54f2))try{const _0x465adc=resolve(__dirname,_0x275ac5(0x109));if(existsSync(_0x465adc)){const _0x43727f=readFileSync(_0x465adc,'utf-8');writeFileSync(_0x6d54f2,_0x43727f,'utf-8'),logger[_0x275ac5(0x115)](_0x275ac5(0x129),_0x275ac5(0x14e),{'from':_0x465adc,'to':_0x6d54f2}),console[_0x275ac5(0x12d)](_0x275ac5(0x150));}else logger[_0x275ac5(0x10c)](_0x275ac5(0x129),_0x275ac5(0xe2),{'templatePath':_0x465adc});}catch(_0x262dfc){logger[_0x275ac5(0x154)](_0x275ac5(0x129),_0x275ac5(0x11e),{'error':_0x262dfc instanceof Error?_0x262dfc[_0x275ac5(0xed)]:String(_0x262dfc)});}else console[_0x275ac5(0x12d)](_0x275ac5(0x14c));return _0x275ac5(0x110);}async function showOtherGuide(){const _0x46615f=a53_0x118ca4,_0x3c7c3a=readConfig(),_0x57d257=_0x3c7c3a[_0x46615f(0x126)]||_0x3c7c3a[_0x46615f(0xf7)],_0x12b180=_0x3c7c3a[_0x46615f(0x131)]||_0x46615f(0xe0);if(!_0x57d257)return console[_0x46615f(0x12d)](_0x46615f(0xf3)),console[_0x46615f(0x12d)](_0x46615f(0x10a)),logger[_0x46615f(0x10c)](_0x46615f(0x129),_0x46615f(0xdb)),_0x46615f(0x12b);return console['log'](_0x46615f(0x14d)),console['log'](_0x46615f(0x112)+_0x57d257+_0x46615f(0x135)+_0x12b180+'\x0a'),console[_0x46615f(0x12d)]('{'),console['log'](_0x46615f(0xe6)),console[_0x46615f(0x12d)](_0x46615f(0xee)+MCP_SERVER_NAME+_0x46615f(0x111)),console[_0x46615f(0x12d)](_0x46615f(0xff)+MCP_COMMAND+'\x22,'),console[_0x46615f(0x12d)](_0x46615f(0x141)+MCP_ARGS[_0x46615f(0xd9)](_0x34a183=>'\x22'+_0x34a183+'\x22')[_0x46615f(0x13c)](',\x20')+'],'),console[_0x46615f(0x12d)](_0x46615f(0xe1)),console[_0x46615f(0x12d)](_0x46615f(0x10e)+_0x57d257+'\x22,'),_0x12b180!==_0x46615f(0xe0)&&console['log'](_0x46615f(0xe7)+_0x12b180+'\x22,'),console[_0x46615f(0x12d)](_0x46615f(0x122)),console['log']('\x20\x20\x20\x20}'),console[_0x46615f(0x12d)](_0x46615f(0xf9)),console['log']('}\x0a'),console[_0x46615f(0x12d)](_0x46615f(0xe4)),logger[_0x46615f(0x115)](_0x46615f(0x129),_0x46615f(0x12e),{'appcode':_0x57d257,'env':_0x12b180}),_0x46615f(0x123);}
|
package/lib/mcp/claude.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0xaac7fd,_0x575f3c){const _0x1847a1=a54_0x1fc2,_0x375e43=_0xaac7fd();while(!![]){try{const _0x44e8fd=-parseInt(_0x1847a1(0x1d0))/0x1+parseInt(_0x1847a1(0x1d2))/0x2*(-parseInt(_0x1847a1(0x1d8))/0x3)+parseInt(_0x1847a1(0x1e5))/0x4*(parseInt(_0x1847a1(0x1e3))/0x5)+parseInt(_0x1847a1(0x1d1))/0x6+parseInt(_0x1847a1(0x1c7))/0x7*(-parseInt(_0x1847a1(0x1dc))/0x8)+parseInt(_0x1847a1(0x1d6))/0x9+parseInt(_0x1847a1(0x1ca))/0xa;if(_0x44e8fd===_0x575f3c)break;else _0x375e43['push'](_0x375e43['shift']());}catch(_0x467c7a){_0x375e43['push'](_0x375e43['shift']());}}}(a54_0x40a0,0x6a373));function a54_0x40a0(){const _0x26bf65=['872OFNiNU','app','claude\x20mcp\x20add\x20lovrabet-dataset\x20npx\x20@lovrabet/dataset-mcp-server@latest','-e\x20LOVRABET_ENV=daily','7jqoLWR','error','配置完成后:\x0a','891020WMPITa','📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','info','env','\x20\x202.\x20在\x20claude\x20code\x20中确认\x20lovrabet-dataset\x20MCP\x20服务器已加载\x0a','错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置','223020REnwSA','2735652AZFoGG','82vspunX','配置信息:','\x20\x20-\x20AppCode:\x20','exit','1007001AXzscA','daily','48525gPgAnE','log','online','mcp-claude','1645736GZTfoY','appcode','未找到\x20appcode\x20配置','trim','message','错误:\x20配置失败\x20-\x20','配置失败','19955UymfLF','-e\x20LOVRABET_APP_CODE='];a54_0x40a0=function(){return _0x26bf65;};return a54_0x40a0();}function a54_0x1fc2(_0x3b35fb,_0x403f58){_0x3b35fb=_0x3b35fb-0x1c7;const _0x40a07e=a54_0x40a0();let _0x1fc25a=_0x40a07e[_0x3b35fb];return _0x1fc25a;}import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';export async function configureClaudeMcp(){const _0x1ccf8e=a54_0x1fc2;try{const _0x7850b4=readConfig(),_0x497d8b=_0x7850b4[_0x1ccf8e(0x1dd)]||_0x7850b4[_0x1ccf8e(0x1e6)],_0x3e6a4c=_0x7850b4[_0x1ccf8e(0x1cd)]||_0x1ccf8e(0x1da);!_0x497d8b&&(console[_0x1ccf8e(0x1c8)](_0x1ccf8e(0x1cf)),logger[_0x1ccf8e(0x1c8)](_0x1ccf8e(0x1db),_0x1ccf8e(0x1de)),process[_0x1ccf8e(0x1d5)](0x1));console[_0x1ccf8e(0x1d9)](_0x1ccf8e(0x1d3)),console[_0x1ccf8e(0x1d9)](_0x1ccf8e(0x1d4)+_0x497d8b),console[_0x1ccf8e(0x1d9)]('\x20\x20-\x20环境:\x20'+_0x3e6a4c+'\x0a');const _0x2112e1=_0x1ccf8e(0x1e7),_0x4b0c14=_0x1ccf8e(0x1e4)+_0x497d8b,_0x5b71f2=_0x3e6a4c===_0x1ccf8e(0x1d7)?_0x1ccf8e(0x1e8):'',_0x260343=(_0x2112e1+'\x20'+_0x4b0c14+'\x20'+_0x5b71f2)[_0x1ccf8e(0x1df)]();console[_0x1ccf8e(0x1d9)](_0x1ccf8e(0x1cb)),console['log']('\x20\x20'+_0x260343+'\x0a'),console[_0x1ccf8e(0x1d9)](_0x1ccf8e(0x1c9)),console[_0x1ccf8e(0x1d9)]('\x20\x201.\x20重启\x20claude\x20code'),console[_0x1ccf8e(0x1d9)](_0x1ccf8e(0x1ce)),logger[_0x1ccf8e(0x1cc)](_0x1ccf8e(0x1db),'生成配置命令',{'appcode':_0x497d8b,'env':_0x3e6a4c}),process[_0x1ccf8e(0x1d5)](0x0);}catch(_0xdd3afd){logger['error'](_0x1ccf8e(0x1db),_0x1ccf8e(0x1e2),{'error':_0xdd3afd instanceof Error?_0xdd3afd[_0x1ccf8e(0x1e0)]:String(_0xdd3afd)}),console['error'](_0x1ccf8e(0x1e1)+(_0xdd3afd instanceof Error?_0xdd3afd[_0x1ccf8e(0x1e0)]:String(_0xdd3afd))),process[_0x1ccf8e(0x1d5)](0x1);}}
|
package/lib/mcp/cursor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a55_0xff33(){const _0x440dbb=['4182792VUfxLX','Cursor\x20Rules\x20模板文件不存在','请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。','更新现有\x20mcp.json\x20配置','复制\x20Cursor\x20Rules\x20文件','\x20\x20-\x20AppCode:\x20','2778312VeiYAE','message','配置\x20Cursor\x20MCP\x20失败','mcp.json','\x20\x20-\x20配置文件:\x20','创建\x20.cursor\x20目录','错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置','app','Cursor\x20Rules\x20文件已存在,跳过','parse','cwd','../../templates/rules/lovrabet_rules.mdc.tpl','\x0a✓\x20Cursor\x20MCP\x20配置成功!','mcpServers','7659882vKmwzZ','rules','\x20\x20-\x20环境:\x20','7397688yhojWH','10700466WqeDrq','1075735PPFbJD','warn','7274JYGpph','exit','log','npx','✓\x20创建\x20.cursor\x20目录:\x20','366gMdwKa','警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20','解析现有\x20mcp.json\x20失败','✓\x20创建\x20mcp.json\x20配置文件','utf8','错误:\x20解析现有\x20mcp.json\x20失败:\x20','online','配置\x20Cursor\x20MCP\x20成功','错误:\x20配置失败:\x20','@lovrabet/dataset-mcp-server','.cursor','\x0a配置信息:','lovrabet-dataset','✓\x20更新\x20mcp.json\x20配置','appcode','!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件','error','mcp-cursor','info','创建\x20.cursor/rules\x20目录','lovrabet_rules.mdc'];a55_0xff33=function(){return _0x440dbb;};return a55_0xff33();}function a55_0x3436(_0x2245a9,_0x1c74a9){_0x2245a9=_0x2245a9-0xfe;const _0xff33d9=a55_0xff33();let _0x343617=_0xff33d9[_0x2245a9];return _0x343617;}(function(_0x1a3585,_0x3c81a7){const _0x20352d=a55_0x3436,_0x2599cb=_0x1a3585();while(!![]){try{const _0x234bc5=-parseInt(_0x20352d(0x122))/0x1*(parseInt(_0x20352d(0x11d))/0x2)+-parseInt(_0x20352d(0x108))/0x3+parseInt(_0x20352d(0x102))/0x4+parseInt(_0x20352d(0x11b))/0x5+parseInt(_0x20352d(0x116))/0x6+parseInt(_0x20352d(0x11a))/0x7+-parseInt(_0x20352d(0x119))/0x8;if(_0x234bc5===_0x3c81a7)break;else _0x2599cb['push'](_0x2599cb['shift']());}catch(_0x2f3750){_0x2599cb['push'](_0x2599cb['shift']());}}}(a55_0xff33,0xd7dcd));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';export async function configureCursorMcp(){const _0x3a173e=a55_0x3436;try{const _0x44c1e5=process[_0x3a173e(0x112)](),_0x331f07=resolve(_0x44c1e5,_0x3a173e(0x12c)),_0x592534=resolve(_0x331f07,_0x3a173e(0x10b)),_0x425ebc=readConfig(),_0x579d8f=_0x425ebc[_0x3a173e(0x130)]||_0x425ebc[_0x3a173e(0x10f)],_0x17cb54=_0x425ebc['env']||_0x3a173e(0x128);!_0x579d8f&&(console[_0x3a173e(0x132)](_0x3a173e(0x10e)),logger[_0x3a173e(0x132)](_0x3a173e(0xfe),'未找到\x20appcode\x20配置'),process['exit'](0x1));!existsSync(_0x331f07)&&(mkdirSync(_0x331f07,{'recursive':!![]}),logger[_0x3a173e(0xff)]('mcp-cursor',_0x3a173e(0x10d),{'path':_0x331f07}),console['log'](_0x3a173e(0x121)+_0x331f07));const _0x4b3ed8={'command':_0x3a173e(0x120),'args':['-y',_0x3a173e(0x12b)],'env':{'LOVRABET_APP_CODE':String(_0x579d8f),'LOVRABET_ENV':String(_0x17cb54)}};let _0x5f2151;if(existsSync(_0x592534))try{const _0x2a5b6c=readFileSync(_0x592534,'utf8');_0x5f2151=JSON[_0x3a173e(0x111)](_0x2a5b6c),!_0x5f2151[_0x3a173e(0x115)]&&(_0x5f2151['mcpServers']={}),_0x5f2151[_0x3a173e(0x115)][_0x3a173e(0x12e)]=_0x4b3ed8,logger[_0x3a173e(0xff)](_0x3a173e(0xfe),_0x3a173e(0x105),{'path':_0x592534,'appcode':_0x579d8f,'env':_0x17cb54}),console[_0x3a173e(0x11f)](_0x3a173e(0x12f));}catch(_0x43a9d6){logger[_0x3a173e(0x132)]('mcp-cursor',_0x3a173e(0x124),{'error':_0x43a9d6 instanceof Error?_0x43a9d6['message']:String(_0x43a9d6)}),console[_0x3a173e(0x132)](_0x3a173e(0x127)+(_0x43a9d6 instanceof Error?_0x43a9d6[_0x3a173e(0x109)]:String(_0x43a9d6))),process[_0x3a173e(0x11e)](0x1);}else _0x5f2151={'mcpServers':{'lovrabet-dataset':_0x4b3ed8}},logger['info'](_0x3a173e(0xfe),'创建新的\x20mcp.json\x20配置',{'path':_0x592534,'appcode':_0x579d8f,'env':_0x17cb54}),console[_0x3a173e(0x11f)](_0x3a173e(0x125));writeFileSync(_0x592534,JSON['stringify'](_0x5f2151,null,0x2),{'encoding':_0x3a173e(0x126)});const _0x523d9f=resolve(_0x331f07,_0x3a173e(0x117)),_0x15ccca=resolve(_0x523d9f,_0x3a173e(0x101));if(!existsSync(_0x15ccca))try{!existsSync(_0x523d9f)&&(mkdirSync(_0x523d9f,{'recursive':!![]}),logger[_0x3a173e(0xff)](_0x3a173e(0xfe),_0x3a173e(0x100),{'path':_0x523d9f}));const _0x47f66c=fileURLToPath(import.meta.url),_0x1d9809=dirname(_0x47f66c),_0x3c094f=resolve(_0x1d9809,_0x3a173e(0x113));existsSync(_0x3c094f)?(copyFileSync(_0x3c094f,_0x15ccca),logger[_0x3a173e(0xff)](_0x3a173e(0xfe),_0x3a173e(0x106),{'from':_0x3c094f,'to':_0x15ccca}),console[_0x3a173e(0x11f)]('✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc')):logger[_0x3a173e(0x11c)]('mcp-cursor',_0x3a173e(0x103),{'templatePath':_0x3c094f});}catch(_0x55f440){logger['error']('mcp-cursor','复制\x20Cursor\x20Rules\x20文件失败',{'error':_0x55f440 instanceof Error?_0x55f440[_0x3a173e(0x109)]:String(_0x55f440)}),console['warn'](_0x3a173e(0x123)+(_0x55f440 instanceof Error?_0x55f440[_0x3a173e(0x109)]:String(_0x55f440)));}else console[_0x3a173e(0x11f)](_0x3a173e(0x131)),logger['info'](_0x3a173e(0xfe),_0x3a173e(0x110),{'path':_0x15ccca});console['log'](_0x3a173e(0x114)),console[_0x3a173e(0x11f)](_0x3a173e(0x12d)),console['log'](_0x3a173e(0x107)+_0x579d8f),console[_0x3a173e(0x11f)](_0x3a173e(0x118)+_0x17cb54),console[_0x3a173e(0x11f)](_0x3a173e(0x10c)+_0x592534),console['log']('\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。'),console[_0x3a173e(0x11f)](_0x3a173e(0x104)),logger[_0x3a173e(0xff)](_0x3a173e(0xfe),_0x3a173e(0x129),{'appcode':_0x579d8f,'env':_0x17cb54,'configPath':_0x592534}),process[_0x3a173e(0x11e)](0x0);}catch(_0x2faf72){logger[_0x3a173e(0x132)](_0x3a173e(0xfe),_0x3a173e(0x10a),{'error':_0x2faf72 instanceof Error?_0x2faf72[_0x3a173e(0x109)]:String(_0x2faf72)}),console['error'](_0x3a173e(0x12a)+(_0x2faf72 instanceof Error?_0x2faf72[_0x3a173e(0x109)]:String(_0x2faf72))),process[_0x3a173e(0x11e)](0x1);}}
|
package/lib/mcp/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a56_0x267242=a56_0xdfc9;(function(_0x2546bb,_0x289d90){const _0x1865cf=a56_0xdfc9,_0x27a367=_0x2546bb();while(!![]){try{const _0x38ba38=-parseInt(_0x1865cf(0x116))/0x1+parseInt(_0x1865cf(0x139))/0x2*(-parseInt(_0x1865cf(0x12e))/0x3)+parseInt(_0x1865cf(0x128))/0x4*(parseInt(_0x1865cf(0x120))/0x5)+parseInt(_0x1865cf(0x126))/0x6+parseInt(_0x1865cf(0x11b))/0x7+parseInt(_0x1865cf(0x13b))/0x8*(parseInt(_0x1865cf(0x11d))/0x9)+-parseInt(_0x1865cf(0x11e))/0xa*(parseInt(_0x1865cf(0x130))/0xb);if(_0x38ba38===_0x289d90)break;else _0x27a367['push'](_0x27a367['shift']());}catch(_0x3b2239){_0x27a367['push'](_0x27a367['shift']());}}}(a56_0x9e25,0x61eee));import{configureCursorMcp}from'./cursor.js';import{configureClaudeMcp}from'./claude.js';import{logger}from'../utils/logger.js';function a56_0xdfc9(_0x1da573,_0x193976){_0x1da573=_0x1da573-0x116;const _0x9e2563=a56_0x9e25();let _0xdfc9f7=_0x9e2563[_0x1da573];return _0xdfc9f7;}function a56_0x9e25(){const _0x1a639c=['40sAmBkd','配置失败','1085CYWQVG','(空)','--help','mcp-install','\x0a📦\x20正在配置\x20','\x0aLovrabet\x20MCP\x20-\x20MCP\x20服务器配置工具\x0a\x0a用法:\x0a\x20\x20lovrabet\x20mcp\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示帮助信息\x0a\x20\x20lovrabet\x20mcp\x20install\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20交互式选择并配置\x20MCP\x0a\x20\x20lovrabet\x20mcp\x20install\x20--cursor\x20\x20\x20\x20直接配置\x20Cursor\x20MCP\x0a\x20\x20lovrabet\x20mcp\x20install\x20--claude\x20\x20\x20\x20直接配置\x20Claude\x20Code\x20MCP\x0a\x20\x20lovrabet\x20mcp\x20install\x20--other\x20\x20\x20\x20\x20显示其他\x20IDE\x20配置指引\x0a\x0a配置方式:\x0a\x20\x20\x20交互式选择\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20-\x20显示\x20IDE\x20列表供选择,支持多选\x0a\x20\x20\x20\x20$\x20lovrabet\x20mcp\x20install\x0a\x20\x20\x20\x20→\x20使用\x20↑↓\x20移动光标,空格选中/取消,Enter\x20确认\x0a\x20\x20\x20\x20→\x20按\x20a\x20全选,按\x20i/r\x20反选,按\x20q\x20退出\x0a\x0a\x20\x20直接配置指定\x20IDE\x20(支持多个)\x20\x20\x20\x20\x20-\x20使用\x20--ide\x20标志直接配置\x0a\x20\x20\x20\x20$\x20lovrabet\x20mcp\x20install\x20--cursor\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20配置\x20Cursor\x0a\x20\x20\x20\x20$\x20lovrabet\x20mcp\x20install\x20--cursor\x20--claude\x20\x20#\x20配置多个\x0a\x20\x20\x20\x20$\x20lovrabet\x20mcp\x20install\x20--other\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20显示其他\x20IDE\x20配置指引\x0a\x0a支持的\x20IDE:\x0a\x20\x20--cursor\x20\x20\x20\x20\x20\x20\x20Cursor\x20\x20\x20\x20\x20-\x20自动写入\x20.cursor/mcp.json,重启\x20IDE\x20后生效\x0a\x20\x20--claude\x20\x20\x20\x20\x20\x20\x20Claude\x20Code\x20-\x20输出配置命令供手动执行\x0a\x20\x20--other\x20\x20\x20\x20\x20\x20\x20\x20其他\x20IDE\x20\x20\x20\x20-\x20显示各\x20IDE\x20的配置指引(Antigravity/Codex/Copilot/OpenCode/Qoder/Windsurf\x20等)\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20mcp\x20install\x0a\x20\x20\x20\x20→\x20交互式选择\x20IDE\x0a\x0a\x20\x20$\x20lovrabet\x20mcp\x20install\x20--cursor\x0a\x20\x20\x20\x20→\x20自动配置\x20Cursor\x20MCP\x20(写入\x20.cursor/mcp.json)\x0a\x0a\x20\x20$\x20lovrabet\x20mcp\x20install\x20--claude\x0a\x20\x20\x20\x20→\x20输出\x20Claude\x20Code\x20MCP\x20配置命令\x0a\x0a\x20\x20$\x20lovrabet\x20mcp\x20install\x20--other\x0a\x20\x20\x20\x20→\x20显示其他\x20IDE\x20的配置指引\x0a\x0a配置指南:\x0a\x20\x20https://help.yuntoo.com/mcp/config-guide\x0a','4473774LfjkYb','mcp','9732zHmlxa','\x20\x20lovrabet\x20mcp\x20install\x20cursor\x20\x20\x20\x20#\x20Cursor\x20IDE','claude\x20code','\x20\x20lovrabet\x20mcp\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20显示帮助信息\x0a','\x0a可用命令:','message','17991YoZtGM','错误:\x20不支持的命令:\x20','1620586zaRCIA','name','\x20\x20claude\x20\x20\x20-\x20claude\x20code\x0a','支持的平台:','\x20\x20cursor\x20\x20\x20-\x20Cursor\x20IDE','不支持的命令:\x20','setLogPath','error','exit','154Gdkkoc','help','2271144ctiQQk','\x20\x20lovrabet\x20mcp\x20install\x20<ide>\x20\x20\x20\x20#\x20安装\x20MCP\x20配置','\x0a错误:\x20配置失败\x20-\x20','452467boFlCr','\x0a支持的平台:\x20cursor,\x20claude\x0a','错误:\x20不支持的平台:\x20','claude','\x0a请指定要配置的平台:\x0a','443086HCghhK','log','18tdGXPf'];a56_0x9e25=function(){return _0x1a639c;};return a56_0x9e25();}const IDE_CONFIGS={'cursor':{'name':'Cursor','description':'Cursor\x20IDE'},'claude':{'name':a56_0x267242(0x12a),'description':a56_0x267242(0x12a)}};export async function mcpCommand(_0x23fcea,_0x1c268d,_0xc2077d){const _0x295c9e=a56_0x267242;logger[_0x295c9e(0x136)](process['cwd']());if(_0xc2077d?.[_0x295c9e(0x13a)]||_0x23fcea===_0x295c9e(0x122)){showHelp();return;}_0x23fcea!=='install'&&(console[_0x295c9e(0x137)](_0x295c9e(0x12f)+(_0x23fcea||_0x295c9e(0x121))),console[_0x295c9e(0x11c)](_0x295c9e(0x12c)),console[_0x295c9e(0x11c)](_0x295c9e(0x13c)),console[_0x295c9e(0x11c)](_0x295c9e(0x12b)),console['log'](_0x295c9e(0x133)),console[_0x295c9e(0x11c)](_0x295c9e(0x134)),console['log'](_0x295c9e(0x132)),logger[_0x295c9e(0x137)](_0x295c9e(0x127),_0x295c9e(0x135)+_0x23fcea),process[_0x295c9e(0x138)](0x1)),await installMcp(_0x1c268d?.[0x0]);}function showHelp(){const _0x4ce5ff=a56_0x267242;console[_0x4ce5ff(0x11c)](_0x4ce5ff(0x125));}async function installMcp(_0x45cff9){const _0x2741f8=a56_0x267242;!_0x45cff9&&(console[_0x2741f8(0x11c)](_0x2741f8(0x11a)),console[_0x2741f8(0x11c)](_0x2741f8(0x129)),console['log']('\x20\x20lovrabet\x20mcp\x20install\x20claude\x20\x20\x20\x20#\x20claude\x20code\x0a'),process[_0x2741f8(0x138)](0x1));const _0x10718c=_0x45cff9['toLowerCase']();!IDE_CONFIGS[_0x10718c]&&(console[_0x2741f8(0x137)](_0x2741f8(0x118)+_0x45cff9),console[_0x2741f8(0x11c)](_0x2741f8(0x117)),process[_0x2741f8(0x138)](0x1));try{console[_0x2741f8(0x11c)](_0x2741f8(0x124)+IDE_CONFIGS[_0x10718c][_0x2741f8(0x131)]+'\x20MCP...\x0a');switch(_0x10718c){case'cursor':await configureCursorMcp();break;case _0x2741f8(0x119):await configureClaudeMcp();break;}}catch(_0x106c8e){logger['error'](_0x2741f8(0x123),_0x2741f8(0x11f),{'error':_0x106c8e instanceof Error?_0x106c8e[_0x2741f8(0x12d)]:String(_0x106c8e)}),console['error'](_0x2741f8(0x13d)+(_0x106c8e instanceof Error?_0x106c8e[_0x2741f8(0x12d)]:String(_0x106c8e))+'\x0a'),process[_0x2741f8(0x138)](0x1);}}
|