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-metadata-selector

v1.0.5

Published

A beautiful, interactive CLI tool for browsing, selecting, and generating package.xml files for Salesforce metadata retrieval with search, save/load, and wildcard support

Readme

Salesforce Metadata Selector CLI

A beautiful, interactive Node.js CLI tool that helps you browse, select, and generate package.xml files for Salesforce metadata retrieval.

It connects to your Salesforce org via the Salesforce CLI (sf), lists all available metadata components, and provides a dark-themed web interface (using Tailwind CSS + Monaco Editor) where you can:

  • 🔍 Search and filter metadata types and components in real-time
  • Select/deselect individual components or entire types
  • 💾 Save and load selections as JSON for reuse
  • 🎯 Use wildcards (*) for entire metadata types
  • 🎨 Customize API version dynamically
  • 📊 Track selection counts in real-time
  • ⌨️ Keyboard shortcuts for common actions
  • 🚫 Filter namespaced components (exclude by default, include with flag)
  • 📥 Download the final package.xml with one click

Screenshot

sf-metadata-sel

Help

✨ New Features

🔍 Search & Filter

  • Real-time search across all metadata types and component names
  • Highlight matching components for easy visibility
  • Auto-hide non-matching items to focus your selection

💾 Save & Load Selections

  • Export selections to JSON file for backup or sharing
  • Import selections to quickly restore previous work
  • Saves API version and wildcard preferences

🎯 Wildcard Support

  • Toggle wildcard mode to use * for entire metadata types
  • Automatically uses * when all components of a type are selected
  • Reduces package.xml size for large deployments

📊 Selection Counter

  • Real-time counter showing selected vs. total components
  • Helps track your selection progress
  • Updates instantly as you select/deselect

⌨️ Keyboard Shortcuts

  • Ctrl+S / Cmd+S - Download package.xml
  • Easy navigation with keyboard accessibility

🎨 Custom API Version

  • Editable API version field (defaults to 60.0 or your specified version)
  • Updates package.xml in real-time
  • Supports all Salesforce API versions

📈 Progress Indicator

  • Shows percentage progress while fetching metadata
  • Better feedback during long-running operations

📋 Features

  • Lists all metadata types using sf org list metadata-types
  • Fetches components per type with sf org list metadata
  • Dark theme UI with Monaco Editor for real-time package.xml preview
  • Per-type Select All / Deselect All buttons
  • Global Select All / Deselect All
  • Namespaced components filtering (exclude by default, include with --include-namespaced)
  • Prevents ENOBUFS errors with increased buffer sizes
  • Generates a standalone HTML file

🔧 Requirements

📦 Installation

npm install -g sf-metadata-selector

🚀 Usage

Basic Usage

# Excludes namespaced components by default
./sf-metadata-ui.js -o myOrgAlias

# Include namespaced components (managed package items, etc.)
./sf-metadata-ui.js -o myOrgAlias --include-namespaced

# Specify API version
./sf-metadata-ui.js -o myOrgAlias --api-version 65.0

# Custom output filename
./sf-metadata-ui.js -o myOrgAlias --output my-selector.html

# Using username instead of alias
./sf-metadata-ui.js -o [email protected]

Command Options

Options:
  -o, --org <alias|username>     Salesforce org alias or username (required)
  --include-namespaced           Include components with namespace prefix
  --api-version <version>        API version for package.xml (default: 60.0)
  --output <filename>            Output HTML filename (default: sf-metadata-selector.html)
  -h, --help                     Display help for command

📖 How It Works

  1. Connects to your org using sf org display
  2. Discovers metadata types with sf org list metadata-types
  3. Lists components for each type with sf org list metadata (with progress indicator)
  4. Filters out namespaced components unless --include-namespaced is used
  5. Generates a rich HTML interface:
    • Left panel: searchable metadata types + checkboxes + controls
    • Right panel: Monaco Editor showing real-time package.xml
  6. Download button creates package.xml ready for deployment

🎯 Usage Tips

Searching

  • Type in the search box to filter by metadata type or component name
  • Matching items are highlighted
  • Non-matching items are hidden

Saving Selections

  1. Select your desired components
  2. Click 💾 Save button
  3. Save the JSON file to your computer
  4. Later, click 📂 Load to restore selections

Using Wildcards

  1. Select all components you want for a metadata type
  2. Enable "Use wildcards (*) for all" checkbox
  3. Types with all components selected will use * instead of listing each member
  4. Great for CustomObject, ApexClass, etc.

Keyboard Navigation

  • Use Tab to navigate between controls
  • Space to toggle checkboxes
  • Ctrl+S (or Cmd+S on Mac) to download package.xml

📄 Example Generated package.xml

Without Wildcards

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <members>Account</members>
    <members>Contact</members>
    <members>CustomObject__c</members>
    <name>CustomObject</name>
  </types>
  <types>
    <members>MyController</members>
    <members>MyUtility</members>
    <name>ApexClass</name>
  </types>
  <version>64.0</version>
</Package>

With Wildcards (all components selected)

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
  <types>
    <members>*</members>
    <name>CustomObject</name>
  </types>
  <types>
    <members>*</members>
    <name>ApexClass</name>
  </types>
  <version>60.0</version>
</Package>

🛠️ Troubleshooting

ENOBUFS Error

Already mitigated with larger maxBuffer (10–20 MB). If still occurring on very large orgs:

  • Use --include-namespaced false to reduce component count
  • Split retrieval into multiple package.xml files
  • Increase buffer in the script if needed

No Components Shown

  • Ensure the org alias/username is authenticated: sf org list
  • Check that you have permissions to view metadata
  • Try running with --include-namespaced to see if components are namespaced

package.xml Not Updating

  • Refresh the HTML page
  • Check browser console (F12) for JavaScript errors
  • Ensure Monaco Editor loaded correctly

Command Not Found

Search Not Working

  • Clear the search box to see all components
  • Search is case-insensitive
  • Try searching for partial names

Load Selection Failed

  • Ensure the JSON file is from this tool's Save feature
  • Check that the file isn't corrupted
  • Verify JSON syntax if manually edited

🎨 UI Features

Left Panel

  • Search box - Real-time filtering
  • Selection counter - Shows X / Total selected
  • Namespace indicator - Shows if namespaced components are included/excluded
  • Action buttons - Select All, Deselect All, Save, Load
  • Collapsible sections - Click to expand/collapse metadata types
  • Per-type controls - Select/Deselect All for each type
  • Highlight on search - Matching items highlighted in blue

Right Panel

  • API Version input - Change version on the fly
  • Wildcard toggle - Enable/disable wildcard mode
  • Monaco Editor - Syntax-highlighted XML editor
  • Download button - One-click package.xml download
  • Keyboard hint - Shows Ctrl+S shortcut

🔮 Future Enhancements

Potential features for future versions:

  • [ ] Metadata comparison between orgs
  • [ ] Dependency analysis to show related components
  • [ ] Multiple package.xml generation (e.g., split by feature)
  • [ ] Recent selections history
  • [ ] Preset filters (e.g., "All Apex", "All Objects")
  • [ ] Diff view against existing package.xml
  • [ ] Cloud storage integration for selections
  • [ ] Batch operations across multiple orgs
  • [ ] Component descriptions on hover

Testing

# Test with your org
./sf-metadata-ui.js -o yourOrgAlias

# Test with different options
./sf-metadata-ui.js -o yourOrg --include-namespaced --api-version 59.0

📄 License

MIT License (c) Mohan Chinnappan


Built with ❤️ for Salesforce developers

🔗 Useful Links