version: '3'

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

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

tasks:
  welcome:
    desc: "Run the 6-phase onboarding ritual (N3 / #1143): detect prior state, prompt subscription scope, run triage:bootstrap, prompt wipCap, offer WIP relief, print triage:summary. Idempotent; re-run resumes cleanly. -- task triage:welcome -- [--no-subprocess]"
    internal: true
    # Runtime/session dispatch: no engine:_ts-build / pnpm build (#2181).
    dir: '{{.USER_WORKING_DIR}}'
    env:
      DEFT_TASK_PREFIX: '{{.DEFT_TASK_PREFIX | default ""}}'
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'triage-welcome --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
