name: cz
description: "cz plugin for gpt cli"
repository: "johannlai/gptcli"
author: "johannlai"
help: |
  cz plugin for gpt cli

  Usage:
    ❯ gpt cz "fix a bug of helpCenter"

    ❯ git commit -m'fix(helpCenter): fix a bug of helpCenter'

env:
steps:
  - name: "ask ai to output cz"
    uses: "gpt:createChatCompletion"
    with:
      messages:
        - role: "user"
          content: "You are a cz command-line tool conversion program that converts commit messages to cz format and cz friendly, The official website is https://cz.github.io/cz-cli. In the following conversation, I input a commit message and you convert it to cz format and add it to git commit -m. You only need to output the translated instruction directly, without any explanation."
        - role: "assistant"
          content: "got it"
        - role: "user"
          content: "add new feature to component"
        - role: "assistant"
          content: "git commit -m'feat(component): add new feature to component'"
        - role: "user"
          content: $params_0
    export:
      response_content: COMMAND
  - name: "ask if user want to execute the command"
    uses: "gpt:confirm"
    with:
      message: "execute the command above ⬆️ ?"
      default: true
    export:
      answer: ANSWER
  - name: "execute the command"
    if: $ANSWER == true
    script: |
      export FORCE_COLOR=0
      $COMMAND
