API Reference Foundry v#0.4.0

Copy Markdown View Source

Modules

Foundry keeps the contexts that define your domain and business logic.

Registers standard Foundry annotation module attributes as persistent.

The typed output for mix foundry.compliance.check --json. Reports the implementation and test coverage status for each declared RG-* requirement.

The status of a single RG-* compliance requirement.

Aggregate counts across all requirements.

Ash domain for Foundry's internal resources (Manifest). Used only when loading and validating project manifests.

Ash domain over the instruments: project status, module context, the system graph, lint runs, and spec-kit documents.

The typed output for mix foundry.context.all --json. A map of domain name strings to lists of ModuleContext structs.

ETS-backed cache for module context data.

Generic recursive compact serialization that filters empty values from maps and structs.

Represents a directed edge between two nodes in the project context graph.

Assembles the complete project graph by collecting all nodes and deriving edges between them based on structural and behavioral relationships.

Core Spark DSL introspection logic for mix foundry.context and mix foundry.context.all.

Formats project context for LLM consumption using compact text notation.

Manages the context lock file (.foundry/context.lock) which tracks whether the cached project context is fresh.

The typed output struct for mix foundry.context <Module> --json.

Discovers a target project's modules by scanning its compiled BEAM files.

Builds a NodeEntry from SparkMeta.ModuleInfo and project manifest.

The core typed output struct for per-module context queries. Mirrors the ModuleContext schema but with extended metadata.

Determines which modules have pending Ash migrations by running mix ash.codegen --check once per project invocation.

Provides convenient access to project context (nodes, edges) without running mix tasks.

Assembles and compacts the complete project context map.

Introspects Phoenix router modules to extract LiveView route metadata.

Caches the latest scenario extraction report and tells subscribers when it changes.

Extracts Studio scenarios from executable test source.

Captures system map state at the start of an editing session. Used by the studio to render preview mode during active proposals.

Builds the spec-kit index by scanning ADRs, runbooks, findings, regulations, and other documentation files. Extracts summaries, tags, and token counts.

Checks system dependencies required for Foundry.

The typed output for mix foundry.diagram.generate --json. A graph of nodes (modules) and edges (relationships), clustered by domain. Consumed by the Phase 2 System Map D3 renderer.

A named cluster of nodes — corresponds to one domain.

A directed edge between two nodes. Represents a relationship, rule application, or Transfer step dependency.

A node in the system map graph. Corresponds to one Ash resource, Transfer, Rule, etc.

Validated file read boundary for all project file access in channels and controllers.

The typed output for mix foundry.lint.all --json. Aggregates all violations from all lint rules across all modules.

A single lint violation from any lint rule.

Ash resource wrapping the output of mix foundry.lint.all.

High-level orchestrator for the lint suite.

Agent steps must declare confidence thresholds, tools, and telemetry (INV-014..017).

Sensitive resources with GraphQL mutations must have explicit authorization policies.

Validates the manifest keyword list directly (not per-module). Does not implement SparkLint.Rule — it is run as a separate pass.

INV-011 extension: Sensitive resources with Oban queues must have paper_trail.

Explicit registry of all active lint rules. Adding a new Foundry.LintRules.* module requires adding it here. Accidental registration is worse than a deliberate omission.

The project manifest resource. Validates and provides typed access to the .foundry/manifest.exs configuration file for a target project.

Module-based calculation for Foundry.Manifest. Returns true if the given library atom is present in conditional_libraries.

Reads and parses .foundry/manifest.exs from a project root. Returns the manifest as a keyword list. Caches per {file_path, mtime} in ETS.

Loads and validates the project manifest from .foundry/manifest.exs. Returns a validated Foundry.Manifest record or raises on error.

Validates CLDR backend exists when :ash_money is in conditional_libraries.

Validates approvers.sensitive_lead and approvers.compliance_officer are present.

Validates coverage_weights values sum to 1.0 ± 0.001.

Validates sensitive_resource_exemptions reference modules in sensitive_resources.

Helpers for reading resolved dependency versions from mix.lock.

Shared page metadata inference for LiveView modules.

Ash resource wrapping the full project context graph from mix foundry.project.context.

Ash resource wrapping the output of mix foundry.context <Module>.

Ash resource wrapping the output of mix foundry.project.status.

Foundry-specific facade over the generic spark_meta analysis pipeline.

Structured representation of an Ash resource action.

Scans LiveView module source to infer Ash action calls.

Extracts page-related metadata from LiveView modules.

Structured representation of an Ash resource attribute.

Structured representation of an AshAuthentication strategy.

Structured representation of a monetary attribute.

Structured representation of an Ash resource relationship.

Structured representation of a side effect.

Structured representation of a Reactor step.

Ash resource representing a spec-kit document (ADR, runbook, finding, regulation, or usage rule).

Extracts durable session findings from assistant responses and persists them as canonical spec-kit artifacts under docs/findings/.

Runtime health picture composed from all Phase 1 data.

Extracts resolved stack dependency versions from mix.lock.

Lightweight test-side annotations for Studio scenario extraction.

Ash.Tracer implementation for Foundry scenario tracing.

Phoenix LiveView on_mount hook that registers the LiveView channel PID with its associated test process PID during test execution.

ETS-backed registry mapping LiveView channel PIDs to test process PIDs.

Spark compile-time verifier: any Ash.Resource referenced in manifest.compliance_requirements must use AshArchival.Resource.

Spark compile-time verifier: any Reactor with side-effecting step types (:create, :update, :destroy, :action, :run) must define @idempotency_key.

Spark compile-time verifier: any Ash.Resource listed in manifest.sensitive_resources must use AshPaperTrail.Resource.

The typed output for mix foundry.versions.check --json. Current dependency versions read from mix.exs.

Mix Tasks

Reads all regulation files in docs/regulations/, extracts RG-* requirements, then verifies each one has at least one implementation: pointer to a module or test, and that a corresponding ExUnit test exists tagged :compliance.

Introspects a single compiled Ash/Reactor/Rule module and emits its full context as a JSON object matching Foundry.Context.ModuleContext.

Introspects every Foundry-relevant compiled module in the current project and emits a JSON object mapping domain names to arrays of ModuleContext objects.

Builds the system map graph by calling Foundry.Context.Introspector.build_all/1, projecting the result into Foundry.Diagram.SystemMap (nodes, edges, clusters), and writing the output to docs/diagrams/system_map.json.

Initialize a new Foundry project by scaffolding required directories and files.

Runs the full Foundry lint suite against all compiled modules and the project manifest. Emits a JSON report and exits non-zero if any :error severity violations are found.

Foundry MCP stdio bridge for Codex and other CLI tools.

Generates project context for Foundry modules.

Outputs the current project health status as JSON.

Reads mix.exs in the current project directory and emits the version of every known Foundry-ecosystem dependency as a JSON object.