Skip to main content

Module project

Module project 

Source
Expand description

Shared project introspection helpers used by deploy-scaffold commands (docker:init, do:init) and other ferro-cli commands that need to read Cargo.toml, detect optional project directories, or resolve the Rust toolchain version.

All helpers are deliberately tolerant of malformed or missing input: they return safe defaults rather than propagating errors, mirroring the legacy get_package_name() behavior they replace.

Structs§

BinEntry
FerroDeployMetadata
Phase 122.2 §1: provider-neutral Dockerfile inputs declared by the project in [package.metadata.ferro.deploy].
ProjectDirs

Functions§

detect_dirs
Probe the project root for the optional directories used by the deploy scaffold templates.
find_project_root
Walk up from start (or the current working directory if None) until a directory containing Cargo.toml is found. Returns NotFound otherwise.
package_name
Parse <root>/Cargo.toml and return the [package] name. Returns "app" on any failure (missing file, parse error, missing key).
read_bins
Parse <root>/Cargo.toml and return every [[bin]] entry. If no [[bin]] table exists, synthesize one entry from [package] name. Returns an empty Vec only if Cargo.toml is unreadable.
read_deploy_metadata
Read <root>/Cargo.toml and return [package.metadata.ferro.deploy]. Missing table → defaults. Invalid field types → Err.
read_workspace_members
Parse <root>/Cargo.toml and return [workspace] members verbatim. Returns an empty Vec when no [workspace] table exists or parsing fails.
resolve_rust_base_image
If <root>/rust-toolchain.toml exists and contains [toolchain] channel = "X.Y.Z", return rust:X.Y.Z-slim-bookworm. Else return the hardcoded default rust:1.88-slim-bookworm.