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
Maintainers
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.
Demo

🚀 Quick Start
npm install -g sf-utils-cli
sf-utilsOpen 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 helpExamples
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.Nameshown 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
localStorageacross 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- Enter comma-separated SObject API names (e.g.
Contact,Account,Opportunity) - Click Generate ERD — runs
sf mohanc md describe -s Objects -e diagram.svgserver-side - SVG renders inline in the preview pane
- Click ⛶ Full Screen to open a slide-in drawer with a zoom slider (20–200%)
- 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-AISupported 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 AIbutton in the results bar pre-fills a summary promptAsk AI about this objectin 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 25Relationship traversal
SELECT Id, Name, Owner.Name, Owner.Email,
(SELECT Id, Subject, Status FROM Tasks)
FROM Account
WHERE CreatedDate = THIS_MONTHAggregate query
SELECT Industry, COUNT(Id) Total, AVG(AnnualRevenue) AvgRevenue
FROM Account
WHERE Industry != null
GROUP BY Industry
ORDER BY COUNT(Id) DESCTooling API (enable "Tooling API" checkbox)
SELECT Id, Name, Body, ApiVersion
FROM ApexClass
WHERE Name LIKE 'Test%'
ORDER BY NameDate 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,value6Account:Name,Industry,AnnualRevenue|Acme Corp,Technology,1000000|Global Inc,Finance,5000000Update (Id field required)
Object:Id,Field1,Field2|recordId,newValue1,newValue2Account:Id,Name,Industry|001XXXXXXXXXXXXXXX,Updated Acme,TechnologyDelete
Object:Id1,Id2,Id3Account: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 4000Explore: "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 appearsAI 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
- Test DML in sandbox first — delete operations are irreversible
- Use LIMIT on exploratory queries to avoid large data transfers
- Page-size selector — use 25/50 for large datasets, 500 for exports
- ERD diagrams — start with 2–5 related objects for readable diagrams
- AI context — disable context chips you don't need to keep prompts focused
- 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
- Monaco Editor — The editor that powers VS Code
- Salesforce CLI — Official Salesforce tooling
- sf mohanc plugin — ERD and metadata utilities
- Built for the Salesforce Developer Community ⚡
📞 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.
