version: '3'

# tasks/triage-classify.yml -- auto-classification surface (#1129 / D10).
#
# Wired into the parent Taskfile.yml via the `includes:` block under
# namespace key `triage-classify` (mirroring the four-fragment cluster
# pattern from #845 / #1131). When included, the inner task `classify`
# is reachable as `task triage-classify:classify`. The parent Taskfile
# exposes the documented `task triage:classify` alias.
#
# Per `conventions/task-caching.md` (#574): NO `sources:` / `generates:`
# declarations on this task because user-facing flags (`--list`,
# `--validate`, `--project-root`) are forwarded via {{.CLI_ARGS}} and
# go-task's incremental-build cache layer would silently swallow them.
#
# Handler: packages/cli/src/triage-classify.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/1129#issuecomment-4471901622

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

tasks:
  classify:
    desc: "Inspect / validate triageAutoClassify + triageLabelMirror. --mirror is withdrawn (#4070)."
    internal: true
    deps: [":engine:_ts-build"]
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'triage-classify --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  strip-withdrawn-chips:
    desc: "Remaining-set strip of withdrawn triaged / triage:* chips (#4070). Dry-run default; --apply writes. --emit-digest prints shadowed vs faithful classify rows for #4071."
    internal: true
    deps: [":engine:_ts-build"]
    dir: '{{.USER_WORKING_DIR}}'
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'triage-strip-withdrawn --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
