@lovrabet/cli 1.1.26-beta.8 → 1.1.26
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/use-get-online-menu-list.js +1 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-cdn-version/app-menu-sync-cdn-version-ui.js +1 -1
- package/lib/app-menu-cdn-version/cdn-url-compare-table.js +1 -1
- package/lib/app-menu-cdn-version/update-menu-cdn-url.js +1 -1
- package/lib/app-menu-update-cdn/current-content.js +1 -0
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -0
- package/lib/app-menu-update-cdn/main.js +1 -0
- 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/lib/init/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1bd822,_0x2717eb){const _0x544a77=a52_0x1ce1,_0x6b040a=_0x1bd822();while(!![]){try{const _0x2f8a2a=-parseInt(_0x544a77(0x1cc))/0x1*(parseInt(_0x544a77(0x1d1))/0x2)+-parseInt(_0x544a77(0x1c9))/0x3+parseInt(_0x544a77(0x1b9))/0x4+parseInt(_0x544a77(0x1d4))/0x5*(-parseInt(_0x544a77(0x1b7))/0x6)+parseInt(_0x544a77(0x1b6))/0x7*(-parseInt(_0x544a77(0x1e0))/0x8)+parseInt(_0x544a77(0x1bb))/0x9+parseInt(_0x544a77(0x1bd))/0xa*(parseInt(_0x544a77(0x1d6))/0xb);if(_0x2f8a2a===_0x2717eb)break;else _0x6b040a['push'](_0x6b040a['shift']());}catch(_0x32be5b){_0x6b040a['push'](_0x6b040a['shift']());}}}(a52_0x24cf,0x684ae));import{jsxs as a52_0x576fae,jsx as a52_0x5c3efd}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Box,Text,useInput}from'ink';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';function a52_0x1ce1(_0x4c2c14,_0x2ceca3){_0x4c2c14=_0x4c2c14-0x1b6;const _0x24cfd8=a52_0x24cf();let _0x1ce1c5=_0x24cfd8[_0x4c2c14];return _0x1ce1c5;}function a52_0x24cf(){const _0xe8ad9c=['stringify','length','当前目录已存在\x20.lovrabetrc\x20文件','version','cyan','393747cotsOf','应用代码不合法','gray','7tcQxIQ','backspace','.lovrabetrc','toLocaleString','test','61158AKpmIl','创建配置文件失败:\x20','green','327885IZJpxK','现在您可以使用\x20lovrabet\x20api\x20doc\x20和\x20lovrabet\x20api\x20pull\x20等命令了','110JQIlEY','../..','delete','utf8','应用代码长度不能超过\x20100\x20个字符','red','应用代码用于标识您的项目,只能包含字母、数字、-\x20和\x20_','string','请输入应用代码\x20(AppCode):\x20','\x20←\x20','8fUxpOp','env','创建配置文件失败','init','return','初始化项目配置文件成功','4196325OYLpWr','24wJxrBZ','message','3149000rjaMyL','应用代码只能包含字母、数字、-\x20和\x20_','3763863bxYJzn','应用代码不能为空','428810tnNrwJ','setLogPath','trim','exit','column','slice','online'];a52_0x24cf=function(){return _0xe8ad9c;};return a52_0x24cf();}export function Init({appcode:_0x48f0c1,env:_0x238b7d}){const _0x46f2de=a52_0x1ce1,[_0x511fc7,_0x43dbc1]=useState(null),[_0x2fd988,_0x351930]=useState(![]),[_0x395db1,_0x4940d1]=useState(!_0x48f0c1),[_0x372fef,_0x533ad4]=useState(''),[_0x2fc943,_0x41fcee]=useState(''),[_0x196492,_0x2b66c3]=useState(_0x48f0c1||''),[_0x1c67e1]=useState(_0x238b7d);function _0x53372b(_0x377ac5){const _0x3c6f6a=a52_0x1ce1;if(_0x377ac5[_0x3c6f6a(0x1c5)]===0x0)return{'valid':![],'message':''};if(_0x377ac5[_0x3c6f6a(0x1c5)]>0x64)return{'valid':![],'message':_0x3c6f6a(0x1da)};const _0x1889a4=/^[A-Za-z0-9_-]+$/;if(!_0x1889a4[_0x3c6f6a(0x1d0)](_0x377ac5))return{'valid':![],'message':_0x3c6f6a(0x1ba)};return{'valid':!![]};}useInput((_0x425ea2,_0x8aab5a)=>{const _0x46be7c=a52_0x1ce1;if(!_0x395db1)return;if(_0x8aab5a[_0x46be7c(0x1e4)]){if(_0x2fc943||!_0x372fef['trim']()){_0x41fcee(_0x46be7c(0x1bc));return;}const _0x1ef932=_0x372fef[_0x46be7c(0x1bf)](),{valid:_0x599f60,message:_0x175421}=_0x53372b(_0x1ef932);if(!_0x599f60){_0x41fcee(_0x175421||_0x46be7c(0x1ca));return;}_0x2b66c3(_0x1ef932),_0x4940d1(![]);}else{if(_0x8aab5a[_0x46be7c(0x1cd)]||_0x8aab5a[_0x46be7c(0x1d8)])_0x533ad4(_0x287ea0=>{const _0xd1e212=_0x46be7c,_0x2d203d=_0x287ea0[_0xd1e212(0x1c2)](0x0,-0x1);if(_0x2d203d[_0xd1e212(0x1c5)]===0x0)_0x41fcee('');else{const {valid:_0x5b2634,message:_0x20bcd2}=_0x53372b(_0x2d203d);_0x41fcee(_0x5b2634?'':_0x20bcd2||_0xd1e212(0x1ca));}return _0x2d203d;});else _0x8aab5a['ctrl']&&_0x425ea2==='c'?process[_0x46be7c(0x1c0)](0x0):_0x533ad4(_0x27d29f=>{const _0x12b239=_0x46be7c,_0x29a0f7=_0x27d29f+_0x425ea2,{valid:_0x25a63b,message:_0x5b7f2d}=_0x53372b(_0x29a0f7);return _0x41fcee(_0x25a63b?'':_0x5b7f2d||_0x12b239(0x1ca)),_0x29a0f7;});}},{'isActive':_0x395db1}),useEffect(()=>{const _0x15e916=a52_0x1ce1;if(!_0x196492||_0x395db1)return;const _0x3af9d5=resolve(process['cwd'](),_0x15e916(0x1ce));if(existsSync(_0x3af9d5)){_0x43dbc1(_0x15e916(0x1c6)),setTimeout(()=>process['exit'](0x1),0x64);return;}try{const _0x2c9865=fileURLToPath(import.meta.url),_0x91f2da=resolve(dirname(_0x2c9865),_0x15e916(0x1d7)),_0x18a6be=join(_0x91f2da,'package.json');let _0x298bbf='1.0.0';try{const _0xb25836=JSON['parse'](readFileSync(_0x18a6be,_0x15e916(0x1d9)));_0x298bbf=_0xb25836[_0x15e916(0x1c7)]||'1.0.0';}catch(_0x3be608){}const _0x56ecb9=readConfig(),_0x3703f5=typeof _0x56ecb9[_0x15e916(0x1e1)]===_0x15e916(0x1dd)?_0x56ecb9[_0x15e916(0x1e1)]:undefined,{app:_0x13d9c9,appcode:_0x2001bb,..._0x3edeb0}=_0x56ecb9,_0x428b59={..._0x3edeb0,'appcode':_0x196492,'env':_0x1c67e1||_0x3703f5||_0x15e916(0x1c3),'createdAt':new Date()[_0x15e916(0x1cf)](),'version':_0x298bbf};writeFileSync(_0x3af9d5,JSON[_0x15e916(0x1c4)](_0x428b59,null,0x2),{'encoding':_0x15e916(0x1d9),'mode':0x180}),logger[_0x15e916(0x1be)](process['cwd']()),logger['info'](_0x15e916(0x1e3),_0x15e916(0x1e5),{'appcode':_0x196492,'env':_0x428b59[_0x15e916(0x1e1)],'version':_0x428b59['version'],'configPath':_0x3af9d5}),_0x351930(!![]),setTimeout(()=>process[_0x15e916(0x1c0)](0x0),0x64);}catch(_0x1f1706){logger['error'](_0x15e916(0x1e3),_0x15e916(0x1e2),{'error':_0x1f1706 instanceof Error?_0x1f1706[_0x15e916(0x1b8)]:String(_0x1f1706)}),_0x43dbc1(_0x15e916(0x1d2)+(_0x1f1706 instanceof Error?_0x1f1706[_0x15e916(0x1b8)]:String(_0x1f1706))),setTimeout(()=>process[_0x15e916(0x1c0)](0x1),0x64);}},[_0x196492,_0x395db1,_0x1c67e1]);if(_0x511fc7)return a52_0x5c3efd(Box,{'flexDirection':_0x46f2de(0x1c1),'children':a52_0x576fae(Text,{'color':_0x46f2de(0x1db),'children':['✗\x20',_0x511fc7]})});if(_0x395db1)return a52_0x576fae(Box,{'flexDirection':_0x46f2de(0x1c1),'children':[a52_0x576fae(Box,{'children':[a52_0x5c3efd(Text,{'color':_0x46f2de(0x1c8),'children':_0x46f2de(0x1de)}),_0x372fef?a52_0x5c3efd(Text,{'color':_0x46f2de(0x1d3),'children':_0x372fef}):a52_0x5c3efd(Text,{'color':_0x46f2de(0x1cb),'children':'_'}),_0x2fc943&&a52_0x576fae(Text,{'color':_0x46f2de(0x1db),'children':[_0x46f2de(0x1df),_0x2fc943]})]}),!_0x2fc943&&!_0x372fef&&a52_0x5c3efd(Box,{'children':a52_0x5c3efd(Text,{'color':_0x46f2de(0x1cb),'children':_0x46f2de(0x1dc)})})]});if(_0x2fd988)return a52_0x576fae(Box,{'flexDirection':_0x46f2de(0x1c1),'children':[a52_0x5c3efd(Text,{'color':_0x46f2de(0x1d3),'children':'✓\x20成功在当前目录初始化\x20.lovrabetrc\x20文件'}),a52_0x576fae(Text,{'color':_0x46f2de(0x1c8),'children':['AppCode:\x20',_0x196492]}),a52_0x5c3efd(Text,{'children':_0x46f2de(0x1d5)})]});return a52_0x5c3efd(Box,{'children':a52_0x5c3efd(Text,{'children':'正在初始化配置文件...'})});}
|
package/lib/mcp/cursor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
(function(_0x5298e4,_0x1742d2){const _0x3f57ab=a53_0x35a8,_0x3f8755=_0x5298e4();while(!![]){try{const _0x5c71b5=-parseInt(_0x3f57ab(0x15e))/0x1*(-parseInt(_0x3f57ab(0x16f))/0x2)+-parseInt(_0x3f57ab(0x16d))/0x3+parseInt(_0x3f57ab(0x173))/0x4+-parseInt(_0x3f57ab(0x18a))/0x5*(parseInt(_0x3f57ab(0x16c))/0x6)+parseInt(_0x3f57ab(0x184))/0x7*(parseInt(_0x3f57ab(0x158))/0x8)+parseInt(_0x3f57ab(0x16b))/0x9+-parseInt(_0x3f57ab(0x161))/0xa;if(_0x5c71b5===_0x1742d2)break;else _0x3f8755['push'](_0x3f8755['shift']());}catch(_0x1f68c6){_0x3f8755['push'](_0x3f8755['shift']());}}}(a53_0x3166,0xa6e6a));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{resolve,dirname}from'node:path';function a53_0x35a8(_0x29a6d6,_0x3fb2bb){_0x29a6d6=_0x29a6d6-0x156;const _0x316624=a53_0x3166();let _0x35a811=_0x316624[_0x29a6d6];return _0x35a811;}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';function a53_0x3166(){const _0x4df10e=['创建\x20.cursor/rules\x20目录','错误:\x20解析现有\x20mcp.json\x20失败:\x20','4993312tBkIyR','env','lovrabet-dataset','.cursor','npx','复制\x20Cursor\x20Rules\x20文件失败','warn','创建\x20.cursor\x20目录','rules','更新现有\x20mcp.json\x20配置','stringify','✓\x20创建\x20.cursor\x20目录:\x20','mcp-cursor','创建新的\x20mcp.json\x20配置','utf8','appcode','未找到\x20appcode\x20配置','133ccGbXn','parse','✓\x20更新\x20mcp.json\x20配置','exit','\x20\x20-\x20配置文件:\x20','@lovrabet/dataset-mcp-server','709015urmKeT','\x20\x20-\x20环境:\x20','online','配置\x20Cursor\x20MCP\x20成功','555400yoFHWu','mcp.json','\x20\x20-\x20AppCode:\x20','message','\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。','错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置','17pjIcqH','log','info','17972590fdBrKJ','请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。','lovrabet_rules.mdc','../../templates/rules/lovrabet_rules.mdc.tpl','Cursor\x20Rules\x20模板文件不存在','✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc','Cursor\x20Rules\x20文件已存在,跳过','app','!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件','mcpServers','10425780KLzJYE','42WIxqYu','2945667ZRkfug','error','85832ERkiVL','\x0a✓\x20Cursor\x20MCP\x20配置成功!'];a53_0x3166=function(){return _0x4df10e;};return a53_0x3166();}export async function configureCursorMcp(){const _0x3473b1=a53_0x35a8;try{const _0x47092e=process['cwd'](),_0x10fb3b=resolve(_0x47092e,_0x3473b1(0x176)),_0x5a4afc=resolve(_0x10fb3b,_0x3473b1(0x159)),_0x5a8c0e=readConfig(),_0x2a3a4c=_0x5a8c0e[_0x3473b1(0x182)]||_0x5a8c0e[_0x3473b1(0x168)],_0x3aa184=_0x5a8c0e[_0x3473b1(0x174)]||_0x3473b1(0x156);!_0x2a3a4c&&(console[_0x3473b1(0x16e)](_0x3473b1(0x15d)),logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),_0x3473b1(0x183)),process[_0x3473b1(0x187)](0x1));!existsSync(_0x10fb3b)&&(mkdirSync(_0x10fb3b,{'recursive':!![]}),logger[_0x3473b1(0x160)](_0x3473b1(0x17f),_0x3473b1(0x17a),{'path':_0x10fb3b}),console[_0x3473b1(0x15f)](_0x3473b1(0x17e)+_0x10fb3b));const _0x345c40={'command':_0x3473b1(0x177),'args':['-y',_0x3473b1(0x189)],'env':{'LOVRABET_APP_CODE':String(_0x2a3a4c),'LOVRABET_ENV':String(_0x3aa184)}};let _0x2e90eb;if(existsSync(_0x5a4afc))try{const _0x1a2627=readFileSync(_0x5a4afc,_0x3473b1(0x181));_0x2e90eb=JSON[_0x3473b1(0x185)](_0x1a2627),!_0x2e90eb[_0x3473b1(0x16a)]&&(_0x2e90eb[_0x3473b1(0x16a)]={}),_0x2e90eb[_0x3473b1(0x16a)][_0x3473b1(0x175)]=_0x345c40,logger[_0x3473b1(0x160)](_0x3473b1(0x17f),_0x3473b1(0x17c),{'path':_0x5a4afc,'appcode':_0x2a3a4c,'env':_0x3aa184}),console[_0x3473b1(0x15f)](_0x3473b1(0x186));}catch(_0xca39c8){logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),'解析现有\x20mcp.json\x20失败',{'error':_0xca39c8 instanceof Error?_0xca39c8['message']:String(_0xca39c8)}),console[_0x3473b1(0x16e)](_0x3473b1(0x172)+(_0xca39c8 instanceof Error?_0xca39c8[_0x3473b1(0x15b)]:String(_0xca39c8))),process[_0x3473b1(0x187)](0x1);}else _0x2e90eb={'mcpServers':{'lovrabet-dataset':_0x345c40}},logger['info'](_0x3473b1(0x17f),_0x3473b1(0x180),{'path':_0x5a4afc,'appcode':_0x2a3a4c,'env':_0x3aa184}),console['log']('✓\x20创建\x20mcp.json\x20配置文件');writeFileSync(_0x5a4afc,JSON[_0x3473b1(0x17d)](_0x2e90eb,null,0x2),{'encoding':_0x3473b1(0x181)});const _0x4abdff=resolve(_0x10fb3b,_0x3473b1(0x17b)),_0x57373e=resolve(_0x4abdff,_0x3473b1(0x163));if(!existsSync(_0x57373e))try{!existsSync(_0x4abdff)&&(mkdirSync(_0x4abdff,{'recursive':!![]}),logger['info']('mcp-cursor',_0x3473b1(0x171),{'path':_0x4abdff}));const _0x4d657a=fileURLToPath(import.meta.url),_0x32c7f0=dirname(_0x4d657a),_0xeda35=resolve(_0x32c7f0,_0x3473b1(0x164));existsSync(_0xeda35)?(copyFileSync(_0xeda35,_0x57373e),logger[_0x3473b1(0x160)](_0x3473b1(0x17f),'复制\x20Cursor\x20Rules\x20文件',{'from':_0xeda35,'to':_0x57373e}),console[_0x3473b1(0x15f)](_0x3473b1(0x166))):logger[_0x3473b1(0x179)](_0x3473b1(0x17f),_0x3473b1(0x165),{'templatePath':_0xeda35});}catch(_0x2a6bc3){logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),_0x3473b1(0x178),{'error':_0x2a6bc3 instanceof Error?_0x2a6bc3[_0x3473b1(0x15b)]:String(_0x2a6bc3)}),console[_0x3473b1(0x179)]('警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20'+(_0x2a6bc3 instanceof Error?_0x2a6bc3[_0x3473b1(0x15b)]:String(_0x2a6bc3)));}else console['log'](_0x3473b1(0x169)),logger[_0x3473b1(0x160)](_0x3473b1(0x17f),_0x3473b1(0x167),{'path':_0x57373e});console[_0x3473b1(0x15f)](_0x3473b1(0x170)),console['log']('\x0a配置信息:'),console['log'](_0x3473b1(0x15a)+_0x2a3a4c),console[_0x3473b1(0x15f)](_0x3473b1(0x18b)+_0x3aa184),console[_0x3473b1(0x15f)](_0x3473b1(0x188)+_0x5a4afc),console[_0x3473b1(0x15f)](_0x3473b1(0x15c)),console['log'](_0x3473b1(0x162)),logger[_0x3473b1(0x160)]('mcp-cursor',_0x3473b1(0x157),{'appcode':_0x2a3a4c,'env':_0x3aa184,'configPath':_0x5a4afc}),process[_0x3473b1(0x187)](0x0);}catch(_0x50ae2e){logger[_0x3473b1(0x16e)](_0x3473b1(0x17f),'配置\x20Cursor\x20MCP\x20失败',{'error':_0x50ae2e instanceof Error?_0x50ae2e[_0x3473b1(0x15b)]:String(_0x50ae2e)}),console[_0x3473b1(0x16e)]('错误:\x20配置失败:\x20'+(_0x50ae2e instanceof Error?_0x50ae2e[_0x3473b1(0x15b)]:String(_0x50ae2e))),process[_0x3473b1(0x187)](0x1);}}
|
package/lib/mcp/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0xc779a6,_0x10b224){var _0x2058a4=a54_0x5b52,_0x209c82=_0xc779a6();while(!![]){try{var _0x411a77=-parseInt(_0x2058a4(0x16e))/0x1+parseInt(_0x2058a4(0x170))/0x2*(-parseInt(_0x2058a4(0x171))/0x3)+-parseInt(_0x2058a4(0x163))/0x4+parseInt(_0x2058a4(0x165))/0x5+-parseInt(_0x2058a4(0x172))/0x6+-parseInt(_0x2058a4(0x166))/0x7+parseInt(_0x2058a4(0x16d))/0x8;if(_0x411a77===_0x10b224)break;else _0x209c82['push'](_0x209c82['shift']());}catch(_0x1dc5d2){_0x209c82['push'](_0x209c82['shift']());}}}(a54_0x20a8,0xb7c4b));import{configureCursorMcp}from'./cursor.js';import{logger}from'../utils/logger.js';function a54_0x5b52(_0x36bb6b,_0x1bdfb0){_0x36bb6b=_0x36bb6b-0x15b;var _0x20a8b3=a54_0x20a8();var _0x5b52aa=_0x20a8b3[_0x36bb6b];return _0x5b52aa;}function a54_0x20a8(){var _0x196097=['\x20\x20-\x20cursor','错误:\x20请指定\x20IDE\x20类型','25216432OslkPR','696136ObLSDW','setLogPath','2rdmoPW','864471ggazhn','5102184AZjUgI','toLowerCase','mcp','\x0a使用方法:','\x20\x20lovrabet\x20mcp\x20cursor\x20\x20\x20\x20配置\x20Cursor\x20的\x20MCP','cursor','log','\x0a示例:','执行配置\x20Cursor\x20MCP\x20命令','885988oRGqgD','\x0a当前支持的\x20IDE:','1784085dOWDcz','4900014AnPDlF','error','错误:\x20不支持的\x20IDE\x20类型:\x20','cwd','exit'];a54_0x20a8=function(){return _0x196097;};return a54_0x20a8();}export async function mcpCommand(_0xcdc4ec){var _0x55b8cb=a54_0x5b52;logger[_0x55b8cb(0x16f)](process[_0x55b8cb(0x169)]());if(!_0xcdc4ec){console['error'](_0x55b8cb(0x16c)),console[_0x55b8cb(0x160)](_0x55b8cb(0x15d)),console[_0x55b8cb(0x160)](_0x55b8cb(0x15e)),console['log'](_0x55b8cb(0x161)),console[_0x55b8cb(0x160)]('\x20\x20lovrabet\x20mcp\x20cursor'),logger['error'](_0x55b8cb(0x15c),'未指定\x20IDE\x20类型'),process['exit'](0x1);return;}switch(_0xcdc4ec[_0x55b8cb(0x15b)]()){case _0x55b8cb(0x15f):logger['info']('mcp',_0x55b8cb(0x162)),await configureCursorMcp();break;default:console['error'](_0x55b8cb(0x168)+_0xcdc4ec),console[_0x55b8cb(0x160)](_0x55b8cb(0x164)),console['log'](_0x55b8cb(0x16b)),logger[_0x55b8cb(0x167)]('mcp','不支持的\x20IDE\x20类型:\x20'+_0xcdc4ec),process[_0x55b8cb(0x16a)](0x1);break;}}
|
package/lib/utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a55_0x5c4024=a55_0x5f1f;(function(_0xbce278,_0x3353a6){const _0xe7654a=a55_0x5f1f,_0x516ddd=_0xbce278();while(!![]){try{const _0x2618ce=-parseInt(_0xe7654a(0x162))/0x1+-parseInt(_0xe7654a(0x167))/0x2+parseInt(_0xe7654a(0x16a))/0x3+-parseInt(_0xe7654a(0x161))/0x4*(-parseInt(_0xe7654a(0x168))/0x5)+parseInt(_0xe7654a(0x15d))/0x6+-parseInt(_0xe7654a(0x15e))/0x7*(-parseInt(_0xe7654a(0x16d))/0x8)+-parseInt(_0xe7654a(0x160))/0x9;if(_0x2618ce===_0x3353a6)break;else _0x516ddd['push'](_0x516ddd['shift']());}catch(_0x138463){_0x516ddd['push'](_0x516ddd['shift']());}}}(a55_0x2eab,0xcca31));function a55_0x2eab(){const _0x588488=['2719338BAyjod','appcode','trim','5743336gUBFKG','9996822GgYjLC','14WEizcA','.lovrabetrc','33088581oaEZIb','572MieoRA','108443sgBsRe','parse','string','utf8','cwd','1496410tOLxZl','47655pTfzmt','app'];a55_0x2eab=function(){return _0x588488;};return a55_0x2eab();}function a55_0x5f1f(_0x2cfabf,_0x5b8fd3){_0x2cfabf=_0x2cfabf-0x15d;const _0x2eabe7=a55_0x2eab();let _0x5f1f53=_0x2eabe7[_0x2cfabf];return _0x5f1f53;}import{existsSync,readFileSync}from'node:fs';import{resolve}from'node:path';import{homedir}from'node:os';export const projectConfigPath=resolve(process[a55_0x5c4024(0x166)](),a55_0x5c4024(0x15f));export const globalConfigPath=resolve(homedir(),a55_0x5c4024(0x15f));export function readConfig(){const _0x42c106=a55_0x5c4024;let _0x52fe02={};try{if(existsSync(globalConfigPath)){const _0x4e8388=readFileSync(globalConfigPath,{'encoding':_0x42c106(0x165)});_0x4e8388&&(_0x52fe02=JSON[_0x42c106(0x163)](_0x4e8388));}}catch(_0x5e94f0){}try{if(existsSync(projectConfigPath)){const _0x1cc181=readFileSync(projectConfigPath,{'encoding':_0x42c106(0x165)});if(_0x1cc181){const _0x34465a=JSON['parse'](_0x1cc181);_0x52fe02={..._0x52fe02,..._0x34465a};}}}catch(_0x40e10a){}return _0x52fe02;}export function getConfigAppCode(){const _0x3606c0=a55_0x5c4024;let _0x534bb8={},_0x56606c={};try{if(existsSync(globalConfigPath)){const _0x499f01=readFileSync(globalConfigPath,{'encoding':'utf8'});_0x499f01&&(_0x56606c=JSON['parse'](_0x499f01));}}catch(_0x3f777a){}try{if(existsSync(projectConfigPath)){const _0x3f107b=readFileSync(projectConfigPath,{'encoding':_0x3606c0(0x165)});_0x3f107b&&(_0x534bb8=JSON[_0x3606c0(0x163)](_0x3f107b));}}catch(_0x22c0bc){}let _0x476353;if(_0x3606c0(0x16b)in _0x534bb8)_0x476353=_0x534bb8[_0x3606c0(0x16b)];else{if('app'in _0x534bb8)_0x476353=_0x534bb8[_0x3606c0(0x169)];else{if(_0x3606c0(0x16b)in _0x56606c)_0x476353=_0x56606c[_0x3606c0(0x16b)];else _0x3606c0(0x169)in _0x56606c&&(_0x476353=_0x56606c[_0x3606c0(0x169)]);}}if(typeof _0x476353!==_0x3606c0(0x164)||_0x476353[_0x3606c0(0x16c)]()==='')return undefined;return _0x476353;}export function isInProject(){return existsSync(projectConfigPath);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x53c933,_0x101871){const _0x1dd7a2=a56_0x2321,_0x3764a8=_0x53c933();while(!![]){try{const _0x5468f5=-parseInt(_0x1dd7a2(0xac))/0x1*(-parseInt(_0x1dd7a2(0xa5))/0x2)+parseInt(_0x1dd7a2(0xa7))/0x3*(-parseInt(_0x1dd7a2(0x9f))/0x4)+-parseInt(_0x1dd7a2(0xa6))/0x5*(-parseInt(_0x1dd7a2(0xa3))/0x6)+-parseInt(_0x1dd7a2(0xa0))/0x7*(parseInt(_0x1dd7a2(0x9d))/0x8)+-parseInt(_0x1dd7a2(0xa9))/0x9*(-parseInt(_0x1dd7a2(0x9c))/0xa)+-parseInt(_0x1dd7a2(0xab))/0xb+-parseInt(_0x1dd7a2(0xa8))/0xc;if(_0x5468f5===_0x101871)break;else _0x3764a8['push'](_0x3764a8['shift']());}catch(_0x4d9a5e){_0x3764a8['push'](_0x3764a8['shift']());}}}(a56_0x2cf9,0x4e4c9));import a56_0x38720f from'node:path';function a56_0x2cf9(){const _0x3569eb=['2992794vLuMtC','复制目录时出错:','copyFileSync','84PmhJQN','name','6sxEQKO','7675bTGILk','178749aRpJyi','1395588KfXutW','111114TxqlRP','join','698676XMrQgy','179986nVluTw','error','readdirSync','490pUsDcz','8XPsphQ','isDirectory','16NJVuNV'];a56_0x2cf9=function(){return _0x3569eb;};return a56_0x2cf9();}function a56_0x2321(_0x27d6f7,_0xd5ffce){_0x27d6f7=_0x27d6f7-0x9c;const _0x2cf9dd=a56_0x2cf9();let _0x23210f=_0x2cf9dd[_0x27d6f7];return _0x23210f;}import a56_0x3ee209 from'node:fs';export async function copyDirectory(_0x222e83,_0x2a00a2){const _0x2f8f6f=a56_0x2321;try{const _0x27c28e=a56_0x3ee209[_0x2f8f6f(0xae)](_0x222e83,{'withFileTypes':!![]});a56_0x3ee209['mkdirSync'](_0x2a00a2,{'recursive':!![]});for(const _0x5a4801 of _0x27c28e){const _0x5a917a=a56_0x38720f[_0x2f8f6f(0xaa)](_0x222e83,_0x5a4801['name']),_0x227e34=a56_0x38720f[_0x2f8f6f(0xaa)](_0x2a00a2,_0x5a4801[_0x2f8f6f(0xa4)]);_0x5a4801[_0x2f8f6f(0x9e)]()?await copyDirectory(_0x5a917a,_0x227e34):a56_0x3ee209[_0x2f8f6f(0xa2)](_0x5a917a,_0x227e34);}}catch(_0x4694a2){console[_0x2f8f6f(0xad)](_0x2f8f6f(0xa1),_0x4694a2);}}
|
package/lib/utils/http-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3de174,_0x16f3a6){const _0x5ba4ef=a57_0x5b0b,_0x35f827=_0x3de174();while(!![]){try{const _0x44154b=parseInt(_0x5ba4ef(0x16d))/0x1+-parseInt(_0x5ba4ef(0x173))/0x2+parseInt(_0x5ba4ef(0x160))/0x3+parseInt(_0x5ba4ef(0x174))/0x4+-parseInt(_0x5ba4ef(0x16f))/0x5+-parseInt(_0x5ba4ef(0x167))/0x6*(-parseInt(_0x5ba4ef(0x165))/0x7)+-parseInt(_0x5ba4ef(0x15a))/0x8*(parseInt(_0x5ba4ef(0x177))/0x9);if(_0x44154b===_0x16f3a6)break;else _0x35f827['push'](_0x35f827['shift']());}catch(_0x4c2062){_0x35f827['push'](_0x35f827['shift']());}}}(a57_0x19e3,0x8988f));export async function httpRequest(_0x205858,_0x1fbe88={}){const _0x576432=a57_0x5b0b,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x1fbe88;let _0x6f4d89=null;for(let _0x47f194=0x0;_0x47f194<=retries;_0x47f194++){try{const _0x27492d=new AbortController(),_0x534946=setTimeout(()=>_0x27492d[_0x576432(0x16a)](),timeout),_0x32bfc1=await fetch(_0x205858,{'headers':headers,'signal':_0x27492d[_0x576432(0x162)]});clearTimeout(_0x534946);let _0x152805;const _0x33e070=_0x32bfc1[_0x576432(0x163)][_0x576432(0x172)](_0x576432(0x15e));return _0x33e070?.[_0x576432(0x170)](_0x576432(0x178))?_0x152805=await _0x32bfc1[_0x576432(0x16c)]():_0x152805=await _0x32bfc1[_0x576432(0x171)](),{'ok':_0x32bfc1['ok'],'status':_0x32bfc1[_0x576432(0x164)],'statusText':_0x32bfc1[_0x576432(0x16e)],'data':_0x152805,'headers':_0x32bfc1[_0x576432(0x163)],'url':_0x32bfc1[_0x576432(0x166)],'text':()=>_0x32bfc1['text']()};}catch(_0x2442eb){_0x6f4d89=_0x2442eb instanceof Error?_0x2442eb:new Error(String(_0x2442eb));if(_0x47f194===retries)break;if(shouldRetry(_0x2442eb)){console[_0x576432(0x15f)](_0x576432(0x16b)+retryDelay+'ms\x20后进行第\x20'+(_0x47f194+0x1)+_0x576432(0x15c)),await sleep(retryDelay);continue;}else break;}}throw _0x6f4d89||new Error(_0x576432(0x168));}function a57_0x19e3(){const _0x12f266=['get','1362016woFsAs','747364PzTKFx','TypeError','fetch','3216249YlCjgy','application/json','16PBtGcp','AbortError','\x20次重试...','name','content-type','log','2334336ZmUPGq','ECONNRESET','signal','headers','status','42yRJeAe','url','829698kCigVT','Request\x20failed','message','abort','*\x20请求失败,','json','1039508vGVTvG','statusText','4375430tlpIgH','includes','text'];a57_0x19e3=function(){return _0x12f266;};return a57_0x19e3();}function a57_0x5b0b(_0xba4fd2,_0x1383eb){_0xba4fd2=_0xba4fd2-0x15a;const _0x19e355=a57_0x19e3();let _0x5b0bb1=_0x19e355[_0xba4fd2];return _0x5b0bb1;}function shouldRetry(_0x4148b7){const _0x765b4b=a57_0x5b0b;if(_0x4148b7 instanceof Error){if(_0x4148b7[_0x765b4b(0x15d)]===_0x765b4b(0x15b))return![];if(_0x4148b7[_0x765b4b(0x15d)]===_0x765b4b(0x175)&&_0x4148b7[_0x765b4b(0x169)][_0x765b4b(0x170)](_0x765b4b(0x176)))return!![];if(_0x4148b7[_0x765b4b(0x169)][_0x765b4b(0x170)](_0x765b4b(0x161)))return!![];if(_0x4148b7['message']['includes']('ENOTFOUND'))return![];}return![];}function sleep(_0x54cf8e){return new Promise(_0x255563=>setTimeout(_0x255563,_0x54cf8e));}export function validateUrl(_0x292f73){try{return new URL(_0x292f73),!![];}catch{return![];}}
|
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a58_0x1d0d(){const _0x2eee49=['12932944iRDnog','readLogs','timestamp','error','File','warn','2298bnPUNW','toISOString','clear','transports','2334812yyemCL','stringify','Failed\x20to\x20clear\x20logs:','now','blue','existsSync','yellow','success','level','winstonLogger','errors','filter','format','2620770IrzLnY','rawCommand','utf8','Failed\x20to\x20read\x20logs:','clearLogs','createLogger','logFilePath','.lovrabet.log','duration','info','unknown','logTask','initWinstonLogger','mkdirSync','printf','red','setRawCommand','9935JFInGF','green','2yNZgUa','parse','split','215089ZDukrr','addColors','currentRawCommand','combine','message','6066263HCOpwS','5629275ZGxxIi'];a58_0x1d0d=function(){return _0x2eee49;};return a58_0x1d0d();}const a58_0x953178=a58_0x2394;(function(_0x124e55,_0x4f41d3){const _0x1a646e=a58_0x2394,_0x5f2430=_0x124e55();while(!![]){try{const _0xc8af0e=parseInt(_0x1a646e(0x101))/0x1+-parseInt(_0x1a646e(0xfe))/0x2*(parseInt(_0x1a646e(0xeb))/0x3)+parseInt(_0x1a646e(0xde))/0x4+parseInt(_0x1a646e(0xfc))/0x5*(parseInt(_0x1a646e(0xda))/0x6)+-parseInt(_0x1a646e(0x106))/0x7+parseInt(_0x1a646e(0x108))/0x8+-parseInt(_0x1a646e(0x107))/0x9;if(_0xc8af0e===_0x4f41d3)break;else _0x5f2430['push'](_0x5f2430['shift']());}catch(_0x2e5b68){_0x5f2430['push'](_0x5f2430['shift']());}}}(a58_0x1d0d,0xc5f05));import a58_0x7b3a29 from'winston';function a58_0x2394(_0x20bb12,_0x68ff40){_0x20bb12=_0x20bb12-0xd5;const _0x1d0de9=a58_0x1d0d();let _0x239425=_0x1d0de9[_0x20bb12];return _0x239425;}import a58_0x5584da from'node:fs';import a58_0x1135e9 from'node:path';class Logger{[a58_0x953178(0xe7)];[a58_0x953178(0xf1)];['currentRawCommand']='';constructor(){const _0x59380e=a58_0x953178;this[_0x59380e(0xf1)]='';}[a58_0x953178(0xfb)](_0x1ea822){const _0x4f970d=a58_0x953178;this[_0x4f970d(0x103)]=_0x1ea822;}['initWinstonLogger'](){const _0x486c82=a58_0x953178,_0x400b56=a58_0x1135e9['dirname'](this[_0x486c82(0xf1)]);!a58_0x5584da['existsSync'](_0x400b56)&&a58_0x5584da[_0x486c82(0xf8)](_0x400b56,{'recursive':!![]});const _0x5325b3=a58_0x7b3a29[_0x486c82(0xea)][_0x486c82(0x104)](a58_0x7b3a29[_0x486c82(0xea)][_0x486c82(0xd6)](),a58_0x7b3a29[_0x486c82(0xea)][_0x486c82(0xe8)]({'stack':!![]}),a58_0x7b3a29['format'][_0x486c82(0xf9)](_0x371550=>{const _0x21c73e=_0x486c82,_0x4b70d0={'timestamp':_0x371550['timestamp']||new Date()[_0x21c73e(0xdb)](),'level':_0x371550[_0x21c73e(0xe6)]||_0x21c73e(0xf4),'command':_0x371550['command']||_0x21c73e(0xf5),'rawCommand':_0x371550[_0x21c73e(0xec)]||this[_0x21c73e(0x103)]||undefined,'message':_0x371550[_0x21c73e(0x105)]||'','duration':_0x371550[_0x21c73e(0xf3)]||undefined,'details':_0x371550['details']||undefined};return JSON[_0x21c73e(0xdf)](_0x4b70d0);}));this['winstonLogger']=a58_0x7b3a29[_0x486c82(0xf0)]({'level':_0x486c82(0xf4),'format':_0x5325b3,'transports':[new a58_0x7b3a29[(_0x486c82(0xdd))][(_0x486c82(0xd8))]({'filename':this[_0x486c82(0xf1)],'level':_0x486c82(0xf4)})],'silent':![]}),a58_0x7b3a29[_0x486c82(0x102)]({'success':_0x486c82(0xfd),'error':_0x486c82(0xfa),'warn':_0x486c82(0xe4),'info':_0x486c82(0xe2)});}['setLogPath'](_0x1b8246){const _0x382ece=a58_0x953178;this[_0x382ece(0xf1)]=a58_0x1135e9['join'](_0x1b8246,_0x382ece(0xf2)),this['winstonLogger']&&this[_0x382ece(0xe7)][_0x382ece(0xdc)](),this[_0x382ece(0xf7)]();}[a58_0x953178(0xf4)](_0x165340,_0x5d471c,_0x432800){const _0x5a28bc=a58_0x953178;if(!this[_0x5a28bc(0xf1)]||!this[_0x5a28bc(0xe7)])return;this[_0x5a28bc(0xe7)][_0x5a28bc(0xf4)](_0x5d471c,{'command':_0x165340,'details':_0x432800});}[a58_0x953178(0xe5)](_0x1031bd,_0x1ce318,_0x5ac448,_0x154ce5){const _0x2c680f=a58_0x953178;if(!this['logFilePath']||!this[_0x2c680f(0xe7)])return;this[_0x2c680f(0xe7)]['log'](_0x2c680f(0xf4),_0x1ce318,{'level':_0x2c680f(0xe5),'command':_0x1031bd,'duration':_0x5ac448,'details':_0x154ce5});}[a58_0x953178(0xd7)](_0x25153d,_0x51cb73,_0x4ae6c4){const _0x30cc47=a58_0x953178;if(!this['logFilePath']||!this['winstonLogger'])return;this[_0x30cc47(0xe7)]['error'](_0x51cb73,{'command':_0x25153d,'details':_0x4ae6c4});}[a58_0x953178(0xd9)](_0x31a036,_0x5d0ecf,_0x5d8f46){const _0x52b765=a58_0x953178;if(!this['logFilePath']||!this[_0x52b765(0xe7)])return;this['winstonLogger']['warn'](_0x5d0ecf,{'command':_0x31a036,'details':_0x5d8f46});}async[a58_0x953178(0xf6)](_0x52d520,_0x1a9249,_0x59f5da){const _0xbef1b9=a58_0x953178,_0xc6eb77=Date[_0xbef1b9(0xe1)]();this[_0xbef1b9(0xf4)](_0x52d520,'开始执行:\x20'+_0x1a9249);try{const _0x36c04a=await _0x59f5da(),_0x21b55f=Date[_0xbef1b9(0xe1)]()-_0xc6eb77;return this[_0xbef1b9(0xe5)](_0x52d520,'完成:\x20'+_0x1a9249,_0x21b55f),_0x36c04a;}catch(_0x1c773c){const _0x46fdb5=Date['now']()-_0xc6eb77;this[_0xbef1b9(0xd7)](_0x52d520,'失败:\x20'+_0x1a9249,{'error':_0x1c773c instanceof Error?_0x1c773c[_0xbef1b9(0x105)]:String(_0x1c773c),'duration':_0x46fdb5});throw _0x1c773c;}}[a58_0x953178(0xd5)](){const _0xacb5d=a58_0x953178;try{if(!a58_0x5584da['existsSync'](this['logFilePath']))return[];const _0x48a592=a58_0x5584da['readFileSync'](this[_0xacb5d(0xf1)],'utf8');return _0x48a592[_0xacb5d(0x100)]('\x0a')[_0xacb5d(0xe9)](_0x5e1078=>_0x5e1078['trim']())['map'](_0x58fe40=>JSON[_0xacb5d(0xff)](_0x58fe40));}catch(_0x394915){return console['warn'](_0xacb5d(0xee),_0x394915),[];}}[a58_0x953178(0xef)](){const _0x2ddec5=a58_0x953178;try{a58_0x5584da[_0x2ddec5(0xe3)](this['logFilePath'])&&a58_0x5584da['writeFileSync'](this[_0x2ddec5(0xf1)],'',_0x2ddec5(0xed));}catch(_0x5231ce){console[_0x2ddec5(0xd9)](_0x2ddec5(0xe0),_0x5231ce);}}['getWinstonInstance'](){const _0x3394c4=a58_0x953178;return this[_0x3394c4(0xe7)];}}export const logger=new Logger();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a59_0x41f042=a59_0x9b4e;(function(_0x5fc06a,_0x500537){const _0x420abb=a59_0x9b4e,_0x4ef3e0=_0x5fc06a();while(!![]){try{const _0x5d14d6=-parseInt(_0x420abb(0x1a4))/0x1+parseInt(_0x420abb(0x1c8))/0x2*(parseInt(_0x420abb(0x1c4))/0x3)+parseInt(_0x420abb(0x1bc))/0x4+parseInt(_0x420abb(0x1b6))/0x5*(-parseInt(_0x420abb(0x1b2))/0x6)+parseInt(_0x420abb(0x1aa))/0x7*(-parseInt(_0x420abb(0x1a9))/0x8)+parseInt(_0x420abb(0x1ac))/0x9*(parseInt(_0x420abb(0x1b4))/0xa)+-parseInt(_0x420abb(0x1ad))/0xb*(-parseInt(_0x420abb(0x1a5))/0xc);if(_0x5d14d6===_0x500537)break;else _0x4ef3e0['push'](_0x4ef3e0['shift']());}catch(_0x4e525c){_0x4ef3e0['push'](_0x4ef3e0['shift']());}}}(a59_0x453f,0x28c88));function a59_0x9b4e(_0x3694bf,_0x3dcd30){_0x3694bf=_0x3694bf-0x19e;const _0x453f41=a59_0x453f();let _0x9b4e15=_0x453f41[_0x3694bf];return _0x9b4e15;}import a59_0x28bed2 from'node:fs';function a59_0x453f(){const _0x4bba51=['index.tsx','path:\x20\x22','toComponentName','charAt','indexOf','146888QyZSnr','3852aGNTlP','utf8','promises','开始更新路由配置','344VgehxI','2863QpYPDj','readFile','10305uNodsM','1804KxyuZE','lastIndexOf','map','router','import\x20','6kTIHxb','includes','2330THgERO','existsSync','529145wAXgfN','match','routerFilePath','addPageRoute','info','addRoute','414212wIrdJt','\x20from\x20\x22../pages/','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','路由文件不存在:\x20','length','slice','split','join','6fByYXK','index','error','previewChanges','14370ZQMbpm','未找到路由配置的\x20children\x20数组','now','addImport'];a59_0x453f=function(){return _0x4bba51;};return a59_0x453f();}import a59_0x58b2c7 from'node:path';import{logger}from'./logger.js';export class RouterUpdater{[a59_0x41f042(0x1b8)];constructor(_0x437c42){const _0x3c49e8=a59_0x41f042;this[_0x3c49e8(0x1b8)]=a59_0x58b2c7['join'](_0x437c42,'src','router',_0x3c49e8(0x19f));}async[a59_0x41f042(0x1b9)](_0x2e49cb,_0x17167c){const _0x21d59a=a59_0x41f042;if(!a59_0x28bed2[_0x21d59a(0x1b5)](this[_0x21d59a(0x1b8)]))throw new Error('路由文件不存在:\x20'+this[_0x21d59a(0x1b8)]);const _0x1dfd7f=Date[_0x21d59a(0x1ca)]();logger[_0x21d59a(0x1ba)](_0x21d59a(0x1b0),_0x21d59a(0x1a8),{'pageName':_0x2e49cb,'routePath':_0x17167c,'file':this[_0x21d59a(0x1b8)]});try{const _0x343a81=await a59_0x28bed2[_0x21d59a(0x1a7)][_0x21d59a(0x1ab)](this[_0x21d59a(0x1b8)],_0x21d59a(0x1a6)),_0x59a424=this[_0x21d59a(0x1a1)](_0x2e49cb),_0x31d6b4=this[_0x21d59a(0x19e)](_0x343a81,_0x59a424,_0x2e49cb),_0x1a6290=this[_0x21d59a(0x1bb)](_0x31d6b4,_0x17167c,_0x59a424);await a59_0x28bed2[_0x21d59a(0x1a7)]['writeFile'](this[_0x21d59a(0x1b8)],_0x1a6290,_0x21d59a(0x1a6));const _0xc89b1e=Date[_0x21d59a(0x1ca)]()-_0x1dfd7f;logger['success'](_0x21d59a(0x1b0),'路由配置更新完成',_0xc89b1e,{'pageName':_0x2e49cb,'routePath':_0x17167c,'componentName':_0x59a424});}catch(_0x419a76){const _0x1ebb63=Date['now']()-_0x1dfd7f;logger[_0x21d59a(0x1c6)](_0x21d59a(0x1b0),'路由配置更新失败',{'pageName':_0x2e49cb,'routePath':_0x17167c,'error':_0x419a76 instanceof Error?_0x419a76['message']:String(_0x419a76),'duration':_0x1ebb63});throw _0x419a76;}}[a59_0x41f042(0x1a1)](_0x4c22cd){const _0x366f26=a59_0x41f042;return _0x4c22cd[_0x366f26(0x1c2)]('-')[_0x366f26(0x1af)](_0x5af8a6=>_0x5af8a6[_0x366f26(0x1a2)](0x0)['toUpperCase']()+_0x5af8a6[_0x366f26(0x1c1)](0x1)['toLowerCase']())[_0x366f26(0x1c3)]('');}[a59_0x41f042(0x19e)](_0x183622,_0x3370df,_0xf8dd9e){const _0x400391=a59_0x41f042,_0x538360=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x3f9419=_0x183622['match'](_0x538360)||[],_0x5bf19a=_0x400391(0x1b1)+_0x3370df+_0x400391(0x1bd)+_0xf8dd9e+'\x22;';if(_0x183622['includes'](_0x5bf19a))return _0x183622;if(_0x3f9419[_0x400391(0x1c0)]>0x0){const _0x4c2361=_0x3f9419[_0x3f9419[_0x400391(0x1c0)]-0x1];if(_0x4c2361){const _0xa94818=_0x183622['lastIndexOf'](_0x4c2361),_0x35302a=_0xa94818+_0x4c2361[_0x400391(0x1c0)];return _0x183622[_0x400391(0x1c1)](0x0,_0x35302a)+_0x5bf19a+'\x0a'+_0x183622['slice'](_0x35302a);}}const _0x50779b=_0x183622[_0x400391(0x1b7)](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x50779b&&_0x50779b[_0x400391(0x1c5)]!==undefined){const _0x27c17f=_0x50779b['index']+_0x50779b[0x0][_0x400391(0x1c0)];return _0x183622['slice'](0x0,_0x27c17f)+_0x5bf19a+'\x0a'+_0x183622[_0x400391(0x1c1)](_0x27c17f);}return _0x183622;}['addRoute'](_0x4191fe,_0x299d1e,_0x3871ed){const _0x279dda=a59_0x41f042,_0x1b45e6='\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22'+_0x299d1e+_0x279dda(0x1be)+_0x3871ed+'\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},';if(_0x4191fe[_0x279dda(0x1b3)](_0x279dda(0x1a0)+_0x299d1e+'\x22'))return _0x4191fe;const _0x54edb8=/children:\s*\[([\s\S]*?)\]/,_0x157e60=_0x4191fe[_0x279dda(0x1b7)](_0x54edb8);if(!_0x157e60||_0x157e60[_0x279dda(0x1c5)]===undefined)throw new Error(_0x279dda(0x1c9));const _0x31d323=_0x157e60[0x1],_0x5a8643=_0x157e60['index']+_0x157e60[0x0][_0x279dda(0x1a3)]('[')+0x1,_0x12a4e8=_0x31d323?.[_0x279dda(0x1b7)](/\{[\s\S]*?\},/g)||[];if(_0x12a4e8[_0x279dda(0x1c0)]>0x0){const _0x956e27=_0x12a4e8[_0x12a4e8[_0x279dda(0x1c0)]-0x1];if(_0x956e27){const _0x3da0cd=_0x4191fe[_0x279dda(0x1ae)](_0x956e27),_0x15e307=_0x3da0cd+_0x956e27[_0x279dda(0x1c0)];return _0x4191fe[_0x279dda(0x1c1)](0x0,_0x15e307)+'\x0a'+_0x1b45e6+_0x4191fe[_0x279dda(0x1c1)](_0x15e307);}}return _0x4191fe['slice'](0x0,_0x5a8643)+'\x0a'+_0x1b45e6+_0x4191fe['slice'](_0x5a8643);}async[a59_0x41f042(0x1c7)](_0xd40fa9,_0x4b210d){const _0x5edeba=a59_0x41f042;if(!a59_0x28bed2['existsSync'](this[_0x5edeba(0x1b8)]))throw new Error(_0x5edeba(0x1bf)+this[_0x5edeba(0x1b8)]);const _0x1ad5e0=await a59_0x28bed2[_0x5edeba(0x1a7)][_0x5edeba(0x1ab)](this['routerFilePath'],_0x5edeba(0x1a6)),_0x3e0e14=this[_0x5edeba(0x1a1)](_0xd40fa9);let _0x5df666=this[_0x5edeba(0x19e)](_0x1ad5e0,_0x3e0e14,_0xd40fa9);return _0x5df666=this['addRoute'](_0x5df666,_0x4b210d,_0x3e0e14),_0x5df666;}}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x4e0c91){return new Promise(_0x56f103=>setTimeout(_0x56f103,_0x4e0c91));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a61_0x4ec784=a61_0x4b0b;(function(_0x4510b9,_0x15adc2){const _0x51e0d1=a61_0x4b0b,_0x1bcaa8=_0x4510b9();while(!![]){try{const _0x3f3544=parseInt(_0x51e0d1(0x1fc))/0x1*(-parseInt(_0x51e0d1(0x1cc))/0x2)+parseInt(_0x51e0d1(0x1f4))/0x3+-parseInt(_0x51e0d1(0x1ef))/0x4+parseInt(_0x51e0d1(0x1ec))/0x5*(parseInt(_0x51e0d1(0x202))/0x6)+parseInt(_0x51e0d1(0x1d6))/0x7+parseInt(_0x51e0d1(0x205))/0x8*(-parseInt(_0x51e0d1(0x1f3))/0x9)+-parseInt(_0x51e0d1(0x1ed))/0xa*(-parseInt(_0x51e0d1(0x1d1))/0xb);if(_0x3f3544===_0x15adc2)break;else _0x1bcaa8['push'](_0x1bcaa8['shift']());}catch(_0x4e7758){_0x1bcaa8['push'](_0x1bcaa8['shift']());}}}(a61_0x6a65,0xa6dbc));import a61_0x3a1d2f from'node:fs';function a61_0x4b0b(_0x507da3,_0x47fa97){_0x507da3=_0x507da3-0x1cc;const _0x6a6532=a61_0x6a65();let _0x4b0b66=_0x6a6532[_0x507da3];return _0x4b0b66;}import a61_0x423fc8 from'node:path';function a61_0x6a65(){const _0x250f19=['endsWith','now','toLocaleDateString','error','mkdir','.ts','.jsx','numeric','map','pop','.tpl','extname','开始处理模板内容替换','replaceContent','join','toComponentName','processDirectory','promises','2646305BZBUvb','570ljDlEw','.scss','518284mfHfUh','.js','template','isFile','203382SzwYKi','2689521usEUTG','utf8','.tsx','api','toDisplayTitle','message','info','charAt','490558oYXFLk','readdir','toLowerCase','replace','processTemplate','toISOString','6dYxLXM','.json','processFile','80lEjQMP','4cKGBRw','stringify','2-digit','name','slice','12419OCbxwR','copyFile','replaceApiContent','readFile','isDirectory','3709986OkXoWd','split','includes','toUpperCase'];a61_0x6a65=function(){return _0x250f19;};return a61_0x6a65();}import{logger}from'./logger.js';export class TemplateReplacer{static[a61_0x4ec784(0x1e9)](_0x596544){const _0x92a19a=a61_0x4ec784,_0x24fded=_0x596544[_0x92a19a(0x1d7)]('/')['pop']()||_0x596544;return _0x24fded['split']('-')[_0x92a19a(0x1e2)](_0x5b5a65=>_0x5b5a65[_0x92a19a(0x1fb)](0x0)[_0x92a19a(0x1d9)]()+_0x5b5a65['slice'](0x1)[_0x92a19a(0x1fe)]())[_0x92a19a(0x1e8)]('');}static['toDisplayTitle'](_0x2431bc){const _0x16b32e=a61_0x4ec784,_0x2ed14e=_0x2431bc[_0x16b32e(0x1d7)]('/')[_0x16b32e(0x1e3)]()||_0x2431bc;return _0x2ed14e[_0x16b32e(0x1d7)]('-')[_0x16b32e(0x1e2)](_0x2d700f=>_0x2d700f['charAt'](0x0)[_0x16b32e(0x1d9)]()+_0x2d700f[_0x16b32e(0x1d0)](0x1)['toLowerCase']())['join']('\x20');}static[a61_0x4ec784(0x1e7)](_0x140777,_0x2f73d8,_0x54bdb8){const _0x2e7b76=a61_0x4ec784,_0x4cc83a=this['toComponentName'](_0x2f73d8),_0x44d40e=this[_0x2e7b76(0x1f8)](_0x2f73d8),_0x5ac308=new Date(),_0x312e0c=_0x5ac308['toLocaleString'](undefined,{'year':_0x2e7b76(0x1e1),'month':'2-digit','day':'2-digit','hour':_0x2e7b76(0x1ce),'minute':_0x2e7b76(0x1ce),'second':_0x2e7b76(0x1ce),'hour12':![]})['replace'](/\//g,'-'),_0x365cca=_0x5ac308[_0x2e7b76(0x1dc)](undefined,{'year':_0x2e7b76(0x1e1),'month':_0x2e7b76(0x1ce),'day':_0x2e7b76(0x1ce)})[_0x2e7b76(0x1ff)](/\//g,'-'),_0x397f2b=_0x5ac308['toLocaleTimeString'](undefined,{'hour12':![]});let _0x41f245=_0x140777[_0x2e7b76(0x1ff)](/\{ComponentName\}/g,_0x4cc83a)[_0x2e7b76(0x1ff)](/\{DisplayTitle\}/g,_0x44d40e)[_0x2e7b76(0x1ff)](/\{PageName\}/g,_0x2f73d8)[_0x2e7b76(0x1ff)](/\{TemplateName\}/g,_0x54bdb8)['replace'](/\{CreatedAt\}/g,_0x312e0c)['replace'](/\{CreatedDate\}/g,_0x365cca)[_0x2e7b76(0x1ff)](/\{CreatedTime\}/g,_0x397f2b);return _0x41f245;}static[a61_0x4ec784(0x1d3)](_0x5b2a0a,_0x323a08,_0x243c7a,_0xa7046,_0x5c6411,_0x4d03c2,_0x59cb6d){const _0x24c247=a61_0x4ec784,_0x1b7398=new Date(),_0x5c439d=_0x1b7398[_0x24c247(0x201)](),_0x8671c0=JSON[_0x24c247(0x1cd)](_0x243c7a,null,0x2)[_0x24c247(0x1d7)]('\x0a')[_0x24c247(0x1d0)](0x1,-0x1)['map'](_0x50b290=>_0x50b290[_0x24c247(0x1ff)](/^ /,'\x20\x20\x20\x20'))['join']('\x0a'),_0xe6a53a=_0xa7046||Object['keys'](_0x243c7a)[0x0]||'YourModel';let _0xb330f6=_0x5b2a0a['replace'](/\{AppCode\}/g,_0x323a08)['replace'](/\{ModelConfigs\}/g,_0x8671c0)['replace'](/\{ExampleModelName\}/g,_0xe6a53a)[_0x24c247(0x1ff)](/\{ApiFileName\}/g,_0x5c6411||_0x24c247(0x1f7))[_0x24c247(0x1ff)](/\{ConfigName\}/g,_0x4d03c2||'default')['replace'](/\{ClientConfigParam\}/g,_0x59cb6d||'')[_0x24c247(0x1ff)](/\{CreatedAt\}/g,_0x5c439d);return _0xb330f6;}static async[a61_0x4ec784(0x200)](_0x3f2138,_0x35be8c,_0x1458b4,_0x533cca,_0xfc1d46=!![]){const _0x4c1d0c=a61_0x4ec784,_0x4442a5=Date[_0x4c1d0c(0x1db)]();try{_0xfc1d46&&logger[_0x4c1d0c(0x1fa)]('template',_0x4c1d0c(0x1e6),{'templatePath':_0x3f2138,'targetPath':_0x35be8c,'pageName':_0x1458b4,'templateName':_0x533cca});await a61_0x3a1d2f[_0x4c1d0c(0x1eb)][_0x4c1d0c(0x1de)](_0x35be8c,{'recursive':!![]}),await this[_0x4c1d0c(0x1ea)](_0x3f2138,_0x35be8c,_0x1458b4,_0x533cca);if(_0xfc1d46){const _0x7e91b5=Date[_0x4c1d0c(0x1db)]()-_0x4442a5;logger['success'](_0x4c1d0c(0x1f1),'模板内容替换完成',_0x7e91b5,{'pageName':_0x1458b4,'templateName':_0x533cca});}}catch(_0x57ff9a){if(_0xfc1d46){const _0x16ef3f=Date[_0x4c1d0c(0x1db)]()-_0x4442a5;logger[_0x4c1d0c(0x1dd)](_0x4c1d0c(0x1f1),'模板内容替换失败',{'templatePath':_0x3f2138,'targetPath':_0x35be8c,'pageName':_0x1458b4,'templateName':_0x533cca,'error':_0x57ff9a instanceof Error?_0x57ff9a[_0x4c1d0c(0x1f9)]:String(_0x57ff9a),'duration':_0x16ef3f});}throw _0x57ff9a;}}static async[a61_0x4ec784(0x1ea)](_0x55945c,_0x17fa40,_0x56923a,_0xda387c){const _0x50edb5=a61_0x4ec784,_0x42de76=await a61_0x3a1d2f[_0x50edb5(0x1eb)][_0x50edb5(0x1fd)](_0x55945c,{'withFileTypes':!![]});for(const _0x3552a6 of _0x42de76){const _0x578527=a61_0x423fc8[_0x50edb5(0x1e8)](_0x55945c,_0x3552a6[_0x50edb5(0x1cf)]);let _0x136381=a61_0x423fc8[_0x50edb5(0x1e8)](_0x17fa40,_0x3552a6[_0x50edb5(0x1cf)]);_0x3552a6['name'][_0x50edb5(0x1da)](_0x50edb5(0x1e4))&&(_0x136381=a61_0x423fc8[_0x50edb5(0x1e8)](_0x17fa40,_0x3552a6[_0x50edb5(0x1cf)][_0x50edb5(0x1ff)](/\.tpl$/,'')));if(_0x3552a6[_0x50edb5(0x1d5)]())await a61_0x3a1d2f[_0x50edb5(0x1eb)]['mkdir'](_0x136381,{'recursive':!![]}),await this[_0x50edb5(0x1ea)](_0x578527,_0x136381,_0x56923a,_0xda387c);else _0x3552a6[_0x50edb5(0x1f2)]()&&await this[_0x50edb5(0x204)](_0x578527,_0x136381,_0x56923a,_0xda387c);}}static async['processFile'](_0x3b9bc8,_0x3849e0,_0xecdd0f,_0x5105fa){const _0x45626d=a61_0x4ec784,_0xb3f945=a61_0x423fc8[_0x45626d(0x1e5)](_0x3b9bc8)[_0x45626d(0x1fe)]();_0x3b9bc8[_0x45626d(0x1da)](_0x45626d(0x1e4))&&(_0x3849e0=_0x3849e0[_0x45626d(0x1ff)](/\.tpl$/,''));const _0x5edeed=[_0x45626d(0x1f6),_0x45626d(0x1df),_0x45626d(0x1e0),_0x45626d(0x1f0),_0x45626d(0x203),'.md','.css',_0x45626d(0x1ee),_0x45626d(0x1e4)];if(_0x5edeed[_0x45626d(0x1d8)](_0xb3f945)||_0x3b9bc8[_0x45626d(0x1da)](_0x45626d(0x1e4))){const _0x18972a=await a61_0x3a1d2f[_0x45626d(0x1eb)][_0x45626d(0x1d4)](_0x3b9bc8,_0x45626d(0x1f5)),_0x1bba86=this[_0x45626d(0x1e7)](_0x18972a,_0xecdd0f,_0x5105fa);await a61_0x3a1d2f[_0x45626d(0x1eb)]['writeFile'](_0x3849e0,_0x1bba86,'utf8');}else await a61_0x3a1d2f[_0x45626d(0x1eb)][_0x45626d(0x1d2)](_0x3b9bc8,_0x3849e0);}}
|