# SPECS - Deobfuscated CLI Application Structure This directory contains the deobfuscated and domain-separated components of the CLI.js application. ## Directory Structure Overview ``` SPECS/ ├── README.md # This file ├── core/ │ ├── shell-parser.js # Shell command parsing and escaping │ ├── module-system.js # Module loading and bundling utilities │ └── main.js # Main application entry point ├── utils/ │ ├── string-utils.js # String manipulation utilities │ ├── object-utils.js # Object manipulation and serialization │ ├── path-utils.js # Cross-platform path handling │ ├── type-checking.js # Type validation utilities │ └── uuid.js # UUID generation ├── platform/ │ ├── environment-detection.js # Runtime environment detection │ ├── global-object.js # Cross-platform global object access │ └── compatibility.js # Browser/Node.js compatibility layers ├── network/ │ ├── http-client.js # HTTP request handling │ ├── fetch-polyfill.js # Fetch API utilities and detection │ ├── xhr-wrapper.js # XMLHttpRequest instrumentation │ └── url-parsing.js # URL parsing and manipulation ├── instrumentation/ │ ├── console-monitor.js # Console output instrumentation │ ├── dom-events.js # DOM event capture and handling │ ├── error-capture.js # Error handling (non-Sentry) │ └── performance-monitor.js # Performance tracking utilities ├── async/ │ ├── sync-promise.js # Synchronous Promise implementation │ ├── promise-buffer.js # Promise management utilities │ └── async-helpers.js # Async operation utilities └── security/ ├── command-sanitizer.js # Command injection protection ├── input-validation.js # Input sanitization └── safe-escaping.js # Safe string escaping utilities ``` ## Domain Separation ### Core (`core/`) - **shell-parser.js**: Advanced shell command parsing with variable substitution and glob support - **module-system.js**: Webpack-style module loading and CommonJS/ES6 compatibility - **main.js**: Application entry point and orchestration ### Utilities (`utils/`) - **string-utils.js**: Text processing, truncation, and pattern matching - **object-utils.js**: Deep object manipulation, normalization, and serialization - **path-utils.js**: Cross-platform path operations and resolution - **type-checking.js**: Runtime type validation and checking utilities - **uuid.js**: UUID generation with crypto fallbacks ### Platform (`platform/`) - **environment-detection.js**: Detect browser vs Node.js, platform-specific features - **global-object.js**: Abstraction for accessing global objects across environments - **compatibility.js**: Polyfills and compatibility layers ### Network (`network/`) - **http-client.js**: Generic HTTP client with rate limiting and retry logic - **fetch-polyfill.js**: Fetch API detection and native implementation checks - **xhr-wrapper.js**: XMLHttpRequest instrumentation and monitoring - **url-parsing.js**: URL parsing, query string handling, and sanitization ### Instrumentation (`instrumentation/`) - **console-monitor.js**: Console output capture and logging instrumentation - **dom-events.js**: DOM click/keypress event handling and capture - **error-capture.js**: Generic error handling (excluding Sentry-specific code) - **performance-monitor.js**: Performance timing and monitoring utilities ### Async (`async/`) - **sync-promise.js**: Custom Promise implementation for synchronous operations - **promise-buffer.js**: Promise queuing and buffer management - **async-helpers.js**: Async operation utilities and helpers ### Security (`security/`) - **command-sanitizer.js**: Protection against command injection attacks - **input-validation.js**: Input sanitization and validation - **safe-escaping.js**: Safe escaping for shell commands and strings ## Deobfuscation Process 1. **Symbol Mapping**: Reverse minified variable names to meaningful identifiers 2. **Function Extraction**: Separate bundled functions into logical modules 3. **Code Beautification**: Format and structure code for readability 4. **Documentation**: Add inline comments explaining complex logic 5. **Type Annotations**: Add JSDoc comments where appropriate ## Excluded Components - **Sentry SDK**: All Sentry-related error tracking and monitoring code has been excluded per requirements - **Third-party Libraries**: External dependencies remain bundled but are clearly marked - **Build Artifacts**: Webpack-specific bundling code is isolated in module-system.js ## Usage Each file is designed to be self-contained with clear exports and minimal dependencies. The deobfuscated code maintains the original functionality while being human-readable and maintainable.