PtcRunner.Kernel.ViewerProjectAdapter (PtcRunner v0.14.0)

Copy Markdown View Source

Project details for the Viewer's Live tab (#1444).

Reads a manifest — and optionally the host configuration that installs its providers — from disk, and projects what an operator wants beside a running dashboard: the environments the manifest declares, the components and shipped preludes each one compiles, the tools its providers install, and every Kernel limit with both its effective and its default value.

Hosts wire the result into PtcViewer.start/1 as a zero-arity function:

project_adapter: fn -> ViewerProjectAdapter.describe("app/ptc.json") end

This is a display projection, not a compilation step. It uses the canonical manifest and host loaders, so component sources keep the same confinement, size, UTF-8, and effective-limit contract as the run the Viewer launches. It can still describe a project that fails later compilation, and it never guesses a tool effect that the host did not install.

Summary

Functions

Describes the manifest at manifest_path.

Types

environment()

@type environment() :: %{
  name: binary(),
  kind: binary(),
  components: [map()],
  providers: [map()],
  tools: [map()]
}

project()

@type project() :: %{
  name: binary(),
  name_fingerprint: binary() | nil,
  manifest: binary(),
  entry: binary(),
  input: map(),
  environments: [environment()],
  limits: [map()]
}

Functions

describe(manifest_path, opts \\ [])

@spec describe(
  binary(),
  keyword()
) :: {:ok, project()} | {:error, :invalid_manifest | File.posix()}

Describes the manifest at manifest_path.

Options:

  • :host_config — path to the host configuration JSON whose install entries name the tools each provider exposes, with their effects. Without it, providers are reported by name and every tools list is empty rather than guessed.
  • :name — display name override; otherwise the manifest's labels.name, else the manifest's file name.

The manifest field echoes the path exactly as configured, because that is the string the operator recognises.