# step-git-commit.ncl — reusable ActionStep template for staging and committing changes.
#
# actor defaults to 'Human — commits require human authorization per project conventions.
#
# Usage in a mode:
#   let t = import "../../reflection/templates/step-git-commit.ncl" in
#   steps = [
#     t {
#       id      = "commit-ontology",
#       message = "chore(on+re): update ontology state",
#       paths   = [".ontology/", "adrs/"],
#     },
#   ]
#
# Required params: id (String), message (String)
# Optional params: paths (default ["."]), action, actor, depends_on, on_error

fun params =>
  let defaults = {
    paths      | default = ["."],
    action     | default = "Stage specified paths and create a git commit with the given message.",
    actor      | default = 'Human,
    depends_on | default = [],
    on_error   | default = { strategy = 'Stop },
  } in
  let p = defaults & params in
  let paths_str = std.string.join " " p.paths in
  {
    id         = p.id,
    action     = p.action,
    cmd        = "git add %{paths_str} && git commit -m \"%{p.message}\"",
    actor      = p.actor,
    depends_on = p.depends_on,
    on_error   = p.on_error,
  }
