@lovrabet/cli 1.2.5-beta.2 → 1.2.5-beta.4
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 -0
- package/lib/ai-setup/config.js +1 -0
- package/lib/api/api-doc-ui.js +1 -1
- package/lib/api/api-doc.js +1 -1
- package/lib/api/api-pull-ui.js +1 -1
- package/lib/api/fetch-model-list.js +1 -1
- package/lib/api/generate-api-file.js +1 -1
- package/lib/api/main.js +1 -1
- package/lib/api/pull-silent.js +1 -1
- package/lib/app-menu/app-menu-sync-ui.js +1 -1
- package/lib/app-menu/create-menu.js +1 -1
- package/lib/app-menu/get-local-pages.js +1 -1
- package/lib/app-menu/get-online-menu-list.js +1 -1
- package/lib/app-menu/use-get-online-menu-list.js +1 -1
- package/lib/app-menu/utils.js +1 -1
- package/lib/app-menu/valid-url.js +1 -1
- package/lib/app-menu-update-cdn/current-content.js +1 -1
- package/lib/app-menu-update-cdn/input-cdn-asset.js +1 -1
- package/lib/app-menu-update-cdn/main.js +1 -1
- package/lib/app-menu-update-cdn/update-menu-cdn-url.js +1 -1
- package/lib/auth/auth-server-ui.js +1 -1
- package/lib/auth/auth-server.js +1 -1
- package/lib/auth/constant.js +1 -1
- package/lib/auth/get-cookie.js +1 -1
- package/lib/auth/is-session-valid.js +1 -1
- package/lib/auth/logout.js +1 -1
- package/lib/cli.js +1 -1
- package/lib/cmd/build-watch.js +1 -1
- package/lib/cmd/build.js +1 -1
- package/lib/cmd/logs.js +1 -1
- package/lib/cmd/preview.js +1 -1
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/help.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/McpInstallUI.js +1 -0
- package/lib/mcp/claude.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/skills/SkillInstallUI.js +1 -0
- package/lib/skills/main.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/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/pages/blank/index.tsx.tpl +1 -2
- package/templates/pages/sdk-fetch/index.tsx.tpl +1 -2
- package/templates/rules/lovrabet_rules.mdc.tpl +109 -0
- package/templates/skills/.agent/skills/lovrabet/SKILL.md +258 -0
- package/templates/skills/.codebuddy/skills/lovrabet/SKILL.md +258 -0
- package/templates/skills/.codex/skills/lovrabet/SKILL.md +258 -0
- package/templates/skills/.opencode/skills/lovrabet/SKILL.md +258 -0
- package/templates/skills/.qoder/rules/lovrabet.md +258 -0
- package/templates/skills/.qoder/skills/lovrabet.md +258 -0
- package/templates/skills/.shared/guides/03-antd-style/guide.md +42 -0
- package/templates/skills/.trae/skills/lovrabet/SKILL.md +258 -0
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a64_0x2ad189=a64_0x3c56;(function(_0x4b1f41,_0x4c65a1){const _0x2ed2a0=a64_0x3c56,_0x780006=_0x4b1f41();while(!![]){try{const _0x93b9fc=-parseInt(_0x2ed2a0(0x12b))/0x1*(parseInt(_0x2ed2a0(0x13a))/0x2)+-parseInt(_0x2ed2a0(0x141))/0x3+-parseInt(_0x2ed2a0(0x12d))/0x4+-parseInt(_0x2ed2a0(0x133))/0x5+-parseInt(_0x2ed2a0(0x151))/0x6*(parseInt(_0x2ed2a0(0x152))/0x7)+-parseInt(_0x2ed2a0(0x13b))/0x8+-parseInt(_0x2ed2a0(0x134))/0x9*(-parseInt(_0x2ed2a0(0x13e))/0xa);if(_0x93b9fc===_0x4c65a1)break;else _0x780006['push'](_0x780006['shift']());}catch(_0x488933){_0x780006['push'](_0x780006['shift']());}}}(a64_0x41ed,0x82766));import a64_0xf53339 from'winston';function a64_0x41ed(){const _0x26e658=['4191940WpdmyG','12141OndDXF','logTask','rawCommand','command','existsSync','stringify','1120qTNgvX','6575216eaBIya','error','parse','33730nOoWgW','clearLogs','timestamp','2105718xqUBFp','success','red','开始执行:\x20','now','join','失败:\x20','File','initWinstonLogger','clear','mkdirSync','writeFileSync','setLogPath','transports','toISOString','currentRawCommand','251730WIIgMm','133qhjKGl','duration','green','logFilePath','message','createLogger','getWinstonInstance','readLogs','winstonLogger','utf8','format','info','filter','combine','.lovrabet.log','level','yellow','577oSKMXJ','log','2133368CvTLOG','warn','errors','dirname','details','trim'];a64_0x41ed=function(){return _0x26e658;};return a64_0x41ed();}import a64_0x2d6527 from'node:fs';import a64_0x272e2e from'node:path';function a64_0x3c56(_0x318cce,_0xc3ead4){_0x318cce=_0x318cce-0x123;const _0x41edfc=a64_0x41ed();let _0x3c56f1=_0x41edfc[_0x318cce];return _0x3c56f1;}class Logger{[a64_0x2ad189(0x15a)];[a64_0x2ad189(0x155)];[a64_0x2ad189(0x150)]='';constructor(){const _0x5e9e23=a64_0x2ad189;this[_0x5e9e23(0x155)]='';}['setRawCommand'](_0x38b45b){const _0x52dde9=a64_0x2ad189;this[_0x52dde9(0x150)]=_0x38b45b;}[a64_0x2ad189(0x149)](){const _0x3d1093=a64_0x2ad189,_0x24f429=a64_0x272e2e[_0x3d1093(0x130)](this[_0x3d1093(0x155)]);!a64_0x2d6527[_0x3d1093(0x138)](_0x24f429)&&a64_0x2d6527[_0x3d1093(0x14b)](_0x24f429,{'recursive':!![]});const _0x52edb8=a64_0xf53339[_0x3d1093(0x124)][_0x3d1093(0x127)](a64_0xf53339[_0x3d1093(0x124)][_0x3d1093(0x140)](),a64_0xf53339[_0x3d1093(0x124)][_0x3d1093(0x12f)]({'stack':!![]}),a64_0xf53339[_0x3d1093(0x124)]['printf'](_0x31109c=>{const _0x240d65=_0x3d1093,_0x3564a7={'timestamp':_0x31109c[_0x240d65(0x140)]||new Date()[_0x240d65(0x14f)](),'level':_0x31109c[_0x240d65(0x129)]||'info','command':_0x31109c[_0x240d65(0x137)]||'unknown','rawCommand':_0x31109c[_0x240d65(0x136)]||this['currentRawCommand']||undefined,'message':_0x31109c[_0x240d65(0x156)]||'','duration':_0x31109c[_0x240d65(0x153)]||undefined,'details':_0x31109c[_0x240d65(0x131)]||undefined};return JSON[_0x240d65(0x139)](_0x3564a7);}));this[_0x3d1093(0x15a)]=a64_0xf53339[_0x3d1093(0x157)]({'level':_0x3d1093(0x125),'format':_0x52edb8,'transports':[new a64_0xf53339[(_0x3d1093(0x14e))][(_0x3d1093(0x148))]({'filename':this[_0x3d1093(0x155)],'level':'info'})],'silent':![]}),a64_0xf53339['addColors']({'success':_0x3d1093(0x154),'error':_0x3d1093(0x143),'warn':_0x3d1093(0x12a),'info':'blue'});}[a64_0x2ad189(0x14d)](_0x43383d){const _0x2ff6a2=a64_0x2ad189;this['logFilePath']=a64_0x272e2e[_0x2ff6a2(0x146)](_0x43383d,_0x2ff6a2(0x128)),this['winstonLogger']&&this[_0x2ff6a2(0x15a)][_0x2ff6a2(0x14a)](),this[_0x2ff6a2(0x149)]();}[a64_0x2ad189(0x125)](_0xea115,_0x489eaf,_0xb441f7){const _0x567752=a64_0x2ad189;if(!this[_0x567752(0x155)]||!this[_0x567752(0x15a)])return;this[_0x567752(0x15a)][_0x567752(0x125)](_0x489eaf,{'command':_0xea115,'details':_0xb441f7});}[a64_0x2ad189(0x142)](_0x474d72,_0x36c3f9,_0x59ac51,_0x1707f5){const _0x578d7c=a64_0x2ad189;if(!this[_0x578d7c(0x155)]||!this[_0x578d7c(0x15a)])return;this[_0x578d7c(0x15a)][_0x578d7c(0x12c)](_0x578d7c(0x125),_0x36c3f9,{'level':_0x578d7c(0x142),'command':_0x474d72,'duration':_0x59ac51,'details':_0x1707f5});}[a64_0x2ad189(0x13c)](_0x20e0d1,_0x1e0497,_0x645b9e){const _0x445586=a64_0x2ad189;if(!this['logFilePath']||!this['winstonLogger'])return;this[_0x445586(0x15a)][_0x445586(0x13c)](_0x1e0497,{'command':_0x20e0d1,'details':_0x645b9e});}[a64_0x2ad189(0x12e)](_0xec9b2e,_0x5f684b,_0x508cb0){const _0x59b7c7=a64_0x2ad189;if(!this[_0x59b7c7(0x155)]||!this[_0x59b7c7(0x15a)])return;this[_0x59b7c7(0x15a)][_0x59b7c7(0x12e)](_0x5f684b,{'command':_0xec9b2e,'details':_0x508cb0});}async[a64_0x2ad189(0x135)](_0x43e7d2,_0x5c5b53,_0x239c9b){const _0x37eac1=a64_0x2ad189,_0x474d9c=Date['now']();this[_0x37eac1(0x125)](_0x43e7d2,_0x37eac1(0x144)+_0x5c5b53);try{const _0x2c7801=await _0x239c9b(),_0x9b60a2=Date[_0x37eac1(0x145)]()-_0x474d9c;return this[_0x37eac1(0x142)](_0x43e7d2,'完成:\x20'+_0x5c5b53,_0x9b60a2),_0x2c7801;}catch(_0x4b0d28){const _0x5cc4ce=Date[_0x37eac1(0x145)]()-_0x474d9c;this['error'](_0x43e7d2,_0x37eac1(0x147)+_0x5c5b53,{'error':_0x4b0d28 instanceof Error?_0x4b0d28[_0x37eac1(0x156)]:String(_0x4b0d28),'duration':_0x5cc4ce});throw _0x4b0d28;}}[a64_0x2ad189(0x159)](){const _0x55c621=a64_0x2ad189;try{if(!a64_0x2d6527[_0x55c621(0x138)](this['logFilePath']))return[];const _0x1c1d05=a64_0x2d6527['readFileSync'](this[_0x55c621(0x155)],_0x55c621(0x123));return _0x1c1d05['split']('\x0a')[_0x55c621(0x126)](_0x5bd0ff=>_0x5bd0ff[_0x55c621(0x132)]())['map'](_0x59ab42=>JSON[_0x55c621(0x13d)](_0x59ab42));}catch(_0x174029){return console[_0x55c621(0x12e)]('Failed\x20to\x20read\x20logs:',_0x174029),[];}}[a64_0x2ad189(0x13f)](){const _0x17593d=a64_0x2ad189;try{a64_0x2d6527[_0x17593d(0x138)](this[_0x17593d(0x155)])&&a64_0x2d6527[_0x17593d(0x14c)](this['logFilePath'],'',_0x17593d(0x123));}catch(_0x360385){console[_0x17593d(0x12e)]('Failed\x20to\x20clear\x20logs:',_0x360385);}}[a64_0x2ad189(0x158)](){return this['winstonLogger'];}}export const logger=new Logger();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a65_0x93e6af=a65_0x12b5;(function(_0x8f007c,_0x382385){const _0x2768ec=a65_0x12b5,_0x2803ca=_0x8f007c();while(!![]){try{const _0x338b2d=parseInt(_0x2768ec(0xd5))/0x1*(-parseInt(_0x2768ec(0xd8))/0x2)+-parseInt(_0x2768ec(0xf9))/0x3*(-parseInt(_0x2768ec(0xf5))/0x4)+-parseInt(_0x2768ec(0xd7))/0x5+-parseInt(_0x2768ec(0xf2))/0x6*(parseInt(_0x2768ec(0xd6))/0x7)+-parseInt(_0x2768ec(0xcf))/0x8+-parseInt(_0x2768ec(0xdc))/0x9*(parseInt(_0x2768ec(0xe5))/0xa)+-parseInt(_0x2768ec(0xef))/0xb*(-parseInt(_0x2768ec(0xf6))/0xc);if(_0x338b2d===_0x382385)break;else _0x2803ca['push'](_0x2803ca['shift']());}catch(_0x36c499){_0x2803ca['push'](_0x2803ca['shift']());}}}(a65_0x5633,0x33d0d));import a65_0x461324 from'node:fs';import a65_0x98de08 from'node:path';import{logger}from'./logger.js';function a65_0x12b5(_0x47643c,_0x103488){_0x47643c=_0x47643c-0xc9;const _0x563323=a65_0x5633();let _0x12b5ba=_0x563323[_0x47643c];return _0x12b5ba;}export class RouterUpdater{[a65_0x93e6af(0xd3)];constructor(_0x4059b3){const _0x19b433=a65_0x93e6af;this[_0x19b433(0xd3)]=a65_0x98de08['join'](_0x4059b3,_0x19b433(0xd9),_0x19b433(0xf3),'index.tsx');}async[a65_0x93e6af(0xe3)](_0x425f57,_0x2fe412){const _0x1b9a16=a65_0x93e6af;if(!a65_0x461324['existsSync'](this['routerFilePath']))throw new Error(_0x1b9a16(0xe8)+this[_0x1b9a16(0xd3)]);const _0x2dfbd7=Date[_0x1b9a16(0xd1)]();logger[_0x1b9a16(0xeb)]('router',_0x1b9a16(0xf8),{'pageName':_0x425f57,'routePath':_0x2fe412,'file':this[_0x1b9a16(0xd3)]});try{const _0x45d29b=await a65_0x461324[_0x1b9a16(0xd2)]['readFile'](this[_0x1b9a16(0xd3)],_0x1b9a16(0xea)),_0x132c33=this['toComponentName'](_0x425f57),_0x5dbc80=this[_0x1b9a16(0xee)](_0x45d29b,_0x132c33,_0x425f57),_0x402175=this[_0x1b9a16(0xda)](_0x5dbc80,_0x2fe412,_0x132c33);await a65_0x461324[_0x1b9a16(0xd2)][_0x1b9a16(0xe7)](this[_0x1b9a16(0xd3)],_0x402175,'utf8');const _0x2a72aa=Date[_0x1b9a16(0xd1)]()-_0x2dfbd7;logger[_0x1b9a16(0xd4)](_0x1b9a16(0xf3),_0x1b9a16(0xc9),_0x2a72aa,{'pageName':_0x425f57,'routePath':_0x2fe412,'componentName':_0x132c33});}catch(_0xca5792){const _0x448ff0=Date[_0x1b9a16(0xd1)]()-_0x2dfbd7;logger[_0x1b9a16(0xce)]('router',_0x1b9a16(0xe1),{'pageName':_0x425f57,'routePath':_0x2fe412,'error':_0xca5792 instanceof Error?_0xca5792[_0x1b9a16(0xe9)]:String(_0xca5792),'duration':_0x448ff0});throw _0xca5792;}}[a65_0x93e6af(0xca)](_0x20a023){const _0xd314af=a65_0x93e6af;return _0x20a023[_0xd314af(0xde)]('-')[_0xd314af(0xcb)](_0x2ef7e2=>_0x2ef7e2['charAt'](0x0)[_0xd314af(0xed)]()+_0x2ef7e2[_0xd314af(0xcd)](0x1)[_0xd314af(0xf0)]())[_0xd314af(0xf7)]('');}[a65_0x93e6af(0xee)](_0x3db08a,_0x4e484b,_0x25d57d){const _0xc5054a=a65_0x93e6af,_0xe44428=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x2ecf56=_0x3db08a[_0xc5054a(0xe0)](_0xe44428)||[],_0x219736=_0xc5054a(0xd0)+_0x4e484b+'\x20from\x20\x22../pages/'+_0x25d57d+'\x22;';if(_0x3db08a['includes'](_0x219736))return _0x3db08a;if(_0x2ecf56[_0xc5054a(0xec)]>0x0){const _0x36944e=_0x2ecf56[_0x2ecf56['length']-0x1];if(_0x36944e){const _0x2e34ba=_0x3db08a[_0xc5054a(0xcc)](_0x36944e),_0x3227ec=_0x2e34ba+_0x36944e[_0xc5054a(0xec)];return _0x3db08a['slice'](0x0,_0x3227ec)+_0x219736+'\x0a'+_0x3db08a[_0xc5054a(0xcd)](_0x3227ec);}}const _0x484a41=_0x3db08a[_0xc5054a(0xe0)](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x484a41&&_0x484a41[_0xc5054a(0xf4)]!==undefined){const _0x498c4a=_0x484a41[_0xc5054a(0xf4)]+_0x484a41[0x0]['length'];return _0x3db08a['slice'](0x0,_0x498c4a)+_0x219736+'\x0a'+_0x3db08a[_0xc5054a(0xcd)](_0x498c4a);}return _0x3db08a;}[a65_0x93e6af(0xda)](_0x5f5c81,_0x5832a3,_0x4f0be8){const _0x2c6b3d=a65_0x93e6af,_0x10a175=_0x2c6b3d(0xe6)+_0x5832a3+_0x2c6b3d(0xe2)+_0x4f0be8+'\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},';if(_0x5f5c81[_0x2c6b3d(0xdf)](_0x2c6b3d(0xdd)+_0x5832a3+'\x22'))return _0x5f5c81;const _0xd872fc=/children:\s*\[([\s\S]*?)\]/,_0x102245=_0x5f5c81[_0x2c6b3d(0xe0)](_0xd872fc);if(!_0x102245||_0x102245[_0x2c6b3d(0xf4)]===undefined)throw new Error('未找到路由配置的\x20children\x20数组');const _0x407d7c=_0x102245[0x1],_0x3a1170=_0x102245['index']+_0x102245[0x0][_0x2c6b3d(0xdb)]('[')+0x1,_0x329966=_0x407d7c?.['match'](/\{[\s\S]*?\},/g)||[];if(_0x329966[_0x2c6b3d(0xec)]>0x0){const _0x3e6a58=_0x329966[_0x329966['length']-0x1];if(_0x3e6a58){const _0x13b928=_0x5f5c81[_0x2c6b3d(0xcc)](_0x3e6a58),_0x2d215d=_0x13b928+_0x3e6a58[_0x2c6b3d(0xec)];return _0x5f5c81['slice'](0x0,_0x2d215d)+'\x0a'+_0x10a175+_0x5f5c81['slice'](_0x2d215d);}}return _0x5f5c81['slice'](0x0,_0x3a1170)+'\x0a'+_0x10a175+_0x5f5c81['slice'](_0x3a1170);}async[a65_0x93e6af(0xe4)](_0x551ff2,_0x168184){const _0xd3dde8=a65_0x93e6af;if(!a65_0x461324[_0xd3dde8(0xf1)](this['routerFilePath']))throw new Error(_0xd3dde8(0xe8)+this['routerFilePath']);const _0x2f13c8=await a65_0x461324[_0xd3dde8(0xd2)]['readFile'](this['routerFilePath'],_0xd3dde8(0xea)),_0x578b9a=this[_0xd3dde8(0xca)](_0x551ff2);let _0x1e5b82=this[_0xd3dde8(0xee)](_0x2f13c8,_0x578b9a,_0x551ff2);return _0x1e5b82=this['addRoute'](_0x1e5b82,_0x168184,_0x578b9a),_0x1e5b82;}}function a65_0x5633(){const _0x585079=['info','length','toUpperCase','addImport','11RBBVMS','toLowerCase','existsSync','1842jhPvHP','router','index','436RVbdxu','8796444kWVolR','join','开始更新路由配置','7677KPWuPq','路由配置更新完成','toComponentName','map','lastIndexOf','slice','error','837504IBkYsl','import\x20','now','promises','routerFilePath','success','252821JErpji','7917QzVyGT','114730qKUDFR','2frmvNR','src','addRoute','indexOf','2169zSXltO','path:\x20\x22','split','includes','match','路由配置更新失败','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','addPageRoute','previewChanges','2990ELbSOW','\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22','writeFile','路由文件不存在:\x20','message','utf8'];a65_0x5633=function(){return _0x585079;};return a65_0x5633();}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x484369){return new Promise(_0xd58dad=>setTimeout(_0xd58dad,_0x484369));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a67_0x5c8cb1=a67_0x8950;(function(_0x25de1a,_0x53b099){const _0x39b6ca=a67_0x8950,_0x3dfc9b=_0x25de1a();while(!![]){try{const _0x3978bb=-parseInt(_0x39b6ca(0x10f))/0x1*(parseInt(_0x39b6ca(0x122))/0x2)+parseInt(_0x39b6ca(0x113))/0x3+-parseInt(_0x39b6ca(0x100))/0x4+-parseInt(_0x39b6ca(0x109))/0x5+-parseInt(_0x39b6ca(0x12f))/0x6+parseInt(_0x39b6ca(0x12e))/0x7*(-parseInt(_0x39b6ca(0x11b))/0x8)+parseInt(_0x39b6ca(0x10b))/0x9;if(_0x3978bb===_0x53b099)break;else _0x3dfc9b['push'](_0x3dfc9b['shift']());}catch(_0x4fdd2e){_0x3dfc9b['push'](_0x3dfc9b['shift']());}}}(a67_0x4746,0x6fbed));function a67_0x4746(){const _0x538696=['2547144AziKNC','utf8','\x0a\x20\x20\x20\x20{\x20','模板内容替换失败','\x20},','readFile','message','extname','344JdZikk','numeric','toComponentName','datasetCode','name','endsWith','version','2mDrcFq','replaceContent','join','.tpl','processTemplate','开始处理模板内容替换','template','processFile','info','includes','alias:\x20\x22','toDisplayTitle','5747NrGeEy','1162734Gbqdco','now','.md','toLocaleDateString','isDirectory','name:\x20\x22','tableName','toLocaleTimeString','promises','replace','error','default','toLowerCase','.ts','processDirectory','charAt','1992380uxlBsO','alias','pop','slice','.tsx','toLocaleString','readdir','YourModel','split','1346605NvAXBw','toUpperCase','10953108gngXDf','.scss','../../package.json','datasetCode:\x20\x22','611843WtFOzb','2-digit','mkdir','tableName:\x20\x22'];a67_0x4746=function(){return _0x538696;};return a67_0x4746();}import a67_0x79066a from'node:fs';import a67_0x10be17 from'node:path';import{createRequire}from'node:module';import{logger}from'./logger.js';function a67_0x8950(_0x3bb765,_0x2cfafa){_0x3bb765=_0x3bb765-0xf9;const _0x474616=a67_0x4746();let _0x8950eb=_0x474616[_0x3bb765];return _0x8950eb;}const require=createRequire(import.meta.url),CLI_VERSION=require(a67_0x5c8cb1(0x10d))[a67_0x5c8cb1(0x121)];export class TemplateReplacer{static[a67_0x5c8cb1(0x11d)](_0x7814d4){const _0x4c63db=a67_0x5c8cb1,_0x396412=_0x7814d4[_0x4c63db(0x108)]('/')[_0x4c63db(0x102)]()||_0x7814d4;return _0x396412['split']('-')['map'](_0x3bf340=>_0x3bf340[_0x4c63db(0xff)](0x0)[_0x4c63db(0x10a)]()+_0x3bf340['slice'](0x1)[_0x4c63db(0xfc)]())[_0x4c63db(0x124)]('');}static[a67_0x5c8cb1(0x12d)](_0x28542d){const _0x5681da=a67_0x5c8cb1,_0x3a83d0=_0x28542d[_0x5681da(0x108)]('/')[_0x5681da(0x102)]()||_0x28542d;return _0x3a83d0[_0x5681da(0x108)]('-')['map'](_0x4fcda2=>_0x4fcda2[_0x5681da(0xff)](0x0)[_0x5681da(0x10a)]()+_0x4fcda2[_0x5681da(0x103)](0x1)['toLowerCase']())[_0x5681da(0x124)]('\x20');}static[a67_0x5c8cb1(0x123)](_0x282c1,_0x103dcc,_0x2b34d9){const _0xa51b1b=a67_0x5c8cb1,_0xd00254=this['toComponentName'](_0x103dcc),_0x184e6b=this[_0xa51b1b(0x12d)](_0x103dcc),_0x4a91e3=new Date(),_0x29f686=_0x4a91e3[_0xa51b1b(0x105)](undefined,{'year':'numeric','month':_0xa51b1b(0x110),'day':_0xa51b1b(0x110),'hour':_0xa51b1b(0x110),'minute':'2-digit','second':_0xa51b1b(0x110),'hour12':![]})['replace'](/\//g,'-'),_0x2128d5=_0x4a91e3[_0xa51b1b(0x132)](undefined,{'year':_0xa51b1b(0x11c),'month':_0xa51b1b(0x110),'day':_0xa51b1b(0x110)})[_0xa51b1b(0xf9)](/\//g,'-'),_0x2d392f=_0x4a91e3[_0xa51b1b(0x136)](undefined,{'hour12':![]});let _0x275edc=_0x282c1[_0xa51b1b(0xf9)](/\{CliVersion\}/g,CLI_VERSION)[_0xa51b1b(0xf9)](/\{ComponentName\}/g,_0xd00254)[_0xa51b1b(0xf9)](/\{DisplayTitle\}/g,_0x184e6b)[_0xa51b1b(0xf9)](/\{PageName\}/g,_0x103dcc)['replace'](/\{TemplateName\}/g,_0x2b34d9)[_0xa51b1b(0xf9)](/\{CreatedAt\}/g,_0x29f686)[_0xa51b1b(0xf9)](/\{CreatedDate\}/g,_0x2128d5)['replace'](/\{CreatedTime\}/g,_0x2d392f);return _0x275edc;}static['replaceApiContent'](_0x5987d5,_0xb617f8,_0xaef4ab,_0x918f77,_0x118d80,_0x1205b7,_0x550442){const _0x3be4ad=a67_0x5c8cb1,_0x37091f=new Date(),_0x3c1499=_0x37091f['toISOString'](),_0x1d544b=_0xaef4ab['map'](_0xa6e711=>{const _0x226897=a67_0x8950,_0x28c30e=[_0x226897(0x10e)+_0xa6e711[_0x226897(0x11e)]+'\x22',_0x226897(0x112)+_0xa6e711[_0x226897(0x135)]+'\x22',_0x226897(0x134)+_0xa6e711['name']+'\x22'];return _0xa6e711['alias']&&_0x28c30e['push'](_0x226897(0x12c)+_0xa6e711[_0x226897(0x101)]+'\x22'),_0x226897(0x115)+_0x28c30e['join'](',\x20')+_0x226897(0x117);})['join'](''),_0x39ed68=_0x918f77||_0xaef4ab[0x0]?.[_0x3be4ad(0x101)]||_0x3be4ad(0x107);let _0x4197b2=_0x5987d5[_0x3be4ad(0xf9)](/\{AppCode\}/g,_0xb617f8)[_0x3be4ad(0xf9)](/\{ModelConfigs\}/g,_0x1d544b)[_0x3be4ad(0xf9)](/\{ExampleModelName\}/g,_0x39ed68)[_0x3be4ad(0xf9)](/\{ApiFileName\}/g,_0x118d80||'api')[_0x3be4ad(0xf9)](/\{ConfigName\}/g,_0x1205b7||_0x3be4ad(0xfb))[_0x3be4ad(0xf9)](/\{ClientConfigParam\}/g,_0x550442||'')['replace'](/\{CreatedAt\}/g,_0x3c1499);return _0x4197b2;}static async[a67_0x5c8cb1(0x126)](_0x18fa94,_0x9444c1,_0x312e2c,_0x43e46f,_0x475f5e=!![]){const _0x3d75fa=a67_0x5c8cb1,_0x2dbb32=Date[_0x3d75fa(0x130)]();try{_0x475f5e&&logger[_0x3d75fa(0x12a)](_0x3d75fa(0x128),_0x3d75fa(0x127),{'templatePath':_0x18fa94,'targetPath':_0x9444c1,'pageName':_0x312e2c,'templateName':_0x43e46f});await a67_0x79066a['promises'][_0x3d75fa(0x111)](_0x9444c1,{'recursive':!![]}),await this[_0x3d75fa(0xfe)](_0x18fa94,_0x9444c1,_0x312e2c,_0x43e46f);if(_0x475f5e){const _0x7fa2a=Date['now']()-_0x2dbb32;logger['success'](_0x3d75fa(0x128),'模板内容替换完成',_0x7fa2a,{'pageName':_0x312e2c,'templateName':_0x43e46f});}}catch(_0x83c677){if(_0x475f5e){const _0x1b9dad=Date[_0x3d75fa(0x130)]()-_0x2dbb32;logger[_0x3d75fa(0xfa)](_0x3d75fa(0x128),_0x3d75fa(0x116),{'templatePath':_0x18fa94,'targetPath':_0x9444c1,'pageName':_0x312e2c,'templateName':_0x43e46f,'error':_0x83c677 instanceof Error?_0x83c677[_0x3d75fa(0x119)]:String(_0x83c677),'duration':_0x1b9dad});}throw _0x83c677;}}static async[a67_0x5c8cb1(0xfe)](_0x3d6f60,_0xd1284a,_0x51fce3,_0xd279e1){const _0x18499e=a67_0x5c8cb1,_0x2e282f=await a67_0x79066a[_0x18499e(0x137)][_0x18499e(0x106)](_0x3d6f60,{'withFileTypes':!![]});for(const _0x5c8411 of _0x2e282f){const _0x3dc1fc=a67_0x10be17[_0x18499e(0x124)](_0x3d6f60,_0x5c8411[_0x18499e(0x11f)]);let _0x468392=a67_0x10be17[_0x18499e(0x124)](_0xd1284a,_0x5c8411[_0x18499e(0x11f)]);_0x5c8411[_0x18499e(0x11f)][_0x18499e(0x120)](_0x18499e(0x125))&&(_0x468392=a67_0x10be17[_0x18499e(0x124)](_0xd1284a,_0x5c8411[_0x18499e(0x11f)][_0x18499e(0xf9)](/\.tpl$/,'')));if(_0x5c8411[_0x18499e(0x133)]())await a67_0x79066a[_0x18499e(0x137)]['mkdir'](_0x468392,{'recursive':!![]}),await this[_0x18499e(0xfe)](_0x3dc1fc,_0x468392,_0x51fce3,_0xd279e1);else _0x5c8411['isFile']()&&await this[_0x18499e(0x129)](_0x3dc1fc,_0x468392,_0x51fce3,_0xd279e1);}}static async[a67_0x5c8cb1(0x129)](_0xfb4ac1,_0x52f259,_0x182507,_0x3a0707){const _0x11f3f8=a67_0x5c8cb1,_0x677ee8=a67_0x10be17[_0x11f3f8(0x11a)](_0xfb4ac1)[_0x11f3f8(0xfc)]();_0xfb4ac1[_0x11f3f8(0x120)]('.tpl')&&(_0x52f259=_0x52f259['replace'](/\.tpl$/,''));const _0x3dfe24=[_0x11f3f8(0x104),_0x11f3f8(0xfd),'.jsx','.js','.json',_0x11f3f8(0x131),'.css',_0x11f3f8(0x10c),_0x11f3f8(0x125)];if(_0x3dfe24[_0x11f3f8(0x12b)](_0x677ee8)||_0xfb4ac1[_0x11f3f8(0x120)](_0x11f3f8(0x125))){const _0x45a8f6=await a67_0x79066a['promises'][_0x11f3f8(0x118)](_0xfb4ac1,_0x11f3f8(0x114)),_0x37bdb6=this[_0x11f3f8(0x123)](_0x45a8f6,_0x182507,_0x3a0707);await a67_0x79066a[_0x11f3f8(0x137)]['writeFile'](_0x52f259,_0x37bdb6,_0x11f3f8(0x114));}else await a67_0x79066a[_0x11f3f8(0x137)]['copyFile'](_0xfb4ac1,_0x52f259);}}
|
package/package.json
CHANGED
|
@@ -17,6 +17,105 @@ alwaysApply: false
|
|
|
17
17
|
5. **类型安全**:充分利用 TypeScript,避免运行时错误
|
|
18
18
|
|
|
19
19
|
|
|
20
|
+
## 页面开发规范
|
|
21
|
+
|
|
22
|
+
### 1. 页面顶部注释(强制)
|
|
23
|
+
|
|
24
|
+
**所有通过 CLI 生成的页面必须在文件顶部包含以下注释**:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
/**
|
|
28
|
+
* Generated by Lovrabet CLI v{CliVersion}
|
|
29
|
+
* Created: {CreatedAt}
|
|
30
|
+
* Page: {PageName}
|
|
31
|
+
* Title: {ComponentName}
|
|
32
|
+
*/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**注释格式说明**:
|
|
36
|
+
- `CliVersion`:生成该页面的 CLI 版本号,便于追踪和兼容性检查
|
|
37
|
+
- `CreatedAt`:页面创建时间,便于维护和追溯
|
|
38
|
+
- `PageName`:页面路径(如 `user-profile`),用于菜单和路由
|
|
39
|
+
- `ComponentName`:组件名称(PascalCase,如 `UserProfile`),中文名称
|
|
40
|
+
|
|
41
|
+
**作用**:
|
|
42
|
+
1. **版本追踪**:通过 CLI 版本号可确定页面使用的 API 规范和特性
|
|
43
|
+
2. **维护追溯**:了解页面创建时间,便于评估代码生命周期
|
|
44
|
+
3. **生成标识**:区分手工编写和 CLI 生成的代码
|
|
45
|
+
4. **迁移参考**:升级 CLI 时可识别哪些页面需要重新生成
|
|
46
|
+
|
|
47
|
+
### 2. 页面组件命名规范
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// ✅ 正确:使用 PascalCase 组件名
|
|
51
|
+
function UserProfile() { }
|
|
52
|
+
function OrderList() { }
|
|
53
|
+
function DataExport() { }
|
|
54
|
+
|
|
55
|
+
// ❌ 错误:使用不规范的命名
|
|
56
|
+
function userProfile() { }
|
|
57
|
+
function order_list() { }
|
|
58
|
+
function data_export() { }
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. 页面结构规范
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
/**
|
|
65
|
+
* Generated by Lovrabet CLI v1.2.5-beta.2
|
|
66
|
+
* Created: 01-18-2026, 21:33:08
|
|
67
|
+
* Page: user-profile
|
|
68
|
+
* Title: UserProfile
|
|
69
|
+
*/
|
|
70
|
+
import React, { useState, useEffect } from 'react';
|
|
71
|
+
import { Table, Button, message } from 'antd';
|
|
72
|
+
import { lovrabetClient } from '../../api/client';
|
|
73
|
+
|
|
74
|
+
function UserProfile() {
|
|
75
|
+
// 1. 状态定义
|
|
76
|
+
const [loading, setLoading] = useState(false);
|
|
77
|
+
const [data, setData] = useState([]);
|
|
78
|
+
|
|
79
|
+
// 2. 数据加载
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
loadData();
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
// 3. 事件处理
|
|
85
|
+
const handleDelete = (id: string) => { };
|
|
86
|
+
|
|
87
|
+
// 4. 渲染
|
|
88
|
+
return (
|
|
89
|
+
<div>
|
|
90
|
+
{/* 页面内容 */}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default UserProfile;
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 4. 保留注释要求
|
|
99
|
+
|
|
100
|
+
**禁止删除或修改页面顶部的生成注释**。如需手动修改页面代码,请保留原始注释以便追踪。
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
// ✅ 正确:保留原始注释,追加自己的说明
|
|
104
|
+
/**
|
|
105
|
+
* Generated by Lovrabet CLI v1.2.5-beta.2
|
|
106
|
+
* Created: 01-18-2026, 21:33:08
|
|
107
|
+
* Page: user-profile
|
|
108
|
+
* Title: UserProfile
|
|
109
|
+
*
|
|
110
|
+
* @modified 2025-01-20 添加批量删除功能
|
|
111
|
+
* @modified 2025-01-25 优化表格性能
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
// ❌ 错误:删除原始注释
|
|
115
|
+
function UserProfile() { }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
|
|
20
119
|
## SDK 使用规范
|
|
21
120
|
|
|
22
121
|
### 1. SDK 初始化
|
|
@@ -1002,6 +1101,11 @@ import {
|
|
|
1002
1101
|
|
|
1003
1102
|
## 禁止事项
|
|
1004
1103
|
|
|
1104
|
+
### 页面相关
|
|
1105
|
+
1. **不要删除页面顶部注释** - CLI 生成的注释必须保留,用于版本追踪和维护
|
|
1106
|
+
2. **不要修改页面顶部注释内容** - 如需追加说明,使用 `@modified` 标签
|
|
1107
|
+
3. **不要使用不规范的组件命名** - 组件名必须使用 PascalCase
|
|
1108
|
+
|
|
1005
1109
|
### SDK 相关
|
|
1006
1110
|
1. **不要臆测 API** - 使用不存在的方法或参数
|
|
1007
1111
|
2. **不要臆测字段** - 未通过 MCP 确认字段是否存在
|
|
@@ -1052,6 +1156,11 @@ import {
|
|
|
1052
1156
|
|
|
1053
1157
|
### 记住
|
|
1054
1158
|
|
|
1159
|
+
#### 页面开发
|
|
1160
|
+
- **保留顶部注释**:CLI 生成的注释包含版本、时间、页面名,禁止删除
|
|
1161
|
+
- **组件命名 PascalCase**:`UserProfile` 而非 `userProfile`
|
|
1162
|
+
- **追加修改说明**:使用 `@modified` 标签记录手动修改
|
|
1163
|
+
|
|
1055
1164
|
#### SDK 核心
|
|
1056
1165
|
- **成功**:SDK 返回 API 响应的 `data` 字段内容
|
|
1057
1166
|
- **失败**:抛出 `LovrabetError` 异常(不是返回错误)
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
# Lovrabet 开发工作流
|
|
2
|
+
|
|
3
|
+
当用户请求与 Lovrabet 平台相关的开发任务时,使用此工作流。
|
|
4
|
+
|
|
5
|
+
## 前置条件
|
|
6
|
+
|
|
7
|
+
此工作流假设 Lovrabet MCP 服务器已在 claude code 的 MCP 设置中配置完成。MCP 工具**直接可用**,需要时请使用。
|
|
8
|
+
|
|
9
|
+
## 重要规则
|
|
10
|
+
|
|
11
|
+
1. **直接使用 MCP 工具**:当用户请求创建/验证 SQL 或查询数据集时,**直接调用 MCP 工具**。不要生成脚本或让用户切换到其他工具。
|
|
12
|
+
2. **5步 SQL 工作流**:创建自定义 SQL 时必须严格遵循以下顺序。
|
|
13
|
+
3. **禁止生成脚本**:不要为 MCP 操作生成脚本 - 直接使用工具。
|
|
14
|
+
4. **禁止命令行调用 MCP**:禁止运行 `npx @lovrabet/dataset-mcp-server` 等命令。MCP 工具只能通过 MCP 协议调用。
|
|
15
|
+
5. **MCP 未配置提示**:如果尝试调用 Lovrabet MCP 工具但发现工具不可用,主动告知用户 MCP 未配置并提供配置方法。
|
|
16
|
+
6. **完全自动执行**:创建自定义 SQL 时,**自动执行全部 5 步,不要询问用户任何输入**(sqlCode、sqlName、描述等)。根据 SQL 功能自动生成合适的名称。
|
|
17
|
+
|
|
18
|
+
## 工作流步骤
|
|
19
|
+
|
|
20
|
+
### 步骤 1: 了解需求
|
|
21
|
+
分析用户请求,提取关键信息:
|
|
22
|
+
- 需要操作哪个数据集?
|
|
23
|
+
- 需要做什么操作(CRUD、自定义 SQL)?
|
|
24
|
+
- 是否需要生成代码?
|
|
25
|
+
|
|
26
|
+
### 步骤 2: 探索数据集(使用 MCP)
|
|
27
|
+
|
|
28
|
+
如果不确定数据集信息,先探索:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
请使用 list_datasets 列出所有可用的数据集
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
或搜索:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
请使用 searchDatasets 搜索包含 "用户" 的数据集
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 步骤 3: 获取数据集详情
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
请使用 get_dataset_detail 获取数据集详情
|
|
44
|
+
datasetCode: <数据集代码>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
重点关注:
|
|
48
|
+
- `fields` - 字段列表及其元数据
|
|
49
|
+
- `operations` - 支持的操作列表
|
|
50
|
+
- `basic.tableName` - 实际表名
|
|
51
|
+
|
|
52
|
+
### 步骤 4: 生成 SDK 代码(可选)
|
|
53
|
+
|
|
54
|
+
如果需要生成代码:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
请使用 generate_sdk_code 生成 SDK 调用代码
|
|
58
|
+
datasetCode: <数据集代码>
|
|
59
|
+
operationName: <操作名称>
|
|
60
|
+
includeImports: true
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 步骤 5: 执行操作
|
|
64
|
+
|
|
65
|
+
根据需求调用相应方法:
|
|
66
|
+
|
|
67
|
+
**列表查询 (CRUD)**
|
|
68
|
+
```typescript
|
|
69
|
+
// 数据集: {datasetName} | 数据表: {tableName}
|
|
70
|
+
const result = await client.models.{modelName}.filter({
|
|
71
|
+
where: { status: { $eq: "active" } },
|
|
72
|
+
select: ["id", "name"],
|
|
73
|
+
currentPage: 1,
|
|
74
|
+
pageSize: 20,
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**自定义 SQL**
|
|
79
|
+
```
|
|
80
|
+
请使用 list_sql_queries 列出可用的 SQL 查询
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**执行 SQL**
|
|
84
|
+
```
|
|
85
|
+
请使用 execute_custom_sql 执行 SQL 查询
|
|
86
|
+
sqlCode: <SQL 代码>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 常见工作流
|
|
90
|
+
|
|
91
|
+
### 工作流 1: 创建列表查询页面
|
|
92
|
+
|
|
93
|
+
用户说:"创建用户列表页面"
|
|
94
|
+
|
|
95
|
+
**直接调用:**
|
|
96
|
+
1. `list_datasets` - 查找用户数据集
|
|
97
|
+
2. `get_dataset_detail(datasetCode: "users")` - 获取字段
|
|
98
|
+
3. `generate_sdk_code(datasetCode: "users", operationName: "filter")` - 生成代码
|
|
99
|
+
4. 然后结合 AntD Table 组件实现页面
|
|
100
|
+
|
|
101
|
+
### 工作流 2: 创建自定义 SQL 报表
|
|
102
|
+
|
|
103
|
+
用户说:"创建一个按月统计的订单报表"
|
|
104
|
+
|
|
105
|
+
**直接调用:**
|
|
106
|
+
1. `list_sql_queries` - 检查 SQL 是否存在
|
|
107
|
+
2. `get_dataset_detail(datasetCode: "orders")` - 获取表结构
|
|
108
|
+
3. `validate_sql_content(sqlContent: "SELECT DATE_FORMAT(...)")` - 验证 SQL
|
|
109
|
+
4. `save_or_update_custom_sql(...)` - 保存 SQL
|
|
110
|
+
5. `execute_custom_sql(sqlCode: "monthly_orders")` - 测试执行
|
|
111
|
+
6. 然后生成代码并使用 AntD Charts 展示报表
|
|
112
|
+
|
|
113
|
+
## Filter 查询规范(关键)
|
|
114
|
+
|
|
115
|
+
### 基本结构
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const result = await client.models.<modelName>.filter({
|
|
119
|
+
where: {
|
|
120
|
+
status: { $eq: "active" }, // 必须使用操作符
|
|
121
|
+
age: { $gte: 18, $lte: 65 },
|
|
122
|
+
},
|
|
123
|
+
select: ["id", "name", "email"], // NOT "fields"
|
|
124
|
+
orderBy: [{ createTime: "desc" }], // NOT "sort"
|
|
125
|
+
currentPage: 1, // NOT "page"
|
|
126
|
+
pageSize: 20, // NOT "limit"
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 操作符速查
|
|
131
|
+
|
|
132
|
+
| 场景 | 操作符 | 示例 |
|
|
133
|
+
|------|-------|------|
|
|
134
|
+
| 等于 | `$eq` | `{ status: { $eq: "active" } }` |
|
|
135
|
+
| 不等于 | `$ne` | `{ status: { $ne: "deleted" } }` |
|
|
136
|
+
| 大于等于 | `$gte` | `{ age: { $gte: 18 } }` |
|
|
137
|
+
| 小于等于 | `$lte` | `{ age: { $lte: 65 } }` |
|
|
138
|
+
| 大于 | `$gt` | `{ price: { $gt: 100 } }` |
|
|
139
|
+
| 小于 | `$lt` | `{ price: { $lt: 1000 } }` |
|
|
140
|
+
| 在数组中 | `$in` | `{ type: { $in: ["A", "B"] } }` |
|
|
141
|
+
| 包含 | `$contain` | `{ name: { $contain: "keyword" } }` |
|
|
142
|
+
| 开头是 | `$startWith` | `{ email: { $startWith: "admin" } }` |
|
|
143
|
+
| 结尾是 | `$endWith` | `{ domain: { $endWith: ".com" } }` |
|
|
144
|
+
| 并且 | `$and` | `{ $and: [{ age: { $gte: 18 } }, { status: { $eq: "active" } }] }` |
|
|
145
|
+
| 或者 | `$or` | `{ $or: [{ status: { $eq: "pending" } }, { status: { $eq: "processing" } }] }` |
|
|
146
|
+
|
|
147
|
+
## SQL 创建规范(关键)
|
|
148
|
+
|
|
149
|
+
### 5 步强制流程
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
查询 → 生成 → 验证 → 保存 → 测试
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
1. **查询**: `list_sql_queries` - 检查 SQL 是否已存在
|
|
156
|
+
2. **生成**: `get_dataset_detail` - 先获取表结构,确保字段名正确
|
|
157
|
+
3. **验证**: `validate_sql_content` - 验证 SQL 语法和结构
|
|
158
|
+
4. **保存**: `save_or_update_custom_sql` - 保存到平台
|
|
159
|
+
5. **测试**: `execute_custom_sql` - 测试执行
|
|
160
|
+
|
|
161
|
+
**禁止跳过任何步骤!**
|
|
162
|
+
|
|
163
|
+
**SQL 命名规范(自动生成):**
|
|
164
|
+
- `sqlCode`:snake_case,描述性(如 `monthly_order_stats`、`user_activity_report`)
|
|
165
|
+
- `sqlName`:中文名称描述功能(如 "月度订单统计"、"用户活跃度报表")
|
|
166
|
+
- `description`:简要描述 SQL 的功能
|
|
167
|
+
|
|
168
|
+
**重要**:禁止询问用户 sqlCode、sqlName 或 description。根据上下文自动生成。
|
|
169
|
+
|
|
170
|
+
## AntD UI 规范(关键)
|
|
171
|
+
|
|
172
|
+
### 禁止项(强制)
|
|
173
|
+
|
|
174
|
+
- ❌ 禁止 emoji
|
|
175
|
+
- ❌ 禁止感叹号
|
|
176
|
+
- ❌ 禁止 AI 味道的文案("太棒了!")
|
|
177
|
+
- ❌ 禁止花哨颜色(#FF00FF,渐变)
|
|
178
|
+
- ❌ 禁止使用 emoji 作为图标
|
|
179
|
+
|
|
180
|
+
### 必需项
|
|
181
|
+
|
|
182
|
+
- ✅ 使用 AntD token 颜色
|
|
183
|
+
- ✅ 专业文案:"保存"、"取消"、"操作成功"
|
|
184
|
+
- ✅ 使用 @ant-design/icons
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
// ✅ 正确
|
|
188
|
+
<Button type="primary">保存</Button>
|
|
189
|
+
<message.success("操作成功" />
|
|
190
|
+
|
|
191
|
+
// ❌ 错误
|
|
192
|
+
<Button>保存!</Button>
|
|
193
|
+
<message.success="🎉 操作成功!" />
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 返回格式
|
|
197
|
+
|
|
198
|
+
### Filter 返回
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
{
|
|
202
|
+
tableData: Array<{ // 数据列表
|
|
203
|
+
total: number, // 总数
|
|
204
|
+
}>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Execute SQL 返回
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
{
|
|
211
|
+
execSuccess: boolean, // SQL 是否执行成功
|
|
212
|
+
execResult?: Array<any>, // 查询结果(成功时)
|
|
213
|
+
execError?: string, // 错误信息(失败时)
|
|
214
|
+
rowCount?: number, // 返回的行数
|
|
215
|
+
message: string, // 可读消息
|
|
216
|
+
fixSuggestions?: Array<SqlFixSuggestion> // 错误修复建议
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## CLI 命令参考
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
lovrabet api pull # 拉取并生成 API 定义
|
|
224
|
+
lovrabet menu sync # 同步菜单到平台
|
|
225
|
+
lovrabet menu update # 更新菜单 CDN 资源
|
|
226
|
+
lovrabet skill --help # 显示技能包帮助
|
|
227
|
+
lovrabet skill install <ide> # 安装技能包到项目
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## 开发者指南位置
|
|
231
|
+
|
|
232
|
+
安装后,详细指南位于:
|
|
233
|
+
- `.lovrabet/skill/.shared/guides/01-filter-query/guide.md`
|
|
234
|
+
- `.lovrabet/skill/.shared/guides/02-mcp-sql-workflow/guide.md`
|
|
235
|
+
- `.lovrabet/skill/.shared/guides/03-antd-style/guide.md`
|
|
236
|
+
- `.lovrabet/skill/.shared/guides/04-troubleshooting/guide.md`
|
|
237
|
+
- `.lovrabet/skill/.shared/guides/05-api-integration/guide.md`
|
|
238
|
+
- `.lovrabet/skill/.shared/guides/06-menu-management/guide.md`
|
|
239
|
+
- `.lovrabet/skill/.shared/guides/07-backend-function/guide.md`
|
|
240
|
+
|
|
241
|
+
## MCP 配置说明
|
|
242
|
+
|
|
243
|
+
当 MCP 工具不可用时,主动告知用户:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
Lovrabet MCP 服务器未配置,请先配置:
|
|
247
|
+
|
|
248
|
+
运行: lovrabet mcp install claude
|
|
249
|
+
|
|
250
|
+
这将输出 claude mcp add 命令供您手动执行。
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## 注意事项
|
|
254
|
+
|
|
255
|
+
- 每次调用 SDK 前添加注释:`// 数据集: <数据集名称> | 数据表: <表名>`
|
|
256
|
+
- 所有 SDK 调用必须用 try-catch 包裹
|
|
257
|
+
- filter 查询必须使用 filter() 方法,不要用 getList()
|
|
258
|
+
- 自定义 SQL 必须先验证字段名与实际表结构匹配
|