Generates project context for Foundry modules.
Usage
mix foundry.project.context <Module> # Per-module context
mix foundry.project.context <Module> --json # Same (--json accepted, output is always JSON)
mix foundry.project.context # Bulk project context
mix foundry.project.context --output ctx.json # Bulk context, written to a file
mix foundry.project.context --check # Check lock freshnessOptions
--json- Accepted for agent compatibility; output is always JSON regardless of this flag.--check- Check if context.lock is current instead of generating context.--output PATH- Write the JSON toPATHinstead of stdout.
Why --output exists (ADR-036)
The Studio reads a target project's context by running this task inside that
project as a subprocess, rather than loading the target's BEAM files into its
own VM. That only works if the JSON can be recovered unambiguously, and it
cannot be recovered from stdout: this task runs mix compile first, and the
compiler writes to the same stream. With --output the JSON lands in a file
the caller named and stdout is free to carry whatever the build says.
Exit codes
0- the context was produced. With--output, the file exists and parses.1-.foundry/manifest.exsis absent or unparseable.2- the target project failed to compile.
Forms
mix foundry.project.context <Module>: Returns JSON context for a single modulemix foundry.project.context: Returns bulk context for all modules in projectmix foundry.project.context --check: Checks if mix.lock is current
Summary
Functions
Callback implementation for Mix.Task.run/1.
Emit bulk JSON context for all modules. Separated from run/1 so tests can
call this without triggering Mix.Task.run("compile") / Mix.Sync.PubSub startup.
Returns {:ok, json_string}.
Check if context.lock is current. Returns :ok or {:error, reason}.
Emit JSON context for a single module. Separated from run/1 so tests can
call this without triggering Mix.Task.run("compile") / Mix.Sync.PubSub startup.
Returns {:ok, json_string} or {:error, reason}.
Functions
Callback implementation for Mix.Task.run/1.
Emit bulk JSON context for all modules. Separated from run/1 so tests can
call this without triggering Mix.Task.run("compile") / Mix.Sync.PubSub startup.
Returns {:ok, json_string}.
Check if context.lock is current. Returns :ok or {:error, reason}.
Emit JSON context for a single module. Separated from run/1 so tests can
call this without triggering Mix.Task.run("compile") / Mix.Sync.PubSub startup.
Returns {:ok, json_string} or {:error, reason}.