Compiles deployment prelude SOURCE into a %PtcRunner.Lisp.Prelude{}
artifact (Capability Prelude V1, plan §1 / §3).
What this does
- Parses the prelude source to raw AST.
- Walks the top-level program treating
(ns name "doc" {meta})as a COMPILER-ONLY directive (not a general user-runtime form), anddefn/defn-as export/private-helper definitions under the current namespace. - Runs compile-time validation that does NOT depend on a selected
runtime: reserved-namespace rejection, missing/invalid namespace,
duplicate public refs, invalid visibility, invalid arity/signature
metadata. Failures are returned as
{:error, %PtcRunner.Lisp.Prelude.ValidationError{}}. - Builds
%Export{}records for public definitions, normalizing kebab-case PTC-Lisp metadata keywords (:provider-ref) at the host boundary and inferring backing metadata only for literal(tool/call {:server "x" :tool "y" ...})patterns (plan §3). - Captures a callable private prelude env by analyzing+evaluating the
definition forms (ns directives stripped,
defn-rewritten todefn) through the existing PTC-Lisp pipeline. The captured value is the resultinguser_nsmap (bare symbol =>{:closure, ...}). NOTE: the evaluator's lexical closure capture does NOT fold sibling top-level defs into each closure'scaptured_env— sibling helpers resolve by name throughuser_nsat CALL time. The wholeprivate_envmap IS that namespace, so P2 must threadprivate_envas the user_ns layer when invoking an export for siblings to resolve (fact #6 capture seam, proven end-to-end during P0). - Computes a sha256 source hash (plan §12).
Attach-time requires validation against a selected upstream runtime is a
SEPARATE later phase and is not performed here.
Summary
Functions
Compiles prelude source into a %PtcRunner.Lisp.Prelude{}.
Functions
@spec compile(String.t()) :: {:ok, PtcRunner.Lisp.Prelude.t()} | {:error, PtcRunner.Lisp.Prelude.ValidationError.t()}
Compiles prelude source into a %PtcRunner.Lisp.Prelude{}.
Returns {:ok, prelude} or {:error, %ValidationError{}}.