JSPM

buildpost-cli

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 122
  • Score
    100M100P100Q68803F
  • License MIT

Turn your git commits into social media posts using AI (Node.js CLI)

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (buildpost-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    BuildPost CLI npm version

    Turn your Git commits into engaging social media posts using AI (Node.js CLI).

    Description

    buildpost-cli is a command-line interface tool that leverages AI to transform your Git commit messages into ready-to-share social media posts. It supports various AI providers (OpenAI, Groq, Gemini) and allows you to customize the post's style and target platform.

    Features

    • Generate social media posts from your latest Git commit.
    • Summarize a range of Git commits into a single post.
    • Customize post style: casual, professional, or technical.
    • Target specific platforms: Twitter, LinkedIn, Dev.to, or generic.
    • Support for OpenAI, Groq, and Gemini AI providers.
    • Dynamic prompt injection using YAML templates.
    • Post length validation for each platform.
    • Automatically copies generated posts to your clipboard.

    Installation

    To install the buildpost-cli globally, use npm:

    npm install -g buildpost-cli

    Configuration

    Before using the CLI, you need to configure your AI provider and API key.

    Set API Key

    Set your API key for your chosen provider. Replace <YOUR_API_KEY> with your actual key.

    buildpost config set-key --provider openai <YOUR_OPENAI_API_KEY>
    buildpost config set-key --provider groq <YOUR_GROQ_API_KEY>
    buildpost config set-key --provider gemini <YOUR_GEMINI_API_KEY>

    Set AI Provider and Model

    Set your preferred AI provider and optionally specify a model. If no model is specified, a default will be used.

    # Set OpenAI as provider (default model: gpt-4o-mini)
    buildpost config set-provider --provider openai
    
    # Set Groq as provider with a specific model
    buildpost config set-provider --provider groq --model mixtral-8x7b
    
    # Set Gemini as provider with a specific model
    buildpost config set-provider --provider gemini --model gemini-pro

    Show Current Configuration

    To view your current buildpost-cli configuration:

    buildpost config show

    Reset Configuration

    To reset all configuration settings to their defaults:

    buildpost config reset

    Usage

    Important: You must run the buildpost command from within the root directory of the Git repository for which you want to generate social media posts. The CLI needs access to the .git directory to fetch commit information.

    cd /path/to/your/git/repo
    buildpost generate [options]

    Generate a Post from the Latest Commit

    Generate a post from your most recent commit using default settings (casual style, Twitter platform):

    buildpost generate

    Generate with Specific Style and Platform

    # Professional post for LinkedIn
    buildpost generate --style professional --platform linkedin
    
    # Technical post for Dev.to
    buildpost generate --style technical --platform devto

    Generate from a Specific Commit

    Use a specific commit hash to generate a post:

    buildpost generate --commit <COMMIT_HASH>

    Generate from a Commit Range (Summarization)

    Summarize a range of commits into a single post. For example, the last 3 commits:

    buildpost generate --range HEAD~3..HEAD

    Prevent Copying to Clipboard

    By default, the generated post is copied to your clipboard. To disable this:

    buildpost generate --no-copy

    Prompt Templates

    The CLI uses YAML files located in the src/templates directory to define the prompts for different styles (casual, professional, technical). You can modify these files or add new ones to customize the AI's behavior.

    Each template file (e.g., casual.yaml) should contain a prompt field:

    prompt: |
      You are a developer writing a casual post for {platform}.
      Write a short, engaging social media post based on this commit:
      "{message}"
      Author: {author}
      Date: {date}

    Placeholders like {platform}, {message}, {author}, and {date} will be dynamically replaced with the relevant information.

    Development

    Running Tests

    To run the test suite:

    npm test

    Building the Project

    To compile the TypeScript code and copy assets:

    npm run build

    License

    This project is licensed under the MIT License.