Codex.Prompts (Codex SDK v0.7.2)

Copy Markdown View Source

Custom prompt discovery and expansion helpers.

Summary

Functions

Expands a prompt's content using positional or named arguments.

Lists custom prompts from $CODEX_HOME/prompts (or a provided directory).

Types

prompt()

@type prompt() :: %{
  name: String.t(),
  path: String.t(),
  content: String.t(),
  description: String.t() | nil,
  argument_hint: String.t() | nil
}

Functions

expand(prompt, args \\ nil)

@spec expand(prompt() | map() | String.t(), String.t() | [String.t()] | map() | nil) ::
  {:ok, String.t()} | {:error, map()}

Expands a prompt's content using positional or named arguments.

If the prompt contains named placeholders (e.g. $USER), the args must be provided as KEY=value pairs. Otherwise positional arguments expand $1..$9 and $ARGUMENTS.

list(opts \\ [])

@spec list(keyword()) :: {:ok, [prompt()]}

Lists custom prompts from $CODEX_HOME/prompts (or a provided directory).

Options

  • :dir - override prompt directory
  • :exclude - list of prompt names to skip