version: '3'

vars:
  DEFT_ROOT: '{{joinPath .TASKFILE_DIR ".."}}'

# prd:render task.
#
# IMPORTANT: explicit absolute paths are passed for BOTH the input spec and
# the output PRD.md so a stray ``dir:`` or ``CWD`` mis-resolution can never
# cause the framework's own ``deft/PRD.md`` to be silently overwritten from
# a consumer project (#539). Standardised on ``node .../bin.js prd-render`` --
# the prior ``python3`` invocation was inconsistent with every other task and
# caused sporadic PATH issues on Windows.

tasks:

  render:
    # Caching: intentionally absent. `prd:render` runs in <30ms and its
    # CLI_ARGS carry recovery flags (e.g. `--force` from the #539
    # refuse-to-overwrite safety check). Declaring `sources:` / `generates:`
    # would cause go-task to short-circuit before `cmds:` runs, dropping
    # CLI_ARGS and silently breaking the #539 recovery path (#573, #574).
    # See deft/conventions/task-caching.md for the full rule.
    desc: Export resolved project narratives to a read-only PRD.md
    summary: |
      Resolves full-spec or greenfield authority from the project root and extracts
      stakeholder-safe narratives into a human-readable PRD.md. Explicit --spec remains
      supported. PRD.md is never authoritative -- the resolved xBRIEF is the source of truth.
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'prd-render --project-root "{{.USER_WORKING_DIR}}" --output "{{.USER_WORKING_DIR}}/PRD.md" {{.CLI_ARGS}}'
