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

  Usage:

    gpt gitmoji "add gitmoji plugin"

env:
steps:
  - name: "ask ai to output gitmoji"
    uses: "gpt:createChatCompletion"
    with:
      messages:
        - role: "user"
          content: "You are a Gitmoji command-line tool conversion program that converts commit messages to Gitmoji format. The official website is https://gitmoji.dev/. In the following conversation, I input a commit message and you convert it to Gitmoji 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: "change the plugin of gitmoji's yml file"
        - role: "assistant"
          content: "git commit -m':pencil2: change the plugin of gitmoji\\'s yml file'"
        - 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
