Skip to Content
Nextra 2 Alpha
User GuideEnhanced Dependencies Command

Enhanced Dependencies Command

The Rhema dependencies command has been significantly enhanced to provide comprehensive dependency analysis using lock file data. This allows for accurate dependency impact analysis, version conflict detection, and detailed comparison between lock file and current state.

Overview

The enhanced dependencies command provides multiple analysis modes and comprehensive reporting options. It can analyze dependencies from either the current state or the lock file, compare them, and provide detailed insights into dependency relationships, conflicts, and impact.

Command Options

Analysis Mode Options

  • --lock-file: Analyze dependencies from the lock file instead of current state
  • --compare: Compare lock file with current state and report differences
  • --visualize: Show enhanced dependency chain visualization
  • --conflicts: Detect and report version conflicts
  • --impact: Show detailed dependency impact analysis

Output Format Options

  • --format text: Output in human-readable text format (default)
  • --format json: Output in JSON format for programmatic processing
  • --format yaml: Output in YAML format for configuration files

Usage Examples

Basic Dependency Analysis

# Analyze current dependencies rhema dependencies # Analyze dependencies from lock file rhema dependencies --lock-file # Compare lock file with current state rhema dependencies --compare

Advanced Analysis

# Full analysis with visualization rhema dependencies --lock-file --visualize --conflicts --impact # Output in JSON format for automation rhema dependencies --compare --format json # Detect conflicts only rhema dependencies --conflicts

Analysis Features

1. Accurate Dependency Impact Analysis

The enhanced command provides precise dependency impact analysis using lock file data:

  • Dependency Depth Calculation: Determines how many levels deep each scope’s dependencies go
  • High Impact Scope Identification: Identifies scopes with the most dependencies
  • Independent Scope Detection: Finds scopes with no dependencies
  • Transitive Dependency Analysis: Analyzes dependencies of dependencies

Example Output:

πŸ“ˆ Enhanced Dependency Impact Analysis ================================================== πŸ† High Impact Scopes: πŸ”΄ Critical main-app (8 dependencies) 🟑 High shared-lib (5 dependencies) 🟒 Medium utils (3 dependencies) πŸ”΅ Low config (1 dependencies) 🟒 Independent Scopes: πŸ“¦ standalone-tool πŸ“¦ documentation

2. Version Conflict Detection

Comprehensive version conflict detection between lock file and current state:

  • Version Mismatches: Detects when current versions differ from locked versions
  • Missing Dependencies: Identifies dependencies in lock file but not in current state
  • Extra Dependencies: Finds dependencies in current state but not in lock file
  • Type Mismatches: Detects changes in dependency types

Example Output:

⚠️ Version Conflicts: πŸ”΄ main-app β†’ shared-lib: expected 1.0.0, got 2.0.0 🟑 main-app β†’ missing-dep: expected 1.0.0, got missing 🟒 utils β†’ extra-dep: expected missing, got 1.0.0

3. Dependency Chain Visualization

Enhanced visualization of dependency relationships:

  • Hierarchical Display: Shows dependency tree structure
  • Impact Indicators: Visual indicators for high-impact dependencies
  • Circular Dependency Detection: Highlights circular dependency chains
  • Longest Chain Analysis: Identifies the longest dependency chains

Example Output:

🎨 Dependency Graph Visualization: πŸ“Š Enhanced Dependency Graph ================================================== πŸ“ main-app β”œβ”€β”€ πŸ“¦ shared-lib β”‚ β”œβ”€β”€ πŸ“„ utils β”‚ └── πŸ“„ config └── πŸ“¦ external-api └── πŸ“„ auth-service πŸ“ shared-lib β”œβ”€β”€ πŸ“„ utils └── πŸ“„ config πŸ“ utils └── πŸ”΄ Independent (no dependencies)

4. Performance Optimization

The command uses pre-computed dependency graphs for improved performance:

  • Lock File Caching: Leverages pre-computed dependency information
  • Incremental Analysis: Only analyzes changed dependencies when possible
  • Efficient Graph Algorithms: Uses optimized algorithms for large dependency graphs
  • Memory Management: Efficient memory usage for large projects

5. Comparison Between Lock File and Current State

Detailed comparison reporting:

  • Scope Differences: Added, removed, or modified scopes
  • Dependency Changes: Changes in dependency relationships
  • Version Updates: Version changes between lock file and current state
  • Structural Changes: Changes in dependency structure

Example Output:

πŸ”„ Differences between lock file and current state: βž• main-app: Dependency 'new-feature' added βž– utils: Dependency 'old-lib' removed πŸ”„ shared-lib: Dependency 'auth-service' version changed from 1.0.0 to 2.0.0

Output Formats

Text Format (Default)

Human-readable output with color coding and emojis for easy scanning:

πŸ“Š DEPENDENCY ANALYSIS RESULTS ================================================================================ πŸ“ˆ Statistics: β€’ Total scopes: 15 β€’ Scopes with dependencies: 12 β€’ Independent scopes: 3 β€’ Circular dependencies: 0 β€’ Version conflicts: 2 πŸ† High Impact Scopes: πŸ”΄ Critical main-app (8 dependencies) 🟑 High shared-lib (5 dependencies) ⚠️ Version Conflicts: πŸ”΄ main-app β†’ shared-lib: expected 1.0.0, got 2.0.0

JSON Format

Structured data for programmatic processing:

{ "analysis": { "total_scopes": 15, "dependency_depths": { "main-app": 8, "shared-lib": 5 }, "circular_dependencies": [], "version_conflicts": [ { "scope": "main-app", "dependency": "shared-lib", "expected_version": "1.0.0", "actual_version": "2.0.0", "conflict_type": "VersionMismatch" } ], "longest_chains": [ ["main-app", "shared-lib", "utils", "config"] ], "high_impact_scopes": [ ["main-app", 8], ["shared-lib", 5] ], "independent_scopes": ["standalone-tool", "documentation"], "differences": [ { "scope": "main-app", "difference_type": "Added", "details": "Dependency 'new-feature' added" } ] } }

YAML Format

Configuration-friendly output:

analysis: total_scopes: 15 dependency_depths: main-app: 8 shared-lib: 5 circular_dependencies: [] version_conflicts: - scope: main-app dependency: shared-lib expected_version: "1.0.0" actual_version: "2.0.0" conflict_type: VersionMismatch longest_chains: - - main-app - shared-lib - utils - config high_impact_scopes: - - main-app - 8 - - shared-lib - 5 independent_scopes: - standalone-tool - documentation differences: - scope: main-app difference_type: Added details: "Dependency 'new-feature' added"

Integration with Other Commands

The enhanced dependencies command integrates with other Rhema commands:

  • Health Command: Uses dependency analysis for lock file health checks
  • Validation Command: Leverages dependency information for validation
  • Impact Command: Provides dependency impact data for change analysis
  • Sync Command: Uses dependency information for synchronization

Best Practices

For Development Teams

  1. Regular Analysis: Run dependency analysis regularly to catch issues early
  2. Lock File Comparison: Use --compare to ensure lock file stays in sync
  3. Conflict Detection: Use --conflicts before major updates
  4. Impact Assessment: Use --impact to understand change implications

For CI/CD Pipelines

  1. JSON Output: Use --format json for automated processing
  2. Conflict Checking: Include --conflicts in validation pipelines
  3. Comparison Monitoring: Use --compare to detect drift
  4. Performance Monitoring: Track analysis time for large projects

For Large Projects

  1. Incremental Analysis: Use lock file analysis for faster results
  2. Focused Analysis: Use specific flags to analyze only what’s needed
  3. Output Filtering: Use JSON output and filter results programmatically
  4. Caching: Leverage lock file caching for repeated analysis

Troubleshooting

Common Issues

  1. No Lock File Found: Use current state analysis or generate lock file first
  2. Large Analysis Times: Use --lock-file for faster analysis of large projects
  3. Memory Issues: Use specific flags to limit analysis scope
  4. Output Format Issues: Ensure proper JSON/YAML parsing for automated tools

Performance Tips

  1. Use Lock File: Lock file analysis is typically faster than current state analysis
  2. Limit Scope: Use specific flags to analyze only what you need
  3. Batch Processing: Use JSON output for batch processing of multiple projects
  4. Caching: Lock file data is cached for repeated analysis

Future Enhancements

Planned improvements for the dependencies command:

  1. Graph Visualization: Interactive dependency graph visualization
  2. Dependency Metrics: Advanced metrics and analytics
  3. Predictive Analysis: Predict impact of dependency changes
  4. Integration APIs: Programmatic access to dependency analysis
  5. Real-time Monitoring: Continuous dependency monitoring
  6. Advanced Filtering: More sophisticated filtering and querying options
Last updated on