hardis:org:list:metadata
Description
Command Behavior
Lists the metadata components of one type in an org, for scripts, agents and user interfaces.
- Any listable type: Pass
--typewith a Metadata API type (ApexClass, Flow, CustomField, Layout...). The result holds the API name (fullName) and the Id of each component, sorted by name. - Folder types in two steps: For Report, Dashboard, Document and EmailTemplate,
--typealone lists the folders. Pass--folderto list the content of one folder, namedFolder/Name. - Cached per org: The listing is kept 30 days per org Id, and shared with hardis:doc:metadata-deps: a listing made by one command serves the other. Pass
--refreshto list the org again. - Read-only: Nothing is written in the org. A type the Metadata API cannot list (a Tooling-only type, a misspelled type) returns
listable: falseand no items instead of an error. Any other failure (expired session, network error, API limit) is an error. - Output: Without
--json, a table and a CSV/Excel report. With--json, only the JSON result: no table and no report file.
The VS Code extension uses it to suggest API names in the Metadata Dependencies panel.
Agent Mode
Supports non-interactive execution with --agent:
sf hardis:org:list:metadata --agent --type ApexClass --target-org myOrgAlias --json
The command has no prompt: --type is required, and --agent only confirms the non-interactive use. Pair it with --json.
Technical explanations
- The components come from the Metadata API
listMetadatacall. The folder types are the types markedinFolderin the metadata registry. Their folders come fromReportFolder,DashboardFolder,DocumentFolder, and bothEmailFolder(Classic) andEmailTemplateFolder(Lightning) for email templates.unfiled$publicis always offered for Reports, email templates and Documents, becauselistMetadatanever returns it.--folderis refused for a type without folders. - Only the names and the Ids are cached, under
~/.sfdx/sfdx-hardis-cache/orgs/<orgId>/. Flow listings are never cached, because activating another Flow version changes its Id. A failed listing is not cached either.NO_CACHEdisables the cache,sf hardis:cache:clearempties it. - The
--jsonresult is{ type, folder, kind, items, listable, fromCache }, wherekindisfoldersorcomponentsand each item is{ fullName, id }.
Parameters
| Name | Type | Description | Default | Required | Options |
|---|---|---|---|---|---|
| agent | boolean | Run in non-interactive mode for agents and automation | |||
| debug -d |
boolean | Activate debug mode (more logs) | |||
| flags-dir | option | undefined | |||
| folder | option | Folder to list, for Report, Dashboard, Document and EmailTemplate | |||
| json | boolean | Format output as json. | |||
| refresh | boolean | List the org again instead of using the cached listing | |||
| skipauth | boolean | Skip authentication check when a default username is required | |||
| target-org -o |
option | undefined | |||
| type | option | Metadata API type to list (for example ApexClass, CustomField or Report) | |||
| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration |
Examples
$ sf hardis:org:list:metadata --type ApexClass --json
$ sf hardis:org:list:metadata --type Report --json
$ sf hardis:org:list:metadata --type Report --folder SalesReports --json
$ sf hardis:org:list:metadata --agent --type CustomField --refresh --target-org myOrgAlias --json