Skip to content

nectarstudio-ai/nectar-cli

Repository files navigation

Nectar CLI

Command-line tool for querying Nectar database schemas and stored procedures with natural language support.

Quick Start (Windows)

Option 1: Automated Installation with winget (Windows 10/11)

Open Command Prompt as Administrator and run:

winget install OpenJS.NodeJS.LTS
winget install Git.Git

Close and reopen Command Prompt, then:

npm install -g git+https://github.com/jcolernectar/nectar-cli.git

Option 2: Automated Installation with Chocolatey

If you have Chocolatey installed, open Command Prompt as Administrator:

choco install nodejs git -y

Close and reopen Command Prompt, then:

npm install -g git+https://github.com/jcolernectar/nectar-cli.git

Option 3: Manual Installation

  1. Download and install Node.js: https://nodejs.org/ (LTS version)
  2. Download and install Git: https://git-scm.com/download/win
  3. Open Command Prompt (not PowerShell) and run:
npm install -g git+https://github.com/jcolernectar/nectar-cli.git

Important: Always use Command Prompt (cmd), not PowerShell, to avoid execution policy errors.

Prerequisites

The automated installation commands above will install:

  1. Node.js (version 14 or higher) - Includes npm
  2. Git - Required to install from GitHub

To verify installation:

node --version
npm --version
git --version

Installation

From GitHub

npm install -g git+https://github.com/jcolernectar/nectar-cli.git

From Local Development

cd C:\Users\JColer\nectar-cli
npm install
npm link

Setup

Configure the CLI with your API key and endpoint:

# Set your API key (from Applications in Nectar)
nectar config:set-key YOUR_64_CHAR_API_KEY_HERE

# Set the endpoint (default: https://staging-api.magazinemanager.biz)
nectar config:set-endpoint https://staging-api.magazinemanager.biz

# Verify configuration
nectar config

Usage

Natural Language Queries (Recommended)

Ask questions in plain English - the AI will figure out which tools to use:

nectar ask "What tables are used in the opportunities module?"
nectar ask "Show me the schema for customer-related tables"
nectar ask "How does usp_ProcessOrder work?"
nectar ask "What are the parameters for usp_GetCustomerData?"

Direct Commands

Search for Objects

# Search by keyword
nectar search "customer"
nectar search "order"

# Include full schemas in results
nectar search "invoice" --full

Get Table Schema

nectar schema Customers
nectar schema dbo.Orders
nectar table Invoices  # 'table' is an alias for 'schema'

Get Procedure Details

nectar proc usp_GetCustomerData
nectar procedure usp_ProcessOrder  # 'procedure' is an alias for 'proc'

Discover Database

# Show all objects
nectar discover

# Show only specific types
nectar discover --tables
nectar discover --procs
nectar discover --views
nectar discover --functions

Server Information

# Show server and role info
nectar info

# List all available tools
nectar tools

Configuration Management

# Show current configuration
nectar config

# Clear all configuration
nectar config:clear

Examples

Example 1: Exploring a New Module

# Start with natural language
nectar ask "I'm working on the billing module. What tables and procedures should I know about?"

# Drill down on specific tables
nectar schema Invoices
nectar schema Payments

# Check procedure details
nectar proc usp_CreateInvoice

Example 2: Understanding a Stored Procedure

# Ask about the procedure
nectar ask "How does usp_ProcessOrder work and what tables does it use?"

# Get full details
nectar proc usp_ProcessOrder

Example 3: Finding Related Objects

# Search for all customer-related objects
nectar search "customer" --full

# Get specific table schemas
nectar schema Customers
nectar schema CustomerAddresses

Configuration File Location

The CLI stores configuration in:

  • Windows: %APPDATA%\nectar-cli\config.json
  • macOS: ~/Library/Preferences/nectar-cli/config.json
  • Linux: ~/.config/nectar-cli/config.json

Troubleshooting

API Key Invalid

# Verify your API key is 64 characters
nectar config

# Get a new API key from Applications in Nectar
# Set it again:
nectar config:set-key YOUR_NEW_API_KEY

Connection Errors

# Verify endpoint is correct
nectar config

# Test connection
nectar info

Permission Errors

# Check which role your API key is using
nectar info

# Contact admin to verify role has MCP enabled and correct permissions

Development

Project Structure

nectar-cli/
├── bin/
│   └── nectar.js          # Main CLI entry point
├── lib/
│   ├── api.js              # API client
│   ├── config.js           # Configuration management
│   ├── formatter.js        # Output formatting
│   └── commands/           # Command implementations
│       ├── ask.js
│       ├── config.js
│       ├── discover.js
│       ├── proc.js
│       ├── schema.js
│       └── search.js
├── package.json
└── README.md

Local Testing

# Install dependencies
npm install

# Link for local testing
npm link

# Test commands
nectar config
nectar info

Debugging

Enable debug mode to see raw API responses:

DEBUG=true nectar ask "show me customer tables"

Support

For issues or questions:

  1. Check configuration: nectar config
  2. Test connection: nectar info
  3. Contact your Nectar administrator

License

Private - Internal use only

About

Command-line interface for Nectar Studio - Database schema discovery, code generation, and MCP server for AI assistants

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors