Skip to main content

write_artifacts

Function write_artifacts 

Source
pub fn write_artifacts(
    output_dir: &Path,
    artifacts: &[GeneratedArtifact],
    force: bool,
) -> Result<Vec<PathBuf>, CoreError>
Expand description

Write generated artifacts into output_dir.

Returns the full paths of every file written (in artifact order), suitable for echoing to the user. This is the single source of truth for write policy: both the CLI and the MCP server route through it.

By default the writer refuses to overwrite an existing file — it fails loudly before touching the disk. Pass force = true to replace existing files instead. The collision check (two artifacts mapping to one destination) is always enforced regardless of force, since that signals a target-design bug rather than stale output.