@lovrabet/cli 1.2.5-beta.7 → 1.3.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/add-page/input-page-router.js +1 -1
- package/lib/add-page/main.js +1 -1
- package/lib/add-page/select-page-template.js +1 -1
- package/lib/ai-setup/AISetupUI.js +1 -1
- package/lib/ai-setup/config.js +1 -1
- package/lib/api/api-doc-ui.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-pull-ui.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/main.js +1 -1
- package/lib/api/pull-silent.js +1 -1
- package/lib/app-menu/app-menu-sync-ui.js +1 -1
- package/lib/app-menu/create-menu.js +1 -1
- package/lib/app-menu/get-local-pages.js +1 -1
- package/lib/app-menu/get-online-menu-list.js +1 -1
- package/lib/app-menu/use-get-online-menu-list.js +1 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-update-cdn/current-content.js +1 -1
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
- package/lib/app-menu-update-cdn/main.js +1 -1
- package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cmd/build-watch.js +1 -1
- package/lib/cmd/build.js +1 -1
- package/lib/cmd/logs.js +1 -1
- package/lib/cmd/preview.js +1 -1
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/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/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/check-sdk-version.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/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/skills/.cursorrules +31 -2
- package/templates/skills/.shared/guides/07-backend-function/guide.md +274 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function a0_0x3476(_0xc82021,_0x55918b){_0xc82021=_0xc82021-0x15e;const _0x4b232c=a0_0x4b23();let _0x3476fe=_0x4b232c[_0xc82021];return _0x3476fe;}(function(_0x1a263c,_0x1c5057){const _0x5d9f7f=a0_0x3476,_0x7c86e0=_0x1a263c();while(!![]){try{const _0x2613e9=parseInt(_0x5d9f7f(0x168))/0x1+-parseInt(_0x5d9f7f(0x173))/0x2+parseInt(_0x5d9f7f(0x15f))/0x3+-parseInt(_0x5d9f7f(0x177))/0x4+parseInt(_0x5d9f7f(0x165))/0x5+parseInt(_0x5d9f7f(0x174))/0x6*(parseInt(_0x5d9f7f(0x172))/0x7)+parseInt(_0x5d9f7f(0x161))/0x8*(-parseInt(_0x5d9f7f(0x16d))/0x9);if(_0x2613e9===_0x1c5057)break;else _0x7c86e0['push'](_0x7c86e0['shift']());}catch(_0x53561c){_0x7c86e0['push'](_0x7c86e0['shift']());}}}(a0_0x4b23,0x69207));import{jsx as a0_0x2f021d,jsxs as a0_0x366925}from'react/jsx-runtime';import{useState}from'react';function a0_0x4b23(){const _0x3102d9=['split','路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_','路径不能以\x20/\x20开头或结尾','846wSEzEZ','endsWith','backspace','return','startsWith','14rvzZTB','41614jMlJpX','1785882vlfzXo','\x20←\x20','页面路径长度不能超过\x20100\x20个字符','2039784EwKmor','路径不能包含连续的\x20/','green','\x20直接回车确认,或输入自定义路由地址','trim','delete','1129257bUGvPI','includes','101968HBwwZJ','existsSync','my-page','页面路由地址:\x20','3373365FjWFFl','页面路径不合法','gray','513090vbPRqA','slice'];a0_0x4b23=function(){return _0x3102d9;};return a0_0x4b23();}import{Text,Box,useInput}from'ink';import a0_0x3bb652 from'node:fs';export function InputProjectCode(_0x164776){const _0x1d1986=a0_0x3476,{onSubmit:_0x3d8aac,pagePath:_0x214998}=_0x164776,[_0x523572,_0x49328c]=useState(''),[_0x2376ed,_0x5e6316]=useState(''),_0x182b4a=_0x1d1986(0x163);function _0x21f9aa(_0xcc2dd5){const _0x40dbc8=_0x1d1986;if(_0xcc2dd5['length']>0x64)return{'valid':![],'message':_0x40dbc8(0x176)};if(_0xcc2dd5[_0x40dbc8(0x171)]('/')||_0xcc2dd5[_0x40dbc8(0x16e)]('/'))return{'valid':![],'message':_0x40dbc8(0x16c)};if(_0xcc2dd5[_0x40dbc8(0x160)]('//'))return{'valid':![],'message':_0x40dbc8(0x178)};const _0x1c61a6=_0xcc2dd5[_0x40dbc8(0x16a)]('/');for(const _0x591627 of _0x1c61a6){if(!_0x591627)continue;const _0x41dafb=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x41dafb['test'](_0x591627))return{'valid':![],'message':_0x40dbc8(0x16b)};}return{'valid':!![]};}return useInput((_0x578838,_0x32de3c)=>{const _0x55bd9b=_0x1d1986;if(_0x32de3c[_0x55bd9b(0x170)]){const _0x1c47ce=_0x523572[_0x55bd9b(0x17b)]()||_0x182b4a;if(_0x2376ed)return;const _0x44cc3d=_0x214998+'/'+_0x1c47ce;if(a0_0x3bb652[_0x55bd9b(0x162)](_0x44cc3d)){_0x5e6316('页面路径\x20'+_0x1c47ce+'\x20已存在,请使用其他路径');return;}_0x3d8aac(_0x1c47ce),_0x49328c(''),_0x5e6316('');}else _0x32de3c[_0x55bd9b(0x16f)]||_0x32de3c[_0x55bd9b(0x15e)]?_0x49328c(_0x37ece6=>{const _0x48de3f=_0x55bd9b,_0x312e74=_0x37ece6[_0x48de3f(0x169)](0x0,-0x1),{valid:_0x3e0de2,message:_0x488b21}=_0x21f9aa(_0x312e74);return _0x5e6316(_0x3e0de2?'':_0x488b21||_0x48de3f(0x166)),_0x312e74;}):_0x49328c(_0x10b170=>{const _0x30ca9b=_0x10b170+_0x578838,{valid:_0x2d566b,message:_0x298fbc}=_0x21f9aa(_0x30ca9b);return _0x5e6316(_0x2d566b?'':_0x298fbc||'页面路径不合法'),_0x30ca9b;});}),a0_0x366925(Box,{'flexDirection':'column','children':[a0_0x366925(Box,{'children':[a0_0x2f021d(Text,{'color':_0x1d1986(0x167),'children':'\x20Step2:\x20'}),a0_0x2f021d(Text,{'children':_0x1d1986(0x164)}),_0x523572?a0_0x2f021d(Text,{'color':_0x1d1986(0x179),'children':_0x523572}):a0_0x2f021d(Text,{'color':_0x1d1986(0x167),'children':_0x182b4a}),_0x2376ed&&a0_0x366925(Text,{'color':'red','children':[_0x1d1986(0x175),_0x2376ed]})]}),!_0x2376ed&&!_0x523572&&a0_0x2f021d(Box,{'children':a0_0x2f021d(Text,{'color':_0x1d1986(0x167),'children':_0x1d1986(0x17a)})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x37669e=a1_0x118f;(function(_0xd75670,_0x247d40){const _0x4cd5c3=a1_0x118f,_0x102a6b=_0xd75670();while(!![]){try{const _0x1ffaa2=-parseInt(_0x4cd5c3(0xa7))/0x1*(-parseInt(_0x4cd5c3(0xb3))/0x2)+-parseInt(_0x4cd5c3(0x9b))/0x3*(parseInt(_0x4cd5c3(0xa2))/0x4)+parseInt(_0x4cd5c3(0xb2))/0x5*(-parseInt(_0x4cd5c3(0xb1))/0x6)+-parseInt(_0x4cd5c3(0xa3))/0x7*(-parseInt(_0x4cd5c3(0xb8))/0x8)+-parseInt(_0x4cd5c3(0xbb))/0x9+parseInt(_0x4cd5c3(0xc0))/0xa+parseInt(_0x4cd5c3(0xaa))/0xb*(-parseInt(_0x4cd5c3(0x9a))/0xc);if(_0x1ffaa2===_0x247d40)break;else _0x102a6b['push'](_0x102a6b['shift']());}catch(_0x348cd0){_0x102a6b['push'](_0x102a6b['shift']());}}}(a1_0x45a9,0xbbf6e));import{jsx as a1_0x4c7621,jsxs as a1_0x1d6131,Fragment as a1_0x10a801}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x3e2084 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_0x118f(_0x3b7b5f,_0x4be12c){_0x3b7b5f=_0x3b7b5f-0x97;const _0x45a95d=a1_0x45a9();let _0x118f45=_0x45a95d[_0x3b7b5f];return _0x118f45;}import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x3e2084[a1_0x37669e(0x9c)](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x3e2084[a1_0x37669e(0xb7)](__dirname,a1_0x37669e(0xa9)),projectDir=process['cwd']();function a1_0x45a9(){const _0x5ae84e=['\x20*\x20页面创建成功!','\x20*\x20页面文件已创建,可直接通过路由访问','14232940zdBaNy','processTemplate','message','error','column','12BjmQIK','1598298NDrYjZ','dirname','join','\x20*\x20页面路径:\x20','cwd','pages','green','8GRUhDO','10031nCkNFH','setLogPath','gray','finally','567389IQXtyq','catch','../../templates/pages','4154513hIsjob','页面添加成功:\x20','then','\x20Step2:\x20','info','add-page','正在创建页面,请稍候…','114LoHONt','158375DerRvt','2CBkUbt','开始添加页面:\x20','src','success','resolve','7624zUwBOX','\x20*\x20路由地址:\x20','已输入的页面路由\x20','4872510CYflVX','已选择页面模板\x20','now'];a1_0x45a9=function(){return _0x5ae84e;};return a1_0x45a9();}export const AddPage=()=>{const _0x5dc911=a1_0x37669e,{exit:_0x10e75f}=useApp(),[_0x4d4adb,_0xa160e7]=useState(''),[_0x12c543,_0x4a20df]=useState(''),[_0x52cd11,_0x102f61]=useState(![]),[_0x5ef4f7,_0x439037]=useState(![]),_0x12b118=a1_0x3e2084['join'](projectDir,_0x5dc911(0xb5),_0x5dc911(0xa0)),_0x3bc991=a1_0x3e2084['join'](_0x12b118,_0x12c543),_0x5b3b7f=a1_0x3e2084['join']('src',_0x5dc911(0xa0),_0x12c543);useEffect(()=>{const _0x59781a=_0x5dc911,_0xdf8943=a1_0x3e2084['resolve'](pageTemplateDir,_0x4d4adb);if(_0x4d4adb&&_0x12c543){_0x102f61(!![]),logger[_0x59781a(0xa4)](process[_0x59781a(0x9f)]());const _0x4fb9b6=Date[_0x59781a(0xbd)]();logger[_0x59781a(0xae)](_0x59781a(0xaf),_0x59781a(0xb4)+_0x12c543,{'template':_0x4d4adb,'targetPath':_0x5b3b7f}),TemplateReplacer[_0x59781a(0xc1)](_0xdf8943,a1_0x3e2084[_0x59781a(0x9d)](_0x12b118,_0x12c543),_0x12c543,_0x4d4adb)[_0x59781a(0xac)](()=>{const _0x26d5fa=_0x59781a,_0x36f80d=Date[_0x26d5fa(0xbd)]()-_0x4fb9b6;logger[_0x26d5fa(0xb6)]('add-page',_0x26d5fa(0xab)+_0x12c543,_0x36f80d,{'template':_0x4d4adb,'targetPath':_0x5b3b7f,'routePath':_0x12c543}),_0x439037(!![]);})[_0x59781a(0xa8)](_0xce2fd9=>{const _0x2666a4=_0x59781a,_0x22d001=Date['now']()-_0x4fb9b6;logger[_0x2666a4(0x98)]('add-page','页面添加失败:\x20'+_0x12c543,{'template':_0x4d4adb,'targetPath':_0x5b3b7f,'error':_0xce2fd9 instanceof Error?_0xce2fd9[_0x2666a4(0x97)]:String(_0xce2fd9),'duration':_0x22d001});})[_0x59781a(0xa6)](()=>{_0x102f61(![]);});}},[_0x4d4adb,_0x12c543]),useEffect(()=>{_0x5ef4f7&&setTimeout(()=>{_0x10e75f();});},[_0x5ef4f7]);if(_0x4d4adb)return a1_0x1d6131(Box,{'flexDirection':_0x5dc911(0x99),'paddingY':0x1,'children':[a1_0x1d6131(Box,{'children':[a1_0x4c7621(Text,{'color':_0x5dc911(0xa5),'children':'\x20Step1:\x20'}),a1_0x4c7621(Text,{'children':_0x5dc911(0xbc)}),a1_0x4c7621(Text,{'color':_0x5dc911(0xa1),'children':_0x4d4adb})]}),_0x12c543?a1_0x1d6131(Box,{'children':[a1_0x4c7621(Text,{'color':_0x5dc911(0xa5),'children':_0x5dc911(0xad)}),a1_0x4c7621(Text,{'children':_0x5dc911(0xba)}),a1_0x4c7621(Text,{'color':_0x5dc911(0xa1),'children':_0x12c543})]}):a1_0x4c7621(InputProjectCode,{'pagePath':_0x3bc991,'onSubmit':_0x4a20df}),_0x12c543&&_0x52cd11?a1_0x1d6131(Box,{'marginTop':0x1,'children':[a1_0x4c7621(Box,{'width':'4'}),a1_0x4c7621(Text,{'children':_0x5dc911(0xb0)})]}):null,_0x5ef4f7?a1_0x1d6131(a1_0x10a801,{'children':[a1_0x4c7621(Box,{'marginTop':0x1,'children':a1_0x4c7621(Text,{'color':_0x5dc911(0xa5),'children':_0x5dc911(0xbe)})}),a1_0x1d6131(Box,{'children':[a1_0x4c7621(Text,{'color':'gray','children':_0x5dc911(0x9e)}),a1_0x4c7621(Text,{'color':_0x5dc911(0xa1),'children':_0x5b3b7f})]}),a1_0x1d6131(Box,{'children':[a1_0x4c7621(Text,{'color':_0x5dc911(0xa5),'children':_0x5dc911(0xb9)}),a1_0x1d6131(Text,{'color':_0x5dc911(0xa1),'children':['/',_0x12c543]})]}),a1_0x4c7621(Box,{'marginTop':0x1,'children':a1_0x4c7621(Text,{'color':'cyan','children':_0x5dc911(0xbf)})})]}):null]});return a1_0x4c7621(SelectPageTemplate,{'onSelect':_0xa160e7});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x339acd,_0xb9c2f){const _0x58d2d8=a2_0x4cf6,_0xd30c69=_0x339acd();while(!![]){try{const _0xd84cc3=parseInt(_0x58d2d8(0xc2))/0x1*(-parseInt(_0x58d2d8(0xbe))/0x2)+-parseInt(_0x58d2d8(0xd0))/0x3*(-parseInt(_0x58d2d8(0xd1))/0x4)+-parseInt(_0x58d2d8(0xd7))/0x5*(-parseInt(_0x58d2d8(0xda))/0x6)+parseInt(_0x58d2d8(0xd4))/0x7+-parseInt(_0x58d2d8(0xdb))/0x8+parseInt(_0x58d2d8(0xc5))/0x9+-parseInt(_0x58d2d8(0xc0))/0xa;if(_0xd84cc3===_0xb9c2f)break;else _0xd30c69['push'](_0xd30c69['shift']());}catch(_0x81fb69){_0xd30c69['push'](_0xd30c69['shift']());}}}(a2_0x718f,0xe9991));function a2_0x4cf6(_0x2f99fa,_0x57c4ae){_0x2f99fa=_0x2f99fa-0xbc;const _0x718f28=a2_0x718f();let _0x4cf688=_0x718f28[_0x2f99fa];return _0x4cf688;}import{jsx as a2_0x1d01d0,jsxs as a2_0x6b4887}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';import a2_0x31e7a8 from'node:path';import{fileURLToPath}from'node:url';function a2_0x718f(){const _0x2bb0a1=['sdk-fetch','\x20\x20\x20\x20\x20\x20\x20\x20','length','712461TPTZdQ','4nWxCJp','localeCompare','join','5255138JWderE','name','filter','5snoLYd','return','blank','10294602sGcJfp','14887304lCEqGf','label','../..','green','82OdATrm','downArrow','11804200alaZDU','gray','6991JCtJGr','\x20Step1:\x20','error','14227137YnMcuh','map','sort','onSelect','isDirectory','column','templates/pages','\x20\x20\x20\x20\x20\x20>\x20'];a2_0x718f=function(){return _0x2bb0a1;};return a2_0x718f();}async function getTemplateList(){const _0x48dc2d=a2_0x4cf6;try{const _0x3bef05=fileURLToPath(import.meta.url),_0x1e20ee=a2_0x31e7a8['resolve'](a2_0x31e7a8['dirname'](_0x3bef05),_0x48dc2d(0xbc)),_0x2bca37=a2_0x31e7a8[_0x48dc2d(0xd3)](_0x1e20ee,_0x48dc2d(0xcb)),_0x463ab1=await readdir(_0x2bca37,{'withFileTypes':!![]}),_0x2ad716=_0x463ab1[_0x48dc2d(0xd6)](_0x29d07b=>_0x29d07b[_0x48dc2d(0xc9)]())[_0x48dc2d(0xc6)](_0xeaf1be=>({'label':_0xeaf1be[_0x48dc2d(0xd5)]}))[_0x48dc2d(0xc7)]((_0x3a29a1,_0x4558d8)=>_0x3a29a1[_0x48dc2d(0xdc)][_0x48dc2d(0xd2)](_0x4558d8[_0x48dc2d(0xdc)]));return _0x2ad716;}catch(_0x375122){return console[_0x48dc2d(0xc4)]('获取模板列表失败:',_0x375122),[{'label':_0x48dc2d(0xd9)},{'label':_0x48dc2d(0xcd)}];}}export function SelectPageTemplate(_0x2d8db2){const _0x453650=a2_0x4cf6,[_0x58df5d,_0x122ca8]=useState(0x0),[_0x286b4f,_0x2efa29]=useState([]),[_0x1669fe,_0x23d63]=useState(!![]);useEffect(()=>{async function _0x2655c4(){const _0x3d3777=await getTemplateList();_0x2efa29(_0x3d3777),_0x23d63(![]);}_0x2655c4();},[]),useInput((_0x1d9e2,_0x3b0c3a)=>{const _0x4ac47b=a2_0x4cf6;if(_0x1669fe)return;if(_0x3b0c3a[_0x4ac47b(0xd8)]){const _0x39f493=_0x286b4f[_0x58df5d];_0x39f493&&_0x2d8db2[_0x4ac47b(0xc8)](_0x39f493[_0x4ac47b(0xdc)]);}_0x3b0c3a['upArrow']&&_0x122ca8(_0x5ac6ca=>_0x5ac6ca===0x0?_0x286b4f['length']-0x1:_0x5ac6ca-0x1),_0x3b0c3a[_0x4ac47b(0xbf)]&&_0x122ca8(_0x7d55f9=>_0x7d55f9===_0x286b4f[_0x4ac47b(0xcf)]-0x1?0x0:_0x7d55f9+0x1);});if(_0x1669fe)return a2_0x1d01d0(Box,{'flexDirection':_0x453650(0xca),'paddingY':0x1,'children':a2_0x6b4887(Box,{'children':[a2_0x1d01d0(Text,{'color':_0x453650(0xc1),'children':'\x20Step1:\x20'}),a2_0x1d01d0(Text,{'children':'正在加载页面模板...'})]})});return a2_0x6b4887(Box,{'flexDirection':_0x453650(0xca),'paddingY':0x1,'children':[a2_0x6b4887(Box,{'children':[a2_0x1d01d0(Text,{'color':_0x453650(0xc1),'children':_0x453650(0xc3)}),a2_0x1d01d0(Text,{'children':'请选择您要创建的页面模板'})]}),_0x286b4f[_0x453650(0xc6)]((_0x3872dd,_0x432caf)=>{const _0x303322=_0x453650,_0x5a8450=_0x432caf===_0x58df5d,_0x287801=_0x5a8450?_0x303322(0xcc)+_0x3872dd[_0x303322(0xdc)]:_0x303322(0xce)+_0x3872dd[_0x303322(0xdc)];return a2_0x1d01d0(Box,{'children':a2_0x1d01d0(Text,{'color':_0x5a8450?_0x303322(0xbd):undefined,'children':_0x287801})},_0x287801);})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a3_0x4534(){const _0x3f79a4=['error','是否同时配置\x20AI\x20助手?这将:','skill-','6TcPzOV','installing','qoder','[\x20]','6472726msgwyN','10qIbQcW','confirming','[N]\x20跳过,稍后手动配置','请至少选择一个配置项','appcode','push','message','done','Claude\x20Code','320677JdeACt','success','blue','ide','Enter\x20默认:\x20是','11125257QFtiEK','60PgCYsy','↑/↓:\x20移动\x20空格:\x20切换\x20a:\x20全选\x20q:\x20退出\x20Enter:\x20确认','has','claude','size','[✓]','trae','358308aiYKkK','name','•\x20MCP:\x20让\x20AI\x20直接访问\x20Lovrabet\x20数据集','cursor','selecting','520307eaBEKC','211115cfbDHp','正在配置\x20AI\x20助手...','1144996GFvdJY','add','filter','184lVkwKT','mcp-','upArrow','return','column','yellow','codex','length','Cursor','codebuddy','cyan','2lDmNzc','projectRoot','gray','red','delete','opencode','white','green','agent','status','map','6xmEnku','windsurf','技能包\x20(研发规范指南)'];a3_0x4534=function(){return _0x3f79a4;};return a3_0x4534();}const a3_0x35cc4a=a3_0x2863;function a3_0x2863(_0xe949a2,_0x47b986){_0xe949a2=_0xe949a2-0x18c;const _0x45348e=a3_0x4534();let _0x2863e8=_0x45348e[_0xe949a2];return _0x2863e8;}(function(_0x575a9c,_0x4cc06d){const _0xd142d9=a3_0x2863,_0x324019=_0x575a9c();while(!![]){try{const _0x1401f7=parseInt(_0xd142d9(0x1a8))/0x1*(parseInt(_0xd142d9(0x1b9))/0x2)+-parseInt(_0xd142d9(0x1c4))/0x3*(-parseInt(_0xd142d9(0x1ab))/0x4)+parseInt(_0xd142d9(0x1a9))/0x5*(parseInt(_0xd142d9(0x1ca))/0x6)+parseInt(_0xd142d9(0x196))/0x7*(parseInt(_0xd142d9(0x1ae))/0x8)+-parseInt(_0xd142d9(0x1a3))/0x9+-parseInt(_0xd142d9(0x18d))/0xa*(-parseInt(_0xd142d9(0x19b))/0xb)+parseInt(_0xd142d9(0x19c))/0xc*(-parseInt(_0xd142d9(0x18c))/0xd);if(_0x1401f7===_0x4cc06d)break;else _0x324019['push'](_0x324019['shift']());}catch(_0x21a556){_0x324019['push'](_0x324019['shift']());}}}(a3_0x4534,0xa3c1a));import{jsx as a3_0x5f19e5,jsxs as a3_0x1d51f7}from'react/jsx-runtime';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';const MCP_IDE_LIST=[a3_0x35cc4a(0x1a6),a3_0x35cc4a(0x19f)],SKILL_IDE_LIST=['antigravity','claude',a3_0x35cc4a(0x1b7),a3_0x35cc4a(0x1b4),'cursor',a3_0x35cc4a(0x1be),a3_0x35cc4a(0x1cc),a3_0x35cc4a(0x1a2),a3_0x35cc4a(0x1c5),a3_0x35cc4a(0x1c1)];export function AISetupUI({config:_0x44c314,onComplete:_0x36cbdd}){const _0x5693d6=a3_0x35cc4a,{exit:_0x2f71a2}=useApp(),[_0x181ad0,_0x228896]=useState('confirming'),[_0x513e00,_0x4fbb72]=useState(0x0),[_0x25bce4,_0x183a09]=useState(new Set([0x0,0x1])),[_0x75c0a4,_0x4b8c1a]=useState(new Set(SKILL_IDE_LIST[_0x5693d6(0x1c3)]((_0x6b0d43,_0x224886)=>_0x224886))),[_0x1bd405,_0x35691c]=useState('');useEffect(()=>{const _0x1145e4=_0x5693d6;!_0x44c314[_0x1145e4(0x191)]&&_0x36cbdd({'mcpResults':[],'skillResults':[]});},[_0x44c314['appcode'],_0x36cbdd]),useInput((_0x40c92d,_0x37987d)=>{const _0x586ba4=_0x5693d6;if(_0x181ad0===_0x586ba4(0x18e)){if(_0x40c92d==='y'||_0x40c92d==='Y'||_0x37987d['return']){_0x9577d7();return;}if(_0x40c92d==='n'||_0x40c92d==='N'){_0x36cbdd({'mcpResults':[],'skillResults':[]});return;}if(_0x37987d[_0x586ba4(0x1b1)]){_0x9577d7();return;}}if(_0x181ad0===_0x586ba4(0x1a7)){if(_0x37987d[_0x586ba4(0x1b0)]){_0x4fbb72(_0x163f06=>_0x163f06>0x0?_0x163f06-0x1:SKILL_IDE_LIST[_0x586ba4(0x1b5)]-0x1);return;}if(_0x37987d['downArrow']){_0x4fbb72(_0x1c4016=>_0x1c4016<SKILL_IDE_LIST['length']-0x1?_0x1c4016+0x1:0x0);return;}if(_0x40c92d==='\x20'){const _0x2221d3=_0x513e00<MCP_IDE_LIST[_0x586ba4(0x1b5)];if(_0x2221d3){const _0x479fc3=new Set(_0x25bce4);_0x479fc3['has'](_0x513e00)?_0x479fc3[_0x586ba4(0x1bd)](_0x513e00):_0x479fc3[_0x586ba4(0x1ac)](_0x513e00),_0x183a09(_0x479fc3);}else{const _0x644dba=_0x513e00-MCP_IDE_LIST[_0x586ba4(0x1b5)],_0x53c297=new Set(_0x75c0a4);_0x53c297['has'](_0x644dba)?_0x53c297['delete'](_0x644dba):_0x53c297[_0x586ba4(0x1ac)](_0x644dba),_0x4b8c1a(_0x53c297);}return;}if(_0x40c92d==='a'||_0x40c92d==='A'){_0x183a09(new Set(MCP_IDE_LIST[_0x586ba4(0x1c3)]((_0x28d4f4,_0x36ed5a)=>_0x36ed5a))),_0x4b8c1a(new Set(SKILL_IDE_LIST[_0x586ba4(0x1c3)]((_0x3c75df,_0x5ee3ed)=>_0x5ee3ed)));return;}if(_0x40c92d==='q'||_0x40c92d==='Q'){_0x2f71a2();return;}if(_0x37987d[_0x586ba4(0x1b1)]){if(_0x25bce4[_0x586ba4(0x1a0)]===0x0&&_0x75c0a4[_0x586ba4(0x1a0)]===0x0){_0x35691c(_0x586ba4(0x190));return;}_0x9577d7();return;}}if(_0x181ad0==='done'){_0x2f71a2();return;}});async function _0x9577d7(){const _0x5dd1a4=_0x5693d6;_0x228896('installing');const _0x4d8889=[],_0x52cb79=[];for(const _0x3e4dad of _0x25bce4){const _0x44111c=MCP_IDE_LIST[_0x3e4dad];if(!_0x44111c)continue;try{const _0x3800c4=await configureMcp(_0x44111c,_0x44c314['projectRoot']);_0x4d8889[_0x5dd1a4(0x192)](_0x3800c4);}catch(_0x2bdf1d){_0x4d8889[_0x5dd1a4(0x192)]({'ide':MCP_IDE_CONFIGS[_0x44111c]?.[_0x5dd1a4(0x1a4)]||_0x44111c,'status':_0x5dd1a4(0x1c7),'message':_0x2bdf1d instanceof Error?_0x2bdf1d[_0x5dd1a4(0x193)]:String(_0x2bdf1d)});}}await copySharedSkills(_0x44c314[_0x5dd1a4(0x1ba)]);for(const _0x4898df of _0x75c0a4){const _0x1d808d=SKILL_IDE_LIST[_0x4898df];if(!_0x1d808d)continue;try{const _0x49c769=await installSkill(_0x1d808d,_0x44c314['projectRoot']);_0x52cb79[_0x5dd1a4(0x192)](_0x49c769);}catch(_0x3223dc){_0x52cb79[_0x5dd1a4(0x192)]({'ide':SKILL_IDE_CONFIGS[_0x1d808d]?.['name']||_0x1d808d,'status':_0x5dd1a4(0x1c7),'message':_0x3223dc instanceof Error?_0x3223dc[_0x5dd1a4(0x193)]:String(_0x3223dc)});}}if(_0x52cb79[_0x5dd1a4(0x1b5)]>0x0){const _0x50d29e=_0x52cb79[_0x5dd1a4(0x1ad)](_0x54bc16=>_0x54bc16[_0x5dd1a4(0x1c2)]===_0x5dd1a4(0x197))[_0x5dd1a4(0x1c3)](_0x570b0c=>_0x570b0c[_0x5dd1a4(0x199)]);_0x50d29e[_0x5dd1a4(0x1b5)]>0x0&&createSkillManifest(_0x44c314[_0x5dd1a4(0x1ba)],_0x50d29e);}_0x228896('done'),setTimeout(()=>{_0x36cbdd({'mcpResults':_0x4d8889,'skillResults':_0x52cb79});},0xbb8);}if(_0x181ad0===_0x5693d6(0x18e))return a3_0x1d51f7(Box,{'flexDirection':_0x5693d6(0x1b2),'marginTop':0x1,'children':[a3_0x5f19e5(Box,{'marginTop':0x1,'children':a3_0x5f19e5(Text,{'color':_0x5693d6(0x1bf),'children':_0x5693d6(0x1c8)})}),a3_0x5f19e5(Box,{'marginLeft':0x2,'marginTop':0x1,'children':a3_0x5f19e5(Text,{'color':_0x5693d6(0x1bb),'children':_0x5693d6(0x1a5)})}),a3_0x5f19e5(Box,{'marginLeft':0x2,'children':a3_0x5f19e5(Text,{'color':_0x5693d6(0x1bb),'children':'•\x20Skill:\x20安装研发最佳实践、Backend\x20Function\x20规范'})}),a3_0x1d51f7(Box,{'marginTop':0x1,'flexDirection':_0x5693d6(0x1b2),'children':[a3_0x5f19e5(Box,{'children':a3_0x5f19e5(Text,{'color':_0x5693d6(0x1c0),'children':'[Y]\x20是,配置\x20AI\x20助手'})}),a3_0x5f19e5(Box,{'children':a3_0x5f19e5(Text,{'color':_0x5693d6(0x1bb),'children':_0x5693d6(0x18f)})}),a3_0x5f19e5(Box,{'children':a3_0x5f19e5(Text,{'color':'dimColor','children':_0x5693d6(0x19a)})})]}),_0x1bd405&&a3_0x5f19e5(Box,{'marginTop':0x1,'children':a3_0x1d51f7(Text,{'color':'red','children':['✗\x20',_0x1bd405]})})]});if(_0x181ad0===_0x5693d6(0x1a7))return a3_0x1d51f7(Box,{'flexDirection':'column','marginTop':0x1,'children':[a3_0x5f19e5(Box,{'children':a3_0x5f19e5(Text,{'color':_0x5693d6(0x1b8),'bold':!![],'children':'*\x20选择要配置的\x20IDE:'})}),_0x1bd405&&a3_0x5f19e5(Box,{'marginTop':0x1,'children':a3_0x1d51f7(Text,{'color':_0x5693d6(0x1bc),'children':['✗\x20',_0x1bd405]})}),a3_0x1d51f7(Box,{'marginTop':0x1,'flexDirection':_0x5693d6(0x1b2),'children':[a3_0x5f19e5(Text,{'bold':!![],'color':_0x5693d6(0x1b3),'children':'MCP\x20服务器\x20(AI\x20访问数据集)'}),MCP_IDE_LIST[_0x5693d6(0x1c3)]((_0x1d40da,_0x5a2518)=>{const _0x17c0c1=_0x5693d6,_0x4e7402=_0x513e00===_0x5a2518,_0x335631=_0x25bce4[_0x17c0c1(0x19e)](_0x5a2518);return a3_0x5f19e5(Box,{'children':a3_0x1d51f7(Text,{'backgroundColor':_0x4e7402?_0x17c0c1(0x198):undefined,'color':_0x4e7402?_0x17c0c1(0x1bf):undefined,'children':[_0x335631?_0x17c0c1(0x1a1):_0x17c0c1(0x1cd),'\x20',_0x1d40da==='cursor'?_0x17c0c1(0x1b6):_0x17c0c1(0x195)]})},_0x17c0c1(0x1af)+_0x1d40da);}),a3_0x5f19e5(Box,{'marginTop':0x1,'children':a3_0x5f19e5(Text,{'bold':!![],'color':_0x5693d6(0x1b3),'children':_0x5693d6(0x1c6)})}),SKILL_IDE_LIST[_0x5693d6(0x1c3)]((_0x509ae9,_0x18459d)=>{const _0x1c4121=_0x5693d6,_0x44aff0=_0x18459d+MCP_IDE_LIST[_0x1c4121(0x1b5)],_0x189536=_0x513e00===_0x44aff0,_0xce961e=_0x75c0a4[_0x1c4121(0x19e)](_0x44aff0);return a3_0x5f19e5(Box,{'children':a3_0x1d51f7(Text,{'backgroundColor':_0x189536?_0x1c4121(0x198):undefined,'color':_0x189536?_0x1c4121(0x1bf):undefined,'children':[_0xce961e?'[✓]':_0x1c4121(0x1cd),'\x20',SKILL_IDE_CONFIGS[_0x509ae9]['name']]})},_0x1c4121(0x1c9)+_0x509ae9);}),a3_0x5f19e5(Box,{'marginTop':0x1,'children':a3_0x5f19e5(Text,{'color':'gray','children':_0x5693d6(0x19d)})})]})]});if(_0x181ad0===_0x5693d6(0x1cb))return a3_0x5f19e5(Box,{'flexDirection':_0x5693d6(0x1b2),'marginTop':0x1,'children':a3_0x5f19e5(Box,{'children':a3_0x5f19e5(Text,{'children':_0x5693d6(0x1aa)})})});if(_0x181ad0===_0x5693d6(0x194))return null;return null;}const MCP_IDE_CONFIGS={'cursor':{'name':a3_0x35cc4a(0x1b6)},'claude':{'name':'Claude\x20Code'}};
|
package/lib/ai-setup/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a4_0x59c374=a4_0x4594;(function(_0x529ecc,_0x13a3ef){const _0x1b633b=a4_0x4594,_0x1e318d=_0x529ecc();while(!![]){try{const _0x2074f2=parseInt(_0x1b633b(0x1ed))/0x1+-parseInt(_0x1b633b(0x22b))/0x2*(-parseInt(_0x1b633b(0x1e8))/0x3)+parseInt(_0x1b633b(0x1e1))/0x4+parseInt(_0x1b633b(0x21d))/0x5*(-parseInt(_0x1b633b(0x1fe))/0x6)+parseInt(_0x1b633b(0x1e9))/0x7+parseInt(_0x1b633b(0x224))/0x8+parseInt(_0x1b633b(0x209))/0x9*(-parseInt(_0x1b633b(0x222))/0xa);if(_0x2074f2===_0x13a3ef)break;else _0x1e318d['push'](_0x1e318d['shift']());}catch(_0x595f45){_0x1e318d['push'](_0x1e318d['shift']());}}}(a4_0x4921,0x75601));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';const __dirname=dirname(fileURLToPath(import.meta.url)),MCP_SERVER_NAME='lovrabet-dataset',MCP_COMMAND=a4_0x59c374(0x20f),MCP_ARGS=['@lovrabet/dataset-mcp-server@latest'];function a4_0x4594(_0x584790,_0x463ab5){_0x584790=_0x584790-0x1de;const _0x4921fd=a4_0x4921();let _0x4594c8=_0x4921fd[_0x584790];return _0x4594c8;}function a4_0x4921(){const _0x1ca42e=['skill-install','复制\x20Cursor\x20Rules\x20文件失败','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','已写入\x20.cursor/mcp.json','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','../../templates/skills','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','35wQOTwC','\x20\x20\x22mcpServers\x22:\x20{','manual','app','未知的\x20IDE:\x20','30foWxdF','\x20\x20环境:\x20','1554216NjCmLG','log','node:fs','map','stringify','message','Claude\x20Code','1906646pYSnMz','需要先配置\x20appcode','../../templates/rules/lovrabet_rules.mdc.tpl','rules','\x20\x20\x20\x20}','2055420aQwfEF','error','env','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','2.0.0','success','.shared','3fhqLOn','5777814axgOPR','创建\x20Cursor\x20Rules\x20文件','\x22:\x20{','utf-8','740300eLiOPM','其他\x20IDE\x20配置指引已显示','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','创建\x20agents.md\x20文件','创建技能包\x20manifest','\x20\x20}','Claude\x20Code\x20MCP\x20命令已生成','.cursor','.lovrabet','mcpServers','object','Cursor','cursor','cwd','共享技能文件复制成功','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','\x20\x20AppCode:\x20','608862JjxdQa','不支持的\x20MCP\x20IDE:\x20','join','\x0a📋\x20其他\x20IDE\x20MCP\x20配置:\x0a','claude\x20mcp\x20add\x20','info','mcp.json','Cursor\x20MCP\x20配置失败','\x20技能包安装成功','.lovrabet/skill-manifest.json','复制\x20agents.md\x20文件失败','6108147qCzXhy','\x20技能包安装失败','lovrabet_rules.mdc','.lovrabet/skill/.shared','\x20\x20\x20\x20\x20\x20}','mcp-install','npx','\x20-e\x20LOVRABET_APP_CODE=','appcode','Cursor\x20MCP\x20配置成功','配置信息:','online','claude'];a4_0x4921=function(){return _0x1ca42e;};return a4_0x4921();}export function buildEnvConfig(_0x2f8650,_0x2d9e56){const _0x3aa0c6=a4_0x59c374,_0x789923={'LOVRABET_APP_CODE':String(_0x2f8650)};return _0x2d9e56!==_0x3aa0c6(0x214)&&(_0x789923['LOVRABET_ENV']=String(_0x2d9e56)),_0x789923;}export async function configureCursorMcp(_0x34ccc3){const _0x36cbe0=a4_0x59c374,_0x236969=_0x34ccc3||process[_0x36cbe0(0x1fa)](),_0x4af061=readConfig(_0x236969),_0x193044=_0x4af061[_0x36cbe0(0x211)]||_0x4af061['app'],_0x4e0899=_0x4af061[_0x36cbe0(0x1e3)]||_0x36cbe0(0x214);if(!_0x193044)return{'ide':'Cursor','status':_0x36cbe0(0x1e2),'message':'需要先配置\x20appcode'};const _0x1fc114=buildEnvConfig(_0x193044,_0x4e0899),_0x3f94a3={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x1fc114},_0x44a8aa=join(_0x236969,_0x36cbe0(0x1f4),_0x36cbe0(0x204)),_0x46a44e=join(_0x236969,_0x36cbe0(0x1f4));try{!existsSync(_0x46a44e)&&mkdirSync(_0x46a44e,{'recursive':!![]});let _0x2a6217={'mcpServers':{}};if(existsSync(_0x44a8aa)){const _0x556227=readFileSync(_0x44a8aa,_0x36cbe0(0x1ec));_0x2a6217=JSON['parse'](_0x556227);}return(!_0x2a6217[_0x36cbe0(0x1f6)]||typeof _0x2a6217['mcpServers']!==_0x36cbe0(0x1f7))&&(_0x2a6217[_0x36cbe0(0x1f6)]={}),_0x2a6217[_0x36cbe0(0x1f6)][MCP_SERVER_NAME]=_0x3f94a3,writeFileSync(_0x44a8aa,JSON[_0x36cbe0(0x228)](_0x2a6217,null,0x2),_0x36cbe0(0x1ec)),logger[_0x36cbe0(0x203)]('mcp-install',_0x36cbe0(0x212),{'appcode':_0x193044,'env':_0x4e0899,'path':_0x44a8aa}),await copyCursorRules(_0x46a44e),{'ide':_0x36cbe0(0x1f8),'status':_0x36cbe0(0x1e6),'message':_0x36cbe0(0x219)};}catch(_0x52f431){return logger[_0x36cbe0(0x1e2)](_0x36cbe0(0x20e),_0x36cbe0(0x205),{'error':_0x52f431 instanceof Error?_0x52f431[_0x36cbe0(0x229)]:String(_0x52f431)}),{'ide':'Cursor','status':'error','message':_0x52f431 instanceof Error?_0x52f431[_0x36cbe0(0x229)]:String(_0x52f431)};}}export async function configureClaudeMcp(_0x46f111){const _0x5206b5=a4_0x59c374,_0x110768=_0x46f111||process[_0x5206b5(0x1fa)](),_0x9c5036=readConfig(_0x110768),_0x4b62b6=_0x9c5036[_0x5206b5(0x211)]||_0x9c5036[_0x5206b5(0x220)],_0x5af3e0=_0x9c5036[_0x5206b5(0x1e3)]||_0x5206b5(0x214);if(!_0x4b62b6)return{'ide':_0x5206b5(0x22a),'status':_0x5206b5(0x1e2),'message':_0x5206b5(0x22c)};let _0x31a4cb=_0x5206b5(0x202)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x5206b5(0x200)]('\x20')+_0x5206b5(0x210)+_0x4b62b6;return _0x5af3e0!==_0x5206b5(0x214)&&(_0x31a4cb+='\x20-e\x20LOVRABET_ENV='+_0x5af3e0),await copyAgentsMd(_0x110768),logger[_0x5206b5(0x203)]('mcp-install',_0x5206b5(0x1f3),{'command':_0x31a4cb,'appcode':_0x4b62b6,'env':_0x5af3e0}),console[_0x5206b5(0x225)](_0x5206b5(0x1e4)),console[_0x5206b5(0x225)]('\x20\x20'+_0x31a4cb+'\x0a'),console[_0x5206b5(0x225)](_0x5206b5(0x213)),console[_0x5206b5(0x225)](_0x5206b5(0x1fd)+_0x4b62b6),_0x5af3e0!==_0x5206b5(0x214)&&console[_0x5206b5(0x225)](_0x5206b5(0x223)+_0x5af3e0),console['log'](_0x5206b5(0x218)),{'ide':'Claude\x20Code','status':_0x5206b5(0x21f),'message':'请手动执行:\x20'+_0x31a4cb};}export async function showOtherGuide(_0x2c5dc9){const _0x283be4=a4_0x59c374,_0x2b94cd=_0x2c5dc9||process[_0x283be4(0x1fa)](),_0x323873=readConfig(_0x2b94cd),_0x1ad954=_0x323873[_0x283be4(0x211)]||_0x323873['app'],_0x4c16f9=_0x323873['env']||_0x283be4(0x214);if(!_0x1ad954)return{'ide':'其他','status':'error','message':'需要先配置\x20appcode'};return console[_0x283be4(0x225)](_0x283be4(0x201)),console[_0x283be4(0x225)]('{'),console[_0x283be4(0x225)](_0x283be4(0x21e)),console[_0x283be4(0x225)]('\x20\x20\x20\x20\x22'+MCP_SERVER_NAME+_0x283be4(0x1eb)),console[_0x283be4(0x225)]('\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22'+MCP_COMMAND+'\x22,'),console['log'](_0x283be4(0x1fc)+MCP_ARGS[_0x283be4(0x227)](_0x21f86b=>'\x22'+_0x21f86b+'\x22')[_0x283be4(0x200)](',\x20')+'],'),console[_0x283be4(0x225)](_0x283be4(0x1ef)),console[_0x283be4(0x225)](_0x283be4(0x21a)+_0x1ad954+'\x22,'),_0x4c16f9!==_0x283be4(0x214)&&console[_0x283be4(0x225)](_0x283be4(0x21c)+_0x4c16f9+'\x22,'),console['log'](_0x283be4(0x20d)),console[_0x283be4(0x225)](_0x283be4(0x1e0)),console['log'](_0x283be4(0x1f2)),console[_0x283be4(0x225)]('}\x0a'),logger[_0x283be4(0x203)](_0x283be4(0x20e),_0x283be4(0x1ee),{'appcode':_0x1ad954,'env':_0x4c16f9}),{'ide':'其他','status':_0x283be4(0x21f),'message':'配置指引已显示'};}export async function configureMcp(_0x4b7af5,_0x4a32f4){const _0x11529e=a4_0x59c374;switch(_0x4b7af5){case _0x11529e(0x1f9):return await configureCursorMcp(_0x4a32f4);case _0x11529e(0x215):return await configureClaudeMcp(_0x4a32f4);default:throw new Error(_0x11529e(0x1ff)+_0x4b7af5);}}async function copyCursorRules(_0x278d0f){const _0x465978=a4_0x59c374,_0x32d55c=join(_0x278d0f,_0x465978(0x1df)),_0xdd0c73=join(_0x32d55c,_0x465978(0x20b));if(existsSync(_0xdd0c73))return;try{!existsSync(_0x32d55c)&&mkdirSync(_0x32d55c,{'recursive':!![]});const _0x2f2c8f=resolve(__dirname,_0x465978(0x1de));existsSync(_0x2f2c8f)&&(copyFileSync(_0x2f2c8f,_0xdd0c73),logger['info'](_0x465978(0x20e),_0x465978(0x1ea),{'from':_0x2f2c8f,'to':_0xdd0c73}));}catch(_0x387c0b){logger[_0x465978(0x1e2)](_0x465978(0x20e),_0x465978(0x217),{'error':_0x387c0b instanceof Error?_0x387c0b[_0x465978(0x229)]:String(_0x387c0b)});}}async function copyAgentsMd(_0x5e53ff){const _0xe432bd=a4_0x59c374,_0x422806=join(_0x5e53ff,'agents.md');if(existsSync(_0x422806))return;try{const _0x3615a5=resolve(__dirname,_0xe432bd(0x1de));if(existsSync(_0x3615a5)){const _0xb645de=readFileSync(_0x3615a5,_0xe432bd(0x1ec));writeFileSync(_0x422806,_0xb645de,'utf-8'),logger[_0xe432bd(0x203)]('mcp-install',_0xe432bd(0x1f0),{'from':_0x3615a5,'to':_0x422806});}}catch(_0x17a0f0){logger[_0xe432bd(0x1e2)](_0xe432bd(0x20e),_0xe432bd(0x208),{'error':_0x17a0f0 instanceof Error?_0x17a0f0[_0xe432bd(0x229)]:String(_0x17a0f0)});}}export const SKILL_IDE_CONFIGS=IDE_CONFIGS;export async function installSkill(_0x4951af,_0x33973a){const _0x46c6b5=a4_0x59c374,_0x4ee52b=_0x33973a||process['cwd'](),_0x5eaf07=resolve(__dirname,_0x46c6b5(0x21b)),_0x177f12=SKILL_IDE_CONFIGS[_0x4951af];if(!_0x177f12)return{'ide':_0x4951af,'status':_0x46c6b5(0x1e2),'message':_0x46c6b5(0x221)+_0x4951af};const _0x3e271d=_0x177f12['name'];try{const _0x5def32=await installSingleIDE(_0x4951af,_0x177f12,_0x4ee52b,_0x5eaf07);return logger[_0x46c6b5(0x203)](_0x46c6b5(0x216),_0x3e271d+_0x46c6b5(0x206),{'ide':_0x4951af,'filesCount':_0x5def32}),{'ide':_0x3e271d,'status':'success','message':'已创建\x20'+_0x5def32+'\x20项'};}catch(_0x55a7e3){return logger[_0x46c6b5(0x1e2)]('skill-install',_0x3e271d+_0x46c6b5(0x20a),{'error':_0x55a7e3 instanceof Error?_0x55a7e3[_0x46c6b5(0x229)]:String(_0x55a7e3)}),{'ide':_0x3e271d,'status':_0x46c6b5(0x1e2),'message':_0x55a7e3 instanceof Error?_0x55a7e3[_0x46c6b5(0x229)]:String(_0x55a7e3)};}}async function copyDir(_0x2e03ee,_0x3923da){const _0x48579c=a4_0x59c374,{statSync:_0x1c6506}=await import(_0x48579c(0x226)),{readdirSync:_0xc2f286}=await import('node:fs'),_0x10d76b=_0x1c6506(_0x2e03ee);if(_0x10d76b['isDirectory']()){!existsSync(_0x3923da)&&mkdirSync(_0x3923da,{'recursive':!![]});const _0x520e55=_0xc2f286(_0x2e03ee);for(const _0x37dae0 of _0x520e55){await copyDir(join(_0x2e03ee,_0x37dae0),join(_0x3923da,_0x37dae0));}}else copyFileSync(_0x2e03ee,_0x3923da);}export async function copySharedSkills(_0x22795a){const _0xe19dc1=a4_0x59c374,_0x49661b=_0x22795a||process['cwd'](),_0x3829df=resolve(__dirname,_0xe19dc1(0x21b)),_0xddfd4c=join(_0x3829df,_0xe19dc1(0x1e7)),_0x509340=join(_0x49661b,_0xe19dc1(0x20c));if(!existsSync(_0xddfd4c))return![];try{return await copyDir(_0xddfd4c,_0x509340),logger[_0xe19dc1(0x203)](_0xe19dc1(0x216),_0xe19dc1(0x1fb),{'path':_0x509340}),!![];}catch(_0x54fdb8){return logger[_0xe19dc1(0x1e2)](_0xe19dc1(0x216),'共享技能文件复制失败',{'error':_0x54fdb8 instanceof Error?_0x54fdb8[_0xe19dc1(0x229)]:String(_0x54fdb8)}),![];}}export function createSkillManifest(_0x4b2725,_0x45f9ac){const _0xcc9a74=a4_0x59c374,_0x4d8a2b={'version':_0xcc9a74(0x1e5),'installedAt':new Date()['toISOString'](),'platforms':_0x45f9ac},_0x36ef0b=join(_0x4b2725,_0xcc9a74(0x207)),_0x48298b=join(_0x4b2725,_0xcc9a74(0x1f5));!existsSync(_0x48298b)&&mkdirSync(_0x48298b,{'recursive':!![]}),writeFileSync(_0x36ef0b,JSON[_0xcc9a74(0x228)](_0x4d8a2b,null,0x2),_0xcc9a74(0x1ec)),logger[_0xcc9a74(0x203)](_0xcc9a74(0x216),_0xcc9a74(0x1f1),{'path':_0x36ef0b});}
|
|
1
|
+
const a4_0x13ff0d=a4_0x544c;(function(_0xd69700,_0x5e46ff){const _0x5053a4=a4_0x544c,_0x33d457=_0xd69700();while(!![]){try{const _0x427d4e=parseInt(_0x5053a4(0x1b7))/0x1+-parseInt(_0x5053a4(0x1a4))/0x2+-parseInt(_0x5053a4(0x1c5))/0x3*(parseInt(_0x5053a4(0x1ae))/0x4)+-parseInt(_0x5053a4(0x1eb))/0x5+-parseInt(_0x5053a4(0x1c7))/0x6*(-parseInt(_0x5053a4(0x1a5))/0x7)+parseInt(_0x5053a4(0x1aa))/0x8+-parseInt(_0x5053a4(0x1c1))/0x9*(-parseInt(_0x5053a4(0x1b4))/0xa);if(_0x427d4e===_0x5e46ff)break;else _0x33d457['push'](_0x33d457['shift']());}catch(_0x3c6969){_0x33d457['push'](_0x33d457['shift']());}}}(a4_0x4649,0xb4d17));import{existsSync,mkdirSync,writeFileSync,readFileSync,copyFileSync}from'node:fs';import{join,resolve,dirname}from'node:path';function a4_0x4649(){const _0x17c138=['已创建\x20','object','.shared','\x20-e\x20LOVRABET_ENV=','lovrabet_rules.mdc','需要先配置\x20appcode','其他\x20IDE\x20配置指引已显示','已写入\x20.cursor/mcp.json','\x20-e\x20LOVRABET_APP_CODE=','error','\x20\x20}','appcode','.lovrabet/skill-manifest.json','复制\x20Cursor\x20Rules\x20文件失败','agents.md','mcp.json','parse','配置指引已显示','online','success','\x20\x20\x20\x20\x22','manual','共享技能文件复制失败','.cursor','../../templates/skills','未知的\x20IDE:\x20','lovrabet-dataset','Claude\x20Code\x20MCP\x20命令已生成','3559125FNSUWl','mcp-install','配置信息:','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','../../templates/rules/lovrabet_rules.mdc.tpl','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','join','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','创建技能包\x20manifest','2441710dnlbgZ','7cDNYKA','mcpServers','app','请手动执行:\x20','\x0a📋\x20其他\x20IDE\x20MCP\x20配置:\x0a','3724672lWAzPf','env','info','.lovrabet','2848796KZzihc','2.0.0','rules','\x20技能包安装成功','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','isDirectory','10HKXAMP','Cursor\x20MCP\x20配置失败','共享技能文件复制成功','1264531CDmXcS','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','utf-8','@lovrabet/dataset-mcp-server@latest','\x20\x20AppCode:\x20','stringify','cwd','map','npx','log','5658327WJRZUu','\x20\x20环境:\x20','cursor','Cursor','3izhwKx','创建\x20agents.md\x20文件','6160152wECewP','claude\x20mcp\x20add\x20','toISOString','skill-install','LOVRABET_ENV','不支持的\x20MCP\x20IDE:\x20','message','node:fs'];a4_0x4649=function(){return _0x17c138;};return a4_0x4649();}import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';import{logger}from'../utils/logger.js';function a4_0x544c(_0x5770e0,_0x37c459){_0x5770e0=_0x5770e0-0x1a2;const _0x464906=a4_0x4649();let _0x544c68=_0x464906[_0x5770e0];return _0x544c68;}import{IDE_CONFIGS}from'../utils/ai_config.js';import{installSingleIDE}from'../skills/skill-installer.js';const __dirname=dirname(fileURLToPath(import.meta.url)),MCP_SERVER_NAME=a4_0x13ff0d(0x1e9),MCP_COMMAND=a4_0x13ff0d(0x1bf),MCP_ARGS=[a4_0x13ff0d(0x1ba)];export function buildEnvConfig(_0x2d3ab9,_0x46b80b){const _0x4fe841=a4_0x13ff0d,_0x38dd34={'LOVRABET_APP_CODE':String(_0x2d3ab9)};return _0x46b80b!=='online'&&(_0x38dd34[_0x4fe841(0x1cb)]=String(_0x46b80b)),_0x38dd34;}export async function configureCursorMcp(_0x38165a){const _0x65e952=a4_0x13ff0d,_0x291165=_0x38165a||process[_0x65e952(0x1bd)](),_0x4869ba=readConfig(_0x291165),_0x427286=_0x4869ba[_0x65e952(0x1da)]||_0x4869ba[_0x65e952(0x1a7)],_0x6d3f96=_0x4869ba['env']||_0x65e952(0x1e1);if(!_0x427286)return{'ide':_0x65e952(0x1c4),'status':'error','message':_0x65e952(0x1d4)};const _0x229ab5=buildEnvConfig(_0x427286,_0x6d3f96),_0x5eeaa3={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x229ab5},_0x16a5fb=join(_0x291165,_0x65e952(0x1e6),_0x65e952(0x1de)),_0x4ab712=join(_0x291165,_0x65e952(0x1e6));try{!existsSync(_0x4ab712)&&mkdirSync(_0x4ab712,{'recursive':!![]});let _0x5e0b6d={'mcpServers':{}};if(existsSync(_0x16a5fb)){const _0x5879d2=readFileSync(_0x16a5fb,_0x65e952(0x1b9));_0x5e0b6d=JSON[_0x65e952(0x1df)](_0x5879d2);}return(!_0x5e0b6d[_0x65e952(0x1a6)]||typeof _0x5e0b6d['mcpServers']!==_0x65e952(0x1d0))&&(_0x5e0b6d[_0x65e952(0x1a6)]={}),_0x5e0b6d[_0x65e952(0x1a6)][MCP_SERVER_NAME]=_0x5eeaa3,writeFileSync(_0x16a5fb,JSON[_0x65e952(0x1bc)](_0x5e0b6d,null,0x2),_0x65e952(0x1b9)),logger['info'](_0x65e952(0x1ec),'Cursor\x20MCP\x20配置成功',{'appcode':_0x427286,'env':_0x6d3f96,'path':_0x16a5fb}),await copyCursorRules(_0x4ab712),{'ide':_0x65e952(0x1c4),'status':_0x65e952(0x1e2),'message':_0x65e952(0x1d6)};}catch(_0x2452b2){return logger[_0x65e952(0x1d8)](_0x65e952(0x1ec),_0x65e952(0x1b5),{'error':_0x2452b2 instanceof Error?_0x2452b2[_0x65e952(0x1cd)]:String(_0x2452b2)}),{'ide':_0x65e952(0x1c4),'status':_0x65e952(0x1d8),'message':_0x2452b2 instanceof Error?_0x2452b2['message']:String(_0x2452b2)};}}export async function configureClaudeMcp(_0x371b04){const _0xb1e6d4=a4_0x13ff0d,_0x2eebeb=_0x371b04||process[_0xb1e6d4(0x1bd)](),_0x32e4ea=readConfig(_0x2eebeb),_0x209fe6=_0x32e4ea['appcode']||_0x32e4ea[_0xb1e6d4(0x1a7)],_0x51fd39=_0x32e4ea['env']||_0xb1e6d4(0x1e1);if(!_0x209fe6)return{'ide':'Claude\x20Code','status':_0xb1e6d4(0x1d8),'message':_0xb1e6d4(0x1d4)};let _0x214363=_0xb1e6d4(0x1c8)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0xb1e6d4(0x1f2)]('\x20')+_0xb1e6d4(0x1d7)+_0x209fe6;return _0x51fd39!=='online'&&(_0x214363+=_0xb1e6d4(0x1d2)+_0x51fd39),await copyAgentsMd(_0x2eebeb),logger[_0xb1e6d4(0x1ac)](_0xb1e6d4(0x1ec),_0xb1e6d4(0x1ea),{'command':_0x214363,'appcode':_0x209fe6,'env':_0x51fd39}),console['log'](_0xb1e6d4(0x1b8)),console['log']('\x20\x20'+_0x214363+'\x0a'),console[_0xb1e6d4(0x1c0)](_0xb1e6d4(0x1ed)),console[_0xb1e6d4(0x1c0)](_0xb1e6d4(0x1bb)+_0x209fe6),_0x51fd39!==_0xb1e6d4(0x1e1)&&console[_0xb1e6d4(0x1c0)](_0xb1e6d4(0x1c2)+_0x51fd39),console['log'](_0xb1e6d4(0x1f1)),{'ide':'Claude\x20Code','status':_0xb1e6d4(0x1e4),'message':_0xb1e6d4(0x1a8)+_0x214363};}export async function showOtherGuide(_0x40026c){const _0x10b7cb=a4_0x13ff0d,_0xa0631b=_0x40026c||process[_0x10b7cb(0x1bd)](),_0x12a296=readConfig(_0xa0631b),_0x4faaa8=_0x12a296[_0x10b7cb(0x1da)]||_0x12a296[_0x10b7cb(0x1a7)],_0x325b3f=_0x12a296[_0x10b7cb(0x1ab)]||_0x10b7cb(0x1e1);if(!_0x4faaa8)return{'ide':'其他','status':_0x10b7cb(0x1d8),'message':_0x10b7cb(0x1d4)};return console[_0x10b7cb(0x1c0)](_0x10b7cb(0x1a9)),console['log']('{'),console[_0x10b7cb(0x1c0)]('\x20\x20\x22mcpServers\x22:\x20{'),console[_0x10b7cb(0x1c0)](_0x10b7cb(0x1e3)+MCP_SERVER_NAME+'\x22:\x20{'),console[_0x10b7cb(0x1c0)](_0x10b7cb(0x1a2)+MCP_COMMAND+'\x22,'),console['log'](_0x10b7cb(0x1ee)+MCP_ARGS[_0x10b7cb(0x1be)](_0x4a4301=>'\x22'+_0x4a4301+'\x22')['join'](',\x20')+'],'),console[_0x10b7cb(0x1c0)](_0x10b7cb(0x1ef)),console[_0x10b7cb(0x1c0)](_0x10b7cb(0x1b2)+_0x4faaa8+'\x22,'),_0x325b3f!==_0x10b7cb(0x1e1)&&console['log']('\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22'+_0x325b3f+'\x22,'),console['log']('\x20\x20\x20\x20\x20\x20}'),console[_0x10b7cb(0x1c0)]('\x20\x20\x20\x20}'),console[_0x10b7cb(0x1c0)](_0x10b7cb(0x1d9)),console[_0x10b7cb(0x1c0)]('}\x0a'),logger[_0x10b7cb(0x1ac)](_0x10b7cb(0x1ec),_0x10b7cb(0x1d5),{'appcode':_0x4faaa8,'env':_0x325b3f}),{'ide':'其他','status':_0x10b7cb(0x1e4),'message':_0x10b7cb(0x1e0)};}export async function configureMcp(_0x4ff2a4,_0x4f1a76){const _0x1e8239=a4_0x13ff0d;switch(_0x4ff2a4){case _0x1e8239(0x1c3):return await configureCursorMcp(_0x4f1a76);case'claude':return await configureClaudeMcp(_0x4f1a76);default:throw new Error(_0x1e8239(0x1cc)+_0x4ff2a4);}}async function copyCursorRules(_0x21bdcf){const _0x5114a1=a4_0x13ff0d,_0x3b0869=join(_0x21bdcf,_0x5114a1(0x1b0)),_0x475208=join(_0x3b0869,_0x5114a1(0x1d3));if(existsSync(_0x475208))return;try{!existsSync(_0x3b0869)&&mkdirSync(_0x3b0869,{'recursive':!![]});const _0x2860bb=resolve(__dirname,_0x5114a1(0x1f0));existsSync(_0x2860bb)&&(copyFileSync(_0x2860bb,_0x475208),logger[_0x5114a1(0x1ac)](_0x5114a1(0x1ec),'创建\x20Cursor\x20Rules\x20文件',{'from':_0x2860bb,'to':_0x475208}));}catch(_0x51d280){logger[_0x5114a1(0x1d8)](_0x5114a1(0x1ec),_0x5114a1(0x1dc),{'error':_0x51d280 instanceof Error?_0x51d280[_0x5114a1(0x1cd)]:String(_0x51d280)});}}async function copyAgentsMd(_0x4be2c2){const _0x33972f=a4_0x13ff0d,_0x5b8ecc=join(_0x4be2c2,_0x33972f(0x1dd));if(existsSync(_0x5b8ecc))return;try{const _0x38aab4=resolve(__dirname,_0x33972f(0x1f0));if(existsSync(_0x38aab4)){const _0x78fa8f=readFileSync(_0x38aab4,_0x33972f(0x1b9));writeFileSync(_0x5b8ecc,_0x78fa8f,'utf-8'),logger[_0x33972f(0x1ac)]('mcp-install',_0x33972f(0x1c6),{'from':_0x38aab4,'to':_0x5b8ecc});}}catch(_0x39aa02){logger[_0x33972f(0x1d8)](_0x33972f(0x1ec),'复制\x20agents.md\x20文件失败',{'error':_0x39aa02 instanceof Error?_0x39aa02[_0x33972f(0x1cd)]:String(_0x39aa02)});}}export const SKILL_IDE_CONFIGS=IDE_CONFIGS;export async function installSkill(_0x1a48e1,_0xfd95c8){const _0x161184=a4_0x13ff0d,_0x438aeb=_0xfd95c8||process['cwd'](),_0x3bc233=resolve(__dirname,_0x161184(0x1e7)),_0x441c6d=SKILL_IDE_CONFIGS[_0x1a48e1];if(!_0x441c6d)return{'ide':_0x1a48e1,'status':_0x161184(0x1d8),'message':_0x161184(0x1e8)+_0x1a48e1};const _0x1d50a6=_0x441c6d['name'];try{const _0xaf6185=await installSingleIDE(_0x1a48e1,_0x441c6d,_0x438aeb,_0x3bc233);return logger[_0x161184(0x1ac)](_0x161184(0x1ca),_0x1d50a6+_0x161184(0x1b1),{'ide':_0x1a48e1,'filesCount':_0xaf6185}),{'ide':_0x1d50a6,'status':_0x161184(0x1e2),'message':_0x161184(0x1cf)+_0xaf6185+'\x20项'};}catch(_0x4f4f94){return logger['error']('skill-install',_0x1d50a6+'\x20技能包安装失败',{'error':_0x4f4f94 instanceof Error?_0x4f4f94['message']:String(_0x4f4f94)}),{'ide':_0x1d50a6,'status':'error','message':_0x4f4f94 instanceof Error?_0x4f4f94[_0x161184(0x1cd)]:String(_0x4f4f94)};}}async function copyDir(_0x37e542,_0x2916d2){const _0x1b0741=a4_0x13ff0d,{statSync:_0x407bfe}=await import(_0x1b0741(0x1ce)),{readdirSync:_0x2cd408}=await import(_0x1b0741(0x1ce)),_0x44f523=_0x407bfe(_0x37e542);if(_0x44f523[_0x1b0741(0x1b3)]()){!existsSync(_0x2916d2)&&mkdirSync(_0x2916d2,{'recursive':!![]});const _0x1cbcd2=_0x2cd408(_0x37e542);for(const _0x297705 of _0x1cbcd2){await copyDir(join(_0x37e542,_0x297705),join(_0x2916d2,_0x297705));}}else copyFileSync(_0x37e542,_0x2916d2);}export async function copySharedSkills(_0xc471bf){const _0x46681f=a4_0x13ff0d,_0x508659=_0xc471bf||process[_0x46681f(0x1bd)](),_0x4849aa=resolve(__dirname,_0x46681f(0x1e7)),_0x4fd643=join(_0x4849aa,_0x46681f(0x1d1)),_0x348ece=join(_0x508659,'.lovrabet/skill/.shared');if(!existsSync(_0x4fd643))return![];try{return await copyDir(_0x4fd643,_0x348ece),logger[_0x46681f(0x1ac)](_0x46681f(0x1ca),_0x46681f(0x1b6),{'path':_0x348ece}),!![];}catch(_0x2ef58e){return logger['error']('skill-install',_0x46681f(0x1e5),{'error':_0x2ef58e instanceof Error?_0x2ef58e['message']:String(_0x2ef58e)}),![];}}export function createSkillManifest(_0x41e2b3,_0x5dcbc7){const _0x5bbaff=a4_0x13ff0d,_0x167f27={'version':_0x5bbaff(0x1af),'installedAt':new Date()[_0x5bbaff(0x1c9)](),'platforms':_0x5dcbc7},_0x119785=join(_0x41e2b3,_0x5bbaff(0x1db)),_0x300dce=join(_0x41e2b3,_0x5bbaff(0x1ad));!existsSync(_0x300dce)&&mkdirSync(_0x300dce,{'recursive':!![]}),writeFileSync(_0x119785,JSON[_0x5bbaff(0x1bc)](_0x167f27,null,0x2),_0x5bbaff(0x1b9)),logger[_0x5bbaff(0x1ac)](_0x5bbaff(0x1ca),_0x5bbaff(0x1a3),{'path':_0x119785});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x16f5ad,_0x14c262){const _0x4c8d3f=a5_0x2d00,_0x34cbc8=_0x16f5ad();while(!![]){try{const _0x11f094=parseInt(_0x4c8d3f(0x200))/0x1*(parseInt(_0x4c8d3f(0x21f))/0x2)+parseInt(_0x4c8d3f(0x20b))/0x3*(parseInt(_0x4c8d3f(0x219))/0x4)+-parseInt(_0x4c8d3f(0x1ef))/0x5+parseInt(_0x4c8d3f(0x1f8))/0x6+-parseInt(_0x4c8d3f(0x1e6))/0x7+-parseInt(_0x4c8d3f(0x1fd))/0x8*(-parseInt(_0x4c8d3f(0x1f4))/0x9)+-parseInt(_0x4c8d3f(0x21a))/0xa;if(_0x11f094===_0x14c262)break;else _0x34cbc8['push'](_0x34cbc8['shift']());}catch(_0x11d847){_0x34cbc8['push'](_0x34cbc8['shift']());}}}(a5_0x1a2c,0x7a067));import{jsx as a5_0x15d340,jsxs as a5_0x27c90c,Fragment as a5_0x3b4c03}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';function a5_0x2d00(_0x254e9f,_0x74d64a){_0x254e9f=_0x254e9f-0x1e5;const _0x1a2c93=a5_0x1a2c();let _0x2d0002=_0x1a2c93[_0x254e9f];return _0x2d0002;}import{initEnv}from'../constant/env.js';import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';function a5_0x1a2c(){const _0x24ec33=['length','\x20个数据集','success','error',',\x20失败\x20','48buJVMJ','\x20个数据集中筛选出\x20','gray','√\x20文档生成完成!成功\x20','指定的数据集代码都不存在:\x20','online','lovrabet\x20auth','*\x20输出目录:\x20','datasetCode','未找到任何数据集','log','\x20个数据集的文档...','*\x20共处理\x20','使用指定的应用AppCode:\x20','124708qHySuG','7182240NYsRQN','red','*\x20生成的文档文件:','cyan','💡\x20请使用\x20','2khsuXF','\x20-\x20','160748pbVWAV','🚀\x20','未提供应用AppCode,且配置中也没有默认值','map','env','string','文档生成完成','datasetName','includes','4461195iuNhaN','api-doc','\x1b[33m!\x20以下数据集代码不存在:\x20','.md\x20(','\x20(环境:\x20','2700738PIWKzO','setLogPath','filter','⚠️\x20以下数据集生成失败:','284250uCRcOg','join','message','\x1b[0m','\x1b[90m*\x20从\x20','16bxhdFn','yellow','green','986871UskKJo','filePath','\x20重新登录后再试','column','dim','文档生成失败:\x20'];a5_0x1a2c=function(){return _0x24ec33;};return a5_0x1a2c();}export const ApiDocUI=({appCode:_0x3d15c8,env:_0x4dab85,output:_0xe30bca,extraParams:_0x415572,datasetCodes:_0x1545ac})=>{const _0x46fc1c=a5_0x2d00,{exit:_0x4d31ae}=useApp(),[_0x4053ab,_0x23dba3]=useState(![]),[_0xb505c3,_0xd3dbb2]=useState(''),[_0x42f981,_0xf72a99]=useState(![]),[_0x1b733a,_0x32e22d]=useState(null),[_0x3b1b77,_0x367260]=useState(null),[_0x337054,_0x5b295e]=useState(0x0),_0x2b3a25=readConfig(),_0x2a7cd0=getConfigAppCode(),_0x131034=_0x3d15c8||_0x2a7cd0,_0x3a051c=typeof _0x2b3a25?.[_0x46fc1c(0x1ea)]===_0x46fc1c(0x1eb)?_0x2b3a25['env']:undefined,_0x469f95=_0x4dab85||_0x3a051c||_0x46fc1c(0x210);initEnv(_0x469f95);const _0x27f237=_0xe30bca||'./docs',_0x5ea9c8=_0x3d15c8?_0x46fc1c(0x218)+_0x131034:'使用配置的应用AppCode:\x20'+_0x131034;useEffect(()=>{_0x23dba3(!![]),_0x15bcc6();},[]),useEffect(()=>{(_0x42f981||_0x1b733a)&&_0x4d31ae();},[_0x42f981,_0x1b733a,_0x4d31ae]);async function _0x15bcc6(){const _0x5523ba=_0x46fc1c;if(!_0x131034){_0x32e22d(_0x5523ba(0x1e8));return;}try{logger[_0x5523ba(0x1f5)](process['cwd']()),_0xd3dbb2('正在获取数据集列表...');const {configArray:_0x55aa78}=await fetchModelList(_0x131034);_0x5b295e(_0x55aa78[_0x5523ba(0x206)]);if(_0x55aa78[_0x5523ba(0x206)]===0x0){_0x32e22d(_0x5523ba(0x214));return;}let _0x4b289d=_0x55aa78;if(_0x1545ac&&_0x1545ac['length']>0x0){_0x4b289d=_0x55aa78[_0x5523ba(0x1f6)](_0x57cb0b=>_0x1545ac[_0x5523ba(0x1ee)](_0x57cb0b[_0x5523ba(0x213)]));const _0x4cddd2=_0x4b289d[_0x5523ba(0x1e9)](_0x4c88a8=>_0x4c88a8[_0x5523ba(0x213)]),_0x3fd594=_0x1545ac['filter'](_0x5ab403=>!_0x4cddd2[_0x5523ba(0x1ee)](_0x5ab403));_0x3fd594[_0x5523ba(0x206)]>0x0&&console['log'](_0x5523ba(0x1f1)+_0x3fd594['join'](',\x20')+_0x5523ba(0x1fb));if(_0x4b289d['length']===0x0){_0x32e22d(_0x5523ba(0x20f)+_0x1545ac[_0x5523ba(0x1f9)](',\x20'));return;}console[_0x5523ba(0x215)](_0x5523ba(0x1fc)+_0x55aa78[_0x5523ba(0x206)]+_0x5523ba(0x20c)+_0x4b289d[_0x5523ba(0x206)]+'\x20个匹配的数据集\x1b[0m');}_0xd3dbb2('正在生成\x20'+_0x4b289d[_0x5523ba(0x206)]+_0x5523ba(0x216));const _0x5bfd9c=await generateDatasetDocs(_0x4b289d,_0x131034,_0x27f237,(_0x1bca42,_0xdf5d7,_0x18985e)=>{const _0x593a30=_0x5523ba;_0xd3dbb2('正在生成\x20'+_0x18985e+_0x593a30(0x1f2)+_0x1bca42+'/'+_0xdf5d7+')');},_0x415572);_0x367260(_0x5bfd9c),_0xf72a99(!![]);const _0x307af9=_0x5bfd9c[_0x5523ba(0x1f6)](_0x30565a=>_0x30565a[_0x5523ba(0x208)])['length'],_0x200a32=_0x5bfd9c[_0x5523ba(0x1f6)](_0x30a02a=>!_0x30a02a['success'])[_0x5523ba(0x206)];logger[_0x5523ba(0x208)](_0x5523ba(0x1f0),_0x5523ba(0x1ec),undefined,{'totalCount':_0x5bfd9c[_0x5523ba(0x206)],'successCount':_0x307af9,'failCount':_0x200a32,'outputDir':_0x27f237});}catch(_0x2fe830){const _0x10b62b=_0x2fe830 instanceof Error?_0x2fe830[_0x5523ba(0x1fa)]:String(_0x2fe830);logger[_0x5523ba(0x209)]('api-doc',_0x5523ba(0x205)+_0x10b62b,{'appCode':_0x131034,'outputDir':_0x27f237}),_0x32e22d(_0x5523ba(0x205)+_0x10b62b);}finally{_0x23dba3(![]);}}const _0x31b62c=_0x3b1b77?.[_0x46fc1c(0x1f6)](_0x2fa2f3=>_0x2fa2f3[_0x46fc1c(0x208)])[_0x46fc1c(0x206)]||0x0,_0x538979=_0x3b1b77?.['filter'](_0x1ba9c9=>!_0x1ba9c9[_0x46fc1c(0x208)])[_0x46fc1c(0x206)]||0x0;return a5_0x27c90c(Box,{'flexDirection':_0x46fc1c(0x203),'children':[(_0x4053ab||_0x42f981)&&a5_0x27c90c(Box,{'children':[a5_0x15d340(Text,{'color':_0x46fc1c(0x20d),'children':'*\x20'}),a5_0x15d340(Text,{'color':_0x3d15c8?'white':_0x46fc1c(0x204),'children':_0x5ea9c8})]}),_0x4053ab&&a5_0x15d340(Box,{'children':a5_0x27c90c(Text,{'children':[_0x46fc1c(0x1e7),_0xb505c3,_0x46fc1c(0x1f3),_0x469f95,')']})}),_0x42f981&&_0x3b1b77&&a5_0x27c90c(Box,{'flexDirection':'column','children':[a5_0x15d340(Box,{'children':a5_0x27c90c(Text,{'color':_0x46fc1c(0x1ff),'children':[_0x46fc1c(0x20e),_0x31b62c,'\x20个',_0x538979>0x0&&_0x46fc1c(0x20a)+_0x538979+'\x20个']})}),a5_0x15d340(Box,{'marginTop':0x1,'children':a5_0x27c90c(Text,{'color':_0x46fc1c(0x20d),'children':[_0x46fc1c(0x217),_0x337054,_0x46fc1c(0x207)]})}),a5_0x27c90c(Box,{'marginTop':0x1,'children':[a5_0x15d340(Text,{'color':'gray','children':_0x46fc1c(0x212)}),a5_0x15d340(Text,{'color':'cyan','children':_0x27f237})]}),_0x31b62c>0x0&&a5_0x27c90c(a5_0x3b4c03,{'children':[a5_0x15d340(Box,{'marginTop':0x1,'children':a5_0x15d340(Text,{'color':_0x46fc1c(0x20d),'children':_0x46fc1c(0x21c)})}),_0x3b1b77[_0x46fc1c(0x1f6)](_0x22496d=>_0x22496d[_0x46fc1c(0x208)])[_0x46fc1c(0x1e9)]((_0x9cf2cf,_0x487f4a)=>a5_0x27c90c(Box,{'marginLeft':0x2,'children':[a5_0x27c90c(Text,{'color':_0x46fc1c(0x21d),'children':['•\x20',_0x9cf2cf[_0x46fc1c(0x201)]]}),a5_0x27c90c(Text,{'color':_0x46fc1c(0x204),'children':[_0x46fc1c(0x1e5),_0x9cf2cf[_0x46fc1c(0x1ed)]]})]},_0x487f4a))]}),_0x538979>0x0&&a5_0x27c90c(a5_0x3b4c03,{'children':[a5_0x15d340(Box,{'marginTop':0x1,'children':a5_0x15d340(Text,{'color':_0x46fc1c(0x1fe),'children':_0x46fc1c(0x1f7)})}),_0x3b1b77[_0x46fc1c(0x1f6)](_0x5b5dad=>!_0x5b5dad[_0x46fc1c(0x208)])[_0x46fc1c(0x1e9)]((_0x584fa5,_0x3e8ab1)=>a5_0x27c90c(Box,{'marginLeft':0x2,'flexDirection':_0x46fc1c(0x203),'children':[a5_0x27c90c(Text,{'color':_0x46fc1c(0x21b),'children':['•\x20',_0x584fa5[_0x46fc1c(0x1ed)],'\x20(',_0x584fa5['datasetCode'],')']}),_0x584fa5[_0x46fc1c(0x209)]&&a5_0x15d340(Box,{'marginLeft':0x2,'children':a5_0x15d340(Text,{'color':_0x46fc1c(0x204),'children':_0x584fa5['error']})})]},_0x3e8ab1))]})]}),_0x1b733a&&a5_0x27c90c(Box,{'flexDirection':_0x46fc1c(0x203),'children':[a5_0x15d340(Box,{'children':a5_0x27c90c(Text,{'color':_0x46fc1c(0x21b),'children':['❌\x20',_0x1b733a]})}),_0x1b733a[_0x46fc1c(0x1ee)]('登录')&&a5_0x27c90c(Box,{'marginTop':0x1,'children':[a5_0x15d340(Text,{'color':_0x46fc1c(0x1fe),'children':_0x46fc1c(0x21e)}),a5_0x15d340(Text,{'color':_0x46fc1c(0x21d),'children':_0x46fc1c(0x211)}),a5_0x15d340(Text,{'color':'yellow','children':_0x46fc1c(0x202)})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x20ae06,_0x5192d3){const _0xf35133=a6_0x2c03,_0x4d40c0=_0x20ae06();while(!![]){try{const _0xcff492=-parseInt(_0xf35133(0xbf))/0x1*(-parseInt(_0xf35133(0xba))/0x2)+parseInt(_0xf35133(0xc1))/0x3*(-parseInt(_0xf35133(0xc9))/0x4)+-parseInt(_0xf35133(0xc0))/0x5+-parseInt(_0xf35133(0xa9))/0x6*(-parseInt(_0xf35133(0xa7))/0x7)+parseInt(_0xf35133(0xbb))/0x8*(parseInt(_0xf35133(0xb9))/0x9)+-parseInt(_0xf35133(0xc4))/0xa+parseInt(_0xf35133(0xae))/0xb*(parseInt(_0xf35133(0xb2))/0xc);if(_0xcff492===_0x5192d3)break;else _0x4d40c0['push'](_0x4d40c0['shift']());}catch(_0x593fcc){_0x4d40c0['push'](_0x4d40c0['shift']());}}}(a6_0x3a5d,0xd4b18));import{mkdirSync,writeFileSync}from'node:fs';import a6_0x36d5a8 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';function a6_0x2c03(_0x3e6937,_0x2331dc){_0x3e6937=_0x3e6937-0xa2;const _0x3a5d44=a6_0x3a5d();let _0x2c037d=_0x3a5d44[_0x3e6937];return _0x2c037d;}export async function fetchDatasetDoc(_0x5d7854){const _0x3b70b9=a6_0x2c03,{appCode:_0x43d0a1,datasetCode:_0x292057,datasetId:_0x2927c3,extraParams:_0x147be7}=_0x5d7854,_0x2e30cd=getApiDomain(),_0x1a6349=_0x2e30cd+_0x3b70b9(0xbc),_0x2ff3a7={'appCode':_0x43d0a1,'datasetCode':_0x292057,'datasetId':_0x2927c3,..._0x147be7||{}},_0x5eb0ce=await fetch(_0x1a6349,{'method':'POST','headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x3b70b9(0xb4)](_0x2ff3a7)});if(!_0x5eb0ce['ok']){if(_0x5eb0ce[_0x3b70b9(0xc6)]===0x191)throw new Error(_0x3b70b9(0xc3));let _0x39b498='';try{_0x39b498=await _0x5eb0ce[_0x3b70b9(0xab)]();}catch(_0x2fcad6){}throw new Error('获取文档失败\x20('+_0x292057+'),HTTP状态码:\x20'+_0x5eb0ce[_0x3b70b9(0xc6)]+(_0x39b498?'\x0a'+_0x39b498:''));}const _0x114fb7=await _0x5eb0ce[_0x3b70b9(0xad)]();if(!_0x114fb7[_0x3b70b9(0xc5)]||typeof _0x114fb7['data'][_0x3b70b9(0xa2)]!==_0x3b70b9(0xa3))throw new Error('响应数据格式错误\x20('+_0x292057+_0x3b70b9(0xb0));return _0x114fb7[_0x3b70b9(0xc5)][_0x3b70b9(0xa2)];}function delay(_0x59cded){return new Promise(_0x21fc6e=>setTimeout(_0x21fc6e,_0x59cded));}function a6_0x3a5d(){const _0x46433b=['.md\x20(','.md\x20-\x20','7pfzxyV','✓\x20成功生成:\x20','3988794PLhkUi','message','text','length','json','209MgsOlg','.md','):缺少\x20data.markdown\x20字段','join','1294356dqqdlj','log','stringify','push','api-doc','utf8','success','9YgmoSO','138Udlktu','1918352ZxFwNY','/api/node-toolbox/api-doc-generator','tableName','error','23507QSxPLD','6694190jjErvs','108gmuVKB','datasetCode','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','6880190HPxYCR','data','status','生成文档失败:\x20','name','186436YuPFxc','markdown','string','\x20个数据集需要生成文档\x0a'];a6_0x3a5d=function(){return _0x46433b;};return a6_0x3a5d();}export async function generateDatasetDocs(_0x576643,_0xd58f93,_0x572526='./docs',_0x2949b4,_0x433e3a){const _0x36f7e5=a6_0x2c03;mkdirSync(_0x572526,{'recursive':!![]});const _0x365bbe=[],_0x5e42a5=_0x576643['length'];console['log']('\x0a共有\x20'+_0x5e42a5+_0x36f7e5(0xa4));for(let _0x3c1351=0x0;_0x3c1351<_0x576643[_0x36f7e5(0xac)];_0x3c1351++){const _0x76bd58=_0x576643[_0x3c1351],_0x2bbff8=_0x3c1351+0x1,_0x5d23fe=_0x76bd58[_0x36f7e5(0xbd)];try{console[_0x36f7e5(0xb3)]('['+_0x2bbff8+'/'+_0x5e42a5+']\x20正在生成:\x20'+_0x5d23fe+_0x36f7e5(0xa5)+_0x76bd58['name']+')');_0x2949b4&&_0x2949b4(_0x2bbff8,_0x5e42a5,_0x5d23fe);const _0x10ed6e=await fetchDatasetDoc({'appCode':_0xd58f93,'datasetCode':_0x76bd58['datasetCode'],'datasetId':_0x76bd58['id'],'enableAI':![],'extraParams':_0x433e3a}),_0x4b4094=a6_0x36d5a8[_0x36f7e5(0xb1)](_0x572526,_0x5d23fe+_0x36f7e5(0xaf));writeFileSync(_0x4b4094,_0x10ed6e,{'encoding':_0x36f7e5(0xb7)}),console['log'](_0x36f7e5(0xa8)+_0x5d23fe+_0x36f7e5(0xaf)),logger[_0x36f7e5(0xb8)]('api-doc','生成文档成功:\x20'+_0x5d23fe,undefined,{'datasetCode':_0x76bd58[_0x36f7e5(0xc2)],'datasetName':_0x76bd58[_0x36f7e5(0xc8)],'filePath':_0x4b4094,'progress':_0x2bbff8+'/'+_0x5e42a5}),_0x365bbe[_0x36f7e5(0xb5)]({'datasetCode':_0x76bd58[_0x36f7e5(0xc2)],'datasetName':_0x76bd58[_0x36f7e5(0xc8)],'filePath':_0x4b4094,'success':!![]}),_0x2bbff8<_0x5e42a5&&await delay(0x1388);}catch(_0x515feb){const _0x4ac06c=_0x515feb instanceof Error?_0x515feb[_0x36f7e5(0xaa)]:String(_0x515feb);console[_0x36f7e5(0xb3)]('✗\x20失败:\x20'+_0x5d23fe+_0x36f7e5(0xa6)+_0x4ac06c+'\x0a'),logger[_0x36f7e5(0xbe)](_0x36f7e5(0xb6),_0x36f7e5(0xc7)+_0x76bd58[_0x36f7e5(0xc2)],{'datasetCode':_0x76bd58[_0x36f7e5(0xc2)],'datasetName':_0x76bd58[_0x36f7e5(0xc8)],'error':_0x4ac06c,'progress':_0x2bbff8+'/'+_0x5e42a5}),_0x365bbe[_0x36f7e5(0xb5)]({'datasetCode':_0x76bd58[_0x36f7e5(0xc2)],'datasetName':_0x76bd58[_0x36f7e5(0xc8)],'filePath':'','success':![],'error':_0x4ac06c}),_0x2bbff8<_0x5e42a5&&(console[_0x36f7e5(0xb3)]('等待\x203\x20秒...\x0a'),await delay(0xbb8));}}return _0x365bbe;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1d27cf,_0x3866fa){const _0x27b485=a7_0x5eea,_0x150e5a=_0x1d27cf();while(!![]){try{const _0x1fc66b=parseInt(_0x27b485(0x1b2))/0x1+parseInt(_0x27b485(0x1c4))/0x2+parseInt(_0x27b485(0x1b5))/0x3*(-parseInt(_0x27b485(0x1ce))/0x4)+parseInt(_0x27b485(0x1b1))/0x5*(-parseInt(_0x27b485(0x1c9))/0x6)+parseInt(_0x27b485(0x1c1))/0x7+parseInt(_0x27b485(0x1a8))/0x8+-parseInt(_0x27b485(0x19e))/0x9*(parseInt(_0x27b485(0x1aa))/0xa);if(_0x1fc66b===_0x3866fa)break;else _0x150e5a['push'](_0x150e5a['shift']());}catch(_0x4041ec){_0x150e5a['push'](_0x150e5a['shift']());}}}(a7_0x5a62,0xb15c9));import{jsx as a7_0x471c23,jsxs as a7_0x331cec}from'react/jsx-runtime';function a7_0x5eea(_0x1d4465,_0xdc4de0){_0x1d4465=_0x1d4465-0x19e;const _0x5a6242=a7_0x5a62();let _0x5eea6f=_0x5a6242[_0x1d4465];return _0x5eea6f;}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';function a7_0x5a62(){const _0x5c2afe=['1195362UsWGPm','setLogPath','slice','error','\x20个数据集,生成','967158hcZeKl','*\x20已生成文件:','red','cyan','💡\x20请使用\x20','77876yeCAJF','duplicateCount','153iSTjeM','split','-\x20模型配置文件\x20(','api','√\x20成功拉取\x20','client','length','lovrabet\x20auth','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','online','215312EstBts','-api','269110EjKSCR','column','datasetCount','join','white','message','{\x20lovrabetClient\x20}','25LxqheH','403512sYnZnU','green','\x20个模型)','33NGWCXZ','modelCount','!\x20原始数据集\x20','拉取\x20API\x20配置失败:\x20','\x20-\x20客户端实例文件','\x20重新登录后再试','./src/api/','includes','.ts','yellow','originalCount','未提供应用AppCode,且配置中也没有默认值','8231839jryqWH','env','replace'];a7_0x5a62=function(){return _0x5c2afe;};return a7_0x5a62();}import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x2f9a9c,env:_0x27cefd,output:_0x23fe23})=>{const _0x257e0b=a7_0x5eea,{exit:_0x22a5b3}=useApp(),[_0x16140e,_0x4ea94a]=useState(![]),[_0xeed937,_0x3d25d6]=useState(![]),[_0x5e154f,_0x1442a4]=useState(null),[_0x15838d,_0x4571b2]=useState(null),_0x2f0bfa=readConfig(),_0x2f5486=getConfigAppCode(),_0x516f05=_0x2f9a9c||_0x2f5486,_0x44cd16=typeof _0x2f0bfa?.['env']==='string'?_0x2f0bfa[_0x257e0b(0x1c2)]:undefined,_0x270101=_0x27cefd||_0x44cd16||_0x257e0b(0x1a7);initEnv(_0x270101);const _0x51ce0f=_0x23fe23||_0x257e0b(0x1bb),_0x336381=_0x2f9a9c&&_0x2f9a9c[_0x257e0b(0x1bc)]('-')?_0x2f9a9c[_0x257e0b(0x19f)]('-')[_0x257e0b(0x1c6)](0x1)[_0x257e0b(0x1ad)]('-'):'',_0x165a5c=_0x2f9a9c?'使用指定的应用AppCode:\x20'+_0x516f05:'使用配置的应用AppCode:\x20'+_0x516f05,_0x1d4625=_0x336381?_0x336381+_0x257e0b(0x1a9):_0x257e0b(0x1a1),_0x25bc72=_0x336381?_0x336381+'-client':_0x257e0b(0x1a3);useEffect(()=>{_0x4ea94a(!![]),_0x55d348();},[]),useEffect(()=>{(_0xeed937||_0x5e154f)&&_0x22a5b3();},[_0xeed937,_0x5e154f,_0x22a5b3]);async function _0x55d348(){const _0x4ae778=_0x257e0b;if(!_0x516f05){_0x1442a4(_0x4ae778(0x1c0));return;}try{logger[_0x4ae778(0x1c5)](process['cwd']());const {configArray:_0x4136c4}=await fetchModelList(_0x516f05),_0x279042=_0x4136c4[_0x4ae778(0x1a4)],_0x2328ac=!_0x2f9a9c,_0x5f41bb=await generateApiFile(_0x4136c4,_0x336381,_0x516f05,_0x2328ac,_0x270101,_0x51ce0f),_0x228300=_0x51ce0f['endsWith']('/')?_0x51ce0f:_0x51ce0f+'/';_0x4571b2({'api':''+_0x228300+_0x1d4625+_0x4ae778(0x1bd),'client':''+_0x228300+_0x25bc72+_0x4ae778(0x1bd),'modelCount':_0x5f41bb[_0x4ae778(0x1b6)],'datasetCount':_0x279042,'originalCount':_0x279042,'duplicateCount':0x0}),_0x3d25d6(!![]);}catch(_0x438392){const _0x262c27=_0x438392 instanceof Error?_0x438392[_0x4ae778(0x1af)]:String(_0x438392);logger[_0x4ae778(0x1c7)]('api-pull',_0x4ae778(0x1b8)+_0x262c27,{'appCode':_0x516f05,'error':_0x262c27}),_0x1442a4(_0x4ae778(0x1b8)+_0x262c27);}finally{_0x4ea94a(![]);}}return a7_0x331cec(Box,{'flexDirection':'column','children':[(_0x16140e||_0xeed937)&&a7_0x331cec(Box,{'children':[a7_0x471c23(Text,{'color':'gray','children':'*\x20'}),a7_0x471c23(Text,{'color':_0x2f9a9c?_0x257e0b(0x1ae):'dim','children':_0x165a5c})]}),_0x16140e&&a7_0x471c23(Box,{'children':a7_0x331cec(Text,{'children':[_0x257e0b(0x1a6),_0x270101,')']})}),_0xeed937&&_0x15838d&&a7_0x331cec(Box,{'flexDirection':'column','children':[a7_0x471c23(Box,{'children':a7_0x331cec(Text,{'color':_0x257e0b(0x1b3),'children':[_0x257e0b(0x1a2),_0x15838d[_0x257e0b(0x1ac)],_0x257e0b(0x1c8),'\x20',_0x15838d[_0x257e0b(0x1b6)],'\x20个模型']})}),_0x15838d[_0x257e0b(0x1cf)]>0x0&&a7_0x471c23(Box,{'marginTop':0x1,'children':a7_0x331cec(Text,{'color':_0x257e0b(0x1be),'children':[_0x257e0b(0x1b7),_0x15838d[_0x257e0b(0x1bf)],'\x20个,过滤重复','\x20',_0x15838d['duplicateCount'],'\x20个']})}),a7_0x471c23(Box,{'marginTop':0x1,'children':a7_0x471c23(Text,{'color':'gray','children':_0x257e0b(0x1ca)})}),a7_0x331cec(Box,{'marginLeft':0x2,'children':[a7_0x331cec(Text,{'color':'cyan','children':['•\x20',_0x15838d[_0x257e0b(0x1a1)]]}),a7_0x331cec(Text,{'color':'dim','children':['\x20',_0x257e0b(0x1a0),_0x15838d[_0x257e0b(0x1b6)],_0x257e0b(0x1b4)]})]}),a7_0x331cec(Box,{'marginLeft':0x2,'children':[a7_0x331cec(Text,{'color':'cyan','children':['•\x20',_0x15838d[_0x257e0b(0x1a3)]]}),a7_0x471c23(Text,{'color':'dim','children':_0x257e0b(0x1b9)})]}),a7_0x471c23(Box,{'marginTop':0x1,'children':a7_0x471c23(Text,{'color':'gray','children':'*\x20导入方式:'})}),a7_0x471c23(Box,{'marginLeft':0x2,'children':a7_0x331cec(Text,{'color':_0x257e0b(0x1be),'children':['import\x20',_0x257e0b(0x1b0),'\x20from\x20\x27@/',_0x15838d[_0x257e0b(0x1a3)][_0x257e0b(0x1c3)](/^\.\//,'')[_0x257e0b(0x1c3)](_0x257e0b(0x1bd),''),'\x27']})})]}),_0x5e154f&&a7_0x331cec(Box,{'flexDirection':_0x257e0b(0x1ab),'children':[a7_0x471c23(Box,{'children':a7_0x331cec(Text,{'color':_0x257e0b(0x1cb),'children':['❌\x20',_0x5e154f]})}),_0x5e154f['includes']('登录')&&a7_0x331cec(Box,{'marginTop':0x1,'children':[a7_0x471c23(Text,{'color':_0x257e0b(0x1be),'children':_0x257e0b(0x1cd)}),a7_0x471c23(Text,{'color':_0x257e0b(0x1cc),'children':_0x257e0b(0x1a5)}),a7_0x471c23(Text,{'color':_0x257e0b(0x1be),'children':_0x257e0b(0x1ba)})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x16c5d3,_0x1a7126){const _0x3eab69=a8_0x283e,_0x3f1994=_0x16c5d3();while(!![]){try{const _0x55a2a8=-parseInt(_0x3eab69(0x1c9))/0x1*(parseInt(_0x3eab69(0x1c8))/0x2)+parseInt(_0x3eab69(0x1b4))/0x3*(parseInt(_0x3eab69(0x1c0))/0x4)+-parseInt(_0x3eab69(0x1ae))/0x5*(-parseInt(_0x3eab69(0x1b3))/0x6)+-parseInt(_0x3eab69(0x1bd))/0x7*(parseInt(_0x3eab69(0x1c5))/0x8)+parseInt(_0x3eab69(0x1bc))/0x9*(-parseInt(_0x3eab69(0x1c4))/0xa)+-parseInt(_0x3eab69(0x1c1))/0xb+parseInt(_0x3eab69(0x1c6))/0xc;if(_0x55a2a8===_0x1a7126)break;else _0x3f1994['push'](_0x3f1994['shift']());}catch(_0x21f579){_0x3f1994['push'](_0x3f1994['shift']());}}}(a8_0x42e7,0x89fbc));import{getCookie}from'../auth/get-cookie.js';function a8_0x42e7(){const _0x555493=['fetch-model-list','status','116oDjPLR','9896029qJVdTo','获取数据集失败,HTTP状态码:\x20','UNAUTHORIZED','3100HUrxfG','1475664eFjsym','21172992EkhAfG','未知错误','55682qHDCjx','3BHswRn','includes','10LZzfaN','count','/api/node-toolbox/dataset/model-list?appcode=','code','data','1066242AAnehN','76344nfqAot','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','info','configArray','error','正在从服务器拉取模型列表...\x20(环境:\x20','401','errorMessage','11241VRkciL','35AQIBxr'];a8_0x42e7=function(){return _0x555493;};return a8_0x42e7();}import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';import{getEnv}from'../constant/env.js';function a8_0x283e(_0x413e04,_0x19f5c){_0x413e04=_0x413e04-0x1ae;const _0x42e7ae=a8_0x42e7();let _0x283e9a=_0x42e7ae[_0x413e04];return _0x283e9a;}export async function fetchModelList(_0x4c2694){const _0x30a00b=a8_0x283e,_0x50cf06=getEnv(),_0x3efcc6=getApiDomain()+_0x30a00b(0x1b0)+_0x4c2694+'&otype=array';logger[_0x30a00b(0x1b6)](_0x30a00b(0x1be),_0x30a00b(0x1b9)+_0x50cf06+')',{'apiUrl':_0x3efcc6});const _0x4ea63a=await fetch(_0x3efcc6,{'headers':{'Cookie':getCookie()}});if(!_0x4ea63a['ok']){if(_0x4ea63a[_0x30a00b(0x1bf)]===0x191)throw new Error(_0x30a00b(0x1b5));throw new Error(_0x30a00b(0x1c2)+_0x4ea63a['status']);}const _0x1410ab=await _0x4ea63a['json']();if(!_0x1410ab['success']){const _0x139679=_0x1410ab['errorMsg']||_0x1410ab['message']||_0x1410ab[_0x30a00b(0x1b2)]?.['message']||_0x1410ab[_0x30a00b(0x1bb)]||_0x1410ab[_0x30a00b(0x1b8)]||_0x30a00b(0x1c7);if(_0x139679[_0x30a00b(0x1ca)]('401')||_0x139679['includes']('Unauthorized')||_0x139679['includes']('登录')||_0x139679[_0x30a00b(0x1ca)]('认证')||_0x1410ab['errorCode']===_0x30a00b(0x1c3)||_0x1410ab['code']===0x191||_0x1410ab[_0x30a00b(0x1b1)]===_0x30a00b(0x1ba))throw new Error(_0x30a00b(0x1b5));throw new Error('获取数据集失败:\x20'+_0x139679);}return{'configArray':_0x1410ab['data'][_0x30a00b(0x1b7)],'count':_0x1410ab[_0x30a00b(0x1b2)][_0x30a00b(0x1af)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a9_0x1be46f=a9_0x3362;(function(_0x17b82d,_0xf72040){const _0x3e4772=a9_0x3362,_0x846978=_0x17b82d();while(!![]){try{const _0x2bc9ae=parseInt(_0x3e4772(0x110))/0x1*(-parseInt(_0x3e4772(0xed))/0x2)+parseInt(_0x3e4772(0x10d))/0x3+-parseInt(_0x3e4772(0xfa))/0x4*(parseInt(_0x3e4772(0xf1))/0x5)+-parseInt(_0x3e4772(0xec))/0x6+-parseInt(_0x3e4772(0x114))/0x7*(parseInt(_0x3e4772(0xfe))/0x8)+parseInt(_0x3e4772(0xf2))/0x9+parseInt(_0x3e4772(0x104))/0xa;if(_0x2bc9ae===_0xf72040)break;else _0x846978['push'](_0x846978['shift']());}catch(_0x286939){_0x846978['push'](_0x846978['shift']());}}}(a9_0x5c18,0xa25d0));function a9_0x3362(_0x304bb2,_0x2a889e){_0x304bb2=_0x304bb2-0xe9;const _0x5c1888=a9_0x5c18();let _0x33620d=_0x5c1888[_0x304bb2];return _0x33620d;}import a9_0x1f89ea from'prettier';import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a9_0xfbc04 from'node:path';import{fileURLToPath}from'node:url';import{readConfig}from'../utils/config.js';function a9_0x5c18(){const _0x538016=['alias','../..','23026460QiFFQB','string','.ts','resolve','push','client','join','replaceApiContent','forEach','3599268YdJOyk','typescript','-api','81eUhJEq','success','./src/api/','slice','7YsvoNh',',\x20env:\x20\x22','{\x20apiConfigName:\x20','datasetCode','env','4727148pciwue','14438ScXJpo','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','endsWith','dirname','365uGkzXm','5370651ZSXCdN','CONFIG_NAMES.DEFAULT','utf8','\x22\x20}','api.ts.tpl','-client','app','client.ts.tpl','52684cqRztB','name','key','format','8800168KYeRfv','tableName','api','online'];a9_0x5c18=function(){return _0x538016;};return a9_0x5c18();}import{TemplateReplacer}from'../utils/template-replacer.js';import{logger}from'../utils/logger.js';export async function generateApiFile(_0x4bb13a,_0x385a5c='',_0xb26630,_0x5c0ba4=![],_0x1d8981,_0x1ded21=a9_0x1be46f(0x112)){const _0x33e7d2=a9_0x1be46f,_0x549111=readConfig(),_0x2eccb5=_0xb26630||_0x549111?.[_0x33e7d2(0xf8)];if(typeof _0x2eccb5!==_0x33e7d2(0x105)||!_0x2eccb5)throw new Error(_0x33e7d2(0xee));const _0x247ce5=_0x5c0ba4?_0x33e7d2(0xf3):'\x22'+_0x2eccb5+'\x22',_0x17a7e2=typeof _0x549111[_0x33e7d2(0xeb)]===_0x33e7d2(0x105)?_0x549111['env']:undefined,_0x2239ab=_0x1d8981||_0x17a7e2||_0x33e7d2(0x101),_0x403daf=_0x2239ab!=='online';let _0x538fde;if(_0x5c0ba4)_0x403daf?_0x538fde=_0x33e7d2(0xe9)+_0x247ce5+_0x33e7d2(0x115)+_0x2239ab+_0x33e7d2(0xf5):_0x538fde='';else{const _0x5edf07=_0x403daf?',\x20env:\x20\x22'+_0x2239ab+'\x22':'';_0x538fde='{\x20apiConfigName:\x20\x22'+_0x2eccb5+'\x22'+_0x5edf07+'\x20}';}const _0x146506=_0x385a5c?_0x385a5c+_0x33e7d2(0x10f):_0x33e7d2(0x100),_0x4a39a6=_0x385a5c?_0x385a5c+_0x33e7d2(0xf7):_0x33e7d2(0x109),_0x46199c=[];_0x4bb13a[_0x33e7d2(0x10c)](_0x28d6ac=>{const _0x420fcd=_0x33e7d2;_0x46199c[_0x420fcd(0x108)]({'datasetCode':_0x28d6ac[_0x420fcd(0xea)],'tableName':_0x28d6ac[_0x420fcd(0xff)],'name':_0x28d6ac[_0x420fcd(0xfb)]||'','alias':_0x28d6ac[_0x420fcd(0x102)]||_0x28d6ac[_0x420fcd(0xfc)]});});const _0x53b1e1=fileURLToPath(import.meta.url),_0x3c2807=a9_0xfbc04[_0x33e7d2(0x107)](a9_0xfbc04[_0x33e7d2(0xf0)](_0x53b1e1),_0x33e7d2(0x103)),_0x427503=a9_0xfbc04[_0x33e7d2(0x10a)](_0x3c2807,'templates/generate-api'),_0x14b7df=a9_0xfbc04['join'](_0x427503,_0x33e7d2(0xf6)),_0x4d402b=a9_0xfbc04['join'](_0x427503,_0x33e7d2(0xf9)),_0x2c662e=_0x1ded21[_0x33e7d2(0xef)]('/')?_0x1ded21[_0x33e7d2(0x113)](0x0,-0x1):_0x1ded21;mkdirSync(_0x2c662e,{'recursive':!![]});const _0x5caa7a=_0x46199c[0x0]?.[_0x33e7d2(0x102)],_0x3f84d0=readFileSync(_0x14b7df,_0x33e7d2(0xf4)),_0x4e5325=TemplateReplacer['replaceApiContent'](_0x3f84d0,_0x2eccb5,_0x46199c,_0x5caa7a,_0x146506,_0x247ce5),_0x10ab69=await a9_0x1f89ea[_0x33e7d2(0xfd)](_0x4e5325,{'parser':'typescript'}),_0x260eee=_0x2c662e+'/'+_0x146506+_0x33e7d2(0x106);writeFileSync(_0x260eee,_0x10ab69,{'encoding':'utf8'});const _0x184d00=readFileSync(_0x4d402b,_0x33e7d2(0xf4)),_0xb7c3ca=TemplateReplacer[_0x33e7d2(0x10b)](_0x184d00,_0x2eccb5,_0x46199c,_0x5caa7a,_0x146506,_0x247ce5,_0x538fde),_0x429391=await a9_0x1f89ea[_0x33e7d2(0xfd)](_0xb7c3ca,{'parser':_0x33e7d2(0x10e)}),_0x3ed312=_0x2c662e+'/'+_0x4a39a6+_0x33e7d2(0x106);writeFileSync(_0x3ed312,_0x429391,{'encoding':_0x33e7d2(0xf4)});const _0x1b1eca=_0x46199c['length'];return logger[_0x33e7d2(0x111)]('init-api','API\x20文件生成成功!',undefined,{'apiFile':_0x260eee,'clientFile':_0x3ed312,'modelCount':_0x1b1eca,'configName':_0x247ce5}),{'modelCount':_0x1b1eca,'apiFilePath':_0x260eee,'clientFilePath':_0x3ed312,'configName':_0x247ce5};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a10_0x33aa(){const _0x51b1b6=['isArray','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','flags','!\x20请使用以下方式之一:','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','env','error','trim','593314zfzByk','\x20\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件','filter','input','×\x20--datasetcode\x20参数不能为空','pull','\x1b[90m*\x20仅生成指定数据集的文档:\x20','\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','parse','map','10381041kQWqRV','\x20\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成\x20API\x20文档','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>','371DqCSze','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','4MKnpox','\x20\x20错误:\x20','请使用\x20--appcode\x20参数,例如:','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','appcode','help','100410iWOsdK','doc','length','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','params','Unknown\x20api\x20command:\x20','datasetcode','×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象','log','54078TXCHuD','\x1b[0m','\x1b[90m*\x20使用配置的应用AppCode:\x20','4777750taKsLO','object','\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','output','4504624bGXIzy','exit','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','string','×\x20未配置\x20AppCode','201088HdQjAa'];a10_0x33aa=function(){return _0x51b1b6;};return a10_0x33aa();}(function(_0x4e7a42,_0x469233){const _0xf629d6=a10_0x1efc,_0x4e7df4=_0x4e7a42();while(!![]){try{const _0x1a7418=-parseInt(_0xf629d6(0x1e0))/0x1+parseInt(_0xf629d6(0x20c))/0x2+-parseInt(_0xf629d6(0x200))/0x3*(parseInt(_0xf629d6(0x1f0))/0x4)+parseInt(_0xf629d6(0x203))/0x5+-parseInt(_0xf629d6(0x1f6))/0x6*(-parseInt(_0xf629d6(0x1ee))/0x7)+parseInt(_0xf629d6(0x207))/0x8+-parseInt(_0xf629d6(0x1eb))/0x9;if(_0x1a7418===_0x469233)break;else _0x4e7df4['push'](_0x4e7df4['shift']());}catch(_0x1ba0e9){_0x4e7df4['push'](_0x4e7df4['shift']());}}}(a10_0x33aa,0xb4fda));import{jsx as a10_0x566887}from'react/jsx-runtime';import{render}from'ink';import{ApiPullUI}from'./api-pull-ui.js';import{ApiDocUI}from'./api-doc-ui.js';import{getConfigAppCode}from'../utils/config.js';function a10_0x1efc(_0x33ba9e,_0xdd6209){_0x33ba9e=_0x33ba9e-0x1d8;const _0x33aaf8=a10_0x33aa();let _0x1efc0d=_0x33aaf8[_0x33ba9e];return _0x1efc0d;}export async function apiCli(_0x3f0d0e){const _0x2352c1=a10_0x1efc,_0x37233f=_0x3f0d0e[_0x2352c1(0x1e3)][0x1];if(_0x3f0d0e['flags'][_0x2352c1(0x1f5)]){console[_0x2352c1(0x1ff)]('\x0alovrabet\x20api\x20-\x20API\x20相关操作\x0a\x0a用法:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20[options]\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20[options]\x0a\x0a选项:\x0a\x20\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20指定应用代码\x0a\x20\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20指定输出目录(pull:\x20./src/api/,doc:\x20./docs)\x0a\x20\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20指定环境(如:daily、online)\x0a\x20\x20--datasetcode\x20<codes>\x20指定要生成文档的数据集代码(多个用逗号分隔,仅\x20doc\x20命令)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20显示此帮助信息\x0a\x0a示例:\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20拉取并生成\x20API\x20配置文件\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--output\x20./api\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20pull\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境拉取\x20API\x0a\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20生成所有数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--appcode\x20myapp\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--output\x20./docs\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--env\x20daily\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境生成文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20只生成指定数据集的文档\x0a\x20\x20$\x20lovrabet\x20api\x20doc\x20--datasetcode\x20ds_001,ds_002\x20\x20\x20\x20\x20\x20//\x20生成多个数据集的文档\x0a');return;}if(_0x37233f===_0x2352c1(0x1e5)){_0x3f0d0e[_0x2352c1(0x1e3)][0x2]&&(console['error']('❌\x20错误:不再支持位置参数方式'),console['log'](_0x2352c1(0x1f2)),console[_0x2352c1(0x1ff)](_0x2352c1(0x209)+_0x3f0d0e[_0x2352c1(0x1e3)][0x2]),process[_0x2352c1(0x208)](0x1));const _0x36f852=getConfigAppCode();let _0x445f29=_0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x1f4)];const _0x23b07b=typeof _0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x1dd)]===_0x2352c1(0x20a)?_0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x1dd)]:undefined,_0x43cd67=_0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x206)];!_0x445f29&&!_0x36f852&&(console[_0x2352c1(0x1de)](_0x2352c1(0x20b)),console[_0x2352c1(0x1ff)](_0x2352c1(0x1db)),console[_0x2352c1(0x1ff)](_0x2352c1(0x1fa)),console['log'](_0x2352c1(0x1ed)),process[_0x2352c1(0x208)](0x1)),_0x445f29&&_0x36f852&&_0x445f29===_0x36f852&&(console[_0x2352c1(0x1ff)](_0x2352c1(0x202)+_0x445f29+_0x2352c1(0x201)),console[_0x2352c1(0x1ff)](_0x2352c1(0x1dc)),_0x445f29=undefined),render(a10_0x566887(ApiPullUI,{'appCode':_0x445f29,'env':_0x23b07b,'output':_0x43cd67}));}else{if(_0x37233f===_0x2352c1(0x1f7)){_0x3f0d0e[_0x2352c1(0x1e3)][0x2]&&(console[_0x2352c1(0x1de)]('❌\x20错误:不再支持位置参数方式'),console['log'](_0x2352c1(0x1f2)),console[_0x2352c1(0x1ff)](_0x2352c1(0x1d9)+_0x3f0d0e[_0x2352c1(0x1e3)][0x2]),process[_0x2352c1(0x208)](0x1));const _0x45dcc7=getConfigAppCode();let _0x24425b=_0x3f0d0e[_0x2352c1(0x1da)]['appcode'];const _0x40cc52=typeof _0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x1dd)]===_0x2352c1(0x20a)?_0x3f0d0e['flags'][_0x2352c1(0x1dd)]:undefined,_0x56ca3b=_0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x206)],_0x4e3444=_0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x1fb)],_0x5596f3=_0x3f0d0e[_0x2352c1(0x1da)][_0x2352c1(0x1fd)];!_0x24425b&&!_0x45dcc7&&(console[_0x2352c1(0x1de)]('×\x20未配置\x20AppCode'),console[_0x2352c1(0x1ff)]('!\x20请使用以下方式之一:'),console[_0x2352c1(0x1ff)]('\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>'),console[_0x2352c1(0x1ff)](_0x2352c1(0x1ef)),process[_0x2352c1(0x208)](0x1));_0x24425b&&_0x45dcc7&&_0x24425b===_0x45dcc7&&(console[_0x2352c1(0x1ff)](_0x2352c1(0x202)+_0x24425b+_0x2352c1(0x201)),_0x24425b=undefined);let _0x51f281;if(_0x4e3444)try{_0x51f281=JSON[_0x2352c1(0x1e9)](_0x4e3444),(typeof _0x51f281!==_0x2352c1(0x204)||_0x51f281===null||Array[_0x2352c1(0x1d8)](_0x51f281))&&(console['error'](_0x2352c1(0x1fe)),process[_0x2352c1(0x208)](0x1));}catch(_0x515e47){console[_0x2352c1(0x1de)]('×\x20--params\x20参数不是有效的\x20JSON\x20格式'),console['error'](_0x2352c1(0x1f1)+(_0x515e47 instanceof Error?_0x515e47['message']:String(_0x515e47))),process['exit'](0x1);}let _0x4df145;_0x5596f3&&(_0x4df145=_0x5596f3['split'](',')[_0x2352c1(0x1ea)](_0x24ccd0=>_0x24ccd0[_0x2352c1(0x1df)]())[_0x2352c1(0x1e2)](_0x550c76=>_0x550c76[_0x2352c1(0x1f8)]>0x0),_0x4df145[_0x2352c1(0x1f8)]===0x0&&(console[_0x2352c1(0x1de)](_0x2352c1(0x1e4)),process['exit'](0x1)),console[_0x2352c1(0x1ff)](_0x2352c1(0x1e6)+_0x4df145['join'](',\x20')+_0x2352c1(0x201))),render(a10_0x566887(ApiDocUI,{'appCode':_0x24425b,'env':_0x40cc52,'output':_0x56ca3b,'extraParams':_0x51f281,'datasetCodes':_0x4df145}));}else console[_0x2352c1(0x1de)](_0x2352c1(0x1fc)+_0x37233f),console['log']('Available\x20commands:'),console[_0x2352c1(0x1ff)](_0x2352c1(0x1e1)),console['log'](_0x2352c1(0x1e8)),console[_0x2352c1(0x1ff)](_0x2352c1(0x1e7)),console[_0x2352c1(0x1ff)](_0x2352c1(0x205)),console['log'](''),console[_0x2352c1(0x1ff)](_0x2352c1(0x1ec)),console['log'](_0x2352c1(0x1f9)),console[_0x2352c1(0x1ff)]('\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)'),console['log'](_0x2352c1(0x1f3)),process['exit'](0x1);}}
|