version: '3'

# tasks/tutorial.yml -- Directive Tutorial progress (#4981).

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

tasks:
  offer:
    desc: "Record the one Directive Tutorial offer, or say it must not be repeated (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial offer --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  start:
    desc: "Start Signal, Postcard, or Echo in a disposable local Git repository (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial start --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  inspect:
    desc: "Show Directive Tutorial progress and the current beat (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial inspect --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  advance:
    desc: "Move to the next tutorial beat after the person's action is recorded (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial advance --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  resume:
    desc: "Print the current tutorial beat for a later session (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial resume --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  skip:
    desc: "Skip the current beat when the person asks. Does not verify the line or finish the work (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial skip --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  leave:
    desc: "Leave the Directive Tutorial sitting; explicit start still works (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial leave --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  reset:
    desc: "Clear tutorial progress without offering again (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial reset --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  decline:
    desc: "Record no. Do not offer the Directive Tutorial again (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial decline --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'

  defer:
    desc: "Record not now. Do not offer the Directive Tutorial again (#4981)"
    dir: '{{.USER_WORKING_DIR}}'
    deps:
      - task: :engine:_ts-build
    cmds:
      - task: :engine:invoke
        vars:
          ENGINE_CMD: 'tutorial defer --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
