npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@brainstack/pipe-chat-cli

v1.0.3

Published

CLI tool to discuss with AI to about data source and apply changes.

Downloads

10

Readme

Here is a README and a deployment script for your npm package @brainstack/pipe-chat-cli:

README

# @brainstack/pipe-chat-cli

`@brainstack/pipe-chat-cli` is a CLI tool designed to interact with your Supabase database and leverage AI to discuss, refactor, and improve your database schema.

## Features

- Initialize a data source.
- Retrieve the current context (schema) from the data source.
- Chat with an AI to get insights and suggestions for schema modifications.
- Dynamically process messages through a customizable parser pipeline.

## Installation

You can install the CLI globally using npm:

```sh
npm install -g @brainstack/pipe-chat-cli

Usage

After installation, you can use the CLI commands as follows:

pipe-chat-cli init
pipe-chat-cli context
pipe-chat-cli chat

Commands

  • init: Initialize the data source.
  • context: Get the current context from the data source.
  • chat: Chat with the AI to discuss and improve the schema.

Environment Variables

Create a .env file in the root directory of your project and add the following environment variables:

SUPABASE_URL=your-supabase-url
SUPABASE_KEY=your-supabase-key
AI_PROVIDER_BASE_URL=your-openai-base-url
AI_PROVIDER_API_KEY=your-openai-api-key
AI_MODEL=your-openai-model

Example .env file

SUPABASE_URL=https://xyzcompany.supabase.co
SUPABASE_KEY=your-supabase-key
AI_PROVIDER_BASE_URL=https://api.openai.com
AI_PROVIDER_API_KEY=your-openai-api-key
AI_MODEL=gpt-4

Development

To develop and test the package locally, clone the repository and run:

npm install
npm run build
npm link

This will link the local package as a global npm package. You can then use the CLI commands as described above.

License

MIT


### Deployment Script

Here's a script to prepare and publish your package to npm:

```sh
#!/bin/bash

# Ensure the package.json version is updated before publishing
echo "Updating package version..."
npm version patch

# Build the project
echo "Building the project..."
npm run build

# Publish the package to npm
echo "Publishing the package to npm..."
npm publish

# Output completion message
echo "Package @brainstack/pipe-chat-cli published successfully!"

# Instructions for testing the package
echo "You can now test the package using: npx @brainstack/pipe-chat-cli"

Adding bin field in package.json

To make sure the CLI can be run using npx @brainstack/pipe-chat-cli, add the bin field to your package.json:

{
  "name": "@brainstack/pipe-chat-cli",
  "version": "1.0.0",
  "description": "CLI tool to interact with Supabase and AI to improve your database schema",
  "main": "dist/index.js",
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  },
  "bin": {
    "pipe-chat-cli": "./dist/index.js"
  },
  "dependencies": {
    "commander": "^10.0.0",
    "dotenv": "^16.0.0",
    "openai": "^3.0.0",
    "supabase": "^1.0.0"
  },
  "devDependencies": {
    "@types/node": "^18.0.0",
    "typescript": "^5.0.0"
  },
  "keywords": [
    "supabase",
    "openai",
    "cli",
    "database",
    "ai"
  },
  "author": "Your Name",
  "license": "MIT"
}

Final Steps

  1. Save the deployment script as deploy.sh, give it executable permissions using chmod +x deploy.sh, and then run it with ./deploy.sh.
  2. Make sure to update the version in package.json appropriately before publishing.

With these steps, your CLI tool should be ready to use and can be installed globally or run using npx @brainstack/pipe-chat-cli.