Codex.Plugins.Paths (Codex SDK v0.16.1)

Copy Markdown View Source

Canonical local authoring paths for plugin manifests and marketplaces.

Summary

Functions

Resolves the canonical manifest path for a plugin root or manifest path.

Resolves the canonical marketplace path for a scope.

Returns the root directory that owns a canonical marketplace file.

Validates a marketplace source path before resolving it against the marketplace root.

Validates a manifest or marketplace relative path.

Resolves the canonical plugin root for a scope and plugin name.

Resolves a plugin root into a marketplace-relative ./... source path.

Resolves a marketplace entry source path to an absolute path under its root.

Resolves the root directory for a repo or personal plugin scope.

Types

scope()

@type scope() :: :repo | :personal

Functions

manifest_path(path)

@spec manifest_path(Path.t()) :: Path.t()

Resolves the canonical manifest path for a plugin root or manifest path.

marketplace_path(scope, opts)

@spec marketplace_path(
  scope(),
  keyword()
) :: {:ok, Path.t()} | {:error, term()}

Resolves the canonical marketplace path for a scope.

marketplace_root(path)

@spec marketplace_root(Path.t()) :: {:ok, Path.t()} | {:error, term()}

Returns the root directory that owns a canonical marketplace file.

normalize_marketplace_source_path(value)

@spec normalize_marketplace_source_path(term()) ::
  {:ok, String.t()} | {:error, String.t()}

Validates a marketplace source path before resolving it against the marketplace root.

normalize_relative_path(value)

@spec normalize_relative_path(term()) :: {:ok, String.t()} | {:error, String.t()}

Validates a manifest or marketplace relative path.

plugin_root(scope, plugin_name, opts)

@spec plugin_root(scope(), String.t(), keyword()) ::
  {:ok, Path.t()} | {:error, term()}

Resolves the canonical plugin root for a scope and plugin name.

relative_plugin_source_path(marketplace_path, plugin_root)

@spec relative_plugin_source_path(Path.t(), Path.t()) ::
  {:ok, String.t()} | {:error, term()}

Resolves a plugin root into a marketplace-relative ./... source path.

resolve_marketplace_source_path(marketplace_path, source_path)

@spec resolve_marketplace_source_path(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, term()}

Resolves a marketplace entry source path to an absolute path under its root.

scope_root(scope, opts \\ [])

@spec scope_root(
  scope(),
  keyword()
) :: {:ok, Path.t()} | {:error, term()}

Resolves the root directory for a repo or personal plugin scope.