Skip to content

Rust Artifact Discovery#34

Merged
mors119 merged 1 commit into
FrilLab:mainfrom
mors119:feature/finished-epic1
Jun 1, 2026
Merged

Rust Artifact Discovery#34
mors119 merged 1 commit into
FrilLab:mainfrom
mors119:feature/finished-epic1

Conversation

@mors119
Copy link
Copy Markdown
Collaborator

@mors119 mors119 commented Jun 1, 2026

Description

Completed "detector v0.1.0" from "crates/dustfril-core".

"crates/dustfril-core"의 "detecter v0.1.0"를 완성했습니다.

Expected Behavior

Run "cargo run -p dustfril-cli -- scan" in the project route to get the output.

프로젝트 루트에서 "cargo run -p dustfril-cli -- scan"을 실행하면, 출력 결과를 얻을 수 있습니다.

Additional Notes

Closes #3
Closes #8
Closes #9
Closes #10
Closes #11
Closes #12
Closes #13
Closes #14
Closes #32
Closes #33

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

    • Launched dfr command-line tool to identify Rust project artifacts via the scan command
    • Added GitHub issue templates for Epic, Feature Task, and Task workflows
  • Tests

    • Added test coverage for artifact detection functionality

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR implements a complete artifact detection system for the dustfril project: defines models for representing Rust artifacts, adds detector modules for identifying Cargo projects and dependency caches, refactors scanning into a composable API, integrates clap for CLI parsing, and delivers a working dfr scan command with placeholder implementations for analyze and clean subcommands.

Changes

Artifact Detection and Scan Command

Layer / File(s) Summary
Artifact models and data contracts
crates/dustfril-core/src/models/artifact_type.rs, crates/dustfril-core/src/models/artifact_location.rs, crates/dustfril-core/src/models/scan_result.rs, crates/dustfril-core/src/models/mod.rs
ArtifactType enum defines Target, CargoRegistry, and CargoGit variants with Display formatting; ArtifactLocation pairs paths with artifact types; ScanResult holds vectors of artifacts; models are re-exported via pub use statements.
Individual artifact detectors
crates/dustfril-core/src/detector/cargo_project.rs, crates/dustfril-core/src/detector/target.rs, crates/dustfril-core/src/detector/registry.rs, crates/dustfril-core/src/detector/git.rs
Four detector modules provide detect() or is_cargo_project() functions that identify Cargo.toml, target build directories, Cargo registry cache (~/.cargo/registry), and git cache (~/.cargo/git) using filesystem checks and HOME environment variable resolution.
Scan orchestration and API
crates/dustfril-core/src/detector/scan.rs, crates/dustfril-core/src/detector/mod.rs
scan_project(root) detects local project artifacts; scan_global() detects user-level caches; scan(root) combines both into a single ScanResult. detector/mod.rs aggregates submodules and re-exports the public scanning API.
CLI framework with clap
apps/dustfril-cli/Cargo.toml, apps/dustfril-cli/src/cli.rs, apps/dustfril-cli/src/main.rs
Cargo.toml adds clap v4 with derive feature and defines the dfr binary target; cli.rs defines Cli parser struct and Commands enum with Scan, Analyze, Clean variants; main.rs imports modules and sets up clap dependency.
Scan command implementation
apps/dustfril-cli/src/commands/scan.rs, apps/dustfril-cli/src/main.rs
commands/scan.rs executes core scanning on the current directory, printing artifact count and details or "No Rust artifacts found" for empty results; main.rs dispatch routes the Scan command to this executor.
Command module structure
apps/dustfril-cli/src/commands/mod.rs, apps/dustfril-cli/src/commands/analyze.rs, apps/dustfril-cli/src/commands/clean.rs
commands/mod.rs exports analyze, clean, and scan submodules; analyze and clean modules provide stub execute() functions printing "not implemented yet" messages.
Detector tests and configuration
crates/dustfril-core/Cargo.toml, crates/dustfril-core/src/detector/tests.rs
Cargo.toml adds tempfile v3.0 dev-dependency; tests.rs provides three unit tests validating scan_project behavior with temporary directories for non-Cargo projects, projects without target directories, and successful target detection.
Issue templates
.github/ISSUE_TEMPLATE/EPIC.md, .github/ISSUE_TEMPLATE/FEATURE_TESK.md, .github/ISSUE_TEMPLATE/TASK.md
EPIC.md adjusts spacing after YAML front-matter; FEATURE_TESK.md defines Feature template with enhancement label and description/tasks sections; TASK.md introduces Task template with description and "Done When" checklist sections.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

  • #6: Main implementation of the Rust artifact discovery referenced in the EPIC—adds detector modules for Cargo projects, build targets, and dependency caches, implements scan orchestration and models, and delivers the scan CLI command.
  • #3: Implements the dfr scan command with artifact detection and output formatting, directly addressing the feature requirement.
  • #8: Completes the clap command structure setup with the Cli parser and Commands enum routing.
  • #9, #10, #11, #12: Fulfill individual artifact detection requirements via dedicated detector modules for Cargo.toml, target directories, registry caches, and git caches.
  • #13: Delivers the artifact model layer with ArtifactType, ArtifactLocation, and ScanResult.
  • #14, #32, #33: Addresses scan output by printing artifacts with type and path details, formatting improvements, and empty-result handling.

Poem

🐰 A scan command springs forth, detecting all the things—
Target dirs, registries, git caches on swift wings.
Models bloom, detectors hum, clap commands align,
The Dustfril CLI now runs—artifact discovery shines!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Rust Artifact Discovery' clearly and concisely summarizes the main objective of the PR: implementing artifact discovery functionality for Rust projects.
Linked Issues check ✅ Passed All linked issue objectives are met: CLI structure with clap [#8], Cargo.toml detection [#9], target directory detection [#10], Cargo registry detection [#11], Cargo git detection [#12], artifact model definition [#13], scan results display [#14], scan command implementation [#3], output formatting [#32], and empty result handling [#33].
Out of Scope Changes check ✅ Passed All changes are directly aligned with linked issue requirements: GitHub issue templates for project management, CLI implementation, detector modules, models, and scan functionality are all within scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
crates/dustfril-core/src/detector/cargo_project.rs (1)

3-3: 💤 Low value

Doc comment doesn't match function behavior.

The comment mentions "artifact scanning" but this function only performs Cargo project detection. Consider updating to: /// Checks whether a directory is a Cargo project.

🤖 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/detector/cargo_project.rs` at line 3, Update the
top-level/doc comment that currently reads "Cargo project detection and artifact
scanning" to accurately reflect the function's behavior—replace it with a
precise description such as "Checks whether a directory is a Cargo project."
Locate the comment in crates/dustfril-core/src/detector/cargo_project.rs (the
module housing the Cargo detection logic, e.g., the function that performs
project detection) and edit the doc comment to match the actual behavior.
🤖 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/detector/git.rs`:
- Around line 15-17: The existence check for the detected git artifact is
insufficient—update the conditional that currently uses git_path.exists() to
also verify it's a directory (e.g., change to git_path.exists() &&
git_path.is_dir()) so that a regular file named "git" won't be treated as the
git directory; locate the check around the git_path variable in the
detector/git.rs detection function and return None unless both conditions are
true.

In `@crates/dustfril-core/src/detector/registry.rs`:
- Around line 15-17: The existence check for the registry artifact is too
permissive—update the conditional that currently uses registry_path.exists()
(the branch that returns None when not found) to also require
registry_path.is_dir(), i.e., only treat the path as valid if it both exists and
is a directory; modify the conditional around registry_path to use &&
registry_path.is_dir() so files named "registry" aren't misidentified as the
registry directory.

In `@crates/dustfril-core/src/detector/target.rs`:
- Around line 8-10: The existence check for the detected artifact should ensure
it's a directory, not just any filesystem entry: update the conditional that
currently uses target_path.exists() (in detector/target.rs where target_path is
checked) to also require target_path.is_dir() (e.g., change the guard to if
!target_path.exists() || !target_path.is_dir() { return None; } or equivalent)
so only a real "target" directory is accepted.

---

Nitpick comments:
In `@crates/dustfril-core/src/detector/cargo_project.rs`:
- Line 3: Update the top-level/doc comment that currently reads "Cargo project
detection and artifact scanning" to accurately reflect the function's
behavior—replace it with a precise description such as "Checks whether a
directory is a Cargo project." Locate the comment in
crates/dustfril-core/src/detector/cargo_project.rs (the module housing the Cargo
detection logic, e.g., the function that performs project detection) and edit
the doc comment to match the actual behavior.
🪄 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: eb730eba-7af1-4b6a-b2ab-37fee3f5a4cd

📥 Commits

Reviewing files that changed from the base of the PR and between 0fc6f7e and 1c74ccf.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (23)
  • .github/ISSUE_TEMPLATE/EPIC.md
  • .github/ISSUE_TEMPLATE/FEATURE_TESK.md
  • .github/ISSUE_TEMPLATE/TASK.md
  • apps/dustfril-cli/Cargo.toml
  • apps/dustfril-cli/src/cli.rs
  • apps/dustfril-cli/src/commands/analyze.rs
  • apps/dustfril-cli/src/commands/clean.rs
  • apps/dustfril-cli/src/commands/mod.rs
  • apps/dustfril-cli/src/commands/scan.rs
  • apps/dustfril-cli/src/main.rs
  • crates/dustfril-core/Cargo.toml
  • crates/dustfril-core/src/detector/cargo_project.rs
  • crates/dustfril-core/src/detector/git.rs
  • crates/dustfril-core/src/detector/mod.rs
  • crates/dustfril-core/src/detector/registry.rs
  • crates/dustfril-core/src/detector/scan.rs
  • crates/dustfril-core/src/detector/target.rs
  • crates/dustfril-core/src/detector/tests.rs
  • crates/dustfril-core/src/lib.rs
  • crates/dustfril-core/src/models/artifact_location.rs
  • crates/dustfril-core/src/models/artifact_type.rs
  • crates/dustfril-core/src/models/mod.rs
  • crates/dustfril-core/src/models/scan_result.rs
💤 Files with no reviewable changes (4)
  • crates/dustfril-core/src/lib.rs
  • .github/ISSUE_TEMPLATE/TASK.md
  • .github/ISSUE_TEMPLATE/FEATURE_TESK.md
  • .github/ISSUE_TEMPLATE/EPIC.md

Comment on lines +15 to +17
if !git_path.exists() {
return None;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Verify that the detected path is a directory.

The current check only verifies existence. A file named "git" in ~/.cargo would be incorrectly identified as an artifact. Add && git_path.is_dir() to ensure you're detecting the git directory.

🛡️ Proposed fix
-    if !git_path.exists() {
+    if !git_path.exists() || !git_path.is_dir() {
         return None;
     }
📝 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
if !git_path.exists() {
return None;
}
if !git_path.exists() || !git_path.is_dir() {
return None;
}
🤖 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/detector/git.rs` around lines 15 - 17, The existence
check for the detected git artifact is insufficient—update the conditional that
currently uses git_path.exists() to also verify it's a directory (e.g., change
to git_path.exists() && git_path.is_dir()) so that a regular file named "git"
won't be treated as the git directory; locate the check around the git_path
variable in the detector/git.rs detection function and return None unless both
conditions are true.

Comment on lines +15 to +17
if !registry_path.exists() {
return None;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Verify that the detected path is a directory.

The current check only verifies existence. A file named "registry" in ~/.cargo would be incorrectly identified as an artifact. Add && registry_path.is_dir() to ensure you're detecting the registry directory.

🛡️ Proposed fix
-    if !registry_path.exists() {
+    if !registry_path.exists() || !registry_path.is_dir() {
         return None;
     }
📝 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
if !registry_path.exists() {
return None;
}
if !registry_path.exists() || !registry_path.is_dir() {
return None;
}
🤖 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/detector/registry.rs` around lines 15 - 17, The
existence check for the registry artifact is too permissive—update the
conditional that currently uses registry_path.exists() (the branch that returns
None when not found) to also require registry_path.is_dir(), i.e., only treat
the path as valid if it both exists and is a directory; modify the conditional
around registry_path to use && registry_path.is_dir() so files named "registry"
aren't misidentified as the registry directory.

Comment on lines +8 to +10
if !target_path.exists() {
return None;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Verify that the detected path is a directory.

The current check only verifies existence, but a file named "target" would be incorrectly identified as an artifact. Add && target_path.is_dir() to ensure you're detecting the target directory, not a file.

🛡️ Proposed fix
-    if !target_path.exists() {
+    if !target_path.exists() || !target_path.is_dir() {
         return None;
     }
📝 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
if !target_path.exists() {
return None;
}
if !target_path.exists() || !target_path.is_dir() {
return None;
}
🤖 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/detector/target.rs` around lines 8 - 10, The
existence check for the detected artifact should ensure it's a directory, not
just any filesystem entry: update the conditional that currently uses
target_path.exists() (in detector/target.rs where target_path is checked) to
also require target_path.is_dir() (e.g., change the guard to if
!target_path.exists() || !target_path.is_dir() { return None; } or equivalent)
so only a real "target" directory is accepted.

@mors119 mors119 merged commit 13169da into FrilLab:main Jun 1, 2026
2 checks passed
@mors119 mors119 deleted the feature/finished-epic1 branch June 1, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant