@loxia-labs/loxia-autopilot-one 1.0.17 → 1.0.19
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 +5 -3
- 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/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/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/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/errorHandler.js +1 -1
- package/src/services/fileAttachmentService.js +1 -1
- package/src/services/modelRouterService.js +1 -1
- package/src/services/modelsService.js +1 -1
- package/src/services/qualityInspector.js +1 -1
- package/src/services/tokenCountingService.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/fileContentReplaceTool.js +1 -1
- package/src/tools/fileSystemTool.js +1 -1
- package/src/tools/fileTreeTool.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/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/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/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/logger.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/web-ui/build/index.html +2 -2
- package/web-ui/build/static/index-Cb8CHAFw.css +1 -0
- package/web-ui/build/static/{index-DzOU48ux.js → index-CcwO7jS4.js} +72 -72
- package/web-ui/build/static/index-CRkOpV4k.css +0 -1
package/README.md
CHANGED
|
@@ -99,7 +99,7 @@ npm install -g @loxia-labs/loxia-autopilot-one
|
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
loxia --version
|
|
102
|
-
# Should display: Loxia Autopilot One v1.0.
|
|
102
|
+
# Should display: Loxia Autopilot One v1.0.19
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
### 4. Create an API Key
|
|
@@ -369,17 +369,19 @@ Loxia automatically compacts long conversations to stay within token limits:
|
|
|
369
369
|
|
|
370
370
|
## 🛣️ Roadmap
|
|
371
371
|
|
|
372
|
-
### Current Version (1.0.
|
|
372
|
+
### Current Version (1.0.19)
|
|
373
373
|
|
|
374
374
|
- ✅ Multi-agent orchestration
|
|
375
375
|
- ✅ 18+ specialized tools
|
|
376
376
|
- ✅ Web UI + CLI interfaces
|
|
377
|
-
- ✅ Conversation compaction
|
|
377
|
+
- ✅ Conversation compaction with round-robin model selection
|
|
378
378
|
- ✅ File attachments
|
|
379
379
|
- ✅ Task management
|
|
380
380
|
- ✅ Centralized agent activity service
|
|
381
381
|
- ✅ Intelligent loop detection
|
|
382
382
|
- ✅ Persistent user data across npm updates
|
|
383
|
+
- ✅ Version status display with update notifications
|
|
384
|
+
- ✅ Automatic token limit error recovery
|
|
383
385
|
|
|
384
386
|
### Upcoming Features
|
|
385
387
|
|
package/bin/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const a0_0x1264ea=a0_0x466a;(function(_0x26470b,_0x575efe){const _0x439675=a0_0x466a,_0x3f3c0d=_0x26470b();while(!![]){try{const _0x2a51ab=parseInt(_0x439675(0x208))/0x1*(-parseInt(_0x439675(0x217))/0x2)+parseInt(_0x439675(0x1d8))/0x3+-parseInt(_0x439675(0x210))/0x4+-parseInt(_0x439675(0x1e6))/0x5+parseInt(_0x439675(0x1f6))/0x6*(-parseInt(_0x439675(0x1e1))/0x7)+parseInt(_0x439675(0x21e))/0x8*(parseInt(_0x439675(0x1e0))/0x9)+-parseInt(_0x439675(0x1d9))/0xa*(-parseInt(_0x439675(0x1ff))/0xb);if(_0x2a51ab===_0x575efe)break;else _0x3f3c0d['push'](_0x3f3c0d['shift']());}catch(_0x49d353){_0x3f3c0d['push'](_0x3f3c0d['shift']());}}}(a0_0x3438,0x25699));import{fileURLToPath}from'url';import{dirname,join}from'path';function a0_0x466a(_0x5dcd0f,_0x4a41f3){_0x5dcd0f=_0x5dcd0f-0x1d4;const _0x343854=a0_0x3438();let _0x466a5b=_0x343854[_0x5dcd0f];return _0x466a5b;}import{spawn,exec}from'child_process';import{readFileSync}from'fs';import a0_0x303651 from'http';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),DEFAULT_PORT=0x1f90,DEFAULT_HOST=a0_0x1264ea(0x202),SERVER_STARTUP_TIMEOUT=0x3a98,SERVER_CHECK_INTERVAL=0x1f4,args=process[a0_0x1264ea(0x1e9)][a0_0x1264ea(0x1ea)](0x2),command=args[0x0]&&!args[0x0][a0_0x1264ea(0x1e3)]('--')?args[0x0]:null,flags={'port':null,'host':null,'help':args['includes']('--help')||args[a0_0x1264ea(0x1f4)]('-h'),'version':args['includes'](a0_0x1264ea(0x1e8))||args[a0_0x1264ea(0x1f4)]('-v')};for(let i=0x0;i<args[a0_0x1264ea(0x21d)];i++){args[i]==='--port'&&args[i+0x1]&&(flags[a0_0x1264ea(0x218)]=parseInt(args[i+0x1],0xa)),args[i]===a0_0x1264ea(0x212)&&args[i+0x1]&&(flags['host']=args[i+0x1]);}const port=flags[a0_0x1264ea(0x218)]||DEFAULT_PORT,host=flags[a0_0x1264ea(0x1dd)]||DEFAULT_HOST,serverUrl=a0_0x1264ea(0x1fd)+host+':'+port;if(flags[a0_0x1264ea(0x1eb)]){const pkgPath=join(__dirname,'..',a0_0x1264ea(0x1f0)),pkg=JSON[a0_0x1264ea(0x1ee)](readFileSync(pkgPath,a0_0x1264ea(0x207)));console['log'](a0_0x1264ea(0x1e5)+pkg['version']),process[a0_0x1264ea(0x20c)](0x0);}if(flags[a0_0x1264ea(0x209)]||!command){const pkgPath=join(__dirname,'..',a0_0x1264ea(0x1f0)),pkg=JSON[a0_0x1264ea(0x1ee)](readFileSync(pkgPath,a0_0x1264ea(0x207)));console[a0_0x1264ea(0x1fc)](a0_0x1264ea(0x20b)+pkg[a0_0x1264ea(0x1eb)]+a0_0x1264ea(0x20f)+DEFAULT_PORT+a0_0x1264ea(0x1d7)+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\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\x20custom\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\x0aDocumentation:\x0a\x20\x20https://autopilot.loxia.ai\x0a\x0a'),process['exit'](0x0);}async function checkServerRunning(_0x2a6be6,_0x1b6b4e,_0x13f196=0x1){for(let _0x35d41c=0x0;_0x35d41c<_0x13f196;_0x35d41c++){const _0x5134c9=await new Promise(_0x47984e=>{const _0xa9ace3=a0_0x466a,_0x260f61=a0_0x303651[_0xa9ace3(0x20a)](_0xa9ace3(0x1fd)+_0x2a6be6+':'+_0x1b6b4e+_0xa9ace3(0x1f7),_0x360f45=>{_0x47984e(_0x360f45['statusCode']===0xc8);});_0x260f61['on'](_0xa9ace3(0x1f8),()=>_0x47984e(![])),_0x260f61['setTimeout'](0x7d0,()=>{const _0x35a148=_0xa9ace3;_0x260f61[_0x35a148(0x20d)](),_0x47984e(![]);});});if(_0x5134c9)return!![];_0x35d41c<_0x13f196-0x1&&await new Promise(_0x5b65ff=>setTimeout(_0x5b65ff,SERVER_CHECK_INTERVAL));}return![];}function a0_0x3438(){const _0x28b245=['SIGTERM','node','\x0aServer\x20failed\x20to\x20start.\x20Please\x20check\x20logs.','ceil','length','8FgtwKh','src','Starting\x20Loxia\x20server...\x0a','SIGINT','catch',')\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20Specify\x20host\x20(default:\x20','680961nOEPra','25690DnYcrl','web','start\x20\x22\x22\x20\x22','Waiting\x20for\x20server\x20to\x20start...','host','index.js','\x20manually.','2176326tRKhDs','2912WZqJhg','kill','startsWith','win32','Loxia\x20Autopilot\x20One\x20v','408400DDCIdR','ignore','--version','argv','slice','version','loxia-terminal.js','\x0aServer\x20may\x20still\x20be\x20starting.\x20Open\x20','parse','env','package.json','Run\x20\x22loxia\x20--help\x22\x20for\x20usage\x20information.','Starting\x20Terminal\x20UI...\x0a','platform','includes','LOXIA_HOST','3072kHhLFl','/api/health','error','open\x20\x22','\x0aPlease\x20start\x20the\x20server\x20first:','inherit','log','http://','toString','1320KSOJBb','\x20\x20loxia\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20Web\x20UI','Could\x20not\x20open\x20browser\x20automatically.','localhost','unref','\x0aServer\x20is\x20not\x20running\x20at\x20','Checking\x20if\x20server\x20is\x20running...','\x0aShutting\x20down\x20server...','utf8','2861vbciLJ','help','get','\x0aLoxia\x20Autopilot\x20One\x20v','exit','destroy','Server\x20running\x20at\x20','\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\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:\x20','366820RlpDYm','\x20\x20loxia\x20plus-terminal\x20\x20#\x20Start\x20server\x20+\x20Terminal\x20UI\x0a','--host','Please\x20open\x20manually:\x20','xdg-open\x20\x22','\x0aOpening\x20Web\x20UI\x20at\x20','Error:','166aMLWdZ','port'];a0_0x3438=function(){return _0x28b245;};return a0_0x3438();}async function waitForServer(_0x1205d8,_0xeeea4f,_0x4ba9c6=SERVER_STARTUP_TIMEOUT){const _0x23f347=a0_0x1264ea,_0x37bfcd=Math[_0x23f347(0x21c)](_0x4ba9c6/SERVER_CHECK_INTERVAL);return checkServerRunning(_0x1205d8,_0xeeea4f,_0x37bfcd);}function openBrowser(_0x5c2145){const _0x282a3c=a0_0x1264ea,_0x4309e5=process[_0x282a3c(0x1f3)];let _0x292c17;if(_0x4309e5==='darwin')_0x292c17=_0x282a3c(0x1f9)+_0x5c2145+'\x22';else _0x4309e5===_0x282a3c(0x1e4)?_0x292c17=_0x282a3c(0x1db)+_0x5c2145+'\x22':_0x292c17=_0x282a3c(0x214)+_0x5c2145+'\x22';exec(_0x292c17,_0x39d90a=>{const _0xd494c2=_0x282a3c;_0x39d90a&&(console[_0xd494c2(0x1fc)](_0xd494c2(0x201)),console['log'](_0xd494c2(0x213)+_0x5c2145));});}function startServer(_0x3ceb98=![]){const _0x205302=a0_0x1264ea,_0x44092b={...process[_0x205302(0x1ef)],'LOXIA_PORT':port[_0x205302(0x1fe)](),'PORT':port[_0x205302(0x1fe)]()};flags['host']&&(_0x44092b[_0x205302(0x1f5)]=flags[_0x205302(0x1dd)]);const _0x3fa527=join(__dirname,'..',_0x205302(0x21f),_0x205302(0x1de)),_0x4dc5aa=spawn(_0x205302(0x21a),[_0x3fa527],{'cwd':join(__dirname,'..'),'env':_0x44092b,'stdio':_0x3ceb98?[_0x205302(0x1e7),_0x205302(0x1e7),_0x205302(0x1e7)]:_0x205302(0x1fb),'detached':_0x3ceb98});return _0x3ceb98&&_0x4dc5aa[_0x205302(0x203)](),_0x4dc5aa;}function startTerminalUI(){const _0x20aa23=a0_0x1264ea,_0x2df044=join(__dirname,_0x20aa23(0x1ec)),_0x49b3bc={...process[_0x20aa23(0x1ef)],'LOXIA_PORT':port[_0x20aa23(0x1fe)](),'LOXIA_HOST':host},_0x752a0b=spawn(_0x20aa23(0x21a),[_0x2df044],{'cwd':join(__dirname,'..'),'env':_0x49b3bc,'stdio':_0x20aa23(0x1fb)});return _0x752a0b;}const commands={'web':async()=>{const _0x47d70d=a0_0x1264ea;console[_0x47d70d(0x1fc)](_0x47d70d(0x1d4));const _0xb81fd2=startServer(![]);console[_0x47d70d(0x1fc)](_0x47d70d(0x1dc));const _0x312aa3=await waitForServer(host,port);_0x312aa3?(console[_0x47d70d(0x1fc)](_0x47d70d(0x215)+serverUrl),openBrowser(serverUrl)):console[_0x47d70d(0x1fc)](_0x47d70d(0x1ed)+serverUrl+_0x47d70d(0x1df)),process['on']('SIGINT',()=>_0xb81fd2[_0x47d70d(0x1e2)](_0x47d70d(0x1d5))),process['on'](_0x47d70d(0x219),()=>_0xb81fd2[_0x47d70d(0x1e2)](_0x47d70d(0x219))),_0xb81fd2['on'](_0x47d70d(0x20c),_0x64f269=>process[_0x47d70d(0x20c)](_0x64f269||0x0));},'plus-web':async()=>{const _0x19796c=a0_0x1264ea;await commands[_0x19796c(0x1da)]();},'terminal':async()=>{const _0x155c75=a0_0x1264ea;console['log'](_0x155c75(0x205));const _0x81a185=await checkServerRunning(host,port);!_0x81a185&&(console[_0x155c75(0x1f8)](_0x155c75(0x204)+serverUrl),console[_0x155c75(0x1f8)](_0x155c75(0x1fa)),console[_0x155c75(0x1f8)](_0x155c75(0x200)),console[_0x155c75(0x1f8)](_0x155c75(0x211)),process[_0x155c75(0x20c)](0x1));console[_0x155c75(0x1fc)]('Server\x20is\x20running\x20at\x20'+serverUrl),console[_0x155c75(0x1fc)](_0x155c75(0x1f2));const _0x3d1266=startTerminalUI();process['on'](_0x155c75(0x1d5),()=>_0x3d1266[_0x155c75(0x1e2)](_0x155c75(0x1d5))),process['on'](_0x155c75(0x219),()=>_0x3d1266[_0x155c75(0x1e2)](_0x155c75(0x219))),_0x3d1266['on'](_0x155c75(0x20c),_0x2d0f5e=>process[_0x155c75(0x20c)](_0x2d0f5e||0x0));},'plus-terminal':async()=>{const _0x1ab78e=a0_0x1264ea;console[_0x1ab78e(0x1fc)]('Starting\x20Loxia\x20server\x20in\x20background...');const _0x557d94=startServer(!![]),_0x21b058=await waitForServer(host,port);!_0x21b058&&(console[_0x1ab78e(0x1f8)](_0x1ab78e(0x21b)),process[_0x1ab78e(0x20c)](0x1));console['log'](_0x1ab78e(0x20e)+serverUrl),console[_0x1ab78e(0x1fc)](_0x1ab78e(0x1f2));const _0xf1efe0=startTerminalUI();_0xf1efe0['on'](_0x1ab78e(0x20c),_0x48ca3d=>{const _0x4b6343=_0x1ab78e;console[_0x4b6343(0x1fc)](_0x4b6343(0x206));try{process[_0x4b6343(0x1e2)](_0x557d94['pid'],'SIGTERM');}catch(_0x410b12){}process['exit'](_0x48ca3d||0x0);}),process['on'](_0x1ab78e(0x1d5),()=>{const _0x174814=_0x1ab78e;_0xf1efe0[_0x174814(0x1e2)](_0x174814(0x1d5));}),process['on'](_0x1ab78e(0x219),()=>{const _0x11c864=_0x1ab78e;_0xf1efe0[_0x11c864(0x1e2)](_0x11c864(0x219));});}};commands[command]?commands[command]()[a0_0x1264ea(0x1d6)](_0x330c75=>{const _0x2bd7ba=a0_0x1264ea;console[_0x2bd7ba(0x1f8)](_0x2bd7ba(0x216),_0x330c75['message']),process[_0x2bd7ba(0x20c)](0x1);}):(console[a0_0x1264ea(0x1f8)]('Unknown\x20command:\x20'+command),console[a0_0x1264ea(0x1f8)](a0_0x1264ea(0x1f1)),process['exit'](0x1));
|
|
3
|
+
const a0_0x3455d4=a0_0x2017;(function(_0x55acdf,_0x4ff77b){const _0x5511e8=a0_0x2017,_0x3e5950=_0x55acdf();while(!![]){try{const _0xf92874=-parseInt(_0x5511e8(0xcf))/0x1+parseInt(_0x5511e8(0xb3))/0x2+-parseInt(_0x5511e8(0xde))/0x3*(parseInt(_0x5511e8(0xbe))/0x4)+parseInt(_0x5511e8(0xb2))/0x5+parseInt(_0x5511e8(0xc0))/0x6+-parseInt(_0x5511e8(0xf3))/0x7+parseInt(_0x5511e8(0xd9))/0x8*(parseInt(_0x5511e8(0xea))/0x9);if(_0xf92874===_0x4ff77b)break;else _0x3e5950['push'](_0x3e5950['shift']());}catch(_0x4d9248){_0x3e5950['push'](_0x3e5950['shift']());}}}(a0_0x2864,0xc7936));import{fileURLToPath}from'url';import{dirname,join}from'path';import{spawn,exec}from'child_process';import{readFileSync}from'fs';function a0_0x2864(){const _0x42f83b=['web','package.json','8216757byoQgw',')\x0a\x20\x20--host\x20<host>\x20\x20\x20\x20\x20Specify\x20host\x20(default:\x20','inherit','startsWith','\x20\x20loxia\x20web\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20#\x20Start\x20server\x20+\x20Web\x20UI','message','Starting\x20Loxia\x20server\x20in\x20background...','utf8','platform','10149580SHAiKC','\x0aPlease\x20start\x20the\x20server\x20first:','exit','2276085MsoMpp','2005510VALhxr','SIGINT','Please\x20open\x20manually:\x20','catch','log','start\x20\x22\x22\x20\x22','setTimeout','--version','includes','Loxia\x20Autopilot\x20One\x20v','http://','709264qHgMhT','ceil','8449206VoudTp','Checking\x20if\x20server\x20is\x20running...','Run\x20\x22loxia\x20--help\x22\x20for\x20usage\x20information.','port','destroy','\x0aServer\x20failed\x20to\x20start.\x20Please\x20check\x20logs.','xdg-open\x20\x22','node','statusCode','host','\x20manually.','env','src','\x0aLoxia\x20Autopilot\x20One\x20v','help','1538137sDjJsm','Starting\x20Loxia\x20server...\x0a','toString','\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\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:\x20','version','argv','pid','ignore','parse','SIGTERM','16ZPuHfh','\x0aShutting\x20down\x20server...','--port','\x0aOpening\x20Web\x20UI\x20at\x20','kill','15rpNXzk','--host','Unknown\x20command:\x20','win32','length','error','Could\x20not\x20open\x20browser\x20automatically.','\x0aServer\x20is\x20not\x20running\x20at\x20','/api/health','index.js'];a0_0x2864=function(){return _0x42f83b;};return a0_0x2864();}import a0_0x1c80b4 from'http';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),DEFAULT_PORT=0x1f90,DEFAULT_HOST='localhost',SERVER_STARTUP_TIMEOUT=0x3a98,SERVER_CHECK_INTERVAL=0x1f4,args=process[a0_0x3455d4(0xd4)]['slice'](0x2),command=args[0x0]&&!args[0x0][a0_0x3455d4(0xed)]('--')?args[0x0]:null,flags={'port':null,'host':null,'help':args['includes']('--help')||args[a0_0x3455d4(0xbb)]('-h'),'version':args[a0_0x3455d4(0xbb)](a0_0x3455d4(0xba))||args[a0_0x3455d4(0xbb)]('-v')};for(let i=0x0;i<args[a0_0x3455d4(0xe2)];i++){args[i]===a0_0x3455d4(0xdb)&&args[i+0x1]&&(flags['port']=parseInt(args[i+0x1],0xa)),args[i]===a0_0x3455d4(0xdf)&&args[i+0x1]&&(flags[a0_0x3455d4(0xc9)]=args[i+0x1]);}const port=flags[a0_0x3455d4(0xc3)]||DEFAULT_PORT,host=flags[a0_0x3455d4(0xc9)]||DEFAULT_HOST,serverUrl=a0_0x3455d4(0xbd)+host+':'+port;if(flags['version']){const pkgPath=join(__dirname,'..',a0_0x3455d4(0xe9)),pkg=JSON[a0_0x3455d4(0xd7)](readFileSync(pkgPath,a0_0x3455d4(0xf1)));console[a0_0x3455d4(0xb7)](a0_0x3455d4(0xbc)+pkg[a0_0x3455d4(0xd3)]),process['exit'](0x0);}if(flags[a0_0x3455d4(0xce)]||!command){const pkgPath=join(__dirname,'..',a0_0x3455d4(0xe9)),pkg=JSON[a0_0x3455d4(0xd7)](readFileSync(pkgPath,a0_0x3455d4(0xf1)));console['log'](a0_0x3455d4(0xcd)+pkg['version']+a0_0x3455d4(0xd2)+DEFAULT_PORT+a0_0x3455d4(0xeb)+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\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\x20custom\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\x0aDocumentation:\x0a\x20\x20https://autopilot.loxia.ai\x0a\x0a'),process['exit'](0x0);}async function checkServerRunning(_0x251934,_0x5aad9d,_0x4b9add=0x1){for(let _0x434726=0x0;_0x434726<_0x4b9add;_0x434726++){const _0x1d8da2=await new Promise(_0x189b29=>{const _0x589d55=a0_0x2017,_0xa67843=a0_0x1c80b4['get'](_0x589d55(0xbd)+_0x251934+':'+_0x5aad9d+_0x589d55(0xe6),_0x1258b3=>{const _0x58a2db=_0x589d55;_0x189b29(_0x1258b3[_0x58a2db(0xc8)]===0xc8);});_0xa67843['on']('error',()=>_0x189b29(![])),_0xa67843[_0x589d55(0xb9)](0x7d0,()=>{const _0x2cdc52=_0x589d55;_0xa67843[_0x2cdc52(0xc4)](),_0x189b29(![]);});});if(_0x1d8da2)return!![];_0x434726<_0x4b9add-0x1&&await new Promise(_0x1552f5=>setTimeout(_0x1552f5,SERVER_CHECK_INTERVAL));}return![];}async function waitForServer(_0x480fb2,_0xa7a71a,_0x3342d1=SERVER_STARTUP_TIMEOUT){const _0x350cf8=a0_0x3455d4,_0x1cd0d1=Math[_0x350cf8(0xbf)](_0x3342d1/SERVER_CHECK_INTERVAL);return checkServerRunning(_0x480fb2,_0xa7a71a,_0x1cd0d1);}function openBrowser(_0x4a620f){const _0x326a53=a0_0x3455d4,_0x44d295=process[_0x326a53(0xf2)];let _0x2675bd;if(_0x44d295==='darwin')_0x2675bd='open\x20\x22'+_0x4a620f+'\x22';else _0x44d295===_0x326a53(0xe1)?_0x2675bd=_0x326a53(0xb8)+_0x4a620f+'\x22':_0x2675bd=_0x326a53(0xc6)+_0x4a620f+'\x22';exec(_0x2675bd,_0x48b1d5=>{const _0x7fa4c0=_0x326a53;_0x48b1d5&&(console[_0x7fa4c0(0xb7)](_0x7fa4c0(0xe4)),console[_0x7fa4c0(0xb7)](_0x7fa4c0(0xb5)+_0x4a620f));});}function startServer(_0x5f54ae=![]){const _0x339ffd=a0_0x3455d4,_0x697ca3={...process[_0x339ffd(0xcb)],'LOXIA_PORT':port[_0x339ffd(0xd1)](),'PORT':port[_0x339ffd(0xd1)]()};flags['host']&&(_0x697ca3['LOXIA_HOST']=flags[_0x339ffd(0xc9)]);const _0x23559f=join(__dirname,'..',_0x339ffd(0xcc),_0x339ffd(0xe7)),_0x5ba812=spawn(_0x339ffd(0xc7),[_0x23559f],{'cwd':join(__dirname,'..'),'env':_0x697ca3,'stdio':_0x5f54ae?[_0x339ffd(0xd6),_0x339ffd(0xd6),_0x339ffd(0xd6)]:_0x339ffd(0xec),'detached':_0x5f54ae});return _0x5f54ae&&_0x5ba812['unref'](),_0x5ba812;}function a0_0x2017(_0x244b06,_0x229135){_0x244b06=_0x244b06-0xb0;const _0x286474=a0_0x2864();let _0x2017e9=_0x286474[_0x244b06];return _0x2017e9;}function startTerminalUI(){const _0x1399f9=a0_0x3455d4,_0x129c59=join(__dirname,'loxia-terminal.js'),_0x4f25e5={...process[_0x1399f9(0xcb)],'LOXIA_PORT':port[_0x1399f9(0xd1)](),'LOXIA_HOST':host},_0x5b270e=spawn(_0x1399f9(0xc7),[_0x129c59],{'cwd':join(__dirname,'..'),'env':_0x4f25e5,'stdio':'inherit'});return _0x5b270e;}const commands={'web':async()=>{const _0x426440=a0_0x3455d4;console[_0x426440(0xb7)](_0x426440(0xd0));const _0x3298ce=startServer(![]);console[_0x426440(0xb7)]('Waiting\x20for\x20server\x20to\x20start...');const _0x5ae852=await waitForServer(host,port);_0x5ae852?(console[_0x426440(0xb7)](_0x426440(0xdc)+serverUrl),openBrowser(serverUrl)):console['log']('\x0aServer\x20may\x20still\x20be\x20starting.\x20Open\x20'+serverUrl+_0x426440(0xca)),process['on'](_0x426440(0xb4),()=>_0x3298ce['kill']('SIGINT')),process['on'](_0x426440(0xd8),()=>_0x3298ce[_0x426440(0xdd)]('SIGTERM')),_0x3298ce['on']('exit',_0x2ae4b0=>process['exit'](_0x2ae4b0||0x0));},'plus-web':async()=>{const _0x440e89=a0_0x3455d4;await commands[_0x440e89(0xe8)]();},'terminal':async()=>{const _0x3bece4=a0_0x3455d4;console[_0x3bece4(0xb7)](_0x3bece4(0xc1));const _0x239f78=await checkServerRunning(host,port);!_0x239f78&&(console[_0x3bece4(0xe3)](_0x3bece4(0xe5)+serverUrl),console['error'](_0x3bece4(0xb0)),console[_0x3bece4(0xe3)](_0x3bece4(0xee)),console['error']('\x20\x20loxia\x20plus-terminal\x20\x20#\x20Start\x20server\x20+\x20Terminal\x20UI\x0a'),process[_0x3bece4(0xb1)](0x1));console[_0x3bece4(0xb7)]('Server\x20is\x20running\x20at\x20'+serverUrl),console['log']('Starting\x20Terminal\x20UI...\x0a');const _0x3e7c93=startTerminalUI();process['on'](_0x3bece4(0xb4),()=>_0x3e7c93[_0x3bece4(0xdd)](_0x3bece4(0xb4))),process['on'](_0x3bece4(0xd8),()=>_0x3e7c93[_0x3bece4(0xdd)](_0x3bece4(0xd8))),_0x3e7c93['on'](_0x3bece4(0xb1),_0x5ed981=>process['exit'](_0x5ed981||0x0));},'plus-terminal':async()=>{const _0x4cc0c6=a0_0x3455d4;console[_0x4cc0c6(0xb7)](_0x4cc0c6(0xf0));const _0x28eb00=startServer(!![]),_0x4c00c3=await waitForServer(host,port);!_0x4c00c3&&(console[_0x4cc0c6(0xe3)](_0x4cc0c6(0xc5)),process[_0x4cc0c6(0xb1)](0x1));console['log']('Server\x20running\x20at\x20'+serverUrl),console['log']('Starting\x20Terminal\x20UI...\x0a');const _0x570402=startTerminalUI();_0x570402['on'](_0x4cc0c6(0xb1),_0x53e784=>{const _0x3593e7=_0x4cc0c6;console[_0x3593e7(0xb7)](_0x3593e7(0xda));try{process['kill'](_0x28eb00[_0x3593e7(0xd5)],_0x3593e7(0xd8));}catch(_0x44beda){}process['exit'](_0x53e784||0x0);}),process['on'](_0x4cc0c6(0xb4),()=>{const _0x35d37c=_0x4cc0c6;_0x570402[_0x35d37c(0xdd)](_0x35d37c(0xb4));}),process['on'](_0x4cc0c6(0xd8),()=>{const _0x3b9d1a=_0x4cc0c6;_0x570402[_0x3b9d1a(0xdd)](_0x3b9d1a(0xd8));});}};commands[command]?commands[command]()[a0_0x3455d4(0xb6)](_0x5625fe=>{const _0x569bdd=a0_0x3455d4;console[_0x569bdd(0xe3)]('Error:',_0x5625fe[_0x569bdd(0xef)]),process[_0x569bdd(0xb1)](0x1);}):(console[a0_0x3455d4(0xe3)](a0_0x3455d4(0xe0)+command),console[a0_0x3455d4(0xe3)](a0_0x3455d4(0xc2)),process['exit'](0x1));
|
package/bin/loxia-terminal-v2.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const a0_0x28d422=a0_0xce81;(function(_0x20648c,_0x28fc5b){const _0x283b51=a0_0xce81,_0x31d8ad=_0x20648c();while(!![]){try{const _0x14fccd=-parseInt(_0x283b51(0xc4))/0x1*(parseInt(_0x283b51(0xb7))/0x2)+parseInt(_0x283b51(0xda))/0x3*(-parseInt(_0x283b51(0xc0))/0x4)+-parseInt(_0x283b51(0xd3))/0x5*(parseInt(_0x283b51(0xdd))/0x6)+parseInt(_0x283b51(0xdf))/0x7*(-parseInt(_0x283b51(0xb1))/0x8)+-parseInt(_0x283b51(0xd6))/0x9+-parseInt(_0x283b51(0xbe))/0xa*(parseInt(_0x283b51(0xc6))/0xb)+parseInt(_0x283b51(0xc9))/0xc;if(_0x14fccd===_0x28fc5b)break;else _0x31d8ad['push'](_0x31d8ad['shift']());}catch(_0x32a85e){_0x31d8ad['push'](_0x31d8ad['shift']());}}}(a0_0x44b3,0x7fe6c));import{spawn}from'child_process';import a0_0xee82d6 from'net';import a0_0x48a9cf from'path';import{fileURLToPath}from'url';const __filename=fileURLToPath(import.meta.url),__dirname=a0_0x48a9cf[a0_0x28d422(0xb6)](__filename),projectRoot=a0_0x48a9cf['dirname'](__dirname),DEFAULT_PORT=0x1f90,DEFAULT_HOST=a0_0x28d422(0xc7),SERVER_STARTUP_TIMEOUT=0x2710;function a0_0x44b3(){const _0x1f0322=['\x20\x20\x202.\x20Try\x20running\x20the\x20server\x20manually:\x20node\x20bin/cli.js','dirname','2nRYgmG','kill','━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━','\x20\x20Loxia\x20Autopilot\x20One\x20-\x20Terminal\x20UI','\x20\x20\x203.\x20Check\x20logs\x20for\x20more\x20details','❌\x20Failed\x20to\x20start\x20Terminal\x20UI:','--port','20rYaljw','LOXIA_HOST','1608cBizWl','LOXIA_PORT','timeout','log','949570JamhPg','pipe','155177yEGuNY','localhost','bin/cli.js','43437672vngODF','slice','--host','destroy','message','ignore','🔍\x20Checking\x20if\x20server\x20is\x20running\x20at\x20','error','data','web','1985JhaVtT','../src/interfaces/terminal/index.js','--ui','8035470BjuFJR','connect','length','now','6717PdsZSa','node','argv','1614tuLMCa','stderr','7szzBdl','✗\x20Server\x20is\x20not\x20running','🚀\x20Starting\x20Loxia\x20server...','✓\x20Server\x20started\x20at\x20','Failed\x20to\x20start\x20server:','1747496qEDWmn','join','Server\x20startup\x20timeout','🎨\x20Launching\x20Ink-based\x20Terminal\x20UI...'];a0_0x44b3=function(){return _0x1f0322;};return a0_0x44b3();}async function isServerRunning(_0x1cbddc,_0x1de971){return new Promise(_0x4f6ea2=>{const _0x2a85e8=a0_0xce81,_0x3e70fe=new a0_0xee82d6['Socket']();_0x3e70fe['setTimeout'](0x7d0),_0x3e70fe['on'](_0x2a85e8(0xd7),()=>{_0x3e70fe['destroy'](),_0x4f6ea2(!![]);}),_0x3e70fe['on'](_0x2a85e8(0xc2),()=>{const _0x3336fd=_0x2a85e8;_0x3e70fe[_0x3336fd(0xcc)](),_0x4f6ea2(![]);}),_0x3e70fe['on'](_0x2a85e8(0xd0),()=>{_0x3e70fe['destroy'](),_0x4f6ea2(![]);}),_0x3e70fe[_0x2a85e8(0xd7)](_0x1de971,_0x1cbddc);});}async function startServer(_0x2acd4d,_0x536f7f){const _0x3b68a5=a0_0x28d422;return console['log'](_0x3b68a5(0xae)),new Promise((_0x4a74e3,_0xc3bdd1)=>{const _0x543a94=_0x3b68a5,_0x2d36a1=spawn(_0x543a94(0xdb),[a0_0x48a9cf[_0x543a94(0xb2)](projectRoot,_0x543a94(0xc8)),_0x543a94(0xd5),_0x543a94(0xd2),_0x543a94(0xcb),_0x2acd4d,'--port',_0x536f7f['toString']()],{'detached':![],'stdio':[_0x543a94(0xce),_0x543a94(0xc5),'pipe']});_0x2d36a1['stdout']['on'](_0x543a94(0xd1),()=>{}),_0x2d36a1[_0x543a94(0xde)]['on'](_0x543a94(0xd1),()=>{}),_0x2d36a1['on'](_0x543a94(0xd0),_0x3fafaf=>{const _0x3d4490=_0x543a94;console[_0x3d4490(0xd0)](_0x3d4490(0xb0),_0x3fafaf['message']),_0xc3bdd1(_0x3fafaf);});const _0x57fb5d=Date[_0x543a94(0xd9)](),_0x3633e3=setInterval(async()=>{const _0x1d9c9d=_0x543a94,_0x3ee46c=await isServerRunning(_0x2acd4d,_0x536f7f);if(_0x3ee46c)clearInterval(_0x3633e3),console['log'](_0x1d9c9d(0xaf)+_0x2acd4d+':'+_0x536f7f),_0x4a74e3();else Date['now']()-_0x57fb5d>SERVER_STARTUP_TIMEOUT&&(clearInterval(_0x3633e3),_0x2d36a1[_0x1d9c9d(0xb8)](),_0xc3bdd1(new Error(_0x1d9c9d(0xb3))));},0x1f4);});}async function main(){const _0x33880c=a0_0x28d422;try{console[_0x33880c(0xc3)](_0x33880c(0xb9)),console['log'](_0x33880c(0xba)),console[_0x33880c(0xc3)]('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'),console[_0x33880c(0xc3)]('');const _0xb5ea49=process[_0x33880c(0xdc)][_0x33880c(0xca)](0x2);let _0x2aa5d4=DEFAULT_HOST,_0x279386=DEFAULT_PORT;for(let _0x1ca92b=0x0;_0x1ca92b<_0xb5ea49[_0x33880c(0xd8)];_0x1ca92b++){if(_0xb5ea49[_0x1ca92b]===_0x33880c(0xcb)&&_0xb5ea49[_0x1ca92b+0x1])_0x2aa5d4=_0xb5ea49[_0x1ca92b+0x1],_0x1ca92b++;else _0xb5ea49[_0x1ca92b]===_0x33880c(0xbd)&&_0xb5ea49[_0x1ca92b+0x1]&&(_0x279386=parseInt(_0xb5ea49[_0x1ca92b+0x1],0xa),_0x1ca92b++);}console[_0x33880c(0xc3)](_0x33880c(0xcf)+_0x2aa5d4+':'+_0x279386+'...');const _0x5bcc74=await isServerRunning(_0x2aa5d4,_0x279386);!_0x5bcc74?(console[_0x33880c(0xc3)](_0x33880c(0xe0)),await startServer(_0x2aa5d4,_0x279386)):console[_0x33880c(0xc3)]('✓\x20Server\x20is\x20already\x20running\x20at\x20'+_0x2aa5d4+':'+_0x279386),console[_0x33880c(0xc3)](''),console['log'](_0x33880c(0xb4)),console[_0x33880c(0xc3)](''),await new Promise(_0x575fb0=>setTimeout(_0x575fb0,0x1f4)),process['env'][_0x33880c(0xbf)]=_0x2aa5d4,process['env'][_0x33880c(0xc1)]=_0x279386['toString'](),await import(_0x33880c(0xd4));}catch(_0x2c46b4){console[_0x33880c(0xd0)](''),console['error'](_0x33880c(0xbc)),console['error']('\x20\x20',_0x2c46b4[_0x33880c(0xcd)]),console[_0x33880c(0xd0)](''),console[_0x33880c(0xd0)]('💡\x20Troubleshooting:'),console[_0x33880c(0xd0)]('\x20\x20\x201.\x20Make\x20sure\x20no\x20other\x20process\x20is\x20using\x20port\x208080'),console['error'](_0x33880c(0xb5)),console[_0x33880c(0xd0)](_0x33880c(0xbb)),console[_0x33880c(0xd0)](''),process['exit'](0x1);}}function a0_0xce81(_0x2a5d4d,_0x3de434){_0x2a5d4d=_0x2a5d4d-0xae;const _0x44b3a8=a0_0x44b3();let _0xce8137=_0x44b3a8[_0x2a5d4d];return _0xce8137;}main();
|
package/bin/loxia-terminal.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const a0_0x27ab6f=a0_0x23a5;(function(_0x31e463,_0x10b9b1){const _0x59e947=a0_0x23a5,_0x212aaf=_0x31e463();while(!![]){try{const _0x4bec8d=parseInt(_0x59e947(0x191))/0x1*(parseInt(_0x59e947(0x1b1))/0x2)+parseInt(_0x59e947(0x19f))/0x3*(-parseInt(_0x59e947(0x19e))/0x4)+parseInt(_0x59e947(0x1aa))/0x5*(parseInt(_0x59e947(0x19a))/0x6)+parseInt(_0x59e947(0x1a7))/0x7+parseInt(_0x59e947(0x190))/0x8*(parseInt(_0x59e947(0x1a0))/0x9)+parseInt(_0x59e947(0x1ae))/0xa+-parseInt(_0x59e947(0x199))/0xb*(parseInt(_0x59e947(0x19b))/0xc);if(_0x4bec8d===_0x10b9b1)break;else _0x212aaf['push'](_0x212aaf['shift']());}catch(_0x39f9de){_0x212aaf['push'](_0x212aaf['shift']());}}}(a0_0xb436,0xcaf1d));import{startTerminalUI}from'../src/interfaces/terminal/index.js';const args=process[a0_0x27ab6f(0x198)][a0_0x27ab6f(0x19c)](0x2),options={'host':'localhost','port':0x1f90};for(let i=0x0;i<args[a0_0x27ab6f(0x1af)];i++){const arg=args[i];if(arg==='--host'||arg==='-h')options['host']=args[++i];else{if(arg===a0_0x27ab6f(0x1a4)||arg==='-p')options[a0_0x27ab6f(0x194)]=parseInt(args[++i],0xa);else arg==='--help'&&(console[a0_0x27ab6f(0x1a6)](a0_0x27ab6f(0x1a2)),process[a0_0x27ab6f(0x1b0)](0x0));}}process[a0_0x27ab6f(0x1ad)][a0_0x27ab6f(0x192)]&&(options[a0_0x27ab6f(0x197)]=process[a0_0x27ab6f(0x1ad)][a0_0x27ab6f(0x192)]);process[a0_0x27ab6f(0x1ad)][a0_0x27ab6f(0x19d)]&&(options[a0_0x27ab6f(0x194)]=parseInt(process['env'][a0_0x27ab6f(0x19d)],0xa));!process[a0_0x27ab6f(0x1b3)][a0_0x27ab6f(0x1a5)]&&(console[a0_0x27ab6f(0x195)]('ERROR:\x20Terminal\x20UI\x20requires\x20an\x20interactive\x20terminal\x20(TTY).'),console['error'](''),console[a0_0x27ab6f(0x195)](a0_0x27ab6f(0x1ac)),console[a0_0x27ab6f(0x195)](a0_0x27ab6f(0x18e)),console['error']('\x20\x20-\x20Redirected\x20output\x20(e.g.,\x20>\x20file.txt,\x202>&1\x20|\x20...)'),console['error']('\x20\x20-\x20Background\x20processes\x20(e.g.,\x20&\x20at\x20the\x20end)'),console['error'](a0_0x27ab6f(0x1a8)),console[a0_0x27ab6f(0x195)](''),console[a0_0x27ab6f(0x195)](a0_0x27ab6f(0x1a3)),console[a0_0x27ab6f(0x195)](a0_0x27ab6f(0x193)),console[a0_0x27ab6f(0x195)](''),console[a0_0x27ab6f(0x195)]('Or\x20use\x20the\x20web\x20UI\x20instead:'),console['error']('\x20\x20npm\x20start'),process['exit'](0x1));console[a0_0x27ab6f(0x1a6)](a0_0x27ab6f(0x1a9)),console[a0_0x27ab6f(0x1a6)]('Connecting\x20to:\x20'+options[a0_0x27ab6f(0x197)]+':'+options[a0_0x27ab6f(0x194)]),console[a0_0x27ab6f(0x1a6)](a0_0x27ab6f(0x1a1));function a0_0xb436(){const _0x5e11fc=['catch','72jGArlf','10mUCdij','LOXIA_HOST','\x20\x20npm\x20run\x20terminal-ui','port','error','waitUntilExit','host','argv','187Qdpzxr','6nqpdwa','1164108FyWdCO','slice','LOXIA_PORT','476NxxefA','2841WDNvpJ','361764SJRUWt','Press\x20Ctrl+C\x20to\x20exit\x0a','\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','Please\x20run\x20this\x20command\x20in\x20a\x20real\x20terminal\x20without\x20pipes\x20or\x20redirection:','--port','isTTY','log','3729943xLgXAQ','\x20\x20-\x20Some\x20CI/CD\x20environments','Starting\x20Loxia\x20Terminal\x20UI...','1341455iNtyMv','\x0aTerminal\x20UI\x20error:','The\x20terminal\x20UI\x20cannot\x20run\x20in:','env','13486230UZiEkw','length','exit','16316jyKXjv','then','stdin','\x20\x20-\x20Piped\x20environments\x20(e.g.,\x20|\x20head,\x20|\x20grep)'];a0_0xb436=function(){return _0x5e11fc;};return a0_0xb436();}function a0_0x23a5(_0x409262,_0x28cf2d){_0x409262=_0x409262-0x18e;const _0xb43605=a0_0xb436();let _0x23a5d7=_0xb43605[_0x409262];return _0x23a5d7;}const instance=startTerminalUI(options);instance[a0_0x27ab6f(0x196)]()[a0_0x27ab6f(0x1b2)](()=>{const _0x14b2d1=a0_0x27ab6f;console['log']('\x0aTerminal\x20UI\x20exited'),process[_0x14b2d1(0x1b0)](0x0);})[a0_0x27ab6f(0x18f)](_0x15d676=>{const _0x3d107a=a0_0x27ab6f;console[_0x3d107a(0x195)](_0x3d107a(0x1ab),_0x15d676),process[_0x3d107a(0x1b0)](0x1);});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function a0_0x467a(){const _0x5dd6f3=['killed','get','32ZnEieH','env','SIGKILL','5380HXkReR','loxia-terminal.js','24150402TcZFSN','stderr','includes','752BlMmEN','[SERVER\x20ERROR]\x20','kill','message','ignore','1845600grHaBq','index.js','log','⚠️\x20\x20Server\x20may\x20not\x20be\x20fully\x20ready,\x20but\x20continuing\x20anyway...','/health','[SERVER]\x20','stdout','error','✅\x20Server\x20is\x20ready!','setTimeout','Error\x20during\x20startup:','node','PORT','SIGTERM','trim','Timeout','5644667yhGOQO','Failed\x20to\x20start\x20server:','SIGINT','exit','ExperimentalWarning','statusCode','\x0a⚠️\x20\x20Received\x20SIGTERM,\x20shutting\x20down...','toString','http://localhost:','1599drFIAm','data','\x0a⚠️\x20\x20Received\x20SIGINT,\x20shutting\x20down...','1376886bylIMq','Failed\x20to\x20start\x20Terminal\x20UI:','pipe','╚════════════════════════════════════════════════╝','6893368zNtKzd'];a0_0x467a=function(){return _0x5dd6f3;};return a0_0x467a();}const a0_0x39716b=a0_0x359a;(function(_0x1a28d5,_0x1e3c91){const _0x383ca4=a0_0x359a,_0x325fe7=_0x1a28d5();while(!![]){try{const _0x737023=-parseInt(_0x383ca4(0x214))/0x1*(parseInt(_0x383ca4(0x217))/0x2)+parseInt(_0x383ca4(0x20a))/0x3*(-parseInt(_0x383ca4(0x21c))/0x4)+-parseInt(_0x383ca4(0x1f1))/0x5+parseInt(_0x383ca4(0x20d))/0x6+-parseInt(_0x383ca4(0x201))/0x7+-parseInt(_0x383ca4(0x211))/0x8+parseInt(_0x383ca4(0x219))/0x9;if(_0x737023===_0x1e3c91)break;else _0x325fe7['push'](_0x325fe7['shift']());}catch(_0xa1c19b){_0x325fe7['push'](_0x325fe7['shift']());}}}(a0_0x467a,0xa84fb));import{spawn}from'child_process';import{fileURLToPath}from'url';import{dirname,join}from'path';import a0_0x2b4e08 from'http';const __filename=fileURLToPath(import.meta.url),__dirname=dirname(__filename),rootDir=join(__dirname,'..'),SERVER_PORT=process[a0_0x39716b(0x215)][a0_0x39716b(0x1fd)]||0x1f90,STARTUP_WAIT=0x7d0;let serverProcess=null;async function checkServerReady(_0x38f5d5=0xa,_0x3fa063=0x1f4){const _0x489246=a0_0x39716b;for(let _0x122108=0x0;_0x122108<_0x38f5d5;_0x122108++){try{return await new Promise((_0x302a42,_0x219b90)=>{const _0x952297=a0_0x359a,_0xd38e4c=a0_0x2b4e08[_0x952297(0x213)](_0x952297(0x209)+SERVER_PORT+_0x952297(0x1f5),_0x5146b3=>{const _0x1f9524=_0x952297;_0x5146b3['statusCode']===0xc8?_0x302a42():_0x219b90(new Error('Server\x20returned\x20'+_0x5146b3[_0x1f9524(0x206)]));});_0xd38e4c['on']('error',_0x219b90),_0xd38e4c[_0x952297(0x1fa)](0x3e8,()=>{const _0x585f02=_0x952297;_0xd38e4c['destroy'](),_0x219b90(new Error(_0x585f02(0x200)));});}),console[_0x489246(0x1f3)](_0x489246(0x1f9)),!![];}catch(_0x53a465){_0x122108<_0x38f5d5-0x1&&await new Promise(_0x1af219=>setTimeout(_0x1af219,_0x3fa063));}}return console[_0x489246(0x1f3)](_0x489246(0x1f4)),![];}async function startServer(){return new Promise(_0xc148b0=>{const _0x1e243d=a0_0x359a;console[_0x1e243d(0x1f3)]('🚀\x20Starting\x20Loxia\x20server...');const _0x202acf=join(rootDir,'src',_0x1e243d(0x1f2));serverProcess=spawn('node',[_0x202acf],{'cwd':rootDir,'env':{...process[_0x1e243d(0x215)]},'stdio':[_0x1e243d(0x1f0),'pipe',_0x1e243d(0x20f)],'detached':![]}),serverProcess[_0x1e243d(0x1f7)]['on'](_0x1e243d(0x20b),_0x46c54e=>{const _0x5bc08e=_0x1e243d,_0x28cc2c=_0x46c54e['toString']()['trim']();_0x28cc2c&&console[_0x5bc08e(0x1f3)](_0x5bc08e(0x1f6)+_0x28cc2c);}),serverProcess[_0x1e243d(0x21a)]['on'](_0x1e243d(0x20b),_0x2194fd=>{const _0x2d49ea=_0x1e243d,_0x4a0415=_0x2194fd[_0x2d49ea(0x208)]()[_0x2d49ea(0x1ff)]();_0x4a0415&&!_0x4a0415[_0x2d49ea(0x21b)](_0x2d49ea(0x205))&&console[_0x2d49ea(0x1f8)](_0x2d49ea(0x21d)+_0x4a0415);}),serverProcess['on'](_0x1e243d(0x1f8),_0x2e158b=>{const _0x231f3f=_0x1e243d;console['error'](_0x231f3f(0x202),_0x2e158b[_0x231f3f(0x1ef)]),process['exit'](0x1);}),serverProcess['on'](_0x1e243d(0x204),(_0x13e88b,_0x4e3164)=>{const _0x555232=_0x1e243d;_0x13e88b!==null&&_0x13e88b!==0x0&&(console[_0x555232(0x1f8)]('Server\x20exited\x20with\x20code\x20'+_0x13e88b),process[_0x555232(0x204)](_0x13e88b));}),setTimeout(_0xc148b0,STARTUP_WAIT);});}async function startTerminalUI(){const _0x29724f=a0_0x39716b;console['log']('🖥️\x20\x20Starting\x20Terminal\x20UI...'),console[_0x29724f(0x1f3)]('');const _0x899312=join(rootDir,'bin',_0x29724f(0x218)),_0x24e83a=spawn(_0x29724f(0x1fc),[_0x899312],{'cwd':rootDir,'env':{...process[_0x29724f(0x215)]},'stdio':'inherit'});return _0x24e83a['on'](_0x29724f(0x1f8),_0x447749=>{const _0x53b7fc=_0x29724f;console[_0x53b7fc(0x1f8)](_0x53b7fc(0x20e),_0x447749['message']),cleanup(),process[_0x53b7fc(0x204)](0x1);}),_0x24e83a['on'](_0x29724f(0x204),_0x1fa490=>{const _0xe84f95=_0x29724f;console[_0xe84f95(0x1f3)]('\x0a👋\x20Terminal\x20UI\x20closed.'),cleanup(),process[_0xe84f95(0x204)](_0x1fa490||0x0);}),_0x24e83a;}function a0_0x359a(_0x36e3c8,_0x284bc2){_0x36e3c8=_0x36e3c8-0x1ef;const _0x467a71=a0_0x467a();let _0x359a19=_0x467a71[_0x36e3c8];return _0x359a19;}function cleanup(){const _0x5f0270=a0_0x39716b;serverProcess&&!serverProcess[_0x5f0270(0x212)]&&(console[_0x5f0270(0x1f3)]('🛑\x20Stopping\x20server...'),serverProcess[_0x5f0270(0x21e)](_0x5f0270(0x1fe)),setTimeout(()=>{const _0x299b0c=_0x5f0270;!serverProcess['killed']&&serverProcess[_0x299b0c(0x21e)](_0x299b0c(0x216));},0x1388));}process['on'](a0_0x39716b(0x203),()=>{const _0x1ab788=a0_0x39716b;console[_0x1ab788(0x1f3)](_0x1ab788(0x20c)),cleanup(),process[_0x1ab788(0x204)](0x0);}),process['on']('SIGTERM',()=>{const _0x2538a4=a0_0x39716b;console[_0x2538a4(0x1f3)](_0x2538a4(0x207)),cleanup(),process[_0x2538a4(0x204)](0x0);}),process['on'](a0_0x39716b(0x204),()=>{cleanup();});async function main(){const _0x38ba27=a0_0x39716b;console[_0x38ba27(0x1f3)]('╔════════════════════════════════════════════════╗'),console[_0x38ba27(0x1f3)]('║\x20\x20\x20Loxia\x20AI\x20Agents\x20-\x20Server\x20+\x20Terminal\x20UI\x20\x20\x20\x20\x20\x20║'),console['log'](_0x38ba27(0x210)),console[_0x38ba27(0x1f3)]('');try{await startServer(),await checkServerReady(),await startTerminalUI(),await new Promise(()=>{});}catch(_0x243709){console[_0x38ba27(0x1f8)](_0x38ba27(0x1fb),_0x243709[_0x38ba27(0x1ef)]),cleanup(),process[_0x38ba27(0x204)](0x1);}}main();
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
2
|
+
const a0_0x2f1259=a0_0x303c;(function(_0x26dd2f,_0x3ce7b9){const _0x2d4658=a0_0x303c,_0x380c4f=_0x26dd2f();while(!![]){try{const _0x37171d=parseInt(_0x2d4658(0x1cc))/0x1*(parseInt(_0x2d4658(0x1cb))/0x2)+-parseInt(_0x2d4658(0x1a5))/0x3*(parseInt(_0x2d4658(0x1af))/0x4)+-parseInt(_0x2d4658(0x1d0))/0x5*(-parseInt(_0x2d4658(0x19c))/0x6)+-parseInt(_0x2d4658(0x1cd))/0x7+-parseInt(_0x2d4658(0x1a7))/0x8*(parseInt(_0x2d4658(0x19f))/0x9)+parseInt(_0x2d4658(0x1cf))/0xa+parseInt(_0x2d4658(0x1c6))/0xb*(parseInt(_0x2d4658(0x1ce))/0xc);if(_0x37171d===_0x3ce7b9)break;else _0x380c4f['push'](_0x380c4f['shift']());}catch(_0x19860c){_0x380c4f['push'](_0x380c4f['shift']());}}}(a0_0x47b5,0xf32cf));import{exec}from'child_process';import{promisify}from'util';import a0_0x4e2f58 from'https';import a0_0x437ed9 from'http';function a0_0x303c(_0x2df0bd,_0x1b93ac){_0x2df0bd=_0x2df0bd-0x19c;const _0x47b50d=a0_0x47b5();let _0x303c2e=_0x47b50d[_0x2df0bd];return _0x303c2e;}import a0_0x571029 from'fs';import a0_0x39804b from'path';import{fileURLToPath}from'url';import{createWriteStream}from'fs';function a0_0x47b5(){const _0x120041=['Failed\x20to\x20download:\x20HTTP\x20','unlink','4411kMheag','\x20installed\x20successfully','\x20\x20Installation\x20Complete','python3\x20--version','\x20\x20\x20Installing\x20','4pyCauv','451810TSOnUS','1913877DaYVzA','46572UhFKjD','4882920YBoloa','3646645OZavTA','═══════════════════════════════════════════════════════════\x0a','\x0a═══════════════════════════════════════════════════════════','\x20\x20\x20You\x20can\x20install\x20manually:\x20pip\x20install\x20','checkov','catch','\x20\x20\x20✅\x20Semgrep\x20already\x20installed:\x20','\x20\x20\x20To\x20enable\x20Python\x20scanning,\x20install\x20Python\x20and\x20run:','startsWith','\x0aYou\x20can\x20manually\x20install\x20scanners:','message','🔍\x20Installing\x20Semgrep...','...','\x20-m\x20pip\x20show\x20','log','finish','get','yamllint','chmod','url','\x20\x20\x20pip\x20install\x20semgrep\x20bandit\x20pip-audit\x20checkov\x20yamllint\x0a','\x20\x20\x20⚠️\x20\x20Failed\x20to\x20install\x20','exit','6qUTjGz','python3','\x20\x20\x20Downloading\x20from\x20','4456845kEJhUE','\x20\x20\x20⚠️\x20\x20eslint-plugin-security\x20not\x20found','📦\x20Checking\x20ESLint\x20Security\x20Plugin...','\x20\x20\x20⚠️\x20\x20Python\x20not\x20found\x20-\x20skipping\x20Python\x20scanners','\x20\x20\x20Please\x20install\x20manually:\x20https://semgrep.dev/docs/getting-started/\x0a','dirname','2787BElBsM','bandit','16puYXYg','\x20\x20pip\x20install\x20semgrep\x20bandit\x20pip-audit','arch','python\x20--version','\x20\x20\x20✅\x20Semgrep\x20installed\x20successfully','\x20\x20\x20✅\x20','\x20\x20Installing\x20Security\x20Scanners','location','6104LfKfYg','then','\x20already\x20installed','mkdir','semgrep\x20--version','join','stdout','❌\x20Installation\x20failed:','\x20\x20\x20Run:\x20npm\x20install\x20--save-dev\x20eslint-plugin-security\x0a','node_modules','error','\x20\x20\x20Location:\x20','🐍\x20Checking\x20Python\x20scanners...','\x20\x20\x20Note:\x20To\x20use\x20system-wide,\x20add\x20to\x20PATH\x20or\x20install\x20globally:','python','\x20\x20\x20✅\x20eslint-plugin-security\x20is\x20installed\x0a','https','\x20\x20\x20pip\x20install\x20semgrep\x0a','statusCode','promises','eslint-plugin-security'];a0_0x47b5=function(){return _0x120041;};return a0_0x47b5();}import{pipeline}from'stream/promises';const execAsync=promisify(exec),__filename=fileURLToPath(import.meta.url),__dirname=a0_0x39804b[a0_0x2f1259(0x1a4)](__filename),SCANNER_DIR=a0_0x39804b[a0_0x2f1259(0x1b4)](__dirname,'..',a0_0x2f1259(0x1b8),'.scanners'),SEMGREP_VERSION='v1.55.0';console['log']('═══════════════════════════════════════════════════════════'),console['log'](a0_0x2f1259(0x1ad)),console[a0_0x2f1259(0x1de)](a0_0x2f1259(0x1d1));async function installScanners(){const _0x2e275d=a0_0x2f1259;await a0_0x571029[_0x2e275d(0x1c2)][_0x2e275d(0x1b2)](SCANNER_DIR,{'recursive':!![]}),await checkESLintSecurity(),await installSemgrep(),await installPythonScanners(),console['log'](_0x2e275d(0x1d2)),console[_0x2e275d(0x1de)](_0x2e275d(0x1c8)),console['log']('═══════════════════════════════════════════════════════════\x0a');}async function checkESLintSecurity(){const _0x3783c6=a0_0x2f1259;console[_0x3783c6(0x1de)](_0x3783c6(0x1a1));try{await import(_0x3783c6(0x1c3)),console[_0x3783c6(0x1de)](_0x3783c6(0x1be));}catch(_0x9c3a6e){console[_0x3783c6(0x1de)](_0x3783c6(0x1a0)),console['log'](_0x3783c6(0x1b7));}}async function installSemgrep(){const _0x4d5ca1=a0_0x2f1259;console[_0x4d5ca1(0x1de)](_0x4d5ca1(0x1db));const _0x3259e8=process['platform'],_0x4a4d87=process[_0x4d5ca1(0x1a9)];try{const _0x117784=await execAsync(_0x4d5ca1(0x1b3),{'timeout':0x1388});console[_0x4d5ca1(0x1de)](_0x4d5ca1(0x1d6)+_0x117784[_0x4d5ca1(0x1b5)]['trim']()),console['log']('\x20\x20\x20Using\x20system-installed\x20Semgrep\x0a');return;}catch(_0x39965c){console[_0x4d5ca1(0x1de)]('\x20\x20\x20Semgrep\x20not\x20found\x20in\x20PATH,\x20installing\x20standalone\x20binary...');}const _0x4a21ee=getSemgrepBinaryInfo(_0x3259e8,_0x4a4d87);if(!_0x4a21ee){console['log']('\x20\x20\x20⚠️\x20\x20No\x20Semgrep\x20binary\x20available\x20for\x20'+_0x3259e8+'-'+_0x4a4d87),console[_0x4d5ca1(0x1de)](_0x4d5ca1(0x1a3));return;}try{const _0x2013b9=a0_0x39804b[_0x4d5ca1(0x1b4)](SCANNER_DIR,'semgrep');console[_0x4d5ca1(0x1de)](_0x4d5ca1(0x19e)+_0x4a21ee[_0x4d5ca1(0x1e3)]+'...'),await downloadFile(_0x4a21ee['url'],_0x2013b9),await a0_0x571029[_0x4d5ca1(0x1c2)][_0x4d5ca1(0x1e2)](_0x2013b9,0x1ed),console[_0x4d5ca1(0x1de)](_0x4d5ca1(0x1ab)),console[_0x4d5ca1(0x1de)](_0x4d5ca1(0x1ba)+_0x2013b9+'\x0a'),console['log'](_0x4d5ca1(0x1bc)),console[_0x4d5ca1(0x1de)](_0x4d5ca1(0x1c0));}catch(_0x551813){console[_0x4d5ca1(0x1de)]('\x20\x20\x20⚠️\x20\x20Failed\x20to\x20install\x20Semgrep:\x20'+_0x551813[_0x4d5ca1(0x1da)]),console[_0x4d5ca1(0x1de)]('\x20\x20\x20You\x20can\x20install\x20manually:\x20pip\x20install\x20semgrep\x0a');}}function getSemgrepBinaryInfo(_0x3d6b28,_0x49f16c){return null;}async function installPythonScanners(){const _0x364473=a0_0x2f1259;console[_0x364473(0x1de)](_0x364473(0x1bb));let _0x350e51=null;try{await execAsync(_0x364473(0x1c9),{'timeout':0x1388}),_0x350e51=_0x364473(0x19d);}catch(_0x6f664a){try{await execAsync(_0x364473(0x1aa),{'timeout':0x1388}),_0x350e51=_0x364473(0x1bd);}catch(_0x6d3779){console[_0x364473(0x1de)](_0x364473(0x1a2)),console[_0x364473(0x1de)](_0x364473(0x1d7)),console['log'](_0x364473(0x1e4));return;}}console[_0x364473(0x1de)]('\x20\x20\x20✅\x20Python\x20found:\x20'+_0x350e51),await installViaPip('semgrep',_0x350e51),await installViaPip(_0x364473(0x1a6),_0x350e51),await installViaPip('pip-audit',_0x350e51),await installViaPip(_0x364473(0x1d4),_0x350e51),await installViaPip(_0x364473(0x1e1),_0x350e51),console['log']('');}async function installViaPip(_0x5400f2,_0x32fca3){const _0x4ea5d5=a0_0x2f1259;try{const _0x204c7d=await execAsync(_0x32fca3+_0x4ea5d5(0x1dd)+_0x5400f2,{'timeout':0x1388});return console[_0x4ea5d5(0x1de)](_0x4ea5d5(0x1ac)+_0x5400f2+_0x4ea5d5(0x1b1)),!![];}catch(_0x1e35fd){console[_0x4ea5d5(0x1de)](_0x4ea5d5(0x1ca)+_0x5400f2+_0x4ea5d5(0x1dc));try{return await execAsync(_0x32fca3+'\x20-m\x20pip\x20install\x20--user\x20'+_0x5400f2,{'timeout':0xea60}),console[_0x4ea5d5(0x1de)](_0x4ea5d5(0x1ac)+_0x5400f2+_0x4ea5d5(0x1c7)),!![];}catch(_0x179aea){return console[_0x4ea5d5(0x1de)](_0x4ea5d5(0x1e5)+_0x5400f2+':\x20'+_0x179aea[_0x4ea5d5(0x1da)]),console[_0x4ea5d5(0x1de)](_0x4ea5d5(0x1d3)+_0x5400f2),![];}}}async function downloadFile(_0x57b8b9,_0x3e575e){return new Promise((_0x144363,_0x54e157)=>{const _0x2da9f5=a0_0x303c,_0x5458c6=_0x57b8b9[_0x2da9f5(0x1d8)](_0x2da9f5(0x1bf))?a0_0x4e2f58:a0_0x437ed9;_0x5458c6[_0x2da9f5(0x1e0)](_0x57b8b9,_0x1f1780=>{const _0x2a6e0e=_0x2da9f5;if(_0x1f1780[_0x2a6e0e(0x1c1)]===0x12e||_0x1f1780['statusCode']===0x12d){downloadFile(_0x1f1780['headers'][_0x2a6e0e(0x1ae)],_0x3e575e)[_0x2a6e0e(0x1b0)](_0x144363)['catch'](_0x54e157);return;}if(_0x1f1780[_0x2a6e0e(0x1c1)]!==0xc8){_0x54e157(new Error(_0x2a6e0e(0x1c4)+_0x1f1780[_0x2a6e0e(0x1c1)]));return;}const _0x204615=createWriteStream(_0x3e575e);_0x1f1780['pipe'](_0x204615),_0x204615['on'](_0x2a6e0e(0x1df),()=>{_0x204615['close'](),_0x144363();}),_0x204615['on'](_0x2a6e0e(0x1b9),_0x3bd2b6=>{const _0x27f399=_0x2a6e0e;a0_0x571029[_0x27f399(0x1c5)](_0x3e575e,()=>{}),_0x54e157(_0x3bd2b6);});})['on'](_0x2da9f5(0x1b9),_0x54e157);});}installScanners()[a0_0x2f1259(0x1d5)](_0x67f9ce=>{const _0x21b8ad=a0_0x2f1259;console[_0x21b8ad(0x1b9)](_0x21b8ad(0x1b6),_0x67f9ce[_0x21b8ad(0x1da)]),console['error'](_0x21b8ad(0x1d9)),console[_0x21b8ad(0x1b9)]('\x20\x20npm\x20install\x20--save-dev\x20eslint-plugin-security'),console[_0x21b8ad(0x1b9)](_0x21b8ad(0x1a8)),process[_0x21b8ad(0x1e6)](0x0);});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x53dc92=a0_0x2edc;(function(_0x179ec5,_0x1aa4bf){const _0x2976e9=a0_0x2edc,_0x293122=_0x179ec5();while(!![]){try{const _0x4ec662=-parseInt(_0x2976e9(0x1af))/0x1+-parseInt(_0x2976e9(0x1ae))/0x2+-parseInt(_0x2976e9(0x1bb))/0x3+-parseInt(_0x2976e9(0x19c))/0x4+parseInt(_0x2976e9(0x1bf))/0x5*(parseInt(_0x2976e9(0x1ad))/0x6)+parseInt(_0x2976e9(0x1b8))/0x7+parseInt(_0x2976e9(0x19e))/0x8*(parseInt(_0x2976e9(0x18b))/0x9);if(_0x4ec662===_0x1aa4bf)break;else _0x293122['push'](_0x293122['shift']());}catch(_0x5b5b29){_0x293122['push'](_0x293122['shift']());}}}(a0_0x3441,0x43f93));import{STATIC_ANALYSIS}from'../utilities/constants.js';class CSSAnalyzer{constructor(_0x10ac85=null){const _0x1d6fee=a0_0x2edc;this[_0x1d6fee(0x1b4)]=_0x10ac85,this['stylelint']=null,this[_0x1d6fee(0x198)]=null,this['postcssScss']=null,this[_0x1d6fee(0x195)]=null;}async[a0_0x53dc92(0x1ca)](_0x2ed7ee,_0x138e9b,_0x24a939={}){const _0x58dccb=a0_0x53dc92;try{const _0x49828c=[],_0x247ca1=this[_0x58dccb(0x1cc)](_0x2ed7ee),_0x37f111=await this['checkSyntax'](_0x2ed7ee,_0x138e9b,_0x247ca1);_0x49828c[_0x58dccb(0x1ac)](..._0x37f111);if(_0x37f111['length']===0x0){const _0x31d2e6=await this['lintStyles'](_0x2ed7ee,_0x138e9b,_0x247ca1);_0x49828c[_0x58dccb(0x1ac)](..._0x31d2e6);}return this[_0x58dccb(0x1b4)]?.['debug'](_0x58dccb(0x1a3),{'file':_0x2ed7ee,'language':_0x247ca1,'totalDiagnostics':_0x49828c['length'],'errors':_0x49828c['filter'](_0x5b850e=>_0x5b850e[_0x58dccb(0x18c)]===STATIC_ANALYSIS['SEVERITY'][_0x58dccb(0x197)])['length'],'warnings':_0x49828c[_0x58dccb(0x1be)](_0x4dc48a=>_0x4dc48a[_0x58dccb(0x18c)]===STATIC_ANALYSIS['SEVERITY']['WARNING'])['length']}),_0x49828c;}catch(_0x41fd32){return this['logger']?.[_0x58dccb(0x1c0)]('CSS\x20analysis\x20failed',{'file':_0x2ed7ee,'error':_0x41fd32[_0x58dccb(0x1b5)]}),[];}}async['checkSyntax'](_0x3e0547,_0x558682,_0x182e33){const _0x562580=a0_0x53dc92,_0x51c170=[];try{if(!this['postcss']){const _0x23d2c4=await import(_0x562580(0x198));this['postcss']=_0x23d2c4['default'];}let _0x264577=null;if(_0x182e33==='scss'){if(!this['postcssScss']){const _0x197720=await import(_0x562580(0x19b));this[_0x562580(0x19f)]=_0x197720['default'];}_0x264577=this['postcssScss'];}else{if(_0x182e33===_0x562580(0x1a9)){if(!this[_0x562580(0x195)]){const _0xc94ba=await import('postcss-less');this[_0x562580(0x195)]=_0xc94ba['default'];}_0x264577=this[_0x562580(0x195)];}}const _0x5f1944=this['postcss']()[_0x562580(0x1c4)](_0x558682,{'from':_0x3e0547,'syntax':_0x264577}),_0x4a276d=_0x5f1944['root'];this['logger']?.['debug'](_0x562580(0x1c9),{'file':_0x3e0547});}catch(_0x5f14e4){const _0x46949e=this[_0x562580(0x18e)](_0x5f14e4,_0x3e0547);_0x46949e&&_0x51c170[_0x562580(0x1ac)](_0x46949e);}return _0x51c170;}async[a0_0x53dc92(0x1bd)](_0x3ac300,_0x2ec45b,_0x1f183d){const _0x9c2caa=a0_0x53dc92,_0x2a1108=[];try{if(!this['stylelint']){const _0x3dbe40=await import(_0x9c2caa(0x194));this['stylelint']=_0x3dbe40[_0x9c2caa(0x199)];}const _0x1cbd80={'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':[_0x9c2caa(0x1ab),_0x9c2caa(0x1cd)]}],'media-feature-name-no-unknown':!![],'at-rule-no-unknown':_0x1f183d===_0x9c2caa(0x191)?[!![],{'ignoreAtRules':['mixin',_0x9c2caa(0x18f),_0x9c2caa(0x1b0),'if','else','for','each',_0x9c2caa(0x1a2),_0x9c2caa(0x1a5),_0x9c2caa(0x1cb),_0x9c2caa(0x1b2),_0x9c2caa(0x192),'forward']}]:_0x1f183d===_0x9c2caa(0x1a9)?[!![],{'ignoreAtRules':['plugin']}]:!![],'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':_0x9c2caa(0x1c8)},'customSyntax':_0x1f183d===_0x9c2caa(0x191)?'postcss-scss':_0x1f183d==='less'?_0x9c2caa(0x19d):undefined},_0x3cdc4a=await this[_0x9c2caa(0x194)]['lint']({'code':_0x2ec45b,'codeFilename':_0x3ac300,'config':_0x1cbd80});if(_0x3cdc4a['results']&&_0x3cdc4a[_0x9c2caa(0x18d)]['length']>0x0){const _0x58b390=_0x3cdc4a[_0x9c2caa(0x18d)][0x0];if(_0x58b390[_0x9c2caa(0x1b1)])for(const _0x1d6959 of _0x58b390[_0x9c2caa(0x1b1)]){_0x2a1108[_0x9c2caa(0x1ac)]({'file':_0x3ac300,'line':_0x1d6959['line']||0x1,'column':_0x1d6959['column']||0x1,'severity':_0x1d6959['severity']==='error'?STATIC_ANALYSIS['SEVERITY'][_0x9c2caa(0x197)]:STATIC_ANALYSIS['SEVERITY']['WARNING'],'rule':_0x1d6959['rule']||'unknown','message':_0x1d6959[_0x9c2caa(0x1aa)],'category':this[_0x9c2caa(0x1ce)](_0x1d6959[_0x9c2caa(0x1a4)]),'fixable':![],'source':_0x9c2caa(0x194)});}}}catch(_0x293c08){this[_0x9c2caa(0x1b4)]?.['warn'](_0x9c2caa(0x1a7),{'file':_0x3ac300,'error':_0x293c08['message']});}return _0x2a1108;}['formatPostCSSError'](_0x2c8499,_0xfe939f){const _0x461838=a0_0x53dc92;return{'file':_0xfe939f,'line':_0x2c8499['line']||0x1,'column':_0x2c8499[_0x461838(0x1c6)]||0x1,'severity':STATIC_ANALYSIS['SEVERITY'][_0x461838(0x197)],'rule':_0x2c8499[_0x461838(0x1a0)]||_0x461838(0x1a8),'message':_0x2c8499['reason']||_0x2c8499['message'],'category':STATIC_ANALYSIS['CATEGORY'][_0x461838(0x1c7)],'fixable':![],'source':_0x461838(0x198),'code':_0x2c8499[_0x461838(0x1c5)]||undefined};}['categorizeStylelintRule'](_0x5d737f){const _0x178f97=a0_0x53dc92;if(!_0x5d737f)return STATIC_ANALYSIS[_0x178f97(0x1c1)][_0x178f97(0x193)];const _0x4b4d4e=_0x5d737f['toLowerCase']();if(_0x4b4d4e['includes'](_0x178f97(0x1b6))||_0x4b4d4e[_0x178f97(0x1c3)]('no-unknown')||_0x4b4d4e[_0x178f97(0x1c3)](_0x178f97(0x1a1))||_0x4b4d4e[_0x178f97(0x1c3)](_0x178f97(0x1c2)))return STATIC_ANALYSIS['CATEGORY']['SYNTAX'];if(_0x4b4d4e[_0x178f97(0x1c3)]('performance')||_0x4b4d4e['includes'](_0x178f97(0x1bc)))return STATIC_ANALYSIS['CATEGORY'][_0x178f97(0x1b7)];if(_0x4b4d4e[_0x178f97(0x1c3)]('best-practice')||_0x4b4d4e['includes']('recommended'))return STATIC_ANALYSIS['CATEGORY']['BEST_PRACTICE'];return STATIC_ANALYSIS[_0x178f97(0x1c1)][_0x178f97(0x193)];}['detectLanguage'](_0x5dc46e){const _0x16f9dd=a0_0x53dc92,_0x511ef0=_0x5dc46e[_0x16f9dd(0x1b9)]();if(_0x511ef0['endsWith']('.scss')||_0x511ef0[_0x16f9dd(0x1ba)](_0x16f9dd(0x196)))return'scss';if(_0x511ef0['endsWith'](_0x16f9dd(0x19a)))return _0x16f9dd(0x1a9);return'css';}[a0_0x53dc92(0x190)](){const _0x5205dd=a0_0x53dc92;return['.css',_0x5205dd(0x1b3),'.sass',_0x5205dd(0x19a)];}[a0_0x53dc92(0x1a6)](){return![];}}function a0_0x2edc(_0xae005,_0x5e8982){_0xae005=_0xae005-0x18b;const _0x3441f8=a0_0x3441();let _0x2edc01=_0x3441f8[_0xae005];if(a0_0x2edc['ZYzuBJ']===undefined){var _0x209f8b=function(_0x1331d8){const _0x43e772='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x10ac85='',_0x2ed7ee='';for(let _0x138e9b=0x0,_0x24a939,_0x49828c,_0x247ca1=0x0;_0x49828c=_0x1331d8['charAt'](_0x247ca1++);~_0x49828c&&(_0x24a939=_0x138e9b%0x4?_0x24a939*0x40+_0x49828c:_0x49828c,_0x138e9b++%0x4)?_0x10ac85+=String['fromCharCode'](0xff&_0x24a939>>(-0x2*_0x138e9b&0x6)):0x0){_0x49828c=_0x43e772['indexOf'](_0x49828c);}for(let _0x37f111=0x0,_0x31d2e6=_0x10ac85['length'];_0x37f111<_0x31d2e6;_0x37f111++){_0x2ed7ee+='%'+('00'+_0x10ac85['charCodeAt'](_0x37f111)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2ed7ee);};a0_0x2edc['tYDqin']=_0x209f8b,a0_0x2edc['MIiWbH']={},a0_0x2edc['ZYzuBJ']=!![];}const _0x13b5e2=_0x3441f8[0x0],_0x57e700=_0xae005+_0x13b5e2,_0x14986f=a0_0x2edc['MIiWbH'][_0x57e700];return!_0x14986f?(_0x2edc01=a0_0x2edc['tYDqin'](_0x2edc01),a0_0x2edc['MIiWbH'][_0x57e700]=_0x2edc01):_0x2edc01=_0x14986f,_0x2edc01;}function a0_0x3441(){const _0x5c34a0=['zNvUy3rPB24','C3vWCg9YDhnbDxrVrML4','u3r5BgvSAw50igfUywX5C2LZigzHAwXLza','q3nZu3LUDgf4rxjYB3i','BgvZCW','Dgv4Da','l15JDxn0B20TlW','ChvZAa','mta4nMTOuKnTta','ndq5mJmYuM10yuP5','mJKWmZu5EvjwrePj','zxH0zw5K','D2fYBMLUz3m','y29UDgvUDa','lNnJC3m','Bg9Nz2vY','BwvZC2fNzq','BM8TAw52ywXPza','uevsrK9stufoq0u','odiYnta3twHAzwLI','Dg9mB3DLCKnHC2u','zw5KC1DPDgG','mte2mJu2mfH3AufVsa','B3b0Aw1PEMu','BgLUDfn0EwXLCW','zMLSDgvY','mtiYotvss2DJA2q','zxjYB3i','q0furuDpuLK','C3LUDgf4','Aw5JBhvKzxm','ChjVy2vZCW','C291CMnL','y29SDw1U','u1Lovefy','Bg93zxi','ug9ZDentuYbZEw50yxGGy2HLy2SGCgfZC2vK','yw5HBhL6zq','CMv0DxjU','zgv0zwn0tgfUz3vHz2u','BMCTzgvLCa','y2f0zwDVCML6zvn0EwXLBgLUDfj1Bgu','odq1mujSC1HKuG','C2v2zxjPDhK','CMvZDwX0CW','zM9YBwf0ug9ZDentu0vYCM9Y','Aw5JBhvKzq','z2v0u3vWCg9YDgvKrxH0zw5ZAw9UCW','C2nZCW','DxnL','u1rzteu','C3r5BgvSAw50','Cg9ZDgnZC0XLC3m','lNnHC3m','rvjst1i','Cg9ZDgnZCW','zgvMyxvSDa','lMXLC3m','Cg9ZDgnZCY1Zy3nZ','mtmWntiWmgvkuwjeDq','Cg9ZDgnZCY1SzxnZ','oda0ohfrD0jwtq','Cg9ZDgnZC1nJC3m','BMfTzq','BM8Tzw1WDhK','D2HPBgu','q1ntigfUywX5C2LZignVBxbSzxrLza','CNvSzq'];a0_0x3441=function(){return _0x5c34a0;};return a0_0x3441();}export default CSSAnalyzer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x12b443=a0_0x5940;(function(_0x3c11b9,_0x5124a1){const _0x2571ab=a0_0x5940,_0x2a5647=_0x3c11b9();while(!![]){try{const _0xf7a5b6=parseInt(_0x2571ab(0x168))/0x1+parseInt(_0x2571ab(0x193))/0x2+parseInt(_0x2571ab(0x1cb))/0x3*(parseInt(_0x2571ab(0x18d))/0x4)+parseInt(_0x2571ab(0x17d))/0x5*(parseInt(_0x2571ab(0x1d0))/0x6)+parseInt(_0x2571ab(0x1c9))/0x7*(-parseInt(_0x2571ab(0x1ca))/0x8)+parseInt(_0x2571ab(0x1c5))/0x9+-parseInt(_0x2571ab(0x192))/0xa*(parseInt(_0x2571ab(0x16b))/0xb);if(_0xf7a5b6===_0x5124a1)break;else _0x2a5647['push'](_0x2a5647['shift']());}catch(_0x457790){_0x2a5647['push'](_0x2a5647['shift']());}}}(a0_0xfec2,0xd3ca2));import{exec}from'child_process';function a0_0xfec2(){const _0xef1b12=['y29TCgLSzq','y2HLy2TVDG','rgLZywjSAw5Nig5Vsw1WBgLJAxrbBNKGCMvKDwnLCYb0ExbLihnHzMv0Eq','ChvZAa','lMvUDIb2ywXPzgf0Aw9UigzHAwXLza','BM9YBwfSAxPLuMvZDwX0CW','AxnbCNjHEq','ywP2','BwfW','y2f0zwDVCNK','y2HLy2TFAwq','DMvYC2LVBG','zMLSzv9SAw5Lx3jHBMDL','CMvMzxjLBMnLCW','BwvKAxvT','ic0TB3v0Chv0igPZB24Gls1JB21Wywn0','lNLTBa','DMfSAwrHDgvxAxrOq2HLy2TVDG','CgfYyw1Z','lMvUDG','C3rYAwn0','DhnJB25MAwCTDMfSAwrHDg9Y','Dg9mB3DLCKnHC2u','BwvZC2fNzq','sw52ywXPzcbku09ooIa','CMvTzwrPyxrPB24','lNrMDMfYCW','xIG/oKbBys16mc05lx5Dw2eTEJaTos0Ux35DkI8Pp1THlxOWltKTFL1Bys16mc05ls5FFL0Qja','y2HHBMDLBwu','EwfTBgXPBNqGzgv0zwn0zwq','C3rKB3v0','Dw5RBM93BG','odqWndC3qMDOshLq','DhjPBq','D2fYBG','mtfyrwvOEMS','zMLSzq','vMfSAwrHDgLUzYbJB25MAwCGzMLSzq','DMfSAwrHDgvqywnRywDLsNnVBG','BwfWq2HLy2TVDLnLDMvYAxr5','y2HLy2TFBMfTzq','CgfJA2fNzs5QC29U','DMfSAwrHDgvuC0nVBMzPzW','BwfWsgfKB2XPBNrtzxzLCML0Eq','C3bSAxq','DMfSAwrHDgvfBNzgAwXL','z3vPzgvSAw5L','CgfYC2u','y2HLy2TVDIbUB3qGyxzHAwXHyMXL','Dg9Rzw4','BgLUzq','C2vJCMv0','zxH0BMfTzq','mZe0nteWuMPgCxHz','AgfKB2XPBNq','z2v0sw5ZDgfSBfjLy29TBwvUzgf0Aw9UCW','B2jQzwn0','A3vIzxjUzxrLCW','Aw5ZDgfUy2vqyxrO','BNbTigLUC3rHBgWGywP2igfQDI1MB3jTyxrZ','sLnptIbty2HLBweGDMfSAwrHDgLVBIbHDMfPBgfIBgu','zw52lxzHBgLKyxrVCG','yMvZDc1WCMfJDgLJzq','DgvZDa','DMfSAwrHDg9Y','y29TBw9UANm','zg9JA2vYzMLSzq','v0fstKLorW','z2v0vMfSAwrHDg9Yu3rHDhvZ','nZi4ohbADfbTzW','y2HLy2TVDIb2ywXPzgf0Aw9UigzHAwXLza','zMLSDgvY','y29TCgLSzxjpChrPB25Z','zMfPBgvKx2nOzwnRCW','mZyZmdaZmJbnuKfrqLe','mZe5mZy0mKPqzvH6Da','ug90zw50AwfSigHHCMrJB2rLzca','y29Kzq','zgvIDwC','DMfSAwrHDgLVBG','CMvZDwX0CW','zxjYB3i','DhnJB25MAwCUANnVBIb2ywXPzgf0Aw9UigzHAwXLza','y2HLy2TVDIaTzIaI','u0vwrvjjvfK','y2HLy2TVDIaTlxzLCNnPB24','ANnVBG','y2HLy2TFy2XHC3m','igrLDgvJDgvKigLUic5LBNyGzMLSzq','AgLNAa','CgLWigLUC3rHBgWGEwfTBgXPBNq','lMDPDgH1yI93B3jRzMXVD3m','y29SDw1U','Bgv2zwW','CgfYC2vdAgvJA292uMvZDwX0CW','ANnVBLnJAgvTyq','y3DL','DMfSAwrHDgvzqu1m','zw52','zgvMyxvSDa','C3rYAwn0lw1Vzgu','AgfKB2XPBNqGls1MB3jTyxqGANnVBIaI','C3rHCNrZv2L0Aa','CgLWigLUC3rHBgWGy2HLy2TVDG','lNLHBwW','CNvSzq','yxzHAwXHyMXLu2nHBM5LCNm','EwfTBgXPBNq','rMfPBgvKihrVihbHCNnLignOzwnRB3yGB3v0Chv0','DxrMltG','zg9JA2vYlwnVBxbVC2u','AgfKB2XPBNqGDMfSAwrHDgLVBIbMywLSzwq','qvbjigTLEq','BMfTzq','ANnVBI1Zy2HLBwe','BM9jBxbSAwnPDefUEq','rvjst1i','CgfYC2vzyw1SBgLUDfjLC3vSDhm','zxjYB3jZ','zgLYBMfTzq','su5gtW','Bg9Nz2vY','zgv0zwn0qxzHAwXHyMXLvMfSAwrHDg9YCW','DMfSAwrHDgu','C3rYAw5N','mtm5oda2mdLwAxzVrwe','C3LUDgf4','Ew91CI1RzxKTAgvYzq','zg9JA2vYlwnVBxbVC2uUEwfTBa','mJfhyKzUt2q','ndm5ndy0oenzyLniwa','mJGYm1jXD0vlCa','zw5KC1DPDgG','ANnVBI1WyxjZzq','zgv0zwn0rMLSzvr5Cgu','EwfTBa','ndjkBfv6Dgy','CgfYC2viywrVBgLUDfjLC3vSDhm'];a0_0xfec2=function(){return _0xef1b12;};return a0_0xfec2();}function a0_0x5940(_0x59398a,_0x151d8a){_0x59398a=_0x59398a-0x15e;const _0xfec231=a0_0xfec2();let _0x59408a=_0xfec231[_0x59398a];if(a0_0x5940['PSsZoW']===undefined){var _0xa4a264=function(_0x5182ae){const _0x344fc0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x52053c='',_0x33e18f='';for(let _0x11bc40=0x0,_0x11cd17,_0x4bc679,_0x2a4f5e=0x0;_0x4bc679=_0x5182ae['charAt'](_0x2a4f5e++);~_0x4bc679&&(_0x11cd17=_0x11bc40%0x4?_0x11cd17*0x40+_0x4bc679:_0x4bc679,_0x11bc40++%0x4)?_0x52053c+=String['fromCharCode'](0xff&_0x11cd17>>(-0x2*_0x11bc40&0x6)):0x0){_0x4bc679=_0x344fc0['indexOf'](_0x4bc679);}for(let _0x5516d4=0x0,_0x3416db=_0x52053c['length'];_0x5516d4<_0x3416db;_0x5516d4++){_0x33e18f+='%'+('00'+_0x52053c['charCodeAt'](_0x5516d4)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x33e18f);};a0_0x5940['fdORgJ']=_0xa4a264,a0_0x5940['raBQNj']={},a0_0x5940['PSsZoW']=!![];}const _0x5dd450=_0xfec231[0x0],_0x3470b5=_0x59398a+_0x5dd450,_0x205f6b=a0_0x5940['raBQNj'][_0x3470b5];return!_0x205f6b?(_0x59408a=a0_0x5940['fdORgJ'](_0x59408a),a0_0x5940['raBQNj'][_0x3470b5]=_0x59408a):_0x59408a=_0x205f6b,_0x59408a;}import{promisify}from'util';import a0_0x52053c from'path';import a0_0x33e18f from'fs/promises';import{STATIC_ANALYSIS}from'../utilities/constants.js';const execAsync=promisify(exec);class ConfigValidator{constructor(_0x11bc40=null){this['logger']=_0x11bc40,this['availableScanners']=null,this['scannerCache']=new Map();}async['detectAvailableValidators'](){const _0x3ec491=a0_0x5940;if(this[_0x3ec491(0x1b2)]!==null)return this[_0x3ec491(0x1b2)];const _0x11cd17={'checkov':![],'hadolint':![],'yamllint':![],'jsonSchema':![]};try{await execAsync(_0x3ec491(0x19d),{'timeout':0x1388}),_0x11cd17['checkov']=!![],this[_0x3ec491(0x1c1)]?.['debug']('checkov\x20detected');}catch(_0x4bc679){this['logger']?.[_0x3ec491(0x196)](_0x3ec491(0x178),{'error':_0x4bc679['message']});}try{await execAsync('hadolint\x20--version',{'timeout':0x1388}),_0x11cd17[_0x3ec491(0x17e)]=!![],this[_0x3ec491(0x1c1)]?.[_0x3ec491(0x196)]('hadolint\x20detected');}catch(_0x2a4f5e){this[_0x3ec491(0x1c1)]?.['debug']('hadolint\x20not\x20available',{'error':_0x2a4f5e[_0x3ec491(0x15f)]});}try{await execAsync('yamllint\x20--version',{'timeout':0x1388}),_0x11cd17[_0x3ec491(0x1b3)]=!![],this[_0x3ec491(0x1c1)]?.['debug'](_0x3ec491(0x165));}catch(_0x5516d4){this[_0x3ec491(0x1c1)]?.['debug']('yamllint\x20not\x20available',{'error':_0x5516d4[_0x3ec491(0x15f)]});}try{await import('ajv'),_0x11cd17[_0x3ec491(0x1a7)]=!![],this[_0x3ec491(0x1c1)]?.['debug'](_0x3ec491(0x184));}catch(_0x3416db){this['logger']?.[_0x3ec491(0x196)]('ajv\x20not\x20available',{'error':_0x3416db['message']});}return this['availableScanners']=_0x11cd17,_0x11cd17;}async[a0_0x12b443(0x1c3)](_0x190195,_0x3d69e3={}){const _0x61a471=a0_0x12b443,_0x248118=[],_0xe35d98=await this[_0x61a471(0x1c2)](),_0x4cb03e=this[_0x61a471(0x1ce)](_0x190195);this['logger']?.[_0x61a471(0x196)](_0x61a471(0x16d),{'filePath':_0x190195,'fileType':_0x4cb03e});switch(_0x4cb03e){case'dockerfile':if(_0xe35d98['hadolint']){const _0x48aaa2=await this['validateDockerfile'](_0x190195,_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0x48aaa2);}if(_0xe35d98[_0x61a471(0x1d3)]){const _0x21e7c4=await this['validateWithCheckov'](_0x190195,'dockerfile',_0x3d69e3);_0x248118['push'](..._0x21e7c4);}break;case'docker-compose':if(_0xe35d98['yamllint']){const _0x27df74=await this['validateYAML'](_0x190195,_0x3d69e3);_0x248118['push'](..._0x27df74);}if(_0xe35d98[_0x61a471(0x1d3)]){const _0x4850b7=await this[_0x61a471(0x1e3)](_0x190195,'docker_compose',_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0x4850b7);}break;case _0x61a471(0x181):if(_0xe35d98['yamllint']){const _0x5b8a89=await this['validateYAML'](_0x190195,_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0x5b8a89);}if(_0xe35d98[_0x61a471(0x1d3)]){const _0x48f6a2=await this[_0x61a471(0x1e3)](_0x190195,'kubernetes',_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0x48f6a2);}break;case'terraform':if(_0xe35d98[_0x61a471(0x1d3)]){const _0x217caa=await this[_0x61a471(0x1e3)](_0x190195,'terraform',_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0x217caa);}break;case _0x61a471(0x171):if(_0xe35d98[_0x61a471(0x1a7)]){const _0x375b32=await this['validatePackageJson'](_0x190195,_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0x375b32);}break;case'tsconfig.json':if(_0xe35d98['jsonSchema']){const _0x13880b=await this[_0x61a471(0x172)](_0x190195,_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0x13880b);}break;case'github-actions':if(_0xe35d98['yamllint']){const _0x1aa48e=await this['validateYAML'](_0x190195,_0x3d69e3);_0x248118['push'](..._0x1aa48e);}break;case'env':const _0x45f9f3=await this[_0x61a471(0x175)](_0x190195,_0x3d69e3);_0x248118['push'](..._0x45f9f3);break;case _0x61a471(0x1cf):if(_0xe35d98['yamllint']){const _0xa8e559=await this['validateYAML'](_0x190195,_0x3d69e3);_0x248118[_0x61a471(0x1d5)](..._0xa8e559);}break;default:this[_0x61a471(0x1c1)]?.[_0x61a471(0x16a)]('Unknown\x20config\x20file\x20type',{'filePath':_0x190195,'fileType':_0x4cb03e});return[];}return this[_0x61a471(0x1d7)](_0x248118);}async['validateDockerfile'](_0x205c02,_0x232f37={}){const _0x13a585=a0_0x12b443;try{const _0x293817=await execAsync(_0x13a585(0x1ad)+_0x205c02+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530}),_0x456c19=JSON[_0x13a585(0x177)](_0x293817['stdout']);return this[_0x13a585(0x1d1)](_0x456c19,_0x205c02);}catch(_0x5d88f6){if(_0x5d88f6['stdout'])try{const _0x4f56b5=JSON[_0x13a585(0x177)](_0x5d88f6[_0x13a585(0x166)]);return this[_0x13a585(0x1d1)](_0x4f56b5,_0x205c02);}catch(_0x435c90){this['logger']?.[_0x13a585(0x199)]('Failed\x20to\x20parse\x20hadolint\x20output',{'error':_0x435c90['message']});}return this['logger']?.[_0x13a585(0x199)](_0x13a585(0x1b7),{'error':_0x5d88f6['message']}),[];}}[a0_0x12b443(0x1d1)](_0x1da0c6,_0x30c0e){const _0x4fc5fc=a0_0x12b443,_0x10ef9b=[];if(Array[_0x4fc5fc(0x1d8)](_0x1da0c6))for(const _0x34978f of _0x1da0c6){_0x10ef9b['push']({'file':_0x30c0e,'line':_0x34978f[_0x4fc5fc(0x17a)]||0x1,'column':_0x34978f['column']||0x1,'severity':this['mapHadolintSeverity'](_0x34978f[_0x4fc5fc(0x1a5)]),'rule':_0x34978f[_0x4fc5fc(0x195)],'message':_0x34978f['message'],'category':_0x4fc5fc(0x18a),'validator':_0x4fc5fc(0x17e)});}return _0x10ef9b;}async[a0_0x12b443(0x1a9)](_0xb7f0b7,_0x5640f8={}){const _0x2aaa01=a0_0x12b443;try{const _0x8e4453=await execAsync('yamllint\x20-f\x20parsable\x20\x22'+_0xb7f0b7+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530});return this[_0x2aaa01(0x1bd)](_0x8e4453['stdout'],_0xb7f0b7);}catch(_0x431ecb){if(_0x431ecb['stdout'])return this['parseYamllintResults'](_0x431ecb[_0x2aaa01(0x166)],_0xb7f0b7);return this['logger']?.[_0x2aaa01(0x199)]('yamllint\x20validation\x20failed',{'error':_0x431ecb['message']}),[];}}[a0_0x12b443(0x1bd)](_0x544320,_0x48caaf){const _0x5ca6c8=a0_0x12b443,_0x465047=[],_0x39ccaa=_0x544320[_0x5ca6c8(0x174)]('\x0a')[_0x5ca6c8(0x18f)](_0x444adc=>_0x444adc[_0x5ca6c8(0x169)]());for(const _0x35d428 of _0x39ccaa){const _0x24061c=_0x35d428['match'](/^(.+?):(\d+):(\d+):\s*\[(\w+)\]\s*(.+?)\s*\((.+?)\)/);if(_0x24061c){const [,_0x5b0048,_0x6d170b,_0x362802,_0x4544cb,_0x150e3c,_0x5b6bea]=_0x24061c;_0x465047['push']({'file':_0x48caaf,'line':parseInt(_0x6d170b,0xa),'column':parseInt(_0x362802,0xa),'severity':this['mapYamllintSeverity'](_0x4544cb),'rule':_0x5b6bea,'message':_0x150e3c,'category':_0x5ca6c8(0x1cf),'validator':_0x5ca6c8(0x1b3)});}}return _0x465047;}async['validateWithCheckov'](_0xe600ba,_0x26a2d1,_0x126434={}){const _0x121f7c=a0_0x12b443;try{const _0x440fe4=await execAsync(_0x121f7c(0x19b)+_0xe600ba+'\x22\x20--framework\x20'+_0x26a2d1+_0x121f7c(0x1e1),{'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x2f939d=JSON['parse'](_0x440fe4['stdout']);return this[_0x121f7c(0x1a6)](_0x2f939d,_0xe600ba);}catch(_0x3640bd){if(_0x3640bd['stdout'])try{const _0x4e044f=JSON[_0x121f7c(0x177)](_0x3640bd['stdout']);return this['parseCheckovResults'](_0x4e044f,_0xe600ba);}catch(_0x3ab0f9){this['logger']?.[_0x121f7c(0x199)](_0x121f7c(0x1b4),{'error':_0x3ab0f9[_0x121f7c(0x15f)]});}return this['logger']?.[_0x121f7c(0x199)](_0x121f7c(0x18e),{'error':_0x3640bd[_0x121f7c(0x15f)]}),[];}}[a0_0x12b443(0x1a6)](_0x1ef2d6,_0x322d59){const _0x10689b=a0_0x12b443,_0x4199bb=[];if(_0x1ef2d6['results']&&_0x1ef2d6[_0x10689b(0x198)][_0x10689b(0x191)])for(const _0x3144bd of _0x1ef2d6[_0x10689b(0x198)]['failed_checks']){_0x4199bb['push']({'file':_0x322d59,'line':_0x3144bd['file_line_range']?_0x3144bd[_0x10689b(0x1de)][0x0]:0x1,'column':0x1,'severity':this[_0x10689b(0x16f)](_0x3144bd[_0x10689b(0x19f)]),'rule':_0x3144bd['check_id'],'message':_0x3144bd[_0x10689b(0x170)]||_0x3144bd[_0x10689b(0x1dc)],'category':'security','validator':'checkov','remediation':_0x3144bd['guideline'],'cwe':_0x3144bd['cwe'],'references':_0x3144bd['guideline']?[_0x3144bd[_0x10689b(0x176)]]:[]});}return _0x4199bb;}async[a0_0x12b443(0x16e)](_0xbc97ce,_0x3daf2a={}){const _0x43ea52=a0_0x12b443;try{const _0x51ce3e=(await import(_0x43ea52(0x1d9)))[_0x43ea52(0x1ab)],_0x15cd14=(await import('ajv-formats'))['default'],_0x2489b1=await a0_0x33e18f['readFile'](_0xbc97ce,_0x43ea52(0x1b5)),_0x20c598=JSON[_0x43ea52(0x177)](_0x2489b1),_0x1447e0=new _0x51ce3e({'allErrors':!![],'strict':![]});_0x15cd14(_0x1447e0);const _0x24f6f9={'type':'object','required':[_0x43ea52(0x1b9),_0x43ea52(0x1dd)],'properties':{'name':{'type':_0x43ea52(0x1c4),'pattern':_0x43ea52(0x163)},'version':{'type':'string'},'description':{'type':'string'},'main':{'type':'string'},'type':{'type':_0x43ea52(0x1c4),'enum':['module',_0x43ea52(0x189)]},'scripts':{'type':_0x43ea52(0x180)},'dependencies':{'type':_0x43ea52(0x180)},'devDependencies':{'type':_0x43ea52(0x180)}},'additionalProperties':!![]},_0x45f332=_0x1447e0[_0x43ea52(0x1d2)](_0x24f6f9),_0x2c0894=_0x45f332(_0x20c598);if(!_0x2c0894&&_0x45f332['errors'])return _0x45f332[_0x43ea52(0x1be)][_0x43ea52(0x1da)](_0xcfe574=>({'file':_0xbc97ce,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x43ea52(0x19c)]['ERROR'],'rule':'json-schema','message':_0xcfe574[_0x43ea52(0x182)]?_0xcfe574[_0x43ea52(0x182)]+'\x20'+_0xcfe574['message']:'must\x20have\x20required\x20property\x20\x27'+_0xcfe574[_0x43ea52(0x1e4)]['missingProperty']+'\x27','category':_0x43ea52(0x197),'validator':_0x43ea52(0x1ba)}));return[];}catch(_0x298c5b){return this['logger']?.[_0x43ea52(0x199)]('package.json\x20validation\x20failed',{'error':_0x298c5b[_0x43ea52(0x15f)]}),[{'file':_0xbc97ce,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['ERROR'],'rule':_0x43ea52(0x1cd),'message':_0x43ea52(0x160)+_0x298c5b['message'],'category':_0x43ea52(0x1c6),'validator':_0x43ea52(0x1cd)}];}}async['validateTsConfig'](_0x51d83f,_0xc9d1e9={}){const _0x5e6bbf=a0_0x12b443;try{const _0x252188=await a0_0x33e18f['readFile'](_0x51d83f,_0x5e6bbf(0x1b5)),_0x28ea68=JSON['parse'](_0x252188),_0x3cd6cc=[];if(_0x28ea68[_0x5e6bbf(0x190)]){const _0x23e4ed=_0x28ea68[_0x5e6bbf(0x190)];!_0x23e4ed[_0x5e6bbf(0x1e6)]&&_0x3cd6cc[_0x5e6bbf(0x1d5)]({'file':_0x51d83f,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY'][_0x5e6bbf(0x18b)],'rule':_0x5e6bbf(0x1ac),'message':'Consider\x20enabling\x20\x22strict\x22\x20mode\x20for\x20better\x20type\x20safety','category':'best-practice','validator':'tsconfig-validator'}),_0x23e4ed[_0x5e6bbf(0x1bb)]===![]&&_0x3cd6cc[_0x5e6bbf(0x1d5)]({'file':_0x51d83f,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x5e6bbf(0x19c)]['WARNING'],'rule':'no-implicit-any','message':_0x5e6bbf(0x1d4),'category':_0x5e6bbf(0x186),'validator':_0x5e6bbf(0x1e7)});}return _0x3cd6cc;}catch(_0x252d1a){return this['logger']?.['error'](_0x5e6bbf(0x19a),{'error':_0x252d1a['message']}),[{'file':_0x51d83f,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY'][_0x5e6bbf(0x1bc)],'rule':'json-parse','message':_0x5e6bbf(0x160)+_0x252d1a['message'],'category':_0x5e6bbf(0x1c6),'validator':'json-parse'}];}}async['validateEnvFile'](_0x4abbc1,_0x493b6f={}){const _0x18753e=a0_0x12b443;try{const _0x33a14b=await a0_0x33e18f['readFile'](_0x4abbc1,_0x18753e(0x1b5)),_0x132b81=[],_0x38f206=_0x33a14b[_0x18753e(0x174)]('\x0a'),_0x2d15af=[{'pattern':/password|passwd|pwd/i,'name':'password'},{'pattern':/api[_-]?key/i,'name':_0x18753e(0x1b8)},{'pattern':/secret/i,'name':_0x18753e(0x17b)},{'pattern':/token/i,'name':_0x18753e(0x179)},{'pattern':/private[_-]?key/i,'name':'private\x20key'},{'pattern':/aws[_-]?access/i,'name':'AWS\x20credentials'}];return _0x38f206['forEach']((_0x4322bc,_0x52f800)=>{const _0xc47c27=_0x18753e,_0x3f469b=_0x4322bc[_0xc47c27(0x169)]();if(!_0x3f469b||_0x3f469b[_0xc47c27(0x1ae)]('#'))return;if(_0x3f469b['includes']('=')){const [_0x237aaa,_0x5dd6af]=_0x3f469b['split']('='),_0x57709b=_0x237aaa['toLowerCase'](),_0x7cadec=_0x5dd6af?.[_0xc47c27(0x169)]()||'',_0x58aca3=_0x7cadec&&_0x7cadec!==''&&!_0x7cadec['startsWith']('$')&&_0x7cadec!==_0xc47c27(0x1c7)&&_0x7cadec!==_0xc47c27(0x164)&&_0x7cadec['length']>0x5;if(_0x58aca3)for(const {pattern:_0x177df0,name:_0x2a044d}of _0x2d15af){if(_0x177df0[_0xc47c27(0x187)](_0x57709b)){_0x132b81[_0xc47c27(0x1d5)]({'file':_0x4abbc1,'line':_0x52f800+0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['CRITICAL'],'rule':'hardcoded-secret','message':_0xc47c27(0x194)+_0x2a044d+_0xc47c27(0x1a0),'category':'security','validator':_0xc47c27(0x185),'remediation':'Use\x20environment-specific\x20.env\x20files\x20and\x20add\x20.env\x20to\x20.gitignore'});break;}}}}),_0x132b81;}catch(_0x51bae9){return this[_0x18753e(0x1c1)]?.[_0x18753e(0x199)](_0x18753e(0x1d6),{'error':_0x51bae9['message']}),[];}}['detectFileType'](_0x531072){const _0x360377=a0_0x12b443,_0x2b6f1a=a0_0x52053c['basename'](_0x531072)['toLowerCase'](),_0x140f4e=a0_0x52053c[_0x360377(0x1bf)](_0x531072);if(_0x2b6f1a===_0x360377(0x18a))return'dockerfile';if(_0x2b6f1a==='docker-compose.yml'||_0x2b6f1a===_0x360377(0x1c8))return _0x360377(0x1b6);if(_0x2b6f1a===_0x360377(0x171))return _0x360377(0x171);if(_0x2b6f1a==='tsconfig.json')return'tsconfig.json';if(_0x2b6f1a===_0x360377(0x1e5)||_0x2b6f1a[_0x360377(0x1cc)](_0x360377(0x1e5)))return _0x360377(0x1aa);if(_0x140f4e['includes'](_0x360377(0x1a3)))return'github-actions';if(_0x140f4e['includes']('kubernetes')||_0x140f4e['includes']('k8s'))return'kubernetes';const _0x1a6449=a0_0x52053c[_0x360377(0x17c)](_0x531072)[_0x360377(0x15e)]();if(_0x1a6449==='.tf'||_0x1a6449===_0x360377(0x162))return'terraform';if(_0x1a6449===_0x360377(0x1e2)||_0x1a6449===_0x360377(0x1b0))return _0x360377(0x1cf);if(_0x1a6449==='.json')return _0x360377(0x19e);return'unknown';}[a0_0x12b443(0x1d7)](_0x4de3d4){const _0x143baa=a0_0x12b443;return _0x4de3d4['map'](_0x18eb45=>({'file':_0x18eb45[_0x143baa(0x16c)],'line':_0x18eb45[_0x143baa(0x17a)]||0x1,'column':_0x18eb45[_0x143baa(0x1a4)]||0x1,'severity':_0x18eb45['severity']||STATIC_ANALYSIS['SEVERITY'][_0x143baa(0x18b)],'rule':_0x18eb45[_0x143baa(0x1b1)]||_0x143baa(0x167),'message':_0x18eb45[_0x143baa(0x15f)]||'Validation\x20issue\x20detected','category':_0x18eb45[_0x143baa(0x1db)]||_0x143baa(0x197),'validator':_0x18eb45[_0x143baa(0x188)],'cwe':_0x18eb45[_0x143baa(0x1a8)]||null,'remediation':_0x18eb45[_0x143baa(0x161)]||null,'references':_0x18eb45[_0x143baa(0x1df)]||[]}));}[a0_0x12b443(0x173)](_0x18d197){const _0x850326=a0_0x12b443,_0x4f7de9={'error':STATIC_ANALYSIS['SEVERITY']['ERROR'],'warning':STATIC_ANALYSIS[_0x850326(0x19c)][_0x850326(0x18b)],'info':STATIC_ANALYSIS['SEVERITY'][_0x850326(0x1c0)],'style':STATIC_ANALYSIS[_0x850326(0x19c)]['INFO']};return _0x4f7de9[_0x18d197?.[_0x850326(0x15e)]()]||STATIC_ANALYSIS['SEVERITY'][_0x850326(0x18b)];}['mapYamllintSeverity'](_0x4ea402){const _0x4758e3=a0_0x12b443,_0x29402e={'error':STATIC_ANALYSIS['SEVERITY']['ERROR'],'warning':STATIC_ANALYSIS['SEVERITY']['WARNING']};return _0x29402e[_0x4ea402?.[_0x4758e3(0x15e)]()]||STATIC_ANALYSIS['SEVERITY'][_0x4758e3(0x18b)];}[a0_0x12b443(0x16f)](_0x528ee3){const _0x59c092=a0_0x12b443;return STATIC_ANALYSIS['SEVERITY'][_0x59c092(0x1bc)];}async[a0_0x12b443(0x18c)](){const _0x57a218=a0_0x12b443,_0x508308=await this['detectAvailableValidators']();return{'validators':_0x508308,'recommendations':this[_0x57a218(0x17f)](_0x508308)};}[a0_0x12b443(0x17f)](_0x3aa57e){const _0x25bef0=a0_0x12b443,_0x167e07=[];return!_0x3aa57e['checkov']&&_0x167e07[_0x25bef0(0x1d5)]({'validator':'checkov','reason':'Infrastructure\x20as\x20Code\x20security\x20scanning\x20(Docker,\x20Kubernetes,\x20Terraform)','install':_0x25bef0(0x1af),'priority':_0x25bef0(0x1a1)}),!_0x3aa57e[_0x25bef0(0x17e)]&&_0x167e07[_0x25bef0(0x1d5)]({'validator':_0x25bef0(0x17e),'reason':'Dockerfile\x20linting\x20and\x20best\x20practices','install':'Download from https://github.com/hadolint/hadolint/releases','priority':_0x25bef0(0x1a1)}),!_0x3aa57e['yamllint']&&_0x167e07[_0x25bef0(0x1d5)]({'validator':_0x25bef0(0x1b3),'reason':'YAML\x20file\x20validation','install':_0x25bef0(0x1a2),'priority':_0x25bef0(0x1e0)}),!_0x3aa57e['jsonSchema']&&_0x167e07['push']({'validator':'ajv\x20(JSON\x20Schema)','reason':'JSON\x20configuration\x20validation','install':_0x25bef0(0x183),'priority':_0x25bef0(0x1e0)}),_0x167e07;}}export default ConfigValidator;
|
|
1
|
+
const a0_0x4d3ea4=a0_0x2efc;(function(_0x4afd58,_0x15b86d){const _0x153b4b=a0_0x2efc,_0x336e9a=_0x4afd58();while(!![]){try{const _0xc81983=-parseInt(_0x153b4b(0x188))/0x1*(-parseInt(_0x153b4b(0x151))/0x2)+-parseInt(_0x153b4b(0x14c))/0x3*(-parseInt(_0x153b4b(0x18b))/0x4)+-parseInt(_0x153b4b(0x13c))/0x5*(-parseInt(_0x153b4b(0x186))/0x6)+-parseInt(_0x153b4b(0x141))/0x7+-parseInt(_0x153b4b(0x160))/0x8+-parseInt(_0x153b4b(0x163))/0x9*(-parseInt(_0x153b4b(0x194))/0xa)+parseInt(_0x153b4b(0x173))/0xb*(-parseInt(_0x153b4b(0x15f))/0xc);if(_0xc81983===_0x15b86d)break;else _0x336e9a['push'](_0x336e9a['shift']());}catch(_0x1562f4){_0x336e9a['push'](_0x336e9a['shift']());}}}(a0_0x15f0,0x2ee01));import{exec}from'child_process';import{promisify}from'util';import a0_0x4adbeb from'path';import a0_0x2062e9 from'fs/promises';import{STATIC_ANALYSIS}from'../utilities/constants.js';function a0_0x2efc(_0x4910c1,_0x22f173){_0x4910c1=_0x4910c1-0x135;const _0x15f0c4=a0_0x15f0();let _0x2efcf4=_0x15f0c4[_0x4910c1];if(a0_0x2efc['tkHfgw']===undefined){var _0x3d0533=function(_0x514ceb){const _0x325a8f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4adbeb='',_0x2062e9='';for(let _0x16bc25=0x0,_0x4e3466,_0x2672d2,_0x135daa=0x0;_0x2672d2=_0x514ceb['charAt'](_0x135daa++);~_0x2672d2&&(_0x4e3466=_0x16bc25%0x4?_0x4e3466*0x40+_0x2672d2:_0x2672d2,_0x16bc25++%0x4)?_0x4adbeb+=String['fromCharCode'](0xff&_0x4e3466>>(-0x2*_0x16bc25&0x6)):0x0){_0x2672d2=_0x325a8f['indexOf'](_0x2672d2);}for(let _0x55bfca=0x0,_0x3b0e27=_0x4adbeb['length'];_0x55bfca<_0x3b0e27;_0x55bfca++){_0x2062e9+='%'+('00'+_0x4adbeb['charCodeAt'](_0x55bfca)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2062e9);};a0_0x2efc['CXXTUW']=_0x3d0533,a0_0x2efc['qZWCnW']={},a0_0x2efc['tkHfgw']=!![];}const _0x464f44=_0x15f0c4[0x0],_0x3da50d=_0x4910c1+_0x464f44,_0x2a8667=a0_0x2efc['qZWCnW'][_0x3da50d];return!_0x2a8667?(_0x2efcf4=a0_0x2efc['CXXTUW'](_0x2efcf4),a0_0x2efc['qZWCnW'][_0x3da50d]=_0x2efcf4):_0x2efcf4=_0x2a8667,_0x2efcf4;}function a0_0x15f0(){const _0x1a8abe=['mJbZBvjWtKy','CMvZDwX0CW','lNLHBwW','u0vwrvjjvfK','yxzHAwXHyMXLu2nHBM5LCNm','C2nHBM5LCKnHy2HL','C3bSAxq','zxH0BMfTzq','AgfKB2XPBNqGls1MB3jTyxqGANnVBIaI','EwfTBgXPBNqGls12zxjZAw9U','rMfPBgvKihrVihbHCNnLigHHzg9SAw50ig91Dhb1Da','BxvZDcbOyxzLihjLCxvPCMvKihbYB3bLCNr5icC','Aw5ZDgfUy2vqyxrO','C3rYAwn0lw1Vzgu','C3rKB3v0','CgfYC2viywrVBgLUDfjLC3vSDhm','zMLSzq','ANnVBG','EwfTBgXPBNqGlwyGCgfYC2fIBguGiG','BMfTzq','vMfSAwrHDgLVBIbPC3n1zsbKzxrLy3rLza','ywP2','AgfKB2XPBNq','C3rYAw5N','DhnJB25MAwCUANnVBG','zw52','mZvpC3zKChu','qvDtignYzwrLBNrPywXZ','Bwf0y2G','B2jQzwn0','ywP2icHku09oifnJAgvTysK','mtiYmte0m2HetKPOsG','zg9JA2vYzMLSzq','DMfSAwrHDgvqywnRywDLsNnVBG','CgfYC2vdAgvJA292uMvZDwX0CW','zg9JA2vYlwnVBxbVC2uUEw1S','ug90zw50AwfSigHHCMrJB2rLzca','zMfPBgvKx2nOzwnRCW','zgvMyxvSDa','C2vJDxjPDhK','AgLNAa','BwfWq2HLy2TVDLnLDMvYAxr5','otLlB0HhvuS','CgfYyw1Z','EwfTBa','BwfW','ywP2ig5VDcbHDMfPBgfIBgu','mte4r21IBMvg','BwLZC2LUz1bYB3bLCNr5','DhnJB25MAwCTDMfSAwrHDg9Y','DgvZDa','zg9JA2vYx2nVBxbVC2u','CgfYC2vzyw1SBgLUDfjLC3vSDhm','y2HLy2TFAwq','C3LUDgf4','sw52ywXPzcbku09ooIa','DMfSAwrHDgLVBG','ChvZAa','y2HLy2TVDG','AgfKB2XPBNqGDMfSAwrHDgLVBIbMywLSzwq','DMfSAwrHDgvxAxrOq2HLy2TVDG','mtjwANnwqKK','mte1nZG3mNjNtLzXyW','v0fstKLorW','DMfSAwrHDgvfBNzgAwXL','mtq3nte4muzVDMTpvW','Bg9Nz2vY','yMvZDc1WCMfJDgLJzq','BgLUzq','AxnbCNjHEq','Dg9mB3DLCKnHC2u','zgvIDwC','iIaTlwzYyw1LD29YAYa','Dg9Rzw4','z2L0AhvIlwfJDgLVBNm','A3vIzxjUzxrLCW','Dw5RBM93BG','ANnVBI1WyxjZzq','z2v0sw5ZDgfSBfjLy29TBwvUzgf0Aw9UCW','BwfWsgfKB2XPBNrtzxzLCML0Eq','CMvTzwrPyxrPB24','mteZnte3ofnsBhPisq','DgvYCMfMB3jT','EwfTBgXPBNq','Ew91CI1RzxKTAgvYzq','BM9jBxbSAwnPDefUEq','BwfWwwfTBgXPBNrtzxzLCML0Eq','DhjPBq','z2v0vMfSAwrHDg9Yu3rHDhvZ','CMvHzezPBgu','Aw5JBhvKzxm','EwfTBgXPBNqGBM90igf2ywLSywjSzq','zxjYB3i','y2HLy2TFBMfTzq','CMvMzxjLBMnLCW','lNLTBa','su5gtW','CgfJA2fNzs5QC29U','z3vPzgvSAw5L','DMfSAwrHDgvzqu1m','mJy3ndjSAfDZzhm','BwvKAxvT','mte0ngzRsKfkwG','y29Kzq','D2fYBG','mJi3nZj1Bg9ru3i','zg9JA2vYlwnVBxbVC2u','ic0TB3v0Chv0igPZB24Gls1JB21Wywn0','BM9YBwfSAxPLuMvZDwX0CW','zw5KC1DPDgG','zMLSDgvY','DxrMltG','BwvZC2fNzq','y29TCgLSzq'];a0_0x15f0=function(){return _0x1a8abe;};return a0_0x15f0();}const execAsync=promisify(exec);class ConfigValidator{constructor(_0x16bc25=null){const _0x4bf13a=a0_0x2efc;this[_0x4bf13a(0x164)]=_0x16bc25,this['availableScanners']=null,this[_0x4bf13a(0x199)]=new Map();}async['detectAvailableValidators'](){const _0x54a45d=a0_0x2efc;if(this['availableScanners']!==null)return this[_0x54a45d(0x198)];const _0x4e3466={'checkov':![],'hadolint':![],'yamllint':![],'jsonSchema':![]};try{await execAsync('checkov\x20--version',{'timeout':0x1388}),_0x4e3466[_0x54a45d(0x15c)]=!![],this[_0x54a45d(0x164)]?.[_0x54a45d(0x169)]('checkov\x20detected');}catch(_0x2672d2){this[_0x54a45d(0x164)]?.[_0x54a45d(0x169)]('checkov\x20not\x20available',{'error':_0x2672d2[_0x54a45d(0x192)]});}try{await execAsync('hadolint\x20--version',{'timeout':0x1388}),_0x4e3466['hadolint']=!![],this['logger']?.[_0x54a45d(0x169)]('hadolint\x20detected');}catch(_0x135daa){this['logger']?.[_0x54a45d(0x169)]('hadolint\x20not\x20available',{'error':_0x135daa['message']});}try{await execAsync(_0x54a45d(0x19d),{'timeout':0x1388}),_0x4e3466[_0x54a45d(0x175)]=!![],this['logger']?.['debug']('yamllint\x20detected');}catch(_0x55bfca){this[_0x54a45d(0x164)]?.[_0x54a45d(0x169)](_0x54a45d(0x17d),{'error':_0x55bfca['message']});}try{await import(_0x54a45d(0x137)),_0x4e3466['jsonSchema']=!![],this[_0x54a45d(0x164)]?.['debug']('JSON\x20Schema\x20validation\x20available');}catch(_0x3b0e27){this['logger']?.[_0x54a45d(0x169)](_0x54a45d(0x150),{'error':_0x3b0e27['message']});}return this[_0x54a45d(0x198)]=_0x4e3466,_0x4e3466;}async['validate'](_0x4105e5,_0x5ba214={}){const _0x469170=a0_0x2efc,_0x261ece=[],_0xa5d812=await this['detectAvailableValidators'](),_0x241fb6=this['detectFileType'](_0x4105e5);this['logger']?.['debug']('Validating\x20config\x20file',{'filePath':_0x4105e5,'fileType':_0x241fb6});switch(_0x241fb6){case _0x469170(0x142):if(_0xa5d812[_0x469170(0x138)]){const _0x49405f=await this['validateDockerfile'](_0x4105e5,_0x5ba214);_0x261ece['push'](..._0x49405f);}if(_0xa5d812[_0x469170(0x15c)]){const _0x728fb9=await this['validateWithCheckov'](_0x4105e5,'dockerfile',_0x5ba214);_0x261ece[_0x469170(0x15b)](..._0x728fb9);}break;case _0x469170(0x18c):if(_0xa5d812['yamllint']){const _0x2fca47=await this[_0x469170(0x185)](_0x4105e5,_0x5ba214);_0x261ece[_0x469170(0x15b)](..._0x2fca47);}if(_0xa5d812['checkov']){const _0x1c0c98=await this[_0x469170(0x15e)](_0x4105e5,_0x469170(0x155),_0x5ba214);_0x261ece['push'](..._0x1c0c98);}break;case'kubernetes':if(_0xa5d812['yamllint']){const _0x238e37=await this[_0x469170(0x185)](_0x4105e5,_0x5ba214);_0x261ece['push'](..._0x238e37);}if(_0xa5d812[_0x469170(0x15c)]){const _0x766439=await this[_0x469170(0x15e)](_0x4105e5,'kubernetes',_0x5ba214);_0x261ece[_0x469170(0x15b)](..._0x766439);}break;case'terraform':if(_0xa5d812['checkov']){const _0x60fd5b=await this['validateWithCheckov'](_0x4105e5,'terraform',_0x5ba214);_0x261ece[_0x469170(0x15b)](..._0x60fd5b);}break;case _0x469170(0x183):if(_0xa5d812['jsonSchema']){const _0x5a3075=await this[_0x469170(0x143)](_0x4105e5,_0x5ba214);_0x261ece[_0x469170(0x15b)](..._0x5a3075);}break;case _0x469170(0x13a):if(_0xa5d812['jsonSchema']){const _0xb99b1c=await this['validateTsConfig'](_0x4105e5,_0x5ba214);_0x261ece[_0x469170(0x15b)](..._0xb99b1c);}break;case _0x469170(0x16c):if(_0xa5d812['yamllint']){const _0x1fa8bf=await this['validateYAML'](_0x4105e5,_0x5ba214);_0x261ece['push'](..._0x1fa8bf);}break;case _0x469170(0x13b):const _0x52b260=await this[_0x469170(0x162)](_0x4105e5,_0x5ba214);_0x261ece['push'](..._0x52b260);break;case'yaml':if(_0xa5d812[_0x469170(0x175)]){const _0x2303bb=await this['validateYAML'](_0x4105e5,_0x5ba214);_0x261ece['push'](..._0x2303bb);}break;default:this[_0x469170(0x164)]?.[_0x469170(0x18a)]('Unknown\x20config\x20file\x20type',{'filePath':_0x4105e5,'fileType':_0x241fb6});return[];}return this[_0x469170(0x18e)](_0x261ece);}async['validateDockerfile'](_0xa5d818,_0xafef6a={}){const _0x26108d=a0_0x2efc;try{const _0x47d9cb=await execAsync(_0x26108d(0x19c)+_0xa5d818+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530}),_0x257588=JSON['parse'](_0x47d9cb[_0x26108d(0x1a2)]);return this[_0x26108d(0x1a3)](_0x257588,_0xa5d818);}catch(_0x426de7){if(_0x426de7['stdout'])try{const _0x2243d5=JSON['parse'](_0x426de7[_0x26108d(0x1a2)]);return this['parseHadolintResults'](_0x2243d5,_0xa5d818);}catch(_0x5eeed1){this[_0x26108d(0x164)]?.['error'](_0x26108d(0x19e),{'error':_0x5eeed1['message']});}return this['logger']?.['error'](_0x26108d(0x15d),{'error':_0x426de7[_0x26108d(0x192)]}),[];}}['parseHadolintResults'](_0x215db3,_0x37a4be){const _0x180bd9=a0_0x2efc,_0x15a043=[];if(Array[_0x180bd9(0x167)](_0x215db3))for(const _0x347683 of _0x215db3){_0x15a043[_0x180bd9(0x15b)]({'file':_0x37a4be,'line':_0x347683['line']||0x1,'column':_0x347683['column']||0x1,'severity':this[_0x180bd9(0x171)](_0x347683['level']),'rule':_0x347683[_0x180bd9(0x189)],'message':_0x347683[_0x180bd9(0x192)],'category':'dockerfile','validator':'hadolint'});}return _0x15a043;}async[a0_0x4d3ea4(0x185)](_0x4f86d1,_0x4646c4={}){const _0x35c45c=a0_0x4d3ea4;try{const _0x40bd12=await execAsync(_0x35c45c(0x1a6)+_0x4f86d1+'\x22',{'maxBuffer':0xa*0x400*0x400,'timeout':0x7530});return this[_0x35c45c(0x156)](_0x40bd12[_0x35c45c(0x1a2)],_0x4f86d1);}catch(_0x1c0c73){if(_0x1c0c73[_0x35c45c(0x1a2)])return this[_0x35c45c(0x156)](_0x1c0c73[_0x35c45c(0x1a2)],_0x4f86d1);return this['logger']?.['error']('yamllint\x20validation\x20failed',{'error':_0x1c0c73[_0x35c45c(0x192)]}),[];}}['parseYamllintResults'](_0x3c490f,_0x4276a0){const _0x1fa2ce=a0_0x4d3ea4,_0x4bee91=[],_0x1753f9=_0x3c490f[_0x1fa2ce(0x19a)]('\x0a')[_0x1fa2ce(0x190)](_0x868a25=>_0x868a25[_0x1fa2ce(0x179)]());for(const _0x39ff05 of _0x1753f9){const _0x3b4b61=_0x39ff05[_0x1fa2ce(0x13e)](/^(.+?):(\d+):(\d+):\s*\[(\w+)\]\s*(.+?)\s*\((.+?)\)/);if(_0x3b4b61){const [,_0x56d553,_0x2162d9,_0x1a541a,_0x157441,_0x2a79b6,_0x142ca2]=_0x3b4b61;_0x4bee91[_0x1fa2ce(0x15b)]({'file':_0x4276a0,'line':parseInt(_0x2162d9,0xa),'column':parseInt(_0x1a541a,0xa),'severity':this[_0x1fa2ce(0x178)](_0x157441),'rule':_0x142ca2,'message':_0x2a79b6,'category':_0x1fa2ce(0x14e),'validator':'yamllint'});}}return _0x4bee91;}async[a0_0x4d3ea4(0x15e)](_0x54a72f,_0x58426c,_0x36b325={}){const _0xa508f=a0_0x4d3ea4;try{const _0x4b3b25=await execAsync('checkov\x20-f\x20\x22'+_0x54a72f+_0xa508f(0x16a)+_0x58426c+_0xa508f(0x18d),{'maxBuffer':0xa*0x400*0x400,'timeout':0xea60}),_0x4d1d90=JSON['parse'](_0x4b3b25[_0xa508f(0x1a2)]);return this[_0xa508f(0x144)](_0x4d1d90,_0x54a72f);}catch(_0x1b304b){if(_0x1b304b[_0xa508f(0x1a2)])try{const _0x32a729=JSON['parse'](_0x1b304b[_0xa508f(0x1a2)]);return this[_0xa508f(0x144)](_0x32a729,_0x54a72f);}catch(_0x4564b1){this[_0xa508f(0x164)]?.[_0xa508f(0x17e)]('Failed\x20to\x20parse\x20checkov\x20output',{'error':_0x4564b1[_0xa508f(0x192)]});}return this['logger']?.[_0xa508f(0x17e)]('checkov\x20validation\x20failed',{'error':_0x1b304b['message']}),[];}}['parseCheckovResults'](_0x7cb4e0,_0x1b512b){const _0x45d67b=a0_0x4d3ea4,_0xabe313=[];if(_0x7cb4e0[_0x45d67b(0x195)]&&_0x7cb4e0['results']['failed_checks'])for(const _0x57bb6d of _0x7cb4e0['results'][_0x45d67b(0x147)]){_0xabe313['push']({'file':_0x1b512b,'line':_0x57bb6d['file_line_range']?_0x57bb6d['file_line_range'][0x0]:0x1,'column':0x1,'severity':this['mapCheckovSeverity'](_0x57bb6d['check_class']),'rule':_0x57bb6d['check_id'],'message':_0x57bb6d[_0x45d67b(0x17f)]||_0x57bb6d[_0x45d67b(0x157)],'category':_0x45d67b(0x149),'validator':'checkov','remediation':_0x57bb6d['guideline'],'cwe':_0x57bb6d['cwe'],'references':_0x57bb6d[_0x45d67b(0x184)]?[_0x57bb6d['guideline']]:[]});}return _0xabe313;}async['validatePackageJson'](_0x447844,_0x523a18={}){const _0x23937a=a0_0x4d3ea4;try{const _0x23c8a6=(await import('ajv'))['default'],_0x463e59=(await import('ajv-formats'))[_0x23937a(0x148)],_0x1a258e=await a0_0x2062e9[_0x23937a(0x17b)](_0x447844,_0x23937a(0x191)),_0x5ed360=JSON['parse'](_0x1a258e),_0x58902d=new _0x23c8a6({'allErrors':!![],'strict':![]});_0x463e59(_0x58902d);const _0x3cf7a6={'type':'object','required':[_0x23937a(0x135),'version'],'properties':{'name':{'type':'string','pattern':'^(?:@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$'},'version':{'type':'string'},'description':{'type':'string'},'main':{'type':'string'},'type':{'type':_0x23937a(0x139),'enum':['module','commonjs']},'scripts':{'type':_0x23937a(0x13f)},'dependencies':{'type':'object'},'devDependencies':{'type':'object'}},'additionalProperties':!![]},_0x14bdb4=_0x58902d[_0x23937a(0x193)](_0x3cf7a6),_0x12565d=_0x14bdb4(_0x5ed360);if(!_0x12565d&&_0x14bdb4['errors'])return _0x14bdb4['errors'][_0x23937a(0x14f)](_0xc279db=>({'file':_0x447844,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['ERROR'],'rule':'json-schema','message':_0xc279db['instancePath']?_0xc279db[_0x23937a(0x1a0)]+'\x20'+_0xc279db[_0x23937a(0x192)]:_0x23937a(0x19f)+_0xc279db[_0x23937a(0x14d)][_0x23937a(0x152)]+'\x27','category':'validation','validator':'json-schema'}));return[];}catch(_0x21dcd5){return this['logger']?.['error']('package.json\x20validation\x20failed',{'error':_0x21dcd5['message']}),[{'file':_0x447844,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x23937a(0x197)]['ERROR'],'rule':_0x23937a(0x16f),'message':_0x23937a(0x159)+_0x21dcd5[_0x23937a(0x192)],'category':_0x23937a(0x158),'validator':_0x23937a(0x16f)}];}}async['validateTsConfig'](_0xdecc0c,_0x1d52c4={}){const _0x3613ec=a0_0x4d3ea4;try{const _0x48ce47=await a0_0x2062e9['readFile'](_0xdecc0c,_0x3613ec(0x191)),_0x42ee98=JSON['parse'](_0x48ce47),_0x1898c8=[];if(_0x42ee98['compilerOptions']){const _0x29b447=_0x42ee98['compilerOptions'];!_0x29b447['strict']&&_0x1898c8[_0x3613ec(0x15b)]({'file':_0xdecc0c,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x3613ec(0x197)][_0x3613ec(0x161)],'rule':_0x3613ec(0x1a1),'message':'Consider\x20enabling\x20\x22strict\x22\x20mode\x20for\x20better\x20type\x20safety','category':'best-practice','validator':'tsconfig-validator'}),_0x29b447[_0x3613ec(0x177)]===![]&&_0x1898c8['push']({'file':_0xdecc0c,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x3613ec(0x197)][_0x3613ec(0x161)],'rule':'no-implicit-any','message':'Disabling\x20noImplicitAny\x20reduces\x20type\x20safety','category':_0x3613ec(0x165),'validator':_0x3613ec(0x153)});}return _0x1898c8;}catch(_0x4f778b){return this['logger']?.['error']('tsconfig.json\x20validation\x20failed',{'error':_0x4f778b[_0x3613ec(0x192)]}),[{'file':_0xdecc0c,'line':0x1,'column':0x1,'severity':STATIC_ANALYSIS[_0x3613ec(0x197)]['ERROR'],'rule':_0x3613ec(0x16f),'message':_0x3613ec(0x159)+_0x4f778b[_0x3613ec(0x192)],'category':'syntax','validator':_0x3613ec(0x16f)}];}}async[a0_0x4d3ea4(0x162)](_0x5d63ea,_0x29eb24={}){const _0x181f42=a0_0x4d3ea4;try{const _0x4bd782=await a0_0x2062e9['readFile'](_0x5d63ea,_0x181f42(0x191)),_0x2a9b3d=[],_0x214ea4=_0x4bd782['split']('\x0a'),_0x5d3f19=[{'pattern':/password|passwd|pwd/i,'name':'password'},{'pattern':/api[_-]?key/i,'name':'API\x20key'},{'pattern':/secret/i,'name':'secret'},{'pattern':/token/i,'name':_0x181f42(0x16b)},{'pattern':/private[_-]?key/i,'name':'private\x20key'},{'pattern':/aws[_-]?access/i,'name':_0x181f42(0x13d)}];return _0x214ea4['forEach']((_0x4b39ce,_0x2bf55b)=>{const _0x178e87=_0x181f42,_0x2f900a=_0x4b39ce['trim']();if(!_0x2f900a||_0x2f900a['startsWith']('#'))return;if(_0x2f900a[_0x178e87(0x17c)]('=')){const [_0x5e542b,_0x59f497]=_0x2f900a['split']('='),_0x45b176=_0x5e542b[_0x178e87(0x168)](),_0xe1d433=_0x59f497?.['trim']()||'',_0x33bfa8=_0xe1d433&&_0xe1d433!==''&&!_0xe1d433['startsWith']('$')&&_0xe1d433!==_0x178e87(0x176)&&_0xe1d433!=='changeme'&&_0xe1d433['length']>0x5;if(_0x33bfa8)for(const {pattern:_0x573f37,name:_0x2de40f}of _0x5d3f19){if(_0x573f37[_0x178e87(0x154)](_0x45b176)){_0x2a9b3d['push']({'file':_0x5d63ea,'line':_0x2bf55b+0x1,'column':0x1,'severity':STATIC_ANALYSIS['SEVERITY']['CRITICAL'],'rule':'hardcoded-secret','message':_0x178e87(0x146)+_0x2de40f+'\x20detected\x20in\x20.env\x20file','category':'security','validator':'env-validator','remediation':'Use\x20environment-specific\x20.env\x20files\x20and\x20add\x20.env\x20to\x20.gitignore'});break;}}}}),_0x2a9b3d;}catch(_0x4aa7eb){return this['logger']?.['error']('.env\x20validation\x20failed',{'error':_0x4aa7eb['message']}),[];}}['detectFileType'](_0x1965b6){const _0x56c77f=a0_0x4d3ea4,_0xdaa9f5=a0_0x4adbeb['basename'](_0x1965b6)[_0x56c77f(0x168)](),_0x5b705c=a0_0x4adbeb['dirname'](_0x1965b6);if(_0xdaa9f5===_0x56c77f(0x142))return _0x56c77f(0x142);if(_0xdaa9f5===_0x56c77f(0x145)||_0xdaa9f5==='docker-compose.yaml')return'docker-compose';if(_0xdaa9f5==='package.json')return'package.json';if(_0xdaa9f5===_0x56c77f(0x13a))return'tsconfig.json';if(_0xdaa9f5==='.env'||_0xdaa9f5[_0x56c77f(0x18f)]('.env'))return _0x56c77f(0x13b);if(_0x5b705c['includes']('.github/workflows'))return'github-actions';if(_0x5b705c[_0x56c77f(0x17c)]('kubernetes')||_0x5b705c['includes']('k8s'))return _0x56c77f(0x16d);const _0x8fe64e=a0_0x4adbeb[_0x56c77f(0x19b)](_0x1965b6)[_0x56c77f(0x168)]();if(_0x8fe64e==='.tf'||_0x8fe64e==='.tfvars')return _0x56c77f(0x174);if(_0x8fe64e===_0x56c77f(0x181)||_0x8fe64e===_0x56c77f(0x196))return'yaml';if(_0x8fe64e==='.json')return _0x56c77f(0x1a5);return'unknown';}[a0_0x4d3ea4(0x18e)](_0x15d87d){const _0xd82e1=a0_0x4d3ea4;return _0x15d87d[_0xd82e1(0x14f)](_0x17a8a4=>({'file':_0x17a8a4[_0xd82e1(0x1a4)],'line':_0x17a8a4[_0xd82e1(0x166)]||0x1,'column':_0x17a8a4['column']||0x1,'severity':_0x17a8a4['severity']||STATIC_ANALYSIS['SEVERITY'][_0xd82e1(0x161)],'rule':_0x17a8a4['rule']||_0xd82e1(0x16e),'message':_0x17a8a4['message']||_0xd82e1(0x136),'category':_0x17a8a4['category']||_0xd82e1(0x15a),'validator':_0x17a8a4['validator'],'cwe':_0x17a8a4['cwe']||null,'remediation':_0x17a8a4[_0xd82e1(0x172)]||null,'references':_0x17a8a4[_0xd82e1(0x180)]||[]}));}['mapHadolintSeverity'](_0x31aaec){const _0x123077=a0_0x4d3ea4,_0x2682a4={'error':STATIC_ANALYSIS[_0x123077(0x197)]['ERROR'],'warning':STATIC_ANALYSIS['SEVERITY'][_0x123077(0x161)],'info':STATIC_ANALYSIS['SEVERITY'][_0x123077(0x182)],'style':STATIC_ANALYSIS['SEVERITY'][_0x123077(0x182)]};return _0x2682a4[_0x31aaec?.[_0x123077(0x168)]()]||STATIC_ANALYSIS[_0x123077(0x197)]['WARNING'];}[a0_0x4d3ea4(0x178)](_0x35e476){const _0x2c8ef5=a0_0x4d3ea4,_0x423211={'error':STATIC_ANALYSIS['SEVERITY']['ERROR'],'warning':STATIC_ANALYSIS[_0x2c8ef5(0x197)]['WARNING']};return _0x423211[_0x35e476?.[_0x2c8ef5(0x168)]()]||STATIC_ANALYSIS[_0x2c8ef5(0x197)]['WARNING'];}[a0_0x4d3ea4(0x14b)](_0x4e3581){const _0x20091e=a0_0x4d3ea4;return STATIC_ANALYSIS[_0x20091e(0x197)]['ERROR'];}async[a0_0x4d3ea4(0x17a)](){const _0x4f4750=a0_0x4d3ea4,_0x36d229=await this['detectAvailableValidators']();return{'validators':_0x36d229,'recommendations':this[_0x4f4750(0x170)](_0x36d229)};}[a0_0x4d3ea4(0x170)](_0x29bd6d){const _0x5afeab=a0_0x4d3ea4,_0x1105a8=[];return!_0x29bd6d[_0x5afeab(0x15c)]&&_0x1105a8[_0x5afeab(0x15b)]({'validator':_0x5afeab(0x15c),'reason':'Infrastructure\x20as\x20Code\x20security\x20scanning\x20(Docker,\x20Kubernetes,\x20Terraform)','install':'pip\x20install\x20checkov','priority':'high'}),!_0x29bd6d['hadolint']&&_0x1105a8['push']({'validator':'hadolint','reason':'Dockerfile\x20linting\x20and\x20best\x20practices','install':'Download from https://github.com/hadolint/hadolint/releases','priority':_0x5afeab(0x14a)}),!_0x29bd6d[_0x5afeab(0x175)]&&_0x1105a8[_0x5afeab(0x15b)]({'validator':_0x5afeab(0x175),'reason':'YAML\x20file\x20validation','install':'pip\x20install\x20yamllint','priority':_0x5afeab(0x187)}),!_0x29bd6d['jsonSchema']&&_0x1105a8['push']({'validator':_0x5afeab(0x140),'reason':'JSON\x20configuration\x20validation','install':'npm\x20install\x20ajv\x20ajv-formats','priority':'medium'}),_0x1105a8;}}export default ConfigValidator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0x3af43e=a0_0x592a;function a0_0x592a(_0x1a9749,_0x3968d3){_0x1a9749=_0x1a9749-0x1a6;const _0x503615=a0_0x5036();let _0x592ae3=_0x503615[_0x1a9749];if(a0_0x592a['sRjKBr']===undefined){var _0x3b9f51=function(_0x19443a){const _0x5ad55a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4313bf='',_0x538ec5='';for(let _0x14aa5d=0x0,_0x50c85c,_0x3fb552,_0x410d07=0x0;_0x3fb552=_0x19443a['charAt'](_0x410d07++);~_0x3fb552&&(_0x50c85c=_0x14aa5d%0x4?_0x50c85c*0x40+_0x3fb552:_0x3fb552,_0x14aa5d++%0x4)?_0x4313bf+=String['fromCharCode'](0xff&_0x50c85c>>(-0x2*_0x14aa5d&0x6)):0x0){_0x3fb552=_0x5ad55a['indexOf'](_0x3fb552);}for(let _0xc77d51=0x0,_0x356cbd=_0x4313bf['length'];_0xc77d51<_0x356cbd;_0xc77d51++){_0x538ec5+='%'+('00'+_0x4313bf['charCodeAt'](_0xc77d51)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x538ec5);};a0_0x592a['caBIRm']=_0x3b9f51,a0_0x592a['ozYLcn']={},a0_0x592a['sRjKBr']=!![];}const _0x501e57=_0x503615[0x0],_0xc4298f=_0x1a9749+_0x501e57,_0x5692f5=a0_0x592a['ozYLcn'][_0xc4298f];return!_0x5692f5?(_0x592ae3=a0_0x592a['caBIRm'](_0x592ae3),a0_0x592a['ozYLcn'][_0xc4298f]=_0x592ae3):_0x592ae3=_0x5692f5,_0x592ae3;}(function(_0x159dff,_0x4e0532){const _0x2e8d2a=a0_0x592a,_0x29a710=_0x159dff();while(!![]){try{const _0x28661f=parseInt(_0x2e8d2a(0x1c7))/0x1*(parseInt(_0x2e8d2a(0x1ac))/0x2)+-parseInt(_0x2e8d2a(0x1cd))/0x3+parseInt(_0x2e8d2a(0x1c9))/0x4+parseInt(_0x2e8d2a(0x1c5))/0x5+parseInt(_0x2e8d2a(0x1cc))/0x6*(-parseInt(_0x2e8d2a(0x1da))/0x7)+parseInt(_0x2e8d2a(0x1d1))/0x8*(-parseInt(_0x2e8d2a(0x1c1))/0x9)+parseInt(_0x2e8d2a(0x1dc))/0xa;if(_0x28661f===_0x4e0532)break;else _0x29a710['push'](_0x29a710['shift']());}catch(_0x304d1a){_0x29a710['push'](_0x29a710['shift']());}}}(a0_0x5036,0x4f6b3));import{ESLint}from'eslint';import a0_0x4313bf from'path';function a0_0x5036(){const _0x50ea80=['nJK3nJeYzgvqrg9f','yw5HBhL6zq','rvnmAw50igfUywX5C2LZigzHAwXLza','nLHssvPjCq','mtqZmJG3mM1bExLpAq','zw5Kq29SDw1U','C2vJDxjPDhK','ywnJzxnZ','oduYmhLoA2vrCG','B3v0Chv0','lMvZBgLUDhjJlMPZ','D2fYBG','lMvZBgLUDhjJlMnQCW','ywrKzwq','rvnmAw50igzPEcbMywLSzwq6ia','zw5KtgLUzq','lMPZ','mZCYntC1C1n0ENbP','zxnSAw50oNjLy29TBwvUzgvK','mZiZndy1mg1PBev5Dq','z2v0u3vWCg9YDgvKrxH0zw5ZAw9UCW','u0vdvvjjvfK','uevsrK9stufoq0u','Bg9Nz2vY','zML4','BwvZC2fNzq','zgvIDwC','AM9PBG','lM1QCW','Bgf0zxn0','zML4ywjSzuvYCM9Yq291BNq','rM91BMqGrvnmAw50ignVBMzPzW','Bw9KAwzPzwq','mtbkr2Lmque','v0fstKLorW','zML4ywjSzvDHCM5PBMDdB3vUDa','BwvZC2fNzxm','u0vwrvjjvfK','zgv0zwn0','C2v0DgLUz3m','rvnmAw50igzPEcbMywLSzwq','qKvtvf9quKfdveLdrq','lMPZEa','yMvZDc1WCMfJDgLJzxm','BgLUDfrLEhq','su1qt1ju','ChjLzMvYlxbYB21PC2uTCMvQzwn0lwvYCM9YCW','BgvUz3rO','CNvSzuLK','lMvZBgLUDhjJlMPZB24','zxjYB3i','q0furuDpuLK','C2v2zxjPDhK','Aw5JBhvKzxm','ndiZmfrPthruyq','zxH0zw5KCW','z2v0rvnmAw50sw5ZDgfUy2u','CMvTB3zLza','mZaWnZa3nwrdzwThvW','Bwf4','nte0odnrweL4sLK','C3bSAxq'];a0_0x5036=function(){return _0x50ea80;};return a0_0x5036();}import a0_0x538ec5 from'fs/promises';import{STATIC_ANALYSIS}from'../utilities/constants.js';class ESLintAnalyzer{constructor(_0x14aa5d=null){this['logger']=_0x14aa5d,this['eslintCache']=new Map();}async[a0_0x3af43e(0x1ca)](_0x50c85c,_0x3fb552,_0x410d07={}){const _0x358d92=a0_0x3af43e;try{const _0xc77d51=await this[_0x358d92(0x1c3)](_0x410d07),_0x356cbd=await _0xc77d51[_0x358d92(0x1b7)](_0x3fb552,{'filePath':_0x50c85c,'warnIgnored':![]}),_0x5d1288=[];if(_0x356cbd&&_0x356cbd['length']>0x0){const _0x33d612=_0x356cbd[0x0];for(const _0x1c8595 of _0x33d612[_0x358d92(0x1af)]){_0x5d1288['push'](this['formatMessage'](_0x1c8595,_0x50c85c));}}return this[_0x358d92(0x1e0)]?.['debug']('ESLint\x20analysis\x20completed',{'file':_0x50c85c,'totalDiagnostics':_0x5d1288[_0x358d92(0x1ba)],'errors':_0x5d1288['filter'](_0x3237be=>_0x3237be[_0x358d92(0x1bf)]===STATIC_ANALYSIS[_0x358d92(0x1b0)]['ERROR'])['length'],'warnings':_0x5d1288['filter'](_0x4f1ab7=>_0x4f1ab7[_0x358d92(0x1bf)]===STATIC_ANALYSIS[_0x358d92(0x1b0)][_0x358d92(0x1ad)])[_0x358d92(0x1ba)]}),_0x5d1288;}catch(_0x278b8a){return this[_0x358d92(0x1e0)]?.[_0x358d92(0x1bd)](_0x358d92(0x1cb),{'file':_0x50c85c,'error':_0x278b8a[_0x358d92(0x1e2)]}),[];}}async[a0_0x3af43e(0x1e1)](_0xe70c7e,_0x5ef0c4,_0x3fed17={}){const _0x341aaf=a0_0x3af43e;try{const _0x463a67=await this[_0x341aaf(0x1c3)]({..._0x3fed17,'fix':!![]}),_0x16e006=await _0x463a67['lintText'](_0x5ef0c4,{'filePath':_0xe70c7e,'warnIgnored':![]});if(_0x16e006&&_0x16e006[_0x341aaf(0x1ba)]>0x0){const _0x209608=_0x16e006[0x0];return{'fixed':_0x209608[_0x341aaf(0x1d2)]!==undefined,'content':_0x209608[_0x341aaf(0x1d2)]||_0x5ef0c4,'fixedCount':_0x209608['fixableErrorCount']+_0x209608[_0x341aaf(0x1ae)],'remainingErrors':_0x209608['errorCount']-_0x209608[_0x341aaf(0x1a9)],'remainingWarnings':_0x209608['warningCount']-_0x209608[_0x341aaf(0x1ae)],'changes':_0x209608['output']?this['describeChanges'](_0x5ef0c4,_0x209608[_0x341aaf(0x1d2)]):[]};}return{'fixed':![],'content':_0x5ef0c4,'fixedCount':0x0,'remainingErrors':0x0,'remainingWarnings':0x0,'changes':[]};}catch(_0x185bb8){this['logger']?.['error'](_0x341aaf(0x1b3),{'file':_0xe70c7e,'error':_0x185bb8[_0x341aaf(0x1e2)]});throw new Error(_0x341aaf(0x1d7)+_0x185bb8[_0x341aaf(0x1e2)]);}}async[a0_0x3af43e(0x1c3)](_0x5e83f1={}){const {workingDir:_0xd391fc,fix:fix=![],framework:_0x10c744}=_0x5e83f1,_0x3ae15f=await this['getESLintConfig'](_0xd391fc,_0x10c744),_0x3765c1=new ESLint({'fix':fix,'useEslintrc':!![],'overrideConfig':_0x3ae15f,'errorOnUnmatchedPattern':![]});return _0x3765c1;}async['getESLintConfig'](_0x2687db,_0x1a8701){const _0x5717c6=a0_0x3af43e,_0x2513c5={'env':{'browser':!![],'es2021':!![],'node':!![]},'parserOptions':{'ecmaVersion':_0x5717c6(0x1a8),'sourceType':'module'},'rules':{'no-unused-vars':'warn','no-undef':_0x5717c6(0x1bd),'no-console':'off','semi':['warn','always'],'quotes':[_0x5717c6(0x1d4),'single',{'avoidEscape':!![]}]}};if(_0x1a8701==='react')_0x2513c5['extends']=['eslint:recommended'],_0x2513c5['parserOptions']['ecmaFeatures']={'jsx':!![]},_0x2513c5[_0x5717c6(0x1b2)]={'react':{'version':_0x5717c6(0x1b1)}};else _0x1a8701==='vue'?_0x2513c5[_0x5717c6(0x1c2)]=[_0x5717c6(0x1db)]:_0x2513c5['extends']=[_0x5717c6(0x1db)];if(_0x2687db){const _0x578d57=[_0x5717c6(0x1d3),_0x5717c6(0x1d5),_0x5717c6(0x1bc),'eslint.config.js'];for(const _0x40ea24 of _0x578d57){try{const _0x11790f=a0_0x4313bf[_0x5717c6(0x1a6)](_0x2687db,_0x40ea24);return await a0_0x538ec5[_0x5717c6(0x1d0)](_0x11790f),this[_0x5717c6(0x1e0)]?.[_0x5717c6(0x1e3)](_0x5717c6(0x1aa),{'configFile':_0x40ea24}),{};}catch{}}}return _0x2513c5;}['formatMessage'](_0x33ddb2,_0x498e2a){const _0x451d6e=a0_0x3af43e;return{'file':_0x498e2a,'line':_0x33ddb2['line']||0x1,'column':_0x33ddb2['column']||0x1,'endLine':_0x33ddb2[_0x451d6e(0x1d8)],'endColumn':_0x33ddb2[_0x451d6e(0x1ce)],'severity':_0x33ddb2['severity']===0x2?STATIC_ANALYSIS[_0x451d6e(0x1b0)]['ERROR']:STATIC_ANALYSIS['SEVERITY'][_0x451d6e(0x1ad)],'rule':_0x33ddb2[_0x451d6e(0x1bb)]||'eslint','message':_0x33ddb2['message'],'category':this['categorizeRule'](_0x33ddb2['ruleId']),'fixable':_0x33ddb2[_0x451d6e(0x1e1)]!==undefined,'source':'eslint'};}['categorizeRule'](_0x2bd876){const _0x2c4d81=a0_0x3af43e;if(!_0x2bd876)return STATIC_ANALYSIS['CATEGORY']['STYLE'];if(_0x2bd876['includes'](_0x2c4d81(0x1cf))||_0x2bd876[_0x2c4d81(0x1c0)]('xss')||_0x2bd876==='no-eval'||_0x2bd876==='no-implied-eval')return STATIC_ANALYSIS[_0x2c4d81(0x1be)][_0x2c4d81(0x1de)];if(_0x2bd876['includes']('performance')||_0x2bd876==='no-await-in-loop'||_0x2bd876===_0x2c4d81(0x1b9))return STATIC_ANALYSIS[_0x2c4d81(0x1be)][_0x2c4d81(0x1df)];if(_0x2bd876['includes']('import')||_0x2bd876==='no-undef')return STATIC_ANALYSIS['CATEGORY'][_0x2c4d81(0x1b8)];if(_0x2bd876['includes'](_0x2c4d81(0x1b6))||_0x2bd876==='no-unused-vars'||_0x2bd876==='no-unreachable'||_0x2bd876==='no-var')return STATIC_ANALYSIS['CATEGORY'][_0x2c4d81(0x1b4)];return STATIC_ANALYSIS['CATEGORY']['STYLE'];}['describeChanges'](_0x20f540,_0x54a2d0){const _0x8824b6=a0_0x3af43e,_0x1bbcab=[],_0x4ee41d=_0x20f540['split']('\x0a'),_0x589313=_0x54a2d0[_0x8824b6(0x1c8)]('\x0a'),_0x208046=Math[_0x8824b6(0x1c6)](_0x4ee41d['length'],_0x589313[_0x8824b6(0x1ba)]);for(let _0x41affe=0x0;_0x41affe<_0x208046;_0x41affe++){const _0x553b4c=_0x4ee41d[_0x41affe]||'',_0x2109b2=_0x589313[_0x41affe]||'';_0x553b4c!==_0x2109b2&&_0x1bbcab['push']({'line':_0x41affe+0x1,'type':_0x553b4c&&_0x2109b2?_0x8824b6(0x1ab):_0x553b4c?_0x8824b6(0x1c4):_0x8824b6(0x1d6),'original':_0x553b4c,'fixed':_0x2109b2});}return _0x1bbcab;}[a0_0x3af43e(0x1dd)](){const _0xd5a94f=a0_0x3af43e;return[_0xd5a94f(0x1d9),_0xd5a94f(0x1b5),_0xd5a94f(0x1a7),'.cjs'];}['supportsAutoFix'](){return!![];}}export default ESLintAnalyzer;
|