version: '3'

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

# project:render task.
#
# Fixed #539: the task previously used ``{{.ROOT_DIR}}`` which is deft's
# own repo root when invoked via ``includes:`` -- consumers got their data
# scanned from ``deft/vbrief/``. Switched to ``{{.USER_WORKING_DIR}}`` to
# match the convention used by roadmap:render / spec:render / migrate:vbrief.
#
# Staleness acknowledgement (#640): ``task project:ack-staleness`` records a
# completed-scope watermark on PROJECT-DEFINITION ``plan.metadata.staleness_review``
# so ``task project:render`` stops re-emitting the same narrative staleness flags
# after review. This is distinct from ``task reconcile:issues``, which reconciles
# origin freshness on scope vBRIEFs — not PROJECT-DEFINITION narrative heuristics.

tasks:

  render:
    desc: Regenerate PROJECT-DEFINITION artifact items registry from lifecycle folders
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'project-render --project-root "{{.USER_WORKING_DIR}}"'

  ack-staleness:
    desc: >-
      Acknowledge reviewed PROJECT-DEFINITION artifact narrative staleness (#640).
      Distinct from task reconcile:issues (scope origin freshness).
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'project-render --acknowledge-staleness --project-root "{{.USER_WORKING_DIR}}"'

  export-spec:
    desc: >-
      Export SPECIFICATION.md from PROJECT-DEFINITION (+ lifecycle scopes).
      Use --audience=internal to include proposed scopes (#2013 / #1502).
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'export-spec {{.CLI_ARGS}}'
