Skip to content

andvarfolomeev/prompt-flex-cli

Repository files navigation

prompt-flex-cli

prompt-flex-cli is a versatile command-line tool designed to generate dynamic prompts for ChatGPT using various input sources. It supports a flexible configuration system, allowing users to fetch inputs from environment variables, command-line arguments, files, and standard input. The tool also allows for customizable output methods, such as printing to the console or writing to a file.

Features

  • Flexible Input Sources: Fetch data from environment variables, command-line arguments, files, and standard input.
  • Dynamic Prompt Generation: Use templating to create dynamic prompts for ChatGPT.
  • Configurable Output: Output results to the console or save to a file.
  • Easy Configuration: Define input, prompt, and output settings declaratively using a YAML configuration file.

Installation

To install prompt-flex-cli, ensure you have Node.js and npm installed, then clone the repository and install dependencies:

git clone https://github.com/yourusername/promptflexcli.git
cd promptflexcli
npm install && npm build && npm link

Usage

prompt-flex-cli allows you to dynamically generate prompts using various plugins configured via a YAML file. To get started, follow these steps:

Configuration

  1. Prepare the Configuration File:

    • Copy the example configuration file provided in ./examples/.prompt-flex.yaml to your home directory as ~/.prompt-flex.yaml.
    • This file defines the plugins, their descriptions, inputs, and prompt templates.

    Example command:

    cp ./examples/.prompt-flex.yaml ~/.prompt-flex.yaml

Running a plugin

To run a specific plugin, use the following command structure:

prompt-flex run <plugin-name> [options]

Example: Using anki-generator

The anki-generator plugin is designed to generate flashcards in CSV format. Here's how you can use it:

  1. Prepare Your Input File. Ensure you have a text file (e.g., a.txt) that contains the list of words you want to generate flashcards for.
  2. Run the Plugin. Use the command below to execute the anki-generator with the specified file:
prompt-flex run anki-generator --file a.txt

Key Points

  • Configuration: Guides users to place the configuration file in the correct location (~/.prompt-flex.yaml).
  • Running Plugins: Provides clear instructions on how to execute specific plugins, using the anki-generator and gitignore as examples.
  • YAML Structure and Customization: Encourages users to understand and potentially modify the YAML configuration to fit their requirements.

Releases

No releases published

Packages

No packages published