shellcheck-gpt

command module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 13 Imported by: 0

README

shellcheck-gpt

Automatically correct script issues by feeding shellcheck analysis into an LLM.

Getting started

Prerequisites
  • ShellCheck should be installed and in your $PATH.
  • Go
  • A valid OpenAI API key
Basic installation

shellcheck-gpt can be installed using the go install tool. Distribution methods that do not depend on Go are coming soon!

go install github.com/kkyr/shellcheck-gpt

Usage

Store your OpenAI API key into the environment:

export OPENAI_API_KEY=replace-with-your-key

Run shellcheck-gpt against a script:

shellcheck-gpt script.sh

This will:

  1. Run shellcheck against script.sh
  2. Feed the script and the output of shellcheck into an LLM and ask it to make the corrections
  3. Write the LLM's output onto stdout

If you'd like to write the output back into the script, use the -w flag:

shellcheck-gpt -w script.sh

Configuration

By default, shellcheck-gpt uses the gpt-3.5-turbo model. You can modify this to another model using the -m flag:

shellcheck-gpt -m gpt-4-turbo script.sh

See available options and models using the --help flag:

shellcheck-gpt --help

Contributing

Contributions are welcome!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL