-
Notifications
You must be signed in to change notification settings - Fork 0
README
This directory contains detailed documentation of the design patterns used throughout the HawkEye MCP security reconnaissance tool. Each pattern is documented separately to provide reusable knowledge that can be referenced from the command-specific documentation.
Each design pattern document follows a consistent structure:
- Intent: What problem does this pattern solve?
- Also Known As: Alternative names for the pattern
- Motivation: Real-world scenarios that led to using this pattern
- UML Class Diagram: Visual representation of the pattern
- Participants: Key classes/interfaces involved
- Collaborations: How participants work together
- Concrete Examples: Actual classes from the codebase
- Code Snippets: Key implementation details
- Variations: How the pattern is adapted for specific needs
- Benefits: Advantages gained from using this pattern
- Drawbacks: Trade-offs and potential issues
- Performance Implications: Impact on system performance
- Complementary Patterns: Patterns often used together
- Alternative Patterns: Other solutions to similar problems
File: abstract-base-class-pattern.md
Usage: MCPDetector, BaseScanner, RiskAssessor, BaseReporter
Purpose: Defines common interface and shared behavior for polymorphic class hierarchies
File: strategy-pattern.md
Usage: Detection strategies, Scanner types, Reporter formats
Purpose: Encapsulates interchangeable algorithms and makes them pluggable
File: factory-pattern.md
Usage: Pipeline creation, Transport factory, Reporter instantiation
Purpose: Creates objects without specifying exact classes, promotes loose coupling
File: command-pattern.md
Usage: CLI command structure using Click framework
Purpose: Encapsulates requests as objects, supports queuing and undo operations
File: template-method-pattern.md
Usage: Base classes with abstract methods and concrete implementations
Purpose: Defines algorithm skeleton, letting subclasses override specific steps
File: chain-of-responsibility-pattern.md
Usage: Detection pipeline, Assessment chain
Purpose: Passes requests along a chain of handlers until one handles it
File: builder-pattern.md
Usage: ReportData construction, PipelineConfig assembly
Purpose: Constructs complex objects step by step with flexible configuration
File: adapter-pattern.md
Usage: Transport layers, MCP version compatibility, Legacy system integration
Purpose: Allows incompatible interfaces to work together
Each pattern document includes cross-references to:
- Command Documentation: Where the pattern is used in scan/detect/analyze-threats
- Architecture Documentation: How the pattern fits into the overall system
- Code Locations: Specific files and classes implementing the pattern
When working on the HawkEye codebase:
- Before Adding New Components: Check if existing patterns can be extended
- When Modifying Existing Code: Ensure pattern integrity is maintained
- During Code Reviews: Verify pattern implementations follow documented structure
- For New Features: Consider which patterns are most appropriate
As the codebase evolves, patterns may need to be:
- Extended: Adding new concrete implementations
- Modified: Adapting to new requirements while maintaining core structure
- Refactored: Improving implementation while preserving interface contracts
- Deprecated: Replacing with better alternatives when necessary
When updating pattern documentation:
- Keep examples current with the codebase
- Update UML diagrams when structure changes
- Document any deviations from standard pattern implementations
- Maintain cross-references to command documentation