% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/audit_state.R
\name{audit_script}
\alias{audit_script}
\title{Silent State Auditor}
\usage{
audit_script()
}
\value{
Invisibly returns a named list with components: \code{status} ("done",
"cancelled", or "error"), \code{script}, and \code{changes_found} (logical).
}
\description{
Takes a snapshot of global options, graphical parameters, and the working directory, 
sources a specified R script, and then interactively helps the user identify 
and revert any "hijacked" settings changed by the script.
}
\details{
The function operates as follows:
\enumerate{
  \item Captures the current state of `getwd()`, `options()`, and `par()`.
  \item Prompts the user to select an R script from the current directory to execute.
  \item Sources the selected script, catching any errors that occur during execution.
  \item Captures the "Before" state (working directory, loaded packages, global objects).
  \item Executes the target script.
  \item Captures the "After" state and reports the delta.
}
}
\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()) {
  audit_script()
}
}
