@loxia-labs/loxia-autopilot-one 2.0.7 → 2.2.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/README.md +7 -4
- package/bin/cli.js +1 -1
- package/bin/loxia-terminal-v2.js +1 -1
- package/bin/loxia-terminal.js +1 -1
- package/bin/start-with-terminal.js +1 -1
- package/package.json +1 -1
- package/scripts/install-scanners.js +1 -1
- package/scripts/watchdog.js +1 -1
- package/src/analyzers/CSSAnalyzer.js +1 -1
- package/src/analyzers/ConfigValidator.js +1 -1
- package/src/analyzers/ESLintAnalyzer.js +1 -1
- package/src/analyzers/JavaScriptAnalyzer.js +1 -1
- package/src/analyzers/PrettierFormatter.js +1 -1
- package/src/analyzers/PythonAnalyzer.js +1 -1
- package/src/analyzers/SecurityAnalyzer.js +1 -1
- package/src/analyzers/SparrowAnalyzer.js +1 -1
- package/src/analyzers/TypeScriptAnalyzer.js +1 -1
- package/src/analyzers/codeCloneDetector/analyzer.js +1 -1
- package/src/analyzers/codeCloneDetector/detector.js +1 -1
- package/src/analyzers/codeCloneDetector/index.js +1 -1
- package/src/analyzers/codeCloneDetector/parser.js +1 -1
- package/src/analyzers/codeCloneDetector/reporter.js +1 -1
- package/src/analyzers/codeCloneDetector/scanner.js +1 -1
- package/src/core/agentPool.js +1 -1
- package/src/core/agentScheduler.js +1 -1
- package/src/core/contextManager.js +1 -1
- package/src/core/flowExecutor.js +1 -1
- package/src/core/messageProcessor.js +1 -1
- package/src/core/orchestrator.js +1 -1
- package/src/core/stateManager.js +1 -1
- package/src/index.js +1 -1
- package/src/interfaces/cli.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/agents.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/components.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/connection.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/imports.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/messages.test.js +1 -1
- package/src/interfaces/terminal/__tests__/smoke/tools.test.js +1 -1
- package/src/interfaces/terminal/api/apiClient.js +1 -1
- package/src/interfaces/terminal/api/messageRouter.js +1 -1
- package/src/interfaces/terminal/api/session.js +1 -1
- package/src/interfaces/terminal/api/websocket.js +1 -1
- package/src/interfaces/terminal/components/AgentCreator.js +1 -1
- package/src/interfaces/terminal/components/AgentEditor.js +1 -1
- package/src/interfaces/terminal/components/AgentSwitcher.js +1 -1
- package/src/interfaces/terminal/components/ErrorBoundary.js +1 -1
- package/src/interfaces/terminal/components/ErrorPanel.js +1 -1
- package/src/interfaces/terminal/components/Header.js +1 -1
- package/src/interfaces/terminal/components/HelpPanel.js +1 -1
- package/src/interfaces/terminal/components/InputBox.js +1 -1
- package/src/interfaces/terminal/components/Layout.js +1 -1
- package/src/interfaces/terminal/components/LoadingSpinner.js +1 -1
- package/src/interfaces/terminal/components/MessageList.js +1 -1
- package/src/interfaces/terminal/components/MultilineTextInput.js +1 -1
- package/src/interfaces/terminal/components/SearchPanel.js +1 -1
- package/src/interfaces/terminal/components/SettingsPanel.js +1 -1
- package/src/interfaces/terminal/components/StatusBar.js +1 -1
- package/src/interfaces/terminal/components/TextInput.js +1 -1
- package/src/interfaces/terminal/config/agentEditorConstants.js +1 -1
- package/src/interfaces/terminal/config/constants.js +1 -1
- package/src/interfaces/terminal/index.js +1 -1
- package/src/interfaces/terminal/state/useAgentControl.js +1 -1
- package/src/interfaces/terminal/state/useAgents.js +1 -1
- package/src/interfaces/terminal/state/useConnection.js +1 -1
- package/src/interfaces/terminal/state/useMessages.js +1 -1
- package/src/interfaces/terminal/state/useTools.js +1 -1
- package/src/interfaces/terminal/utils/debugLogger.js +1 -1
- package/src/interfaces/terminal/utils/settingsStorage.js +1 -1
- package/src/interfaces/terminal/utils/theme.js +1 -1
- package/src/interfaces/webServer.js +1 -1
- package/src/modules/fileExplorer/controller.js +1 -1
- package/src/modules/fileExplorer/index.js +1 -1
- package/src/modules/fileExplorer/middleware.js +1 -1
- package/src/modules/fileExplorer/routes.js +1 -1
- package/src/services/agentActivityService.js +1 -1
- package/src/services/aiService.js +1 -1
- package/src/services/apiKeyManager.js +1 -1
- package/src/services/benchmarkService.js +1 -1
- package/src/services/budgetService.js +1 -1
- package/src/services/contextInjectionService.js +1 -1
- package/src/services/conversationCompactionService.js +1 -1
- package/src/services/credentialVault.js +1 -1
- package/src/services/errorHandler.js +1 -1
- package/src/services/fileAttachmentService.js +1 -1
- package/src/services/flowContextService.js +1 -1
- package/src/services/memoryService.js +1 -1
- package/src/services/modelRouterService.js +1 -1
- package/src/services/modelsService.js +1 -1
- package/src/services/portRegistry.js +1 -1
- package/src/services/portTracker.js +1 -1
- package/src/services/projectDetector.js +1 -1
- package/src/services/promptService.js +1 -1
- package/src/services/qualityInspector.js +1 -1
- package/src/services/serviceRegistry.js +1 -1
- package/src/services/tokenCountingService.js +1 -1
- package/src/services/visualEditorBridge.js +1 -1
- package/src/services/visualEditorServer.js +1 -1
- package/src/tools/agentCommunicationTool.js +1 -1
- package/src/tools/agentDelayTool.js +1 -1
- package/src/tools/asyncToolManager.js +1 -1
- package/src/tools/baseTool.js +1 -1
- package/src/tools/browserTool.js +1 -1
- package/src/tools/cloneDetectionTool.js +1 -1
- package/src/tools/dependencyResolverTool.js +1 -1
- package/src/tools/docxTool.js +1 -1
- package/src/tools/excelTool.js +1 -1
- package/src/tools/fileContentReplaceTool.js +1 -1
- package/src/tools/fileSystemTool.js +1 -1
- package/src/tools/fileTreeTool.js +1 -1
- package/src/tools/helpTool.js +1 -1
- package/src/tools/imageTool.js +1 -1
- package/src/tools/importAnalyzerTool.js +1 -1
- package/src/tools/jobDoneTool.js +1 -1
- package/src/tools/memoryTool.js +1 -1
- package/src/tools/pdfTool.js +1 -1
- package/src/tools/seekTool.js +1 -1
- package/src/tools/staticAnalysisTool.js +1 -1
- package/src/tools/taskManagerTool.js +1 -1
- package/src/tools/terminalTool.js +1 -1
- package/src/tools/userPromptTool.js +1 -1
- package/src/tools/videoTool.js +1 -1
- package/src/tools/visualEditorTool.js +1 -1
- package/src/tools/webTool.js +1 -1
- package/src/types/agent.js +1 -1
- package/src/types/contextReference.js +1 -1
- package/src/types/conversation.js +1 -1
- package/src/types/toolCommand.js +1 -1
- package/src/utilities/attachmentValidator.js +1 -1
- package/src/utilities/browserStealth.js +1 -1
- package/src/utilities/configManager.js +1 -1
- package/src/utilities/constants.js +1 -1
- package/src/utilities/directoryAccessManager.js +1 -1
- package/src/utilities/fileProcessor.js +1 -1
- package/src/utilities/humanBehavior.js +1 -1
- package/src/utilities/jsonRepair.js +1 -1
- package/src/utilities/logger.js +1 -1
- package/src/utilities/platformUtils.js +1 -1
- package/src/utilities/platformUtils.test.js +1 -1
- package/src/utilities/stealthConstants.js +1 -1
- package/src/utilities/structuredFileValidator.js +1 -1
- package/src/utilities/tagParser.js +1 -1
- package/src/utilities/toolConstants.js +1 -1
- package/src/utilities/userDataDir.js +1 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ npm install -g @loxia-labs/loxia-autopilot-one
|
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
100
|
loxia --version
|
|
101
|
-
# Should display: Loxia Autopilot One v2.0
|
|
101
|
+
# Should display: Loxia Autopilot One v2.2.0
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
### 4. Create an API Key
|
|
@@ -297,11 +297,14 @@ Loxia comes with 18+ specialized tools that agents can use autonomously:
|
|
|
297
297
|
|
|
298
298
|
## Roadmap
|
|
299
299
|
|
|
300
|
-
### Current Version (2.0
|
|
300
|
+
### Current Version (2.2.0)
|
|
301
301
|
|
|
302
|
+
- Two-layer tool descriptions: compact index + on-demand full docs via Help tool
|
|
303
|
+
- Document creation tools: DOCX (Word) and Excel read/create support
|
|
304
|
+
- PDF creation: HTML to PDF via Puppeteer with full CSS support
|
|
305
|
+
- Tool result turn tracking: batched results grouped by turn with manifest headers
|
|
306
|
+
- Unified `MAX_OUTPUT_TOKENS` constant (10,000) shared by aiService and compaction check
|
|
302
307
|
- Compaction: preserve recent achievements, file paths, meaningful tool outcomes; 8K summary tokens
|
|
303
|
-
- Tool invocation guidance: dependent calls must split across messages
|
|
304
|
-
- CI publish fix: OIDC auth no longer interferes with npm install
|
|
305
308
|
|
|
306
309
|
### v2.0.6
|
|
307
310
|
- Tool path sync: terminal `cd` now propagates to all tools (filesystem, seek, pdf, etc.)
|
package/bin/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const a0_0x4122c6=a0_0x3d78;(function(_0x4344b9,_0x55f9b0){const _0x44cc8f=a0_0x3d78,_0x5d0016=_0x4344b9();while(!![]){try{const _0x2cda76=parseInt(_0x44cc8f(0x202))/0x1*(-parseInt(_0x44cc8f(0x1f4))/0x2)+-parseInt(_0x44cc8f(0x1f9))/0x3+-parseInt(_0x44cc8f(0x215))/0x4+-parseInt(_0x44cc8f(0x1fd))/0x5*(-parseInt(_0x44cc8f(0x204))/0x6)+-parseInt(_0x44cc8f(0x22e))/0x7+-parseInt(_0x44cc8f(0x234))/0x8+parseInt(_0x44cc8f(0x20f))/0x9;if(_0x2cda76===_0x55f9b0)break;else _0x5d0016['push'](_0x5d0016['shift']());}catch(_0x23d319){_0x5d0016['push'](_0x5d0016['shift']());}}}(a0_0x53d0,0xcb831));import{fileURLToPath}from'url';function a0_0x53d0(){const _0x2645b7=['\x20but\x20not\x20responding.','Please\x20open\x20manually:\x20','6303464AbnFkl','Loxia\x20Autopilot\x20One\x20v','Starting\x20Loxia\x20server...\x0a','log','../src/services/portRegistry.js','LOXIA_PORT','darwin','src','Run\x20\x22loxia\x20--help\x22\x20for\x20usage\x20information.','Server\x20discovered\x20at\x20','\x0aLoxia\x20Autopilot\x20One\x20v','--help','\x0aPlease\x20start\x20the\x20server\x20first:','now','destroy','cmd','Starting\x20Terminal\x20UI...\x0a','package.json','SIGTERM','utf8','includes','LOXIA_HOST','--port','help','web','11265891AQONjW','Waiting\x20for\x20server\x20to\x20start...','\x0a\x20\x20Web\x20UI:\x20\x20\x20\x20\x20\x20\x20','inherit','message','error','9152680qSgyJq','ignore','getService','port','\x20\x20Terminal\x20UI:\x20\x20loxia\x20terminal','Looking\x20for\x20running\x20server...','Server\x20running\x20at\x20http://','kill','It\x20may\x20have\x20crashed.\x20Please\x20restart\x20it.','Starting\x20Loxia\x20server\x20in\x20background...','version','index.js','\x0aServer\x20may\x20still\x20be\x20starting.\x20Check\x20the\x20port\x20registry\x20or\x20logs.','\x0aShutting\x20down\x20server...','\x0a✓\x20Server\x20running\x20at\x20','parse','\x20\x20loxia\x20serve\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20only','2TVczRu','\x0aOpening\x20Web\x20UI\x20at\x20','\x20\x20loxia\x20plus-terminal\x20\x20#\x20Start\x20server\x20+\x20Terminal\x20UI\x0a','\x0aServer\x20started\x20but\x20may\x20still\x20be\x20initializing.','xdg-open','3743904tYPxCw','--version','loxia-terminal.js','win32','25405gccmPo','--host','cleanupStaleEntries','localhost','unref','68851VyCNmA',')\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20Specify\x20host\x20(default:\x20','1134djzLWW','\x0aServer\x20registered\x20at\x20','\x20\x20loxia\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20Web\x20UI','length','pid','SIGINT','exit','127.0.0.1','Unknown\x20command:\x20','http://','platform','49675131sAVPPj','host','ceil','toString'];a0_0x53d0=function(){return _0x2645b7;};return a0_0x53d0();}import{dirname,join}from'path';import{spawn}from'child_process';import{readFileSync}from'fs';function a0_0x3d78(_0x1f0c60,_0x127daa){_0x1f0c60=_0x1f0c60-0x1e5;const _0x53d078=a0_0x53d0();let _0x3d78a2=_0x53d078[_0x1f0c60];return _0x3d78a2;}import a0_0x31cbd9 from'http';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),DEFAULT_PORT=0x1f90,DEFAULT_HOST=a0_0x4122c6(0x20b),SERVER_STARTUP_TIMEOUT=0x3a98,SERVER_CHECK_INTERVAL=0x1f4,args=process['argv']['slice'](0x2),command=args[0x0]&&!args[0x0]['startsWith']('--')?args[0x0]:null,flags={'port':null,'host':null,'help':args['includes'](a0_0x4122c6(0x220))||args[a0_0x4122c6(0x229)]('-h'),'version':args['includes'](a0_0x4122c6(0x1fa))||args[a0_0x4122c6(0x229)]('-v')};for(let i=0x0;i<args[a0_0x4122c6(0x207)];i++){args[i]===a0_0x4122c6(0x22b)&&args[i+0x1]&&(flags[a0_0x4122c6(0x1e6)]=parseInt(args[i+0x1],0xa)),args[i]===a0_0x4122c6(0x1fe)&&args[i+0x1]&&(flags[a0_0x4122c6(0x210)]=args[i+0x1]);}const explicitPort=flags[a0_0x4122c6(0x1e6)],host=flags['host']||DEFAULT_HOST;if(flags['version']){const pkgPath=join(__dirname,'..',a0_0x4122c6(0x226)),pkg=JSON[a0_0x4122c6(0x1f2)](readFileSync(pkgPath,a0_0x4122c6(0x228)));console[a0_0x4122c6(0x218)](a0_0x4122c6(0x216)+pkg[a0_0x4122c6(0x1ed)]),process[a0_0x4122c6(0x20a)](0x0);}if(flags[a0_0x4122c6(0x22c)]||!command){const pkgPath=join(__dirname,'..',a0_0x4122c6(0x226)),pkg=JSON['parse'](readFileSync(pkgPath,'utf8'));console[a0_0x4122c6(0x218)](a0_0x4122c6(0x21f)+pkg[a0_0x4122c6(0x1ed)]+'\x20-\x20AI\x20Agent\x20System\x0a\x0aUsage:\x0a\x20\x20loxia\x20<command>\x20[options]\x0a\x0aCommands:\x0a\x20\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Start\x20server\x20+\x20open\x20Web\x20UI\x20in\x20browser\x0a\x20\x20serve\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Start\x20server\x20only\x20(no\x20UI\x20opened)\x0a\x20\x20terminal\x20\x20\x20\x20\x20\x20\x20\x20Start\x20Terminal\x20UI\x20(server\x20must\x20be\x20running)\x0a\x20\x20plus-web\x20\x20\x20\x20\x20\x20\x20\x20Alias\x20for\x20\x27web\x27\x0a\x20\x20plus-terminal\x20\x20\x20Start\x20server\x20+\x20Terminal\x20UI\x20together\x0a\x0aOptions:\x0a\x20\x20--port\x20<number>\x20\x20\x20Specify\x20port\x20(default:\x20auto-select\x20starting\x20from\x20'+DEFAULT_PORT+a0_0x4122c6(0x203)+DEFAULT_HOST+')\x0a\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x0a\x20\x20-v,\x20--version\x20\x20\x20\x20\x20Show\x20version\x20number\x0a\x0aExamples:\x0a\x20\x20loxia\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20open\x20browser\x0a\x20\x20loxia\x20serve\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20only\x20(headless)\x0a\x20\x20loxia\x20terminal\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Connect\x20Terminal\x20UI\x20to\x20running\x20server\x0a\x20\x20loxia\x20plus-terminal\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20Terminal\x20UI\x0a\x20\x20loxia\x20web\x20--port\x203000\x20\x20\x20\x20#\x20Use\x20specific\x20port\x0a\x0aQuick\x20Start:\x0a\x20\x201.\x20Run\x20\x27loxia\x20web\x27\x20to\x20start\x20with\x20Web\x20UI\x0a\x20\x202.\x20Or\x20run\x20\x27loxia\x20plus-terminal\x27\x20for\x20Terminal\x20UI\x20experience\x0a\x20\x203.\x20Or\x20run\x20\x27loxia\x20serve\x27\x20for\x20headless\x20server\x20(connect\x20remotely)\x0a\x0aNote:\x20If\x20no\x20port\x20is\x20specified,\x20the\x20server\x20will\x20automatically\x20find\x0aan\x20available\x20port.\x20The\x20Terminal\x20UI\x20will\x20discover\x20the\x20server\x20port\x0aautomatically\x20from\x20the\x20port\x20registry.\x0a\x0aDocumentation:\x0a\x20\x20https://autopilot.loxia.ai\x0a\x0a'),process[a0_0x4122c6(0x20a)](0x0);}async function getPortRegistry(){const _0x394bce=a0_0x4122c6,{getPortRegistry:_0x1f2090}=await import(_0x394bce(0x219));return _0x1f2090();}async function discoverBackend(){const _0x23e6ef=a0_0x4122c6;try{const _0xc91dde=await getPortRegistry();await _0xc91dde[_0x23e6ef(0x1ff)]();const _0x3bdfd8=await _0xc91dde[_0x23e6ef(0x1e5)]('backend');if(_0x3bdfd8)return{'host':_0x3bdfd8[_0x23e6ef(0x210)]||_0x23e6ef(0x200),'port':_0x3bdfd8['port'],'pid':_0x3bdfd8[_0x23e6ef(0x208)]};return null;}catch(_0xbb3779){return null;}}async function checkServerRunning(_0x2406ad,_0x22c035,_0x18bdd4=0x1){for(let _0x38609a=0x0;_0x38609a<_0x18bdd4;_0x38609a++){const _0xe75624=await new Promise(_0x12352b=>{const _0x217076=a0_0x3d78,_0x1ed49b=a0_0x31cbd9['get'](_0x217076(0x20d)+_0x2406ad+':'+_0x22c035+'/api/health',_0x36d243=>{_0x12352b(_0x36d243['statusCode']===0xc8);});_0x1ed49b['on'](_0x217076(0x233),()=>_0x12352b(![])),_0x1ed49b['setTimeout'](0x7d0,()=>{const _0x2efc45=_0x217076;_0x1ed49b[_0x2efc45(0x223)](),_0x12352b(![]);});});if(_0xe75624)return!![];_0x38609a<_0x18bdd4-0x1&&await new Promise(_0x4a49f3=>setTimeout(_0x4a49f3,SERVER_CHECK_INTERVAL));}return![];}async function waitForServerWithDiscovery(_0x5ea7c6=SERVER_STARTUP_TIMEOUT){const _0xf8ff1=a0_0x4122c6,_0x15037c=Date[_0xf8ff1(0x222)]();while(Date[_0xf8ff1(0x222)]()-_0x15037c<_0x5ea7c6){const _0x3c7819=await discoverBackend();if(_0x3c7819){const _0x2b6d72=await checkServerRunning(_0x3c7819[_0xf8ff1(0x210)],_0x3c7819['port']);if(_0x2b6d72)return _0x3c7819;}await new Promise(_0x549385=>setTimeout(_0x549385,SERVER_CHECK_INTERVAL));}return null;}async function waitForServerAtPort(_0x247a7c,_0x5a8adc,_0x57bd72=SERVER_STARTUP_TIMEOUT){const _0x418849=a0_0x4122c6,_0x3b6af2=Math[_0x418849(0x211)](_0x57bd72/SERVER_CHECK_INTERVAL),_0x299350=await checkServerRunning(_0x247a7c,_0x5a8adc,_0x3b6af2);return _0x299350?{'host':_0x247a7c,'port':_0x5a8adc}:null;}function openBrowser(_0x44189b){const _0x2a8afa=a0_0x4122c6;let _0x467627,_0x23917c;if(process['platform']===_0x2a8afa(0x21b))_0x467627='open',_0x23917c=[_0x44189b];else process[_0x2a8afa(0x20e)]===_0x2a8afa(0x1fc)?(_0x467627=_0x2a8afa(0x224),_0x23917c=['/c','start','\x22\x22',_0x44189b]):(_0x467627=_0x2a8afa(0x1f8),_0x23917c=[_0x44189b]);const _0x43508e=spawn(_0x467627,_0x23917c,{'detached':!![],'stdio':_0x2a8afa(0x235)});_0x43508e[_0x2a8afa(0x201)](),_0x43508e['on'](_0x2a8afa(0x233),()=>{const _0x26bbc1=_0x2a8afa;console[_0x26bbc1(0x218)]('Could\x20not\x20open\x20browser\x20automatically.'),console[_0x26bbc1(0x218)](_0x26bbc1(0x214)+_0x44189b);});}function startServer(_0x19ecd8=![]){const _0x24a03d=a0_0x4122c6,_0x108804={...process.env};explicitPort&&(_0x108804[_0x24a03d(0x21a)]=explicitPort['toString'](),_0x108804['PORT']=explicitPort[_0x24a03d(0x212)]());flags[_0x24a03d(0x210)]&&(_0x108804[_0x24a03d(0x22a)]=flags[_0x24a03d(0x210)]);const _0x1c52b0=join(__dirname,'..',_0x24a03d(0x21c),_0x24a03d(0x1ee)),_0x9a5b9f=spawn('node',[_0x1c52b0],{'cwd':join(__dirname,'..'),'env':_0x108804,'stdio':_0x19ecd8?[_0x24a03d(0x235),'ignore','ignore']:_0x24a03d(0x231),'detached':_0x19ecd8});return _0x19ecd8&&_0x9a5b9f[_0x24a03d(0x201)](),_0x9a5b9f;}function startTerminalUIProcess(_0x84f496,_0x403a19){const _0x1ca86e=a0_0x4122c6,_0x3a3ac9=join(__dirname,_0x1ca86e(0x1fb)),_0x3107d2={...process.env,'LOXIA_PORT':_0x403a19['toString'](),'LOXIA_HOST':_0x84f496},_0x5aee5c=spawn('node',[_0x3a3ac9],{'cwd':join(__dirname,'..'),'env':_0x3107d2,'stdio':_0x1ca86e(0x231)});return _0x5aee5c;}const commands={'web':async()=>{const _0x520cc8=a0_0x4122c6;console[_0x520cc8(0x218)](_0x520cc8(0x217));const _0x54f582=startServer(![]);console[_0x520cc8(0x218)](_0x520cc8(0x22f));let _0x4d1fbe;explicitPort?_0x4d1fbe=await waitForServerAtPort(host,explicitPort):_0x4d1fbe=await waitForServerWithDiscovery();if(_0x4d1fbe){const _0x62b977='http://'+_0x4d1fbe['host']+':'+_0x4d1fbe[_0x520cc8(0x1e6)];console['log'](_0x520cc8(0x1f5)+_0x62b977),openBrowser(_0x62b977);}else console[_0x520cc8(0x218)](_0x520cc8(0x1ef));process['on'](_0x520cc8(0x209),()=>_0x54f582[_0x520cc8(0x1ea)]('SIGINT')),process['on'](_0x520cc8(0x227),()=>_0x54f582['kill'](_0x520cc8(0x227))),_0x54f582['on'](_0x520cc8(0x20a),_0x551d9b=>process[_0x520cc8(0x20a)](_0x551d9b||0x0));},'plus-web':async()=>{const _0x217b1e=a0_0x4122c6;await commands[_0x217b1e(0x22d)]();},'serve':async()=>{const _0x455d61=a0_0x4122c6;console[_0x455d61(0x218)](_0x455d61(0x217));const _0x17eb52=startServer(![]);console[_0x455d61(0x218)](_0x455d61(0x22f));let _0x23d3ab;explicitPort?_0x23d3ab=await waitForServerAtPort(host,explicitPort):_0x23d3ab=await waitForServerWithDiscovery();if(_0x23d3ab){const _0x1192d8=_0x455d61(0x20d)+_0x23d3ab[_0x455d61(0x210)]+':'+_0x23d3ab[_0x455d61(0x1e6)];console['log'](_0x455d61(0x1f1)+_0x1192d8),console[_0x455d61(0x218)](_0x455d61(0x230)+_0x1192d8),console[_0x455d61(0x218)](_0x455d61(0x1e7)),console[_0x455d61(0x218)]('\x20\x20API\x20Health:\x20\x20\x20'+_0x1192d8+'/api/health\x0a');}else console[_0x455d61(0x218)](_0x455d61(0x1f7)),console[_0x455d61(0x218)]('Run\x20\x27loxia\x20terminal\x27\x20to\x20connect\x20when\x20ready.');process['on'](_0x455d61(0x209),()=>_0x17eb52[_0x455d61(0x1ea)](_0x455d61(0x209))),process['on'](_0x455d61(0x227),()=>_0x17eb52['kill'](_0x455d61(0x227))),_0x17eb52['on'](_0x455d61(0x20a),_0x2ff4a6=>process[_0x455d61(0x20a)](_0x2ff4a6||0x0));},'terminal':async()=>{const _0x4e6af3=a0_0x4122c6;console[_0x4e6af3(0x218)](_0x4e6af3(0x1e8));let _0x237116=await discoverBackend();explicitPort&&(_0x237116={'host':host,'port':explicitPort});!_0x237116&&(console[_0x4e6af3(0x233)]('\x0aNo\x20running\x20server\x20found\x20in\x20the\x20port\x20registry.'),console[_0x4e6af3(0x233)](_0x4e6af3(0x221)),console[_0x4e6af3(0x233)](_0x4e6af3(0x206)),console[_0x4e6af3(0x233)](_0x4e6af3(0x1f3)),console['error'](_0x4e6af3(0x1f6)),process['exit'](0x1));const _0x2b75ab=await checkServerRunning(_0x237116[_0x4e6af3(0x210)],_0x237116[_0x4e6af3(0x1e6)]);!_0x2b75ab&&(console[_0x4e6af3(0x233)](_0x4e6af3(0x205)+_0x237116[_0x4e6af3(0x210)]+':'+_0x237116[_0x4e6af3(0x1e6)]+_0x4e6af3(0x213)),console[_0x4e6af3(0x233)](_0x4e6af3(0x1eb)),process['exit'](0x1));console['log'](_0x4e6af3(0x21e)+_0x237116[_0x4e6af3(0x210)]+':'+_0x237116[_0x4e6af3(0x1e6)]),console['log']('Starting\x20Terminal\x20UI...\x0a');const _0x2c9a91=startTerminalUIProcess(_0x237116[_0x4e6af3(0x210)],_0x237116[_0x4e6af3(0x1e6)]);process['on'](_0x4e6af3(0x209),()=>_0x2c9a91[_0x4e6af3(0x1ea)](_0x4e6af3(0x209))),process['on'](_0x4e6af3(0x227),()=>_0x2c9a91[_0x4e6af3(0x1ea)](_0x4e6af3(0x227))),_0x2c9a91['on'](_0x4e6af3(0x20a),_0x2cb993=>process[_0x4e6af3(0x20a)](_0x2cb993||0x0));},'plus-terminal':async()=>{const _0x2ab914=a0_0x4122c6;console['log'](_0x2ab914(0x1ec));const _0x53b4cd=startServer(!![]);let _0x58c7c3;explicitPort?_0x58c7c3=await waitForServerAtPort(host,explicitPort):_0x58c7c3=await waitForServerWithDiscovery();!_0x58c7c3&&(console[_0x2ab914(0x233)]('\x0aServer\x20failed\x20to\x20start.\x20Please\x20check\x20logs.'),process[_0x2ab914(0x20a)](0x1));console[_0x2ab914(0x218)](_0x2ab914(0x1e9)+_0x58c7c3[_0x2ab914(0x210)]+':'+_0x58c7c3['port']),console[_0x2ab914(0x218)](_0x2ab914(0x225));const _0x1f374e=startTerminalUIProcess(_0x58c7c3[_0x2ab914(0x210)],_0x58c7c3['port']);_0x1f374e['on']('exit',_0x5dfc8e=>{const _0x174174=_0x2ab914;console['log'](_0x174174(0x1f0));try{process[_0x174174(0x1ea)](_0x53b4cd[_0x174174(0x208)],'SIGTERM');}catch(_0x5bede6){}process['exit'](_0x5dfc8e||0x0);}),process['on'](_0x2ab914(0x209),()=>{const _0x48bb64=_0x2ab914;_0x1f374e[_0x48bb64(0x1ea)](_0x48bb64(0x209));}),process['on']('SIGTERM',()=>{const _0x2de10c=_0x2ab914;_0x1f374e[_0x2de10c(0x1ea)](_0x2de10c(0x227));});}};commands[command]?commands[command]()['catch'](_0x2278b1=>{const _0x48be96=a0_0x4122c6;console[_0x48be96(0x233)]('Error:',_0x2278b1[_0x48be96(0x232)]),process['exit'](0x1);}):(console[a0_0x4122c6(0x233)](a0_0x4122c6(0x20c)+command),console[a0_0x4122c6(0x233)](a0_0x4122c6(0x21d)),process['exit'](0x1));
|
|
3
|
+
const a0_0x2479d6=a0_0xd47f;(function(_0x2e70ba,_0x58887a){const _0x537084=a0_0xd47f,_0x26af91=_0x2e70ba();while(!![]){try{const _0x5e6732=-parseInt(_0x537084(0x1be))/0x1+-parseInt(_0x537084(0x1a8))/0x2+-parseInt(_0x537084(0x17a))/0x3*(-parseInt(_0x537084(0x19f))/0x4)+parseInt(_0x537084(0x1ac))/0x5+-parseInt(_0x537084(0x1b9))/0x6*(parseInt(_0x537084(0x19e))/0x7)+parseInt(_0x537084(0x1ae))/0x8*(parseInt(_0x537084(0x186))/0x9)+parseInt(_0x537084(0x19d))/0xa;if(_0x5e6732===_0x58887a)break;else _0x26af91['push'](_0x26af91['shift']());}catch(_0x105b50){_0x26af91['push'](_0x26af91['shift']());}}}(a0_0x32ba,0x89b1a));import{fileURLToPath}from'url';import{dirname,join}from'path';import{spawn}from'child_process';import{readFileSync}from'fs';import a0_0x52db66 from'http';function a0_0x32ba(){const _0x36ec98=['toString','Starting\x20Loxia\x20server...\x0a','\x20but\x20not\x20responding.','Could\x20not\x20open\x20browser\x20automatically.','ignore','catch','unref','/api/health','\x20\x20loxia\x20plus-terminal\x20\x20#\x20Start\x20server\x20+\x20Terminal\x20UI\x0a','exit','includes','statusCode','ceil','kill','utf8','length','7297410rfQPcO','14UkqWPB','151172kMGcKy','startsWith',')\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20Specify\x20host\x20(default:\x20','inherit','LOXIA_PORT','Server\x20running\x20at\x20http://','http://','start','\x0aServer\x20may\x20still\x20be\x20starting.\x20Check\x20the\x20port\x20registry\x20or\x20logs.','1455804xjxpKo','\x0aServer\x20failed\x20to\x20start.\x20Please\x20check\x20logs.','Looking\x20for\x20running\x20server...','message','5249615nCXhAO','get','7453256LdQyHj','src','\x20\x20loxia\x20serve\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20only','log','platform','now','argv','\x0a\x20\x20Web\x20UI:\x20\x20\x20\x20\x20\x20\x20','\x0aServer\x20registered\x20at\x20','\x0a✓\x20Server\x20running\x20at\x20','index.js','2042280phKtJd','parse','host','web','win32','927630FkiMap','/api/health\x0a','--host','Please\x20open\x20manually:\x20','--help','--version','127.0.0.1','\x0aOpening\x20Web\x20UI\x20at\x20','cleanupStaleEntries','Run\x20\x22loxia\x20--help\x22\x20for\x20usage\x20information.','Starting\x20Terminal\x20UI...\x0a','setTimeout','cmd','LOXIA_HOST','pid','15ChuNjq','port','getService','destroy','Server\x20discovered\x20at\x20','help','\x20\x20loxia\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20Web\x20UI','loxia-terminal.js','It\x20may\x20have\x20crashed.\x20Please\x20restart\x20it.','localhost','Run\x20\x27loxia\x20terminal\x27\x20to\x20connect\x20when\x20ready.','Waiting\x20for\x20server\x20to\x20start...','9UwdfTN','backend','package.json','version','error','SIGINT','SIGTERM'];a0_0x32ba=function(){return _0x36ec98;};return a0_0x32ba();}const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),DEFAULT_PORT=0x1f90,DEFAULT_HOST=a0_0x2479d6(0x171),SERVER_STARTUP_TIMEOUT=0x3a98,SERVER_CHECK_INTERVAL=0x1f4,args=process[a0_0x2479d6(0x1b4)]['slice'](0x2),command=args[0x0]&&!args[0x0][a0_0x2479d6(0x1a0)]('--')?args[0x0]:null,flags={'port':null,'host':null,'help':args[a0_0x2479d6(0x197)](a0_0x2479d6(0x16f))||args[a0_0x2479d6(0x197)]('-h'),'version':args[a0_0x2479d6(0x197)](a0_0x2479d6(0x170))||args[a0_0x2479d6(0x197)]('-v')};for(let i=0x0;i<args[a0_0x2479d6(0x19c)];i++){args[i]==='--port'&&args[i+0x1]&&(flags['port']=parseInt(args[i+0x1],0xa)),args[i]===a0_0x2479d6(0x1c0)&&args[i+0x1]&&(flags['host']=args[i+0x1]);}const explicitPort=flags['port'],host=flags['host']||DEFAULT_HOST;if(flags[a0_0x2479d6(0x189)]){const pkgPath=join(__dirname,'..',a0_0x2479d6(0x188)),pkg=JSON[a0_0x2479d6(0x1ba)](readFileSync(pkgPath,a0_0x2479d6(0x19b)));console['log']('Loxia\x20Autopilot\x20One\x20v'+pkg[a0_0x2479d6(0x189)]),process[a0_0x2479d6(0x196)](0x0);}function a0_0xd47f(_0x28ba65,_0x389645){_0x28ba65=_0x28ba65-0x16e;const _0x32baa7=a0_0x32ba();let _0xd47f39=_0x32baa7[_0x28ba65];return _0xd47f39;}if(flags[a0_0x2479d6(0x17f)]||!command){const pkgPath=join(__dirname,'..','package.json'),pkg=JSON[a0_0x2479d6(0x1ba)](readFileSync(pkgPath,a0_0x2479d6(0x19b)));console[a0_0x2479d6(0x1b1)]('\x0aLoxia\x20Autopilot\x20One\x20v'+pkg[a0_0x2479d6(0x189)]+'\x20-\x20AI\x20Agent\x20System\x0a\x0aUsage:\x0a\x20\x20loxia\x20<command>\x20[options]\x0a\x0aCommands:\x0a\x20\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Start\x20server\x20+\x20open\x20Web\x20UI\x20in\x20browser\x0a\x20\x20serve\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Start\x20server\x20only\x20(no\x20UI\x20opened)\x0a\x20\x20terminal\x20\x20\x20\x20\x20\x20\x20\x20Start\x20Terminal\x20UI\x20(server\x20must\x20be\x20running)\x0a\x20\x20plus-web\x20\x20\x20\x20\x20\x20\x20\x20Alias\x20for\x20\x27web\x27\x0a\x20\x20plus-terminal\x20\x20\x20Start\x20server\x20+\x20Terminal\x20UI\x20together\x0a\x0aOptions:\x0a\x20\x20--port\x20<number>\x20\x20\x20Specify\x20port\x20(default:\x20auto-select\x20starting\x20from\x20'+DEFAULT_PORT+a0_0x2479d6(0x1a1)+DEFAULT_HOST+')\x0a\x20\x20-h,\x20--help\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x0a\x20\x20-v,\x20--version\x20\x20\x20\x20\x20Show\x20version\x20number\x0a\x0aExamples:\x0a\x20\x20loxia\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20open\x20browser\x0a\x20\x20loxia\x20serve\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20only\x20(headless)\x0a\x20\x20loxia\x20terminal\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Connect\x20Terminal\x20UI\x20to\x20running\x20server\x0a\x20\x20loxia\x20plus-terminal\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20Terminal\x20UI\x0a\x20\x20loxia\x20web\x20--port\x203000\x20\x20\x20\x20#\x20Use\x20specific\x20port\x0a\x0aQuick\x20Start:\x0a\x20\x201.\x20Run\x20\x27loxia\x20web\x27\x20to\x20start\x20with\x20Web\x20UI\x0a\x20\x202.\x20Or\x20run\x20\x27loxia\x20plus-terminal\x27\x20for\x20Terminal\x20UI\x20experience\x0a\x20\x203.\x20Or\x20run\x20\x27loxia\x20serve\x27\x20for\x20headless\x20server\x20(connect\x20remotely)\x0a\x0aNote:\x20If\x20no\x20port\x20is\x20specified,\x20the\x20server\x20will\x20automatically\x20find\x0aan\x20available\x20port.\x20The\x20Terminal\x20UI\x20will\x20discover\x20the\x20server\x20port\x0aautomatically\x20from\x20the\x20port\x20registry.\x0a\x0aDocumentation:\x0a\x20\x20https://autopilot.loxia.ai\x0a\x0a'),process[a0_0x2479d6(0x196)](0x0);}async function getPortRegistry(){const {getPortRegistry:_0x2f4d70}=await import('../src/services/portRegistry.js');return _0x2f4d70();}async function discoverBackend(){const _0x4c3e93=a0_0x2479d6;try{const _0x372c9f=await getPortRegistry();await _0x372c9f[_0x4c3e93(0x173)]();const _0x3eabce=await _0x372c9f[_0x4c3e93(0x17c)](_0x4c3e93(0x187));if(_0x3eabce)return{'host':_0x3eabce[_0x4c3e93(0x1bb)]||_0x4c3e93(0x183),'port':_0x3eabce['port'],'pid':_0x3eabce[_0x4c3e93(0x179)]};return null;}catch(_0x531fee){return null;}}async function checkServerRunning(_0x513663,_0x4bc4ad,_0x2af02f=0x1){for(let _0x15b938=0x0;_0x15b938<_0x2af02f;_0x15b938++){const _0x5cd0fc=await new Promise(_0x35e461=>{const _0x20ad61=a0_0xd47f,_0xd0678f=a0_0x52db66[_0x20ad61(0x1ad)]('http://'+_0x513663+':'+_0x4bc4ad+_0x20ad61(0x194),_0x20340a=>{const _0x3bd14c=_0x20ad61;_0x35e461(_0x20340a[_0x3bd14c(0x198)]===0xc8);});_0xd0678f['on']('error',()=>_0x35e461(![])),_0xd0678f[_0x20ad61(0x176)](0x7d0,()=>{const _0xa416c6=_0x20ad61;_0xd0678f[_0xa416c6(0x17d)](),_0x35e461(![]);});});if(_0x5cd0fc)return!![];_0x15b938<_0x2af02f-0x1&&await new Promise(_0x3d835f=>setTimeout(_0x3d835f,SERVER_CHECK_INTERVAL));}return![];}async function waitForServerWithDiscovery(_0x393db7=SERVER_STARTUP_TIMEOUT){const _0x27bc4c=a0_0x2479d6,_0x554f6d=Date['now']();while(Date[_0x27bc4c(0x1b3)]()-_0x554f6d<_0x393db7){const _0x320c97=await discoverBackend();if(_0x320c97){const _0x2b4746=await checkServerRunning(_0x320c97[_0x27bc4c(0x1bb)],_0x320c97['port']);if(_0x2b4746)return _0x320c97;}await new Promise(_0x54095d=>setTimeout(_0x54095d,SERVER_CHECK_INTERVAL));}return null;}async function waitForServerAtPort(_0x12ae3c,_0x26455e,_0x38e0f2=SERVER_STARTUP_TIMEOUT){const _0x4d36c2=a0_0x2479d6,_0x52c7f3=Math[_0x4d36c2(0x199)](_0x38e0f2/SERVER_CHECK_INTERVAL),_0xd08253=await checkServerRunning(_0x12ae3c,_0x26455e,_0x52c7f3);return _0xd08253?{'host':_0x12ae3c,'port':_0x26455e}:null;}function openBrowser(_0x4d50b7){const _0x1682ae=a0_0x2479d6;let _0x3d916c,_0xd68df6;if(process[_0x1682ae(0x1b2)]==='darwin')_0x3d916c='open',_0xd68df6=[_0x4d50b7];else process['platform']===_0x1682ae(0x1bd)?(_0x3d916c=_0x1682ae(0x177),_0xd68df6=['/c',_0x1682ae(0x1a6),'\x22\x22',_0x4d50b7]):(_0x3d916c='xdg-open',_0xd68df6=[_0x4d50b7]);const _0x5cd5ae=spawn(_0x3d916c,_0xd68df6,{'detached':!![],'stdio':_0x1682ae(0x191)});_0x5cd5ae[_0x1682ae(0x193)](),_0x5cd5ae['on'](_0x1682ae(0x18a),()=>{const _0x541be9=_0x1682ae;console[_0x541be9(0x1b1)](_0x541be9(0x190)),console[_0x541be9(0x1b1)](_0x541be9(0x16e)+_0x4d50b7);});}function startServer(_0x4e3af3=![]){const _0x544a74=a0_0x2479d6,_0x10866a={...process.env};explicitPort&&(_0x10866a[_0x544a74(0x1a3)]=explicitPort[_0x544a74(0x18d)](),_0x10866a['PORT']=explicitPort[_0x544a74(0x18d)]());flags[_0x544a74(0x1bb)]&&(_0x10866a[_0x544a74(0x178)]=flags[_0x544a74(0x1bb)]);const _0x446130=join(__dirname,'..',_0x544a74(0x1af),_0x544a74(0x1b8)),_0x5eca59=spawn('node',[_0x446130],{'cwd':join(__dirname,'..'),'env':_0x10866a,'stdio':_0x4e3af3?[_0x544a74(0x191),'ignore',_0x544a74(0x191)]:_0x544a74(0x1a2),'detached':_0x4e3af3});return _0x4e3af3&&_0x5eca59[_0x544a74(0x193)](),_0x5eca59;}function startTerminalUIProcess(_0x422ee4,_0x37389c){const _0x4bd792=a0_0x2479d6,_0x54828c=join(__dirname,_0x4bd792(0x181)),_0x2ba1e6={...process.env,'LOXIA_PORT':_0x37389c[_0x4bd792(0x18d)](),'LOXIA_HOST':_0x422ee4},_0x24a21b=spawn('node',[_0x54828c],{'cwd':join(__dirname,'..'),'env':_0x2ba1e6,'stdio':'inherit'});return _0x24a21b;}const commands={'web':async()=>{const _0x20b585=a0_0x2479d6;console[_0x20b585(0x1b1)](_0x20b585(0x18e));const _0x57ccf9=startServer(![]);console['log']('Waiting\x20for\x20server\x20to\x20start...');let _0x446aa4;explicitPort?_0x446aa4=await waitForServerAtPort(host,explicitPort):_0x446aa4=await waitForServerWithDiscovery();if(_0x446aa4){const _0x1055ba='http://'+_0x446aa4[_0x20b585(0x1bb)]+':'+_0x446aa4[_0x20b585(0x17b)];console['log'](_0x20b585(0x172)+_0x1055ba),openBrowser(_0x1055ba);}else console[_0x20b585(0x1b1)](_0x20b585(0x1a7));process['on']('SIGINT',()=>_0x57ccf9[_0x20b585(0x19a)](_0x20b585(0x18b))),process['on'](_0x20b585(0x18c),()=>_0x57ccf9[_0x20b585(0x19a)](_0x20b585(0x18c))),_0x57ccf9['on'](_0x20b585(0x196),_0x4acd6c=>process[_0x20b585(0x196)](_0x4acd6c||0x0));},'plus-web':async()=>{const _0x42fda3=a0_0x2479d6;await commands[_0x42fda3(0x1bc)]();},'serve':async()=>{const _0x262b51=a0_0x2479d6;console[_0x262b51(0x1b1)](_0x262b51(0x18e));const _0x450c83=startServer(![]);console['log'](_0x262b51(0x185));let _0x4b678c;explicitPort?_0x4b678c=await waitForServerAtPort(host,explicitPort):_0x4b678c=await waitForServerWithDiscovery();if(_0x4b678c){const _0x3840ef=_0x262b51(0x1a5)+_0x4b678c[_0x262b51(0x1bb)]+':'+_0x4b678c[_0x262b51(0x17b)];console[_0x262b51(0x1b1)](_0x262b51(0x1b7)+_0x3840ef),console[_0x262b51(0x1b1)](_0x262b51(0x1b5)+_0x3840ef),console[_0x262b51(0x1b1)]('\x20\x20Terminal\x20UI:\x20\x20loxia\x20terminal'),console['log']('\x20\x20API\x20Health:\x20\x20\x20'+_0x3840ef+_0x262b51(0x1bf));}else console[_0x262b51(0x1b1)]('\x0aServer\x20started\x20but\x20may\x20still\x20be\x20initializing.'),console[_0x262b51(0x1b1)](_0x262b51(0x184));process['on']('SIGINT',()=>_0x450c83['kill'](_0x262b51(0x18b))),process['on']('SIGTERM',()=>_0x450c83[_0x262b51(0x19a)](_0x262b51(0x18c))),_0x450c83['on'](_0x262b51(0x196),_0x159ae8=>process[_0x262b51(0x196)](_0x159ae8||0x0));},'terminal':async()=>{const _0x5bc1e9=a0_0x2479d6;console[_0x5bc1e9(0x1b1)](_0x5bc1e9(0x1aa));let _0x3c235a=await discoverBackend();explicitPort&&(_0x3c235a={'host':host,'port':explicitPort});!_0x3c235a&&(console[_0x5bc1e9(0x18a)]('\x0aNo\x20running\x20server\x20found\x20in\x20the\x20port\x20registry.'),console['error']('\x0aPlease\x20start\x20the\x20server\x20first:'),console['error'](_0x5bc1e9(0x180)),console[_0x5bc1e9(0x18a)](_0x5bc1e9(0x1b0)),console[_0x5bc1e9(0x18a)](_0x5bc1e9(0x195)),process[_0x5bc1e9(0x196)](0x1));const _0x36c110=await checkServerRunning(_0x3c235a[_0x5bc1e9(0x1bb)],_0x3c235a[_0x5bc1e9(0x17b)]);!_0x36c110&&(console[_0x5bc1e9(0x18a)](_0x5bc1e9(0x1b6)+_0x3c235a[_0x5bc1e9(0x1bb)]+':'+_0x3c235a[_0x5bc1e9(0x17b)]+_0x5bc1e9(0x18f)),console['error'](_0x5bc1e9(0x182)),process[_0x5bc1e9(0x196)](0x1));console[_0x5bc1e9(0x1b1)](_0x5bc1e9(0x17e)+_0x3c235a[_0x5bc1e9(0x1bb)]+':'+_0x3c235a[_0x5bc1e9(0x17b)]),console[_0x5bc1e9(0x1b1)](_0x5bc1e9(0x175));const _0x43f3be=startTerminalUIProcess(_0x3c235a[_0x5bc1e9(0x1bb)],_0x3c235a['port']);process['on'](_0x5bc1e9(0x18b),()=>_0x43f3be[_0x5bc1e9(0x19a)](_0x5bc1e9(0x18b))),process['on'](_0x5bc1e9(0x18c),()=>_0x43f3be[_0x5bc1e9(0x19a)](_0x5bc1e9(0x18c))),_0x43f3be['on']('exit',_0x1524ef=>process[_0x5bc1e9(0x196)](_0x1524ef||0x0));},'plus-terminal':async()=>{const _0x2785e1=a0_0x2479d6;console[_0x2785e1(0x1b1)]('Starting\x20Loxia\x20server\x20in\x20background...');const _0x138bfe=startServer(!![]);let _0x4a1486;explicitPort?_0x4a1486=await waitForServerAtPort(host,explicitPort):_0x4a1486=await waitForServerWithDiscovery();!_0x4a1486&&(console[_0x2785e1(0x18a)](_0x2785e1(0x1a9)),process[_0x2785e1(0x196)](0x1));console['log'](_0x2785e1(0x1a4)+_0x4a1486['host']+':'+_0x4a1486[_0x2785e1(0x17b)]),console[_0x2785e1(0x1b1)](_0x2785e1(0x175));const _0x4b9636=startTerminalUIProcess(_0x4a1486[_0x2785e1(0x1bb)],_0x4a1486[_0x2785e1(0x17b)]);_0x4b9636['on'](_0x2785e1(0x196),_0x45b0d4=>{const _0x524084=_0x2785e1;console[_0x524084(0x1b1)]('\x0aShutting\x20down\x20server...');try{process[_0x524084(0x19a)](_0x138bfe[_0x524084(0x179)],_0x524084(0x18c));}catch(_0x1e39cc){}process[_0x524084(0x196)](_0x45b0d4||0x0);}),process['on']('SIGINT',()=>{const _0x3b5bd0=_0x2785e1;_0x4b9636[_0x3b5bd0(0x19a)](_0x3b5bd0(0x18b));}),process['on'](_0x2785e1(0x18c),()=>{const _0x5165d5=_0x2785e1;_0x4b9636['kill'](_0x5165d5(0x18c));});}};commands[command]?commands[command]()[a0_0x2479d6(0x192)](_0x2b45ed=>{const _0x3fd305=a0_0x2479d6;console[_0x3fd305(0x18a)]('Error:',_0x2b45ed[_0x3fd305(0x1ab)]),process[_0x3fd305(0x196)](0x1);}):(console[a0_0x2479d6(0x18a)]('Unknown\x20command:\x20'+command),console[a0_0x2479d6(0x18a)](a0_0x2479d6(0x174)),process[a0_0x2479d6(0x196)](0x1));
|
package/bin/loxia-terminal-v2.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
function a0_0x30c3(_0x50a457,_0x546a42){_0x50a457=_0x50a457-0xd7;const _0x2bffdb=a0_0x2bff();let _0x30c322=_0x2bffdb[_0x50a457];return _0x30c322;}const a0_0x4c3ade=a0_0x30c3;(function(_0xefe935,_0x1d7181){const _0x4ec009=a0_0x30c3,_0x48b5e7=_0xefe935();while(!![]){try{const _0x39974f=parseInt(_0x4ec009(0x100))/0x1*(parseInt(_0x4ec009(0xef))/0x2)+parseInt(_0x4ec009(0x108))/0x3+parseInt(_0x4ec009(0xfc))/0x4+parseInt(_0x4ec009(0xde))/0x5*(-parseInt(_0x4ec009(0xf8))/0x6)+parseInt(_0x4ec009(0xff))/0x7+-parseInt(_0x4ec009(0xec))/0x8*(-parseInt(_0x4ec009(0x101))/0x9)+-parseInt(_0x4ec009(0xf6))/0xa;if(_0x39974f===_0x1d7181)break;else _0x48b5e7['push'](_0x48b5e7['shift']());}catch(_0x4db232){_0x48b5e7['push'](_0x48b5e7['shift']());}}}(a0_0x2bff,0xcc467));import{spawn}from'child_process';import a0_0x471e40 from'net';import a0_0x427e64 from'path';import{fileURLToPath}from'url';const __filename=fileURLToPath(import.meta.url),__dirname=a0_0x427e64['dirname'](__filename),projectRoot=a0_0x427e64[a0_0x4c3ade(0xee)](__dirname),DEFAULT_PORT=0x1f90,DEFAULT_HOST=a0_0x4c3ade(0xdb),SERVER_STARTUP_TIMEOUT=0x2710;async function isServerRunning(_0x271dac,_0x4977d3){return new Promise(_0x528f8a=>{const _0x5434b7=a0_0x30c3,_0x2aeaec=new a0_0x471e40[(_0x5434b7(0xe3))]();_0x2aeaec[_0x5434b7(0xe5)](0x7d0),_0x2aeaec['on'](_0x5434b7(0xeb),()=>{const _0x708d3=_0x5434b7;_0x2aeaec[_0x708d3(0xe6)](),_0x528f8a(!![]);}),_0x2aeaec['on'](_0x5434b7(0xe2),()=>{const _0x371582=_0x5434b7;_0x2aeaec[_0x371582(0xe6)](),_0x528f8a(![]);}),_0x2aeaec['on'](_0x5434b7(0xd8),()=>{const _0x2e76bb=_0x5434b7;_0x2aeaec[_0x2e76bb(0xe6)](),_0x528f8a(![]);}),_0x2aeaec[_0x5434b7(0xeb)](_0x4977d3,_0x271dac);});}async function startServer(_0x452ccd,_0x1bec77){const _0x1a73be=a0_0x4c3ade;return console[_0x1a73be(0xed)](_0x1a73be(0xf4)),new Promise((_0x287325,_0x37cf2a)=>{const _0x34659a=_0x1a73be,_0x302f04=spawn(_0x34659a(0x102),[a0_0x427e64['join'](projectRoot,'bin/cli.js'),'--ui',_0x34659a(0xf5),'--host',_0x452ccd,_0x34659a(0x105),_0x1bec77[_0x34659a(0xe0)]()],{'detached':![],'stdio':[_0x34659a(0xf7),_0x34659a(0xfb),'pipe']});_0x302f04[_0x34659a(0xdf)]['on'](_0x34659a(0xf1),()=>{}),_0x302f04[_0x34659a(0x107)]['on'](_0x34659a(0xf1),()=>{}),_0x302f04['on']('error',_0x49ba31=>{const _0x4a4a3b=_0x34659a;console[_0x4a4a3b(0xd8)]('Failed\x20to\x20start\x20server:',_0x49ba31['message']),_0x37cf2a(_0x49ba31);});const _0x3dc794=Date[_0x34659a(0xf3)](),_0xbe6be7=setInterval(async()=>{const _0x30a4a1=_0x34659a,_0x2b9415=await isServerRunning(_0x452ccd,_0x1bec77);if(_0x2b9415)clearInterval(_0xbe6be7),console[_0x30a4a1(0xed)](_0x30a4a1(0xd7)+_0x452ccd+':'+_0x1bec77),_0x287325();else Date['now']()-_0x3dc794>SERVER_STARTUP_TIMEOUT&&(clearInterval(_0xbe6be7),_0x302f04['kill'](),_0x37cf2a(new Error(_0x30a4a1(0xea))));},0x1f4);});}function a0_0x2bff(){const _0x193d51=['Server\x20startup\x20timeout','connect','2512wGXgfX','log','dirname','328596tKSDFJ','message','data','argv','now','🚀\x20Starting\x20Loxia\x20server...','web','38928520cBFEdG','ignore','6sTHwKA','💡\x20Troubleshooting:','\x20\x20\x203.\x20Check\x20logs\x20for\x20more\x20details','pipe','2769520vArdWU','✓\x20Server\x20is\x20already\x20running\x20at\x20','\x20\x20\x202.\x20Try\x20running\x20the\x20server\x20manually:\x20node\x20bin/cli.js','5865377OTnyrU','8MVYeGM','21753KtfDCB','node','\x20\x20\x201.\x20Make\x20sure\x20no\x20other\x20process\x20is\x20using\x20port\x208080','\x20\x20Loxia\x20Autopilot\x20One\x20-\x20Terminal\x20UI','--port','...','stderr','3470691bkPzvO','✓\x20Server\x20started\x20at\x20','error','exit','🔍\x20Checking\x20if\x20server\x20is\x20running\x20at\x20','localhost','slice','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','154735axCDMG','stdout','toString','❌\x20Failed\x20to\x20start\x20Terminal\x20UI:','timeout','Socket','🎨\x20Launching\x20Ink-based\x20Terminal\x20UI...','setTimeout','destroy','length','✗\x20Server\x20is\x20not\x20running','--host'];a0_0x2bff=function(){return _0x193d51;};return a0_0x2bff();}async function main(){const _0x11623e=a0_0x4c3ade;try{console[_0x11623e(0xed)](_0x11623e(0xdd)),console['log'](_0x11623e(0x104)),console[_0x11623e(0xed)](_0x11623e(0xdd)),console[_0x11623e(0xed)]('');const _0x5588f1=process[_0x11623e(0xf2)][_0x11623e(0xdc)](0x2);let _0x45ff22=DEFAULT_HOST,_0x5bf10d=DEFAULT_PORT;for(let _0x408c7c=0x0;_0x408c7c<_0x5588f1[_0x11623e(0xe7)];_0x408c7c++){if(_0x5588f1[_0x408c7c]===_0x11623e(0xe9)&&_0x5588f1[_0x408c7c+0x1])_0x45ff22=_0x5588f1[_0x408c7c+0x1],_0x408c7c++;else _0x5588f1[_0x408c7c]===_0x11623e(0x105)&&_0x5588f1[_0x408c7c+0x1]&&(_0x5bf10d=parseInt(_0x5588f1[_0x408c7c+0x1],0xa),_0x408c7c++);}console[_0x11623e(0xed)](_0x11623e(0xda)+_0x45ff22+':'+_0x5bf10d+_0x11623e(0x106));const _0x2a1f5a=await isServerRunning(_0x45ff22,_0x5bf10d);!_0x2a1f5a?(console[_0x11623e(0xed)](_0x11623e(0xe8)),await startServer(_0x45ff22,_0x5bf10d)):console[_0x11623e(0xed)](_0x11623e(0xfd)+_0x45ff22+':'+_0x5bf10d),console[_0x11623e(0xed)](''),console[_0x11623e(0xed)](_0x11623e(0xe4)),console[_0x11623e(0xed)](''),await new Promise(_0x47ab77=>setTimeout(_0x47ab77,0x1f4)),process.env.LOXIA_HOST=_0x45ff22,process.env.LOXIA_PORT=_0x5bf10d['toString'](),await import('../src/interfaces/terminal/index.js');}catch(_0x5150d7){console['error'](''),console[_0x11623e(0xd8)](_0x11623e(0xe1)),console['error']('\x20\x20',_0x5150d7[_0x11623e(0xf0)]),console[_0x11623e(0xd8)](''),console[_0x11623e(0xd8)](_0x11623e(0xf9)),console[_0x11623e(0xd8)](_0x11623e(0x103)),console[_0x11623e(0xd8)](_0x11623e(0xfe)),console[_0x11623e(0xd8)](_0x11623e(0xfa)),console['error'](''),process[_0x11623e(0xd9)](0x1);}}main();
|
package/bin/loxia-terminal.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function a0_0x554e(_0x1959df,_0x2ab1c7){_0x1959df=_0x1959df-0x78;const _0x4523e0=a0_0x4523();let _0x554e33=_0x4523e0[_0x1959df];return _0x554e33;}const a0_0x334f19=a0_0x554e;(function(_0x36c900,_0x4d6d9a){const _0x30e765=a0_0x554e,_0x19417f=_0x36c900();while(!![]){try{const _0x45f92a=parseInt(_0x30e765(0x9e))/0x1+parseInt(_0x30e765(0x93))/0x2*(parseInt(_0x30e765(0x96))/0x3)+-parseInt(_0x30e765(0x8f))/0x4+parseInt(_0x30e765(0x91))/0x5*(-parseInt(_0x30e765(0x8b))/0x6)+-parseInt(_0x30e765(0x99))/0x7*(-parseInt(_0x30e765(0x9d))/0x8)+-parseInt(_0x30e765(0x8a))/0x9*(-parseInt(_0x30e765(0x88))/0xa)+parseInt(_0x30e765(0x7c))/0xb;if(_0x45f92a===_0x4d6d9a)break;else _0x19417f['push'](_0x19417f['shift']());}catch(_0x30a0b0){_0x19417f['push'](_0x19417f['shift']());}}}(a0_0x4523,0xb6d40));import{startTerminalUI}from'../src/interfaces/terminal/index.js';const args=process[a0_0x334f19(0x89)][a0_0x334f19(0x97)](0x2),options={'host':a0_0x334f19(0x7d),'port':0x1f90};for(let i=0x0;i<args[a0_0x334f19(0x9b)];i++){const arg=args[i];if(arg===a0_0x334f19(0x8c)||arg==='-h')options[a0_0x334f19(0x84)]=args[++i];else{if(arg===a0_0x334f19(0x8e)||arg==='-p')options[a0_0x334f19(0x7a)]=parseInt(args[++i],0xa);else arg===a0_0x334f19(0x78)&&(console['log']('\x0aLoxia\x20Terminal\x20UI\x0a\x0aUsage:\x0a\x20\x20loxia-terminal\x20[options]\x0a\x0aOptions:\x0a\x20\x20--host,\x20-h\x20<host>\x20\x20\x20\x20Backend\x20host\x20(default:\x20localhost)\x0a\x20\x20--port,\x20-p\x20<port>\x20\x20\x20\x20Backend\x20port\x20(default:\x208080)\x0a\x20\x20--help\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Show\x20this\x20help\x20message\x0a\x0aEnvironment\x20Variables:\x0a\x20\x20LOXIA_HOST\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Backend\x20host\x0a\x20\x20LOXIA_PORT\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Backend\x20port\x0a\x0aExamples:\x0a\x20\x20loxia-terminal\x0a\x20\x20loxia-terminal\x20--host\x20192.168.1.100\x20--port\x203000\x0a\x20\x20LOXIA_HOST=api.example.com\x20LOXIA_PORT=443\x20loxia-terminal\x0a'),process[a0_0x334f19(0x90)](0x0));}}process.env.LOXIA_HOST&&(options[a0_0x334f19(0x84)]=process.env.LOXIA_HOST);process.env.LOXIA_PORT&&(options[a0_0x334f19(0x7a)]=parseInt(process.env.LOXIA_PORT,0xa));!process[a0_0x334f19(0x8d)][a0_0x334f19(0x86)]&&(console[a0_0x334f19(0x95)](a0_0x334f19(0x94)),console[a0_0x334f19(0x95)](''),console[a0_0x334f19(0x95)]('The\x20terminal\x20UI\x20cannot\x20run\x20in:'),console[a0_0x334f19(0x95)](a0_0x334f19(0x81)),console[a0_0x334f19(0x95)](a0_0x334f19(0x79)),console[a0_0x334f19(0x95)](a0_0x334f19(0x7b)),console[a0_0x334f19(0x95)](a0_0x334f19(0x7e)),console[a0_0x334f19(0x95)](''),console[a0_0x334f19(0x95)](a0_0x334f19(0x80)),console['error']('\x20\x20npm\x20run\x20terminal-ui'),console['error'](''),console[a0_0x334f19(0x95)]('Or\x20use\x20the\x20web\x20UI\x20instead:'),console[a0_0x334f19(0x95)]('\x20\x20npm\x20start'),process['exit'](0x1));console[a0_0x334f19(0x9a)](a0_0x334f19(0x9c)),console[a0_0x334f19(0x9a)](a0_0x334f19(0x83)+options['host']+':'+options[a0_0x334f19(0x7a)]),console[a0_0x334f19(0x9a)](a0_0x334f19(0x92));const instance=startTerminalUI(options);instance[a0_0x334f19(0x98)]()[a0_0x334f19(0x85)](()=>{const _0x1be76f=a0_0x334f19;console[_0x1be76f(0x9a)](_0x1be76f(0x87)),process[_0x1be76f(0x90)](0x0);})[a0_0x334f19(0x82)](_0x242f30=>{const _0x4168ae=a0_0x334f19;console[_0x4168ae(0x95)](_0x4168ae(0x7f),_0x242f30),process['exit'](0x1);});function a0_0x4523(){const _0x387d61=['then','isTTY','\x0aTerminal\x20UI\x20exited','30010beRKBz','argv','1449QqGUzZ','6049374erdFHo','--host','stdin','--port','4137120ebiFpv','exit','5eRhbKE','Press\x20Ctrl+C\x20to\x20exit\x0a','18pVySdR','ERROR:\x20Terminal\x20UI\x20requires\x20an\x20interactive\x20terminal\x20(TTY).','error','364053jVTYQp','slice','waitUntilExit','7664377XjAVmT','log','length','Starting\x20Loxia\x20Terminal\x20UI...','8BlkBLT','98196WLbsGc','--help','\x20\x20-\x20Redirected\x20output\x20(e.g.,\x20>\x20file.txt,\x202>&1\x20|\x20...)','port','\x20\x20-\x20Background\x20processes\x20(e.g.,\x20&\x20at\x20the\x20end)','252406BkDCXG','localhost','\x20\x20-\x20Some\x20CI/CD\x20environments','\x0aTerminal\x20UI\x20error:','Please\x20run\x20this\x20command\x20in\x20a\x20real\x20terminal\x20without\x20pipes\x20or\x20redirection:','\x20\x20-\x20Piped\x20environments\x20(e.g.,\x20|\x20head,\x20|\x20grep)','catch','Connecting\x20to:\x20','host'];a0_0x4523=function(){return _0x387d61;};return a0_0x4523();}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const a0_0x1382c1=a0_0x1cb8;(function(_0x212ec8,_0x20cbad){const _0x3beaf0=a0_0x1cb8,_0x3e38ad=_0x212ec8();while(!![]){try{const _0xc99544=-parseInt(_0x3beaf0(0x1b8))/0x1*(-parseInt(_0x3beaf0(0x1aa))/0x2)+parseInt(_0x3beaf0(0x1b3))/0x3*(parseInt(_0x3beaf0(0x1bf))/0x4)+parseInt(_0x3beaf0(0x1a8))/0x5+parseInt(_0x3beaf0(0x1c0))/0x6*(parseInt(_0x3beaf0(0x19c))/0x7)+parseInt(_0x3beaf0(0x1a5))/0x8+parseInt(_0x3beaf0(0x1b6))/0x9*(parseInt(_0x3beaf0(0x19e))/0xa)+-parseInt(_0x3beaf0(0x19a))/0xb;if(_0xc99544===_0x20cbad)break;else _0x3e38ad['push'](_0x3e38ad['shift']());}catch(_0x4787dd){_0x3e38ad['push'](_0x3e38ad['shift']());}}}(a0_0x26f2,0x8c912));import{spawn}from'child_process';import{fileURLToPath}from'url';import{dirname,join}from'path';import a0_0x2614ed from'http';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),rootDir=join(__dirname,'..'),SERVER_PORT=process.env.PORT||0x1f90,STARTUP_WAIT=0x7d0;let serverProcess=null;async function checkServerReady(_0x1952a8=0xa,_0x31d911=0x1f4){const _0x507827=a0_0x1cb8;for(let _0x339a6d=0x0;_0x339a6d<_0x1952a8;_0x339a6d++){try{return await new Promise((_0x3b704b,_0x1d6ab9)=>{const _0x5a1a3b=a0_0x1cb8,_0x430cd3=a0_0x2614ed['get'](_0x5a1a3b(0x1bc)+SERVER_PORT+_0x5a1a3b(0x1ad),_0xddd87a=>{const _0x5a81eb=_0x5a1a3b;_0xddd87a['statusCode']===0xc8?_0x3b704b():_0x1d6ab9(new Error('Server\x20returned\x20'+_0xddd87a[_0x5a81eb(0x197)]));});_0x430cd3['on'](_0x5a1a3b(0x1bd),_0x1d6ab9),_0x430cd3['setTimeout'](0x3e8,()=>{const _0x1bcc79=_0x5a1a3b;_0x430cd3[_0x1bcc79(0x1a4)](),_0x1d6ab9(new Error('Timeout'));});}),console[_0x507827(0x1b0)](_0x507827(0x1a9)),!![];}catch(_0x239bca){_0x339a6d<_0x1952a8-0x1&&await new Promise(_0x390b3d=>setTimeout(_0x390b3d,_0x31d911));}}return console[_0x507827(0x1b0)](_0x507827(0x1bb)),![];}function a0_0x1cb8(_0x4776d4,_0x144f18){_0x4776d4=_0x4776d4-0x196;const _0x26f252=a0_0x26f2();let _0x1cb80a=_0x26f252[_0x4776d4];return _0x1cb80a;}async function startServer(){return new Promise(_0x59fe73=>{const _0x197c16=a0_0x1cb8;console[_0x197c16(0x1b0)]('🚀\x20Starting\x20Loxia\x20server...');const _0x4ce3c1=join(rootDir,'src','index.js');serverProcess=spawn(_0x197c16(0x1c1),[_0x4ce3c1],{'cwd':rootDir,'env':{...process.env},'stdio':['ignore',_0x197c16(0x19d),_0x197c16(0x19d)],'detached':![]}),serverProcess[_0x197c16(0x1a6)]['on'](_0x197c16(0x19b),_0x5ded5c=>{const _0x1f0f8d=_0x197c16,_0x2b6972=_0x5ded5c[_0x1f0f8d(0x1c2)]()[_0x1f0f8d(0x1b5)]();_0x2b6972&&console['log'](_0x1f0f8d(0x196)+_0x2b6972);}),serverProcess[_0x197c16(0x198)]['on'](_0x197c16(0x19b),_0x58f866=>{const _0x1fc9d4=_0x197c16,_0x111773=_0x58f866['toString']()[_0x1fc9d4(0x1b5)]();_0x111773&&!_0x111773[_0x1fc9d4(0x19f)](_0x1fc9d4(0x1a2))&&console[_0x1fc9d4(0x1bd)](_0x1fc9d4(0x1b1)+_0x111773);}),serverProcess['on']('error',_0x321035=>{const _0x24357a=_0x197c16;console[_0x24357a(0x1bd)]('Failed\x20to\x20start\x20server:',_0x321035[_0x24357a(0x1ae)]),process[_0x24357a(0x1a1)](0x1);}),serverProcess['on']('exit',(_0x41d6c2,_0x46245f)=>{const _0x5deacb=_0x197c16;_0x41d6c2!==null&&_0x41d6c2!==0x0&&(console[_0x5deacb(0x1bd)](_0x5deacb(0x1b7)+_0x41d6c2),process['exit'](_0x41d6c2));}),setTimeout(_0x59fe73,STARTUP_WAIT);});}async function startTerminalUI(){const _0x302969=a0_0x1cb8;console[_0x302969(0x1b0)](_0x302969(0x1b4)),console[_0x302969(0x1b0)]('');const _0x218cd9=join(rootDir,'bin','loxia-terminal.js'),_0x35b377=spawn(_0x302969(0x1c1),[_0x218cd9],{'cwd':rootDir,'env':{...process.env},'stdio':_0x302969(0x1af)});return _0x35b377['on'](_0x302969(0x1bd),_0x255f10=>{const _0x1f23e1=_0x302969;console[_0x1f23e1(0x1bd)]('Failed\x20to\x20start\x20Terminal\x20UI:',_0x255f10[_0x1f23e1(0x1ae)]),cleanup(),process['exit'](0x1);}),_0x35b377['on']('exit',_0x26d885=>{const _0xd0fde4=_0x302969;console[_0xd0fde4(0x1b0)](_0xd0fde4(0x1ab)),cleanup(),process[_0xd0fde4(0x1a1)](_0x26d885||0x0);}),_0x35b377;}function cleanup(){const _0x3b8e82=a0_0x1cb8;serverProcess&&!serverProcess[_0x3b8e82(0x1b2)]&&(console[_0x3b8e82(0x1b0)](_0x3b8e82(0x1ba)),serverProcess[_0x3b8e82(0x1a0)](_0x3b8e82(0x1c3)),setTimeout(()=>{const _0x12a138=_0x3b8e82;!serverProcess[_0x12a138(0x1b2)]&&serverProcess[_0x12a138(0x1a0)](_0x12a138(0x1be));},0x1388));}process['on'](a0_0x1382c1(0x1ac),()=>{const _0x15c1ba=a0_0x1382c1;console['log'](_0x15c1ba(0x1a7)),cleanup(),process[_0x15c1ba(0x1a1)](0x0);}),process['on'](a0_0x1382c1(0x1c3),()=>{const _0x2f17dc=a0_0x1382c1;console[_0x2f17dc(0x1b0)](_0x2f17dc(0x199)),cleanup(),process[_0x2f17dc(0x1a1)](0x0);}),process['on'](a0_0x1382c1(0x1a1),()=>{cleanup();});function a0_0x26f2(){const _0x206b73=['ExperimentalWarning','╔════════════════════════════════════════════════╗','destroy','6306456HHmGua','stdout','\x0a⚠️\x20\x20Received\x20SIGINT,\x20shutting\x20down...','5108355VSzaBV','✅\x20Server\x20is\x20ready!','4chSdWF','\x0a👋\x20Terminal\x20UI\x20closed.','SIGINT','/health','message','inherit','log','[SERVER\x20ERROR]\x20','killed','3WexoSJ','🖥️\x20\x20Starting\x20Terminal\x20UI...','trim','4635WSGNBh','Server\x20exited\x20with\x20code\x20','64721PspyxD','╚════════════════════════════════════════════════╝','🛑\x20Stopping\x20server...','⚠️\x20\x20Server\x20may\x20not\x20be\x20fully\x20ready,\x20but\x20continuing\x20anyway...','http://localhost:','error','SIGKILL','4181844OjsICn','12YRpJzt','node','toString','SIGTERM','Error\x20during\x20startup:','[SERVER]\x20','statusCode','stderr','\x0a⚠️\x20\x20Received\x20SIGTERM,\x20shutting\x20down...','42488127pocqQz','data','3248483isyEXO','pipe','10200KOqLNU','includes','kill','exit'];a0_0x26f2=function(){return _0x206b73;};return a0_0x26f2();}async function main(){const _0x4006e2=a0_0x1382c1;console[_0x4006e2(0x1b0)](_0x4006e2(0x1a3)),console[_0x4006e2(0x1b0)]('║\x20\x20\x20Loxia\x20AI\x20Agents\x20-\x20Server\x20+\x20Terminal\x20UI\x20\x20\x20\x20\x20\x20║'),console[_0x4006e2(0x1b0)](_0x4006e2(0x1b9)),console[_0x4006e2(0x1b0)]('');try{await startServer(),await checkServerReady(),await startTerminalUI(),await new Promise(()=>{});}catch(_0x5a4e84){console[_0x4006e2(0x1bd)](_0x4006e2(0x1c4),_0x5a4e84[_0x4006e2(0x1ae)]),cleanup(),process['exit'](0x1);}}main();
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const a0_0x45e56b=a0_0x643e;(function(_0x1c1ad7,_0x57f4c0){const _0x579db2=a0_0x643e,_0x1c09e6=_0x1c1ad7();while(!![]){try{const _0x52af76=-parseInt(_0x579db2(0x118))/0x1+parseInt(_0x579db2(0x121))/0x2*(-parseInt(_0x579db2(0x101))/0x3)+-parseInt(_0x579db2(0x10a))/0x4*(parseInt(_0x579db2(0xf9))/0x5)+-parseInt(_0x579db2(0x127))/0x6*(parseInt(_0x579db2(0xfb))/0x7)+parseInt(_0x579db2(0x12b))/0x8*(-parseInt(_0x579db2(0xf6))/0x9)+parseInt(_0x579db2(0x108))/0xa*(parseInt(_0x579db2(0x11b))/0xb)+parseInt(_0x579db2(0x10e))/0xc;if(_0x52af76===_0x57f4c0)break;else _0x1c09e6['push'](_0x1c09e6['shift']());}catch(_0xaa6d79){_0x1c09e6['push'](_0x1c09e6['shift']());}}}(a0_0x415f,0x7a530));function a0_0x415f(){const _0x3d7438=['dirname','promises','❌\x20Installation\x20failed:','\x20\x20\x20⚠️\x20\x20Python\x20not\x20found\x20-\x20skipping\x20Python\x20scanners','375312GAmWlY','location','\x0aYou\x20can\x20manually\x20install\x20scanners:','\x20\x20\x20✅\x20Semgrep\x20already\x20installed:\x20','1489576RvIPiQ','\x20\x20\x20✅\x20eslint-plugin-security\x20is\x20installed\x0a','\x0a═══════════════════════════════════════════════════════════','📦\x20Checking\x20ESLint\x20Security\x20Plugin...','log','🔍\x20Installing\x20Semgrep...','mkdir','\x20\x20Installing\x20Security\x20Scanners','\x20\x20\x20pip\x20install\x20semgrep\x0a','\x20\x20\x20Using\x20system-installed\x20Semgrep\x0a','\x20\x20\x20✅\x20Python\x20found:\x20','startsWith','eslint-plugin-security','\x20\x20\x20✅\x20Semgrep\x20installed\x20successfully','v1.55.0','trim','/opt/homebrew','url','exit','message','node_modules','chmod','\x20\x20Platform:\x20','\x20\x20\x20Installing\x20','pipe','\x20\x20\x20✅\x20','═══════════════════════════════════════════════════════════','statusCode','semgrep','--user','catch','pip-audit','\x20already\x20installed','9EMtUOM','stdout','═══════════════════════════════════════════════════════════\x0a','3533015ZPoqgU','python3\x20--version','21wkgClz','\x20\x20\x20You\x20can\x20install\x20manually:\x20pip\x20install\x20semgrep\x0a','\x20\x20\x20Run:\x20npm\x20install\x20--save-dev\x20eslint-plugin-security\x0a','...','\x20\x20\x20Location:\x20','then','1041699FOMoSx','platform','\x20\x20\x20Semgrep\x20not\x20found\x20in\x20PATH,\x20installing\x20standalone\x20binary...','.scanners','python\x20--version','headers','close','100XBbmle','arch','4hrDYfF','\x20\x20\x20You\x20can\x20install\x20manually:\x20pip\x20install\x20','python','\x20\x20\x20⚠️\x20\x20Failed\x20to\x20install\x20','21839844kzXoji','/usr/local/Cellar','\x20\x20npm\x20install\x20--save-dev\x20eslint-plugin-security','includes','🐍\x20Checking\x20Python\x20scanners...','\x20\x20\x20To\x20enable\x20Python\x20scanning,\x20install\x20Python\x20and\x20run:','error','Failed\x20to\x20download:\x20HTTP\x20','python3','finish','316175ULGvMq','\x20-m\x20pip\x20show\x20','join','849365oMUZEj','unlink','\x20\x20\x20⚠️\x20\x20Failed\x20to\x20install\x20Semgrep:\x20','\x20\x20\x20Downloading\x20from\x20','bandit','\x20\x20\x20Please\x20install\x20manually:\x20https://semgrep.dev/docs/getting-started/\x0a','4hfrnLj','\x20\x20\x20Note:\x20To\x20use\x20system-wide,\x20add\x20to\x20PATH\x20or\x20install\x20globally:'];a0_0x415f=function(){return _0x3d7438;};return a0_0x415f();}import{exec}from'child_process';import{promisify}from'util';import a0_0x163145 from'https';import a0_0x2ee74f from'http';import a0_0x2c9f45 from'fs';import a0_0xf5c282 from'path';import{fileURLToPath}from'url';import{createWriteStream}from'fs';import{pipeline}from'stream/promises';const execAsync=promisify(exec),__filename=fileURLToPath(import.meta.url),__dirname=a0_0xf5c282[a0_0x45e56b(0x123)](__filename),SCANNER_DIR=a0_0xf5c282['join'](__dirname,'..',a0_0x45e56b(0xe9),a0_0x45e56b(0x104)),SEMGREP_VERSION=a0_0x45e56b(0x139);console[a0_0x45e56b(0x12f)](a0_0x45e56b(0xef)),console[a0_0x45e56b(0x12f)](a0_0x45e56b(0x132)),console[a0_0x45e56b(0x12f)](a0_0x45e56b(0xeb)+process[a0_0x45e56b(0x102)]+'\x20('+process['arch']+')'),console['log'](a0_0x45e56b(0xf8));function a0_0x643e(_0x4ae9e5,_0x3f831c){_0x4ae9e5=_0x4ae9e5-0xe6;const _0x415f9f=a0_0x415f();let _0x643e21=_0x415f9f[_0x4ae9e5];return _0x643e21;}async function installScanners(){const _0x433366=a0_0x45e56b;await a0_0x2c9f45[_0x433366(0x124)][_0x433366(0x131)](SCANNER_DIR,{'recursive':!![]}),await checkESLintSecurity(),await installSemgrep(),await installPythonScanners(),console[_0x433366(0x12f)](_0x433366(0x12d)),console[_0x433366(0x12f)]('\x20\x20Installation\x20Complete'),console[_0x433366(0x12f)](_0x433366(0xf8));}async function checkESLintSecurity(){const _0x186b30=a0_0x45e56b;console[_0x186b30(0x12f)](_0x186b30(0x12e));try{await import(_0x186b30(0x137)),console[_0x186b30(0x12f)](_0x186b30(0x12c));}catch(_0xaf42ab){console[_0x186b30(0x12f)]('\x20\x20\x20⚠️\x20\x20eslint-plugin-security\x20not\x20found'),console[_0x186b30(0x12f)](_0x186b30(0xfd));}}async function installSemgrep(){const _0x23a9d0=a0_0x45e56b;console[_0x23a9d0(0x12f)](_0x23a9d0(0x130));const _0x42ab93=process[_0x23a9d0(0x102)],_0x2a9b15=process[_0x23a9d0(0x109)];try{const _0x11ec95=await execAsync('semgrep\x20--version',{'timeout':0x1388});console[_0x23a9d0(0x12f)](_0x23a9d0(0x12a)+_0x11ec95[_0x23a9d0(0xf7)][_0x23a9d0(0x13a)]()),console[_0x23a9d0(0x12f)](_0x23a9d0(0x134));return;}catch(_0x327afb){console[_0x23a9d0(0x12f)](_0x23a9d0(0x103));}const _0x2865de=getSemgrepBinaryInfo(_0x42ab93,_0x2a9b15);if(!_0x2865de){console[_0x23a9d0(0x12f)]('\x20\x20\x20⚠️\x20\x20No\x20Semgrep\x20binary\x20available\x20for\x20'+_0x42ab93+'-'+_0x2a9b15),console['log'](_0x23a9d0(0x120));return;}try{const _0x3eb7c5=a0_0xf5c282[_0x23a9d0(0x11a)](SCANNER_DIR,_0x23a9d0(0xf1));console['log'](_0x23a9d0(0x11e)+_0x2865de[_0x23a9d0(0xe6)]+_0x23a9d0(0xfe)),await downloadFile(_0x2865de[_0x23a9d0(0xe6)],_0x3eb7c5),await a0_0x2c9f45[_0x23a9d0(0x124)][_0x23a9d0(0xea)](_0x3eb7c5,0x1ed),console[_0x23a9d0(0x12f)](_0x23a9d0(0x138)),console[_0x23a9d0(0x12f)](_0x23a9d0(0xff)+_0x3eb7c5+'\x0a'),console['log'](_0x23a9d0(0x122)),console[_0x23a9d0(0x12f)](_0x23a9d0(0x133));}catch(_0x1312b0){console[_0x23a9d0(0x12f)](_0x23a9d0(0x11d)+_0x1312b0[_0x23a9d0(0xe8)]),console[_0x23a9d0(0x12f)](_0x23a9d0(0xfc));}}function getSemgrepBinaryInfo(_0x309c08,_0x4bb11e){return null;}async function installPythonScanners(){const _0x35b132=a0_0x45e56b;console['log'](_0x35b132(0x112));let _0x11bdf1=null;try{await execAsync(_0x35b132(0xfa),{'timeout':0x1388}),_0x11bdf1=_0x35b132(0x116);}catch(_0x106cc0){try{await execAsync(_0x35b132(0x105),{'timeout':0x1388}),_0x11bdf1=_0x35b132(0x10c);}catch(_0x26b4fd){console[_0x35b132(0x12f)](_0x35b132(0x126)),console[_0x35b132(0x12f)](_0x35b132(0x113)),console[_0x35b132(0x12f)]('\x20\x20\x20pip\x20install\x20semgrep\x20bandit\x20pip-audit\x20checkov\x20yamllint\x0a');return;}}console[_0x35b132(0x12f)](_0x35b132(0x135)+_0x11bdf1),await installViaPip(_0x35b132(0xf1),_0x11bdf1),await installViaPip(_0x35b132(0x11f),_0x11bdf1),await installViaPip(_0x35b132(0xf4),_0x11bdf1),await installViaPip('checkov',_0x11bdf1),await installViaPip('yamllint',_0x11bdf1),console[_0x35b132(0x12f)]('');}async function isHomebrewPython(_0x4c8923){const _0x501eee=a0_0x45e56b;try{const {stdout:_0x39c196}=await execAsync(_0x4c8923+'\x20-c\x20\x22import\x20sys;\x20print(sys.prefix)\x22',{'timeout':0x1388});return _0x39c196[_0x501eee(0x111)](_0x501eee(0x13b))||_0x39c196['includes'](_0x501eee(0x10f));}catch{return![];}}async function installViaPip(_0x576f4e,_0x120351){const _0x2db279=a0_0x45e56b;try{const _0x16c210=await execAsync(_0x120351+_0x2db279(0x119)+_0x576f4e,{'timeout':0x1388});return console[_0x2db279(0x12f)](_0x2db279(0xee)+_0x576f4e+_0x2db279(0xf5)),!![];}catch(_0x5170f7){console['log'](_0x2db279(0xec)+_0x576f4e+_0x2db279(0xfe));try{const _0x460bbb=await isHomebrewPython(_0x120351),_0x2fcb44=_0x460bbb?'':_0x2db279(0xf2),_0x282469=(_0x120351+'\x20-m\x20pip\x20install\x20'+_0x2fcb44+'\x20'+_0x576f4e)['replace'](/\s+/g,'\x20')[_0x2db279(0x13a)]();return await execAsync(_0x282469,{'timeout':0xea60}),console[_0x2db279(0x12f)](_0x2db279(0xee)+_0x576f4e+'\x20installed\x20successfully'),!![];}catch(_0x529a07){return console['log'](_0x2db279(0x10d)+_0x576f4e+':\x20'+_0x529a07['message']),console['log'](_0x2db279(0x10b)+_0x576f4e),![];}}}async function downloadFile(_0x5857a6,_0x4c77cf){return new Promise((_0x384288,_0x37728d)=>{const _0x36480b=a0_0x643e,_0x595899=_0x5857a6[_0x36480b(0x136)]('https')?a0_0x163145:a0_0x2ee74f;_0x595899['get'](_0x5857a6,_0x1b6532=>{const _0x375753=_0x36480b;if(_0x1b6532[_0x375753(0xf0)]===0x12e||_0x1b6532[_0x375753(0xf0)]===0x12d){downloadFile(_0x1b6532[_0x375753(0x106)][_0x375753(0x128)],_0x4c77cf)[_0x375753(0x100)](_0x384288)[_0x375753(0xf3)](_0x37728d);return;}if(_0x1b6532['statusCode']!==0xc8){_0x37728d(new Error(_0x375753(0x115)+_0x1b6532[_0x375753(0xf0)]));return;}const _0x2cf744=createWriteStream(_0x4c77cf);_0x1b6532[_0x375753(0xed)](_0x2cf744),_0x2cf744['on'](_0x375753(0x117),()=>{const _0x38a673=_0x375753;_0x2cf744[_0x38a673(0x107)](),_0x384288();}),_0x2cf744['on'](_0x375753(0x114),_0x58cd18=>{const _0x3f5897=_0x375753;a0_0x2c9f45[_0x3f5897(0x11c)](_0x4c77cf,()=>{}),_0x37728d(_0x58cd18);});})['on'](_0x36480b(0x114),_0x37728d);});}installScanners()[a0_0x45e56b(0xf3)](_0x5f317c=>{const _0x249bd5=a0_0x45e56b;console[_0x249bd5(0x114)](_0x249bd5(0x125),_0x5f317c['message']),console[_0x249bd5(0x114)](_0x249bd5(0x129)),console['error'](_0x249bd5(0x110)),console['error']('\x20\x20pip\x20install\x20semgrep\x20bandit\x20pip-audit'),process[_0x249bd5(0xe7)](0x0);});
|
package/scripts/watchdog.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const a0_0x4726bb=a0_0x1210;(function(_0x5125c9,_0x4dd2ff){const _0x5d37fa=a0_0x1210,_0x4492e0=_0x5125c9();while(!![]){try{const _0x2e6f1b=parseInt(_0x5d37fa(0x142))/0x1*(parseInt(_0x5d37fa(0x14b))/0x2)+parseInt(_0x5d37fa(0x151))/0x3+parseInt(_0x5d37fa(0x12b))/0x4*(-parseInt(_0x5d37fa(0x12c))/0x5)+-parseInt(_0x5d37fa(0x14a))/0x6+parseInt(_0x5d37fa(0x12e))/0x7*(-parseInt(_0x5d37fa(0x134))/0x8)+parseInt(_0x5d37fa(0x13a))/0x9*(parseInt(_0x5d37fa(0x159))/0xa)+parseInt(_0x5d37fa(0x128))/0xb*(parseInt(_0x5d37fa(0x130))/0xc);if(_0x2e6f1b===_0x4dd2ff)break;else _0x4492e0['push'](_0x4492e0['shift']());}catch(_0x44e0e7){_0x4492e0['push'](_0x4492e0['shift']());}}}(a0_0x5ddb,0x18952));const {spawn,execSync}=require(a0_0x4726bb(0x14e)),path=require(a0_0x4726bb(0x13e)),fs=require('fs'),logFile=path[a0_0x4726bb(0x13c)](__dirname,a0_0x4726bb(0x156));function log(_0x2c19f7){const _0x5acdfd=a0_0x4726bb,_0x2f4010=new Date()[_0x5acdfd(0x139)](),_0x23f408='['+_0x2f4010+']\x20'+_0x2c19f7+'\x0a';console[_0x5acdfd(0x12d)](_0x2c19f7);try{fs[_0x5acdfd(0x152)](logFile,_0x23f408);}catch(_0x38313){}}function a0_0x1210(_0x522f14,_0x53f1cc){_0x522f14=_0x522f14-0x128;const _0x5ddbd8=a0_0x5ddb();let _0x1210f5=_0x5ddbd8[_0x522f14];return _0x1210f5;}log(a0_0x4726bb(0x158));function a0_0x5ddb(){const _0x15fe28=['watchdog.log','pid','[Watchdog]\x20Script\x20loaded','1372130VFJbvB','674916HKXTDn','--delay','kill','4eejofO','88095gVuOLo','log','49RxRwuU','win32','12TsyXpc','now','slice','[Watchdog]\x20Executing:\x20','98248LHHuTh','\x20has\x20terminated','loxia\x20web','ignore','\x20to\x20exit...','toISOString','9FOSchW','catch','join','[Watchdog]\x20Loxia\x20restarted\x20with\x20PID\x20','path','delay','ms\x20before\x20restart...','[Watchdog]\x20Watchdog\x20exiting...','132716WkBhbQ','message','split','[Watchdog]\x20Started\x20with\x20options:','platform','exit','command','[Watchdog]\x20Waiting\x20for\x20parent\x20process\x20','882396dEhglX','2UqqSCt','[Watchdog]\x20Waiting\x20','\x20still\x20running\x20after\x20','child_process','--command','ms,\x20proceeding\x20anyway','60171lBsSjs','appendFileSync','unref','[Watchdog]\x20Error:\x20','length'];a0_0x5ddb=function(){return _0x15fe28;};return a0_0x5ddb();}function parseArgs(){const _0x5eb4db=a0_0x4726bb,_0x2e57fc=process['argv'][_0x5eb4db(0x132)](0x2),_0x5e0f10={'delay':0x1388,'command':_0x5eb4db(0x136),'pid':null};for(let _0x1fe79d=0x0;_0x1fe79d<_0x2e57fc[_0x5eb4db(0x155)];_0x1fe79d++){switch(_0x2e57fc[_0x1fe79d]){case _0x5eb4db(0x129):_0x5e0f10[_0x5eb4db(0x13f)]=parseInt(_0x2e57fc[++_0x1fe79d],0xa)||0x1388;break;case _0x5eb4db(0x14f):_0x5e0f10[_0x5eb4db(0x148)]=_0x2e57fc[++_0x1fe79d]||_0x5eb4db(0x136);break;case'--pid':_0x5e0f10[_0x5eb4db(0x157)]=parseInt(_0x2e57fc[++_0x1fe79d],0xa)||null;break;}}return _0x5e0f10;}function isProcessRunning(_0x34fd4e){const _0x291152=a0_0x4726bb;try{return process[_0x291152(0x12a)](_0x34fd4e,0x0),!![];}catch(_0x18106b){return![];}}async function waitForParentExit(_0x3bb953,_0x4c60a3=0x7530){const _0x170e03=a0_0x4726bb;if(!_0x3bb953)return;const _0xe0b8e9=Date['now']();while(isProcessRunning(_0x3bb953)){if(Date[_0x170e03(0x131)]()-_0xe0b8e9>_0x4c60a3){log('[Watchdog]\x20Parent\x20process\x20'+_0x3bb953+_0x170e03(0x14d)+_0x4c60a3+_0x170e03(0x150));return;}await new Promise(_0x4bd286=>setTimeout(_0x4bd286,0x1f4));}log('[Watchdog]\x20Parent\x20process\x20'+_0x3bb953+_0x170e03(0x135));}async function main(){const _0xefc322=a0_0x4726bb,_0x4f9970=parseArgs();log(_0xefc322(0x145),{'delay':_0x4f9970[_0xefc322(0x13f)],'command':_0x4f9970[_0xefc322(0x148)],'pid':_0x4f9970[_0xefc322(0x157)]});_0x4f9970[_0xefc322(0x157)]&&(log(_0xefc322(0x149)+_0x4f9970[_0xefc322(0x157)]+_0xefc322(0x138)),await waitForParentExit(_0x4f9970[_0xefc322(0x157)]));log(_0xefc322(0x14c)+_0x4f9970['delay']+_0xefc322(0x140)),await new Promise(_0x4b655a=>setTimeout(_0x4b655a,_0x4f9970[_0xefc322(0x13f)]));const _0x19e451=_0x4f9970[_0xefc322(0x148)][_0xefc322(0x144)]('\x20'),_0x13b74e=_0x19e451[0x0],_0x4bfe71=_0x19e451[_0xefc322(0x132)](0x1);log(_0xefc322(0x133)+_0x13b74e+'\x20'+_0x4bfe71[_0xefc322(0x13c)]('\x20'));const _0x48e141=process[_0xefc322(0x146)]===_0xefc322(0x12f),_0x2da422=spawn(_0x13b74e,_0x4bfe71,{'detached':!![],'stdio':_0xefc322(0x137),'shell':!![],'windowsHide':![]});_0x2da422[_0xefc322(0x153)](),log(_0xefc322(0x13d)+_0x2da422[_0xefc322(0x157)]),log(_0xefc322(0x141)),setTimeout(()=>process[_0xefc322(0x147)](0x0),0x3e8);}main()[a0_0x4726bb(0x13b)](_0x28813c=>{const _0x3510ff=a0_0x4726bb;log(_0x3510ff(0x154)+_0x28813c[_0x3510ff(0x143)]),process[_0x3510ff(0x147)](0x1);});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
const a0_0x5f1c78=a0_0x535f;(function(_0x32ac6a,_0x3e1496){const _0x1d2959=a0_0x535f,_0x486f62=_0x32ac6a();while(!![]){try{const _0x1af107=parseInt(_0x1d2959(0x21e))/0x1*(-parseInt(_0x1d2959(0x1e7))/0x2)+parseInt(_0x1d2959(0x21c))/0x3*(-parseInt(_0x1d2959(0x222))/0x4)+parseInt(_0x1d2959(0x1e1))/0x5+parseInt(_0x1d2959(0x224))/0x6*(-parseInt(_0x1d2959(0x1f7))/0x7)+-parseInt(_0x1d2959(0x201))/0x8*(parseInt(_0x1d2959(0x1f0))/0x9)+-parseInt(_0x1d2959(0x1e5))/0xa+parseInt(_0x1d2959(0x21d))/0xb*(parseInt(_0x1d2959(0x1fe))/0xc);if(_0x1af107===_0x3e1496)break;else _0x486f62['push'](_0x486f62['shift']());}catch(_0xbf95c4){_0x486f62['push'](_0x486f62['shift']());}}}(a0_0x37e9,0x9299d));import{STATIC_ANALYSIS}from'../utilities/constants.js';function a0_0x535f(_0x1d2926,_0x52d731){_0x1d2926=_0x1d2926-0x1e1;const _0x37e9a7=a0_0x37e9();let _0x535f1e=_0x37e9a7[_0x1d2926];if(a0_0x535f['OgeNBc']===undefined){var _0x4a1f4e=function(_0x3aa07f){const _0x533396='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1673dc='',_0x1d7c86='';for(let _0x546f13=0x0,_0x331c7c,_0x2d8fcb,_0x5d2658=0x0;_0x2d8fcb=_0x3aa07f['charAt'](_0x5d2658++);~_0x2d8fcb&&(_0x331c7c=_0x546f13%0x4?_0x331c7c*0x40+_0x2d8fcb:_0x2d8fcb,_0x546f13++%0x4)?_0x1673dc+=String['fromCharCode'](0xff&_0x331c7c>>(-0x2*_0x546f13&0x6)):0x0){_0x2d8fcb=_0x533396['indexOf'](_0x2d8fcb);}for(let _0x3ab269=0x0,_0x14caf2=_0x1673dc['length'];_0x3ab269<_0x14caf2;_0x3ab269++){_0x1d7c86+='%'+('00'+_0x1673dc['charCodeAt'](_0x3ab269)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1d7c86);};a0_0x535f['JuZFxL']=_0x4a1f4e,a0_0x535f['hSfKul']={},a0_0x535f['OgeNBc']=!![];}const _0x145885=_0x37e9a7[0x0],_0x2bc936=_0x1d2926+_0x145885,_0x32a1f0=a0_0x535f['hSfKul'][_0x2bc936];return!_0x32a1f0?(_0x535f1e=a0_0x535f['JuZFxL'](_0x535f1e),a0_0x535f['hSfKul'][_0x2bc936]=_0x535f1e):_0x535f1e=_0x32a1f0,_0x535f1e;}function a0_0x37e9(){const _0x50aa10=['q0furuDpuLK','z2v0u3vWCg9YDgvKrxH0zw5ZAw9UCW','zwXZzq','BgLUzq','CMv0DxjU','CM9VDa','zgvIDwC','Aw5JBhvKzq','mJfcCgXqvhO','ndK1C2DLzu5U','nJa5ntzmt3PMC0S','CMvZDwX0CW','Cg9ZDgnZC1nJC3m','y2f0zwDVCML6zvn0EwXLBgLUDfj1Bgu','nJa5nZy4C0TlD3P5','BM8TAw52ywXPza','ndu5odaXmef6whHHuW','u3r5BgvSAw50igfUywX5C2LZigzHAwXLza','rvjst1i','nteWotK5nxztDxrVva','Bg9Nz2vY','BgvUz3rO','CgX1z2LU','mtaWmJa1mgvbqvrUDG','y29SDw1U','mZj2ru9pvxC','Cg9ZDgnZCY1SzxnZ','C3vWCg9YDhnbDxrVrML4','zxjYB3i','C3LUDgf4','CMvJB21Tzw5Kzwq','BgvZCW','Cg9ZDgnZCW','DxnL','otm1mvLzvgjvDa','C2v2zxjPDhK','ChvZAa','BMCTzgvLCa','Dw5RBM93BG','zMLSDgvY','D2fYBG','n3nzqu9wrq','CNvSzq','zw5KC1DPDgG','y29UDgvUDa','Cg9ZDgnZC0XLC3m','lNnHC3m','ChjVy2vZCW','nJy0mtqWrxPcshrH','zgvMyxvSDa','zNvUy3rPB24','mJrWBungq1e','Bg93zxi','u0vwrvjjvfK','q1ntigfUywX5C2LZignVBxbSzxrLza','zM9YD2fYza','l15JDxn0B20TlW','lMXLC3m','C3r5BgvSAw50','zgv0zwn0tgfUz3vHz2u','C2nZCW','BMfTzq','u1rzteu','qKvtvf9quKfdveLdrq','Aw5JBhvKzxm','u1Lovefy','zM9Y','D2fYBMLUz3m','Dg9mB3DLCKnHC2u','zM9YBwf0ug9ZDentu0vYCM9Y'];a0_0x37e9=function(){return _0x50aa10;};return a0_0x37e9();}class CSSAnalyzer{constructor(_0x1673dc=null){const _0x2246e2=a0_0x535f;this[_0x2246e2(0x1e2)]=_0x1673dc,this[_0x2246e2(0x208)]=null,this['postcss']=null,this['postcssScss']=null,this[_0x2246e2(0x1fb)]=null;}async['analyze'](_0x1d7c86,_0x546f13,_0x331c7c={}){const _0x4f4012=a0_0x535f;try{const _0x2d8fcb=[],_0x5d2658=this[_0x4f4012(0x209)](_0x1d7c86),_0x3ab269=await this['checkSyntax'](_0x1d7c86,_0x546f13,_0x5d2658);_0x2d8fcb[_0x4f4012(0x1f2)](..._0x3ab269);if(_0x3ab269['length']===0x0){const _0x14caf2=await this['lintStyles'](_0x1d7c86,_0x546f13,_0x5d2658);_0x2d8fcb[_0x4f4012(0x1f2)](..._0x14caf2);}return this['logger']?.[_0x4f4012(0x21a)](_0x4f4012(0x204),{'file':_0x1d7c86,'language':_0x5d2658,'totalDiagnostics':_0x2d8fcb[_0x4f4012(0x1e3)],'errors':_0x2d8fcb[_0x4f4012(0x1f5)](_0x57b1b8=>_0x57b1b8['severity']===STATIC_ANALYSIS[_0x4f4012(0x203)][_0x4f4012(0x226)])['length'],'warnings':_0x2d8fcb['filter'](_0x192159=>_0x192159['severity']===STATIC_ANALYSIS['SEVERITY']['WARNING'])[_0x4f4012(0x1e3)]}),_0x2d8fcb;}catch(_0x42e656){return this[_0x4f4012(0x1e2)]?.[_0x4f4012(0x1ea)]('CSS\x20analysis\x20failed',{'file':_0x1d7c86,'error':_0x42e656['message']}),[];}}async['checkSyntax'](_0x1551c5,_0x1a3ccd,_0x9964d7){const _0x107144=a0_0x535f,_0x159ea9=[];try{if(!this['postcss']){const _0x1861b1=await import(_0x107144(0x1ee));this[_0x107144(0x1ee)]=_0x1861b1['default'];}let _0x1830ee=null;if(_0x9964d7==='scss'){if(!this['postcssScss']){const _0x442696=await import('postcss-scss');this[_0x107144(0x220)]=_0x442696['default'];}_0x1830ee=this[_0x107144(0x220)];}else{if(_0x9964d7===_0x107144(0x1ed)){if(!this['postcssLess']){const _0x541ea7=await import('postcss-less');this[_0x107144(0x1fb)]=_0x541ea7[_0x107144(0x1ff)];}_0x1830ee=this[_0x107144(0x1fb)];}}const _0xe53bdb=this['postcss']()[_0x107144(0x1fd)](_0x1a3ccd,{'from':_0x1551c5,'syntax':_0x1830ee}),_0x4f7ca5=_0xe53bdb[_0x107144(0x219)];this['logger']?.[_0x107144(0x21a)]('PostCSS\x20syntax\x20check\x20passed',{'file':_0x1551c5});}catch(_0x5350e8){const _0x11be4b=this[_0x107144(0x213)](_0x5350e8,_0x1551c5);_0x11be4b&&_0x159ea9[_0x107144(0x1f2)](_0x11be4b);}return _0x159ea9;}async['lintStyles'](_0x164ea5,_0x2600de,_0xf5c124){const _0x4e2319=a0_0x535f,_0x237c6e=[];try{if(!this['stylelint']){const _0x2f9804=await import(_0x4e2319(0x208));this[_0x4e2319(0x208)]=_0x2f9804[_0x4e2319(0x1ff)];}const _0x46a66b={'extends':['stylelint-config-standard'],'rules':{'color-no-invalid-hex':!![],'font-family-no-duplicate-names':!![],'function-calc-no-invalid':!![],'string-no-newline':!![],'unit-no-unknown':!![],'property-no-unknown':!![],'declaration-block-no-duplicate-properties':!![],'selector-pseudo-class-no-unknown':!![],'selector-pseudo-element-no-unknown':!![],'selector-type-no-unknown':[!![],{'ignoreTypes':[_0x4e2319(0x206),_0x4e2319(0x1f3)]}],'media-feature-name-no-unknown':!![],'at-rule-no-unknown':_0xf5c124===_0x4e2319(0x20a)?[!![],{'ignoreAtRules':['mixin',_0x4e2319(0x21b),'extend','if',_0x4e2319(0x216),_0x4e2319(0x210),'each','while',_0x4e2319(0x200),_0x4e2319(0x218),_0x4e2319(0x1fa),_0x4e2319(0x1ef),_0x4e2319(0x205)]}]:_0xf5c124==='less'?[!![],{'ignoreAtRules':[_0x4e2319(0x1e4)]}]:!![],'comment-no-empty':!![],'no-duplicate-selectors':!![],'no-empty-source':null,'block-no-empty':!![],'declaration-block-no-shorthand-property-overrides':!![],'font-family-no-missing-generic-family-keyword':!![],'function-linear-gradient-no-nonstandard-direction':!![],'no-descending-specificity':null,'no-duplicate-at-import-rules':!![],'no-extra-semicolons':!![],'no-invalid-double-slash-comments':!![],'selector-pseudo-element-colon-notation':'double','selector-type-case':_0x4e2319(0x202)},'customSyntax':_0xf5c124===_0x4e2319(0x20a)?'postcss-scss':_0xf5c124==='less'?_0x4e2319(0x1e8):undefined},_0x2ce12d=await this['stylelint']['lint']({'code':_0x2600de,'codeFilename':_0x164ea5,'config':_0x46a66b});if(_0x2ce12d[_0x4e2319(0x21f)]&&_0x2ce12d['results'][_0x4e2319(0x1e3)]>0x0){const _0xc52c2b=_0x2ce12d[_0x4e2319(0x21f)][0x0];if(_0xc52c2b['warnings'])for(const _0x38e79d of _0xc52c2b[_0x4e2319(0x211)]){_0x237c6e['push']({'file':_0x164ea5,'line':_0x38e79d[_0x4e2319(0x217)]||0x1,'column':_0x38e79d['column']||0x1,'severity':_0x38e79d[_0x4e2319(0x1f1)]===_0x4e2319(0x1ea)?STATIC_ANALYSIS[_0x4e2319(0x203)][_0x4e2319(0x226)]:STATIC_ANALYSIS['SEVERITY']['WARNING'],'rule':_0x38e79d[_0x4e2319(0x1f8)]||_0x4e2319(0x1f4),'message':_0x38e79d['text'],'category':this[_0x4e2319(0x221)](_0x38e79d['rule']),'fixable':![],'source':'stylelint'});}}}catch(_0x136182){this[_0x4e2319(0x1e2)]?.[_0x4e2319(0x1f6)](_0x4e2319(0x225),{'file':_0x164ea5,'error':_0x136182['message']});}return _0x237c6e;}['formatPostCSSError'](_0x495f03,_0x43748a){const _0x32b33e=a0_0x535f;return{'file':_0x43748a,'line':_0x495f03[_0x32b33e(0x217)]||0x1,'column':_0x495f03[_0x32b33e(0x1e6)]||0x1,'severity':STATIC_ANALYSIS[_0x32b33e(0x203)][_0x32b33e(0x226)],'rule':_0x495f03[_0x32b33e(0x20b)]||'CssSyntaxError','message':_0x495f03['reason']||_0x495f03['message'],'category':STATIC_ANALYSIS['CATEGORY']['SYNTAX'],'fixable':![],'source':_0x32b33e(0x1ee),'code':_0x495f03['source']||undefined};}['categorizeStylelintRule'](_0x36cfbb){const _0x42477c=a0_0x535f;if(!_0x36cfbb)return STATIC_ANALYSIS[_0x42477c(0x214)]['STYLE'];const _0x29ffb0=_0x36cfbb[_0x42477c(0x212)]();if(_0x29ffb0['includes'](_0x42477c(0x223))||_0x29ffb0['includes']('no-unknown')||_0x29ffb0[_0x42477c(0x20e)]('no-empty')||_0x29ffb0[_0x42477c(0x20e)](_0x42477c(0x1eb)))return STATIC_ANALYSIS[_0x42477c(0x214)][_0x42477c(0x20f)];if(_0x29ffb0[_0x42477c(0x20e)]('performance')||_0x29ffb0[_0x42477c(0x20e)]('optimize'))return STATIC_ANALYSIS[_0x42477c(0x214)]['PERFORMANCE'];if(_0x29ffb0[_0x42477c(0x20e)]('best-practice')||_0x29ffb0[_0x42477c(0x20e)](_0x42477c(0x1ec)))return STATIC_ANALYSIS['CATEGORY'][_0x42477c(0x20d)];return STATIC_ANALYSIS[_0x42477c(0x214)][_0x42477c(0x20c)];}[a0_0x5f1c78(0x209)](_0x3d1ee0){const _0x25e7a3=a0_0x5f1c78,_0x19a6a4=_0x3d1ee0[_0x25e7a3(0x212)]();if(_0x19a6a4['endsWith']('.scss')||_0x19a6a4[_0x25e7a3(0x1f9)](_0x25e7a3(0x1fc)))return'scss';if(_0x19a6a4[_0x25e7a3(0x1f9)]('.less'))return _0x25e7a3(0x1ed);return'css';}[a0_0x5f1c78(0x215)](){const _0x1b98c8=a0_0x5f1c78;return['.css','.scss',_0x1b98c8(0x1fc),_0x1b98c8(0x207)];}[a0_0x5f1c78(0x1e9)](){return![];}}export default CSSAnalyzer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x1187ab=a0_0x52d8;(function(_0x48e9b0,_0x5a2c16){const _0x70c799=a0_0x52d8,_0x3b1486=_0x48e9b0();while(!![]){try{const _0x5d4e32=parseInt(_0x70c799(0xd7))/0x1+-parseInt(_0x70c799(0xdd))/0x2*(-parseInt(_0x70c799(0xd1))/0x3)+parseInt(_0x70c799(0xa8))/0x4+parseInt(_0x70c799(0xbc))/0x5*(-parseInt(_0x70c799(0xa7))/0x6)+parseInt(_0x70c799(0xe3))/0x7*(parseInt(_0x70c799(0xf4))/0x8)+parseInt(_0x70c799(0xe2))/0x9+-parseInt(_0x70c799(0x86))/0xa*(parseInt(_0x70c799(0xd6))/0xb);if(_0x5d4e32===_0x5a2c16)break;else _0x3b1486['push'](_0x3b1486['shift']());}catch(_0x24998b){_0x3b1486['push'](_0x3b1486['shift']());}}}(a0_0x5e8e,0xbe9b1));import{exec}from'child_process';import{promisify}from'util';import a0_0x3732a6 from'path';import a0_0x39da58 from'fs/promises';import{STATIC_ANALYSIS}from'../utilities/constants.js';const execAsync=promisify(exec);class ConfigValidator{constructor(_0x3f021c=null){const _0x3715a4=a0_0x52d8;this['logger']=_0x3f021c,this[_0x3715a4(0xb1)]=null,this[_0x3715a4(0xea)]=new Map();}async['detectAvailableValidators'](){const _0x20a14f=a0_0x52d8;if(this['availableScanners']!==null)return this['availableScanners'];const _0x575006={'checkov':![],'hadolint':![],'yamllint':![],'jsonSchema':![]};try{await execAsync('checkov\x20--version',{'timeout':0x1388}),_0x575006['checkov']=!![],this['logger']?.['debug']('checkov\x20detected');}catch(_0x27bdaf){this['logger']?.['debug']('checkov\x20not\x20available',{'error':_0x27bdaf['message']});}try{await execAsync('hadolint\x20--version',{'timeout':0x1388}),_0x575006[_0x20a14f(0xd3)]=!![],this['logger']?.['debug']('hadolint\x20detected');}catch(_0x392fe2){this['logger']?.[_0x20a14f(0xb9)](_0x20a14f(0xb4),{'error':_0x392fe2[_0x20a14f(0x8b)]});}try{await execAsync('yamllint\x20--version',{'timeout':0x1388}),_0x575006['yamllint']=!![],this[_0x20a14f(0xe0)]?.['debug']('yamllint\x20detected');}catch(_0x52f755){this['logger']?.[_0x20a14f(0xb9)]('yamllint\x20not\x20available',{'error':_0x52f755[_0x20a14f(0x8b)]});}try{await import('ajv'),_0x575006['jsonSchema']=!![],this['logger']?.[_0x20a14f(0xb9)](_0x20a14f(0x8d));}catch(_0x27b79f){this['logger']?.[_0x20a14f(0xb9)]('ajv\x20not\x20available',{'error':_0x27b79f[_0x20a14f(0x8b)]});}return this['availableScanners']=_0x575006,_0x575006;}async[a0_0x1187ab(0x90)](_0xefa49a,_0x188efb={}){const _0x3f06b5=a0_0x1187ab,_0x426aa0=[],_0x3a9357=await this['detectAvailableValidators'](),_0x279ba0=this['detectFileType'](_0xefa49a);this['logger']?.[_0x3f06b5(0xb9)]('Validating\x20config\x20file',{'filePath':_0xefa49a,'fileType':_0x279ba0});switch(_0x279ba0){case'dockerfile':if(_0x3a9357['hadolint']){const _0x4567db=await this[_0x3f06b5(0x92)](_0xefa49a,_0x188efb);_0x426aa0[_0x3f06b5(0xdf)](..._0x4567db);}if(_0x3a9357[_0x3f06b5(0xce)]){const _0x26a753=await this[_0x3f06b5(0xde)](_0xefa49a,_0x3f06b5(0x9d),_0x188efb);_0x426aa0[_0x3f06b5(0xdf)](..._0x26a753);}break;case'docker-compose':if(_0x3a9357[_0x3f06b5(0xcc)]){const _0x2531c5=await this[_0x3f06b5(0xc5)](_0xefa49a,_0x188efb);_0x426aa0[_0x3f06b5(0xdf)](..._0x2531c5);}if(_0x3a9357[_0x3f06b5(0xce)]){const _0x4e92fa=await this['validateWithCheckov'](_0xefa49a,_0x3f06b5(0xdb),_0x188efb);_0x426aa0['push'](..._0x4e92fa);}break;case'kubernetes':if(_0x3a9357['yamllint']){const _0x2fc306=await this[_0x3f06b5(0xc5)](_0xefa49a,_0x188efb);_0x426aa0['push'](..._0x2fc306);}if(_0x3a9357[_0x3f06b5(0xce)]){const _0x171d08=await this['validateWithCheckov'](_0xefa49a,'kubernetes',_0x188efb);_0x426aa0[_0x3f06b5(0xdf)](..._0x171d08);}break;case'terraform':if(_0x3a9357['checkov']){const _0x20de65=await this[_0x3f06b5(0xde)](_0xefa49a,_0x3f06b5(0xef),_0x188efb);_0x426aa0[_0x3f06b5(0xdf)](..._0x20de65);}break;case _0x3f06b5(0xc0):if(_0x3a9357['jsonSchema']){const _0x509e97=await this['validatePackageJson'](_0xefa49a,_0x188efb);_0x426aa0[_0x3f06b5(0xdf)](..._0x509e97);}break;case _0x3f06b5(0xb6):if(_0x3a9357[_0x3f06b5(0xa9)]){const _0x1516a8=await this['validateTsConfig'](_0xefa49a,_0x188efb);_0x426aa0['push'](..._0x1516a8);}break;case'github-actions':if(_0x3a9357[_0x3f06b5(0xcc)]){const _0x285940=await this['validateYAML'](_0xefa49a,_0x188efb);_0x426aa0['push'](..._0x285940);}break;case _0x3f06b5(0xe9):const _0x4f8dff=await this[_0x3f06b5(0xc4)](_0xefa49a,_0x188efb);_0x426aa0['push'](..._0x4f8dff);break;case _0x3f06b5(0xb2):if(_0x3a9357['yamllint']){const _0x5ebe64=await this[_0x3f06b5(0xc5)](_0xefa49a,_0x188efb);_0x426aa0[_0x3f06b5(0xdf)](..._0x5ebe64);}break;default:this[_0x3f06b5(0xe0)]?.[_0x3f06b5(0xcd)](_0x3f06b5(0xd5),{'filePath':_0xefa49a,'fileType':_0x279ba0});return[];}return this[_0x3f06b5(0x80)](_0x426aa0);}async[a0_0x1187ab(0x92)](_0x2953da,_0x38c92c={}){const _0xe3e5d9=a0_0x1187ab;try{const _0x163ddb=await execAsync(_0xe3e5d9(0x95)+_0x2953da+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530}),_0x3a08f5=JSON[_0xe3e5d9(0xcf)](_0x163ddb['stdout']);return this[_0xe3e5d9(0xeb)](_0x3a08f5,_0x2953da);}catch(_0x3a3efb){if(_0x3a3efb['stdout'])try{const _0xcf6b58=JSON['parse'](_0x3a3efb[_0xe3e5d9(0xc7)]);return this['parseHadolintResults'](_0xcf6b58,_0x2953da);}catch(_0x3558fe){this['logger']?.[_0xe3e5d9(0xd4)](_0xe3e5d9(0x9e),{'error':_0x3558fe[_0xe3e5d9(0x8b)]});}return this['logger']?.['error']('hadolint\x20validation\x20failed',{'error':_0x3a3efb['message']}),[];}}['parseHadolintResults'](_0x23d9db,_0x115dc7){const _0x297291=a0_0x1187ab,_0x3ef4a1=[];if(Array['isArray'](_0x23d9db))for(const _0x49051b of _0x23d9db){_0x3ef4a1[_0x297291(0xdf)]({'file':_0x115dc7,'line':_0x49051b[_0x297291(0xd0)]||0x1,'column':_0x49051b[_0x297291(0xf5)]||0x1,'severity':this[_0x297291(0xed)](_0x49051b['level']),'rule':_0x49051b[_0x297291(0xb0)],'message':_0x49051b['message'],'category':'dockerfile','validator':'hadolint'});}return _0x3ef4a1;}async['validateYAML'](_0x7c01ba,_0x48559d={}){const _0x28d99c=a0_0x1187ab;try{const _0x50cf31=await execAsync(_0x28d99c(0xe7)+_0x7c01ba+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530});return this['parseYamllintResults'](_0x50cf31[_0x28d99c(0xc7)],_0x7c01ba);}catch(_0xc0321e){if(_0xc0321e['stdout'])return this[_0x28d99c(0xbd)](_0xc0321e['stdout'],_0x7c01ba);return this[_0x28d99c(0xe0)]?.[_0x28d99c(0xd4)]('yamllint\x20validation\x20failed',{'error':_0xc0321e['message']}),[];}}[a0_0x1187ab(0xbd)](_0x4d48da,_0x401dde){const _0x40a522=a0_0x1187ab,_0x10a90c=[],_0x1efc14=_0x4d48da['split']('\x0a')[_0x40a522(0xb8)](_0x2c7666=>_0x2c7666['trim']());for(const _0x5c589d of _0x1efc14){const _0xd24d79=_0x5c589d['match'](/^(.+?):(\d+):(\d+):\s*\[(\w+)\]\s*(.+?)\s*\((.+?)\)/);if(_0xd24d79){const [,_0x29c105,_0x4bef2d,_0x5f1311,_0x3e3d2c,_0x34c7e1,_0x54a59a]=_0xd24d79;_0x10a90c[_0x40a522(0xdf)]({'file':_0x401dde,'line':parseInt(_0x4bef2d,0xa),'column':parseInt(_0x5f1311,0xa),'severity':this[_0x40a522(0xc8)](_0x3e3d2c),'rule':_0x54a59a,'message':_0x34c7e1,'category':'yaml','validator':'yamllint'});}}return _0x10a90c;}async['validateWithCheckov'](_0xcf8f83,_0x3d9a2c,_0x3893b4={}){const _0x407c5b=a0_0x1187ab;try{const _0x34d2e1=await execAsync('checkov\x20-f\x20\x22'+_0xcf8f83+_0x407c5b(0x9f)+_0x3d9a2c+_0x407c5b(0xad),{'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x1e7576=JSON[_0x407c5b(0xcf)](_0x34d2e1[_0x407c5b(0xc7)]);return this[_0x407c5b(0xf2)](_0x1e7576,_0xcf8f83);}catch(_0x4b0b70){if(_0x4b0b70[_0x407c5b(0xc7)])try{const _0x1f1dd5=JSON['parse'](_0x4b0b70['stdout']);return this[_0x407c5b(0xf2)](_0x1f1dd5,_0xcf8f83);}catch(_0x210ce2){this[_0x407c5b(0xe0)]?.[_0x407c5b(0xd4)](_0x407c5b(0xc3),{'error':_0x210ce2[_0x407c5b(0x8b)]});}return this[_0x407c5b(0xe0)]?.[_0x407c5b(0xd4)]('checkov\x20validation\x20failed',{'error':_0x4b0b70['message']}),[];}}['parseCheckovResults'](_0xf95b36,_0x3eced0){const _0x1f670d=a0_0x1187ab,_0x4cdaf4=[];if(_0xf95b36[_0x1f670d(0x8a)]&&_0xf95b36[_0x1f670d(0x8a)]['failed_checks'])for(const _0x27b666 of _0xf95b36[_0x1f670d(0x8a)]['failed_checks']){_0x4cdaf4['push']({'file':_0x3eced0,'line':_0x27b666[_0x1f670d(0xa0)]?_0x27b666[_0x1f670d(0xa0)][0x0]:0x1,'column':0x1,'severity':this[_0x1f670d(0xa5)](_0x27b666[_0x1f670d(0xbb)]),'rule':_0x27b666['check_id'],'message':_0x27b666['check_name']||_0x27b666['check_id'],'category':'security','validator':'checkov','remediation':_0x27b666[_0x1f670d(0x99)],'cwe':_0x27b666['cwe'],'references':_0x27b666[_0x1f670d(0x99)]?[_0x27b666['guideline']]:[]});}return _0x4cdaf4;}async[a0_0x1187ab(0x88)](_0x2157a3,_0x5528ca={}){const _0x3f433d=a0_0x1187ab;try{const _0xbc2499=(await import(_0x3f433d(0xbf)))[_0x3f433d(0xdc)],_0x4b3728=(await import('ajv-formats'))['default'],_0x30bb50=await a0_0x39da58[_0x3f433d(0xd8)](_0x2157a3,'utf-8'),_0x2a9280=JSON[_0x3f433d(0xcf)](_0x30bb50),_0x370b6a=new _0xbc2499({'allErrors':!![],'strict':![]});_0x4b3728(_0x370b6a);const _0x19951c={'type':'object','required':[_0x3f433d(0xb7),_0x3f433d(0xe5)],'properties':{'name':{'type':_0x3f433d(0xf1),'pattern':_0x3f433d(0x8e)},'version':{'type':'string'},'description':{'type':_0x3f433d(0xf1)},'main':{'type':'string'},'type':{'type':_0x3f433d(0xf1),'enum':['module',_0x3f433d(0x87)]},'scripts':{'type':_0x3f433d(0xf3)},'dependencies':{'type':_0x3f433d(0xf3)},'devDependencies':{'type':'object'}},'additionalProperties':!![]},_0x46c38e=_0x370b6a[_0x3f433d(0xab)](_0x19951c),_0x1f4167=_0x46c38e(_0x2a9280);if(!_0x1f4167&&_0x46c38e[_0x3f433d(0xf8)])return _0x46c38e['errors']['map'](_0xb497f5=>({'file':_0x2157a3,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['ERROR'],'rule':'json-schema','message':_0xb497f5[_0x3f433d(0x91)]?_0xb497f5['instancePath']+'\x20'+_0xb497f5['message']:_0x3f433d(0x96)+_0xb497f5['params']['missingProperty']+'\x27','category':_0x3f433d(0x82),'validator':'json-schema'}));return[];}catch(_0x3f4a6f){return this['logger']?.[_0x3f433d(0xd4)]('package.json\x20validation\x20failed',{'error':_0x3f4a6f['message']}),[{'file':_0x2157a3,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x3f433d(0xaf)][_0x3f433d(0xa2)],'rule':'json-parse','message':_0x3f433d(0x89)+_0x3f4a6f['message'],'category':_0x3f433d(0x9a),'validator':'json-parse'}];}}async[a0_0x1187ab(0xda)](_0x53a48b,_0x5d1a91={}){const _0x1b5fbb=a0_0x1187ab;try{const _0x6db026=await a0_0x39da58[_0x1b5fbb(0xd8)](_0x53a48b,'utf-8'),_0x444649=JSON['parse'](_0x6db026),_0x518d3f=[];if(_0x444649[_0x1b5fbb(0xbe)]){const _0x4a1a4b=_0x444649['compilerOptions'];!_0x4a1a4b[_0x1b5fbb(0x8f)]&&_0x518d3f['push']({'file':_0x53a48b,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['WARNING'],'rule':'strict-mode','message':_0x1b5fbb(0xa4),'category':'best-practice','validator':'tsconfig-validator'}),_0x4a1a4b['noImplicitAny']===![]&&_0x518d3f['push']({'file':_0x53a48b,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['WARNING'],'rule':_0x1b5fbb(0xa3),'message':_0x1b5fbb(0xac),'category':'best-practice','validator':'tsconfig-validator'});}return _0x518d3f;}catch(_0x569604){return this['logger']?.['error']('tsconfig.json\x20validation\x20failed',{'error':_0x569604[_0x1b5fbb(0x8b)]}),[{'file':_0x53a48b,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x1b5fbb(0xaf)]['ERROR'],'rule':'json-parse','message':'Invalid\x20JSON:\x20'+_0x569604[_0x1b5fbb(0x8b)],'category':'syntax','validator':'json-parse'}];}}async['validateEnvFile'](_0x278a6c,_0x3a6f59={}){const _0x3b3695=a0_0x1187ab;try{const _0xb75caf=await a0_0x39da58[_0x3b3695(0xd8)](_0x278a6c,_0x3b3695(0x81)),_0x3f103b=[],_0x237622=_0xb75caf[_0x3b3695(0xcb)]('\x0a'),_0x45442f=[{'pattern':/password|passwd|pwd/i,'name':'password'},{'pattern':/api[_-]?key/i,'name':_0x3b3695(0xba)},{'pattern':/secret/i,'name':_0x3b3695(0x9b)},{'pattern':/token/i,'name':'token'},{'pattern':/private[_-]?key/i,'name':_0x3b3695(0xaa)},{'pattern':/aws[_-]?access/i,'name':'AWS\x20credentials'}];return _0x237622[_0x3b3695(0xa6)]((_0x54371e,_0x2d5b68)=>{const _0x2733a5=_0x3b3695,_0x2dad6c=_0x54371e[_0x2733a5(0xf0)]();if(!_0x2dad6c||_0x2dad6c['startsWith']('#'))return;if(_0x2dad6c['includes']('=')){const [_0x54b524,_0x3035a5]=_0x2dad6c['split']('='),_0x455f60=_0x54b524[_0x2733a5(0xe4)](),_0x1a49fb=_0x3035a5?.['trim']()||'',_0x43ef5c=_0x1a49fb&&_0x1a49fb!==''&&!_0x1a49fb['startsWith']('$')&&_0x1a49fb!=='your-key-here'&&_0x1a49fb!=='changeme'&&_0x1a49fb[_0x2733a5(0x83)]>0x5;if(_0x43ef5c)for(const {pattern:_0x3777ec,name:_0x4bcbec}of _0x45442f){if(_0x3777ec[_0x2733a5(0x84)](_0x455f60)){_0x3f103b[_0x2733a5(0xdf)]({'file':_0x278a6c,'line':_0x2d5b68+0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x2733a5(0xaf)]['CRITICAL'],'rule':'hardcoded-secret','message':'Potential\x20hardcoded\x20'+_0x4bcbec+'\x20detected\x20in\x20.env\x20file','category':_0x2733a5(0xee),'validator':_0x2733a5(0xd9),'remediation':_0x2733a5(0xf6)});break;}}}}),_0x3f103b;}catch(_0x150cc2){return this['logger']?.[_0x3b3695(0xd4)]('.env\x20validation\x20failed',{'error':_0x150cc2['message']}),[];}}['detectFileType'](_0x2af4af){const _0x1b3056=a0_0x1187ab,_0x3debe1=a0_0x3732a6[_0x1b3056(0xec)](_0x2af4af)[_0x1b3056(0xe4)](),_0x4ca145=a0_0x3732a6['dirname'](_0x2af4af);if(_0x3debe1==='dockerfile')return'dockerfile';if(_0x3debe1==='docker-compose.yml'||_0x3debe1==='docker-compose.yaml')return'docker-compose';if(_0x3debe1===_0x1b3056(0xc0))return _0x1b3056(0xc0);if(_0x3debe1==='tsconfig.json')return _0x1b3056(0xb6);if(_0x3debe1==='.env'||_0x3debe1['endsWith']('.env'))return'env';if(_0x4ca145[_0x1b3056(0x85)](_0x1b3056(0x93)))return _0x1b3056(0x9c);if(_0x4ca145['includes'](_0x1b3056(0xd2))||_0x4ca145[_0x1b3056(0x85)]('k8s'))return _0x1b3056(0xd2);const _0x54e62c=a0_0x3732a6[_0x1b3056(0xc1)](_0x2af4af)['toLowerCase']();if(_0x54e62c==='.tf'||_0x54e62c==='.tfvars')return'terraform';if(_0x54e62c==='.yml'||_0x54e62c==='.yaml')return _0x1b3056(0xb2);if(_0x54e62c===_0x1b3056(0xa1))return'json';return _0x1b3056(0xe6);}['normalizeResults'](_0x1b07a3){const _0x43c6fe=a0_0x1187ab;return _0x1b07a3[_0x43c6fe(0xe1)](_0x4ed47f=>({'file':_0x4ed47f[_0x43c6fe(0xb5)],'line':_0x4ed47f[_0x43c6fe(0xd0)]||0x1,'column':_0x4ed47f[_0x43c6fe(0xf5)]||0x1,'severity':_0x4ed47f['severity']||STATIC_ANALYSIS['SEVERITY']['WARNING'],'rule':_0x4ed47f['rule']||_0x43c6fe(0xe6),'message':_0x4ed47f[_0x43c6fe(0x8b)]||'Validation\x20issue\x20detected','category':_0x4ed47f[_0x43c6fe(0xc9)]||_0x43c6fe(0x82),'validator':_0x4ed47f['validator'],'cwe':_0x4ed47f['cwe']||null,'remediation':_0x4ed47f[_0x43c6fe(0xc6)]||null,'references':_0x4ed47f[_0x43c6fe(0x98)]||[]}));}['mapHadolintSeverity'](_0x402e5d){const _0x3b2543=a0_0x1187ab,_0x3d5a36={'error':STATIC_ANALYSIS[_0x3b2543(0xaf)]['ERROR'],'warning':STATIC_ANALYSIS['SEVERITY']['WARNING'],'info':STATIC_ANALYSIS[_0x3b2543(0xaf)]['INFO'],'style':STATIC_ANALYSIS[_0x3b2543(0xaf)][_0x3b2543(0x97)]};return _0x3d5a36[_0x402e5d?.['toLowerCase']()]||STATIC_ANALYSIS[_0x3b2543(0xaf)][_0x3b2543(0xae)];}['mapYamllintSeverity'](_0x1405f6){const _0x1178f7=a0_0x1187ab,_0x66a550={'error':STATIC_ANALYSIS[_0x1178f7(0xaf)]['ERROR'],'warning':STATIC_ANALYSIS[_0x1178f7(0xaf)][_0x1178f7(0xae)]};return _0x66a550[_0x1405f6?.[_0x1178f7(0xe4)]()]||STATIC_ANALYSIS['SEVERITY'][_0x1178f7(0xae)];}['mapCheckovSeverity'](_0x263cd8){const _0x220ccb=a0_0x1187ab;return STATIC_ANALYSIS['SEVERITY'][_0x220ccb(0xa2)];}async['getValidatorStatus'](){const _0x48a663=a0_0x1187ab,_0x5e6610=await this[_0x48a663(0xca)]();return{'validators':_0x5e6610,'recommendations':this['getInstallRecommendations'](_0x5e6610)};}['getInstallRecommendations'](_0x339e81){const _0x580e08=a0_0x1187ab,_0x291e9b=[];return!_0x339e81['checkov']&&_0x291e9b[_0x580e08(0xdf)]({'validator':_0x580e08(0xce),'reason':'Infrastructure\x20as\x20Code\x20security\x20scanning\x20(Docker,\x20Kubernetes,\x20Terraform)','install':'pip\x20install\x20checkov','priority':_0x580e08(0xb3)}),!_0x339e81['hadolint']&&_0x291e9b[_0x580e08(0xdf)]({'validator':_0x580e08(0xd3),'reason':'Dockerfile\x20linting\x20and\x20best\x20practices','install':'Download from https://github.com/hadolint/hadolint/releases','priority':'high'}),!_0x339e81['yamllint']&&_0x291e9b[_0x580e08(0xdf)]({'validator':'yamllint','reason':_0x580e08(0x8c),'install':'pip\x20install\x20yamllint','priority':_0x580e08(0xe8)}),!_0x339e81[_0x580e08(0xa9)]&&_0x291e9b['push']({'validator':_0x580e08(0xf7),'reason':_0x580e08(0xc2),'install':_0x580e08(0x94),'priority':_0x580e08(0xe8)}),_0x291e9b;}}function a0_0x52d8(_0xd7814d,_0x2a2425){_0xd7814d=_0xd7814d-0x80;const _0x5e8e2f=a0_0x5e8e();let _0x52d8ec=_0x5e8e2f[_0xd7814d];if(a0_0x52d8['YZcvRY']===undefined){var _0x2477ca=function(_0xa814fd){const _0xe00b48='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3732a6='',_0x39da58='';for(let _0x3f021c=0x0,_0x575006,_0x27bdaf,_0x392fe2=0x0;_0x27bdaf=_0xa814fd['charAt'](_0x392fe2++);~_0x27bdaf&&(_0x575006=_0x3f021c%0x4?_0x575006*0x40+_0x27bdaf:_0x27bdaf,_0x3f021c++%0x4)?_0x3732a6+=String['fromCharCode'](0xff&_0x575006>>(-0x2*_0x3f021c&0x6)):0x0){_0x27bdaf=_0xe00b48['indexOf'](_0x27bdaf);}for(let _0x52f755=0x0,_0x27b79f=_0x3732a6['length'];_0x52f755<_0x27b79f;_0x52f755++){_0x39da58+='%'+('00'+_0x3732a6['charCodeAt'](_0x52f755)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x39da58);};a0_0x52d8['wLpLtK']=_0x2477ca,a0_0x52d8['RRCAws']={},a0_0x52d8['YZcvRY']=!![];}const _0x338f9b=_0x5e8e2f[0x0],_0x5ea52b=_0xd7814d+_0x338f9b,_0x193649=a0_0x52d8['RRCAws'][_0x5ea52b];return!_0x193649?(_0x52d8ec=a0_0x52d8['wLpLtK'](_0x52d8ec),a0_0x52d8['RRCAws'][_0x5ea52b]=_0x52d8ec):_0x52d8ec=_0x193649,_0x52d8ec;}function a0_0x5e8e(){const _0x128a3a=['y2HLy2TFy2XHC3m','mZvvww5qCui','CgfYC2vzyw1SBgLUDfjLC3vSDhm','y29TCgLSzxjpChrPB25Z','ywP2','CgfJA2fNzs5QC29U','zxH0BMfTzq','sLnptIbJB25MAwD1CMf0Aw9UihzHBgLKyxrPB24','rMfPBgvKihrVihbHCNnLignOzwnRB3yGB3v0Chv0','DMfSAwrHDgvfBNzgAwXL','DMfSAwrHDgvzqu1m','CMvTzwrPyxrPB24','C3rKB3v0','BwfWwwfTBgXPBNrtzxzLCML0Eq','y2f0zwDVCNK','zgv0zwn0qxzHAwXHyMXLvMfSAwrHDg9YCW','C3bSAxq','EwfTBgXPBNq','D2fYBG','y2HLy2TVDG','CgfYC2u','BgLUzq','nJe4vhLUBwPM','A3vIzxjUzxrLCW','AgfKB2XPBNq','zxjYB3i','vw5RBM93BIbJB25MAwCGzMLSzsb0ExbL','mty4mZeYmJfKB3fhsuC','nZy1mZvfrNPVCNm','CMvHzezPBgu','zw52lxzHBgLKyxrVCG','DMfSAwrHDgvuC0nVBMzPzW','zg9JA2vYx2nVBxbVC2u','zgvMyxvSDa','nJa4ohretw1sEG','DMfSAwrHDgvxAxrOq2HLy2TVDG','ChvZAa','Bg9Nz2vY','BwfW','nZi0otuWy3DxEevO','mJe5otqWCg9Ut1bx','Dg9mB3DLCKnHC2u','DMvYC2LVBG','Dw5RBM93BG','EwfTBgXPBNqGlwyGCgfYC2fIBguGiG','BwvKAxvT','zw52','C2nHBM5LCKnHy2HL','CgfYC2viywrVBgLUDfjLC3vSDhm','yMfZzw5HBwu','BwfWsgfKB2XPBNrtzxzLCML0Eq','C2vJDxjPDhK','DgvYCMfMB3jT','DhjPBq','C3rYAw5N','CgfYC2vdAgvJA292uMvZDwX0CW','B2jQzwn0','odH4u1b2zKe','y29SDw1U','vxnLigvUDMLYB25Tzw50lxnWzwnPzMLJic5LBNyGzMLSzxmGyw5KigfKzcaUzw52ihrVic5NAxrPz25VCMu','ywP2icHku09oifnJAgvTysK','zxjYB3jZ','BM9YBwfSAxPLuMvZDwX0CW','DxrMltG','DMfSAwrHDgLVBG','BgvUz3rO','DgvZDa','Aw5JBhvKzxm','mtb2sLHpt2y','y29TBw9UANm','DMfSAwrHDgvqywnRywDLsNnVBG','sw52ywXPzcbku09ooIa','CMvZDwX0CW','BwvZC2fNzq','wufntcbMAwXLihzHBgLKyxrPB24','sLnptIbty2HLBweGDMfSAwrHDgLVBIbHDMfPBgfIBgu','xIG/oKbBys16mc05lx5Dw2eTEJaTos0Ux35DkI8Pp1THlxOWltKTFL1Bys16mc05ls5FFL0Qja','C3rYAwn0','DMfSAwrHDgu','Aw5ZDgfUy2vqyxrO','DMfSAwrHDgveB2nRzxjMAwXL','lMDPDgH1yI93B3jRzMXVD3m','BNbTigLUC3rHBgWGywP2igfQDI1MB3jTyxrZ','AgfKB2XPBNqGls1MB3jTyxqGANnVBIaI','BxvZDcbOyxzLihjLCxvPCMvKihbYB3bLCNr5icC','su5gtW','CMvMzxjLBMnLCW','z3vPzgvSAw5L','C3LUDgf4','C2vJCMv0','z2L0AhvIlwfJDgLVBNm','zg9JA2vYzMLSzq','rMfPBgvKihrVihbHCNnLigHHzg9SAw50ig91Dhb1Da','iIaTlwzYyw1LD29YAYa','zMLSzv9SAw5Lx3jHBMDL','lMPZB24','rvjst1i','BM8TAw1WBgLJAxqTyw55','q29UC2LKzxiGzw5HyMXPBMCGiNn0CMLJDciGBw9KzsbMB3iGyMv0DgvYihr5CguGC2fMzxr5','BwfWq2HLy2TVDLnLDMvYAxr5','zM9YrwfJAa','ndmXmJjhs2vtwg4','ndKYntq4oe13BgntsW','ANnVBLnJAgvTyq','ChjPDMf0zsbRzxK','y29TCgLSzq','rgLZywjSAw5Nig5Vsw1WBgLJAxrbBNKGCMvKDwnLCYb0ExbLihnHzMv0Eq','ic0TB3v0Chv0igPZB24Gls1JB21Wywn0','v0fstKLorW','u0vwrvjjvfK','y29Kzq','yxzHAwXHyMXLu2nHBM5LCNm','EwfTBa','AgLNAa','AgfKB2XPBNqGBM90igf2ywLSywjSzq','zMLSzq','DhnJB25MAwCUANnVBG','BMfTzq','zMLSDgvY','zgvIDwC','qvbjigTLEq'];a0_0x5e8e=function(){return _0x128a3a;};return a0_0x5e8e();}export default ConfigValidator;
|
|
1
|
+
const a0_0x111283=a0_0x8cd3;(function(_0x3c6d8a,_0x18c2db){const _0x13dbe8=a0_0x8cd3,_0x33e974=_0x3c6d8a();while(!![]){try{const _0x4d35b8=parseInt(_0x13dbe8(0x207))/0x1*(parseInt(_0x13dbe8(0x257))/0x2)+parseInt(_0x13dbe8(0x252))/0x3+parseInt(_0x13dbe8(0x25e))/0x4*(parseInt(_0x13dbe8(0x20c))/0x5)+-parseInt(_0x13dbe8(0x24b))/0x6+parseInt(_0x13dbe8(0x1ea))/0x7*(-parseInt(_0x13dbe8(0x1ee))/0x8)+-parseInt(_0x13dbe8(0x224))/0x9*(parseInt(_0x13dbe8(0x225))/0xa)+parseInt(_0x13dbe8(0x202))/0xb*(parseInt(_0x13dbe8(0x238))/0xc);if(_0x4d35b8===_0x18c2db)break;else _0x33e974['push'](_0x33e974['shift']());}catch(_0x41bc49){_0x33e974['push'](_0x33e974['shift']());}}}(a0_0x4411,0xf2534));import{exec}from'child_process';import{promisify}from'util';function a0_0x4411(){const _0x347a34=['y29TCgLSzq','su5gtW','y29Kzq','zgv0zwn0qxzHAwXHyMXLvMfSAwrHDg9YCW','ywP2','mJu1oduYouvMBwfHtq','y2HHBMDLBwu','rMfPBgvKihrVihbHCNnLigHHzg9SAw50ig91Dhb1Da','CgfYC2vdAgvJA292uMvZDwX0CW','sw52ywXPzcbku09ooIa','otC2odm4wNrIvLzY','u0vwrvjjvfK','CMvHzezPBgu','lNrMDMfYCW','zg9JA2vYlwnVBxbVC2u','CNvSzq','rg9JA2vYzMLSzsbSAw50Aw5NigfUzcbIzxn0ihbYywn0AwnLCW','ndruELPft3q','DhjPBq','C3rYAw5N','ChvZAa','ywP2ig5VDcbHDMfPBgfIBgu','Ew91CI1RzxKTAgvYzq','BM9YBwfSAxPLuMvZDwX0CW','DMfSAwrHDgu','lMvUDIb2ywXPzgf0Aw9UigzHAwXLza','B2jQzwn0','zMLSzv9SAw5Lx3jHBMDL','DgvYCMfMB3jT','A3vIzxjUzxrLCW','BwvZC2fNzq','zw52lxzHBgLKyxrVCG','Dw5RBM93BG','ntzNvwr3D1K','wufntcbMAwXLihzHBgLKyxrPB24','AZHZ','AgLNAa','nJmYmtC2uengCend','EwfTBa','AgfYzgnVzgvKlxnLy3jLDa','zgvIDwC','rgLZywjSAw5Nig5Vsw1WBgLJAxrbBNKGCMvKDwnLCYb0ExbLihnHzMv0Eq','CgfYC2u','lNLTBa','DMfSAwrHDgvfBNzgAwXL','y2f0zwDVCNK','Aw5JBhvKzxm','zgv0zwn0rMLSzvr5Cgu','sLnptIbJB25MAwD1CMf0Aw9UihzHBgLKyxrPB24','zxjYB3jZ','y2HLy2TVDG','zMfPBgvKx2nOzwnRCW','sw5MCMfZDhj1y3r1CMuGyxmGq29KzsbZzwn1CML0EsbZy2fUBMLUzYaOrg9JA2vYlcblDwjLCM5LDgvZlcbuzxjYywzVCM0P','zgvMyxvSDa','CgfYC2viywrVBgLUDfjLC3vSDhm','z2L0AhvIlwfJDgLVBNm','CgfJA2fNzs5QC29U','mZiZoda3BwX3Auj5','C2vJDxjPDhK','BwfWwwfTBgXPBNrtzxzLCML0Eq','y29SDw1U','C2nHBM5LCKnHy2HL','m01uq3HOra','Bg9Nz2vY','D2fYBG','ChjPDMf0zsbRzxK','BwLZC2LUz1bYB3bLCNr5','nZm3ndK1BhnPEeXR','DMfSAwrHDgvzqu1m','DxrMltG','BwfWq2HLy2TVDLnLDMvYAxr5','EwfTBgXPBNq','CMvMzxjLBMnLCW','lMDPDgH1yI93B3jRzMXVD3m','CgfZC3DVCMq','BwvKAxvT','ANnVBI1Zy2HLBwe','BwfWsgfKB2XPBNrtzxzLCML0Eq','EwfTBgXPBNqGzgv0zwn0zwq','DMfSAwrHDgvuC0nVBMzPzW','y3DL','AgfKB2XPBNq','y2HLy2TVDIbUB3qGyxzHAwXHyMXL','vxnLigvUDMLYB25Tzw50lxnWzwnPzMLJic5LBNyGzMLSzxmGyw5KigfKzcaUzw52ihrVic5NAxrPz25VCMu','BwfW','yxzHAwXHyMXLu2nHBM5LCNm','CgLWigLUC3rHBgWGEwfTBgXPBNq','EwfTBgXPBNqGDMfSAwrHDgLVBIbMywLSzwq','AxnbCNjHEq','CgfYC2vzyw1SBgLUDfjLC3vSDhm','DhnJB25MAwCUANnVBG','ote4wMDVww16','mty1ndeWtgjVCLLi','y2HLy2TVDIbKzxrLy3rLza','zxjYB3i','AgfKB2XPBNqGls12zxjZAw9U','C3rKB3v0','qvDtignYzwrLBNrPywXZ','lMvUDG','ywP2lwzVCM1HDhm','DMfSAwrHDgvxAxrOq2HLy2TVDG','rvjst1i','CMvZDwX0CW','zg9JA2vYlwnVBxbVC2uUEwfTBa','CMvTzwrPyxrPB24','vMfSAwrHDgLVBIbPC3n1zsbKzxrLy3rLza','zw52','DMfSAwrHDgLVBG','y2HLy2TFAwq','lMPZB24','z2v0vMfSAwrHDg9Yu3rHDhvZ','ndq0D2PrDxnP','v0fstKLorW','zMLSzq','Dg9mB3DLCKnHC2u','C3bSAxq','EwfTBgXPBNqGlwyGCgfYC2fIBguGiG','zg9JA2vYzMLSzq','z3vPzgvSAw5L','sLnptIbty2HLBweGDMfSAwrHDgLVBIbHDMfPBgfIBgu','igrLDgvJDgvKigLUic5LBNyGzMLSzq','Bw9KDwXL','q29UC2LKzxiGzw5HyMXPBMCGiNn0CMLJDciGBw9KzsbMB3iGyMv0DgvYihr5CguGC2fMzxr5','lNLHBwW','zw5KC1DPDgG','Bgv2zwW','ANnVBI1WyxjZzq','ANnVBLnJAgvTyq','AgfKB2XPBNqGls1MB3jTyxqGANnVBIaI','DhnJB25MAwCTDMfSAwrHDg9Y','mtaZmdCWmtzns0Lwyxa','AgfKB2XPBNqGDMfSAwrHDgLVBIbMywLSzwq'];a0_0x4411=function(){return _0x347a34;};return a0_0x4411();}import a0_0x160da0 from'path';import a0_0x300a1c from'fs/promises';import{STATIC_ANALYSIS}from'../utilities/constants.js';const execAsync=promisify(exec);class ConfigValidator{constructor(_0x1967e6=null){const _0x454e9c=a0_0x8cd3;this[_0x454e9c(0x208)]=_0x1967e6,this['availableScanners']=null,this[_0x454e9c(0x206)]=new Map();}async[a0_0x111283(0x250)](){const _0x22917a=a0_0x111283;if(this[_0x22917a(0x21e)]!==null)return this[_0x22917a(0x21e)];const _0xfb772d={'checkov':![],'hadolint':![],'yamllint':![],'jsonSchema':![]};try{await execAsync('checkov\x20--version',{'timeout':0x1388}),_0xfb772d['checkov']=!![],this[_0x22917a(0x208)]?.['debug'](_0x22917a(0x226));}catch(_0x4a55bc){this['logger']?.['debug'](_0x22917a(0x21b),{'error':_0x4a55bc[_0x22917a(0x1e7)]});}try{await execAsync(_0x22917a(0x228),{'timeout':0x1388}),_0xfb772d[_0x22917a(0x21a)]=!![],this[_0x22917a(0x208)]?.['debug']('hadolint\x20detected');}catch(_0xb555c){this[_0x22917a(0x208)]?.['debug']('hadolint\x20not\x20available',{'error':_0xb555c['message']});}try{await execAsync('yamllint\x20--version',{'timeout':0x1388}),_0xfb772d[_0x22917a(0x210)]=!![],this['logger']?.['debug'](_0x22917a(0x217));}catch(_0x43164f){this[_0x22917a(0x208)]?.['debug']('yamllint\x20not\x20available',{'error':_0x43164f['message']});}try{await import(_0x22917a(0x251)),_0xfb772d[_0x22917a(0x248)]=!![],this[_0x22917a(0x208)]?.[_0x22917a(0x1f1)](_0x22917a(0x240));}catch(_0xf8310e){this['logger']?.['debug'](_0x22917a(0x262),{'error':_0xf8310e['message']});}return this[_0x22917a(0x21e)]=_0xfb772d,_0xfb772d;}async[a0_0x111283(0x1e1)](_0x2f5733,_0x5cfbc0={}){const _0x23c4b1=a0_0x111283,_0x1e51e4=[],_0x5264f1=await this['detectAvailableValidators'](),_0x5c2e69=this[_0x23c4b1(0x1f8)](_0x2f5733);this[_0x23c4b1(0x208)]?.['debug']('Validating\x20config\x20file',{'filePath':_0x2f5733,'fileType':_0x5c2e69});switch(_0x5c2e69){case _0x23c4b1(0x23e):if(_0x5264f1['hadolint']){const _0x2f2c85=await this['validateDockerfile'](_0x2f5733,_0x5cfbc0);_0x1e51e4['push'](..._0x2f2c85);}if(_0x5264f1[_0x23c4b1(0x1fb)]){const _0x47491f=await this[_0x23c4b1(0x22d)](_0x2f5733,_0x23c4b1(0x23e),_0x5cfbc0);_0x1e51e4['push'](..._0x47491f);}break;case _0x23c4b1(0x25b):if(_0x5264f1['yamllint']){const _0x250e21=await this[_0x23c4b1(0x20d)](_0x2f5733,_0x5cfbc0);_0x1e51e4['push'](..._0x250e21);}if(_0x5264f1['checkov']){const _0x481fe5=await this[_0x23c4b1(0x22d)](_0x2f5733,'docker_compose',_0x5cfbc0);_0x1e51e4[_0x23c4b1(0x261)](..._0x481fe5);}break;case'kubernetes':if(_0x5264f1[_0x23c4b1(0x210)]){const _0x3d3b46=await this['validateYAML'](_0x2f5733,_0x5cfbc0);_0x1e51e4['push'](..._0x3d3b46);}if(_0x5264f1[_0x23c4b1(0x1fb)]){const _0xd4cab4=await this['validateWithCheckov'](_0x2f5733,'kubernetes',_0x5cfbc0);_0x1e51e4['push'](..._0xd4cab4);}break;case'terraform':if(_0x5264f1[_0x23c4b1(0x1fb)]){const _0x573003=await this['validateWithCheckov'](_0x2f5733,_0x23c4b1(0x1e5),_0x5cfbc0);_0x1e51e4[_0x23c4b1(0x261)](..._0x573003);}break;case _0x23c4b1(0x201):if(_0x5264f1[_0x23c4b1(0x248)]){const _0x53aa19=await this['validatePackageJson'](_0x2f5733,_0x5cfbc0);_0x1e51e4[_0x23c4b1(0x261)](..._0x53aa19);}break;case'tsconfig.json':if(_0x5264f1['jsonSchema']){const _0x4d03ba=await this[_0x23c4b1(0x218)](_0x2f5733,_0x5cfbc0);_0x1e51e4['push'](..._0x4d03ba);}break;case _0x23c4b1(0x200):if(_0x5264f1[_0x23c4b1(0x210)]){const _0x49d097=await this[_0x23c4b1(0x20d)](_0x2f5733,_0x5cfbc0);_0x1e51e4[_0x23c4b1(0x261)](..._0x49d097);}break;case'env':const _0x3dbda1=await this[_0x23c4b1(0x1f5)](_0x2f5733,_0x5cfbc0);_0x1e51e4[_0x23c4b1(0x261)](..._0x3dbda1);break;case _0x23c4b1(0x1ef):if(_0x5264f1['yamllint']){const _0x4d288b=await this['validateYAML'](_0x2f5733,_0x5cfbc0);_0x1e51e4['push'](..._0x4d288b);}break;default:this['logger']?.[_0x23c4b1(0x209)]('Unknown\x20config\x20file\x20type',{'filePath':_0x2f5733,'fileType':_0x5c2e69});return[];}return this['normalizeResults'](_0x1e51e4);}async['validateDockerfile'](_0xe7f73f,_0x20ffe2={}){const _0x46798b=a0_0x111283;try{const _0x5b879f=await execAsync(_0x46798b(0x249)+_0xe7f73f+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530}),_0x1af36d=JSON['parse'](_0x5b879f[_0x46798b(0x229)]);return this['parseHadolintResults'](_0x1af36d,_0xe7f73f);}catch(_0x22a6bc){if(_0x22a6bc[_0x46798b(0x229)])try{const _0x4deab4=JSON[_0x46798b(0x1f3)](_0x22a6bc[_0x46798b(0x229)]);return this[_0x46798b(0x1ff)](_0x4deab4,_0xe7f73f);}catch(_0x556b03){this[_0x46798b(0x208)]?.[_0x46798b(0x227)](_0x46798b(0x254),{'error':_0x556b03[_0x46798b(0x1e7)]});}return this[_0x46798b(0x208)]?.[_0x46798b(0x227)](_0x46798b(0x24c),{'error':_0x22a6bc[_0x46798b(0x1e7)]}),[];}}[a0_0x111283(0x1ff)](_0x30b47c,_0x4f45a1){const _0x2007f2=a0_0x111283,_0x2d07b8=[];if(Array[_0x2007f2(0x221)](_0x30b47c))for(const _0x341063 of _0x30b47c){_0x2d07b8[_0x2007f2(0x261)]({'file':_0x4f45a1,'line':_0x341063['line']||0x1,'column':_0x341063[_0x2007f2(0x205)]||0x1,'severity':this[_0x2007f2(0x216)](_0x341063[_0x2007f2(0x246)]),'rule':_0x341063[_0x2007f2(0x24f)],'message':_0x341063[_0x2007f2(0x1e7)],'category':'dockerfile','validator':'hadolint'});}return _0x2d07b8;}async[a0_0x111283(0x20d)](_0x59acea,_0x3c9d15={}){const _0x298f98=a0_0x111283;try{const _0x8339c7=await execAsync(_0x298f98(0x23d)+_0x59acea+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530});return this['parseYamllintResults'](_0x8339c7[_0x298f98(0x229)],_0x59acea);}catch(_0x7289b2){if(_0x7289b2['stdout'])return this['parseYamllintResults'](_0x7289b2['stdout'],_0x59acea);return this['logger']?.[_0x298f98(0x227)](_0x298f98(0x220),{'error':_0x7289b2[_0x298f98(0x1e7)]}),[];}}[a0_0x111283(0x222)](_0x2ea61f,_0x443857){const _0x572698=a0_0x111283,_0x10f71e=[],_0x46956c=_0x2ea61f[_0x572698(0x23c)]('\x0a')['filter'](_0x2adb47=>_0x2adb47[_0x572698(0x25f)]());for(const _0x17915e of _0x46956c){const _0x36577f=_0x17915e['match'](/^(.+?):(\d+):(\d+):\s*\[(\w+)\]\s*(.+?)\s*\((.+?)\)/);if(_0x36577f){const [,_0x196141,_0x3d516a,_0x39c281,_0x1f8fad,_0x5d72f1,_0x425193]=_0x36577f;_0x10f71e[_0x572698(0x261)]({'file':_0x443857,'line':parseInt(_0x3d516a,0xa),'column':parseInt(_0x39c281,0xa),'severity':this[_0x572698(0x204)](_0x1f8fad),'rule':_0x425193,'message':_0x5d72f1,'category':_0x572698(0x1ef),'validator':_0x572698(0x210)});}}return _0x10f71e;}async['validateWithCheckov'](_0x41d84d,_0x3df78c,_0x45cde6={}){const _0x7248b3=a0_0x111283;try{const _0x394c82=await execAsync('checkov\x20-f\x20\x22'+_0x41d84d+'\x22\x20--framework\x20'+_0x3df78c+'\x20--output\x20json\x20--compact',{'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x14a4cb=JSON[_0x7248b3(0x1f3)](_0x394c82[_0x7248b3(0x229)]);return this['parseCheckovResults'](_0x14a4cb,_0x41d84d);}catch(_0x27311){if(_0x27311[_0x7248b3(0x229)])try{const _0x5663c0=JSON[_0x7248b3(0x1f3)](_0x27311['stdout']);return this[_0x7248b3(0x255)](_0x5663c0,_0x41d84d);}catch(_0x5de0f0){this[_0x7248b3(0x208)]?.['error']('Failed\x20to\x20parse\x20checkov\x20output',{'error':_0x5de0f0[_0x7248b3(0x1e7)]});}return this['logger']?.[_0x7248b3(0x227)]('checkov\x20validation\x20failed',{'error':_0x27311[_0x7248b3(0x1e7)]}),[];}}['parseCheckovResults'](_0x4db91f,_0x2d8448){const _0x305bc2=a0_0x111283,_0xb3b293=[];if(_0x4db91f[_0x305bc2(0x22f)]&&_0x4db91f['results'][_0x305bc2(0x1fc)])for(const _0x448a40 of _0x4db91f['results']['failed_checks']){_0xb3b293[_0x305bc2(0x261)]({'file':_0x2d8448,'line':_0x448a40['file_line_range']?_0x448a40[_0x305bc2(0x1e4)][0x0]:0x1,'column':0x1,'severity':this[_0x305bc2(0x20f)](_0x448a40['check_class']),'rule':_0x448a40[_0x305bc2(0x235)],'message':_0x448a40['check_name']||_0x448a40['check_id'],'category':_0x305bc2(0x203),'validator':_0x305bc2(0x1fb),'remediation':_0x448a40[_0x305bc2(0x23f)],'cwe':_0x448a40[_0x305bc2(0x219)],'references':_0x448a40[_0x305bc2(0x23f)]?[_0x448a40[_0x305bc2(0x23f)]]:[]});}return _0xb3b293;}async['validatePackageJson'](_0x193d2b,_0x121e6e={}){const _0x4bb89f=a0_0x111283;try{const _0x5d3046=(await import('ajv'))['default'],_0xccfa9d=(await import(_0x4bb89f(0x22c)))[_0x4bb89f(0x1fe)],_0x288713=await a0_0x300a1c['readFile'](_0x193d2b,_0x4bb89f(0x20e)),_0x59a341=JSON['parse'](_0x288713),_0x4f4da6=new _0x5d3046({'allErrors':!![],'strict':![]});_0xccfa9d(_0x4f4da6);const _0x1e8cb2={'type':'object','required':['name','version'],'properties':{'name':{'type':_0x4bb89f(0x260),'pattern':'^(?:@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$'},'version':{'type':_0x4bb89f(0x260)},'description':{'type':'string'},'main':{'type':'string'},'type':{'type':_0x4bb89f(0x260),'enum':[_0x4bb89f(0x242),'commonjs']},'scripts':{'type':_0x4bb89f(0x1e3)},'dependencies':{'type':_0x4bb89f(0x1e3)},'devDependencies':{'type':_0x4bb89f(0x1e3)}},'additionalProperties':!![]},_0x1ed1eb=_0x4f4da6[_0x4bb89f(0x24d)](_0x1e8cb2),_0x39518a=_0x1ed1eb(_0x59a341);if(!_0x39518a&&_0x1ed1eb[_0x4bb89f(0x1fa)])return _0x1ed1eb['errors'][_0x4bb89f(0x21d)](_0x57b25d=>({'file':_0x193d2b,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY'][_0x4bb89f(0x22e)],'rule':_0x4bb89f(0x215),'message':_0x57b25d['instancePath']?_0x57b25d['instancePath']+'\x20'+_0x57b25d[_0x4bb89f(0x1e7)]:'must\x20have\x20required\x20property\x20\x27'+_0x57b25d['params'][_0x4bb89f(0x20b)]+'\x27','category':'validation','validator':_0x4bb89f(0x215)}));return[];}catch(_0x21c2a8){return this['logger']?.[_0x4bb89f(0x227)]('package.json\x20validation\x20failed',{'error':_0x21c2a8['message']}),[{'file':_0x193d2b,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x4bb89f(0x258)][_0x4bb89f(0x22e)],'rule':'json-parse','message':_0x4bb89f(0x256)+_0x21c2a8['message'],'category':'syntax','validator':_0x4bb89f(0x247)}];}}async[a0_0x111283(0x218)](_0xeb39f7,_0x45fd03={}){const _0x5286b1=a0_0x111283;try{const _0x5340d8=await a0_0x300a1c[_0x5286b1(0x259)](_0xeb39f7,_0x5286b1(0x20e)),_0x44e9c8=JSON[_0x5286b1(0x1f3)](_0x5340d8),_0x4a8508=[];if(_0x44e9c8['compilerOptions']){const _0x47f651=_0x44e9c8['compilerOptions'];!_0x47f651['strict']&&_0x4a8508[_0x5286b1(0x261)]({'file':_0xeb39f7,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x5286b1(0x258)][_0x5286b1(0x239)],'rule':'strict-mode','message':_0x5286b1(0x243),'category':'best-practice','validator':_0x5286b1(0x24a)}),_0x47f651['noImplicitAny']===![]&&_0x4a8508['push']({'file':_0xeb39f7,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY'][_0x5286b1(0x239)],'rule':'no-implicit-any','message':_0x5286b1(0x1f2),'category':'best-practice','validator':_0x5286b1(0x24a)});}return _0x4a8508;}catch(_0xaffcf1){return this['logger']?.['error']('tsconfig.json\x20validation\x20failed',{'error':_0xaffcf1['message']}),[{'file':_0xeb39f7,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['ERROR'],'rule':_0x5286b1(0x247),'message':_0x5286b1(0x256)+_0xaffcf1['message'],'category':'syntax','validator':_0x5286b1(0x247)}];}}async['validateEnvFile'](_0x522705,_0x5e2d26={}){const _0x345e79=a0_0x111283;try{const _0x5bc5c7=await a0_0x300a1c[_0x345e79(0x259)](_0x522705,_0x345e79(0x20e)),_0x3ebfd9=[],_0x5e6e11=_0x5bc5c7['split']('\x0a'),_0x5e740a=[{'pattern':/password|passwd|pwd/i,'name':_0x345e79(0x213)},{'pattern':/api[_-]?key/i,'name':'API\x20key'},{'pattern':/secret/i,'name':'secret'},{'pattern':/token/i,'name':'token'},{'pattern':/private[_-]?key/i,'name':_0x345e79(0x20a)},{'pattern':/aws[_-]?access/i,'name':_0x345e79(0x22a)}];return _0x5e6e11['forEach']((_0x198d41,_0x58ec4e)=>{const _0xeb92c8=_0x345e79,_0x1a2a07=_0x198d41['trim']();if(!_0x1a2a07||_0x1a2a07['startsWith']('#'))return;if(_0x1a2a07[_0xeb92c8(0x1f7)]('=')){const [_0x1f9884,_0x576c32]=_0x1a2a07[_0xeb92c8(0x23c)]('='),_0x290125=_0x1f9884['toLowerCase'](),_0x45afe6=_0x576c32?.[_0xeb92c8(0x25f)]()||'',_0x23ef0a=_0x45afe6&&_0x45afe6!==''&&!_0x45afe6['startsWith']('$')&&_0x45afe6!==_0xeb92c8(0x263)&&_0x45afe6!==_0xeb92c8(0x253)&&_0x45afe6['length']>0x5;if(_0x23ef0a)for(const {pattern:_0x34633c,name:_0x30e32d}of _0x5e740a){if(_0x34633c['test'](_0x290125)){_0x3ebfd9[_0xeb92c8(0x261)]({'file':_0x522705,'line':_0x58ec4e+0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0xeb92c8(0x258)]['CRITICAL'],'rule':_0xeb92c8(0x1f0),'message':'Potential\x20hardcoded\x20'+_0x30e32d+_0xeb92c8(0x241),'category':'security','validator':_0xeb92c8(0x1e8),'remediation':_0xeb92c8(0x21c)});break;}}}}),_0x3ebfd9;}catch(_0x2c35a6){return this['logger']?.[_0x345e79(0x227)](_0x345e79(0x1e2),{'error':_0x2c35a6[_0x345e79(0x1e7)]}),[];}}[a0_0x111283(0x1f8)](_0x52d979){const _0x2cff89=a0_0x111283,_0x268495=a0_0x160da0['basename'](_0x52d979)[_0x2cff89(0x23b)](),_0x26427d=a0_0x160da0['dirname'](_0x52d979);if(_0x268495==='dockerfile')return'dockerfile';if(_0x268495==='docker-compose.yml'||_0x268495===_0x2cff89(0x230))return'docker-compose';if(_0x268495===_0x2cff89(0x201))return'package.json';if(_0x268495===_0x2cff89(0x223))return'tsconfig.json';if(_0x268495===_0x2cff89(0x22b)||_0x268495[_0x2cff89(0x245)](_0x2cff89(0x22b)))return _0x2cff89(0x233);if(_0x26427d['includes'](_0x2cff89(0x212)))return'github-actions';if(_0x26427d['includes']('kubernetes')||_0x26427d['includes'](_0x2cff89(0x1ec)))return _0x2cff89(0x1e6);const _0x5bf8b7=a0_0x160da0['extname'](_0x52d979)['toLowerCase']();if(_0x5bf8b7==='.tf'||_0x5bf8b7===_0x2cff89(0x25a))return'terraform';if(_0x5bf8b7===_0x2cff89(0x1f4)||_0x5bf8b7===_0x2cff89(0x244))return'yaml';if(_0x5bf8b7===_0x2cff89(0x236))return'json';return _0x2cff89(0x1e9);}[a0_0x111283(0x1e0)](_0xe4a50c){const _0x3efcd8=a0_0x111283;return _0xe4a50c[_0x3efcd8(0x21d)](_0x27474b=>({'file':_0x27474b[_0x3efcd8(0x23a)],'line':_0x27474b['line']||0x1,'column':_0x27474b['column']||0x1,'severity':_0x27474b['severity']||STATIC_ANALYSIS[_0x3efcd8(0x258)]['WARNING'],'rule':_0x27474b[_0x3efcd8(0x25c)]||'unknown','message':_0x27474b['message']||_0x3efcd8(0x232),'category':_0x27474b[_0x3efcd8(0x1f6)]||_0x3efcd8(0x234),'validator':_0x27474b['validator'],'cwe':_0x27474b[_0x3efcd8(0x219)]||null,'remediation':_0x27474b[_0x3efcd8(0x231)]||null,'references':_0x27474b[_0x3efcd8(0x211)]||[]}));}[a0_0x111283(0x216)](_0x3cd40a){const _0x52bf16=a0_0x111283,_0x1c6ec8={'error':STATIC_ANALYSIS['SEVERITY'][_0x52bf16(0x22e)],'warning':STATIC_ANALYSIS['SEVERITY']['WARNING'],'info':STATIC_ANALYSIS[_0x52bf16(0x258)][_0x52bf16(0x24e)],'style':STATIC_ANALYSIS[_0x52bf16(0x258)][_0x52bf16(0x24e)]};return _0x1c6ec8[_0x3cd40a?.[_0x52bf16(0x23b)]()]||STATIC_ANALYSIS[_0x52bf16(0x258)][_0x52bf16(0x239)];}[a0_0x111283(0x204)](_0xf497e){const _0x1db49f=a0_0x111283,_0x1d045d={'error':STATIC_ANALYSIS[_0x1db49f(0x258)][_0x1db49f(0x22e)],'warning':STATIC_ANALYSIS[_0x1db49f(0x258)]['WARNING']};return _0x1d045d[_0xf497e?.['toLowerCase']()]||STATIC_ANALYSIS[_0x1db49f(0x258)]['WARNING'];}[a0_0x111283(0x20f)](_0x22dba7){const _0x3ebb86=a0_0x111283;return STATIC_ANALYSIS[_0x3ebb86(0x258)][_0x3ebb86(0x22e)];}async[a0_0x111283(0x237)](){const _0x356144=await this['detectAvailableValidators']();return{'validators':_0x356144,'recommendations':this['getInstallRecommendations'](_0x356144)};}['getInstallRecommendations'](_0x204318){const _0x5a50ed=a0_0x111283,_0x271a1e=[];return!_0x204318['checkov']&&_0x271a1e[_0x5a50ed(0x261)]({'validator':_0x5a50ed(0x1fb),'reason':_0x5a50ed(0x1fd),'install':'pip\x20install\x20checkov','priority':_0x5a50ed(0x1ed)}),!_0x204318[_0x5a50ed(0x21a)]&&_0x271a1e[_0x5a50ed(0x261)]({'validator':'hadolint','reason':_0x5a50ed(0x25d),'install':'Download from https://github.com/hadolint/hadolint/releases','priority':'high'}),!_0x204318[_0x5a50ed(0x210)]&&_0x271a1e[_0x5a50ed(0x261)]({'validator':'yamllint','reason':_0x5a50ed(0x1eb),'install':_0x5a50ed(0x21f),'priority':_0x5a50ed(0x214)}),!_0x204318['jsonSchema']&&_0x271a1e[_0x5a50ed(0x261)]({'validator':'ajv\x20(JSON\x20Schema)','reason':_0x5a50ed(0x1f9),'install':'npm\x20install\x20ajv\x20ajv-formats','priority':_0x5a50ed(0x214)}),_0x271a1e;}}function a0_0x8cd3(_0x3e89c2,_0x5dcbfe){_0x3e89c2=_0x3e89c2-0x1e0;const _0x4411d4=a0_0x4411();let _0x8cd3b6=_0x4411d4[_0x3e89c2];if(a0_0x8cd3['ZzzvAj']===undefined){var _0x5233c3=function(_0x3d5dd2){const _0x170b96='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x160da0='',_0x300a1c='';for(let _0x1967e6=0x0,_0xfb772d,_0x4a55bc,_0xb555c=0x0;_0x4a55bc=_0x3d5dd2['charAt'](_0xb555c++);~_0x4a55bc&&(_0xfb772d=_0x1967e6%0x4?_0xfb772d*0x40+_0x4a55bc:_0x4a55bc,_0x1967e6++%0x4)?_0x160da0+=String['fromCharCode'](0xff&_0xfb772d>>(-0x2*_0x1967e6&0x6)):0x0){_0x4a55bc=_0x170b96['indexOf'](_0x4a55bc);}for(let _0x43164f=0x0,_0xf8310e=_0x160da0['length'];_0x43164f<_0xf8310e;_0x43164f++){_0x300a1c+='%'+('00'+_0x160da0['charCodeAt'](_0x43164f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x300a1c);};a0_0x8cd3['wgREgu']=_0x5233c3,a0_0x8cd3['EOlaon']={},a0_0x8cd3['ZzzvAj']=!![];}const _0x20d0e4=_0x4411d4[0x0],_0x207685=_0x3e89c2+_0x20d0e4,_0xa03b6c=a0_0x8cd3['EOlaon'][_0x207685];return!_0xa03b6c?(_0x8cd3b6=a0_0x8cd3['wgREgu'](_0x8cd3b6),a0_0x8cd3['EOlaon'][_0x207685]=_0x8cd3b6):_0x8cd3b6=_0xa03b6c,_0x8cd3b6;}export default ConfigValidator;
|