feat(cli): add --ipfs-superfluous flag to clean command#1854
Open
saturn-dbeal wants to merge 4 commits intousecannon:devfrom
Open
feat(cli): add --ipfs-superfluous flag to clean command#1854saturn-dbeal wants to merge 4 commits intousecannon:devfrom
saturn-dbeal wants to merge 4 commits intousecannon:devfrom
Conversation
Add a new mode to the cannon clean command that deletes IPFS packages not referenced by any tag in the tags folder. Usage: cannon clean --ipfs-superfluous cannon clean --ipfs-superfluous --no-confirm This helps users free disk space by removing orphaned IPFS cache files that are no longer needed. - Add getReferencedIpfsUrls() to scan tags folder for IPFS references - Add cleanSuperfluousIpfs() to identify and delete unreferenced files - Add --ipfs-superfluous flag to CLI - Add unit tests for new functionality
dbeal-eth
requested changes
Mar 1, 2026
Contributor
dbeal-eth
left a comment
There was a problem hiding this comment.
This is looking good so far. I particularly like how you used careful validation throughout the scanning processes.
one thing we have to be careful about is that its possible for an IPFS file to contain a dependency upon another IPFS file. In this case, we should be keeping those second-order IPFS files as well. Please make changes to ensure this isn't an issue 👍
When cleaning superfluous IPFS packages, recursively scan the content of referenced IPFS cache files to find nested IPFS URLs. This ensures that second-order (and deeper) IPFS dependencies are preserved and not incorrectly marked as superfluous. Adds extractIpfsUrls() and resolveIpfsDependencies() functions to build a complete dependency graph before determining which files are safe to delete. Includes test coverage for nested dependency chains.
Author
|
Addressed review feedback: added recursive IPFS dependency resolution. The clean command now:
Added tests covering the second-order dependency case. |
Author
|
All inline review comments addressed in 7917b33. Changes:
Ready for re-review @dbeal-eth |
- Rename --ipfs-superfluous flag to --ipfs - Use CliLoader.getCacheHash instead of duplicating the function - Replace 'superfluous' terminology with 'orphaned' - Remove formatBytes and space-freed tracking - getReferencedIpfsUrls already returns Set<string> (confirmed)
7917b33 to
e2a6600
Compare
Author
|
All inline review comments have been addressed. Ready for re-review. Changes in commit e2a6600:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new mode to the
cannon cleancommand that deletes IPFS packages not referenced by any tag in the tags folder.Usage
How it works
tags/folder for all.txtand.metafilesipfs_cache/--no-confirm)Benefits
Testing
Draft PR - ready for initial review.