Skip to content

Conversation

@william-xie-sf
Copy link
Collaborator

@william-xie-sf william-xie-sf commented Feb 9, 2026

What does this PR do?

  • Set flag so that command is in preview state
Screenshot 2026-02-09 at 3 45 05 PM
  • Use @oclif/multi-stage-output library instead of spinner for execution messages
Screenshot 2026-02-09 at 3 45 08 PM
  • Use @oclif/table (abstracted within sf-plugins-core) for non-json results output instead of custom metricsFormatter
Screenshot 2026-02-09 at 3 45 14 PM
  • Update command help text to call out org needs to be metadata enrichment eligible
Screenshot 2026-02-09 at 3 46 22 PM
  • Update README.md with updated help text

What issues does this PR fix or reference?

GUS: @W-21194676@

@william-xie-sf william-xie-sf requested a review from a team as a code owner February 9, 2026 23:28

Currently, this command supports enriching only Lightning Web Components, represented by the LightningComponentBundle metadata type.

Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Your org must be eligible for metadata enrichment. Your Salesforce admin can help with that.
Your org must be enabled with the MetadataAiEnrichmentPilot org perm to use the metadata enrichment feature. Contact your Salesforce admin.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's useful to explicitly say what's needed to use the feature.

If, however, there's more that has to happen beyond just enabling an org perm, then reject my suggestion and just keep the more vague original message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid point. I think for future proofing and to not expose the pilot perm (it's something we need to enable from our end - access requirements will likely change in the near future), we will keep it for now and revisit later!

Executing metadata enrichment for %s eligible components
Executing metadata enrichment

# spinner.updating.files
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do spinner and stage mean here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are both from oclif libraries as part CLI output formatting. Both do basically the same thing but just in slightly different ways (Spinner, Stage).

CLI team recommended us to use multi stage output for consistency with other plugins and make it clear what stage the execution is that, which is what this change is.

Comment on lines +17 to +23
import { MultiStageOutput } from '@oclif/multi-stage-output';
import { Messages, SfProject } from '@salesforce/core';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Flags, SfCommand, Ux } from '@salesforce/sf-plugins-core';
import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve';
import { EnrichmentHandler, EnrichmentMetrics, EnrichmentStatus, FileProcessor } from '@salesforce/metadata-enrichment';
import { ComponentProcessor } from '../../component/index.js';
import { MetricsFormatter, EnrichmentRecords } from '../../utils/index.js';
import { EnrichmentRecords } from '../../utils/index.js';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Organizing imports or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the only two actual changes were:

  • Removing MetricsFormatter (this was removed in favor of using oclif library)
  • Adding Ux from sf-plugins-core

commandMessages.getMessage('stage.executing'),
commandMessages.getMessage('stage.updating.files'),
];
const mso = new MultiStageOutput({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - can we rename the const to MULTI_STAGE_OUTPUT as this is a constant and provides better readability

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually not a constant but an initialized object that we call in order to move stages and change the output to the console. (see mso.goto() and mso.next() calls) It's inline with other plugins in salesforcecli org

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the const stages above could be moved to constants. Will update.

const metrics = EnrichmentMetrics.createEnrichmentMetrics(Array.from(enrichmentRecords.recordSet));
MetricsFormatter.logMetrics(this.log.bind(this), metrics, metricsMessages);
const ux = new Ux();
ux.log('');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?
ux.log('');

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea this is basically to print a newline

overflow: 'wrap',
});
}
ux.log('');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?
ux.log('');

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md Outdated
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
configuration variable is already set.
-m, --metadata=<value>... (required) Metadata type and optional component name to enrich.
-o, --target-org=<value> (required) [default: epic.out.18fed7c5294a@orgfarm.salesforce.com] Username or alias of the target
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[default: epic.out.18fed7c5294a@orgfarm.salesforce.com]
It might be default in one's system and not in others

Can we specify this as an example isntead if need be to avoid confusion

--target-org=epic.out.18fed7c5294a@orgfarm.salesforce.com

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - this needs to be removed. This was printed out from my local context which won't apply in the README.md. Will update.

@william-xie-sf william-xie-sf merged commit 4fabd9d into main Feb 10, 2026
15 checks passed
@william-xie-sf william-xie-sf deleted the t/metadata-intelligence/use-libraries-refactor branch February 10, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants