% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scan_dependencies.R
\name{scan_dependencies}
\alias{scan_dependencies}
\title{Unused Dependency Scanner}
\usage{
scan_dependencies()
}
\value{
Invisibly returns a named list with components: \code{status} ("done",
"cancelled", "clean", or "error"), \code{script}, \code{external_packages},
and \code{unused_packages} (character vectors).
}
\description{
Scans a specified R script for function calls, cross-references them 
against currently attached packages, and interactively helps the user 
resolve unused dependencies based on their current workflow.
}
\details{
The function provides different resolution paths depending on the detected context:
\enumerate{
  \item \strong{Package Development}: If a `DESCRIPTION` file is found, it flags 
      unused packages that should be removed from the `Imports` field.
  \item \strong{Data Analysis}: If the user is working in an active session, 
      it offers to detach idle packages and call `gc()` to reclaim RAM.
  \item \strong{Raw Script Cleaning}: It generates an optimized block of 
      `library()` calls containing only the packages actually required by the script.
}
}
\section{Warning}{

This function modifies files on disk or the global environment. Please ensure you have a backup or are using version control (e.g., Git) before execution.
}

\examples{
if (interactive()) {
  scan_dependencies()
}
}
