Skip to contents

Writes a path-safe reproducible study directory containing:

  • spec.yaml: the validated declarative spec_ir specification;

  • simulation.R: the deterministic, AST-verified standalone R script;

  • report.qmd: the sanitized reproducible Quarto report; and

  • bundle_manifest.json: SHA-256 checksums for every exported file plus the static AST safety attestation from verify_compiled_r_ast().

Usage

export_spec_bundle(
  spec,
  dir,
  overwrite = FALSE,
  format = "html",
  execute_report = TRUE
)

Arguments

spec

A validated spec_ir object.

dir

Character path to the target bundle directory (created if needed). Must not contain .. path-traversal segments.

overwrite

Logical; if FALSE (default), refuses to overwrite existing bundle files in dir.

format

Quarto report output format (defaults to "html").

execute_report

Logical; whether Quarto report chunks default to eval: true (default) or eval: false.

Value

Invisibly returns a named list with dir, files, manifest, and ast_verification.

Examples

spec <- new_spec_ir(hierarchy = list(levels = 1L, n_obs = 120L),
                    simulation = list(n_reps = 10L, seed = 42L))
out_dir <- file.path(tempdir(), "specshiny_bundle_example")
res <- export_spec_bundle(spec, out_dir, overwrite = TRUE)
verify_spec_bundle(out_dir)$valid
#> [1] TRUE
unlink(out_dir, recursive = TRUE)