{"id":33589342,"url":"https://github.com/salesforcecli/plugin-bre-to-cml","last_synced_at":"2026-04-26T08:10:31.846Z","repository":{"id":308418521,"uuid":"1009226977","full_name":"salesforcecli/plugin-bre-to-cml","owner":"salesforcecli","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-11T11:51:49.000Z","size":8607,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-11T13:25:47.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/salesforcecli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-26T19:31:42.000Z","updated_at":"2026-04-11T11:50:06.000Z","dependencies_parsed_at":"2026-04-18T11:00:54.022Z","dependency_job_id":null,"html_url":"https://github.com/salesforcecli/plugin-bre-to-cml","commit_stats":null,"previous_names":["salesforcecli/plugin-bre-to-cml"],"tags_count":37,"template":false,"template_full_name":null,"purl":"pkg:github/salesforcecli/plugin-bre-to-cml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-bre-to-cml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-bre-to-cml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-bre-to-cml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-bre-to-cml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salesforcecli","download_url":"https://codeload.github.com/salesforcecli/plugin-bre-to-cml/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salesforcecli%2Fplugin-bre-to-cml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31966217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-29T14:04:34.944Z","updated_at":"2026-04-18T11:01:00.223Z","avatar_url":"https://github.com/salesforcecli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# plugin-bre-to-cml\n\n[![NPM](https://img.shields.io/npm/v/@salesforce/plugin-agent.svg?label=@salesforce/plugin-agent)](https://www.npmjs.com/package/@salesforce/plugin-bre-to-cml) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/plugin-bre-to-cml.svg)](https://npmjs.org/package/@salesforce/plugin-bre-to-cml) [![License](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](https://opensource.org/license/apache-2-0)\n\n## Install\n\n```bash\nsf plugins install @salesforce/plugin-bre-to-cml@x.y.z\n```\n\n## Contributing\n\n1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)\n2. Create a new issue before starting your project so that we can keep track of\n   what you are trying to add/fix. That way, we can also offer suggestions or\n   let you know if there is already an effort in progress.\n3. Fork this repository.\n4. [Build the plugin locally](#build)\n5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.\n6. Edit the code in your fork.\n7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.\n8. Sign CLA (see [CLA](#cla) below).\n9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.\n\n### CLA\n\nExternal contributors will be required to sign a Contributor's License\nAgreement. You can do so by going to https://cla.salesforce.com/sign-cla.\n\n### Build\n\nTo build the plugin locally, make sure to have yarn installed and run the following commands:\n\n```bash\n# Clone the repository\ngit clone git@github.com:salesforcecli/plugin-bre-to-cml\n\n# Install the dependencies and compile\nyarn install\nyarn build\n```\n\nTo use your plugin, run using the local `./bin/dev.js` or `./bin/dev.cmd` file.\n\n```bash\n# Run using local run file.\n./bin/dev cml\n```\n\nThere should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.\n\n```bash\n# Link your plugin to the sf cli\nsf plugins link .\n# To verify\nsf plugins\n```\n\n## Commands\n\n\u003c!-- commands --\u003e\n\n- [`sf cml convert prod-cfg-rules`](#sf-cml-convert-prod-cfg-rules)\n- [`sf cml import as-expression-set`](#sf-cml-import-as-expression-set)\n\n## `sf cml convert prod-cfg-rules`\n\nConverts BRE based Standard Configurator rules represented as JSON to CML and saves it as a pair of CML and association files.\n\n```\nUSAGE\n  $ sf cml convert prod-cfg-rules -o \u003cvalue\u003e -r \u003cvalue\u003e -c \u003cvalue\u003e [--json] [--flags-dir \u003cvalue\u003e] [--api-version \u003cvalue\u003e] [-d\n    \u003cvalue\u003e] [-x \u003cvalue\u003e] [-v \u003cvalue\u003e]\n\nFLAGS\n  -c, --cml-api=\u003cvalue\u003e              (required) Unique CML API Name to be created.\n  -d, --workspace-dir=\u003cvalue\u003e        Directory where working files are located, exported rules JSON and where CMLs will\n                                     be created.\n  -o, --target-org=\u003cvalue\u003e           (required) Username or alias of the target org. Not required if the `target-org`\n                                     configuration variable is already set.\n  -r, --pcr-file=\u003cvalue\u003e             (required) Name of the JSON file that contain exported standard Product\n                                     Configuration Rules.\n  -v, --products-file=\u003cvalue\u003e        Name of the JSON file that contain exported Products from PCM (if not present\n                                     products will be fetched automatically).\n  -x, --additional-products=\u003cvalue\u003e  Comma-separated list of additional product IDs for which CML types should be\n                                     generated.\n      --api-version=\u003cvalue\u003e          Override the api version used for api requests made by this command\n\nGLOBAL FLAGS\n  --flags-dir=\u003cvalue\u003e  Import flag values from a directory.\n  --json               Format output as json.\n\nDESCRIPTION\n  Converts BRE based Standard Configurator rules represented as JSON to CML and saves it as a pair of CML and\n  association files.\n\n  Before you execute this command make sure to migrate you PCM or perform migration of rules within the same org.\n\n  Export BRE based Standard Configurator rules using sf data export bulk plugin and save results in a JSON file:\n  sf data export bulk -o breMigOrg --query \"SELECT ApiName, ConfigurationRuleDefinition,Description, EffectiveFromDate,\n  EffectiveToDate, Id, IsDeleted, Name, ProcessScope, RuleSubType, RuleType, Sequence, Status FROM\n  ProductConfigurationRule WHERE RuleType = 'Configurator' AND ApiName = 'myTestBundle'\" --output-file\n  ./data/ProductConfigurationRules.json --result-format json --wait 10 --all-rows\n\n  This command executes following logic:\n\n  - Read SC Rules from the json file and build a list of `ConfiguratorRuleInput` to mimic the JSON structure of\n  `ConfigurationRuleDefinition`\n  - Group rules by non-intersecting `Product2` IDs (CMLs can’t share products)\n  - For each group:\n  - Query PCM for related products (for bundle rules) or root definitions (for others)\n  - Build an in-memory representation of the CML\n  - Apply logic to build constraints\n  - Serialize the in-memory CML to a blob for import as an Expression Set, save it in a cml-api.cml file.\n  - Create `ExpressionSetConstraintObj` association records pointing to the `cml-api` name and write them to\n  `cml-api_associations.csv` file.\n  - If multiple CML and association files are produced 1-N number will be appended to the names of files.\n\nEXAMPLES\n  $ sf cml convert prod-cfg-rules --pcr-file data/ProductConfigurationRules.json --cml-api MY_TEST --workspace-dir data --target-org breMigOrg\n```\n\n## `sf cml import as-expression-set`\n\nImports CML and associations to the target org\n\n```\nUSAGE\n  $ sf cml import as-expression-set -o \u003cvalue\u003e -x \u003cvalue\u003e -c \u003cvalue\u003e [--json] [--flags-dir \u003cvalue\u003e] [--api-version \u003cvalue\u003e] [-d\n    \u003cvalue\u003e]\n\nFLAGS\n  -c, --cml-api=\u003cvalue\u003e             (required) Unique CML API Name to be created.\n  -d, --workspace-dir=\u003cvalue\u003e       Directory where converted CML and assocciations csv files are located.\n  -o, --target-org=\u003cvalue\u003e          (required) Username or alias of the target org. Not required if the `target-org`\n                                    configuration variable is already set.\n  -x, --context-definition=\u003cvalue\u003e  (required) Context Definition name to be assocciated with the CML.\n      --api-version=\u003cvalue\u003e         Override the api version used for api requests made by this command\n\nGLOBAL FLAGS\n  --flags-dir=\u003cvalue\u003e  Import flag values from a directory.\n  --json               Format output as json.\n\nDESCRIPTION\n  Imports CML and associations to the target org\n\n  Review CM created by conversion command before doing import.\n  This command executes following logic:\n  - Import one CML at a time\n  - Upsert the Expression Set using the `cml-api` name\n  - Read and upsert `ExpressionSetConstraintObj` rows from the `cml-api_associations.csv` file (resolving FKs)\n  - Upload the CML blob\n\nEXAMPLES\n  $ sf cml import as-expression-set --cml-api MY_TEST --context-definition PricingTransactionCD2 --workspace-dir data --target-org tgtOrg\n```\n\n\u003c!-- commandsstop --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforcecli%2Fplugin-bre-to-cml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalesforcecli%2Fplugin-bre-to-cml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalesforcecli%2Fplugin-bre-to-cml/lists"}