### Install pkgrank with Windows PowerShell Installer Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Installs pkgrank using a PowerShell script for Windows. No Rust toolchain is required. ```powershell # Windows (PowerShell) powershell -ExecutionPolicy ByPass -c "irm https://github.com/arclabs561/pkgrank/releases/latest/download/pkgrank-installer.ps1 | iex" ``` -------------------------------- ### Install pkgrank with macOS/Linux Installer Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Installs pkgrank using a curl script for macOS and Linux. No Rust toolchain is required. ```bash # macOS / Linux curl --proto '=https' --tlsv1.2 -LsSf https://github.com/arclabs561/pkgrank/releases/latest/download/pkgrank-installer.sh | sh ``` -------------------------------- ### Quick Start: File-level analysis of local project Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Analyzes structural hotspots in the current local project directory. The ecosystem is auto-detected. ```bash # File-level: structural hotspots in any project pkgrank files . ``` -------------------------------- ### Install and Run Cargo Modules Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Installs the cargo-modules tool and then runs it to analyze a specific crate, listing the top N items by coupling. ```bash cargo install cargo-modules pkgrank modules -p my_crate --lib -n 25 ``` -------------------------------- ### Quick Start: File-level analysis of FastAPI repository Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Analyzes structural hotspots in a project hosted on GitHub by providing its full URL. ```bash pkgrank files https://github.com/fastapi/fastapi ``` -------------------------------- ### Install pkgrank with Cargo Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Installs pkgrank using the Cargo package manager. Requires a Rust toolchain. ```bash cargo install pkgrank ``` -------------------------------- ### Quick Start: Package-level analysis Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Analyzes package dependencies to rank them by importance. Automatically detects the package ecosystem. ```bash # Package-level: rank dependencies by importance (auto-detects ecosystem) pkgrank analyze pkgrank analyze path/to/npm-project pkgrank analyze path/to/python-project ``` -------------------------------- ### Quick Start: File-level directory aggregation Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Aggregates file-level analysis results by directory, useful for large codebases to get a higher-level view. ```bash # Directory-level aggregation for large codebases pkgrank files astral-sh/ruff --directory ``` -------------------------------- ### Quick Start: File-level analysis with Git forge shorthands Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Analyzes structural hotspots in projects hosted on various Git forges using shorthand notations. ```bash # Works with any git forge pkgrank files gl:inkscape/inkscape # GitLab pkgrank files cb:forgejo/forgejo # Codeberg pkgrank files sh:~sircmpwn/aerc # SourceHut pkgrank files bb:pypy/pypy # Bitbucket pkgrank files tg:tangled.org/core # Tangled ``` -------------------------------- ### Quick Start: File-level analysis of GitHub repository Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Analyzes structural hotspots in a project hosted on GitHub by specifying the owner and repository name. ```bash pkgrank files tokio-rs/tokio ``` -------------------------------- ### JSON Output Format Example Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Demonstrates the structure of JSON output for commands that support the --format json flag. This format is wrapped for forwards-compatible parsing. ```json { "schema_version": 1, "ok": true, "command": "files", "rows": [ ... ] } ``` -------------------------------- ### Quick Start: File-level analysis of affected files Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Identifies which files are affected by changes in a specific file or a list of changed files. ```bash # What files are affected by a change? pkgrank files . --affected src/parser.rs git diff --name-only | pkgrank files . --affected - ``` -------------------------------- ### Quick Start: File-level analysis focusing on a specific file Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Focuses the file-level analysis on a particular file within the project, showing its imports, dependents, and co-changers. ```bash # Focus on a specific file pkgrank files . --focus main.rs ``` -------------------------------- ### Quick Start: Upgrade priority analysis (Cargo) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Identifies which outdated dependencies in a Cargo project have the highest priority for upgrading based on their importance and version differences. ```bash # Upgrade priority: which outdated deps matter most? (Cargo only) pkgrank upgrade-priority ``` -------------------------------- ### Quick Start: File-level analysis with Git churn risk Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Combines structural centrality analysis with Git commit history to identify files with high churn risk. ```bash # File-level with git churn risk overlay pkgrank files . --git ``` -------------------------------- ### Quick Start: CI gate for architectural violations Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Configures the file-level analysis to fail the build if architectural violations, such as cycles or layer violations, are detected. ```bash # CI gate: fail on architectural violations pkgrank files . --fail-on-violation ``` -------------------------------- ### Quick Start: Blast radius analysis Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Determines the potential impact or 'blast radius' of a change to a specific package within a project's dependency tree. ```bash # Blast radius: what breaks if serde changes? pkgrank blast-radius serde pkgrank blast-radius express path/to/npm-project ``` -------------------------------- ### Run Cross-Project Queries Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Execute SQL-like queries on project dependency graphs to find hotspots, dependencies, and compare project states. ```bash pkgrank query hotspots # highest churn risk files pkgrank query deps # most-used external deps pkgrank query projects # list all analyzed projects pkgrank query "files lib.rs" # search for files by name pkgrank query compare # diff between last two snapshots pkgrank query drift # centrality changes over time ``` -------------------------------- ### File-level analysis of local project (detailed) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Performs file-level analysis on the current local project, auto-detecting the ecosystem. Uses `go list -json` for Go projects if available, otherwise falls back to static parsing. ```bash # Any local project (ecosystem auto-detected) pkgrank files . ``` -------------------------------- ### Define Architectural Rules with .pkgrank.toml Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Configure project layers and forbidden dependencies using a TOML file. Supports 'deny' and 'allow' rules for enforcing architectural patterns. ```toml [layers] domain = ["src/domain/**", "src/models/**"] infra = ["src/infra/**", "src/db/**"] api = ["src/api/**", "src/routes/**"] # Deny rules: explicitly forbid specific imports [[deny]] from = "domain" to = "infra" # Allow rules: layer may ONLY import from listed layers (stricter) [[allow]] from = "domain" to = ["domain"] # domain may only import domain -- no infra, no api ``` -------------------------------- ### Run All Tests Source: https://github.com/arclabs561/pkgrank/blob/main/CONTRIBUTING.md Execute all tests for the project, including all features, to ensure code correctness. ```bash cargo test --all-features ``` -------------------------------- ### Run Code Formatting and Linting Checks Source: https://github.com/arclabs561/pkgrank/blob/main/CONTRIBUTING.md Execute cargo fmt to check code formatting and cargo clippy to check for lints and warnings. Ensure these pass before committing changes. ```bash cargo fmt --check cargo clippy --all-targets --all-features -- -D warnings ``` -------------------------------- ### File-level analysis of remote repository (detailed) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Analyzes file-level structure of remote repositories specified by URL or shorthand notation. Supports GitHub, GitLab, Codeberg, SourceHut, Bitbucket, and Tangled. ```bash # Any repo via URL or shorthand (owner/repo defaults to GitHub) pkgrank files tokio-rs/tokio pkgrank files https://gitlab.com/inkscape/inkscape pkgrank files cb:forgejo/forgejo ``` -------------------------------- ### File-level analysis with caching Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Enables caching of analysis results to speed up repeated queries for the same project. This can significantly reduce analysis time for frequently accessed projects. ```bash # Cache results for repeated queries pkgrank files . --cache ``` -------------------------------- ### Analyze Packages in a Dependency Graph Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Rank packages within a dependency graph based on centrality metrics. Automatically detects the project's ecosystem. ```bash # Auto-detect: finds Cargo.toml, package-lock.json, uv.lock, or go.mod pkgrank analyze # Explicit ecosystem override pkgrank analyze --ecosystem js path/to/project pkgrank analyze --ecosystem python path/to/project pkgrank analyze --ecosystem go path/to/project # Choose metric pkgrank analyze --metric consumers-pagerank -n 10 # JSON output pkgrank analyze --format json --json-limit 200 ``` -------------------------------- ### File-level analysis with Git churn risk (detailed) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Combines structural centrality with Git commit history to identify files with high churn risk. Requires a Git repository. ```bash # Git churn risk: combine structural centrality with change frequency pkgrank files . --git ``` -------------------------------- ### File-level analysis with directory aggregation (detailed) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Aggregates file-level analysis results by directory, which is beneficial for analyzing large codebases and understanding structural importance at a higher level. ```bash # Directory aggregation for large codebases pkgrank files astral-sh/ruff --directory ``` -------------------------------- ### File-level analysis focusing on a specific file (detailed) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Focuses file-level analysis on a single file, including Git churn risk, to understand its imports, dependents, and co-changing files. ```bash # Focus on one file: see imports, dependents, co-changers, blast radius pkgrank files . --git --focus lib.rs ``` -------------------------------- ### Run Cargo Modules Sweep Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Performs a sweep analysis using cargo-modules across multiple specified crates. ```bash pkgrank modules-sweep -p crate_a -p crate_b --lib ``` -------------------------------- ### Calculate Upgrade Priority for Dependencies (Cargo) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Score outdated dependencies based on their structural importance and the number of dependents. Requires 'cargo-outdated'. ```bash pkgrank upgrade-priority -n 15 # JSON for CI integration pkgrank upgrade-priority --format json | jq '.rows[:5]' ``` -------------------------------- ### Show Transitive Dependents (Blast Radius) Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Display all packages that transitively depend on a specified package. Useful for understanding the blast radius of a package. ```bash pkgrank blast-radius serde pkgrank blast-radius express path/to/npm-project pkgrank blast-radius --workspace-only=false -n 20 serde ``` -------------------------------- ### File-level analysis including test files Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Includes test files in the analysis, which are typically excluded by default. Useful for understanding the structural importance of test code. ```bash # Include test files (excluded by default) pkgrank files . --include-tests ``` -------------------------------- ### CI: File-level analysis for architectural violations Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Configures the file-level analysis to act as a CI gate, failing the build if cycles or layer violations are detected in the project's import graph. ```bash # CI: fail if cycles or layer violations exist pkgrank files . --fail-on-violation ``` -------------------------------- ### Analyze Affected Files Source: https://github.com/arclabs561/pkgrank/blob/main/README.md Identify files that are affected by changes in specified source files. Useful for understanding the impact of modifications. ```bash pkgrank files . --affected src/graph.rs,src/index.rs git diff --name-only | pkgrank files . --affected - ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.