Introduce Core API Layer#78
Conversation
📝 WalkthroughWalkthroughAdds a public ChangesCore API Layer and CLI Migration
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI Command
participant api as dustfril_core::api
participant detector as detector (internal)
participant analyzer as analyzer (internal)
participant cleaner as cleaner (internal)
rect rgba(70, 130, 180, 0.5)
note over CLI,detector: scan command
CLI->>api: scan(root, global)
api->>detector: scan_global() or scan_workspace(root)
detector-->>api: ScanResult
api-->>CLI: ScanResult
end
rect rgba(60, 179, 113, 0.5)
note over CLI,analyzer: analyze command
CLI->>api: scan(root, global)
api->>detector: scan_global() or scan_workspace(root)
detector-->>api: ScanResult
CLI->>api: analyze(ScanResult)
api->>analyzer: analyze(ScanResult)
analyzer-->>api: AnalysisResult
api-->>CLI: AnalysisResult
end
rect rgba(210, 105, 30, 0.5)
note over CLI,cleaner: clean command
CLI->>api: scan(root, global)
api->>detector: scan_global() or scan_workspace(root)
CLI->>api: clean::build_plan(ScanResult)
api->>analyzer: analyze(ScanResult)
api->>cleaner: create_cleanup_plan(AnalysisResult)
cleaner-->>api: CleanupPlan
CLI->>api: clean::execute(CleanupPlan)
api->>cleaner: execute_cleanup(CleanupPlan)
cleaner-->>api: CleanupResult
api-->>CLI: CleanupResult
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
crates/dustfril-core/src/detector/scan.rs (1)
55-61: ⚡ Quick winRemove the commented-out
scanimplementation.Keeping retired API code as comments makes the active contract less clear and increases maintenance noise. Please delete this block instead of preserving it inline.
Proposed cleanup
-// pub fn scan(root: &Path) -> ScanResult { -// let mut result = scan_workspace(root); -// -// result.artifacts.extend(scan_global().artifacts); -// -// result -// }🤖 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/scan.rs` around lines 55 - 61, The commented-out `scan` function implementation should be completely removed from the file rather than kept as inline comments. Delete the entire commented block that includes the function signature for `scan` accepting a root Path parameter and returning ScanResult, along with its implementation body. This cleanup will improve code clarity and reduce maintenance noise by removing retired API code from the active codebase.
🤖 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.
Nitpick comments:
In `@crates/dustfril-core/src/detector/scan.rs`:
- Around line 55-61: The commented-out `scan` function implementation should be
completely removed from the file rather than kept as inline comments. Delete the
entire commented block that includes the function signature for `scan` accepting
a root Path parameter and returning ScanResult, along with its implementation
body. This cleanup will improve code clarity and reduce maintenance noise by
removing retired API code from the active codebase.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 549148c2-7bcd-4d69-b832-073a1107984f
📒 Files selected for processing (16)
.github/PULL_REQUEST_TEMPLATE.mdapps/dustfril-cli/src/commands/analyze.rsapps/dustfril-cli/src/commands/clean.rsapps/dustfril-cli/src/commands/scan.rscrates/dustfril-core/src/analyzer/mod.rscrates/dustfril-core/src/analyzer/tests.rscrates/dustfril-core/src/api/analyze.rscrates/dustfril-core/src/api/clean.rscrates/dustfril-core/src/api/mod.rscrates/dustfril-core/src/api/scan.rscrates/dustfril-core/src/detector/mod.rscrates/dustfril-core/src/detector/scan.rscrates/dustfril-core/src/format/date.rscrates/dustfril-core/src/format/mod.rscrates/dustfril-core/src/format/size.rscrates/dustfril-core/src/lib.rs
💤 Files with no reviewable changes (2)
- crates/dustfril-core/src/analyzer/mod.rs
- crates/dustfril-core/src/format/size.rs
What
The CLI must use the Core API to use the Core function.
Why
To use Core in common, Tauri and the CLI made each function accessible using Core's API layer.
Closes #76
Closes #77
Checklist
Required
Functional Validation
Documentation
Safety
Summary by CodeRabbit