Skip to content

Update documentation and modify core#86

Merged
mors119 merged 3 commits into
FrilLab:mainfrom
mors119:refactor/core-supplementation
Jun 27, 2026
Merged

Update documentation and modify core#86
mors119 merged 3 commits into
FrilLab:mainfrom
mors119:refactor/core-supplementation

Conversation

@mors119

@mors119 mors119 commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

What

Why

Closes #

Checklist

Required

  • cargo check passes
  • cargo fmt --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test passes

Functional Validation

  • I verified the behavior locally
  • I added or updated tests when necessary

Documentation

  • README or docs were updated if needed
  • New configuration or behavior is documented

Safety

  • Cleanup behavior was reviewed for safety
  • No destructive behavior was introduced without confirmation

Summary by CodeRabbit

  • New Features

    • Expanded artifact detection to cover more project types and report cleaner paths in scan results.
    • Added a full scan → analyze → dry-run cleanup → cleanup workflow to the CLI examples.
  • Bug Fixes

    • Improved result ordering so larger items appear first in analysis output.
    • Made path handling and validation more consistent for cleaner command behavior.
  • Documentation

    • Updated README content to reflect broader multi-ecosystem support and refreshed project goals.
    • Improved command and formatting help text for clearer user guidance.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mors119, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 16 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f8f0db84-effd-4d00-916d-b87963236684

📥 Commits

Reviewing files that changed from the base of the PR and between c98482a and 8fe8238.

📒 Files selected for processing (7)
  • crates/dustfril-core/src/api/analyze.rs
  • crates/dustfril-core/src/api/clean.rs
  • crates/dustfril-core/src/error.rs
  • crates/dustfril-core/src/models/analysis.rs
  • crates/dustfril-core/src/models/cleanup.rs
  • crates/dustfril-core/src/models/scan.rs
  • crates/dustfril-core/src/scanner/detector.rs
📝 Walkthrough

Walkthrough

README and CLI text were updated for multi-ecosystem scanning. Core scanner logic now detects Rust, Node, and Java artifact directories, analyzer output is sorted and filesystem traversal uses WalkDir, and cleanup-related docs/tests were added.

Changes

Artifact workflow updates

Layer / File(s) Summary
CLI surface and docs
README.md, README.ko.md, apps/dustfril-cli/src/cli.rs, apps/dustfril-cli/src/commands/scan.rs, apps/dustfril-cli/src/format/*, apps/dustfril-cli/src/shared/path.rs
README text, CLI command metadata, scan output, format helpers, and path validation now describe multi-ecosystem usage and include helper tests.
Detector contract and scan flow
crates/dustfril-core/src/scanner/detector.rs, crates/dustfril-core/src/scanner/scan.rs, crates/dustfril-core/src/scanner/tests.rs, crates/dustfril-core/src/api/scan.rs, crates/dustfril-core/src/models/scan.rs
The detector trait now returns matches plus artifacts, Rust/Node/Java detectors require ecosystem artifact directories, scan aggregates detector-provided artifacts, and scan tests assert the detected paths.
Analysis ordering and traversal
crates/dustfril-core/src/analyzer/analyze.rs, crates/dustfril-core/src/api/analyze.rs, crates/dustfril-core/src/fs/walk.rs
Artifact analysis is sorted by size, directory-size and latest-modified calculations use WalkDir, and the analyze and walk tests exercise the updated traversal.
Cleanup planning and execution
crates/dustfril-core/src/api/clean.rs, crates/dustfril-core/src/cleaner/*, crates/dustfril-core/src/models/cleanup.rs
Cleanup API and planner/executor docs were added, and tests cover recent-artifact planning and executing cleanup against temporary directories.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • FrilLab/dustfril#85: Shares the scanner detector/scan refactor and ecosystem-specific artifact handling.
  • FrilLab/dustfril#39: Overlaps with the scan-to-analyze path and artifact analysis changes in analyzer/analyze.rs.
  • FrilLab/dustfril#50: Touches the CLI path and scan command surface updated in apps/dustfril-cli/src/cli.rs, commands/scan.rs, and shared/path.rs.

Poem

Hop, hop—my whiskers read the diff by moonbeam glow,
target/, node_modules/, and build/ now show.
I scanned, I analyzed, I tidied the trail,
With tests as my carrot, the cleanup won’t fail.
🐇✨ The codebase twitches; this rabbit gives a tail-flick hail.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to the change set, but it is too generic to communicate the main update clearly. Use a more specific title that mentions the core shift to multi-ecosystem scanning and the documentation updates.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 82.46% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/dustfril-cli/src/shared/path.rs (1)

3-11: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Only accept directories as scan roots.

scan::execute passes this straight into api::scan as the project root, so an existing file currently validates here and then falls through to a misleading “No artifacts found.” path. Tightening this to is_dir() also lets the caller own the final error message instead of splitting stderr output across two layers.

Proposed fix
-/// Returns `true` when the given path exists on disk.
+/// Returns `true` when the given path is an existing directory.
 pub fn validate_path(path: &Path) -> bool {
-    if !path.exists() {
-        eprintln!("Path does not exist: {}", path.display());
-
+    if !path.exists() || !path.is_dir() {
         return false;
     }
 
     true
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/dustfril-cli/src/shared/path.rs` around lines 3 - 11, The validate_path
function currently accepts any existing path, including files, which lets
scan::execute pass a non-directory into api::scan and produce a misleading
outcome. Update validate_path to only return true for directories by checking
the Path with is_dir() instead of exists(), and remove the direct stderr
printing so the caller can handle the final error message in one place.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/dustfril-core/src/scanner/detector.rs`:
- Around line 77-93: The Java detector currently treats Maven and Gradle the
same by always matching and returning build/, which misses standard Maven
projects. Update detector.rs so Detector::matches and Detector::artifacts
distinguish pom.xml from build.gradle/build.gradle.kts: Maven should look for
target/ and return a Maven artifact from target/, while Gradle should continue
using build/; keep the existing Java ecosystem type and ensure the helper/test
cases cover pom.xml with target/ separately from Gradle layouts.

---

Outside diff comments:
In `@apps/dustfril-cli/src/shared/path.rs`:
- Around line 3-11: The validate_path function currently accepts any existing
path, including files, which lets scan::execute pass a non-directory into
api::scan and produce a misleading outcome. Update validate_path to only return
true for directories by checking the Path with is_dir() instead of exists(), and
remove the direct stderr printing so the caller can handle the final error
message in one place.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 79aef025-0102-4255-9723-128eaabba1ae

📥 Commits

Reviewing files that changed from the base of the PR and between f7609e6 and c98482a.

📒 Files selected for processing (19)
  • README.ko.md
  • README.md
  • apps/dustfril-cli/src/cli.rs
  • apps/dustfril-cli/src/commands/scan.rs
  • apps/dustfril-cli/src/format/size_format.rs
  • apps/dustfril-cli/src/format/time_format.rs
  • apps/dustfril-cli/src/shared/path.rs
  • crates/dustfril-core/src/analyzer/analyze.rs
  • crates/dustfril-core/src/api/analyze.rs
  • crates/dustfril-core/src/api/clean.rs
  • crates/dustfril-core/src/api/scan.rs
  • crates/dustfril-core/src/cleaner/executor.rs
  • crates/dustfril-core/src/cleaner/plan.rs
  • crates/dustfril-core/src/fs/walk.rs
  • crates/dustfril-core/src/models/cleanup.rs
  • crates/dustfril-core/src/models/scan.rs
  • crates/dustfril-core/src/scanner/detector.rs
  • crates/dustfril-core/src/scanner/scan.rs
  • crates/dustfril-core/src/scanner/tests.rs

Comment on lines +77 to +93
fn matches(&self, root: &Path) -> bool {
(root.join("pom.xml").is_file()
|| root.join("build.gradle").is_file()
|| root.join("build.gradle.kts").is_file()
|| root.join("build.gradle.kts").is_file())
&& root.join("build").is_dir()
}

fn artifacts(&self, root: &Path) -> Vec<Artifact> {
let mut artifacts = Vec::new();
let build = root.join("build");

if build.is_dir()
&& (root.join("pom.xml").is_file()
|| root.join("build.gradle").is_file()
|| root.join("build.gradle.kts").is_file())
{
artifacts.push(Artifact::new(build, Ecosystem::Java));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Handle Maven artifacts separately from Gradle artifacts.

pom.xml identifies Maven, but this detector only matches and returns build/. Standard Maven outputs live under target/, so Java scans will miss normal Maven projects entirely. The new Java test helper also creates pom.xml + build/, so this regression stays untested.

💡 Proposed fix
 impl Detector for JavaDetector {
     fn matches(&self, root: &Path) -> bool {
-        (root.join("pom.xml").is_file()
-            || root.join("build.gradle").is_file()
-            || root.join("build.gradle.kts").is_file())
-            && root.join("build").is_dir()
+        (root.join("pom.xml").is_file() && root.join("target").is_dir())
+            || ((root.join("build.gradle").is_file()
+                || root.join("build.gradle.kts").is_file())
+                && root.join("build").is_dir())
     }
 
     fn artifacts(&self, root: &Path) -> Vec<Artifact> {
         let mut artifacts = Vec::new();
-        let build = root.join("build");
-
-        if build.is_dir()
-            && (root.join("pom.xml").is_file()
-                || root.join("build.gradle").is_file()
-                || root.join("build.gradle.kts").is_file())
-        {
-            artifacts.push(Artifact::new(build, Ecosystem::Java));
+        if root.join("pom.xml").is_file() {
+            let target = root.join("target");
+            if target.is_dir() {
+                artifacts.push(Artifact::new(target, Ecosystem::Java));
+            }
+        }
+
+        if root.join("build.gradle").is_file() || root.join("build.gradle.kts").is_file() {
+            let build = root.join("build");
+            if build.is_dir() {
+                artifacts.push(Artifact::new(build, Ecosystem::Java));
+            }
         }
 
         artifacts
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn matches(&self, root: &Path) -> bool {
(root.join("pom.xml").is_file()
|| root.join("build.gradle").is_file()
|| root.join("build.gradle.kts").is_file()
|| root.join("build.gradle.kts").is_file())
&& root.join("build").is_dir()
}
fn artifacts(&self, root: &Path) -> Vec<Artifact> {
let mut artifacts = Vec::new();
let build = root.join("build");
if build.is_dir()
&& (root.join("pom.xml").is_file()
|| root.join("build.gradle").is_file()
|| root.join("build.gradle.kts").is_file())
{
artifacts.push(Artifact::new(build, Ecosystem::Java));
fn matches(&self, root: &Path) -> bool {
(root.join("pom.xml").is_file() && root.join("target").is_dir())
|| ((root.join("build.gradle").is_file()
|| root.join("build.gradle.kts").is_file())
&& root.join("build").is_dir())
}
fn artifacts(&self, root: &Path) -> Vec<Artifact> {
let mut artifacts = Vec::new();
if root.join("pom.xml").is_file() {
let target = root.join("target");
if target.is_dir() {
artifacts.push(Artifact::new(target, Ecosystem::Java));
}
}
if root.join("build.gradle").is_file() || root.join("build.gradle.kts").is_file() {
let build = root.join("build");
if build.is_dir() {
artifacts.push(Artifact::new(build, Ecosystem::Java));
}
}
artifacts
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/dustfril-core/src/scanner/detector.rs` around lines 77 - 93, The Java
detector currently treats Maven and Gradle the same by always matching and
returning build/, which misses standard Maven projects. Update detector.rs so
Detector::matches and Detector::artifacts distinguish pom.xml from
build.gradle/build.gradle.kts: Maven should look for target/ and return a Maven
artifact from target/, while Gradle should continue using build/; keep the
existing Java ecosystem type and ensure the helper/test cases cover pom.xml with
target/ separately from Gradle layouts.

@mors119 mors119 merged commit 8af0997 into FrilLab:main Jun 27, 2026
3 checks passed
@mors119 mors119 deleted the refactor/core-supplementation branch June 27, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant