@lovrabet/cli 1.1.22 → 1.1.23
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/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/valid-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/cursor.js +1 -1
- package/lib/mcp/main.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/templates/rules/lovrabet_rules.mdc.tpl +181 -115
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x1dc794,_0x112044){const _0x317916=a32_0x2be4,_0x3ac2ae=_0x1dc794();while(!![]){try{const _0x3ca3cf=-parseInt(_0x317916(0x137))/0x1*(parseInt(_0x317916(0x14a))/0x2)+-parseInt(_0x317916(0x117))/0x3+-parseInt(_0x317916(0x150))/0x4+parseInt(_0x317916(0x12b))/0x5+-parseInt(_0x317916(0x120))/0x6+-parseInt(_0x317916(0x145))/0x7*(-parseInt(_0x317916(0x130))/0x8)+parseInt(_0x317916(0x134))/0x9*(parseInt(_0x317916(0x11d))/0xa);if(_0x3ca3cf===_0x112044)break;else _0x3ac2ae['push'](_0x3ac2ae['shift']());}catch(_0x1f6b04){_0x3ac2ae['push'](_0x3ac2ae['shift']());}}}(a32_0x3763,0x636c0));import{jsx as a32_0x500300,jsxs as a32_0x1febb8,Fragment as a32_0x215995}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import{getIsSessionValid}from'../auth/is-session-valid.js';function a32_0x3763(){const _0x14dd80=['登录失败','online','2234964SBFdlm','delete','api-pull','*\x20项目名:\x20','column','test','10YbHvvK','creating','应用AppCode只能包含字母、数字、连字符和下划线,且必须以字母或数字开头','582810qnnwgE','red','应用AppCode不合法','[可选]:\x20','login-process','已登录','project-name','项目名不合法','跳过登录','login','my-app','1116570cMUGpp','Yes','label','!\x20未检测到有效登录','string','5136VRhrGJ','\x20登录中...','应用AppCode长度不能超过\x20100\x20个字符','backspace','11335914mGADxP','length','*\x20正在检查登录状态...','249rTYzZj','登录状态','√\x20检测到有效登录状态','项目名','return','cyan','trim','confirm-api-pull','app-code','green','*\x20是否要自动拉取\x20API\x20配置?','\x20检查中...','login-prompt','*\x20是否要先登录以便拉取\x20API\x20配置?','7819jtqOVy','\x20\x20使用\x20←→\x20选择,回车确认','\x20←\x20','绑定应用AppCode可自动配置\x20API,如:\x20app-c4c89304\x20(直接回车跳过)','项目名只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','2328nQbpDH','\x20直接回车确认,或输入自定义名称','value','gray','yellow','env','2643132PMxMZv','\x20\x20推荐选择\x20Yes,登录后可自动拉取并配置\x20API\x20接口','应用AppCode','step','拉取API配置','login-check','slice','includes','\x20\x20推荐选择\x20Yes,可自动配置\x20API\x20接口'];a32_0x3763=function(){return _0x14dd80;};return a32_0x3763();}import{authServer}from'../auth/auth-server.js';function a32_0x2be4(_0x53631b,_0x38bf49){const _0x376331=a32_0x3763();return a32_0x2be4=function(_0x2be41d,_0x55f108){_0x2be41d=_0x2be41d-0x116;let _0x267daf=_0x376331[_0x2be41d];return _0x267daf;},a32_0x2be4(_0x53631b,_0x38bf49);}import{readConfig}from'../utils/config.js';export function EnhancedGuidedCreate(_0xfcde){const _0x28bbbf=a32_0x2be4,{onCreate:_0x6e9f8d,env:_0x34af7a}=_0xfcde,[_0x39ec72,_0x2191e8]=useState(_0x28bbbf(0x126)),[_0xe39ab7,_0x103fad]=useState(''),[_0x3b76a2,_0x48b323]=useState(''),[_0x356871,_0x21e417]=useState(''),[_0x3ee369,_0x1c78cb]=useState(''),[_0x47b387,_0x51b3a0]=useState([]),[_0x15f51a,_0x142329]=useState(null),[_0x1fc65f,_0x3bc2a7]=useState(![]),[_0x3ed53d,_0x3cb38e]=useState(![]),[_0x528a11,_0x3ebfc0]=useState(![]),[_0x3fbfb1,_0x527193]=useState(0x0),[_0x15248c,_0x4b9b86]=useState(0x0),_0x2314cf=_0x28bbbf(0x12a),_0x4eae82=readConfig(),_0x2748b6=typeof _0x4eae82[_0x28bbbf(0x14f)]===_0x28bbbf(0x12f)?_0x4eae82[_0x28bbbf(0x14f)]:undefined;function _0xa3b094(_0x458582){const _0x52b868=_0x28bbbf;if(_0x458582[_0x52b868(0x135)]>0x32)return{'valid':![],'message':'项目名长度不能超过\x2050\x20个字符'};const _0x57d914=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(_0x458582?.[_0x52b868(0x13d)]()&&!_0x57d914[_0x52b868(0x11c)](_0x458582))return{'valid':![],'message':_0x52b868(0x149)};return{'valid':!![]};}function _0x416a57(_0x4b9133){const _0x4bab6e=_0x28bbbf;if(!_0x4b9133[_0x4bab6e(0x13d)]())return{'valid':!![]};if(_0x4b9133['length']>0x64)return{'valid':![],'message':_0x4bab6e(0x132)};const _0x4c1adf=/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;if(!_0x4c1adf[_0x4bab6e(0x11c)](_0x4b9133))return{'valid':![],'message':_0x4bab6e(0x11f)};return{'valid':!![]};}async function _0x5558b4(){_0x3bc2a7(!![]);try{const _0x584a9a=await getIsSessionValid();return _0x142329(_0x584a9a),_0x584a9a;}catch(_0x1c1f84){return _0x142329(![]),![];}finally{_0x3bc2a7(![]);}}async function _0x3fe4c9(){_0x3cb38e(!![]);try{const _0x16bc61=await authServer({'silent':!![]});return _0x142329(_0x16bc61),_0x16bc61;}catch(_0x56bfb6){return _0x142329(![]),![];}finally{_0x3cb38e(![]);}}return useInput(async(_0x29cea7,_0x1aee79)=>{const _0x5348e3=_0x28bbbf;if(_0x1aee79['leftArrow']||_0x1aee79['rightArrow']){if(_0x39ec72==='confirm-api-pull'){_0x527193(_0x187d79=>_0x187d79===0x0?0x1:0x0);return;}if(_0x39ec72===_0x5348e3(0x143)){_0x4b9b86(_0x145606=>_0x145606===0x0?0x1:0x0);return;}}if(_0x1aee79[_0x5348e3(0x13b)]){if(_0x39ec72===_0x5348e3(0x126)){const _0x56aa62=_0x356871['trim']()||_0x2314cf;if(_0x3ee369)return;_0x103fad(_0x56aa62),_0x51b3a0([{'step':'project-name','label':_0x5348e3(0x13a),'value':_0x56aa62}]),_0x21e417(''),_0x1c78cb(''),_0x2191e8(_0x5348e3(0x13f));return;}if(_0x39ec72==='app-code'){if(_0x3ee369)return;const _0x263e29=_0x356871[_0x5348e3(0x13d)]();_0x48b323(_0x263e29),_0x51b3a0(_0x1152a4=>[..._0x1152a4,{'step':'app-code','label':_0x5348e3(0x152),'value':_0x263e29||'未设置'}]),_0x21e417(''),_0x1c78cb('');if(_0x263e29){_0x2191e8(_0x5348e3(0x155));const _0x271095=await _0x5558b4();_0x271095?_0x2191e8(_0x5348e3(0x13e)):_0x2191e8(_0x5348e3(0x143));}else{const _0x32616b=_0x34af7a||_0x2748b6||'online';_0x6e9f8d({'projectName':_0xe39ab7,'appCode':undefined,'pullApi':![],'env':_0x32616b}),_0x2191e8('creating');}return;}if(_0x39ec72===_0x5348e3(0x13e)){const _0x15aa17=_0x3fbfb1===0x0;_0x3ebfc0(_0x15aa17),_0x51b3a0(_0x54483c=>[..._0x54483c,{'step':_0x5348e3(0x119),'label':_0x5348e3(0x154),'value':_0x15aa17?'是':'否'}]);const _0x583856=_0x34af7a||_0x2748b6||'online';_0x6e9f8d({'projectName':_0xe39ab7,'appCode':_0x3b76a2,'pullApi':_0x15aa17,'env':_0x583856}),_0x2191e8(_0x5348e3(0x11e));return;}if(_0x39ec72===_0x5348e3(0x143)){const _0x3bc47e=_0x15248c===0x0;if(_0x3bc47e){_0x2191e8(_0x5348e3(0x124));const _0x573b72=await _0x3fe4c9();if(_0x573b72)_0x51b3a0(_0x39b075=>[..._0x39b075,{'step':_0x5348e3(0x129),'label':_0x5348e3(0x138),'value':_0x5348e3(0x125)}]),_0x2191e8(_0x5348e3(0x13e));else{_0x51b3a0(_0x5d6543=>[..._0x5d6543,{'step':_0x5348e3(0x129),'label':_0x5348e3(0x138),'value':_0x5348e3(0x159)}]);const _0xf08a18=_0x34af7a||_0x2748b6||'online';_0x6e9f8d({'projectName':_0xe39ab7,'appCode':_0x3b76a2,'pullApi':![],'env':_0xf08a18}),_0x2191e8('creating');}}else{_0x51b3a0(_0x35dc6b=>[..._0x35dc6b,{'step':'login','label':'登录状态','value':_0x5348e3(0x128)}]);const _0x518caf=_0x34af7a||_0x2748b6||_0x5348e3(0x116);_0x6e9f8d({'projectName':_0xe39ab7,'appCode':_0x3b76a2,'pullApi':![],'env':_0x518caf}),_0x2191e8(_0x5348e3(0x11e));}return;}}if(_0x1aee79[_0x5348e3(0x133)]||_0x1aee79[_0x5348e3(0x118)]){_0x21e417(_0x2b62fe=>{const _0x1dbbcd=_0x5348e3,_0x2fb834=_0x2b62fe[_0x1dbbcd(0x156)](0x0,-0x1);if(_0x39ec72===_0x1dbbcd(0x126)){const {valid:_0x182895,message:_0x5e9076}=_0xa3b094(_0x2fb834);_0x1c78cb(_0x182895?'':_0x5e9076||_0x1dbbcd(0x127));}else{if(_0x39ec72===_0x1dbbcd(0x13f)){const {valid:_0x5743eb,message:_0x4ec837}=_0x416a57(_0x2fb834);_0x1c78cb(_0x5743eb?'':_0x4ec837||'应用AppCode不合法');}}return _0x2fb834;});return;}if(['creating','login-check','login-process'][_0x5348e3(0x157)](_0x39ec72))return;if(_0x39ec72===_0x5348e3(0x13e)||_0x39ec72==='login-prompt')return;_0x21e417(_0x4d2192=>{const _0x11ec94=_0x5348e3,_0x2c2d3b=_0x4d2192+_0x29cea7;if(_0x39ec72==='project-name'){const {valid:_0x3b47d5,message:_0x34452a}=_0xa3b094(_0x2c2d3b);_0x1c78cb(_0x3b47d5?'':_0x34452a||'项目名不合法');}else{if(_0x39ec72===_0x11ec94(0x13f)){const {valid:_0x3d76bf,message:_0x32e728}=_0x416a57(_0x2c2d3b);_0x1c78cb(_0x3d76bf?'':_0x32e728||_0x11ec94(0x122));}}return _0x2c2d3b;});}),a32_0x1febb8(Box,{'flexDirection':_0x28bbbf(0x11b),'marginTop':0x1,'children':[_0x47b387[_0x28bbbf(0x135)]===0x0&&a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':_0x28bbbf(0x13c),'children':'*\x20创建新项目'})}),_0x47b387['map'](_0x1cb5ac=>a32_0x1febb8(Box,{'children':[a32_0x1febb8(Text,{'color':_0x28bbbf(0x140),'children':['√\x20',_0x1cb5ac[_0x28bbbf(0x12d)],':\x20']}),a32_0x500300(Text,{'color':_0x28bbbf(0x13c),'children':_0x1cb5ac[_0x28bbbf(0x14c)]})]},_0x1cb5ac[_0x28bbbf(0x153)])),_0x39ec72===_0x28bbbf(0x126)&&a32_0x1febb8(a32_0x215995,{'children':[a32_0x1febb8(Box,{'children':[a32_0x500300(Text,{'children':_0x28bbbf(0x11a)}),_0x356871?a32_0x500300(Text,{'color':_0x28bbbf(0x140),'children':_0x356871}):a32_0x500300(Text,{'color':_0x28bbbf(0x14d),'children':_0x2314cf}),_0x3ee369&&a32_0x1febb8(Text,{'color':_0x28bbbf(0x121),'children':[_0x28bbbf(0x147),_0x3ee369]})]}),!_0x3ee369&&!_0x356871&&a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':'gray','children':_0x28bbbf(0x14b)})})]}),_0x39ec72===_0x28bbbf(0x13f)&&a32_0x1febb8(a32_0x215995,{'children':[a32_0x1febb8(Box,{'children':[a32_0x500300(Text,{'children':'*\x20应用AppCode\x20'}),a32_0x500300(Text,{'color':_0x28bbbf(0x14d),'children':_0x28bbbf(0x123)}),a32_0x500300(Text,{'color':_0x28bbbf(0x140),'children':_0x356871}),_0x3ee369&&a32_0x1febb8(Text,{'color':'red','children':[_0x28bbbf(0x147),_0x3ee369]})]}),!_0x3ee369&&a32_0x500300(Box,{'children':a32_0x1febb8(Text,{'color':_0x28bbbf(0x14d),'children':['\x20',_0x28bbbf(0x148)]})})]}),_0x39ec72===_0x28bbbf(0x155)&&a32_0x1febb8(Box,{'children':[a32_0x500300(Text,{'children':_0x28bbbf(0x136)}),_0x1fc65f&&a32_0x500300(Text,{'color':'gray','children':_0x28bbbf(0x142)})]}),_0x39ec72===_0x28bbbf(0x13e)&&a32_0x1febb8(a32_0x215995,{'children':[a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':_0x28bbbf(0x140),'children':_0x28bbbf(0x139)})}),a32_0x500300(Box,{'marginTop':0x1,'children':a32_0x500300(Text,{'children':_0x28bbbf(0x141)})}),a32_0x1febb8(Box,{'marginLeft':0x2,'children':[a32_0x1febb8(Text,{'color':_0x3fbfb1===0x0?_0x28bbbf(0x140):_0x28bbbf(0x14d),'children':[_0x3fbfb1===0x0?'▶\x20':'\x20\x20','Yes']}),a32_0x500300(Text,{'children':'\x20'}),a32_0x1febb8(Text,{'color':_0x3fbfb1===0x1?'green':_0x28bbbf(0x14d),'children':[_0x3fbfb1===0x1?'▶\x20':'\x20\x20','No']})]}),a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':_0x28bbbf(0x14d),'children':_0x28bbbf(0x146)})}),a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':'yellow','children':_0x28bbbf(0x158)})})]}),_0x39ec72===_0x28bbbf(0x143)&&a32_0x1febb8(a32_0x215995,{'children':[a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':_0x28bbbf(0x14e),'children':_0x28bbbf(0x12e)})}),a32_0x500300(Box,{'marginTop':0x1,'children':a32_0x500300(Text,{'children':_0x28bbbf(0x144)})}),a32_0x1febb8(Box,{'marginLeft':0x2,'children':[a32_0x1febb8(Text,{'color':_0x15248c===0x0?_0x28bbbf(0x140):_0x28bbbf(0x14d),'children':[_0x15248c===0x0?'▶\x20':'\x20\x20',_0x28bbbf(0x12c)]}),a32_0x500300(Text,{'children':'\x20'}),a32_0x1febb8(Text,{'color':_0x15248c===0x1?'green':'gray','children':[_0x15248c===0x1?'▶\x20':'\x20\x20','No']})]}),a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':_0x28bbbf(0x14d),'children':_0x28bbbf(0x146)})}),a32_0x500300(Box,{'children':a32_0x500300(Text,{'color':_0x28bbbf(0x14e),'children':_0x28bbbf(0x151)})})]}),_0x39ec72===_0x28bbbf(0x124)&&a32_0x1febb8(Box,{'children':[a32_0x500300(Text,{'children':'*\x20正在登录,请前往浏览器完成登录...'}),_0x3ed53d&&a32_0x500300(Text,{'color':_0x28bbbf(0x14d),'children':_0x28bbbf(0x131)})]})]});}
|
|
1
|
+
(function(_0x4f8eca,_0x34183b){const _0x1a147e=a32_0x4126,_0x442b90=_0x4f8eca();while(!![]){try{const _0x3b0cd2=-parseInt(_0x1a147e(0x122))/0x1+-parseInt(_0x1a147e(0x113))/0x2*(-parseInt(_0x1a147e(0xf0))/0x3)+parseInt(_0x1a147e(0x105))/0x4*(parseInt(_0x1a147e(0x124))/0x5)+parseInt(_0x1a147e(0x116))/0x6*(-parseInt(_0x1a147e(0x10d))/0x7)+-parseInt(_0x1a147e(0x10b))/0x8+-parseInt(_0x1a147e(0x104))/0x9*(-parseInt(_0x1a147e(0x119))/0xa)+parseInt(_0x1a147e(0x117))/0xb;if(_0x3b0cd2===_0x34183b)break;else _0x442b90['push'](_0x442b90['shift']());}catch(_0x2a40f5){_0x442b90['push'](_0x442b90['shift']());}}}(a32_0x378b,0x9a5f7));function a32_0x4126(_0x5d1328,_0x1c12ad){const _0x378bde=a32_0x378b();return a32_0x4126=function(_0x4126e7,_0x3cd84f){_0x4126e7=_0x4126e7-0xe3;let _0x3a8bcf=_0x378bde[_0x4126e7];return _0x3a8bcf;},a32_0x4126(_0x5d1328,_0x1c12ad);}import{jsx as a32_0x50796c,jsxs as a32_0x4d84ce,Fragment as a32_0x365a4c}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import{getIsSessionValid}from'../auth/is-session-valid.js';import{authServer}from'../auth/auth-server.js';import{readConfig}from'../utils/config.js';export function EnhancedGuidedCreate(_0x47eae9){const _0x3563f0=a32_0x4126,{onCreate:_0x5b8be1,env:_0x417e6f}=_0x47eae9,[_0x1c8304,_0xc8a810]=useState(_0x3563f0(0x121)),[_0xe194b0,_0x4378c6]=useState(''),[_0x11cdea,_0x2c1c51]=useState(''),[_0x500b14,_0x17545a]=useState(''),[_0x1c0582,_0x19d0ea]=useState(''),[_0x112abe,_0x3fb129]=useState([]),[_0x9a88d,_0x541f06]=useState(null),[_0x3ac90a,_0x1fe7e2]=useState(![]),[_0x27abfa,_0x459835]=useState(![]),[_0x4a5c46,_0x156940]=useState(![]),[_0x3ed9b3,_0x2255a8]=useState(0x0),[_0x1145cc,_0x38fda6]=useState(0x0),_0x12bd15=_0x3563f0(0xf2),_0x6289ab=readConfig(),_0x3612db=typeof _0x6289ab[_0x3563f0(0xe6)]===_0x3563f0(0xf1)?_0x6289ab[_0x3563f0(0xe6)]:undefined;function _0x9d0173(_0x1b1000){const _0x3f5bbb=_0x3563f0;if(_0x1b1000['length']>0x32)return{'valid':![],'message':_0x3f5bbb(0x11a)};const _0x32869a=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(_0x1b1000?.[_0x3f5bbb(0x114)]()&&!_0x32869a[_0x3f5bbb(0xe3)](_0x1b1000))return{'valid':![],'message':_0x3f5bbb(0xea)};return{'valid':!![]};}function _0x2a50a4(_0x375ac5){const _0x97dd68=_0x3563f0;if(!_0x375ac5[_0x97dd68(0x114)]())return{'valid':!![]};if(_0x375ac5[_0x97dd68(0xf4)]>0x64)return{'valid':![],'message':'应用AppCode长度不能超过\x20100\x20个字符'};const _0x44c0a7=/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;if(!_0x44c0a7[_0x97dd68(0xe3)](_0x375ac5))return{'valid':![],'message':_0x97dd68(0x11e)};return{'valid':!![]};}async function _0x3605d8(){_0x1fe7e2(!![]);try{const _0x5dec89=await getIsSessionValid();return _0x541f06(_0x5dec89),_0x5dec89;}catch(_0x2355f3){return _0x541f06(![]),![];}finally{_0x1fe7e2(![]);}}async function _0x5ac71b(){_0x459835(!![]);try{const _0x1cd061=await authServer({'silent':!![]});return _0x541f06(_0x1cd061),_0x1cd061;}catch(_0x442288){return _0x541f06(![]),![];}finally{_0x459835(![]);}}return useInput(async(_0x551177,_0x339c1c)=>{const _0x2a0674=_0x3563f0;if(_0x339c1c[_0x2a0674(0xe7)]||_0x339c1c['rightArrow']){if(_0x1c8304===_0x2a0674(0x100)){_0x2255a8(_0x252350=>_0x252350===0x0?0x1:0x0);return;}if(_0x1c8304===_0x2a0674(0xfc)){_0x38fda6(_0xfe2b18=>_0xfe2b18===0x0?0x1:0x0);return;}}if(_0x339c1c['return']){if(_0x1c8304===_0x2a0674(0x121)){const _0x4b3ee4=_0x500b14[_0x2a0674(0x114)]()||_0x12bd15;if(_0x1c0582)return;_0x4378c6(_0x4b3ee4),_0x3fb129([{'step':_0x2a0674(0x121),'label':_0x2a0674(0x120),'value':_0x4b3ee4}]),_0x17545a(''),_0x19d0ea(''),_0xc8a810(_0x2a0674(0x103));return;}if(_0x1c8304===_0x2a0674(0x103)){if(_0x1c0582)return;const _0x5a8a97=_0x500b14[_0x2a0674(0x114)]();_0x2c1c51(_0x5a8a97),_0x3fb129(_0x4636ed=>[..._0x4636ed,{'step':_0x2a0674(0x103),'label':_0x2a0674(0x127),'value':_0x5a8a97||_0x2a0674(0xeb)}]),_0x17545a(''),_0x19d0ea('');if(_0x5a8a97){_0xc8a810(_0x2a0674(0xf5));const _0x1375e3=await _0x3605d8();_0x1375e3?_0xc8a810(_0x2a0674(0x100)):_0xc8a810(_0x2a0674(0xfc));}else{const _0x6a1b6=_0x417e6f||_0x3612db||_0x2a0674(0x11c);_0x5b8be1({'projectName':_0xe194b0,'appCode':undefined,'pullApi':![],'env':_0x6a1b6}),_0xc8a810(_0x2a0674(0x108));}return;}if(_0x1c8304===_0x2a0674(0x100)){const _0x2c0c0c=_0x3ed9b3===0x0;_0x156940(_0x2c0c0c),_0x3fb129(_0x5c368f=>[..._0x5c368f,{'step':'api-pull','label':'拉取API配置','value':_0x2c0c0c?'是':'否'}]);const _0x3e667a=_0x417e6f||_0x3612db||_0x2a0674(0x11c);_0x5b8be1({'projectName':_0xe194b0,'appCode':_0x11cdea,'pullApi':_0x2c0c0c,'env':_0x3e667a}),_0xc8a810(_0x2a0674(0x108));return;}if(_0x1c8304===_0x2a0674(0xfc)){const _0x4c6803=_0x1145cc===0x0;if(_0x4c6803){_0xc8a810(_0x2a0674(0x118));const _0x102b2c=await _0x5ac71b();if(_0x102b2c)_0x3fb129(_0x426c89=>[..._0x426c89,{'step':_0x2a0674(0xfd),'label':_0x2a0674(0xf9),'value':_0x2a0674(0xe4)}]),_0xc8a810('confirm-api-pull');else{_0x3fb129(_0x3d7524=>[..._0x3d7524,{'step':_0x2a0674(0xfd),'label':_0x2a0674(0xf9),'value':_0x2a0674(0x10c)}]);const _0x9840f=_0x417e6f||_0x3612db||'online';_0x5b8be1({'projectName':_0xe194b0,'appCode':_0x11cdea,'pullApi':![],'env':_0x9840f}),_0xc8a810(_0x2a0674(0x108));}}else{_0x3fb129(_0x3c1bd3=>[..._0x3c1bd3,{'step':_0x2a0674(0xfd),'label':'登录状态','value':_0x2a0674(0x10a)}]);const _0x5d4908=_0x417e6f||_0x3612db||_0x2a0674(0x11c);_0x5b8be1({'projectName':_0xe194b0,'appCode':_0x11cdea,'pullApi':![],'env':_0x5d4908}),_0xc8a810(_0x2a0674(0x108));}return;}}if(_0x339c1c[_0x2a0674(0xee)]||_0x339c1c[_0x2a0674(0xfe)]){_0x17545a(_0x56aee5=>{const _0x5a975d=_0x2a0674,_0x2632ab=_0x56aee5[_0x5a975d(0x126)](0x0,-0x1);if(_0x1c8304===_0x5a975d(0x121)){const {valid:_0x12f8ab,message:_0x2439c4}=_0x9d0173(_0x2632ab);_0x19d0ea(_0x12f8ab?'':_0x2439c4||_0x5a975d(0x107));}else{if(_0x1c8304===_0x5a975d(0x103)){const {valid:_0x110af2,message:_0x18d830}=_0x2a50a4(_0x2632ab);_0x19d0ea(_0x110af2?'':_0x18d830||_0x5a975d(0xe5));}}return _0x2632ab;});return;}if(['creating','login-check',_0x2a0674(0x118)][_0x2a0674(0x102)](_0x1c8304))return;if(_0x1c8304===_0x2a0674(0x100)||_0x1c8304===_0x2a0674(0xfc))return;_0x17545a(_0x3c1159=>{const _0x4c5c23=_0x2a0674,_0x86a4e3=_0x3c1159+_0x551177;if(_0x1c8304===_0x4c5c23(0x121)){const {valid:_0xc44637,message:_0x42ba39}=_0x9d0173(_0x86a4e3);_0x19d0ea(_0xc44637?'':_0x42ba39||_0x4c5c23(0x107));}else{if(_0x1c8304===_0x4c5c23(0x103)){const {valid:_0x3b6fb2,message:_0x43393e}=_0x2a50a4(_0x86a4e3);_0x19d0ea(_0x3b6fb2?'':_0x43393e||'应用AppCode不合法');}}return _0x86a4e3;});}),a32_0x4d84ce(Box,{'flexDirection':_0x3563f0(0x110),'marginTop':0x1,'children':[_0x112abe['length']===0x0&&a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':_0x3563f0(0xf3),'children':_0x3563f0(0x11f)})}),_0x112abe[_0x3563f0(0x125)](_0x5f46eb=>a32_0x4d84ce(Box,{'children':[a32_0x4d84ce(Text,{'color':'green','children':['√\x20',_0x5f46eb[_0x3563f0(0xe8)],':\x20']}),a32_0x50796c(Text,{'color':_0x3563f0(0xf3),'children':_0x5f46eb[_0x3563f0(0x123)]})]},_0x5f46eb[_0x3563f0(0x11d)])),_0x1c8304===_0x3563f0(0x121)&&a32_0x4d84ce(a32_0x365a4c,{'children':[a32_0x4d84ce(Box,{'children':[a32_0x50796c(Text,{'children':_0x3563f0(0xe9)}),_0x500b14?a32_0x50796c(Text,{'color':'green','children':_0x500b14}):a32_0x50796c(Text,{'color':_0x3563f0(0xfb),'children':_0x12bd15}),_0x1c0582&&a32_0x4d84ce(Text,{'color':_0x3563f0(0x115),'children':[_0x3563f0(0xed),_0x1c0582]})]}),!_0x1c0582&&!_0x500b14&&a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':_0x3563f0(0xfb),'children':_0x3563f0(0x106)})})]}),_0x1c8304===_0x3563f0(0x103)&&a32_0x4d84ce(a32_0x365a4c,{'children':[a32_0x4d84ce(Box,{'children':[a32_0x50796c(Text,{'children':_0x3563f0(0x10e)}),a32_0x50796c(Text,{'color':'gray','children':'[可选]:\x20'}),a32_0x50796c(Text,{'color':'green','children':_0x500b14}),_0x1c0582&&a32_0x4d84ce(Text,{'color':'red','children':['\x20←\x20',_0x1c0582]})]}),!_0x1c0582&&a32_0x50796c(Box,{'children':a32_0x4d84ce(Text,{'color':_0x3563f0(0xfb),'children':['\x20','绑定应用AppCode可自动配置\x20API,如:\x20app-c4c89304\x20(直接回车跳过)']})})]}),_0x1c8304==='login-check'&&a32_0x4d84ce(Box,{'children':[a32_0x50796c(Text,{'children':_0x3563f0(0x128)}),_0x3ac90a&&a32_0x50796c(Text,{'color':_0x3563f0(0xfb),'children':_0x3563f0(0xec)})]}),_0x1c8304==='confirm-api-pull'&&a32_0x4d84ce(a32_0x365a4c,{'children':[a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':_0x3563f0(0xef),'children':_0x3563f0(0xf8)})}),a32_0x50796c(Box,{'marginTop':0x1,'children':a32_0x50796c(Text,{'children':_0x3563f0(0xff)})}),a32_0x4d84ce(Box,{'marginLeft':0x2,'children':[a32_0x4d84ce(Text,{'color':_0x3ed9b3===0x0?_0x3563f0(0xef):_0x3563f0(0xfb),'children':[_0x3ed9b3===0x0?'▶\x20':'\x20\x20','Yes']}),a32_0x50796c(Text,{'children':'\x20'}),a32_0x4d84ce(Text,{'color':_0x3ed9b3===0x1?_0x3563f0(0xef):_0x3563f0(0xfb),'children':[_0x3ed9b3===0x1?'▶\x20':'\x20\x20','No']})]}),a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':_0x3563f0(0xfb),'children':_0x3563f0(0x11b)})}),a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':'yellow','children':_0x3563f0(0x101)})})]}),_0x1c8304===_0x3563f0(0xfc)&&a32_0x4d84ce(a32_0x365a4c,{'children':[a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':_0x3563f0(0x111),'children':_0x3563f0(0xf7)})}),a32_0x50796c(Box,{'marginTop':0x1,'children':a32_0x50796c(Text,{'children':_0x3563f0(0xf6)})}),a32_0x4d84ce(Box,{'marginLeft':0x2,'children':[a32_0x4d84ce(Text,{'color':_0x1145cc===0x0?'green':_0x3563f0(0xfb),'children':[_0x1145cc===0x0?'▶\x20':'\x20\x20',_0x3563f0(0x10f)]}),a32_0x50796c(Text,{'children':'\x20'}),a32_0x4d84ce(Text,{'color':_0x1145cc===0x1?_0x3563f0(0xef):_0x3563f0(0xfb),'children':[_0x1145cc===0x1?'▶\x20':'\x20\x20','No']})]}),a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':_0x3563f0(0xfb),'children':_0x3563f0(0x11b)})}),a32_0x50796c(Box,{'children':a32_0x50796c(Text,{'color':_0x3563f0(0x111),'children':_0x3563f0(0xfa)})})]}),_0x1c8304===_0x3563f0(0x118)&&a32_0x4d84ce(Box,{'children':[a32_0x50796c(Text,{'children':_0x3563f0(0x112)}),_0x27abfa&&a32_0x50796c(Text,{'color':_0x3563f0(0xfb),'children':_0x3563f0(0x109)})]})]});}function a32_0x378b(){const _0x297e63=['*\x20创建新项目','项目名','project-name','25014eiQMiy','value','176485JsTjLG','map','slice','应用AppCode','*\x20正在检查登录状态...','test','已登录','应用AppCode不合法','env','leftArrow','label','*\x20项目名:\x20','项目名只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','未设置','\x20检查中...','\x20←\x20','backspace','green','111zVFWbT','string','my-app','cyan','length','login-check','*\x20是否要先登录以便拉取\x20API\x20配置?','!\x20未检测到有效登录','√\x20检测到有效登录状态','登录状态','\x20\x20推荐选择\x20Yes,登录后可自动拉取并配置\x20API\x20接口','gray','login-prompt','login','delete','*\x20是否要自动拉取\x20API\x20配置?','confirm-api-pull','\x20\x20推荐选择\x20Yes,可自动配置\x20API\x20接口','includes','app-code','58095qsJeWt','16XZdEkY','\x20直接回车确认,或输入自定义名称','项目名不合法','creating','\x20登录中...','跳过登录','8631096eccJOT','登录失败','28oeUJVK','*\x20应用AppCode\x20','Yes','column','yellow','*\x20正在登录,请前往浏览器完成登录...','31874TjKTBY','trim','red','762198vMPfGm','4790522KTxEpd','login-process','1670BVUMNM','项目名长度不能超过\x2050\x20个字符','\x20\x20使用\x20←→\x20选择,回车确认','online','step','应用AppCode只能包含字母、数字、连字符和下划线,且必须以字母或数字开头'];a32_0x378b=function(){return _0x297e63;};return a32_0x378b();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3a3aef,_0x1eec18){const _0x540f61=a33_0x1aa1,_0x16f70b=_0x3a3aef();while(!![]){try{const _0xfb6a58=parseInt(_0x540f61(0x10d))/0x1*(parseInt(_0x540f61(0x10c))/0x2)+parseInt(_0x540f61(0x116))/0x3*(-parseInt(_0x540f61(0x112))/0x4)+parseInt(_0x540f61(0x10e))/0x5*(-parseInt(_0x540f61(0x111))/0x6)+parseInt(_0x540f61(0x119))/0x7+-parseInt(_0x540f61(0x115))/0x8*(parseInt(_0x540f61(0x10f))/0x9)+-parseInt(_0x540f61(0x114))/0xa*(-parseInt(_0x540f61(0x11a))/0xb)+parseInt(_0x540f61(0x110))/0xc;if(_0xfb6a58===_0x1eec18)break;else _0x16f70b['push'](_0x16f70b['shift']());}catch(_0x4f77be){_0x16f70b['push'](_0x16f70b['shift']());}}}(a33_0x339e,0xa2b49));function a33_0x1aa1(_0x4b4da4,_0x2fea45){const _0x339e30=a33_0x339e();return a33_0x1aa1=function(_0x1aa193,_0x3521b4){_0x1aa193=_0x1aa193-0x10c;let _0x9ae9c4=_0x339e30[_0x1aa193];return _0x9ae9c4;},a33_0x1aa1(_0x4b4da4,_0x2fea45);}function a33_0x339e(){const _0x54b6c9=['19506ArnWCA','420HimyjX','replace','40XapixJ','3719704QXNQhr','20229lfPkZF','now','toFixed','6404391jjjulX','707509PeOycM','8pbCBIi','291601wVXfaa','895ezGEox','9MnsKhm','993060hykwNP'];a33_0x339e=function(){return _0x54b6c9;};return a33_0x339e();}export function formatElapsed(_0x4fd9f9){const _0x1036c1=a33_0x1aa1,_0x480225=Date[_0x1036c1(0x117)]()-_0x4fd9f9;if(_0x480225<0x3e8)return _0x480225+'ms';const _0x38d9f0=(_0x480225/0x3e8)[_0x1036c1(0x118)](0x2),_0x4a537c=_0x38d9f0[_0x1036c1(0x113)](/\.?0+$/u,'');return _0x4a537c+'s';}
|
package/lib/create-app/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x3a9b61,_0x13ee8b){const _0x58e31f=a34_0x3c12,_0xc28b24=_0x3a9b61();while(!![]){try{const _0x17769a=parseInt(_0x58e31f(0x83))/0x1+-parseInt(_0x58e31f(0x92))/0x2+parseInt(_0x58e31f(0xa8))/0x3+-parseInt(_0x58e31f(0x82))/0x4+parseInt(_0x58e31f(0xc4))/0x5+parseInt(_0x58e31f(0xd3))/0x6+-parseInt(_0x58e31f(0x97))/0x7;if(_0x17769a===_0x13ee8b)break;else _0xc28b24['push'](_0xc28b24['shift']());}catch(_0x2a1ca7){_0xc28b24['push'](_0xc28b24['shift']());}}}(a34_0x272c,0xe53b8));function a34_0x3c12(_0x3855a4,_0x2befeb){const _0x272c86=a34_0x272c();return a34_0x3c12=function(_0x3c12f0,_0x2ab755){_0x3c12f0=_0x3c12f0-0x82;let _0x2efea9=_0x272c86[_0x3c12f0];return _0x2efea9;},a34_0x3c12(_0x3855a4,_0x2befeb);}import{jsx as a34_0x4ea556,Fragment as a34_0x47651b,jsxs as a34_0x2be763}from'react/jsx-runtime';import a34_0x17f8bf from'node:path';import a34_0x243c10 from'node: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 a34_0x272c(){const _0x49aeaa=['!\x20API\x20配置拉取失败,可稍后手动执行:\x20lovrabet\x20api\x20pull','*\x20配置文件路径:\x20','2.\x20','length','error','create','√\x20配置文件已创建,可稍后使用\x20\x27lovrabet\x20config\x20set\x20appcode\x20<app-code>\x27\x20配置','4756836SnMjWo','1.0.0','*\x20正在更新\x20package.json\x20的\x20name\x20和\x20description\x20字段','\x20创建配置文件','gray','开始创建项目:\x20','*\x20正在为项目\x20','🎉\x20项目创建成功!','warn','5050668yqkIJy','246840pjCEvg','需手动拉取','*\x20清理失败的项目目录:\x20',',\x20description=','resolve','更新\x20package.json\x20失败:\x20','rmSync','name','message','version','项目名称:\x20','项目创建完成:\x20','appCode','cyan','配置应用AppCode:\x20','2030712QGgnTK','\x20|\x20应用AppCode:\x20','pullApi','projectCode','配置应用AppCode失败:\x20','3230283eCFsge','🚀\x20接下来可以:','setLogPath','\x20Generated\x20by\x20lovrabet\x20cli\x20','string','online','log','info','url','×\x20无法在当前目录创建项目,请检查目录权限','description','projectName','未配置','启动项目:\x20','📦\x20API配置:\x20','\x20√\x20','package.json','3030354oMnmJe','更新\x20package.json\x20name\x20和\x20description\x20字段','parse','API\x20配置拉取成功:\x20','cwd','column','√\x20API\x20配置拉取完成','√\x20配置文件已创建,应用AppCode:\x20','../..','📁\x20项目名称:\x20','accessSync','1.\x20','green','repeat','env','writeFileSync','API\x20配置拉取异常:\x20','W_OK','*\x20正在拉取\x20API\x20配置...','utf8','清理项目目录失败:\x20','lovrabet\x20api\x20pull\x20--appcode\x20[app-code]','existsSync','join','dirname','stringify','项目创建失败:\x20','拉取API配置:\x20','8143320bNZSYB','API\x20配置拉取失败:\x20','doTask','constants','×\x20项目名过长,最多支持\x20100\x20个字符','readFileSync','white','cd\x20'];a34_0x272c=function(){return _0x49aeaa;};return a34_0x272c();}import{TaskRunning}from'./task-running.js';import{logger}from'../utils/logger.js';export function CreateApp(_0x5c75ee){const _0x48bf82=a34_0x3c12,[_0x1c4ca3,_0x49ee48]=useState(![]),[_0x197f10,_0x58358d]=useState(![]),[_0x52cc08,_0x26ad68]=useState(null),_0x32307d=useCopyProjectTemplate(),_0x1d2568=useInstallDependencies(),_0x35bf32=useFormatCode(),_0x5f26ea=async _0x651f1f=>{const _0x32da1f=a34_0x3c12;if(!_0x651f1f[_0x32da1f(0xa2)]||_0x651f1f[_0x32da1f(0xa2)]['trim']()===''){console[_0x32da1f(0xd0)]('×\x20项目名不能为空');return;}const _0x51389c=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x51389c['test'](_0x651f1f[_0x32da1f(0xa2)])){console[_0x32da1f(0xd0)]('×\x20项目名包含非法字符,不允许使用:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20及控制字符');return;}if(_0x651f1f['projectName'][_0x32da1f(0xcf)]>0x64){console[_0x32da1f(0xd0)](_0x32da1f(0xc8));return;}const _0x41c6e1=a34_0x17f8bf[_0x32da1f(0x87)](process[_0x32da1f(0xac)](),_0x651f1f[_0x32da1f(0xa2)]);if(a34_0x243c10[_0x32da1f(0xbe)](_0x41c6e1)){console[_0x32da1f(0xd0)]('×\x20项目目录\x20'+_0x651f1f[_0x32da1f(0xa2)]+'\x20已存在,请使用其他项目名');return;}try{const _0x1823a6=a34_0x17f8bf[_0x32da1f(0xc0)](_0x41c6e1);a34_0x243c10[_0x32da1f(0xb2)](_0x1823a6,a34_0x243c10[_0x32da1f(0xc7)][_0x32da1f(0xb9)]);}catch(_0x2268d3){console['error'](_0x32da1f(0xa0));return;}_0x26ad68(_0x651f1f),_0x49ee48(!![]),logger[_0x32da1f(0x99)](_0x41c6e1),logger[_0x32da1f(0x9e)](_0x32da1f(0xd1),_0x32da1f(0xd8)+_0x651f1f['projectName'],{'projectDir':_0x41c6e1,'appCode':_0x651f1f[_0x32da1f(0x8f)]});try{await _0x32307d[_0x32da1f(0xc6)](_0x651f1f[_0x32da1f(0xa2)]),await _0x12f7b1(_0x651f1f['projectName']),await _0x1d2568[_0x32da1f(0xc6)](_0x651f1f['projectName']),await _0x35bf32[_0x32da1f(0xc6)](_0x651f1f[_0x32da1f(0xa2)]),await _0x401260(_0x651f1f[_0x32da1f(0xa2)],_0x651f1f[_0x32da1f(0x8f)]||'',_0x651f1f[_0x32da1f(0xb6)]);if(_0x651f1f[_0x32da1f(0x94)]&&_0x651f1f['appCode']){console[_0x32da1f(0x9d)](_0x32da1f(0xba));try{const _0x26e9ab=await pullApiSilent(_0x651f1f[_0x32da1f(0x8f)],undefined,_0x41c6e1,_0x651f1f[_0x32da1f(0xb6)]);_0x26e9ab?(console['log'](_0x32da1f(0xae)),logger[_0x32da1f(0x9e)](_0x32da1f(0xd1),_0x32da1f(0xab)+_0x651f1f[_0x32da1f(0x8f)],{'projectDir':_0x41c6e1,'appCode':_0x651f1f[_0x32da1f(0x8f)],'env':_0x651f1f['env']})):(console['log'](_0x32da1f(0xcc)),logger[_0x32da1f(0xdb)](_0x32da1f(0xd1),_0x32da1f(0xc5)+_0x651f1f[_0x32da1f(0x8f)],{'projectDir':_0x41c6e1,'appCode':_0x651f1f[_0x32da1f(0x8f)],'env':_0x651f1f[_0x32da1f(0xb6)]}));}catch(_0xc7127a){console[_0x32da1f(0x9d)]('!\x20API\x20配置拉取异常,项目已创建,可稍后手动执行:\x20lovrabet\x20api\x20pull'),logger[_0x32da1f(0xdb)]('create',_0x32da1f(0xb8)+_0x651f1f[_0x32da1f(0x8f)],{'projectDir':_0x41c6e1,'appCode':_0x651f1f['appCode'],'env':_0x651f1f['env'],'error':_0xc7127a instanceof Error?_0xc7127a[_0x32da1f(0x8b)]:String(_0xc7127a)});}}logger['success'](_0x32da1f(0xd1),_0x32da1f(0x8e)+_0x651f1f[_0x32da1f(0xa2)]),_0x58358d(!![]),_0x49ee48(![]);}catch(_0x46fc5e){logger[_0x32da1f(0xd0)](_0x32da1f(0xd1),_0x32da1f(0xc2)+_0x651f1f[_0x32da1f(0xa2)],{'error':_0x46fc5e instanceof Error?_0x46fc5e[_0x32da1f(0x8b)]:String(_0x46fc5e)});try{a34_0x243c10[_0x32da1f(0xbe)](_0x41c6e1)&&(console[_0x32da1f(0x9d)](_0x32da1f(0x85)+_0x41c6e1),a34_0x243c10[_0x32da1f(0x89)](_0x41c6e1,{'recursive':!![],'force':!![]}));}catch(_0xb41ae2){logger['warn'](_0x32da1f(0xd1),_0x32da1f(0xbc)+_0x41c6e1,{'error':_0xb41ae2 instanceof Error?_0xb41ae2[_0x32da1f(0x8b)]:String(_0xb41ae2)});}_0x49ee48(![]),console[_0x32da1f(0xd0)]('×\x20项目创建失败:\x20'+(_0x46fc5e instanceof Error?_0x46fc5e[_0x32da1f(0x8b)]:String(_0x46fc5e)));}},_0x2a8101=async _0x38cd1a=>{await _0x5f26ea({'projectName':_0x38cd1a,'env':_0x5c75ee['env']});},_0x12f7b1=async _0x6bf197=>{const _0x1347d7=a34_0x3c12,_0x546718=a34_0x17f8bf['resolve'](process[_0x1347d7(0xac)](),_0x6bf197),_0x481902=a34_0x17f8bf[_0x1347d7(0xbf)](_0x546718,'package.json');try{console['log'](_0x1347d7(0xd5));const _0x2b235b=fileURLToPath(import.meta[_0x1347d7(0x9f)]),_0x1f5277=a34_0x17f8bf['resolve'](a34_0x17f8bf['dirname'](_0x2b235b),_0x1347d7(0xb0)),_0x421eba=a34_0x17f8bf[_0x1347d7(0xbf)](_0x1f5277,_0x1347d7(0xa7));let _0x55fdc4=_0x1347d7(0xd4);try{const _0x103eb6=JSON[_0x1347d7(0xaa)](a34_0x243c10[_0x1347d7(0xc9)](_0x421eba,_0x1347d7(0xbb)));_0x55fdc4=_0x103eb6[_0x1347d7(0x8c)]||_0x1347d7(0xd4);}catch(_0x14cb58){}const _0x3285d1=a34_0x243c10[_0x1347d7(0xc9)](_0x481902,_0x1347d7(0xbb)),_0x5a789e=JSON[_0x1347d7(0xaa)](_0x3285d1);_0x5a789e[_0x1347d7(0x8a)]=_0x6bf197,_0x5a789e[_0x1347d7(0xa1)]=_0x6bf197+_0x1347d7(0x9a)+_0x55fdc4,a34_0x243c10['writeFileSync'](_0x481902,JSON[_0x1347d7(0xc1)](_0x5a789e,null,0x2)+'\x0a',_0x1347d7(0xbb)),console['log']('√\x20package.json\x20已更新:\x20name='+_0x6bf197+_0x1347d7(0x86)+_0x5a789e[_0x1347d7(0xa1)]),logger[_0x1347d7(0x9e)](_0x1347d7(0xd1),_0x1347d7(0xa9),{'projectName':_0x6bf197,'description':_0x5a789e[_0x1347d7(0xa1)],'cliVersion':_0x55fdc4,'packageJsonPath':'package.json'});}catch(_0x21199d){logger[_0x1347d7(0xd0)](_0x1347d7(0xd1),_0x1347d7(0x88)+_0x6bf197,{'projectName':_0x6bf197,'error':_0x21199d instanceof Error?_0x21199d[_0x1347d7(0x8b)]:String(_0x21199d)});throw _0x21199d;}},_0x401260=async(_0x586fc3,_0xcdbe67,_0x5c0174)=>{const _0x1ae6a1=a34_0x3c12,_0x19b8ce=a34_0x17f8bf[_0x1ae6a1(0x87)](process['cwd'](),_0x586fc3),_0x1adfc6=a34_0x17f8bf[_0x1ae6a1(0xbf)](_0x19b8ce,'.lovrabetrc');try{_0xcdbe67?console['log'](_0x1ae6a1(0xd9)+_0x586fc3+'\x20配置应用AppCode:\x20'+_0xcdbe67):console['log'](_0x1ae6a1(0xd9)+_0x586fc3+_0x1ae6a1(0xd6));console[_0x1ae6a1(0x9d)](_0x1ae6a1(0xcd)+_0x1adfc6);const _0x3beb3a=fileURLToPath(import.meta[_0x1ae6a1(0x9f)]),_0x294543=a34_0x17f8bf['resolve'](a34_0x17f8bf[_0x1ae6a1(0xc0)](_0x3beb3a),_0x1ae6a1(0xb0)),_0x36a116=a34_0x17f8bf[_0x1ae6a1(0xbf)](_0x294543,_0x1ae6a1(0xa7));let _0x21be7d=_0x1ae6a1(0xd4);try{const _0x5cfe97=JSON[_0x1ae6a1(0xaa)](a34_0x243c10[_0x1ae6a1(0xc9)](_0x36a116,_0x1ae6a1(0xbb)));_0x21be7d=_0x5cfe97[_0x1ae6a1(0x8c)]||_0x1ae6a1(0xd4);}catch(_0x405c8b){}const _0x37e893=readConfig(),_0x3b9e04=typeof _0x37e893[_0x1ae6a1(0xb6)]===_0x1ae6a1(0x9b)?_0x37e893[_0x1ae6a1(0xb6)]:undefined,{app:_0x214817,appcode:_0x3a3ad1,..._0x2b4c02}=_0x37e893,_0x16b09b={..._0x2b4c02,'appcode':_0xcdbe67||'','env':_0x5c0174||_0x3b9e04||_0x1ae6a1(0x9c),'createdAt':new Date()['toLocaleString'](),'version':_0x21be7d};a34_0x243c10[_0x1ae6a1(0xb7)](_0x1adfc6,JSON[_0x1ae6a1(0xc1)](_0x16b09b,null,0x2),_0x1ae6a1(0xbb)),_0xcdbe67?console[_0x1ae6a1(0x9d)](_0x1ae6a1(0xaf)+_0xcdbe67):console[_0x1ae6a1(0x9d)](_0x1ae6a1(0xd2)),logger[_0x1ae6a1(0x9e)](_0x1ae6a1(0xd1),_0x1ae6a1(0x91)+_0xcdbe67,{'projectName':_0x586fc3,'configFile':'.lovrabetrc'});}catch(_0x12e082){logger[_0x1ae6a1(0xd0)](_0x1ae6a1(0xd1),_0x1ae6a1(0x96)+_0xcdbe67,{'projectName':_0x586fc3,'error':_0x12e082 instanceof Error?_0x12e082['message']:String(_0x12e082)});}};useEffect(()=>{const _0x37be3d=a34_0x3c12;_0x5c75ee[_0x37be3d(0x95)]&&_0x2a8101(_0x5c75ee[_0x37be3d(0x95)]);},[_0x5c75ee[_0x48bf82(0x95)]]);if(!_0x1c4ca3&&!_0x197f10&&!_0x5c75ee[_0x48bf82(0x95)])return a34_0x4ea556(EnhancedGuidedCreate,{'onCreate':_0x5f26ea,'env':_0x5c75ee['env']});if(_0x1c4ca3)return a34_0x2be763(a34_0x47651b,{'children':[a34_0x2be763(Box,{'marginTop':0x1,'children':[a34_0x4ea556(Box,{'width':'1'}),a34_0x4ea556(Text,{'color':'green','children':_0x48bf82(0xa6)}),a34_0x4ea556(Text,{'children':_0x48bf82(0x8d)}),a34_0x4ea556(Text,{'color':_0x48bf82(0xb4),'children':_0x52cc08?.[_0x48bf82(0xa2)]}),_0x52cc08?.[_0x48bf82(0x8f)]&&a34_0x2be763(a34_0x47651b,{'children':[a34_0x4ea556(Text,{'children':_0x48bf82(0x93)}),a34_0x4ea556(Text,{'color':_0x48bf82(0x90),'children':_0x52cc08[_0x48bf82(0x8f)]})]})]}),a34_0x4ea556(TaskRunning,{..._0x32307d}),a34_0x4ea556(TaskRunning,{..._0x1d2568}),a34_0x4ea556(TaskRunning,{..._0x35bf32})]});if(_0x197f10)return a34_0x2be763(a34_0x47651b,{'children':[a34_0x2be763(Box,{'marginTop':0x1,'children':[a34_0x4ea556(Box,{'width':'1'}),a34_0x4ea556(Text,{'color':_0x48bf82(0xb4),'children':_0x48bf82(0xa6)}),a34_0x4ea556(Text,{'children':'项目名称:\x20'}),a34_0x4ea556(Text,{'color':_0x48bf82(0xb4),'children':_0x52cc08?.[_0x48bf82(0xa2)]}),_0x52cc08?.['appCode']&&a34_0x2be763(a34_0x47651b,{'children':[a34_0x4ea556(Text,{'children':_0x48bf82(0x93)}),a34_0x4ea556(Text,{'color':'cyan','children':_0x52cc08['appCode']})]})]}),a34_0x4ea556(TaskFinished,{..._0x32307d}),a34_0x4ea556(TaskFinished,{..._0x1d2568}),a34_0x4ea556(TaskFinished,{..._0x35bf32}),a34_0x4ea556(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a34_0x4ea556(Text,{'color':_0x48bf82(0xb4),'children':'─'[_0x48bf82(0xb5)](0x3c)})}),a34_0x4ea556(Box,{'children':a34_0x4ea556(Text,{'color':_0x48bf82(0xb4),'bold':!![],'children':_0x48bf82(0xda)})}),a34_0x2be763(Box,{'marginTop':0x1,'flexDirection':_0x48bf82(0xad),'children':[a34_0x2be763(Box,{'children':[a34_0x4ea556(Text,{'color':'cyan','children':_0x48bf82(0xb1)}),a34_0x4ea556(Text,{'color':_0x48bf82(0xca),'bold':!![],'children':_0x52cc08?.[_0x48bf82(0xa2)]})]}),_0x52cc08?.[_0x48bf82(0x8f)]&&a34_0x2be763(Box,{'children':[a34_0x4ea556(Text,{'color':'cyan','children':'🔗\x20应用AppCode:\x20'}),a34_0x4ea556(Text,{'color':'white','bold':!![],'children':_0x52cc08[_0x48bf82(0x8f)]})]}),a34_0x2be763(Box,{'children':[a34_0x4ea556(Text,{'color':'cyan','children':_0x48bf82(0xa5)}),_0x52cc08?.[_0x48bf82(0x94)]?a34_0x4ea556(Text,{'color':_0x48bf82(0xb4),'bold':!![],'children':'已自动拉取\x20✓'}):_0x52cc08?.[_0x48bf82(0x8f)]?a34_0x4ea556(Text,{'color':'yellow','bold':!![],'children':_0x48bf82(0x84)}):a34_0x4ea556(Text,{'color':_0x48bf82(0xd7),'bold':!![],'children':_0x48bf82(0xa3)})]})]}),a34_0x4ea556(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a34_0x4ea556(Text,{'color':_0x48bf82(0x90),'bold':!![],'children':_0x48bf82(0x98)})}),a34_0x2be763(Box,{'marginLeft':0x2,'flexDirection':'column','children':[a34_0x2be763(Box,{'children':[a34_0x4ea556(Text,{'color':'green','children':_0x48bf82(0xb3)}),a34_0x4ea556(Text,{'color':_0x48bf82(0xca),'children':_0x48bf82(0xa4)}),a34_0x4ea556(Text,{'color':'cyan','bold':!![],'children':_0x48bf82(0xcb)+_0x52cc08?.['projectName']+'\x20&&\x20lovrabet\x20start'})]}),_0x52cc08?.[_0x48bf82(0x8f)]&&!_0x52cc08?.[_0x48bf82(0x94)]&&a34_0x2be763(Box,{'children':[a34_0x4ea556(Text,{'color':'yellow','children':_0x48bf82(0xce)}),a34_0x4ea556(Text,{'color':_0x48bf82(0xca),'children':_0x48bf82(0xc3)}),a34_0x4ea556(Text,{'color':_0x48bf82(0x90),'bold':!![],'children':'lovrabet\x20api\x20pull'})]}),!_0x52cc08?.[_0x48bf82(0x8f)]&&a34_0x2be763(a34_0x47651b,{'children':[a34_0x2be763(Box,{'children':[a34_0x4ea556(Text,{'color':_0x48bf82(0xd7),'children':_0x48bf82(0xce)}),a34_0x4ea556(Text,{'color':_0x48bf82(0xca),'children':'配置AppCode:\x20'}),a34_0x4ea556(Text,{'color':_0x48bf82(0x90),'bold':!![],'children':'lovrabet\x20config\x20set\x20appcode\x20[app-code]'})]}),a34_0x2be763(Box,{'children':[a34_0x4ea556(Text,{'color':'gray','children':'3.\x20'}),a34_0x4ea556(Text,{'color':_0x48bf82(0xca),'children':_0x48bf82(0xc3)}),a34_0x4ea556(Text,{'color':_0x48bf82(0x90),'bold':!![],'children':_0x48bf82(0xbd)})]})]})]}),a34_0x4ea556(Box,{'marginTop':0x1,'children':a34_0x4ea556(Text,{'color':_0x48bf82(0xb4),'children':'─'[_0x48bf82(0xb5)](0x3c)})})]});return null;}
|
|
1
|
+
(function(_0x507911,_0x3022ea){const _0x6f40f9=a34_0x55d9,_0x822390=_0x507911();while(!![]){try{const _0x28f6e6=parseInt(_0x6f40f9(0xa6))/0x1+parseInt(_0x6f40f9(0xfa))/0x2+parseInt(_0x6f40f9(0xcc))/0x3+parseInt(_0x6f40f9(0xa5))/0x4+-parseInt(_0x6f40f9(0xe2))/0x5*(-parseInt(_0x6f40f9(0xe8))/0x6)+-parseInt(_0x6f40f9(0xa4))/0x7*(-parseInt(_0x6f40f9(0xbb))/0x8)+-parseInt(_0x6f40f9(0xca))/0x9;if(_0x28f6e6===_0x3022ea)break;else _0x822390['push'](_0x822390['shift']());}catch(_0x3493e4){_0x822390['push'](_0x822390['shift']());}}}(a34_0x2db3,0x7926a));function a34_0x2db3(){const _0x285298=['name','清理项目目录失败:\x20','gray','error','cwd','配置AppCode:\x20','🚀\x20接下来可以:','green','parse','toLocaleString','项目创建完成:\x20','env','已自动拉取\x20✓','appCode','create','拉取API配置:\x20','lovrabet\x20config\x20set\x20appcode\x20[app-code]','1192yLdTrG','../..','info','url','\x20配置应用AppCode:\x20','*\x20正在为项目\x20','rmSync','test','3.\x20','doTask','开始创建项目:\x20','message','API\x20配置拉取失败:\x20','未配置','setLogPath','19270953mJEiAk','online','516444BpAuwT','2.\x20','existsSync','\x20√\x20','API\x20配置拉取异常:\x20','resolve','readFileSync','×\x20项目名不能为空','version','🔗\x20应用AppCode:\x20','join','cyan','1.\x20','projectCode','√\x20API\x20配置拉取完成','启动项目:\x20','√\x20配置文件已创建,可稍后使用\x20\x27lovrabet\x20config\x20set\x20appcode\x20<app-code>\x27\x20配置','description','warn','cd\x20','*\x20配置文件路径:\x20','length','1930150ADUxHo','×\x20项目名过长,最多支持\x20100\x20个字符','accessSync','1.0.0','white','*\x20清理失败的项目目录:\x20','6coDinI','column','\x20创建配置文件','√\x20配置文件已创建,应用AppCode:\x20','dirname','package.json','配置应用AppCode:\x20','utf8','*\x20正在拉取\x20API\x20配置...','!\x20API\x20配置拉取失败,可稍后手动执行:\x20lovrabet\x20api\x20pull','📁\x20项目名称:\x20','×\x20项目创建失败:\x20','\x20Generated\x20by\x20lovrabet\x20cli\x20','log','√\x20package.json\x20已更新:\x20name=','success','更新\x20package.json\x20失败:\x20','\x20已存在,请使用其他项目名','404070WwgySp',',\x20description=','项目名称:\x20','API\x20配置拉取成功:\x20','!\x20API\x20配置拉取异常,项目已创建,可稍后手动执行:\x20lovrabet\x20api\x20pull','需手动拉取','pullApi','W_OK','\x20|\x20应用AppCode:\x20','projectName','36519fwSeUc','1737920wLaHaO','665425aaJWBt','×\x20项目目录\x20','yellow','repeat'];a34_0x2db3=function(){return _0x285298;};return a34_0x2db3();}import{jsx as a34_0x4705e3,Fragment as a34_0x243601,jsxs as a34_0x191d5b}from'react/jsx-runtime';import a34_0x312b67 from'node:path';import a34_0x316816 from'node:fs';import{fileURLToPath}from'node:url';function a34_0x55d9(_0x20563f,_0x4a8f3a){const _0x2db3a2=a34_0x2db3();return a34_0x55d9=function(_0x55d97e,_0x4d7dbf){_0x55d97e=_0x55d97e-0xa4;let _0x2f120a=_0x2db3a2[_0x55d97e];return _0x2f120a;},a34_0x55d9(_0x20563f,_0x4a8f3a);}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';import{TaskRunning}from'./task-running.js';import{logger}from'../utils/logger.js';export function CreateApp(_0x429558){const _0x237efe=a34_0x55d9,[_0x323ba0,_0xf347fe]=useState(![]),[_0x3885c2,_0x11b488]=useState(![]),[_0x2dece0,_0x2fcf2c]=useState(null),_0x1a3140=useCopyProjectTemplate(),_0x19c758=useInstallDependencies(),_0x3e2c02=useFormatCode(),_0x4077d9=async _0x994006=>{const _0x26de6b=a34_0x55d9;if(!_0x994006[_0x26de6b(0x103)]||_0x994006[_0x26de6b(0x103)]['trim']()===''){console['error'](_0x26de6b(0xd3));return;}const _0x51eff0=/[<>:"|?*\x00-\x1f\x7f]/;if(_0x51eff0[_0x26de6b(0xc2)](_0x994006[_0x26de6b(0x103)])){console['error']('×\x20项目名包含非法字符,不允许使用:\x20<\x20>\x20:\x20\x22\x20|\x20?\x20*\x20及控制字符');return;}if(_0x994006[_0x26de6b(0x103)][_0x26de6b(0xe1)]>0x64){console['error'](_0x26de6b(0xe3));return;}const _0x57fabf=a34_0x312b67[_0x26de6b(0xd1)](process['cwd'](),_0x994006[_0x26de6b(0x103)]);if(a34_0x316816[_0x26de6b(0xce)](_0x57fabf)){console['error'](_0x26de6b(0xa7)+_0x994006['projectName']+_0x26de6b(0xf9));return;}try{const _0x5d3ee1=a34_0x312b67['dirname'](_0x57fabf);a34_0x316816[_0x26de6b(0xe4)](_0x5d3ee1,a34_0x316816['constants'][_0x26de6b(0x101)]);}catch(_0x49bbc1){console[_0x26de6b(0xad)]('×\x20无法在当前目录创建项目,请检查目录权限');return;}_0x2fcf2c(_0x994006),_0xf347fe(!![]),logger[_0x26de6b(0xc9)](_0x57fabf),logger[_0x26de6b(0xbd)](_0x26de6b(0xb8),_0x26de6b(0xc5)+_0x994006[_0x26de6b(0x103)],{'projectDir':_0x57fabf,'appCode':_0x994006[_0x26de6b(0xb7)]});try{await _0x1a3140[_0x26de6b(0xc4)](_0x994006[_0x26de6b(0x103)]),await _0x4ea1d2(_0x994006['projectName']),await _0x19c758[_0x26de6b(0xc4)](_0x994006[_0x26de6b(0x103)]),await _0x3e2c02[_0x26de6b(0xc4)](_0x994006[_0x26de6b(0x103)]),await _0x1bb1b6(_0x994006['projectName'],_0x994006[_0x26de6b(0xb7)]||'',_0x994006[_0x26de6b(0xb5)]);if(_0x994006[_0x26de6b(0x100)]&&_0x994006[_0x26de6b(0xb7)]){console[_0x26de6b(0xf5)](_0x26de6b(0xf0));try{const _0x4822f1=await pullApiSilent(_0x994006['appCode'],undefined,_0x57fabf,_0x994006[_0x26de6b(0xb5)]);_0x4822f1?(console['log'](_0x26de6b(0xda)),logger[_0x26de6b(0xbd)](_0x26de6b(0xb8),_0x26de6b(0xfd)+_0x994006['appCode'],{'projectDir':_0x57fabf,'appCode':_0x994006[_0x26de6b(0xb7)],'env':_0x994006[_0x26de6b(0xb5)]})):(console[_0x26de6b(0xf5)](_0x26de6b(0xf1)),logger[_0x26de6b(0xde)](_0x26de6b(0xb8),_0x26de6b(0xc7)+_0x994006[_0x26de6b(0xb7)],{'projectDir':_0x57fabf,'appCode':_0x994006[_0x26de6b(0xb7)],'env':_0x994006[_0x26de6b(0xb5)]}));}catch(_0xac57f6){console['log'](_0x26de6b(0xfe)),logger[_0x26de6b(0xde)](_0x26de6b(0xb8),_0x26de6b(0xd0)+_0x994006[_0x26de6b(0xb7)],{'projectDir':_0x57fabf,'appCode':_0x994006[_0x26de6b(0xb7)],'env':_0x994006[_0x26de6b(0xb5)],'error':_0xac57f6 instanceof Error?_0xac57f6[_0x26de6b(0xc6)]:String(_0xac57f6)});}}logger[_0x26de6b(0xf7)](_0x26de6b(0xb8),_0x26de6b(0xb4)+_0x994006['projectName']),_0x11b488(!![]),_0xf347fe(![]);}catch(_0x1fd4a8){logger['error'](_0x26de6b(0xb8),'项目创建失败:\x20'+_0x994006[_0x26de6b(0x103)],{'error':_0x1fd4a8 instanceof Error?_0x1fd4a8[_0x26de6b(0xc6)]:String(_0x1fd4a8)});try{a34_0x316816[_0x26de6b(0xce)](_0x57fabf)&&(console[_0x26de6b(0xf5)](_0x26de6b(0xe7)+_0x57fabf),a34_0x316816[_0x26de6b(0xc1)](_0x57fabf,{'recursive':!![],'force':!![]}));}catch(_0x29dc1f){logger[_0x26de6b(0xde)](_0x26de6b(0xb8),_0x26de6b(0xab)+_0x57fabf,{'error':_0x29dc1f instanceof Error?_0x29dc1f['message']:String(_0x29dc1f)});}_0xf347fe(![]),console[_0x26de6b(0xad)](_0x26de6b(0xf3)+(_0x1fd4a8 instanceof Error?_0x1fd4a8[_0x26de6b(0xc6)]:String(_0x1fd4a8)));}},_0x2b8c5d=async _0x2a28f0=>{const _0x5e0df0=a34_0x55d9;await _0x4077d9({'projectName':_0x2a28f0,'env':_0x429558[_0x5e0df0(0xb5)]});},_0x4ea1d2=async _0xfd9ccd=>{const _0x3d4737=a34_0x55d9,_0x13e0d9=a34_0x312b67[_0x3d4737(0xd1)](process[_0x3d4737(0xae)](),_0xfd9ccd),_0x28a2c7=a34_0x312b67[_0x3d4737(0xd6)](_0x13e0d9,_0x3d4737(0xed));try{console[_0x3d4737(0xf5)]('*\x20正在更新\x20package.json\x20的\x20name\x20和\x20description\x20字段');const _0x5dff39=fileURLToPath(import.meta[_0x3d4737(0xbe)]),_0x59179a=a34_0x312b67['resolve'](a34_0x312b67['dirname'](_0x5dff39),_0x3d4737(0xbc)),_0x5ca8ef=a34_0x312b67[_0x3d4737(0xd6)](_0x59179a,_0x3d4737(0xed));let _0x723617=_0x3d4737(0xe5);try{const _0x7b7305=JSON[_0x3d4737(0xb2)](a34_0x316816[_0x3d4737(0xd2)](_0x5ca8ef,_0x3d4737(0xef)));_0x723617=_0x7b7305['version']||_0x3d4737(0xe5);}catch(_0x2449ec){}const _0x121e34=a34_0x316816['readFileSync'](_0x28a2c7,_0x3d4737(0xef)),_0x1cd8a9=JSON[_0x3d4737(0xb2)](_0x121e34);_0x1cd8a9[_0x3d4737(0xaa)]=_0xfd9ccd,_0x1cd8a9[_0x3d4737(0xdd)]=_0xfd9ccd+_0x3d4737(0xf4)+_0x723617,a34_0x316816['writeFileSync'](_0x28a2c7,JSON['stringify'](_0x1cd8a9,null,0x2)+'\x0a',_0x3d4737(0xef)),console[_0x3d4737(0xf5)](_0x3d4737(0xf6)+_0xfd9ccd+_0x3d4737(0xfb)+_0x1cd8a9['description']),logger[_0x3d4737(0xbd)](_0x3d4737(0xb8),'更新\x20package.json\x20name\x20和\x20description\x20字段',{'projectName':_0xfd9ccd,'description':_0x1cd8a9[_0x3d4737(0xdd)],'cliVersion':_0x723617,'packageJsonPath':'package.json'});}catch(_0x4b8e7e){logger[_0x3d4737(0xad)]('create',_0x3d4737(0xf8)+_0xfd9ccd,{'projectName':_0xfd9ccd,'error':_0x4b8e7e instanceof Error?_0x4b8e7e[_0x3d4737(0xc6)]:String(_0x4b8e7e)});throw _0x4b8e7e;}},_0x1bb1b6=async(_0x407204,_0x55e47d,_0x3ccd1b)=>{const _0x6439ad=a34_0x55d9,_0x10a048=a34_0x312b67['resolve'](process[_0x6439ad(0xae)](),_0x407204),_0x13b6b9=a34_0x312b67[_0x6439ad(0xd6)](_0x10a048,'.lovrabetrc');try{_0x55e47d?console[_0x6439ad(0xf5)](_0x6439ad(0xc0)+_0x407204+_0x6439ad(0xbf)+_0x55e47d):console['log'](_0x6439ad(0xc0)+_0x407204+_0x6439ad(0xea));console['log'](_0x6439ad(0xe0)+_0x13b6b9);const _0x3f4b83=fileURLToPath(import.meta[_0x6439ad(0xbe)]),_0x27e039=a34_0x312b67[_0x6439ad(0xd1)](a34_0x312b67[_0x6439ad(0xec)](_0x3f4b83),_0x6439ad(0xbc)),_0x2fdc19=a34_0x312b67[_0x6439ad(0xd6)](_0x27e039,_0x6439ad(0xed));let _0x52b34a=_0x6439ad(0xe5);try{const _0x5eb853=JSON[_0x6439ad(0xb2)](a34_0x316816[_0x6439ad(0xd2)](_0x2fdc19,_0x6439ad(0xef)));_0x52b34a=_0x5eb853[_0x6439ad(0xd4)]||_0x6439ad(0xe5);}catch(_0x343ffe){}const _0x31a4d0=readConfig(),_0x3944d2=typeof _0x31a4d0['env']==='string'?_0x31a4d0[_0x6439ad(0xb5)]:undefined,{app:_0x107295,appcode:_0x41090f,..._0x557cb4}=_0x31a4d0,_0x4e7916={..._0x557cb4,'appcode':_0x55e47d||'','env':_0x3ccd1b||_0x3944d2||_0x6439ad(0xcb),'createdAt':new Date()[_0x6439ad(0xb3)](),'version':_0x52b34a};a34_0x316816['writeFileSync'](_0x13b6b9,JSON['stringify'](_0x4e7916,null,0x2),_0x6439ad(0xef)),_0x55e47d?console[_0x6439ad(0xf5)](_0x6439ad(0xeb)+_0x55e47d):console[_0x6439ad(0xf5)](_0x6439ad(0xdc)),logger[_0x6439ad(0xbd)]('create',_0x6439ad(0xee)+_0x55e47d,{'projectName':_0x407204,'configFile':'.lovrabetrc'});}catch(_0x57087e){logger['error'](_0x6439ad(0xb8),'配置应用AppCode失败:\x20'+_0x55e47d,{'projectName':_0x407204,'error':_0x57087e instanceof Error?_0x57087e[_0x6439ad(0xc6)]:String(_0x57087e)});}};useEffect(()=>{const _0x378622=a34_0x55d9;_0x429558[_0x378622(0xd9)]&&_0x2b8c5d(_0x429558[_0x378622(0xd9)]);},[_0x429558['projectCode']]);if(!_0x323ba0&&!_0x3885c2&&!_0x429558[_0x237efe(0xd9)])return a34_0x4705e3(EnhancedGuidedCreate,{'onCreate':_0x4077d9,'env':_0x429558[_0x237efe(0xb5)]});if(_0x323ba0)return a34_0x191d5b(a34_0x243601,{'children':[a34_0x191d5b(Box,{'marginTop':0x1,'children':[a34_0x4705e3(Box,{'width':'1'}),a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'children':_0x237efe(0xcf)}),a34_0x4705e3(Text,{'children':_0x237efe(0xfc)}),a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'children':_0x2dece0?.['projectName']}),_0x2dece0?.[_0x237efe(0xb7)]&&a34_0x191d5b(a34_0x243601,{'children':[a34_0x4705e3(Text,{'children':_0x237efe(0x102)}),a34_0x4705e3(Text,{'color':'cyan','children':_0x2dece0[_0x237efe(0xb7)]})]})]}),a34_0x4705e3(TaskRunning,{..._0x1a3140}),a34_0x4705e3(TaskRunning,{..._0x19c758}),a34_0x4705e3(TaskRunning,{..._0x3e2c02})]});if(_0x3885c2)return a34_0x191d5b(a34_0x243601,{'children':[a34_0x191d5b(Box,{'marginTop':0x1,'children':[a34_0x4705e3(Box,{'width':'1'}),a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'children':_0x237efe(0xcf)}),a34_0x4705e3(Text,{'children':'项目名称:\x20'}),a34_0x4705e3(Text,{'color':'green','children':_0x2dece0?.[_0x237efe(0x103)]}),_0x2dece0?.['appCode']&&a34_0x191d5b(a34_0x243601,{'children':[a34_0x4705e3(Text,{'children':_0x237efe(0x102)}),a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'children':_0x2dece0[_0x237efe(0xb7)]})]})]}),a34_0x4705e3(TaskFinished,{..._0x1a3140}),a34_0x4705e3(TaskFinished,{..._0x19c758}),a34_0x4705e3(TaskFinished,{..._0x3e2c02}),a34_0x4705e3(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'children':'─'[_0x237efe(0xa9)](0x3c)})}),a34_0x4705e3(Box,{'children':a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'bold':!![],'children':'🎉\x20项目创建成功!'})}),a34_0x191d5b(Box,{'marginTop':0x1,'flexDirection':_0x237efe(0xe9),'children':[a34_0x191d5b(Box,{'children':[a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'children':_0x237efe(0xf2)}),a34_0x4705e3(Text,{'color':'white','bold':!![],'children':_0x2dece0?.['projectName']})]}),_0x2dece0?.[_0x237efe(0xb7)]&&a34_0x191d5b(Box,{'children':[a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'children':_0x237efe(0xd5)}),a34_0x4705e3(Text,{'color':_0x237efe(0xe6),'bold':!![],'children':_0x2dece0[_0x237efe(0xb7)]})]}),a34_0x191d5b(Box,{'children':[a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'children':'📦\x20API配置:\x20'}),_0x2dece0?.[_0x237efe(0x100)]?a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'bold':!![],'children':_0x237efe(0xb6)}):_0x2dece0?.[_0x237efe(0xb7)]?a34_0x4705e3(Text,{'color':_0x237efe(0xa8),'bold':!![],'children':_0x237efe(0xff)}):a34_0x4705e3(Text,{'color':_0x237efe(0xac),'bold':!![],'children':_0x237efe(0xc8)})]})]}),a34_0x4705e3(Box,{'marginTop':0x1,'marginBottom':0x1,'children':a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'bold':!![],'children':_0x237efe(0xb0)})}),a34_0x191d5b(Box,{'marginLeft':0x2,'flexDirection':'column','children':[a34_0x191d5b(Box,{'children':[a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'children':_0x237efe(0xd8)}),a34_0x4705e3(Text,{'color':_0x237efe(0xe6),'children':_0x237efe(0xdb)}),a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'bold':!![],'children':_0x237efe(0xdf)+_0x2dece0?.['projectName']+'\x20&&\x20lovrabet\x20start'})]}),_0x2dece0?.[_0x237efe(0xb7)]&&!_0x2dece0?.['pullApi']&&a34_0x191d5b(Box,{'children':[a34_0x4705e3(Text,{'color':_0x237efe(0xa8),'children':_0x237efe(0xcd)}),a34_0x4705e3(Text,{'color':_0x237efe(0xe6),'children':'拉取API配置:\x20'}),a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'bold':!![],'children':'lovrabet\x20api\x20pull'})]}),!_0x2dece0?.[_0x237efe(0xb7)]&&a34_0x191d5b(a34_0x243601,{'children':[a34_0x191d5b(Box,{'children':[a34_0x4705e3(Text,{'color':_0x237efe(0xac),'children':_0x237efe(0xcd)}),a34_0x4705e3(Text,{'color':'white','children':_0x237efe(0xaf)}),a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'bold':!![],'children':_0x237efe(0xba)})]}),a34_0x191d5b(Box,{'children':[a34_0x4705e3(Text,{'color':'gray','children':_0x237efe(0xc3)}),a34_0x4705e3(Text,{'color':'white','children':_0x237efe(0xb9)}),a34_0x4705e3(Text,{'color':_0x237efe(0xd7),'bold':!![],'children':'lovrabet\x20api\x20pull\x20--appcode\x20[app-code]'})]})]})]}),a34_0x4705e3(Box,{'marginTop':0x1,'children':a34_0x4705e3(Text,{'color':_0x237efe(0xb1),'children':'─'[_0x237efe(0xa9)](0x3c)})})]});return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a35_0x5f0c(){var _0x1f0d18=['green','2378760wkqYLY','6EqYCuX','1585866RvLuCG','elapsed','4733900ahHaFK','15elVStL','2814235tNOiNH','534130NFSbdA','6163122hPJOBX','29355543OztiMz','taskName'];a35_0x5f0c=function(){return _0x1f0d18;};return a35_0x5f0c();}(function(_0x3d0b77,_0x49c173){var _0x45be32=a35_0x1a9d,_0x2d12db=_0x3d0b77();while(!![]){try{var _0x2ac2de=-parseInt(_0x45be32(0x84))/0x1+parseInt(_0x45be32(0x89))/0x2*(-parseInt(_0x45be32(0x87))/0x3)+parseInt(_0x45be32(0x86))/0x4+parseInt(_0x45be32(0x88))/0x5+-parseInt(_0x45be32(0x83))/0x6*(parseInt(_0x45be32(0x8a))/0x7)+-parseInt(_0x45be32(0x82))/0x8+parseInt(_0x45be32(0x8b))/0x9;if(_0x2ac2de===_0x49c173)break;else _0x2d12db['push'](_0x2d12db['shift']());}catch(_0xb3de53){_0x2d12db['push'](_0x2d12db['shift']());}}}(a35_0x5f0c,0xddf0b));import{jsx as a35_0x1a6512,jsxs as a35_0x444c72}from'react/jsx-runtime';import{Box,Text}from'ink';function a35_0x1a9d(_0x615381,_0x2dec76){var _0x5f0cfc=a35_0x5f0c();return a35_0x1a9d=function(_0x1a9dc9,_0x4acb1e){_0x1a9dc9=_0x1a9dc9-0x81;var _0x3a37ca=_0x5f0cfc[_0x1a9dc9];return _0x3a37ca;},a35_0x1a9d(_0x615381,_0x2dec76);}import{TaskTime}from'./task-time.js';export function TaskFinished(_0x17a220){var _0x2c3c7b=a35_0x1a9d;return a35_0x444c72(Box,{'children':[a35_0x1a6512(Box,{'width':'1'}),a35_0x1a6512(Text,{'color':_0x2c3c7b(0x81),'children':'\x20√\x20'}),a35_0x1a6512(Text,{'children':_0x17a220[_0x2c3c7b(0x8c)]}),a35_0x1a6512(TaskTime,{'elapsed':_0x17a220[_0x2c3c7b(0x85)]})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a36_0x1752(_0x58b73c,_0x361b04){var _0x5a4e2d=a36_0x5a4e();return a36_0x1752=function(_0x1752a3,_0x3cd5b4){_0x1752a3=_0x1752a3-0x1a0;var _0x36bb2d=_0x5a4e2d[_0x1752a3];return _0x36bb2d;},a36_0x1752(_0x58b73c,_0x361b04);}function a36_0x5a4e(){var _0x507c31=['7FYegfw','7733RvSkNZ','dots','9882618pZafep','8209550ohKeRb','307842iBADnk','10938483ZQbYaI','876493hFuRQY','4yyNUqy','3Saibel','26300YdiHWU','finished','\x20\x20\x20','13127608IUHGnO','loading'];a36_0x5a4e=function(){return _0x507c31;};return a36_0x5a4e();}(function(_0x191307,_0x35ac05){var _0xd33a88=a36_0x1752,_0x4e132b=_0x191307();while(!![]){try{var _0x2c9064=-parseInt(_0xd33a88(0x1a4))/0x1+parseInt(_0xd33a88(0x1a2))/0x2*(-parseInt(_0xd33a88(0x1a6))/0x3)+-parseInt(_0xd33a88(0x1a5))/0x4*(-parseInt(_0xd33a88(0x1a1))/0x5)+parseInt(_0xd33a88(0x1a0))/0x6*(parseInt(_0xd33a88(0x1ac))/0x7)+parseInt(_0xd33a88(0x1aa))/0x8+-parseInt(_0xd33a88(0x1a3))/0x9+parseInt(_0xd33a88(0x1a7))/0xa*(-parseInt(_0xd33a88(0x1ad))/0xb);if(_0x2c9064===_0x35ac05)break;else _0x4e132b['push'](_0x4e132b['shift']());}catch(_0x33b7f3){_0x4e132b['push'](_0x4e132b['shift']());}}}(a36_0x5a4e,0xcbec9));import{jsx as a36_0x331952,jsxs as a36_0x5f7880}from'react/jsx-runtime';import{Text}from'ink';import a36_0x3eebfe from'ink-spinner';export function TaskLoading(_0x543e31){var _0x5a7256=a36_0x1752;if(_0x543e31[_0x5a7256(0x1a8)])return a36_0x331952(Text,{'color':'green','children':'\x20√\x20'});if(_0x543e31[_0x5a7256(0x1ab)])return a36_0x5f7880(Text,{'color':'green','children':['\x20',a36_0x331952(a36_0x3eebfe,{'type':_0x5a7256(0x1ae)}),'\x20']});return a36_0x331952(Text,{'children':_0x5a7256(0x1a9)});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3bda17,_0x2e8432){var _0x356552=a37_0xca1a,_0x1609ab=_0x3bda17();while(!![]){try{var _0x14c25e=parseInt(_0x356552(0xc2))/0x1*(parseInt(_0x356552(0xc3))/0x2)+parseInt(_0x356552(0xc6))/0x3*(-parseInt(_0x356552(0xcb))/0x4)+parseInt(_0x356552(0xc0))/0x5+-parseInt(_0x356552(0xc1))/0x6+parseInt(_0x356552(0xc4))/0x7*(-parseInt(_0x356552(0xc5))/0x8)+parseInt(_0x356552(0xc9))/0x9+parseInt(_0x356552(0xca))/0xa*(parseInt(_0x356552(0xcc))/0xb);if(_0x14c25e===_0x2e8432)break;else _0x1609ab['push'](_0x1609ab['shift']());}catch(_0x2ccc1e){_0x1609ab['push'](_0x1609ab['shift']());}}}(a37_0x3ab9,0x4808a));function a37_0xca1a(_0x41c2e8,_0x52213c){var _0x3ab9a5=a37_0x3ab9();return a37_0xca1a=function(_0xca1a04,_0x2932b2){_0xca1a04=_0xca1a04-0xc0;var _0x455148=_0x3ab9a5[_0xca1a04];return _0x455148;},a37_0xca1a(_0x41c2e8,_0x52213c);}function a37_0x3ab9(){var _0x3ccd89=['1232NmkPWy','11EnDnfL','2812755CnRtJW','2645958JGbjDJ','1CmZuLK','347558hPqTGr','2706522gzGtKS','8QqiuLu','678gfFopm','elapsed','taskName','50184YJEqCU','4503910CMaCJa'];a37_0x3ab9=function(){return _0x3ccd89;};return a37_0x3ab9();}import{jsx as a37_0x18425d,jsxs as a37_0x2ccb1c}from'react/jsx-runtime';import{Box,Text}from'ink';import{TaskLoading}from'./task-loading.js';import{TaskTime}from'./task-time.js';export function TaskRunning(_0x5cc7b2){var _0x286134=a37_0xca1a;return a37_0x2ccb1c(Box,{'children':[a37_0x18425d(Box,{'width':'1'}),a37_0x18425d(TaskLoading,{..._0x5cc7b2}),a37_0x18425d(Text,{'children':_0x5cc7b2[_0x286134(0xc8)]}),a37_0x18425d(TaskTime,{'elapsed':_0x5cc7b2[_0x286134(0xc7)]})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2bde27,_0x32340a){var _0xf5028b=a38_0x1b9f,_0x1a932b=_0x2bde27();while(!![]){try{var _0x5f2c86=-parseInt(_0xf5028b(0x1dc))/0x1+parseInt(_0xf5028b(0x1db))/0x2*(parseInt(_0xf5028b(0x1e0))/0x3)+parseInt(_0xf5028b(0x1e5))/0x4+-parseInt(_0xf5028b(0x1e7))/0x5*(parseInt(_0xf5028b(0x1e1))/0x6)+-parseInt(_0xf5028b(0x1e2))/0x7*(parseInt(_0xf5028b(0x1de))/0x8)+parseInt(_0xf5028b(0x1e8))/0x9*(-parseInt(_0xf5028b(0x1e4))/0xa)+parseInt(_0xf5028b(0x1df))/0xb*(-parseInt(_0xf5028b(0x1e6))/0xc);if(_0x5f2c86===_0x32340a)break;else _0x1a932b['push'](_0x1a932b['shift']());}catch(_0x878db1){_0x1a932b['push'](_0x1a932b['shift']());}}}(a38_0x1746,0xb329f));import{jsx as a38_0x41f7f3,Fragment as a38_0x1e9f6d,jsxs as a38_0x36f6ed}from'react/jsx-runtime';function a38_0x1b9f(_0x454abd,_0x37e128){var _0x1746b1=a38_0x1746();return a38_0x1b9f=function(_0x1b9f50,_0x1a19c7){_0x1b9f50=_0x1b9f50-0x1db;var _0x542c13=_0x1746b1[_0x1b9f50];return _0x542c13;},a38_0x1b9f(_0x454abd,_0x37e128);}import{Text}from'ink';export function TaskTime(_0x5db8ef){var _0x4314df=a38_0x1b9f;if(_0x5db8ef[_0x4314df(0x1e3)])return a38_0x36f6ed(a38_0x1e9f6d,{'children':[a38_0x41f7f3(Text,{'color':'gray','children':'\x20['}),a38_0x41f7f3(Text,{'color':_0x4314df(0x1dd),'bold':!![],'children':_0x5db8ef[_0x4314df(0x1e3)]}),a38_0x41f7f3(Text,{'color':_0x4314df(0x1dd),'children':']'})]});return null;}function a38_0x1746(){var _0x22e24a=['784133qvAWgE','elapsed','10rnBIsj','4684760YQFeCI','60zQpRtT','195kavdFq','7296507pgQBAg','104342qZtOqb','241391fzRqsC','gray','16VqOoKx','232969NTsjZh','81TsULjF','71370mKpwhG'];a38_0x1746=function(){return _0x22e24a;};return a38_0x1746();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a39_0x142bdc=a39_0x29c6;(function(_0xc30692,_0x25b950){const _0x4554fe=a39_0x29c6,_0x102c86=_0xc30692();while(!![]){try{const _0x2df3ac=-parseInt(_0x4554fe(0x1d3))/0x1*(parseInt(_0x4554fe(0x1d8))/0x2)+parseInt(_0x4554fe(0x1de))/0x3*(parseInt(_0x4554fe(0x1e3))/0x4)+-parseInt(_0x4554fe(0x1d7))/0x5+parseInt(_0x4554fe(0x1db))/0x6+-parseInt(_0x4554fe(0x1d2))/0x7+parseInt(_0x4554fe(0x1e1))/0x8*(-parseInt(_0x4554fe(0x1dc))/0x9)+parseInt(_0x4554fe(0x1d0))/0xa;if(_0x2df3ac===_0x25b950)break;else _0x102c86['push'](_0x102c86['shift']());}catch(_0x51d80f){_0x102c86['push'](_0x102c86['shift']());}}}(a39_0x5222,0x1e062));import a39_0x1e1092 from'node:path';import{fileURLToPath}from'node:url';import{useCallback,useState}from'react';import{copyDirectory}from'../utils/copy-directory.js';function a39_0x5222(){const _0x41fdac=['10EEZomK','开始复制项目模板','cwd','1403340XCwwDo','60678Hgddcb','项目模板复制失败','1077SAMOPu','now','复制项目文件','24uZCqGL','../../templates/projects/sub-app-react-demo','1868mvJLdJ','url','2744760CkGFrT','copy','634830BDnvzs','47309pCovdw','项目模板复制完成','error','dirname','1027900ennKjk'];a39_0x5222=function(){return _0x41fdac;};return a39_0x5222();}import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';function a39_0x29c6(_0x1ddfcd,_0xb86946){const _0x52224d=a39_0x5222();return a39_0x29c6=function(_0x29c6f2,_0x34f1f6){_0x29c6f2=_0x29c6f2-0x1cf;let _0x17fc89=_0x52224d[_0x29c6f2];return _0x17fc89;},a39_0x29c6(_0x1ddfcd,_0xb86946);}const __dirname=a39_0x1e1092[a39_0x142bdc(0x1d6)](fileURLToPath(import.meta[a39_0x142bdc(0x1cf)])),templateDir=a39_0x1e1092['resolve'](__dirname,a39_0x142bdc(0x1e2));export function useCopyProjectTemplate(){const _0x4632a4=a39_0x142bdc,[_0x58de6a,_0xadd020]=useState(![]),[_0x2a2c14,_0x1a33b3]=useState(![]),[_0x4c0087,_0x31af75]=useState(''),_0xf27e63=useCallback(async _0x7f3037=>{const _0x4efc4f=a39_0x29c6,_0x19278a=Date[_0x4efc4f(0x1df)](),_0x490b09=a39_0x1e1092['resolve'](process[_0x4efc4f(0x1da)](),_0x7f3037);_0xadd020(!![]);try{logger['info'](_0x4efc4f(0x1d1),_0x4efc4f(0x1d9),{'projectCode':_0x7f3037,'templateDir':templateDir}),await copyDirectory(templateDir,_0x490b09);const _0x350b00=Date[_0x4efc4f(0x1df)]()-_0x19278a;logger['success'](_0x4efc4f(0x1d1),_0x4efc4f(0x1d4),_0x350b00,{'projectCode':_0x7f3037});}catch(_0x4985b3){const _0x5242de=Date[_0x4efc4f(0x1df)]()-_0x19278a;logger[_0x4efc4f(0x1d5)](_0x4efc4f(0x1d1),_0x4efc4f(0x1dd),{'projectCode':_0x7f3037,'error':_0x4985b3 instanceof Error?_0x4985b3['message']:String(_0x4985b3),'duration':_0x5242de});throw _0x4985b3;}finally{_0xadd020(![]),_0x1a33b3(!![]),_0x31af75(formatElapsed(_0x19278a));}},[]);return{'taskName':_0x4632a4(0x1e0),'finished':_0x2a2c14,'loading':_0x58de6a,'elapsed':_0x4c0087,'doTask':_0xf27e63};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1efed5,_0x2591d7){const _0x1e9f15=a40_0x1eec,_0x565e34=_0x1efed5();while(!![]){try{const _0x3b7a32=-parseInt(_0x1e9f15(0xe3))/0x1*(-parseInt(_0x1e9f15(0xea))/0x2)+-parseInt(_0x1e9f15(0xdf))/0x3+-parseInt(_0x1e9f15(0xda))/0x4+parseInt(_0x1e9f15(0xdb))/0x5*(-parseInt(_0x1e9f15(0xf1))/0x6)+-parseInt(_0x1e9f15(0xdc))/0x7+-parseInt(_0x1e9f15(0xe1))/0x8*(-parseInt(_0x1e9f15(0xed))/0x9)+parseInt(_0x1e9f15(0xeb))/0xa*(parseInt(_0x1e9f15(0xec))/0xb);if(_0x3b7a32===_0x2591d7)break;else _0x565e34['push'](_0x565e34['shift']());}catch(_0x27dc65){_0x565e34['push'](_0x565e34['shift']());}}}(a40_0x3545,0x556b3));import a40_0x2fc4ef from'node:path';import{useCallback,useState}from'react';import{execa}from'execa';import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';export function useFormatCode(){const _0x1b4683=a40_0x1eec,[_0x247645,_0x14ce95]=useState(![]),[_0x26dccf,_0x499069]=useState(![]),[_0x1641fe,_0x1b349]=useState(''),_0x10e51e=useCallback(async _0x3d4f24=>{const _0x490096=a40_0x1eec,_0x6fa5bf=Date[_0x490096(0xdd)](),_0x2dc16b=a40_0x2fc4ef[_0x490096(0xee)](process['cwd'](),_0x3d4f24);_0x14ce95(!![]);try{logger[_0x490096(0xe2)](_0x490096(0xf0),_0x490096(0xef),{'projectCode':_0x3d4f24}),await execa(_0x490096(0xe5),[_0x490096(0xe0),_0x490096(0xe9),'.'],{'cwd':_0x2dc16b});const _0x52f14a=Date[_0x490096(0xdd)]()-_0x6fa5bf;logger['success'](_0x490096(0xf0),_0x490096(0xe8),_0x52f14a,{'projectCode':_0x3d4f24});}catch(_0x67b4c){const _0xac0481=Date[_0x490096(0xdd)]()-_0x6fa5bf;logger[_0x490096(0xde)]('format',_0x490096(0xe6),{'projectCode':_0x3d4f24,'error':_0x67b4c instanceof Error?_0x67b4c[_0x490096(0xe7)]:String(_0x67b4c),'duration':_0xac0481});throw _0x67b4c;}finally{_0x14ce95(![]),_0x499069(!![]),_0x1b349(formatElapsed(_0x6fa5bf));}},[]);return{'taskName':_0x1b4683(0xe4),'finished':_0x26dccf,'loading':_0x247645,'elapsed':_0x1641fe,'doTask':_0x10e51e};}function a40_0x1eec(_0x56099f,_0x5b118d){const _0x35455b=a40_0x3545();return a40_0x1eec=function(_0x1eec28,_0x3d61ed){_0x1eec28=_0x1eec28-0xda;let _0x710450=_0x35455b[_0x1eec28];return _0x710450;},a40_0x1eec(_0x56099f,_0x5b118d);}function a40_0x3545(){const _0x3e117c=['now','error','762606TnAnPc','prettier','8SkrZbL','info','2KDJeVT','格式化代码','npx','代码格式化失败','message','代码格式化完成','--write','271154MKPFoX','310nrlEyl','336193MEoWYm','4881807mdwxiH','resolve','开始格式化代码','format','186IMatEy','2285916FbrFml','70005NIbQAL','1060101OYdsUO'];a40_0x3545=function(){return _0x3e117c;};return a40_0x3545();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x349c7b,_0x36a731){const _0x241733=a41_0x4ca0,_0x3915d8=_0x349c7b();while(!![]){try{const _0x5b1141=parseInt(_0x241733(0x13a))/0x1*(-parseInt(_0x241733(0x13e))/0x2)+parseInt(_0x241733(0x136))/0x3*(-parseInt(_0x241733(0x137))/0x4)+parseInt(_0x241733(0x13f))/0x5+parseInt(_0x241733(0x135))/0x6+-parseInt(_0x241733(0x12c))/0x7*(-parseInt(_0x241733(0x12f))/0x8)+-parseInt(_0x241733(0x12b))/0x9*(parseInt(_0x241733(0x138))/0xa)+parseInt(_0x241733(0x132))/0xb;if(_0x5b1141===_0x36a731)break;else _0x3915d8['push'](_0x3915d8['shift']());}catch(_0x3a2a3e){_0x3915d8['push'](_0x3915d8['shift']());}}}(a41_0x42c8,0x2a1d6));function a41_0x4ca0(_0x280f7c,_0x153680){const _0x42c8fd=a41_0x42c8();return a41_0x4ca0=function(_0x4ca0f4,_0x250630){_0x4ca0f4=_0x4ca0f4-0x12a;let _0x8e1431=_0x42c8fd[_0x4ca0f4];return _0x8e1431;},a41_0x4ca0(_0x280f7c,_0x153680);}import a41_0x3a4be9 from'node:path';import{useCallback,useState}from'react';import{execa}from'execa';import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';export function useInstallDependencies(){const _0x1aa4f2=a41_0x4ca0,[_0x1776d3,_0x286db8]=useState(![]),[_0x2254f5,_0x5bd9d9]=useState(![]),[_0x60c37f,_0x96d625]=useState(''),_0x39fc45=useCallback(async _0x863a45=>{const _0x57ba11=a41_0x4ca0,_0x552f46=Date['now'](),_0x1b6b8a=a41_0x3a4be9[_0x57ba11(0x12a)](process[_0x57ba11(0x12d)](),_0x863a45);_0x286db8(!![]),_0x5bd9d9(![]);const _0x5f32b5=async(_0x59775d,_0x3994fc)=>{await execa(_0x59775d,_0x3994fc,{'cwd':_0x1b6b8a});};try{logger[_0x57ba11(0x131)]('install',_0x57ba11(0x140),{'projectCode':_0x863a45,'registry':_0x57ba11(0x142)}),await _0x5f32b5(_0x57ba11(0x12e),[_0x57ba11(0x130),_0x57ba11(0x13c),'https://registry.npmmirror.com']);const _0x568ace=Date[_0x57ba11(0x141)]()-_0x552f46;logger[_0x57ba11(0x133)](_0x57ba11(0x130),_0x57ba11(0x134),_0x568ace,{'projectCode':_0x863a45});}catch(_0x113010){const _0x50bc5a=Date[_0x57ba11(0x141)]()-_0x552f46;logger['error'](_0x57ba11(0x130),_0x57ba11(0x13d),{'projectCode':_0x863a45,'error':_0x113010 instanceof Error?_0x113010[_0x57ba11(0x13b)]:String(_0x113010),'duration':_0x50bc5a});throw _0x113010;}finally{_0x286db8(![]),_0x5bd9d9(!![]),_0x96d625(formatElapsed(_0x552f46));}},[]);return{'taskName':_0x1aa4f2(0x139),'finished':_0x2254f5,'loading':_0x1776d3,'elapsed':_0x60c37f,'doTask':_0x39fc45};}function a41_0x42c8(){const _0xe381bc=['resolve','324936SijAag','6811SRJSsc','cwd','npm','472lBwurn','install','info','1415194VFcMnW','success','依赖安装完成','1077462jAHvku','240063GSBsPO','4UnICvD','10sakExv','安装依赖','3dEuemX','message','--registry','依赖安装失败','137526ybqxmt','646390PJubVM','开始安装依赖','now','https://registry.npmmirror.com'];a41_0x42c8=function(){return _0xe381bc;};return a41_0x42c8();}
|
package/lib/help.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a42_0xb52d(_0x4d4e4a,_0x55d5cb){var _0x27a3b6=a42_0x27a3();return a42_0xb52d=function(_0xb52d8e,_0x55f91b){_0xb52d8e=_0xb52d8e-0x1df;var _0x34e484=_0x27a3b6[_0xb52d8e];return _0x34e484;},a42_0xb52d(_0x4d4e4a,_0x55d5cb);}(function(_0x302ce5,_0x427b19){var _0x4e0508=a42_0xb52d,_0x588e4a=_0x302ce5();while(!![]){try{var _0x38b02e=parseInt(_0x4e0508(0x1ec))/0x1*(parseInt(_0x4e0508(0x1df))/0x2)+-parseInt(_0x4e0508(0x1e6))/0x3+parseInt(_0x4e0508(0x1e1))/0x4+-parseInt(_0x4e0508(0x1e4))/0x5*(-parseInt(_0x4e0508(0x1eb))/0x6)+parseInt(_0x4e0508(0x1e9))/0x7*(parseInt(_0x4e0508(0x1e3))/0x8)+-parseInt(_0x4e0508(0x1e2))/0x9*(-parseInt(_0x4e0508(0x1e8))/0xa)+-parseInt(_0x4e0508(0x1ea))/0xb;if(_0x38b02e===_0x427b19)break;else _0x588e4a['push'](_0x588e4a['shift']());}catch(_0x4de1fa){_0x588e4a['push'](_0x588e4a['shift']());}}}(a42_0x27a3,0x466f0));import{jsx as a42_0x5b2f9c,jsxs as a42_0x4847a}from'react/jsx-runtime';import{Box,Text}from'ink';export function Help(){var _0x2699fc=a42_0xb52d;return a42_0x4847a(Box,{'flexDirection':'column','marginTop':0x1,'marginBottom':0x1,'children':[a42_0x4847a(Box,{'children':[a42_0x5b2f9c(Box,{'width':'1'}),a42_0x5b2f9c(Text,{'children':_0x2699fc(0x1e0)})]}),a42_0x4847a(Box,{'marginTop':0x1,'children':[a42_0x5b2f9c(Box,{'width':'1'}),a42_0x4847a(Text,{'children':['\x20\x20','使用']}),a42_0x4847a(Text,{'bold':!![],'color':_0x2699fc(0x1e5),'children':['\x20','lovrabet\x20--help','\x20']}),a42_0x5b2f9c(Text,{'children':_0x2699fc(0x1e7)})]})]});}function a42_0x27a3(){var _0x254ca2=['3073080JwhFYa','364YOoQTn','10186044EMfdZK','318aQoRaY','428091nCAFnV','2pEWOXL','!\x20请指定一个有效的命令。','605312ynjIQZ','9tAPsaQ','50824yepYLH','12790wGaRKQ','green','414471BHbFET','查看可用命令。'];a42_0x27a3=function(){return _0x254ca2;};return a42_0x27a3();}
|
package/lib/init/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5a256c,_0x6f8eda){const _0x1f8880=a43_0x51d5,_0x4e120f=_0x5a256c();while(!![]){try{const _0xdaa7cb=-parseInt(_0x1f8880(0x131))/0x1*(parseInt(_0x1f8880(0x130))/0x2)+parseInt(_0x1f8880(0x13a))/0x3+parseInt(_0x1f8880(0x125))/0x4+-parseInt(_0x1f8880(0x11a))/0x5+-parseInt(_0x1f8880(0x13b))/0x6+-parseInt(_0x1f8880(0x120))/0x7*(-parseInt(_0x1f8880(0x129))/0x8)+-parseInt(_0x1f8880(0x140))/0x9;if(_0xdaa7cb===_0x6f8eda)break;else _0x4e120f['push'](_0x4e120f['shift']());}catch(_0x585a9d){_0x4e120f['push'](_0x4e120f['shift']());}}}(a43_0x437b,0x9184f));import{jsxs as a43_0x521fd0,jsx as a43_0x14109d}from'react/jsx-runtime';function a43_0x51d5(_0x1b14c8,_0xfcac37){const _0x437b25=a43_0x437b();return a43_0x51d5=function(_0x51d59d,_0xcfba96){_0x51d59d=_0x51d59d-0x11a;let _0x236605=_0x437b25[_0x51d59d];return _0x236605;},a43_0x51d5(_0x1b14c8,_0xfcac37);}import{useState,useEffect}from'react';import{Box,Text,useInput}from'ink';function a43_0x437b(){const _0x264aa7=['1.0.0','parse','应用代码不合法','message','gray','green','delete','创建配置文件失败:\x20','3470994eHzaFU','1007196uHEAaN','stringify','url','length','backspace','6759621GPeqTo','exit','info','.lovrabetrc','trim','cyan','4083195KmQkNV','return','env','初始化项目配置文件成功','请输入应用代码\x20(AppCode):\x20','red','7819LpqMKo','version','✓\x20成功在当前目录初始化\x20.lovrabetrc\x20文件','当前目录已存在\x20.lovrabetrc\x20文件','应用代码长度不能超过\x20100\x20个字符','3751968MYQbrK','online','应用代码只能包含字母、数字、-\x20和\x20_','AppCode:\x20','3672FmvQDU','init','setLogPath','\x20←\x20','cwd','正在初始化配置文件...','utf8','4lSRDwe','138036eJVVfQ'];a43_0x437b=function(){return _0x264aa7;};return a43_0x437b();}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:_0x20fdb3,env:_0x251fd6}){const _0x36766a=a43_0x51d5,[_0x1c9f77,_0x651aab]=useState(null),[_0x13f9b0,_0x419367]=useState(![]),[_0xde79f7,_0x3f2e28]=useState(!_0x20fdb3),[_0x2ed8f1,_0x8f37ec]=useState(''),[_0x463a38,_0x77d5e3]=useState(''),[_0x45d6b9,_0x280472]=useState(_0x20fdb3||''),[_0x20cd49]=useState(_0x251fd6);function _0x1a1c18(_0x5088f2){const _0x351237=a43_0x51d5;if(_0x5088f2[_0x351237(0x13e)]===0x0)return{'valid':![],'message':''};if(_0x5088f2['length']>0x64)return{'valid':![],'message':_0x351237(0x124)};const _0x1fd27e=/^[A-Za-z0-9_-]+$/;if(!_0x1fd27e['test'](_0x5088f2))return{'valid':![],'message':_0x351237(0x127)};return{'valid':!![]};}useInput((_0x49a57f,_0x152502)=>{const _0x56b550=a43_0x51d5;if(!_0xde79f7)return;if(_0x152502[_0x56b550(0x11b)]){if(_0x463a38||!_0x2ed8f1[_0x56b550(0x144)]()){_0x77d5e3('应用代码不能为空');return;}const _0xdd4dcd=_0x2ed8f1[_0x56b550(0x144)](),{valid:_0x5abb1d,message:_0x1d5ad4}=_0x1a1c18(_0xdd4dcd);if(!_0x5abb1d){_0x77d5e3(_0x1d5ad4||_0x56b550(0x134));return;}_0x280472(_0xdd4dcd),_0x3f2e28(![]);}else{if(_0x152502[_0x56b550(0x13f)]||_0x152502[_0x56b550(0x138)])_0x8f37ec(_0x157b3a=>{const _0x25c230=_0x56b550,_0x2e40dc=_0x157b3a['slice'](0x0,-0x1);if(_0x2e40dc['length']===0x0)_0x77d5e3('');else{const {valid:_0x2bfaba,message:_0x139a01}=_0x1a1c18(_0x2e40dc);_0x77d5e3(_0x2bfaba?'':_0x139a01||_0x25c230(0x134));}return _0x2e40dc;});else _0x152502['ctrl']&&_0x49a57f==='c'?process[_0x56b550(0x141)](0x0):_0x8f37ec(_0x29eb63=>{const _0x18b16d=_0x56b550,_0x15daf6=_0x29eb63+_0x49a57f,{valid:_0x5ab0e0,message:_0x3f4668}=_0x1a1c18(_0x15daf6);return _0x77d5e3(_0x5ab0e0?'':_0x3f4668||_0x18b16d(0x134)),_0x15daf6;});}},{'isActive':_0xde79f7}),useEffect(()=>{const _0x63b555=a43_0x51d5;if(!_0x45d6b9||_0xde79f7)return;const _0x78af39=resolve(process[_0x63b555(0x12d)](),_0x63b555(0x143));if(existsSync(_0x78af39)){_0x651aab(_0x63b555(0x123)),setTimeout(()=>process[_0x63b555(0x141)](0x1),0x64);return;}try{const _0x62f645=fileURLToPath(import.meta[_0x63b555(0x13d)]),_0x1cb05d=resolve(dirname(_0x62f645),'../..'),_0x47d89b=join(_0x1cb05d,'package.json');let _0x4ce521=_0x63b555(0x132);try{const _0x313ea7=JSON[_0x63b555(0x133)](readFileSync(_0x47d89b,_0x63b555(0x12f)));_0x4ce521=_0x313ea7[_0x63b555(0x121)]||_0x63b555(0x132);}catch(_0x712708){}const _0x3991fa=readConfig(),_0x3f8bb6=typeof _0x3991fa[_0x63b555(0x11c)]==='string'?_0x3991fa[_0x63b555(0x11c)]:undefined,{app:_0x5d9bca,appcode:_0x4cc764,..._0x58404c}=_0x3991fa,_0x5b55fb={..._0x58404c,'appcode':_0x45d6b9,'env':_0x20cd49||_0x3f8bb6||_0x63b555(0x126),'createdAt':new Date()['toLocaleString'](),'version':_0x4ce521};writeFileSync(_0x78af39,JSON[_0x63b555(0x13c)](_0x5b55fb,null,0x2),{'encoding':_0x63b555(0x12f),'mode':0x180}),logger[_0x63b555(0x12b)](process[_0x63b555(0x12d)]()),logger[_0x63b555(0x142)](_0x63b555(0x12a),_0x63b555(0x11d),{'appcode':_0x45d6b9,'env':_0x5b55fb['env'],'version':_0x5b55fb['version'],'configPath':_0x78af39}),_0x419367(!![]),setTimeout(()=>process[_0x63b555(0x141)](0x0),0x64);}catch(_0x4d418c){logger['error'](_0x63b555(0x12a),'创建配置文件失败',{'error':_0x4d418c instanceof Error?_0x4d418c[_0x63b555(0x135)]:String(_0x4d418c)}),_0x651aab(_0x63b555(0x139)+(_0x4d418c instanceof Error?_0x4d418c['message']:String(_0x4d418c))),setTimeout(()=>process['exit'](0x1),0x64);}},[_0x45d6b9,_0xde79f7,_0x20cd49]);if(_0x1c9f77)return a43_0x14109d(Box,{'flexDirection':'column','children':a43_0x521fd0(Text,{'color':_0x36766a(0x11f),'children':['✗\x20',_0x1c9f77]})});if(_0xde79f7)return a43_0x521fd0(Box,{'flexDirection':'column','children':[a43_0x521fd0(Box,{'children':[a43_0x14109d(Text,{'color':_0x36766a(0x145),'children':_0x36766a(0x11e)}),_0x2ed8f1?a43_0x14109d(Text,{'color':_0x36766a(0x137),'children':_0x2ed8f1}):a43_0x14109d(Text,{'color':_0x36766a(0x136),'children':'_'}),_0x463a38&&a43_0x521fd0(Text,{'color':_0x36766a(0x11f),'children':[_0x36766a(0x12c),_0x463a38]})]}),!_0x463a38&&!_0x2ed8f1&&a43_0x14109d(Box,{'children':a43_0x14109d(Text,{'color':_0x36766a(0x136),'children':'应用代码用于标识您的项目,只能包含字母、数字、-\x20和\x20_'})})]});if(_0x13f9b0)return a43_0x521fd0(Box,{'flexDirection':'column','children':[a43_0x14109d(Text,{'color':_0x36766a(0x137),'children':_0x36766a(0x122)}),a43_0x521fd0(Text,{'color':'cyan','children':[_0x36766a(0x128),_0x45d6b9]}),a43_0x14109d(Text,{'children':'现在您可以使用\x20lovrabet\x20api\x20doc\x20和\x20lovrabet\x20api\x20pull\x20等命令了'})]});return a43_0x14109d(Box,{'children':a43_0x14109d(Text,{'children':_0x36766a(0x12e)})});}
|
package/lib/mcp/cursor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a44_0x5577(){const _0x5d1f2b=['\x0a配置信息:','\x20\x20-\x20配置文件:\x20','配置\x20Cursor\x20MCP\x20失败','错误:\x20配置失败:\x20','620442HeKqlJ','未找到\x20appcode\x20配置','mcp-cursor','✓\x20创建\x20mcp.json\x20配置文件','12914388kZHEkO','请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。','message','4333rysKgM','url','../../templates/rules/lovrabet_rules.mdc.tpl','lovrabet_rules.mdc','@lovrabet/dataset-mcp-server','warn','更新现有\x20mcp.json\x20配置','✓\x20更新\x20mcp.json\x20配置','rules','info','创建新的\x20mcp.json\x20配置','stringify','复制\x20Cursor\x20Rules\x20文件失败','utf8','解析现有\x20mcp.json\x20失败','4994241jKggWq','parse','npx','5720GrAwzq','4bBvGZH','error','1062905XeOwcC','25714160GDelQX','\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。','Cursor\x20Rules\x20文件已存在,跳过','✓\x20创建\x20.cursor\x20目录:\x20','env','10DezQvu','exit','✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc','.cursor','195946HHcxcT','log','配置\x20Cursor\x20MCP\x20成功','mcpServers','Cursor\x20Rules\x20模板文件不存在'];a44_0x5577=function(){return _0x5d1f2b;};return a44_0x5577();}(function(_0x30b9aa,_0x20ace7){const _0x3867df=a44_0x2782,_0x34ce12=_0x30b9aa();while(!![]){try{const _0x30b4ac=-parseInt(_0x3867df(0x9a))/0x1*(-parseInt(_0x3867df(0x96))/0x2)+parseInt(_0x3867df(0xb9))/0x3+-parseInt(_0x3867df(0x8e))/0x4*(parseInt(_0x3867df(0x90))/0x5)+parseInt(_0x3867df(0xa3))/0x6+parseInt(_0x3867df(0xaa))/0x7*(-parseInt(_0x3867df(0x8d))/0x8)+parseInt(_0x3867df(0xa7))/0x9+-parseInt(_0x3867df(0x91))/0xa;if(_0x30b4ac===_0x20ace7)break;else _0x34ce12['push'](_0x34ce12['shift']());}catch(_0x5aa957){_0x34ce12['push'](_0x34ce12['shift']());}}}(a44_0x5577,0xe974a));function a44_0x2782(_0x77c047,_0x1a445b){const _0x5577bc=a44_0x5577();return a44_0x2782=function(_0x2782a2,_0x5bde96){_0x2782a2=_0x2782a2-0x8d;let _0x532432=_0x5577bc[_0x2782a2];return _0x532432;},a44_0x2782(_0x77c047,_0x1a445b);}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 _0x52961b=a44_0x2782;try{const _0x61c062=process['cwd'](),_0xeba9c3=resolve(_0x61c062,_0x52961b(0x99)),_0x1a8194=resolve(_0xeba9c3,'mcp.json'),_0xce53d2=readConfig(),_0x141ca9=_0xce53d2['appcode']||_0xce53d2['app'],_0x4b8ec4=_0xce53d2[_0x52961b(0x95)]||'online';!_0x141ca9&&(console['error']('错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置'),logger[_0x52961b(0x8f)](_0x52961b(0xa5),_0x52961b(0xa4)),process['exit'](0x1));!existsSync(_0xeba9c3)&&(mkdirSync(_0xeba9c3,{'recursive':!![]}),logger[_0x52961b(0xb3)](_0x52961b(0xa5),'创建\x20.cursor\x20目录',{'path':_0xeba9c3}),console[_0x52961b(0x9b)](_0x52961b(0x94)+_0xeba9c3));const _0x163063={'command':_0x52961b(0xbb),'args':['-y',_0x52961b(0xae)],'env':{'LOVRABET_APP_CODE':String(_0x141ca9),'LOVRABET_ENV':String(_0x4b8ec4)}};let _0x3909e6;if(existsSync(_0x1a8194))try{const _0x2a139a=readFileSync(_0x1a8194,_0x52961b(0xb7));_0x3909e6=JSON[_0x52961b(0xba)](_0x2a139a),!_0x3909e6[_0x52961b(0x9d)]&&(_0x3909e6[_0x52961b(0x9d)]={}),_0x3909e6[_0x52961b(0x9d)]['lovrabet-dataset']=_0x163063,logger[_0x52961b(0xb3)](_0x52961b(0xa5),_0x52961b(0xb0),{'path':_0x1a8194,'appcode':_0x141ca9,'env':_0x4b8ec4}),console[_0x52961b(0x9b)](_0x52961b(0xb1));}catch(_0x32b3a1){logger[_0x52961b(0x8f)](_0x52961b(0xa5),_0x52961b(0xb8),{'error':_0x32b3a1 instanceof Error?_0x32b3a1[_0x52961b(0xa9)]:String(_0x32b3a1)}),console[_0x52961b(0x8f)]('错误:\x20解析现有\x20mcp.json\x20失败:\x20'+(_0x32b3a1 instanceof Error?_0x32b3a1[_0x52961b(0xa9)]:String(_0x32b3a1))),process['exit'](0x1);}else _0x3909e6={'mcpServers':{'lovrabet-dataset':_0x163063}},logger['info']('mcp-cursor',_0x52961b(0xb4),{'path':_0x1a8194,'appcode':_0x141ca9,'env':_0x4b8ec4}),console[_0x52961b(0x9b)](_0x52961b(0xa6));writeFileSync(_0x1a8194,JSON[_0x52961b(0xb5)](_0x3909e6,null,0x2),{'encoding':_0x52961b(0xb7)});const _0x18619c=resolve(_0xeba9c3,_0x52961b(0xb2)),_0x5e8ef4=resolve(_0x18619c,_0x52961b(0xad));if(!existsSync(_0x5e8ef4))try{!existsSync(_0x18619c)&&(mkdirSync(_0x18619c,{'recursive':!![]}),logger[_0x52961b(0xb3)]('mcp-cursor','创建\x20.cursor/rules\x20目录',{'path':_0x18619c}));const _0x557da6=fileURLToPath(import.meta[_0x52961b(0xab)]),_0x24d8e9=dirname(_0x557da6),_0x4cb803=resolve(_0x24d8e9,_0x52961b(0xac));existsSync(_0x4cb803)?(copyFileSync(_0x4cb803,_0x5e8ef4),logger[_0x52961b(0xb3)](_0x52961b(0xa5),'复制\x20Cursor\x20Rules\x20文件',{'from':_0x4cb803,'to':_0x5e8ef4}),console['log'](_0x52961b(0x98))):logger[_0x52961b(0xaf)]('mcp-cursor',_0x52961b(0x9e),{'templatePath':_0x4cb803});}catch(_0x4c06b6){logger[_0x52961b(0x8f)](_0x52961b(0xa5),_0x52961b(0xb6),{'error':_0x4c06b6 instanceof Error?_0x4c06b6[_0x52961b(0xa9)]:String(_0x4c06b6)}),console[_0x52961b(0xaf)]('警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20'+(_0x4c06b6 instanceof Error?_0x4c06b6[_0x52961b(0xa9)]:String(_0x4c06b6)));}else console[_0x52961b(0x9b)]('!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件'),logger[_0x52961b(0xb3)](_0x52961b(0xa5),_0x52961b(0x93),{'path':_0x5e8ef4});console[_0x52961b(0x9b)]('\x0a✓\x20Cursor\x20MCP\x20配置成功!'),console[_0x52961b(0x9b)](_0x52961b(0x9f)),console[_0x52961b(0x9b)]('\x20\x20-\x20AppCode:\x20'+_0x141ca9),console[_0x52961b(0x9b)]('\x20\x20-\x20环境:\x20'+_0x4b8ec4),console[_0x52961b(0x9b)](_0x52961b(0xa0)+_0x1a8194),console[_0x52961b(0x9b)](_0x52961b(0x92)),console['log'](_0x52961b(0xa8)),logger[_0x52961b(0xb3)](_0x52961b(0xa5),_0x52961b(0x9c),{'appcode':_0x141ca9,'env':_0x4b8ec4,'configPath':_0x1a8194}),process[_0x52961b(0x97)](0x0);}catch(_0x57f40){logger['error'](_0x52961b(0xa5),_0x52961b(0xa1),{'error':_0x57f40 instanceof Error?_0x57f40[_0x52961b(0xa9)]:String(_0x57f40)}),console['error'](_0x52961b(0xa2)+(_0x57f40 instanceof Error?_0x57f40[_0x52961b(0xa9)]:String(_0x57f40))),process[_0x52961b(0x97)](0x1);}}
|
package/lib/mcp/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4ce517,_0x58ee43){var _0x38e8b4=a45_0x3842,_0x5b6246=_0x4ce517();while(!![]){try{var _0x435d7f=-parseInt(_0x38e8b4(0x184))/0x1+-parseInt(_0x38e8b4(0x16c))/0x2+-parseInt(_0x38e8b4(0x174))/0x3+parseInt(_0x38e8b4(0x16f))/0x4*(parseInt(_0x38e8b4(0x16b))/0x5)+parseInt(_0x38e8b4(0x180))/0x6*(parseInt(_0x38e8b4(0x16d))/0x7)+parseInt(_0x38e8b4(0x183))/0x8+parseInt(_0x38e8b4(0x179))/0x9;if(_0x435d7f===_0x58ee43)break;else _0x5b6246['push'](_0x5b6246['shift']());}catch(_0x2a9588){_0x5b6246['push'](_0x5b6246['shift']());}}}(a45_0x395b,0x1d540));function a45_0x3842(_0x52f5cf,_0x182cdb){var _0x395be4=a45_0x395b();return a45_0x3842=function(_0x3842f0,_0x2344b5){_0x3842f0=_0x3842f0-0x16b;var _0x481741=_0x395be4[_0x3842f0];return _0x481741;},a45_0x3842(_0x52f5cf,_0x182cdb);}import{configureCursorMcp}from'./cursor.js';function a45_0x395b(){var _0x2dc5bd=['\x0a当前支持的\x20IDE:','3781485uKzsSu','执行配置\x20Cursor\x20MCP\x20命令','toLowerCase','\x20\x20lovrabet\x20mcp\x20cursor','setLogPath','错误:\x20不支持的\x20IDE\x20类型:\x20','\x20\x20-\x20cursor','141996NvABUx','不支持的\x20IDE\x20类型:\x20','error','38104cBOpjx','217276kBbBhT','错误:\x20请指定\x20IDE\x20类型','\x20\x20lovrabet\x20mcp\x20cursor\x20\x20\x20\x20配置\x20Cursor\x20的\x20MCP','635230fkDUZt','294342QtfLbD','28oAnQnQ','\x0a使用方法:','4IrQzgf','exit','log','cursor','未指定\x20IDE\x20类型','486189uyoFss','info','cwd','mcp'];a45_0x395b=function(){return _0x2dc5bd;};return a45_0x395b();}import{logger}from'../utils/logger.js';export async function mcpCommand(_0xf744eb){var _0x546bd0=a45_0x3842;logger[_0x546bd0(0x17d)](process[_0x546bd0(0x176)]());if(!_0xf744eb){console[_0x546bd0(0x182)](_0x546bd0(0x185)),console['log'](_0x546bd0(0x16e)),console[_0x546bd0(0x171)](_0x546bd0(0x186)),console[_0x546bd0(0x171)]('\x0a示例:'),console[_0x546bd0(0x171)](_0x546bd0(0x17c)),logger[_0x546bd0(0x182)]('mcp',_0x546bd0(0x173)),process[_0x546bd0(0x170)](0x1);return;}switch(_0xf744eb[_0x546bd0(0x17b)]()){case _0x546bd0(0x172):logger[_0x546bd0(0x175)](_0x546bd0(0x177),_0x546bd0(0x17a)),await configureCursorMcp();break;default:console[_0x546bd0(0x182)](_0x546bd0(0x17e)+_0xf744eb),console[_0x546bd0(0x171)](_0x546bd0(0x178)),console['log'](_0x546bd0(0x17f)),logger[_0x546bd0(0x182)](_0x546bd0(0x177),_0x546bd0(0x181)+_0xf744eb),process[_0x546bd0(0x170)](0x1);break;}}
|
package/lib/utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a46_0x3af1ff=a46_0x2a94;(function(_0x539626,_0x1be76a){const _0x1c7413=a46_0x2a94,_0x565b19=_0x539626();while(!![]){try{const _0x519925=-parseInt(_0x1c7413(0x180))/0x1*(-parseInt(_0x1c7413(0x17d))/0x2)+parseInt(_0x1c7413(0x183))/0x3+-parseInt(_0x1c7413(0x17e))/0x4*(parseInt(_0x1c7413(0x18b))/0x5)+-parseInt(_0x1c7413(0x184))/0x6*(-parseInt(_0x1c7413(0x18a))/0x7)+parseInt(_0x1c7413(0x187))/0x8+parseInt(_0x1c7413(0x17b))/0x9+-parseInt(_0x1c7413(0x185))/0xa*(parseInt(_0x1c7413(0x18c))/0xb);if(_0x519925===_0x1be76a)break;else _0x565b19['push'](_0x565b19['shift']());}catch(_0x485aef){_0x565b19['push'](_0x565b19['shift']());}}}(a46_0x5728,0x85ea5));import{existsSync,readFileSync}from'node:fs';import{resolve}from'node:path';function a46_0x5728(){const _0x5ba8ed=['app','trim','4140381DtWUJj','295rZunni','11ctVALT','cwd','8219637qofhiT','string','365318BVTyNS','3816jsUkfz','appcode','3BwlxaR','utf8','.lovrabetrc','2465427IQFnzE','6cndmkE','23076610yheSLl','parse','303216nYybpZ'];a46_0x5728=function(){return _0x5ba8ed;};return a46_0x5728();}import{homedir}from'node:os';export const projectConfigPath=resolve(process[a46_0x3af1ff(0x18d)](),a46_0x3af1ff(0x182));export const globalConfigPath=resolve(homedir(),a46_0x3af1ff(0x182));export function readConfig(){const _0x3f3b82=a46_0x3af1ff;let _0x4a68e4={};try{if(existsSync(globalConfigPath)){const _0x67e365=readFileSync(globalConfigPath,{'encoding':_0x3f3b82(0x181)});_0x67e365&&(_0x4a68e4=JSON['parse'](_0x67e365));}}catch(_0x4feb69){}try{if(existsSync(projectConfigPath)){const _0x52a4c3=readFileSync(projectConfigPath,{'encoding':'utf8'});if(_0x52a4c3){const _0x368603=JSON[_0x3f3b82(0x186)](_0x52a4c3);_0x4a68e4={..._0x4a68e4,..._0x368603};}}}catch(_0x4945c7){}return _0x4a68e4;}function a46_0x2a94(_0x3cb983,_0x1efb2b){const _0x5728df=a46_0x5728();return a46_0x2a94=function(_0x2a94d0,_0x20deca){_0x2a94d0=_0x2a94d0-0x17b;let _0x210425=_0x5728df[_0x2a94d0];return _0x210425;},a46_0x2a94(_0x3cb983,_0x1efb2b);}export function getConfigAppCode(){const _0x231c0d=a46_0x3af1ff;let _0x1942c7={},_0x154121={};try{if(existsSync(globalConfigPath)){const _0xe08df1=readFileSync(globalConfigPath,{'encoding':_0x231c0d(0x181)});_0xe08df1&&(_0x154121=JSON['parse'](_0xe08df1));}}catch(_0x2b6748){}try{if(existsSync(projectConfigPath)){const _0x46f439=readFileSync(projectConfigPath,{'encoding':_0x231c0d(0x181)});_0x46f439&&(_0x1942c7=JSON['parse'](_0x46f439));}}catch(_0x1a1f50){}let _0x3fd2e6;if(_0x231c0d(0x17f)in _0x1942c7)_0x3fd2e6=_0x1942c7['appcode'];else{if(_0x231c0d(0x188)in _0x1942c7)_0x3fd2e6=_0x1942c7[_0x231c0d(0x188)];else{if(_0x231c0d(0x17f)in _0x154121)_0x3fd2e6=_0x154121[_0x231c0d(0x17f)];else'app'in _0x154121&&(_0x3fd2e6=_0x154121[_0x231c0d(0x188)]);}}if(typeof _0x3fd2e6!==_0x231c0d(0x17c)||_0x3fd2e6[_0x231c0d(0x189)]()==='')return undefined;return _0x3fd2e6;}export function isInProject(){return existsSync(projectConfigPath);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x19b063,_0x5d8272){const _0xb4185d=a47_0x2f10,_0x5f329a=_0x19b063();while(!![]){try{const _0x2ad935=parseInt(_0xb4185d(0x15c))/0x1*(parseInt(_0xb4185d(0x167))/0x2)+parseInt(_0xb4185d(0x163))/0x3*(parseInt(_0xb4185d(0x164))/0x4)+-parseInt(_0xb4185d(0x156))/0x5+parseInt(_0xb4185d(0x15e))/0x6*(-parseInt(_0xb4185d(0x161))/0x7)+-parseInt(_0xb4185d(0x159))/0x8+parseInt(_0xb4185d(0x168))/0x9*(parseInt(_0xb4185d(0x158))/0xa)+-parseInt(_0xb4185d(0x166))/0xb*(parseInt(_0xb4185d(0x15a))/0xc);if(_0x2ad935===_0x5d8272)break;else _0x5f329a['push'](_0x5f329a['shift']());}catch(_0x90a696){_0x5f329a['push'](_0x5f329a['shift']());}}}(a47_0x505f,0x746dd));function a47_0x2f10(_0x23387b,_0x13ccf8){const _0x505f2d=a47_0x505f();return a47_0x2f10=function(_0x2f107e,_0x1734f6){_0x2f107e=_0x2f107e-0x156;let _0x53e4c0=_0x505f2d[_0x2f107e];return _0x53e4c0;},a47_0x2f10(_0x23387b,_0x13ccf8);}function a47_0x505f(){const _0x337c10=['name','error','7abocFF','isDirectory','1824DMcGxS','3484faUHbu','copyFileSync','55rPIyPp','6EtSuGT','2315529qigjvI','join','4492015NSJQDx','复制目录时出错:','30CGjucV','2526520XlynWu','260976oEyprn','mkdirSync','246934wIfmLb','readdirSync','1454172jwfaPk'];a47_0x505f=function(){return _0x337c10;};return a47_0x505f();}import a47_0x37109a from'node:path';import a47_0x28d8f3 from'node:fs';export async function copyDirectory(_0x3ba94a,_0x3de2ee){const _0x32cb37=a47_0x2f10;try{const _0x1343a2=a47_0x28d8f3[_0x32cb37(0x15d)](_0x3ba94a,{'withFileTypes':!![]});a47_0x28d8f3[_0x32cb37(0x15b)](_0x3de2ee,{'recursive':!![]});for(const _0x575dfb of _0x1343a2){const _0x16de3f=a47_0x37109a[_0x32cb37(0x169)](_0x3ba94a,_0x575dfb['name']),_0x355976=a47_0x37109a[_0x32cb37(0x169)](_0x3de2ee,_0x575dfb[_0x32cb37(0x15f)]);_0x575dfb[_0x32cb37(0x162)]()?await copyDirectory(_0x16de3f,_0x355976):a47_0x28d8f3[_0x32cb37(0x165)](_0x16de3f,_0x355976);}}catch(_0x1832ef){console[_0x32cb37(0x160)](_0x32cb37(0x157),_0x1832ef);}}
|
package/lib/utils/http-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a48_0x3d2e(){const _0x3dd726=['304370ArThRm','17362qduBeK','99EoBZHp','content-type','1712UfNaLM','1963368jkzrte','23mHGpOl','AbortError','includes','json','get','application/json','1476095HNipHq','12019hoiBcw','abort','headers','2072628mkjGhM','\x20次重试...','status','fetch','*\x20请求失败,','name','2130FpDSwN','ENOTFOUND','ECONNRESET','6JRNZSQ','text','signal','log','1264yliYmk','message'];a48_0x3d2e=function(){return _0x3dd726;};return a48_0x3d2e();}(function(_0x1a1be4,_0x437c10){const _0x4488d4=a48_0x54c3,_0x39365d=_0x1a1be4();while(!![]){try{const _0xd483e2=parseInt(_0x4488d4(0x65))/0x1*(parseInt(_0x4488d4(0x7f))/0x2)+-parseInt(_0x4488d4(0x75))/0x3*(-parseInt(_0x4488d4(0x82))/0x4)+-parseInt(_0x4488d4(0x6b))/0x5*(-parseInt(_0x4488d4(0x78))/0x6)+parseInt(_0x4488d4(0x6c))/0x7*(-parseInt(_0x4488d4(0x7c))/0x8)+-parseInt(_0x4488d4(0x80))/0x9*(parseInt(_0x4488d4(0x7e))/0xa)+parseInt(_0x4488d4(0x83))/0xb+-parseInt(_0x4488d4(0x6f))/0xc;if(_0xd483e2===_0x437c10)break;else _0x39365d['push'](_0x39365d['shift']());}catch(_0x5ba195){_0x39365d['push'](_0x39365d['shift']());}}}(a48_0x3d2e,0x30726));export async function httpRequest(_0x1df783,_0x4d07dd={}){const _0x58077a=a48_0x54c3,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x4d07dd;let _0x19ee2f=null;for(let _0x2a5e5a=0x0;_0x2a5e5a<=retries;_0x2a5e5a++){try{const _0x183229=new AbortController(),_0x3a0355=setTimeout(()=>_0x183229[_0x58077a(0x6d)](),timeout),_0x3aa051=await fetch(_0x1df783,{'headers':headers,'signal':_0x183229[_0x58077a(0x7a)]});clearTimeout(_0x3a0355);let _0xd31840;const _0x50f08f=_0x3aa051[_0x58077a(0x6e)][_0x58077a(0x69)](_0x58077a(0x81));return _0x50f08f?.[_0x58077a(0x67)](_0x58077a(0x6a))?_0xd31840=await _0x3aa051[_0x58077a(0x68)]():_0xd31840=await _0x3aa051[_0x58077a(0x79)](),{'ok':_0x3aa051['ok'],'status':_0x3aa051[_0x58077a(0x71)],'statusText':_0x3aa051['statusText'],'data':_0xd31840,'headers':_0x3aa051[_0x58077a(0x6e)],'url':_0x3aa051['url'],'text':()=>_0x3aa051[_0x58077a(0x79)]()};}catch(_0x379c90){_0x19ee2f=_0x379c90 instanceof Error?_0x379c90:new Error(String(_0x379c90));if(_0x2a5e5a===retries)break;if(shouldRetry(_0x379c90)){console[_0x58077a(0x7b)](_0x58077a(0x73)+retryDelay+'ms\x20后进行第\x20'+(_0x2a5e5a+0x1)+_0x58077a(0x70)),await sleep(retryDelay);continue;}else break;}}throw _0x19ee2f||new Error('Request\x20failed');}function shouldRetry(_0x111018){const _0x3c814c=a48_0x54c3;if(_0x111018 instanceof Error){if(_0x111018['name']===_0x3c814c(0x66))return![];if(_0x111018[_0x3c814c(0x74)]==='TypeError'&&_0x111018['message']['includes'](_0x3c814c(0x72)))return!![];if(_0x111018[_0x3c814c(0x7d)][_0x3c814c(0x67)](_0x3c814c(0x77)))return!![];if(_0x111018[_0x3c814c(0x7d)][_0x3c814c(0x67)](_0x3c814c(0x76)))return![];}return![];}function sleep(_0x33d3c2){return new Promise(_0x5726ce=>setTimeout(_0x5726ce,_0x33d3c2));}function a48_0x54c3(_0x827ef6,_0x371e2e){const _0x3d2ea2=a48_0x3d2e();return a48_0x54c3=function(_0x54c34a,_0x3408ea){_0x54c34a=_0x54c34a-0x65;let _0x136e73=_0x3d2ea2[_0x54c34a];return _0x136e73;},a48_0x54c3(_0x827ef6,_0x371e2e);}export function validateUrl(_0xf87672){try{return new URL(_0xf87672),!![];}catch{return![];}}
|