version: '3'

# tasks/triage-scope.yml -- typed plan.policy.triageScope[] surface (#1131 / D12).
#
# Wired into the parent Taskfile.yml via the `includes:` block under namespace
# key `triage-scope` (matching the four-fragment cluster pattern from #845).
# When included that way, the inner task `scope` is reachable as
# `task triage-scope:scope`. The parent Taskfile exposes the documented
# `task triage:scope` alias.
#
# Per `conventions/task-caching.md` (#574): NO `sources:` / `generates:`
# declarations on this task because user-facing flags (`--list`,
# `--refresh-denominator`, `--repo`, `--count`, `--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.ts via engine:invoke (packages/cli/dist).
# Help registry: packages/core/src/triage/help/registry-data.ts (edit in place).
# Current Shape:    https://github.com/deftai/directive/issues/1131#issuecomment-4471901494

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

tasks:
  scope:
    desc: "Inspect / mutate / diff the typed plan.policy.triageScope[] subscription + triageScopeIgnores[] (#1131 / D12, #1133 / D14, #1182 / D14c). -- task triage:scope -- [--list] [--add-label=L | --add-milestone=M | --ignore-label=L] [--diff-from-upstream --repo OWNER/NAME] [--refresh-denominator --repo OWNER/NAME --count N]"
    internal: true
    deps: [":engine:_ts-build"]
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'triage-scope --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
