@lovrabet/cli 1.2.5-beta.4 → 1.2.5-beta.6
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 -0
- 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 -0
- package/lib/mcp/mcp-installer.js +1 -0
- package/lib/skills/SkillInstallUI.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/skill-install-non-interactive.js +1 -0
- package/lib/skills/skill-installer.js +1 -0
- package/lib/ui/IDESelector.js +1 -0
- package/lib/ui/useIDESelection.js +1 -0
- package/lib/utils/ai_config.js +1 -0
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/file-utils.js +1 -0
- 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/.shared/README.md +12 -37
- package/templates/skills/.shared/SKILL.md.tpl +119 -0
- package/templates/skills/.shared/guides/01-filter-query/guide.md +2 -3
- package/templates/skills/.shared/guides/02-mcp-sql-workflow/guide.md +2 -2
- package/templates/skills/.shared/guides/03-antd-style/guide.md +21 -8
- package/templates/skills/.shared/guides/04-troubleshooting/guide.md +1 -1
- package/templates/skills/.shared/guides/05-api-integration/guide.md +4 -2
- package/templates/skills/.shared/guides/06-menu-management/guide.md +4 -2
- package/templates/skills/.shared/guides/07-backend-function/guide.md +312 -445
- package/templates/skills/.agent/skills/lovrabet/SKILL.md +0 -258
- package/templates/skills/.claude/skills/lovrabet/SKILL.md +0 -258
- package/templates/skills/.codebuddy/skills/lovrabet/SKILL.md +0 -258
- package/templates/skills/.codex/skills/lovrabet/SKILL.md +0 -258
- package/templates/skills/.cursor/commands/lovrabet.md +0 -248
- package/templates/skills/.opencode/skills/lovrabet/SKILL.md +0 -258
- package/templates/skills/.qoder/rules/lovrabet.md +0 -258
- package/templates/skills/.qoder/skills/lovrabet.md +0 -258
- package/templates/skills/.trae/skills/lovrabet/SKILL.md +0 -258
- package/templates/skills/.windsurf/workflows/lovrabet.md +0 -257
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1a05b9,_0xf68da9){const _0x597180=a0_0xfb1a,_0x3676c3=_0x1a05b9();while(!![]){try{const _0x1aa826=-parseInt(_0x597180(0x10c))/0x1*(parseInt(_0x597180(0x105))/0x2)+parseInt(_0x597180(0x113))/0x3*(parseInt(_0x597180(0x110))/0x4)+-parseInt(_0x597180(0x11e))/0x5+-parseInt(_0x597180(0x10a))/0x6+parseInt(_0x597180(0x115))/0x7+parseInt(_0x597180(0x108))/0x8*(-parseInt(_0x597180(0x11a))/0x9)+parseInt(_0x597180(0x11c))/0xa;if(_0x1aa826===_0xf68da9)break;else _0x3676c3['push'](_0x3676c3['shift']());}catch(_0x1f6f04){_0x3676c3['push'](_0x3676c3['shift']());}}}(a0_0x492d,0xb9599));import{jsx as a0_0x59d81a,jsxs as a0_0x15d8ab}from'react/jsx-runtime';import{useState}from'react';function a0_0xfb1a(_0x4f3795,_0x46f67b){_0x4f3795=_0x4f3795-0x105;const _0x492dc5=a0_0x492d();let _0xfb1a17=_0x492dc5[_0x4f3795];return _0xfb1a17;}import{Text,Box,useInput}from'ink';import a0_0x189be5 from'node:fs';function a0_0x492d(){const _0x491608=['return','路径不能以\x20/\x20开头或结尾','5949CnHXsT','页面路径不合法','16429630EalQjk','\x20Step2:\x20','2008750sPClQI','trim','页面路径长度不能超过\x20100\x20个字符','106xbWyoe','green','test','200uZvNwJ','slice','5882442QAToZu','existsSync','18498TOETGw','split','red','路径不能包含连续的\x20/','4ZbfBnI','页面路径\x20','endsWith','1025142XWcyFZ','includes','8075144eQbHiK','gray','\x20已存在,请使用其他路径'];a0_0x492d=function(){return _0x491608;};return a0_0x492d();}export function InputProjectCode(_0x7e9a25){const _0x20e3ec=a0_0xfb1a,{onSubmit:_0x18e8ec,pagePath:_0x5c073b}=_0x7e9a25,[_0x4ddf6c,_0x4aff9e]=useState(''),[_0xf8e459,_0x58850d]=useState(''),_0xd8bb9d='my-page';function _0x129a2a(_0x5c528c){const _0x88ef80=a0_0xfb1a;if(_0x5c528c['length']>0x64)return{'valid':![],'message':_0x88ef80(0x120)};if(_0x5c528c['startsWith']('/')||_0x5c528c[_0x88ef80(0x112)]('/'))return{'valid':![],'message':_0x88ef80(0x119)};if(_0x5c528c[_0x88ef80(0x114)]('//'))return{'valid':![],'message':_0x88ef80(0x10f)};const _0x52f790=_0x5c528c[_0x88ef80(0x10d)]('/');for(const _0x52f022 of _0x52f790){if(!_0x52f022)continue;const _0x41b2f7=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x41b2f7[_0x88ef80(0x107)](_0x52f022))return{'valid':![],'message':'路径中的每个段只能以字母或数字开头,且只包含字母、数字、-\x20和\x20_'};}return{'valid':!![]};}return useInput((_0x7a3323,_0x566180)=>{const _0x5d2aa9=a0_0xfb1a;if(_0x566180[_0x5d2aa9(0x118)]){const _0x59724a=_0x4ddf6c[_0x5d2aa9(0x11f)]()||_0xd8bb9d;if(_0xf8e459)return;const _0x4f330e=_0x5c073b+'/'+_0x59724a;if(a0_0x189be5[_0x5d2aa9(0x10b)](_0x4f330e)){_0x58850d(_0x5d2aa9(0x111)+_0x59724a+_0x5d2aa9(0x117));return;}_0x18e8ec(_0x59724a),_0x4aff9e(''),_0x58850d('');}else _0x566180['backspace']||_0x566180['delete']?_0x4aff9e(_0x5af399=>{const _0x13bddb=_0x5d2aa9,_0x42a07f=_0x5af399[_0x13bddb(0x109)](0x0,-0x1),{valid:_0x20bd8d,message:_0x100e89}=_0x129a2a(_0x42a07f);return _0x58850d(_0x20bd8d?'':_0x100e89||_0x13bddb(0x11b)),_0x42a07f;}):_0x4aff9e(_0x4bde38=>{const _0x32101e=_0x4bde38+_0x7a3323,{valid:_0x249732,message:_0x588e52}=_0x129a2a(_0x32101e);return _0x58850d(_0x249732?'':_0x588e52||'页面路径不合法'),_0x32101e;});}),a0_0x15d8ab(Box,{'flexDirection':'column','children':[a0_0x15d8ab(Box,{'children':[a0_0x59d81a(Text,{'color':_0x20e3ec(0x116),'children':_0x20e3ec(0x11d)}),a0_0x59d81a(Text,{'children':'页面路由地址:\x20'}),_0x4ddf6c?a0_0x59d81a(Text,{'color':_0x20e3ec(0x106),'children':_0x4ddf6c}):a0_0x59d81a(Text,{'color':_0x20e3ec(0x116),'children':_0xd8bb9d}),_0xf8e459&&a0_0x15d8ab(Text,{'color':_0x20e3ec(0x10e),'children':['\x20←\x20',_0xf8e459]})]}),!_0xf8e459&&!_0x4ddf6c&&a0_0x59d81a(Box,{'children':a0_0x59d81a(Text,{'color':_0x20e3ec(0x116),'children':'\x20直接回车确认,或输入自定义路由地址'})})]});}
|
package/lib/add-page/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a1_0x1ae621=a1_0x5729;(function(_0x1b92f1,_0x3f61ca){const _0x4880c0=a1_0x5729,_0x1ef317=_0x1b92f1();while(!![]){try{const _0x5527fb=parseInt(_0x4880c0(0x205))/0x1*(parseInt(_0x4880c0(0x1f8))/0x2)+parseInt(_0x4880c0(0x1fe))/0x3+parseInt(_0x4880c0(0x1ec))/0x4+parseInt(_0x4880c0(0x1f6))/0x5*(parseInt(_0x4880c0(0x1f9))/0x6)+-parseInt(_0x4880c0(0x204))/0x7+-parseInt(_0x4880c0(0x1e5))/0x8*(parseInt(_0x4880c0(0x1ee))/0x9)+-parseInt(_0x4880c0(0x1eb))/0xa;if(_0x5527fb===_0x3f61ca)break;else _0x1ef317['push'](_0x1ef317['shift']());}catch(_0x509cf2){_0x1ef317['push'](_0x1ef317['shift']());}}}(a1_0x1344,0xd1b64));import{jsx as a1_0x4ac368,jsxs as a1_0x447f82,Fragment as a1_0x255696}from'react/jsx-runtime';import{fileURLToPath}from'node:url';import a1_0x26a2d5 from'node:path';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';function a1_0x5729(_0x1dcedc,_0x533b77){_0x1dcedc=_0x1dcedc-0x1e0;const _0x1344d3=a1_0x1344();let _0x5729e5=_0x1344d3[_0x1dcedc];return _0x5729e5;}import{SelectPageTemplate}from'./select-page-template.js';function a1_0x1344(){const _0x5550e4=['\x20*\x20页面创建成功!','green','开始添加页面:\x20','resolve','页面添加失败:\x20','78655shMefD','join','10xTHRHz','318NrJdNY','pages','cyan','error','src','4185063GnQCvg','已选择页面模板\x20','catch','\x20*\x20路由地址:\x20','processTemplate','now','11918991xqzJMQ','240490QyJBiR','\x20Step1:\x20','cwd','then','add-page','success','53968lnMPsA','已输入的页面路由\x20','message','finally','setLogPath','gray','12315700fUVknu','6359284hhJJkT','info','1638qwWgQW','../../templates/pages','页面添加成功:\x20'];a1_0x1344=function(){return _0x5550e4;};return a1_0x1344();}import{InputProjectCode}from'./input-page-router.js';import{logger}from'../utils/logger.js';import{TemplateReplacer}from'../utils/template-replacer.js';const __dirname=a1_0x26a2d5['dirname'](fileURLToPath(import.meta.url)),pageTemplateDir=a1_0x26a2d5['resolve'](__dirname,a1_0x1ae621(0x1ef)),projectDir=process[a1_0x1ae621(0x1e1)]();export const AddPage=()=>{const _0x4823ed=a1_0x1ae621,{exit:_0x210e9f}=useApp(),[_0x2a7dfc,_0x5dcef4]=useState(''),[_0x36ade7,_0x112768]=useState(''),[_0x41926b,_0x27c20e]=useState(![]),[_0x15488f,_0x5c03ae]=useState(![]),_0x157830=a1_0x26a2d5[_0x4823ed(0x1f7)](projectDir,_0x4823ed(0x1fd),_0x4823ed(0x1fa)),_0x4e642c=a1_0x26a2d5[_0x4823ed(0x1f7)](_0x157830,_0x36ade7),_0x3ef2e3=a1_0x26a2d5['join'](_0x4823ed(0x1fd),_0x4823ed(0x1fa),_0x36ade7);useEffect(()=>{const _0x175f57=_0x4823ed,_0x2cccaf=a1_0x26a2d5[_0x175f57(0x1f4)](pageTemplateDir,_0x2a7dfc);if(_0x2a7dfc&&_0x36ade7){_0x27c20e(!![]),logger[_0x175f57(0x1e9)](process[_0x175f57(0x1e1)]());const _0x6f792c=Date['now']();logger[_0x175f57(0x1ed)]('add-page',_0x175f57(0x1f3)+_0x36ade7,{'template':_0x2a7dfc,'targetPath':_0x3ef2e3}),TemplateReplacer[_0x175f57(0x202)](_0x2cccaf,a1_0x26a2d5[_0x175f57(0x1f7)](_0x157830,_0x36ade7),_0x36ade7,_0x2a7dfc)[_0x175f57(0x1e2)](()=>{const _0x19c046=_0x175f57,_0x10c7f4=Date[_0x19c046(0x203)]()-_0x6f792c;logger[_0x19c046(0x1e4)](_0x19c046(0x1e3),_0x19c046(0x1f0)+_0x36ade7,_0x10c7f4,{'template':_0x2a7dfc,'targetPath':_0x3ef2e3,'routePath':_0x36ade7}),_0x5c03ae(!![]);})[_0x175f57(0x200)](_0x14f5e7=>{const _0x783934=_0x175f57,_0x5c9b6e=Date[_0x783934(0x203)]()-_0x6f792c;logger[_0x783934(0x1fc)]('add-page',_0x783934(0x1f5)+_0x36ade7,{'template':_0x2a7dfc,'targetPath':_0x3ef2e3,'error':_0x14f5e7 instanceof Error?_0x14f5e7[_0x783934(0x1e7)]:String(_0x14f5e7),'duration':_0x5c9b6e});})[_0x175f57(0x1e8)](()=>{_0x27c20e(![]);});}},[_0x2a7dfc,_0x36ade7]),useEffect(()=>{_0x15488f&&setTimeout(()=>{_0x210e9f();});},[_0x15488f]);if(_0x2a7dfc)return a1_0x447f82(Box,{'flexDirection':'column','paddingY':0x1,'children':[a1_0x447f82(Box,{'children':[a1_0x4ac368(Text,{'color':_0x4823ed(0x1ea),'children':_0x4823ed(0x1e0)}),a1_0x4ac368(Text,{'children':_0x4823ed(0x1ff)}),a1_0x4ac368(Text,{'color':_0x4823ed(0x1f2),'children':_0x2a7dfc})]}),_0x36ade7?a1_0x447f82(Box,{'children':[a1_0x4ac368(Text,{'color':_0x4823ed(0x1ea),'children':'\x20Step2:\x20'}),a1_0x4ac368(Text,{'children':_0x4823ed(0x1e6)}),a1_0x4ac368(Text,{'color':_0x4823ed(0x1f2),'children':_0x36ade7})]}):a1_0x4ac368(InputProjectCode,{'pagePath':_0x4e642c,'onSubmit':_0x112768}),_0x36ade7&&_0x41926b?a1_0x447f82(Box,{'marginTop':0x1,'children':[a1_0x4ac368(Box,{'width':'4'}),a1_0x4ac368(Text,{'children':'正在创建页面,请稍候…'})]}):null,_0x15488f?a1_0x447f82(a1_0x255696,{'children':[a1_0x4ac368(Box,{'marginTop':0x1,'children':a1_0x4ac368(Text,{'color':_0x4823ed(0x1ea),'children':_0x4823ed(0x1f1)})}),a1_0x447f82(Box,{'children':[a1_0x4ac368(Text,{'color':'gray','children':'\x20*\x20页面路径:\x20'}),a1_0x4ac368(Text,{'color':_0x4823ed(0x1f2),'children':_0x3ef2e3})]}),a1_0x447f82(Box,{'children':[a1_0x4ac368(Text,{'color':'gray','children':_0x4823ed(0x201)}),a1_0x447f82(Text,{'color':'green','children':['/',_0x36ade7]})]}),a1_0x4ac368(Box,{'marginTop':0x1,'children':a1_0x4ac368(Text,{'color':_0x4823ed(0x1fb),'children':'\x20*\x20页面文件已创建,可直接通过路由访问'})})]}):null]});return a1_0x4ac368(SelectPageTemplate,{'onSelect':_0x5dcef4});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x3c55e1,_0x2c4610){const _0x325a10=a2_0x4631,_0x543a5b=_0x3c55e1();while(!![]){try{const _0x556178=parseInt(_0x325a10(0x15a))/0x1*(-parseInt(_0x325a10(0x162))/0x2)+parseInt(_0x325a10(0x169))/0x3+-parseInt(_0x325a10(0x151))/0x4*(parseInt(_0x325a10(0x16b))/0x5)+parseInt(_0x325a10(0x164))/0x6*(-parseInt(_0x325a10(0x159))/0x7)+parseInt(_0x325a10(0x167))/0x8*(-parseInt(_0x325a10(0x160))/0x9)+-parseInt(_0x325a10(0x15e))/0xa+-parseInt(_0x325a10(0x152))/0xb*(-parseInt(_0x325a10(0x16c))/0xc);if(_0x556178===_0x2c4610)break;else _0x543a5b['push'](_0x543a5b['shift']());}catch(_0x58ffb6){_0x543a5b['push'](_0x543a5b['shift']());}}}(a2_0x5cd9,0x9dd83));import{jsx as a2_0x51f01d,jsxs as a2_0x3ffdda}from'react/jsx-runtime';import{useState,useEffect}from'react';import{Text,Box,useInput}from'ink';import{readdir}from'node:fs/promises';function a2_0x5cd9(){const _0x409c6e=['4085772xBwRVk','110pPCMEa','请选择您要创建的页面模板','upArrow','正在加载页面模板...','green','\x20\x20\x20\x20\x20\x20>\x20','column','21WVbodB','1QIXApF','filter','onSelect','error','5349010FRoHWn','join','135XWRWqS','length','2018764jjfaZs','../..','1295718fnEwKE','获取模板列表失败:','isDirectory','627992JDSQTm','templates/pages','2783853NoIQXV','label','5KJTqOW','4931580CXmFGA','return','downArrow','resolve'];a2_0x5cd9=function(){return _0x409c6e;};return a2_0x5cd9();}import a2_0x2ad898 from'node:path';import{fileURLToPath}from'node:url';function a2_0x4631(_0x1673c2,_0x46fd43){_0x1673c2=_0x1673c2-0x150;const _0x5cd92b=a2_0x5cd9();let _0x46313a=_0x5cd92b[_0x1673c2];return _0x46313a;}async function getTemplateList(){const _0x42547c=a2_0x4631;try{const _0x269f3f=fileURLToPath(import.meta.url),_0x2708f0=a2_0x2ad898[_0x42547c(0x150)](a2_0x2ad898['dirname'](_0x269f3f),_0x42547c(0x163)),_0x420bba=a2_0x2ad898[_0x42547c(0x15f)](_0x2708f0,_0x42547c(0x168)),_0x1fd6d3=await readdir(_0x420bba,{'withFileTypes':!![]}),_0x1f074d=_0x1fd6d3[_0x42547c(0x15b)](_0x5be40e=>_0x5be40e[_0x42547c(0x166)]())['map'](_0x2bb884=>({'label':_0x2bb884['name']}))['sort']((_0x3bdefa,_0x5935f4)=>_0x3bdefa['label']['localeCompare'](_0x5935f4[_0x42547c(0x16a)]));return _0x1f074d;}catch(_0x11bb2d){return console[_0x42547c(0x15d)](_0x42547c(0x165),_0x11bb2d),[{'label':'blank'},{'label':'sdk-fetch'}];}}export function SelectPageTemplate(_0x377683){const _0x517a9e=a2_0x4631,[_0x2b345b,_0x400e8f]=useState(0x0),[_0x107838,_0x2fd59c]=useState([]),[_0x14ab53,_0x29b5c6]=useState(!![]);useEffect(()=>{async function _0x24e173(){const _0x1d12a1=await getTemplateList();_0x2fd59c(_0x1d12a1),_0x29b5c6(![]);}_0x24e173();},[]),useInput((_0x186f6d,_0x1d95e3)=>{const _0x19904f=a2_0x4631;if(_0x14ab53)return;if(_0x1d95e3[_0x19904f(0x16d)]){const _0x841911=_0x107838[_0x2b345b];_0x841911&&_0x377683[_0x19904f(0x15c)](_0x841911[_0x19904f(0x16a)]);}_0x1d95e3[_0x19904f(0x154)]&&_0x400e8f(_0x38a060=>_0x38a060===0x0?_0x107838[_0x19904f(0x161)]-0x1:_0x38a060-0x1),_0x1d95e3[_0x19904f(0x16e)]&&_0x400e8f(_0x21d132=>_0x21d132===_0x107838[_0x19904f(0x161)]-0x1?0x0:_0x21d132+0x1);});if(_0x14ab53)return a2_0x51f01d(Box,{'flexDirection':_0x517a9e(0x158),'paddingY':0x1,'children':a2_0x3ffdda(Box,{'children':[a2_0x51f01d(Text,{'color':'gray','children':'\x20Step1:\x20'}),a2_0x51f01d(Text,{'children':_0x517a9e(0x155)})]})});return a2_0x3ffdda(Box,{'flexDirection':_0x517a9e(0x158),'paddingY':0x1,'children':[a2_0x3ffdda(Box,{'children':[a2_0x51f01d(Text,{'color':'gray','children':'\x20Step1:\x20'}),a2_0x51f01d(Text,{'children':_0x517a9e(0x153)})]}),_0x107838['map']((_0x5e85cb,_0x5ee00f)=>{const _0x3512ac=_0x517a9e,_0x44fd15=_0x5ee00f===_0x2b345b,_0xe8a45e=_0x44fd15?_0x3512ac(0x157)+_0x5e85cb[_0x3512ac(0x16a)]:'\x20\x20\x20\x20\x20\x20\x20\x20'+_0x5e85cb['label'];return a2_0x51f01d(Box,{'children':a2_0x51f01d(Text,{'color':_0x44fd15?_0x3512ac(0x156):undefined,'children':_0xe8a45e})},_0xe8a45e);})]});}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a3_0x149922=a3_0x3828;(function(_0x533300,_0x41f433){const _0x107ce6=a3_0x3828,_0x5a81c6=_0x533300();while(!![]){try{const _0x296dec=parseInt(_0x107ce6(0x1d8))/0x1+-parseInt(_0x107ce6(0x1c6))/0x2+-parseInt(_0x107ce6(0x1d1))/0x3+-parseInt(_0x107ce6(0x1f7))/0x4*(parseInt(_0x107ce6(0x1ea))/0x5)+-parseInt(_0x107ce6(0x1e4))/0x6*(-parseInt(_0x107ce6(0x1c1))/0x7)+parseInt(_0x107ce6(0x1e2))/0x8*(-parseInt(_0x107ce6(0x1ca))/0x9)+parseInt(_0x107ce6(0x1e3))/0xa;if(_0x296dec===_0x41f433)break;else _0x5a81c6['push'](_0x5a81c6['shift']());}catch(_0x199d38){_0x5a81c6['push'](_0x5a81c6['shift']());}}}(a3_0x3f96,0x9e8e5));import{jsx as a3_0x89b1ca,jsxs as a3_0x32a96c}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';function a3_0x3f96(){const _0x409f25=['upArrow','cursor','blue','117DKXfKS','name','codebuddy','Claude\x20Code','windsurf','gray','qoder','2450508HoCbwK','filter','white','confirming','正在配置\x20AI\x20助手...','*\x20选择要配置的\x20IDE:','是否同时配置\x20AI\x20助手?这将:','1162987eeRZxL','error','[Y]\x20是,配置\x20AI\x20助手','codex','red','Cursor','opencode','length','green','[\x20]','614904xOkKtu','25762500hUBAij','2004DQvIhF','skill-','↑/↓:\x20移动\x20空格:\x20切换\x20a:\x20全选\x20q:\x20退出\x20Enter:\x20确认','projectRoot','请至少选择一个配置项','mcp-','20QAeSLj','技能包\x20(研发规范指南)','yellow','appcode','map','agent','downArrow','done','add','delete','•\x20MCP:\x20让\x20AI\x20直接访问\x20Lovrabet\x20数据集','column','[✓]','1119740lMDaJy','status','installing','has','message','return','9170WpAwqi','size','cyan','push','selecting','1183074fCRazu'];a3_0x3f96=function(){return _0x409f25;};return a3_0x3f96();}const MCP_IDE_LIST=[a3_0x149922(0x1c8),'claude'],SKILL_IDE_LIST=['antigravity','claude',a3_0x149922(0x1cc),a3_0x149922(0x1db),a3_0x149922(0x1c8),a3_0x149922(0x1de),a3_0x149922(0x1d0),'trae',a3_0x149922(0x1ce),a3_0x149922(0x1ef)];function a3_0x3828(_0x433279,_0x4cb78d){_0x433279=_0x433279-0x1c1;const _0x3f9635=a3_0x3f96();let _0x38287f=_0x3f9635[_0x433279];return _0x38287f;}export function AISetupUI({config:_0x237b96,onComplete:_0x30aa0c}){const _0x3240ca=a3_0x149922,{exit:_0x5c8d1b}=useApp(),[_0x3c6b0e,_0x141923]=useState('confirming'),[_0x3856d2,_0x52a7a8]=useState(0x0),[_0x4081c9,_0x25182d]=useState(new Set([0x0,0x1])),[_0x1c8618,_0x1de939]=useState(new Set(SKILL_IDE_LIST[_0x3240ca(0x1ee)]((_0x4ac10d,_0x11c92d)=>_0x11c92d))),[_0x3f3a64,_0x553461]=useState('');useEffect(()=>{!_0x237b96['appcode']&&_0x30aa0c({'mcpResults':[],'skillResults':[]});},[_0x237b96[_0x3240ca(0x1ed)],_0x30aa0c]),useInput((_0x18049f,_0x338897)=>{const _0x1837d1=_0x3240ca;if(_0x3c6b0e===_0x1837d1(0x1d4)){if(_0x18049f==='y'||_0x18049f==='Y'||_0x338897['return']){_0x3d6261();return;}if(_0x18049f==='n'||_0x18049f==='N'){_0x30aa0c({'mcpResults':[],'skillResults':[]});return;}if(_0x338897[_0x1837d1(0x1fc)]){_0x3d6261();return;}}if(_0x3c6b0e===_0x1837d1(0x1c5)){if(_0x338897[_0x1837d1(0x1c7)]){_0x52a7a8(_0xfb6bdd=>_0xfb6bdd>0x0?_0xfb6bdd-0x1:SKILL_IDE_LIST[_0x1837d1(0x1df)]-0x1);return;}if(_0x338897[_0x1837d1(0x1f0)]){_0x52a7a8(_0x37b34e=>_0x37b34e<SKILL_IDE_LIST[_0x1837d1(0x1df)]-0x1?_0x37b34e+0x1:0x0);return;}if(_0x18049f==='\x20'){const _0x4bdd4b=_0x3856d2<MCP_IDE_LIST['length'];if(_0x4bdd4b){const _0x15c2b0=new Set(_0x4081c9);_0x15c2b0[_0x1837d1(0x1fa)](_0x3856d2)?_0x15c2b0[_0x1837d1(0x1f3)](_0x3856d2):_0x15c2b0[_0x1837d1(0x1f2)](_0x3856d2),_0x25182d(_0x15c2b0);}else{const _0x418766=_0x3856d2-MCP_IDE_LIST['length'],_0x5e4414=new Set(_0x1c8618);_0x5e4414[_0x1837d1(0x1fa)](_0x418766)?_0x5e4414['delete'](_0x418766):_0x5e4414[_0x1837d1(0x1f2)](_0x418766),_0x1de939(_0x5e4414);}return;}if(_0x18049f==='a'||_0x18049f==='A'){_0x25182d(new Set(MCP_IDE_LIST[_0x1837d1(0x1ee)]((_0x8c79f1,_0x41db9b)=>_0x41db9b))),_0x1de939(new Set(SKILL_IDE_LIST[_0x1837d1(0x1ee)]((_0xb6dac6,_0x15cab1)=>_0x15cab1)));return;}if(_0x18049f==='q'||_0x18049f==='Q'){_0x5c8d1b();return;}if(_0x338897[_0x1837d1(0x1fc)]){if(_0x4081c9[_0x1837d1(0x1c2)]===0x0&&_0x1c8618['size']===0x0){_0x553461(_0x1837d1(0x1e8));return;}_0x3d6261();return;}}if(_0x3c6b0e===_0x1837d1(0x1f1)){_0x5c8d1b();return;}});async function _0x3d6261(){const _0x326e72=_0x3240ca;_0x141923(_0x326e72(0x1f9));const _0x2aa935=[],_0x18266e=[];for(const _0x3d8f39 of _0x4081c9){const _0x37ed3a=MCP_IDE_LIST[_0x3d8f39];if(!_0x37ed3a)continue;try{const _0x144b6f=await configureMcp(_0x37ed3a,_0x237b96[_0x326e72(0x1e7)]);_0x2aa935[_0x326e72(0x1c4)](_0x144b6f);}catch(_0x3e20c5){_0x2aa935[_0x326e72(0x1c4)]({'ide':MCP_IDE_CONFIGS[_0x37ed3a]?.[_0x326e72(0x1cb)]||_0x37ed3a,'status':'error','message':_0x3e20c5 instanceof Error?_0x3e20c5[_0x326e72(0x1fb)]:String(_0x3e20c5)});}}await copySharedSkills(_0x237b96[_0x326e72(0x1e7)]);for(const _0x260d80 of _0x1c8618){const _0x3f34c5=SKILL_IDE_LIST[_0x260d80];if(!_0x3f34c5)continue;try{const _0x4af55a=await installSkill(_0x3f34c5,_0x237b96[_0x326e72(0x1e7)]);_0x18266e['push'](_0x4af55a);}catch(_0x3f09f2){_0x18266e[_0x326e72(0x1c4)]({'ide':SKILL_IDE_CONFIGS[_0x3f34c5]?.[_0x326e72(0x1cb)]||_0x3f34c5,'status':_0x326e72(0x1d9),'message':_0x3f09f2 instanceof Error?_0x3f09f2['message']:String(_0x3f09f2)});}}if(_0x18266e[_0x326e72(0x1df)]>0x0){const _0x294ab1=_0x18266e[_0x326e72(0x1d2)](_0x30c582=>_0x30c582[_0x326e72(0x1f8)]==='success')[_0x326e72(0x1ee)](_0x508fe8=>_0x508fe8['ide']);_0x294ab1[_0x326e72(0x1df)]>0x0&&createSkillManifest(_0x237b96[_0x326e72(0x1e7)],_0x294ab1);}_0x141923(_0x326e72(0x1f1)),setTimeout(()=>{_0x30aa0c({'mcpResults':_0x2aa935,'skillResults':_0x18266e});},0xbb8);}if(_0x3c6b0e==='confirming')return a3_0x32a96c(Box,{'flexDirection':_0x3240ca(0x1f5),'marginTop':0x1,'children':[a3_0x89b1ca(Box,{'marginTop':0x1,'children':a3_0x89b1ca(Text,{'color':_0x3240ca(0x1d3),'children':_0x3240ca(0x1d7)})}),a3_0x89b1ca(Box,{'marginLeft':0x2,'marginTop':0x1,'children':a3_0x89b1ca(Text,{'color':_0x3240ca(0x1cf),'children':_0x3240ca(0x1f4)})}),a3_0x89b1ca(Box,{'marginLeft':0x2,'children':a3_0x89b1ca(Text,{'color':'gray','children':'•\x20Skill:\x20安装研发最佳实践、Backend\x20Function\x20规范'})}),a3_0x32a96c(Box,{'marginTop':0x1,'flexDirection':_0x3240ca(0x1f5),'children':[a3_0x89b1ca(Box,{'children':a3_0x89b1ca(Text,{'color':_0x3240ca(0x1e0),'children':_0x3240ca(0x1da)})}),a3_0x89b1ca(Box,{'children':a3_0x89b1ca(Text,{'color':'gray','children':'[N]\x20跳过,稍后手动配置'})}),a3_0x89b1ca(Box,{'children':a3_0x89b1ca(Text,{'color':'dimColor','children':'Enter\x20默认:\x20是'})})]}),_0x3f3a64&&a3_0x89b1ca(Box,{'marginTop':0x1,'children':a3_0x32a96c(Text,{'color':_0x3240ca(0x1dc),'children':['✗\x20',_0x3f3a64]})})]});if(_0x3c6b0e===_0x3240ca(0x1c5))return a3_0x32a96c(Box,{'flexDirection':_0x3240ca(0x1f5),'marginTop':0x1,'children':[a3_0x89b1ca(Box,{'children':a3_0x89b1ca(Text,{'color':_0x3240ca(0x1c3),'bold':!![],'children':_0x3240ca(0x1d6)})}),_0x3f3a64&&a3_0x89b1ca(Box,{'marginTop':0x1,'children':a3_0x32a96c(Text,{'color':_0x3240ca(0x1dc),'children':['✗\x20',_0x3f3a64]})}),a3_0x32a96c(Box,{'marginTop':0x1,'flexDirection':_0x3240ca(0x1f5),'children':[a3_0x89b1ca(Text,{'bold':!![],'color':_0x3240ca(0x1ec),'children':'MCP\x20服务器\x20(AI\x20访问数据集)'}),MCP_IDE_LIST[_0x3240ca(0x1ee)]((_0x4e6e0a,_0x103094)=>{const _0x235e39=_0x3240ca,_0x484ff4=_0x3856d2===_0x103094,_0x439bd7=_0x4081c9[_0x235e39(0x1fa)](_0x103094);return a3_0x89b1ca(Box,{'children':a3_0x32a96c(Text,{'backgroundColor':_0x484ff4?_0x235e39(0x1c9):undefined,'color':_0x484ff4?_0x235e39(0x1d3):undefined,'children':[_0x439bd7?_0x235e39(0x1f6):_0x235e39(0x1e1),'\x20',_0x4e6e0a===_0x235e39(0x1c8)?_0x235e39(0x1dd):_0x235e39(0x1cd)]})},_0x235e39(0x1e9)+_0x4e6e0a);}),a3_0x89b1ca(Box,{'marginTop':0x1,'children':a3_0x89b1ca(Text,{'bold':!![],'color':'yellow','children':_0x3240ca(0x1eb)})}),SKILL_IDE_LIST[_0x3240ca(0x1ee)]((_0x4af50f,_0x36525d)=>{const _0x56736f=_0x3240ca,_0x97ea7c=_0x36525d+MCP_IDE_LIST[_0x56736f(0x1df)],_0x5a567d=_0x3856d2===_0x97ea7c,_0x11e6af=_0x1c8618[_0x56736f(0x1fa)](_0x97ea7c);return a3_0x89b1ca(Box,{'children':a3_0x32a96c(Text,{'backgroundColor':_0x5a567d?'blue':undefined,'color':_0x5a567d?_0x56736f(0x1d3):undefined,'children':[_0x11e6af?_0x56736f(0x1f6):'[\x20]','\x20',SKILL_IDE_CONFIGS[_0x4af50f]['name']]})},_0x56736f(0x1e5)+_0x4af50f);}),a3_0x89b1ca(Box,{'marginTop':0x1,'children':a3_0x89b1ca(Text,{'color':_0x3240ca(0x1cf),'children':_0x3240ca(0x1e6)})})]})]});if(_0x3c6b0e==='installing')return a3_0x89b1ca(Box,{'flexDirection':_0x3240ca(0x1f5),'marginTop':0x1,'children':a3_0x89b1ca(Box,{'children':a3_0x89b1ca(Text,{'children':_0x3240ca(0x1d5)})})});if(_0x3c6b0e===_0x3240ca(0x1f1))return null;return null;}const MCP_IDE_CONFIGS={'cursor':{'name':a3_0x149922(0x1dd)},'claude':{'name':a3_0x149922(0x1cd)}};
|
package/lib/ai-setup/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a4_0x4303ac=a4_0xc875;(function(_0x31c63a,_0x5462b1){const _0x312de9=a4_0xc875,_0x17a416=_0x31c63a();while(!![]){try{const _0x566595=-parseInt(_0x312de9(0x1a4))/0x1*(-parseInt(_0x312de9(0x1e7))/0x2)+parseInt(_0x312de9(0x1be))/0x3*(parseInt(_0x312de9(0x1ce))/0x4)+-parseInt(_0x312de9(0x1c3))/0x5+parseInt(_0x312de9(0x1c9))/0x6+parseInt(_0x312de9(0x1aa))/0x7*(parseInt(_0x312de9(0x19f))/0x8)+-parseInt(_0x312de9(0x1ad))/0x9*(parseInt(_0x312de9(0x1d5))/0xa)+-parseInt(_0x312de9(0x1ea))/0xb;if(_0x566595===_0x5462b1)break;else _0x17a416['push'](_0x17a416['shift']());}catch(_0x3603b0){_0x17a416['push'](_0x17a416['shift']());}}}(a4_0x4381,0x6317e));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';function a4_0x4381(){const _0xd7f912=['.lovrabet','info','189oZLvuV','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','.trae','manual','Cursor','.lovrabet/skill/.shared','Qoder\x20IDE','已写入\x20.cursor/mcp.json','parse','配置信息:','\x20个目录','\x0a📋\x20其他\x20IDE\x20MCP\x20配置:\x0a','CodeBuddy','log','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','isDirectory','OpenCode\x20IDE','2422713rIGmSw','message','共享技能文件复制成功','通用模板','\x20技能包安装成功','3043160ahGNpK','.qoder','npx','Cursor\x20MCP\x20配置失败','env','共享技能文件复制失败','193032RkqJFi','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','node:fs','toISOString','其他\x20IDE\x20配置指引已显示','4KWgXce','\x20\x20\x20\x20\x20\x20\x22args\x22:\x20[','Cursor\x20MCP\x20配置成功','\x22:\x20{','复制\x20agents.md\x20文件失败','\x20\x20}','success','19770UybHip','\x20\x20\x20\x20}','agents.md','utf-8','Windsurf\x20IDE','join','\x20\x20\x20\x20\x22','cwd','创建\x20Cursor\x20Rules\x20文件','\x20\x20\x20\x20\x20\x20}','.lovrabet/skill-manifest.json','Windsurf','error','.shared','online','claude\x20mcp\x20add\x20','app','claude','1049366YrMufs','CodeBuddy\x20IDE','Antigravity\x20IDE','9154013cVBRaX','\x20\x20环境:\x20','\x20技能包安装失败','.claude','\x20\x20AppCode:\x20','.cursor','@lovrabet/dataset-mcp-server@latest','Trae','warn','mcp-install','\x20-e\x20LOVRABET_APP_CODE=','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','\x20-e\x20LOVRABET_ENV=','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','需要先配置\x20appcode','复制\x20Cursor\x20Rules\x20文件失败','.agent','../../templates/rules/lovrabet_rules.mdc.tpl','skill-install','Antigravity','.codebuddy','Cursor\x20IDE','appcode','lovrabet-dataset','name','16HbsmwY','LOVRABET_ENV','.codex','../../templates/skills','mcpServers','1cdVPUg','模板不存在:\x20','.windsurf','创建\x20agents.md\x20文件','Claude\x20Code','请手动执行:\x20','1833272bOCuCe'];a4_0x4381=function(){return _0xd7f912;};return a4_0x4381();}import{logger}from'../utils/logger.js';function a4_0xc875(_0x11eab6,_0x15c10){_0x11eab6=_0x11eab6-0x19c;const _0x4381e5=a4_0x4381();let _0xc875cc=_0x4381e5[_0x11eab6];return _0xc875cc;}const __dirname=dirname(fileURLToPath(import.meta.url)),MCP_SERVER_NAME=a4_0x4303ac(0x19d),MCP_COMMAND=a4_0x4303ac(0x1c5),MCP_ARGS=[a4_0x4303ac(0x1f0)];export function buildEnvConfig(_0x269461,_0x4eb997){const _0x3e7b26=a4_0x4303ac,_0x28d778={'LOVRABET_APP_CODE':String(_0x269461)};return _0x4eb997!=='online'&&(_0x28d778[_0x3e7b26(0x1a0)]=String(_0x4eb997)),_0x28d778;}export async function configureCursorMcp(_0x1f9372){const _0x4e1265=a4_0x4303ac,_0x18450c=_0x1f9372||process[_0x4e1265(0x1dc)](),_0x1bd6b8=readConfig(_0x18450c),_0x1f26d2=_0x1bd6b8['appcode']||_0x1bd6b8[_0x4e1265(0x1e5)],_0x53cd31=_0x1bd6b8[_0x4e1265(0x1c7)]||'online';if(!_0x1f26d2)return{'ide':'Cursor','status':_0x4e1265(0x1e1),'message':_0x4e1265(0x1f8)};const _0x375c6f=buildEnvConfig(_0x1f26d2,_0x53cd31),_0x43174f={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x375c6f},_0x3af689=join(_0x18450c,'.cursor','mcp.json'),_0x4b8b4f=join(_0x18450c,_0x4e1265(0x1ef));try{!existsSync(_0x4b8b4f)&&mkdirSync(_0x4b8b4f,{'recursive':!![]});let _0x1b9f59={'mcpServers':{}};if(existsSync(_0x3af689)){const _0x2561dd=readFileSync(_0x3af689,_0x4e1265(0x1d8));_0x1b9f59=JSON[_0x4e1265(0x1b5)](_0x2561dd);}return(!_0x1b9f59[_0x4e1265(0x1a3)]||typeof _0x1b9f59[_0x4e1265(0x1a3)]!=='object')&&(_0x1b9f59[_0x4e1265(0x1a3)]={}),_0x1b9f59[_0x4e1265(0x1a3)][MCP_SERVER_NAME]=_0x43174f,writeFileSync(_0x3af689,JSON['stringify'](_0x1b9f59,null,0x2),_0x4e1265(0x1d8)),logger[_0x4e1265(0x1ac)](_0x4e1265(0x1f3),_0x4e1265(0x1d0),{'appcode':_0x1f26d2,'env':_0x53cd31,'path':_0x3af689}),await copyCursorRules(_0x4b8b4f),{'ide':'Cursor','status':_0x4e1265(0x1d4),'message':_0x4e1265(0x1b4)};}catch(_0x290088){return logger[_0x4e1265(0x1e1)](_0x4e1265(0x1f3),_0x4e1265(0x1c6),{'error':_0x290088 instanceof Error?_0x290088[_0x4e1265(0x1bf)]:String(_0x290088)}),{'ide':_0x4e1265(0x1b1),'status':_0x4e1265(0x1e1),'message':_0x290088 instanceof Error?_0x290088[_0x4e1265(0x1bf)]:String(_0x290088)};}}export async function configureClaudeMcp(_0x1b60ec){const _0xa8f949=a4_0x4303ac,_0x5ec802=_0x1b60ec||process['cwd'](),_0x3394ce=readConfig(_0x5ec802),_0x287154=_0x3394ce[_0xa8f949(0x19c)]||_0x3394ce['app'],_0x385c40=_0x3394ce[_0xa8f949(0x1c7)]||_0xa8f949(0x1e3);if(!_0x287154)return{'ide':_0xa8f949(0x1a8),'status':'error','message':'需要先配置\x20appcode'};let _0x47ec19=_0xa8f949(0x1e4)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0xa8f949(0x1da)]('\x20')+_0xa8f949(0x1f4)+_0x287154;return _0x385c40!==_0xa8f949(0x1e3)&&(_0x47ec19+=_0xa8f949(0x1f6)+_0x385c40),await copyAgentsMd(_0x5ec802),logger['info'](_0xa8f949(0x1f3),'Claude\x20Code\x20MCP\x20命令已生成',{'command':_0x47ec19,'appcode':_0x287154,'env':_0x385c40}),console[_0xa8f949(0x1ba)](_0xa8f949(0x1f5)),console['log']('\x20\x20'+_0x47ec19+'\x0a'),console[_0xa8f949(0x1ba)](_0xa8f949(0x1b6)),console['log'](_0xa8f949(0x1ee)+_0x287154),_0x385c40!==_0xa8f949(0x1e3)&&console[_0xa8f949(0x1ba)](_0xa8f949(0x1eb)+_0x385c40),console['log'](_0xa8f949(0x1ca)),{'ide':_0xa8f949(0x1a8),'status':_0xa8f949(0x1b0),'message':_0xa8f949(0x1a9)+_0x47ec19};}export async function showOtherGuide(_0x5d55cc){const _0x513b2a=a4_0x4303ac,_0x250977=_0x5d55cc||process['cwd'](),_0x22f318=readConfig(_0x250977),_0x23fd32=_0x22f318[_0x513b2a(0x19c)]||_0x22f318[_0x513b2a(0x1e5)],_0x15a353=_0x22f318[_0x513b2a(0x1c7)]||_0x513b2a(0x1e3);if(!_0x23fd32)return{'ide':'其他','status':_0x513b2a(0x1e1),'message':_0x513b2a(0x1f8)};return console[_0x513b2a(0x1ba)](_0x513b2a(0x1b8)),console[_0x513b2a(0x1ba)]('{'),console['log']('\x20\x20\x22mcpServers\x22:\x20{'),console[_0x513b2a(0x1ba)](_0x513b2a(0x1db)+MCP_SERVER_NAME+_0x513b2a(0x1d1)),console[_0x513b2a(0x1ba)]('\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22'+MCP_COMMAND+'\x22,'),console[_0x513b2a(0x1ba)](_0x513b2a(0x1cf)+MCP_ARGS['map'](_0x3d2c25=>'\x22'+_0x3d2c25+'\x22')[_0x513b2a(0x1da)](',\x20')+'],'),console[_0x513b2a(0x1ba)](_0x513b2a(0x1bb)),console[_0x513b2a(0x1ba)](_0x513b2a(0x1f7)+_0x23fd32+'\x22,'),_0x15a353!==_0x513b2a(0x1e3)&&console['log'](_0x513b2a(0x1ae)+_0x15a353+'\x22,'),console['log'](_0x513b2a(0x1de)),console['log'](_0x513b2a(0x1d6)),console['log'](_0x513b2a(0x1d3)),console[_0x513b2a(0x1ba)]('}\x0a'),logger[_0x513b2a(0x1ac)]('mcp-install',_0x513b2a(0x1cd),{'appcode':_0x23fd32,'env':_0x15a353}),{'ide':'其他','status':'manual','message':'配置指引已显示'};}export async function configureMcp(_0x243d60,_0x57ad06){const _0x150bd9=a4_0x4303ac;switch(_0x243d60){case'cursor':return await configureCursorMcp(_0x57ad06);case _0x150bd9(0x1e6):return await configureClaudeMcp(_0x57ad06);default:throw new Error('不支持的\x20MCP\x20IDE:\x20'+_0x243d60);}}async function copyCursorRules(_0x175698){const _0x4d605c=a4_0x4303ac,_0x1f4a47=join(_0x175698,'rules'),_0x195532=join(_0x1f4a47,'lovrabet_rules.mdc');if(existsSync(_0x195532))return;try{!existsSync(_0x1f4a47)&&mkdirSync(_0x1f4a47,{'recursive':!![]});const _0xd32afe=resolve(__dirname,'../../templates/rules/lovrabet_rules.mdc.tpl');existsSync(_0xd32afe)&&(copyFileSync(_0xd32afe,_0x195532),logger[_0x4d605c(0x1ac)](_0x4d605c(0x1f3),_0x4d605c(0x1dd),{'from':_0xd32afe,'to':_0x195532}));}catch(_0x4871fa){logger[_0x4d605c(0x1e1)]('mcp-install',_0x4d605c(0x1f9),{'error':_0x4871fa instanceof Error?_0x4871fa[_0x4d605c(0x1bf)]:String(_0x4871fa)});}}async function copyAgentsMd(_0x64297c){const _0x2a7c3f=a4_0x4303ac,_0x5398a5=join(_0x64297c,_0x2a7c3f(0x1d7));if(existsSync(_0x5398a5))return;try{const _0x14bd39=resolve(__dirname,_0x2a7c3f(0x1fb));if(existsSync(_0x14bd39)){const _0x39ef73=readFileSync(_0x14bd39,_0x2a7c3f(0x1d8));writeFileSync(_0x5398a5,_0x39ef73,_0x2a7c3f(0x1d8)),logger[_0x2a7c3f(0x1ac)](_0x2a7c3f(0x1f3),_0x2a7c3f(0x1a7),{'from':_0x14bd39,'to':_0x5398a5});}}catch(_0x1cbac3){logger[_0x2a7c3f(0x1e1)](_0x2a7c3f(0x1f3),_0x2a7c3f(0x1d2),{'error':_0x1cbac3 instanceof Error?_0x1cbac3[_0x2a7c3f(0x1bf)]:String(_0x1cbac3)});}}export const SKILL_IDE_CONFIGS={'cursor':{'name':a4_0x4303ac(0x1b1),'description':a4_0x4303ac(0x1ff),'folders':['.cursorrules',a4_0x4303ac(0x1ef)]},'windsurf':{'name':a4_0x4303ac(0x1e0),'description':a4_0x4303ac(0x1d9),'folders':[a4_0x4303ac(0x1a6)]},'claude':{'name':'Claude\x20Code','description':a4_0x4303ac(0x1a8),'folders':[a4_0x4303ac(0x1ed)]},'codex':{'name':'Codex','description':'Codex\x20IDE','folders':[a4_0x4303ac(0x1a1)]},'opencode':{'name':'OpenCode','description':a4_0x4303ac(0x1bd),'folders':['.opencode']},'qoder':{'name':'Qoder','description':a4_0x4303ac(0x1b3),'folders':[a4_0x4303ac(0x1c4)]},'codebuddy':{'name':a4_0x4303ac(0x1b9),'description':a4_0x4303ac(0x1e8),'folders':[a4_0x4303ac(0x1fe)]},'trae':{'name':a4_0x4303ac(0x1f1),'description':'Trae\x20IDE','folders':[a4_0x4303ac(0x1af)]},'antigravity':{'name':a4_0x4303ac(0x1fd),'description':a4_0x4303ac(0x1e9),'folders':[a4_0x4303ac(0x1fa)]},'agent':{'name':a4_0x4303ac(0x1c1),'description':'其他\x20IDE','folders':[a4_0x4303ac(0x1fa)]}};async function copyDir(_0x30502a,_0x46c22f){const _0x278d12=a4_0x4303ac,{statSync:_0x96f28f}=await import(_0x278d12(0x1cb)),{readdirSync:_0x369762}=await import(_0x278d12(0x1cb)),_0x5546cd=_0x96f28f(_0x30502a);if(_0x5546cd[_0x278d12(0x1bc)]()){!existsSync(_0x46c22f)&&mkdirSync(_0x46c22f,{'recursive':!![]});const _0x51b1da=_0x369762(_0x30502a);for(const _0x1e7175 of _0x51b1da){await copyDir(join(_0x30502a,_0x1e7175),join(_0x46c22f,_0x1e7175));}}else copyFileSync(_0x30502a,_0x46c22f);}export async function installSkill(_0x257b8c,_0x471b34){const _0x7043aa=a4_0x4303ac,_0x5ca94c=_0x471b34||process[_0x7043aa(0x1dc)](),_0x26e792=resolve(__dirname,_0x7043aa(0x1a2)),_0x44b659=_0x257b8c==='agent',_0x55b9d6=SKILL_IDE_CONFIGS[_0x257b8c],_0xc8073=_0x44b659?_0x7043aa(0x1c1):_0x55b9d6[_0x7043aa(0x19e)];try{let _0x2384c5=0x0;const _0x16a0bf=_0x44b659?['.agent']:_0x55b9d6['folders'];for(const _0x5cfbab of _0x16a0bf){const _0xb1ed06=join(_0x26e792,_0x5cfbab),_0x6fbbf6=join(_0x5ca94c,_0x5cfbab);if(!existsSync(_0xb1ed06)){logger[_0x7043aa(0x1f2)](_0x7043aa(0x1fc),_0x7043aa(0x1a5)+_0xb1ed06);continue;}await copyDir(_0xb1ed06,_0x6fbbf6),_0x2384c5++;}return logger[_0x7043aa(0x1ac)](_0x7043aa(0x1fc),_0xc8073+_0x7043aa(0x1c2),{'ide':_0x257b8c,'foldersCount':_0x2384c5}),{'ide':_0xc8073,'status':_0x7043aa(0x1d4),'message':'已复制\x20'+_0x2384c5+_0x7043aa(0x1b7)};}catch(_0x5667d1){return logger['error'](_0x7043aa(0x1fc),_0xc8073+_0x7043aa(0x1ec),{'error':_0x5667d1 instanceof Error?_0x5667d1[_0x7043aa(0x1bf)]:String(_0x5667d1)}),{'ide':_0xc8073,'status':_0x7043aa(0x1e1),'message':_0x5667d1 instanceof Error?_0x5667d1[_0x7043aa(0x1bf)]:String(_0x5667d1)};}}export async function copySharedSkills(_0x499232){const _0x11d754=a4_0x4303ac,_0x383ecc=_0x499232||process[_0x11d754(0x1dc)](),_0x5d2c9c=resolve(__dirname,'../../templates/skills'),_0x2aa56e=join(_0x5d2c9c,_0x11d754(0x1e2)),_0x59b3=join(_0x383ecc,_0x11d754(0x1b2));if(!existsSync(_0x2aa56e))return![];try{return await copyDir(_0x2aa56e,_0x59b3),logger[_0x11d754(0x1ac)](_0x11d754(0x1fc),_0x11d754(0x1c0),{'path':_0x59b3}),!![];}catch(_0x5cf568){return logger[_0x11d754(0x1e1)](_0x11d754(0x1fc),_0x11d754(0x1c8),{'error':_0x5cf568 instanceof Error?_0x5cf568[_0x11d754(0x1bf)]:String(_0x5cf568)}),![];}}export function createSkillManifest(_0x3a0d88,_0x490392){const _0x33153c=a4_0x4303ac,_0x42badc={'version':'2.0.0','installedAt':new Date()[_0x33153c(0x1cc)](),'platforms':_0x490392},_0x20e62a=join(_0x3a0d88,_0x33153c(0x1df)),_0x4b18c8=join(_0x3a0d88,_0x33153c(0x1ab));!existsSync(_0x4b18c8)&&mkdirSync(_0x4b18c8,{'recursive':!![]}),writeFileSync(_0x20e62a,JSON['stringify'](_0x42badc,null,0x2),_0x33153c(0x1d8)),logger[_0x33153c(0x1ac)](_0x33153c(0x1fc),'创建技能包\x20manifest',{'path':_0x20e62a});}
|
|
1
|
+
const a4_0x24b823=a4_0x1a83;(function(_0x264f5d,_0x1781ac){const _0x306648=a4_0x1a83,_0x4b226e=_0x264f5d();while(!![]){try{const _0x36f6d7=-parseInt(_0x306648(0x16b))/0x1+-parseInt(_0x306648(0x162))/0x2*(parseInt(_0x306648(0x13d))/0x3)+-parseInt(_0x306648(0x16a))/0x4+-parseInt(_0x306648(0x180))/0x5*(parseInt(_0x306648(0x165))/0x6)+-parseInt(_0x306648(0x17b))/0x7*(-parseInt(_0x306648(0x150))/0x8)+parseInt(_0x306648(0x151))/0x9*(-parseInt(_0x306648(0x166))/0xa)+parseInt(_0x306648(0x143))/0xb;if(_0x36f6d7===_0x1781ac)break;else _0x4b226e['push'](_0x4b226e['shift']());}catch(_0x276aa8){_0x4b226e['push'](_0x4b226e['shift']());}}}(a4_0x1125,0xee2e7));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_0x24b823(0x15f),MCP_COMMAND=a4_0x24b823(0x169),MCP_ARGS=['@lovrabet/dataset-mcp-server@latest'];export function buildEnvConfig(_0xf22a43,_0x236a60){const _0x69c403={'LOVRABET_APP_CODE':String(_0xf22a43)};return _0x236a60!=='online'&&(_0x69c403['LOVRABET_ENV']=String(_0x236a60)),_0x69c403;}function a4_0x1125(){const _0x745aaf=['stringify','error','.lovrabet/skill/.shared','rules','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_APP_CODE\x22:\x20\x22','\x0a📋\x20其他\x20IDE\x20MCP\x20配置:\x0a','.lovrabet/skill-manifest.json','\x20\x20重启\x20Claude\x20Code\x20后生效\x0a','parse','mcpServers','claude\x20mcp\x20add\x20','21tJPMqF','\x20\x20\x20\x20\x20\x20\x20\x20\x22LOVRABET_ENV\x22:\x20\x22','\x0a📋\x20请执行以下命令配置\x20Claude\x20Code\x20MCP:\x0a','skill-install','\x20\x20\x22mcpServers\x22:\x20{','6774795ssNpPt','\x20\x20\x20\x20\x20\x20\x22env\x22:\x20{','env','复制\x20Cursor\x20Rules\x20文件失败','创建技能包\x20manifest','message','object','\x20技能包安装失败','配置信息:','不支持的\x20MCP\x20IDE:\x20','isDirectory','69oOvivR','Cursor\x20MCP\x20配置成功','cursor','\x20\x20}','manual','../../templates/rules/lovrabet_rules.mdc.tpl','82177381SDXWMS','\x20-e\x20LOVRABET_ENV=','lovrabet_rules.mdc','未知的\x20IDE:\x20','\x20\x20\x20\x20\x22','.lovrabet','mcp.json','app','mcp-install','claude','utf-8','共享技能文件复制失败','\x20-e\x20LOVRABET_APP_CODE=','2419240WgAKwg','73386gpQdHZ','.cursor','Claude\x20Code','\x20\x20\x20\x20}','Cursor','\x20\x20\x20\x20\x20\x20\x22command\x22:\x20\x22','info','2.0.0','已创建\x20','log','success','创建\x20Cursor\x20Rules\x20文件','../../templates/skills','appcode','lovrabet-dataset','cwd','需要先配置\x20appcode','129966LZzhKI','已写入\x20.cursor/mcp.json','online','6vlvcSw','1920EsYsox','map','join','npx','5916932UDsuwk','1507926YqQhDZ','\x20\x20AppCode:\x20','复制\x20agents.md\x20文件失败','\x22:\x20{','node:fs'];a4_0x1125=function(){return _0x745aaf;};return a4_0x1125();}export async function configureCursorMcp(_0x204d34){const _0x4dc991=a4_0x24b823,_0x2afce2=_0x204d34||process[_0x4dc991(0x160)](),_0x8508a1=readConfig(_0x2afce2),_0x4b4272=_0x8508a1[_0x4dc991(0x15e)]||_0x8508a1['app'],_0x4d8259=_0x8508a1['env']||'online';if(!_0x4b4272)return{'ide':_0x4dc991(0x155),'status':'error','message':_0x4dc991(0x161)};const _0x3da183=buildEnvConfig(_0x4b4272,_0x4d8259),_0x5b3c82={'command':MCP_COMMAND,'args':MCP_ARGS,'env':_0x3da183},_0x1a9ac2=join(_0x2afce2,_0x4dc991(0x152),_0x4dc991(0x149)),_0xdaf7f2=join(_0x2afce2,_0x4dc991(0x152));try{!existsSync(_0xdaf7f2)&&mkdirSync(_0xdaf7f2,{'recursive':!![]});let _0x5deb50={'mcpServers':{}};if(existsSync(_0x1a9ac2)){const _0x78b8e4=readFileSync(_0x1a9ac2,'utf-8');_0x5deb50=JSON[_0x4dc991(0x178)](_0x78b8e4);}return(!_0x5deb50[_0x4dc991(0x179)]||typeof _0x5deb50[_0x4dc991(0x179)]!==_0x4dc991(0x138))&&(_0x5deb50[_0x4dc991(0x179)]={}),_0x5deb50[_0x4dc991(0x179)][MCP_SERVER_NAME]=_0x5b3c82,writeFileSync(_0x1a9ac2,JSON[_0x4dc991(0x170)](_0x5deb50,null,0x2),'utf-8'),logger['info']('mcp-install',_0x4dc991(0x13e),{'appcode':_0x4b4272,'env':_0x4d8259,'path':_0x1a9ac2}),await copyCursorRules(_0xdaf7f2),{'ide':_0x4dc991(0x155),'status':'success','message':_0x4dc991(0x163)};}catch(_0x1fa85c){return logger['error'](_0x4dc991(0x14b),'Cursor\x20MCP\x20配置失败',{'error':_0x1fa85c instanceof Error?_0x1fa85c[_0x4dc991(0x137)]:String(_0x1fa85c)}),{'ide':_0x4dc991(0x155),'status':_0x4dc991(0x171),'message':_0x1fa85c instanceof Error?_0x1fa85c[_0x4dc991(0x137)]:String(_0x1fa85c)};}}export async function configureClaudeMcp(_0x5de674){const _0x25ebe7=a4_0x24b823,_0x4f0bcd=_0x5de674||process[_0x25ebe7(0x160)](),_0x39c10a=readConfig(_0x4f0bcd),_0x23dc19=_0x39c10a[_0x25ebe7(0x15e)]||_0x39c10a[_0x25ebe7(0x14a)],_0x3217d4=_0x39c10a['env']||_0x25ebe7(0x164);if(!_0x23dc19)return{'ide':_0x25ebe7(0x153),'status':_0x25ebe7(0x171),'message':'需要先配置\x20appcode'};let _0x1d57e5=_0x25ebe7(0x17a)+MCP_SERVER_NAME+'\x20'+MCP_COMMAND+'\x20'+MCP_ARGS[_0x25ebe7(0x168)]('\x20')+_0x25ebe7(0x14f)+_0x23dc19;return _0x3217d4!==_0x25ebe7(0x164)&&(_0x1d57e5+=_0x25ebe7(0x144)+_0x3217d4),await copyAgentsMd(_0x4f0bcd),logger['info'](_0x25ebe7(0x14b),'Claude\x20Code\x20MCP\x20命令已生成',{'command':_0x1d57e5,'appcode':_0x23dc19,'env':_0x3217d4}),console['log'](_0x25ebe7(0x17d)),console[_0x25ebe7(0x15a)]('\x20\x20'+_0x1d57e5+'\x0a'),console[_0x25ebe7(0x15a)](_0x25ebe7(0x13a)),console[_0x25ebe7(0x15a)](_0x25ebe7(0x16c)+_0x23dc19),_0x3217d4!==_0x25ebe7(0x164)&&console['log']('\x20\x20环境:\x20'+_0x3217d4),console[_0x25ebe7(0x15a)](_0x25ebe7(0x177)),{'ide':_0x25ebe7(0x153),'status':_0x25ebe7(0x141),'message':'请手动执行:\x20'+_0x1d57e5};}export async function showOtherGuide(_0xfb72cd){const _0xb8e870=a4_0x24b823,_0x329413=_0xfb72cd||process[_0xb8e870(0x160)](),_0xd6cc60=readConfig(_0x329413),_0x35f1aa=_0xd6cc60['appcode']||_0xd6cc60[_0xb8e870(0x14a)],_0x42ddd9=_0xd6cc60[_0xb8e870(0x182)]||_0xb8e870(0x164);if(!_0x35f1aa)return{'ide':'其他','status':_0xb8e870(0x171),'message':_0xb8e870(0x161)};return console[_0xb8e870(0x15a)](_0xb8e870(0x175)),console[_0xb8e870(0x15a)]('{'),console[_0xb8e870(0x15a)](_0xb8e870(0x17f)),console[_0xb8e870(0x15a)](_0xb8e870(0x147)+MCP_SERVER_NAME+_0xb8e870(0x16e)),console[_0xb8e870(0x15a)](_0xb8e870(0x156)+MCP_COMMAND+'\x22,'),console[_0xb8e870(0x15a)]('\x20\x20\x20\x20\x20\x20\x22args\x22:\x20['+MCP_ARGS[_0xb8e870(0x167)](_0x520416=>'\x22'+_0x520416+'\x22')['join'](',\x20')+'],'),console[_0xb8e870(0x15a)](_0xb8e870(0x181)),console['log'](_0xb8e870(0x174)+_0x35f1aa+'\x22,'),_0x42ddd9!==_0xb8e870(0x164)&&console['log'](_0xb8e870(0x17c)+_0x42ddd9+'\x22,'),console['log']('\x20\x20\x20\x20\x20\x20}'),console[_0xb8e870(0x15a)](_0xb8e870(0x154)),console[_0xb8e870(0x15a)](_0xb8e870(0x140)),console[_0xb8e870(0x15a)]('}\x0a'),logger[_0xb8e870(0x157)](_0xb8e870(0x14b),'其他\x20IDE\x20配置指引已显示',{'appcode':_0x35f1aa,'env':_0x42ddd9}),{'ide':'其他','status':_0xb8e870(0x141),'message':'配置指引已显示'};}export async function configureMcp(_0x1a24a7,_0x52dff0){const _0x31e886=a4_0x24b823;switch(_0x1a24a7){case _0x31e886(0x13f):return await configureCursorMcp(_0x52dff0);case _0x31e886(0x14c):return await configureClaudeMcp(_0x52dff0);default:throw new Error(_0x31e886(0x13b)+_0x1a24a7);}}function a4_0x1a83(_0x28a175,_0x49edae){_0x28a175=_0x28a175-0x135;const _0x112574=a4_0x1125();let _0x1a83de=_0x112574[_0x28a175];return _0x1a83de;}async function copyCursorRules(_0x2b519d){const _0x23a738=a4_0x24b823,_0x587b70=join(_0x2b519d,_0x23a738(0x173)),_0x381005=join(_0x587b70,_0x23a738(0x145));if(existsSync(_0x381005))return;try{!existsSync(_0x587b70)&&mkdirSync(_0x587b70,{'recursive':!![]});const _0x3b04c0=resolve(__dirname,_0x23a738(0x142));existsSync(_0x3b04c0)&&(copyFileSync(_0x3b04c0,_0x381005),logger[_0x23a738(0x157)](_0x23a738(0x14b),_0x23a738(0x15c),{'from':_0x3b04c0,'to':_0x381005}));}catch(_0x324e33){logger['error'](_0x23a738(0x14b),_0x23a738(0x135),{'error':_0x324e33 instanceof Error?_0x324e33['message']:String(_0x324e33)});}}async function copyAgentsMd(_0x59c106){const _0x5a5cc6=a4_0x24b823,_0x20026c=join(_0x59c106,'agents.md');if(existsSync(_0x20026c))return;try{const _0x4945ba=resolve(__dirname,_0x5a5cc6(0x142));if(existsSync(_0x4945ba)){const _0x20aa36=readFileSync(_0x4945ba,_0x5a5cc6(0x14d));writeFileSync(_0x20026c,_0x20aa36,_0x5a5cc6(0x14d)),logger[_0x5a5cc6(0x157)]('mcp-install','创建\x20agents.md\x20文件',{'from':_0x4945ba,'to':_0x20026c});}}catch(_0x59e984){logger[_0x5a5cc6(0x171)](_0x5a5cc6(0x14b),_0x5a5cc6(0x16d),{'error':_0x59e984 instanceof Error?_0x59e984[_0x5a5cc6(0x137)]:String(_0x59e984)});}}export const SKILL_IDE_CONFIGS=IDE_CONFIGS;export async function installSkill(_0x4a055e,_0x5b0f07){const _0x41559d=a4_0x24b823,_0x15ce4d=_0x5b0f07||process[_0x41559d(0x160)](),_0x43d34f=resolve(__dirname,_0x41559d(0x15d)),_0x4532b0=SKILL_IDE_CONFIGS[_0x4a055e];if(!_0x4532b0)return{'ide':_0x4a055e,'status':_0x41559d(0x171),'message':_0x41559d(0x146)+_0x4a055e};const _0x55aa6b=_0x4532b0['name'];try{const _0x22683e=await installSingleIDE(_0x4a055e,_0x4532b0,_0x15ce4d,_0x43d34f);return logger[_0x41559d(0x157)](_0x41559d(0x17e),_0x55aa6b+'\x20技能包安装成功',{'ide':_0x4a055e,'filesCount':_0x22683e}),{'ide':_0x55aa6b,'status':_0x41559d(0x15b),'message':_0x41559d(0x159)+_0x22683e+'\x20项'};}catch(_0x23b1f7){return logger['error'](_0x41559d(0x17e),_0x55aa6b+_0x41559d(0x139),{'error':_0x23b1f7 instanceof Error?_0x23b1f7['message']:String(_0x23b1f7)}),{'ide':_0x55aa6b,'status':'error','message':_0x23b1f7 instanceof Error?_0x23b1f7[_0x41559d(0x137)]:String(_0x23b1f7)};}}async function copyDir(_0x31e97a,_0x4150ab){const _0x28c163=a4_0x24b823,{statSync:_0x141ed0}=await import(_0x28c163(0x16f)),{readdirSync:_0x2cf5be}=await import(_0x28c163(0x16f)),_0x930777=_0x141ed0(_0x31e97a);if(_0x930777[_0x28c163(0x13c)]()){!existsSync(_0x4150ab)&&mkdirSync(_0x4150ab,{'recursive':!![]});const _0x473729=_0x2cf5be(_0x31e97a);for(const _0x56ae2c of _0x473729){await copyDir(join(_0x31e97a,_0x56ae2c),join(_0x4150ab,_0x56ae2c));}}else copyFileSync(_0x31e97a,_0x4150ab);}export async function copySharedSkills(_0x24960d){const _0x4f0c95=a4_0x24b823,_0x88dc07=_0x24960d||process['cwd'](),_0x6f0625=resolve(__dirname,'../../templates/skills'),_0x38c2cc=join(_0x6f0625,'.shared'),_0x2d1b6c=join(_0x88dc07,_0x4f0c95(0x172));if(!existsSync(_0x38c2cc))return![];try{return await copyDir(_0x38c2cc,_0x2d1b6c),logger[_0x4f0c95(0x157)]('skill-install','共享技能文件复制成功',{'path':_0x2d1b6c}),!![];}catch(_0x3f1e6f){return logger['error'](_0x4f0c95(0x17e),_0x4f0c95(0x14e),{'error':_0x3f1e6f instanceof Error?_0x3f1e6f['message']:String(_0x3f1e6f)}),![];}}export function createSkillManifest(_0x304025,_0x428f36){const _0x21c75e=a4_0x24b823,_0x66f24e={'version':_0x21c75e(0x158),'installedAt':new Date()['toISOString'](),'platforms':_0x428f36},_0x57d43c=join(_0x304025,_0x21c75e(0x176)),_0xf6ba7f=join(_0x304025,_0x21c75e(0x148));!existsSync(_0xf6ba7f)&&mkdirSync(_0xf6ba7f,{'recursive':!![]}),writeFileSync(_0x57d43c,JSON[_0x21c75e(0x170)](_0x66f24e,null,0x2),_0x21c75e(0x14d)),logger[_0x21c75e(0x157)](_0x21c75e(0x17e),_0x21c75e(0x136),{'path':_0x57d43c});}
|
package/lib/api/api-doc-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x6dacf4,_0x4d55db){const _0x2ccb80=a5_0x8cc8,_0x2be50c=_0x6dacf4();while(!![]){try{const _0x543237=-parseInt(_0x2ccb80(0x214))/0x1+-parseInt(_0x2ccb80(0x217))/0x2+-parseInt(_0x2ccb80(0x206))/0x3*(parseInt(_0x2ccb80(0x213))/0x4)+parseInt(_0x2ccb80(0x1f6))/0x5*(parseInt(_0x2ccb80(0x20b))/0x6)+-parseInt(_0x2ccb80(0x215))/0x7+-parseInt(_0x2ccb80(0x1f8))/0x8*(parseInt(_0x2ccb80(0x1f2))/0x9)+parseInt(_0x2ccb80(0x1ed))/0xa;if(_0x543237===_0x4d55db)break;else _0x2be50c['push'](_0x2be50c['shift']());}catch(_0x3a0c39){_0x2be50c['push'](_0x2be50c['shift']());}}}(a5_0x33a1,0x3ebf3));import{jsx as a5_0x28871c,jsxs as a5_0x32d645,Fragment as a5_0x12c4c0}from'react/jsx-runtime';function a5_0x8cc8(_0x5d8bfc,_0x4920bc){_0x5d8bfc=_0x5d8bfc-0x1e2;const _0x33a14b=a5_0x33a1();let _0x8cc835=_0x33a14b[_0x5d8bfc];return _0x8cc835;}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{fetchModelList}from'./fetch-model-list.js';function a5_0x33a1(){const _0x13d74d=['\x1b[0m','online','error','filter','env','setLogPath','16902500wpbftk','datasetName','文档生成完成','green','api-doc','4041279ECUhGJ','map','gray','💡\x20请使用\x20','335emIvgl','*\x20生成的文档文件:','8guAEFb','\x20个数据集中筛选出\x20','使用指定的应用AppCode:\x20','未提供应用AppCode,且配置中也没有默认值','column','未找到任何数据集','*\x20共处理\x20',',\x20失败\x20','\x20(环境:\x20','join','使用配置的应用AppCode:\x20','正在生成\x20','log','指定的数据集代码都不存在:\x20','1719irdXIK','.md\x20(','dim','\x20个数据集','\x1b[90m*\x20从\x20','8130RIwxoU','*\x20输出目录:\x20','./docs','yellow','length','cwd','datasetCode','正在获取数据集列表...','2104xsnfaD','272751MoGkHl','290290sWXROt','white','918748KvDaYW','filePath','文档生成失败:\x20','message','success','\x20重新登录后再试','cyan','red','√\x20文档生成完成!成功\x20','\x20个数据集的文档...','includes','\x1b[33m!\x20以下数据集代码不存在:\x20'];a5_0x33a1=function(){return _0x13d74d;};return a5_0x33a1();}import{generateDatasetDocs}from'./api-doc.js';import{logger}from'../utils/logger.js';export const ApiDocUI=({appCode:_0x310415,env:_0x4d7ab5,output:_0x37d46a,extraParams:_0x9600d1,datasetCodes:_0x51a5bd})=>{const _0xd8f92a=a5_0x8cc8,{exit:_0x5060fb}=useApp(),[_0x2fea48,_0x4439b7]=useState(![]),[_0x49e49c,_0xbfa52c]=useState(''),[_0xb50ca0,_0x3cc928]=useState(![]),[_0x24104e,_0x347620]=useState(null),[_0x39c6cc,_0x3e6dc8]=useState(null),[_0x3abe94,_0x327d79]=useState(0x0),_0x517e6d=readConfig(),_0x45627a=getConfigAppCode(),_0x19fa9e=_0x310415||_0x45627a,_0xe8f796=typeof _0x517e6d?.['env']==='string'?_0x517e6d[_0xd8f92a(0x1eb)]:undefined,_0x1a77bf=_0x4d7ab5||_0xe8f796||_0xd8f92a(0x1e8);initEnv(_0x1a77bf);const _0x55c7ee=_0x37d46a||_0xd8f92a(0x20d),_0x3e562a=_0x310415?_0xd8f92a(0x1fa)+_0x19fa9e:_0xd8f92a(0x202)+_0x19fa9e;useEffect(()=>{_0x4439b7(!![]),_0x1d25c0();},[]),useEffect(()=>{(_0xb50ca0||_0x24104e)&&_0x5060fb();},[_0xb50ca0,_0x24104e,_0x5060fb]);async function _0x1d25c0(){const _0x1bcaf3=_0xd8f92a;if(!_0x19fa9e){_0x347620(_0x1bcaf3(0x1fb));return;}try{logger[_0x1bcaf3(0x1ec)](process[_0x1bcaf3(0x210)]()),_0xbfa52c(_0x1bcaf3(0x212));const {configArray:_0x4b072c}=await fetchModelList(_0x19fa9e);_0x327d79(_0x4b072c[_0x1bcaf3(0x20f)]);if(_0x4b072c[_0x1bcaf3(0x20f)]===0x0){_0x347620(_0x1bcaf3(0x1fd));return;}let _0x2dd899=_0x4b072c;if(_0x51a5bd&&_0x51a5bd['length']>0x0){_0x2dd899=_0x4b072c[_0x1bcaf3(0x1ea)](_0x143d99=>_0x51a5bd['includes'](_0x143d99[_0x1bcaf3(0x211)]));const _0x2863a7=_0x2dd899[_0x1bcaf3(0x1f3)](_0x4bd0c0=>_0x4bd0c0['datasetCode']),_0x594fab=_0x51a5bd[_0x1bcaf3(0x1ea)](_0x3ec555=>!_0x2863a7['includes'](_0x3ec555));_0x594fab[_0x1bcaf3(0x20f)]>0x0&&console[_0x1bcaf3(0x204)](_0x1bcaf3(0x1e6)+_0x594fab[_0x1bcaf3(0x201)](',\x20')+_0x1bcaf3(0x1e7));if(_0x2dd899[_0x1bcaf3(0x20f)]===0x0){_0x347620(_0x1bcaf3(0x205)+_0x51a5bd[_0x1bcaf3(0x201)](',\x20'));return;}console['log'](_0x1bcaf3(0x20a)+_0x4b072c[_0x1bcaf3(0x20f)]+_0x1bcaf3(0x1f9)+_0x2dd899[_0x1bcaf3(0x20f)]+'\x20个匹配的数据集\x1b[0m');}_0xbfa52c(_0x1bcaf3(0x203)+_0x2dd899['length']+_0x1bcaf3(0x1e4));const _0x15534e=await generateDatasetDocs(_0x2dd899,_0x19fa9e,_0x55c7ee,(_0x21e6cc,_0x441a45,_0x4c36b9)=>{const _0x5a56a7=_0x1bcaf3;_0xbfa52c('正在生成\x20'+_0x4c36b9+_0x5a56a7(0x207)+_0x21e6cc+'/'+_0x441a45+')');},_0x9600d1);_0x3e6dc8(_0x15534e),_0x3cc928(!![]);const _0x9509f2=_0x15534e[_0x1bcaf3(0x1ea)](_0x481711=>_0x481711[_0x1bcaf3(0x21b)])[_0x1bcaf3(0x20f)],_0x24a5cb=_0x15534e[_0x1bcaf3(0x1ea)](_0x2f353f=>!_0x2f353f[_0x1bcaf3(0x21b)])['length'];logger[_0x1bcaf3(0x21b)](_0x1bcaf3(0x1f1),_0x1bcaf3(0x1ef),undefined,{'totalCount':_0x15534e['length'],'successCount':_0x9509f2,'failCount':_0x24a5cb,'outputDir':_0x55c7ee});}catch(_0x17c77d){const _0x4d3c86=_0x17c77d instanceof Error?_0x17c77d[_0x1bcaf3(0x21a)]:String(_0x17c77d);logger[_0x1bcaf3(0x1e9)](_0x1bcaf3(0x1f1),_0x1bcaf3(0x219)+_0x4d3c86,{'appCode':_0x19fa9e,'outputDir':_0x55c7ee}),_0x347620(_0x1bcaf3(0x219)+_0x4d3c86);}finally{_0x4439b7(![]);}}const _0x9bbc11=_0x39c6cc?.[_0xd8f92a(0x1ea)](_0x39b908=>_0x39b908[_0xd8f92a(0x21b)])[_0xd8f92a(0x20f)]||0x0,_0x5ad30a=_0x39c6cc?.[_0xd8f92a(0x1ea)](_0x18761f=>!_0x18761f[_0xd8f92a(0x21b)])[_0xd8f92a(0x20f)]||0x0;return a5_0x32d645(Box,{'flexDirection':'column','children':[(_0x2fea48||_0xb50ca0)&&a5_0x32d645(Box,{'children':[a5_0x28871c(Text,{'color':_0xd8f92a(0x1f4),'children':'*\x20'}),a5_0x28871c(Text,{'color':_0x310415?_0xd8f92a(0x216):'dim','children':_0x3e562a})]}),_0x2fea48&&a5_0x28871c(Box,{'children':a5_0x32d645(Text,{'children':['🚀\x20',_0x49e49c,_0xd8f92a(0x200),_0x1a77bf,')']})}),_0xb50ca0&&_0x39c6cc&&a5_0x32d645(Box,{'flexDirection':_0xd8f92a(0x1fc),'children':[a5_0x28871c(Box,{'children':a5_0x32d645(Text,{'color':_0xd8f92a(0x1f0),'children':[_0xd8f92a(0x1e3),_0x9bbc11,'\x20个',_0x5ad30a>0x0&&_0xd8f92a(0x1ff)+_0x5ad30a+'\x20个']})}),a5_0x28871c(Box,{'marginTop':0x1,'children':a5_0x32d645(Text,{'color':_0xd8f92a(0x1f4),'children':[_0xd8f92a(0x1fe),_0x3abe94,_0xd8f92a(0x209)]})}),a5_0x32d645(Box,{'marginTop':0x1,'children':[a5_0x28871c(Text,{'color':_0xd8f92a(0x1f4),'children':_0xd8f92a(0x20c)}),a5_0x28871c(Text,{'color':_0xd8f92a(0x21d),'children':_0x55c7ee})]}),_0x9bbc11>0x0&&a5_0x32d645(a5_0x12c4c0,{'children':[a5_0x28871c(Box,{'marginTop':0x1,'children':a5_0x28871c(Text,{'color':_0xd8f92a(0x1f4),'children':_0xd8f92a(0x1f7)})}),_0x39c6cc[_0xd8f92a(0x1ea)](_0x497f4f=>_0x497f4f['success'])[_0xd8f92a(0x1f3)]((_0x1abb95,_0x2e7f0f)=>a5_0x32d645(Box,{'marginLeft':0x2,'children':[a5_0x32d645(Text,{'color':'cyan','children':['•\x20',_0x1abb95[_0xd8f92a(0x218)]]}),a5_0x32d645(Text,{'color':_0xd8f92a(0x208),'children':['\x20-\x20',_0x1abb95['datasetName']]})]},_0x2e7f0f))]}),_0x5ad30a>0x0&&a5_0x32d645(a5_0x12c4c0,{'children':[a5_0x28871c(Box,{'marginTop':0x1,'children':a5_0x28871c(Text,{'color':'yellow','children':'⚠️\x20以下数据集生成失败:'})}),_0x39c6cc[_0xd8f92a(0x1ea)](_0xc6a8df=>!_0xc6a8df['success'])[_0xd8f92a(0x1f3)]((_0xe5c9e5,_0x485208)=>a5_0x32d645(Box,{'marginLeft':0x2,'flexDirection':_0xd8f92a(0x1fc),'children':[a5_0x32d645(Text,{'color':_0xd8f92a(0x1e2),'children':['•\x20',_0xe5c9e5[_0xd8f92a(0x1ee)],'\x20(',_0xe5c9e5['datasetCode'],')']}),_0xe5c9e5['error']&&a5_0x28871c(Box,{'marginLeft':0x2,'children':a5_0x28871c(Text,{'color':_0xd8f92a(0x208),'children':_0xe5c9e5[_0xd8f92a(0x1e9)]})})]},_0x485208))]})]}),_0x24104e&&a5_0x32d645(Box,{'flexDirection':_0xd8f92a(0x1fc),'children':[a5_0x28871c(Box,{'children':a5_0x32d645(Text,{'color':_0xd8f92a(0x1e2),'children':['❌\x20',_0x24104e]})}),_0x24104e[_0xd8f92a(0x1e5)]('登录')&&a5_0x32d645(Box,{'marginTop':0x1,'children':[a5_0x28871c(Text,{'color':_0xd8f92a(0x20e),'children':_0xd8f92a(0x1f5)}),a5_0x28871c(Text,{'color':_0xd8f92a(0x21d),'children':'lovrabet\x20auth'}),a5_0x28871c(Text,{'color':_0xd8f92a(0x20e),'children':_0xd8f92a(0x21c)})]})]})]});};
|
package/lib/api/api-doc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a6_0x3cb070=a6_0x5d13;(function(_0x248146,_0x56a539){const _0xc8f0d1=a6_0x5d13,_0x464c95=_0x248146();while(!![]){try{const _0x53c4f1=parseInt(_0xc8f0d1(0x161))/0x1*(parseInt(_0xc8f0d1(0x15e))/0x2)+parseInt(_0xc8f0d1(0x13a))/0x3+-parseInt(_0xc8f0d1(0x148))/0x4+-parseInt(_0xc8f0d1(0x13e))/0x5*(-parseInt(_0xc8f0d1(0x156))/0x6)+parseInt(_0xc8f0d1(0x14c))/0x7+parseInt(_0xc8f0d1(0x146))/0x8*(parseInt(_0xc8f0d1(0x14b))/0x9)+-parseInt(_0xc8f0d1(0x15d))/0xa;if(_0x53c4f1===_0x56a539)break;else _0x464c95['push'](_0x464c95['shift']());}catch(_0x453d90){_0x464c95['push'](_0x464c95['shift']());}}}(a6_0xb922,0xdfcb9));function a6_0xb922(){const _0x5d014b=['4304823DLBiTk','markdown','success','生成文档成功:\x20','20ziteyg','push',']\x20正在生成:\x20','./docs','.md','.md\x20-\x20','stringify','text','1296jyslty','error','381408SFoHHE','datasetCode','log','50067IwAtRs','12586035VOHfkR','message','json','tableName','),HTTP状态码:\x20','join','等待\x203\x20秒...\x0a','/api/node-toolbox/api-doc-generator','✓\x20成功生成:\x20','name','860736VdUnXU','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','生成文档失败:\x20','length','✗\x20失败:\x20','data','status','42836720RCnqac','14OVlFWW','string','):缺少\x20data.markdown\x20字段','83959IirVqU','api-doc','utf8','获取文档失败\x20(','POST'];a6_0xb922=function(){return _0x5d014b;};return a6_0xb922();}import{mkdirSync,writeFileSync}from'node:fs';import a6_0x21d42f from'node:path';import{getCookie}from'../auth/get-cookie.js';import{getApiDomain}from'../constant/domain.js';import{logger}from'../utils/logger.js';export async function fetchDatasetDoc(_0x5b034a){const _0x5b4eee=a6_0x5d13,{appCode:_0xf2197c,datasetCode:_0x32b691,datasetId:_0x4476ee,extraParams:_0x1dc4a9}=_0x5b034a,_0x947c20=getApiDomain(),_0x2a5664=_0x947c20+_0x5b4eee(0x153),_0x6bcf65={'appCode':_0xf2197c,'datasetCode':_0x32b691,'datasetId':_0x4476ee,..._0x1dc4a9||{}},_0x72bcf2=await fetch(_0x2a5664,{'method':_0x5b4eee(0x139),'headers':{'Content-Type':'application/json','Cookie':getCookie()},'body':JSON[_0x5b4eee(0x144)](_0x6bcf65)});if(!_0x72bcf2['ok']){if(_0x72bcf2[_0x5b4eee(0x15c)]===0x191)throw new Error(_0x5b4eee(0x157));let _0x588351='';try{_0x588351=await _0x72bcf2[_0x5b4eee(0x145)]();}catch(_0x4627c6){}throw new Error(_0x5b4eee(0x164)+_0x32b691+_0x5b4eee(0x150)+_0x72bcf2[_0x5b4eee(0x15c)]+(_0x588351?'\x0a'+_0x588351:''));}const _0x4b14c2=await _0x72bcf2[_0x5b4eee(0x14e)]();if(!_0x4b14c2[_0x5b4eee(0x15b)]||typeof _0x4b14c2[_0x5b4eee(0x15b)]['markdown']!==_0x5b4eee(0x15f))throw new Error('响应数据格式错误\x20('+_0x32b691+_0x5b4eee(0x160));return _0x4b14c2['data'][_0x5b4eee(0x13b)];}function delay(_0x2a3ec9){return new Promise(_0x1ac2a7=>setTimeout(_0x1ac2a7,_0x2a3ec9));}function a6_0x5d13(_0x4a2fb8,_0x530422){_0x4a2fb8=_0x4a2fb8-0x139;const _0xb922b7=a6_0xb922();let _0x5d13dc=_0xb922b7[_0x4a2fb8];return _0x5d13dc;}export async function generateDatasetDocs(_0x406428,_0x4096ee,_0x1cb19e=a6_0x3cb070(0x141),_0x118400,_0x49f22e){const _0x2a8ae2=a6_0x3cb070;mkdirSync(_0x1cb19e,{'recursive':!![]});const _0xc43b52=[],_0x3471df=_0x406428['length'];console[_0x2a8ae2(0x14a)]('\x0a共有\x20'+_0x3471df+'\x20个数据集需要生成文档\x0a');for(let _0x345120=0x0;_0x345120<_0x406428[_0x2a8ae2(0x159)];_0x345120++){const _0x2e8450=_0x406428[_0x345120],_0x170066=_0x345120+0x1,_0x57112c=_0x2e8450[_0x2a8ae2(0x14f)];try{console[_0x2a8ae2(0x14a)]('['+_0x170066+'/'+_0x3471df+_0x2a8ae2(0x140)+_0x57112c+'.md\x20('+_0x2e8450[_0x2a8ae2(0x155)]+')');_0x118400&&_0x118400(_0x170066,_0x3471df,_0x57112c);const _0x1f593f=await fetchDatasetDoc({'appCode':_0x4096ee,'datasetCode':_0x2e8450[_0x2a8ae2(0x149)],'datasetId':_0x2e8450['id'],'enableAI':![],'extraParams':_0x49f22e}),_0x5b2a93=a6_0x21d42f[_0x2a8ae2(0x151)](_0x1cb19e,_0x57112c+_0x2a8ae2(0x142));writeFileSync(_0x5b2a93,_0x1f593f,{'encoding':_0x2a8ae2(0x163)}),console[_0x2a8ae2(0x14a)](_0x2a8ae2(0x154)+_0x57112c+'.md'),logger[_0x2a8ae2(0x13c)](_0x2a8ae2(0x162),_0x2a8ae2(0x13d)+_0x57112c,undefined,{'datasetCode':_0x2e8450[_0x2a8ae2(0x149)],'datasetName':_0x2e8450[_0x2a8ae2(0x155)],'filePath':_0x5b2a93,'progress':_0x170066+'/'+_0x3471df}),_0xc43b52['push']({'datasetCode':_0x2e8450[_0x2a8ae2(0x149)],'datasetName':_0x2e8450[_0x2a8ae2(0x155)],'filePath':_0x5b2a93,'success':!![]}),_0x170066<_0x3471df&&await delay(0x1388);}catch(_0x3f203b){const _0x4e45d2=_0x3f203b instanceof Error?_0x3f203b[_0x2a8ae2(0x14d)]:String(_0x3f203b);console[_0x2a8ae2(0x14a)](_0x2a8ae2(0x15a)+_0x57112c+_0x2a8ae2(0x143)+_0x4e45d2+'\x0a'),logger[_0x2a8ae2(0x147)](_0x2a8ae2(0x162),_0x2a8ae2(0x158)+_0x2e8450['datasetCode'],{'datasetCode':_0x2e8450[_0x2a8ae2(0x149)],'datasetName':_0x2e8450['name'],'error':_0x4e45d2,'progress':_0x170066+'/'+_0x3471df}),_0xc43b52[_0x2a8ae2(0x13f)]({'datasetCode':_0x2e8450['datasetCode'],'datasetName':_0x2e8450[_0x2a8ae2(0x155)],'filePath':'','success':![],'error':_0x4e45d2}),_0x170066<_0x3471df&&(console[_0x2a8ae2(0x14a)](_0x2a8ae2(0x152)),await delay(0xbb8));}}return _0xc43b52;}
|
package/lib/api/api-pull-ui.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x292f99,_0x58d351){const _0x48c168=a7_0x10ac,_0x505c2d=_0x292f99();while(!![]){try{const _0x5687f3=parseInt(_0x48c168(0xc2))/0x1*(parseInt(_0x48c168(0xed))/0x2)+parseInt(_0x48c168(0xc4))/0x3*(parseInt(_0x48c168(0xf1))/0x4)+-parseInt(_0x48c168(0xe0))/0x5+parseInt(_0x48c168(0xd9))/0x6*(parseInt(_0x48c168(0xd6))/0x7)+parseInt(_0x48c168(0xd5))/0x8*(parseInt(_0x48c168(0xd8))/0x9)+parseInt(_0x48c168(0xcc))/0xa+parseInt(_0x48c168(0xc3))/0xb*(-parseInt(_0x48c168(0xc9))/0xc);if(_0x5687f3===_0x58d351)break;else _0x505c2d['push'](_0x505c2d['shift']());}catch(_0x437c45){_0x505c2d['push'](_0x505c2d['shift']());}}}(a7_0x26f1,0x5ed4e));import{jsx as a7_0x477d06,jsxs as a7_0x3a9db2}from'react/jsx-runtime';import{useEffect,useState}from'react';import{Box,Text,useApp}from'ink';import{readConfig,getConfigAppCode}from'../utils/config.js';import{initEnv}from'../constant/env.js';import{generateApiFile}from'./generate-api-file.js';import{logger}from'../utils/logger.js';function a7_0x10ac(_0x848882,_0x2c88f9){_0x848882=_0x848882-0xbf;const _0x26f15c=a7_0x26f1();let _0x10ac78=_0x26f15c[_0x848882];return _0x10ac78;}import{fetchModelList}from'./fetch-model-list.js';function a7_0x26f1(){const _0xdfcdd4=['join','setLogPath','dim','拉取\x20API\x20配置失败:\x20','11300880gpTosK','duplicateCount','!\x20原始数据集\x20','449420vEftVn','-client','使用配置的应用AppCode:\x20','*\x20已生成文件:','modelCount','white','cwd','cyan','env','46160XvXdAu','249319gdcMfn','error','999TRaPjM','78OXiJDa','.ts','gray','string','column','*\x20导入方式:','\x20from\x20\x27@/','1735265qgthPO','yellow','{\x20lovrabetClient\x20}','client','未提供应用AppCode,且配置中也没有默认值','length','./src/api/','green','slice','originalCount','\x20个模型)','datasetCount','\x20个数据集,生成','1094DIpYrH','💡\x20请使用\x20','import\x20','api','348qeoPLV','replace','includes','\x20个模型','🚀\x20正在从服务器拉取\x20API\x20配置...\x20(环境:\x20','\x20-\x20客户端实例文件','\x20重新登录后再试','289YXSFGp','11fBnMfJ','12783VluqAQ'];a7_0x26f1=function(){return _0xdfcdd4;};return a7_0x26f1();}export const ApiPullUI=({appCode:_0x5c42f1,env:_0xd7b602,output:_0x211295})=>{const _0xf8cd16=a7_0x10ac,{exit:_0x55fd97}=useApp(),[_0x213ec1,_0x5ba92f]=useState(![]),[_0x26f435,_0x29d30f]=useState(![]),[_0x2aea71,_0x1233de]=useState(null),[_0x358a16,_0x345f7c]=useState(null),_0x119c33=readConfig(),_0x17f057=getConfigAppCode(),_0x1f2d64=_0x5c42f1||_0x17f057,_0x1bedd9=typeof _0x119c33?.['env']===_0xf8cd16(0xdc)?_0x119c33[_0xf8cd16(0xd4)]:undefined,_0x2d7cf3=_0xd7b602||_0x1bedd9||'online';initEnv(_0x2d7cf3);const _0x29472c=_0x211295||_0xf8cd16(0xe6),_0x85c6f5=_0x5c42f1&&_0x5c42f1[_0xf8cd16(0xf3)]('-')?_0x5c42f1['split']('-')[_0xf8cd16(0xe8)](0x1)[_0xf8cd16(0xc5)]('-'):'',_0x4ccb01=_0x5c42f1?'使用指定的应用AppCode:\x20'+_0x1f2d64:_0xf8cd16(0xce)+_0x1f2d64,_0x128e1b=_0x85c6f5?_0x85c6f5+'-api':_0xf8cd16(0xf0),_0x104803=_0x85c6f5?_0x85c6f5+_0xf8cd16(0xcd):_0xf8cd16(0xe3);useEffect(()=>{_0x5ba92f(!![]),_0x11b45f();},[]),useEffect(()=>{(_0x26f435||_0x2aea71)&&_0x55fd97();},[_0x26f435,_0x2aea71,_0x55fd97]);async function _0x11b45f(){const _0x17ab45=_0xf8cd16;if(!_0x1f2d64){_0x1233de(_0x17ab45(0xe4));return;}try{logger[_0x17ab45(0xc6)](process[_0x17ab45(0xd2)]());const {configArray:_0x3dc900}=await fetchModelList(_0x1f2d64),_0x5e4809=_0x3dc900[_0x17ab45(0xe5)],_0x10a70c=!_0x5c42f1,_0x271df1=await generateApiFile(_0x3dc900,_0x85c6f5,_0x1f2d64,_0x10a70c,_0x2d7cf3,_0x29472c),_0x2dc130=_0x29472c['endsWith']('/')?_0x29472c:_0x29472c+'/';_0x345f7c({'api':''+_0x2dc130+_0x128e1b+'.ts','client':''+_0x2dc130+_0x104803+_0x17ab45(0xda),'modelCount':_0x271df1[_0x17ab45(0xd0)],'datasetCount':_0x5e4809,'originalCount':_0x5e4809,'duplicateCount':0x0}),_0x29d30f(!![]);}catch(_0x817285){const _0x24f665=_0x817285 instanceof Error?_0x817285['message']:String(_0x817285);logger[_0x17ab45(0xd7)]('api-pull',_0x17ab45(0xc8)+_0x24f665,{'appCode':_0x1f2d64,'error':_0x24f665}),_0x1233de(_0x17ab45(0xc8)+_0x24f665);}finally{_0x5ba92f(![]);}}return a7_0x3a9db2(Box,{'flexDirection':'column','children':[(_0x213ec1||_0x26f435)&&a7_0x3a9db2(Box,{'children':[a7_0x477d06(Text,{'color':'gray','children':'*\x20'}),a7_0x477d06(Text,{'color':_0x5c42f1?_0xf8cd16(0xd1):'dim','children':_0x4ccb01})]}),_0x213ec1&&a7_0x477d06(Box,{'children':a7_0x3a9db2(Text,{'children':[_0xf8cd16(0xbf),_0x2d7cf3,')']})}),_0x26f435&&_0x358a16&&a7_0x3a9db2(Box,{'flexDirection':_0xf8cd16(0xdd),'children':[a7_0x477d06(Box,{'children':a7_0x3a9db2(Text,{'color':_0xf8cd16(0xe7),'children':['√\x20成功拉取\x20',_0x358a16[_0xf8cd16(0xeb)],_0xf8cd16(0xec),'\x20',_0x358a16[_0xf8cd16(0xd0)],_0xf8cd16(0xf4)]})}),_0x358a16[_0xf8cd16(0xca)]>0x0&&a7_0x477d06(Box,{'marginTop':0x1,'children':a7_0x3a9db2(Text,{'color':_0xf8cd16(0xe1),'children':[_0xf8cd16(0xcb),_0x358a16[_0xf8cd16(0xe9)],'\x20个,过滤重复','\x20',_0x358a16[_0xf8cd16(0xca)],'\x20个']})}),a7_0x477d06(Box,{'marginTop':0x1,'children':a7_0x477d06(Text,{'color':'gray','children':_0xf8cd16(0xcf)})}),a7_0x3a9db2(Box,{'marginLeft':0x2,'children':[a7_0x3a9db2(Text,{'color':'cyan','children':['•\x20',_0x358a16[_0xf8cd16(0xf0)]]}),a7_0x3a9db2(Text,{'color':'dim','children':['\x20','-\x20模型配置文件\x20(',_0x358a16[_0xf8cd16(0xd0)],_0xf8cd16(0xea)]})]}),a7_0x3a9db2(Box,{'marginLeft':0x2,'children':[a7_0x3a9db2(Text,{'color':_0xf8cd16(0xd3),'children':['•\x20',_0x358a16['client']]}),a7_0x477d06(Text,{'color':_0xf8cd16(0xc7),'children':_0xf8cd16(0xc0)})]}),a7_0x477d06(Box,{'marginTop':0x1,'children':a7_0x477d06(Text,{'color':_0xf8cd16(0xdb),'children':_0xf8cd16(0xde)})}),a7_0x477d06(Box,{'marginLeft':0x2,'children':a7_0x3a9db2(Text,{'color':_0xf8cd16(0xe1),'children':[_0xf8cd16(0xef),_0xf8cd16(0xe2),_0xf8cd16(0xdf),_0x358a16[_0xf8cd16(0xe3)][_0xf8cd16(0xf2)](/^\.\//,'')[_0xf8cd16(0xf2)](_0xf8cd16(0xda),''),'\x27']})})]}),_0x2aea71&&a7_0x3a9db2(Box,{'flexDirection':_0xf8cd16(0xdd),'children':[a7_0x477d06(Box,{'children':a7_0x3a9db2(Text,{'color':'red','children':['❌\x20',_0x2aea71]})}),_0x2aea71['includes']('登录')&&a7_0x3a9db2(Box,{'marginTop':0x1,'children':[a7_0x477d06(Text,{'color':_0xf8cd16(0xe1),'children':_0xf8cd16(0xee)}),a7_0x477d06(Text,{'color':'cyan','children':'lovrabet\x20auth'}),a7_0x477d06(Text,{'color':'yellow','children':_0xf8cd16(0xc1)})]})]})]});};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x5af338,_0x2abb1b){const _0x3cbc71=a8_0x2657,_0x330361=_0x5af338();while(!![]){try{const _0xdddc86=parseInt(_0x3cbc71(0x9f))/0x1+parseInt(_0x3cbc71(0xa5))/0x2*(parseInt(_0x3cbc71(0x9b))/0x3)+-parseInt(_0x3cbc71(0xa4))/0x4*(parseInt(_0x3cbc71(0x90))/0x5)+-parseInt(_0x3cbc71(0x99))/0x6+parseInt(_0x3cbc71(0x8d))/0x7+parseInt(_0x3cbc71(0x8b))/0x8+-parseInt(_0x3cbc71(0x94))/0x9;if(_0xdddc86===_0x2abb1b)break;else _0x330361['push'](_0x330361['shift']());}catch(_0x132efc){_0x330361['push'](_0x330361['shift']());}}}(a8_0x4c67,0x30dba));function a8_0x2657(_0x3b4931,_0x28390f){_0x3b4931=_0x3b4931-0x8b;const _0x4c673e=a8_0x4c67();let _0x26571e=_0x4c673e[_0x3b4931];return _0x26571e;}function a8_0x4c67(){const _0x4c5c8b=['3eEspvq','error','data','info','252159LnVMZX','count','fetch-model-list','未知错误','获取数据集失败,HTTP状态码:\x20','8AVzEQV','723546DanhJu','configArray','获取数据集失败:\x20','401','正在从服务器拉取模型列表...\x20(环境:\x20','860016RroAjQ','登录鉴权失败,登录已过期,请使用\x20lovrabet\x20auth\x20重新登录','1022392qeLNSK','includes','status','25965eFbomZ','errorCode','success','message','5739246UMuUhw','errorMsg','code','/api/node-toolbox/dataset/model-list?appcode=','&otype=array','115728HXsINL','json'];a8_0x4c67=function(){return _0x4c5c8b;};return a8_0x4c67();}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(_0x2b46cc){const _0x162051=a8_0x2657,_0x4283a8=getEnv(),_0x420e3f=getApiDomain()+_0x162051(0x97)+_0x2b46cc+_0x162051(0x98);logger[_0x162051(0x9e)](_0x162051(0xa1),_0x162051(0xa9)+_0x4283a8+')',{'apiUrl':_0x420e3f});const _0xc9f10b=await fetch(_0x420e3f,{'headers':{'Cookie':getCookie()}});if(!_0xc9f10b['ok']){if(_0xc9f10b[_0x162051(0x8f)]===0x191)throw new Error(_0x162051(0x8c));throw new Error(_0x162051(0xa3)+_0xc9f10b[_0x162051(0x8f)]);}const _0xccbda6=await _0xc9f10b[_0x162051(0x9a)]();if(!_0xccbda6[_0x162051(0x92)]){const _0x104f46=_0xccbda6[_0x162051(0x95)]||_0xccbda6[_0x162051(0x93)]||_0xccbda6[_0x162051(0x9d)]?.[_0x162051(0x93)]||_0xccbda6['errorMessage']||_0xccbda6[_0x162051(0x9c)]||_0x162051(0xa2);if(_0x104f46[_0x162051(0x8e)](_0x162051(0xa8))||_0x104f46['includes']('Unauthorized')||_0x104f46[_0x162051(0x8e)]('登录')||_0x104f46[_0x162051(0x8e)]('认证')||_0xccbda6[_0x162051(0x91)]==='UNAUTHORIZED'||_0xccbda6[_0x162051(0x96)]===0x191||_0xccbda6[_0x162051(0x96)]===_0x162051(0xa8))throw new Error(_0x162051(0x8c));throw new Error(_0x162051(0xa7)+_0x104f46);}return{'configArray':_0xccbda6[_0x162051(0x9d)][_0x162051(0xa6)],'count':_0xccbda6['data'][_0x162051(0xa0)]};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a9_0x2ba4(){const _0x51eee7=['endsWith','3083853YUPpkA','.ts','25GXkPIs','-client','346973dpODSr','28856BXUTJC','api.ts.tpl','forEach','{\x20apiConfigName:\x20\x22','name','2359978URZYbw','api','250OAcUOb','typescript','string','success','templates/generate-api','9837716zvBGeq','-api','client.ts.tpl','replaceApiContent','length','2041350zAiwFs','join','client','51450168zGbFQl','app','请先通过\x20`lovrabet\x20config\x20set\x20app\x20<value>`\x20配置应用\x20Code','key','\x22\x20}','4nEwjed','push','4167xnJHOd',',\x20env:\x20\x22','datasetCode','1vZaOXd','env','utf8','online','CONFIG_NAMES.DEFAULT'];a9_0x2ba4=function(){return _0x51eee7;};return a9_0x2ba4();}(function(_0x4b0db2,_0x834ee2){const _0x22dda7=a9_0x26cd,_0x52a44a=_0x4b0db2();while(!![]){try{const _0x23cdbd=parseInt(_0x22dda7(0x10b))/0x1*(-parseInt(_0x22dda7(0xf2))/0x2)+-parseInt(_0x22dda7(0x111))/0x3*(parseInt(_0x22dda7(0x106))/0x4)+parseInt(_0x22dda7(0x113))/0x5*(-parseInt(_0x22dda7(0xfe))/0x6)+parseInt(_0x22dda7(0xf9))/0x7+-parseInt(_0x22dda7(0x116))/0x8*(parseInt(_0x22dda7(0x108))/0x9)+parseInt(_0x22dda7(0xf4))/0xa*(parseInt(_0x22dda7(0x115))/0xb)+parseInt(_0x22dda7(0x101))/0xc;if(_0x23cdbd===_0x834ee2)break;else _0x52a44a['push'](_0x52a44a['shift']());}catch(_0x72f79d){_0x52a44a['push'](_0x52a44a['shift']());}}}(a9_0x2ba4,0xdc4e3));import a9_0x325f8 from'prettier';function a9_0x26cd(_0x3117f5,_0x3df4b9){_0x3117f5=_0x3117f5-0xf2;const _0x2ba40e=a9_0x2ba4();let _0x26cd17=_0x2ba40e[_0x3117f5];return _0x26cd17;}import{mkdirSync,writeFileSync,readFileSync}from'node:fs';import a9_0x3ef38f 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(_0x54cee1,_0x578a36='',_0x178840,_0x449904=![],_0x1335ad,_0x3a8a66='./src/api/'){const _0x5abcf9=a9_0x26cd,_0x2cfb10=readConfig(),_0x1e9746=_0x178840||_0x2cfb10?.[_0x5abcf9(0x102)];if(typeof _0x1e9746!==_0x5abcf9(0xf6)||!_0x1e9746)throw new Error(_0x5abcf9(0x103));const _0x340267=_0x449904?_0x5abcf9(0x10f):'\x22'+_0x1e9746+'\x22',_0x46d37b=typeof _0x2cfb10[_0x5abcf9(0x10c)]===_0x5abcf9(0xf6)?_0x2cfb10[_0x5abcf9(0x10c)]:undefined,_0x56956f=_0x1335ad||_0x46d37b||_0x5abcf9(0x10e),_0x2fe189=_0x56956f!==_0x5abcf9(0x10e);let _0xe1c09c;if(_0x449904)_0x2fe189?_0xe1c09c='{\x20apiConfigName:\x20'+_0x340267+',\x20env:\x20\x22'+_0x56956f+_0x5abcf9(0x105):_0xe1c09c='';else{const _0x186f64=_0x2fe189?_0x5abcf9(0x109)+_0x56956f+'\x22':'';_0xe1c09c=_0x5abcf9(0x119)+_0x1e9746+'\x22'+_0x186f64+'\x20}';}const _0x7c2790=_0x578a36?_0x578a36+_0x5abcf9(0xfa):_0x5abcf9(0xf3),_0x1d188d=_0x578a36?_0x578a36+_0x5abcf9(0x114):_0x5abcf9(0x100),_0x57cc21=[];_0x54cee1[_0x5abcf9(0x118)](_0x332a07=>{const _0x12406f=_0x5abcf9;_0x57cc21[_0x12406f(0x107)]({'datasetCode':_0x332a07[_0x12406f(0x10a)],'tableName':_0x332a07['tableName'],'name':_0x332a07[_0x12406f(0x11a)]||'','alias':_0x332a07['alias']||_0x332a07[_0x12406f(0x104)]});});const _0x8c2d14=fileURLToPath(import.meta.url),_0x2a371a=a9_0x3ef38f['resolve'](a9_0x3ef38f['dirname'](_0x8c2d14),'../..'),_0x21b82d=a9_0x3ef38f[_0x5abcf9(0xff)](_0x2a371a,_0x5abcf9(0xf8)),_0x13cd82=a9_0x3ef38f[_0x5abcf9(0xff)](_0x21b82d,_0x5abcf9(0x117)),_0x4ba087=a9_0x3ef38f[_0x5abcf9(0xff)](_0x21b82d,_0x5abcf9(0xfb)),_0x5b4793=_0x3a8a66[_0x5abcf9(0x110)]('/')?_0x3a8a66['slice'](0x0,-0x1):_0x3a8a66;mkdirSync(_0x5b4793,{'recursive':!![]});const _0xdae983=_0x57cc21[0x0]?.['alias'],_0x15038d=readFileSync(_0x13cd82,_0x5abcf9(0x10d)),_0x59d452=TemplateReplacer[_0x5abcf9(0xfc)](_0x15038d,_0x1e9746,_0x57cc21,_0xdae983,_0x7c2790,_0x340267),_0x314ea1=await a9_0x325f8['format'](_0x59d452,{'parser':_0x5abcf9(0xf5)}),_0x57fd2c=_0x5b4793+'/'+_0x7c2790+_0x5abcf9(0x112);writeFileSync(_0x57fd2c,_0x314ea1,{'encoding':_0x5abcf9(0x10d)});const _0x4946c0=readFileSync(_0x4ba087,'utf8'),_0x192436=TemplateReplacer[_0x5abcf9(0xfc)](_0x4946c0,_0x1e9746,_0x57cc21,_0xdae983,_0x7c2790,_0x340267,_0xe1c09c),_0x5967af=await a9_0x325f8['format'](_0x192436,{'parser':'typescript'}),_0x3f142a=_0x5b4793+'/'+_0x1d188d+'.ts';writeFileSync(_0x3f142a,_0x5967af,{'encoding':_0x5abcf9(0x10d)});const _0x1b7e77=_0x57cc21[_0x5abcf9(0xfd)];return logger[_0x5abcf9(0xf7)]('init-api','API\x20文件生成成功!',undefined,{'apiFile':_0x57fd2c,'clientFile':_0x3f142a,'modelCount':_0x1b7e77,'configName':_0x340267}),{'modelCount':_0x1b7e77,'apiFilePath':_0x57fd2c,'clientFilePath':_0x3f142a,'configName':_0x340267};}
|