Landscape Analysis CLI
landscape_analysis
is a Dart CLI tool for analyzing Dart package dependencies and generating visual dependency graphs. It reads pubspec.yaml
files, builds a dependency tree, and supports different output formats.
Features
- Fetch dependencies from a GitLab group using API credentials.
- Analyze dependencies from a folder of Dart
pubspec.yaml
files. - Output dependency graphs in dot, gexf, graphml or json format.
Prerequisites
- Dart SDK: Install the Dart SDK.
Installation
Option 1: Install with dart pub activate
Activate landscape_analysis
directly from pub.dev
or a Git repository.
-
From
pub.dev
:dart pub activate landscape_analysis
Option 2: Compile a Standalone Executable
-
Clone the repository:
git clone https://github.com/yourusername/landscape_analysis.git cd landscape_analysis
-
Compile the executable:
dart compile exe bin/landscape_analysis.dart -o landscape_analysis
-
Run the executable:
./landscape_analysis <command> <options>
Usage
Put the pubspec.yaml
files in a folder and run the following command to analyze them:
landscape_analysis analyze --format <format> ./path/to/your/folder > output
Optional: You can fetch pubspec.yaml
files from a gitlab group using:
landscape_analysis fetch gitlab --token <token> --group-id <group-id> --api-url <api-url>
Visualize the graph
It is recommended to use yEd (uses graphml-format) for visualization, if a hierarchical structure is desired. For simple graphs GraphViz (uses dot-format) is sufficient. And some metrics can be calculated in Gephi (uses gexf-format).
Contributing
Contributions are welcome! Open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Libraries
- cli/cli_runner
- cli/commands/analyze_command
- cli/commands/fetch-command/base_fetch_command
- cli/commands/fetch-command/fetch_command
- cli/commands/fetch-command/gitlab_command
- cli/commands/fetch-command/local_command
- core/input/gitlab_source
- core/input/http/api_client
- core/input/local_source
- core/input/pubspec_source
- core/output/dot_generator
- core/output/gexf_generator
- core/output/graph_ml_generator
- core/output/json_generator
- core/output/output_generator
- core/processing/dependency_edge
- core/processing/dependency_graph_parser
- core/processing/dependency_node
- core/processing/graph/edge
- core/processing/graph/graph
- core/processing/graph/node
- core/processing/pubspec_loader