@lovrabet/cli 1.2.5-beta.1 → 1.2.5-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/add-page/input-page-router.js +1 -1
- package/lib/add-page/main.js +1 -1
- package/lib/add-page/select-page-template.js +1 -1
- package/lib/ai-setup/AISetupUI.js +1 -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/.claude/skills/lovrabet/SKILL.md +1 -0
- package/templates/skills/.codebuddy/skills/lovrabet/SKILL.md +258 -0
- package/templates/skills/.codex/skills/lovrabet/SKILL.md +258 -0
- package/templates/skills/.cursor/commands/lovrabet.md +1 -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/.shared/guides/07-backend-function/guide.md +679 -0
- package/templates/skills/.trae/skills/lovrabet/SKILL.md +258 -0
- package/templates/skills/.windsurf/workflows/lovrabet.md +1 -0
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function a64_0x14bd(_0x140fdf,_0x17379e){_0x140fdf=_0x140fdf-0x12a;const _0x1db82f=a64_0x1db8();let _0x14bdb6=_0x1db82f[_0x140fdf];return _0x14bdb6;}const a64_0x234030=a64_0x14bd;(function(_0x475d29,_0x4a9dd5){const _0x4e9081=a64_0x14bd,_0x1f92d4=_0x475d29();while(!![]){try{const _0x3d1da2=parseInt(_0x4e9081(0x15a))/0x1+parseInt(_0x4e9081(0x159))/0x2+-parseInt(_0x4e9081(0x141))/0x3*(-parseInt(_0x4e9081(0x156))/0x4)+-parseInt(_0x4e9081(0x140))/0x5*(-parseInt(_0x4e9081(0x154))/0x6)+parseInt(_0x4e9081(0x15e))/0x7*(parseInt(_0x4e9081(0x15f))/0x8)+-parseInt(_0x4e9081(0x12b))/0x9+-parseInt(_0x4e9081(0x14f))/0xa*(parseInt(_0x4e9081(0x12a))/0xb);if(_0x3d1da2===_0x4a9dd5)break;else _0x1f92d4['push'](_0x1f92d4['shift']());}catch(_0x136630){_0x1f92d4['push'](_0x1f92d4['shift']());}}}(a64_0x1db8,0x91179));function a64_0x1db8(){const _0x1f03a5=['stringify','File','existsSync','unknown','details','readLogs','format','565sJydBR','3gGtbCu','readFileSync','printf','transports','errors','setRawCommand','yellow','完成:\x20','clear','createLogger','command','initWinstonLogger','blue','join','30iasmfK','warn','green','combine','rawCommand','6738MnEFvQ','red','2508784vEBjud','toISOString','error','1529512LWdRQv','155059UEPQpT','.lovrabet.log','writeFileSync','log','1390501XPZCQw','24kczdMN','filter','setLogPath','Failed\x20to\x20read\x20logs:','map','Failed\x20to\x20clear\x20logs:','utf8','info','message','4297887mnGWRX','4530519BaRNdB','currentRawCommand','trim','addColors','clearLogs','logTask','timestamp','success','mkdirSync','level','winstonLogger','logFilePath','parse','now'];a64_0x1db8=function(){return _0x1f03a5;};return a64_0x1db8();}import a64_0x56efd1 from'winston';import a64_0x11edf7 from'node:fs';import a64_0x17ad5b from'node:path';class Logger{[a64_0x234030(0x135)];['logFilePath'];['currentRawCommand']='';constructor(){const _0x219d18=a64_0x234030;this[_0x219d18(0x136)]='';}[a64_0x234030(0x146)](_0x21b6fd){this['currentRawCommand']=_0x21b6fd;}[a64_0x234030(0x14c)](){const _0x3c3cb8=a64_0x234030,_0x349e89=a64_0x17ad5b['dirname'](this[_0x3c3cb8(0x136)]);!a64_0x11edf7[_0x3c3cb8(0x13b)](_0x349e89)&&a64_0x11edf7[_0x3c3cb8(0x133)](_0x349e89,{'recursive':!![]});const _0x5cba2b=a64_0x56efd1['format'][_0x3c3cb8(0x152)](a64_0x56efd1['format'][_0x3c3cb8(0x131)](),a64_0x56efd1[_0x3c3cb8(0x13f)][_0x3c3cb8(0x145)]({'stack':!![]}),a64_0x56efd1['format'][_0x3c3cb8(0x143)](_0x2f5612=>{const _0x561322=_0x3c3cb8,_0x1065d4={'timestamp':_0x2f5612[_0x561322(0x131)]||new Date()[_0x561322(0x157)](),'level':_0x2f5612[_0x561322(0x134)]||_0x561322(0x166),'command':_0x2f5612[_0x561322(0x14b)]||_0x561322(0x13c),'rawCommand':_0x2f5612[_0x561322(0x153)]||this[_0x561322(0x12c)]||undefined,'message':_0x2f5612[_0x561322(0x167)]||'','duration':_0x2f5612['duration']||undefined,'details':_0x2f5612[_0x561322(0x13d)]||undefined};return JSON[_0x561322(0x139)](_0x1065d4);}));this[_0x3c3cb8(0x135)]=a64_0x56efd1[_0x3c3cb8(0x14a)]({'level':'info','format':_0x5cba2b,'transports':[new a64_0x56efd1[(_0x3c3cb8(0x144))][(_0x3c3cb8(0x13a))]({'filename':this[_0x3c3cb8(0x136)],'level':_0x3c3cb8(0x166)})],'silent':![]}),a64_0x56efd1[_0x3c3cb8(0x12e)]({'success':_0x3c3cb8(0x151),'error':_0x3c3cb8(0x155),'warn':_0x3c3cb8(0x147),'info':_0x3c3cb8(0x14d)});}[a64_0x234030(0x161)](_0x1fe383){const _0x26bac3=a64_0x234030;this['logFilePath']=a64_0x17ad5b[_0x26bac3(0x14e)](_0x1fe383,_0x26bac3(0x15b)),this[_0x26bac3(0x135)]&&this[_0x26bac3(0x135)][_0x26bac3(0x149)](),this['initWinstonLogger']();}[a64_0x234030(0x166)](_0xf2f39d,_0x2e77b5,_0x20e56f){const _0x5b875c=a64_0x234030;if(!this['logFilePath']||!this[_0x5b875c(0x135)])return;this[_0x5b875c(0x135)][_0x5b875c(0x166)](_0x2e77b5,{'command':_0xf2f39d,'details':_0x20e56f});}[a64_0x234030(0x132)](_0x71b24a,_0x3f0a86,_0x294b38,_0x207cc1){const _0x445ab8=a64_0x234030;if(!this[_0x445ab8(0x136)]||!this[_0x445ab8(0x135)])return;this[_0x445ab8(0x135)][_0x445ab8(0x15d)](_0x445ab8(0x166),_0x3f0a86,{'level':'success','command':_0x71b24a,'duration':_0x294b38,'details':_0x207cc1});}[a64_0x234030(0x158)](_0x2f820e,_0x2c8736,_0x20c977){const _0x12267b=a64_0x234030;if(!this[_0x12267b(0x136)]||!this[_0x12267b(0x135)])return;this[_0x12267b(0x135)][_0x12267b(0x158)](_0x2c8736,{'command':_0x2f820e,'details':_0x20c977});}['warn'](_0x153bf7,_0x58dcfb,_0x69ef3b){const _0x85adb1=a64_0x234030;if(!this[_0x85adb1(0x136)]||!this[_0x85adb1(0x135)])return;this[_0x85adb1(0x135)][_0x85adb1(0x150)](_0x58dcfb,{'command':_0x153bf7,'details':_0x69ef3b});}async[a64_0x234030(0x130)](_0x53d3b3,_0x33b5ab,_0x1aeced){const _0x454617=a64_0x234030,_0x4a5c84=Date['now']();this[_0x454617(0x166)](_0x53d3b3,'开始执行:\x20'+_0x33b5ab);try{const _0x56e985=await _0x1aeced(),_0x281c80=Date[_0x454617(0x138)]()-_0x4a5c84;return this[_0x454617(0x132)](_0x53d3b3,_0x454617(0x148)+_0x33b5ab,_0x281c80),_0x56e985;}catch(_0x4f8473){const _0x6398e4=Date[_0x454617(0x138)]()-_0x4a5c84;this['error'](_0x53d3b3,'失败:\x20'+_0x33b5ab,{'error':_0x4f8473 instanceof Error?_0x4f8473['message']:String(_0x4f8473),'duration':_0x6398e4});throw _0x4f8473;}}[a64_0x234030(0x13e)](){const _0x5a8354=a64_0x234030;try{if(!a64_0x11edf7[_0x5a8354(0x13b)](this[_0x5a8354(0x136)]))return[];const _0x2bcfdd=a64_0x11edf7[_0x5a8354(0x142)](this[_0x5a8354(0x136)],'utf8');return _0x2bcfdd['split']('\x0a')[_0x5a8354(0x160)](_0x2956a5=>_0x2956a5[_0x5a8354(0x12d)]())[_0x5a8354(0x163)](_0x358b93=>JSON[_0x5a8354(0x137)](_0x358b93));}catch(_0x1ee540){return console[_0x5a8354(0x150)](_0x5a8354(0x162),_0x1ee540),[];}}[a64_0x234030(0x12f)](){const _0x2b4404=a64_0x234030;try{a64_0x11edf7['existsSync'](this['logFilePath'])&&a64_0x11edf7[_0x2b4404(0x15c)](this[_0x2b4404(0x136)],'',_0x2b4404(0x165));}catch(_0x299657){console[_0x2b4404(0x150)](_0x2b4404(0x164),_0x299657);}}['getWinstonInstance'](){return this['winstonLogger'];}}export const logger=new Logger();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a65_0x5970db=a65_0x996a;function a65_0x996a(_0x25216b,_0x9a9163){_0x25216b=_0x25216b-0x13b;const _0x234544=a65_0x2345();let _0x996a38=_0x234544[_0x25216b];return _0x996a38;}(function(_0x5eb237,_0x7f8fb4){const _0x5efb23=a65_0x996a,_0x31afe8=_0x5eb237();while(!![]){try{const _0x18bc7b=parseInt(_0x5efb23(0x13e))/0x1*(parseInt(_0x5efb23(0x163))/0x2)+-parseInt(_0x5efb23(0x141))/0x3+parseInt(_0x5efb23(0x157))/0x4+parseInt(_0x5efb23(0x142))/0x5*(-parseInt(_0x5efb23(0x14a))/0x6)+parseInt(_0x5efb23(0x154))/0x7*(-parseInt(_0x5efb23(0x150))/0x8)+-parseInt(_0x5efb23(0x165))/0x9+parseInt(_0x5efb23(0x14d))/0xa*(parseInt(_0x5efb23(0x15a))/0xb);if(_0x18bc7b===_0x7f8fb4)break;else _0x31afe8['push'](_0x31afe8['shift']());}catch(_0x2dc21e){_0x31afe8['push'](_0x31afe8['shift']());}}}(a65_0x2345,0x59b4b));function a65_0x2345(){const _0x728cdf=['1551132TfljJv','match','toComponentName','readFile','error','router','now','开始更新路由配置','join','53995NzWJTb','existsSync','path:\x20\x22','425904mKzIyk','2469095DOoeQF','\x22,\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20element:\x20<','index.tsx','writeFile','lastIndexOf','previewChanges','\x20\x20\x20\x20\x20\x20\x20\x20{\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20path:\x20\x22','路由文件不存在:\x20','6EYYDgJ','includes','\x20from\x20\x22../pages/','20aAFfCG','indexOf','map','80kdifQg','index','split','utf8','212149btzeto','import\x20','promises','1110828GyupCX','addPageRoute','toLowerCase','6308159zRlCjX','addRoute','routerFilePath','message','\x20/>,\x0a\x20\x20\x20\x20\x20\x20\x20\x20},','addImport','length','slice','info','2fuFqJJ','路由配置更新失败'];a65_0x2345=function(){return _0x728cdf;};return a65_0x2345();}import a65_0x1a27a8 from'node:fs';import a65_0x508fa9 from'node:path';import{logger}from'./logger.js';export class RouterUpdater{[a65_0x5970db(0x15c)];constructor(_0x259c1d){const _0x3ebaf1=a65_0x5970db;this[_0x3ebaf1(0x15c)]=a65_0x508fa9[_0x3ebaf1(0x13d)](_0x259c1d,'src',_0x3ebaf1(0x16a),_0x3ebaf1(0x144));}async[a65_0x5970db(0x158)](_0x4accc7,_0x1d5805){const _0x18a350=a65_0x5970db;if(!a65_0x1a27a8[_0x18a350(0x13f)](this[_0x18a350(0x15c)]))throw new Error(_0x18a350(0x149)+this['routerFilePath']);const _0x1af791=Date[_0x18a350(0x13b)]();logger[_0x18a350(0x162)](_0x18a350(0x16a),_0x18a350(0x13c),{'pageName':_0x4accc7,'routePath':_0x1d5805,'file':this[_0x18a350(0x15c)]});try{const _0x188d90=await a65_0x1a27a8[_0x18a350(0x156)]['readFile'](this[_0x18a350(0x15c)],_0x18a350(0x153)),_0x52cee3=this[_0x18a350(0x167)](_0x4accc7),_0x2d2c1f=this[_0x18a350(0x15f)](_0x188d90,_0x52cee3,_0x4accc7),_0x1d6b22=this[_0x18a350(0x15b)](_0x2d2c1f,_0x1d5805,_0x52cee3);await a65_0x1a27a8[_0x18a350(0x156)][_0x18a350(0x145)](this[_0x18a350(0x15c)],_0x1d6b22,_0x18a350(0x153));const _0x4540b6=Date[_0x18a350(0x13b)]()-_0x1af791;logger['success']('router','路由配置更新完成',_0x4540b6,{'pageName':_0x4accc7,'routePath':_0x1d5805,'componentName':_0x52cee3});}catch(_0x503b03){const _0x39c578=Date[_0x18a350(0x13b)]()-_0x1af791;logger[_0x18a350(0x169)]('router',_0x18a350(0x164),{'pageName':_0x4accc7,'routePath':_0x1d5805,'error':_0x503b03 instanceof Error?_0x503b03[_0x18a350(0x15d)]:String(_0x503b03),'duration':_0x39c578});throw _0x503b03;}}[a65_0x5970db(0x167)](_0x4cc73b){const _0x396797=a65_0x5970db;return _0x4cc73b[_0x396797(0x152)]('-')[_0x396797(0x14f)](_0x25a9cf=>_0x25a9cf['charAt'](0x0)['toUpperCase']()+_0x25a9cf[_0x396797(0x161)](0x1)[_0x396797(0x159)]())[_0x396797(0x13d)]('');}['addImport'](_0x2d0564,_0x6b13d3,_0xc0954){const _0x208ca9=a65_0x5970db,_0x7e3fec=/import\s+\w+\s+from\s+["']\.\.\/pages\/\w+["'];?\n/g,_0x395423=_0x2d0564[_0x208ca9(0x166)](_0x7e3fec)||[],_0x4f0956=_0x208ca9(0x155)+_0x6b13d3+_0x208ca9(0x14c)+_0xc0954+'\x22;';if(_0x2d0564[_0x208ca9(0x14b)](_0x4f0956))return _0x2d0564;if(_0x395423[_0x208ca9(0x160)]>0x0){const _0x12f977=_0x395423[_0x395423[_0x208ca9(0x160)]-0x1];if(_0x12f977){const _0x28cd1a=_0x2d0564[_0x208ca9(0x146)](_0x12f977),_0x3afbb7=_0x28cd1a+_0x12f977[_0x208ca9(0x160)];return _0x2d0564[_0x208ca9(0x161)](0x0,_0x3afbb7)+_0x4f0956+'\x0a'+_0x2d0564[_0x208ca9(0x161)](_0x3afbb7);}}const _0x14048c=_0x2d0564[_0x208ca9(0x166)](/import\s+\w+\s+from\s+["']\.\.\/layouts\/\w+["'];?\n/);if(_0x14048c&&_0x14048c[_0x208ca9(0x151)]!==undefined){const _0x2559b4=_0x14048c['index']+_0x14048c[0x0][_0x208ca9(0x160)];return _0x2d0564[_0x208ca9(0x161)](0x0,_0x2559b4)+_0x4f0956+'\x0a'+_0x2d0564['slice'](_0x2559b4);}return _0x2d0564;}['addRoute'](_0x57192f,_0xd2c52b,_0x18eb46){const _0x3f4592=a65_0x5970db,_0x47ae54=_0x3f4592(0x148)+_0xd2c52b+_0x3f4592(0x143)+_0x18eb46+_0x3f4592(0x15e);if(_0x57192f[_0x3f4592(0x14b)](_0x3f4592(0x140)+_0xd2c52b+'\x22'))return _0x57192f;const _0x4a639a=/children:\s*\[([\s\S]*?)\]/,_0x188d9b=_0x57192f[_0x3f4592(0x166)](_0x4a639a);if(!_0x188d9b||_0x188d9b[_0x3f4592(0x151)]===undefined)throw new Error('未找到路由配置的\x20children\x20数组');const _0x253752=_0x188d9b[0x1],_0x2f45c1=_0x188d9b[_0x3f4592(0x151)]+_0x188d9b[0x0][_0x3f4592(0x14e)]('[')+0x1,_0x4f9ddd=_0x253752?.[_0x3f4592(0x166)](/\{[\s\S]*?\},/g)||[];if(_0x4f9ddd[_0x3f4592(0x160)]>0x0){const _0x4eccc9=_0x4f9ddd[_0x4f9ddd[_0x3f4592(0x160)]-0x1];if(_0x4eccc9){const _0x503819=_0x57192f[_0x3f4592(0x146)](_0x4eccc9),_0x2a2c95=_0x503819+_0x4eccc9[_0x3f4592(0x160)];return _0x57192f['slice'](0x0,_0x2a2c95)+'\x0a'+_0x47ae54+_0x57192f[_0x3f4592(0x161)](_0x2a2c95);}}return _0x57192f['slice'](0x0,_0x2f45c1)+'\x0a'+_0x47ae54+_0x57192f[_0x3f4592(0x161)](_0x2f45c1);}async[a65_0x5970db(0x147)](_0x30d7c9,_0xac71ff){const _0x88e313=a65_0x5970db;if(!a65_0x1a27a8[_0x88e313(0x13f)](this[_0x88e313(0x15c)]))throw new Error(_0x88e313(0x149)+this[_0x88e313(0x15c)]);const _0x2016fe=await a65_0x1a27a8['promises'][_0x88e313(0x168)](this[_0x88e313(0x15c)],_0x88e313(0x153)),_0xb2fa4c=this['toComponentName'](_0x30d7c9);let _0x1bbb90=this[_0x88e313(0x15f)](_0x2016fe,_0xb2fa4c,_0x30d7c9);return _0x1bbb90=this['addRoute'](_0x1bbb90,_0xac71ff,_0xb2fa4c),_0x1bbb90;}}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x32345d){return new Promise(_0x40b03=>setTimeout(_0x40b03,_0x32345d));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a67_0x1cac4f=a67_0x202d;(function(_0x1d4123,_0x16f3aa){const _0xcf5ea7=a67_0x202d,_0x4842e4=_0x1d4123();while(!![]){try{const _0x3b3cae=parseInt(_0xcf5ea7(0xe8))/0x1+parseInt(_0xcf5ea7(0xb1))/0x2+-parseInt(_0xcf5ea7(0xd2))/0x3*(-parseInt(_0xcf5ea7(0xd1))/0x4)+parseInt(_0xcf5ea7(0xe5))/0x5+-parseInt(_0xcf5ea7(0xbd))/0x6*(parseInt(_0xcf5ea7(0xbe))/0x7)+-parseInt(_0xcf5ea7(0xc3))/0x8+-parseInt(_0xcf5ea7(0xce))/0x9;if(_0x3b3cae===_0x16f3aa)break;else _0x4842e4['push'](_0x4842e4['shift']());}catch(_0x521c72){_0x4842e4['push'](_0x4842e4['shift']());}}}(a67_0x4fb2,0xa8520));import a67_0x13d74c from'node:fs';import a67_0x339bf2 from'node:path';function a67_0x202d(_0x4fed04,_0x6aa1d2){_0x4fed04=_0x4fed04-0xae;const _0x4fb24c=a67_0x4fb2();let _0x202d7e=_0x4fb24c[_0x4fed04];return _0x202d7e;}function a67_0x4fb2(){const _0x3489b8=['1257402OORBsV','name:\x20\x22','.ts','tableName','../../package.json','readdir','join','isDirectory','default','toComponentName','version','replace','552tlmbMc','39550iEksga','name','map','error','.js','5774800umNRIS','tableName:\x20\x22','includes','writeFile','readFile','.css','processFile','numeric','replaceApiContent','slice','replaceContent','13794147MVAaXM','toUpperCase','split','15784Qfhxzd','753DGGWvc','extname','endsWith','toLocaleTimeString','模板内容替换失败','.json','.tsx','alias:\x20\x22','datasetCode','utf8','.tpl','promises','isFile','processTemplate','template','charAt','toLocaleString','message','mkdir','2768475WRieXU','模板内容替换完成','toLowerCase','1290931DtVQYp','.jsx','processDirectory','copyFile','\x20},','toDisplayTitle','datasetCode:\x20\x22','alias','info','开始处理模板内容替换','2-digit','api','now','\x0a\x20\x20\x20\x20{\x20'];a67_0x4fb2=function(){return _0x3489b8;};return a67_0x4fb2();}import{createRequire}from'node:module';import{logger}from'./logger.js';const require=createRequire(import.meta.url),CLI_VERSION=require(a67_0x1cac4f(0xb5))[a67_0x1cac4f(0xbb)];export class TemplateReplacer{static[a67_0x1cac4f(0xba)](_0x4f9704){const _0x261024=a67_0x1cac4f,_0x50ba6f=_0x4f9704[_0x261024(0xd0)]('/')['pop']()||_0x4f9704;return _0x50ba6f[_0x261024(0xd0)]('-')[_0x261024(0xc0)](_0xbe745b=>_0xbe745b['charAt'](0x0)[_0x261024(0xcf)]()+_0xbe745b[_0x261024(0xcc)](0x1)[_0x261024(0xe7)]())[_0x261024(0xb7)]('');}static[a67_0x1cac4f(0xed)](_0x10345c){const _0x5e8fa9=a67_0x1cac4f,_0x2ba814=_0x10345c[_0x5e8fa9(0xd0)]('/')['pop']()||_0x10345c;return _0x2ba814['split']('-')[_0x5e8fa9(0xc0)](_0x222995=>_0x222995[_0x5e8fa9(0xe1)](0x0)['toUpperCase']()+_0x222995[_0x5e8fa9(0xcc)](0x1)[_0x5e8fa9(0xe7)]())['join']('\x20');}static[a67_0x1cac4f(0xcd)](_0xc09c9d,_0x67b7eb,_0x1e12d4){const _0x36530d=a67_0x1cac4f,_0x55481b=this[_0x36530d(0xba)](_0x67b7eb),_0x397b84=this[_0x36530d(0xed)](_0x67b7eb),_0x4c27cf=new Date(),_0x111d7c=_0x4c27cf[_0x36530d(0xe2)](undefined,{'year':'numeric','month':_0x36530d(0xf2),'day':_0x36530d(0xf2),'hour':_0x36530d(0xf2),'minute':'2-digit','second':_0x36530d(0xf2),'hour12':![]})['replace'](/\//g,'-'),_0x214753=_0x4c27cf['toLocaleDateString'](undefined,{'year':_0x36530d(0xca),'month':_0x36530d(0xf2),'day':'2-digit'})['replace'](/\//g,'-'),_0x1f0b40=_0x4c27cf[_0x36530d(0xd5)](undefined,{'hour12':![]});let _0x57277d=_0xc09c9d[_0x36530d(0xbc)](/\{CliVersion\}/g,CLI_VERSION)[_0x36530d(0xbc)](/\{ComponentName\}/g,_0x55481b)['replace'](/\{DisplayTitle\}/g,_0x397b84)[_0x36530d(0xbc)](/\{PageName\}/g,_0x67b7eb)[_0x36530d(0xbc)](/\{TemplateName\}/g,_0x1e12d4)[_0x36530d(0xbc)](/\{CreatedAt\}/g,_0x111d7c)['replace'](/\{CreatedDate\}/g,_0x214753)[_0x36530d(0xbc)](/\{CreatedTime\}/g,_0x1f0b40);return _0x57277d;}static[a67_0x1cac4f(0xcb)](_0x1b0012,_0x23dd6c,_0x4c5ab5,_0x142f9c,_0x486cf1,_0x35745f,_0x4762e6){const _0x4830da=a67_0x1cac4f,_0xd62886=new Date(),_0x4b1c5=_0xd62886['toISOString'](),_0x33deb0=_0x4c5ab5[_0x4830da(0xc0)](_0x4d57e9=>{const _0x19b0c6=_0x4830da,_0x1bcc43=[_0x19b0c6(0xee)+_0x4d57e9[_0x19b0c6(0xda)]+'\x22',_0x19b0c6(0xc4)+_0x4d57e9[_0x19b0c6(0xb4)]+'\x22',_0x19b0c6(0xb2)+_0x4d57e9[_0x19b0c6(0xbf)]+'\x22'];return _0x4d57e9[_0x19b0c6(0xef)]&&_0x1bcc43['push'](_0x19b0c6(0xd9)+_0x4d57e9[_0x19b0c6(0xef)]+'\x22'),_0x19b0c6(0xb0)+_0x1bcc43[_0x19b0c6(0xb7)](',\x20')+_0x19b0c6(0xec);})[_0x4830da(0xb7)](''),_0x453008=_0x142f9c||_0x4c5ab5[0x0]?.[_0x4830da(0xef)]||'YourModel';let _0x23268b=_0x1b0012[_0x4830da(0xbc)](/\{AppCode\}/g,_0x23dd6c)[_0x4830da(0xbc)](/\{ModelConfigs\}/g,_0x33deb0)['replace'](/\{ExampleModelName\}/g,_0x453008)['replace'](/\{ApiFileName\}/g,_0x486cf1||_0x4830da(0xae))[_0x4830da(0xbc)](/\{ConfigName\}/g,_0x35745f||_0x4830da(0xb9))['replace'](/\{ClientConfigParam\}/g,_0x4762e6||'')[_0x4830da(0xbc)](/\{CreatedAt\}/g,_0x4b1c5);return _0x23268b;}static async[a67_0x1cac4f(0xdf)](_0x307763,_0x490e7b,_0x54bb92,_0x30b448,_0x1e50eb=!![]){const _0x2b2be3=a67_0x1cac4f,_0x908c3a=Date[_0x2b2be3(0xaf)]();try{_0x1e50eb&&logger[_0x2b2be3(0xf0)](_0x2b2be3(0xe0),_0x2b2be3(0xf1),{'templatePath':_0x307763,'targetPath':_0x490e7b,'pageName':_0x54bb92,'templateName':_0x30b448});await a67_0x13d74c[_0x2b2be3(0xdd)]['mkdir'](_0x490e7b,{'recursive':!![]}),await this[_0x2b2be3(0xea)](_0x307763,_0x490e7b,_0x54bb92,_0x30b448);if(_0x1e50eb){const _0xbd1c0a=Date[_0x2b2be3(0xaf)]()-_0x908c3a;logger['success'](_0x2b2be3(0xe0),_0x2b2be3(0xe6),_0xbd1c0a,{'pageName':_0x54bb92,'templateName':_0x30b448});}}catch(_0x2fff82){if(_0x1e50eb){const _0x4b0c48=Date[_0x2b2be3(0xaf)]()-_0x908c3a;logger[_0x2b2be3(0xc1)](_0x2b2be3(0xe0),_0x2b2be3(0xd6),{'templatePath':_0x307763,'targetPath':_0x490e7b,'pageName':_0x54bb92,'templateName':_0x30b448,'error':_0x2fff82 instanceof Error?_0x2fff82[_0x2b2be3(0xe3)]:String(_0x2fff82),'duration':_0x4b0c48});}throw _0x2fff82;}}static async[a67_0x1cac4f(0xea)](_0x184d6a,_0x2be10a,_0x996f13,_0x156998){const _0x590dbd=a67_0x1cac4f,_0x43d096=await a67_0x13d74c['promises'][_0x590dbd(0xb6)](_0x184d6a,{'withFileTypes':!![]});for(const _0x363120 of _0x43d096){const _0x25600e=a67_0x339bf2[_0x590dbd(0xb7)](_0x184d6a,_0x363120[_0x590dbd(0xbf)]);let _0x255350=a67_0x339bf2[_0x590dbd(0xb7)](_0x2be10a,_0x363120[_0x590dbd(0xbf)]);_0x363120[_0x590dbd(0xbf)][_0x590dbd(0xd4)](_0x590dbd(0xdc))&&(_0x255350=a67_0x339bf2[_0x590dbd(0xb7)](_0x2be10a,_0x363120[_0x590dbd(0xbf)][_0x590dbd(0xbc)](/\.tpl$/,'')));if(_0x363120[_0x590dbd(0xb8)]())await a67_0x13d74c['promises'][_0x590dbd(0xe4)](_0x255350,{'recursive':!![]}),await this['processDirectory'](_0x25600e,_0x255350,_0x996f13,_0x156998);else _0x363120[_0x590dbd(0xde)]()&&await this[_0x590dbd(0xc9)](_0x25600e,_0x255350,_0x996f13,_0x156998);}}static async[a67_0x1cac4f(0xc9)](_0x2b9696,_0x4babd4,_0x4837df,_0x18643d){const _0x2d3c48=a67_0x1cac4f,_0x184516=a67_0x339bf2[_0x2d3c48(0xd3)](_0x2b9696)['toLowerCase']();_0x2b9696['endsWith']('.tpl')&&(_0x4babd4=_0x4babd4[_0x2d3c48(0xbc)](/\.tpl$/,''));const _0x17de2e=[_0x2d3c48(0xd8),_0x2d3c48(0xb3),_0x2d3c48(0xe9),_0x2d3c48(0xc2),_0x2d3c48(0xd7),'.md',_0x2d3c48(0xc8),'.scss',_0x2d3c48(0xdc)];if(_0x17de2e[_0x2d3c48(0xc5)](_0x184516)||_0x2b9696['endsWith'](_0x2d3c48(0xdc))){const _0x8f39a4=await a67_0x13d74c['promises'][_0x2d3c48(0xc7)](_0x2b9696,'utf8'),_0x2c33e7=this[_0x2d3c48(0xcd)](_0x8f39a4,_0x4837df,_0x18643d);await a67_0x13d74c[_0x2d3c48(0xdd)][_0x2d3c48(0xc6)](_0x4babd4,_0x2c33e7,_0x2d3c48(0xdb));}else await a67_0x13d74c[_0x2d3c48(0xdd)][_0x2d3c48(0xeb)](_0x2b9696,_0x4babd4);}}
|
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 必须先验证字段名与实际表结构匹配
|
|
@@ -236,6 +236,7 @@ lovrabet skill install <ide> # 安装技能包到项目
|
|
|
236
236
|
- `.lovrabet/skill/.shared/guides/04-troubleshooting/guide.md`
|
|
237
237
|
- `.lovrabet/skill/.shared/guides/05-api-integration/guide.md`
|
|
238
238
|
- `.lovrabet/skill/.shared/guides/06-menu-management/guide.md`
|
|
239
|
+
- `.lovrabet/skill/.shared/guides/07-backend-function/guide.md`
|
|
239
240
|
|
|
240
241
|
## MCP 配置说明
|
|
241
242
|
|