version: '3'

# tasks/triage-scope-drift.yml -- subscription drift detection (#1133 / D14).
#
# Wired into the parent Taskfile.yml via the `includes:` block under namespace
# key `triage-scope-drift`. When included that way, the inner task
# `scope-drift` is reachable as `task triage-scope-drift:scope-drift`. The
# parent Taskfile exposes the documented `task triage:scope-drift` alias.
#
# Per `conventions/task-caching.md` (#574): NO `sources:` / `generates:`
# declarations on this task because user-facing flags (`--ignore-label`,
# `--ignore-milestone`, `--threshold`, `--cache-root`) are forwarded via
# {{.CLI_ARGS}} and go-task's incremental-build cache layer would silently
# swallow them.
#
# Handler: packages/cli/src/triage-scope-drift.ts via engine:invoke (packages/cli/dist).
# Help registry: packages/core/src/triage/help/registry-data.ts (edit in place).

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

tasks:
  scope-drift:
    desc: "Detect subscription drift -- unsubscribed labels/milestones on cached open issues (#1133 / D14). -- task triage:scope-drift [-- --ignore-label=L | --ignore-milestone=M]"
    internal: true
    deps: [":engine:_ts-build"]
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'triage-scope-drift --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
