DEV Community

Cover image for sfDesk: A Desktop App for the Salesforce CLI
Ahmad Ezzat
Ahmad Ezzat

Posted on Originally published at ahmadezzat.me AI-assisted

sfDesk: A Desktop App for the Salesforce CLI

The Salesforce CLI is the most capable tool we have for working with orgs. It's also a long list of commands and flags. I use it every day, and I still look up the flags for exporting records or tailing a log more often than I'd like to admit. For many of the admins, testers and consultants I work with, the terminal is reason enough not to use it at all.

So I built sfDesk: a desktop app that puts the sf CLI behind buttons. It shows every org your computer is signed in to, and gives you a page for each everyday job: querying data, running Apex, reading debug logs, running tests, deploying, building packages and checking an org's health.

Today I'm releasing sfDesk 0.1.0 for macOS and Windows. It's free and open source under the Apache 2.0 license.

Download sfDesk · Source on GitHub

What I wanted from it

IntelliJ is where I write my code, and browser extensions are great for a quick look at a record. What I kept missing was the thing in between: one window where I can switch orgs, check data, run a script, read the log it produced, run the tests and ship the change, without remembering a single flag. Three rules shaped every screen:

  • Buttons, not commands. Every action is a button that says what it does: "Open in browser", not "Run org open". If you want to learn the CLI, turn on Show sf commands in Settings and sfDesk shows the exact sf command behind every button.
  • Safe by default. Queries only read. Production orgs ask before the first Apex run, before a record edit and before a deploy. Validating doesn't change anything, so it doesn't ask.
  • At home on both platforms. Liquid Glass on macOS 26, Mica and Fluent on Windows 11, in light, dark or colorful themes with six accent colors.

Twelve pages in sfDesk: Connections, Schema, Query, GraphQL, Import & Export, Anonymous Apex, Apex Tests, Debug Logs, Deploy & Retrieve, Code Analyzer, Packages and Org Info

Most pages work on the active connection, which you pick at the top of the sidebar. It's separate from the CLI's default org, so switching in sfDesk never changes what your terminal targets.

A quick tour

The screenshots use made-up sample data, not a real org. Shortcuts are shown for macOS; on Windows, use Ctrl for ⌘.

Every org in one place

Connections lists every org, grouped into Production, Developer orgs, Sandboxes and Scratch orgs. Each shows whether it's connected, needs sign-in, expires soon, has expired, can't be reached or hasn't been used in a while.

The Connections page on macOS: production orgs, developer orgs and sandboxes with their status and when each was last used

  • Add a connection with the + button. You sign in on Salesforce's own page in your browser, so your password never touches sfDesk.
  • Open an org, its Setup or a private window with one click. Rename connections, sign out of several at once, and clear out expired scratch orgs.
  • Give each connection a project folder, and Deploy & Retrieve, Code Analyzer and Packages open it whenever that connection is active.
  • Export and import your connections. A plain list is safe to share with your team, since everyone signs in with their own account. To move to a new computer, include the sign-ins, locked with a password you choose.

If you work with scratch orgs, sfDesk creates them from any Dev Hub (edition, duration, any of the 330 features, or your project's definition file). Pools keep a few ready: describe a pool once, Fill pool makes the missing orgs within your Dev Hub's limits, and Take one hands you the org with the most days left. Reminders 1, 3 or 7 days before a scratch org expires show as a banner, a dot in the sidebar and a notification.

⌘K for everything

Press ⌘K anywhere to switch connection, open an org or its Setup, go to a page, run an action, or load a query or script you saved.

The ⌘K palette searching for "acme": switch to a sandbox, open an org in the browser, or open its Setup

Query, Schema and GraphQL

Query has autocomplete for objects, fields, relationships, picklist values and date literals. Mistakes are underlined as you type, with one-click fixes (Nmae becomes Name), and ⌘↵ runs the query.

The Query page in dark mode: a colored SOQL query on Account and 50 rows of results

  • Results sort and search, and copy for Excel, as CSV or as JSON, or save to Downloads as a workbook, CSV or JSON file.
  • Reading is the default. Anything other than SELECT is refused. To delete records, you tick them in the results and confirm, and sfDesk lists any that Salesforce refused, with the reason.
  • Tooling API queries reach metadata such as Apex classes, flows and debug logs.
  • Schema shows objects and fields in readable types like Lookup(Account) and Text(255), with picklist values, formulas and help text. Query this object writes the SELECT for you.
  • GraphQL runs read-only UI API queries and shows the records in the same table, with the full JSON one click away.

Click any record Id, in Query or GraphQL, and the record opens in a side panel with every field and lookups you can follow. Edit shows exactly what will change, and in which org, before it saves.

GraphQL results with an Account record open in the side panel

Import and export spreadsheets

Open Import & Export, choose the operation and the object, and drop a CSV file or an Excel workbook on the window. sfDesk matches columns to fields by name, finds related records by an external ID (Account.ERP_Id__c), and checks every row before anything is sent. Rows with a bad date, number, email or picklist value are left out, and you can save them to fix.

The Import tab: the columns of a Contacts file matched to fields, and a check that leaves out 2 of 2,480 rows with the reason for each

The load runs through the Bulk API (insert, update, upsert or delete), and sfDesk follows the job until Salesforce is done, then lists any rows it refused, with the reason. Export works the other way: an object's records, or what a query selects, as CSV, Excel or JSON.

Apex, tests and debug logs

Anonymous Apex keeps several scripts open in tabs, so you can pin the ones you use often and pick up where you left off. Autocomplete knows the org's objects and fields and your own variables. After a run you see compile errors, any exception with its line, and the log, and Debug only shows just your System.debug lines.

Anonymous Apex in dark mode: a script that ran on a production org, with its debug lines below

Apex Tests run class by class, with failures and stack traces as they come in. Results show the pass rate, the slowest tests and coverage, and one button reruns the classes that failed. The Code coverage tab shows the whole org against the 75% that production deploys need, with the covered and missed lines of each class.

Apex Tests: 2 of 38 tests failed, with a 95% pass rate, 78% coverage and the stack trace of each failure

Debug Logs puts what matters first. Pick a log and Insights shows the exception that stopped the run, queries in a loop, the limits it used and the slowest code, before you read a single line of the log itself.

Debug Logs: a failed Lightning page request with its NullPointerException, SOQL, DML, CPU and heap usage

You can also turn logging on for any user, the Automated Process user or the Platform Integration user for 30 minutes to 24 hours, trace a single Apex class or trigger, and clean up old logs while watching how much of the org's 1,000 MB of log storage is used.

Deploy and retrieve, with a diff first

Deploy & Retrieve lets you pick what to move from your project or straight from the org, type by type, or open a package.xml. Then Compare fetches the org's copy and lists every file that's new, changed or only on one side, with a line-by-line diff. Nothing changes in the org or in your project.

Seven components compared with a production org, with a line-by-line diff of an Apex class

  • Deploy or validate with the tests you need: none, the ones you name, the relevant tests Salesforce picks (beta), local tests or all tests. Components and tests show as they run, and errors point to their file and line.
  • Retrieve writes the org's versions into your project and lists what was created and changed.
  • Deployment status lists the org's recent and running deployments from any tool (sfDesk, the CLI, change sets), with who started each one and what failed. Cancel one that's running, or quick deploy a validation that passed in the last 10 days.
  • A file sf can't read usually stops every deploy in a project with a confusing error. sfDesk names the file, says what's wrong, and can add it to .forceignore.

For small fixes there's an Apex editor right in the project list, with completion for your org's objects and fields. Save and deploy sends that one class or trigger to the org with the tests you choose, and sfDesk asks before overwriting a file that changed on disk since you opened it.

The Apex editor: a class open with completion offering an Account picklist field, and Save and Save and deploy buttons

Code Analyzer and packages

Code Analyzer scans a project with Salesforce Code Analyzer and the engines you pick: PMD, Copy/Paste Detector, ESLint, RetireJS, Regex, Flow Scanner, Graph Engine, ApexGuru and UI Bundle. Results group by file, rule, severity or engine, with the code around each problem, and reports save as HTML, SARIF, CSV, JSON or XML. sfDesk installs the plugin on first use and tells you when an engine needs Java or Python.

Code Analyzer: 34 violations grouped by file, with critical, high, moderate, low and info counts

Packages is for teams that ship packages: see your Dev Hub's unlocked and managed packages with every version's status and coverage, build a new version from your project, promote it, install any version by its 04t ID, and copy install links. If you don't build packages, hide the page in Settings.

Org Info: health check and compare

Org Info starts with the essentials: edition, instance and release, active users (and who hasn't signed in for 90 days), API requests and storage. Then:

  • Health Check shows Salesforce's Security Health Check score and every setting it checks, plus what it leaves out: admins who haven't signed in for 90 days, users who can modify or view all data, unassigned licenses, limits over 80%, Apex coverage under 75%, code saved at API versions over three years old, Process Builder processes still running and Apex jobs that failed this week. Each finding lists the people, code or jobs behind it.
  • Limits and licenses shows what's closest to running out, and licenses that are full or expiring.
  • Compare puts another org next to the active one and lists only what differs: the release each is on, Apex coverage by class, limits, licenses and installed package versions. It's handy before a deploy, or to check that a sandbox still matches production.

Health Check: a 64% score, 3 high-risk and 4 medium-risk settings, and findings worst first

At home on Windows too

It's one codebase, and the Windows build follows Windows 11's design: Mica, Fluent controls and the standard window buttons.

sfDesk on Windows 11: the Connections page with the Windows title bar

How it works, and what it never does

sfDesk is a thin layer over the official Salesforce CLI. Every action runs a real sf command on your computer, so it works with the orgs you're already signed in to, and anything you do in sfDesk you could also do in your terminal.

How sfDesk talks to Salesforce: the window asks the Rust core for a named action, the core runs a real sf command, and the CLI talks to your orgs

Because it touches your orgs, I was strict about what it's allowed to do:

  • No passwords or tokens are stored by sfDesk. The CLI keeps your sign-ins, encrypted, exactly as it does in the terminal. sfDesk removes tokens from sf's sign-in details before the window ever sees them.
  • Only a fixed list of commands can run. The window can't ask for arbitrary commands. Every button maps to one named action, every value (aliases, usernames, object names, queries, scripts) is checked first, and commands run directly, never through a shell.
  • Sign-ins leave the CLI only when you ask. An export with sign-ins is locked with your password (Argon2id and XChaCha20-Poly1305), and nothing in it, not even the usernames, can be read without it.
  • Nothing is sent anywhere else. The only network calls sfDesk makes itself are update checks, and Salesforce's download site if you ask it to install the CLI.

Under the hood

For the curious, sfDesk is built with Tauri 2: a Rust core that runs sf safely, and an interface in React and TypeScript. A few parts I especially enjoyed building:

  • SOQL autocomplete and checks written from scratch, so the editor knows your org's objects, fields, relationships and picklist values.
  • A small syntax highlighter for Apex, SOQL and GraphQL with ten color themes, including Xcode, GitHub, One, Solarized, Dracula, Monokai, Nord and Tokyo Night, instead of a heavy editor library.
  • A pretend Salesforce CLI for working on the interface. Run npm run dev, open the app in a browser, and every button works safely against sample orgs. The screenshots in this post come from it.
  • Automatic, signed releases. Pull requests use Conventional Commits, release-please writes the changelog, and each release builds signed installers for macOS and Windows. A release is published only when every installer built, and the app updates itself from there.

Download

Your computer Download
macOS, Apple silicon sfDesk_0.1.0_aarch64.dmg
macOS, Intel sfDesk_0.1.0_x64.dmg
Windows, x64 sfDesk_0.1.0_x64-setup.exe
Windows, x64 (MSI) sfDesk_0.1.0_x64_en-US.msi
Windows, ARM sfDesk_0.1.0_arm64-setup.exe

The newest version is always on the releases page.

  • Requirements: macOS 12 or later (Apple silicon or Intel), or Windows 10 or 11 (x64 or ARM).
  • No Salesforce CLI yet? On first run, sfDesk downloads Salesforce's official installer, checks its signature and runs it for you.
  • On Mac, the app is signed and notarized, so it opens without a warning.
  • On Windows, the installers aren't code-signed yet, so the first time Windows may show a SmartScreen notice: choose More info, then Run anyway.
  • Updates are automatic. sfDesk checks once a day and shows a card in the sidebar when there's a new version of sfDesk or the Salesforce CLI.

What's next

This is version 0.1.0, so there will be rough edges, and I'd love your help finding them. If something doesn't work the way you expect, report it. If there's a job you still open the terminal for, suggest it. And if you'd like to contribute, CONTRIBUTING.md covers setting up and the checks to run.

If sfDesk saves you a few commands, a star on GitHub helps other Salesforce folks find it.

GitHub logo iahmadezzat / sfdesk

A friendly desktop app for the Salesforce CLI: manage org connections with buttons, on macOS and Windows.

sfDesk is a community project. It isn't made by, endorsed by or affiliated with Salesforce. Salesforce and Salesforce CLI are trademarks of Salesforce, Inc.

Top comments (0)