@salesforce/afv-skills 1.68.0 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/package.json +1 -1
  2. package/skills/afcc-setup-coordinate/SKILL.md +348 -0
  3. package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
  4. package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
  5. package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
  6. package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
  7. package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
  8. package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
  9. package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
  10. package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
  11. package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
  12. package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
  13. package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
  14. package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
  15. package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
  16. package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
  17. package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
  18. package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
  19. package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
  20. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
  21. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
  22. package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
  23. package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
  24. package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
  25. package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
  26. package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
  27. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
  28. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
  29. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
  30. package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
  31. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
  32. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
  33. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
  34. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
  35. package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
  36. package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
  37. package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
  38. package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
  39. package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
  40. package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
  41. package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
  42. package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
  43. package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
  44. package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
  45. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
  46. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
  47. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
  48. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
  49. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
  50. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
  51. package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
  52. package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
  53. package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
  54. package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
  55. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
  56. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
  57. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
  58. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
  59. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
  60. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
  61. package/skills/commerce-react-storefront-create/SKILL.md +54 -21
  62. package/skills/dx-lifecycle-center/SKILL.md +24 -18
  63. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  64. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  65. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  66. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  67. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  68. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  69. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  70. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  71. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  72. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  73. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  74. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
  75. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  76. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  77. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  78. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  79. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  80. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  81. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  82. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  83. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  84. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  85. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  86. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  87. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  88. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  89. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  90. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  91. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  92. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  93. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  94. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  95. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  96. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  97. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  98. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  99. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  100. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  101. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  102. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  103. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  104. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  105. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  106. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  107. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  108. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  109. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  110. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  111. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  112. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  113. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  114. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  115. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  116. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  117. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  118. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  119. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  120. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  121. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  122. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  123. package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
  124. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  125. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  126. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  127. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  128. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  129. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  130. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  131. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  132. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  133. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  134. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  135. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  136. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  137. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  138. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  139. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  140. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  141. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  142. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  143. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  144. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  145. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  146. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  147. package/skills/platform-report-generate/SKILL.md +20 -1
  148. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  149. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  150. package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
  151. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  152. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  153. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  154. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  155. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  156. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  157. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
  158. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  159. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  160. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  161. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  162. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  163. package/skills/service-e911-configure/SKILL.md +242 -0
  164. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  165. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  166. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  167. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  168. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  169. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  170. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  171. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  172. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  173. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  174. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  175. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  176. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  177. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  178. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  179. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  180. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  181. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  182. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  183. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  184. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  185. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  186. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  187. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  188. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: experience-app-mcp-delivery-generate
3
+ description: "Package and deliver an existing Salesforce hosted MCP server/App MCP for an Experience Site as an MCP configuration file or a Claude plugin repository. Discover the serving URL and External Client Application client ID, generate client configuration, optionally bundle skills in a plugin, and provide local testing and private GitHub handoff instructions. Plugin packaging supports Claude only; reject requests for Codex, ChatGPT, or other plugin platforms. Use for connecting clients and packaging delivery, not for creating or activating the Salesforce MCP server."
4
+ metadata:
5
+ version: "1.0"
6
+ minApiVersion: "68.0"
7
+ cliTools:
8
+ - tool:
9
+ - "git"
10
+ semver: ">=2.0"
11
+ - tool:
12
+ - "node"
13
+ semver: ">=18.0.0"
14
+ - tool:
15
+ - "sf"
16
+ semver: ">=2.0.0"
17
+ ---
18
+
19
+ # Deliver an Experience Site MCP Connection
20
+
21
+ Create a standalone MCP configuration file or a local Claude plugin for an existing hosted server. This skill owns client connection discovery and ECA client-ID retrieval. It reads Salesforce configuration and creates local files; publishing requires a separate user request.
22
+
23
+ `<skill-dir>` is the absolute directory containing this `SKILL.md`. Run discovery helpers from the selected SFDX project root and write delivery files to the user's chosen destination.
24
+
25
+ Reuse the org/site/server/ECA identities, exact site developer name, serving URL and validation results already established in the current context. Discover only missing, stale, conflicting or unverified facts. Ask only for choices that have not already been supplied.
26
+
27
+ ## Supported plugin platform
28
+
29
+ Check the requested delivery format and plugin platform before preflight or connection discovery. This skill generates **Claude plugins only**. If the user requests a Codex, ChatGPT, or any other non-Claude plugin, explain that the requested plugin platform is unsupported and stop without running helpers or creating files. Do not substitute a Claude plugin, claim cross-platform compatibility, or use `authStyle: "requested"` to bypass this boundary. Changing the delivery format requires a new, explicit user choice.
30
+
31
+ If the user asks for a plugin without naming its platform, ask which platform they want and state that this skill supports Claude plugins only. Determine the platform from the requested artifact, not from the application running this skill; an explicit request for a Claude plugin remains supported when made in Codex or ChatGPT. Standalone MCP configuration requests continue through the configuration-only path.
32
+
33
+ ## 0. Preflight
34
+
35
+ For supported delivery requests, reuse the target org alias or ask if missing. Run from the selected SFDX project root before every supported entry path, including repair and resume. Unsupported plugin requests stop at the platform check above without running preflight. Proceed only on `decision: continue`.
36
+
37
+ If the project root has no `sfdx-project.json`, create it before running any bundled script, with `packageDirectories` `[{"path": "force-app", "default": true}]` and `sourceApiVersion` `"68.0"`. Do not change an existing one.
38
+
39
+ IMPORTANT: Set `<skill-named>` to `true` only if the user's request explicitly names `experience-app-mcp-delivery-generate`; otherwise use `false`. Do not count the agent's own skill selection or messages.
40
+
41
+ ```bash
42
+ node "<skill-dir>/scripts/preflight.mjs" <target-org-alias> --skill-named <skill-named>
43
+ ```
44
+
45
+ Read the JSON `decision`:
46
+
47
+ - `continue`: proceed to step 1.
48
+ - `skip`: immediately exit this skill and pursue the original request another way. Say nothing about this skill, its check, or the result.
49
+ - `disabled`: say only the returned `userMessage`, without error details; exit this skill and pursue the original request another way.
50
+ - `needs_input` or `error`: show only `userMessage` and `nextAction`, obtain corrections and rerun preflight. Proceed only on `continue`; never infer entitlement from errors.
51
+
52
+ ## 1. Choose the delivery format
53
+
54
+ Reuse known choices. Establish whether the user wants **MCP configuration only** or an explicitly selected **Claude plugin**, following the supported-platform check above. Configuration-only delivery requires no plugin name, author, version, icon or bundled skills. Ask for its target client, an absolute path to a new JSON file, and missing connection facts. Read [standalone configuration delivery](references/mcp-config-delivery.md).
55
+
56
+ For a Claude plugin, load [package format and publishing](references/plugin-format-and-publishing.md) and ask together for missing inputs:
57
+
58
+ - Target org alias, MCP server DeveloperName, and Experience Site, if not already known.
59
+ - Where to create the plugin's GitHub repository locally: an absolute path to a **new directory**. Never assume the Salesforce project or this skill's directory is the destination.
60
+ - Kebab-case plugin name, short purpose/description, author, and semantic version (suggest `1.0.0` for the first release). Ask for the intended private `github.com` repository owner/name and license if the user knows them; both can be skipped for local testing. Do not invent author details or choose a license for them.
61
+ - Ask: **“Do you want to bundle any skills in this plugin?”** If yes, ask whether the user wants to include one or more existing skills, create one or more new skills, or both. For each new skill, ask for its goal, intended users, and the MCP tasks it should help with. For each existing skill, ask for the absolute folder path containing `SKILL.md`.
62
+ - Establish the OAuth callback port choice for every plugin request. Reuse an explicitly selected port or an explicit decision to skip from this session; otherwise ask: **“Provide the callback port matching your ECA's registered callback URL, or choose to skip setting a fixed port.”** If provided, pass it as the numeric `mcp.callbackPort` (integer 1–65535); the Claude Code profile writes it as `oauth.callbackPort`. Omit the field from both the generation config and `.mcp.json` when the user skips it or cannot provide a port—do not add a default, `null`, empty string or guessed port. Note any unverified callback registration as pending; packaging does not modify the ECA.
63
+ - Ask: **“Would you like to add a plugin icon? Provide an image file path, or skip for now.”** Reuse an image only if the user selected it for this plugin; do not reuse a removed icon or substitute Anthropic branding. Supply `iconPath` according to the reference's input requirements. Omit it when the user skips and continue with local testing.
64
+
65
+ Do not repeatedly ask for permission to inspect configuration, read the selected skill, generate new local files in the chosen scope, or validate them. Resolve ambiguity and incompatible existing files before proceeding. Do not deploy or activate a server, change ECA settings or permissions, authenticate as another user, or create/push any GitHub repository as part of packaging alone.
66
+
67
+ ## 2. Discover and confirm the connection
68
+
69
+ ```bash
70
+ node "<skill-dir>/scripts/discover_mcp_context.mjs" <target-org-alias> [SERVER_DEV_NAME]
71
+ ```
72
+
73
+ The helper prints only selected non-secret org fields, Tooling MCP server/access records, Network sites with their developer names, and ECA names/record IDs. Use the selected site's `DeveloperName` from this output. It captures `sf org display` internally; never print its full raw response because it contains an access token. A non-empty `errors` array or `incomplete` status indicates a failed or incomplete lookup, not absence. Report which lookup failed and resolve only the missing facts.
74
+
75
+ Select the exact deployed server and site from those results. Confirm the selected server's activation state; if it is inactive or activation lookup failed, report readiness as pending rather than activating it. An ECA need not share the server's name, and the server inventory does not prove an ECA association. Reuse a previously selected ECA or ask the user to choose its DeveloperName from the inventory.
76
+
77
+ Users do not need to know the full serving URL. Reuse an authoritative HTTPS URL from the existing server setup when available. Otherwise the generator builds the URL from route components; the path depends on the org environment:
78
+
79
+ | Environment | `https://api.salesforce.com/platform/mcp/v1/p/…` |
80
+ |---|---|
81
+ | `production` | `{my-domain}/{site-dev-name}/custom/{server-name}` |
82
+ | `developer` | `{my-domain}/develop/{site-dev-name}/custom/{server-name}` (token usually ends in `-dev-ed`) |
83
+ | `sandbox` | `{my-domain}--{sandbox-name}/sandbox/{site-dev-name}/custom/{server-name}` |
84
+ | `scratch` | `{my-domain}/scratch/{site-dev-name}/custom/{server-name}` |
85
+
86
+ - **Environment**: select `production`, `developer`, `sandbox`, or `scratch`. If the user explicitly requests one, use it. Otherwise use the discovery helper's `environment.value` (from the Organization record) and confirm it equals `domainCandidate.hostEnvironment` (from the instance hostname). If they differ or either is missing, report both pieces of evidence and ask; never guess.
87
+ - **My Domain token** is `domainCandidate.value`, **not** the full hostname, when its `hostEnvironment` matches the selected environment. When the user requests an environment other than the connected org's, or the host is unrecognized, ask only for that environment's token (for a sandbox, `{my-domain}--{sandbox-name}`) or resolve it through read-only org configuration.
88
+ - `site-dev-name` is the selected site's exact developer name, including case. Use its `DeveloperName` from the discovery output or current setup context. If it is missing, resolve the failed lookup and ask only for the missing authoritative value. Never substitute the display name, URL prefix, or a guessed bundle name.
89
+ - `server-name` is the exact deployed server DeveloperName, including case. Keep it separate from the plugin slug and MCP configuration key.
90
+
91
+ Pass `mcp.environment`, `mcp.domain`, `mcp.siteDeveloperName` and `mcp.mcpName` to the generator; never assemble the URL by hand or convert one environment's URL into another by editing path segments. Pass `mcp.url` instead only for an authoritative URL from existing setup. The legacy `mcp.sitePrefix` configuration is rejected. Show the environment, the resulting URL and their evidence in the delivery preview. Ask only about missing, ambiguous or conflicting components; do not require the user to research or assemble the URL.
92
+
93
+ Do not invoke business tools to determine a route. A correctly constructed URL does not prove the selected org has Experience Site MCP support enabled, its server is active, or OAuth and user access work. Record those connection checks as unverified until checked in the intended client.
94
+
95
+ ## 3. Retrieve the ECA client ID
96
+
97
+ Read [ECA lookup and recovery](references/eca-consumer-key.md).
98
+
99
+ If the caller already supplied a consumer key from a successful lookup in this session for the same selected org and ECA, reuse it. Otherwise run:
100
+
101
+ ```bash
102
+ node "<skill-dir>/scripts/retrieve_eca_consumer_key.mjs" <target-org-alias> <ECA_DEV_NAME> --json
103
+ ```
104
+
105
+ Use the returned **`clientId`** as the public OAuth client ID in the delivery output. Never fetch a consumer secret or copy an access/refresh token.
106
+
107
+ A non-zero exit means lookup/validation failed. Exit `0` with `status: not_found` proves no deployed ECA matched; `status: selection_required` lists consumer IDs/names and requires a selection. On `selection_required`, ask once which consumer to use, then rerun with its ID before `--json`. Do not guess a key or print candidate keys. Packaging does not change callback URLs, scopes, or permissions; note any needed readiness work in the generated README/handoff.
108
+
109
+ ## 4. Deliver configuration or prepare plugin skills
110
+
111
+ For **MCP configuration only**, follow [standalone configuration delivery](references/mcp-config-delivery.md), validate the written JSON and report the destination, client profile and pending connection checks. Stop there; do not run plugin generation, plugin validation or publication steps below.
112
+
113
+ For a **Claude plugin**, continue below.
114
+
115
+ For **no skills**, use `skills: []` in the generation config and create an MCP-only plugin.
116
+
117
+ For **each new skill**, inspect the selected server's available tool definitions/descriptions through an authenticated, read-only client connection when available. Otherwise use existing server metadata and backing-action descriptions as evidence, and mark unverified runtime tool names instead of inventing them. Write each focused `SKILL.md` and any necessary companions in a temporary staging directory: kebab-case name, concise trigger description, the user's stated goal, guidance on using the actual MCP tools, and consent before actions that change business data. Do not invoke business actions while authoring the skills, embed org credentials, or promise tools that are not exposed. Match tool references to the client-visible names once the plugin is loaded. Keep each skill self-contained; only bundle resources that serve its goal.
118
+
119
+ For **each existing skill**, inspect the chosen `SKILL.md`, its references, scripts, assets and local dependencies. Review it for public sharing, required companions and third-party license notices. Pass its absolute directory path in the configuration's `skills` array; the generator handles resource copying and file permissions. Create a staged copy only when edits are needed, such as resolving missing dependencies or machine-specific absolute references; pass that staged directory instead and leave the original unchanged. Resolve reported symlinks or credential files in the staged copy before retrying.
120
+
121
+ ## 5. Generate and validate
122
+
123
+ Create a temporary JSON configuration using the input contract in the reference. Omit `authStyle` or set it to `"claude-code"` for Claude Code. Select the custom `"requested"` OAuth profile only when the user explicitly requests it for the Claude plugin; leave runtime compatibility pending until validated. An OAuth profile changes connection settings, not the supported plugin platform. Supply the public client ID, never a secret.
124
+
125
+ Run the bundled generator to preview and write the package:
126
+
127
+ ```bash
128
+ node "<skill-dir>/scripts/generate_plugin.mjs" /path/to/package-config.json
129
+ node "<skill-dir>/scripts/generate_plugin.mjs" /path/to/package-config.json --write
130
+ ```
131
+
132
+ Show the preview: destination, manifest identity/version, MCP URL, public client ID source, auth profile, bundled skills and file inventory. Resolve uncertain routing/auth facts or naming changes in one question. Once the plan is within the user's selected scope, create the files with `--write`; do not ask a second time just to create them. Existing destinations block generation and are never overwritten.
133
+
134
+ On a blocked result or nonzero exit, report the generator's error, resolve the invalid inputs and rerun the preview; do not bypass the generator by constructing the output manually. Inspect the written files against the approved inputs: identity/version, server URL, public client ID, selected profile, icon and skill resources. Check that referenced resources resolve and that no credentials or private material entered the package.
135
+
136
+ Run `claude plugin validate <absolute-plugin-path>` after generation and after any correction; report its exit status and actual output, including warnings. If `claude` is not on PATH, look for an existing installation before declaring the CLI unavailable. Fix packaging errors within scope and rerun; unresolved errors mean the package is not validated. If the CLI is unavailable, report validation as pending rather than passed. Follow the reference for local `--plugin-dir` and `/mcp` OAuth/listing checks. Do not confuse file/schema validation with a verified connection or successful business action.
137
+
138
+ ## 6. Handoff for publication
139
+
140
+ Read the generated `README.md` and present its local testing and publication instructions to the user. Preserve its separate command blocks, safe path quoting and stop-on-error guidance. Adapt the instructions when the user's actual repository, account, version or installed CLI requires it; follow the reference for those cases. Present the launch command for the user to run, without starting an interactive Claude session automatically.
141
+
142
+ Report the local folder, files, chosen site/server/ECA, final serving URL, selected authentication profile, actual validation results and unresolved routing/OAuth or licensing work. Creating a repository, uploading, tagging or submitting requires a separate user request; presenting the README's commands does not authorize executing them. Keep hosting private unless the user explicitly requests another visibility, and review directory eligibility separately. Report publication or approval only when actually completed. Make the final documentation link in the completion message [Submit your plugin](https://claude.com/docs/plugins/submit).
@@ -0,0 +1,26 @@
1
+ # ECA client ID lookup
2
+
3
+ This delivery skill owns consumer-key retrieval. Run its helper from the selected SFDX project root; `<skill-dir>` is this skill's absolute directory.
4
+
5
+ ```bash
6
+ node "<skill-dir>/scripts/retrieve_eca_consumer_key.mjs" <target-org-alias> <ECA_DEV_NAME> --json
7
+ ```
8
+
9
+ The helper reads the project's `sourceApiVersion`, queries `ExternalClientApplication` by exact `DeveloperName`, and requests only the public key using GET `/services/data/v<version>/apps/oauth/credentials/<ECA-record-id>?part=key`. Do not query a `ConsumerKey` sObject field or retrieve a consumer secret.
10
+
11
+ Default successful output is the public consumer key. With `--json`, the response contains `apiVersion`, `ecaDeveloperName`, `ecaId`, `oauthConsumerId`, and `clientId`. Only `clientId` is the public OAuth client ID; the other IDs identify Salesforce records. Reuse a successful same-session lookup for the same selected org and ECA. Never copy access or refresh tokens into an output.
12
+
13
+ ### Consumer-key retrieval
14
+
15
+ | Exit | Meaning | Next step |
16
+ |---|---|---|
17
+ | `2` | Lookup, API, or response validation failed | Resolve the reported failure; it doesn't establish that the ECA or consumer is missing |
18
+ | `3` | The query succeeded and no ECA matched the DeveloperName | Confirm the exact ECA name and deployment; allow for propagation before retrying |
19
+ | `4` | An OAuth consumer must be selected | Show the returned consumer names and IDs and ask the user which is intended |
20
+
21
+ After the user selects an OAuth consumer, rerun the helper owned by `experience-app-mcp-delivery-generate` with that ID. Run it from the selected SFDX project root:
22
+ ```bash
23
+ node "<skill-dir>/scripts/retrieve_eca_consumer_key.mjs" <target-org-alias> <ECA_DEV_NAME> <oauth-consumer-id>
24
+ ```
25
+
26
+ For a permission error, report that the authenticated user needs `View External Client App Consumer Secrets in Metadata` and point the user to the ECA OAuth consumer details in Setup. Retry only `retrieve_eca_consumer_key.mjs` after resolving the failure, or have the user read the consumer key from that screen. Never retrieve the consumer secret. Use the lookup command and output contract above.
@@ -0,0 +1,38 @@
1
+ # Standalone MCP configuration delivery
2
+
3
+ Use when the user wants connection configuration without a plugin. Ask for the target client and an absolute path to a **new JSON file**. Do not change an existing client configuration; generate a file the user can review and import or merge using their client's supported workflow.
4
+
5
+ The delivery workflow is client-neutral; configuration schemas still depend on the client. The current generator supports the `claude-code` profile (default, `oauth.clientId`) and an explicitly requested custom `requested` profile (`auth.CLIENT_ID`). Do not claim either schema works in every client. For another client, establish its supported schema before generating; report unsupported formats rather than guessing.
6
+
7
+ A configuration input needs only `destination`, `mcp`, and optionally `authStyle`:
8
+
9
+ ```json
10
+ {
11
+ "destination": "/absolute/user-selected/new-mcp-config.json",
12
+ "authStyle": "claude-code",
13
+ "mcp": {
14
+ "serverName": "partner-tools",
15
+ "environment": "production",
16
+ "domain": "your-my-domain",
17
+ "siteDeveloperName": "PartnerPortal",
18
+ "mcpName": "PartnerTools",
19
+ "clientId": "actual-public-eca-consumer-key"
20
+ }
21
+ }
22
+ ```
23
+
24
+ Substitute the selected environment (`production`, `developer`, `sandbox` or `scratch`), its My Domain token and the exact site/server developer names as described in the skill; the generator builds the environment's route, so users need not supply or assemble the URL. Replace the four route components with `url` only when reusing an authoritative setup URL. An explicitly selected integer `mcp.callbackPort` is supported only for `claude-code`; omit it when skipped. Plugin identity, author, icon, repository and skills are unnecessary.
25
+
26
+ Preview:
27
+
28
+ ```bash
29
+ node "<skill-dir>/scripts/generate_mcp_config.mjs" /path/to/delivery-config.json
30
+ ```
31
+
32
+ Create the selected file:
33
+
34
+ ```bash
35
+ node "<skill-dir>/scripts/generate_mcp_config.mjs" /path/to/delivery-config.json --write
36
+ ```
37
+
38
+ Inspect the written JSON: `mcpServers` wraps the selected server key; its entry contains `type: "http"`, the exact HTTPS URL and the selected public client ID in the target profile. Confirm an omitted callback port remains absent. The generator refuses existing destinations and does not write plugin files or a README. Report the file path, selected org/site/server/ECA, profile and validation results. Provide import/merge guidance for the selected client; leave OAuth, routing, tool listing and user permissions pending until verified there. Do not run `claude plugin validate` on a standalone configuration file or provide publication steps unless separately requested.
@@ -0,0 +1,80 @@
1
+ # Claude Plugin Package and Publication
2
+
3
+ This format and the bundled generator support Claude plugins only. Reject Codex, ChatGPT, and other non-Claude plugin requests before running discovery or generation; do not package a Claude plugin as a substitute. If the plugin platform is unspecified, resolve it before proceeding.
4
+
5
+ Read before generating files. Format sources are the [official example README](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/example-plugin/README.md), [plugin manifest reference](https://code.claude.com/docs/en/plugins-reference), [MCP OAuth reference](https://code.claude.com/docs/en/mcp#use-pre-configured-oauth-credentials), and [submission guide](https://claude.com/docs/plugins/submit). Check these sources again if the target client's validator disagrees; do not treat a locally generated skeleton as directory approval.
6
+
7
+ ## Required layout
8
+
9
+ ```text
10
+ <plugin-repository>/
11
+ .claude-plugin/plugin.json
12
+ .mcp.json
13
+ README.md
14
+ .gitignore
15
+ assets/ # only when the user supplies an icon
16
+ skills/ # only when requested
17
+ <skill-name>/SKILL.md
18
+ <skill-name>/references/...
19
+ <skill-name>/scripts/...
20
+ ```
21
+
22
+ Only the manifest lives inside `.claude-plugin/`; skills and `.mcp.json` live at the plugin root. Prefer `skills/<name>/SKILL.md` over legacy `commands/*.md`. A marketplace manifest is not required merely to package a plugin repository for submission. Do not copy Anthropic branding or its example author's identity/license into a new package.
23
+
24
+ The plugin manifest contains `name`, semantic `version`, `description`, `author.name`, and the user's optional author email, repository URL and chosen license identifier. Use a stable kebab-case plugin name; never silently rename an already published plugin. First release can use `1.0.0`, then increment patch/minor/major according to the change. The skill's own metadata version and generated plugin's semantic version are separate.
25
+
26
+ For the icon choice established in the skill, supply `iconPath` as an absolute path to a regular, non-empty PNG, JPEG or WebP file, at most 5 MiB. Directories and symlinks are rejected. Omit `iconPath` when the user skips it. Prefer a square, legible image; local validation does not certify directory acceptance. If the generator rejects the input, report the error and ask for a valid replacement or an explicit decision to omit the icon. Do not substitute a placeholder or reuse a removed icon.
27
+
28
+ The icon is for the directory listing, not an MCP tool widget. If the client validator warns about the icon field, report the installed Claude Code version and the warning, and check the [manifest reference](https://code.claude.com/docs/en/plugins-reference#directory-listing-fields) before resolving it. Do not silently remove the selected icon.
29
+
30
+ ## Configuration for the bundled generator
31
+
32
+ This example is a configuration schema illustration, not real connection data. Replace every value using the selected org and user choices. Keep the temporary config outside both this repo and the public output.
33
+
34
+ ```json
35
+ {
36
+ "destination": "/absolute/user-chosen/new-plugin-folder",
37
+ "name": "partner-tools",
38
+ "version": "1.0.0",
39
+ "description": "Use approved partner operations through the Experience Site MCP server.",
40
+ "author": { "name": "User-provided author" },
41
+ "repository": "https://github.com/owner/partner-tools",
42
+ "authStyle": "claude-code",
43
+ "iconPath": "/absolute/path/to/user-selected-icon.png",
44
+ "mcp": {
45
+ "serverName": "partner-tools",
46
+ "environment": "production",
47
+ "domain": "your-my-domain",
48
+ "siteDeveloperName": "PartnerPortal",
49
+ "mcpName": "PartnerTools",
50
+ "clientId": "actual-public-eca-consumer-key"
51
+ },
52
+ "skills": ["/absolute/path/to/optional-skill"]
53
+ }
54
+ ```
55
+
56
+ Use `skills: []` for an MCP-only plugin. Substitute the selected environment (`production`, `developer`, `sandbox` or `scratch`), its My Domain token and the exact site/server developer names as described in the skill; the generator builds the environment's route, so users need not supply or assemble it. Replace the four route components with `mcp.url` only when reusing an authoritative setup URL. Do not normalize the server's DeveloperName or site developer name to the plugin slug. `serverName` is the local MCP configuration key, not a Salesforce record identifier.
57
+
58
+ `authStyle` accepts `"claude-code"` (the default when omitted) or `"requested"` (a custom OAuth profile requiring an explicit user request for the Claude plugin). Both produce the same Claude plugin package format; `"requested"` does not enable Codex, ChatGPT, or other plugin platforms. Use the default for Claude Code and leave custom OAuth compatibility pending until verified. The generator constructs the connection configuration. Report incompatible or ignored settings found during client validation and resolve the profile or inputs before retrying. A consumer secret, access token, refresh token or org-auth file must never enter either profile.
59
+
60
+ ## Local verification
61
+
62
+ ### Callback port input
63
+
64
+ Set `mcp.callbackPort` only to a user-selected JSON integer from 1 through 65535, and only with the `claude-code` profile. Omit the input when the user skips or cannot provide a port; do not supply `null`, an empty string or a guessed value. Check that the intended redirect URI matches the ECA registration; report that check as pending if unverified, and do not modify org settings as part of packaging.
65
+
66
+ Present the generated README's **Local check** instructions, preserving one command per fenced block and its safely quoted destination. Adapt the CLI path when needed. The launch command is for the user to run; do not start an interactive session automatically.
67
+
68
+ Run validation on the final files, not just an earlier preview. Record exit status, errors and warnings, fix packaging errors, and rerun after changes. Compare the generated connection settings with the approved inputs; a successful manifest check alone does not verify the connection. If the executable is not on PATH, use its installed absolute path when available; otherwise mark validation pending.
69
+
70
+ In the interactive client, use `/mcp` to authenticate with the intended Experience Site user and inspect the available tools. Check that the OAuth client and allowed redirect URI match the ECA, the server is active, and the user has permission for the backing actions. Read-only listing is sufficient for packaging verification; do not execute an action just to test the connection. A successful connection does not prove every business tool works or a widget renders.
71
+
72
+ ## Private GitHub handoff
73
+
74
+ Before upload, review every generated and copied file, resolve confidential material or machine-specific references, and clear routing/auth compatibility failures. A private repository still must not contain secrets. Discuss licensing before distribution. Present the generated README's **Publication** instructions and replace any owner placeholder with the user's intended private repository on github.com. Check the active account and intended owner's permissions; private visibility does not bypass managed-account restrictions. Creating a repository, uploading, tagging or submitting requires a separate user request.
75
+
76
+ Preserve one command per fenced block, with labels and blank lines between blocks. Tell users to run commands separately and stop on the first error. Keep repository creation private by default, and adapt the README's release tag to the selected semantic version. Create and push a release tag only after successful upload.
77
+
78
+ For an existing local repository, skip `git init`; commit only if there are changes. For an existing GitHub repository, provide its verified `git remote add origin`/push steps instead of creating a duplicate; inspect an existing `origin` before changing it. Do not recreate, move or force-push an existing release tag. The plugin files belong at the repository root. Keep `.claude-plugin/plugin.json` and release tags aligned for later versions. If no license has been chosen, label that distribution work pending rather than copying a sample license.
79
+
80
+ Private GitHub hosting is separate from public directory submission. After local and client checks, follow [Submit your plugin](https://claude.com/docs/plugins/submit) to review the current access/visibility requirements; do not promise that a private repository is eligible or automatically make it public. Valid structure is not marketplace acceptance. Do not create an Anthropic-owned `/plugins/` entry or submit a PR to the example as the default route for a third-party plugin. End the user-facing completion message with this submission guide as its final documentation link.
@@ -0,0 +1,9 @@
1
+ // DeveloperName values are interpolated into SOQL and filenames.
2
+ // Allow one managed-package separator (ns__Name). Reject a second double
3
+ // underscore, a trailing underscore, and anything over 80 characters.
4
+ const DEVELOPER_NAME =
5
+ /^(?:[A-Za-z][A-Za-z0-9]{0,14}__)?[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/;
6
+
7
+ export function isValidDeveloperName(name) {
8
+ return typeof name === "string" && name.length > 0 && name.length <= 80 && DEVELOPER_NAME.test(name);
9
+ }
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+ // Read-only inventory. Never print the full org-display response: it contains
3
+ // an access token. Only selected non-secret fields leave this process.
4
+ import fs from "node:fs";
5
+ import { execFileSync } from "node:child_process";
6
+ import { isValidDeveloperName } from "./developer_name.mjs";
7
+
8
+ function sfJson(args) {
9
+ return JSON.parse(execFileSync("sf", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }));
10
+ }
11
+
12
+ function normalizeSalesforceId(id) {
13
+ return typeof id === "string" && /^[A-Za-z0-9]{15}(?:[A-Za-z0-9]{3})?$/.test(id) ? id.slice(0, 15) : null;
14
+ }
15
+
16
+ // Enhanced-domain instance hosts encode both the routing token and the environment.
17
+ const HOST_PATTERNS = [
18
+ [/^([a-z0-9-]+--[a-z0-9]+)\.sandbox\.my\.salesforce\.com$/i, "sandbox"],
19
+ [/^([a-z0-9-]+)\.develop\.my\.salesforce\.com$/i, "developer"],
20
+ [/^([a-z0-9-]+)\.scratch\.my\.salesforce\.com$/i, "scratch"],
21
+ [/^([a-z0-9-]+)\.my\.salesforce\.com$/i, "production"],
22
+ ];
23
+
24
+ function domainFromHost(hostname) {
25
+ for (const [pattern, hostEnvironment] of HOST_PATTERNS) {
26
+ const match = hostname.match(pattern);
27
+ if (match) return { value: match[1].toLowerCase(), hostEnvironment };
28
+ }
29
+ return null;
30
+ }
31
+
32
+ // Scratch orgs report IsSandbox and carry a trial expiration; production trials do not report IsSandbox.
33
+ function classifyOrg({ IsSandbox, TrialExpirationDate, OrganizationType }) {
34
+ if (IsSandbox && TrialExpirationDate != null) return "scratch";
35
+ if (IsSandbox) return "sandbox";
36
+ if (typeof OrganizationType === "string" && OrganizationType.toLowerCase().includes("developer")) return "developer";
37
+ return "production";
38
+ }
39
+
40
+ function main() {
41
+ const [targetOrg, serverName, ...extra] = process.argv.slice(2);
42
+ if (!targetOrg || targetOrg.startsWith("-") || extra.length || (serverName && !isValidDeveloperName(serverName))) {
43
+ throw new Error("Usage: discover_mcp_context.mjs <target-org-alias> [SERVER_DEV_NAME]");
44
+ }
45
+ const { sourceApiVersion: apiVersion } = JSON.parse(fs.readFileSync("sfdx-project.json", "utf8"));
46
+ if (!/^\d{2,3}\.0$/.test(apiVersion)) throw new Error("SFDX project sourceApiVersion is missing or invalid");
47
+ let displayed;
48
+ try { displayed = sfJson(["org", "display", "--target-org", targetOrg, "--json"]); }
49
+ catch { throw new Error("Org lookup failed; authenticate the selected org with sf before retrying"); }
50
+ if (displayed.status !== 0 || !displayed.result?.instanceUrl || !displayed.result?.id) throw new Error("Org lookup returned an unrecognized response");
51
+ const instance = new URL(displayed.result.instanceUrl);
52
+ if (instance.protocol !== "https:" || instance.username || instance.password) throw new Error("Org instance URL is invalid");
53
+ const domain = domainFromHost(instance.hostname);
54
+ const errors = [];
55
+ function listNetworkMetadata() {
56
+ try {
57
+ const response = sfJson([
58
+ "org", "list", "metadata", "--metadata-type", "Network",
59
+ "--target-org", targetOrg, "--api-version", apiVersion, "--json",
60
+ ]);
61
+ if (response.status !== 0 || !Array.isArray(response.result) ||
62
+ response.result.some((record) => typeof record.fullName !== "string" || !record.fullName)) {
63
+ throw new Error();
64
+ }
65
+ return response.result.map(({ id, fullName }) => ({ id, fullName }));
66
+ } catch {
67
+ errors.push("Network Metadata API lookup failed or returned incomplete results; this does not prove absence");
68
+ return null;
69
+ }
70
+ }
71
+ function query(label, soql, tooling, fields) {
72
+ try {
73
+ const args = ["data", "query", "--query", soql, "--target-org", targetOrg, "--api-version", apiVersion, "--json"];
74
+ if (tooling) args.push("--use-tooling-api");
75
+ const response = sfJson(args);
76
+ if (response.status !== 0 || !Array.isArray(response.result?.records) || response.result.totalSize !== response.result.records.length) throw new Error();
77
+ return response.result.records.map((record) => Object.fromEntries(fields.map((field) => [field, record[field]])));
78
+ } catch {
79
+ errors.push(`${label} lookup failed or returned incomplete results; this does not prove absence`);
80
+ return null;
81
+ }
82
+ }
83
+ const orgs = query("Org environment", "SELECT IsSandbox, TrialExpirationDate, OrganizationType FROM Organization", false, ["IsSandbox", "TrialExpirationDate", "OrganizationType"]);
84
+ const environment = orgs?.length === 1 ? { value: classifyOrg(orgs[0]), source: "Organization query" } : null;
85
+ if (orgs && orgs.length !== 1) errors.push("Org environment lookup returned no single Organization record");
86
+ const servers = query("MCP server", `SELECT Id, DeveloperName, MasterLabel FROM McpServerDefinition${serverName ? ` WHERE DeveloperName = '${serverName}'` : ""}`, true, ["Id", "DeveloperName", "MasterLabel"]);
87
+ const serverAccess = query("MCP activation", "SELECT Id, McpServerId, Active FROM McpServerAccess", true, ["Id", "McpServerId", "Active"]);
88
+ const networkMetadata = listNetworkMetadata();
89
+ const sites = query("Experience Site", "SELECT Id, Name, UrlPathPrefix FROM Network", false, ["Id", "Name", "UrlPathPrefix"]);
90
+ const siteDeveloperNames = new Map(
91
+ (networkMetadata ?? []).map((record) => [normalizeSalesforceId(record.id), record.fullName])
92
+ .filter(([id]) => id !== null),
93
+ );
94
+ const sitesWithDeveloperNames = sites?.map((site) => ({
95
+ ...site,
96
+ DeveloperName: siteDeveloperNames.get(normalizeSalesforceId(site.Id)) ?? null,
97
+ }));
98
+ const ecas = query("ECA", "SELECT Id, DeveloperName FROM ExternalClientApplication", false, ["Id", "DeveloperName"]);
99
+ console.log(JSON.stringify({
100
+ status: errors.length ? "incomplete" : "discovered",
101
+ targetOrg, apiVersion,
102
+ org: { id: displayed.result.id, instanceUrl: instance.origin },
103
+ environment,
104
+ domainCandidate: domain ? { ...domain, source: "selected org instance hostname", routingVerified: false } : null,
105
+ servers, serverAccess, sites: sitesWithDeveloperNames,
106
+ networkMetadataFullNames: networkMetadata?.map((record) => record.fullName) ?? null,
107
+ ecas, errors,
108
+ }, null, 2));
109
+ }
110
+
111
+ try { main(); } catch (error) {
112
+ console.log(JSON.stringify({ status: "blocked", error: error.message }, null, 2));
113
+ process.exitCode = 1;
114
+ }
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ // Preview or create a standalone connection file without plugin metadata or org writes.
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { createMcpConfig } from "./mcp_config.mjs";
6
+
7
+ try {
8
+ const args = process.argv.slice(2);
9
+ if (args.length !== 1 && !(args.length === 2 && args[1] === "--write")) throw new Error("Usage: generate_mcp_config.mjs <CONFIG_JSON> [--write]");
10
+ const config = JSON.parse(fs.readFileSync(args[0], "utf8"));
11
+ if (typeof config.destination !== "string" || !path.isAbsolute(config.destination)) throw new Error("destination must be an absolute path to a new MCP configuration file");
12
+ const destination = path.resolve(config.destination);
13
+ // lstat also detects dangling symlinks; exclusive creation protects against races.
14
+ try {
15
+ fs.lstatSync(destination);
16
+ throw new Error("Destination already exists; select a new file");
17
+ } catch (error) { if (error.code !== "ENOENT") throw error; }
18
+ const mcpConfig = createMcpConfig(config);
19
+ if (args[1] === "--write") {
20
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
21
+ fs.writeFileSync(destination, JSON.stringify(mcpConfig, null, 2) + "\n", { flag: "wx", mode: 0o644 });
22
+ }
23
+ console.log(JSON.stringify({ status: args[1] === "--write" ? "created" : "preview", destination, mcpConfig, runtimeVerified: false }, null, 2));
24
+ } catch (error) {
25
+ console.log(JSON.stringify({ status: "blocked", error: error.message }, null, 2));
26
+ process.exitCode = 1;
27
+ }