README.md: - Complete feature overview and live demo link - Getting started guide with prerequisites and installation - Development and testing instructions - Architecture overview and component descriptions - Visual guide explaining arrow colors and interactions - Usage tips for finding critical packages and analyzing impact - Future enhancement ideas CLAUDE.md: - Critical context for AI assistants working on the project - Technical implementation details and decisions - Common tasks and how to approach them - Testing strategies and debugging tips - Code style guidelines - Known issues and gotchas - Emphasis on Wolfi (not Alpine) and project goals This documentation ensures the project can be effectively maintained and enhanced by future contributors, whether human or AI. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
5.1 KiB
CLAUDE.md - Project Context for AI Assistants
This document provides essential context for AI assistants (particularly Claude) to effectively work on the Wolfi APK Dependency Visualizer project.
Project Overview
This is a web application that visualizes package dependencies in the Wolfi Linux distribution (NOT Alpine - this is important!). The app provides advanced analytics to help users understand package relationships, identify critical dependencies, and make informed decisions about their system architecture.
Critical Context
What This Project Does
- Visualizes Wolfi package dependencies as an interactive force-directed graph
- Analyzes package criticality - which packages are most depended upon
- Calculates size impact - total disk space including all dependencies
- Shows both forward and reverse dependencies - bidirectional analysis
- Provides system-wide insights via the "Most Critical Packages" dashboard
Key Technical Decisions
- Uses D3.js force simulation for graph layout
- TypeScript for type safety
- Single-page application with no backend required
- APKINDEX file (50MB) is pre-downloaded and served statically
- GitHub Pages deployment via GitHub Actions
- Playwright for automated browser testing
Important Implementation Details
Dependency Analysis Algorithm
The DependencyAnalyzer class provides several key metrics:
- Criticality Score: Direct dependents + (transitive dependents × 0.5)
- Bus Factor: Identifies packages that many others depend on
- Total Size Impact: Recursively calculates package + all dependencies size
- Dependency Depth: Maximum depth of the dependency tree
Visualization Features
-
Three types of dependencies rendered differently:
- Direct dependencies (solid lines)
- Transitive dependencies (dashed lines)
- Reverse dependencies (red lines, showing what depends on this package)
-
Interactive navigation:
- Click any node to re-center the graph on that package
- Search box updates to show current package
- Package details panel shows analytics
-
Performance considerations:
- Graph only shows dependencies to depth 2 by default
- Transitive dependencies can be toggled on/off
- Force simulation stops after stabilization
Testing Infrastructure
- All Playwright test outputs go to
playwright-output/(gitignored) - Test files are prefixed with
test-ordemo- - The
quick-debug.jsscript provides fast screenshot/console capture
Common Tasks
Adding New Analytics
- Add analysis methods to
src/dependency-analyzer.ts - Update
showPackageStats()insrc/index.tsto display results - Add appropriate styling in
src/styles.css
Modifying the Visualization
- Core D3 logic is in
src/visualization.ts - Graph building logic in
buildDependencyGraph()andbuildTransitiveDependencyGraph() - Rendering logic in
renderGraph()
Updating Data
npm run fetch-data # Downloads latest APKINDEX from Wolfi
Deployment
Pushes to main branch automatically trigger GitHub Actions to:
- Build the project
- Deploy to GitHub Pages at https://imjasonh.github.io/apkviz/
Known Issues & Gotchas
- APKINDEX size: The 50MB file triggers GitHub warnings but works fine
- Base path: Production uses
/apkviz/base path, development uses/ - Tooltip cleanup: Must properly manage D3 selections to avoid memory leaks
- Force simulation: Can be CPU intensive with many nodes
Future Enhancement Ideas
-
Security analysis:
- Highlight packages with known vulnerabilities
- Show security update paths
-
Performance optimization:
- Implement virtualization for large graphs
- Add WebGL rendering option
-
Advanced features:
- Circular dependency detection
- Diff between package versions
- Export dependency graphs as DOT files
Testing Approach
When testing changes:
- Use
npm startfor development - Run
node quick-debug.js screenshotfor quick visual checks - Use
node demo-impressive.jsfor full feature demonstration - Check console for errors with
node quick-debug.js console
Code Style Guidelines
- TypeScript: Use proper types, avoid
anywhen possible - D3.js: Chain method calls, use arrow functions
- CSS: Use CSS classes over inline styles
- Comments: Focus on WHY not WHAT
- Git commits: Descriptive messages explaining the change
Important Notes
- This is for Wolfi, NOT Alpine Linux - Never confuse the two
- The visualization should impress friends and shame enemies
- Focus on actionable insights not just pretty graphs
- Performance matters - the app should handle thousands of packages
- The goal is to make dependency management understandable and fun
Contact & Context
This project was created to provide powerful dependency analysis for the Wolfi ecosystem. It should serve as both a practical tool and a showcase of what's possible with modern web technologies and thoughtful data visualization.
When in doubt, prioritize:
- User experience
- Actionable insights
- Performance
- Visual appeal
Remember: Great tools make complex systems understandable!