Capstone.Config (Capstone v0.33.3)

Copy Markdown View Source

Reads and validates a project's target.exs — the hand-authored record of what a project asked Capstone for (goals.md D16).

Every read goes through Capstone.Config.Literal, never Code.eval_*: target.exs is data, not code, per goals.md G6. Validation does not stop at the first problem — read/1 and read_string/1 return every error found, so a target.exs with three mistakes reports three.

Summary

Types

Every reason read/1, read_string/1 and their bang variants can fail.

A location inside a parsed target.exs, as a list of map/keyword keys and list indices from the root.

t()

Functions

Reads and validates the target.exs at path.

As read/1, raising Capstone.Config.Error on any validation failure.

Parses and validates source as target.exs content, without touching the filesystem.

As read_string/1, raising Capstone.Config.Error on any validation failure.

Types

error()

@type error() ::
  {:file_error, File.posix()}
  | Capstone.Config.Literal.error()
  | {:not_a_map, term()}
  | {:missing_key, path()}
  | {:unknown_key, path(), atom()}
  | {:invalid_type, path(), String.t(), term()}
  | {:invalid_value, path(), [term()], term()}
  | {:unsupported_schema_version, term()}

Every reason read/1, read_string/1 and their bang variants can fail.

path()

@type path() :: Capstone.Config.Literal.path()

A location inside a parsed target.exs, as a list of map/keyword keys and list indices from the root.

t()

@type t() :: %Capstone.Config{
  base: :api | :web | :both,
  container: Capstone.Config.Container.t(),
  plugins: [atom()],
  project: Capstone.Config.Project.t(),
  schema_version: pos_integer(),
  security: Capstone.Config.Security.t()
}

Functions

read(path)

@spec read(Path.t()) :: {:ok, t()} | {:error, [error()]}

Reads and validates the target.exs at path.

read!(path)

@spec read!(Path.t()) :: t()

As read/1, raising Capstone.Config.Error on any validation failure.

read_string(source)

@spec read_string(String.t()) :: {:ok, t()} | {:error, [error()]}

Parses and validates source as target.exs content, without touching the filesystem.

read_string!(source)

@spec read_string!(String.t()) :: t()

As read_string/1, raising Capstone.Config.Error on any validation failure.