How spectronp/sizr works
Project Type and Purpose
• Project Type: Command-line tool (CLI) written in Go.
• Purpose: It calculates the cumulative size of package dependencies that become removable once a target package is deleted. The tool focuses on displaying packages in descending order based on their removable size.
• Use Cases: Running the tool to list high-impact packages, interacting with the package database, and integrating with package manager scripts particularly for Pacman (with possible future support for Apt).
File Structure
• Top-Level Files: Notice the presence of Makefile, LICENSE, README, .editorconfig, and main.go, which indicate a typical Go project with a clear entry point.
• Core Directories:
• data: Contains data handling functions (data.go, data_test.go) likely related to fetching and processing package size data.
• db: Includes code to interact with a database (db.go, db_test.go) – this likely manages the internal package database that tracks package dependencies.
• types: Provides core type definitions.
• utils: Contains utility functions for generic operations.
• vars: Holds global variables or configuration settings.
• scripts: Contains system and package manager-specific scripts (especially for Pacman). These scripts (e.g., get-all.sh, info.sh) likely fetch package details from the system.
• tests: Contains helper code and output files for running integration tests, plus scripts to wrap test execution.
• Configuration & Build: The Makefile, go.mod, and go.sum files are present to manage dependencies and build processes.
Readme Insights
• The README describes the tool’s usage, installation, dependencies (notably jq), and the process for loading package records on first run.
• Dependency on system permission (user being in the "wheel" group) and the interaction with external package managers like Pacman.
Putting It All Together
• Start from the top with the CLI interface and branch into the core processing modules.
• Recursive data processing flow that calculates sizes and the interactions with the database.
• Separate clusters that house the external Pacman scripts and note how these scripts communicate with the main application.