@lovrabet/cli 1.2.5-beta.7 → 1.3.0-beta.9
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
|
-
|
|
1
|
+
(function(_0x40ef53,_0x471357){const _0x294970=a0_0x452e,_0x4ad8aa=_0x40ef53();while(!![]){try{const _0x344889=parseInt(_0x294970(0xde))/0x1*(parseInt(_0x294970(0xda))/0x2)+parseInt(_0x294970(0xd8))/0x3+-parseInt(_0x294970(0xce))/0x4+parseInt(_0x294970(0xc6))/0x5*(parseInt(_0x294970(0xc3))/0x6)+parseInt(_0x294970(0xcd))/0x7+-parseInt(_0x294970(0xc4))/0x8*(-parseInt(_0x294970(0xe3))/0x9)+-parseInt(_0x294970(0xdb))/0xa*(parseInt(_0x294970(0xd9))/0xb);if(_0x344889===_0x471357)break;else _0x4ad8aa['push'](_0x4ad8aa['shift']());}catch(_0x5cd0e0){_0x4ad8aa['push'](_0x4ad8aa['shift']());}}}(a0_0x412c,0x8da91));import{jsx as a0_0x420e18,jsxs as a0_0x48043a}from'react/jsx-runtime';import{useState}from'react';function a0_0x452e(_0x3b62d3,_0x16834c){_0x3b62d3=_0x3b62d3-0xc3;const _0x412cf8=a0_0x412c();let _0x452e44=_0x412cf8[_0x3b62d3];return _0x452e44;}function a0_0x412c(){const _0x167457=['test','路径不能包含连续的\x20/','页面路径长度不能超过\x20100\x20个字符','619086otnOJN','1826869MKMjyy','20RABdBO','70HSOwUQ','路径不能以\x20/\x20开头或结尾','delete','40097PfNJCw','slice','页面路径不合法','endsWith','startsWith','1442817qwhirV','1607646LMrfNW','56vnSpSp','split','5llaFuO','页面路径\x20','\x20已存在,请使用其他路径','length','trim','\x20←\x20','\x20Step2:\x20','4869018bOBGcF','3800976gDbSuq','\x20直接回车确认,或输入自定义路由地址','return','gray','red','includes','my-page'];a0_0x412c=function(){return _0x167457;};return a0_0x412c();}import{Text,Box,useInput}from'ink';import a0_0x3f8dd9 from'node:fs';export function InputProjectCode(_0x5c5f7f){const _0x283656=a0_0x452e,{onSubmit:_0x19707d,pagePath:_0x536c91}=_0x5c5f7f,[_0x1be5d3,_0x18c2a8]=useState(''),[_0x50150f,_0x3e964a]=useState(''),_0x3d1b1a=_0x283656(0xd4);function _0x4df319(_0x52261f){const _0x35e1cb=_0x283656;if(_0x52261f[_0x35e1cb(0xc9)]>0x64)return{'valid':![],'message':_0x35e1cb(0xd7)};if(_0x52261f[_0x35e1cb(0xe2)]('/')||_0x52261f[_0x35e1cb(0xe1)]('/'))return{'valid':![],'message':_0x35e1cb(0xdc)};if(_0x52261f[_0x35e1cb(0xd3)]('//'))return{'valid':![],'message':_0x35e1cb(0xd6)};const _0x5b0dcf=_0x52261f[_0x35e1cb(0xc5)]('/');for(const _0x93f596 of _0x5b0dcf){if(!_0x93f596)continue;const _0x1ee68b=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x1ee68b[_0x35e1cb(0xd5)](_0x93f596))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x1361ec,_0x2eaea1)=>{const _0x2faed8=_0x283656;if(_0x2eaea1[_0x2faed8(0xd0)]){const _0xb7cc08=_0x1be5d3[_0x2faed8(0xca)]()||_0x3d1b1a;if(_0x50150f)return;const _0x231e38=_0x536c91+'/'+_0xb7cc08;if(a0_0x3f8dd9['existsSync'](_0x231e38)){_0x3e964a(_0x2faed8(0xc7)+_0xb7cc08+_0x2faed8(0xc8));return;}_0x19707d(_0xb7cc08),_0x18c2a8(''),_0x3e964a('');}else _0x2eaea1['backspace']||_0x2eaea1[_0x2faed8(0xdd)]?_0x18c2a8(_0x5903a7=>{const _0x3390f6=_0x2faed8,_0x3c1ef7=_0x5903a7[_0x3390f6(0xdf)](0x0,-0x1),{valid:_0xbedab3,message:_0x5b2769}=_0x4df319(_0x3c1ef7);return _0x3e964a(_0xbedab3?'':_0x5b2769||_0x3390f6(0xe0)),_0x3c1ef7;}):_0x18c2a8(_0x427ea7=>{const _0x23c0ef=_0x2faed8,_0x466fac=_0x427ea7+_0x1361ec,{valid:_0x360b8d,message:_0x521760}=_0x4df319(_0x466fac);return _0x3e964a(_0x360b8d?'':_0x521760||_0x23c0ef(0xe0)),_0x466fac;});}),a0_0x48043a(Box,{'flexDirection':'column','children':[a0_0x48043a(Box,{'children':[a0_0x420e18(Text,{'color':'gray','children':_0x283656(0xcc)}),a0_0x420e18(Text,{'children':'页面路由地址:\x20'}),_0x1be5d3?a0_0x420e18(Text,{'color':'green','children':_0x1be5d3}):a0_0x420e18(Text,{'color':'gray','children':_0x3d1b1a}),_0x50150f&&a0_0x48043a(Text,{'color':_0x283656(0xd2),'children':[_0x283656(0xcb),_0x50150f]})]}),!_0x50150f&&!_0x1be5d3&&a0_0x420e18(Box,{'children':a0_0x420e18(Text,{'color':_0x283656(0xd1),'children':_0x283656(0xcf)})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0xbd306c=a1_0x3393;(function(_0xd8208,_0x2ede4d){const _0x3ca48d=a1_0x3393,_0x2abab5=_0xd8208();while(!![]){try{const _0x504e2a=-parseInt(_0x3ca48d(0x94))/0x1+parseInt(_0x3ca48d(0xa8))/0x2*(-parseInt(_0x3ca48d(0xb3))/0x3)+parseInt(_0x3ca48d(0xa1))/0x4+parseInt(_0x3ca48d(0xb2))/0x5+parseInt(_0x3ca48d(0x93))/0x6*(-parseInt(_0x3ca48d(0xb4))/0x7)+parseInt(_0x3ca48d(0xa9))/0x8+parseInt(_0x3ca48d(0x9a))/0x9*(-parseInt(_0x3ca48d(0xa6))/0xa);if(_0x504e2a===_0x2ede4d)break;else _0x2abab5['push'](_0x2abab5['shift']());}catch(_0x402d94){_0x2abab5['push'](_0x2abab5['shift']());}}}(a1_0x4a26,0x2ec07));import{jsx as a1_0x51430a,jsxs as a1_0x46f386,Fragment as a1_0x317858}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x187bf9 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a1_0x3393(_0x4a77a8,_0x35c292){_0x4a77a8=_0x4a77a8-0x91;const _0x4a26a7=a1_0x4a26();let _0x339376=_0x4a26a7[_0x4a77a8];return _0x339376;}import{SelectPageTemplate}from'./select-page-template.js';function a1_0x4a26(){const _0x1ca087=['add-page','正在创建页面,请稍候…','页面添加成功:\x20','页面添加失败:\x20','1470920MdGFzg','723747AlEkgb','1071CyAHaO','message','cwd','setLogPath','2118kmPbJW','182746aPvPAk','cyan','gray','resolve','pages','error','2367UTPxot','now','green','\x20*\x20页面文件已创建,可直接通过路由访问','catch','info','finally','1127856mssLxp','已选择页面模板\x20','join','../../templates/pages','success','2770mUZoQd','\x20Step1:\x20','2OxSGBm','1329616JpyAiA','src','\x20*\x20页面路径:\x20','column','dirname'];a1_0x4a26=function(){return _0x1ca087;};return a1_0x4a26();}import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x187bf9[a1_0xbd306c(0xad)](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x187bf9[a1_0xbd306c(0x97)](__dirname,a1_0xbd306c(0xa4)),projectDir=process[a1_0xbd306c(0x91)]();export const AddPage=()=>{const _0x3b980a=a1_0xbd306c,{exit:_0x21a344}=useApp(),[_0x21944c,_0x6c075]=useState(''),[_0x47ae84,_0x2df4ff]=useState(''),[_0x6ccf3b,_0x4804ce]=useState(![]),[_0x600ee9,_0x4caa66]=useState(![]),_0x32bf02=a1_0x187bf9[_0x3b980a(0xa3)](projectDir,_0x3b980a(0xaa),_0x3b980a(0x98)),_0x344e0a=a1_0x187bf9[_0x3b980a(0xa3)](_0x32bf02,_0x47ae84),_0x466637=a1_0x187bf9['join'](_0x3b980a(0xaa),_0x3b980a(0x98),_0x47ae84);useEffect(()=>{const _0x15ce76=_0x3b980a,_0xd7c340=a1_0x187bf9[_0x15ce76(0x97)](pageTemplateDir,_0x21944c);if(_0x21944c&&_0x47ae84){_0x4804ce(!![]),logger[_0x15ce76(0x92)](process['cwd']());const _0x259753=Date[_0x15ce76(0x9b)]();logger[_0x15ce76(0x9f)](_0x15ce76(0xae),'开始添加页面:\x20'+_0x47ae84,{'template':_0x21944c,'targetPath':_0x466637}),TemplateReplacer['processTemplate'](_0xd7c340,a1_0x187bf9[_0x15ce76(0xa3)](_0x32bf02,_0x47ae84),_0x47ae84,_0x21944c)['then'](()=>{const _0x374db9=_0x15ce76,_0x454d20=Date['now']()-_0x259753;logger[_0x374db9(0xa5)](_0x374db9(0xae),_0x374db9(0xb0)+_0x47ae84,_0x454d20,{'template':_0x21944c,'targetPath':_0x466637,'routePath':_0x47ae84}),_0x4caa66(!![]);})[_0x15ce76(0x9e)](_0x4df995=>{const _0xf2e7a7=_0x15ce76,_0x974a77=Date[_0xf2e7a7(0x9b)]()-_0x259753;logger[_0xf2e7a7(0x99)](_0xf2e7a7(0xae),_0xf2e7a7(0xb1)+_0x47ae84,{'template':_0x21944c,'targetPath':_0x466637,'error':_0x4df995 instanceof Error?_0x4df995[_0xf2e7a7(0xb5)]:String(_0x4df995),'duration':_0x974a77});})[_0x15ce76(0xa0)](()=>{_0x4804ce(![]);});}},[_0x21944c,_0x47ae84]),useEffect(()=>{_0x600ee9&&setTimeout(()=>{_0x21a344();});},[_0x600ee9]);if(_0x21944c)return a1_0x46f386(Box,{'flexDirection':_0x3b980a(0xac),'paddingY':0x1,'children':[a1_0x46f386(Box,{'children':[a1_0x51430a(Text,{'color':_0x3b980a(0x96),'children':_0x3b980a(0xa7)}),a1_0x51430a(Text,{'children':_0x3b980a(0xa2)}),a1_0x51430a(Text,{'color':_0x3b980a(0x9c),'children':_0x21944c})]}),_0x47ae84?a1_0x46f386(Box,{'children':[a1_0x51430a(Text,{'color':'gray','children':'\x20Step2:\x20'}),a1_0x51430a(Text,{'children':'已输入的页面路由\x20'}),a1_0x51430a(Text,{'color':_0x3b980a(0x9c),'children':_0x47ae84})]}):a1_0x51430a(InputProjectCode,{'pagePath':_0x344e0a,'onSubmit':_0x2df4ff}),_0x47ae84&&_0x6ccf3b?a1_0x46f386(Box,{'marginTop':0x1,'children':[a1_0x51430a(Box,{'width':'4'}),a1_0x51430a(Text,{'children':_0x3b980a(0xaf)})]}):null,_0x600ee9?a1_0x46f386(a1_0x317858,{'children':[a1_0x51430a(Box,{'marginTop':0x1,'children':a1_0x51430a(Text,{'color':'gray','children':'\x20*\x20页面创建成功!'})}),a1_0x46f386(Box,{'children':[a1_0x51430a(Text,{'color':_0x3b980a(0x96),'children':_0x3b980a(0xab)}),a1_0x51430a(Text,{'color':_0x3b980a(0x9c),'children':_0x466637})]}),a1_0x46f386(Box,{'children':[a1_0x51430a(Text,{'color':'gray','children':'\x20*\x20路由地址:\x20'}),a1_0x46f386(Text,{'color':_0x3b980a(0x9c),'children':['/',_0x47ae84]})]}),a1_0x51430a(Box,{'marginTop':0x1,'children':a1_0x51430a(Text,{'color':_0x3b980a(0x95),'children':_0x3b980a(0x9d)})})]}):null]});return a1_0x51430a(SelectPageTemplate,{'onSelect':_0x6c075});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x31e22b,_0x21134a){const _0xaefb2b=a2_0x4c03,_0x1b5bbf=_0x31e22b();while(!![]){try{const _0x3d7c49=parseInt(_0xaefb2b(0x13b))/0x1+-parseInt(_0xaefb2b(0x136))/0x2+-parseInt(_0xaefb2b(0x127))/0x3*(parseInt(_0xaefb2b(0x123))/0x4)+-parseInt(_0xaefb2b(0x13e))/0x5+-parseInt(_0xaefb2b(0x131))/0x6*(-parseInt(_0xaefb2b(0x139))/0x7)+-parseInt(_0xaefb2b(0x132))/0x8+parseInt(_0xaefb2b(0x135))/0x9*(parseInt(_0xaefb2b(0x133))/0xa);if(_0x3d7c49===_0x21134a)break;else _0x1b5bbf['push'](_0x1b5bbf['shift']());}catch(_0x340953){_0x1b5bbf['push'](_0x1b5bbf['shift']());}}}(a2_0x3761,0xb2a94));import{jsx as a2_0x3fa2a6,jsxs as a2_0x95f478}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';function a2_0x3761(){const _0x3b0149=['label','77JcRrnt','\x20\x20\x20\x20\x20\x20\x20\x20','441269vRsJGU','sdk-fetch','isDirectory','377460CTTjdU','dirname','sort','onSelect','\x20\x20\x20\x20\x20\x20>\x20','map','localeCompare','join','44xtoVCD','upArrow','return','name','302469nWuNEi','请选择您要创建的页面模板','\x20Step1:\x20','../..','blank','column','正在加载页面模板...','获取模板列表失败:','gray','error','72606nwFyah','5866912GCvTtp','16729510vKSDmL','resolve','18muesal','2541154agzCbx','length'];a2_0x3761=function(){return _0x3b0149;};return a2_0x3761();}import a2_0x25415f from'node:path';import{fileURLToPath}from'node:url';function a2_0x4c03(_0x198f24,_0x425dee){_0x198f24=_0x198f24-0x11c;const _0x37612a=a2_0x3761();let _0x4c033f=_0x37612a[_0x198f24];return _0x4c033f;}async function getTemplateList(){const _0x259e6f=a2_0x4c03;try{const _0x4a86f4=fileURLToPath(import.meta.url),_0x38e8fb=a2_0x25415f[_0x259e6f(0x134)](a2_0x25415f[_0x259e6f(0x11c)](_0x4a86f4),_0x259e6f(0x12a)),_0x71de00=a2_0x25415f[_0x259e6f(0x122)](_0x38e8fb,'templates/pages'),_0xd5b2e3=await readdir(_0x71de00,{'withFileTypes':!![]}),_0x145d34=_0xd5b2e3['filter'](_0x1272b9=>_0x1272b9[_0x259e6f(0x13d)]())[_0x259e6f(0x120)](_0x1b11a3=>({'label':_0x1b11a3[_0x259e6f(0x126)]}))[_0x259e6f(0x11d)]((_0x2fd930,_0x24c87e)=>_0x2fd930[_0x259e6f(0x138)][_0x259e6f(0x121)](_0x24c87e[_0x259e6f(0x138)]));return _0x145d34;}catch(_0x1c1163){return console[_0x259e6f(0x130)](_0x259e6f(0x12e),_0x1c1163),[{'label':_0x259e6f(0x12b)},{'label':_0x259e6f(0x13c)}];}}export function SelectPageTemplate(_0x1479e4){const _0x3f7bb1=a2_0x4c03,[_0x12d282,_0x44a8ec]=useState(0x0),[_0x2b92a0,_0x282db4]=useState([]),[_0x2959e3,_0x436280]=useState(!![]);useEffect(()=>{async function _0x8573e(){const _0x589099=await getTemplateList();_0x282db4(_0x589099),_0x436280(![]);}_0x8573e();},[]),useInput((_0x33b38b,_0x115d83)=>{const _0x2b0f8a=a2_0x4c03;if(_0x2959e3)return;if(_0x115d83[_0x2b0f8a(0x125)]){const _0x5adbac=_0x2b92a0[_0x12d282];_0x5adbac&&_0x1479e4[_0x2b0f8a(0x11e)](_0x5adbac[_0x2b0f8a(0x138)]);}_0x115d83[_0x2b0f8a(0x124)]&&_0x44a8ec(_0x4a0f70=>_0x4a0f70===0x0?_0x2b92a0[_0x2b0f8a(0x137)]-0x1:_0x4a0f70-0x1),_0x115d83['downArrow']&&_0x44a8ec(_0x4bcc99=>_0x4bcc99===_0x2b92a0[_0x2b0f8a(0x137)]-0x1?0x0:_0x4bcc99+0x1);});if(_0x2959e3)return a2_0x3fa2a6(Box,{'flexDirection':_0x3f7bb1(0x12c),'paddingY':0x1,'children':a2_0x95f478(Box,{'children':[a2_0x3fa2a6(Text,{'color':_0x3f7bb1(0x12f),'children':_0x3f7bb1(0x129)}),a2_0x3fa2a6(Text,{'children':_0x3f7bb1(0x12d)})]})});return a2_0x95f478(Box,{'flexDirection':'column','paddingY':0x1,'children':[a2_0x95f478(Box,{'children':[a2_0x3fa2a6(Text,{'color':_0x3f7bb1(0x12f),'children':_0x3f7bb1(0x129)}),a2_0x3fa2a6(Text,{'children':_0x3f7bb1(0x128)})]}),_0x2b92a0['map']((_0x44b0a5,_0x43a9ed)=>{const _0x2318ed=_0x3f7bb1,_0xb7fac7=_0x43a9ed===_0x12d282,_0x551158=_0xb7fac7?_0x2318ed(0x11f)+_0x44b0a5[_0x2318ed(0x138)]:_0x2318ed(0x13a)+_0x44b0a5[_0x2318ed(0x138)];return a2_0x3fa2a6(Box,{'children':a2_0x3fa2a6(Text,{'color':_0xb7fac7?'green':undefined,'children':_0x551158})},_0x551158);})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a3_0x30b4(){const _0x52456d=['cursor','push','map','appcode','windsurf','error','success','blue','antigravity','正在配置\x20AI\x20助手...','has','opencode','column','agent','trae','8565285anvltY','10898363qQWPsa','white','red','↑/↓:\x20移动\x20空格:\x20切换\x20a:\x20全选\x20q:\x20退出\x20Enter:\x20确认','请至少选择一个配置项','done','是否同时配置\x20AI\x20助手?这将:','delete','[N]\x20跳过,稍后手动配置','Cursor','return','downArrow','yellow','confirming','add','projectRoot','name','qoder','技能包\x20(研发规范指南)','14593896torkgS','upArrow','[\x20]','9zRGrRP','•\x20MCP:\x20让\x20AI\x20直接访问\x20Lovrabet\x20数据集','1530QbRLze','6xTYzmM','gray','claude','742814colQwc','[✓]','filter','3782355XZMmgY','installing','dimColor','4RaFgGt','*\x20选择要配置的\x20IDE:','ide','selecting','message','skill-','length','•\x20Skill:\x20安装研发最佳实践、Backend\x20Function\x20规范','316569QfAnGo','1376136ysFNOA','codebuddy'];a3_0x30b4=function(){return _0x52456d;};return a3_0x30b4();}const a3_0x27e57f=a3_0xecd6;function a3_0xecd6(_0x5218dc,_0x47b091){_0x5218dc=_0x5218dc-0xae;const _0x30b4e5=a3_0x30b4();let _0xecd645=_0x30b4e5[_0x5218dc];return _0xecd645;}(function(_0x2b24f1,_0x5607b9){const _0x199053=a3_0xecd6,_0x2a1fca=_0x2b24f1();while(!![]){try{const _0x141939=-parseInt(_0x199053(0xbe))/0x1+parseInt(_0x199053(0xaf))/0x2+parseInt(_0x199053(0xb2))/0x3+-parseInt(_0x199053(0xb5))/0x4*(-parseInt(_0x199053(0xcf))/0x5)+-parseInt(_0x199053(0xe9))/0x6*(-parseInt(_0x199053(0xd0))/0x7)+-parseInt(_0x199053(0xe3))/0x8*(-parseInt(_0x199053(0xe6))/0x9)+-parseInt(_0x199053(0xe8))/0xa*(parseInt(_0x199053(0xbd))/0xb);if(_0x141939===_0x5607b9)break;else _0x2a1fca['push'](_0x2a1fca['shift']());}catch(_0x5216b8){_0x2a1fca['push'](_0x2a1fca['shift']());}}}(a3_0x30b4,0xe7380));import{jsx as a3_0x506d14,jsxs as a3_0x24ef2c}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=['cursor',a3_0x27e57f(0xae)],SKILL_IDE_LIST=[a3_0x27e57f(0xc8),a3_0x27e57f(0xae),a3_0x27e57f(0xbf),'codex',a3_0x27e57f(0xc0),a3_0x27e57f(0xcb),a3_0x27e57f(0xe1),a3_0x27e57f(0xce),a3_0x27e57f(0xc4),a3_0x27e57f(0xcd)];export function AISetupUI({config:_0x35e1fa,onComplete:_0x15c3be}){const _0x163728=a3_0x27e57f,{exit:_0x863779}=useApp(),[_0x1f7080,_0x51021b]=useState('confirming'),[_0x3cf82e,_0x3409f8]=useState(0x0),[_0x12b444,_0x300237]=useState(new Set([0x0,0x1])),[_0x31234f,_0x3d67cf]=useState(new Set(SKILL_IDE_LIST[_0x163728(0xc2)]((_0x28161e,_0x16ab2a)=>_0x16ab2a))),[_0x532fb6,_0x38474b]=useState('');useEffect(()=>{!_0x35e1fa['appcode']&&_0x15c3be({'mcpResults':[],'skillResults':[]});},[_0x35e1fa[_0x163728(0xc3)],_0x15c3be]),useInput((_0x24d92d,_0x328e9c)=>{const _0x577bf9=_0x163728;if(_0x1f7080===_0x577bf9(0xdd)){if(_0x24d92d==='y'||_0x24d92d==='Y'||_0x328e9c[_0x577bf9(0xda)]){_0x156bc0();return;}if(_0x24d92d==='n'||_0x24d92d==='N'){_0x15c3be({'mcpResults':[],'skillResults':[]});return;}if(_0x328e9c['return']){_0x156bc0();return;}}if(_0x1f7080===_0x577bf9(0xb8)){if(_0x328e9c[_0x577bf9(0xe4)]){_0x3409f8(_0x191b39=>_0x191b39>0x0?_0x191b39-0x1:SKILL_IDE_LIST[_0x577bf9(0xbb)]-0x1);return;}if(_0x328e9c[_0x577bf9(0xdb)]){_0x3409f8(_0x35a65f=>_0x35a65f<SKILL_IDE_LIST[_0x577bf9(0xbb)]-0x1?_0x35a65f+0x1:0x0);return;}if(_0x24d92d==='\x20'){const _0x171a09=_0x3cf82e<MCP_IDE_LIST[_0x577bf9(0xbb)];if(_0x171a09){const _0x17ad67=new Set(_0x12b444);_0x17ad67['has'](_0x3cf82e)?_0x17ad67[_0x577bf9(0xd7)](_0x3cf82e):_0x17ad67[_0x577bf9(0xde)](_0x3cf82e),_0x300237(_0x17ad67);}else{const _0x508dc1=_0x3cf82e-MCP_IDE_LIST[_0x577bf9(0xbb)],_0x1154c7=new Set(_0x31234f);_0x1154c7[_0x577bf9(0xca)](_0x508dc1)?_0x1154c7['delete'](_0x508dc1):_0x1154c7['add'](_0x508dc1),_0x3d67cf(_0x1154c7);}return;}if(_0x24d92d==='a'||_0x24d92d==='A'){_0x300237(new Set(MCP_IDE_LIST[_0x577bf9(0xc2)]((_0x468db9,_0x249f17)=>_0x249f17))),_0x3d67cf(new Set(SKILL_IDE_LIST[_0x577bf9(0xc2)]((_0x4045ba,_0x1b5bd0)=>_0x1b5bd0)));return;}if(_0x24d92d==='q'||_0x24d92d==='Q'){_0x863779();return;}if(_0x328e9c[_0x577bf9(0xda)]){if(_0x12b444['size']===0x0&&_0x31234f['size']===0x0){_0x38474b(_0x577bf9(0xd4));return;}_0x156bc0();return;}}if(_0x1f7080===_0x577bf9(0xd5)){_0x863779();return;}});async function _0x156bc0(){const _0x40780e=_0x163728;_0x51021b(_0x40780e(0xb3));const _0x3f8c27=[],_0x61a2d2=[];for(const _0x2b1f35 of _0x12b444){const _0x120881=MCP_IDE_LIST[_0x2b1f35];if(!_0x120881)continue;try{const _0x39593b=await configureMcp(_0x120881,_0x35e1fa[_0x40780e(0xdf)]);_0x3f8c27[_0x40780e(0xc1)](_0x39593b);}catch(_0x52ddbe){_0x3f8c27[_0x40780e(0xc1)]({'ide':MCP_IDE_CONFIGS[_0x120881]?.['name']||_0x120881,'status':_0x40780e(0xc5),'message':_0x52ddbe instanceof Error?_0x52ddbe[_0x40780e(0xb9)]:String(_0x52ddbe)});}}await copySharedSkills(_0x35e1fa[_0x40780e(0xdf)]);for(const _0x1a2f11 of _0x31234f){const _0x1c191d=SKILL_IDE_LIST[_0x1a2f11];if(!_0x1c191d)continue;try{const _0x430930=await installSkill(_0x1c191d,_0x35e1fa[_0x40780e(0xdf)]);_0x61a2d2[_0x40780e(0xc1)](_0x430930);}catch(_0x406ad3){_0x61a2d2[_0x40780e(0xc1)]({'ide':SKILL_IDE_CONFIGS[_0x1c191d]?.[_0x40780e(0xe0)]||_0x1c191d,'status':_0x40780e(0xc5),'message':_0x406ad3 instanceof Error?_0x406ad3[_0x40780e(0xb9)]:String(_0x406ad3)});}}if(_0x61a2d2[_0x40780e(0xbb)]>0x0){const _0x393260=_0x61a2d2[_0x40780e(0xb1)](_0x3faf43=>_0x3faf43['status']===_0x40780e(0xc6))[_0x40780e(0xc2)](_0x3d3725=>_0x3d3725[_0x40780e(0xb7)]);_0x393260['length']>0x0&&createSkillManifest(_0x35e1fa[_0x40780e(0xdf)],_0x393260);}_0x51021b('done'),setTimeout(()=>{_0x15c3be({'mcpResults':_0x3f8c27,'skillResults':_0x61a2d2});},0xbb8);}if(_0x1f7080===_0x163728(0xdd))return a3_0x24ef2c(Box,{'flexDirection':_0x163728(0xcc),'marginTop':0x1,'children':[a3_0x506d14(Box,{'marginTop':0x1,'children':a3_0x506d14(Text,{'color':'white','children':_0x163728(0xd6)})}),a3_0x506d14(Box,{'marginLeft':0x2,'marginTop':0x1,'children':a3_0x506d14(Text,{'color':_0x163728(0xea),'children':_0x163728(0xe7)})}),a3_0x506d14(Box,{'marginLeft':0x2,'children':a3_0x506d14(Text,{'color':_0x163728(0xea),'children':_0x163728(0xbc)})}),a3_0x24ef2c(Box,{'marginTop':0x1,'flexDirection':'column','children':[a3_0x506d14(Box,{'children':a3_0x506d14(Text,{'color':'green','children':'[Y]\x20是,配置\x20AI\x20助手'})}),a3_0x506d14(Box,{'children':a3_0x506d14(Text,{'color':_0x163728(0xea),'children':_0x163728(0xd8)})}),a3_0x506d14(Box,{'children':a3_0x506d14(Text,{'color':_0x163728(0xb4),'children':'Enter\x20默认:\x20是'})})]}),_0x532fb6&&a3_0x506d14(Box,{'marginTop':0x1,'children':a3_0x24ef2c(Text,{'color':_0x163728(0xd2),'children':['✗\x20',_0x532fb6]})})]});if(_0x1f7080===_0x163728(0xb8))return a3_0x24ef2c(Box,{'flexDirection':'column','marginTop':0x1,'children':[a3_0x506d14(Box,{'children':a3_0x506d14(Text,{'color':'cyan','bold':!![],'children':_0x163728(0xb6)})}),_0x532fb6&&a3_0x506d14(Box,{'marginTop':0x1,'children':a3_0x24ef2c(Text,{'color':_0x163728(0xd2),'children':['✗\x20',_0x532fb6]})}),a3_0x24ef2c(Box,{'marginTop':0x1,'flexDirection':'column','children':[a3_0x506d14(Text,{'bold':!![],'color':_0x163728(0xdc),'children':'MCP\x20服务器\x20(AI\x20访问数据集)'}),MCP_IDE_LIST[_0x163728(0xc2)]((_0x4132c3,_0x5e7a2e)=>{const _0xddaa23=_0x163728,_0x5f24ff=_0x3cf82e===_0x5e7a2e,_0x292309=_0x12b444[_0xddaa23(0xca)](_0x5e7a2e);return a3_0x506d14(Box,{'children':a3_0x24ef2c(Text,{'backgroundColor':_0x5f24ff?_0xddaa23(0xc7):undefined,'color':_0x5f24ff?_0xddaa23(0xd1):undefined,'children':[_0x292309?_0xddaa23(0xb0):'[\x20]','\x20',_0x4132c3===_0xddaa23(0xc0)?_0xddaa23(0xd9):'Claude\x20Code']})},'mcp-'+_0x4132c3);}),a3_0x506d14(Box,{'marginTop':0x1,'children':a3_0x506d14(Text,{'bold':!![],'color':_0x163728(0xdc),'children':_0x163728(0xe2)})}),SKILL_IDE_LIST[_0x163728(0xc2)]((_0x2c6da1,_0x53685b)=>{const _0x1d5603=_0x163728,_0xf0a7f8=_0x53685b+MCP_IDE_LIST['length'],_0x278274=_0x3cf82e===_0xf0a7f8,_0x422b0f=_0x31234f[_0x1d5603(0xca)](_0xf0a7f8);return a3_0x506d14(Box,{'children':a3_0x24ef2c(Text,{'backgroundColor':_0x278274?_0x1d5603(0xc7):undefined,'color':_0x278274?_0x1d5603(0xd1):undefined,'children':[_0x422b0f?_0x1d5603(0xb0):_0x1d5603(0xe5),'\x20',SKILL_IDE_CONFIGS[_0x2c6da1]['name']]})},_0x1d5603(0xba)+_0x2c6da1);}),a3_0x506d14(Box,{'marginTop':0x1,'children':a3_0x506d14(Text,{'color':'gray','children':_0x163728(0xd3)})})]})]});if(_0x1f7080==='installing')return a3_0x506d14(Box,{'flexDirection':_0x163728(0xcc),'marginTop':0x1,'children':a3_0x506d14(Box,{'children':a3_0x506d14(Text,{'children':_0x163728(0xc9)})})});if(_0x1f7080===_0x163728(0xd5))return null;return null;}const MCP_IDE_CONFIGS={'cursor':{'name':'Cursor'},'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
|
+
function a4_0xeed7(_0x42c98a,_0x526b5a){_0x42c98a=_0x42c98a-0x1cd;const _0x2539b1=a4_0x2539();let _0xeed759=_0x2539b1[_0x42c98a];return _0xeed759;}const a4_0x2b96aa=a4_0xeed7;(function(_0x4098e8,_0x638b9c){const _0x4f3ea0=a4_0xeed7,_0x5d3740=_0x4098e8();while(!![]){try{const _0x1c8679=parseInt(_0x4f3ea0(0x1e2))/0x1*(-parseInt(_0x4f3ea0(0x20e))/0x2)+-parseInt(_0x4f3ea0(0x1da))/0x3+parseInt(_0x4f3ea0(0x1d5))/0x4+-parseInt(_0x4f3ea0(0x20f))/0x5*(parseInt(_0x4f3ea0(0x214))/0x6)+parseInt(_0x4f3ea0(0x1dc))/0x7*(-parseInt(_0x4f3ea0(0x1f2))/0x8)+parseInt(_0x4f3ea0(0x211))/0x9+-parseInt(_0x4f3ea0(0x209))/0xa*(-parseInt(_0x4f3ea0(0x1d9))/0xb);if(_0x1c8679===_0x638b9c)break;else _0x5d3740['push'](_0x5d3740['shift']());}catch(_0x5a982f){_0x5d3740['push'](_0x5d3740['shift']());}}}(a4_0x2539,0xdebf3));function a4_0x2539(){const _0x17607b=['agents.md','object','需要先配置\x20appcode','app','toISOString','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','\x20\x20\x20\x20\x22','\x20技能包安装失败','395824hbqALK','创建\x20Cursor\x20Rules\x20文件','\x20\x20\x22mcpServers\x22:\x20{','.lovrabet/skill/.shared','11ooHJKN','2936868tNZfcR','parse','8932070vRLiva','env','stringify','@lovrabet/dataset-mcp-server@latest','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','创建\x20agents.md\x20文件','1LGOVLf','mcp-install','Cursor','已写入\x20.cursor/mcp.json','skill-install','共享技能文件复制失败','lovrabet_rules.mdc','配置信息:','error','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','请手动执行:\x20','join','\x20\x20}','\x20\x20\x20\x20}','cwd','claude','8SfrKpG','node:fs','\x0a📋\x20其他\x20IDE\x20MCP\x20配置:\x0a','创建技能包\x20manifest','.cursor','online','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','map','info','不支持的\x20MCP\x20IDE:\x20','log','LOVRABET_ENV','success','claude\x20mcp\x20add\x20','mcp.json','appcode','复制\x20Cursor\x20Rules\x20文件失败','\x22:\x20{','.shared','\x20技能包安装成功','\x20-e\x20LOVRABET_APP_CODE=','共享技能文件复制成功','message','47209330jkbBnN','已创建\x20','Claude\x20Code','Cursor\x20MCP\x20配置成功','.lovrabet','3103988PzoWvO','1865hzypKk','isDirectory','4838805xWJrZm','lovrabet-dataset','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','10266tgzBGl','utf-8','mcpServers','rules','manual','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20['];a4_0x2539=function(){return _0x17607b;};return a4_0x2539();}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=a4_0x2b96aa(0x212),MCP_COMMAND='npx',MCP_ARGS=[a4_0x2b96aa(0x1df)];export function buildEnvConfig(_0x50aa8e,_0x5a4ed4){const _0x44c9fb=a4_0x2b96aa,_0x5e149a={'LOVRABET_APP_CODE':String(_0x50aa8e)};return _0x5a4ed4!==_0x44c9fb(0x1f7)&&(_0x5e149a[_0x44c9fb(0x1fd)]=String(_0x5a4ed4)),_0x5e149a;}export async function configureCursorMcp(_0x96ee34){const _0x4eb155=a4_0x2b96aa,_0x2caeb4=_0x96ee34||process['cwd'](),_0x5f4d93=readConfig(_0x2caeb4),_0x492a7c=_0x5f4d93[_0x4eb155(0x201)]||_0x5f4d93['app'],_0x5aeb9e=_0x5f4d93['env']||_0x4eb155(0x1f7);if(!_0x492a7c)return{'ide':'Cursor','status':_0x4eb155(0x1ea),'message':'需要先配置\x20appcode'};const _0xc3d31f=buildEnvConfig(_0x492a7c,_0x5aeb9e),_0x4c95e8={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0xc3d31f},_0x397d7b=join(_0x2caeb4,'.cursor',_0x4eb155(0x200)),_0x2e3cdf=join(_0x2caeb4,_0x4eb155(0x1f6));try{!existsSync(_0x2e3cdf)&&mkdirSync(_0x2e3cdf,{'recursive':!![]});let _0x1bd2b0={'mcpServers':{}};if(existsSync(_0x397d7b)){const _0x303949=readFileSync(_0x397d7b,_0x4eb155(0x215));_0x1bd2b0=JSON[_0x4eb155(0x1db)](_0x303949);}return(!_0x1bd2b0[_0x4eb155(0x216)]||typeof _0x1bd2b0[_0x4eb155(0x216)]!==_0x4eb155(0x1ce))&&(_0x1bd2b0[_0x4eb155(0x216)]={}),_0x1bd2b0['mcpServers'][MCP_SERVER_NAME]=_0x4c95e8,writeFileSync(_0x397d7b,JSON[_0x4eb155(0x1de)](_0x1bd2b0,null,0x2),_0x4eb155(0x215)),logger[_0x4eb155(0x1fa)](_0x4eb155(0x1e3),_0x4eb155(0x20c),{'appcode':_0x492a7c,'env':_0x5aeb9e,'path':_0x397d7b}),await copyCursorRules(_0x2e3cdf),{'ide':_0x4eb155(0x1e4),'status':_0x4eb155(0x1fe),'message':_0x4eb155(0x1e5)};}catch(_0x2f05c8){return logger['error']('mcp-install','Cursor\x20MCP\x20配置失败',{'error':_0x2f05c8 instanceof Error?_0x2f05c8[_0x4eb155(0x208)]:String(_0x2f05c8)}),{'ide':_0x4eb155(0x1e4),'status':'error','message':_0x2f05c8 instanceof Error?_0x2f05c8['message']:String(_0x2f05c8)};}}export async function configureClaudeMcp(_0x15ff0f){const _0x2559be=a4_0x2b96aa,_0x50cfc0=_0x15ff0f||process[_0x2559be(0x1f0)](),_0x23b0c1=readConfig(_0x50cfc0),_0x4820f7=_0x23b0c1[_0x2559be(0x201)]||_0x23b0c1[_0x2559be(0x1d0)],_0x43c50e=_0x23b0c1['env']||_0x2559be(0x1f7);if(!_0x4820f7)return{'ide':_0x2559be(0x20b),'status':'error','message':_0x2559be(0x1cf)};let _0x25fe0e=_0x2559be(0x1ff)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x2559be(0x1ed)]('\x20')+_0x2559be(0x206)+_0x4820f7;return _0x43c50e!=='online'&&(_0x25fe0e+='\x20-e\x20LOVRABET_ENV='+_0x43c50e),await copyAgentsMd(_0x50cfc0),logger[_0x2559be(0x1fa)](_0x2559be(0x1e3),'Claude\x20Code\x20MCP\x20命令已生成',{'command':_0x25fe0e,'appcode':_0x4820f7,'env':_0x43c50e}),console[_0x2559be(0x1fc)](_0x2559be(0x213)),console[_0x2559be(0x1fc)]('\x20\x20'+_0x25fe0e+'\x0a'),console[_0x2559be(0x1fc)](_0x2559be(0x1e9)),console[_0x2559be(0x1fc)]('\x20\x20AppCode:\x20'+_0x4820f7),_0x43c50e!==_0x2559be(0x1f7)&&console[_0x2559be(0x1fc)]('\x20\x20环境:\x20'+_0x43c50e),console[_0x2559be(0x1fc)](_0x2559be(0x1eb)),{'ide':'Claude\x20Code','status':'manual','message':_0x2559be(0x1ec)+_0x25fe0e};}export async function showOtherGuide(_0x2fba84){const _0x8c1cb7=a4_0x2b96aa,_0x503b2a=_0x2fba84||process[_0x8c1cb7(0x1f0)](),_0x4fb2ce=readConfig(_0x503b2a),_0x26ee04=_0x4fb2ce[_0x8c1cb7(0x201)]||_0x4fb2ce[_0x8c1cb7(0x1d0)],_0x17b3f9=_0x4fb2ce[_0x8c1cb7(0x1dd)]||_0x8c1cb7(0x1f7);if(!_0x26ee04)return{'ide':'其他','status':'error','message':'需要先配置\x20appcode'};return console[_0x8c1cb7(0x1fc)](_0x8c1cb7(0x1f4)),console[_0x8c1cb7(0x1fc)]('{'),console[_0x8c1cb7(0x1fc)](_0x8c1cb7(0x1d7)),console[_0x8c1cb7(0x1fc)](_0x8c1cb7(0x1d3)+MCP_SERVER_NAME+_0x8c1cb7(0x203)),console[_0x8c1cb7(0x1fc)](_0x8c1cb7(0x1d2)+MCP_COMMAND+'\x22,'),console[_0x8c1cb7(0x1fc)](_0x8c1cb7(0x219)+MCP_ARGS[_0x8c1cb7(0x1f9)](_0x122f54=>'\x22'+_0x122f54+'\x22')[_0x8c1cb7(0x1ed)](',\x20')+'],'),console[_0x8c1cb7(0x1fc)]('\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{'),console['log'](_0x8c1cb7(0x1f8)+_0x26ee04+'\x22,'),_0x17b3f9!==_0x8c1cb7(0x1f7)&&console[_0x8c1cb7(0x1fc)](_0x8c1cb7(0x1e0)+_0x17b3f9+'\x22,'),console[_0x8c1cb7(0x1fc)]('\x20\x20\x20\x20\x20\x20}'),console[_0x8c1cb7(0x1fc)](_0x8c1cb7(0x1ef)),console['log'](_0x8c1cb7(0x1ee)),console[_0x8c1cb7(0x1fc)]('}\x0a'),logger[_0x8c1cb7(0x1fa)]('mcp-install','其他\x20IDE\x20配置指引已显示',{'appcode':_0x26ee04,'env':_0x17b3f9}),{'ide':'其他','status':_0x8c1cb7(0x218),'message':'配置指引已显示'};}export async function configureMcp(_0x55a515,_0x1276f5){const _0x304ef1=a4_0x2b96aa;switch(_0x55a515){case'cursor':return await configureCursorMcp(_0x1276f5);case _0x304ef1(0x1f1):return await configureClaudeMcp(_0x1276f5);default:throw new Error(_0x304ef1(0x1fb)+_0x55a515);}}async function copyCursorRules(_0x259722){const _0x341ea3=a4_0x2b96aa,_0x7c2f89=join(_0x259722,_0x341ea3(0x217)),_0x4ecac0=join(_0x7c2f89,_0x341ea3(0x1e8));if(existsSync(_0x4ecac0))return;try{!existsSync(_0x7c2f89)&&mkdirSync(_0x7c2f89,{'recursive':!![]});const _0x2164f0=resolve(__dirname,'../../templates/rules/lovrabet_rules.mdc.tpl');existsSync(_0x2164f0)&&(copyFileSync(_0x2164f0,_0x4ecac0),logger[_0x341ea3(0x1fa)](_0x341ea3(0x1e3),_0x341ea3(0x1d6),{'from':_0x2164f0,'to':_0x4ecac0}));}catch(_0x42be20){logger['error'](_0x341ea3(0x1e3),_0x341ea3(0x202),{'error':_0x42be20 instanceof Error?_0x42be20[_0x341ea3(0x208)]:String(_0x42be20)});}}async function copyAgentsMd(_0x10583c){const _0x3c3271=a4_0x2b96aa,_0x3e0c04=join(_0x10583c,_0x3c3271(0x1cd));if(existsSync(_0x3e0c04))return;try{const _0x18e832=resolve(__dirname,'../../templates/rules/lovrabet_rules.mdc.tpl');if(existsSync(_0x18e832)){const _0x111daa=readFileSync(_0x18e832,_0x3c3271(0x215));writeFileSync(_0x3e0c04,_0x111daa,_0x3c3271(0x215)),logger[_0x3c3271(0x1fa)](_0x3c3271(0x1e3),_0x3c3271(0x1e1),{'from':_0x18e832,'to':_0x3e0c04});}}catch(_0x25759b){logger['error']('mcp-install','复制\x20agents.md\x20文件失败',{'error':_0x25759b instanceof Error?_0x25759b[_0x3c3271(0x208)]:String(_0x25759b)});}}export const SKILL_IDE_CONFIGS=IDE_CONFIGS;export async function installSkill(_0x31620d,_0x56d6fc){const _0x1ba03d=a4_0x2b96aa,_0x3d2562=_0x56d6fc||process[_0x1ba03d(0x1f0)](),_0xc72d9=resolve(__dirname,'../../templates/skills'),_0x32eddb=SKILL_IDE_CONFIGS[_0x31620d];if(!_0x32eddb)return{'ide':_0x31620d,'status':'error','message':'未知的\x20IDE:\x20'+_0x31620d};const _0x35b88f=_0x32eddb['name'];try{const _0x5a2b65=await installSingleIDE(_0x31620d,_0x32eddb,_0x3d2562,_0xc72d9);return logger[_0x1ba03d(0x1fa)](_0x1ba03d(0x1e6),_0x35b88f+_0x1ba03d(0x205),{'ide':_0x31620d,'filesCount':_0x5a2b65}),{'ide':_0x35b88f,'status':_0x1ba03d(0x1fe),'message':_0x1ba03d(0x20a)+_0x5a2b65+'\x20项'};}catch(_0x772dcc){return logger[_0x1ba03d(0x1ea)]('skill-install',_0x35b88f+_0x1ba03d(0x1d4),{'error':_0x772dcc instanceof Error?_0x772dcc[_0x1ba03d(0x208)]:String(_0x772dcc)}),{'ide':_0x35b88f,'status':'error','message':_0x772dcc instanceof Error?_0x772dcc['message']:String(_0x772dcc)};}}async function copyDir(_0x1fd383,_0xf1c41c){const _0x457d1e=a4_0x2b96aa,{statSync:_0x16e9a5}=await import(_0x457d1e(0x1f3)),{readdirSync:_0x4d10bd}=await import(_0x457d1e(0x1f3)),_0x1b1c72=_0x16e9a5(_0x1fd383);if(_0x1b1c72[_0x457d1e(0x210)]()){!existsSync(_0xf1c41c)&&mkdirSync(_0xf1c41c,{'recursive':!![]});const _0x4e076b=_0x4d10bd(_0x1fd383);for(const _0x64ffd0 of _0x4e076b){await copyDir(join(_0x1fd383,_0x64ffd0),join(_0xf1c41c,_0x64ffd0));}}else copyFileSync(_0x1fd383,_0xf1c41c);}export async function copySharedSkills(_0x403049){const _0x5b0106=a4_0x2b96aa,_0x398350=_0x403049||process['cwd'](),_0x4d5877=resolve(__dirname,'../../templates/skills'),_0x4fc6e9=join(_0x4d5877,_0x5b0106(0x204)),_0x1c4d71=join(_0x398350,_0x5b0106(0x1d8));if(!existsSync(_0x4fc6e9))return![];try{return await copyDir(_0x4fc6e9,_0x1c4d71),logger['info'](_0x5b0106(0x1e6),_0x5b0106(0x207),{'path':_0x1c4d71}),!![];}catch(_0x56bcae){return logger[_0x5b0106(0x1ea)](_0x5b0106(0x1e6),_0x5b0106(0x1e7),{'error':_0x56bcae instanceof Error?_0x56bcae[_0x5b0106(0x208)]:String(_0x56bcae)}),![];}}export function createSkillManifest(_0x2b1681,_0x365eeb){const _0x19ed81=a4_0x2b96aa,_0x548e07={'version':'2.0.0','installedAt':new Date()[_0x19ed81(0x1d1)](),'platforms':_0x365eeb},_0x177454=join(_0x2b1681,'.lovrabet/skill-manifest.json'),_0x449d04=join(_0x2b1681,_0x19ed81(0x20d));!existsSync(_0x449d04)&&mkdirSync(_0x449d04,{'recursive':!![]}),writeFileSync(_0x177454,JSON[_0x19ed81(0x1de)](_0x548e07,null,0x2),_0x19ed81(0x215)),logger[_0x19ed81(0x1fa)](_0x19ed81(0x1e6),_0x19ed81(0x1f5),{'path':_0x177454});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x337978,_0x5eec20){const _0x489de5=a5_0x4ebd,_0x56a172=_0x337978();while(!![]){try{const _0x3d0cd7=parseInt(_0x489de5(0xea))/0x1*(parseInt(_0x489de5(0x109))/0x2)+parseInt(_0x489de5(0xf2))/0x3+-parseInt(_0x489de5(0xec))/0x4*(parseInt(_0x489de5(0xd5))/0x5)+parseInt(_0x489de5(0xeb))/0x6+-parseInt(_0x489de5(0x106))/0x7+-parseInt(_0x489de5(0xfc))/0x8+parseInt(_0x489de5(0x10a))/0x9*(parseInt(_0x489de5(0xfd))/0xa);if(_0x3d0cd7===_0x5eec20)break;else _0x56a172['push'](_0x56a172['shift']());}catch(_0x2bd8ed){_0x56a172['push'](_0x56a172['shift']());}}}(a5_0xf60c,0x9dc2f));import{jsx as a5_0x4b135e,jsxs as a5_0x5dddab,Fragment as a5_0x4f8e13}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_0x4ebd(_0x1ff350,_0x3f477e){_0x1ff350=_0x1ff350-0xd2;const _0xf60cbe=a5_0xf60c();let _0x4ebd2d=_0xf60cbe[_0x1ff350];return _0x4ebd2d;}import{fetchModelList}from'./fetch-model-list.js';import{generateDatasetDocs}from'./api-doc.js';function a5_0xf60c(){const _0x5f45c5=['1760274mYZIbi','正在生成\x20','map','💡\x20请使用\x20','datasetName','使用指定的应用AppCode:\x20','cwd','online','filter','gray','9440280DYVFxe','10jCYzzl','指定的数据集代码都不存在:\x20','\x20个数据集','env','error','string','\x20重新登录后再试','datasetCode','未提供应用AppCode,且配置中也没有默认值','8875034WDURnZ','log','\x20-\x20','173474sHCmPh','19072017SeIoZC','green','文档生成失败:\x20','success','includes','yellow','53830tqVaqa','filePath','cyan','*\x20输出目录:\x20','\x20个数据集的文档...','length','√\x20文档生成完成!成功\x20','lovrabet\x20auth','使用配置的应用AppCode:\x20','未找到任何数据集','red','dim','join','.md\x20(','🚀\x20','⚠️\x20以下数据集生成失败:','正在获取数据集列表...','\x1b[0m','文档生成完成','column','*\x20共处理\x20','14cHqlNl','1632186yNdAoN','408mKEBTk','\x20个匹配的数据集\x1b[0m','message','api-doc',',\x20失败\x20','\x1b[90m*\x20从\x20'];a5_0xf60c=function(){return _0x5f45c5;};return a5_0xf60c();}import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x12b587,env:_0x10c8c6,output:_0x26164b,extraParams:_0x113f93,datasetCodes:_0x5aadb3})=>{const _0x48fefd=a5_0x4ebd,{exit:_0x17e503}=useApp(),[_0x214d33,_0x4eecf8]=useState(![]),[_0x5a088e,_0x1d57f5]=useState(''),[_0x2f41a4,_0x27176e]=useState(![]),[_0x4fbb13,_0x8efebd]=useState(null),[_0x1360d3,_0x10403a]=useState(null),[_0x57aac9,_0x32482b]=useState(0x0),_0x376bdf=readConfig(),_0x53db49=getConfigAppCode(),_0x380908=_0x12b587||_0x53db49,_0xab51b4=typeof _0x376bdf?.[_0x48fefd(0x100)]===_0x48fefd(0x102)?_0x376bdf['env']:undefined,_0x4f8eb6=_0x10c8c6||_0xab51b4||_0x48fefd(0xf9);initEnv(_0x4f8eb6);const _0x21120f=_0x26164b||'./docs',_0x593722=_0x12b587?_0x48fefd(0xf7)+_0x380908:_0x48fefd(0xdd)+_0x380908;useEffect(()=>{_0x4eecf8(!![]),_0x590b3e();},[]),useEffect(()=>{(_0x2f41a4||_0x4fbb13)&&_0x17e503();},[_0x2f41a4,_0x4fbb13,_0x17e503]);async function _0x590b3e(){const _0x2b1ac4=_0x48fefd;if(!_0x380908){_0x8efebd(_0x2b1ac4(0x105));return;}try{logger['setLogPath'](process[_0x2b1ac4(0xf8)]()),_0x1d57f5(_0x2b1ac4(0xe5));const {configArray:_0x1c4f1c}=await fetchModelList(_0x380908);_0x32482b(_0x1c4f1c[_0x2b1ac4(0xda)]);if(_0x1c4f1c[_0x2b1ac4(0xda)]===0x0){_0x8efebd(_0x2b1ac4(0xde));return;}let _0x2b5fda=_0x1c4f1c;if(_0x5aadb3&&_0x5aadb3['length']>0x0){_0x2b5fda=_0x1c4f1c['filter'](_0x592676=>_0x5aadb3[_0x2b1ac4(0xd3)](_0x592676[_0x2b1ac4(0x104)]));const _0x3fefe5=_0x2b5fda[_0x2b1ac4(0xf4)](_0xaa953a=>_0xaa953a[_0x2b1ac4(0x104)]),_0x2c2b11=_0x5aadb3[_0x2b1ac4(0xfa)](_0x182e7a=>!_0x3fefe5['includes'](_0x182e7a));_0x2c2b11['length']>0x0&&console[_0x2b1ac4(0x107)]('\x1b[33m!\x20以下数据集代码不存在:\x20'+_0x2c2b11[_0x2b1ac4(0xe1)](',\x20')+_0x2b1ac4(0xe6));if(_0x2b5fda[_0x2b1ac4(0xda)]===0x0){_0x8efebd(_0x2b1ac4(0xfe)+_0x5aadb3[_0x2b1ac4(0xe1)](',\x20'));return;}console[_0x2b1ac4(0x107)](_0x2b1ac4(0xf1)+_0x1c4f1c['length']+'\x20个数据集中筛选出\x20'+_0x2b5fda[_0x2b1ac4(0xda)]+_0x2b1ac4(0xed));}_0x1d57f5(_0x2b1ac4(0xf3)+_0x2b5fda[_0x2b1ac4(0xda)]+_0x2b1ac4(0xd9));const _0x3d761a=await generateDatasetDocs(_0x2b5fda,_0x380908,_0x21120f,(_0x1895e8,_0x2b29fe,_0x11c453)=>{const _0x2236b4=_0x2b1ac4;_0x1d57f5(_0x2236b4(0xf3)+_0x11c453+_0x2236b4(0xe2)+_0x1895e8+'/'+_0x2b29fe+')');},_0x113f93);_0x10403a(_0x3d761a),_0x27176e(!![]);const _0x5b8140=_0x3d761a[_0x2b1ac4(0xfa)](_0x56ca34=>_0x56ca34[_0x2b1ac4(0xd2)])[_0x2b1ac4(0xda)],_0x56a414=_0x3d761a[_0x2b1ac4(0xfa)](_0x5bcee3=>!_0x5bcee3[_0x2b1ac4(0xd2)])['length'];logger[_0x2b1ac4(0xd2)](_0x2b1ac4(0xef),_0x2b1ac4(0xe7),undefined,{'totalCount':_0x3d761a[_0x2b1ac4(0xda)],'successCount':_0x5b8140,'failCount':_0x56a414,'outputDir':_0x21120f});}catch(_0x717791){const _0x337c33=_0x717791 instanceof Error?_0x717791[_0x2b1ac4(0xee)]:String(_0x717791);logger[_0x2b1ac4(0x101)]('api-doc','文档生成失败:\x20'+_0x337c33,{'appCode':_0x380908,'outputDir':_0x21120f}),_0x8efebd(_0x2b1ac4(0x10c)+_0x337c33);}finally{_0x4eecf8(![]);}}const _0xcd464b=_0x1360d3?.[_0x48fefd(0xfa)](_0x427868=>_0x427868[_0x48fefd(0xd2)])['length']||0x0,_0x1023db=_0x1360d3?.[_0x48fefd(0xfa)](_0x66fe52=>!_0x66fe52[_0x48fefd(0xd2)])[_0x48fefd(0xda)]||0x0;return a5_0x5dddab(Box,{'flexDirection':_0x48fefd(0xe8),'children':[(_0x214d33||_0x2f41a4)&&a5_0x5dddab(Box,{'children':[a5_0x4b135e(Text,{'color':_0x48fefd(0xfb),'children':'*\x20'}),a5_0x4b135e(Text,{'color':_0x12b587?'white':_0x48fefd(0xe0),'children':_0x593722})]}),_0x214d33&&a5_0x4b135e(Box,{'children':a5_0x5dddab(Text,{'children':[_0x48fefd(0xe3),_0x5a088e,'\x20(环境:\x20',_0x4f8eb6,')']})}),_0x2f41a4&&_0x1360d3&&a5_0x5dddab(Box,{'flexDirection':_0x48fefd(0xe8),'children':[a5_0x4b135e(Box,{'children':a5_0x5dddab(Text,{'color':_0x48fefd(0x10b),'children':[_0x48fefd(0xdb),_0xcd464b,'\x20个',_0x1023db>0x0&&_0x48fefd(0xf0)+_0x1023db+'\x20个']})}),a5_0x4b135e(Box,{'marginTop':0x1,'children':a5_0x5dddab(Text,{'color':'gray','children':[_0x48fefd(0xe9),_0x57aac9,_0x48fefd(0xff)]})}),a5_0x5dddab(Box,{'marginTop':0x1,'children':[a5_0x4b135e(Text,{'color':_0x48fefd(0xfb),'children':_0x48fefd(0xd8)}),a5_0x4b135e(Text,{'color':'cyan','children':_0x21120f})]}),_0xcd464b>0x0&&a5_0x5dddab(a5_0x4f8e13,{'children':[a5_0x4b135e(Box,{'marginTop':0x1,'children':a5_0x4b135e(Text,{'color':_0x48fefd(0xfb),'children':'*\x20生成的文档文件:'})}),_0x1360d3[_0x48fefd(0xfa)](_0x2f495f=>_0x2f495f[_0x48fefd(0xd2)])[_0x48fefd(0xf4)]((_0x30e3e1,_0x4a275a)=>a5_0x5dddab(Box,{'marginLeft':0x2,'children':[a5_0x5dddab(Text,{'color':_0x48fefd(0xd7),'children':['•\x20',_0x30e3e1[_0x48fefd(0xd6)]]}),a5_0x5dddab(Text,{'color':_0x48fefd(0xe0),'children':[_0x48fefd(0x108),_0x30e3e1[_0x48fefd(0xf6)]]})]},_0x4a275a))]}),_0x1023db>0x0&&a5_0x5dddab(a5_0x4f8e13,{'children':[a5_0x4b135e(Box,{'marginTop':0x1,'children':a5_0x4b135e(Text,{'color':'yellow','children':_0x48fefd(0xe4)})}),_0x1360d3['filter'](_0x5395a5=>!_0x5395a5[_0x48fefd(0xd2)])[_0x48fefd(0xf4)]((_0x12bf94,_0x358908)=>a5_0x5dddab(Box,{'marginLeft':0x2,'flexDirection':_0x48fefd(0xe8),'children':[a5_0x5dddab(Text,{'color':_0x48fefd(0xdf),'children':['•\x20',_0x12bf94['datasetName'],'\x20(',_0x12bf94[_0x48fefd(0x104)],')']}),_0x12bf94[_0x48fefd(0x101)]&&a5_0x4b135e(Box,{'marginLeft':0x2,'children':a5_0x4b135e(Text,{'color':_0x48fefd(0xe0),'children':_0x12bf94[_0x48fefd(0x101)]})})]},_0x358908))]})]}),_0x4fbb13&&a5_0x5dddab(Box,{'flexDirection':'column','children':[a5_0x4b135e(Box,{'children':a5_0x5dddab(Text,{'color':_0x48fefd(0xdf),'children':['❌\x20',_0x4fbb13]})}),_0x4fbb13['includes']('登录')&&a5_0x5dddab(Box,{'marginTop':0x1,'children':[a5_0x4b135e(Text,{'color':'yellow','children':_0x48fefd(0xf5)}),a5_0x4b135e(Text,{'color':_0x48fefd(0xd7),'children':_0x48fefd(0xdc)}),a5_0x4b135e(Text,{'color':_0x48fefd(0xd4),'children':_0x48fefd(0x103)})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a6_0x392258=a6_0x4d94;(function(_0x5138c9,_0x15357d){const _0x10263d=a6_0x4d94,_0x357c7d=_0x5138c9();while(!![]){try{const _0x5c5431=-parseInt(_0x10263d(0x128))/0x1*(parseInt(_0x10263d(0x111))/0x2)+-parseInt(_0x10263d(0x112))/0x3+parseInt(_0x10263d(0x10f))/0x4+-parseInt(_0x10263d(0x129))/0x5+parseInt(_0x10263d(0x11a))/0x6*(-parseInt(_0x10263d(0x12a))/0x7)+parseInt(_0x10263d(0x10c))/0x8+parseInt(_0x10263d(0x11b))/0x9;if(_0x5c5431===_0x15357d)break;else _0x357c7d['push'](_0x357c7d['shift']());}catch(_0x5d94be){_0x357c7d['push'](_0x357c7d['shift']());}}}(a6_0x31ae,0x45467));import{mkdirSync,writeFileSync}from'node:fs';function a6_0x4d94(_0x44e81c,_0x2f2f28){_0x44e81c=_0x44e81c-0x108;const _0x31ae6c=a6_0x31ae();let _0x4d94a3=_0x31ae6c[_0x44e81c];return _0x4d94a3;}import a6_0x5c4e91 from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';function a6_0x31ae(){const _0x4aa21d=['tableName','markdown','application/json','datasetCode','./docs','data','push','join','6077pFdZKu','1940200ljPcTq','14JmaGYP','.md','length',']\x20正在生成:\x20','):缺少\x20data.markdown\x20字段','log','status','name','utf8','✗\x20失败:\x20','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','),HTTP状态码:\x20','.md\x20(','374360BrflHn','获取文档失败\x20(','生成文档成功:\x20','1212412WACNmz','error','26CdokJb','888378Qbnexk','POST','stringify','响应数据格式错误\x20(','生成文档失败:\x20','.md\x20-\x20','message','api-doc','160194wYBjSI','6753762YWxioG','success','text','等待\x203\x20秒...\x0a','\x0a共有\x20'];a6_0x31ae=function(){return _0x4aa21d;};return a6_0x31ae();}export async function fetchDatasetDoc(_0xa9d65d){const _0x5979ef=a6_0x4d94,{appCode:_0x3b1954,datasetCode:_0x39d667,datasetId:_0x2b0923,extraParams:_0x3a9777}=_0xa9d65d,_0xa8468b=getApiDomain(),_0xa6b4a6=_0xa8468b+'/api/node-toolbox/api-doc-generator',_0x3a7654={'appCode':_0x3b1954,'datasetCode':_0x39d667,'datasetId':_0x2b0923,..._0x3a9777||{}},_0x13e5cb=await fetch(_0xa6b4a6,{'method':_0x5979ef(0x113),'headers':{'Content-Type':_0x5979ef(0x122),'Cookie':getCookie()},'body':JSON[_0x5979ef(0x114)](_0x3a7654)});if(!_0x13e5cb['ok']){if(_0x13e5cb['status']===0x191)throw new Error(_0x5979ef(0x109));let _0x3f5c91='';try{_0x3f5c91=await _0x13e5cb[_0x5979ef(0x11d)]();}catch(_0x3d8a44){}throw new Error(_0x5979ef(0x10d)+_0x39d667+_0x5979ef(0x10a)+_0x13e5cb[_0x5979ef(0x130)]+(_0x3f5c91?'\x0a'+_0x3f5c91:''));}const _0x3ce53d=await _0x13e5cb['json']();if(!_0x3ce53d[_0x5979ef(0x125)]||typeof _0x3ce53d[_0x5979ef(0x125)][_0x5979ef(0x121)]!=='string')throw new Error(_0x5979ef(0x115)+_0x39d667+_0x5979ef(0x12e));return _0x3ce53d[_0x5979ef(0x125)][_0x5979ef(0x121)];}function delay(_0x40be66){return new Promise(_0x37bf4c=>setTimeout(_0x37bf4c,_0x40be66));}export async function generateDatasetDocs(_0x31cf8a,_0x2d58e2,_0x5eeb6b=a6_0x392258(0x124),_0xa58394,_0x2d4b58){const _0xcf9959=a6_0x392258;mkdirSync(_0x5eeb6b,{'recursive':!![]});const _0x949754=[],_0x58057b=_0x31cf8a[_0xcf9959(0x12c)];console[_0xcf9959(0x12f)](_0xcf9959(0x11f)+_0x58057b+'\x20个数据集需要生成文档\x0a');for(let _0x2ffe50=0x0;_0x2ffe50<_0x31cf8a[_0xcf9959(0x12c)];_0x2ffe50++){const _0xee8579=_0x31cf8a[_0x2ffe50],_0x2f1c4e=_0x2ffe50+0x1,_0x39b35f=_0xee8579[_0xcf9959(0x120)];try{console[_0xcf9959(0x12f)]('['+_0x2f1c4e+'/'+_0x58057b+_0xcf9959(0x12d)+_0x39b35f+_0xcf9959(0x10b)+_0xee8579['name']+')');_0xa58394&&_0xa58394(_0x2f1c4e,_0x58057b,_0x39b35f);const _0x498039=await fetchDatasetDoc({'appCode':_0x2d58e2,'datasetCode':_0xee8579[_0xcf9959(0x123)],'datasetId':_0xee8579['id'],'enableAI':![],'extraParams':_0x2d4b58}),_0x2c832c=a6_0x5c4e91[_0xcf9959(0x127)](_0x5eeb6b,_0x39b35f+_0xcf9959(0x12b));writeFileSync(_0x2c832c,_0x498039,{'encoding':_0xcf9959(0x132)}),console[_0xcf9959(0x12f)]('✓\x20成功生成:\x20'+_0x39b35f+'.md'),logger[_0xcf9959(0x11c)]('api-doc',_0xcf9959(0x10e)+_0x39b35f,undefined,{'datasetCode':_0xee8579[_0xcf9959(0x123)],'datasetName':_0xee8579[_0xcf9959(0x131)],'filePath':_0x2c832c,'progress':_0x2f1c4e+'/'+_0x58057b}),_0x949754['push']({'datasetCode':_0xee8579[_0xcf9959(0x123)],'datasetName':_0xee8579[_0xcf9959(0x131)],'filePath':_0x2c832c,'success':!![]}),_0x2f1c4e<_0x58057b&&await delay(0x1388);}catch(_0x55f464){const _0x5ab636=_0x55f464 instanceof Error?_0x55f464[_0xcf9959(0x118)]:String(_0x55f464);console[_0xcf9959(0x12f)](_0xcf9959(0x108)+_0x39b35f+_0xcf9959(0x117)+_0x5ab636+'\x0a'),logger[_0xcf9959(0x110)](_0xcf9959(0x119),_0xcf9959(0x116)+_0xee8579['datasetCode'],{'datasetCode':_0xee8579[_0xcf9959(0x123)],'datasetName':_0xee8579[_0xcf9959(0x131)],'error':_0x5ab636,'progress':_0x2f1c4e+'/'+_0x58057b}),_0x949754[_0xcf9959(0x126)]({'datasetCode':_0xee8579[_0xcf9959(0x123)],'datasetName':_0xee8579[_0xcf9959(0x131)],'filePath':'','success':![],'error':_0x5ab636}),_0x2f1c4e<_0x58057b&&(console[_0xcf9959(0x12f)](_0xcf9959(0x11e)),await delay(0xbb8));}}return _0x949754;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3c68f3,_0x472417){const _0x5d6a0a=a7_0x4b9e,_0xa15c5c=_0x3c68f3();while(!![]){try{const _0x9fb6b8=-parseInt(_0x5d6a0a(0x11f))/0x1*(parseInt(_0x5d6a0a(0x129))/0x2)+-parseInt(_0x5d6a0a(0x135))/0x3+-parseInt(_0x5d6a0a(0x10b))/0x4*(-parseInt(_0x5d6a0a(0x130))/0x5)+-parseInt(_0x5d6a0a(0x131))/0x6+parseInt(_0x5d6a0a(0x12d))/0x7+-parseInt(_0x5d6a0a(0x13f))/0x8*(-parseInt(_0x5d6a0a(0x13a))/0x9)+parseInt(_0x5d6a0a(0x11a))/0xa;if(_0x9fb6b8===_0x472417)break;else _0xa15c5c['push'](_0xa15c5c['shift']());}catch(_0x5c47e3){_0xa15c5c['push'](_0xa15c5c['shift']());}}}(a7_0x36b9,0x9e747));import{jsx as a7_0x397fae,jsxs as a7_0x4f1b34}from'react/jsx-runtime';import{useEffect,useState}from'react';function a7_0x4b9e(_0x73d489,_0x321a7e){_0x73d489=_0x73d489-0x10a;const _0x36b9bb=a7_0x36b9();let _0x4b9e92=_0x36b9bb[_0x73d489];return _0x4b9e92;}import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';function a7_0x36b9(){const _0x508617=['includes','slice','datasetCount','import\x20','3538azrrgs','\x20个数据集,生成','length','\x20from\x20\x27@/','💡\x20请使用\x20','modelCount','env','column','*\x20已生成文件:','online','254oHLCAV','red','lovrabet\x20auth','*\x20导入方式:','7167286wPlcfW','-client','client','64925OSYyme','4554420FtwRCN','拉取\x20API\x20配置失败:\x20','\x20-\x20客户端实例文件','endsWith','205656ilmbfe','join','api','\x20重新登录后再试','originalCount','2357325Dhztoq','√\x20成功拉取\x20','duplicateCount','cyan','setLogPath','16lBukVc','replace','error','8gMGlEK','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','gray','dim','.ts','\x20个模型)','\x20个模型','message','\x20个,过滤重复','split','yellow','api-pull','green','./src/api/','使用指定的应用AppCode:\x20','3522610jPakgM'];a7_0x36b9=function(){return _0x508617;};return a7_0x36b9();}import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';import{fetchModelList}from'./fetch-model-list.js';export const ApiPullUI=({appCode:_0x11ffc6,env:_0xcd7e78,output:_0xfc8f13})=>{const _0x29519a=a7_0x4b9e,{exit:_0x5a6105}=useApp(),[_0x236db5,_0x598b73]=useState(![]),[_0x38ae33,_0x19bbbf]=useState(![]),[_0x5083fb,_0x241d16]=useState(null),[_0x213aee,_0x1d7ee6]=useState(null),_0x5dff5c=readConfig(),_0x30c975=getConfigAppCode(),_0x2afbde=_0x11ffc6||_0x30c975,_0x52482a=typeof _0x5dff5c?.[_0x29519a(0x125)]==='string'?_0x5dff5c[_0x29519a(0x125)]:undefined,_0x352c19=_0xcd7e78||_0x52482a||_0x29519a(0x128);initEnv(_0x352c19);const _0x14c60d=_0xfc8f13||_0x29519a(0x118),_0x3cc964=_0x11ffc6&&_0x11ffc6[_0x29519a(0x11b)]('-')?_0x11ffc6[_0x29519a(0x114)]('-')[_0x29519a(0x11c)](0x1)[_0x29519a(0x136)]('-'):'',_0x136d2e=_0x11ffc6?_0x29519a(0x119)+_0x2afbde:'使用配置的应用AppCode:\x20'+_0x2afbde,_0x2e7f33=_0x3cc964?_0x3cc964+'-api':'api',_0x4b23ab=_0x3cc964?_0x3cc964+_0x29519a(0x12e):_0x29519a(0x12f);useEffect(()=>{_0x598b73(!![]),_0x306b6d();},[]),useEffect(()=>{(_0x38ae33||_0x5083fb)&&_0x5a6105();},[_0x38ae33,_0x5083fb,_0x5a6105]);async function _0x306b6d(){const _0xe374e2=_0x29519a;if(!_0x2afbde){_0x241d16('未提供应用AppCode,且配置中也没有默认值');return;}try{logger[_0xe374e2(0x13e)](process['cwd']());const {configArray:_0x61b281}=await fetchModelList(_0x2afbde),_0x3390c1=_0x61b281[_0xe374e2(0x121)],_0x4e541a=!_0x11ffc6,_0x55e15a=await generateApiFile(_0x61b281,_0x3cc964,_0x2afbde,_0x4e541a,_0x352c19,_0x14c60d),_0x522b42=_0x14c60d[_0xe374e2(0x134)]('/')?_0x14c60d:_0x14c60d+'/';_0x1d7ee6({'api':''+_0x522b42+_0x2e7f33+_0xe374e2(0x10f),'client':''+_0x522b42+_0x4b23ab+_0xe374e2(0x10f),'modelCount':_0x55e15a[_0xe374e2(0x124)],'datasetCount':_0x3390c1,'originalCount':_0x3390c1,'duplicateCount':0x0}),_0x19bbbf(!![]);}catch(_0x34d137){const _0x479094=_0x34d137 instanceof Error?_0x34d137[_0xe374e2(0x112)]:String(_0x34d137);logger[_0xe374e2(0x10a)](_0xe374e2(0x116),_0xe374e2(0x132)+_0x479094,{'appCode':_0x2afbde,'error':_0x479094}),_0x241d16('拉取\x20API\x20配置失败:\x20'+_0x479094);}finally{_0x598b73(![]);}}return a7_0x4f1b34(Box,{'flexDirection':'column','children':[(_0x236db5||_0x38ae33)&&a7_0x4f1b34(Box,{'children':[a7_0x397fae(Text,{'color':_0x29519a(0x10d),'children':'*\x20'}),a7_0x397fae(Text,{'color':_0x11ffc6?'white':_0x29519a(0x10e),'children':_0x136d2e})]}),_0x236db5&&a7_0x397fae(Box,{'children':a7_0x4f1b34(Text,{'children':[_0x29519a(0x10c),_0x352c19,')']})}),_0x38ae33&&_0x213aee&&a7_0x4f1b34(Box,{'flexDirection':'column','children':[a7_0x397fae(Box,{'children':a7_0x4f1b34(Text,{'color':_0x29519a(0x117),'children':[_0x29519a(0x13b),_0x213aee[_0x29519a(0x11d)],_0x29519a(0x120),'\x20',_0x213aee[_0x29519a(0x124)],_0x29519a(0x111)]})}),_0x213aee['duplicateCount']>0x0&&a7_0x397fae(Box,{'marginTop':0x1,'children':a7_0x4f1b34(Text,{'color':_0x29519a(0x115),'children':['!\x20原始数据集\x20',_0x213aee[_0x29519a(0x139)],_0x29519a(0x113),'\x20',_0x213aee[_0x29519a(0x13c)],'\x20个']})}),a7_0x397fae(Box,{'marginTop':0x1,'children':a7_0x397fae(Text,{'color':'gray','children':_0x29519a(0x127)})}),a7_0x4f1b34(Box,{'marginLeft':0x2,'children':[a7_0x4f1b34(Text,{'color':'cyan','children':['•\x20',_0x213aee[_0x29519a(0x137)]]}),a7_0x4f1b34(Text,{'color':_0x29519a(0x10e),'children':['\x20','-\x20模型配置文件\x20(',_0x213aee[_0x29519a(0x124)],_0x29519a(0x110)]})]}),a7_0x4f1b34(Box,{'marginLeft':0x2,'children':[a7_0x4f1b34(Text,{'color':_0x29519a(0x13d),'children':['•\x20',_0x213aee[_0x29519a(0x12f)]]}),a7_0x397fae(Text,{'color':_0x29519a(0x10e),'children':_0x29519a(0x133)})]}),a7_0x397fae(Box,{'marginTop':0x1,'children':a7_0x397fae(Text,{'color':_0x29519a(0x10d),'children':_0x29519a(0x12c)})}),a7_0x397fae(Box,{'marginLeft':0x2,'children':a7_0x4f1b34(Text,{'color':_0x29519a(0x115),'children':[_0x29519a(0x11e),'{\x20lovrabetClient\x20}',_0x29519a(0x122),_0x213aee['client'][_0x29519a(0x140)](/^\.\//,'')[_0x29519a(0x140)](_0x29519a(0x10f),''),'\x27']})})]}),_0x5083fb&&a7_0x4f1b34(Box,{'flexDirection':_0x29519a(0x126),'children':[a7_0x397fae(Box,{'children':a7_0x4f1b34(Text,{'color':_0x29519a(0x12a),'children':['❌\x20',_0x5083fb]})}),_0x5083fb['includes']('登录')&&a7_0x4f1b34(Box,{'marginTop':0x1,'children':[a7_0x397fae(Text,{'color':_0x29519a(0x115),'children':_0x29519a(0x123)}),a7_0x397fae(Text,{'color':_0x29519a(0x13d),'children':_0x29519a(0x12b)}),a7_0x397fae(Text,{'color':'yellow','children':_0x29519a(0x138)})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5af833,_0x1f6528){const _0x5e61f1=a8_0x3ebe,_0x5d7b3e=_0x5af833();while(!![]){try{const _0x40c3d3=parseInt(_0x5e61f1(0xf1))/0x1+-parseInt(_0x5e61f1(0xee))/0x2+-parseInt(_0x5e61f1(0xe6))/0x3+parseInt(_0x5e61f1(0xe0))/0x4*(parseInt(_0x5e61f1(0xde))/0x5)+parseInt(_0x5e61f1(0xe5))/0x6+parseInt(_0x5e61f1(0xea))/0x7*(-parseInt(_0x5e61f1(0xdf))/0x8)+-parseInt(_0x5e61f1(0xe2))/0x9*(-parseInt(_0x5e61f1(0xf5))/0xa);if(_0x40c3d3===_0x1f6528)break;else _0x5d7b3e['push'](_0x5d7b3e['shift']());}catch(_0x5ef666){_0x5d7b3e['push'](_0x5d7b3e['shift']());}}}(a8_0x2189,0x95ef6));function a8_0x3ebe(_0x2b720f,_0x3aa9c8){_0x2b720f=_0x2b720f-0xdc;const _0x218912=a8_0x2189();let _0x3ebec1=_0x218912[_0x2b720f];return _0x3ebec1;}function a8_0x2189(){const _0x1a658b=['Unauthorized','839804fcwONe','UNAUTHORIZED','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','1040725UULdEV','success','configArray','401','30UKFmfy','获取数据集失败:\x20','message','531515KLBlbU','5125048uROIHI','8fRWuTK','未知错误','3927447eYSxxx','获取数据集失败,HTTP状态码:\x20','data','585720NzJQez','2956299fHqoNY','errorCode','count','includes','7VMKozH','fetch-model-list','status'];a8_0x2189=function(){return _0x1a658b;};return a8_0x2189();}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';export async function fetchModelList(_0x4e60fd){const _0x43c247=a8_0x3ebe,_0x15af9c=getEnv(),_0x4cd1ca=getApiDomain()+'/api/node-toolbox/dataset/model-list?appcode='+_0x4e60fd+'&otype=array';logger['info'](_0x43c247(0xeb),'正在从服务器拉取模型列表...\x20(环境:\x20'+_0x15af9c+')',{'apiUrl':_0x4cd1ca});const _0x1f8e7b=await fetch(_0x4cd1ca,{'headers':{'Cookie':getCookie()}});if(!_0x1f8e7b['ok']){if(_0x1f8e7b[_0x43c247(0xec)]===0x191)throw new Error(_0x43c247(0xf0));throw new Error(_0x43c247(0xe3)+_0x1f8e7b[_0x43c247(0xec)]);}const _0x4b3ac3=await _0x1f8e7b['json']();if(!_0x4b3ac3[_0x43c247(0xf2)]){const _0x1c180e=_0x4b3ac3['errorMsg']||_0x4b3ac3[_0x43c247(0xdd)]||_0x4b3ac3[_0x43c247(0xe4)]?.[_0x43c247(0xdd)]||_0x4b3ac3['errorMessage']||_0x4b3ac3['error']||_0x43c247(0xe1);if(_0x1c180e[_0x43c247(0xe9)]('401')||_0x1c180e['includes'](_0x43c247(0xed))||_0x1c180e['includes']('登录')||_0x1c180e[_0x43c247(0xe9)]('认证')||_0x4b3ac3[_0x43c247(0xe7)]===_0x43c247(0xef)||_0x4b3ac3['code']===0x191||_0x4b3ac3['code']===_0x43c247(0xf4))throw new Error(_0x43c247(0xf0));throw new Error(_0x43c247(0xdc)+_0x1c180e);}return{'configArray':_0x4b3ac3[_0x43c247(0xe4)][_0x43c247(0xf3)],'count':_0x4b3ac3[_0x43c247(0xe4)][_0x43c247(0xe8)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a9_0x494e27=a9_0x3f19;(function(_0x54e54f,_0x1b9a39){const _0x150eee=a9_0x3f19,_0x312923=_0x54e54f();while(!![]){try{const _0x211b04=parseInt(_0x150eee(0x11a))/0x1*(-parseInt(_0x150eee(0x12b))/0x2)+-parseInt(_0x150eee(0x11d))/0x3+-parseInt(_0x150eee(0x13a))/0x4+-parseInt(_0x150eee(0x138))/0x5+parseInt(_0x150eee(0x126))/0x6+parseInt(_0x150eee(0x11b))/0x7+-parseInt(_0x150eee(0x140))/0x8*(-parseInt(_0x150eee(0x125))/0x9);if(_0x211b04===_0x1b9a39)break;else _0x312923['push'](_0x312923['shift']());}catch(_0x841465){_0x312923['push'](_0x312923['shift']());}}}(a9_0x5312,0x69046));import a9_0x20c469 from'prettier';function a9_0x5312(){const _0x2a1e22=['string','format','244826opUBIq','1227870ajPMft','resolve','2048406EKOQzD','app','\x22\x20}','client.ts.tpl','replaceApiContent','join','CONFIG_NAMES.DEFAULT','../..','4338GwSSXC','1838682MmkrGx','datasetCode','alias','name','online','2jpWnri','dirname','env','templates/generate-api','./src/api/','length','{\x20apiConfigName:\x20\x22','key','init-api','slice','API\x20文件生成成功!','typescript','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','2306430lANHhA','utf8','2962780bVyVuA','endsWith','{\x20apiConfigName:\x20','-client','forEach',',\x20env:\x20\x22','34488nVIHdG','.ts','-api'];a9_0x5312=function(){return _0x2a1e22;};return a9_0x5312();}function a9_0x3f19(_0x1bc9a3,_0x5199a0){_0x1bc9a3=_0x1bc9a3-0x119;const _0x5312ee=a9_0x5312();let _0x3f192c=_0x5312ee[_0x1bc9a3];return _0x3f192c;}import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a9_0x307bd9 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';export async function generateApiFile(_0x51a1b6,_0x1b8546='',_0x223664,_0x5ea8fa=![],_0x18a435,_0x2fca67=a9_0x494e27(0x12f)){const _0x4a4224=a9_0x494e27,_0x1cf046=readConfig(),_0x2a80b7=_0x223664||_0x1cf046?.[_0x4a4224(0x11e)];if(typeof _0x2a80b7!==_0x4a4224(0x143)||!_0x2a80b7)throw new Error(_0x4a4224(0x137));const _0x975824=_0x5ea8fa?_0x4a4224(0x123):'\x22'+_0x2a80b7+'\x22',_0x54bcfe=typeof _0x1cf046[_0x4a4224(0x12d)]===_0x4a4224(0x143)?_0x1cf046[_0x4a4224(0x12d)]:undefined,_0x1e62cf=_0x18a435||_0x54bcfe||_0x4a4224(0x12a),_0x568a69=_0x1e62cf!=='online';let _0x29a0d4;if(_0x5ea8fa)_0x568a69?_0x29a0d4=_0x4a4224(0x13c)+_0x975824+',\x20env:\x20\x22'+_0x1e62cf+_0x4a4224(0x11f):_0x29a0d4='';else{const _0x3cdd1c=_0x568a69?_0x4a4224(0x13f)+_0x1e62cf+'\x22':'';_0x29a0d4=_0x4a4224(0x131)+_0x2a80b7+'\x22'+_0x3cdd1c+'\x20}';}const _0x22ffe2=_0x1b8546?_0x1b8546+_0x4a4224(0x142):'api',_0x5aefd1=_0x1b8546?_0x1b8546+_0x4a4224(0x13d):'client',_0x1c42f3=[];_0x51a1b6[_0x4a4224(0x13e)](_0x58832e=>{const _0x394cce=_0x4a4224;_0x1c42f3['push']({'datasetCode':_0x58832e[_0x394cce(0x127)],'tableName':_0x58832e['tableName'],'name':_0x58832e[_0x394cce(0x129)]||'','alias':_0x58832e[_0x394cce(0x128)]||_0x58832e[_0x394cce(0x132)]});});const _0x5e8c6e=fileURLToPath(import.meta.url),_0xaa3915=a9_0x307bd9[_0x4a4224(0x11c)](a9_0x307bd9[_0x4a4224(0x12c)](_0x5e8c6e),_0x4a4224(0x124)),_0x1e8b8a=a9_0x307bd9['join'](_0xaa3915,_0x4a4224(0x12e)),_0x17538a=a9_0x307bd9[_0x4a4224(0x122)](_0x1e8b8a,'api.ts.tpl'),_0x33fdc1=a9_0x307bd9['join'](_0x1e8b8a,_0x4a4224(0x120)),_0xd8c68c=_0x2fca67[_0x4a4224(0x13b)]('/')?_0x2fca67[_0x4a4224(0x134)](0x0,-0x1):_0x2fca67;mkdirSync(_0xd8c68c,{'recursive':!![]});const _0x365fd4=_0x1c42f3[0x0]?.[_0x4a4224(0x128)],_0x2ec0b8=readFileSync(_0x17538a,_0x4a4224(0x139)),_0x4bec95=TemplateReplacer[_0x4a4224(0x121)](_0x2ec0b8,_0x2a80b7,_0x1c42f3,_0x365fd4,_0x22ffe2,_0x975824),_0x55347a=await a9_0x20c469[_0x4a4224(0x119)](_0x4bec95,{'parser':_0x4a4224(0x136)}),_0x277536=_0xd8c68c+'/'+_0x22ffe2+_0x4a4224(0x141);writeFileSync(_0x277536,_0x55347a,{'encoding':'utf8'});const _0x482d59=readFileSync(_0x33fdc1,'utf8'),_0x1bd271=TemplateReplacer[_0x4a4224(0x121)](_0x482d59,_0x2a80b7,_0x1c42f3,_0x365fd4,_0x22ffe2,_0x975824,_0x29a0d4),_0x5e4d57=await a9_0x20c469[_0x4a4224(0x119)](_0x1bd271,{'parser':'typescript'}),_0x929cb5=_0xd8c68c+'/'+_0x5aefd1+_0x4a4224(0x141);writeFileSync(_0x929cb5,_0x5e4d57,{'encoding':'utf8'});const _0x40f6b4=_0x1c42f3[_0x4a4224(0x130)];return logger['success'](_0x4a4224(0x133),_0x4a4224(0x135),undefined,{'apiFile':_0x277536,'clientFile':_0x929cb5,'modelCount':_0x40f6b4,'configName':_0x975824}),{'modelCount':_0x40f6b4,'apiFilePath':_0x277536,'clientFilePath':_0x929cb5,'configName':_0x975824};}
|
package/lib/api/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function a10_0x4a9f(){const _0x139d91=['请使用\x20--appcode\x20参数,例如:','\x1b[90m\x20\x20(注:\x20--appcode\x20参数与配置一致,将使用默认配置)\x1b[0m','\x1b[90m*\x20使用配置的应用AppCode:\x20','exit','\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20','input','message','❌\x20错误:不再支持位置参数方式','5KPHtjI','89901fQPwGI','doc','pull','parse','702ibTfpZ','×\x20未配置\x20AppCode','\x20\x20lovrabet\x20api\x20doc\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)','filter','2199366AJoaUj','map','appcode','!\x20请使用以下方式之一:','isArray','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20doc\x20--appcode\x20<app-code>','\x1b[0m','join','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode','\x20\x20lovrabet\x20api\x20pull\x20--appcode\x20','split','length','3183372DJdelz','\x1b[90m*\x20仅生成指定数据集的文档:\x20','10OAmXSD','6043096xXIKji','error','3929372aSIsEc','env','string','flags','object','datasetcode','33111397mASDEf','log','9NSmtxO','912339SgSauK','×\x20--datasetcode\x20参数不能为空','\x20\x20\x201.\x20配置默认值:\x20lovrabet\x20config\x20set\x20appcode\x20<app-code>','trim','\x20\x20\x202.\x20使用参数:\x20lovrabet\x20api\x20pull\x20--appcode\x20<app-code>'];a10_0x4a9f=function(){return _0x139d91;};return a10_0x4a9f();}function a10_0x2eb6(_0x10b7bd,_0x41c2bc){_0x10b7bd=_0x10b7bd-0x1d0;const _0x4a9f28=a10_0x4a9f();let _0x2eb641=_0x4a9f28[_0x10b7bd];return _0x2eb641;}(function(_0x146af7,_0x2832ae){const _0x34b6b7=a10_0x2eb6,_0x5e9905=_0x146af7();while(!![]){try{const _0x17e461=-parseInt(_0x34b6b7(0x1f4))/0x1+-parseInt(_0x34b6b7(0x1da))/0x2+parseInt(_0x34b6b7(0x1e6))/0x3+parseInt(_0x34b6b7(0x1eb))/0x4*(parseInt(_0x34b6b7(0x1d1))/0x5)+parseInt(_0x34b6b7(0x1d6))/0x6*(-parseInt(_0x34b6b7(0x1d2))/0x7)+-parseInt(_0x34b6b7(0x1e9))/0x8*(parseInt(_0x34b6b7(0x1f3))/0x9)+parseInt(_0x34b6b7(0x1e8))/0xa*(parseInt(_0x34b6b7(0x1f1))/0xb);if(_0x17e461===_0x2832ae)break;else _0x5e9905['push'](_0x5e9905['shift']());}catch(_0x1833f6){_0x5e9905['push'](_0x5e9905['shift']());}}}(a10_0x4a9f,0xbf4c2));import{jsx as a10_0x60c857}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';export async function apiCli(_0x640b1a){const _0x3c7f1c=a10_0x2eb6,_0x4387f2=_0x640b1a['input'][0x1];if(_0x640b1a[_0x3c7f1c(0x1ee)]['help']){console[_0x3c7f1c(0x1f2)]('\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(_0x4387f2===_0x3c7f1c(0x1d4)){_0x640b1a['input'][0x2]&&(console[_0x3c7f1c(0x1ea)](_0x3c7f1c(0x1d0)),console[_0x3c7f1c(0x1f2)]('请使用\x20--appcode\x20参数,例如:'),console['log'](_0x3c7f1c(0x1e3)+_0x640b1a['input'][0x2]),process[_0x3c7f1c(0x1fc)](0x1));const _0x2208df=getConfigAppCode();let _0xce25c7=_0x640b1a[_0x3c7f1c(0x1ee)][_0x3c7f1c(0x1dc)];const _0x2c1f11=typeof _0x640b1a[_0x3c7f1c(0x1ee)]['env']===_0x3c7f1c(0x1ed)?_0x640b1a['flags']['env']:undefined,_0x28199b=_0x640b1a[_0x3c7f1c(0x1ee)]['output'];!_0xce25c7&&!_0x2208df&&(console[_0x3c7f1c(0x1ea)]('×\x20未配置\x20AppCode'),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1dd)),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1f6)),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1f8)),process[_0x3c7f1c(0x1fc)](0x1)),_0xce25c7&&_0x2208df&&_0xce25c7===_0x2208df&&(console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1fb)+_0xce25c7+'\x1b[0m'),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1fa)),_0xce25c7=undefined),render(a10_0x60c857(ApiPullUI,{'appCode':_0xce25c7,'env':_0x2c1f11,'output':_0x28199b}));}else{if(_0x4387f2===_0x3c7f1c(0x1d3)){_0x640b1a[_0x3c7f1c(0x1fe)][0x2]&&(console['error'](_0x3c7f1c(0x1d0)),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1f9)),console['log'](_0x3c7f1c(0x1fd)+_0x640b1a[_0x3c7f1c(0x1fe)][0x2]),process[_0x3c7f1c(0x1fc)](0x1));const _0x181a7b=getConfigAppCode();let _0x2ebe52=_0x640b1a[_0x3c7f1c(0x1ee)][_0x3c7f1c(0x1dc)];const _0x581ced=typeof _0x640b1a[_0x3c7f1c(0x1ee)][_0x3c7f1c(0x1ec)]===_0x3c7f1c(0x1ed)?_0x640b1a[_0x3c7f1c(0x1ee)][_0x3c7f1c(0x1ec)]:undefined,_0x2c7983=_0x640b1a[_0x3c7f1c(0x1ee)]['output'],_0x5c17e4=_0x640b1a[_0x3c7f1c(0x1ee)]['params'],_0x2cbb80=_0x640b1a[_0x3c7f1c(0x1ee)][_0x3c7f1c(0x1f0)];!_0x2ebe52&&!_0x181a7b&&(console[_0x3c7f1c(0x1ea)](_0x3c7f1c(0x1d7)),console['log'](_0x3c7f1c(0x1dd)),console['log'](_0x3c7f1c(0x1f6)),console['log'](_0x3c7f1c(0x1df)),process[_0x3c7f1c(0x1fc)](0x1));_0x2ebe52&&_0x181a7b&&_0x2ebe52===_0x181a7b&&(console[_0x3c7f1c(0x1f2)]('\x1b[90m*\x20使用配置的应用AppCode:\x20'+_0x2ebe52+_0x3c7f1c(0x1e0)),_0x2ebe52=undefined);let _0x4597f5;if(_0x5c17e4)try{_0x4597f5=JSON[_0x3c7f1c(0x1d5)](_0x5c17e4),(typeof _0x4597f5!==_0x3c7f1c(0x1ef)||_0x4597f5===null||Array[_0x3c7f1c(0x1de)](_0x4597f5))&&(console[_0x3c7f1c(0x1ea)]('×\x20--params\x20参数必须是一个有效的\x20JSON\x20对象'),process['exit'](0x1));}catch(_0x589777){console[_0x3c7f1c(0x1ea)]('×\x20--params\x20参数不是有效的\x20JSON\x20格式'),console[_0x3c7f1c(0x1ea)]('\x20\x20错误:\x20'+(_0x589777 instanceof Error?_0x589777[_0x3c7f1c(0x1ff)]:String(_0x589777))),process[_0x3c7f1c(0x1fc)](0x1);}let _0x3c4e0f;_0x2cbb80&&(_0x3c4e0f=_0x2cbb80[_0x3c7f1c(0x1e4)](',')[_0x3c7f1c(0x1db)](_0xc30ca4=>_0xc30ca4[_0x3c7f1c(0x1f7)]())[_0x3c7f1c(0x1d9)](_0x3d3534=>_0x3d3534[_0x3c7f1c(0x1e5)]>0x0),_0x3c4e0f[_0x3c7f1c(0x1e5)]===0x0&&(console[_0x3c7f1c(0x1ea)](_0x3c7f1c(0x1f5)),process['exit'](0x1)),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1e7)+_0x3c4e0f[_0x3c7f1c(0x1e1)](',\x20')+'\x1b[0m')),render(a10_0x60c857(ApiDocUI,{'appCode':_0x2ebe52,'env':_0x581ced,'output':_0x2c7983,'extraParams':_0x4597f5,'datasetCodes':_0x3c4e0f}));}else console['error']('Unknown\x20api\x20command:\x20'+_0x4387f2),console[_0x3c7f1c(0x1f2)]('Available\x20commands:'),console[_0x3c7f1c(0x1f2)]('\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配置文件'),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1e2)),console[_0x3c7f1c(0x1f2)]('\x20\x20lovrabet\x20api\x20pull\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定输出目录(默认:\x20./src/api/)'),console[_0x3c7f1c(0x1f2)]('\x20\x20lovrabet\x20api\x20pull\x20--env\x20<env>\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定环境(如:\x20daily,\x20online)'),console[_0x3c7f1c(0x1f2)](''),console[_0x3c7f1c(0x1f2)]('\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文档'),console['log']('\x20\x20lovrabet\x20api\x20doc\x20--appcode\x20<code>\x20\x20\x20\x20\x20\x20\x20//\x20使用指定的\x20appcode'),console['log']('\x20\x20lovrabet\x20api\x20doc\x20--output\x20<dir>\x20\x20\x20\x20\x20\x20\x20\x20\x20//\x20指定文档输出目录(默认:\x20./docs)'),console[_0x3c7f1c(0x1f2)](_0x3c7f1c(0x1d8)),process['exit'](0x1);}}
|