This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
PatternFly Analytics is a tool that analyzes PatternFly usage across Red Hat products. It clones repositories, scans their source code for PatternFly imports and usage, and generates detailed analytics reports.
-
Static Analysis Pipeline (
src/static-analysis/): Main analysis engine that processes repositoriescli.js: Entry point that orchestrates the collection processgetPatternflyStats.js: Extracts PatternFly component usage statisticsgetPackageStats.js: Analyzes package dependencies and versionsgetSortedImports.js: Categorizes and sorts import usage datagetDeprecatedComponents.js: Identifies usage of deprecated components
-
HTML Analysis (
src/html-analysis/): Web crawling functionality for HTML-based analysiscrawler.js: Puppeteer-based web crawleraggregator.js: Processes crawled data
- Repository list defined in
repos.json npm run collectclones/updates repos in/tmpdirectory- Static analysis modules scan each repository's source code
- Results written to
/stats-static/{YYYY-MM-DD}/with multiple JSON output files - Python script
to_xls.pyconverts JSON data to Excel reports
Each analysis run creates these files in /stats-static/{date}/:
_all.json: Import path usage statistics_all_dependencies.json: Dependency analysis across productsall_pf_versions.json: PatternFly package versions by repository_all_product_uses.json: Component usage by product with file locations_all_sorted.json: Components categorized by PatternFly package_deprecated_usage.json: Deprecated component usage tracking
_dependents_analysis.json: Complete analysis of all PatternFly package dependents_suggested_repos.json: Prioritized list of repositories to consider adding_dependents_by_package.json: Summary of missing dependents by PatternFly package
npm run collect # Run complete analysis pipeline
npm run collect-with-dependents # Run analysis + GitHub dependents analysis
npm run collect -- -c # Clean /tmp directory before collection
npm run collect -- -j -d # Run with package stats and dependents analysisnpm run analyze-dependents # Compare GitHub dependents with local repos.json
npm run sync-dependents # Create PR to add missing dependents (requires GITHUB_TOKEN)
# Custom repository analysis
node src/github-dependents-analyzer.js --repo-url https://github.com/patternfly/patternfly-react
node src/github-dependents-analyzer.js --repo-url https://github.com/patternfly/patternfly-react --create-pr# Generate Excel reports from JSON data
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt
python3 to_xls.pyrepos.json: Defines which repositories to analyze- Each entry has
git(repository URL) andname(display name) - Add new repositories by editing this file
- Import Analysis: Tracks how components are imported (
@patternfly/react-corevs@patternfly/react-core/) - Usage Tracking: Counts component usage across files with exact file locations
- Version Analysis: Maps PatternFly package versions to consuming repositories
- Deprecation Tracking: Identifies deprecated component usage for migration planning
- Results in
/stats-static/are organized by date - JSON files contain raw analysis data
- Excel reports provide user-friendly views of the data
- Use
_all_product_uses.jsonto find where specific components are used - Use
_deprecated_usage.jsonto track migration needs