Skip to content

Conversation

jon-freed
Copy link

@jon-freed jon-freed commented Sep 24, 2025

What does this PR do?

This PR adds support for comments in flags-dir files. (The flags-dir functionality is documented here: Salesforce CLI Setup Guide / Salesforce CLI Configuration and Tips / Specify Flag Values in Files.)

Allowing comments will improve usability and maintainability of flag configuration files. With this change, users will be able to add full-line comments that start with # or // to document their flag configurations without affecting CLI behavior.

Acceptance Criteria

  • Full-line comments starting with # or // (and nothing but whitespace before that) are filtered out from non-".json" files
  • Existing functionality is preserved (backwards compatible)
  • Lines with comments that are not full-line comments are preserved as-is
  • Whitespace in non-comment lines is maintained exactly
  • Comprehensive test coverage added for all scenarios

Testing Notes

  • Added 6 new test cases covering various comment scenarios
  • All existing tests continue to pass
  • Tested with mixed comment types, whitespace variations, and edge cases
  • Verified ".json" file behavior remains unchanged

Checklist

  • This change has been approved by the CLI Review Board or approval isn't required. Anything that adds/changes/deletes commands, flags, output, or json output has to be reviewed.
  • Does this follow the deprecation policy?

What issues does this PR fix or reference?

This PR does not fix any existing issue logged at https://github.com/forcedotcom/cli/issues.

The general issue that this PR helps fix is that the specifics of how the flags-dir is being used is difficult to document and understand.

For example: It can be difficult for reviewers to understand why specific paths are included in flags-dir files. A reviewer may ask: 'Why does your source-dir file contain this path?' If this PR is accepted, then developers will be able to add comments above each path to provide immediate context for reviewers.

Another example: Comments help document requirements for different deployment scenarios. For instance, when setting up multiple flags-dir directories for separate deployments, comments can clarify which paths belong in each file. (For an example of when multiple deployments are required, see the Salesforce Help Article 'Deploying OmniStudio Components with Other Objects Causes an Exception'.)

Also:

Copy link

Thanks for the contribution! Unfortunately we can't verify the commit author(s): jon-freed. One possible solution is to add that email to your GitHub account. Alternatively you can change your commits to another email and force push the change. After getting your commits associated with your GitHub account, sign the Salesforce Inc. Contributor License Agreement and this Pull Request will be revalidated.

- Support full-line comments starting with # or // in non-JSON files
- Preserve existing JSON file behavior (no comment processing)
- Filter lines that contain only whitespace + comment markers
- Maintain exact whitespace for non-comment lines
- Add comprehensive test coverage for comment filtering scenarios
@jon-freed jon-freed force-pushed the feature/flags-dir-files-support-comments branch from 7d9579e to 8ced491 Compare September 24, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant