@lovrabet/cli 1.3.3 → 1.3.4-beta.0
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/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-flags.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-execa.js +1 -0
- package/lib/cmd/start.js +1 -1
- package/lib/config/config-help.js +1 -1
- package/lib/config/main.js +1 -1
- package/lib/constant/domain.js +1 -1
- package/lib/constant/env.js +1 -1
- package/lib/create-app/enhanced-guided-create.js +1 -1
- package/lib/create-app/format-elapsed.js +1 -1
- package/lib/create-app/main.js +1 -1
- package/lib/create-app/non-interactive.js +1 -1
- package/lib/create-app/task-finished.js +1 -1
- package/lib/create-app/task-loading.js +1 -1
- package/lib/create-app/task-running.js +1 -1
- package/lib/create-app/task-time.js +1 -1
- package/lib/create-app/use-copy-project-template.js +1 -1
- package/lib/create-app/use-format-code.js +1 -1
- package/lib/create-app/use-install-dependencies.js +1 -1
- package/lib/help.js +1 -1
- package/lib/i18n/I18nProvider.js +1 -1
- package/lib/i18n/hooks.js +1 -1
- package/lib/i18n/index.js +1 -1
- package/lib/i18n/locales/en-US.js +1 -1
- package/lib/i18n/locales/zh-CN.js +1 -1
- package/lib/init/main.js +1 -1
- package/lib/mcp/McpInstallUI.js +1 -1
- package/lib/mcp/claude.js +1 -1
- package/lib/mcp/cursor.js +1 -1
- package/lib/mcp/main.js +1 -1
- package/lib/mcp/mcp-install-non-interactive.js +1 -1
- package/lib/mcp/mcp-installer.js +1 -1
- package/lib/skills/SkillInstallUI.js +1 -1
- package/lib/skills/main.js +1 -1
- package/lib/skills/skill-install-non-interactive.js +1 -1
- package/lib/skills/skill-installer.js +1 -1
- package/lib/ui/IDESelector.js +1 -1
- package/lib/ui/useIDESelection.js +1 -1
- package/lib/utils/ai_config.js +1 -1
- package/lib/utils/cdn-config.js +1 -1
- package/lib/utils/check-sdk-version.js +1 -1
- package/lib/utils/cli-version-check.js +1 -1
- package/lib/utils/config.js +1 -1
- package/lib/utils/copy-directory.js +1 -1
- package/lib/utils/file-utils.js +1 -1
- package/lib/utils/guides-cdn.js +1 -1
- package/lib/utils/http-client.js +1 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/rules-cdn.js +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/template-replacer.js +1 -1
- package/package.json +4 -1
- package/templates/README.md +10 -55
- package/lib/add-page/input-page-router.js +0 -1
- package/lib/add-page/main.js +0 -1
- package/lib/add-page/select-page-template.js +0 -1
- package/lib/utils/router-updater.js +0 -1
- package/templates/pages/blank/index.tsx.tpl +0 -13
- package/templates/pages/sdk-fetch/index.tsx.tpl +0 -80
package/lib/utils/ai_config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a71_0x74b9b8=a71_0x115b;(function(_0x50d496,_0x17d715){const _0x2ee957=a71_0x115b,_0x4b19f3=_0x50d496();while(!![]){try{const _0x42e15c=parseInt(_0x2ee957(0x13a))/0x1*(parseInt(_0x2ee957(0x127))/0x2)+-parseInt(_0x2ee957(0x11c))/0x3+parseInt(_0x2ee957(0x11d))/0x4+-parseInt(_0x2ee957(0x115))/0x5+parseInt(_0x2ee957(0x10b))/0x6*(-parseInt(_0x2ee957(0x132))/0x7)+-parseInt(_0x2ee957(0x117))/0x8*(-parseInt(_0x2ee957(0x122))/0x9)+parseInt(_0x2ee957(0x128))/0xa*(parseInt(_0x2ee957(0x133))/0xb);if(_0x42e15c===_0x17d715)break;else _0x4b19f3['push'](_0x4b19f3['shift']());}catch(_0x56aa72){_0x4b19f3['push'](_0x4b19f3['shift']());}}}(a71_0x42ce,0x578db));export const CORE_IDE_CONFIGS={'cursor':{'name':'Cursor','description':a71_0x74b9b8(0x11e),'folders':['.cursorrules','.cursor'],'files':[{'type':a71_0x74b9b8(0x136),'path':a71_0x74b9b8(0x11f),'template':a71_0x74b9b8(0x13d)}]},'windsurf':{'name':'Windsurf','description':'Windsurf\x20IDE','folders':[a71_0x74b9b8(0x12c)],'files':[{'type':'file','path':a71_0x74b9b8(0x131),'template':a71_0x74b9b8(0x13d)}]},'claude':{'name':a71_0x74b9b8(0x12e),'description':a71_0x74b9b8(0x12e),'folders':['.claude'],'files':[{'type':a71_0x74b9b8(0x136),'path':'.claude/skills/lovrabet/SKILL.md','template':'SKILL.md.tpl'}]},'cline':{'name':a71_0x74b9b8(0x112),'description':a71_0x74b9b8(0x139),'folders':['.cline'],'files':[{'type':a71_0x74b9b8(0x136),'path':a71_0x74b9b8(0x13c),'template':a71_0x74b9b8(0x13d)}]},'codex':{'name':a71_0x74b9b8(0x129),'description':a71_0x74b9b8(0x125),'folders':['.codex'],'files':[{'type':a71_0x74b9b8(0x136),'path':'.codex/skills/lovrabet/SKILL.md','template':a71_0x74b9b8(0x13d)}]},'opencode':{'name':a71_0x74b9b8(0x110),'description':a71_0x74b9b8(0x119),'folders':[a71_0x74b9b8(0x138)],'files':[{'type':a71_0x74b9b8(0x136),'path':a71_0x74b9b8(0x12f),'template':a71_0x74b9b8(0x13d)}]},'qoder':{'name':'Qoder','description':a71_0x74b9b8(0x10c),'folders':[a71_0x74b9b8(0x12b)],'files':[{'type':'file','path':a71_0x74b9b8(0x12d),'template':a71_0x74b9b8(0x13d)},{'type':a71_0x74b9b8(0x136),'path':a71_0x74b9b8(0x120),'template':a71_0x74b9b8(0x13d)}]},'codebuddy':{'name':'CodeBuddy','description':a71_0x74b9b8(0x13e),'folders':[a71_0x74b9b8(0x123)],'files':[{'type':a71_0x74b9b8(0x136),'path':a71_0x74b9b8(0x11b),'template':a71_0x74b9b8(0x13d)}]},'trae':{'name':a71_0x74b9b8(0x116),'description':a71_0x74b9b8(0x11a),'folders':[a71_0x74b9b8(0x10f)],'files':[{'type':a71_0x74b9b8(0x136),'path':'.trae/skills/lovrabet/SKILL.md','template':'SKILL.md.tpl'}]}};export const IDE_CONFIGS={...CORE_IDE_CONFIGS,'agent':{'name':a71_0x74b9b8(0x12a),'description':'通用模板\x20-\x20兜底方案','folders':['.agent'],'files':[{'type':'file','path':a71_0x74b9b8(0x118),'template':'SKILL.md.tpl'}]},'antigravity':{'name':'Antigravity','description':a71_0x74b9b8(0x135),'folders':[a71_0x74b9b8(0x113)],'files':[{'type':a71_0x74b9b8(0x136),'path':a71_0x74b9b8(0x118),'template':a71_0x74b9b8(0x13d)}]}};function a71_0x115b(_0x3bdb90,_0x2fcdc1){_0x3bdb90=_0x3bdb90-0x10b;const _0x42ce2e=a71_0x42ce();let _0x115bee=_0x42ce2e[_0x3bdb90];return _0x115bee;}export const CORE_IDE_LIST=[a71_0x74b9b8(0x124),a71_0x74b9b8(0x121),'codebuddy',a71_0x74b9b8(0x114),a71_0x74b9b8(0x134),'opencode','qoder',a71_0x74b9b8(0x13b),'windsurf'];export const IDE_LIST=[a71_0x74b9b8(0x10e),a71_0x74b9b8(0x124),a71_0x74b9b8(0x121),a71_0x74b9b8(0x111),a71_0x74b9b8(0x114),'cursor',a71_0x74b9b8(0x130),'qoder',a71_0x74b9b8(0x13b),a71_0x74b9b8(0x126),a71_0x74b9b8(0x10d)];export const ALL_CORE_IDES=['cursor',a71_0x74b9b8(0x126),'claude','cline',a71_0x74b9b8(0x114),a71_0x74b9b8(0x130),a71_0x74b9b8(0x137),'codebuddy','trae'];function a71_0x42ce(){const _0x4b2d9f=['.qoder/rules/lovrabet.md','Claude\x20Code','.opencode/skills/lovrabet/SKILL.md','opencode','.windsurf/workflows/lovrabet.md','81501DlmBEn','1083269xBsmIM','cursor','Antigravity\x20IDE','file','qoder','.opencode','Cline\x20IDE','47800AbWmrj','trae','.cline/skills/lovrabet/SKILL.md','SKILL.md.tpl','CodeBuddy\x20IDE','342vHijpA','Qoder\x20IDE','agent','antigravity','.trae','OpenCode','codebuddy','Cline','.agent','codex','1640535gJqUFW','Trae','5112YPePBU','.agent/skills/lovrabet/SKILL.md','OpenCode\x20IDE','Trae\x20IDE','.codebuddy/skills/lovrabet/SKILL.md','247764mciuZl','1961300vxyqqy','Cursor\x20IDE','.cursor/skills/lovrabet.md','.qoder/skills/lovrabet/SKILL.md','cline','1791MnTadZ','.codebuddy','claude','Codex\x20IDE','windsurf','30snGrSA','10ZNfgdi','Codex','其他\x20(通用模板)','.qoder','.windsurf'];a71_0x42ce=function(){return _0x4b2d9f;};return a71_0x42ce();}export const MCP_IDES=new Set(['cursor',a71_0x74b9b8(0x124)]);
|
package/lib/utils/cdn-config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x32a08d,_0x257ef9){const _0x3585d1=a72_0x3c2d,_0x1ab3e9=_0x32a08d();while(!![]){try{const _0x929361=-parseInt(_0x3585d1(0xb5))/0x1*(-parseInt(_0x3585d1(0xa6))/0x2)+parseInt(_0x3585d1(0xb9))/0x3*(-parseInt(_0x3585d1(0xb4))/0x4)+parseInt(_0x3585d1(0xad))/0x5+-parseInt(_0x3585d1(0xb2))/0x6*(-parseInt(_0x3585d1(0xa7))/0x7)+parseInt(_0x3585d1(0xaf))/0x8*(parseInt(_0x3585d1(0xb0))/0x9)+-parseInt(_0x3585d1(0xb6))/0xa*(parseInt(_0x3585d1(0xb7))/0xb)+-parseInt(_0x3585d1(0xa8))/0xc*(parseInt(_0x3585d1(0xab))/0xd);if(_0x929361===_0x257ef9)break;else _0x1ab3e9['push'](_0x1ab3e9['shift']());}catch(_0x379ad9){_0x1ab3e9['push'](_0x1ab3e9['shift']());}}}(a72_0x4f73,0xac458));function a72_0x3c2d(_0xd5b042,_0x3b5ffb){_0xd5b042=_0xd5b042-0xa6;const _0x4f731f=a72_0x4f73();let _0x3c2d5e=_0x4f731f[_0xd5b042];return _0x3c2d5e;}import{getTemplateBaseUrl}from'./config.js';export async function fetchCdnConfig(){const _0x225967=a72_0x3c2d;try{const _0x236ae7=getTemplateBaseUrl(),_0x3ba0e7=_0x236ae7+_0x225967(0xae),_0x56995c=await fetch(_0x3ba0e7,{'headers':{'Accept':_0x225967(0xac)}});if(!_0x56995c['ok'])return null;const _0x1feb2c=await _0x56995c[_0x225967(0xa9)]();if(!_0x1feb2c[_0x225967(0xb8)]?.[_0x225967(0xb3)]||!_0x1feb2c[_0x225967(0xb1)]?.[_0x225967(0xaa)]?.['stableVersion'])return null;return _0x1feb2c;}catch{return null;}}let cachedConfig=null,cacheTime=0x0;const CACHE_TTL=0x5*0x3c*0x3e8;function a72_0x4f73(){const _0x5636fb=['sdk','30dUxbYj','stableVersion','1464kOAADk','1nmJVDn','3279460AcjWpr','11nYGbiR','cli','1605kWbDhX','200118TsaOnq','985537Wbtsih','552AbHjgE','json','node','280943Owpinu','application/json','996870xwIdBy','/config.json','157432FjSLTP','558MrRmJI'];a72_0x4f73=function(){return _0x5636fb;};return a72_0x4f73();}export async function getCdnConfig(){const _0x21f81b=Date['now']();if(cachedConfig&&_0x21f81b-cacheTime<CACHE_TTL)return cachedConfig;const _0xd5d257=await fetchCdnConfig();return _0xd5d257&&(cachedConfig=_0xd5d257,cacheTime=_0x21f81b),_0xd5d257;}export function clearCdnConfigCache(){cachedConfig=null,cacheTime=0x0;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a73_0x1e23f9=a73_0x164e;(function(_0x16f4a5,_0x1d99ca){const _0x652b81=a73_0x164e,_0x18f0e1=_0x16f4a5();while(!![]){try{const _0x52f62d=parseInt(_0x652b81(0x160))/0x1+-parseInt(_0x652b81(0x16a))/0x2*(parseInt(_0x652b81(0x15d))/0x3)+-parseInt(_0x652b81(0x159))/0x4*(-parseInt(_0x652b81(0x15e))/0x5)+-parseInt(_0x652b81(0x163))/0x6*(parseInt(_0x652b81(0x155))/0x7)+parseInt(_0x652b81(0x16c))/0x8+parseInt(_0x652b81(0x161))/0x9+-parseInt(_0x652b81(0x151))/0xa;if(_0x52f62d===_0x1d99ca)break;else _0x18f0e1['push'](_0x18f0e1['shift']());}catch(_0x52ffd1){_0x18f0e1['push'](_0x18f0e1['shift']());}}}(a73_0x4c1a,0x7c32a));import a73_0xeeed99 from'node:fs';function a73_0x164e(_0x236f45,_0x4d9432){_0x236f45=_0x236f45-0x149;const _0x4c1a85=a73_0x4c1a();let _0x164e1f=_0x4c1a85[_0x236f45];return _0x164e1f;}import a73_0x2ad3bd from'node:path';import a73_0x3e61a1 from'semver';import{getCdnConfig}from'./cdn-config.js';import a73_0x16e6de from'../i18n/index.js';const t=a73_0x16e6de['t'][a73_0x1e23f9(0x15c)](a73_0x16e6de),FALLBACK_MIN_SDK_VERSION='1.2.0';function isNonNumericVersion(_0xd7092c){const _0x130388=[/^latest$/i,/^beta$/i,/^alpha$/i,/^canary$/i,/^\*$/,/^x$/];return _0x130388['some'](_0x1d0107=>_0x1d0107['test'](_0xd7092c));}function getInstalledVersion(_0x286098,_0x118503){const _0x25ed93=a73_0x1e23f9;try{const _0x53892c=a73_0x2ad3bd[_0x25ed93(0x15a)](_0x286098,_0x25ed93(0x14a),_0x118503,_0x25ed93(0x152));if(a73_0xeeed99['existsSync'](_0x53892c)){const _0x3a9247=JSON[_0x25ed93(0x153)](a73_0xeeed99['readFileSync'](_0x53892c,'utf-8'));return _0x3a9247[_0x25ed93(0x149)]||null;}}catch{}return null;}async function getSdkStableVersion(){const _0x1fa686=a73_0x1e23f9;try{const _0xdbb4c1=await getCdnConfig();return _0xdbb4c1?.[_0x1fa686(0x14b)]?.[_0x1fa686(0x154)]?.[_0x1fa686(0x14d)]||null;}catch{return null;}}async function getSdkPackageName(){const _0x40f4db=a73_0x1e23f9;try{const _0x4390aa=await getCdnConfig();return _0x4390aa?.[_0x40f4db(0x14b)]?.[_0x40f4db(0x154)]?.[_0x40f4db(0x16b)]||_0x40f4db(0x157);}catch{return _0x40f4db(0x157);}}function a73_0x4c1a(){const _0x42dd7f=['upgrade.sdk.current','stableVersion','npm\x20install\x20','readFileSync','dependencies','7221460egiVRM','package.json','parse','node','721TjomCa','upgrade.sdk.stable','@lovrabet/sdk','upgrade.sdk.command','4GMGCrF','join','devDependencies','bind','60iesera','1345915vmIgBG','upgrade.sdk.title','489576cGzzqh','6902100PuHsBF','log','30036bcFnQa','coerce','\x1b[1m','\x1b[0m','existsSync','\x1b[33m','utf8','834HufKAy','packageName','1833272knyQlr','version','node_modules','sdk'];a73_0x4c1a=function(){return _0x42dd7f;};return a73_0x4c1a();}export async function checkSdkVersion(_0x49fb45){const _0x451df6=a73_0x1e23f9,_0x3ec213=a73_0x2ad3bd['join'](_0x49fb45,_0x451df6(0x152)),[_0x59e6c2,_0xdd00d0]=await Promise['all']([getSdkStableVersion(),getSdkPackageName()]),_0xbaac4d=_0x59e6c2||FALLBACK_MIN_SDK_VERSION;if(!a73_0xeeed99[_0x451df6(0x167)](_0x3ec213))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0xbaac4d,'packageName':_0xdd00d0,'stableVersion':_0x59e6c2};try{const _0x14e98f=JSON[_0x451df6(0x153)](a73_0xeeed99[_0x451df6(0x14f)](_0x3ec213,'utf8')),_0x23d98f=_0x14e98f[_0x451df6(0x150)]||{},_0x45cba7=_0x14e98f[_0x451df6(0x15b)]||{},_0x2391a7=_0x23d98f[_0xdd00d0]||_0x45cba7[_0xdd00d0];if(!_0x2391a7)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0xbaac4d,'packageName':_0xdd00d0,'stableVersion':_0x59e6c2};let _0x6d2df4=getInstalledVersion(_0x49fb45,_0xdd00d0);!_0x6d2df4&&(_0x6d2df4=_0x2391a7);if(isNonNumericVersion(_0x2391a7))return{'installed':!![],'version':_0x6d2df4,'needsUpgrade':![],'minVersion':_0xbaac4d,'packageName':_0xdd00d0,'stableVersion':_0x59e6c2};const _0x341239=a73_0x3e61a1[_0x451df6(0x164)](_0x6d2df4),_0x164912=a73_0x3e61a1[_0x451df6(0x164)](_0xbaac4d),_0x2bb276=_0x341239&&_0x164912?a73_0x3e61a1['lt'](_0x341239,_0x164912):![];return{'installed':!![],'version':_0x6d2df4,'needsUpgrade':_0x2bb276,'minVersion':_0xbaac4d,'packageName':_0xdd00d0,'stableVersion':_0x59e6c2};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0xbaac4d,'packageName':_0xdd00d0,'stableVersion':_0x59e6c2};}}export function checkSdkVersionSync(_0x48ce04){const _0x275963=a73_0x1e23f9,_0x4a4f3f=a73_0x2ad3bd[_0x275963(0x15a)](_0x48ce04,_0x275963(0x152)),_0x1bcfdf='@lovrabet/sdk';if(!a73_0xeeed99[_0x275963(0x167)](_0x4a4f3f))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x1bcfdf,'stableVersion':null};try{const _0xbdea37=JSON['parse'](a73_0xeeed99[_0x275963(0x14f)](_0x4a4f3f,_0x275963(0x169))),_0x909ce9=_0xbdea37[_0x275963(0x150)]||{},_0x1c425d=_0xbdea37[_0x275963(0x15b)]||{},_0xf6f6b8=_0x909ce9[_0x1bcfdf]||_0x1c425d[_0x1bcfdf];if(!_0xf6f6b8)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x1bcfdf,'stableVersion':null};let _0xdd1165=getInstalledVersion(_0x48ce04,_0x1bcfdf);!_0xdd1165&&(_0xdd1165=_0xf6f6b8);if(isNonNumericVersion(_0xf6f6b8))return{'installed':!![],'version':_0xdd1165,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x1bcfdf,'stableVersion':null};const _0x46c810=a73_0x3e61a1['coerce'](_0xdd1165),_0x382ae0=_0x46c810?a73_0x3e61a1['lt'](_0x46c810,FALLBACK_MIN_SDK_VERSION):![];return{'installed':!![],'version':_0xdd1165,'needsUpgrade':_0x382ae0,'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x1bcfdf,'stableVersion':null};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x1bcfdf,'stableVersion':null};}}export function printSdkUpgradeWarning(_0x4eb45b){const _0x8e288c=a73_0x1e23f9;if(!_0x4eb45b['needsUpgrade'])return;const _0x3a193e=_0x8e288c(0x168),_0x3f2cbc=_0x8e288c(0x166),_0x3af19a=_0x8e288c(0x165),_0x2ff952=_0x4eb45b['packageName']||_0x8e288c(0x157),_0x8759e0=_0x4eb45b[_0x8e288c(0x14d)]||_0x4eb45b['minVersion'],_0x364114=_0x8e288c(0x14e)+_0x2ff952+'@'+(_0x8759e0||'latest');console[_0x8e288c(0x162)](),console[_0x8e288c(0x162)](''+_0x3a193e+_0x3af19a+t(_0x8e288c(0x15f))+_0x3f2cbc),console['log'](''+_0x3a193e+t(_0x8e288c(0x14c),{'package':_0x2ff952,'version':_0x4eb45b['version']})+_0x3f2cbc),console['log'](''+_0x3a193e+t(_0x8e288c(0x156),{'version':_0x8759e0})+_0x3f2cbc),console[_0x8e288c(0x162)](''+_0x3a193e+t(_0x8e288c(0x158),{'command':_0x364114})+_0x3f2cbc),console[_0x8e288c(0x162)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a74_0x118a85=a74_0x5d85;(function(_0x337728,_0x1761d0){const _0x3387fb=a74_0x5d85,_0x16a2f9=_0x337728();while(!![]){try{const _0x42aac8=-parseInt(_0x3387fb(0x13f))/0x1*(-parseInt(_0x3387fb(0x133))/0x2)+parseInt(_0x3387fb(0x139))/0x3+-parseInt(_0x3387fb(0x145))/0x4*(-parseInt(_0x3387fb(0x14f))/0x5)+-parseInt(_0x3387fb(0x147))/0x6*(parseInt(_0x3387fb(0x14e))/0x7)+-parseInt(_0x3387fb(0x13b))/0x8+-parseInt(_0x3387fb(0x141))/0x9+parseInt(_0x3387fb(0x140))/0xa*(-parseInt(_0x3387fb(0x136))/0xb);if(_0x42aac8===_0x1761d0)break;else _0x16a2f9['push'](_0x16a2f9['shift']());}catch(_0x2205fc){_0x16a2f9['push'](_0x16a2f9['shift']());}}}(a74_0x2b24,0x84394));import{readFileSync}from'node:fs';import{resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import a74_0x2f8539 from'semver';import{getCdnConfig}from'./cdn-config.js';import a74_0x5db28c from'../i18n/index.js';const t=a74_0x5db28c['t'][a74_0x118a85(0x13c)](a74_0x5db28c);function getCurrentCliVersion(){const _0x475f19=a74_0x118a85;try{const _0x2176be=fileURLToPath(import.meta.url),_0xb04173=resolve(dirname(_0x2176be),_0x475f19(0x14a)),_0x310692=resolve(_0xb04173,_0x475f19(0x137)),_0x21f89d=JSON[_0x475f19(0x131)](readFileSync(_0x310692,_0x475f19(0x135)));return _0x21f89d[_0x475f19(0x13e)]||_0x475f19(0x143);}catch{return'1.0.0';}}function a74_0x5d85(_0x216851,_0x4a179b){_0x216851=_0x216851-0x12f;const _0x2b24c5=a74_0x2b24();let _0x5d85cf=_0x2b24c5[_0x216851];return _0x5d85cf;}function isNonNumericVersion(_0xdb38f4){const _0x52e2a6=a74_0x118a85,_0x21941d=[/^latest$/i,/^beta$/i,/^alpha$/i,/^canary$/i,/^\^/,/^~/,/^>/,/^</,/^\*/,/^x$/];return _0x21941d[_0x52e2a6(0x12f)](_0x32d94b=>_0x32d94b[_0x52e2a6(0x14d)](_0xdb38f4));}export async function checkCliVersion(){const _0x5db3cb=a74_0x118a85,_0x2e67d1=getCurrentCliVersion(),_0x10d2da=await getCdnConfig(),_0x2a3a48=_0x10d2da?.[_0x5db3cb(0x14b)]?.[_0x5db3cb(0x13d)]||null;let _0x18e43e=![];if(_0x2a3a48)try{const _0x2796d6=a74_0x2f8539[_0x5db3cb(0x14c)](_0x2e67d1),_0xfd5f86=a74_0x2f8539[_0x5db3cb(0x14c)](_0x2a3a48);_0x2796d6&&_0xfd5f86&&(_0x18e43e=a74_0x2f8539['lt'](_0x2796d6,_0xfd5f86));}catch{_0x18e43e=![];}return{'currentVersion':_0x2e67d1,'stableVersion':_0x2a3a48,'needsUpgrade':_0x18e43e,'isPreRelease':![]};}function a74_0x2b24(){const _0x131eb8=['63900tholSR','some','upgrade.cli.title','parse','upgrade.cli.command','1910882rdYgSx','needsUpgrade','utf-8','7557hIfmxM','package.json','upgrade.cli.current','2318748ylpqRf','currentVersion','2200464tLOhkH','bind','stableVersion','version','1qEXcOk','7960pUSucC','562446VvPENK','\x1b[0m','1.0.0','log','96XKBRjZ','npm\x20install\x20-g\x20@lovrabet/cli@latest','366KRMySm','upgrade.cli.stable','\x1b[33m','../..','cli','coerce','test','69895kalkiU'];a74_0x2b24=function(){return _0x131eb8;};return a74_0x2b24();}export function printCliUpgradeWarning(_0x4ef4b3){const _0x3e97b8=a74_0x118a85;if(!_0x4ef4b3[_0x3e97b8(0x134)])return;const _0x9accc8=_0x3e97b8(0x149),_0x43c450=_0x3e97b8(0x142),_0x10dd54='\x1b[1m',_0x5e71e8=_0x3e97b8(0x146);console[_0x3e97b8(0x144)](),console['log'](''+_0x9accc8+_0x10dd54+t(_0x3e97b8(0x130))+_0x43c450),console[_0x3e97b8(0x144)](''+_0x9accc8+t(_0x3e97b8(0x138),{'version':_0x4ef4b3[_0x3e97b8(0x13a)]})+_0x43c450),console['log'](''+_0x9accc8+t(_0x3e97b8(0x148),{'version':_0x4ef4b3['stableVersion']})+_0x43c450),console['log'](''+_0x9accc8+t(_0x3e97b8(0x132),{'command':_0x5e71e8})+_0x43c450),console[_0x3e97b8(0x144)]();}
|
package/lib/utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a75_0x10b03a=a75_0x49e7;(function(_0x4d8a6f,_0x263080){const _0x2f9667=a75_0x49e7,_0x1e9789=_0x4d8a6f();while(!![]){try{const _0x56072a=-parseInt(_0x2f9667(0x6b))/0x1*(parseInt(_0x2f9667(0x72))/0x2)+parseInt(_0x2f9667(0x6a))/0x3*(-parseInt(_0x2f9667(0x67))/0x4)+parseInt(_0x2f9667(0x69))/0x5+-parseInt(_0x2f9667(0x73))/0x6+parseInt(_0x2f9667(0x66))/0x7+-parseInt(_0x2f9667(0x70))/0x8+parseInt(_0x2f9667(0x6d))/0x9;if(_0x56072a===_0x263080)break;else _0x1e9789['push'](_0x1e9789['shift']());}catch(_0x460323){_0x1e9789['push'](_0x1e9789['shift']());}}}(a75_0x4f82,0x6a859));import{existsSync,readFileSync}from'node:fs';import{resolve}from'node:path';import{homedir}from'node:os';import{initEnv}from'../constant/env.js';export const projectConfigPath=resolve(process[a75_0x10b03a(0x6f)](),a75_0x10b03a(0x76));export const globalConfigPath=resolve(homedir(),a75_0x10b03a(0x76));export function readConfig(_0x3e11eb){const _0x5abbbb=a75_0x10b03a;let _0x47c6b5={};try{if(existsSync(globalConfigPath)){const _0x142ecb=readFileSync(globalConfigPath,{'encoding':_0x5abbbb(0x64)});_0x142ecb&&(_0x47c6b5=JSON[_0x5abbbb(0x77)](_0x142ecb));}}catch(_0x1e0f39){}try{const _0x5ad731=_0x3e11eb?resolve(_0x3e11eb,'.lovrabetrc'):projectConfigPath;if(existsSync(_0x5ad731)){const _0x58b8ae=readFileSync(_0x5ad731,{'encoding':'utf8'});if(_0x58b8ae){const _0x20b70c=JSON[_0x5abbbb(0x77)](_0x58b8ae);_0x47c6b5={..._0x47c6b5,..._0x20b70c};}}}catch(_0x262e94){}return _0x47c6b5[_0x5abbbb(0x6e)]&&typeof _0x47c6b5['env']===_0x5abbbb(0x68)&&initEnv(_0x47c6b5[_0x5abbbb(0x6e)]),_0x47c6b5;}export function getConfigAppCode(){const _0x5df1fb=a75_0x10b03a;let _0x13362a={},_0x2249e0={};try{if(existsSync(globalConfigPath)){const _0x42abdf=readFileSync(globalConfigPath,{'encoding':_0x5df1fb(0x64)});_0x42abdf&&(_0x2249e0=JSON['parse'](_0x42abdf));}}catch(_0x2e8ceb){}try{if(existsSync(projectConfigPath)){const _0x4575fc=readFileSync(projectConfigPath,{'encoding':'utf8'});_0x4575fc&&(_0x13362a=JSON[_0x5df1fb(0x77)](_0x4575fc));}}catch(_0x4f4cec){}let _0x52035e;if('appcode'in _0x13362a)_0x52035e=_0x13362a[_0x5df1fb(0x65)];else{if(_0x5df1fb(0x71)in _0x13362a)_0x52035e=_0x13362a[_0x5df1fb(0x71)];else{if(_0x5df1fb(0x65)in _0x2249e0)_0x52035e=_0x2249e0[_0x5df1fb(0x65)];else _0x5df1fb(0x71)in _0x2249e0&&(_0x52035e=_0x2249e0[_0x5df1fb(0x71)]);}}if(typeof _0x52035e!==_0x5df1fb(0x68)||_0x52035e[_0x5df1fb(0x75)]()==='')return undefined;return _0x52035e;}export function isInProject(){return existsSync(projectConfigPath);}function a75_0x4f82(){const _0x41b9f2=['24663eOgwKg','8poDwgL','template_base_url','14226048QDidhN','env','cwd','1402592SFKsKX','app','193370tIwHio','4533108YKRrPj','https://g.lovrabet.com/dist/lovrabet-cli','trim','.lovrabetrc','parse','utf8','appcode','3441907RrMqON','156UwPXht','string','1944405syLDUP'];a75_0x4f82=function(){return _0x41b9f2;};return a75_0x4f82();}function a75_0x49e7(_0x2c4339,_0x168853){_0x2c4339=_0x2c4339-0x64;const _0x4f8249=a75_0x4f82();let _0x49e74a=_0x4f8249[_0x2c4339];return _0x49e74a;}export function getTemplateBaseUrl(){const _0x2b630b=a75_0x10b03a,_0x57982d=readConfig();if(_0x57982d[_0x2b630b(0x6c)]&&typeof _0x57982d[_0x2b630b(0x6c)]===_0x2b630b(0x68))return _0x57982d['template_base_url']['replace'](/\/$/,'');return _0x2b630b(0x74);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x5bf947,_0x38743e){const _0x310eeb=a76_0x53ad,_0x37edd6=_0x5bf947();while(!![]){try{const _0x2ffa17=-parseInt(_0x310eeb(0x7e))/0x1+parseInt(_0x310eeb(0x7c))/0x2+-parseInt(_0x310eeb(0x7f))/0x3+-parseInt(_0x310eeb(0x85))/0x4*(-parseInt(_0x310eeb(0x78))/0x5)+parseInt(_0x310eeb(0x83))/0x6*(parseInt(_0x310eeb(0x81))/0x7)+-parseInt(_0x310eeb(0x7d))/0x8+parseInt(_0x310eeb(0x7a))/0x9;if(_0x2ffa17===_0x38743e)break;else _0x37edd6['push'](_0x37edd6['shift']());}catch(_0x3bdfd0){_0x37edd6['push'](_0x37edd6['shift']());}}}(a76_0x33fe,0x690ca));import a76_0x223ee3 from'node:path';import a76_0xc270eb from'node:fs';function a76_0x53ad(_0x3ba3f5,_0x5a8d8a){_0x3ba3f5=_0x3ba3f5-0x77;const _0x33fe19=a76_0x33fe();let _0x53addc=_0x33fe19[_0x3ba3f5];return _0x53addc;}function a76_0x33fe(){const _0x399b49=['copyFileSync','2152fUCDXU','name','6085dEotyF','join','4951197lCnhjo','复制目录时出错:','1448292BjxGNB','6791384ipXvdX','182588QEHJTb','1588023SXZdET','error','63EiKYSN','isDirectory','41406nVakxS'];a76_0x33fe=function(){return _0x399b49;};return a76_0x33fe();}export async function copyDirectory(_0x357167,_0x466276){const _0x1f07b2=a76_0x53ad;try{const _0x2cd4de=a76_0xc270eb['readdirSync'](_0x357167,{'withFileTypes':!![]});a76_0xc270eb['mkdirSync'](_0x466276,{'recursive':!![]});for(const _0x53ff2b of _0x2cd4de){const _0x2cd34e=a76_0x223ee3[_0x1f07b2(0x79)](_0x357167,_0x53ff2b[_0x1f07b2(0x77)]),_0x34d434=a76_0x223ee3[_0x1f07b2(0x79)](_0x466276,_0x53ff2b[_0x1f07b2(0x77)]);_0x53ff2b[_0x1f07b2(0x82)]()?await copyDirectory(_0x2cd34e,_0x34d434):a76_0xc270eb[_0x1f07b2(0x84)](_0x2cd34e,_0x34d434);}}catch(_0x2c236){console[_0x1f07b2(0x80)](_0x1f07b2(0x7b),_0x2c236);}}
|
package/lib/utils/file-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4d5935,_0x43ac8e){const _0x488a66=a77_0x3e31,_0x1e2cdd=_0x4d5935();while(!![]){try{const _0x111c96=parseInt(_0x488a66(0x126))/0x1*(-parseInt(_0x488a66(0x123))/0x2)+parseInt(_0x488a66(0x11f))/0x3+-parseInt(_0x488a66(0x129))/0x4*(parseInt(_0x488a66(0x128))/0x5)+parseInt(_0x488a66(0x124))/0x6+-parseInt(_0x488a66(0x11e))/0x7*(-parseInt(_0x488a66(0x127))/0x8)+parseInt(_0x488a66(0x122))/0x9*(parseInt(_0x488a66(0x121))/0xa)+-parseInt(_0x488a66(0x120))/0xb*(parseInt(_0x488a66(0x125))/0xc);if(_0x111c96===_0x43ac8e)break;else _0x1e2cdd['push'](_0x1e2cdd['shift']());}catch(_0x40dc64){_0x1e2cdd['push'](_0x1e2cdd['shift']());}}}(a77_0x4174,0xafee5));import{existsSync,mkdirSync,copyFileSync,readdirSync,statSync}from'node:fs';import{join}from'node:path';export async function copyDir(_0x182df5,_0x2eb547){const _0x172d2e=statSync(_0x182df5);if(_0x172d2e['isDirectory']()){!existsSync(_0x2eb547)&&mkdirSync(_0x2eb547,{'recursive':!![]});const _0x5e795d=readdirSync(_0x182df5);for(const _0x59f605 of _0x5e795d){await copyDir(join(_0x182df5,_0x59f605),join(_0x2eb547,_0x59f605));}}else copyFileSync(_0x182df5,_0x2eb547);}function a77_0x4174(){const _0x481a7d=['586564ssuhvr','493300Emnqqt','234pjDMJZ','747896MhTmpG','7218084dQZcTg','108Vmgkyd','2YFXiIK','635288hXJFgA','165KpisVg','153528VHUlXA','28QcPBKC','1235379MgAiEz'];a77_0x4174=function(){return _0x481a7d;};return a77_0x4174();}function a77_0x3e31(_0x1ead6e,_0x5ce852){_0x1ead6e=_0x1ead6e-0x11e;const _0x417417=a77_0x4174();let _0x3e311f=_0x417417[_0x1ead6e];return _0x3e311f;}export function ensureDir(_0x52026f){!existsSync(_0x52026f)&&mkdirSync(_0x52026f,{'recursive':!![]});}export function pathExists(_0x148b50){return existsSync(_0x148b50);}
|
package/lib/utils/guides-cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a78_0x1ddbee=a78_0x488a;(function(_0x51c1ef,_0x4e5761){const _0x48e9d9=a78_0x488a,_0x4e13c5=_0x51c1ef();while(!![]){try{const _0x2840b7=-parseInt(_0x48e9d9(0x114))/0x1+-parseInt(_0x48e9d9(0x104))/0x2*(parseInt(_0x48e9d9(0xf3))/0x3)+parseInt(_0x48e9d9(0x110))/0x4+-parseInt(_0x48e9d9(0x10e))/0x5+parseInt(_0x48e9d9(0xee))/0x6*(-parseInt(_0x48e9d9(0x116))/0x7)+parseInt(_0x48e9d9(0xf5))/0x8*(-parseInt(_0x48e9d9(0xf4))/0x9)+-parseInt(_0x48e9d9(0x10c))/0xa*(-parseInt(_0x48e9d9(0xfd))/0xb);if(_0x2840b7===_0x4e5761)break;else _0x4e13c5['push'](_0x4e13c5['shift']());}catch(_0x2dd3a4){_0x4e13c5['push'](_0x4e13c5['shift']());}}}(a78_0x561c,0x4819f));import{mkdirSync,writeFileSync}from'node:fs';import{dirname,join}from'node:path';import{getTemplateBaseUrl}from'./config.js';function getGuidesCdnUrl(){const _0x3d1a0c=a78_0x488a,_0x3b2a1e=getTemplateBaseUrl();return _0x3b2a1e+_0x3d1a0c(0x105);}function getGuidesExtendCdnUrl(){const _0x54ab48=a78_0x488a,_0x31add2=getTemplateBaseUrl();return _0x31add2+_0x54ab48(0xe8);}function a78_0x488a(_0x1684b9,_0x5f3e93){_0x1684b9=_0x1684b9-0xe6;const _0x561c73=a78_0x561c();let _0x488a80=_0x561c73[_0x1684b9];return _0x488a80;}const CACHE_DIR=join(process[a78_0x1ddbee(0x115)]['HOME']||process[a78_0x1ddbee(0x115)][a78_0x1ddbee(0xea)]||'','.lovrabet',a78_0x1ddbee(0x10d));export async function fetchGuidesFromCDN(_0x58e6b5=![]){const _0x436b6f=a78_0x1ddbee,_0x17b9d2=getGuidesCdnUrl(),_0x5d0946=await fetch(_0x17b9d2,{'headers':{'Accept':'application/json'}});if(!_0x5d0946['ok'])throw new Error(_0x436b6f(0x112)+_0x5d0946['status']+'\x20'+_0x5d0946[_0x436b6f(0x10f)]);const _0x32d85e=await _0x5d0946[_0x436b6f(0xfc)]();if(!_0x32d85e['guides']||typeof _0x32d85e[_0x436b6f(0x10b)]!==_0x436b6f(0x108))throw new Error('CDN\x20返回数据格式错误');if(!_0x58e6b5)return _0x32d85e;try{const _0x2155a7=getGuidesExtendCdnUrl(),_0x5d3eae=await fetch(_0x2155a7,{'headers':{'Accept':_0x436b6f(0x102)}});if(_0x5d3eae['ok']){const _0x51e704=await _0x5d3eae[_0x436b6f(0xfc)]();_0x51e704['guides']&&typeof _0x51e704[_0x436b6f(0x10b)]===_0x436b6f(0x108)&&(_0x32d85e[_0x436b6f(0x10b)]={..._0x32d85e[_0x436b6f(0x10b)],..._0x51e704[_0x436b6f(0x10b)]});}}catch{}return _0x32d85e;}export function writeGuidesToProject(_0x350524,_0x299384,_0x81de99=a78_0x1ddbee(0xeb),_0x288ee1){const _0x564d1c=a78_0x1ddbee,_0x3949dd=join(_0x299384,_0x81de99);for(const [_0x3caba2,_0x41d292]of Object[_0x564d1c(0xfe)](_0x350524[_0x564d1c(0x10b)])){if(_0x41d292[_0x564d1c(0x10a)]&&_0x41d292[_0x564d1c(0x10a)][_0x564d1c(0xf8)]>0x0){const _0x395b0d=_0x41d292['requireFlags'][_0x564d1c(0xff)](_0x4ce180=>_0x288ee1?.[_0x564d1c(0x101)](_0x4ce180));if(!_0x395b0d)continue;}const _0x417d52=join(_0x3949dd,_0x3caba2);mkdirSync(_0x417d52,{'recursive':!![]});let _0x3461ed=_0x41d292[_0x564d1c(0xec)];_0x41d292[_0x564d1c(0xf2)]&&(_0x3461ed=appendUpdateTime(_0x3461ed,_0x41d292['lastUpdated'])),writeFileSync(join(_0x417d52,_0x564d1c(0xe7)),_0x3461ed,_0x564d1c(0xf6));}}export function appendUpdateTime(_0x171447,_0x5ab9b3){const _0x521819=a78_0x1ddbee;return _0x171447=_0x171447['replace'](/\n*>更新时间:.*$/m,''),_0x171447['trimEnd']()+(_0x521819(0xef)+_0x5ab9b3);}function a78_0x561c(){const _0x5cfb68=['entries','some','join','includes','application/json','trimEnd','46EEUImm','/skills/guides.json','title','replace','object','`\x20|\x20','requireFlags','guides','10dGGIFe','cache','1274635eNtKXI','statusText','736560oYGcsv','keys','CDN\x20请求失败:\x20','<!--\x20GUIDES_APPEND\x20-->','50290PLqlRP','env','2916767qVBIgr','test','guide.md','/skills/guides-extend.json','skillTemplate','USERPROFILE','.lovrabet/skill/.shared/guides','content','\x0a<!--\x20GUIDES_APPEND\x20-->','6srvrdH','\x0a\x0a>更新时间:','map','indexOf','lastUpdated','7251NNgizI','666evnXSj','57576FgzknW','utf-8','|\x20`','length','extendContent','path','sort','json','15633794qROwbx'];a78_0x561c=function(){return _0x5cfb68;};return a78_0x561c();}export function getSkillTemplate(_0x587ff4){const _0x579974=a78_0x1ddbee;return _0x587ff4[_0x579974(0xe9)]?.[_0x579974(0xec)]||'';}export function appendExtendContents(_0x4a75fe,_0x5440f7,_0x5365ed){const _0x4204a1=a78_0x1ddbee,_0x46ce24=[];for(const [_0x103a8f,_0x45cc89]of Object['entries'](_0x5440f7[_0x4204a1(0x10b)])){if(_0x45cc89[_0x4204a1(0x10a)]&&_0x45cc89['requireFlags'][_0x4204a1(0xf8)]>0x0){const _0x5b1cd7=_0x45cc89[_0x4204a1(0x10a)]['some'](_0x357071=>_0x5365ed?.[_0x4204a1(0x101)](_0x357071));if(!_0x5b1cd7)continue;}_0x45cc89[_0x4204a1(0xf9)]&&_0x46ce24['push'](_0x45cc89[_0x4204a1(0xf9)][_0x4204a1(0x103)]());}if(_0x46ce24[_0x4204a1(0xf8)]===0x0)return _0x4a75fe;return _0x4a75fe[_0x4204a1(0x103)]()+'\x0a\x0a'+_0x46ce24['join']('\x0a\x0a')+'\x0a';}export function writeSkillFile(_0x5dd1da,_0x35cf5d,_0x5623f1,_0x48f240){const _0x3f32b0=a78_0x1ddbee,_0x160a1f=getSkillTemplate(_0x5dd1da);if(!_0x160a1f)throw new Error('CDN\x20数据中缺少\x20skillTemplate');const _0x53f2b1=dirname(_0x35cf5d);mkdirSync(_0x53f2b1,{'recursive':!![]});let _0x29c276=_0x160a1f[_0x3f32b0(0x107)](/\{\{IDE_NAME\}\}/g,_0x5623f1);_0x29c276=insertGuidesSection(_0x29c276,_0x5dd1da,_0x48f240),_0x29c276=appendExtendContents(_0x29c276,_0x5dd1da,_0x48f240),_0x5dd1da[_0x3f32b0(0xe9)][_0x3f32b0(0xf2)]&&(_0x29c276=appendUpdateTime(_0x29c276,_0x5dd1da[_0x3f32b0(0xe9)]['lastUpdated'])),writeFileSync(_0x35cf5d,_0x29c276,_0x3f32b0(0xf6));}export function insertGuidesSection(_0x545adb,_0x3c635d,_0x40bf67){const _0x3649a2=a78_0x1ddbee,_0x1d8a91=_0x3649a2(0x113),_0x3e0bf6=_0x545adb[_0x3649a2(0xf1)](_0x1d8a91);if(_0x3e0bf6===-0x1)return _0x545adb;const _0x2fba37=[],_0x3b6f87=Object[_0x3649a2(0x111)](_0x3c635d[_0x3649a2(0x10b)])[_0x3649a2(0xfb)]();for(const _0x2e8a48 of _0x3b6f87){const _0xb85744=_0x3c635d[_0x3649a2(0x10b)][_0x2e8a48];if(!_0xb85744)continue;if(/^0[1-6]-/[_0x3649a2(0xe6)](_0x2e8a48))continue;if(_0xb85744[_0x3649a2(0x10a)]&&_0xb85744[_0x3649a2(0x10a)][_0x3649a2(0xf8)]>0x0){const _0x49b9e2=_0xb85744['requireFlags'][_0x3649a2(0xff)](_0xca07f4=>_0x40bf67?.['includes'](_0xca07f4));if(!_0x49b9e2)continue;}const _0x5f047a=_0xb85744[_0x3649a2(0xfa)][_0x3649a2(0x107)](/^\.lovrabet\/skill\/\.shared\/guides\//,'');_0x2fba37['push'](_0x3649a2(0xf7)+_0x5f047a+_0x3649a2(0x109)+_0xb85744['title']+'\x20|');}if(_0x2fba37[_0x3649a2(0xf8)]===0x0)return _0x545adb['replace'](_0x1d8a91,_0x3649a2(0x113));const _0x3255dc=_0x2fba37[_0x3649a2(0x100)]('\x0a');return _0x545adb[_0x3649a2(0x107)](_0x1d8a91,_0x3255dc+_0x3649a2(0xed));}export async function installGuides(_0x150819){const _0x4d64a7=a78_0x1ddbee,_0x5540a5=await fetchGuidesFromCDN();return writeGuidesToProject(_0x5540a5,_0x150819),Object[_0x4d64a7(0x111)](_0x5540a5[_0x4d64a7(0x10b)])['length'];}export function getGuidesSummary(_0x48c08a){const _0x1e58eb=a78_0x1ddbee;return Object[_0x1e58eb(0xfe)](_0x48c08a[_0x1e58eb(0x10b)])[_0x1e58eb(0xf0)](([_0x4e2709,_0x49a758])=>({'key':_0x4e2709,'title':_0x49a758[_0x1e58eb(0x106)],'path':_0x49a758[_0x1e58eb(0xfa)]}));}
|
package/lib/utils/http-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x1ebdcd,_0x1165de){const _0x35eeb4=a79_0x345f,_0x29b0e9=_0x1ebdcd();while(!![]){try{const _0x151b29=-parseInt(_0x35eeb4(0xf0))/0x1*(parseInt(_0x35eeb4(0xfd))/0x2)+parseInt(_0x35eeb4(0xea))/0x3+parseInt(_0x35eeb4(0xf8))/0x4+parseInt(_0x35eeb4(0xf2))/0x5+parseInt(_0x35eeb4(0xfc))/0x6+-parseInt(_0x35eeb4(0x100))/0x7+-parseInt(_0x35eeb4(0xf5))/0x8*(parseInt(_0x35eeb4(0xf7))/0x9);if(_0x151b29===_0x1165de)break;else _0x29b0e9['push'](_0x29b0e9['shift']());}catch(_0x4de681){_0x29b0e9['push'](_0x29b0e9['shift']());}}}(a79_0x3b45,0xa7a67));export async function httpRequest(_0x8338,_0x254ed8={}){const _0x1760df=a79_0x345f,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x254ed8;let _0x3f335c=null;for(let _0x2b244a=0x0;_0x2b244a<=retries;_0x2b244a++){try{const _0x2a1c3b=new AbortController(),_0x40a71a=setTimeout(()=>_0x2a1c3b[_0x1760df(0xee)](),timeout),_0x30505d=await fetch(_0x8338,{'headers':headers,'signal':_0x2a1c3b['signal']});clearTimeout(_0x40a71a);let _0x3d2ca2;const _0x581c78=_0x30505d[_0x1760df(0xed)][_0x1760df(0xef)]('content-type');return _0x581c78?.['includes']('application/json')?_0x3d2ca2=await _0x30505d[_0x1760df(0xf1)]():_0x3d2ca2=await _0x30505d[_0x1760df(0xf3)](),{'ok':_0x30505d['ok'],'status':_0x30505d['status'],'statusText':_0x30505d[_0x1760df(0xfa)],'data':_0x3d2ca2,'headers':_0x30505d[_0x1760df(0xed)],'url':_0x30505d[_0x1760df(0xff)],'text':()=>_0x30505d[_0x1760df(0xf3)]()};}catch(_0x1c107a){_0x3f335c=_0x1c107a instanceof Error?_0x1c107a:new Error(String(_0x1c107a));if(_0x2b244a===retries)break;if(shouldRetry(_0x1c107a)){console['log'](_0x1760df(0xeb)+retryDelay+_0x1760df(0xf6)+(_0x2b244a+0x1)+_0x1760df(0xfe)),await sleep(retryDelay);continue;}else break;}}throw _0x3f335c||new Error('Request\x20failed');}function a79_0x345f(_0x3445a3,_0x37a8b8){_0x3445a3=_0x3445a3-0xea;const _0x3b453d=a79_0x3b45();let _0x345fd8=_0x3b453d[_0x3445a3];return _0x345fd8;}function shouldRetry(_0xe17a15){const _0x2d8be6=a79_0x345f;if(_0xe17a15 instanceof Error){if(_0xe17a15[_0x2d8be6(0xf4)]===_0x2d8be6(0x103))return![];if(_0xe17a15[_0x2d8be6(0xf4)]===_0x2d8be6(0x101)&&_0xe17a15[_0x2d8be6(0xfb)]['includes'](_0x2d8be6(0x102)))return!![];if(_0xe17a15[_0x2d8be6(0xfb)][_0x2d8be6(0xec)](_0x2d8be6(0x104)))return!![];if(_0xe17a15['message'][_0x2d8be6(0xec)](_0x2d8be6(0xf9)))return![];}return![];}function sleep(_0x12608a){return new Promise(_0x463e1a=>setTimeout(_0x463e1a,_0x12608a));}export function validateUrl(_0x51f1cb){try{return new URL(_0x51f1cb),!![];}catch{return![];}}function a79_0x3b45(){const _0x5cf721=['statusText','message','4424988RYeLwR','15002CYbhiI','\x20次重试...','url','3708824ZqYXMT','TypeError','fetch','AbortError','ECONNRESET','3640473OsonrB','*\x20请求失败,','includes','headers','abort','get','34MwpADc','json','6179490zrFyrQ','text','name','30288SPrdzm','ms\x20后进行第\x20','6030KgJxlf','3285176YIyLZv','ENOTFOUND'];a79_0x3b45=function(){return _0x5cf721;};return a79_0x3b45();}
|
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a80_0x4451c8=a80_0x1e5d;(function(_0x57229e,_0x45eaa9){const _0x3d4e86=a80_0x1e5d,_0x436ad8=_0x57229e();while(!![]){try{const _0x4361ae=-parseInt(_0x3d4e86(0x76))/0x1+parseInt(_0x3d4e86(0x69))/0x2*(parseInt(_0x3d4e86(0x8d))/0x3)+parseInt(_0x3d4e86(0x95))/0x4+-parseInt(_0x3d4e86(0x73))/0x5+parseInt(_0x3d4e86(0x6d))/0x6*(-parseInt(_0x3d4e86(0x87))/0x7)+parseInt(_0x3d4e86(0x77))/0x8+parseInt(_0x3d4e86(0x90))/0x9;if(_0x4361ae===_0x45eaa9)break;else _0x436ad8['push'](_0x436ad8['shift']());}catch(_0x5bb0d6){_0x436ad8['push'](_0x436ad8['shift']());}}}(a80_0x509e,0xe31f2));import a80_0x2580a2 from'winston';function a80_0x509e(){const _0x47b3ff=['getWinstonInstance','details','writeFileSync','clear','currentRawCommand','success','logFilePath','addColors','timestamp','2xFEIKA','errors','createLogger','initWinstonLogger','42IFsRPc','now','readFileSync','info','filter','transports','5270515cGetIX','format','winstonLogger','1587460fIhehA','2274224VyLaQG','setRawCommand','.lovrabet.log','readLogs','error','split','message','utf8','green','blue','失败:\x20','map','开始执行:\x20','clearLogs','logTask','red','1754543cZDHUY','printf','join','warn','File','log','1506390mhKUeT','完成:\x20','existsSync','37279485YEyIoK','mkdirSync','toISOString','trim','rawCommand','1591292BuuDSq'];a80_0x509e=function(){return _0x47b3ff;};return a80_0x509e();}function a80_0x1e5d(_0x476571,_0x402d4e){_0x476571=_0x476571-0x66;const _0x509e32=a80_0x509e();let _0x1e5d9c=_0x509e32[_0x476571];return _0x1e5d9c;}import a80_0x205377 from'node:fs';import a80_0x473284 from'node:path';class Logger{[a80_0x4451c8(0x75)];[a80_0x4451c8(0x66)];['currentRawCommand']='';constructor(){const _0x38af4e=a80_0x4451c8;this[_0x38af4e(0x66)]='';}[a80_0x4451c8(0x78)](_0x29723c){const _0x62e81a=a80_0x4451c8;this[_0x62e81a(0x9a)]=_0x29723c;}[a80_0x4451c8(0x6c)](){const _0x722f75=a80_0x4451c8,_0x51d9ac=a80_0x473284['dirname'](this[_0x722f75(0x66)]);!a80_0x205377[_0x722f75(0x8f)](_0x51d9ac)&&a80_0x205377[_0x722f75(0x91)](_0x51d9ac,{'recursive':!![]});const _0x2c068e=a80_0x2580a2[_0x722f75(0x74)]['combine'](a80_0x2580a2[_0x722f75(0x74)][_0x722f75(0x68)](),a80_0x2580a2['format'][_0x722f75(0x6a)]({'stack':!![]}),a80_0x2580a2[_0x722f75(0x74)][_0x722f75(0x88)](_0x20825e=>{const _0xf3375d=_0x722f75,_0x57cdf1={'timestamp':_0x20825e[_0xf3375d(0x68)]||new Date()[_0xf3375d(0x92)](),'level':_0x20825e['level']||_0xf3375d(0x70),'command':_0x20825e['command']||'unknown','rawCommand':_0x20825e[_0xf3375d(0x94)]||this[_0xf3375d(0x9a)]||undefined,'message':_0x20825e[_0xf3375d(0x7d)]||'','duration':_0x20825e['duration']||undefined,'details':_0x20825e[_0xf3375d(0x97)]||undefined};return JSON['stringify'](_0x57cdf1);}));this[_0x722f75(0x75)]=a80_0x2580a2[_0x722f75(0x6b)]({'level':_0x722f75(0x70),'format':_0x2c068e,'transports':[new a80_0x2580a2[(_0x722f75(0x72))][(_0x722f75(0x8b))]({'filename':this[_0x722f75(0x66)],'level':'info'})],'silent':![]}),a80_0x2580a2[_0x722f75(0x67)]({'success':_0x722f75(0x7f),'error':_0x722f75(0x86),'warn':'yellow','info':_0x722f75(0x80)});}['setLogPath'](_0x1c0794){const _0x528747=a80_0x4451c8;this[_0x528747(0x66)]=a80_0x473284[_0x528747(0x89)](_0x1c0794,_0x528747(0x79)),this[_0x528747(0x75)]&&this['winstonLogger'][_0x528747(0x99)](),this[_0x528747(0x6c)]();}[a80_0x4451c8(0x70)](_0x59af71,_0x5d33d9,_0x145878){const _0x18952d=a80_0x4451c8;if(!this['logFilePath']||!this[_0x18952d(0x75)])return;this['winstonLogger'][_0x18952d(0x70)](_0x5d33d9,{'command':_0x59af71,'details':_0x145878});}[a80_0x4451c8(0x9b)](_0x28b2a8,_0x2ed5c7,_0x1ed853,_0x1e7a54){const _0x4caeae=a80_0x4451c8;if(!this['logFilePath']||!this['winstonLogger'])return;this[_0x4caeae(0x75)][_0x4caeae(0x8c)](_0x4caeae(0x70),_0x2ed5c7,{'level':_0x4caeae(0x9b),'command':_0x28b2a8,'duration':_0x1ed853,'details':_0x1e7a54});}[a80_0x4451c8(0x7b)](_0x4fa609,_0x36d327,_0x5ec1cb){const _0x301a04=a80_0x4451c8;if(!this[_0x301a04(0x66)]||!this[_0x301a04(0x75)])return;this[_0x301a04(0x75)]['error'](_0x36d327,{'command':_0x4fa609,'details':_0x5ec1cb});}[a80_0x4451c8(0x8a)](_0x17d66c,_0x12530b,_0x2bc158){const _0x522c51=a80_0x4451c8;if(!this[_0x522c51(0x66)]||!this[_0x522c51(0x75)])return;this[_0x522c51(0x75)][_0x522c51(0x8a)](_0x12530b,{'command':_0x17d66c,'details':_0x2bc158});}async[a80_0x4451c8(0x85)](_0x2b7ab6,_0x4999d5,_0x9c4095){const _0x275f55=a80_0x4451c8,_0x3557fa=Date[_0x275f55(0x6e)]();this['info'](_0x2b7ab6,_0x275f55(0x83)+_0x4999d5);try{const _0x476913=await _0x9c4095(),_0x101cbf=Date[_0x275f55(0x6e)]()-_0x3557fa;return this[_0x275f55(0x9b)](_0x2b7ab6,_0x275f55(0x8e)+_0x4999d5,_0x101cbf),_0x476913;}catch(_0x22b620){const _0x596478=Date[_0x275f55(0x6e)]()-_0x3557fa;this['error'](_0x2b7ab6,_0x275f55(0x81)+_0x4999d5,{'error':_0x22b620 instanceof Error?_0x22b620[_0x275f55(0x7d)]:String(_0x22b620),'duration':_0x596478});throw _0x22b620;}}[a80_0x4451c8(0x7a)](){const _0x57707c=a80_0x4451c8;try{if(!a80_0x205377[_0x57707c(0x8f)](this['logFilePath']))return[];const _0x15206a=a80_0x205377[_0x57707c(0x6f)](this[_0x57707c(0x66)],_0x57707c(0x7e));return _0x15206a[_0x57707c(0x7c)]('\x0a')[_0x57707c(0x71)](_0x102ea3=>_0x102ea3[_0x57707c(0x93)]())[_0x57707c(0x82)](_0x1bc1a7=>JSON['parse'](_0x1bc1a7));}catch(_0x3212b3){return console[_0x57707c(0x8a)]('Failed\x20to\x20read\x20logs:',_0x3212b3),[];}}[a80_0x4451c8(0x84)](){const _0xae559d=a80_0x4451c8;try{a80_0x205377['existsSync'](this[_0xae559d(0x66)])&&a80_0x205377[_0xae559d(0x98)](this[_0xae559d(0x66)],'',_0xae559d(0x7e));}catch(_0x208784){console[_0xae559d(0x8a)]('Failed\x20to\x20clear\x20logs:',_0x208784);}}[a80_0x4451c8(0x96)](){const _0x13f17b=a80_0x4451c8;return this[_0x13f17b(0x75)];}}export const logger=new Logger();
|
package/lib/utils/rules-cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a81_0x293839=a81_0x2002;(function(_0x40988a,_0x328125){const _0x3aed10=a81_0x2002,_0xc1319b=_0x40988a();while(!![]){try{const _0x55fe3e=-parseInt(_0x3aed10(0x94))/0x1+parseInt(_0x3aed10(0x97))/0x2*(parseInt(_0x3aed10(0x9e))/0x3)+-parseInt(_0x3aed10(0x9f))/0x4*(parseInt(_0x3aed10(0x96))/0x5)+parseInt(_0x3aed10(0x9a))/0x6+-parseInt(_0x3aed10(0xa1))/0x7*(parseInt(_0x3aed10(0x98))/0x8)+parseInt(_0x3aed10(0x95))/0x9*(parseInt(_0x3aed10(0x93))/0xa)+parseInt(_0x3aed10(0xa3))/0xb*(parseInt(_0x3aed10(0xa0))/0xc);if(_0x55fe3e===_0x328125)break;else _0xc1319b['push'](_0xc1319b['shift']());}catch(_0x2254d0){_0xc1319b['push'](_0xc1319b['shift']());}}}(a81_0x4f6b,0x6118e));import{existsSync,mkdirSync,readFileSync,writeFileSync}from'node:fs';import{dirname,join,resolve}from'node:path';function a81_0x4f6b(){const _0x414503=['CDN\x20返回数据格式错误','content','126657QSQgIV','4YVOSad','918444ZQFvqx','2291086poBZyW','string','66EYsraI','catch','CDN\x20请求失败:\x20','status','utf-8','application/json','agents.md','.cursor/rules','statusText','690QcLoUn','735649oSrwKb','100053WhpVlN','1394245DvhMrt','6GutBHh','16xpBIWR','lastUpdated','4283112WVlCmQ','../../cdn-source/rules/lovrabet_rules.mdc.tpl'];a81_0x4f6b=function(){return _0x414503;};return a81_0x4f6b();}import{fileURLToPath}from'node:url';import{getTemplateBaseUrl}from'./config.js';import{appendUpdateTime}from'./guides-cdn.js';function a81_0x2002(_0x5bd37d,_0x536305){_0x5bd37d=_0x5bd37d-0x8f;const _0x4f6b90=a81_0x4f6b();let _0x2002fa=_0x4f6b90[_0x5bd37d];return _0x2002fa;}const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);function getRulesCdnUrl(){const _0xe92173=getTemplateBaseUrl();return _0xe92173+'/rules/rules.json';}const LOCAL_TEMPLATE_PATH=resolve(__dirname,a81_0x293839(0x9b));export async function fetchRulesFromCDN(){const _0x56e111=a81_0x293839,_0x126f32=getRulesCdnUrl(),_0x100988=await fetch(_0x126f32,{'headers':{'Accept':_0x56e111(0x8f)}});if(!_0x100988['ok'])throw new Error(_0x56e111(0xa5)+_0x100988[_0x56e111(0xa6)]+'\x20'+_0x100988[_0x56e111(0x92)]);const _0x4aecbe=await _0x100988['json']();if(!_0x4aecbe['content']||typeof _0x4aecbe[_0x56e111(0x9d)]!==_0x56e111(0xa2))throw new Error(_0x56e111(0x9c));return _0x4aecbe;}export async function getRulesContent(){const _0x581535=a81_0x293839;try{const _0x231e27=await fetchRulesFromCDN();return _0x231e27[_0x581535(0x9d)];}catch{return readLocalTemplate();}}export function readLocalTemplate(){const _0x5a1264=a81_0x293839;if(existsSync(LOCAL_TEMPLATE_PATH))return readFileSync(LOCAL_TEMPLATE_PATH,_0x5a1264(0xa7));throw new Error('本地模板文件不存在:\x20'+LOCAL_TEMPLATE_PATH);}export async function writeRulesFile(_0x41560d){const _0x39e2f6=a81_0x293839,_0x4663f8=await fetchRulesFromCDN()[_0x39e2f6(0xa4)](()=>null);let _0x11dd7d;_0x4663f8?(_0x11dd7d=_0x4663f8[_0x39e2f6(0x9d)],_0x4663f8[_0x39e2f6(0x99)]&&(_0x11dd7d=appendUpdateTime(_0x11dd7d,_0x4663f8[_0x39e2f6(0x99)]))):_0x11dd7d=readLocalTemplate();const _0x4317ba=dirname(_0x41560d);!existsSync(_0x4317ba)&&mkdirSync(_0x4317ba,{'recursive':!![]}),writeFileSync(_0x41560d,_0x11dd7d,_0x39e2f6(0xa7));}export async function copyRulesToCursor(_0x37e14f){const _0x154c78=a81_0x293839,_0x5c556d=join(_0x37e14f,_0x154c78(0x91)),_0x55ac4e=join(_0x5c556d,'lovrabet_rules.mdc');if(existsSync(_0x55ac4e))return![];return await writeRulesFile(_0x55ac4e),!![];}export async function copyRulesToAgentsMd(_0x5dbddd){const _0x399455=a81_0x293839,_0x3ab814=join(_0x5dbddd,_0x399455(0x90));if(existsSync(_0x3ab814))return![];return await writeRulesFile(_0x3ab814),!![];}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x41af7e){return new Promise(_0x48ab01=>setTimeout(_0x48ab01,_0x41af7e));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a83_0x4972(){const _0x175458=['模板内容替换完成','promises','isDirectory','slice','replace','split','2611953kUtZJa','processFile','charAt','../../package.json','toComponentName','.json','.ts','2808078NkvfKU','.tpl','numeric','push','.css','651686pIoTWS','isFile','alias','toLocaleString','103891MMlxQe','writeFile','.js','now','模板内容替换失败','extname','\x0a\x20\x20\x20\x20{\x20','alias:\x20\x22','2-digit','replaceApiContent','name','readFile','utf8','datasetCode:\x20\x22','toDisplayTitle','8QrZbef','replaceContent','success','.scss','tableName:\x20\x22','datasetCode','join','1165KsnDwB','processDirectory','.jsx','mkdir','toLocaleTimeString','2220084KTptLV','toISOString','endsWith','YourModel','15390ZyHObD','includes','default','info','1164840HEfxoo','message','pop','toLowerCase','version','\x20},','map','开始处理模板内容替换','toUpperCase','name:\x20\x22'];a83_0x4972=function(){return _0x175458;};return a83_0x4972();}const a83_0x2de1cb=a83_0x3467;(function(_0x45146f,_0x2c5b11){const _0x2357e6=a83_0x3467,_0x42aa8b=_0x45146f();while(!![]){try{const _0x2d4762=-parseInt(_0x2357e6(0x133))/0x1+-parseInt(_0x2357e6(0x12f))/0x2+parseInt(_0x2357e6(0x14e))/0x3+parseInt(_0x2357e6(0x113))/0x4+-parseInt(_0x2357e6(0x149))/0x5*(parseInt(_0x2357e6(0x10f))/0x6)+parseInt(_0x2357e6(0x12a))/0x7+parseInt(_0x2357e6(0x142))/0x8*(parseInt(_0x2357e6(0x123))/0x9);if(_0x2d4762===_0x2c5b11)break;else _0x42aa8b['push'](_0x42aa8b['shift']());}catch(_0x1b1c9c){_0x42aa8b['push'](_0x42aa8b['shift']());}}}(a83_0x4972,0xa9bbe));import a83_0x51389b from'node:fs';function a83_0x3467(_0x33d7f4,_0x295709){_0x33d7f4=_0x33d7f4-0x10d;const _0x4972fe=a83_0x4972();let _0x3467d9=_0x4972fe[_0x33d7f4];return _0x3467d9;}import a83_0x35b46c from'node:path';import{createRequire}from'node:module';import{logger}from'./logger.js';const require=createRequire(import.meta.url),CLI_VERSION=require(a83_0x2de1cb(0x126))[a83_0x2de1cb(0x117)];export class TemplateReplacer{static['toComponentName'](_0x13aa29){const _0x165ea4=a83_0x2de1cb,_0x2b780f=_0x13aa29['split']('/')[_0x165ea4(0x115)]()||_0x13aa29;return _0x2b780f['split']('-')[_0x165ea4(0x119)](_0x3321ac=>_0x3321ac[_0x165ea4(0x125)](0x0)[_0x165ea4(0x11b)]()+_0x3321ac['slice'](0x1)[_0x165ea4(0x116)]())[_0x165ea4(0x148)]('');}static['toDisplayTitle'](_0xa89ad0){const _0xcf1268=a83_0x2de1cb,_0x48b373=_0xa89ad0[_0xcf1268(0x122)]('/')[_0xcf1268(0x115)]()||_0xa89ad0;return _0x48b373[_0xcf1268(0x122)]('-')['map'](_0x10bdc0=>_0x10bdc0[_0xcf1268(0x125)](0x0)['toUpperCase']()+_0x10bdc0[_0xcf1268(0x120)](0x1)[_0xcf1268(0x116)]())[_0xcf1268(0x148)]('\x20');}static[a83_0x2de1cb(0x143)](_0x537ba0,_0x35c3a9,_0x4aefb9){const _0x251e76=a83_0x2de1cb,_0x27f0ae=this[_0x251e76(0x127)](_0x35c3a9),_0x2117a4=this[_0x251e76(0x141)](_0x35c3a9),_0x3b3da1=new Date(),_0x480a46=_0x3b3da1[_0x251e76(0x132)](undefined,{'year':_0x251e76(0x12c),'month':_0x251e76(0x13b),'day':_0x251e76(0x13b),'hour':_0x251e76(0x13b),'minute':_0x251e76(0x13b),'second':_0x251e76(0x13b),'hour12':![]})[_0x251e76(0x121)](/\//g,'-'),_0x3c3eb3=_0x3b3da1['toLocaleDateString'](undefined,{'year':_0x251e76(0x12c),'month':_0x251e76(0x13b),'day':_0x251e76(0x13b)})[_0x251e76(0x121)](/\//g,'-'),_0x28aea3=_0x3b3da1[_0x251e76(0x14d)](undefined,{'hour12':![]});let _0x3b64d7=_0x537ba0['replace'](/\{CliVersion\}/g,CLI_VERSION)[_0x251e76(0x121)](/\{ComponentName\}/g,_0x27f0ae)[_0x251e76(0x121)](/\{DisplayTitle\}/g,_0x2117a4)[_0x251e76(0x121)](/\{PageName\}/g,_0x35c3a9)[_0x251e76(0x121)](/\{TemplateName\}/g,_0x4aefb9)[_0x251e76(0x121)](/\{CreatedAt\}/g,_0x480a46)[_0x251e76(0x121)](/\{CreatedDate\}/g,_0x3c3eb3)[_0x251e76(0x121)](/\{CreatedTime\}/g,_0x28aea3);return _0x3b64d7;}static[a83_0x2de1cb(0x13c)](_0x164b82,_0xeb5e19,_0x31810e,_0x4877da,_0x3654fe,_0x5432ba,_0x5d0d6a){const _0x346f27=a83_0x2de1cb,_0x4d4afe=new Date(),_0x3452e8=_0x4d4afe[_0x346f27(0x14f)](),_0x47ef1d=_0x31810e[_0x346f27(0x119)](_0x1e40e8=>{const _0x32b00b=_0x346f27,_0x55154a=[_0x32b00b(0x140)+_0x1e40e8[_0x32b00b(0x147)]+'\x22',_0x32b00b(0x146)+_0x1e40e8['tableName']+'\x22',_0x32b00b(0x11c)+_0x1e40e8[_0x32b00b(0x13d)]+'\x22'];return _0x1e40e8[_0x32b00b(0x131)]&&_0x55154a[_0x32b00b(0x12d)](_0x32b00b(0x13a)+_0x1e40e8[_0x32b00b(0x131)]+'\x22'),_0x32b00b(0x139)+_0x55154a['join'](',\x20')+_0x32b00b(0x118);})['join'](''),_0x4746d5=_0x4877da||_0x31810e[0x0]?.[_0x346f27(0x131)]||_0x346f27(0x10e);let _0x577460=_0x164b82[_0x346f27(0x121)](/\{AppCode\}/g,_0xeb5e19)[_0x346f27(0x121)](/\{ModelConfigs\}/g,_0x47ef1d)[_0x346f27(0x121)](/\{ExampleModelName\}/g,_0x4746d5)[_0x346f27(0x121)](/\{ApiFileName\}/g,_0x3654fe||'api')[_0x346f27(0x121)](/\{ConfigName\}/g,_0x5432ba||_0x346f27(0x111))['replace'](/\{ClientConfigParam\}/g,_0x5d0d6a||'')[_0x346f27(0x121)](/\{CreatedAt\}/g,_0x3452e8);return _0x577460;}static async['processTemplate'](_0x31e472,_0x410fd2,_0x57782f,_0x35b7b4,_0x46f9bc=!![]){const _0xadccb=a83_0x2de1cb,_0x39c8c7=Date[_0xadccb(0x136)]();try{_0x46f9bc&&logger[_0xadccb(0x112)]('template',_0xadccb(0x11a),{'templatePath':_0x31e472,'targetPath':_0x410fd2,'pageName':_0x57782f,'templateName':_0x35b7b4});await a83_0x51389b[_0xadccb(0x11e)][_0xadccb(0x14c)](_0x410fd2,{'recursive':!![]}),await this[_0xadccb(0x14a)](_0x31e472,_0x410fd2,_0x57782f,_0x35b7b4);if(_0x46f9bc){const _0xe95082=Date['now']()-_0x39c8c7;logger[_0xadccb(0x144)]('template',_0xadccb(0x11d),_0xe95082,{'pageName':_0x57782f,'templateName':_0x35b7b4});}}catch(_0x169a50){if(_0x46f9bc){const _0x562cb0=Date[_0xadccb(0x136)]()-_0x39c8c7;logger['error']('template',_0xadccb(0x137),{'templatePath':_0x31e472,'targetPath':_0x410fd2,'pageName':_0x57782f,'templateName':_0x35b7b4,'error':_0x169a50 instanceof Error?_0x169a50[_0xadccb(0x114)]:String(_0x169a50),'duration':_0x562cb0});}throw _0x169a50;}}static async[a83_0x2de1cb(0x14a)](_0x1694fe,_0x11dfc6,_0x1c012c,_0x37860){const _0x1a5ceb=a83_0x2de1cb,_0x4e54a9=await a83_0x51389b[_0x1a5ceb(0x11e)]['readdir'](_0x1694fe,{'withFileTypes':!![]});for(const _0x575b46 of _0x4e54a9){const _0x135411=a83_0x35b46c[_0x1a5ceb(0x148)](_0x1694fe,_0x575b46[_0x1a5ceb(0x13d)]);let _0x502b6f=a83_0x35b46c[_0x1a5ceb(0x148)](_0x11dfc6,_0x575b46['name']);_0x575b46[_0x1a5ceb(0x13d)][_0x1a5ceb(0x10d)](_0x1a5ceb(0x12b))&&(_0x502b6f=a83_0x35b46c['join'](_0x11dfc6,_0x575b46[_0x1a5ceb(0x13d)][_0x1a5ceb(0x121)](/\.tpl$/,'')));if(_0x575b46[_0x1a5ceb(0x11f)]())await a83_0x51389b['promises'][_0x1a5ceb(0x14c)](_0x502b6f,{'recursive':!![]}),await this[_0x1a5ceb(0x14a)](_0x135411,_0x502b6f,_0x1c012c,_0x37860);else _0x575b46[_0x1a5ceb(0x130)]()&&await this[_0x1a5ceb(0x124)](_0x135411,_0x502b6f,_0x1c012c,_0x37860);}}static async[a83_0x2de1cb(0x124)](_0x522c71,_0xa0e69a,_0x59089f,_0x9ed625){const _0x5ec27d=a83_0x2de1cb,_0x1d63cf=a83_0x35b46c[_0x5ec27d(0x138)](_0x522c71)['toLowerCase']();_0x522c71[_0x5ec27d(0x10d)](_0x5ec27d(0x12b))&&(_0xa0e69a=_0xa0e69a[_0x5ec27d(0x121)](/\.tpl$/,''));const _0x20f750=['.tsx',_0x5ec27d(0x129),_0x5ec27d(0x14b),_0x5ec27d(0x135),_0x5ec27d(0x128),'.md',_0x5ec27d(0x12e),_0x5ec27d(0x145),'.tpl'];if(_0x20f750[_0x5ec27d(0x110)](_0x1d63cf)||_0x522c71[_0x5ec27d(0x10d)](_0x5ec27d(0x12b))){const _0x4b064c=await a83_0x51389b[_0x5ec27d(0x11e)][_0x5ec27d(0x13e)](_0x522c71,_0x5ec27d(0x13f)),_0x293992=this[_0x5ec27d(0x143)](_0x4b064c,_0x59089f,_0x9ed625);await a83_0x51389b[_0x5ec27d(0x11e)][_0x5ec27d(0x134)](_0xa0e69a,_0x293992,'utf8');}else await a83_0x51389b[_0x5ec27d(0x11e)]['copyFile'](_0x522c71,_0xa0e69a);}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovrabet/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4-beta.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lovrabet": "lib/cli.js"
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
"test:unit": "vitest run test/unit",
|
|
28
28
|
"test:integration": "vitest run test/integration",
|
|
29
29
|
"test:e2e": "vitest run test/e2e",
|
|
30
|
+
"test:windows": "node test/run-windows-tests.js",
|
|
31
|
+
"test:windows:unit": "node test/run-windows-tests.js unit",
|
|
32
|
+
"test:windows:integration": "node test/run-windows-tests.js integration",
|
|
30
33
|
"typecheck": "tsc --noEmit",
|
|
31
34
|
"lint": "echo 'No linter configured yet'",
|
|
32
35
|
"ci": "npm run typecheck && npm run test:run && npm run build"
|
package/templates/README.md
CHANGED
|
@@ -7,59 +7,14 @@
|
|
|
7
7
|
```
|
|
8
8
|
templates/
|
|
9
9
|
├── README.md # 本说明文档
|
|
10
|
-
├──
|
|
11
|
-
|
|
12
|
-
│ └── hello-world/ # 功能丰富的演示页面模板
|
|
13
|
-
└── projects/ # 项目模板,用于 `lovrabet create project` 命令
|
|
10
|
+
├── generate-api/ # API 生成模板
|
|
11
|
+
└── projects/ # 项目模板,用于 `lovrabet create` 命令
|
|
14
12
|
└── sub-app-react-demo/ # Git 子模块,指向主模板仓库
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
##
|
|
15
|
+
## API 生成模板
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
创建页面模板(`.tsx.tpl` 文件)时,可以使用以下占位符标签,它们会被自动替换:
|
|
22
|
-
|
|
23
|
-
| 标签 | 说明 | 示例 |
|
|
24
|
-
|-----|------|------|
|
|
25
|
-
| `{ComponentName}` | PascalCase 组件名 | `UserProfile` |
|
|
26
|
-
| `{DisplayTitle}` | 人类可读的标题 | `User Profile` |
|
|
27
|
-
| `{PageName}` | 原始的 kebab-case 页面名 | `user-profile` |
|
|
28
|
-
| `{TemplateName}` | 使用的模板名称 | `blank` |
|
|
29
|
-
| `{CreatedAt}` | 创建时的 ISO 时间戳 | `2024-09-14T15:30:45.123Z` |
|
|
30
|
-
| `{CreatedDate}` | 创建日期 | `2024-09-14` |
|
|
31
|
-
| `{CreatedTime}` | 创建时间 | `15:30:45` |
|
|
32
|
-
|
|
33
|
-
### 模板文件命名
|
|
34
|
-
|
|
35
|
-
- 模板文件应使用 `.tpl` 扩展名(如 `index.tsx.tpl`)
|
|
36
|
-
- 生成时会自动移除 `.tpl` 扩展名
|
|
37
|
-
- CLI 会处理所有文本文件(`.tsx`, `.ts`, `.jsx`, `.js`, `.json`, `.md`, `.css`, `.scss`, `.tpl`)
|
|
38
|
-
|
|
39
|
-
### 模板使用示例
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
/**
|
|
43
|
-
* Generated by Lovrabet CLI
|
|
44
|
-
* Template: {TemplateName}
|
|
45
|
-
* Created: {CreatedAt}
|
|
46
|
-
* Page: {PageName}
|
|
47
|
-
*/
|
|
48
|
-
import React from "react";
|
|
49
|
-
|
|
50
|
-
function {ComponentName}() {
|
|
51
|
-
return <div>{DisplayTitle} 页面</div>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default {ComponentName};
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 添加新页面模板
|
|
58
|
-
|
|
59
|
-
1. 在 `templates/pages/` 下创建新目录(如 `templates/pages/my-template/`)
|
|
60
|
-
2. 添加带 `.tpl` 扩展名的模板文件
|
|
61
|
-
3. 使用上述文档化的占位符标签
|
|
62
|
-
4. 无需修改 CLI 代码 - 任何新模板都会自动工作!
|
|
17
|
+
`generate-api/` 目录包含用于生成 API 配置的模板。
|
|
63
18
|
|
|
64
19
|
## 项目模板
|
|
65
20
|
|
|
@@ -101,18 +56,18 @@ git submodule update --init --recursive
|
|
|
101
56
|
|
|
102
57
|
添加新模板时:
|
|
103
58
|
|
|
104
|
-
1.
|
|
105
|
-
2.
|
|
106
|
-
3.
|
|
107
|
-
4.
|
|
108
|
-
5. **更新此 README**:记录任何新功能或标签
|
|
59
|
+
1. **项目模板**:放置在 `templates/projects/` 中
|
|
60
|
+
2. **文件扩展名**:需要处理的模板文件使用 `.tpl`
|
|
61
|
+
3. **本地测试**:提交前使用新模板生成项目进行测试
|
|
62
|
+
4. **更新此 README**:记录任何新功能
|
|
109
63
|
|
|
110
64
|
## 注意事项
|
|
111
65
|
|
|
112
|
-
-
|
|
66
|
+
- 模板在项目生成过程中被复制和处理
|
|
113
67
|
- CLI 使用 `TemplateReplacer` 工具进行标签替换
|
|
114
68
|
- 生成的文件包含显示生成元数据的头部注释
|
|
115
69
|
- 所有模板支持国际化并可根据需要扩展
|
|
70
|
+
|
|
116
71
|
## Cursor Rules 模板
|
|
117
72
|
|
|
118
73
|
### 用途
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(_0x28ab51,_0x992edc){const _0x81a2f3=a0_0x1f6b,_0x4d6696=_0x28ab51();while(!![]){try{const _0x35c4bf=-parseInt(_0x81a2f3(0x1f1))/0x1*(-parseInt(_0x81a2f3(0x1f7))/0x2)+parseInt(_0x81a2f3(0x1f5))/0x3*(-parseInt(_0x81a2f3(0x1ff))/0x4)+parseInt(_0x81a2f3(0x201))/0x5+-parseInt(_0x81a2f3(0x1fd))/0x6+parseInt(_0x81a2f3(0x203))/0x7*(-parseInt(_0x81a2f3(0x1ea))/0x8)+-parseInt(_0x81a2f3(0x1ec))/0x9+parseInt(_0x81a2f3(0x1e8))/0xa;if(_0x35c4bf===_0x992edc)break;else _0x4d6696['push'](_0x4d6696['shift']());}catch(_0x5531e1){_0x4d6696['push'](_0x4d6696['shift']());}}}(a0_0x4d6a,0x58e62));import{jsx as a0_0x2469f6,jsxs as a0_0x48b6c8}from'react/jsx-runtime';import{useState}from'react';import{Text,Box,useInput}from'ink';import a0_0x4cce16 from'node:fs';function a0_0x1f6b(_0x5ae4a6,_0x5d1c73){_0x5ae4a6=_0x5ae4a6-0x1e8;const _0x4d6a48=a0_0x4d6a();let _0x1f6be8=_0x4d6a48[_0x5ae4a6];return _0x1f6be8;}function a0_0x4d6a(){const _0x496486=['column','7VBRPdj','return','gray','13718980qKEuxv','delete','4691768FqOeMQ','existsSync','2602899BMpVKf','addPage.input.route.label','red','includes','addPage.validation.path.tooLong','15695QHAvUj','addPage.validation.path.exists','my-page','addPage.validation.path.invalid','21927kZCnbM','addPage.input.route.hint','80UGBjzF','length','trim','green','slice','addPage.steps.step2','2716854dZVhWS','startsWith','292GsGCvN','\x20←\x20','1132400SfFlXZ'];a0_0x4d6a=function(){return _0x496486;};return a0_0x4d6a();}import{useI18n}from'../i18n/hooks.js';export function InputProjectCode(_0x2c8ec9){const _0x2a1175=a0_0x1f6b,{onSubmit:_0x4e9e0c,pagePath:_0x406942}=_0x2c8ec9,{t:_0x27c967}=useI18n(),[_0x2855f3,_0x31c2ca]=useState(''),[_0x4e6b0f,_0x4306d6]=useState(''),_0x188d21=_0x2a1175(0x1f3);function _0x325c78(_0x2c964a){const _0x4bfb34=_0x2a1175;if(_0x2c964a[_0x4bfb34(0x1f8)]>0x64)return{'valid':![],'message':_0x27c967(_0x4bfb34(0x1f0))};if(_0x2c964a[_0x4bfb34(0x1fe)]('/')||_0x2c964a['endsWith']('/'))return{'valid':![],'message':_0x27c967('addPage.validation.path.invalidStartEnd')};if(_0x2c964a[_0x4bfb34(0x1ef)]('//'))return{'valid':![],'message':_0x27c967('addPage.validation.path.doubleSlash')};const _0x22e076=_0x2c964a['split']('/');for(const _0x183cb1 of _0x22e076){if(!_0x183cb1)continue;const _0x1ab1a4=/^[A-Za-z0-9][A-Za-z0-9_-]*$/;if(!_0x1ab1a4['test'](_0x183cb1))return{'valid':![],'message':_0x27c967('addPage.validation.path.invalidSegment')};}return{'valid':!![]};}return useInput((_0x1090b6,_0x7545de)=>{const _0x16848e=_0x2a1175;if(_0x7545de[_0x16848e(0x204)]){const _0x457fd6=_0x2855f3[_0x16848e(0x1f9)]()||_0x188d21;if(_0x4e6b0f)return;const _0x525fbc=_0x406942+'/'+_0x457fd6;if(a0_0x4cce16[_0x16848e(0x1eb)](_0x525fbc)){_0x4306d6(_0x27c967(_0x16848e(0x1f2),{'path':_0x457fd6}));return;}_0x4e9e0c(_0x457fd6),_0x31c2ca(''),_0x4306d6('');}else _0x7545de['backspace']||_0x7545de[_0x16848e(0x1e9)]?_0x31c2ca(_0x47b8cd=>{const _0x1a7473=_0x16848e,_0x289bbf=_0x47b8cd[_0x1a7473(0x1fb)](0x0,-0x1),{valid:_0x23486e,message:_0x4b1e92}=_0x325c78(_0x289bbf);return _0x4306d6(_0x23486e?'':_0x4b1e92||_0x27c967('addPage.validation.path.invalid')),_0x289bbf;}):_0x31c2ca(_0x47cb49=>{const _0x126f04=_0x16848e,_0x7414ac=_0x47cb49+_0x1090b6,{valid:_0x453522,message:_0x4b7b88}=_0x325c78(_0x7414ac);return _0x4306d6(_0x453522?'':_0x4b7b88||_0x27c967(_0x126f04(0x1f4))),_0x7414ac;});}),a0_0x48b6c8(Box,{'flexDirection':_0x2a1175(0x202),'children':[a0_0x48b6c8(Box,{'children':[a0_0x2469f6(Text,{'color':_0x2a1175(0x205),'children':_0x27c967(_0x2a1175(0x1fc))}),a0_0x2469f6(Text,{'children':_0x27c967(_0x2a1175(0x1ed))}),_0x2855f3?a0_0x2469f6(Text,{'color':_0x2a1175(0x1fa),'children':_0x2855f3}):a0_0x2469f6(Text,{'color':_0x2a1175(0x205),'children':_0x188d21}),_0x4e6b0f&&a0_0x48b6c8(Text,{'color':_0x2a1175(0x1ee),'children':[_0x2a1175(0x200),_0x4e6b0f]})]}),!_0x4e6b0f&&!_0x2855f3&&a0_0x2469f6(Box,{'children':a0_0x2469f6(Text,{'color':_0x2a1175(0x205),'children':_0x27c967(_0x2a1175(0x1f6))})})]});}
|