@lovrabet/cli 1.3.2-beta.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/add-page/input-page-router.js +1 -1
- package/lib/add-page/main.js +1 -1
- package/lib/add-page/select-page-template.js +1 -1
- package/lib/ai-setup/AISetupUI.js +1 -1
- package/lib/ai-setup/config.js +1 -1
- package/lib/api/api-doc-ui.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-pull-ui.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/main.js +1 -1
- package/lib/api/pull-silent.js +1 -1
- package/lib/app-menu/app-menu-sync-ui.js +1 -1
- package/lib/app-menu/create-menu.js +1 -1
- package/lib/app-menu/get-local-pages.js +1 -1
- package/lib/app-menu/get-online-menu-list.js +1 -1
- package/lib/app-menu/use-get-online-menu-list.js +1 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-update-cdn/current-content.js +1 -1
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
- package/lib/app-menu-update-cdn/main.js +1 -1
- package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli-flags.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/non-interactive.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/i18n/I18nProvider.js +1 -0
- package/lib/i18n/hooks.js +1 -0
- package/lib/i18n/index.js +1 -0
- package/lib/i18n/locales/en-US.js +1 -0
- package/lib/i18n/locales/zh-CN.js +1 -0
- package/lib/init/main.js +1 -1
- package/lib/mcp/McpInstallUI.js +1 -1
- package/lib/mcp/claude.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/mcp/mcp-install-non-interactive.js +1 -1
- package/lib/mcp/mcp-installer.js +1 -1
- package/lib/skills/SkillInstallUI.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/skill-install-non-interactive.js +1 -1
- package/lib/skills/skill-installer.js +1 -1
- package/lib/ui/IDESelector.js +1 -1
- package/lib/ui/useIDESelection.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.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/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x28ab51,_0x992edc){const _0x81a2f3=a0_0x1f6b,_0x4d6696=_0x28ab51();while(!![]){try{const _0x35c4bf=-parseInt(_0x81a2f3(0x1f1))/0x1*(-parseInt(_0x81a2f3(0x1f7))/0x2)+parseInt(_0x81a2f3(0x1f5))/0x3*(-parseInt(_0x81a2f3(0x1ff))/0x4)+parseInt(_0x81a2f3(0x201))/0x5+-parseInt(_0x81a2f3(0x1fd))/0x6+parseInt(_0x81a2f3(0x203))/0x7*(-parseInt(_0x81a2f3(0x1ea))/0x8)+-parseInt(_0x81a2f3(0x1ec))/0x9+parseInt(_0x81a2f3(0x1e8))/0xa;if(_0x35c4bf===_0x992edc)break;else _0x4d6696['push'](_0x4d6696['shift']());}catch(_0x5531e1){_0x4d6696['push'](_0x4d6696['shift']());}}}(a0_0x4d6a,0x58e62));import{jsx as a0_0x2469f6,jsxs as a0_0x48b6c8}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x4cce16 from'node:fs';function a0_0x1f6b(_0x5ae4a6,_0x5d1c73){_0x5ae4a6=_0x5ae4a6-0x1e8;const _0x4d6a48=a0_0x4d6a();let _0x1f6be8=_0x4d6a48[_0x5ae4a6];return _0x1f6be8;}function a0_0x4d6a(){const _0x496486=['column','7VBRPdj','return','gray','13718980qKEuxv','delete','4691768FqOeMQ','existsSync','2602899BMpVKf','addPage.input.route.label','red','includes','addPage.validation.path.tooLong','15695QHAvUj','addPage.validation.path.exists','my-page','addPage.validation.path.invalid','21927kZCnbM','addPage.input.route.hint','80UGBjzF','length','trim','green','slice','addPage.steps.step2','2716854dZVhWS','startsWith','292GsGCvN','\x20←\x20','1132400SfFlXZ'];a0_0x4d6a=function(){return _0x496486;};return a0_0x4d6a();}import{useI18n}from'../i18n/hooks.js';export function InputProjectCode(_0x2c8ec9){const _0x2a1175=a0_0x1f6b,{onSubmit:_0x4e9e0c,pagePath:_0x406942}=_0x2c8ec9,{t:_0x27c967}=useI18n(),[_0x2855f3,_0x31c2ca]=useState(''),[_0x4e6b0f,_0x4306d6]=useState(''),_0x188d21=_0x2a1175(0x1f3);function _0x325c78(_0x2c964a){const _0x4bfb34=_0x2a1175;if(_0x2c964a[_0x4bfb34(0x1f8)]>0x64)return{'valid':![],'message':_0x27c967(_0x4bfb34(0x1f0))};if(_0x2c964a[_0x4bfb34(0x1fe)]('/')||_0x2c964a['endsWith']('/'))return{'valid':![],'message':_0x27c967('addPage.validation.path.invalidStartEnd')};if(_0x2c964a[_0x4bfb34(0x1ef)]('//'))return{'valid':![],'message':_0x27c967('addPage.validation.path.doubleSlash')};const _0x22e076=_0x2c964a['split']('/');for(const _0x183cb1 of _0x22e076){if(!_0x183cb1)continue;const _0x1ab1a4=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x1ab1a4['test'](_0x183cb1))return{'valid':![],'message':_0x27c967('addPage.validation.path.invalidSegment')};}return{'valid':!![]};}return useInput((_0x1090b6,_0x7545de)=>{const _0x16848e=_0x2a1175;if(_0x7545de[_0x16848e(0x204)]){const _0x457fd6=_0x2855f3[_0x16848e(0x1f9)]()||_0x188d21;if(_0x4e6b0f)return;const _0x525fbc=_0x406942+'/'+_0x457fd6;if(a0_0x4cce16[_0x16848e(0x1eb)](_0x525fbc)){_0x4306d6(_0x27c967(_0x16848e(0x1f2),{'path':_0x457fd6}));return;}_0x4e9e0c(_0x457fd6),_0x31c2ca(''),_0x4306d6('');}else _0x7545de['backspace']||_0x7545de[_0x16848e(0x1e9)]?_0x31c2ca(_0x47b8cd=>{const _0x1a7473=_0x16848e,_0x289bbf=_0x47b8cd[_0x1a7473(0x1fb)](0x0,-0x1),{valid:_0x23486e,message:_0x4b1e92}=_0x325c78(_0x289bbf);return _0x4306d6(_0x23486e?'':_0x4b1e92||_0x27c967('addPage.validation.path.invalid')),_0x289bbf;}):_0x31c2ca(_0x47cb49=>{const _0x126f04=_0x16848e,_0x7414ac=_0x47cb49+_0x1090b6,{valid:_0x453522,message:_0x4b7b88}=_0x325c78(_0x7414ac);return _0x4306d6(_0x453522?'':_0x4b7b88||_0x27c967(_0x126f04(0x1f4))),_0x7414ac;});}),a0_0x48b6c8(Box,{'flexDirection':_0x2a1175(0x202),'children':[a0_0x48b6c8(Box,{'children':[a0_0x2469f6(Text,{'color':_0x2a1175(0x205),'children':_0x27c967(_0x2a1175(0x1fc))}),a0_0x2469f6(Text,{'children':_0x27c967(_0x2a1175(0x1ed))}),_0x2855f3?a0_0x2469f6(Text,{'color':_0x2a1175(0x1fa),'children':_0x2855f3}):a0_0x2469f6(Text,{'color':_0x2a1175(0x205),'children':_0x188d21}),_0x4e6b0f&&a0_0x48b6c8(Text,{'color':_0x2a1175(0x1ee),'children':[_0x2a1175(0x200),_0x4e6b0f]})]}),!_0x4e6b0f&&!_0x2855f3&&a0_0x2469f6(Box,{'children':a0_0x2469f6(Text,{'color':_0x2a1175(0x205),'children':_0x27c967(_0x2a1175(0x1f6))})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x4b77a3=a1_0xc82b;(function(_0x366c47,_0x2657c9){const _0x20ce0e=a1_0xc82b,_0xd252d6=_0x366c47();while(!![]){try{const _0x25dc94=-parseInt(_0x20ce0e(0xc9))/0x1+-parseInt(_0x20ce0e(0xb9))/0x2*(parseInt(_0x20ce0e(0xa8))/0x3)+-parseInt(_0x20ce0e(0xc4))/0x4*(parseInt(_0x20ce0e(0xb3))/0x5)+parseInt(_0x20ce0e(0xbb))/0x6*(-parseInt(_0x20ce0e(0xca))/0x7)+-parseInt(_0x20ce0e(0xa6))/0x8+-parseInt(_0x20ce0e(0xaa))/0x9+parseInt(_0x20ce0e(0xb7))/0xa;if(_0x25dc94===_0x2657c9)break;else _0xd252d6['push'](_0xd252d6['shift']());}catch(_0x2d292e){_0xd252d6['push'](_0xd252d6['shift']());}}}(a1_0x5ac3,0x3cf14));import{jsx as a1_0x1cdb30,jsxs as a1_0x257c40,Fragment as a1_0x1dbb2e}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x5c7928 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{SelectPageTemplate}from'./select-page-template.js';import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';function a1_0xc82b(_0x478e9d,_0x1090e5){_0x478e9d=_0x478e9d-0xa3;const _0x5ac35f=a1_0x5ac3();let _0xc82baa=_0x5ac35f[_0x478e9d];return _0xc82baa;}import{TemplateReplacer}from'../utils/template-replacer.js';function a1_0x5ac3(){const _0x39591f=['join','cyan','addPage.display.routeEntered','415lrIwWG','now','setLogPath','cwd','17526540rBkzTS','finally','14ShrYyQ','error','6FfCSqg','addPage.display.route','addPage.success','addPage.display.path','message','addPage.steps.step2','processTemplate','info','../../templates/pages','6700PWFOoZ','src','gray','green','dirname','382489FpPiLV','2105047NrvWeD','页面添加成功:\x20','addPage.steps.step1','then','addPage.display.templateSelected','pages','3476824nLuiVZ','resolve','62523ncIBtT','add-page','902781OvTVkx','success','addPage.creating','addPage.successHint','column','页面添加失败:\x20'];a1_0x5ac3=function(){return _0x39591f;};return a1_0x5ac3();}import{useI18n}from'../i18n/hooks.js';const __dirname=a1_0x5c7928[a1_0x4b77a3(0xc8)](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x5c7928[a1_0x4b77a3(0xa7)](__dirname,a1_0x4b77a3(0xc3)),projectDir=process[a1_0x4b77a3(0xb6)]();export const AddPage=()=>{const _0x3d9b0b=a1_0x4b77a3,{exit:_0x374dba}=useApp(),{t:_0x3e92df}=useI18n(),[_0x12d901,_0x4c1566]=useState(''),[_0x97cf51,_0x30d95f]=useState(''),[_0x1be24c,_0x34a38f]=useState(![]),[_0x20f2d4,_0x546928]=useState(![]),_0x396606=a1_0x5c7928['join'](projectDir,'src',_0x3d9b0b(0xa5)),_0x5020ea=a1_0x5c7928[_0x3d9b0b(0xb0)](_0x396606,_0x97cf51),_0x390d0c=a1_0x5c7928[_0x3d9b0b(0xb0)](_0x3d9b0b(0xc5),_0x3d9b0b(0xa5),_0x97cf51);useEffect(()=>{const _0x3447e6=_0x3d9b0b,_0x21b889=a1_0x5c7928[_0x3447e6(0xa7)](pageTemplateDir,_0x12d901);if(_0x12d901&&_0x97cf51){_0x34a38f(!![]),logger[_0x3447e6(0xb5)](process[_0x3447e6(0xb6)]());const _0x2e3b8d=Date[_0x3447e6(0xb4)]();logger[_0x3447e6(0xc2)](_0x3447e6(0xa9),'开始添加页面:\x20'+_0x97cf51,{'template':_0x12d901,'targetPath':_0x390d0c}),TemplateReplacer[_0x3447e6(0xc1)](_0x21b889,a1_0x5c7928[_0x3447e6(0xb0)](_0x396606,_0x97cf51),_0x97cf51,_0x12d901)[_0x3447e6(0xa3)](()=>{const _0x5ec700=_0x3447e6,_0x466818=Date[_0x5ec700(0xb4)]()-_0x2e3b8d;logger[_0x5ec700(0xab)](_0x5ec700(0xa9),_0x5ec700(0xcb)+_0x97cf51,_0x466818,{'template':_0x12d901,'targetPath':_0x390d0c,'routePath':_0x97cf51}),_0x546928(!![]);})['catch'](_0x466251=>{const _0x52e607=_0x3447e6,_0x1d0fad=Date[_0x52e607(0xb4)]()-_0x2e3b8d;logger[_0x52e607(0xba)](_0x52e607(0xa9),_0x52e607(0xaf)+_0x97cf51,{'template':_0x12d901,'targetPath':_0x390d0c,'error':_0x466251 instanceof Error?_0x466251[_0x52e607(0xbf)]:String(_0x466251),'duration':_0x1d0fad});})[_0x3447e6(0xb8)](()=>{_0x34a38f(![]);});}},[_0x12d901,_0x97cf51]),useEffect(()=>{_0x20f2d4&&setTimeout(()=>{_0x374dba();});},[_0x20f2d4]);if(_0x12d901)return a1_0x257c40(Box,{'flexDirection':_0x3d9b0b(0xae),'paddingY':0x1,'children':[a1_0x257c40(Box,{'children':[a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xc6),'children':_0x3e92df(_0x3d9b0b(0xcc))}),a1_0x1cdb30(Text,{'children':_0x3e92df(_0x3d9b0b(0xa4))}),a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xc7),'children':_0x12d901})]}),_0x97cf51?a1_0x257c40(Box,{'children':[a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xc6),'children':_0x3e92df(_0x3d9b0b(0xc0))}),a1_0x1cdb30(Text,{'children':_0x3e92df(_0x3d9b0b(0xb2))}),a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xc7),'children':_0x97cf51})]}):a1_0x1cdb30(InputProjectCode,{'pagePath':_0x5020ea,'onSubmit':_0x30d95f}),_0x97cf51&&_0x1be24c?a1_0x257c40(Box,{'marginTop':0x1,'children':[a1_0x1cdb30(Box,{'width':'4'}),a1_0x1cdb30(Text,{'children':_0x3e92df(_0x3d9b0b(0xac))})]}):null,_0x20f2d4?a1_0x257c40(a1_0x1dbb2e,{'children':[a1_0x1cdb30(Box,{'marginTop':0x1,'children':a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xc6),'children':_0x3e92df(_0x3d9b0b(0xbd))})}),a1_0x257c40(Box,{'children':[a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xc6),'children':_0x3e92df(_0x3d9b0b(0xbe))}),a1_0x1cdb30(Text,{'color':'green','children':_0x390d0c})]}),a1_0x257c40(Box,{'children':[a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xc6),'children':_0x3e92df(_0x3d9b0b(0xbc))}),a1_0x257c40(Text,{'color':_0x3d9b0b(0xc7),'children':['/',_0x97cf51]})]}),a1_0x1cdb30(Box,{'marginTop':0x1,'children':a1_0x1cdb30(Text,{'color':_0x3d9b0b(0xb1),'children':_0x3e92df(_0x3d9b0b(0xad))})})]}):null]});return a1_0x1cdb30(SelectPageTemplate,{'onSelect':_0x4c1566});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a2_0x33c2d0=a2_0x41d0;(function(_0x2e5b85,_0x3fcea2){const _0x42cb48=a2_0x41d0,_0x5239f8=_0x2e5b85();while(!![]){try{const _0x22b8f7=parseInt(_0x42cb48(0x1cb))/0x1+-parseInt(_0x42cb48(0x1d1))/0x2*(-parseInt(_0x42cb48(0x1c6))/0x3)+-parseInt(_0x42cb48(0x1d0))/0x4+-parseInt(_0x42cb48(0x1dd))/0x5*(-parseInt(_0x42cb48(0x1d5))/0x6)+parseInt(_0x42cb48(0x1d6))/0x7+-parseInt(_0x42cb48(0x1ce))/0x8*(-parseInt(_0x42cb48(0x1d4))/0x9)+-parseInt(_0x42cb48(0x1cd))/0xa;if(_0x22b8f7===_0x3fcea2)break;else _0x5239f8['push'](_0x5239f8['shift']());}catch(_0x5d2bad){_0x5239f8['push'](_0x5239f8['shift']());}}}(a2_0x3548,0x8bb07));function a2_0x3548(){const _0x503096=['183016iRWgrg','label','2315072nYxqQC','133526mSbSJp','sort','addPage.loading.templates','171cMxhRO','11418pCBSkh','6805225BKtqCV','dirname','bind','addPage.steps.step1','\x20\x20\x20\x20\x20\x20\x20\x20','resolve','\x20\x20\x20\x20\x20\x20>\x20','2575WenetT','localeCompare','templates/pages','addPage.select.template.title','onSelect','length','error','isDirectory','map','addPage.error.templateListFailed','name','../..','filter','48ndcCOD','downArrow','gray','column','upArrow','225950lwVzyr','return','25301060iarNXe'];a2_0x3548=function(){return _0x503096;};return a2_0x3548();}import{jsx as a2_0x4173ff,jsxs as a2_0x1f8c95}from'react/jsx-runtime';function a2_0x41d0(_0x3fa83a,_0x2a2cde){_0x3fa83a=_0x3fa83a-0x1bb;const _0x3548ee=a2_0x3548();let _0x41d040=_0x3548ee[_0x3fa83a];return _0x41d040;}import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x1f02f2 from'node:path';import{fileURLToPath}from'node:url';import{useI18n}from'../i18n/hooks.js';import a2_0x5fc0b2 from'../i18n/index.js';const t=a2_0x5fc0b2['t'][a2_0x33c2d0(0x1d8)](a2_0x5fc0b2);async function getTemplateList(){const _0xc85b83=a2_0x33c2d0;try{const _0x3849d5=fileURLToPath(import.meta.url),_0x42726c=a2_0x1f02f2[_0xc85b83(0x1db)](a2_0x1f02f2[_0xc85b83(0x1d7)](_0x3849d5),_0xc85b83(0x1c4)),_0x3aea03=a2_0x1f02f2['join'](_0x42726c,_0xc85b83(0x1bb)),_0x5d632=await readdir(_0x3aea03,{'withFileTypes':!![]}),_0x363d1f=_0x5d632[_0xc85b83(0x1c5)](_0x99be9a=>_0x99be9a[_0xc85b83(0x1c0)]())[_0xc85b83(0x1c1)](_0xcac055=>({'label':_0xcac055[_0xc85b83(0x1c3)]}))[_0xc85b83(0x1d2)]((_0x134c3b,_0x57d6c7)=>_0x134c3b[_0xc85b83(0x1cf)][_0xc85b83(0x1de)](_0x57d6c7[_0xc85b83(0x1cf)]));return _0x363d1f;}catch(_0x3b4907){return console[_0xc85b83(0x1bf)](t(_0xc85b83(0x1c2)),_0x3b4907),[{'label':'blank'},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x311726){const _0x1de4cb=a2_0x33c2d0,{t:_0x5366fa}=useI18n(),[_0x190ebd,_0x3e9b37]=useState(0x0),[_0x1b7bb5,_0x27d654]=useState([]),[_0x4efc46,_0x565ff6]=useState(!![]);useEffect(()=>{async function _0x24a76a(){const _0x3bc3e6=await getTemplateList();_0x27d654(_0x3bc3e6),_0x565ff6(![]);}_0x24a76a();},[]),useInput((_0xfcfcd6,_0x4dae08)=>{const _0x54fcab=a2_0x41d0;if(_0x4efc46)return;if(_0x4dae08[_0x54fcab(0x1cc)]){const _0x161fa4=_0x1b7bb5[_0x190ebd];_0x161fa4&&_0x311726[_0x54fcab(0x1bd)](_0x161fa4[_0x54fcab(0x1cf)]);}_0x4dae08[_0x54fcab(0x1ca)]&&_0x3e9b37(_0xe8de2d=>_0xe8de2d===0x0?_0x1b7bb5[_0x54fcab(0x1be)]-0x1:_0xe8de2d-0x1),_0x4dae08[_0x54fcab(0x1c7)]&&_0x3e9b37(_0x5c8b1f=>_0x5c8b1f===_0x1b7bb5[_0x54fcab(0x1be)]-0x1?0x0:_0x5c8b1f+0x1);});if(_0x4efc46)return a2_0x4173ff(Box,{'flexDirection':_0x1de4cb(0x1c9),'paddingY':0x1,'children':a2_0x1f8c95(Box,{'children':[a2_0x4173ff(Text,{'color':'gray','children':_0x5366fa(_0x1de4cb(0x1d9))}),a2_0x4173ff(Text,{'children':_0x5366fa(_0x1de4cb(0x1d3))})]})});return a2_0x1f8c95(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x1f8c95(Box,{'children':[a2_0x4173ff(Text,{'color':_0x1de4cb(0x1c8),'children':_0x5366fa(_0x1de4cb(0x1d9))}),a2_0x4173ff(Text,{'children':_0x5366fa(_0x1de4cb(0x1bc))})]}),_0x1b7bb5[_0x1de4cb(0x1c1)]((_0x26f12c,_0x449750)=>{const _0x48d5cf=_0x1de4cb,_0x2c1caa=_0x449750===_0x190ebd,_0x3f104f=_0x2c1caa?_0x48d5cf(0x1dc)+_0x26f12c[_0x48d5cf(0x1cf)]:_0x48d5cf(0x1da)+_0x26f12c[_0x48d5cf(0x1cf)];return a2_0x4173ff(Box,{'children':a2_0x4173ff(Text,{'color':_0x2c1caa?'green':undefined,'children':_0x3f104f})},_0x3f104f);})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a3_0x108091=a3_0x540e;(function(_0x2475a1,_0x2b3813){const _0x2bc9fb=a3_0x540e,_0x33980e=_0x2475a1();while(!![]){try{const _0x2409c1=parseInt(_0x2bc9fb(0x190))/0x1+parseInt(_0x2bc9fb(0x189))/0x2+parseInt(_0x2bc9fb(0x1a8))/0x3*(-parseInt(_0x2bc9fb(0x192))/0x4)+parseInt(_0x2bc9fb(0x1a2))/0x5+-parseInt(_0x2bc9fb(0x19a))/0x6+-parseInt(_0x2bc9fb(0x1af))/0x7*(-parseInt(_0x2bc9fb(0x1ac))/0x8)+-parseInt(_0x2bc9fb(0x175))/0x9;if(_0x2409c1===_0x2b3813)break;else _0x33980e['push'](_0x33980e['shift']());}catch(_0x170ebc){_0x33980e['push'](_0x33980e['shift']());}}}(a3_0x8d14,0x2cabd));function a3_0x8d14(){const _0x471cec=['qoder','mcp-','upArrow','aiSetup.ui.installing','813PJmLQR','size','cursor','push','2047976AtepJR','aiSetup.ui.select.title','success','7WfrSkM','aiSetup.ui.selectAtLeastOne','message','green','selecting','ide','trae','2512044CJCToP','aiSetup.ui.confirm.no','agent','delete','white','status','aiSetup.ui.select.controls','done','blue','aiSetup.ui.confirm.title','installing','aiSetup.ui.select.skillSection','add','projectRoot','name','aiSetup.ui.confirm.default','aiSetup.ui.select.mcpSection','[✓]','cyan','codebuddy','351742xJlGdW','filter','column','appcode','length','antigravity','return','313702VJRzRe','has','3704bxAtpe','yellow','skill-','gray','windsurf','[\x20]','confirming','aiSetup.ui.confirm.yes','580452CYOaJa','claude','dimColor','Cursor','aiSetup.ui.confirm.skillDescription','map','aiSetup.ui.confirm.mcpDescription','error','321035JsHopf','Claude\x20Code'];a3_0x8d14=function(){return _0x471cec;};return a3_0x8d14();}import{jsx as a3_0x18be36,jsxs as a3_0x309ec8}from'react/jsx-runtime';function a3_0x540e(_0x2b5cb1,_0x3a2b18){_0x2b5cb1=_0x2b5cb1-0x16f;const _0x8d14c8=a3_0x8d14();let _0x540e7f=_0x8d14c8[_0x2b5cb1];return _0x540e7f;}import{useState,useEffect}from'react';import{Box,Text,useInput,useApp}from'ink';import{configureMcp}from'./config.js';import{installSkill,copySharedSkills,createSkillManifest,SKILL_IDE_CONFIGS}from'./config.js';import{useI18n}from'../i18n/hooks.js';const MCP_IDE_LIST=[a3_0x108091(0x1aa),'claude'],SKILL_IDE_LIST=[a3_0x108091(0x18e),a3_0x108091(0x19b),a3_0x108091(0x188),'codex','cursor','opencode',a3_0x108091(0x1a4),a3_0x108091(0x174),a3_0x108091(0x196),a3_0x108091(0x177)];export function AISetupUI({config:_0x1e01ea,onComplete:_0x1b18d2}){const _0x8adb1b=a3_0x108091,{t:_0xe73336}=useI18n(),{exit:_0x15247c}=useApp(),[_0x1323d3,_0x1526f0]=useState(_0x8adb1b(0x198)),[_0x355845,_0x1a1988]=useState(0x0),[_0x2d90f8,_0x5985b2]=useState(new Set([0x0,0x1])),[_0x14bff8,_0x450a57]=useState(new Set(SKILL_IDE_LIST[_0x8adb1b(0x19f)]((_0xf9e9a7,_0x4e61e0)=>_0x4e61e0))),[_0x5ec695,_0x1756cd]=useState('');useEffect(()=>{!_0x1e01ea['appcode']&&_0x1b18d2({'mcpResults':[],'skillResults':[]});},[_0x1e01ea[_0x8adb1b(0x18c)],_0x1b18d2]),useInput((_0x242a42,_0x2fd94f)=>{const _0x31aeeb=_0x8adb1b;if(_0x1323d3===_0x31aeeb(0x198)){if(_0x242a42==='y'||_0x242a42==='Y'||_0x2fd94f[_0x31aeeb(0x18f)]){_0x3b8dc8();return;}if(_0x242a42==='n'||_0x242a42==='N'){_0x1b18d2({'mcpResults':[],'skillResults':[]});return;}if(_0x2fd94f[_0x31aeeb(0x18f)]){_0x3b8dc8();return;}}if(_0x1323d3==='selecting'){if(_0x2fd94f[_0x31aeeb(0x1a6)]){_0x1a1988(_0x37fa57=>_0x37fa57>0x0?_0x37fa57-0x1:SKILL_IDE_LIST[_0x31aeeb(0x18d)]-0x1);return;}if(_0x2fd94f['downArrow']){_0x1a1988(_0x2575e2=>_0x2575e2<SKILL_IDE_LIST['length']-0x1?_0x2575e2+0x1:0x0);return;}if(_0x242a42==='\x20'){const _0x1a564f=_0x355845<MCP_IDE_LIST[_0x31aeeb(0x18d)];if(_0x1a564f){const _0x1843b5=new Set(_0x2d90f8);_0x1843b5['has'](_0x355845)?_0x1843b5[_0x31aeeb(0x178)](_0x355845):_0x1843b5[_0x31aeeb(0x181)](_0x355845),_0x5985b2(_0x1843b5);}else{const _0x15571a=_0x355845-MCP_IDE_LIST[_0x31aeeb(0x18d)],_0x1af463=new Set(_0x14bff8);_0x1af463['has'](_0x15571a)?_0x1af463[_0x31aeeb(0x178)](_0x15571a):_0x1af463[_0x31aeeb(0x181)](_0x15571a),_0x450a57(_0x1af463);}return;}if(_0x242a42==='a'||_0x242a42==='A'){_0x5985b2(new Set(MCP_IDE_LIST['map']((_0x4e99e0,_0x19856a)=>_0x19856a))),_0x450a57(new Set(SKILL_IDE_LIST[_0x31aeeb(0x19f)]((_0x56584c,_0xf4d2bb)=>_0xf4d2bb)));return;}if(_0x242a42==='q'||_0x242a42==='Q'){_0x15247c();return;}if(_0x2fd94f['return']){if(_0x2d90f8[_0x31aeeb(0x1a9)]===0x0&&_0x14bff8[_0x31aeeb(0x1a9)]===0x0){_0x1756cd(_0xe73336(_0x31aeeb(0x16f)));return;}_0x3b8dc8();return;}}if(_0x1323d3==='done'){_0x15247c();return;}});async function _0x3b8dc8(){const _0x1f51ff=_0x8adb1b;_0x1526f0(_0x1f51ff(0x17f));const _0x15567a=[],_0x1dc298=[];for(const _0x41a014 of _0x2d90f8){const _0x17c484=MCP_IDE_LIST[_0x41a014];if(!_0x17c484)continue;try{const _0x7a45fc=await configureMcp(_0x17c484,_0x1e01ea[_0x1f51ff(0x182)]);_0x15567a[_0x1f51ff(0x1ab)](_0x7a45fc);}catch(_0x3fdc56){_0x15567a[_0x1f51ff(0x1ab)]({'ide':MCP_IDE_CONFIGS[_0x17c484]?.[_0x1f51ff(0x183)]||_0x17c484,'status':_0x1f51ff(0x1a1),'message':_0x3fdc56 instanceof Error?_0x3fdc56[_0x1f51ff(0x170)]:String(_0x3fdc56)});}}await copySharedSkills(_0x1e01ea['projectRoot']);for(const _0x20ddb2 of _0x14bff8){const _0x5c398c=SKILL_IDE_LIST[_0x20ddb2];if(!_0x5c398c)continue;try{const _0x296e82=await installSkill(_0x5c398c,_0x1e01ea[_0x1f51ff(0x182)]);_0x1dc298[_0x1f51ff(0x1ab)](_0x296e82);}catch(_0x46d070){_0x1dc298['push']({'ide':SKILL_IDE_CONFIGS[_0x5c398c]?.[_0x1f51ff(0x183)]||_0x5c398c,'status':_0x1f51ff(0x1a1),'message':_0x46d070 instanceof Error?_0x46d070[_0x1f51ff(0x170)]:String(_0x46d070)});}}if(_0x1dc298[_0x1f51ff(0x18d)]>0x0){const _0x5663c3=_0x1dc298[_0x1f51ff(0x18a)](_0x516781=>_0x516781[_0x1f51ff(0x17a)]===_0x1f51ff(0x1ae))[_0x1f51ff(0x19f)](_0x59731e=>_0x59731e[_0x1f51ff(0x173)]);_0x5663c3[_0x1f51ff(0x18d)]>0x0&&createSkillManifest(_0x1e01ea[_0x1f51ff(0x182)],_0x5663c3);}_0x1526f0('done'),setTimeout(()=>{_0x1b18d2({'mcpResults':_0x15567a,'skillResults':_0x1dc298});},0xbb8);}if(_0x1323d3===_0x8adb1b(0x198))return a3_0x309ec8(Box,{'flexDirection':_0x8adb1b(0x18b),'marginTop':0x1,'children':[a3_0x18be36(Box,{'marginTop':0x1,'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x179),'children':_0xe73336(_0x8adb1b(0x17e))})}),a3_0x18be36(Box,{'marginLeft':0x2,'marginTop':0x1,'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x195),'children':_0xe73336(_0x8adb1b(0x1a0))})}),a3_0x18be36(Box,{'marginLeft':0x2,'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x195),'children':_0xe73336(_0x8adb1b(0x19e))})}),a3_0x309ec8(Box,{'marginTop':0x1,'flexDirection':_0x8adb1b(0x18b),'children':[a3_0x18be36(Box,{'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x171),'children':_0xe73336(_0x8adb1b(0x199))})}),a3_0x18be36(Box,{'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x195),'children':_0xe73336(_0x8adb1b(0x176))})}),a3_0x18be36(Box,{'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x19c),'children':_0xe73336(_0x8adb1b(0x184))})})]}),_0x5ec695&&a3_0x18be36(Box,{'marginTop':0x1,'children':a3_0x309ec8(Text,{'color':'red','children':['✗\x20',_0x5ec695]})})]});if(_0x1323d3===_0x8adb1b(0x172))return a3_0x309ec8(Box,{'flexDirection':'column','marginTop':0x1,'children':[a3_0x18be36(Box,{'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x187),'bold':!![],'children':_0xe73336(_0x8adb1b(0x1ad))})}),_0x5ec695&&a3_0x18be36(Box,{'marginTop':0x1,'children':a3_0x309ec8(Text,{'color':'red','children':['✗\x20',_0x5ec695]})}),a3_0x309ec8(Box,{'marginTop':0x1,'flexDirection':'column','children':[a3_0x18be36(Text,{'bold':!![],'color':_0x8adb1b(0x193),'children':_0xe73336(_0x8adb1b(0x185))}),MCP_IDE_LIST[_0x8adb1b(0x19f)]((_0x3fd7db,_0x3044b2)=>{const _0x51fee7=_0x8adb1b,_0x3e9519=_0x355845===_0x3044b2,_0x5dcb94=_0x2d90f8[_0x51fee7(0x191)](_0x3044b2);return a3_0x18be36(Box,{'children':a3_0x309ec8(Text,{'backgroundColor':_0x3e9519?_0x51fee7(0x17d):undefined,'color':_0x3e9519?_0x51fee7(0x179):undefined,'children':[_0x5dcb94?_0x51fee7(0x186):_0x51fee7(0x197),'\x20',_0x3fd7db===_0x51fee7(0x1aa)?_0x51fee7(0x19d):_0x51fee7(0x1a3)]})},_0x51fee7(0x1a5)+_0x3fd7db);}),a3_0x18be36(Box,{'marginTop':0x1,'children':a3_0x18be36(Text,{'bold':!![],'color':'yellow','children':_0xe73336(_0x8adb1b(0x180))})}),SKILL_IDE_LIST[_0x8adb1b(0x19f)]((_0x433f8f,_0x14aad8)=>{const _0x268857=_0x8adb1b,_0x5ba19b=_0x14aad8+MCP_IDE_LIST[_0x268857(0x18d)],_0x2fd89e=_0x355845===_0x5ba19b,_0x346977=_0x14bff8[_0x268857(0x191)](_0x5ba19b);return a3_0x18be36(Box,{'children':a3_0x309ec8(Text,{'backgroundColor':_0x2fd89e?_0x268857(0x17d):undefined,'color':_0x2fd89e?_0x268857(0x179):undefined,'children':[_0x346977?'[✓]':_0x268857(0x197),'\x20',SKILL_IDE_CONFIGS[_0x433f8f][_0x268857(0x183)]]})},_0x268857(0x194)+_0x433f8f);}),a3_0x18be36(Box,{'marginTop':0x1,'children':a3_0x18be36(Text,{'color':_0x8adb1b(0x195),'children':_0xe73336(_0x8adb1b(0x17b))})})]})]});if(_0x1323d3==='installing')return a3_0x18be36(Box,{'flexDirection':_0x8adb1b(0x18b),'marginTop':0x1,'children':a3_0x18be36(Box,{'children':a3_0x18be36(Text,{'children':_0xe73336(_0x8adb1b(0x1a7))})})});if(_0x1323d3===_0x8adb1b(0x17c))return null;return null;}const MCP_IDE_CONFIGS={'cursor':{'name':a3_0x108091(0x19d)},'claude':{'name':a3_0x108091(0x1a3)}};
|
package/lib/ai-setup/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a4_0x4b9d(_0x3c3779,_0x7692b8){_0x3c3779=_0x3c3779-0x1a1;const _0x51494b=a4_0x5149();let _0x4b9d62=_0x51494b[_0x3c3779];return _0x4b9d62;}const a4_0x30f68b=a4_0x4b9d;(function(_0x3420f6,_0x2424e1){const _0x433dc8=a4_0x4b9d,_0x2b94e1=_0x3420f6();while(!![]){try{const _0xacdb9d=-parseInt(_0x433dc8(0x1c5))/0x1*(parseInt(_0x433dc8(0x1ef))/0x2)+-parseInt(_0x433dc8(0x1b8))/0x3*(parseInt(_0x433dc8(0x1d5))/0x4)+parseInt(_0x433dc8(0x1ca))/0x5*(parseInt(_0x433dc8(0x1eb))/0x6)+-parseInt(_0x433dc8(0x1cb))/0x7+parseInt(_0x433dc8(0x1c2))/0x8*(-parseInt(_0x433dc8(0x1d9))/0x9)+parseInt(_0x433dc8(0x1ac))/0xa*(parseInt(_0x433dc8(0x1de))/0xb)+parseInt(_0x433dc8(0x1cc))/0xc*(parseInt(_0x433dc8(0x1e7))/0xd);if(_0xacdb9d===_0x2424e1)break;else _0x2b94e1['push'](_0x2b94e1['shift']());}catch(_0x304ed6){_0x2b94e1['push'](_0x2b94e1['shift']());}}}(a4_0x5149,0xc125d));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{join,resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';function a4_0x5149(){const _0xf49638=['toISOString','info','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','\x20技能包安装失败','Claude\x20Code','复制\x20Cursor\x20Rules\x20文件失败','lovrabet-dataset','skill-install','已创建\x20','87EyLgwi','\x20\x20\x20\x20\x20\x20}','LOVRABET_ENV','创建技能包\x20manifest','env','error','rules','mcp-install','success','join','342424okZyGW','配置信息:','\x22:\x20{','5hYOMKY','npx','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','需要先配置\x20appcode','1870hLCGkO','2630271JezKAi','11976kkjrCH','Cursor\x20MCP\x20配置成功','claude','创建\x20Cursor\x20Rules\x20文件','请手动执行:\x20','\x20\x20}','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','\x20\x20\x20\x20}','\x20-e\x20LOVRABET_APP_CODE=','179048xddspN','.cursor','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','Cursor','189hynzSW','\x20技能包安装成功','\x0a📋\x20其他\x20IDE\x20MCP\x20配置:\x0a','utf-8','\x20\x20环境:\x20','11IZcfKB','log','lovrabet_rules.mdc','配置指引已显示','appcode','message','mcpServers','未知的\x20IDE:\x20','\x20\x20AppCode:\x20','24596GQQOnX','online','.lovrabet','不支持的\x20MCP\x20IDE:\x20','4518pETVBR','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','../../cdn-source/skills','2.0.0','35560qWBVFC','stringify','object','共享技能文件复制失败','.shared','\x20-e\x20LOVRABET_ENV=','创建\x20agents.md\x20文件','map','.lovrabet/skill-manifest.json','agents.md','manual','node:fs','Claude\x20Code\x20MCP\x20命令已生成','12829090JpyfCx','cwd','cursor'];a4_0x5149=function(){return _0xf49638;};return a4_0x5149();}import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';import{IDE_CONFIGS}from'../utils/ai_config.js';import{installSingleIDE}from'../skills/skill-installer.js';import{fetchGuidesFromCDN,writeGuidesToProject}from'../utils/guides-cdn.js';import{getRulesContent}from'../utils/rules-cdn.js';const __dirname=dirname(fileURLToPath(import.meta.url)),MCP_SERVER_NAME=a4_0x30f68b(0x1b5),MCP_COMMAND=a4_0x30f68b(0x1c6),MCP_ARGS=['@lovrabet/dataset-mcp-server@latest'];export function buildEnvConfig(_0x28dc06,_0x2a6bfc){const _0x343ccf=a4_0x30f68b,_0x551554={'LOVRABET_APP_CODE':String(_0x28dc06)};return _0x2a6bfc!==_0x343ccf(0x1e8)&&(_0x551554[_0x343ccf(0x1ba)]=String(_0x2a6bfc)),_0x551554;}export async function configureCursorMcp(_0x1f6fe7){const _0x22fec4=a4_0x30f68b,_0x387de5=_0x1f6fe7||process['cwd'](),_0xc69d8b=readConfig(_0x387de5),_0x579996=_0xc69d8b[_0x22fec4(0x1e2)]||_0xc69d8b['app'],_0x5a0dd4=_0xc69d8b[_0x22fec4(0x1bc)]||_0x22fec4(0x1e8);if(!_0x579996)return{'ide':_0x22fec4(0x1d8),'status':'error','message':_0x22fec4(0x1c9)};const _0xdf447=buildEnvConfig(_0x579996,_0x5a0dd4),_0x2d6c76={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0xdf447},_0x34fcac=join(_0x387de5,'.cursor','mcp.json'),_0x1c111b=join(_0x387de5,_0x22fec4(0x1d6));try{!existsSync(_0x1c111b)&&mkdirSync(_0x1c111b,{'recursive':!![]});let _0x4e9588={'mcpServers':{}};if(existsSync(_0x34fcac)){const _0x240352=readFileSync(_0x34fcac,'utf-8');_0x4e9588=JSON['parse'](_0x240352);}return(!_0x4e9588['mcpServers']||typeof _0x4e9588[_0x22fec4(0x1e4)]!==_0x22fec4(0x1a1))&&(_0x4e9588['mcpServers']={}),_0x4e9588[_0x22fec4(0x1e4)][MCP_SERVER_NAME]=_0x2d6c76,writeFileSync(_0x34fcac,JSON['stringify'](_0x4e9588,null,0x2),_0x22fec4(0x1dc)),logger[_0x22fec4(0x1b0)](_0x22fec4(0x1bf),_0x22fec4(0x1cd),{'appcode':_0x579996,'env':_0x5a0dd4,'path':_0x34fcac}),await copyCursorRules(_0x1c111b),{'ide':_0x22fec4(0x1d8),'status':_0x22fec4(0x1c0),'message':'已写入\x20.cursor/mcp.json'};}catch(_0x4641e6){return logger['error'](_0x22fec4(0x1bf),'Cursor\x20MCP\x20配置失败',{'error':_0x4641e6 instanceof Error?_0x4641e6[_0x22fec4(0x1e3)]:String(_0x4641e6)}),{'ide':_0x22fec4(0x1d8),'status':_0x22fec4(0x1bd),'message':_0x4641e6 instanceof Error?_0x4641e6[_0x22fec4(0x1e3)]:String(_0x4641e6)};}}export async function configureClaudeMcp(_0x29d169){const _0x59897c=a4_0x30f68b,_0x5d4509=_0x29d169||process['cwd'](),_0x586707=readConfig(_0x5d4509),_0x43c4c9=_0x586707[_0x59897c(0x1e2)]||_0x586707['app'],_0x346ba8=_0x586707['env']||'online';if(!_0x43c4c9)return{'ide':_0x59897c(0x1b3),'status':'error','message':_0x59897c(0x1c9)};let _0x5b0bde='claude\x20mcp\x20add\x20'+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x59897c(0x1c1)]('\x20')+_0x59897c(0x1d4)+_0x43c4c9;return _0x346ba8!=='online'&&(_0x5b0bde+=_0x59897c(0x1a4)+_0x346ba8),await copyAgentsMd(_0x5d4509),logger[_0x59897c(0x1b0)](_0x59897c(0x1bf),_0x59897c(0x1ab),{'command':_0x5b0bde,'appcode':_0x43c4c9,'env':_0x346ba8}),console[_0x59897c(0x1df)](_0x59897c(0x1c7)),console['log']('\x20\x20'+_0x5b0bde+'\x0a'),console[_0x59897c(0x1df)](_0x59897c(0x1c3)),console[_0x59897c(0x1df)](_0x59897c(0x1e6)+_0x43c4c9),_0x346ba8!=='online'&&console[_0x59897c(0x1df)](_0x59897c(0x1dd)+_0x346ba8),console[_0x59897c(0x1df)](_0x59897c(0x1d7)),{'ide':_0x59897c(0x1b3),'status':_0x59897c(0x1a9),'message':_0x59897c(0x1d0)+_0x5b0bde};}export async function showOtherGuide(_0x401001){const _0x4d13e5=a4_0x30f68b,_0x3d1454=_0x401001||process[_0x4d13e5(0x1ad)](),_0x10dd4e=readConfig(_0x3d1454),_0x5107fb=_0x10dd4e[_0x4d13e5(0x1e2)]||_0x10dd4e['app'],_0x48a1d6=_0x10dd4e[_0x4d13e5(0x1bc)]||_0x4d13e5(0x1e8);if(!_0x5107fb)return{'ide':'其他','status':_0x4d13e5(0x1bd),'message':_0x4d13e5(0x1c9)};return console[_0x4d13e5(0x1df)](_0x4d13e5(0x1db)),console[_0x4d13e5(0x1df)]('{'),console[_0x4d13e5(0x1df)]('\x20\x20\x22mcpServers\x22:\x20{'),console['log']('\x20\x20\x20\x20\x22'+MCP_SERVER_NAME+_0x4d13e5(0x1c4)),console['log'](_0x4d13e5(0x1c8)+MCP_COMMAND+'\x22,'),console[_0x4d13e5(0x1df)]('\x20\x20\x20\x20\x20\x20\x22args\x22:\x20['+MCP_ARGS[_0x4d13e5(0x1a6)](_0x13d5c4=>'\x22'+_0x13d5c4+'\x22')[_0x4d13e5(0x1c1)](',\x20')+'],'),console[_0x4d13e5(0x1df)](_0x4d13e5(0x1d2)),console[_0x4d13e5(0x1df)](_0x4d13e5(0x1ec)+_0x5107fb+'\x22,'),_0x48a1d6!==_0x4d13e5(0x1e8)&&console[_0x4d13e5(0x1df)](_0x4d13e5(0x1b1)+_0x48a1d6+'\x22,'),console[_0x4d13e5(0x1df)](_0x4d13e5(0x1b9)),console[_0x4d13e5(0x1df)](_0x4d13e5(0x1d3)),console[_0x4d13e5(0x1df)](_0x4d13e5(0x1d1)),console[_0x4d13e5(0x1df)]('}\x0a'),logger[_0x4d13e5(0x1b0)]('mcp-install','其他\x20IDE\x20配置指引已显示',{'appcode':_0x5107fb,'env':_0x48a1d6}),{'ide':'其他','status':_0x4d13e5(0x1a9),'message':_0x4d13e5(0x1e1)};}export async function configureMcp(_0x568dcb,_0x308a17){const _0x596820=a4_0x30f68b;switch(_0x568dcb){case _0x596820(0x1ae):return await configureCursorMcp(_0x308a17);case _0x596820(0x1ce):return await configureClaudeMcp(_0x308a17);default:throw new Error(_0x596820(0x1ea)+_0x568dcb);}}async function copyCursorRules(_0x3daa21){const _0xa242ec=a4_0x30f68b,_0x4a74bd=join(_0x3daa21,_0xa242ec(0x1be)),_0x5f1370=join(_0x4a74bd,_0xa242ec(0x1e0));if(existsSync(_0x5f1370))return;try{!existsSync(_0x4a74bd)&&mkdirSync(_0x4a74bd,{'recursive':!![]});const _0x3028ad=await getRulesContent();writeFileSync(_0x5f1370,_0x3028ad,_0xa242ec(0x1dc)),logger[_0xa242ec(0x1b0)](_0xa242ec(0x1bf),_0xa242ec(0x1cf),{'to':_0x5f1370});}catch(_0x59ec8d){logger['error']('mcp-install',_0xa242ec(0x1b4),{'error':_0x59ec8d instanceof Error?_0x59ec8d['message']:String(_0x59ec8d)});}}async function copyAgentsMd(_0x188be6){const _0x4aef0d=a4_0x30f68b,_0x4e4ae5=join(_0x188be6,_0x4aef0d(0x1a8));if(existsSync(_0x4e4ae5))return;try{const _0xa48fe8=await getRulesContent();writeFileSync(_0x4e4ae5,_0xa48fe8,_0x4aef0d(0x1dc)),logger[_0x4aef0d(0x1b0)](_0x4aef0d(0x1bf),_0x4aef0d(0x1a5),{'to':_0x4e4ae5});}catch(_0x103aee){logger['error'](_0x4aef0d(0x1bf),'复制\x20agents.md\x20文件失败',{'error':_0x103aee instanceof Error?_0x103aee[_0x4aef0d(0x1e3)]:String(_0x103aee)});}}export const SKILL_IDE_CONFIGS=IDE_CONFIGS;export async function installSkill(_0x2f55f7,_0x4fd1cd){const _0x4cfc9c=a4_0x30f68b,_0x2b3e6e=_0x4fd1cd||process[_0x4cfc9c(0x1ad)](),_0x4a95b2=resolve(__dirname,_0x4cfc9c(0x1ed)),_0x372c5c=SKILL_IDE_CONFIGS[_0x2f55f7];if(!_0x372c5c)return{'ide':_0x2f55f7,'status':_0x4cfc9c(0x1bd),'message':_0x4cfc9c(0x1e5)+_0x2f55f7};const _0x29e354=_0x372c5c['name'];try{let _0x128c24;try{_0x128c24=await fetchGuidesFromCDN();}catch{}const _0xec0d2a=await installSingleIDE(_0x2f55f7,_0x372c5c,_0x2b3e6e,_0x4a95b2,_0x128c24);return _0x128c24&&writeGuidesToProject(_0x128c24,_0x2b3e6e),logger[_0x4cfc9c(0x1b0)]('skill-install',_0x29e354+_0x4cfc9c(0x1da),{'ide':_0x2f55f7,'filesCount':_0xec0d2a}),{'ide':_0x29e354,'status':_0x4cfc9c(0x1c0),'message':_0x4cfc9c(0x1b7)+_0xec0d2a+'\x20项'};}catch(_0x373f14){return logger[_0x4cfc9c(0x1bd)](_0x4cfc9c(0x1b6),_0x29e354+_0x4cfc9c(0x1b2),{'error':_0x373f14 instanceof Error?_0x373f14[_0x4cfc9c(0x1e3)]:String(_0x373f14)}),{'ide':_0x29e354,'status':_0x4cfc9c(0x1bd),'message':_0x373f14 instanceof Error?_0x373f14['message']:String(_0x373f14)};}}async function copyDir(_0x59d756,_0x5bfa24){const _0x583c58=a4_0x30f68b,{statSync:_0x174242}=await import('node:fs'),{readdirSync:_0x511c96}=await import(_0x583c58(0x1aa)),_0x2123f2=_0x174242(_0x59d756);if(_0x2123f2['isDirectory']()){!existsSync(_0x5bfa24)&&mkdirSync(_0x5bfa24,{'recursive':!![]});const _0x3adf7f=_0x511c96(_0x59d756);for(const _0x53568f of _0x3adf7f){await copyDir(join(_0x59d756,_0x53568f),join(_0x5bfa24,_0x53568f));}}else copyFileSync(_0x59d756,_0x5bfa24);}export async function copySharedSkills(_0x55fc11){const _0x58a239=a4_0x30f68b,_0x29e686=_0x55fc11||process[_0x58a239(0x1ad)](),_0x3fba4b=resolve(__dirname,_0x58a239(0x1ed)),_0x286be7=join(_0x3fba4b,_0x58a239(0x1a3)),_0x4e08a1=join(_0x29e686,'.lovrabet/skill/.shared');if(!existsSync(_0x286be7))return![];try{return await copyDir(_0x286be7,_0x4e08a1),logger['info'](_0x58a239(0x1b6),'共享技能文件复制成功',{'path':_0x4e08a1}),!![];}catch(_0x3b3315){return logger[_0x58a239(0x1bd)]('skill-install',_0x58a239(0x1a2),{'error':_0x3b3315 instanceof Error?_0x3b3315['message']:String(_0x3b3315)}),![];}}export function createSkillManifest(_0x2c1d4c,_0x558279){const _0x37bb2c=a4_0x30f68b,_0x37eaa6={'version':_0x37bb2c(0x1ee),'installedAt':new Date()[_0x37bb2c(0x1af)](),'platforms':_0x558279},_0x3704c3=join(_0x2c1d4c,_0x37bb2c(0x1a7)),_0xfba98f=join(_0x2c1d4c,_0x37bb2c(0x1e9));!existsSync(_0xfba98f)&&mkdirSync(_0xfba98f,{'recursive':!![]}),writeFileSync(_0x3704c3,JSON[_0x37bb2c(0x1f0)](_0x37eaa6,null,0x2),_0x37bb2c(0x1dc)),logger['info'](_0x37bb2c(0x1b6),_0x37bb2c(0x1bb),{'path':_0x3704c3});}
|
|
1
|
+
const a4_0x498413=a4_0xb8a0;(function(_0x43fe8b,_0x21d0c2){const _0x28a293=a4_0xb8a0,_0x4e3ef1=_0x43fe8b();while(!![]){try{const _0x542305=parseInt(_0x28a293(0x129))/0x1*(-parseInt(_0x28a293(0x13d))/0x2)+parseInt(_0x28a293(0x14c))/0x3*(-parseInt(_0x28a293(0x14f))/0x4)+parseInt(_0x28a293(0x163))/0x5*(-parseInt(_0x28a293(0x136))/0x6)+-parseInt(_0x28a293(0x127))/0x7*(parseInt(_0x28a293(0x135))/0x8)+parseInt(_0x28a293(0x12c))/0x9+parseInt(_0x28a293(0x11f))/0xa+-parseInt(_0x28a293(0x162))/0xb*(-parseInt(_0x28a293(0x121))/0xc);if(_0x542305===_0x21d0c2)break;else _0x4e3ef1['push'](_0x4e3ef1['shift']());}catch(_0x48f797){_0x4e3ef1['push'](_0x4e3ef1['shift']());}}}(a4_0x2fab,0xd7b08));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{join,resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';import{IDE_CONFIGS}from'../utils/ai_config.js';import{installSingleIDE}from'../skills/skill-installer.js';import{fetchGuidesFromCDN,writeGuidesToProject}from'../utils/guides-cdn.js';import{getRulesContent}from'../utils/rules-cdn.js';import a4_0x107e12 from'../i18n/index.js';const __dirname=dirname(fileURLToPath(import.meta.url)),MCP_SERVER_NAME='lovrabet-dataset',MCP_COMMAND=a4_0x498413(0x120),MCP_ARGS=[a4_0x498413(0x137)];export function buildEnvConfig(_0x3166c1,_0x34d57a){const _0x1ae25f=a4_0x498413,_0x5d1940={'LOVRABET_APP_CODE':String(_0x3166c1)};return _0x34d57a!==_0x1ae25f(0x16e)&&(_0x5d1940[_0x1ae25f(0x11c)]=String(_0x34d57a)),_0x5d1940;}export async function configureCursorMcp(_0x59594f){const _0x3d7a1d=a4_0x498413,_0x598aa2=_0x59594f||process[_0x3d7a1d(0x15c)](),_0x8c3699=readConfig(_0x598aa2),_0x494e3b=_0x8c3699[_0x3d7a1d(0x11e)]||_0x8c3699[_0x3d7a1d(0x15b)],_0x24d5e5=_0x8c3699['env']||_0x3d7a1d(0x16e);if(!_0x494e3b)return{'ide':_0x3d7a1d(0x151),'status':_0x3d7a1d(0x154),'message':a4_0x107e12['t']('aiSetup.error.missingAppcode')};const _0x319b95=buildEnvConfig(_0x494e3b,_0x24d5e5),_0x37df92={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x319b95},_0x20d542=join(_0x598aa2,'.cursor',_0x3d7a1d(0x133)),_0x240d85=join(_0x598aa2,'.cursor');try{!existsSync(_0x240d85)&&mkdirSync(_0x240d85,{'recursive':!![]});let _0x3201c4={'mcpServers':{}};if(existsSync(_0x20d542)){const _0x41a60e=readFileSync(_0x20d542,_0x3d7a1d(0x11d));_0x3201c4=JSON[_0x3d7a1d(0x159)](_0x41a60e);}return(!_0x3201c4[_0x3d7a1d(0x143)]||typeof _0x3201c4[_0x3d7a1d(0x143)]!=='object')&&(_0x3201c4['mcpServers']={}),_0x3201c4[_0x3d7a1d(0x143)][MCP_SERVER_NAME]=_0x37df92,writeFileSync(_0x20d542,JSON[_0x3d7a1d(0x15d)](_0x3201c4,null,0x2),_0x3d7a1d(0x11d)),logger[_0x3d7a1d(0x13b)](_0x3d7a1d(0x13a),a4_0x107e12['t'](_0x3d7a1d(0x14b)),{'appcode':_0x494e3b,'env':_0x24d5e5,'path':_0x20d542}),await copyCursorRules(_0x240d85),{'ide':_0x3d7a1d(0x151),'status':_0x3d7a1d(0x146),'message':a4_0x107e12['t'](_0x3d7a1d(0x12d))};}catch(_0x3265df){return logger[_0x3d7a1d(0x154)]('mcp-install',a4_0x107e12['t'](_0x3d7a1d(0x15e)),{'error':_0x3265df instanceof Error?_0x3265df[_0x3d7a1d(0x126)]:String(_0x3265df)}),{'ide':_0x3d7a1d(0x151),'status':_0x3d7a1d(0x154),'message':_0x3265df instanceof Error?_0x3265df['message']:String(_0x3265df)};}}export async function configureClaudeMcp(_0x375c53){const _0x28c71e=a4_0x498413,_0x397a0e=_0x375c53||process[_0x28c71e(0x15c)](),_0x57e5da=readConfig(_0x397a0e),_0x472f30=_0x57e5da[_0x28c71e(0x11e)]||_0x57e5da['app'],_0x15253b=_0x57e5da[_0x28c71e(0x148)]||_0x28c71e(0x16e);if(!_0x472f30)return{'ide':_0x28c71e(0x16c),'status':_0x28c71e(0x154),'message':a4_0x107e12['t'](_0x28c71e(0x166))};let _0x197293=_0x28c71e(0x12f)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS['join']('\x20')+'\x20-e\x20LOVRABET_APP_CODE='+_0x472f30;return _0x15253b!==_0x28c71e(0x16e)&&(_0x197293+=_0x28c71e(0x13e)+_0x15253b),await copyAgentsMd(_0x397a0e),logger[_0x28c71e(0x13b)](_0x28c71e(0x13a),a4_0x107e12['t'](_0x28c71e(0x16d)),{'command':_0x197293,'appcode':_0x472f30,'env':_0x15253b}),console['log'](a4_0x107e12['t'](_0x28c71e(0x134))),console[_0x28c71e(0x125)]('\x20\x20'+_0x197293+'\x0a'),console[_0x28c71e(0x125)](a4_0x107e12['t'](_0x28c71e(0x131))),console[_0x28c71e(0x125)](_0x28c71e(0x152)+_0x472f30),_0x15253b!==_0x28c71e(0x16e)&&console[_0x28c71e(0x125)](a4_0x107e12['t'](_0x28c71e(0x153),{'env':_0x15253b})),console[_0x28c71e(0x125)](a4_0x107e12['t']('aiSetup.mcp.claude.restartRequired')),{'ide':'Claude\x20Code','status':_0x28c71e(0x15f),'message':a4_0x107e12['t'](_0x28c71e(0x144),{'command':_0x197293})};}export async function showOtherGuide(_0x3ed692){const _0x3065b2=a4_0x498413,_0x24480f=_0x3ed692||process[_0x3065b2(0x15c)](),_0x43d2c5=readConfig(_0x24480f),_0x4fc641=_0x43d2c5[_0x3065b2(0x11e)]||_0x43d2c5[_0x3065b2(0x15b)],_0x9b4a9c=_0x43d2c5[_0x3065b2(0x148)]||_0x3065b2(0x16e);if(!_0x4fc641)return{'ide':a4_0x107e12['t'](_0x3065b2(0x165)),'status':_0x3065b2(0x154),'message':a4_0x107e12['t'](_0x3065b2(0x166))};return console[_0x3065b2(0x125)](a4_0x107e12['t'](_0x3065b2(0x139))),console['log']('{'),console[_0x3065b2(0x125)](_0x3065b2(0x13f)),console[_0x3065b2(0x125)](_0x3065b2(0x128)+MCP_SERVER_NAME+'\x22:\x20{'),console[_0x3065b2(0x125)](_0x3065b2(0x16b)+MCP_COMMAND+'\x22,'),console['log'](_0x3065b2(0x169)+MCP_ARGS[_0x3065b2(0x14a)](_0x1cac38=>'\x22'+_0x1cac38+'\x22')[_0x3065b2(0x140)](',\x20')+'],'),console[_0x3065b2(0x125)](_0x3065b2(0x138)),console[_0x3065b2(0x125)](_0x3065b2(0x12e)+_0x4fc641+'\x22,'),_0x9b4a9c!=='online'&&console[_0x3065b2(0x125)](_0x3065b2(0x161)+_0x9b4a9c+'\x22,'),console[_0x3065b2(0x125)](_0x3065b2(0x124)),console[_0x3065b2(0x125)](_0x3065b2(0x150)),console[_0x3065b2(0x125)](_0x3065b2(0x13c)),console[_0x3065b2(0x125)]('}\x0a'),logger[_0x3065b2(0x13b)]('mcp-install',a4_0x107e12['t'](_0x3065b2(0x14d)),{'appcode':_0x4fc641,'env':_0x9b4a9c}),{'ide':a4_0x107e12['t']('aiSetup.mcp.other.name'),'status':_0x3065b2(0x15f),'message':a4_0x107e12['t'](_0x3065b2(0x14d))};}export async function configureMcp(_0x1aa3e2,_0x256bcf){const _0xd2f5f8=a4_0x498413;switch(_0x1aa3e2){case _0xd2f5f8(0x164):return await configureCursorMcp(_0x256bcf);case'claude':return await configureClaudeMcp(_0x256bcf);default:throw new Error(a4_0x107e12['t'](_0xd2f5f8(0x16a),{'ide':_0x1aa3e2}));}}async function copyCursorRules(_0x110038){const _0x19caaa=a4_0x498413,_0x2c8440=join(_0x110038,_0x19caaa(0x149)),_0x29526e=join(_0x2c8440,_0x19caaa(0x12b));if(existsSync(_0x29526e))return;try{!existsSync(_0x2c8440)&&mkdirSync(_0x2c8440,{'recursive':!![]});const _0x16f749=await getRulesContent();writeFileSync(_0x29526e,_0x16f749,_0x19caaa(0x11d)),logger[_0x19caaa(0x13b)]('mcp-install',a4_0x107e12['t'](_0x19caaa(0x122)),{'to':_0x29526e});}catch(_0x51193d){logger[_0x19caaa(0x154)](_0x19caaa(0x13a),a4_0x107e12['t']('aiSetup.mcp.cursor.rules.copyFailed'),{'error':_0x51193d instanceof Error?_0x51193d[_0x19caaa(0x126)]:String(_0x51193d)});}}function a4_0xb8a0(_0x314228,_0x517161){_0x314228=_0x314228-0x11c;const _0x2fab5f=a4_0x2fab();let _0xb8a0ff=_0x2fab5f[_0x314228];return _0xb8a0ff;}async function copyAgentsMd(_0x1dfa66){const _0x483357=a4_0x498413,_0x30a99e=join(_0x1dfa66,'agents.md');if(existsSync(_0x30a99e))return;try{const _0x324525=await getRulesContent();writeFileSync(_0x30a99e,_0x324525,_0x483357(0x11d)),logger[_0x483357(0x13b)](_0x483357(0x13a),a4_0x107e12['t'](_0x483357(0x167)),{'to':_0x30a99e});}catch(_0x3f4486){logger[_0x483357(0x154)]('mcp-install',a4_0x107e12['t'](_0x483357(0x130)),{'error':_0x3f4486 instanceof Error?_0x3f4486[_0x483357(0x126)]:String(_0x3f4486)});}}export const SKILL_IDE_CONFIGS=IDE_CONFIGS;export async function installSkill(_0x398a08,_0x3049fc){const _0x424efb=a4_0x498413,_0x2dec98=_0x3049fc||process['cwd'](),_0x5668e6=resolve(__dirname,_0x424efb(0x141)),_0x374009=SKILL_IDE_CONFIGS[_0x398a08];if(!_0x374009)return{'ide':_0x398a08,'status':'error','message':a4_0x107e12['t']('aiSetup.skill.unknownIDE',{'ide':_0x398a08})};const _0x24ac8e=_0x374009[_0x424efb(0x142)];try{let _0xc94b11;try{_0xc94b11=await fetchGuidesFromCDN();}catch{}const _0x52bd28=await installSingleIDE(_0x398a08,_0x374009,_0x2dec98,_0x5668e6,_0xc94b11);return _0xc94b11&&writeGuidesToProject(_0xc94b11,_0x2dec98),logger['info'](_0x424efb(0x157),a4_0x107e12['t'](_0x424efb(0x168),{'name':_0x24ac8e}),{'ide':_0x398a08,'filesCount':_0x52bd28}),{'ide':_0x24ac8e,'status':_0x424efb(0x146),'message':a4_0x107e12['t'](_0x424efb(0x12a),{'count':_0x52bd28})};}catch(_0x3f52a8){return logger[_0x424efb(0x154)](_0x424efb(0x157),a4_0x107e12['t'](_0x424efb(0x158),{'name':_0x24ac8e}),{'error':_0x3f52a8 instanceof Error?_0x3f52a8['message']:String(_0x3f52a8)}),{'ide':_0x24ac8e,'status':'error','message':_0x3f52a8 instanceof Error?_0x3f52a8[_0x424efb(0x126)]:String(_0x3f52a8)};}}function a4_0x2fab(){const _0x370ce5=['aiSetup.mcp.cursor.error','manual','.shared','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','44wOcbJn','5620VpEbxK','cursor','aiSetup.mcp.other.name','aiSetup.error.missingAppcode','aiSetup.mcp.claude.agents.created','aiSetup.skill.installSuccess','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','aiSetup.mcp.unsupportedIDE','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','Claude\x20Code','aiSetup.mcp.claude.commandGenerated','online','toISOString','LOVRABET_ENV','utf-8','appcode','2338170CSfXmZ','npx','8832804eQIdBJ','aiSetup.mcp.cursor.rules.created','isDirectory','\x20\x20\x20\x20\x20\x20}','log','message','448UEiMoM','\x20\x20\x20\x20\x22','233610hLfghp','aiSetup.skill.itemsCreated','lovrabet_rules.mdc','2019042fwCRTz','aiSetup.mcp.cursor.written','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','claude\x20mcp\x20add\x20','aiSetup.mcp.claude.agents.copyFailed','aiSetup.mcp.claude.configInfo','aiSetup.skill.manifestCreated','mcp.json','aiSetup.mcp.claude.manualCommand','141352YizYAm','672QrrzSq','@lovrabet/dataset-mcp-server@latest','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','aiSetup.mcp.other.title','mcp-install','info','\x20\x20}','8VAQinD','\x20-e\x20LOVRABET_ENV=','\x20\x20\x22mcpServers\x22:\x20{','join','../../cdn-source/skills','name','mcpServers','aiSetup.mcp.claude.manualExecute','aiSetup.skill.sharedCopied','success','2.0.0','env','rules','map','aiSetup.mcp.cursor.success','983445iQzfbY','aiSetup.mcp.other.guideShown','aiSetup.skill.sharedCopyFailed','4KWuyvN','\x20\x20\x20\x20}','Cursor','\x20\x20AppCode:\x20','aiSetup.mcp.claude.env','error','.lovrabet/skill-manifest.json','node:fs','skill-install','aiSetup.skill.installFailed','parse','.lovrabet','app','cwd','stringify'];a4_0x2fab=function(){return _0x370ce5;};return a4_0x2fab();}async function copyDir(_0x28ea4f,_0x175cfc){const _0x32276c=a4_0x498413,{statSync:_0x1da682}=await import(_0x32276c(0x156)),{readdirSync:_0x230093}=await import(_0x32276c(0x156)),_0x3e397b=_0x1da682(_0x28ea4f);if(_0x3e397b[_0x32276c(0x123)]()){!existsSync(_0x175cfc)&&mkdirSync(_0x175cfc,{'recursive':!![]});const _0x592e6a=_0x230093(_0x28ea4f);for(const _0x236ede of _0x592e6a){await copyDir(join(_0x28ea4f,_0x236ede),join(_0x175cfc,_0x236ede));}}else copyFileSync(_0x28ea4f,_0x175cfc);}export async function copySharedSkills(_0x321abd){const _0x395f84=a4_0x498413,_0x17f128=_0x321abd||process[_0x395f84(0x15c)](),_0x1e47f7=resolve(__dirname,_0x395f84(0x141)),_0x32999d=join(_0x1e47f7,_0x395f84(0x160)),_0x5a52c1=join(_0x17f128,'.lovrabet/skill/.shared');if(!existsSync(_0x32999d))return![];try{return await copyDir(_0x32999d,_0x5a52c1),logger[_0x395f84(0x13b)](_0x395f84(0x157),a4_0x107e12['t'](_0x395f84(0x145)),{'path':_0x5a52c1}),!![];}catch(_0x20affb){return logger[_0x395f84(0x154)](_0x395f84(0x157),a4_0x107e12['t'](_0x395f84(0x14e)),{'error':_0x20affb instanceof Error?_0x20affb[_0x395f84(0x126)]:String(_0x20affb)}),![];}}export function createSkillManifest(_0x3713ea,_0x1bcac5){const _0x4d64d0=a4_0x498413,_0x349d2d={'version':_0x4d64d0(0x147),'installedAt':new Date()[_0x4d64d0(0x16f)](),'platforms':_0x1bcac5},_0x47e2d3=join(_0x3713ea,_0x4d64d0(0x155)),_0x16d749=join(_0x3713ea,_0x4d64d0(0x15a));!existsSync(_0x16d749)&&mkdirSync(_0x16d749,{'recursive':!![]}),writeFileSync(_0x47e2d3,JSON[_0x4d64d0(0x15d)](_0x349d2d,null,0x2),'utf-8'),logger['info'](_0x4d64d0(0x157),a4_0x107e12['t'](_0x4d64d0(0x132)),{'path':_0x47e2d3});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x37ec09,_0x1fe690){const _0x5398e8=a5_0x77e2,_0x1a4c7d=_0x37ec09();while(!![]){try{const _0x77d3eb=-parseInt(_0x5398e8(0xca))/0x1*(parseInt(_0x5398e8(0xee))/0x2)+parseInt(_0x5398e8(0xdc))/0x3+-parseInt(_0x5398e8(0xef))/0x4+parseInt(_0x5398e8(0xfa))/0x5*(-parseInt(_0x5398e8(0xd1))/0x6)+parseInt(_0x5398e8(0xf4))/0x7*(-parseInt(_0x5398e8(0xfb))/0x8)+-parseInt(_0x5398e8(0xe4))/0x9+parseInt(_0x5398e8(0xcb))/0xa;if(_0x77d3eb===_0x1fe690)break;else _0x1a4c7d['push'](_0x1a4c7d['shift']());}catch(_0x288bbe){_0x1a4c7d['push'](_0x1a4c7d['shift']());}}}(a5_0x3823,0x3145f));import{jsx as a5_0x22d190,jsxs as a5_0x51e3b1,Fragment as a5_0x289d1e}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a5_0x77e2(_0x21059e,_0x1979ff){_0x21059e=_0x21059e-0xca;const _0x38233d=a5_0x3823();let _0x77e2de=_0x38233d[_0x21059e];return _0x77e2de;}import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';import{useI18n}from'../i18n/hooks.js';function a5_0x3823(){const _0x1be931=['column','api.common.usingDefaultAppCode','length','api.docUI.datasetsNotFound','cyan','yellow','./docs','string','includes','310944vHrrMC','filePath','dim','success','filter','error','api.common.noAppCodeDefault','🚀\x20','1179810hstqdU','green','expired','setLogPath','message','api.docUI.docComplete','join','api.docUI.generatedDocs','api.docUI.outputDir','文档生成完成','2qtJDMg','673824rdvXsF','api.docUI.docFailed','white','datasetCode','api.docUI.generatingDocs','229397iasAPO','datasetName','api.docUI.generatingFile','\x1b[33m','api.common.authRetry','\x20-\x20','40ubniqf','32NvqvKl','map','api.docUI.fetchingDatasets','api.docUI.filteredDatasets','api.docUI.docGenerateFailed','env','gray','191951peNZtE','10652600gYlsQr','cwd','api.common.usingSpecifiedAppCode','\x1b[90m','online','\x1b[0m','258378UOpqjN','api.docUI.noDatasets'];a5_0x3823=function(){return _0x1be931;};return a5_0x3823();}export const ApiDocUI=({appCode:_0x34e32f,env:_0x14c09c,output:_0x27ef49,extraParams:_0xf9b257,datasetCodes:_0x9afafa})=>{const _0x1c2f99=a5_0x77e2,{exit:_0x156b01}=useApp(),{t:_0x4b4104}=useI18n(),[_0x279ca5,_0x3daf97]=useState(![]),[_0x861a34,_0x2238a1]=useState(''),[_0x401c86,_0x20b8c8]=useState(![]),[_0x17e7d3,_0x3abc43]=useState(null),[_0x109754,_0x2b773d]=useState(null),[_0x28e2f1,_0x2d16b8]=useState(0x0),_0x4255c3=readConfig(),_0x3cca8f=getConfigAppCode(),_0x36b9ee=_0x34e32f||_0x3cca8f,_0x39453a=typeof _0x4255c3?.[_0x1c2f99(0x100)]===_0x1c2f99(0xda)?_0x4255c3[_0x1c2f99(0x100)]:undefined,_0x5e4617=_0x14c09c||_0x39453a||_0x1c2f99(0xcf);initEnv(_0x5e4617);const _0x1d52d4=_0x27ef49||_0x1c2f99(0xd9),_0x322127=_0x34e32f?_0x4b4104(_0x1c2f99(0xcd),{'appCode':_0x36b9ee}):_0x4b4104(_0x1c2f99(0xd4),{'appCode':_0x36b9ee});useEffect(()=>{_0x3daf97(!![]),_0x1bc664();},[]),useEffect(()=>{(_0x401c86||_0x17e7d3)&&_0x156b01();},[_0x401c86,_0x17e7d3,_0x156b01]);async function _0x1bc664(){const _0x58e558=_0x1c2f99;if(!_0x36b9ee){_0x3abc43(_0x4b4104(_0x58e558(0xe2)));return;}try{logger[_0x58e558(0xe7)](process[_0x58e558(0xcc)]()),_0x2238a1(_0x4b4104(_0x58e558(0xfd)));const {configArray:_0x43736b}=await fetchModelList(_0x36b9ee);_0x2d16b8(_0x43736b[_0x58e558(0xd5)]);if(_0x43736b['length']===0x0){_0x3abc43(_0x4b4104(_0x58e558(0xd2)));return;}let _0x508288=_0x43736b;if(_0x9afafa&&_0x9afafa['length']>0x0){_0x508288=_0x43736b['filter'](_0x46c3fc=>_0x9afafa[_0x58e558(0xdb)](_0x46c3fc[_0x58e558(0xf2)]));const _0x5acf8f=_0x508288[_0x58e558(0xfc)](_0x30af0c=>_0x30af0c[_0x58e558(0xf2)]),_0x20b15b=_0x9afafa[_0x58e558(0xe0)](_0x218c05=>!_0x5acf8f[_0x58e558(0xdb)](_0x218c05));_0x20b15b[_0x58e558(0xd5)]>0x0&&console['log'](_0x58e558(0xf7)+_0x4b4104(_0x58e558(0xd6),{'codes':_0x20b15b[_0x58e558(0xea)](',\x20')})+_0x58e558(0xd0));if(_0x508288[_0x58e558(0xd5)]===0x0){_0x3abc43(_0x4b4104('api.docUI.allDatasetsNotFound',{'codes':_0x9afafa[_0x58e558(0xea)](',\x20')}));return;}console['log'](_0x58e558(0xce)+_0x4b4104(_0x58e558(0xfe),{'total':_0x43736b['length'],'count':_0x508288[_0x58e558(0xd5)]})+'\x1b[0m');}_0x2238a1(_0x4b4104(_0x58e558(0xf3),{'count':_0x508288[_0x58e558(0xd5)]}));const _0x316912=await generateDatasetDocs(_0x508288,_0x36b9ee,_0x1d52d4,(_0x396ce5,_0x3e6caa,_0x1ad527)=>{const _0x3b1c6b=_0x58e558;_0x2238a1(_0x4b4104(_0x3b1c6b(0xf6),{'fileName':_0x1ad527,'current':_0x396ce5,'total':_0x3e6caa}));},_0xf9b257);_0x2b773d(_0x316912),_0x20b8c8(!![]);const _0x18d8f2=_0x316912[_0x58e558(0xe0)](_0x44757a=>_0x44757a[_0x58e558(0xdf)])[_0x58e558(0xd5)],_0x18352e=_0x316912[_0x58e558(0xe0)](_0x42996f=>!_0x42996f[_0x58e558(0xdf)])[_0x58e558(0xd5)];logger[_0x58e558(0xdf)]('api-doc',_0x58e558(0xed),undefined,{'totalCount':_0x316912[_0x58e558(0xd5)],'successCount':_0x18d8f2,'failCount':_0x18352e,'outputDir':_0x1d52d4});}catch(_0x8510fe){const _0x30e70a=_0x8510fe instanceof Error?_0x8510fe[_0x58e558(0xe8)]:String(_0x8510fe);logger[_0x58e558(0xe1)]('api-doc','文档生成失败:\x20'+_0x30e70a,{'appCode':_0x36b9ee,'outputDir':_0x1d52d4}),_0x3abc43(_0x4b4104(_0x58e558(0xff),{'error':_0x30e70a}));}finally{_0x3daf97(![]);}}const _0x4cf2e6=_0x109754?.['filter'](_0x1699c0=>_0x1699c0['success'])[_0x1c2f99(0xd5)]||0x0,_0x31423b=_0x109754?.['filter'](_0x15f284=>!_0x15f284[_0x1c2f99(0xdf)])[_0x1c2f99(0xd5)]||0x0;return a5_0x51e3b1(Box,{'flexDirection':_0x1c2f99(0xd3),'children':[(_0x279ca5||_0x401c86)&&a5_0x51e3b1(Box,{'children':[a5_0x22d190(Text,{'color':_0x1c2f99(0x101),'children':'*\x20'}),a5_0x22d190(Text,{'color':_0x34e32f?_0x1c2f99(0xf1):_0x1c2f99(0xde),'children':_0x322127})]}),_0x279ca5&&a5_0x22d190(Box,{'children':a5_0x51e3b1(Text,{'children':[_0x1c2f99(0xe3),_0x861a34]})}),_0x401c86&&_0x109754&&a5_0x51e3b1(Box,{'flexDirection':'column','children':[a5_0x22d190(Box,{'children':a5_0x51e3b1(Text,{'color':_0x1c2f99(0xe5),'children':[_0x4b4104(_0x1c2f99(0xe9),{'successCount':_0x4cf2e6}),_0x31423b>0x0?_0x4b4104(_0x1c2f99(0xf0),{'failCount':_0x31423b}):'']})}),a5_0x22d190(Box,{'marginTop':0x1,'children':a5_0x22d190(Text,{'color':'gray','children':_0x4b4104('api.docUI.processedDatasets',{'count':_0x28e2f1})})}),a5_0x51e3b1(Box,{'marginTop':0x1,'children':[a5_0x22d190(Text,{'color':'gray','children':_0x4b4104(_0x1c2f99(0xec))}),a5_0x22d190(Text,{'color':_0x1c2f99(0xd7),'children':_0x1d52d4})]}),_0x4cf2e6>0x0&&a5_0x51e3b1(a5_0x289d1e,{'children':[a5_0x22d190(Box,{'marginTop':0x1,'children':a5_0x22d190(Text,{'color':_0x1c2f99(0x101),'children':_0x4b4104(_0x1c2f99(0xeb))})}),_0x109754['filter'](_0x3ecb25=>_0x3ecb25[_0x1c2f99(0xdf)])['map']((_0x270c77,_0x5edaed)=>a5_0x51e3b1(Box,{'marginLeft':0x2,'children':[a5_0x51e3b1(Text,{'color':'cyan','children':['•\x20',_0x270c77[_0x1c2f99(0xdd)]]}),a5_0x51e3b1(Text,{'color':_0x1c2f99(0xde),'children':[_0x1c2f99(0xf9),_0x270c77[_0x1c2f99(0xf5)]]})]},_0x5edaed))]}),_0x31423b>0x0&&a5_0x51e3b1(a5_0x289d1e,{'children':[a5_0x22d190(Box,{'marginTop':0x1,'children':a5_0x22d190(Text,{'color':'yellow','children':_0x4b4104('api.docUI.failedDatasets')})}),_0x109754[_0x1c2f99(0xe0)](_0x223bd1=>!_0x223bd1['success'])[_0x1c2f99(0xfc)]((_0x5a15e3,_0x47becc)=>a5_0x51e3b1(Box,{'marginLeft':0x2,'flexDirection':_0x1c2f99(0xd3),'children':[a5_0x51e3b1(Text,{'color':'red','children':['•\x20',_0x5a15e3[_0x1c2f99(0xf5)],'\x20(',_0x5a15e3[_0x1c2f99(0xf2)],')']}),_0x5a15e3[_0x1c2f99(0xe1)]&&a5_0x22d190(Box,{'marginLeft':0x2,'children':a5_0x22d190(Text,{'color':_0x1c2f99(0xde),'children':_0x5a15e3['error']})})]},_0x47becc))]})]}),_0x17e7d3&&a5_0x51e3b1(Box,{'flexDirection':_0x1c2f99(0xd3),'children':[a5_0x22d190(Box,{'children':a5_0x51e3b1(Text,{'color':'red','children':['❌\x20',_0x17e7d3]})}),(_0x17e7d3[_0x1c2f99(0xdb)]('登录')||_0x17e7d3['includes']('Authentication')||_0x17e7d3['includes'](_0x1c2f99(0xe6)))&&a5_0x51e3b1(Box,{'marginTop':0x1,'children':[a5_0x22d190(Text,{'color':_0x1c2f99(0xd8),'children':'💡\x20'}),a5_0x22d190(Text,{'color':_0x1c2f99(0xd7),'children':'lovrabet\x20auth'}),a5_0x51e3b1(Text,{'color':_0x1c2f99(0xd8),'children':['\x20',_0x4b4104(_0x1c2f99(0xf8))]})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a6_0x28689e=a6_0x2ab5;(function(_0x587411,_0x117333){const _0x35dd49=a6_0x2ab5,_0x4d2ff4=_0x587411();while(!![]){try{const _0x30556f=-parseInt(_0x35dd49(0x1b8))/0x1+-parseInt(_0x35dd49(0x1a0))/0x2+parseInt(_0x35dd49(0x19d))/0x3+parseInt(_0x35dd49(0x1a4))/0x4*(-parseInt(_0x35dd49(0x1b7))/0x5)+-parseInt(_0x35dd49(0x1b5))/0x6*(parseInt(_0x35dd49(0x1a8))/0x7)+-parseInt(_0x35dd49(0x198))/0x8*(-parseInt(_0x35dd49(0x1ae))/0x9)+parseInt(_0x35dd49(0x1a3))/0xa;if(_0x30556f===_0x117333)break;else _0x4d2ff4['push'](_0x4d2ff4['shift']());}catch(_0x5f278a){_0x4d2ff4['push'](_0x4d2ff4['shift']());}}}(a6_0x4f0f,0x2e4cc));import{mkdirSync,writeFileSync}from'node:fs';import a6_0x5f3245 from'node:path';function a6_0x2ab5(_0x4cc55b,_0x1c4352){_0x4cc55b=_0x4cc55b-0x197;const _0x4f0f53=a6_0x4f0f();let _0x2ab53a=_0x4f0f53[_0x4cc55b];return _0x2ab53a;}import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import a6_0xf62a26 from'../i18n/index.js';const t=a6_0xf62a26['t'][a6_0x28689e(0x19a)](a6_0xf62a26);export async function fetchDatasetDoc(_0x5b022c){const _0x260ffa=a6_0x28689e,{appCode:_0x51db13,datasetCode:_0x27c3b8,datasetId:_0x488ac1,extraParams:_0x38ed02}=_0x5b022c,_0x417eaa=getApiDomain(),_0x3a2b5c=_0x417eaa+'/api/node-toolbox/api-doc-generator',_0x49f364={'appCode':_0x51db13,'datasetCode':_0x27c3b8,'datasetId':_0x488ac1,..._0x38ed02||{}},_0x1cf652=await fetch(_0x3a2b5c,{'method':'POST','headers':{'Content-Type':_0x260ffa(0x19c),'Cookie':getCookie()},'body':JSON['stringify'](_0x49f364)});if(!_0x1cf652['ok']){if(_0x1cf652[_0x260ffa(0x1b4)]===0x191)throw new Error(t(_0x260ffa(0x1ab)));let _0x4e9f4f='';try{_0x4e9f4f=await _0x1cf652['text']();}catch(_0x16f15e){}throw new Error(''+t(_0x260ffa(0x1a9),{'datasetCode':_0x27c3b8,'status':_0x1cf652[_0x260ffa(0x1b4)]})+(_0x4e9f4f?'\x0a'+_0x4e9f4f:''));}const _0x7a392c=await _0x1cf652[_0x260ffa(0x197)]();if(!_0x7a392c[_0x260ffa(0x1b2)]||typeof _0x7a392c[_0x260ffa(0x1b2)][_0x260ffa(0x1a6)]!=='string')throw new Error(t(_0x260ffa(0x1a2),{'datasetCode':_0x27c3b8}));return _0x7a392c['data'][_0x260ffa(0x1a6)];}function delay(_0x2f5a3b){return new Promise(_0xc0478f=>setTimeout(_0xc0478f,_0x2f5a3b));}export async function generateDatasetDocs(_0x3e5878,_0x28bfcb,_0x3990f6=a6_0x28689e(0x19b),_0x53512c,_0x437cc9){const _0x9c4126=a6_0x28689e;mkdirSync(_0x3990f6,{'recursive':!![]});const _0x3b4283=[],_0xed791c=_0x3e5878[_0x9c4126(0x19e)];console[_0x9c4126(0x1af)](t('api.docBatch.totalDatasets',{'count':_0xed791c}));for(let _0x100b18=0x0;_0x100b18<_0x3e5878[_0x9c4126(0x19e)];_0x100b18++){const _0xee6bf2=_0x3e5878[_0x100b18],_0x23e008=_0x100b18+0x1,_0x2fbab6=_0xee6bf2[_0x9c4126(0x1a5)];try{console[_0x9c4126(0x1af)](t('api.docBatch.generating',{'current':_0x23e008,'total':_0xed791c,'fileName':_0x2fbab6,'name':_0xee6bf2[_0x9c4126(0x1b6)]}));_0x53512c&&_0x53512c(_0x23e008,_0xed791c,_0x2fbab6);const _0x2870c3=await fetchDatasetDoc({'appCode':_0x28bfcb,'datasetCode':_0xee6bf2[_0x9c4126(0x1ac)],'datasetId':_0xee6bf2['id'],'enableAI':![],'extraParams':_0x437cc9}),_0x596231=a6_0x5f3245[_0x9c4126(0x1a1)](_0x3990f6,_0x2fbab6+'.md');writeFileSync(_0x596231,_0x2870c3,{'encoding':'utf8'}),console[_0x9c4126(0x1af)](t('api.docBatch.success',{'fileName':_0x2fbab6})),logger[_0x9c4126(0x1b0)](_0x9c4126(0x1ad),_0x9c4126(0x1a7)+_0x2fbab6,undefined,{'datasetCode':_0xee6bf2[_0x9c4126(0x1ac)],'datasetName':_0xee6bf2['name'],'filePath':_0x596231,'progress':_0x23e008+'/'+_0xed791c}),_0x3b4283['push']({'datasetCode':_0xee6bf2[_0x9c4126(0x1ac)],'datasetName':_0xee6bf2['name'],'filePath':_0x596231,'success':!![]}),_0x23e008<_0xed791c&&await delay(0x1388);}catch(_0x5c11d1){const _0x274d77=_0x5c11d1 instanceof Error?_0x5c11d1[_0x9c4126(0x1b1)]:String(_0x5c11d1);console[_0x9c4126(0x1af)](t(_0x9c4126(0x1b3),{'fileName':_0x2fbab6,'error':_0x274d77})),logger[_0x9c4126(0x19f)](_0x9c4126(0x1ad),_0x9c4126(0x199)+_0xee6bf2[_0x9c4126(0x1ac)],{'datasetCode':_0xee6bf2[_0x9c4126(0x1ac)],'datasetName':_0xee6bf2[_0x9c4126(0x1b6)],'error':_0x274d77,'progress':_0x23e008+'/'+_0xed791c}),_0x3b4283[_0x9c4126(0x1aa)]({'datasetCode':_0xee6bf2[_0x9c4126(0x1ac)],'datasetName':_0xee6bf2[_0x9c4126(0x1b6)],'filePath':'','success':![],'error':_0x274d77}),_0x23e008<_0xed791c&&(console[_0x9c4126(0x1af)](t('api.docBatch.waiting')),await delay(0xbb8));}}return _0x3b4283;}function a6_0x4f0f(){const _0x25d83b=['515706MQjCAl','join','api.docBatch.docFormatError','5372480xCGlml','4308sApdza','tableName','markdown','生成文档成功:\x20','19341BwBSga','api.docBatch.httpError','push','api.common.authExpired','datasetCode','api-doc','461079iaAKqc','log','success','message','data','api.docBatch.failed','status','588jNyYXm','name','1285IfyeSW','38402HlmKvt','json','24SoTpaA','生成文档失败:\x20','bind','./docs','application/json','1027563MzIAAQ','length','error'];a6_0x4f0f=function(){return _0x25d83b;};return a6_0x4f0f();}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a7_0x30d0(){const _0x2efe64=['originalCount','join','4375482HPtNmA','api','api.pullUI.fetching','.ts','error','-client','api.pullUI.modelFile','message','duplicateCount','6094305TYxlpF','api.pullUI.duplicateInfo','api.pullUI.importHint','api.pullUI.successPull','428589PCVjoB','split','gray','import\x20','api.common.usingSpecifiedAppCode','27492ZfvPRM','cyan','string','datasetCount','client','api.common.noAppCodeDefault','api.common.usingDefaultAppCode','14408UuFixs','setLogPath','870564vemKYN','\x20from\x20\x27@/','1205Aizlhu','env','Authentication','green','modelCount','includes','-api','yellow','online','replace','expired','api.pullUI.pullFailed','column','api.pullUI.clientFile','40sSeggt','slice','api.pullUI.generatedFiles','1515032oYmIjh'];a7_0x30d0=function(){return _0x2efe64;};return a7_0x30d0();}(function(_0x31d94c,_0x1c5ec9){const _0x4f417f=a7_0x4e4b,_0xc9a84f=_0x31d94c();while(!![]){try{const _0x13c846=-parseInt(_0x4f417f(0x16d))/0x1+-parseInt(_0x4f417f(0x158))/0x2+parseInt(_0x4f417f(0x176))/0x3+-parseInt(_0x4f417f(0x174))/0x4*(parseInt(_0x4f417f(0x178))/0x5)+parseInt(_0x4f417f(0x15b))/0x6+parseInt(_0x4f417f(0x164))/0x7+parseInt(_0x4f417f(0x155))/0x8*(parseInt(_0x4f417f(0x168))/0x9);if(_0x13c846===_0x1c5ec9)break;else _0xc9a84f['push'](_0xc9a84f['shift']());}catch(_0x3cd375){_0xc9a84f['push'](_0xc9a84f['shift']());}}}(a7_0x30d0,0x73fb9));import{jsx as a7_0x55c71b,jsxs as a7_0x1fa83c}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';import{useI18n}from'../i18n/hooks.js';function a7_0x4e4b(_0x2beea1,_0x42636a){_0x2beea1=_0x2beea1-0x153;const _0x30d0b8=a7_0x30d0();let _0x4e4bab=_0x30d0b8[_0x2beea1];return _0x4e4bab;}export const ApiPullUI=({appCode:_0x155aee,env:_0x34fbd7,output:_0x4f8d62})=>{const _0x2d1a53=a7_0x4e4b,{exit:_0x13b534}=useApp(),{t:_0x14213e}=useI18n(),[_0x391e42,_0x470d29]=useState(![]),[_0x297a1c,_0x2a3b3e]=useState(![]),[_0x45b291,_0x4eeadc]=useState(null),[_0x383af7,_0x3b8010]=useState(null),_0xf3512=readConfig(),_0x296f8f=getConfigAppCode(),_0x98b4c3=_0x155aee||_0x296f8f,_0x13abcb=typeof _0xf3512?.[_0x2d1a53(0x179)]===_0x2d1a53(0x16f)?_0xf3512[_0x2d1a53(0x179)]:undefined,_0x44701a=_0x34fbd7||_0x13abcb||_0x2d1a53(0x180);initEnv(_0x44701a);const _0x47f183=_0x4f8d62||'./src/api/',_0x47e356=_0x155aee&&_0x155aee[_0x2d1a53(0x17d)]('-')?_0x155aee[_0x2d1a53(0x169)]('-')[_0x2d1a53(0x156)](0x1)[_0x2d1a53(0x15a)]('-'):'',_0x90c0bd=_0x155aee?_0x14213e(_0x2d1a53(0x16c),{'appCode':_0x98b4c3}):_0x14213e(_0x2d1a53(0x173),{'appCode':_0x98b4c3}),_0x8c4251=_0x47e356?_0x47e356+_0x2d1a53(0x17e):_0x2d1a53(0x15c),_0x20c006=_0x47e356?_0x47e356+_0x2d1a53(0x160):'client';useEffect(()=>{_0x470d29(!![]),_0x2df911();},[]),useEffect(()=>{(_0x297a1c||_0x45b291)&&_0x13b534();},[_0x297a1c,_0x45b291,_0x13b534]);async function _0x2df911(){const _0x478719=_0x2d1a53;if(!_0x98b4c3){_0x4eeadc(_0x14213e(_0x478719(0x172)));return;}try{logger[_0x478719(0x175)](process['cwd']());const {configArray:_0x53d137}=await fetchModelList(_0x98b4c3),_0x38be34=_0x53d137['length'],_0x187f9a=!_0x155aee,_0x399490=await generateApiFile(_0x53d137,_0x47e356,_0x98b4c3,_0x187f9a,_0x44701a,_0x47f183),_0x2db1df=_0x47f183['endsWith']('/')?_0x47f183:_0x47f183+'/';_0x3b8010({'api':''+_0x2db1df+_0x8c4251+_0x478719(0x15e),'client':''+_0x2db1df+_0x20c006+_0x478719(0x15e),'modelCount':_0x399490[_0x478719(0x17c)],'datasetCount':_0x38be34,'originalCount':_0x38be34,'duplicateCount':0x0}),_0x2a3b3e(!![]);}catch(_0x269d16){const _0x20bd8b=_0x269d16 instanceof Error?_0x269d16[_0x478719(0x162)]:String(_0x269d16);logger[_0x478719(0x15f)]('api-pull','拉取\x20API\x20配置失败:\x20'+_0x20bd8b,{'appCode':_0x98b4c3,'error':_0x20bd8b}),_0x4eeadc(_0x14213e(_0x478719(0x183),{'error':_0x20bd8b}));}finally{_0x470d29(![]);}}return a7_0x1fa83c(Box,{'flexDirection':_0x2d1a53(0x153),'children':[(_0x391e42||_0x297a1c)&&a7_0x1fa83c(Box,{'children':[a7_0x55c71b(Text,{'color':_0x2d1a53(0x16a),'children':'*\x20'}),a7_0x55c71b(Text,{'color':_0x155aee?'white':'dim','children':_0x90c0bd})]}),_0x391e42&&a7_0x55c71b(Box,{'children':a7_0x55c71b(Text,{'children':_0x14213e(_0x2d1a53(0x15d),{'env':_0x44701a})})}),_0x297a1c&&_0x383af7&&a7_0x1fa83c(Box,{'flexDirection':_0x2d1a53(0x153),'children':[a7_0x55c71b(Box,{'children':a7_0x55c71b(Text,{'color':_0x2d1a53(0x17b),'children':_0x14213e(_0x2d1a53(0x167),{'datasetCount':_0x383af7[_0x2d1a53(0x170)],'modelCount':_0x383af7[_0x2d1a53(0x17c)]})})}),_0x383af7[_0x2d1a53(0x163)]>0x0&&a7_0x55c71b(Box,{'marginTop':0x1,'children':a7_0x55c71b(Text,{'color':'yellow','children':_0x14213e(_0x2d1a53(0x165),{'originalCount':_0x383af7[_0x2d1a53(0x159)],'duplicateCount':_0x383af7['duplicateCount']})})}),a7_0x55c71b(Box,{'marginTop':0x1,'children':a7_0x55c71b(Text,{'color':_0x2d1a53(0x16a),'children':_0x14213e(_0x2d1a53(0x157))})}),a7_0x1fa83c(Box,{'marginLeft':0x2,'children':[a7_0x1fa83c(Text,{'color':_0x2d1a53(0x16e),'children':['•\x20',_0x383af7[_0x2d1a53(0x15c)]]}),a7_0x1fa83c(Text,{'color':'dim','children':['\x20',_0x14213e(_0x2d1a53(0x161),{'count':_0x383af7['modelCount']})]})]}),a7_0x1fa83c(Box,{'marginLeft':0x2,'children':[a7_0x1fa83c(Text,{'color':_0x2d1a53(0x16e),'children':['•\x20',_0x383af7[_0x2d1a53(0x171)]]}),a7_0x1fa83c(Text,{'color':'dim','children':['\x20',_0x14213e(_0x2d1a53(0x154))]})]}),a7_0x55c71b(Box,{'marginTop':0x1,'children':a7_0x55c71b(Text,{'color':_0x2d1a53(0x16a),'children':_0x14213e(_0x2d1a53(0x166))})}),a7_0x55c71b(Box,{'marginLeft':0x2,'children':a7_0x1fa83c(Text,{'color':_0x2d1a53(0x17f),'children':[_0x2d1a53(0x16b),'{\x20lovrabetClient\x20}',_0x2d1a53(0x177),_0x383af7[_0x2d1a53(0x171)]['replace'](/^\.\//,'')[_0x2d1a53(0x181)](_0x2d1a53(0x15e),''),'\x27']})})]}),_0x45b291&&a7_0x1fa83c(Box,{'flexDirection':'column','children':[a7_0x55c71b(Box,{'children':a7_0x1fa83c(Text,{'color':'red','children':['❌\x20',_0x45b291]})}),(_0x45b291['includes']('登录')||_0x45b291['includes'](_0x2d1a53(0x17a))||_0x45b291[_0x2d1a53(0x17d)](_0x2d1a53(0x182)))&&a7_0x1fa83c(Box,{'marginTop':0x1,'children':[a7_0x55c71b(Text,{'color':_0x2d1a53(0x17f),'children':'💡\x20'}),a7_0x55c71b(Text,{'color':'cyan','children':'lovrabet\x20auth'}),a7_0x1fa83c(Text,{'color':_0x2d1a53(0x17f),'children':['\x20',_0x14213e('api.common.authRetry')]})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x33751f,_0x35bec0){const _0x1d6a5e=a8_0x51c4,_0x11a12e=_0x33751f();while(!![]){try{const _0x57bd8b=-parseInt(_0x1d6a5e(0x94))/0x1*(parseInt(_0x1d6a5e(0x98))/0x2)+parseInt(_0x1d6a5e(0x93))/0x3+parseInt(_0x1d6a5e(0x80))/0x4+-parseInt(_0x1d6a5e(0x88))/0x5*(parseInt(_0x1d6a5e(0x82))/0x6)+parseInt(_0x1d6a5e(0x95))/0x7*(parseInt(_0x1d6a5e(0x85))/0x8)+parseInt(_0x1d6a5e(0x92))/0x9*(-parseInt(_0x1d6a5e(0x9a))/0xa)+-parseInt(_0x1d6a5e(0x91))/0xb*(-parseInt(_0x1d6a5e(0x8a))/0xc);if(_0x57bd8b===_0x35bec0)break;else _0x11a12e['push'](_0x11a12e['shift']());}catch(_0x15d40e){_0x11a12e['push'](_0x11a12e['shift']());}}}(a8_0x4684,0xf008a));import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';function a8_0x51c4(_0x3b82b5,_0x40b839){_0x3b82b5=_0x3b82b5-0x7f;const _0x468421=a8_0x4684();let _0x51c4ff=_0x468421[_0x3b82b5];return _0x51c4ff;}function a8_0x4684(){const _0x1cf98c=['error','正在从服务器拉取模型列表...\x20(环境:\x20','34MmYZjv','UNAUTHORIZED','10ppUFhc','errorMsg','errorMessage','map','replace','Unauthorized','info','errorCode','configArray','2702288MjeIgh','code','6DQayRg','api.common.authExpired','length','14048gxAUmA','api.fetchModel.httpError','&otype=array','6921190KrFQWg','status','99672ullUAf','name','includes','data','401','json','api.common.unknownError','2497YWuyiK','3630726CCuqkp','3466407uQlVQy','84137qGEbnh','1932RldwiT'];a8_0x4684=function(){return _0x1cf98c;};return a8_0x4684();}import a8_0x377a69 from'../i18n/index.js';const t=a8_0x377a69['t']['bind'](a8_0x377a69);function cleanNewlines(_0x8fd600){const _0x5f4761=a8_0x51c4;return _0x8fd600[_0x5f4761(0x9e)](/[\r\n]+/g,'\x20')['trim']();}function cleanDatasetName(_0x2f562a){const _0x3a49c1=a8_0x51c4;if(!_0x2f562a[_0x3a49c1(0x8b)])return _0x2f562a;return{..._0x2f562a,'name':cleanNewlines(_0x2f562a[_0x3a49c1(0x8b)])};}function cleanDatasetNames(_0x3c028d){const _0x221c7c=a8_0x51c4;return _0x3c028d[_0x221c7c(0x9d)](cleanDatasetName);}export async function fetchModelList(_0x22717e){const _0xb69103=a8_0x51c4,_0xbc97bc=getEnv(),_0x2f0201=getApiDomain()+'/api/node-toolbox/dataset/model-list?appcode='+_0x22717e+_0xb69103(0x87);logger[_0xb69103(0xa0)]('fetch-model-list',_0xb69103(0x97)+_0xbc97bc+')',{'apiUrl':_0x2f0201});const _0x2c440e=await fetch(_0x2f0201,{'headers':{'Cookie':getCookie()}});if(!_0x2c440e['ok']){if(_0x2c440e['status']===0x191)throw new Error(t('api.common.authExpired'));throw new Error(t(_0xb69103(0x86),{'status':_0x2c440e[_0xb69103(0x89)]}));}const _0x361da9=await _0x2c440e[_0xb69103(0x8f)]();if(!_0x361da9['success']){const _0x1ae6bd=_0x361da9[_0xb69103(0x9b)]||_0x361da9['message']||_0x361da9[_0xb69103(0x8d)]?.['message']||_0x361da9[_0xb69103(0x9c)]||_0x361da9[_0xb69103(0x96)]||t(_0xb69103(0x90));if(_0x1ae6bd[_0xb69103(0x8c)](_0xb69103(0x8e))||_0x1ae6bd['includes'](_0xb69103(0x9f))||_0x1ae6bd[_0xb69103(0x8c)]('登录')||_0x1ae6bd[_0xb69103(0x8c)]('认证')||_0x361da9[_0xb69103(0xa1)]===_0xb69103(0x99)||_0x361da9[_0xb69103(0x81)]===0x191||_0x361da9[_0xb69103(0x81)]===_0xb69103(0x8e))throw new Error(t(_0xb69103(0x83)));throw new Error(t('api.fetchModel.fetchError',{'error':_0x1ae6bd}));}const _0x2b4f29=cleanDatasetNames(_0x361da9[_0xb69103(0x8d)][_0xb69103(0x7f)]);return{'configArray':_0x2b4f29,'count':_0x2b4f29[_0xb69103(0x84)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a9_0x3b7825=a9_0x5833;function a9_0x5833(_0x3578cb,_0x1a86a7){_0x3578cb=_0x3578cb-0x192;const _0x32b408=a9_0x32b4();let _0x5833df=_0x32b408[_0x3578cb];return _0x5833df;}(function(_0x4711cc,_0x271100){const _0x11490d=a9_0x5833,_0x5f7cf2=_0x4711cc();while(!![]){try{const _0x377cca=parseInt(_0x11490d(0x1b1))/0x1+parseInt(_0x11490d(0x193))/0x2+parseInt(_0x11490d(0x1a4))/0x3*(-parseInt(_0x11490d(0x199))/0x4)+parseInt(_0x11490d(0x1b8))/0x5*(-parseInt(_0x11490d(0x1a8))/0x6)+-parseInt(_0x11490d(0x1af))/0x7*(-parseInt(_0x11490d(0x1a9))/0x8)+parseInt(_0x11490d(0x1b2))/0x9*(-parseInt(_0x11490d(0x1ae))/0xa)+-parseInt(_0x11490d(0x197))/0xb;if(_0x377cca===_0x271100)break;else _0x5f7cf2['push'](_0x5f7cf2['shift']());}catch(_0x52802d){_0x5f7cf2['push'](_0x5f7cf2['shift']());}}}(a9_0x32b4,0x3d1eb));import a9_0x57d787 from'prettier';function a9_0x32b4(){const _0x8254e3=['.ts','name','-client','slice','30nZYZmm','utf8','replaceApiContent','alias','length','endsWith','414212AXxBPj','online','api.generateFile.noAppCode','{\x20apiConfigName:\x20','404514wQkZdx','datasetCode','4Uzrdar','env','templates/generate-api','./src/api/','success','-api','client','typescript','API\x20文件生成成功!','string','../..','803691ujYXmf','push','dirname','api','351240rSQCQD','832FUFifb','app','init-api','key','format','207190nyrRzh','31633hYySXB','join','457085rlXOZW','99AGyERa','bind'];a9_0x32b4=function(){return _0x8254e3;};return a9_0x32b4();}import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a9_0x57287b from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';import a9_0xf985e8 from'../i18n/index.js';const t=a9_0xf985e8['t'][a9_0x3b7825(0x1b3)](a9_0xf985e8);export async function generateApiFile(_0x8a33ec,_0x1a20db='',_0x19ef6e,_0x49db8d=![],_0x5cf633,_0x35b3a3=a9_0x3b7825(0x19c)){const _0x56b116=a9_0x3b7825,_0x41d30a=readConfig(),_0x2f4a74=_0x19ef6e||_0x41d30a?.[_0x56b116(0x1aa)];if(typeof _0x2f4a74!=='string'||!_0x2f4a74)throw new Error(t(_0x56b116(0x195)));const _0x2c75e4=_0x49db8d?'CONFIG_NAMES.DEFAULT':'\x22'+_0x2f4a74+'\x22',_0xc594d8=typeof _0x41d30a[_0x56b116(0x19a)]===_0x56b116(0x1a2)?_0x41d30a[_0x56b116(0x19a)]:undefined,_0x1198a7=_0x5cf633||_0xc594d8||'online',_0xf3a3a7=_0x1198a7!==_0x56b116(0x194);let _0x144ece;if(_0x49db8d)_0xf3a3a7?_0x144ece=_0x56b116(0x196)+_0x2c75e4+',\x20env:\x20\x22'+_0x1198a7+'\x22\x20}':_0x144ece='';else{const _0x68bd29=_0xf3a3a7?',\x20env:\x20\x22'+_0x1198a7+'\x22':'';_0x144ece='{\x20apiConfigName:\x20\x22'+_0x2f4a74+'\x22'+_0x68bd29+'\x20}';}const _0x4ef22e=_0x1a20db?_0x1a20db+_0x56b116(0x19e):_0x56b116(0x1a7),_0x5648b5=_0x1a20db?_0x1a20db+_0x56b116(0x1b6):_0x56b116(0x19f),_0x24abf5=[];_0x8a33ec['forEach'](_0x1f0df9=>{const _0x540503=_0x56b116;_0x24abf5[_0x540503(0x1a5)]({'datasetCode':_0x1f0df9[_0x540503(0x198)],'tableName':_0x1f0df9['tableName'],'name':_0x1f0df9[_0x540503(0x1b5)]||'','alias':_0x1f0df9[_0x540503(0x1bb)]||_0x1f0df9[_0x540503(0x1ac)]});});const _0x495895=fileURLToPath(import.meta.url),_0x4991be=a9_0x57287b['resolve'](a9_0x57287b[_0x56b116(0x1a6)](_0x495895),_0x56b116(0x1a3)),_0x2241be=a9_0x57287b['join'](_0x4991be,_0x56b116(0x19b)),_0x1e7568=a9_0x57287b[_0x56b116(0x1b0)](_0x2241be,'api.ts.tpl'),_0x3e4b27=a9_0x57287b[_0x56b116(0x1b0)](_0x2241be,'client.ts.tpl'),_0x4aef19=_0x35b3a3[_0x56b116(0x192)]('/')?_0x35b3a3[_0x56b116(0x1b7)](0x0,-0x1):_0x35b3a3;mkdirSync(_0x4aef19,{'recursive':!![]});const _0x212bb2=_0x24abf5[0x0]?.[_0x56b116(0x1bb)],_0x527f36=readFileSync(_0x1e7568,'utf8'),_0x466dff=TemplateReplacer[_0x56b116(0x1ba)](_0x527f36,_0x2f4a74,_0x24abf5,_0x212bb2,_0x4ef22e,_0x2c75e4),_0x267fcf=await a9_0x57d787['format'](_0x466dff,{'parser':'typescript'}),_0x38fea2=_0x4aef19+'/'+_0x4ef22e+_0x56b116(0x1b4);writeFileSync(_0x38fea2,_0x267fcf,{'encoding':'utf8'});const _0x314398=readFileSync(_0x3e4b27,_0x56b116(0x1b9)),_0x3da442=TemplateReplacer[_0x56b116(0x1ba)](_0x314398,_0x2f4a74,_0x24abf5,_0x212bb2,_0x4ef22e,_0x2c75e4,_0x144ece),_0x5f4d37=await a9_0x57d787[_0x56b116(0x1ad)](_0x3da442,{'parser':_0x56b116(0x1a0)}),_0x28948b=_0x4aef19+'/'+_0x5648b5+_0x56b116(0x1b4);writeFileSync(_0x28948b,_0x5f4d37,{'encoding':_0x56b116(0x1b9)});const _0x569f7c=_0x24abf5[_0x56b116(0x1bc)];return logger[_0x56b116(0x19d)](_0x56b116(0x1ab),_0x56b116(0x1a1),undefined,{'apiFile':_0x38fea2,'clientFile':_0x28948b,'modelCount':_0x569f7c,'configName':_0x2c75e4}),{'modelCount':_0x569f7c,'apiFilePath':_0x38fea2,'clientFilePath':_0x28948b,'configName':_0x2c75e4};}
|