aura-lang 0.2.0

Aura configuration language: deterministic, capability-secured, schema-validated configs — embeddable library + the `aura` CLI
Documentation
# Aura stdlib surface — the single source of truth for editor completion/hover.
#
# The language server EVALUATES this file with aura-lang at startup (dogfooding:
# Aura configuring its own tooling) to build its completion database. A test
# checks these method names against the real method registry so the two cannot
# drift. Grouped by receiver type; `builtins` are global functions.

String:
  upper:
    params:  []
    returns: "String"
    doc:     "Uppercase every character."
  end
  lower:
    params:  []
    returns: "String"
    doc:     "Lowercase every character."
  end
  len:
    params:  []
    returns: "Int"
    doc:     "Number of characters."
  end
  trim:
    params:  []
    returns: "String"
    doc:     "Remove leading and trailing whitespace."
  end
  split:
    params:  ["sep"]
    returns: "List"
    doc:     "Split on a non-empty separator into a list of strings."
  end
  replace:
    params:  ["from", "to"]
    returns: "String"
    doc:     "Replace every occurrence of a substring."
  end
  starts_with:
    params:  ["prefix"]
    returns: "Bool"
    doc:     "True if the string begins with the prefix."
  end
  ends_with:
    params:  ["suffix"]
    returns: "Bool"
    doc:     "True if the string ends with the suffix."
  end
  contains:
    params:  ["substr"]
    returns: "Bool"
    doc:     "True if the substring occurs anywhere."
  end
  slice:
    params:  ["start", "end"]
    returns: "String"
    doc:     "Substring by character index; end exclusive, indices clamped."
  end
  to_int:
    params:  []
    returns: "Int"
    doc:     "Parse an integer (E0314 on failure)."
  end
  to_float:
    params:  []
    returns: "Float"
    doc:     "Parse a float (E0314 on failure)."
  end
  to_str:
    params:  []
    returns: "String"
    doc:     "The string itself (universal to_str)."
  end
  parse_json:
    params:  []
    returns: "Object"
    doc:     "Parse a JSON document into a value."
  end
  parse_yaml:
    params:  []
    returns: "Object"
    doc:     "Parse a YAML document into a value."
  end
  parse_toml:
    params:  []
    returns: "Object"
    doc:     "Parse a TOML document into a value."
  end
  parse_duration:
    params:  []
    returns: "Int"
    doc:     "Duration string (d/h/m/s) to seconds; E0319 on error."
  end
  parse_datetime:
    params:  []
    returns: "Int"
    doc:     "RFC3339 timestamp to epoch seconds UTC; E0320 on error."
  end
  sha256:
    params:  []
    returns: "String"
    doc:     "SHA-256 digest as lowercase hex (config checksums)."
  end
  base64:
    params:  []
    returns: "String"
    doc:     "Standard base64 with padding (e.g. Kubernetes Secret data)."
  end
  base64_decode:
    params:  []
    returns: "String"
    doc:     "Decode standard base64 to a String; E0321 if invalid."
  end
end

Int:
  abs:
    params:  []
    returns: "Int"
    doc:     "Absolute value."
  end
  to_str:
    params:  []
    returns: "String"
    doc:     "Decimal string form."
  end
  to_float:
    params:  []
    returns: "Float"
    doc:     "Widen to Float. There is no Float -> Int: narrowing would have to round."
  end
  format_duration:
    params:  []
    returns: "String"
    doc:     "Seconds to a duration string (d/h/m/s)."
  end
  format_datetime:
    params:  []
    returns: "String"
    doc:     "Epoch seconds to an RFC3339 UTC timestamp."
  end
end

Float:
  abs:
    params:  []
    returns: "Float"
    doc:     "Absolute value."
  end
  to_str:
    params:  []
    returns: "String"
    doc:     "Decimal string form."
  end
end

Bool:
  to_str:
    params:  []
    returns: "String"
    doc:     "\"true\" or \"false\"."
  end
end

List:
  len:
    params:  []
    returns: "Int"
    doc:     "Number of elements."
  end
  to_object:
    params:  []
    returns: "Object"
    doc:     "Build an Object from { key, value } pairs; a duplicate key is E0323."
  end
  reduce:
    params:  ["init", "fn"]
    returns: "Any"
    doc:     "Left fold: reduce(init) (acc, elem) -> ... end. The init is required."
  end
  any:
    params:  ["fn"]
    returns: "Bool"
    doc:     "True if the predicate holds for some element; false for an empty list."
  end
  all:
    params:  ["fn"]
    returns: "Bool"
    doc:     "True if the predicate holds for every element; true for an empty list."
  end
  find:
    params:  ["default", "fn"]
    returns: "Any"
    doc:     "First element matching the predicate, or the default."
  end
  index_of:
    params:  ["value", "default"]
    returns: "Int"
    doc:     "Index of the first equal element, or the default (which must be an Int)."
  end
  first:
    params:  []
    returns: "Any"
    doc:     "First element (E0317 if empty)."
  end
  last:
    params:  []
    returns: "Any"
    doc:     "Last element (E0317 if empty)."
  end
  get:
    params:  ["index"]
    returns: "Any"
    doc:     "Element at an Int index, or a default via .get(i, default)."
  end
  contains:
    params:  ["item"]
    returns: "Bool"
    doc:     "True if the element is present."
  end
  compact:
    params:  []
    returns: "List"
    doc:     "Drop null elements."
  end
  uniq:
    params:  []
    returns: "List"
    doc:     "Remove duplicates, keeping first occurrence."
  end
  map:
    params:  ["fn"]
    returns: "List"
    doc:     "Apply (element, index) -> value to each element."
  end
  filter:
    params:  ["fn"]
    returns: "List"
    doc:     "Keep elements where (element, index) -> Bool is true."
  end
  join:
    params:  ["sep"]
    returns: "String"
    doc:     "Join scalar elements with a separator."
  end
  sort:
    params:  []
    returns: "List"
    doc:     "Ascending sort of mutually-comparable scalars."
  end
  reverse:
    params:  []
    returns: "List"
    doc:     "Elements in reverse order."
  end
  sum:
    params:  []
    returns: "Int"
    doc:     "Sum of numbers (Float if any Float)."
  end
  min:
    params:  []
    returns: "Any"
    doc:     "Smallest element (E0317 if empty)."
  end
  max:
    params:  []
    returns: "Any"
    doc:     "Largest element (E0317 if empty)."
  end
  flatten:
    params:  []
    returns: "List"
    doc:     "Spread one level of nested lists."
  end
  slice:
    params:  ["start", "end"]
    returns: "List"
    doc:     "Half-open sub-list; indices are clamped."
  end
  to_json:
    params:  []
    returns: "String"
    doc:     "Serialize to a compact JSON string, for embedding."
  end
  to_json_pretty:
    params:  []
    returns: "String"
    doc:     "Serialize to indented JSON, for a file a person reads."
  end
  to_yaml:
    params:  []
    returns: "String"
    doc:     "Serialize to a compact YAML string (flow style), for embedding."
  end
  to_yaml_pretty:
    params:  []
    returns: "String"
    doc:     "Serialize to block-style YAML, for a file a person reads."
  end
  to_toml:
    params:  []
    returns: "String"
    doc:     "Serialize to TOML with arrays on one line, for embedding."
  end
  to_toml_pretty:
    params:  []
    returns: "String"
    doc:     "Serialize to TOML with one array element per line."
  end
end

Object:
  len:
    params:  []
    returns: "Int"
    doc:     "Number of keys."
  end
  keys:
    params:  []
    returns: "List"
    doc:     "Keys in declaration order."
  end
  values:
    params:  []
    returns: "List"
    doc:     "Values in declaration order."
  end
  contains:
    params:  ["key"]
    returns: "Bool"
    doc:     "True if the key is present."
  end
  get:
    params:  ["key", "default"]
    returns: "Any"
    doc:     "Value for a key, or a default if absent."
  end
  entries:
    params:  []
    returns: "List"
    doc:     "Key/value pairs as { key, value } objects, in declaration order."
  end
  merge:
    params:  ["other"]
    returns: "Object"
    doc:     "Shallow merge; the argument wins on key conflicts."
  end
  to_json:
    params:  []
    returns: "String"
    doc:     "Serialize to a compact JSON string, for embedding."
  end
  to_json_pretty:
    params:  []
    returns: "String"
    doc:     "Serialize to indented JSON, for a file a person reads."
  end
  to_yaml:
    params:  []
    returns: "String"
    doc:     "Serialize to a compact YAML string (flow style), for embedding."
  end
  to_yaml_pretty:
    params:  []
    returns: "String"
    doc:     "Serialize to block-style YAML, for a file a person reads."
  end
  to_toml:
    params:  []
    returns: "String"
    doc:     "Serialize to TOML with arrays on one line, for embedding."
  end
  to_toml_pretty:
    params:  []
    returns: "String"
    doc:     "Serialize to TOML with one array element per line."
  end
end

builtins:
  range:
    params:  ["n"]
    returns: "List"
    doc:     "The list [0, 1, ..., n-1]."
  end
  env:
    params:  ["name", "default"]
    returns: "String"
    doc:     "Environment variable value or a default (needs --allow-env)."
  end
  read_file:
    params:  ["path"]
    returns: "String"
    doc:     "File contents as a string (needs --allow-read)."
  end
  fail:
    params:  ["message"]
    returns: "Any"
    doc:     "Abort evaluation with a message (E0530)."
  end
end