# sfdx-plugin-package-xml

> explore metadata in an org and generate a package.xml manifest

Latest version **1.0.1** (published 2026-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install sfdx-plugin-package-xml
pnpm add sfdx-plugin-package-xml
yarn add sfdx-plugin-package-xml
bun add sfdx-plugin-package-xml
```

Provides the command `sfdx-plugin-package-xml`.

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2026-08-18 |
| First published | 2020-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 7 |
| Unpacked size | 97.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 8 |
| Author | Matthias Rolke @amtrack |
| Maintainers | amtrack |
| Keywords | sfdx, sfdx-plugin, sf-plugin, package.xml, manifest, metadata backup, file properties, salesforce |

## Links

- npm: https://www.npmjs.com/package/sfdx-plugin-package-xml
- Repository: https://github.com/amtrack/sfdx-plugin-package-xml
- Homepage: https://github.com/amtrack/sfdx-plugin-package-xml#readme
- Issues: https://github.com/amtrack/sfdx-plugin-package-xml/issues
- npm.io page: https://npm.io/package/sfdx-plugin-package-xml

## Dependencies (7)

- [get-stdin](https://npm.io/package/get-stdin.md) 10.0.0
- [picomatch](https://npm.io/package/picomatch.md) 4.0.5
- [@salesforce/sf-plugins-core](https://npm.io/package/@salesforce/sf-plugins-core.md) 13.0.0
- [@mdapi-issues/listmetadata-standardvalueset](https://npm.io/package/@mdapi-issues/listmetadata-standardvalueset.md) 3.1.0
- [@mdapi-issues/listmetadata-recordtype-personaccount](https://npm.io/package/@mdapi-issues/listmetadata-recordtype-personaccount.md) 3.0.0
- [@mdapi-issues/listmetadata-standardvaluesettranslation-type](https://npm.io/package/@mdapi-issues/listmetadata-standardvaluesettranslation-type.md) 3.0.0
- [@mdapi-issues/listmetadata-installed-missing-namespaceprefix](https://npm.io/package/@mdapi-issues/listmetadata-installed-missing-namespaceprefix.md) 3.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2026-08-18
- 1.0.0-beta.36 (beta) — 2025-09-14
- 1.0.0 — 2025-09-19
- 1.0.0-beta.35 — 2025-06-04
- 1.0.0-beta.34 — 2025-01-30
- 1.0.0-beta.33 — 2024-11-13
- 1.0.0-beta.32 — 2024-10-26
- 1.0.0-beta.31 — 2024-10-25
- 1.0.0-beta.30 — 2024-06-10
- 1.0.0-beta.29 — 2024-06-06
- 1.0.0-beta.28 — 2023-10-27
- 1.0.0-beta.27 — 2022-10-23
- 1.0.0-beta.26 — 2022-10-19
- 1.0.0-beta.25 — 2022-10-19
- 1.0.0-beta.24 — 2022-10-19
- … 22 more at https://npm.io/package/sfdx-plugin-package-xml/versions

## README

# sfdx-plugin-package-xml

> explore metadata in an org and generate a package.xml manifest

> sfdx/sf plugin for generating a package.xml manifest

[![Actions Status](https://github.com/amtrack/sfdx-plugin-package-xml/actions/workflows/default.yml/badge.svg?branch=main)](https://github.com/amtrack/sfdx-plugin-package-xml/actions?query=branch:main)

## Installation

```console
sf plugins install sfdx-plugin-package-xml
```

## Usage

Commands

```console
sf force mdapi listallmetadata -h
sf package.xml generate -h
```

> :warning: Note: The first command is similar to the official (`sf force mdapi listmetadata`) command.
>
> However our command lists Metadata for **ALL** Metadata Types.
>
> ```diff
> -force mdapi listmetadata
> +force mdapi listallmetadata
> ```

## Use Cases

Retrieve all Metadata from an org named `acme-dev` (a.k.a "Metadata Backup", a.k.a. "sf force org pull")

```console
sf force mdapi listallmetadata -f /tmp/fileproperties.json -o acme-dev
sf package.xml generate -j /tmp/fileproperties.json -f package.xml --api-version 54.0
sf project retrieve start --manifest package.xml -o acme-dev
```

Explore Metadata in an org named `acme-dev`

```console
sf force mdapi listallmetadata --names -o acme-dev
# include child Metadata such as CustomField and filter for CustomFields on Account
sf force mdapi listallmetadata --children --names -o acme-dev | grep "CustomField:Account."
```

## Concept and Implementation

### Listing Metadata

General Approach:

- call [describeMetadata()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_describe.htm) to retrieve a list of Metadata Types
- call [listMetadata()](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_listmetadata.htm) for all Metadata Types (in chunks of max. 3 queries to adhere to the limits)
- list all folders and folder-based Metadata
- list `StandardValueSet`s using a workaround because of a bug
- optionally list all child Metadata Types (e.g. `CustomField` of `CustomObject`, `CustomLabel` of `CustomLabels`)

Workarounds:

There are a bunch of issues with `listMetadata`. The following repositories provide Minimum Working Examples and Workarounds we use:

- https://github.com/mdapi-issues/listmetadata-recordtype-personaccount
- https://github.com/mdapi-issues/listmetadata-standardvalueset
- https://github.com/mdapi-issues/listmetadata-standardvaluesettranslation-type
- https://github.com/mdapi-issues/listmetadata-installed-missing-namespaceprefix

### Component Names and Patterns

Component Names and Patterns have the following format: `<type>:<fullName>`

Examples:

```
CustomField:Account.Industry
CustomField:Account.*
ReportFolder:unfiled$public
Report:unfiled$public/
ApexClass:Test_*
ApexClass:*Test
ApexClass:ACME__*
```

For convenience you can also write `CustomField` instead of `CustomField:*`.

They are used throughout this plugin, e.g. in the

- output of `sf force mdapi listallmetadata --names`
- component names (allow rules) in `sf force mdapi listallmetadata --metadata`
- ignore rules in `sf force mdapi listallmetadata --ignore` and `sf package.xml generate --ignore`

### Filtering Metadata

There are some predefined filters to either **filter** or **exclude** certain metadata components:

- unmanaged
- unlocked
- managed
- managedreadonly
- managedwriteable

Examples:

1. To **only** list CustomObjects belonging to a Managed Package Unlocked Package:

```console
sf force mdapi listallmetadata -m "CustomObject" --managed --unlocked --names
sf force mdapi listallmetadata -m "CustomObject" --no-unmanaged --names
```

2. To list CustomObjects **except** the ones belonging to a Managed Package OR Unlocked Package:

```console
sf force mdapi listallmetadata -m "CustomObject" --unmanaged --names
sf force mdapi listallmetadata -m "CustomObject" --no-managed --no-unlocked --names
```

### Package.xml

The `package.xml` file follows a certain format (indentation, sort order).
You can discover this when using an unformatted `package.xml` to retrieve Metadata.
The returned zip file contains a well formatted `package.xml`.
We try to stick to this format to make working with version control systems more easy.

---
_Source: https://npm.io/package/sfdx-plugin-package-xml · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
