version: '3'

# tasks/triage-summary.yml -- D2 (#1122) `task triage:summary` one-liner surface.
#
# Wired into the parent Taskfile.yml via the `includes:` block under namespace
# key `triage-summary`. The inner task `summary` is reachable as
# `task triage-summary:summary`; the parent Taskfile exposes the documented
# `task triage:summary` alias.
#
# Per `conventions/task-caching.md` (#574): NO `sources:` / `generates:`
# declarations because user-facing flags (`--project-root`, `--cache-root`,
# `--no-history`, `--json`) are forwarded via {{.CLI_ARGS}} and go-task's
# incremental-build cache layer would silently swallow them.
#
# Handler: packages/cli/src/triage-summary.ts via engine:invoke (packages/cli/dist).
# Help registry: packages/core/src/triage/help/registry-data.ts (edit in place).
# Pattern reference: tasks/triage-scope.yml (D12 / #1131 / merged via #1190).

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

tasks:
  summary:
    desc: "Emit the D2 (#1122) one-line triage state for the session-start ritual (N9 / #1149). Always exits 0; appends a JSONL record to <lifecycle-root>/.triage-cache/summary-history.jsonl. -- task triage:summary -- [--json] [--no-history]"
    internal: true
    # Runtime/session dispatch: no engine:_ts-build / pnpm build (#2181).
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'triage-summary --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
