@lovrabet/cli 1.2.3 → 1.2.5-beta.1
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/README.md +33 -17
- 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-update-cdn/current-content.js +1 -1
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
- package/lib/app-menu-update-cdn/main.js +1 -1
- package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cmd/build-watch.js +1 -1
- package/lib/cmd/build.js +1 -1
- package/lib/cmd/logs.js +1 -1
- package/lib/cmd/preview.js +1 -1
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/claude.js +1 -0
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/skills/main.js +1 -0
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/router-updater.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +1 -1
- package/templates/projects/sub-app-react-demo/index.html +22 -34
- package/templates/projects/sub-app-react-demo/public/logo.svg +1 -0
- package/templates/projects/sub-app-react-demo/src/api/api.ts +1 -1
- package/templates/projects/sub-app-react-demo/src/api/client.ts +1 -1
- package/templates/projects/sub-app-react-demo/src/layouts/MainLayout.tsx +44 -71
- package/templates/projects/sub-app-react-demo/src/pages/index.tsx +387 -927
- package/templates/projects/sub-app-react-demo/src/pages/sdk-demo/index.tsx +1 -1
- package/templates/projects/sub-app-react-demo/src/pages/workbench/index.module.css +293 -0
- package/templates/projects/sub-app-react-demo/src/pages/workbench/index.tsx +100 -414
- package/templates/projects/sub-app-react-demo/src/style.css +21 -15
- package/templates/projects/sub-app-react-demo/vite.config.ts +18 -13
- package/templates/rules/lovrabet_rules.mdc.tpl +636 -43
- package/templates/skills/.claude/skills/lovrabet/SKILL.md +257 -0
- package/templates/skills/.cursor/commands/lovrabet.md +247 -0
- package/templates/skills/.cursorrules +109 -0
- package/templates/skills/.shared/README.md +45 -0
- package/templates/skills/.shared/guides/01-filter-query/guide.md +300 -0
- package/templates/skills/.shared/guides/02-mcp-sql-workflow/guide.md +272 -0
- package/templates/skills/.shared/guides/03-antd-style/guide.md +227 -0
- package/templates/skills/.shared/guides/04-troubleshooting/guide.md +426 -0
- package/templates/skills/.shared/guides/05-api-integration/guide.md +327 -0
- package/templates/skills/.shared/guides/06-menu-management/guide.md +305 -0
- package/templates/skills/.windsurf/workflows/lovrabet.md +256 -0
- package/templates/projects/sub-app-react-demo/.vscode/extensions.json +0 -3
- package/templates/projects/sub-app-react-demo/.vscode/settings.json +0 -57
- package/templates/projects/sub-app-react-demo/src/pages/intro/index.tsx +0 -560
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x52f54f,_0x53c5b2){const _0x398ef6=a47_0x5096,_0x469e00=_0x52f54f();while(!![]){try{const _0x357345=parseInt(_0x398ef6(0x10e))/0x1*(-parseInt(_0x398ef6(0x10b))/0x2)+-parseInt(_0x398ef6(0x113))/0x3*(-parseInt(_0x398ef6(0x108))/0x4)+parseInt(_0x398ef6(0x119))/0x5+parseInt(_0x398ef6(0x10f))/0x6*(-parseInt(_0x398ef6(0x107))/0x7)+parseInt(_0x398ef6(0x109))/0x8*(-parseInt(_0x398ef6(0x11b))/0x9)+parseInt(_0x398ef6(0x114))/0xa+parseInt(_0x398ef6(0x10d))/0xb;if(_0x357345===_0x53c5b2)break;else _0x469e00['push'](_0x469e00['shift']());}catch(_0x5a25a6){_0x469e00['push'](_0x469e00['shift']());}}}(a47_0x1b97,0xdf8c8));import a47_0x1a6787 from'node:path';import{useCallback,useState}from'react';import{execa}from'execa';function a47_0x1b97(){const _0x1d5d4c=['8778qQkStL','message','开始格式化代码','prettier','127215khndIR','3638590EmHFtI','npx','success','cwd','now','3272240PsxfPo','resolve','5957613Vaxwhs','--write','代码格式化失败','error','format','5810MjnAxa','100KqKTAA','8NgVEEW','info','2258FGOhEe','格式化代码','25048496LodrBV','1385YBVxIe'];a47_0x1b97=function(){return _0x1d5d4c;};return a47_0x1b97();}function a47_0x5096(_0xd692aa,_0x5ea60b){_0xd692aa=_0xd692aa-0x106;const _0x1b9765=a47_0x1b97();let _0x509671=_0x1b9765[_0xd692aa];return _0x509671;}import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';export function useFormatCode(){const _0xe70e3d=a47_0x5096,[_0x443bb9,_0x2516ff]=useState(![]),[_0x3af2c5,_0x20c355]=useState(![]),[_0x17295f,_0x20232f]=useState(''),_0x1c4208=useCallback(async _0xcc2248=>{const _0x17ea71=a47_0x5096,_0x188c8a=Date[_0x17ea71(0x118)](),_0x5136fb=a47_0x1a6787[_0x17ea71(0x11a)](process[_0x17ea71(0x117)](),_0xcc2248);_0x2516ff(!![]);try{logger[_0x17ea71(0x10a)](_0x17ea71(0x106),_0x17ea71(0x111),{'projectCode':_0xcc2248}),await execa(_0x17ea71(0x115),[_0x17ea71(0x112),_0x17ea71(0x11c),'.'],{'cwd':_0x5136fb});const _0x5306df=Date[_0x17ea71(0x118)]()-_0x188c8a;logger[_0x17ea71(0x116)]('format','代码格式化完成',_0x5306df,{'projectCode':_0xcc2248});}catch(_0x101476){const _0x27253c=Date['now']()-_0x188c8a;logger[_0x17ea71(0x11e)](_0x17ea71(0x106),_0x17ea71(0x11d),{'projectCode':_0xcc2248,'error':_0x101476 instanceof Error?_0x101476[_0x17ea71(0x110)]:String(_0x101476),'duration':_0x27253c});throw _0x101476;}finally{_0x2516ff(![]),_0x20c355(!![]),_0x20232f(formatElapsed(_0x188c8a));}},[]);return{'taskName':_0xe70e3d(0x10c),'finished':_0x3af2c5,'loading':_0x443bb9,'elapsed':_0x17295f,'doTask':_0x1c4208};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x52dcdd,_0x1d89d8){const _0x4cc6c5=a48_0xccf7,_0x13cce5=_0x52dcdd();while(!![]){try{const _0x4ac923=parseInt(_0x4cc6c5(0x1b4))/0x1+parseInt(_0x4cc6c5(0x1b0))/0x2*(-parseInt(_0x4cc6c5(0x1af))/0x3)+parseInt(_0x4cc6c5(0x1a4))/0x4*(-parseInt(_0x4cc6c5(0x1a5))/0x5)+parseInt(_0x4cc6c5(0x1a6))/0x6*(parseInt(_0x4cc6c5(0x1aa))/0x7)+parseInt(_0x4cc6c5(0x1a2))/0x8+parseInt(_0x4cc6c5(0x1b2))/0x9*(parseInt(_0x4cc6c5(0x1a1))/0xa)+parseInt(_0x4cc6c5(0x1ae))/0xb*(-parseInt(_0x4cc6c5(0x1b5))/0xc);if(_0x4ac923===_0x1d89d8)break;else _0x13cce5['push'](_0x13cce5['shift']());}catch(_0x44e8a1){_0x13cce5['push'](_0x13cce5['shift']());}}}(a48_0x51ff,0xda0ee));import a48_0x43ae5d from'node:path';import{useCallback,useState}from'react';function a48_0x51ff(){const _0x1cd3ac=['npm','resolve','140eLmGjs','13172960hiDamR','安装依赖','1656cvGanu','19325skkwsu','1316118ZZfSOw','依赖安装失败','https://registry.npmmirror.com','install','56VgUtui','info','now','--registry','24753069CTDDTX','793857gRnMpj','6WSrFfh','message','535239ZslfSv','依赖安装完成','1303374lFooYW','12frOQvT','cwd','error'];a48_0x51ff=function(){return _0x1cd3ac;};return a48_0x51ff();}import{execa}from'execa';function a48_0xccf7(_0x5a231f,_0x4f80fe){_0x5a231f=_0x5a231f-0x19f;const _0x51ff80=a48_0x51ff();let _0xccf7bd=_0x51ff80[_0x5a231f];return _0xccf7bd;}import{formatElapsed}from'./format-elapsed.js';import{logger}from'../utils/logger.js';export function useInstallDependencies(){const _0x585428=a48_0xccf7,[_0x514835,_0x1d7f06]=useState(![]),[_0x1d88ee,_0x5c2d2b]=useState(![]),[_0x3da556,_0x104a20]=useState(''),_0x25bca8=useCallback(async _0xcef933=>{const _0x436822=a48_0xccf7,_0x3c602e=Date[_0x436822(0x1ac)](),_0x3258b2=a48_0x43ae5d[_0x436822(0x1a0)](process[_0x436822(0x1b6)](),_0xcef933);_0x1d7f06(!![]),_0x5c2d2b(![]);const _0x2316e0=async(_0xf1a88c,_0x337e5b)=>{await execa(_0xf1a88c,_0x337e5b,{'cwd':_0x3258b2});};try{logger[_0x436822(0x1ab)](_0x436822(0x1a9),'开始安装依赖',{'projectCode':_0xcef933,'registry':_0x436822(0x1a8)}),await _0x2316e0(_0x436822(0x19f),[_0x436822(0x1a9),_0x436822(0x1ad),_0x436822(0x1a8)]);const _0x22cd3d=Date[_0x436822(0x1ac)]()-_0x3c602e;logger['success'](_0x436822(0x1a9),_0x436822(0x1b3),_0x22cd3d,{'projectCode':_0xcef933});}catch(_0x33cdf5){const _0x172342=Date[_0x436822(0x1ac)]()-_0x3c602e;logger[_0x436822(0x1b7)](_0x436822(0x1a9),_0x436822(0x1a7),{'projectCode':_0xcef933,'error':_0x33cdf5 instanceof Error?_0x33cdf5[_0x436822(0x1b1)]:String(_0x33cdf5),'duration':_0x172342});throw _0x33cdf5;}finally{_0x1d7f06(![]),_0x5c2d2b(!![]),_0x104a20(formatElapsed(_0x3c602e));}},[]);return{'taskName':_0x585428(0x1a3),'finished':_0x1d88ee,'loading':_0x514835,'elapsed':_0x3da556,'doTask':_0x25bca8};}
|
package/lib/help.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a49_0x1ace(){var _0x32a4fa=['1019007qpOYQx','20850HMDYnD','column','green','13755ZJPmMN','180824WfLIQy','312CyElun','查看可用命令。','121918jvKMwv','!\x20请指定一个有效的命令。','310248HbsdMJ','175JdxIqy','34195giCiNI'];a49_0x1ace=function(){return _0x32a4fa;};return a49_0x1ace();}(function(_0x476816,_0xe6de9c){var _0x1da622=a49_0x205b,_0x4fa3a9=_0x476816();while(!![]){try{var _0x1b0e2e=parseInt(_0x1da622(0x1bc))/0x1+parseInt(_0x1da622(0x1be))/0x2+-parseInt(_0x1da622(0x1b8))/0x3+parseInt(_0x1da622(0x1b9))/0x4+parseInt(_0x1da622(0x1bf))/0x5*(-parseInt(_0x1da622(0x1b5))/0x6)+-parseInt(_0x1da622(0x1c0))/0x7*(parseInt(_0x1da622(0x1ba))/0x8)+parseInt(_0x1da622(0x1b4))/0x9;if(_0x1b0e2e===_0xe6de9c)break;else _0x4fa3a9['push'](_0x4fa3a9['shift']());}catch(_0x1a83b0){_0x4fa3a9['push'](_0x4fa3a9['shift']());}}}(a49_0x1ace,0x1cfda));function a49_0x205b(_0x57986e,_0x42a739){_0x57986e=_0x57986e-0x1b4;var _0x1ace73=a49_0x1ace();var _0x205b52=_0x1ace73[_0x57986e];return _0x205b52;}import{jsx as a49_0x1dfd37,jsxs as a49_0x505200}from'react/jsx-runtime';import{Box,Text}from'ink';export function Help(){var _0x2de393=a49_0x205b;return a49_0x505200(Box,{'flexDirection':_0x2de393(0x1b6),'marginTop':0x1,'marginBottom':0x1,'children':[a49_0x505200(Box,{'children':[a49_0x1dfd37(Box,{'width':'1'}),a49_0x1dfd37(Text,{'children':_0x2de393(0x1bd)})]}),a49_0x505200(Box,{'marginTop':0x1,'children':[a49_0x1dfd37(Box,{'width':'1'}),a49_0x505200(Text,{'children':['\x20\x20','使用']}),a49_0x505200(Text,{'bold':!![],'color':_0x2de393(0x1b7),'children':['\x20','lovrabet\x20--help','\x20']}),a49_0x1dfd37(Text,{'children':_0x2de393(0x1bb)})]})]});}
|
package/lib/init/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x41c373,_0x17e9a4){const _0x156235=a50_0x1c4f,_0x2de3da=_0x41c373();while(!![]){try{const _0x1e53ac=parseInt(_0x156235(0xe1))/0x1+parseInt(_0x156235(0xd4))/0x2+-parseInt(_0x156235(0xec))/0x3*(-parseInt(_0x156235(0xfa))/0x4)+-parseInt(_0x156235(0xed))/0x5*(-parseInt(_0x156235(0xd8))/0x6)+-parseInt(_0x156235(0xd5))/0x7+-parseInt(_0x156235(0xfb))/0x8*(-parseInt(_0x156235(0xe6))/0x9)+-parseInt(_0x156235(0xe5))/0xa;if(_0x1e53ac===_0x17e9a4)break;else _0x2de3da['push'](_0x2de3da['shift']());}catch(_0x32d5a4){_0x2de3da['push'](_0x2de3da['shift']());}}}(a50_0xe11a,0x62586));import{jsxs as a50_0x592919,jsx as a50_0x4a9b44}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';function a50_0x1c4f(_0x3a5679,_0x5f192b){_0x3a5679=_0x3a5679-0xd2;const _0xe11aca=a50_0xe11a();let _0x1c4fa0=_0xe11aca[_0x3a5679];return _0x1c4fa0;}import{fileURLToPath}from'node:url';import{logger}from'../utils/logger.js';import{readConfig}from'../utils/config.js';function a50_0xe11a(){const _0x46c022=['当前目录已存在\x20.lovrabetrc\x20文件','stringify','893328liPcPT','3194660BEsyeV','gray','创建配置文件失败:\x20','144588FNuwZK','delete','column','现在您可以使用\x20lovrabet\x20api\x20doc\x20和\x20lovrabet\x20api\x20pull\x20等命令了','\x20←\x20','../..','green','cwd','AppCode:\x20','396690dfRMUo','backspace','setLogPath','error','11559140pkcwCm','72ZBmtHt','请输入应用代码\x20(AppCode):\x20','应用代码长度不能超过\x20100\x20个字符','.lovrabetrc','应用代码用于标识您的项目,只能包含字母、数字、-\x20和\x20_','red','732flsXDf','115sRQybR','version','正在初始化配置文件...','init','env','return','length','string','应用代码不合法','slice','exit','1.0.0','应用代码只能包含字母、数字、-\x20和\x20_','7764dYqWGI','143904CVhAAG','utf8','message','✓\x20成功在当前目录初始化\x20.lovrabetrc\x20文件','trim','cyan','应用代码不能为空','创建配置文件失败','初始化项目配置文件成功','parse','ctrl'];a50_0xe11a=function(){return _0x46c022;};return a50_0xe11a();}export function Init({appcode:_0x555ae2,env:_0x1af77a}){const _0x5c870d=a50_0x1c4f,[_0x257101,_0x49e1b9]=useState(null),[_0x59022e,_0x1633e4]=useState(![]),[_0x1d947b,_0x4497d7]=useState(!_0x555ae2),[_0x135e99,_0x3e52a4]=useState(''),[_0x503653,_0x5750e3]=useState(''),[_0x45b86d,_0x481d19]=useState(_0x555ae2||''),[_0x20a8a0]=useState(_0x1af77a);function _0x4af332(_0x383c90){const _0x50671d=a50_0x1c4f;if(_0x383c90[_0x50671d(0xf3)]===0x0)return{'valid':![],'message':''};if(_0x383c90['length']>0x64)return{'valid':![],'message':_0x50671d(0xe8)};const _0x2ee9ba=/^[A-Za-z0-9_-]+$/;if(!_0x2ee9ba['test'](_0x383c90))return{'valid':![],'message':_0x50671d(0xf9)};return{'valid':!![]};}useInput((_0x39c248,_0x52329e)=>{const _0x2c101d=a50_0x1c4f;if(!_0x1d947b)return;if(_0x52329e[_0x2c101d(0xf2)]){if(_0x503653||!_0x135e99[_0x2c101d(0xff)]()){_0x5750e3(_0x2c101d(0x101));return;}const _0x254735=_0x135e99[_0x2c101d(0xff)](),{valid:_0x168a63,message:_0x4384c5}=_0x4af332(_0x254735);if(!_0x168a63){_0x5750e3(_0x4384c5||_0x2c101d(0xf5));return;}_0x481d19(_0x254735),_0x4497d7(![]);}else{if(_0x52329e[_0x2c101d(0xe2)]||_0x52329e[_0x2c101d(0xd9)])_0x3e52a4(_0x56084c=>{const _0x351ad7=_0x2c101d,_0x20956c=_0x56084c[_0x351ad7(0xf6)](0x0,-0x1);if(_0x20956c[_0x351ad7(0xf3)]===0x0)_0x5750e3('');else{const {valid:_0x546129,message:_0xc98727}=_0x4af332(_0x20956c);_0x5750e3(_0x546129?'':_0xc98727||_0x351ad7(0xf5));}return _0x20956c;});else _0x52329e[_0x2c101d(0x105)]&&_0x39c248==='c'?process['exit'](0x0):_0x3e52a4(_0x2c035a=>{const _0x25c42c=_0x2c035a+_0x39c248,{valid:_0x59b87c,message:_0x759b73}=_0x4af332(_0x25c42c);return _0x5750e3(_0x59b87c?'':_0x759b73||'应用代码不合法'),_0x25c42c;});}},{'isActive':_0x1d947b}),useEffect(()=>{const _0x56c904=a50_0x1c4f;if(!_0x45b86d||_0x1d947b)return;const _0xe58eb8=resolve(process[_0x56c904(0xdf)](),_0x56c904(0xe9));if(existsSync(_0xe58eb8)){_0x49e1b9(_0x56c904(0xd2)),setTimeout(()=>process[_0x56c904(0xf7)](0x1),0x64);return;}try{const _0x177181=fileURLToPath(import.meta.url),_0x56f697=resolve(dirname(_0x177181),_0x56c904(0xdd)),_0x446c7d=join(_0x56f697,'package.json');let _0x300ebd=_0x56c904(0xf8);try{const _0x545fac=JSON[_0x56c904(0x104)](readFileSync(_0x446c7d,_0x56c904(0xfc)));_0x300ebd=_0x545fac[_0x56c904(0xee)]||_0x56c904(0xf8);}catch(_0x172335){}const _0x332882=readConfig(),_0x1aeeb5=typeof _0x332882[_0x56c904(0xf1)]===_0x56c904(0xf4)?_0x332882['env']:undefined,{app:_0x45e5fe,appcode:_0x2a0f4c,..._0x561c89}=_0x332882,_0x5964a7={..._0x561c89,'appcode':_0x45b86d,'env':_0x20a8a0||_0x1aeeb5||'online','createdAt':new Date()['toLocaleString'](),'version':_0x300ebd};writeFileSync(_0xe58eb8,JSON[_0x56c904(0xd3)](_0x5964a7,null,0x2),{'encoding':_0x56c904(0xfc),'mode':0x180}),logger[_0x56c904(0xe3)](process[_0x56c904(0xdf)]()),logger['info'](_0x56c904(0xf0),_0x56c904(0x103),{'appcode':_0x45b86d,'env':_0x5964a7[_0x56c904(0xf1)],'version':_0x5964a7[_0x56c904(0xee)],'configPath':_0xe58eb8}),_0x1633e4(!![]),setTimeout(()=>process[_0x56c904(0xf7)](0x0),0x64);}catch(_0x2eea2f){logger[_0x56c904(0xe4)](_0x56c904(0xf0),_0x56c904(0x102),{'error':_0x2eea2f instanceof Error?_0x2eea2f['message']:String(_0x2eea2f)}),_0x49e1b9(_0x56c904(0xd7)+(_0x2eea2f instanceof Error?_0x2eea2f[_0x56c904(0xfd)]:String(_0x2eea2f))),setTimeout(()=>process[_0x56c904(0xf7)](0x1),0x64);}},[_0x45b86d,_0x1d947b,_0x20a8a0]);if(_0x257101)return a50_0x4a9b44(Box,{'flexDirection':_0x5c870d(0xda),'children':a50_0x592919(Text,{'color':_0x5c870d(0xeb),'children':['✗\x20',_0x257101]})});if(_0x1d947b)return a50_0x592919(Box,{'flexDirection':_0x5c870d(0xda),'children':[a50_0x592919(Box,{'children':[a50_0x4a9b44(Text,{'color':_0x5c870d(0x100),'children':_0x5c870d(0xe7)}),_0x135e99?a50_0x4a9b44(Text,{'color':_0x5c870d(0xde),'children':_0x135e99}):a50_0x4a9b44(Text,{'color':_0x5c870d(0xd6),'children':'_'}),_0x503653&&a50_0x592919(Text,{'color':_0x5c870d(0xeb),'children':[_0x5c870d(0xdc),_0x503653]})]}),!_0x503653&&!_0x135e99&&a50_0x4a9b44(Box,{'children':a50_0x4a9b44(Text,{'color':_0x5c870d(0xd6),'children':_0x5c870d(0xea)})})]});if(_0x59022e)return a50_0x592919(Box,{'flexDirection':_0x5c870d(0xda),'children':[a50_0x4a9b44(Text,{'color':_0x5c870d(0xde),'children':_0x5c870d(0xfe)}),a50_0x592919(Text,{'color':_0x5c870d(0x100),'children':[_0x5c870d(0xe0),_0x45b86d]}),a50_0x4a9b44(Text,{'children':_0x5c870d(0xdb)})]});return a50_0x4a9b44(Box,{'children':a50_0x4a9b44(Text,{'children':_0x5c870d(0xef)})});}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x459c6d,_0x195118){const _0xfbdaaf=a51_0x5db7,_0x342b6d=_0x459c6d();while(!![]){try{const _0x2e2468=parseInt(_0xfbdaaf(0x145))/0x1*(-parseInt(_0xfbdaaf(0x141))/0x2)+-parseInt(_0xfbdaaf(0x148))/0x3+parseInt(_0xfbdaaf(0x137))/0x4*(parseInt(_0xfbdaaf(0x134))/0x5)+parseInt(_0xfbdaaf(0x12e))/0x6*(-parseInt(_0xfbdaaf(0x140))/0x7)+parseInt(_0xfbdaaf(0x142))/0x8*(-parseInt(_0xfbdaaf(0x135))/0x9)+parseInt(_0xfbdaaf(0x13e))/0xa*(parseInt(_0xfbdaaf(0x13a))/0xb)+parseInt(_0xfbdaaf(0x147))/0xc*(parseInt(_0xfbdaaf(0x12f))/0xd);if(_0x2e2468===_0x195118)break;else _0x342b6d['push'](_0x342b6d['shift']());}catch(_0x226662){_0x342b6d['push'](_0x342b6d['shift']());}}}(a51_0x1142,0x2413b));function a51_0x5db7(_0xb8b484,_0x2ea1cb){_0xb8b484=_0xb8b484-0x12d;const _0x11425c=a51_0x1142();let _0x5db777=_0x11425c[_0xb8b484];return _0x5db777;}import{readConfig}from'../utils/config.js';function a51_0x1142(){const _0x1306d4=['1107012JZheie','2960893ArZjLw','appcode','\x20\x20-\x20AppCode:\x20','log','online','5QufIEe','9NGpqHL','exit','1004728YmfDzz','\x20\x20-\x20环境:\x20','生成\x20claude\x20MCP\x20配置命令','803FaJzsk','message','错误:\x20配置失败\x20-\x20','error','37180gXoIYl','claude\x20mcp\x20add\x20lovrabet-dataset\x20npx\x20@lovrabet/dataset-mcp-server@latest','7UfaHvY','140558GdxJqp','237192TaKxri','daily','错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置','2oZajzR','请在终端中执行以下命令来配置\x20claude\x20code\x20MCP:\x0a','12ZXNgaG','743631vwAzJC','未找到\x20appcode\x20配置','-e\x20LOVRABET_ENV=daily','配置信息:','info','配置完成后:\x0a','mcp-claude'];a51_0x1142=function(){return _0x1306d4;};return a51_0x1142();}import{logger}from'../utils/logger.js';export async function configureClaudeMcp(){const _0x416dfe=a51_0x5db7;try{const _0x39c265=readConfig(),_0x33bb87=_0x39c265[_0x416dfe(0x130)]||_0x39c265['app'],_0x26c9b9=_0x39c265['env']||_0x416dfe(0x133);!_0x33bb87&&(console['error'](_0x416dfe(0x144)),logger['error'](_0x416dfe(0x12d),_0x416dfe(0x149)),process['exit'](0x1));console[_0x416dfe(0x132)](_0x416dfe(0x14b)),console[_0x416dfe(0x132)](_0x416dfe(0x131)+_0x33bb87),console['log'](_0x416dfe(0x138)+_0x26c9b9+'\x0a');const _0xe14278=_0x416dfe(0x13f),_0x2e0373='-e\x20LOVRABET_APP_CODE='+_0x33bb87,_0x2a6e89=_0x26c9b9===_0x416dfe(0x143)?_0x416dfe(0x14a):'',_0x34e8e0=(_0xe14278+'\x20'+_0x2e0373+'\x20'+_0x2a6e89)['trim']();console[_0x416dfe(0x132)](_0x416dfe(0x146)),console['log']('\x20\x20'+_0x34e8e0+'\x0a'),console['log'](_0x416dfe(0x14d)),console[_0x416dfe(0x132)]('\x20\x201.\x20重启\x20claude\x20code'),console[_0x416dfe(0x132)]('\x20\x202.\x20在\x20claude\x20code\x20中确认\x20lovrabet-dataset\x20MCP\x20服务器已加载\x0a'),logger[_0x416dfe(0x14c)](_0x416dfe(0x12d),_0x416dfe(0x139),{'appcode':_0x33bb87,'env':_0x26c9b9}),process[_0x416dfe(0x136)](0x0);}catch(_0x1092a7){logger['error'](_0x416dfe(0x12d),'配置失败',{'error':_0x1092a7 instanceof Error?_0x1092a7[_0x416dfe(0x13b)]:String(_0x1092a7)}),console[_0x416dfe(0x13d)](_0x416dfe(0x13c)+(_0x1092a7 instanceof Error?_0x1092a7['message']:String(_0x1092a7))),process[_0x416dfe(0x136)](0x1);}}
|
package/lib/mcp/cursor.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2d921f,_0x43410b){const _0x4068dc=a52_0x3571,_0x26b710=_0x2d921f();while(!![]){try{const _0x537b85=-parseInt(_0x4068dc(0x97))/0x1*(-parseInt(_0x4068dc(0x7e))/0x2)+parseInt(_0x4068dc(0x81))/0x3*(parseInt(_0x4068dc(0xa1))/0x4)+-parseInt(_0x4068dc(0xa5))/0x5+-parseInt(_0x4068dc(0x9e))/0x6*(-parseInt(_0x4068dc(0x7f))/0x7)+-parseInt(_0x4068dc(0x8a))/0x8+parseInt(_0x4068dc(0x87))/0x9*(parseInt(_0x4068dc(0xa4))/0xa)+parseInt(_0x4068dc(0x7b))/0xb*(-parseInt(_0x4068dc(0x90))/0xc);if(_0x537b85===_0x43410b)break;else _0x26b710['push'](_0x26b710['shift']());}catch(_0x49bd9f){_0x26b710['push'](_0x26b710['shift']());}}}(a52_0x2641,0x4a8a0));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';function a52_0x2641(){const _0x54b14d=['lovrabet_rules.mdc','✓\x20更新\x20mcp.json\x20配置','9ZqxaIT','rules','appcode','592928dfJLpm','\x0a✓\x20Cursor\x20MCP\x20配置成功!','!\x20Cursor\x20Rules\x20文件已存在,跳过创建,如需重新创建,请删除\x20.cursor/rules/lovrabet_rules.mdc\x20文件','Cursor\x20Rules\x20模板文件不存在','exit','更新现有\x20mcp.json\x20配置','30684OfKTGL','复制\x20Cursor\x20Rules\x20文件','错误:\x20配置失败:\x20','请重启\x20Cursor\x20以加载新的\x20MCP\x20配置。','utf8','\x0a配置信息:','解析现有\x20mcp.json\x20失败','142271XqVCRW','\x20\x20-\x20环境:\x20','创建新的\x20mcp.json\x20配置','cwd','✓\x20创建\x20.cursor\x20目录:\x20','stringify','app','50574GysWCe','未找到\x20appcode\x20配置','警告:\x20复制\x20Cursor\x20Rules\x20文件失败:\x20','4KeWLrn','online','warn','1110300NlpwPl','920550bhXEzD','parse','✓\x20创建\x20mcp.json\x20配置文件','error','log','message','info','复制\x20Cursor\x20Rules\x20文件失败','mcp-cursor','创建\x20.cursor/rules\x20目录','创建\x20.cursor\x20目录','Cursor\x20Rules\x20文件已存在,跳过','配置\x20Cursor\x20MCP\x20成功','2123PQaZTc','✓\x20创建\x20Cursor\x20Rules\x20文件:\x20.cursor/rules/lovrabet_rules.mdc','\x0a现在您可以在\x20Cursor\x20中使用\x20Lovrabet\x20数据集\x20MCP\x20工具了。','4aeLdux','476EjfUbJ','.cursor','264885kQzcvf','错误:\x20解析现有\x20mcp.json\x20失败:\x20','mcp.json','\x20\x20-\x20配置文件:\x20'];a52_0x2641=function(){return _0x54b14d;};return a52_0x2641();}import{resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a52_0x3571(_0x5a5397,_0x16de00){_0x5a5397=_0x5a5397-0x7a;const _0x2641d5=a52_0x2641();let _0x357173=_0x2641d5[_0x5a5397];return _0x357173;}import{logger}from'../utils/logger.js';export async function configureCursorMcp(){const _0x3501a2=a52_0x3571;try{const _0x35dfc5=process[_0x3501a2(0x9a)](),_0x52ba1e=resolve(_0x35dfc5,_0x3501a2(0x80)),_0x265e68=resolve(_0x52ba1e,_0x3501a2(0x83)),_0x464a92=readConfig(),_0x5daa91=_0x464a92[_0x3501a2(0x89)]||_0x464a92[_0x3501a2(0x9d)],_0x4383ce=_0x464a92['env']||_0x3501a2(0xa2);!_0x5daa91&&(console[_0x3501a2(0xa8)]('错误:\x20未找到\x20appcode\x20配置,请先运行\x20\x27lovrabet\x20init\x27\x20初始化项目配置'),logger['error'](_0x3501a2(0xad),_0x3501a2(0x9f)),process[_0x3501a2(0x8e)](0x1));!existsSync(_0x52ba1e)&&(mkdirSync(_0x52ba1e,{'recursive':!![]}),logger[_0x3501a2(0xab)](_0x3501a2(0xad),_0x3501a2(0xaf),{'path':_0x52ba1e}),console[_0x3501a2(0xa9)](_0x3501a2(0x9b)+_0x52ba1e));const _0x5c0ab2={'command':'npx','args':['-y','@lovrabet/dataset-mcp-server'],'env':{'LOVRABET_APP_CODE':String(_0x5daa91),'LOVRABET_ENV':String(_0x4383ce)}};let _0x1a4f37;if(existsSync(_0x265e68))try{const _0x72ad08=readFileSync(_0x265e68,_0x3501a2(0x94));_0x1a4f37=JSON[_0x3501a2(0xa6)](_0x72ad08),!_0x1a4f37['mcpServers']&&(_0x1a4f37['mcpServers']={}),_0x1a4f37['mcpServers']['lovrabet-dataset']=_0x5c0ab2,logger[_0x3501a2(0xab)]('mcp-cursor',_0x3501a2(0x8f),{'path':_0x265e68,'appcode':_0x5daa91,'env':_0x4383ce}),console[_0x3501a2(0xa9)](_0x3501a2(0x86));}catch(_0x4c5e4c){logger[_0x3501a2(0xa8)]('mcp-cursor',_0x3501a2(0x96),{'error':_0x4c5e4c instanceof Error?_0x4c5e4c['message']:String(_0x4c5e4c)}),console[_0x3501a2(0xa8)](_0x3501a2(0x82)+(_0x4c5e4c instanceof Error?_0x4c5e4c[_0x3501a2(0xaa)]:String(_0x4c5e4c))),process[_0x3501a2(0x8e)](0x1);}else _0x1a4f37={'mcpServers':{'lovrabet-dataset':_0x5c0ab2}},logger['info']('mcp-cursor',_0x3501a2(0x99),{'path':_0x265e68,'appcode':_0x5daa91,'env':_0x4383ce}),console[_0x3501a2(0xa9)](_0x3501a2(0xa7));writeFileSync(_0x265e68,JSON[_0x3501a2(0x9c)](_0x1a4f37,null,0x2),{'encoding':_0x3501a2(0x94)});const _0x51797e=resolve(_0x52ba1e,_0x3501a2(0x88)),_0x56417c=resolve(_0x51797e,_0x3501a2(0x85));if(!existsSync(_0x56417c))try{!existsSync(_0x51797e)&&(mkdirSync(_0x51797e,{'recursive':!![]}),logger[_0x3501a2(0xab)]('mcp-cursor',_0x3501a2(0xae),{'path':_0x51797e}));const _0x31c0d3=fileURLToPath(import.meta.url),_0x42c6cb=dirname(_0x31c0d3),_0x3c44b6=resolve(_0x42c6cb,'../../templates/rules/lovrabet_rules.mdc.tpl');existsSync(_0x3c44b6)?(copyFileSync(_0x3c44b6,_0x56417c),logger[_0x3501a2(0xab)](_0x3501a2(0xad),_0x3501a2(0x91),{'from':_0x3c44b6,'to':_0x56417c}),console[_0x3501a2(0xa9)](_0x3501a2(0x7c))):logger[_0x3501a2(0xa3)](_0x3501a2(0xad),_0x3501a2(0x8d),{'templatePath':_0x3c44b6});}catch(_0x3c7ddf){logger[_0x3501a2(0xa8)](_0x3501a2(0xad),_0x3501a2(0xac),{'error':_0x3c7ddf instanceof Error?_0x3c7ddf[_0x3501a2(0xaa)]:String(_0x3c7ddf)}),console[_0x3501a2(0xa3)](_0x3501a2(0xa0)+(_0x3c7ddf instanceof Error?_0x3c7ddf[_0x3501a2(0xaa)]:String(_0x3c7ddf)));}else console[_0x3501a2(0xa9)](_0x3501a2(0x8c)),logger[_0x3501a2(0xab)]('mcp-cursor',_0x3501a2(0xb0),{'path':_0x56417c});console[_0x3501a2(0xa9)](_0x3501a2(0x8b)),console[_0x3501a2(0xa9)](_0x3501a2(0x95)),console[_0x3501a2(0xa9)]('\x20\x20-\x20AppCode:\x20'+_0x5daa91),console[_0x3501a2(0xa9)](_0x3501a2(0x98)+_0x4383ce),console[_0x3501a2(0xa9)](_0x3501a2(0x84)+_0x265e68),console['log'](_0x3501a2(0x7d)),console[_0x3501a2(0xa9)](_0x3501a2(0x93)),logger[_0x3501a2(0xab)]('mcp-cursor',_0x3501a2(0x7a),{'appcode':_0x5daa91,'env':_0x4383ce,'configPath':_0x265e68}),process[_0x3501a2(0x8e)](0x0);}catch(_0x16a135){logger[_0x3501a2(0xa8)](_0x3501a2(0xad),'配置\x20Cursor\x20MCP\x20失败',{'error':_0x16a135 instanceof Error?_0x16a135[_0x3501a2(0xaa)]:String(_0x16a135)}),console[_0x3501a2(0xa8)](_0x3501a2(0x92)+(_0x16a135 instanceof Error?_0x16a135[_0x3501a2(0xaa)]:String(_0x16a135))),process[_0x3501a2(0x8e)](0x1);}}
|
package/lib/mcp/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a53_0xfebb(_0x8fa39c,_0x504b2d){_0x8fa39c=_0x8fa39c-0x10b;const _0x58204d=a53_0x5820();let _0xfebbb2=_0x58204d[_0x8fa39c];return _0xfebbb2;}const a53_0x37d05b=a53_0xfebb;(function(_0x42230e,_0x2ff8ef){const _0x4550f3=a53_0xfebb,_0x61a6ef=_0x42230e();while(!![]){try{const _0x5de5fd=parseInt(_0x4550f3(0x112))/0x1*(parseInt(_0x4550f3(0x132))/0x2)+parseInt(_0x4550f3(0x11f))/0x3+parseInt(_0x4550f3(0x133))/0x4+parseInt(_0x4550f3(0x11b))/0x5*(-parseInt(_0x4550f3(0x126))/0x6)+parseInt(_0x4550f3(0x10d))/0x7*(parseInt(_0x4550f3(0x131))/0x8)+parseInt(_0x4550f3(0x10e))/0x9*(-parseInt(_0x4550f3(0x122))/0xa)+parseInt(_0x4550f3(0x12d))/0xb*(-parseInt(_0x4550f3(0x115))/0xc);if(_0x5de5fd===_0x2ff8ef)break;else _0x61a6ef['push'](_0x61a6ef['shift']());}catch(_0x17c8c6){_0x61a6ef['push'](_0x61a6ef['shift']());}}}(a53_0x5820,0x1a9e3));import{configureCursorMcp}from'./cursor.js';import{configureClaudeMcp}from'./claude.js';import{logger}from'../utils/logger.js';const IDE_CONFIGS={'cursor':{'name':a53_0x37d05b(0x12f),'description':'Cursor\x20IDE'},'claude':{'name':'claude\x20code','description':a53_0x37d05b(0x10f)}};function a53_0x5820(){const _0x8f15f=['cursor','1OtcDjE','(空)','\x0a可用命令:','9156sQgytR','install','log','\x0a📦\x20正在配置\x20','claude','\x20\x20lovrabet\x20mcp\x20install\x20<ide>\x20\x20\x20\x20#\x20安装\x20MCP\x20配置','5jfjWwz','mcp-install','name','\x0a支持的平台:\x20cursor,\x20claude\x0a','594360muYkzK','help','错误:\x20不支持的平台:\x20','20YNumpM','message','\x0a请指定要配置的平台:\x0a','error','544218AFMGlD','\x20\x20cursor\x20\x20\x20-\x20Cursor\x20IDE','错误:\x20不支持的命令:\x20','setLogPath','不支持的命令:\x20','exit','支持的平台:','4565Aalrii','cwd','Cursor','--help','40248asNpMz','93038GCmARR','627244IZmgFz','\x0aLovrabet\x20MCP\x20-\x20MCP\x20服务器配置工具\x0a\x0a用法:\x0a\x20\x20lovrabet\x20mcp\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示帮助信息\x0a\x0a安装\x20MCP\x20配置:\x0a\x20\x20lovrabet\x20mcp\x20install\x20<ide>\x20\x20\x20\x20\x20\x20\x20安装\x20MCP\x20配置到\x20IDE\x0a\x0a支持的平台:\x0a\x20\x20cursor\x20\x20\x20-\x20Cursor\x20IDE\x0a\x20\x20\x20\x20└──\x20自动配置\x20.cursor/mcp.json\x0a\x0a\x20\x20claude\x20\x20\x20-\x20claude\x20code\x0a\x20\x20\x20\x20└──\x20输出手动配置命令(需手动执行)\x0a\x0a示例:\x0a\x20\x20lovrabet\x20mcp\x20install\x20cursor\x20\x20\x20\x20\x20\x20\x20#\x20配置\x20Cursor\x20的\x20MCP\x0a\x20\x20lovrabet\x20mcp\x20install\x20claude\x20\x20\x20\x20\x20\x20\x20#\x20输出\x20claude\x20code\x20的\x20MCP\x20配置命令\x0a\x0a配置后:\x0a\x20\x20-\x20Cursor:\x20重启\x20IDE\x20即可使用\x0a\x20\x20-\x20claude\x20code:\x20手动执行输出的命令\x0a','toLowerCase','273oyHGms','365778EhsJMn','claude\x20code','\x20\x20lovrabet\x20mcp\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20显示帮助信息\x0a'];a53_0x5820=function(){return _0x8f15f;};return a53_0x5820();}export async function mcpCommand(_0x45cb87,_0x1e2cac,_0x5d2c09){const _0xe9b0d8=a53_0x37d05b;logger[_0xe9b0d8(0x129)](process[_0xe9b0d8(0x12e)]());if(_0x5d2c09?.[_0xe9b0d8(0x120)]||_0x45cb87===_0xe9b0d8(0x130)){showHelp();return;}_0x45cb87!==_0xe9b0d8(0x116)&&(console[_0xe9b0d8(0x125)](_0xe9b0d8(0x128)+(_0x45cb87||_0xe9b0d8(0x113))),console[_0xe9b0d8(0x117)](_0xe9b0d8(0x114)),console[_0xe9b0d8(0x117)](_0xe9b0d8(0x11a)),console[_0xe9b0d8(0x117)](_0xe9b0d8(0x110)),console[_0xe9b0d8(0x117)](_0xe9b0d8(0x12c)),console[_0xe9b0d8(0x117)](_0xe9b0d8(0x127)),console[_0xe9b0d8(0x117)]('\x20\x20claude\x20\x20\x20-\x20claude\x20code\x0a'),logger[_0xe9b0d8(0x125)]('mcp',_0xe9b0d8(0x12a)+_0x45cb87),process[_0xe9b0d8(0x12b)](0x1)),await installMcp(_0x1e2cac?.[0x0]);}function showHelp(){const _0x239db9=a53_0x37d05b;console[_0x239db9(0x117)](_0x239db9(0x10b));}async function installMcp(_0x28f28){const _0x457751=a53_0x37d05b;!_0x28f28&&(console[_0x457751(0x117)](_0x457751(0x124)),console[_0x457751(0x117)]('\x20\x20lovrabet\x20mcp\x20install\x20cursor\x20\x20\x20\x20#\x20Cursor\x20IDE'),console[_0x457751(0x117)]('\x20\x20lovrabet\x20mcp\x20install\x20claude\x20\x20\x20\x20#\x20claude\x20code\x0a'),process[_0x457751(0x12b)](0x1));const _0x510ded=_0x28f28[_0x457751(0x10c)]();!IDE_CONFIGS[_0x510ded]&&(console[_0x457751(0x125)](_0x457751(0x121)+_0x28f28),console[_0x457751(0x117)](_0x457751(0x11e)),process[_0x457751(0x12b)](0x1));try{console[_0x457751(0x117)](_0x457751(0x118)+IDE_CONFIGS[_0x510ded][_0x457751(0x11d)]+'\x20MCP...\x0a');switch(_0x510ded){case _0x457751(0x111):await configureCursorMcp();break;case _0x457751(0x119):await configureClaudeMcp();break;}}catch(_0x40690d){logger[_0x457751(0x125)](_0x457751(0x11c),'配置失败',{'error':_0x40690d instanceof Error?_0x40690d[_0x457751(0x123)]:String(_0x40690d)}),console[_0x457751(0x125)]('\x0a错误:\x20配置失败\x20-\x20'+(_0x40690d instanceof Error?_0x40690d[_0x457751(0x123)]:String(_0x40690d))+'\x0a'),process[_0x457751(0x12b)](0x1);}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a54_0x201853=a54_0x1fe4;(function(_0xec7c9,_0x55f6c8){const _0x4061a0=a54_0x1fe4,_0x52fa14=_0xec7c9();while(!![]){try{const _0x97296e=parseInt(_0x4061a0(0xb6))/0x1*(-parseInt(_0x4061a0(0xb7))/0x2)+-parseInt(_0x4061a0(0xa8))/0x3+parseInt(_0x4061a0(0xb8))/0x4*(-parseInt(_0x4061a0(0xc5))/0x5)+-parseInt(_0x4061a0(0xb5))/0x6+parseInt(_0x4061a0(0xba))/0x7+parseInt(_0x4061a0(0xa4))/0x8+parseInt(_0x4061a0(0xc8))/0x9*(parseInt(_0x4061a0(0xb3))/0xa);if(_0x97296e===_0x55f6c8)break;else _0x52fa14['push'](_0x52fa14['shift']());}catch(_0x10b02a){_0x52fa14['push'](_0x52fa14['shift']());}}}(a54_0xd5d9,0xcc60a));import{existsSync,mkdirSync,writeFileSync,copyFileSync,readdirSync,statSync}from'node:fs';import{resolve,dirname,join}from'node:path';import{fileURLToPath}from'node:url';import{logger}from'../utils/logger.js';function a54_0xd5d9(){const _0x1a9a00=['cursor','.lovrabet/skill-manifest.json','\x0a可用命令:','exit','claude\x20code\x20(.claude/skills/)','支持的平台:','\x0a请指定要安装的平台:\x0a','Cursor','开发者指南位置:','install','isDirectory','不支持的命令:\x20','\x20\x20claude\x20\x20\x20-\x20claude\x20code\x0a','(空)','安装成功','13291120btHmOg','\x20\x20lovrabet\x20skill\x20install\x20<ide>\x20\x20\x20\x20#\x20安装技能包到项目','.claude','错误:\x20不支持的平台:\x20','4391685XowHmD','\x20\x20lovrabet\x20skill\x20install\x20cursor\x20\x20\x20#\x20Cursor\x20IDE','\x0a📦\x20正在安装\x20Lovrabet\x20技能包...\x0a','目标平台:\x20','message','\x20\x20-\x20.lovrabet/skill/.shared/guides/\x20-\x20详细开发指南\x0a','Cursor\x20IDE\x20(.cursorrules\x20+\x20.cursor/commands/)','info','.lovrabet','.cursorrules','2.0.0','10CANneu','.cursor','5490162XDdvTm','8BQFOtf','51566sLWrxi','1900STdkhh','\x20\x20lovrabet\x20skill\x20install\x20windsurf\x20#\x20Windsurf\x20IDE','805714aQLNKO','\x20\x20-\x20.windsurf/workflows/lovrabet.md\x20文件已安装\x0a','.shared','skill-install','claude','\x20\x20cursor\x20\x20\x20-\x20Cursor\x20IDE','folders','cwd','log','help','\x20\x20windsurf\x20-\x20Windsurf\x20IDE','7415mnpOOO','name','setLogPath','21152241SmZAyu','warn','.lovrabet/skill/.shared','\x20\x20-\x20.cursorrules\x20文件已创建,Cursor\x20会自动读取','windsurf','claude\x20code','Windsurf\x20使用说明:','\x0aLovrabet\x20Skill\x20-\x20开发者技能包安装工具\x0a\x0a用法:\x0a\x20\x20lovrabet\x20skill\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示帮助信息\x0a\x0a安装技能包:\x0a\x20\x20lovrabet\x20skill\x20install\x20<ide>\x20\x20\x20\x20\x20安装技能包到项目\x0a\x0a支持的平台:\x0a\x20\x20cursor\x20\x20\x20-\x20Cursor\x20IDE\x0a\x20\x20\x20\x20└──\x20安装\x20.cursorrules\x20和\x20.cursor/commands/\x0a\x0a\x20\x20windsurf\x20-\x20Windsurf\x20IDE\x0a\x20\x20\x20\x20└──\x20安装\x20.windsurf/workflows/\x0a\x0a\x20\x20claude\x20\x20\x20-\x20claude\x20code\x0a\x20\x20\x20\x20└──\x20安装\x20.claude/skills/\x0a\x0a技能包内容包括:\x0a\x20\x20-\x20Filter\x20查询构建规范\x20(10\x20种常见错误对照)\x0a\x20\x20-\x20MCP\x20SQL\x20创建工作流\x20(5\x20步强制流程)\x0a\x20\x20-\x20AntD\x20UI\x20开发规范\x20(禁止\x20AI\x20味道)\x0a\x20\x20-\x20API\x20集成指南\x20(lovrabet\x20api\x20pull\x20流程)\x0a\x20\x20-\x20菜单管理指南\x20(menu\x20sync/update\x20流程)\x0a\x0a示例:\x0a\x20\x20lovrabet\x20skill\x20install\x20cursor\x20\x20\x20#\x20安装\x20Cursor\x20规则\x0a\x20\x20lovrabet\x20skill\x20install\x20windsurf\x20#\x20安装\x20Windsurf\x20规则\x0a\x20\x20lovrabet\x20skill\x20install\x20claude\x20\x20\x20#\x20安装\x20claude\x20code\x20规则\x0a\x0a安装后会在项目中创建:\x0a\x20\x20-\x20.cursorrules\x20或\x20.windsurf/workflows/\x20或\x20.claude/skills/\x0a\x20\x20-\x20.lovrabet/skill/.shared/guides/\x20\x20-\x20开发者技能指南\x0a\x0a开发者指南位置:\x0a\x20\x20.lovrabet/skill/.shared/guides/01-filter-query/guide.md\x0a\x20\x20.lovrabet/skill/.shared/guides/02-mcp-sql-workflow/guide.md\x0a\x20\x20.lovrabet/skill/.shared/guides/03-antd-style/guide.md\x0a\x20\x20.lovrabet/skill/.shared/guides/05-api-integration/guide.md\x0a\x20\x20.lovrabet/skill/.shared/guides/06-menu-management/guide.md\x0a\x20\x20','\x0a错误:\x20安装失败\x20-\x20','\x0a✓\x20技能包安装成功!\x0a','../../templates/skills','error','utf-8','✓\x20复制\x20','\x20\x20lovrabet\x20skill\x20install\x20claude\x20\x20\x20#\x20claude\x20code\x0a','✓\x20复制\x20.lovrabet/skill/.shared/'];a54_0xd5d9=function(){return _0x1a9a00;};return a54_0xd5d9();}const __dirname=dirname(fileURLToPath(import.meta.url)),IDE_CONFIGS={'cursor':{'name':a54_0x201853(0x9c),'description':a54_0x201853(0xae),'folders':[a54_0x201853(0xb1),a54_0x201853(0xb4)]},'windsurf':{'name':'Windsurf','description':'Windsurf\x20IDE\x20(.windsurf/workflows/)','folders':['.windsurf']},'claude':{'name':a54_0x201853(0x8a),'description':a54_0x201853(0x99),'folders':[a54_0x201853(0xa6)]}};export async function skillsCommand(_0x284b4f,_0x531be3,_0x3b5a88){const _0x5c05f9=a54_0x201853;logger[_0x5c05f9(0xc7)](process[_0x5c05f9(0xc1)]());if(_0x3b5a88?.[_0x5c05f9(0xc3)]||_0x284b4f==='--help'){showHelp();return;}_0x284b4f!==_0x5c05f9(0x9e)&&(console[_0x5c05f9(0x90)]('错误:\x20不支持的命令:\x20'+(_0x284b4f||_0x5c05f9(0xa2))),console[_0x5c05f9(0xc2)](_0x5c05f9(0x97)),console['log'](_0x5c05f9(0xa5)),console[_0x5c05f9(0xc2)]('\x20\x20lovrabet\x20skill\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20显示帮助信息\x0a'),console['log'](_0x5c05f9(0x9a)),console[_0x5c05f9(0xc2)](_0x5c05f9(0xbf)),console[_0x5c05f9(0xc2)](_0x5c05f9(0xc4)),console[_0x5c05f9(0xc2)](_0x5c05f9(0xa1)),logger['error']('skill',_0x5c05f9(0xa0)+_0x284b4f),process['exit'](0x1)),await installSkill(_0x531be3?.[0x0]);}function a54_0x1fe4(_0x26f65b,_0x4ecfee){_0x26f65b=_0x26f65b-0x86;const _0xd5d9ee=a54_0xd5d9();let _0x1fe42c=_0xd5d9ee[_0x26f65b];return _0x1fe42c;}function showHelp(){const _0x252f99=a54_0x201853;console[_0x252f99(0xc2)](_0x252f99(0x8c));}async function copyDir(_0x54db74,_0x2d146c){const _0x4443cd=a54_0x201853,_0x1263d4=statSync(_0x54db74);if(_0x1263d4[_0x4443cd(0x9f)]()){!existsSync(_0x2d146c)&&mkdirSync(_0x2d146c,{'recursive':!![]});const _0x285a36=readdirSync(_0x54db74);for(const _0x5093fc of _0x285a36){await copyDir(join(_0x54db74,_0x5093fc),join(_0x2d146c,_0x5093fc));}}else copyFileSync(_0x54db74,_0x2d146c);}async function installSkill(_0x7262fc){const _0x160468=a54_0x201853,_0x15ba86=process[_0x160468(0xc1)]();!_0x7262fc&&(console[_0x160468(0xc2)](_0x160468(0x9b)),console['log'](_0x160468(0xa9)),console[_0x160468(0xc2)](_0x160468(0xb9)),console['log'](_0x160468(0x93)),process[_0x160468(0x98)](0x1));!IDE_CONFIGS[_0x7262fc]&&(console[_0x160468(0x90)](_0x160468(0xa7)+_0x7262fc),console['log']('\x0a支持的平台:\x20cursor,\x20windsurf,\x20claude\x0a'),process[_0x160468(0x98)](0x1));try{console[_0x160468(0xc2)](_0x160468(0xaa)),console['log'](_0x160468(0xab)+IDE_CONFIGS[_0x7262fc][_0x160468(0xc6)]+'\x0a');const _0x107453=resolve(__dirname,_0x160468(0x8f));let _0x10c2dc=0x0;for(const _0x2d583b of IDE_CONFIGS[_0x7262fc][_0x160468(0xc0)]){const _0x5a00cc=join(_0x107453,_0x2d583b),_0x1f2d14=join(_0x15ba86,_0x2d583b);if(!existsSync(_0x5a00cc)){logger[_0x160468(0x86)](_0x160468(0xbd),'模板不存在:\x20'+_0x5a00cc);continue;}await copyDir(_0x5a00cc,_0x1f2d14),_0x10c2dc++,console[_0x160468(0xc2)](_0x160468(0x92)+_0x2d583b+'/');}const _0x55502f=join(_0x107453,_0x160468(0xbc)),_0x400ff6=join(_0x15ba86,_0x160468(0x87));existsSync(_0x55502f)&&(await copyDir(_0x55502f,_0x400ff6),_0x10c2dc++,console[_0x160468(0xc2)](_0x160468(0x94)));const _0x27efaa={'version':_0x160468(0xb2),'installedAt':new Date()['toISOString'](),'platform':_0x7262fc},_0xe26693=join(_0x15ba86,_0x160468(0x96));!existsSync(join(_0x15ba86,_0x160468(0xb0)))&&mkdirSync(join(_0x15ba86,_0x160468(0xb0)),{'recursive':!![]});writeFileSync(_0xe26693,JSON['stringify'](_0x27efaa,null,0x2),_0x160468(0x91)),console['log']('✓\x20创建\x20.lovrabet/skill-manifest.json'),console['log'](_0x160468(0x8e));switch(_0x7262fc){case _0x160468(0x95):console[_0x160468(0xc2)]('Cursor\x20使用说明:'),console[_0x160468(0xc2)](_0x160468(0x88)),console[_0x160468(0xc2)]('\x20\x20-\x20.cursor/commands/lovrabet.md\x20也已安装,可通过\x20@lovrabet\x20直接调用\x0a'),console['log'](_0x160468(0x9d)),console[_0x160468(0xc2)](_0x160468(0xad));break;case _0x160468(0x89):console[_0x160468(0xc2)](_0x160468(0x8b)),console[_0x160468(0xc2)](_0x160468(0xbb)),console[_0x160468(0xc2)]('开发者指南位置:'),console[_0x160468(0xc2)]('\x20\x20-\x20.lovrabet/skill/.shared/guides/\x20-\x20详细开发指南\x0a');break;case _0x160468(0xbe):console['log']('claude\x20code\x20使用说明:'),console['log']('\x20\x20-\x20.claude/skills/lovrabet/SKILL.md\x20文件已安装'),console[_0x160468(0xc2)]('\x20\x20-\x20在\x20claude\x20code\x20设置中添加此技能,即可使用\x0a'),console[_0x160468(0xc2)](_0x160468(0x9d)),console[_0x160468(0xc2)](_0x160468(0xad));break;}logger[_0x160468(0xaf)](_0x160468(0xbd),_0x160468(0xa3),{'projectRoot':_0x15ba86,'ide':_0x7262fc,'foldersCount':_0x10c2dc});}catch(_0x3f0182){logger[_0x160468(0x90)](_0x160468(0xbd),'安装失败',{'error':_0x3f0182 instanceof Error?_0x3f0182[_0x160468(0xac)]:String(_0x3f0182)}),console[_0x160468(0x90)](_0x160468(0x8d)+(_0x3f0182 instanceof Error?_0x3f0182[_0x160468(0xac)]:String(_0x3f0182))+'\x0a'),process['exit'](0x1);}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a56_0x428672=a56_0x2401;(function(_0x4ac2ae,_0x5cd08d){const _0x2040a3=a56_0x2401,_0x369bf8=_0x4ac2ae();while(!![]){try{const _0x53bf19=-parseInt(_0x2040a3(0x14e))/0x1*(parseInt(_0x2040a3(0x154))/0x2)+-parseInt(_0x2040a3(0x160))/0x3+parseInt(_0x2040a3(0x14c))/0x4*(-parseInt(_0x2040a3(0x15f))/0x5)+-parseInt(_0x2040a3(0x155))/0x6+parseInt(_0x2040a3(0x164))/0x7*(-parseInt(_0x2040a3(0x15c))/0x8)+-parseInt(_0x2040a3(0x161))/0x9*(-parseInt(_0x2040a3(0x151))/0xa)+-parseInt(_0x2040a3(0x15e))/0xb*(-parseInt(_0x2040a3(0x150))/0xc);if(_0x53bf19===_0x5cd08d)break;else _0x369bf8['push'](_0x369bf8['shift']());}catch(_0x532f97){_0x369bf8['push'](_0x369bf8['shift']());}}}(a56_0x2043,0x9c444));import a56_0xb09cb6 from'node:fs';import a56_0x1e45d7 from'node:path';function a56_0x2401(_0x595e90,_0x362a26){_0x595e90=_0x595e90-0x14c;const _0x2043e7=a56_0x2043();let _0x2401ce=_0x2043e7[_0x595e90];return _0x2401ce;}import a56_0x11fc07 from'semver';const MIN_SDK_VERSION=a56_0x428672(0x163);export function checkSdkVersion(_0x5a5c75){const _0x4ad59c=a56_0x428672,_0x1deff4=a56_0x1e45d7['join'](_0x5a5c75,_0x4ad59c(0x158));if(!a56_0xb09cb6[_0x4ad59c(0x165)](_0x1deff4))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};try{const _0x13e2ff=JSON['parse'](a56_0xb09cb6['readFileSync'](_0x1deff4,_0x4ad59c(0x168))),_0x50059f=_0x13e2ff[_0x4ad59c(0x14f)]||{},_0xb9daf3=_0x13e2ff[_0x4ad59c(0x159)]||{},_0x5329ed=_0x50059f[_0x4ad59c(0x167)]||_0xb9daf3['@lovrabet/sdk'];if(!_0x5329ed)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};const _0x1a8aab=a56_0x11fc07[_0x4ad59c(0x157)](_0x5329ed),_0x5c11d0=_0x1a8aab?a56_0x11fc07['lt'](_0x1a8aab,MIN_SDK_VERSION):![];return{'installed':!![],'version':_0x5329ed,'needsUpgrade':_0x5c11d0,'minVersion':MIN_SDK_VERSION};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':MIN_SDK_VERSION};}}export function printSdkUpgradeWarning(_0x4c4039){const _0x1ff53a=a56_0x428672;if(!_0x4c4039[_0x1ff53a(0x15a)])return;const _0x4b0c51=_0x1ff53a(0x153),_0x15d97e=_0x1ff53a(0x15d),_0x187538='\x1b[1m';console[_0x1ff53a(0x14d)](),console[_0x1ff53a(0x14d)](''+_0x4b0c51+_0x187538+_0x1ff53a(0x15b)+_0x15d97e),console[_0x1ff53a(0x14d)](_0x4b0c51+_0x1ff53a(0x152)+_0x4c4039[_0x1ff53a(0x156)]+_0x1ff53a(0x162)+_0x15d97e),console['log'](_0x4b0c51+'\x20\x20\x20请升级\x20SDK\x20至\x20'+_0x4c4039['minVersion']+_0x1ff53a(0x166)+_0x15d97e),console['log'](_0x4b0c51+'\x20\x20\x20npm\x20install\x20@lovrabet/sdk@latest'+_0x15d97e),console[_0x1ff53a(0x14d)](_0x4b0c51+'\x20\x20\x20查看最新版本:\x20https://www.npmjs.com/package/@lovrabet/sdk'+_0x15d97e),console['log']();}function a56_0x2043(){const _0x53a9b0=['3560343qunvTU','63TDRaiw','\x20不支持新协议。','1.2.0','4530561GOjogj','existsSync','\x20或更高版本:','@lovrabet/sdk','utf8','1863012tdcLGE','log','37613NDPUGe','dependencies','60WpkBbH','606070eWuyTt','\x20\x20\x20当前\x20CLI\x20版本已升级模型注册协议,但检测到您的\x20@lovrabet/sdk\x20版本\x20','\x1b[33m','58PlYfgW','2265714jpVRLs','version','coerce','package.json','devDependencies','needsUpgrade','⚠️\x20\x20SDK\x20版本不兼容','8kLYfXS','\x1b[0m','9789395uSazsU','10XtkbrY'];a56_0x2043=function(){return _0x53a9b0;};return a56_0x2043();}
|
package/lib/utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a57_0x4944d9=a57_0x3c4b;(function(_0x32e554,_0xa9da7b){const _0x553c81=a57_0x3c4b,_0x48eaeb=_0x32e554();while(!![]){try{const _0x4fc27b=parseInt(_0x553c81(0x97))/0x1+parseInt(_0x553c81(0xa0))/0x2+parseInt(_0x553c81(0x93))/0x3*(parseInt(_0x553c81(0x9f))/0x4)+parseInt(_0x553c81(0x9e))/0x5*(-parseInt(_0x553c81(0x94))/0x6)+-parseInt(_0x553c81(0xa1))/0x7*(-parseInt(_0x553c81(0x9d))/0x8)+parseInt(_0x553c81(0x9c))/0x9+parseInt(_0x553c81(0x96))/0xa*(-parseInt(_0x553c81(0x95))/0xb);if(_0x4fc27b===_0xa9da7b)break;else _0x48eaeb['push'](_0x48eaeb['shift']());}catch(_0x647703){_0x48eaeb['push'](_0x48eaeb['shift']());}}}(a57_0x29f3,0x77e95));import{existsSync,readFileSync}from'node:fs';import{resolve}from'node:path';import{homedir}from'node:os';export const projectConfigPath=resolve(process[a57_0x4944d9(0x98)](),'.lovrabetrc');function a57_0x3c4b(_0xd70231,_0x306fad){_0xd70231=_0xd70231-0x92;const _0x29f33a=a57_0x29f3();let _0x3c4bcb=_0x29f33a[_0xd70231];return _0x3c4bcb;}export const globalConfigPath=resolve(homedir(),a57_0x4944d9(0x9b));export function readConfig(){const _0x537d0d=a57_0x4944d9;let _0x62af4b={};try{if(existsSync(globalConfigPath)){const _0x36a466=readFileSync(globalConfigPath,{'encoding':'utf8'});_0x36a466&&(_0x62af4b=JSON[_0x537d0d(0x9a)](_0x36a466));}}catch(_0x37706e){}try{if(existsSync(projectConfigPath)){const _0x2abfea=readFileSync(projectConfigPath,{'encoding':'utf8'});if(_0x2abfea){const _0x253020=JSON[_0x537d0d(0x9a)](_0x2abfea);_0x62af4b={..._0x62af4b,..._0x253020};}}}catch(_0x5e3c4c){}return _0x62af4b;}export function getConfigAppCode(){const _0x3e0c90=a57_0x4944d9;let _0x489d8e={},_0x59f8d3={};try{if(existsSync(globalConfigPath)){const _0x33ca25=readFileSync(globalConfigPath,{'encoding':_0x3e0c90(0xa3)});_0x33ca25&&(_0x59f8d3=JSON[_0x3e0c90(0x9a)](_0x33ca25));}}catch(_0x1638c9){}try{if(existsSync(projectConfigPath)){const _0x4ab502=readFileSync(projectConfigPath,{'encoding':'utf8'});_0x4ab502&&(_0x489d8e=JSON[_0x3e0c90(0x9a)](_0x4ab502));}}catch(_0x1ee0b4){}let _0x4c80e2;if(_0x3e0c90(0xa2)in _0x489d8e)_0x4c80e2=_0x489d8e['appcode'];else{if(_0x3e0c90(0x92)in _0x489d8e)_0x4c80e2=_0x489d8e[_0x3e0c90(0x92)];else{if(_0x3e0c90(0xa2)in _0x59f8d3)_0x4c80e2=_0x59f8d3[_0x3e0c90(0xa2)];else _0x3e0c90(0x92)in _0x59f8d3&&(_0x4c80e2=_0x59f8d3[_0x3e0c90(0x92)]);}}if(typeof _0x4c80e2!=='string'||_0x4c80e2[_0x3e0c90(0x99)]()==='')return undefined;return _0x4c80e2;}function a57_0x29f3(){const _0x4019bc=['685700RnZsLQ','14BCOmNl','appcode','utf8','app','765vUkTVy','2532JgeUkN','364309omDlpf','580qZQhNF','201502LMEMTd','cwd','trim','parse','.lovrabetrc','6433596rnWUQN','3137168oHXwjF','5685wBppZA','13308nAnstO'];a57_0x29f3=function(){return _0x4019bc;};return a57_0x29f3();}export function isInProject(){return existsSync(projectConfigPath);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x7938a3,_0x35f3da){const _0x5cce9c=a58_0x3f24,_0x1c00e5=_0x7938a3();while(!![]){try{const _0x3ad14b=parseInt(_0x5cce9c(0x105))/0x1*(parseInt(_0x5cce9c(0x10a))/0x2)+parseInt(_0x5cce9c(0x108))/0x3+-parseInt(_0x5cce9c(0x102))/0x4*(-parseInt(_0x5cce9c(0xfe))/0x5)+-parseInt(_0x5cce9c(0xff))/0x6+parseInt(_0x5cce9c(0x103))/0x7+parseInt(_0x5cce9c(0x106))/0x8*(-parseInt(_0x5cce9c(0x101))/0x9)+-parseInt(_0x5cce9c(0x10d))/0xa;if(_0x3ad14b===_0x35f3da)break;else _0x1c00e5['push'](_0x1c00e5['shift']());}catch(_0x10beb9){_0x1c00e5['push'](_0x1c00e5['shift']());}}}(a58_0x8217,0xccf56));function a58_0x3f24(_0x122739,_0x1d07f5){_0x122739=_0x122739-0xfe;const _0x8217c9=a58_0x8217();let _0x3f24ff=_0x8217c9[_0x122739];return _0x3f24ff;}import a58_0x24180c from'node:path';function a58_0x8217(){const _0x2cf2a3=['44UrOskG','354753vMwbKN','mkdirSync','2rXFuac','6711304IArWxX','error','3639879eOlzyh','readdirSync','1055762eIhcMO','isDirectory','name','7051630xnTznl','640015zFBkAj','8065086mcVrfX','join','9wsOHwX'];a58_0x8217=function(){return _0x2cf2a3;};return a58_0x8217();}import a58_0x3795ec from'node:fs';export async function copyDirectory(_0x57dfac,_0x53d8d9){const _0x40a5fc=a58_0x3f24;try{const _0x45eb84=a58_0x3795ec[_0x40a5fc(0x109)](_0x57dfac,{'withFileTypes':!![]});a58_0x3795ec[_0x40a5fc(0x104)](_0x53d8d9,{'recursive':!![]});for(const _0xa04a66 of _0x45eb84){const _0x2bd87b=a58_0x24180c[_0x40a5fc(0x100)](_0x57dfac,_0xa04a66[_0x40a5fc(0x10c)]),_0x2df885=a58_0x24180c[_0x40a5fc(0x100)](_0x53d8d9,_0xa04a66[_0x40a5fc(0x10c)]);_0xa04a66[_0x40a5fc(0x10b)]()?await copyDirectory(_0x2bd87b,_0x2df885):a58_0x3795ec['copyFileSync'](_0x2bd87b,_0x2df885);}}catch(_0x17ee2c){console[_0x40a5fc(0x107)]('复制目录时出错:',_0x17ee2c);}}
|
package/lib/utils/http-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4accd1,_0x328d22){const _0x2811b8=a59_0x1840,_0x4ce3c9=_0x4accd1();while(!![]){try{const _0x5f0647=parseInt(_0x2811b8(0x189))/0x1+-parseInt(_0x2811b8(0x185))/0x2+-parseInt(_0x2811b8(0x18d))/0x3*(-parseInt(_0x2811b8(0x192))/0x4)+-parseInt(_0x2811b8(0x188))/0x5+-parseInt(_0x2811b8(0x183))/0x6*(parseInt(_0x2811b8(0x17a))/0x7)+parseInt(_0x2811b8(0x180))/0x8+parseInt(_0x2811b8(0x17d))/0x9*(-parseInt(_0x2811b8(0x191))/0xa);if(_0x5f0647===_0x328d22)break;else _0x4ce3c9['push'](_0x4ce3c9['shift']());}catch(_0x32104e){_0x4ce3c9['push'](_0x4ce3c9['shift']());}}}(a59_0x4157,0xafed2));export async function httpRequest(_0x1d3c8e,_0xc1cd77={}){const _0x563685=a59_0x1840,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0xc1cd77;let _0x45cb33=null;for(let _0xaab801=0x0;_0xaab801<=retries;_0xaab801++){try{const _0x5bc3a6=new AbortController(),_0x7c5ee1=setTimeout(()=>_0x5bc3a6['abort'](),timeout),_0x2488ac=await fetch(_0x1d3c8e,{'headers':headers,'signal':_0x5bc3a6[_0x563685(0x179)]});clearTimeout(_0x7c5ee1);let _0x3a046b;const _0x3df26e=_0x2488ac['headers'][_0x563685(0x178)](_0x563685(0x18e));return _0x3df26e?.['includes']('application/json')?_0x3a046b=await _0x2488ac[_0x563685(0x187)]():_0x3a046b=await _0x2488ac[_0x563685(0x18f)](),{'ok':_0x2488ac['ok'],'status':_0x2488ac[_0x563685(0x17e)],'statusText':_0x2488ac['statusText'],'data':_0x3a046b,'headers':_0x2488ac[_0x563685(0x18b)],'url':_0x2488ac['url'],'text':()=>_0x2488ac[_0x563685(0x18f)]()};}catch(_0x40d124){_0x45cb33=_0x40d124 instanceof Error?_0x40d124:new Error(String(_0x40d124));if(_0xaab801===retries)break;if(shouldRetry(_0x40d124)){console[_0x563685(0x18c)](_0x563685(0x17f)+retryDelay+_0x563685(0x184)+(_0xaab801+0x1)+_0x563685(0x186)),await sleep(retryDelay);continue;}else break;}}throw _0x45cb33||new Error(_0x563685(0x182));}function shouldRetry(_0x484e58){const _0x18ce07=a59_0x1840;if(_0x484e58 instanceof Error){if(_0x484e58[_0x18ce07(0x181)]===_0x18ce07(0x18a))return![];if(_0x484e58['name']==='TypeError'&&_0x484e58['message']['includes'](_0x18ce07(0x17b)))return!![];if(_0x484e58[_0x18ce07(0x190)]['includes']('ECONNRESET'))return!![];if(_0x484e58[_0x18ce07(0x190)][_0x18ce07(0x193)](_0x18ce07(0x17c)))return![];}return![];}function sleep(_0x4833bf){return new Promise(_0x54fad0=>setTimeout(_0x54fad0,_0x4833bf));}function a59_0x1840(_0x2eb52b,_0x295bca){_0x2eb52b=_0x2eb52b-0x178;const _0x4157d3=a59_0x4157();let _0x18401b=_0x4157d3[_0x2eb52b];return _0x18401b;}function a59_0x4157(){const _0x4c6441=['fetch','ENOTFOUND','18bojUiR','status','*\x20请求失败,','5534800zyqVEE','name','Request\x20failed','5495106nJjOYS','ms\x20后进行第\x20','1567058YMLUVf','\x20次重试...','json','892115aRQcsL','1183300gtcyEw','AbortError','headers','log','3bncbme','content-type','text','message','1826160emtsUb','4353916rBHSKs','includes','get','signal','7rxmkdk'];a59_0x4157=function(){return _0x4c6441;};return a59_0x4157();}export function validateUrl(_0x3f94e4){try{return new URL(_0x3f94e4),!![];}catch{return![];}}
|
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a60_0x932ba7=a60_0x1be5;(function(_0x1b9475,_0x596604){const _0x10cfc3=a60_0x1be5,_0x33107f=_0x1b9475();while(!![]){try{const _0x1b079a=parseInt(_0x10cfc3(0x1a0))/0x1*(parseInt(_0x10cfc3(0x1ad))/0x2)+-parseInt(_0x10cfc3(0x1cf))/0x3*(parseInt(_0x10cfc3(0x1c3))/0x4)+-parseInt(_0x10cfc3(0x1a1))/0x5*(parseInt(_0x10cfc3(0x1c2))/0x6)+parseInt(_0x10cfc3(0x1bc))/0x7+parseInt(_0x10cfc3(0x1aa))/0x8*(parseInt(_0x10cfc3(0x1c0))/0x9)+-parseInt(_0x10cfc3(0x1d6))/0xa+parseInt(_0x10cfc3(0x1cc))/0xb;if(_0x1b079a===_0x596604)break;else _0x33107f['push'](_0x33107f['shift']());}catch(_0x260383){_0x33107f['push'](_0x33107f['shift']());}}}(a60_0x2d54,0x1dd5f));import a60_0x46e6d2 from'winston';import a60_0x2cb398 from'node:fs';function a60_0x1be5(_0x58ea7e,_0x96f4ba){_0x58ea7e=_0x58ea7e-0x1a0;const _0x2d54b7=a60_0x2d54();let _0x1be599=_0x2d54b7[_0x58ea7e];return _0x1be599;}function a60_0x2d54(){const _0x1041d5=['1042770xqcXdw','348NzAKSp','setLogPath','完成:\x20','join','失败:\x20','map','File','stringify','level','4958932PRueAX','logFilePath','duration','6522FaBwff','error','setRawCommand','existsSync','now','logTask','message','1487750WKyiFM','47876RrGjJa','5DFDVkx','addColors','Failed\x20to\x20clear\x20logs:','trim','currentRawCommand','split','parse','green','errors','16dJmVka','command','readLogs','2ZxiNMN','success','writeFileSync','mkdirSync','utf8','info','winstonLogger','details','Failed\x20to\x20read\x20logs:','warn','format','initWinstonLogger','clearLogs','yellow','blue','544383clryjE','开始执行:\x20','readFileSync','toISOString','258561JZwSSB','unknown'];a60_0x2d54=function(){return _0x1041d5;};return a60_0x2d54();}import a60_0x34638d from'node:path';class Logger{['winstonLogger'];[a60_0x932ba7(0x1cd)];['currentRawCommand']='';constructor(){const _0x5197e9=a60_0x932ba7;this[_0x5197e9(0x1cd)]='';}[a60_0x932ba7(0x1d1)](_0xfd52f7){this['currentRawCommand']=_0xfd52f7;}[a60_0x932ba7(0x1b8)](){const _0x50b982=a60_0x932ba7,_0x4edf2b=a60_0x34638d['dirname'](this[_0x50b982(0x1cd)]);!a60_0x2cb398['existsSync'](_0x4edf2b)&&a60_0x2cb398[_0x50b982(0x1b0)](_0x4edf2b,{'recursive':!![]});const _0x16703c=a60_0x46e6d2[_0x50b982(0x1b7)]['combine'](a60_0x46e6d2[_0x50b982(0x1b7)]['timestamp'](),a60_0x46e6d2['format'][_0x50b982(0x1a9)]({'stack':!![]}),a60_0x46e6d2[_0x50b982(0x1b7)]['printf'](_0x582723=>{const _0x4fc4a5=_0x50b982,_0x56bdf={'timestamp':_0x582723['timestamp']||new Date()[_0x4fc4a5(0x1bf)](),'level':_0x582723[_0x4fc4a5(0x1cb)]||'info','command':_0x582723[_0x4fc4a5(0x1ab)]||_0x4fc4a5(0x1c1),'rawCommand':_0x582723['rawCommand']||this[_0x4fc4a5(0x1a5)]||undefined,'message':_0x582723['message']||'','duration':_0x582723[_0x4fc4a5(0x1ce)]||undefined,'details':_0x582723[_0x4fc4a5(0x1b4)]||undefined};return JSON[_0x4fc4a5(0x1ca)](_0x56bdf);}));this['winstonLogger']=a60_0x46e6d2['createLogger']({'level':_0x50b982(0x1b2),'format':_0x16703c,'transports':[new a60_0x46e6d2['transports'][(_0x50b982(0x1c9))]({'filename':this['logFilePath'],'level':_0x50b982(0x1b2)})],'silent':![]}),a60_0x46e6d2[_0x50b982(0x1a2)]({'success':_0x50b982(0x1a8),'error':'red','warn':_0x50b982(0x1ba),'info':_0x50b982(0x1bb)});}[a60_0x932ba7(0x1c4)](_0x385021){const _0x9c99de=a60_0x932ba7;this[_0x9c99de(0x1cd)]=a60_0x34638d[_0x9c99de(0x1c6)](_0x385021,'.lovrabet.log'),this[_0x9c99de(0x1b3)]&&this['winstonLogger']['clear'](),this['initWinstonLogger']();}[a60_0x932ba7(0x1b2)](_0x282ed9,_0x3fc2c7,_0x229a7e){const _0x1df4ca=a60_0x932ba7;if(!this['logFilePath']||!this[_0x1df4ca(0x1b3)])return;this['winstonLogger']['info'](_0x3fc2c7,{'command':_0x282ed9,'details':_0x229a7e});}['success'](_0x211d5a,_0x4f5524,_0x5897a6,_0x43f6f6){const _0x52609b=a60_0x932ba7;if(!this[_0x52609b(0x1cd)]||!this[_0x52609b(0x1b3)])return;this[_0x52609b(0x1b3)]['log'](_0x52609b(0x1b2),_0x4f5524,{'level':_0x52609b(0x1ae),'command':_0x211d5a,'duration':_0x5897a6,'details':_0x43f6f6});}[a60_0x932ba7(0x1d0)](_0x4de4f1,_0x338657,_0x2d341d){const _0x43cbdc=a60_0x932ba7;if(!this[_0x43cbdc(0x1cd)]||!this[_0x43cbdc(0x1b3)])return;this[_0x43cbdc(0x1b3)][_0x43cbdc(0x1d0)](_0x338657,{'command':_0x4de4f1,'details':_0x2d341d});}[a60_0x932ba7(0x1b6)](_0x36b23f,_0x295fad,_0x1c606d){const _0x57c477=a60_0x932ba7;if(!this['logFilePath']||!this[_0x57c477(0x1b3)])return;this[_0x57c477(0x1b3)]['warn'](_0x295fad,{'command':_0x36b23f,'details':_0x1c606d});}async[a60_0x932ba7(0x1d4)](_0x2bb0cf,_0x18580e,_0x24d76f){const _0x28eebb=a60_0x932ba7,_0x17c570=Date[_0x28eebb(0x1d3)]();this['info'](_0x2bb0cf,_0x28eebb(0x1bd)+_0x18580e);try{const _0x350309=await _0x24d76f(),_0x39fae0=Date[_0x28eebb(0x1d3)]()-_0x17c570;return this[_0x28eebb(0x1ae)](_0x2bb0cf,_0x28eebb(0x1c5)+_0x18580e,_0x39fae0),_0x350309;}catch(_0x5b125a){const _0x4e637b=Date[_0x28eebb(0x1d3)]()-_0x17c570;this[_0x28eebb(0x1d0)](_0x2bb0cf,_0x28eebb(0x1c7)+_0x18580e,{'error':_0x5b125a instanceof Error?_0x5b125a[_0x28eebb(0x1d5)]:String(_0x5b125a),'duration':_0x4e637b});throw _0x5b125a;}}[a60_0x932ba7(0x1ac)](){const _0x1a6307=a60_0x932ba7;try{if(!a60_0x2cb398[_0x1a6307(0x1d2)](this['logFilePath']))return[];const _0x4e80cc=a60_0x2cb398[_0x1a6307(0x1be)](this[_0x1a6307(0x1cd)],_0x1a6307(0x1b1));return _0x4e80cc[_0x1a6307(0x1a6)]('\x0a')['filter'](_0x4d26d3=>_0x4d26d3[_0x1a6307(0x1a4)]())[_0x1a6307(0x1c8)](_0x590b0b=>JSON[_0x1a6307(0x1a7)](_0x590b0b));}catch(_0x1cf5dc){return console[_0x1a6307(0x1b6)](_0x1a6307(0x1b5),_0x1cf5dc),[];}}[a60_0x932ba7(0x1b9)](){const _0x29bc5f=a60_0x932ba7;try{a60_0x2cb398[_0x29bc5f(0x1d2)](this[_0x29bc5f(0x1cd)])&&a60_0x2cb398[_0x29bc5f(0x1af)](this[_0x29bc5f(0x1cd)],'',_0x29bc5f(0x1b1));}catch(_0xb626b8){console[_0x29bc5f(0x1b6)](_0x29bc5f(0x1a3),_0xb626b8);}}['getWinstonInstance'](){const _0x5ebfe8=a60_0x932ba7;return this[_0x5ebfe8(0x1b3)];}}export const logger=new Logger();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a61_0x48a835=a61_0x6c53;(function(_0xbd9581,_0x27b735){const _0x1dc7f9=a61_0x6c53,_0xf501cd=_0xbd9581();while(!![]){try{const _0x5ee14b=-parseInt(_0x1dc7f9(0x108))/0x1*(-parseInt(_0x1dc7f9(0x124))/0x2)+parseInt(_0x1dc7f9(0x110))/0x3*(parseInt(_0x1dc7f9(0x105))/0x4)+parseInt(_0x1dc7f9(0x121))/0x5*(-parseInt(_0x1dc7f9(0x12e))/0x6)+-parseInt(_0x1dc7f9(0x12f))/0x7*(-parseInt(_0x1dc7f9(0x125))/0x8)+parseInt(_0x1dc7f9(0x120))/0x9*(-parseInt(_0x1dc7f9(0x129))/0xa)+parseInt(_0x1dc7f9(0x12a))/0xb+-parseInt(_0x1dc7f9(0x119))/0xc;if(_0x5ee14b===_0x27b735)break;else _0xf501cd['push'](_0xf501cd['shift']());}catch(_0x3e1d1c){_0xf501cd['push'](_0xf501cd['shift']());}}}(a61_0xf221,0xded52));import a61_0x467ff9 from'node:fs';import a61_0x51c4fe from'node:path';function a61_0xf221(){const _0x4fdcca=['197721BbrPEr','5ChYTCc','\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},','addImport','22dBsoMT','218872nDqAYU','join','\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22','length','410ygIFYv','19484058JdsKHq','previewChanges','addPageRoute','toComponentName','7245606azfoUy','21crPiJN','index.tsx','error','import\x20','未找到路由配置的\x20children\x20数组','5982832nJQiti','promises','路由文件不存在:\x20','78941cULWdu','routerFilePath','路由配置更新失败','lastIndexOf','slice','\x20from\x20\x22../pages/','indexOf','info','3ThKZVZ','utf8','index','message','now','match','toUpperCase','开始更新路由配置','path:\x20\x22','14356344pxcXyw','includes','readFile','addRoute','router','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','existsSync'];a61_0xf221=function(){return _0x4fdcca;};return a61_0xf221();}import{logger}from'./logger.js';function a61_0x6c53(_0x4fe2e0,_0x5713cf){_0x4fe2e0=_0x4fe2e0-0x102;const _0xf22140=a61_0xf221();let _0x6c5395=_0xf22140[_0x4fe2e0];return _0x6c5395;}export class RouterUpdater{[a61_0x48a835(0x109)];constructor(_0x4ac22e){const _0x3ba283=a61_0x48a835;this[_0x3ba283(0x109)]=a61_0x51c4fe[_0x3ba283(0x126)](_0x4ac22e,'src',_0x3ba283(0x11d),_0x3ba283(0x130));}async[a61_0x48a835(0x12c)](_0x1a6397,_0x5dfa37){const _0x3544db=a61_0x48a835;if(!a61_0x467ff9[_0x3544db(0x11f)](this[_0x3544db(0x109)]))throw new Error('路由文件不存在:\x20'+this[_0x3544db(0x109)]);const _0x565c6a=Date[_0x3544db(0x114)]();logger[_0x3544db(0x10f)](_0x3544db(0x11d),_0x3544db(0x117),{'pageName':_0x1a6397,'routePath':_0x5dfa37,'file':this['routerFilePath']});try{const _0x325079=await a61_0x467ff9[_0x3544db(0x106)][_0x3544db(0x11b)](this[_0x3544db(0x109)],_0x3544db(0x111)),_0x4c03f2=this['toComponentName'](_0x1a6397),_0xe8c4d2=this[_0x3544db(0x123)](_0x325079,_0x4c03f2,_0x1a6397),_0x558265=this[_0x3544db(0x11c)](_0xe8c4d2,_0x5dfa37,_0x4c03f2);await a61_0x467ff9[_0x3544db(0x106)]['writeFile'](this[_0x3544db(0x109)],_0x558265,_0x3544db(0x111));const _0x15d933=Date[_0x3544db(0x114)]()-_0x565c6a;logger['success'](_0x3544db(0x11d),'路由配置更新完成',_0x15d933,{'pageName':_0x1a6397,'routePath':_0x5dfa37,'componentName':_0x4c03f2});}catch(_0x462631){const _0x428cb4=Date['now']()-_0x565c6a;logger[_0x3544db(0x102)](_0x3544db(0x11d),_0x3544db(0x10a),{'pageName':_0x1a6397,'routePath':_0x5dfa37,'error':_0x462631 instanceof Error?_0x462631[_0x3544db(0x113)]:String(_0x462631),'duration':_0x428cb4});throw _0x462631;}}['toComponentName'](_0x4ce3b7){const _0x14a1ef=a61_0x48a835;return _0x4ce3b7['split']('-')['map'](_0x3a52c0=>_0x3a52c0['charAt'](0x0)[_0x14a1ef(0x116)]()+_0x3a52c0[_0x14a1ef(0x10c)](0x1)['toLowerCase']())['join']('');}[a61_0x48a835(0x123)](_0x100998,_0x51c959,_0x1a23ea){const _0x442f80=a61_0x48a835,_0x15f32f=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x458b92=_0x100998['match'](_0x15f32f)||[],_0x53f5f2=_0x442f80(0x103)+_0x51c959+_0x442f80(0x10d)+_0x1a23ea+'\x22;';if(_0x100998[_0x442f80(0x11a)](_0x53f5f2))return _0x100998;if(_0x458b92[_0x442f80(0x128)]>0x0){const _0x38ebd8=_0x458b92[_0x458b92[_0x442f80(0x128)]-0x1];if(_0x38ebd8){const _0x3d1de9=_0x100998[_0x442f80(0x10b)](_0x38ebd8),_0x162090=_0x3d1de9+_0x38ebd8[_0x442f80(0x128)];return _0x100998[_0x442f80(0x10c)](0x0,_0x162090)+_0x53f5f2+'\x0a'+_0x100998[_0x442f80(0x10c)](_0x162090);}}const _0x492119=_0x100998['match'](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x492119&&_0x492119[_0x442f80(0x112)]!==undefined){const _0xd40819=_0x492119[_0x442f80(0x112)]+_0x492119[0x0]['length'];return _0x100998[_0x442f80(0x10c)](0x0,_0xd40819)+_0x53f5f2+'\x0a'+_0x100998[_0x442f80(0x10c)](_0xd40819);}return _0x100998;}[a61_0x48a835(0x11c)](_0x24b5a6,_0x4a68e0,_0xb7c183){const _0x98097=a61_0x48a835,_0x4595e0=_0x98097(0x127)+_0x4a68e0+_0x98097(0x11e)+_0xb7c183+_0x98097(0x122);if(_0x24b5a6[_0x98097(0x11a)](_0x98097(0x118)+_0x4a68e0+'\x22'))return _0x24b5a6;const _0x32c511=/children:\s*\[([\s\S]*?)\]/,_0x3451db=_0x24b5a6['match'](_0x32c511);if(!_0x3451db||_0x3451db['index']===undefined)throw new Error(_0x98097(0x104));const _0x189406=_0x3451db[0x1],_0x568b67=_0x3451db[_0x98097(0x112)]+_0x3451db[0x0][_0x98097(0x10e)]('[')+0x1,_0x2886b0=_0x189406?.[_0x98097(0x115)](/\{[\s\S]*?\},/g)||[];if(_0x2886b0[_0x98097(0x128)]>0x0){const _0x504325=_0x2886b0[_0x2886b0[_0x98097(0x128)]-0x1];if(_0x504325){const _0x5eda47=_0x24b5a6[_0x98097(0x10b)](_0x504325),_0x4d7996=_0x5eda47+_0x504325[_0x98097(0x128)];return _0x24b5a6['slice'](0x0,_0x4d7996)+'\x0a'+_0x4595e0+_0x24b5a6[_0x98097(0x10c)](_0x4d7996);}}return _0x24b5a6['slice'](0x0,_0x568b67)+'\x0a'+_0x4595e0+_0x24b5a6[_0x98097(0x10c)](_0x568b67);}async[a61_0x48a835(0x12b)](_0x391e97,_0x228e0f){const _0x4158b2=a61_0x48a835;if(!a61_0x467ff9['existsSync'](this[_0x4158b2(0x109)]))throw new Error(_0x4158b2(0x107)+this[_0x4158b2(0x109)]);const _0x10d3df=await a61_0x467ff9[_0x4158b2(0x106)][_0x4158b2(0x11b)](this['routerFilePath'],_0x4158b2(0x111)),_0x1c1879=this[_0x4158b2(0x12d)](_0x391e97);let _0x18b120=this[_0x4158b2(0x123)](_0x10d3df,_0x1c1879,_0x391e97);return _0x18b120=this[_0x4158b2(0x11c)](_0x18b120,_0x228e0f,_0x1c1879),_0x18b120;}}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x289687){return new Promise(_0x288681=>setTimeout(_0x288681,_0x289687));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a63_0x3fb1(){const _0x391c16=['alias:\x20\x22','replaceContent','.tpl','.md','91YRLdoF','processTemplate','readdir','pop','.css','\x0a\x20\x20\x20\x20{\x20','split','promises','default','3957NjJMZH','mkdir','toComponentName','339018aWAPYp','2943964vkLjMd','template','name:\x20\x22','utf8','success','开始处理模板内容替换','10FxnrXK','name','slice','.jsx','error','join','.json','8736696SfCJUv','toISOString','map','80VOjPHQ','now','模板内容替换完成','replace','charAt','toUpperCase','api','isFile','isDirectory','1688208rARtki','.tsx','toLowerCase','datasetCode:\x20\x22','tableName:\x20\x22','processDirectory','toDisplayTitle','2-digit','6500456RDtxtX','replaceApiContent','writeFile','toLocaleDateString','extname','includes','alias','endsWith','processFile','info','copyFile','.ts','readFile','numeric','10kmMyMJ','4416159xNXVMa'];a63_0x3fb1=function(){return _0x391c16;};return a63_0x3fb1();}const a63_0x393cb3=a63_0x3abc;(function(_0x3826ed,_0x271382){const _0x25b21d=a63_0x3abc,_0xc9f895=_0x3826ed();while(!![]){try{const _0x39a6e0=parseInt(_0x25b21d(0x11e))/0x1*(-parseInt(_0x25b21d(0x132))/0x2)+parseInt(_0x25b21d(0x13b))/0x3+parseInt(_0x25b21d(0x122))/0x4*(parseInt(_0x25b21d(0x10f))/0x5)+-parseInt(_0x25b21d(0x121))/0x6*(parseInt(_0x25b21d(0x115))/0x7)+-parseInt(_0x25b21d(0x101))/0x8+parseInt(_0x25b21d(0x12f))/0x9+-parseInt(_0x25b21d(0x128))/0xa*(parseInt(_0x25b21d(0x110))/0xb);if(_0x39a6e0===_0x271382)break;else _0xc9f895['push'](_0xc9f895['shift']());}catch(_0x3c38a0){_0xc9f895['push'](_0xc9f895['shift']());}}}(a63_0x3fb1,0xdb639));import a63_0x4b419c from'node:fs';function a63_0x3abc(_0x41e548,_0x5aeb29){_0x41e548=_0x41e548-0xfd;const _0x3fb1ae=a63_0x3fb1();let _0x3abcb0=_0x3fb1ae[_0x41e548];return _0x3abcb0;}import a63_0x4c46f8 from'node:path';import{logger}from'./logger.js';export class TemplateReplacer{static['toComponentName'](_0x3fae40){const _0x22b910=a63_0x3abc,_0x125d3f=_0x3fae40['split']('/')[_0x22b910(0x118)]()||_0x3fae40;return _0x125d3f[_0x22b910(0x11b)]('-')[_0x22b910(0x131)](_0x344b84=>_0x344b84['charAt'](0x0)[_0x22b910(0x137)]()+_0x344b84[_0x22b910(0x12a)](0x1)[_0x22b910(0x13d)]())[_0x22b910(0x12d)]('');}static[a63_0x393cb3(0xff)](_0x527dbf){const _0x362654=a63_0x393cb3,_0x9460ea=_0x527dbf['split']('/')[_0x362654(0x118)]()||_0x527dbf;return _0x9460ea['split']('-')[_0x362654(0x131)](_0x16e66a=>_0x16e66a[_0x362654(0x136)](0x0)[_0x362654(0x137)]()+_0x16e66a[_0x362654(0x12a)](0x1)[_0x362654(0x13d)]())['join']('\x20');}static[a63_0x393cb3(0x112)](_0x37e67d,_0x1f41eb,_0x21b04e){const _0x5f13ae=a63_0x393cb3,_0x3d76dd=this[_0x5f13ae(0x120)](_0x1f41eb),_0x5087da=this[_0x5f13ae(0xff)](_0x1f41eb),_0x3c09db=new Date(),_0x3a3b65=_0x3c09db['toLocaleString'](undefined,{'year':'numeric','month':_0x5f13ae(0x100),'day':_0x5f13ae(0x100),'hour':_0x5f13ae(0x100),'minute':_0x5f13ae(0x100),'second':'2-digit','hour12':![]})['replace'](/\//g,'-'),_0x3119bb=_0x3c09db[_0x5f13ae(0x104)](undefined,{'year':_0x5f13ae(0x10e),'month':_0x5f13ae(0x100),'day':'2-digit'})[_0x5f13ae(0x135)](/\//g,'-'),_0x176078=_0x3c09db['toLocaleTimeString'](undefined,{'hour12':![]});let _0x43d324=_0x37e67d['replace'](/\{ComponentName\}/g,_0x3d76dd)['replace'](/\{DisplayTitle\}/g,_0x5087da)[_0x5f13ae(0x135)](/\{PageName\}/g,_0x1f41eb)[_0x5f13ae(0x135)](/\{TemplateName\}/g,_0x21b04e)['replace'](/\{CreatedAt\}/g,_0x3a3b65)['replace'](/\{CreatedDate\}/g,_0x3119bb)[_0x5f13ae(0x135)](/\{CreatedTime\}/g,_0x176078);return _0x43d324;}static[a63_0x393cb3(0x102)](_0x2212f3,_0x30beac,_0x3e7df7,_0x52ab73,_0x438fec,_0x272388,_0x468382){const _0x2f72ad=a63_0x393cb3,_0x5524aa=new Date(),_0x458af2=_0x5524aa[_0x2f72ad(0x130)](),_0x160528=_0x3e7df7[_0x2f72ad(0x131)](_0x3cef13=>{const _0x20b55a=_0x2f72ad,_0x4f3b92=[_0x20b55a(0x13e)+_0x3cef13['datasetCode']+'\x22',_0x20b55a(0xfd)+_0x3cef13['tableName']+'\x22',_0x20b55a(0x124)+_0x3cef13['name']+'\x22'];return _0x3cef13[_0x20b55a(0x107)]&&_0x4f3b92['push'](_0x20b55a(0x111)+_0x3cef13[_0x20b55a(0x107)]+'\x22'),_0x20b55a(0x11a)+_0x4f3b92[_0x20b55a(0x12d)](',\x20')+'\x20},';})[_0x2f72ad(0x12d)](''),_0x3b2b33=_0x52ab73||_0x3e7df7[0x0]?.[_0x2f72ad(0x107)]||'YourModel';let _0x30727c=_0x2212f3['replace'](/\{AppCode\}/g,_0x30beac)[_0x2f72ad(0x135)](/\{ModelConfigs\}/g,_0x160528)[_0x2f72ad(0x135)](/\{ExampleModelName\}/g,_0x3b2b33)[_0x2f72ad(0x135)](/\{ApiFileName\}/g,_0x438fec||_0x2f72ad(0x138))['replace'](/\{ConfigName\}/g,_0x272388||_0x2f72ad(0x11d))[_0x2f72ad(0x135)](/\{ClientConfigParam\}/g,_0x468382||'')['replace'](/\{CreatedAt\}/g,_0x458af2);return _0x30727c;}static async[a63_0x393cb3(0x116)](_0x543e33,_0x320dd1,_0x3bf00c,_0x17cb1b,_0x1d8b3a=!![]){const _0x3e1b66=a63_0x393cb3,_0x1d7a15=Date[_0x3e1b66(0x133)]();try{_0x1d8b3a&&logger[_0x3e1b66(0x10a)](_0x3e1b66(0x123),_0x3e1b66(0x127),{'templatePath':_0x543e33,'targetPath':_0x320dd1,'pageName':_0x3bf00c,'templateName':_0x17cb1b});await a63_0x4b419c[_0x3e1b66(0x11c)][_0x3e1b66(0x11f)](_0x320dd1,{'recursive':!![]}),await this[_0x3e1b66(0xfe)](_0x543e33,_0x320dd1,_0x3bf00c,_0x17cb1b);if(_0x1d8b3a){const _0x47830a=Date['now']()-_0x1d7a15;logger[_0x3e1b66(0x126)](_0x3e1b66(0x123),_0x3e1b66(0x134),_0x47830a,{'pageName':_0x3bf00c,'templateName':_0x17cb1b});}}catch(_0x1c8506){if(_0x1d8b3a){const _0x5924f7=Date['now']()-_0x1d7a15;logger[_0x3e1b66(0x12c)](_0x3e1b66(0x123),'模板内容替换失败',{'templatePath':_0x543e33,'targetPath':_0x320dd1,'pageName':_0x3bf00c,'templateName':_0x17cb1b,'error':_0x1c8506 instanceof Error?_0x1c8506['message']:String(_0x1c8506),'duration':_0x5924f7});}throw _0x1c8506;}}static async['processDirectory'](_0xbed977,_0x514d21,_0x125e7e,_0x311d53){const _0x6b6e16=a63_0x393cb3,_0x2c9773=await a63_0x4b419c['promises'][_0x6b6e16(0x117)](_0xbed977,{'withFileTypes':!![]});for(const _0x14f9c3 of _0x2c9773){const _0x5782c5=a63_0x4c46f8[_0x6b6e16(0x12d)](_0xbed977,_0x14f9c3['name']);let _0x45f91c=a63_0x4c46f8[_0x6b6e16(0x12d)](_0x514d21,_0x14f9c3[_0x6b6e16(0x129)]);_0x14f9c3['name'][_0x6b6e16(0x108)](_0x6b6e16(0x113))&&(_0x45f91c=a63_0x4c46f8[_0x6b6e16(0x12d)](_0x514d21,_0x14f9c3[_0x6b6e16(0x129)][_0x6b6e16(0x135)](/\.tpl$/,'')));if(_0x14f9c3[_0x6b6e16(0x13a)]())await a63_0x4b419c[_0x6b6e16(0x11c)]['mkdir'](_0x45f91c,{'recursive':!![]}),await this[_0x6b6e16(0xfe)](_0x5782c5,_0x45f91c,_0x125e7e,_0x311d53);else _0x14f9c3[_0x6b6e16(0x139)]()&&await this[_0x6b6e16(0x109)](_0x5782c5,_0x45f91c,_0x125e7e,_0x311d53);}}static async[a63_0x393cb3(0x109)](_0x2c4d82,_0x4e716c,_0x1a5c89,_0x1b3c1f){const _0x6601b6=a63_0x393cb3,_0x145d2c=a63_0x4c46f8[_0x6601b6(0x105)](_0x2c4d82)[_0x6601b6(0x13d)]();_0x2c4d82[_0x6601b6(0x108)](_0x6601b6(0x113))&&(_0x4e716c=_0x4e716c[_0x6601b6(0x135)](/\.tpl$/,''));const _0x144f9d=[_0x6601b6(0x13c),_0x6601b6(0x10c),_0x6601b6(0x12b),'.js',_0x6601b6(0x12e),_0x6601b6(0x114),_0x6601b6(0x119),'.scss',_0x6601b6(0x113)];if(_0x144f9d[_0x6601b6(0x106)](_0x145d2c)||_0x2c4d82[_0x6601b6(0x108)](_0x6601b6(0x113))){const _0x41d246=await a63_0x4b419c['promises'][_0x6601b6(0x10d)](_0x2c4d82,_0x6601b6(0x125)),_0xb1f18d=this['replaceContent'](_0x41d246,_0x1a5c89,_0x1b3c1f);await a63_0x4b419c[_0x6601b6(0x11c)][_0x6601b6(0x103)](_0x4e716c,_0xb1f18d,_0x6601b6(0x125));}else await a63_0x4b419c[_0x6601b6(0x11c)][_0x6601b6(0x10b)](_0x2c4d82,_0x4e716c);}}
|