Validated file read boundary for all project file access in channels and controllers.
All file reads that originate from the Studio UI or copilot shell must go through
this module. Direct File.read!/1 calls from channels are forbidden (enforced by
Foundry.LintRules.FileWriteRule in later phases).
Permits reading any file within the project root. Path traversal attacks are prevented by expanding paths and verifying they remain within the root boundary.
See ADR-020 §File system access via Foundry.FileSystem.
Summary
Types
@type read_error() :: :outside_boundary | :not_found | File.posix()
@type write_error() :: :outside_boundary | File.posix()
Functions
@spec read(project_root :: String.t(), relative_path :: String.t()) :: {:ok, String.t()} | {:error, read_error()}
@spec write( project_root :: String.t(), relative_path :: String.t(), content :: String.t() ) :: :ok | {:error, write_error()}