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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sf-utils-cli

v2.0.1

Published

A modern, web-based interface for executing SOQL queries, Anonymous Apex, and DML operations against Salesforce orgs with Monaco Editor and AI, ERD and others

Readme

⚡ Salesforce Utils CLI

A modern, web-based developer toolkit for Salesforce — SOQL queries, DML operations, Anonymous Apex, SObject exploration, ER diagrams, and AI-powered data chat, all in one tool.

Salesforce Utils CLI Node.js Monaco Editor Version License


Demo

V2 demo

🚀 Quick Start

npm install -g sf-utils-cli
sf-utils

Open http://localhost:3456 — connect your org alias — start querying.


📦 Installation

Prerequisites

| Requirement | Notes | |---|---| | Node.js ≥ 14 | node --version | | Salesforce CLI (sf) | Install guide | | Authenticated org | sf org login web -a myorg | | sf mohanc plugin (for ERD) | sf plugins install sfdx-mohanc-plugins |

Install

npm install -g sf-utils-cli

🎯 CLI Usage

sf-utils [options]

OPTIONS
  -p, --port <number>    Port to run the server on (default: 3456)
      --enable-AI        Enable AI Chat and AI Settings
      --enable-erd       Enable ERD diagram generation (requires sf mohanc plugin)
  -h, --help             Show help

Examples

sf-utils                          # Default port 3456
sf-utils -p 4000                  # Custom port
sf-utils --enable-AI              # With AI Chat
sf-utils --enable-erd             # With ERD generation
sf-utils -p 8080 --enable-AI --enable-erd   # All features

✨ Features

⚡ Query Panel — SOQL, Apex & DML

The main workspace with a Monaco Editor (VS Code's editor engine) connected to your Salesforce org.

Operation modes (dropdown): | Mode | Description | |---|---| | Query (SELECT) | Run SOQL with full syntax highlighting, autocomplete, and Tooling API support | | Execute Apex | Anonymous Apex with debug output | | Insert | Bulk insert records using Object:Field1,Field2\|val1,val2 format | | Update | Bulk update with record IDs | | Delete | Delete records by ID |

Keyboard shortcut: Ctrl/Cmd + Enter to execute.

Resizable split pane — drag the ••••• splitter between the editor and results table to resize both regions freely. Works with mouse and touch.

Results table features:

  • Sortable columns (click headers)
  • Full-text search across all columns
  • Page-size selector — 25 / 50 / 100 / 250 / 500 rows per page
  • CSV export
  • Nested object flattening (e.g. Owner.Name shown as a column)
  • Pagination with prev/next

🔭 Explore Panel — SObject Inspector

Enter any SObject API name to get a complete picture of that object:

  • All fields table — API Name, Label, Type, References, Nillable, Createable, Updateable, Filterable, Unique, Calculated, Length
  • Formatted SOQL scaffold — auto-generated SELECT covering every field, displayed in readable multi-line format with syntax highlighting. Copy as clean text or load directly into the Query Editor.
  • One-click actions — Load into Editor · View ERD · Ask AI

The describe call uses the Salesforce REST API (/sobjects/{Object}/describe) — no FieldDefinition SOQL required, so it works for all users regardless of object-level security.

📚 History Panel

Every successful SOQL query is auto-saved:

  • Timestamp, record count, and org username
  • Click to reload into the editor
  • Per-query delete or clear all
  • Persists in localStorage across browser sessions (up to 50 entries)

🗺️ ERD Panel (requires --enable-erd)

Generate Entity Relationship Diagrams for any set of SObjects using the sf mohanc plugin.

sf-utils --enable-erd
  1. Enter comma-separated SObject API names (e.g. Contact,Account,Opportunity)
  2. Click Generate ERD — runs sf mohanc md describe -s Objects -e diagram.svg server-side
  3. SVG renders inline in the preview pane
  4. Click ⛶ Full Screen to open a slide-in drawer with a zoom slider (20–200%)
  5. Click 📥 Download SVG to save the diagram

The ERD drawer slides in from the right with a smooth animation. Press Escape or click the overlay to close. The Explore panel's View ERD button pre-fills the current object name.

Requires: sf plugins install sfdx-mohanc-plugins

💬 AI Chat (requires --enable-AI)

Chat with an AI assistant that has full context of your query results and object schemas.

sf-utils --enable-AI

Supported providers (configure in AI Settings ⚙️):

| Provider | Model | Notes | |---|---|---| | 🦙 Ollama | Any local model | Free, private, runs on your machine | | 🔵 Claude | claude-sonnet-4-20250514 | Anthropic API key required | | 🤖 OpenAI | GPT-4o | OpenAI API key required | | ✕ xAI | Grok-2 | xAI API key required | | ⭐ Gemini | Gemini 1.5 Pro | Google AI API key required |

Context chips (toggle on/off):

  • Query Results — sends ALL returned records (up to 500 rows) to the AI so it can count, summarize, and analyze accurately
  • Object Fields — sends the full field schema from the last Explore session

Quick access:

  • 🤖 Ask AI button in the results bar pre-fills a summary prompt
  • Ask AI about this object in the Explore panel pre-fills an object analysis prompt

API keys are saved in localStorage — never sent to the sf-utils server.

⚙️ AI Settings

Configure and switch between AI providers. The active provider is highlighted. API keys are saved locally per-provider.

🎨 Themes

Five built-in themes, switchable from the header dropdown:

| Theme | Description | |---|---| | 🌑 Dark | Default dark slate theme | | ☀️ Light | Clean light theme | | 🔮 Cyberpunk | Neon on black | | ❄️ Nord | Arctic blue-grey | | 🌊 Solarized | Classic Solarized Dark |

Theme persists in localStorage. Monaco Editor theme syncs automatically.


📚 SOQL Examples

Basic query

SELECT Id, Name, Industry, AnnualRevenue
FROM Account
WHERE Industry = 'Technology'
LIMIT 25

Relationship traversal

SELECT Id, Name, Owner.Name, Owner.Email,
       (SELECT Id, Subject, Status FROM Tasks)
FROM Account
WHERE CreatedDate = THIS_MONTH

Aggregate query

SELECT Industry, COUNT(Id) Total, AVG(AnnualRevenue) AvgRevenue
FROM Account
WHERE Industry != null
GROUP BY Industry
ORDER BY COUNT(Id) DESC

Tooling API (enable "Tooling API" checkbox)

SELECT Id, Name, Body, ApiVersion
FROM ApexClass
WHERE Name LIKE 'Test%'
ORDER BY Name

Date literals

SELECT Id, Name, CloseDate, Amount
FROM Opportunity
WHERE CloseDate = THIS_QUARTER
  AND StageName = 'Closed Won'
ORDER BY Amount DESC

🔧 DML Format Reference

Insert

Object:Field1,Field2,Field3|value1,value2,value3|value4,value5,value6
Account:Name,Industry,AnnualRevenue|Acme Corp,Technology,1000000|Global Inc,Finance,5000000

Update (Id field required)

Object:Id,Field1,Field2|recordId,newValue1,newValue2
Account:Id,Name,Industry|001XXXXXXXXXXXXXXX,Updated Acme,Technology

Delete

Object:Id1,Id2,Id3
Account:001XXXXXXXXXXXXXXX,001YYYYYYYYYYYYYYY

⌨️ Keyboard Shortcuts

| Shortcut | Action | |---|---| | Ctrl/Cmd + Enter | Execute query / run code | | Ctrl/Cmd + / | Toggle comment | | Ctrl/Cmd + D | Select next occurrence | | Alt + ↑/↓ | Move line up/down | | Escape | Close ERD drawer |


🐛 Troubleshooting

Connection Issues

Error: Failed to get org details
  • Verify CLI: sf --version
  • Check auth: sf org list
  • Re-authenticate: sf org login web -a myalias

Port Already in Use

# macOS / Linux
lsof -ti:3456 | xargs kill -9

# Windows
netstat -ano | findstr :3456
# then: taskkill /PID <pid> /F

# Or use a different port:
sf-utils -p 4000

Explore: "No fields returned"

  • Check the SObject API name is exact (case-sensitive for some orgs)
  • Custom objects must end with __c
  • Verify your user has Read access on the object

ERD: "sf mohanc not found"

sf plugins install sfdx-mohanc-plugins
sf plugins list   # verify it appears

AI Chat: "Error: No AI provider selected"

  • Go to the ⚙️ AI Settings panel and click Select next to your preferred provider
  • Enter your API key for the chosen provider

AI Chat: Incorrect record counts

  • Make sure the Query Results context chip is enabled (blue)
  • The AI receives all records up to 500 rows — if your result has more, run a count query: SELECT COUNT() FROM Account

🔒 Security

  • Runs entirely locally on your machine
  • Uses your existing Salesforce CLI authenticated session — no credentials stored
  • AI API keys stored only in your browser's localStorage
  • Never expose the server port to public networks
  • Recommended: sandbox/scratch orgs for testing DML operations

📝 Best Practices

  1. Test DML in sandbox first — delete operations are irreversible
  2. Use LIMIT on exploratory queries to avoid large data transfers
  3. Page-size selector — use 25/50 for large datasets, 500 for exports
  4. ERD diagrams — start with 2–5 related objects for readable diagrams
  5. AI context — disable context chips you don't need to keep prompts focused
  6. Themes — Light theme recommended for screen sharing / presentations

🏗️ Architecture

Server endpoints:

| Endpoint | Description | |---|---| | GET /api/config | Returns { aiEnabled, erdEnabled, port } | | POST /api/org-details | Gets org access token + instance URL | | POST /api/execute | Runs SOQL/Apex/DML | | POST /api/objects | Lists all queryable SObjects (via REST) | | POST /api/object-fields | Gets fields for autocomplete | | POST /api/explore | Full REST describe for Explore panel | | POST /api/erd | Generates ERD SVG via sf mohanc |


📄 License

MIT License — © Mohan Chinnappan


🙏 Acknowledgments


📞 Resources


❓ Built-in Help System

Click the button at the bottom of the sidebar (or press the ? key anywhere outside the editor) to open the contextual help drawer.

The help drawer slides in from the right and covers every feature in the app across 10 tabs:

| Tab | Contents | |---|---| | 🗺️ Overview | Feature cards, getting-started steps | | ⚡ Query | SOQL syntax, autocomplete tips, date literals, results table | | 🔭 Explore | SObject explorer usage, field type reference | | ✏️ DML | Insert/Update/Delete format reference with live examples | | 📈 Charts | Chart types guide, aggregation, example workflow | | 💬 AI Chat | Provider setup, voice input, context chips, useful prompts | | 📊 Limits | Filter reference, bar colour key | | 🗺️ ERD | Step-by-step ERD generation, plugin install | | ⌨️ Shortcuts | All keyboard shortcuts for editor, dropdowns, drawers | | 🖥️ CLI | Full flag reference, examples, troubleshooting |

Press Esc or click the overlay to close the help drawer.