Skip to content

Latest commit

 

History

History
184 lines (153 loc) · 5.4 KB

File metadata and controls

184 lines (153 loc) · 5.4 KB

Implementation Summary: Collector Configuration & Module Organization

✅ What Was Implemented

1. Configurable Collectors (Phablets)

  • Created config.json with enable/disable switches for all 13 data collection modules
  • Each collector can be individually toggled on or off
  • Configuration is persistent and survives application restarts

2. Module-Based Output Organization

  • Data from each collector is saved to its own folder in /output/
  • Structure:
    output/
    ├── network/
    ├── console/
    ├── elements/
    ├── scripts/
    ├── css/
    ├── application/
    ├── security/
    ├── performance/
    ├── accessibility/
    ├── media/
    ├── webgl/
    ├── memory/
    ├── serviceWorker/
    └── analysis-<timestamp>.json (combined)
    

3. Configuration Management System

  • src/utils/configManager.ts: Core configuration handling
  • Functions:
    • loadConfig() - Load settings from config.json
    • isCollectorEnabled(name) - Check if a collector is active
    • enableCollector(name) - Activate a collector
    • disableCollector(name) - Deactivate a collector
    • getEnabledCollectors() - List active collectors
    • createModuleDir(name) - Create module-specific folders
    • ensureModuleDirs() - Initialize all module directories

4. CLI Tool for Easy Management

  • src/bin/collector-cli.ts: Command-line interface
  • New npm script: npm run collectors
  • Commands:
    npm run collectors list           # Show all collectors
    npm run collectors enable <name>  # Activate collector
    npm run collectors disable <name> # Deactivate collector
    npm run collectors toggle <name>  # Toggle on/off
    npm run collectors status <name>  # Check status
    npm run collectors enable-all     # Activate all
    npm run collectors disable-all    # Deactivate all

5. Preset System (Optional)

  • src/utils/presets.ts: Pre-configured collector profiles
  • Available presets:
    • minimal - Network + Console only
    • performance - Performance focused
    • security - Security focused
    • dom - DOM and styling focused
    • full - All collectors enabled

6. Updated Main Application

  • Modified src/main.ts to respect configuration
  • Only active collectors are initialized
  • Network & Console collectors only start if enabled
  • Only enabled data is collected and saved
  • Each module's data saved to dedicated folder
  • Displays enabled collectors at startup

🎯 How to Use

Enable/Disable Individual Collectors

# See status of all collectors
npm run collectors list

# Enable specific collectors
npm run collectors enable network
npm run collectors enable console

# Disable specific collectors
npm run collectors disable memory
npm run collectors disable webgl

# Toggle a collector
npm run collectors toggle performance

Example Workflows

Minimal Configuration (Network + Console only):

npm run collectors disable-all
npm run collectors enable network
npm run collectors enable console
npm start

Performance Analysis:

npm run collectors disable-all
npm run collectors enable performance
npm run collectors enable media
npm run collectors enable memory
npm start

Full Analysis:

npm run collectors enable-all
npm start

📁 Output Structure

After running, output is organized as:

  • /output/network/network-<timestamp>.json - Network data
  • /output/console/console-<timestamp>.json - Console data
  • /output/elements/elements-<timestamp>.json - DOM elements
  • ... and so on for each enabled collector
  • /output/analysis-<timestamp>.json - Combined analysis

Each click event also creates:

  • /output/click-<timestamp>.partial.json - Quick snapshot
  • /output/click-<timestamp>.json - Full analysis
  • Module-specific folders with click data

📝 Configuration File

Edit config.json to customize:

{
  "targetUrl": "https://your-url.com",
  "headless": false,
  "slowMo": 80,
  "collectors": {
    "network": { "enabled": true, "description": "..." },
    "console": { "enabled": true, "description": "..." },
    // ... etc
  }
}

🔧 Key Features

Granular Control - Enable/disable each collector independently ✅ Organized Output - Each module has dedicated folder ✅ CLI Management - Easy toggle via command line ✅ Persistent Config - Settings saved across runs ✅ Non-blocking - Only runs enabled collectors ✅ Performance - Reduce memory/disk usage by disabling unnecessary collectors ✅ Preset Profiles - Quick setup for common scenarios

📚 Files Modified/Created

New Files:

  • config.json - Collector configuration
  • src/utils/configManager.ts - Configuration management
  • src/utils/presets.ts - Preset profiles
  • src/bin/collector-cli.ts - CLI tool
  • README.md - Updated documentation

Modified Files:

  • src/main.ts - Added configuration support
  • package.json - Added CLI script

🚀 Next Steps

  1. Configure collectors via CLI or edit config.json:

    npm run collectors list
  2. Start extraction with only needed collectors:

    npm start
  3. Find organized output in /output/<collector-name>/ folders

Enjoy your flexible data collection! 🎉