@lovrabet/cli 1.3.3 → 1.3.4-beta.1
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_0x1004b4=a71_0x348e;(function(_0x206be9,_0x160dbb){const _0x35ee05=a71_0x348e,_0x3e6d3e=_0x206be9();while(!![]){try{const _0x235c62=parseInt(_0x35ee05(0x219))/0x1*(parseInt(_0x35ee05(0x206))/0x2)+parseInt(_0x35ee05(0x1f4))/0x3*(parseInt(_0x35ee05(0x1f5))/0x4)+-parseInt(_0x35ee05(0x1fc))/0x5+-parseInt(_0x35ee05(0x212))/0x6+-parseInt(_0x35ee05(0x1ed))/0x7*(parseInt(_0x35ee05(0x1f3))/0x8)+parseInt(_0x35ee05(0x1f2))/0x9+parseInt(_0x35ee05(0x20d))/0xa*(parseInt(_0x35ee05(0x1ef))/0xb);if(_0x235c62===_0x160dbb)break;else _0x3e6d3e['push'](_0x3e6d3e['shift']());}catch(_0x36edcb){_0x3e6d3e['push'](_0x3e6d3e['shift']());}}}(a71_0x393a,0xa28f0));export const CORE_IDE_CONFIGS={'cursor':{'name':a71_0x1004b4(0x1f6),'description':a71_0x1004b4(0x1fd),'folders':[a71_0x1004b4(0x1eb),'.cursor'],'files':[{'type':a71_0x1004b4(0x21d),'path':a71_0x1004b4(0x201),'template':'SKILL.md.tpl'}]},'windsurf':{'name':a71_0x1004b4(0x209),'description':a71_0x1004b4(0x1e8),'folders':[a71_0x1004b4(0x204)],'files':[{'type':a71_0x1004b4(0x21d),'path':'.windsurf/workflows/lovrabet.md','template':a71_0x1004b4(0x1ea)}]},'claude':{'name':'Claude\x20Code','description':a71_0x1004b4(0x1e9),'folders':[a71_0x1004b4(0x217)],'files':[{'type':a71_0x1004b4(0x21d),'path':'.claude/skills/lovrabet/SKILL.md','template':a71_0x1004b4(0x1ea)}]},'cline':{'name':a71_0x1004b4(0x21b),'description':'Cline\x20IDE','folders':[a71_0x1004b4(0x1ff)],'files':[{'type':a71_0x1004b4(0x21d),'path':a71_0x1004b4(0x208),'template':a71_0x1004b4(0x1ea)}]},'codex':{'name':a71_0x1004b4(0x1f8),'description':a71_0x1004b4(0x214),'folders':[a71_0x1004b4(0x1f9)],'files':[{'type':a71_0x1004b4(0x21d),'path':a71_0x1004b4(0x1e7),'template':a71_0x1004b4(0x1ea)}]},'opencode':{'name':a71_0x1004b4(0x20a),'description':a71_0x1004b4(0x207),'folders':['.opencode'],'files':[{'type':'file','path':a71_0x1004b4(0x211),'template':a71_0x1004b4(0x1ea)}]},'qoder':{'name':a71_0x1004b4(0x202),'description':a71_0x1004b4(0x1fe),'folders':[a71_0x1004b4(0x203)],'files':[{'type':'file','path':a71_0x1004b4(0x21f),'template':a71_0x1004b4(0x1ea)},{'type':'file','path':a71_0x1004b4(0x1f1),'template':a71_0x1004b4(0x1ea)}]},'codebuddy':{'name':a71_0x1004b4(0x1ec),'description':'CodeBuddy\x20IDE','folders':[a71_0x1004b4(0x1f0)],'files':[{'type':a71_0x1004b4(0x21d),'path':a71_0x1004b4(0x1fa),'template':a71_0x1004b4(0x1ea)}]},'trae':{'name':a71_0x1004b4(0x1ee),'description':'Trae\x20IDE','folders':[a71_0x1004b4(0x20c)],'files':[{'type':a71_0x1004b4(0x21d),'path':a71_0x1004b4(0x20e),'template':a71_0x1004b4(0x1ea)}]}};export const IDE_CONFIGS={...CORE_IDE_CONFIGS,'agent':{'name':'其他\x20(通用模板)','description':a71_0x1004b4(0x215),'folders':[a71_0x1004b4(0x21c)],'files':[{'type':a71_0x1004b4(0x21d),'path':'.agent/skills/lovrabet/SKILL.md','template':a71_0x1004b4(0x1ea)}]},'antigravity':{'name':'Antigravity','description':a71_0x1004b4(0x1fb),'folders':['.agent'],'files':[{'type':a71_0x1004b4(0x21d),'path':a71_0x1004b4(0x210),'template':a71_0x1004b4(0x1ea)}]}};function a71_0x348e(_0x123b77,_0x38a1d7){_0x123b77=_0x123b77-0x1e6;const _0x393add=a71_0x393a();let _0x348efc=_0x393add[_0x123b77];return _0x348efc;}export const CORE_IDE_LIST=[a71_0x1004b4(0x216),a71_0x1004b4(0x205),a71_0x1004b4(0x20f),a71_0x1004b4(0x200),'cursor','opencode',a71_0x1004b4(0x21a),a71_0x1004b4(0x1e6),'windsurf'];function a71_0x393a(){const _0x7a4820=['Codex','.codex','.codebuddy/skills/lovrabet/SKILL.md','Antigravity\x20IDE','2853880RjBdmD','Cursor\x20IDE','Qoder\x20IDE','.cline','codex','.cursor/skills/lovrabet.md','Qoder','.qoder','.windsurf','cline','720162HCMzdl','OpenCode\x20IDE','.cline/skills/lovrabet/SKILL.md','Windsurf','OpenCode','agent','.trae','10WTTktV','.trae/skills/lovrabet/SKILL.md','codebuddy','.agent/skills/lovrabet/SKILL.md','.opencode/skills/lovrabet/SKILL.md','5343672SVcroj','cursor','Codex\x20IDE','通用模板\x20-\x20兜底方案','claude','.claude','opencode','1zGiybn','qoder','Cline','.agent','file','windsurf','.qoder/rules/lovrabet.md','trae','.codex/skills/lovrabet/SKILL.md','Windsurf\x20IDE','Claude\x20Code','SKILL.md.tpl','.cursorrules','CodeBuddy','2360533zXolzn','Trae','14143151gZVjxE','.codebuddy','.qoder/skills/lovrabet/SKILL.md','8028837EFDgsX','16HBcWsU','791253jtHxvI','4XdYtvw','Cursor','antigravity'];a71_0x393a=function(){return _0x7a4820;};return a71_0x393a();}export const IDE_LIST=[a71_0x1004b4(0x1f7),a71_0x1004b4(0x216),a71_0x1004b4(0x205),a71_0x1004b4(0x20f),a71_0x1004b4(0x200),a71_0x1004b4(0x213),a71_0x1004b4(0x218),a71_0x1004b4(0x21a),a71_0x1004b4(0x1e6),a71_0x1004b4(0x21e),a71_0x1004b4(0x20b)];export const ALL_CORE_IDES=[a71_0x1004b4(0x213),a71_0x1004b4(0x21e),'claude',a71_0x1004b4(0x205),'codex','opencode',a71_0x1004b4(0x21a),a71_0x1004b4(0x20f),'trae'];export const MCP_IDES=new Set([a71_0x1004b4(0x213),a71_0x1004b4(0x216)]);
|
package/lib/utils/cdn-config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x41bc16,_0x4c9c35){const _0x2baa4f=a72_0x21b7,_0x53a84c=_0x41bc16();while(!![]){try{const _0x51e68e=-parseInt(_0x2baa4f(0x11c))/0x1+parseInt(_0x2baa4f(0x11a))/0x2*(-parseInt(_0x2baa4f(0x114))/0x3)+parseInt(_0x2baa4f(0x122))/0x4*(parseInt(_0x2baa4f(0x118))/0x5)+parseInt(_0x2baa4f(0x11b))/0x6*(-parseInt(_0x2baa4f(0x121))/0x7)+-parseInt(_0x2baa4f(0x11f))/0x8+-parseInt(_0x2baa4f(0x119))/0x9+parseInt(_0x2baa4f(0x120))/0xa;if(_0x51e68e===_0x4c9c35)break;else _0x53a84c['push'](_0x53a84c['shift']());}catch(_0x53d9ec){_0x53a84c['push'](_0x53a84c['shift']());}}}(a72_0x2126,0x4b37f));import{getTemplateBaseUrl}from'./config.js';export async function fetchCdnConfig(){const _0x4e6d58=a72_0x21b7;try{const _0x237af2=getTemplateBaseUrl(),_0x2ccc9d=_0x237af2+_0x4e6d58(0x117),_0x4645d3=await fetch(_0x2ccc9d,{'headers':{'Accept':'application/json'}});if(!_0x4645d3['ok'])return null;const _0x33eb18=await _0x4645d3['json']();if(!_0x33eb18['cli']?.[_0x4e6d58(0x11e)]||!_0x33eb18[_0x4e6d58(0x11d)]?.[_0x4e6d58(0x115)]?.[_0x4e6d58(0x11e)])return null;return _0x33eb18;}catch{return null;}}function a72_0x21b7(_0x2acd77,_0x19459f){_0x2acd77=_0x2acd77-0x114;const _0x212679=a72_0x2126();let _0x21b7ec=_0x212679[_0x2acd77];return _0x21b7ec;}let cachedConfig=null,cacheTime=0x0;const CACHE_TTL=0x5*0x3c*0x3e8;export async function getCdnConfig(){const _0x14c26e=a72_0x21b7,_0x3e3e45=Date[_0x14c26e(0x116)]();if(cachedConfig&&_0x3e3e45-cacheTime<CACHE_TTL)return cachedConfig;const _0x34a196=await fetchCdnConfig();return _0x34a196&&(cachedConfig=_0x34a196,cacheTime=_0x3e3e45),_0x34a196;}function a72_0x2126(){const _0x543355=['15742120SfIoec','14hTneWe','4ppEIYm','1268559uWUOHL','node','now','/config.json','1407885ErTRsk','750492PWawLj','2NspMAM','673656bWwSXI','335640LPfwsB','sdk','stableVersion','3850088UzqqST'];a72_0x2126=function(){return _0x543355;};return a72_0x2126();}export function clearCdnConfigCache(){cachedConfig=null,cacheTime=0x0;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a73_0x52e47c=a73_0x5a47;(function(_0x5537bc,_0x3c6401){const _0x14823c=a73_0x5a47,_0x339fb6=_0x5537bc();while(!![]){try{const _0x58edb4=-parseInt(_0x14823c(0x75))/0x1*(parseInt(_0x14823c(0x73))/0x2)+-parseInt(_0x14823c(0x95))/0x3+-parseInt(_0x14823c(0x76))/0x4*(-parseInt(_0x14823c(0x91))/0x5)+parseInt(_0x14823c(0x8b))/0x6+parseInt(_0x14823c(0x8a))/0x7+-parseInt(_0x14823c(0x8d))/0x8*(parseInt(_0x14823c(0x7e))/0x9)+parseInt(_0x14823c(0x7d))/0xa;if(_0x58edb4===_0x3c6401)break;else _0x339fb6['push'](_0x339fb6['shift']());}catch(_0x394385){_0x339fb6['push'](_0x339fb6['shift']());}}}(a73_0x1c03,0x2036f));import a73_0x219b1f from'node:fs';import a73_0x433541 from'node:path';function a73_0x5a47(_0x784eb8,_0x5124d4){_0x784eb8=_0x784eb8-0x6e;const _0x1c0353=a73_0x1c03();let _0x5a478e=_0x1c0353[_0x784eb8];return _0x5a478e;}import a73_0x5cb27a from'semver';import{getCdnConfig}from'./cdn-config.js';import a73_0x2ca156 from'../i18n/index.js';const t=a73_0x2ca156['t'][a73_0x52e47c(0x6e)](a73_0x2ca156),FALLBACK_MIN_SDK_VERSION=a73_0x52e47c(0x88);function a73_0x1c03(){const _0x3e052f=['133415RhCkYp','parse','upgrade.sdk.command','needsUpgrade','626721ikiaiQ','bind','utf-8','node','upgrade.sdk.stable','@lovrabet/sdk','167588aIGvBD','stableVersion','1TvBijs','4VHhRZb','minVersion','\x1b[0m','sdk','node_modules','version','package.json','5061190DVsyAS','162xPNTLj','devDependencies','readFileSync','\x1b[33m','existsSync','utf8','some','dependencies','log','coerce','1.2.0','join','114604xhliRv','490224IvJRpU','packageName','91656OfwYBQ','upgrade.sdk.title','latest','\x1b[1m'];a73_0x1c03=function(){return _0x3e052f;};return a73_0x1c03();}function isNonNumericVersion(_0xdf7980){const _0x33c760=a73_0x52e47c,_0x159eef=[/^latest$/i,/^beta$/i,/^alpha$/i,/^canary$/i,/^\*$/,/^x$/];return _0x159eef[_0x33c760(0x84)](_0x5347e6=>_0x5347e6['test'](_0xdf7980));}function getInstalledVersion(_0x1c6bf2,_0x4f4a99){const _0x3435d7=a73_0x52e47c;try{const _0xc200d6=a73_0x433541[_0x3435d7(0x89)](_0x1c6bf2,_0x3435d7(0x7a),_0x4f4a99,_0x3435d7(0x7c));if(a73_0x219b1f[_0x3435d7(0x82)](_0xc200d6)){const _0x301c70=JSON['parse'](a73_0x219b1f[_0x3435d7(0x80)](_0xc200d6,_0x3435d7(0x6f)));return _0x301c70['version']||null;}}catch{}return null;}async function getSdkStableVersion(){const _0x562f4b=a73_0x52e47c;try{const _0x342a6d=await getCdnConfig();return _0x342a6d?.[_0x562f4b(0x79)]?.[_0x562f4b(0x70)]?.[_0x562f4b(0x74)]||null;}catch{return null;}}async function getSdkPackageName(){const _0x570930=a73_0x52e47c;try{const _0x4655dd=await getCdnConfig();return _0x4655dd?.[_0x570930(0x79)]?.[_0x570930(0x70)]?.['packageName']||_0x570930(0x72);}catch{return _0x570930(0x72);}}export async function checkSdkVersion(_0xe8455c){const _0x2d90cc=a73_0x52e47c,_0x52b7e8=a73_0x433541[_0x2d90cc(0x89)](_0xe8455c,_0x2d90cc(0x7c)),[_0x55fa4b,_0x1fc5c0]=await Promise['all']([getSdkStableVersion(),getSdkPackageName()]),_0x127cd9=_0x55fa4b||FALLBACK_MIN_SDK_VERSION;if(!a73_0x219b1f['existsSync'](_0x52b7e8))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0x127cd9,'packageName':_0x1fc5c0,'stableVersion':_0x55fa4b};try{const _0x25c335=JSON[_0x2d90cc(0x92)](a73_0x219b1f['readFileSync'](_0x52b7e8,_0x2d90cc(0x83))),_0x250235=_0x25c335[_0x2d90cc(0x85)]||{},_0x43c5bb=_0x25c335[_0x2d90cc(0x7f)]||{},_0x542738=_0x250235[_0x1fc5c0]||_0x43c5bb[_0x1fc5c0];if(!_0x542738)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0x127cd9,'packageName':_0x1fc5c0,'stableVersion':_0x55fa4b};let _0x474745=getInstalledVersion(_0xe8455c,_0x1fc5c0);!_0x474745&&(_0x474745=_0x542738);if(isNonNumericVersion(_0x542738))return{'installed':!![],'version':_0x474745,'needsUpgrade':![],'minVersion':_0x127cd9,'packageName':_0x1fc5c0,'stableVersion':_0x55fa4b};const _0x10bb61=a73_0x5cb27a[_0x2d90cc(0x87)](_0x474745),_0x4c773d=a73_0x5cb27a[_0x2d90cc(0x87)](_0x127cd9),_0xb7c245=_0x10bb61&&_0x4c773d?a73_0x5cb27a['lt'](_0x10bb61,_0x4c773d):![];return{'installed':!![],'version':_0x474745,'needsUpgrade':_0xb7c245,'minVersion':_0x127cd9,'packageName':_0x1fc5c0,'stableVersion':_0x55fa4b};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':_0x127cd9,'packageName':_0x1fc5c0,'stableVersion':_0x55fa4b};}}export function checkSdkVersionSync(_0x2aebca){const _0x1d2311=a73_0x52e47c,_0x49a5ba=a73_0x433541[_0x1d2311(0x89)](_0x2aebca,'package.json'),_0x4d8017=_0x1d2311(0x72);if(!a73_0x219b1f[_0x1d2311(0x82)](_0x49a5ba))return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x4d8017,'stableVersion':null};try{const _0x248cb9=JSON[_0x1d2311(0x92)](a73_0x219b1f[_0x1d2311(0x80)](_0x49a5ba,_0x1d2311(0x83))),_0xd2570f=_0x248cb9['dependencies']||{},_0x20e477=_0x248cb9[_0x1d2311(0x7f)]||{},_0x54cc02=_0xd2570f[_0x4d8017]||_0x20e477[_0x4d8017];if(!_0x54cc02)return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x4d8017,'stableVersion':null};let _0x6825e=getInstalledVersion(_0x2aebca,_0x4d8017);!_0x6825e&&(_0x6825e=_0x54cc02);if(isNonNumericVersion(_0x54cc02))return{'installed':!![],'version':_0x6825e,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x4d8017,'stableVersion':null};const _0x1e7830=a73_0x5cb27a[_0x1d2311(0x87)](_0x6825e),_0x7347bd=_0x1e7830?a73_0x5cb27a['lt'](_0x1e7830,FALLBACK_MIN_SDK_VERSION):![];return{'installed':!![],'version':_0x6825e,'needsUpgrade':_0x7347bd,'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x4d8017,'stableVersion':null};}catch{return{'installed':![],'version':null,'needsUpgrade':![],'minVersion':FALLBACK_MIN_SDK_VERSION,'packageName':_0x4d8017,'stableVersion':null};}}export function printSdkUpgradeWarning(_0x2df0aa){const _0x52b0e5=a73_0x52e47c;if(!_0x2df0aa[_0x52b0e5(0x94)])return;const _0x2dcd79=_0x52b0e5(0x81),_0xf50def=_0x52b0e5(0x78),_0x3be003=_0x52b0e5(0x90),_0x5a07ea=_0x2df0aa[_0x52b0e5(0x8c)]||_0x52b0e5(0x72),_0x38f2a6=_0x2df0aa['stableVersion']||_0x2df0aa[_0x52b0e5(0x77)],_0x13613a='npm\x20install\x20'+_0x5a07ea+'@'+(_0x38f2a6||_0x52b0e5(0x8f));console[_0x52b0e5(0x86)](),console['log'](''+_0x2dcd79+_0x3be003+t(_0x52b0e5(0x8e))+_0xf50def),console[_0x52b0e5(0x86)](''+_0x2dcd79+t('upgrade.sdk.current',{'package':_0x5a07ea,'version':_0x2df0aa[_0x52b0e5(0x7b)]})+_0xf50def),console['log'](''+_0x2dcd79+t(_0x52b0e5(0x71),{'version':_0x38f2a6})+_0xf50def),console[_0x52b0e5(0x86)](''+_0x2dcd79+t(_0x52b0e5(0x93),{'command':_0x13613a})+_0xf50def),console[_0x52b0e5(0x86)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const a74_0x18301f=a74_0x2661;(function(_0x54f51f,_0x8aa00d){const _0xb62e6e=a74_0x2661,_0xe2c1a2=_0x54f51f();while(!![]){try{const _0x5d9c52=parseInt(_0xb62e6e(0x1a7))/0x1*(parseInt(_0xb62e6e(0x1a2))/0x2)+parseInt(_0xb62e6e(0x19a))/0x3+parseInt(_0xb62e6e(0x194))/0x4+-parseInt(_0xb62e6e(0x19d))/0x5+-parseInt(_0xb62e6e(0x1a3))/0x6+-parseInt(_0xb62e6e(0x193))/0x7+parseInt(_0xb62e6e(0x1a6))/0x8;if(_0x5d9c52===_0x8aa00d)break;else _0xe2c1a2['push'](_0xe2c1a2['shift']());}catch(_0x1f1103){_0xe2c1a2['push'](_0xe2c1a2['shift']());}}}(a74_0x5c9f,0xc2eca));import{readFileSync}from'node:fs';function a74_0x5c9f(){const _0x34a647=['version','parse','7471672iPDCQa','11327HVgLAg','upgrade.cli.title','currentVersion','coerce','1.0.0','upgrade.cli.current','9340898rdVtIN','4605152xRnGSv','npm\x20install\x20-g\x20@lovrabet/cli@latest','\x1b[33m','package.json','\x1b[1m','log','4171662KRjPAS','needsUpgrade','test','6273685kmyTWT','upgrade.cli.command','stableVersion','upgrade.cli.stable','bind','44gvPiME','2024604nnWylR'];a74_0x5c9f=function(){return _0x34a647;};return a74_0x5c9f();}import{resolve,dirname}from'node:path';import{fileURLToPath}from'node:url';import a74_0x365305 from'semver';import{getCdnConfig}from'./cdn-config.js';import a74_0x50636a from'../i18n/index.js';const t=a74_0x50636a['t'][a74_0x18301f(0x1a1)](a74_0x50636a);function getCurrentCliVersion(){const _0x57c111=a74_0x18301f;try{const _0x1f28e9=fileURLToPath(import.meta.url),_0x6d927a=resolve(dirname(_0x1f28e9),'../..'),_0x136d4d=resolve(_0x6d927a,_0x57c111(0x197)),_0x20da7d=JSON[_0x57c111(0x1a5)](readFileSync(_0x136d4d,'utf-8'));return _0x20da7d[_0x57c111(0x1a4)]||_0x57c111(0x191);}catch{return'1.0.0';}}function a74_0x2661(_0x135555,_0x38c5c0){_0x135555=_0x135555-0x190;const _0x5c9f35=a74_0x5c9f();let _0x2661ed=_0x5c9f35[_0x135555];return _0x2661ed;}function isNonNumericVersion(_0x37f7a9){const _0xc08cca=a74_0x18301f,_0x254fd8=[/^latest$/i,/^beta$/i,/^alpha$/i,/^canary$/i,/^\^/,/^~/,/^>/,/^</,/^\*/,/^x$/];return _0x254fd8['some'](_0x448a41=>_0x448a41[_0xc08cca(0x19c)](_0x37f7a9));}export async function checkCliVersion(){const _0x429b71=a74_0x18301f,_0x2bed2f=getCurrentCliVersion(),_0x369571=await getCdnConfig(),_0xb0fe8b=_0x369571?.['cli']?.[_0x429b71(0x19f)]||null;let _0x2c088f=![];if(_0xb0fe8b)try{const _0xb40800=a74_0x365305['coerce'](_0x2bed2f),_0x27a356=a74_0x365305[_0x429b71(0x190)](_0xb0fe8b);_0xb40800&&_0x27a356&&(_0x2c088f=a74_0x365305['lt'](_0xb40800,_0x27a356));}catch{_0x2c088f=![];}return{'currentVersion':_0x2bed2f,'stableVersion':_0xb0fe8b,'needsUpgrade':_0x2c088f,'isPreRelease':![]};}export function printCliUpgradeWarning(_0x878c96){const _0x22df7a=a74_0x18301f;if(!_0x878c96[_0x22df7a(0x19b)])return;const _0x2d4edd=_0x22df7a(0x196),_0x167ba2='\x1b[0m',_0x23bc31=_0x22df7a(0x198),_0x55a60c=_0x22df7a(0x195);console[_0x22df7a(0x199)](),console[_0x22df7a(0x199)](''+_0x2d4edd+_0x23bc31+t(_0x22df7a(0x1a8))+_0x167ba2),console[_0x22df7a(0x199)](''+_0x2d4edd+t(_0x22df7a(0x192),{'version':_0x878c96[_0x22df7a(0x1a9)]})+_0x167ba2),console[_0x22df7a(0x199)](''+_0x2d4edd+t(_0x22df7a(0x1a0),{'version':_0x878c96[_0x22df7a(0x19f)]})+_0x167ba2),console['log'](''+_0x2d4edd+t(_0x22df7a(0x19e),{'command':_0x55a60c})+_0x167ba2),console['log']();}
|
package/lib/utils/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a75_0x30c771=a75_0x3bd5;function a75_0x160e(){const _0x2a34e3=['1176007RzSkSP','24YHBnMm','cwd','9093188TxcghU','replace','11734460ycliOL','8HZmhUP','utf8','https://g.lovrabet.com/dist/lovrabet-cli','11pZxdpZ','51005hTNFwS','env','.lovrabetrc','template_base_url','208XHetlf','app','11630448cgfGdQ','100FGwDXU','appcode','21954YSQeiC','4915lAuylw','parse','6eGIIGP','string'];a75_0x160e=function(){return _0x2a34e3;};return a75_0x160e();}function a75_0x3bd5(_0x1557ef,_0xe52010){_0x1557ef=_0x1557ef-0x193;const _0x160e19=a75_0x160e();let _0x3bd586=_0x160e19[_0x1557ef];return _0x3bd586;}(function(_0x4a493a,_0x14bbf2){const _0x50404b=a75_0x3bd5,_0xf188f0=_0x4a493a();while(!![]){try{const _0x4526ba=-parseInt(_0x50404b(0x193))/0x1+-parseInt(_0x50404b(0x197))/0x2*(parseInt(_0x50404b(0x19c))/0x3)+-parseInt(_0x50404b(0x19a))/0x4*(-parseInt(_0x50404b(0x19d))/0x5)+-parseInt(_0x50404b(0x19f))/0x6*(-parseInt(_0x50404b(0x1a1))/0x7)+parseInt(_0x50404b(0x1a7))/0x8*(parseInt(_0x50404b(0x199))/0x9)+-parseInt(_0x50404b(0x1a6))/0xa*(parseInt(_0x50404b(0x1aa))/0xb)+-parseInt(_0x50404b(0x1a2))/0xc*(-parseInt(_0x50404b(0x1a4))/0xd);if(_0x4526ba===_0x14bbf2)break;else _0xf188f0['push'](_0xf188f0['shift']());}catch(_0xe89e06){_0xf188f0['push'](_0xf188f0['shift']());}}}(a75_0x160e,0xdb4e5));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_0x30c771(0x1a3)](),a75_0x30c771(0x195));export const globalConfigPath=resolve(homedir(),a75_0x30c771(0x195));export function readConfig(_0x1a51ce){const _0x229ced=a75_0x30c771;let _0x16f921={};try{if(existsSync(globalConfigPath)){const _0xba9bea=readFileSync(globalConfigPath,{'encoding':_0x229ced(0x1a8)});_0xba9bea&&(_0x16f921=JSON[_0x229ced(0x19e)](_0xba9bea));}}catch(_0x35db07){}try{const _0x3e2a26=_0x1a51ce?resolve(_0x1a51ce,_0x229ced(0x195)):projectConfigPath;if(existsSync(_0x3e2a26)){const _0x3743ba=readFileSync(_0x3e2a26,{'encoding':_0x229ced(0x1a8)});if(_0x3743ba){const _0x54579b=JSON['parse'](_0x3743ba);_0x16f921={..._0x16f921,..._0x54579b};}}}catch(_0x4aca17){}return _0x16f921[_0x229ced(0x194)]&&typeof _0x16f921[_0x229ced(0x194)]===_0x229ced(0x1a0)&&initEnv(_0x16f921[_0x229ced(0x194)]),_0x16f921;}export function getConfigAppCode(){const _0x525080=a75_0x30c771;let _0x143c55={},_0x3f5050={};try{if(existsSync(globalConfigPath)){const _0x30d8db=readFileSync(globalConfigPath,{'encoding':_0x525080(0x1a8)});_0x30d8db&&(_0x3f5050=JSON['parse'](_0x30d8db));}}catch(_0x103fff){}try{if(existsSync(projectConfigPath)){const _0x17394b=readFileSync(projectConfigPath,{'encoding':'utf8'});_0x17394b&&(_0x143c55=JSON['parse'](_0x17394b));}}catch(_0x49035a){}let _0x2ecdd7;if(_0x525080(0x19b)in _0x143c55)_0x2ecdd7=_0x143c55[_0x525080(0x19b)];else{if(_0x525080(0x198)in _0x143c55)_0x2ecdd7=_0x143c55['app'];else{if('appcode'in _0x3f5050)_0x2ecdd7=_0x3f5050[_0x525080(0x19b)];else _0x525080(0x198)in _0x3f5050&&(_0x2ecdd7=_0x3f5050[_0x525080(0x198)]);}}if(typeof _0x2ecdd7!==_0x525080(0x1a0)||_0x2ecdd7['trim']()==='')return undefined;return _0x2ecdd7;}export function isInProject(){return existsSync(projectConfigPath);}export function getTemplateBaseUrl(){const _0x33aa20=a75_0x30c771,_0x45c35b=readConfig();if(_0x45c35b[_0x33aa20(0x196)]&&typeof _0x45c35b[_0x33aa20(0x196)]===_0x33aa20(0x1a0))return _0x45c35b[_0x33aa20(0x196)][_0x33aa20(0x1a5)](/\/$/,'');return _0x33aa20(0x1a9);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x4ad6da,_0xc01375){const _0x2949e4=a76_0x493e,_0x35443b=_0x4ad6da();while(!![]){try{const _0x41e467=parseInt(_0x2949e4(0x124))/0x1+-parseInt(_0x2949e4(0x121))/0x2+-parseInt(_0x2949e4(0x11c))/0x3*(-parseInt(_0x2949e4(0x125))/0x4)+parseInt(_0x2949e4(0x122))/0x5*(parseInt(_0x2949e4(0x12a))/0x6)+-parseInt(_0x2949e4(0x129))/0x7*(-parseInt(_0x2949e4(0x12b))/0x8)+parseInt(_0x2949e4(0x127))/0x9+parseInt(_0x2949e4(0x11f))/0xa*(-parseInt(_0x2949e4(0x123))/0xb);if(_0x41e467===_0xc01375)break;else _0x35443b['push'](_0x35443b['shift']());}catch(_0x382ef7){_0x35443b['push'](_0x35443b['shift']());}}}(a76_0x5e38,0xe1e4d));import a76_0x4ab7f0 from'node:path';function a76_0x5e38(){const _0x3a4303=['129faZHQf','readdirSync','error','103120VKaaFJ','mkdirSync','2880400mUMDbu','5211215vXFELS','4334QjXTOF','1164376PcaWXR','159468xcBkgZ','name','11350089LdYvLs','copyFileSync','224yzGKFO','6QFjavq','311592WQIkUI','join'];a76_0x5e38=function(){return _0x3a4303;};return a76_0x5e38();}function a76_0x493e(_0x56ae63,_0x36bd9b){_0x56ae63=_0x56ae63-0x11b;const _0x5e38a4=a76_0x5e38();let _0x493e08=_0x5e38a4[_0x56ae63];return _0x493e08;}import a76_0x31a801 from'node:fs';export async function copyDirectory(_0x8cf0bc,_0x445f04){const _0x3acb58=a76_0x493e;try{const _0x1f5dff=a76_0x31a801[_0x3acb58(0x11d)](_0x8cf0bc,{'withFileTypes':!![]});a76_0x31a801[_0x3acb58(0x120)](_0x445f04,{'recursive':!![]});for(const _0x15098e of _0x1f5dff){const _0x2b47ec=a76_0x4ab7f0[_0x3acb58(0x11b)](_0x8cf0bc,_0x15098e[_0x3acb58(0x126)]),_0x467572=a76_0x4ab7f0[_0x3acb58(0x11b)](_0x445f04,_0x15098e[_0x3acb58(0x126)]);_0x15098e['isDirectory']()?await copyDirectory(_0x2b47ec,_0x467572):a76_0x31a801[_0x3acb58(0x128)](_0x2b47ec,_0x467572);}}catch(_0x1214fc){console[_0x3acb58(0x11e)]('复制目录时出错:',_0x1214fc);}}
|
package/lib/utils/file-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x607a96,_0x47070b){const _0x22da2c=a77_0x242b,_0xea7a18=_0x607a96();while(!![]){try{const _0x2039e6=-parseInt(_0x22da2c(0x7e))/0x1*(parseInt(_0x22da2c(0x7a))/0x2)+-parseInt(_0x22da2c(0x79))/0x3+-parseInt(_0x22da2c(0x77))/0x4*(parseInt(_0x22da2c(0x76))/0x5)+-parseInt(_0x22da2c(0x78))/0x6+-parseInt(_0x22da2c(0x7f))/0x7*(-parseInt(_0x22da2c(0x7c))/0x8)+parseInt(_0x22da2c(0x7b))/0x9+parseInt(_0x22da2c(0x80))/0xa*(parseInt(_0x22da2c(0x7d))/0xb);if(_0x2039e6===_0x47070b)break;else _0xea7a18['push'](_0xea7a18['shift']());}catch(_0x39ceaa){_0xea7a18['push'](_0xea7a18['shift']());}}}(a77_0x5cc6,0xb0143));function a77_0x5cc6(){const _0x543e3a=['1879WmxSvs','21daDaSj','50GErKAB','31575RyQzkQ','540FGfHNM','1019238NizYCe','793176gTSehQ','934uIDsbj','10924866PMXhOv','3504168VhGwGH','786643MeXMfc'];a77_0x5cc6=function(){return _0x543e3a;};return a77_0x5cc6();}import{existsSync,mkdirSync,copyFileSync,readdirSync,statSync}from'node:fs';import{join}from'node:path';export async function copyDir(_0x1192c0,_0x4c9d47){const _0x2a9c9e=statSync(_0x1192c0);if(_0x2a9c9e['isDirectory']()){!existsSync(_0x4c9d47)&&mkdirSync(_0x4c9d47,{'recursive':!![]});const _0x2d6d5c=readdirSync(_0x1192c0);for(const _0x12a343 of _0x2d6d5c){await copyDir(join(_0x1192c0,_0x12a343),join(_0x4c9d47,_0x12a343));}}else copyFileSync(_0x1192c0,_0x4c9d47);}function a77_0x242b(_0x56a179,_0xa8e854){_0x56a179=_0x56a179-0x76;const _0x5cc6df=a77_0x5cc6();let _0x242b16=_0x5cc6df[_0x56a179];return _0x242b16;}export function ensureDir(_0x43e20c){!existsSync(_0x43e20c)&&mkdirSync(_0x43e20c,{'recursive':!![]});}export function pathExists(_0x5f37e2){return existsSync(_0x5f37e2);}
|
package/lib/utils/guides-cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a78_0x4ce2b3=a78_0x11c6;(function(_0x111861,_0x5680ba){const _0x31573f=a78_0x11c6,_0x52a243=_0x111861();while(!![]){try{const _0x2a5a13=-parseInt(_0x31573f(0x1ce))/0x1+-parseInt(_0x31573f(0x1c8))/0x2+parseInt(_0x31573f(0x1d1))/0x3+parseInt(_0x31573f(0x1e9))/0x4*(parseInt(_0x31573f(0x1c6))/0x5)+-parseInt(_0x31573f(0x1f1))/0x6+parseInt(_0x31573f(0x1cc))/0x7+parseInt(_0x31573f(0x1cd))/0x8*(parseInt(_0x31573f(0x1d3))/0x9);if(_0x2a5a13===_0x5680ba)break;else _0x52a243['push'](_0x52a243['shift']());}catch(_0x574ff4){_0x52a243['push'](_0x52a243['shift']());}}}(a78_0x1be2,0x63021));import{mkdirSync,writeFileSync}from'node:fs';import{dirname,join}from'node:path';import{getTemplateBaseUrl}from'./config.js';function a78_0x1be2(){const _0x1d66d9=['262444RuJtMo','guide.md','guides','requireFlags','3932586AiHbyW','8eYLhhD','526729kCssPY','json','utf-8','1020627KmiUun','title','181800UlpyaQ','lastUpdated','length','push','path','some','includes','object','sort','map','\x0a\x0a>更新时间:','test','\x0a<!--\x20GUIDES_APPEND\x20-->','entries','CDN\x20数据中缺少\x20skillTemplate','extendContent','.lovrabet/skill/.shared/guides','HOME','keys','/skills/guides-extend.json','.lovrabet','cache','28KieMuA','<!--\x20GUIDES_APPEND\x20-->','status','indexOf','content','CDN\x20请求失败:\x20','application/json','join','2999304zYlbGc','skillTemplate','trimEnd','statusText','env','`\x20|\x20','457975TlMgHG','replace'];a78_0x1be2=function(){return _0x1d66d9;};return a78_0x1be2();}function getGuidesCdnUrl(){const _0x3f056a=getTemplateBaseUrl();return _0x3f056a+'/skills/guides.json';}function getGuidesExtendCdnUrl(){const _0x9b7c4=a78_0x11c6,_0x59fa50=getTemplateBaseUrl();return _0x59fa50+_0x9b7c4(0x1e6);}const CACHE_DIR=join(process[a78_0x4ce2b3(0x1f5)][a78_0x4ce2b3(0x1e4)]||process['env']['USERPROFILE']||'',a78_0x4ce2b3(0x1e7),a78_0x4ce2b3(0x1e8));export async function fetchGuidesFromCDN(_0x2d6289=![]){const _0x575504=a78_0x4ce2b3,_0x47940b=getGuidesCdnUrl(),_0x178d74=await fetch(_0x47940b,{'headers':{'Accept':'application/json'}});if(!_0x178d74['ok'])throw new Error(_0x575504(0x1ee)+_0x178d74[_0x575504(0x1eb)]+'\x20'+_0x178d74[_0x575504(0x1f4)]);const _0x3b093a=await _0x178d74[_0x575504(0x1cf)]();if(!_0x3b093a[_0x575504(0x1ca)]||typeof _0x3b093a[_0x575504(0x1ca)]!=='object')throw new Error('CDN\x20返回数据格式错误');if(!_0x2d6289)return _0x3b093a;try{const _0x31f28b=getGuidesExtendCdnUrl(),_0x2effc3=await fetch(_0x31f28b,{'headers':{'Accept':_0x575504(0x1ef)}});if(_0x2effc3['ok']){const _0x1713fa=await _0x2effc3[_0x575504(0x1cf)]();_0x1713fa[_0x575504(0x1ca)]&&typeof _0x1713fa['guides']===_0x575504(0x1da)&&(_0x3b093a[_0x575504(0x1ca)]={..._0x3b093a[_0x575504(0x1ca)],..._0x1713fa[_0x575504(0x1ca)]});}}catch{}return _0x3b093a;}export function writeGuidesToProject(_0x16aca7,_0x3edf68,_0x527519=a78_0x4ce2b3(0x1e3),_0x141cf0){const _0x30ef2e=a78_0x4ce2b3,_0x531d4f=join(_0x3edf68,_0x527519);for(const [_0x3eabba,_0x50433c]of Object[_0x30ef2e(0x1e0)](_0x16aca7[_0x30ef2e(0x1ca)])){if(_0x50433c['requireFlags']&&_0x50433c[_0x30ef2e(0x1cb)]['length']>0x0){const _0x108b40=_0x50433c[_0x30ef2e(0x1cb)][_0x30ef2e(0x1d8)](_0x4249f5=>_0x141cf0?.[_0x30ef2e(0x1d9)](_0x4249f5));if(!_0x108b40)continue;}const _0x16b643=join(_0x531d4f,_0x3eabba);mkdirSync(_0x16b643,{'recursive':!![]});let _0x4d48e8=_0x50433c[_0x30ef2e(0x1ed)];_0x50433c[_0x30ef2e(0x1d4)]&&(_0x4d48e8=appendUpdateTime(_0x4d48e8,_0x50433c[_0x30ef2e(0x1d4)])),writeFileSync(join(_0x16b643,_0x30ef2e(0x1c9)),_0x4d48e8,'utf-8');}}export function appendUpdateTime(_0x1d915b,_0x3a534e){const _0x25ba40=a78_0x4ce2b3;return _0x1d915b=_0x1d915b[_0x25ba40(0x1c7)](/\n*>更新时间:.*$/m,''),_0x1d915b[_0x25ba40(0x1f3)]()+(_0x25ba40(0x1dd)+_0x3a534e);}export function getSkillTemplate(_0x5ca5d1){const _0x13d291=a78_0x4ce2b3;return _0x5ca5d1[_0x13d291(0x1f2)]?.[_0x13d291(0x1ed)]||'';}export function appendExtendContents(_0x3e136d,_0x34b677,_0x33b952){const _0x204bc8=a78_0x4ce2b3,_0x5b22b8=[];for(const [_0x6f30ee,_0x46c847]of Object[_0x204bc8(0x1e0)](_0x34b677[_0x204bc8(0x1ca)])){if(_0x46c847['requireFlags']&&_0x46c847[_0x204bc8(0x1cb)][_0x204bc8(0x1d5)]>0x0){const _0x345d0b=_0x46c847[_0x204bc8(0x1cb)]['some'](_0xada7c3=>_0x33b952?.['includes'](_0xada7c3));if(!_0x345d0b)continue;}_0x46c847[_0x204bc8(0x1e2)]&&_0x5b22b8[_0x204bc8(0x1d6)](_0x46c847['extendContent']['trimEnd']());}if(_0x5b22b8[_0x204bc8(0x1d5)]===0x0)return _0x3e136d;return _0x3e136d[_0x204bc8(0x1f3)]()+'\x0a\x0a'+_0x5b22b8[_0x204bc8(0x1f0)]('\x0a\x0a')+'\x0a';}export function writeSkillFile(_0x4ecbcd,_0xd31cd0,_0x56261e,_0x206c7f){const _0x1ff0b1=a78_0x4ce2b3,_0x5eb888=getSkillTemplate(_0x4ecbcd);if(!_0x5eb888)throw new Error(_0x1ff0b1(0x1e1));const _0x57a67c=dirname(_0xd31cd0);mkdirSync(_0x57a67c,{'recursive':!![]});let _0x2cd550=_0x5eb888[_0x1ff0b1(0x1c7)](/\{\{IDE_NAME\}\}/g,_0x56261e);_0x2cd550=insertGuidesSection(_0x2cd550,_0x4ecbcd,_0x206c7f),_0x2cd550=appendExtendContents(_0x2cd550,_0x4ecbcd,_0x206c7f),_0x4ecbcd['skillTemplate'][_0x1ff0b1(0x1d4)]&&(_0x2cd550=appendUpdateTime(_0x2cd550,_0x4ecbcd['skillTemplate'][_0x1ff0b1(0x1d4)])),writeFileSync(_0xd31cd0,_0x2cd550,_0x1ff0b1(0x1d0));}export function insertGuidesSection(_0x7ca1be,_0x16cb4d,_0x58a352){const _0x4b48fa=a78_0x4ce2b3,_0x18abf2='<!--\x20GUIDES_APPEND\x20-->',_0x364f2e=_0x7ca1be[_0x4b48fa(0x1ec)](_0x18abf2);if(_0x364f2e===-0x1)return _0x7ca1be;const _0x3d35d5=[],_0x3179f6=Object[_0x4b48fa(0x1e5)](_0x16cb4d[_0x4b48fa(0x1ca)])[_0x4b48fa(0x1db)]();for(const _0x4f347b of _0x3179f6){const _0x3c72a2=_0x16cb4d[_0x4b48fa(0x1ca)][_0x4f347b];if(!_0x3c72a2)continue;if(/^0[1-6]-/[_0x4b48fa(0x1de)](_0x4f347b))continue;if(_0x3c72a2[_0x4b48fa(0x1cb)]&&_0x3c72a2[_0x4b48fa(0x1cb)][_0x4b48fa(0x1d5)]>0x0){const _0x3d5e28=_0x3c72a2[_0x4b48fa(0x1cb)][_0x4b48fa(0x1d8)](_0x34db6a=>_0x58a352?.[_0x4b48fa(0x1d9)](_0x34db6a));if(!_0x3d5e28)continue;}const _0x2f783a=_0x3c72a2[_0x4b48fa(0x1d7)][_0x4b48fa(0x1c7)](/^\.lovrabet\/skill\/\.shared\/guides\//,'');_0x3d35d5[_0x4b48fa(0x1d6)]('|\x20`'+_0x2f783a+_0x4b48fa(0x1f6)+_0x3c72a2[_0x4b48fa(0x1d2)]+'\x20|');}if(_0x3d35d5[_0x4b48fa(0x1d5)]===0x0)return _0x7ca1be[_0x4b48fa(0x1c7)](_0x18abf2,_0x4b48fa(0x1ea));const _0x59373e=_0x3d35d5[_0x4b48fa(0x1f0)]('\x0a');return _0x7ca1be[_0x4b48fa(0x1c7)](_0x18abf2,_0x59373e+_0x4b48fa(0x1df));}export async function installGuides(_0x153875){const _0x36c372=a78_0x4ce2b3,_0x42f4fa=await fetchGuidesFromCDN();return writeGuidesToProject(_0x42f4fa,_0x153875),Object[_0x36c372(0x1e5)](_0x42f4fa['guides'])[_0x36c372(0x1d5)];}function a78_0x11c6(_0x4df885,_0x65fbb9){_0x4df885=_0x4df885-0x1c6;const _0x1be253=a78_0x1be2();let _0x11c66d=_0x1be253[_0x4df885];return _0x11c66d;}export function getGuidesSummary(_0x5e83f9){const _0xc19835=a78_0x4ce2b3;return Object[_0xc19835(0x1e0)](_0x5e83f9[_0xc19835(0x1ca)])[_0xc19835(0x1dc)](([_0x303366,_0x575fdc])=>({'key':_0x303366,'title':_0x575fdc[_0xc19835(0x1d2)],'path':_0x575fdc[_0xc19835(0x1d7)]}));}
|
package/lib/utils/http-client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x9be630,_0x40633c){const _0x19a2fc=a79_0x2168,_0x5d258c=_0x9be630();while(!![]){try{const _0x2138bb=parseInt(_0x19a2fc(0x142))/0x1*(-parseInt(_0x19a2fc(0x145))/0x2)+parseInt(_0x19a2fc(0x135))/0x3+-parseInt(_0x19a2fc(0x13c))/0x4*(parseInt(_0x19a2fc(0x13b))/0x5)+parseInt(_0x19a2fc(0x14d))/0x6+parseInt(_0x19a2fc(0x132))/0x7+parseInt(_0x19a2fc(0x144))/0x8+-parseInt(_0x19a2fc(0x143))/0x9*(parseInt(_0x19a2fc(0x14b))/0xa);if(_0x2138bb===_0x40633c)break;else _0x5d258c['push'](_0x5d258c['shift']());}catch(_0x40faa6){_0x5d258c['push'](_0x5d258c['shift']());}}}(a79_0x4128,0x798e3));export async function httpRequest(_0x2a1639,_0x29caa2={}){const _0x7fc4ff=a79_0x2168,{timeout:timeout=0x7530,retries:retries=0x3,retryDelay:retryDelay=0x3e8,headers:headers={}}=_0x29caa2;let _0x1fd583=null;for(let _0x29cd8c=0x0;_0x29cd8c<=retries;_0x29cd8c++){try{const _0x1e2412=new AbortController(),_0x4b64d4=setTimeout(()=>_0x1e2412[_0x7fc4ff(0x14a)](),timeout),_0x420aab=await fetch(_0x2a1639,{'headers':headers,'signal':_0x1e2412[_0x7fc4ff(0x13f)]});clearTimeout(_0x4b64d4);let _0xbc8893;const _0x544714=_0x420aab['headers'][_0x7fc4ff(0x138)]('content-type');return _0x544714?.[_0x7fc4ff(0x14c)](_0x7fc4ff(0x141))?_0xbc8893=await _0x420aab[_0x7fc4ff(0x140)]():_0xbc8893=await _0x420aab[_0x7fc4ff(0x149)](),{'ok':_0x420aab['ok'],'status':_0x420aab[_0x7fc4ff(0x137)],'statusText':_0x420aab[_0x7fc4ff(0x148)],'data':_0xbc8893,'headers':_0x420aab[_0x7fc4ff(0x130)],'url':_0x420aab[_0x7fc4ff(0x136)],'text':()=>_0x420aab[_0x7fc4ff(0x149)]()};}catch(_0xa131ff){_0x1fd583=_0xa131ff instanceof Error?_0xa131ff:new Error(String(_0xa131ff));if(_0x29cd8c===retries)break;if(shouldRetry(_0xa131ff)){console[_0x7fc4ff(0x131)]('*\x20请求失败,'+retryDelay+_0x7fc4ff(0x13a)+(_0x29cd8c+0x1)+_0x7fc4ff(0x134)),await sleep(retryDelay);continue;}else break;}}throw _0x1fd583||new Error(_0x7fc4ff(0x146));}function shouldRetry(_0x41dcc3){const _0x1ed5d6=a79_0x2168;if(_0x41dcc3 instanceof Error){if(_0x41dcc3[_0x1ed5d6(0x13e)]==='AbortError')return![];if(_0x41dcc3[_0x1ed5d6(0x13e)]==='TypeError'&&_0x41dcc3['message'][_0x1ed5d6(0x14c)](_0x1ed5d6(0x147)))return!![];if(_0x41dcc3[_0x1ed5d6(0x139)][_0x1ed5d6(0x14c)](_0x1ed5d6(0x13d)))return!![];if(_0x41dcc3[_0x1ed5d6(0x139)][_0x1ed5d6(0x14c)](_0x1ed5d6(0x133)))return![];}return![];}function sleep(_0x4b12c8){return new Promise(_0x16f3b0=>setTimeout(_0x16f3b0,_0x4b12c8));}export function validateUrl(_0x2068a5){try{return new URL(_0x2068a5),!![];}catch{return![];}}function a79_0x2168(_0x50c2e0,_0xa7005c){_0x50c2e0=_0x50c2e0-0x130;const _0x41282e=a79_0x4128();let _0x216816=_0x41282e[_0x50c2e0];return _0x216816;}function a79_0x4128(){const _0x410a13=['status','get','message','ms\x20后进行第\x20','32425xMIhnv','92JHrdLv','ECONNRESET','name','signal','json','application/json','331766KptwRN','9BZlVAW','6727088OqfzjK','2WYcskj','Request\x20failed','fetch','statusText','text','abort','7774630EjBVeu','includes','613482uSINzX','headers','log','756917OoximK','ENOTFOUND','\x20次重试...','2115033KVAXAm','url'];a79_0x4128=function(){return _0x410a13;};return a79_0x4128();}
|
package/lib/utils/logger.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a80_0x402d(_0x3fbf56,_0x4c6ace){_0x3fbf56=_0x3fbf56-0xfd;const _0x120237=a80_0x1202();let _0x402d1b=_0x120237[_0x3fbf56];return _0x402d1b;}const a80_0x129492=a80_0x402d;function a80_0x1202(){const _0x53d4ed=['timestamp','info','290GcnmVe','success','开始执行:\x20','2491416gJRmIJ','.lovrabet.log','logFilePath','combine','logTask','1804130xJtOOC','blue','3119872AnwCxo','currentRawCommand','message','addColors','150wXYLUQ','yellow','8mvuRbC','warn','readLogs','command','714033knCdXa','失败:\x20','details','getWinstonInstance','File','duration','完成:\x20','split','filter','green','clearLogs','utf8','1330652WQJgNn','5413960WbnNMP','initWinstonLogger','trim','error','Failed\x20to\x20read\x20logs:','existsSync','setLogPath','red','join','format','winstonLogger','15508MZUZHw','now'];a80_0x1202=function(){return _0x53d4ed;};return a80_0x1202();}(function(_0x3713bc,_0x375cd5){const _0x1683d8=a80_0x402d,_0x1247f1=_0x3713bc();while(!![]){try{const _0x1a341b=parseInt(_0x1683d8(0x114))/0x1+parseInt(_0x1683d8(0x12c))/0x2+parseInt(_0x1683d8(0x102))/0x3*(-parseInt(_0x1683d8(0x120))/0x4)+parseInt(_0x1683d8(0x115))/0x5+parseInt(_0x1683d8(0x127))/0x6+parseInt(_0x1683d8(0xfe))/0x7*(-parseInt(_0x1683d8(0x104))/0x8)+parseInt(_0x1683d8(0x108))/0x9*(-parseInt(_0x1683d8(0x124))/0xa);if(_0x1a341b===_0x375cd5)break;else _0x1247f1['push'](_0x1247f1['shift']());}catch(_0x185aaa){_0x1247f1['push'](_0x1247f1['shift']());}}}(a80_0x1202,0xc0f9a));import a80_0x4fc2c5 from'winston';import a80_0x5b8d76 from'node:fs';import a80_0x489d16 from'node:path';class Logger{[a80_0x129492(0x11f)];[a80_0x129492(0x129)];[a80_0x129492(0xff)]='';constructor(){const _0x51f43e=a80_0x129492;this[_0x51f43e(0x129)]='';}['setRawCommand'](_0x5e2f0c){const _0xc41d8a=a80_0x129492;this[_0xc41d8a(0xff)]=_0x5e2f0c;}[a80_0x129492(0x116)](){const _0x590395=a80_0x129492,_0x5b26a0=a80_0x489d16['dirname'](this['logFilePath']);!a80_0x5b8d76[_0x590395(0x11a)](_0x5b26a0)&&a80_0x5b8d76['mkdirSync'](_0x5b26a0,{'recursive':!![]});const _0xab2090=a80_0x4fc2c5[_0x590395(0x11e)][_0x590395(0x12a)](a80_0x4fc2c5[_0x590395(0x11e)][_0x590395(0x122)](),a80_0x4fc2c5['format']['errors']({'stack':!![]}),a80_0x4fc2c5[_0x590395(0x11e)]['printf'](_0xf81f5d=>{const _0x52a9e7=_0x590395,_0x4cfa59={'timestamp':_0xf81f5d[_0x52a9e7(0x122)]||new Date()['toISOString'](),'level':_0xf81f5d['level']||_0x52a9e7(0x123),'command':_0xf81f5d[_0x52a9e7(0x107)]||'unknown','rawCommand':_0xf81f5d['rawCommand']||this[_0x52a9e7(0xff)]||undefined,'message':_0xf81f5d[_0x52a9e7(0x100)]||'','duration':_0xf81f5d[_0x52a9e7(0x10d)]||undefined,'details':_0xf81f5d[_0x52a9e7(0x10a)]||undefined};return JSON['stringify'](_0x4cfa59);}));this[_0x590395(0x11f)]=a80_0x4fc2c5['createLogger']({'level':_0x590395(0x123),'format':_0xab2090,'transports':[new a80_0x4fc2c5['transports'][(_0x590395(0x10c))]({'filename':this['logFilePath'],'level':_0x590395(0x123)})],'silent':![]}),a80_0x4fc2c5[_0x590395(0x101)]({'success':_0x590395(0x111),'error':_0x590395(0x11c),'warn':_0x590395(0x103),'info':_0x590395(0xfd)});}[a80_0x129492(0x11b)](_0x5bb387){const _0x4ea2e1=a80_0x129492;this[_0x4ea2e1(0x129)]=a80_0x489d16[_0x4ea2e1(0x11d)](_0x5bb387,_0x4ea2e1(0x128)),this[_0x4ea2e1(0x11f)]&&this[_0x4ea2e1(0x11f)]['clear'](),this['initWinstonLogger']();}['info'](_0x2718e8,_0x3928c4,_0x507de5){const _0x108894=a80_0x129492;if(!this['logFilePath']||!this[_0x108894(0x11f)])return;this[_0x108894(0x11f)]['info'](_0x3928c4,{'command':_0x2718e8,'details':_0x507de5});}[a80_0x129492(0x125)](_0x161b94,_0x59a576,_0x12f402,_0x5a562e){const _0x3f5287=a80_0x129492;if(!this['logFilePath']||!this['winstonLogger'])return;this[_0x3f5287(0x11f)]['log'](_0x3f5287(0x123),_0x59a576,{'level':'success','command':_0x161b94,'duration':_0x12f402,'details':_0x5a562e});}[a80_0x129492(0x118)](_0x43891f,_0x5a4ce7,_0x31090d){const _0x5a6001=a80_0x129492;if(!this['logFilePath']||!this[_0x5a6001(0x11f)])return;this[_0x5a6001(0x11f)][_0x5a6001(0x118)](_0x5a4ce7,{'command':_0x43891f,'details':_0x31090d});}[a80_0x129492(0x105)](_0x5f4d4d,_0x567326,_0x5b5a0d){const _0x6a39c3=a80_0x129492;if(!this[_0x6a39c3(0x129)]||!this[_0x6a39c3(0x11f)])return;this[_0x6a39c3(0x11f)][_0x6a39c3(0x105)](_0x567326,{'command':_0x5f4d4d,'details':_0x5b5a0d});}async[a80_0x129492(0x12b)](_0x1a5207,_0x3503bc,_0x2cbcd4){const _0x3ad863=a80_0x129492,_0x3b7e97=Date[_0x3ad863(0x121)]();this[_0x3ad863(0x123)](_0x1a5207,_0x3ad863(0x126)+_0x3503bc);try{const _0x34014a=await _0x2cbcd4(),_0x397036=Date[_0x3ad863(0x121)]()-_0x3b7e97;return this[_0x3ad863(0x125)](_0x1a5207,_0x3ad863(0x10e)+_0x3503bc,_0x397036),_0x34014a;}catch(_0xe083e1){const _0x5b1d93=Date['now']()-_0x3b7e97;this[_0x3ad863(0x118)](_0x1a5207,_0x3ad863(0x109)+_0x3503bc,{'error':_0xe083e1 instanceof Error?_0xe083e1[_0x3ad863(0x100)]:String(_0xe083e1),'duration':_0x5b1d93});throw _0xe083e1;}}[a80_0x129492(0x106)](){const _0x32a629=a80_0x129492;try{if(!a80_0x5b8d76[_0x32a629(0x11a)](this[_0x32a629(0x129)]))return[];const _0x25f418=a80_0x5b8d76['readFileSync'](this[_0x32a629(0x129)],_0x32a629(0x113));return _0x25f418[_0x32a629(0x10f)]('\x0a')[_0x32a629(0x110)](_0x2f5439=>_0x2f5439[_0x32a629(0x117)]())['map'](_0x34d2a4=>JSON['parse'](_0x34d2a4));}catch(_0x8cf3a0){return console[_0x32a629(0x105)](_0x32a629(0x119),_0x8cf3a0),[];}}[a80_0x129492(0x112)](){const _0x5e470b=a80_0x129492;try{a80_0x5b8d76[_0x5e470b(0x11a)](this[_0x5e470b(0x129)])&&a80_0x5b8d76['writeFileSync'](this[_0x5e470b(0x129)],'','utf8');}catch(_0x337574){console['warn']('Failed\x20to\x20clear\x20logs:',_0x337574);}}[a80_0x129492(0x10b)](){return this['winstonLogger'];}}export const logger=new Logger();
|
package/lib/utils/rules-cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a81_0x7d5378=a81_0x5dcd;(function(_0xb2b37b,_0x131c11){const _0x3c3c29=a81_0x5dcd,_0x55c4e2=_0xb2b37b();while(!![]){try{const _0x193b18=-parseInt(_0x3c3c29(0x1b0))/0x1+parseInt(_0x3c3c29(0x1b9))/0x2+parseInt(_0x3c3c29(0x1b6))/0x3+-parseInt(_0x3c3c29(0x1aa))/0x4*(parseInt(_0x3c3c29(0x1c2))/0x5)+parseInt(_0x3c3c29(0x1bb))/0x6*(parseInt(_0x3c3c29(0x1ba))/0x7)+parseInt(_0x3c3c29(0x1b4))/0x8+-parseInt(_0x3c3c29(0x1b8))/0x9;if(_0x193b18===_0x131c11)break;else _0x55c4e2['push'](_0x55c4e2['shift']());}catch(_0x37ad76){_0x55c4e2['push'](_0x55c4e2['shift']());}}}(a81_0x1a5f,0xe8aa9));import{existsSync,mkdirSync,readFileSync,writeFileSync}from'node:fs';import{dirname,join,resolve}from'node:path';import{fileURLToPath}from'node:url';import{getTemplateBaseUrl}from'./config.js';import{appendUpdateTime}from'./guides-cdn.js';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename);function getRulesCdnUrl(){const _0x19d398=a81_0x5dcd,_0x14d62e=getTemplateBaseUrl();return _0x14d62e+_0x19d398(0x1bc);}const LOCAL_TEMPLATE_PATH=resolve(__dirname,a81_0x7d5378(0x1af));export async function fetchRulesFromCDN(){const _0x2c4e69=a81_0x7d5378,_0x1adb9f=getRulesCdnUrl(),_0x161596=await fetch(_0x1adb9f,{'headers':{'Accept':_0x2c4e69(0x1c1)}});if(!_0x161596['ok'])throw new Error(_0x2c4e69(0x1b5)+_0x161596[_0x2c4e69(0x1b1)]+'\x20'+_0x161596[_0x2c4e69(0x1be)]);const _0x585b55=await _0x161596[_0x2c4e69(0x1ab)]();if(!_0x585b55[_0x2c4e69(0x1bd)]||typeof _0x585b55[_0x2c4e69(0x1bd)]!==_0x2c4e69(0x1ad))throw new Error(_0x2c4e69(0x1b3));return _0x585b55;}export async function getRulesContent(){const _0x91d07d=a81_0x7d5378;try{const _0x2d8083=await fetchRulesFromCDN();return _0x2d8083[_0x91d07d(0x1bd)];}catch{return readLocalTemplate();}}export function readLocalTemplate(){const _0x5d0cd2=a81_0x7d5378;if(existsSync(LOCAL_TEMPLATE_PATH))return readFileSync(LOCAL_TEMPLATE_PATH,_0x5d0cd2(0x1b7));throw new Error(_0x5d0cd2(0x1ac)+LOCAL_TEMPLATE_PATH);}export async function writeRulesFile(_0x44017d){const _0x5d7e46=a81_0x7d5378,_0x54aa78=await fetchRulesFromCDN()[_0x5d7e46(0x1c0)](()=>null);let _0x33973a;_0x54aa78?(_0x33973a=_0x54aa78[_0x5d7e46(0x1bd)],_0x54aa78[_0x5d7e46(0x1b2)]&&(_0x33973a=appendUpdateTime(_0x33973a,_0x54aa78[_0x5d7e46(0x1b2)]))):_0x33973a=readLocalTemplate();const _0x12fef3=dirname(_0x44017d);!existsSync(_0x12fef3)&&mkdirSync(_0x12fef3,{'recursive':!![]}),writeFileSync(_0x44017d,_0x33973a,'utf-8');}function a81_0x1a5f(){const _0x499a8e=['91164mPDZbe','/rules/rules.json','content','statusText','.cursor/rules','catch','application/json','8705COOOQy','4344mfehIA','json','本地模板文件不存在:\x20','string','agents.md','../../cdn-source/rules/lovrabet_rules.mdc.tpl','1819970EtBnRJ','status','lastUpdated','CDN\x20返回数据格式错误','6977968cAgoyP','CDN\x20请求失败:\x20','4326399LlRljr','utf-8','803799MCbgJP','1747294RtqBYr','721uoRpwy'];a81_0x1a5f=function(){return _0x499a8e;};return a81_0x1a5f();}export async function copyRulesToCursor(_0x33a276){const _0x5dd719=a81_0x7d5378,_0x573c29=join(_0x33a276,_0x5dd719(0x1bf)),_0x283026=join(_0x573c29,'lovrabet_rules.mdc');if(existsSync(_0x283026))return![];return await writeRulesFile(_0x283026),!![];}function a81_0x5dcd(_0x4b6de1,_0xbc93ab){_0x4b6de1=_0x4b6de1-0x1aa;const _0x1a5ffc=a81_0x1a5f();let _0x5dcdb9=_0x1a5ffc[_0x4b6de1];return _0x5dcdb9;}export async function copyRulesToAgentsMd(_0x58cc95){const _0x4abea6=a81_0x7d5378,_0x299da0=join(_0x58cc95,_0x4abea6(0x1ae));if(existsSync(_0x299da0))return![];return await writeRulesFile(_0x299da0),!![];}
|
package/lib/utils/sleep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function sleep(
|
|
1
|
+
export function sleep(_0x3353c0){return new Promise(_0xbdbc80=>setTimeout(_0xbdbc80,_0x3353c0));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function a83_0x4561(){const _0x32b549=['alias','toLowerCase','2-digit','replace','api','replaceApiContent','416456GXJMMG','7hNtyZY','join','slice','mkdir','map','../../package.json','promises','\x0a\x20\x20\x20\x20{\x20','error','processFile','toDisplayTitle','extname','41151mlOcyh','replaceContent','.scss','\x20},','copyFile','endsWith','default','345763xGyorc','.css','toComponentName','readFile','datasetCode','processDirectory','1308895iKGiXP','alias:\x20\x22','pop','.ts','22OuWOMy','split','includes','isDirectory','numeric','readdir','2170395UCGqZs','模板内容替换失败','YourModel','18183xLfSQI','.tpl','845250uuUZlT','120VEhRgg','模板内容替换完成','name:\x20\x22','toLocaleString','name','.tsx','writeFile','4dzpmRf','开始处理模板内容替换','toUpperCase','utf8','toLocaleTimeString','tableName:\x20\x22','push','processTemplate','info','template','charAt','version','now','datasetCode:\x20\x22'];a83_0x4561=function(){return _0x32b549;};return a83_0x4561();}function a83_0xa8ef(_0x116534,_0x903728){_0x116534=_0x116534-0x86;const _0x456121=a83_0x4561();let _0xa8efe4=_0x456121[_0x116534];return _0xa8efe4;}const a83_0x2cee84=a83_0xa8ef;(function(_0x48af61,_0x4f54e2){const _0x1cfa99=a83_0xa8ef,_0xf9c472=_0x48af61();while(!![]){try{const _0x32492a=-parseInt(_0x1cfa99(0xbf))/0x1+parseInt(_0x1cfa99(0xc9))/0x2*(-parseInt(_0x1cfa99(0xb8))/0x3)+parseInt(_0x1cfa99(0x97))/0x4*(parseInt(_0x1cfa99(0xc5))/0x5)+parseInt(_0x1cfa99(0x8f))/0x6+-parseInt(_0x1cfa99(0xac))/0x7*(-parseInt(_0x1cfa99(0xab))/0x8)+parseInt(_0x1cfa99(0x8a))/0x9+parseInt(_0x1cfa99(0x90))/0xa*(-parseInt(_0x1cfa99(0x8d))/0xb);if(_0x32492a===_0x4f54e2)break;else _0xf9c472['push'](_0xf9c472['shift']());}catch(_0x5c58e5){_0xf9c472['push'](_0xf9c472['shift']());}}}(a83_0x4561,0x2bcb4));import a83_0x1cdcbb from'node:fs';import a83_0x58ef98 from'node:path';import{createRequire}from'node:module';import{logger}from'./logger.js';const require=createRequire(import.meta.url),CLI_VERSION=require(a83_0x2cee84(0xb1))[a83_0x2cee84(0xa2)];export class TemplateReplacer{static[a83_0x2cee84(0xc1)](_0x45b9c5){const _0x4422bb=a83_0x2cee84,_0x2d8e28=_0x45b9c5[_0x4422bb(0xca)]('/')[_0x4422bb(0xc7)]()||_0x45b9c5;return _0x2d8e28[_0x4422bb(0xca)]('-')[_0x4422bb(0xb0)](_0x370d3e=>_0x370d3e[_0x4422bb(0xa1)](0x0)[_0x4422bb(0x99)]()+_0x370d3e[_0x4422bb(0xae)](0x1)[_0x4422bb(0xa6)]())[_0x4422bb(0xad)]('');}static['toDisplayTitle'](_0x476240){const _0x193f12=a83_0x2cee84,_0x5bb110=_0x476240[_0x193f12(0xca)]('/')['pop']()||_0x476240;return _0x5bb110[_0x193f12(0xca)]('-')[_0x193f12(0xb0)](_0x22e236=>_0x22e236[_0x193f12(0xa1)](0x0)[_0x193f12(0x99)]()+_0x22e236[_0x193f12(0xae)](0x1)[_0x193f12(0xa6)]())[_0x193f12(0xad)]('\x20');}static['replaceContent'](_0x885fe,_0x1fc2a5,_0x4731e2){const _0x3ece0b=a83_0x2cee84,_0x59b484=this['toComponentName'](_0x1fc2a5),_0x1c4556=this[_0x3ece0b(0xb6)](_0x1fc2a5),_0xd79085=new Date(),_0x32c92c=_0xd79085[_0x3ece0b(0x93)](undefined,{'year':'numeric','month':'2-digit','day':_0x3ece0b(0xa7),'hour':'2-digit','minute':'2-digit','second':_0x3ece0b(0xa7),'hour12':![]})[_0x3ece0b(0xa8)](/\//g,'-'),_0xa6bf71=_0xd79085['toLocaleDateString'](undefined,{'year':_0x3ece0b(0x88),'month':_0x3ece0b(0xa7),'day':_0x3ece0b(0xa7)})['replace'](/\//g,'-'),_0x584a79=_0xd79085[_0x3ece0b(0x9b)](undefined,{'hour12':![]});let _0x5f554b=_0x885fe[_0x3ece0b(0xa8)](/\{CliVersion\}/g,CLI_VERSION)[_0x3ece0b(0xa8)](/\{ComponentName\}/g,_0x59b484)[_0x3ece0b(0xa8)](/\{DisplayTitle\}/g,_0x1c4556)[_0x3ece0b(0xa8)](/\{PageName\}/g,_0x1fc2a5)['replace'](/\{TemplateName\}/g,_0x4731e2)[_0x3ece0b(0xa8)](/\{CreatedAt\}/g,_0x32c92c)[_0x3ece0b(0xa8)](/\{CreatedDate\}/g,_0xa6bf71)[_0x3ece0b(0xa8)](/\{CreatedTime\}/g,_0x584a79);return _0x5f554b;}static[a83_0x2cee84(0xaa)](_0x2eb3ef,_0x5886a2,_0x1a04f2,_0x27f9f5,_0x5ceebd,_0x2c95fa,_0x236cc9){const _0xf722cf=a83_0x2cee84,_0x490f6a=new Date(),_0x407837=_0x490f6a['toISOString'](),_0x57cfc0=_0x1a04f2[_0xf722cf(0xb0)](_0x45f168=>{const _0x5a0919=_0xf722cf,_0x11a0d9=[_0x5a0919(0xa4)+_0x45f168[_0x5a0919(0xc3)]+'\x22',_0x5a0919(0x9c)+_0x45f168['tableName']+'\x22',_0x5a0919(0x92)+_0x45f168[_0x5a0919(0x94)]+'\x22'];return _0x45f168[_0x5a0919(0xa5)]&&_0x11a0d9[_0x5a0919(0x9d)](_0x5a0919(0xc6)+_0x45f168[_0x5a0919(0xa5)]+'\x22'),_0x5a0919(0xb3)+_0x11a0d9['join'](',\x20')+_0x5a0919(0xbb);})[_0xf722cf(0xad)](''),_0x49cd68=_0x27f9f5||_0x1a04f2[0x0]?.[_0xf722cf(0xa5)]||_0xf722cf(0x8c);let _0x5d79e7=_0x2eb3ef[_0xf722cf(0xa8)](/\{AppCode\}/g,_0x5886a2)[_0xf722cf(0xa8)](/\{ModelConfigs\}/g,_0x57cfc0)[_0xf722cf(0xa8)](/\{ExampleModelName\}/g,_0x49cd68)['replace'](/\{ApiFileName\}/g,_0x5ceebd||_0xf722cf(0xa9))[_0xf722cf(0xa8)](/\{ConfigName\}/g,_0x2c95fa||_0xf722cf(0xbe))['replace'](/\{ClientConfigParam\}/g,_0x236cc9||'')[_0xf722cf(0xa8)](/\{CreatedAt\}/g,_0x407837);return _0x5d79e7;}static async[a83_0x2cee84(0x9e)](_0x54f4a2,_0x11432d,_0x47aa23,_0x3844eb,_0x52998c=!![]){const _0x53643c=a83_0x2cee84,_0x20c78a=Date[_0x53643c(0xa3)]();try{_0x52998c&&logger[_0x53643c(0x9f)](_0x53643c(0xa0),_0x53643c(0x98),{'templatePath':_0x54f4a2,'targetPath':_0x11432d,'pageName':_0x47aa23,'templateName':_0x3844eb});await a83_0x1cdcbb[_0x53643c(0xb2)][_0x53643c(0xaf)](_0x11432d,{'recursive':!![]}),await this[_0x53643c(0xc4)](_0x54f4a2,_0x11432d,_0x47aa23,_0x3844eb);if(_0x52998c){const _0x3197d7=Date[_0x53643c(0xa3)]()-_0x20c78a;logger['success'](_0x53643c(0xa0),_0x53643c(0x91),_0x3197d7,{'pageName':_0x47aa23,'templateName':_0x3844eb});}}catch(_0x1462b6){if(_0x52998c){const _0x4383d4=Date[_0x53643c(0xa3)]()-_0x20c78a;logger[_0x53643c(0xb4)]('template',_0x53643c(0x8b),{'templatePath':_0x54f4a2,'targetPath':_0x11432d,'pageName':_0x47aa23,'templateName':_0x3844eb,'error':_0x1462b6 instanceof Error?_0x1462b6['message']:String(_0x1462b6),'duration':_0x4383d4});}throw _0x1462b6;}}static async['processDirectory'](_0x3be36f,_0x5a4327,_0x409831,_0x3f7700){const _0xf79d2e=a83_0x2cee84,_0x10beed=await a83_0x1cdcbb[_0xf79d2e(0xb2)][_0xf79d2e(0x89)](_0x3be36f,{'withFileTypes':!![]});for(const _0x46164c of _0x10beed){const _0xe1d784=a83_0x58ef98[_0xf79d2e(0xad)](_0x3be36f,_0x46164c[_0xf79d2e(0x94)]);let _0x3cbe45=a83_0x58ef98[_0xf79d2e(0xad)](_0x5a4327,_0x46164c['name']);_0x46164c[_0xf79d2e(0x94)][_0xf79d2e(0xbd)]('.tpl')&&(_0x3cbe45=a83_0x58ef98[_0xf79d2e(0xad)](_0x5a4327,_0x46164c[_0xf79d2e(0x94)]['replace'](/\.tpl$/,'')));if(_0x46164c[_0xf79d2e(0x87)]())await a83_0x1cdcbb[_0xf79d2e(0xb2)][_0xf79d2e(0xaf)](_0x3cbe45,{'recursive':!![]}),await this[_0xf79d2e(0xc4)](_0xe1d784,_0x3cbe45,_0x409831,_0x3f7700);else _0x46164c['isFile']()&&await this[_0xf79d2e(0xb5)](_0xe1d784,_0x3cbe45,_0x409831,_0x3f7700);}}static async['processFile'](_0x69d7ef,_0x240587,_0x332904,_0x4bf6e0){const _0x2a57c6=a83_0x2cee84,_0x878adc=a83_0x58ef98[_0x2a57c6(0xb7)](_0x69d7ef)[_0x2a57c6(0xa6)]();_0x69d7ef['endsWith'](_0x2a57c6(0x8e))&&(_0x240587=_0x240587[_0x2a57c6(0xa8)](/\.tpl$/,''));const _0x505644=[_0x2a57c6(0x95),_0x2a57c6(0xc8),'.jsx','.js','.json','.md',_0x2a57c6(0xc0),_0x2a57c6(0xba),'.tpl'];if(_0x505644[_0x2a57c6(0x86)](_0x878adc)||_0x69d7ef[_0x2a57c6(0xbd)]('.tpl')){const _0xb4ccfe=await a83_0x1cdcbb[_0x2a57c6(0xb2)][_0x2a57c6(0xc2)](_0x69d7ef,_0x2a57c6(0x9a)),_0x431d07=this[_0x2a57c6(0xb9)](_0xb4ccfe,_0x332904,_0x4bf6e0);await a83_0x1cdcbb[_0x2a57c6(0xb2)][_0x2a57c6(0x96)](_0x240587,_0x431d07,'utf8');}else await a83_0x1cdcbb[_0x2a57c6(0xb2)][_0x2a57c6(0xbc)](_0x69d7ef,_0x240587);}}
|
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.1",
|
|
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))})})]});}
|