@project-blue-book/sfdx-metadata-dump
v1.0.1
Published
Concatenate Salesforce metadata source into a single markdown file using sf CLI syntax.
Maintainers
Readme
sfdx-metadata-dump
Concatenate Salesforce metadata source into a single Markdown file. Accepts the
same Type:Member syntax that sf project retrieve start -m and sf project
deploy start -m accept, including globs and bare type names. The output is
ideal for feeding metadata into LLMs, code reviews, and documentation.
Install
npm install -g @project-blue-book/sfdx-metadata-dumpPrerequisites
- Node.js >= 18
- The Salesforce CLI v2 (
@salesforce/cli) installed and on$PATH - Run from inside an SFDX project (a directory with
sfdx-project.json)
The tool does not require an authenticated org. It only reads local source.
Quickstart
# A single CustomObject and a single LWC
sfdx-metadata-dump CustomObject:Opportunity LightningComponentBundle:myComponent
# Glob (always quote globs so the shell doesn't expand them)
sfdx-metadata-dump "ApexClass:Account*"
# Every permission set in the project
sfdx-metadata-dump PermissionSet
# Preview what would be included
sfdx-metadata-dump --dry-run "ApexClass:My*"Options
| Flag | Default | Description |
|---|---|---|
| -o, --output <path> | docs/METADATA_DUMP.md | Output file path. |
| -m, --metadata <args> | | Repeatable alternative to positional args. |
| --include-meta-xml / --no-include-meta-xml | on | Include *-meta.xml sidecars. |
| --binary-mode <mode> | placeholder | placeholder, skip, or base64. |
| --max-file-size <bytes> | 1048576 | Files larger than this are treated as binary. |
| --dry-run | off | Print the file list, don't write output. |
| --quiet | off | Suppress progress on stderr. |
| --debug | off | Print stack traces on unexpected errors. |
| -h, --help | | Print usage. |
Output
A single Markdown file. Each file gets a header (its project-relative path) and
its contents in a fenced code block with a language hint. Binary files get a
placeholder section noting their size. See docs/sfdx_metadata_dump_spec.md
for the full output structure.
Troubleshooting
- "sf: command not found": install the Salesforce CLI globally with
npm install -g @salesforce/cli. - "Not inside an SFDX project":
cdinto a directory that containssfdx-project.json. - A glob matched nothing: shells expand
*before the tool sees it. Quote the argument:sfdx-metadata-dump "ApexClass:My*". - Component resolved to zero files: the metadata may exist only in your
org. Run
sf project retrieve start -m <Type:Member>first to pull it.
Contributing
git clone <repo>
npm install
npm testLicense
MIT
