@salesforce/afv-skills 1.68.0 → 1.70.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.
- package/package.json +1 -1
- package/skills/afcc-setup-coordinate/SKILL.md +348 -0
- package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
- package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
- package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
- package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
- package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
- package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
- package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
- package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
- package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
- package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
- package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
- package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
- package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
- package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
- package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
- package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
- package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
- package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
- package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
- package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
- package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
- package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
- package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
- package/skills/commerce-react-storefront-create/SKILL.md +54 -21
- package/skills/data360-code-extension-generate/SKILL.md +160 -252
- package/skills/data360-code-extension-generate/references/README.md +34 -172
- package/skills/data360-code-extension-generate/references/environment-setup.md +198 -0
- package/skills/data360-code-extension-generate/references/mcp-integration.md +36 -0
- package/skills/data360-code-extension-generate/references/quick-reference.md +132 -202
- package/skills/data360-code-extension-generate/references/run-logs.md +31 -0
- package/skills/data360-code-extension-generate/references/schema-discovery.md +45 -0
- package/skills/data360-code-extension-generate/references/troubleshooting.md +45 -0
- package/skills/data360-code-extension-generate/scripts/check_env.sh +197 -0
- package/skills/data360-code-extension-generate/scripts/venv_hook.sh +22 -0
- package/skills/dx-devops-work-item-manage/SKILL.md +24 -8
- package/skills/dx-devops-work-item-manage/examples/common-workflows.md +32 -0
- package/skills/dx-devops-work-item-manage/references/review-api.md +95 -0
- package/skills/dx-lifecycle-center/SKILL.md +24 -18
- package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
- package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
- package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
- package/skills/dx-lifecycle-center/references/deploy.md +3 -3
- package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
- package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
- package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
- package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
- package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
- package/skills/dx-org-manage/SKILL.md +12 -12
- package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +1 -3
- package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +1 -3
- package/skills/dx-org-manage/references/opening-org.md +1 -1
- package/skills/dx-org-manage/references/scratch-org-operations.md +15 -20
- package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
- package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
- package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +3 -4
- package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
- package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
- package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
- package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
- package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
- package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
- package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
- package/skills/education-cloud-academic-calendar-generate/SKILL.md +2 -2
- package/skills/education-cloud-course-catalog-migrate/SKILL.md +1 -1
- package/skills/education-cloud-domain-configure/references/domain-features/recruitment-admissions.md +8 -7
- package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -0
- package/skills/education-cloud-multi-campus-configure/references/error_handling.md +7 -6
- package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +2 -0
- package/skills/education-cloud-student-recruitment-agent-configure/references/customer-narration.md +2 -0
- package/skills/education-cloud-student-recruitment-agent-configure/references/flows.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/grounding.md +5 -4
- package/skills/education-cloud-student-recruitment-agent-configure/references/permissions.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/routing.md +1 -1
- package/skills/experience-afv-analytics-query/SKILL.md +239 -0
- package/skills/experience-afv-analytics-query/references/references.md +176 -0
- package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
- package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
- package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
- package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
- package/skills/experience-app-mcp-generate/SKILL.md +174 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
- package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
- package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
- package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
- package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
- package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
- package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
- package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
- package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
- package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
- package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
- package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
- package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
- package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
- package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
- package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
- package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
- package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
- package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
- package/skills/experience-cms-content-type-generate/SKILL.md +8 -7
- package/skills/experience-cms-content-type-generate/references/agent-checklist.md +3 -3
- package/skills/experience-cms-content-type-generate/references/anti-patterns.md +2 -2
- package/skills/experience-cms-content-type-generate/references/discovery-details.md +1 -1
- package/skills/experience-cms-content-type-generate/references/retrieve-and-reconcile.md +5 -9
- package/skills/experience-ui-bundle-custom-app-generate/scripts/resolve-uibundle-path.mjs +10 -0
- package/skills/field-service-data-capture-migrate/references/converter-builder-contract.md +2 -2
- package/skills/field-service-data-capture-migrate/references/fsm-dc-capability-catalog.md +2 -2
- package/skills/field-service-data-capture-migrate/scripts/analyze_flow.py +1 -1
- package/skills/field-service-data-capture-migrate/scripts/convert_to_dc_spec.py +1 -1
- package/skills/field-service-data-capture-migrate/scripts/fsm_dc_catalog.py +2 -2
- package/skills/field-service-data-capture-migrate/scripts/generate_summary.py +2 -2
- package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
- package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
- package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
- package/skills/platform-custom-application-generate/SKILL.md +97 -104
- package/skills/platform-custom-application-generate/references/app-properties.md +52 -0
- package/skills/platform-custom-application-generate/references/app-visibility.md +19 -0
- package/skills/platform-custom-application-generate/references/utility-bar.md +55 -0
- package/skills/platform-custom-field-generate/SKILL.md +24 -16
- package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
- package/skills/platform-custom-setting-generate/SKILL.md +1 -0
- package/skills/platform-datamask-run/SKILL.md +1 -1
- package/skills/platform-datamask-run/references/policy-authoring.md +41 -18
- package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
- package/skills/platform-dsar-policy-manage/SKILL.md +7 -6
- package/skills/platform-dsar-policy-manage/references/export-and-history.md +10 -8
- package/skills/platform-dsar-policy-manage/references/report-format.md +4 -2
- package/skills/platform-flexipage-generate/SKILL.md +7 -10
- package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
- package/skills/platform-metadata-grounding-get/SKILL.md +7 -7
- package/skills/platform-policy-rule-generate/SKILL.md +9 -7
- package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
- package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
- package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
- package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
- package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
- package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
- package/skills/platform-report-generate/SKILL.md +29 -8
- package/skills/platform-report-generate/references/column-names.md +12 -1
- package/skills/platform-report-generate/references/errors-and-troubleshooting.md +1 -1
- package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
- package/skills/platform-report-generate/references/verification-checklist.md +12 -0
- package/skills/platform-sharing-rules-generate/SKILL.md +12 -3
- package/skills/platform-sharing-rules-generate/references/rule-types.md +1 -0
- package/skills/service-agentforce-channel-configure/SKILL.md +6 -3
- package/skills/service-agentforce-channel-configure/references/agent-wiring.md +5 -3
- package/skills/service-agentforce-channel-configure/references/channel-branch-email.md +24 -15
- package/skills/service-agentforce-channel-configure/references/input-validation.md +23 -0
- package/skills/service-agentforce-channel-configure/references/live-traffic-gate.md +13 -7
- package/skills/service-agentforce-channel-configure/references/queue-resolution.md +3 -1
- package/skills/service-agentforce-human-escalation-configure/references/_vendored/input-validation.md +23 -0
- package/skills/service-agentforce-human-escalation-configure/references/_vendored/queue-resolution.md +146 -0
- package/skills/service-agentforce-human-escalation-configure/references/escalation-mechanism.md +1 -1
- package/skills/service-agentforce-human-escalation-configure/scripts/tests/_bootstrap.py +42 -11
- package/skills/service-agentforce-human-escalation-configure/scripts/tests/test_escalation_contracts.py +45 -0
- package/skills/service-agentforce-human-escalation-configure/scripts/verify-and-configure.sh +23 -9
- package/skills/service-de-channel-activate/SKILL.md +10 -10
- package/skills/service-de-channel-activate/references/gotchas.md +4 -4
- package/skills/service-de-channel-activate/references/phone-verification.md +43 -19
- package/skills/service-de-channel-create/SKILL.md +1 -1
- package/skills/service-de-channel-create/references/facebook.md +1 -1
- package/skills/service-de-channel-create/references/whatsapp.md +33 -6
- package/skills/service-de-channel-routing-configure/SKILL.md +5 -1
- package/skills/service-de-channel-routing-configure/references/gotchas.md +3 -1
- package/skills/service-de-channel-routing-configure/references/named-queue.md +39 -0
- package/skills/service-de-channel-settings-configure/SKILL.md +3 -1
- package/skills/service-de-channel-settings-configure/references/channel-settings-facets.md +2 -2
- package/skills/service-de-channel-settings-configure/references/gotchas.md +12 -1
- package/skills/service-de-headless-channel-configure/SKILL.md +68 -74
- package/skills/service-de-headless-channel-configure/references/gotchas.md +6 -2
- package/skills/service-de-headless-channel-configure/references/inputs.md +19 -0
- package/skills/service-de-headless-channel-configure/references/output-envelopes.md +23 -1
- package/skills/service-de-headless-channel-configure/references/partial-success.md +1 -0
- package/skills/service-de-headless-channel-configure/references/requested-settings.md +55 -0
- package/skills/service-de-headless-channel-configure/references/worked-examples.md +35 -1
- package/skills/service-digital-engagement-channel-configure/SKILL.md +45 -108
- package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
- package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
- package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
- package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +17 -21
- package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
- package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
- package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
- package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
- package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
- package/skills/service-digital-engagement-deployment-configure/SKILL.md +2 -2
- package/skills/service-digital-engagement-deployment-configure/references/onboarding_contract.md +4 -2
- package/skills/service-digital-engagement-deployment-configure/scripts/check-api-version.sh +1 -1
- package/skills/service-e911-configure/SKILL.md +242 -0
- package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
- package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
- package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
- package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
- package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
- package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
- package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
- package/skills/service-omni-command-center-configure/SKILL.md +1 -1
- package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
- package/skills/data360-schema-get/SKILL.md +0 -388
- package/skills/data360-schema-get/references/README.md +0 -191
- package/skills/data360-schema-get/scripts/get_dlo_schema.py +0 -244
- package/skills/data360-schema-get/scripts/get_dmo_schema.py +0 -233
- package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
- package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
- package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
- package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
- package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
- package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
- package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
- package/skills/experience-content-media-image-generate/SKILL.md +0 -83
- package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
- package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
- package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
- package/skills/field-service-prework-brief-deployer-configure/SKILL.md +0 -646
- package/skills/field-service-voice-to-form-configure/SKILL.md +0 -650
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Tool and Prompt Discovery and Binding
|
|
2
|
+
|
|
3
|
+
Read this before Phase 4 discovery and binding. Use `<skill-dir>` and `<default-package>` as defined in [SKILL.md](../SKILL.md). On resume, read the sections needed to verify incomplete or changed state.
|
|
4
|
+
|
|
5
|
+
## Discovery (4a–4d)
|
|
6
|
+
|
|
7
|
+
Before binding assets, read the supported backings and availability patterns in [mcp-objects.md](mcp-objects.md). For a new setup or requested extension, complete and track the four discovery passes below separately and in order: site UI, local Apex/Flow, org Apex/Flow, and Prompt Builder. Record a short result and its supporting evidence for each pass before binding. When resuming, repeat only the passes needed to verify incomplete or changed state; reuse prior results only when they are still valid and intended bindings are confirmed. Org discovery is read-only and does not retrieve metadata into the project.
|
|
8
|
+
|
|
9
|
+
This skill discovers and builds tools backed by global Apex `@InvocableMethod` actions, eligible autolaunched Flows, and available Prompt Builder templates. It also binds active, published Flex templates as MCP prompts. Compose `aa:`, `fa:`, and `pr:` identifiers only after confirming availability.
|
|
10
|
+
|
|
11
|
+
### 4a. Front-end review
|
|
12
|
+
|
|
13
|
+
Run this pass first, before any Apex/Flow scan or org listing. Read [ui-frameworks.md](ui-frameworks.md) for ExperienceBundle and component scanning. Use the selected Phase 1 entry's `uiRoots`; rerun `list_sites.mjs` if source changed. If UI paths or referenced custom components are missing, follow Phase 1's stop-and-ask rule; do not skip UI review.
|
|
14
|
+
|
|
15
|
+
Read every site view/route and every referenced custom component, and trace each server call. Build an exhaustive **UI operation inventory**: one row per distinct CRUD operation the UI performs or exposes, including simple lists, searches, detail queries, and writes. For each row, record the view and component, observed server call, inputs, outputs, filters, and read/write behavior. Include every operation whether or not a backing action exists; do not judge coverage, look for backings, or drop rows in this pass. Exclude only navigation and presentation-only flows. Flag unresolved CRUD behavior rather than inventing it. If no operations are found, identify the inspected source supporting that conclusion.
|
|
16
|
+
|
|
17
|
+
### 4b. Local project scan
|
|
18
|
+
```bash
|
|
19
|
+
node "<skill-dir>/scripts/scan_tool_candidates.mjs"
|
|
20
|
+
```
|
|
21
|
+
Reports Apex `@InvocableMethod` actions whose containing class and method are `global`. Supported primitive `List` element types are eligible directly; custom request or result types and every exposed `@InvocableVariable` field must also be `global`. It also reports autolaunched Flows that have at least one input variable and at least one output variable. Those can be different `<variables>`. Eligible sources get a composable `apiIdentifier` (`aa:apex-<Class>`, `fa:flow-<Flow>`).
|
|
22
|
+
|
|
23
|
+
### 4c. Org action discovery
|
|
24
|
+
|
|
25
|
+
Run the read-only candidate listing:
|
|
26
|
+
```bash
|
|
27
|
+
node "<skill-dir>/scripts/retrieve_existing_tools.mjs" <target-org-alias>
|
|
28
|
+
```
|
|
29
|
+
The helper makes one REST list call for Apex actions and one for Flow actions, validates both response envelopes, and prints their runtime candidate records without writing files. The runtime catalog can include namespaced actions from installed packages; do not discard them solely because their source isn't locally retrievable.
|
|
30
|
+
|
|
31
|
+
Compare the candidate names with 4b and the server's existing `<tools>`. From the site purpose, the 4a inventory, and candidate labels and names, select a small set that plausibly helps this site's users. Do not describe every org action. For each plausible candidate, use its returned `url` for a read-only describe call:
|
|
32
|
+
```bash
|
|
33
|
+
sf api request rest "<candidate-url>" --target-org <target-org-alias> --method GET
|
|
34
|
+
```
|
|
35
|
+
Use the description plus input and output schemas to decide whether the action represents a coherent MCP tool and to propose an accurate title and description. For Flows, require an autolaunched action with both input and output parameters. For Apex found in local source, retain 4b's `global @InvocableMethod` check. For an org-only Apex action, report that the runtime catalog and describe response establish action availability but don't expose its source-level visibility; deployment remains the platform validation. If behavior annotations can't be determined from the descriptor, local implementation, or site behavior, ask the user rather than inventing them.
|
|
36
|
+
|
|
37
|
+
A non-zero exit means listing or response validation failed, not that the org has no candidates. Stop Phase 4, report the failure, and do not use partial output to conclude that a tool is absent. For an authentication failure, ask the user to reauthenticate the target org with `sf`, then rerun only after the failure is resolved.
|
|
38
|
+
|
|
39
|
+
**Reconcile and deduplicate.** Map every row of the 4a inventory to a backing, in this order: an existing server binding, a 4b local action, or a 4c org action. Merge rows that share one operation, and merge 4b/4c candidates that are the same action. IMPORTANT: Proactively suggest a tool for every inventory row, including simple lists, searches, detail queries, and writes; for each row with no matching backing, propose a new eligible backing action (Apex or Flow) using the row's observed inputs, outputs, filters, and behavior. Do not limit UI-derived suggestions to the strongest candidates, and do not drop a row because other tools already exist. Then add the strongest relevant unbound 4b/4c candidates that serve no inventory row, and explain why each fits.
|
|
40
|
+
|
|
41
|
+
Present the reconciled list once, showing each tool's source row or candidate and its backing (existing, local, org, or new), and ask add-or-skip for each unbound tool. Implement each approved tool with its real input, output, and behavior. Do not generate placeholder Apex classes.
|
|
42
|
+
|
|
43
|
+
Example: when the UI lists service requests, loads request details, and submits a new request, offer all three tools, reusing a matching action where one exists and proposing a new action for each one that doesn't.
|
|
44
|
+
|
|
45
|
+
### 4d. Prompt Builder discovery
|
|
46
|
+
|
|
47
|
+
Run the read-only listing:
|
|
48
|
+
```bash
|
|
49
|
+
node "<skill-dir>/scripts/retrieve_existing_prompts.mjs" <target-org-alias>
|
|
50
|
+
```
|
|
51
|
+
Compare candidate API names with existing `<prompts>` and `pr:` `<tools>` bindings. Inspect plausible template metadata and GET the returned action `url` when present to review its description and inputs. Offer confirmed active, published Flex templates as MCP prompts, runtime-available `pr:<template API name>` actions as tools, or both. Publication or runtime availability alone doesn't establish prompt eligibility. For inactive or unverified candidates, read [Prompt Builder eligibility](mcp-objects.md#prompt-builder-eligibility) before proposing a prompt binding. A non-zero exit means incomplete discovery, not absence; report it and continue the independent Apex/Flow and UI passes. Read [discovery troubleshooting](troubleshooting.md#tool-discovery-and-binding) before retrying.
|
|
52
|
+
|
|
53
|
+
## Author and bind (4e)
|
|
54
|
+
|
|
55
|
+
**Authoring new tools — invocable first.** Use global Apex `@InvocableMethod` for new custom logic, or an **autolaunched Flow** for declarative or admin-owned logic. Apply [Phase 4b's global visibility requirements](#4b-local-project-scan) to the Apex class, method, custom request/result types, and exposed fields.
|
|
56
|
+
|
|
57
|
+
**Custom Apex actions — validate inputs and enforce user access.** Load `platform-apex-generate` before authoring. Apply these requirements to each new action, each existing method newly exposed (including in-place edits; keep its signature and existing callers working), and any data-access helpers they call:
|
|
58
|
+
|
|
59
|
+
- Validate the request list and every request at runtime before queries, searches, DML, or other side effects. Reject null/empty lists, null items, missing required values, invalid IDs or IDs for the wrong sObject type, unsupported values, and values outside the operation's allowed lengths or ranges. Derive constraints from the actual operation and target schema; `@InvocableVariable(required=true)` and UI validation do not replace runtime checks. Validate all requests before starting a batch write.
|
|
60
|
+
- Use `global with sharing` for the entry class. Explicitly enforce user mode for every database operation: `WITH USER_MODE` for static SOQL/SOSL, `AccessLevel.USER_MODE` for dynamic query/search and `Database` DML methods, or `as user` for DML statements. Bind input values and allowlist dynamic object, field, and operator names. `with sharing` alone does not enforce CRUD/FLS; do not rely on API-version defaults.
|
|
61
|
+
- Return sanitized validation and access errors using the action's result contract, or a safe fault for an unrecoverable failure. Do not expose internal exception details or retry denied operations in system mode. Only use elevated access for an explicitly approved, justified requirement; isolate it in a narrowly scoped helper with an authorization check.
|
|
62
|
+
- Verify valid inputs, null/empty lists and items, invalid values and IDs, and denied record/object/field access. Check that invalid or unauthorized requests produce safe errors and no unauthorized writes.
|
|
63
|
+
|
|
64
|
+
For confirmed tools, write `apiIdentifier`, `toolTitle`, `descriptionOverride`, and all five behavior booleans (`destructive`, `idempotent`, `openWorld`, `readOnly`, `returnDirect`). Classify actual side effects from the implementation, authoritative descriptor, or confirmed behavior; never use names alone. Ask when behavior is unknown. `destructive` means any write, including indirect writes, not just deletion:
|
|
65
|
+
|
|
66
|
+
| Behavior | `readOnly` | `destructive` |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| Create, update, upsert, delete (for example insert a Case or change its status) | false | true |
|
|
69
|
+
| Read-only queries or text generation without side effects | true | false |
|
|
70
|
+
|
|
71
|
+
Creating a new record on every call is also `idempotent: false`. Determine prompt-backed annotations from the template and called actions; do not assume prompts are read-only. Leave `openWorld` and `returnDirect` false unless the backing calls outside the org or its result should return directly to the user. Prefer backing labels and descriptions, or write concise, accurate ones. `apiSource` defaults to `API_CATALOG`. For `aa:apex-`, `fa:flow-`, and `pr:` specs, the helper derives `operation` and `toolName`; set `toolName` if the exposed name should differ.
|
|
72
|
+
|
|
73
|
+
For confirmed MCP prompts, provide `promptName` (exposed name), `promptTemplateName` (exact template API name), `promptTitle`, and `descriptionOverride`. Group tools and prompts in a temporary JSON file:
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"prompts": [{"promptName": "revenue_cloud__updateQuoteLineItems", "promptTemplateName": "revenue_cloud__updateQuoteLineItems", "promptTitle": "Update Quote Line Items", "descriptionOverride": "Updates line items on an existing quote."}],
|
|
77
|
+
"tools": [{"apiIdentifier": "pr:revenue_cloud__activateOrderWorkflow", "toolName": "revenue_cloud_activateOrderWorkflow", "toolTitle": "Activate Order Workflow", "descriptionOverride": "Activates a Revenue Cloud order.", "destructive": true, "idempotent": false, "openWorld": false, "readOnly": false, "returnDirect": false}]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Always use `merge_tools.mjs`; never edit `<tools>` or `<prompts>` XML directly for Phase 4 binding.** The Phase 6 widget linkage exception allows only adding or reconciling top-level `<resources>` and a selected tool's `<uiResource>` after authoritative retrieval, as specified in [widget-resources.md](widget-resources.md). It does not permit editing API bindings, behavior annotations, prompts, or other tool fields by hand. Merge the specs into the rendered or retrieved component:
|
|
82
|
+
```bash
|
|
83
|
+
node "<skill-dir>/scripts/merge_tools.mjs" <default-package>/main/default/mcpServerDefinitions/<name>.mcpServerDefinition-meta.xml <tools.json>
|
|
84
|
+
```
|
|
85
|
+
`merge_tools.mjs` validates tool and prompt specs and rejects a tool missing any behavior boolean or containing an inconsistent `readOnly`/`destructive` pair. It de-duplicates tools by `apiIdentifier` and prompts by `promptName`, preserves an existing `uiResource` node when rebuilding an updated tool, preserves other server content, and writes canonical element order. Widget linkage keys are not accepted in the JSON spec; Phase 6 owns attachment. `--dry-run` prints without writing; `--skip-existing` preserves already-bound entries. Before changing an existing binding, show the diff, explain that active clients may be affected, and confirm the change. Review the JSON summary and resulting metadata, then remove the temporary JSON file.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Troubleshooting — experience-app-mcp-generate
|
|
2
|
+
|
|
3
|
+
Read only the section relevant to the failed phase. Apply Phase 0's disclosure rules to preflight diagnostics.
|
|
4
|
+
|
|
5
|
+
## Preflight
|
|
6
|
+
|
|
7
|
+
**`decision: skip` or `disabled` (exit 0):** `isAppMcpEnabled: false` or invocable-action `INVALID_INPUT` means this skill must not be used. `--skill-named` selects silent `skip` or `disabled` with a user message. Follow Phase 0.
|
|
8
|
+
|
|
9
|
+
**`decision: needs_input` (exit 0):** Show the safe message and corrective action, ask for a valid authenticated alias or org-supported `sourceApiVersion` of at least `68.0`, then rerun preflight. Do not edit existing project configuration without approval. These input errors are actionable even before gate enablement is known.
|
|
10
|
+
|
|
11
|
+
**`decision: error` (nonzero):** Show the returned message and corrective action; resolve the failure and rerun preflight. After gate success, errors are visible even for unnamed requests. Before success, other inconclusive failures route to silent `skip` unless explicitly named. Missing metadata types do not establish entitlement.
|
|
12
|
+
|
|
13
|
+
## ECA and deployment
|
|
14
|
+
|
|
15
|
+
**OAuth returns `invalid_scope`:** Confirm that the deployed ECA OAuth settings include `MCP`. Review the rendered metadata and targeted deployment result before changing or redeploying anything.
|
|
16
|
+
|
|
17
|
+
**A metadata property is invalid for the API version:** Keep the project `sourceApiVersion`, target-org support, and rendered metadata aligned. Review and confirm any version change before editing `sfdx-project.json`.
|
|
18
|
+
|
|
19
|
+
## Tool discovery and binding
|
|
20
|
+
|
|
21
|
+
**A bound tool is missing from the client:** Confirm that the global invocable Apex action or eligible autolaunched Flow exists in the org, that its `aa:` or `fa:` identifier is correct, and that the org's invocable-action MCP gate is enabled.
|
|
22
|
+
|
|
23
|
+
**A discovery pass returns no candidates:** An empty local scan means the scanned source tree has no eligible metadata. Empty Apex and Flow action arrays mean the authenticated user has no runtime candidates exposed by those endpoints. A non-zero exit means the REST listing failed or returned an invalid envelope, so do not treat it as an empty result. If a specific describe call fails, omit that candidate and report why it couldn't be evaluated; don't infer that other candidates are unavailable.
|
|
24
|
+
|
|
25
|
+
**Prompt discovery fails or returns no candidates:** `retrieve_existing_prompts.mjs` reads active templates through Connect REST and available prompt-template actions through the Actions API. A non-zero exit is an incomplete read, not proof of absence; check Prompt Builder enablement, the authenticated user's access, and the reported endpoint before retrying. A successful empty list means no candidates were exposed to that user.
|
|
26
|
+
|
|
27
|
+
**A bound prompt is missing from the client:** Check that the template is published and Flex, that `promptTemplateName` matches its API name, and that the client supports MCP prompts. For a `pr:` tool, confirm its prompt-template action is runtime-available and its identifier matches the template API name.
|
|
28
|
+
|
|
29
|
+
**The UI scan reports an already implemented capability:** Reuse the existing action or Flow instead of generating another implementation.
|
|
30
|
+
|
|
31
|
+
## Activation and client discovery
|
|
32
|
+
|
|
33
|
+
**The protected-resource document lacks `mcp_api`:** Confirm that `McpServerAccess.Active` is `true`, the ECA includes the `MCP` scope, and the deployed server name matches the resource URL. If all three are correct, allow for propagation and recheck.
|
|
34
|
+
|
|
35
|
+
**Activation reports a duplicate access row:** A duplicate proves only that the row exists. Re-query it and report success only when `Active=true`.
|
|
36
|
+
|
|
37
|
+
## Recovery and secrets
|
|
38
|
+
|
|
39
|
+
**A run failed after creating or changing state:** Report the exact files and records affected. Deactivate the server first, confirm no client uses it, then delete or revert only components created or changed by this run. Never delete reused state.
|
|
40
|
+
|
|
41
|
+
**A consumer secret was printed or written:** Treat it as compromised and have the user rotate it in Setup. Deleting the visible copy isn't sufficient remediation.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Aura Experience Site UI review
|
|
2
|
+
|
|
3
|
+
Read this reference during Phase 4a after selecting an entry with `status: "ready"`.
|
|
4
|
+
|
|
5
|
+
## Site source
|
|
6
|
+
|
|
7
|
+
Use the selected inventory entry's `uiRoots` and metadata evidence. Inspect its `experiences/<bundle>/routes` and `views` JSON files to identify rendered journeys and top-level component references.
|
|
8
|
+
|
|
9
|
+
The inventory identifies supported Aura view structure from `forceCommunity:` or `siteforce:` component references, or a view-referenced local Aura component. Legacy LWR view components in `community_builder:`, `community_layout:`, or `community_login:` are unsupported, as are DigitalExperienceBundle and UI-bundle source.
|
|
10
|
+
|
|
11
|
+
## Component and server-call tracing
|
|
12
|
+
|
|
13
|
+
Aura Experience Sites can use both LWC and Aura components.
|
|
14
|
+
|
|
15
|
+
Traverse standard layout and component nodes, including `forceCommunity:` and `siteforce:` references, through their regions and child components. Resolve referenced custom components from `lwc/` and `aura/` across the project's package directories, then follow their component composition, handlers, and data access. Skip unrelated components.
|
|
16
|
+
|
|
17
|
+
Review every UI flow, including initial data loading, searches, detail views, forms, and multi-step actions. In LWCs, inspect `@wire` adapters, reactive parameters, and imperative calls. In Aura components, follow markup event handlers, controllers, helpers, and server actions. Consult Salesforce documentation for unfamiliar adapters.
|
|
18
|
+
|
|
19
|
+
Trace every server operation and record its inputs, outputs, filters, and behavior in Phase 4a's UI operation inventory. Include simple data queries and writes without filtering by complexity.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# MCP Tool Widget Resources
|
|
2
|
+
|
|
3
|
+
Read this only for Phase 6, after the MCP stack and its backing actions have deployed successfully. Use `<skill-dir>` and `<default-package>` from `../SKILL.md`. Do not run it for an explicit preview/activate-only request on an existing named server; that bypass leaves metadata unchanged.
|
|
4
|
+
|
|
5
|
+
## 1. Eligible deployed tools
|
|
6
|
+
|
|
7
|
+
Build the eligible list from the final deployed `<tools>` bindings. Include only an `apiIdentifier` starting with `aa:apex-`. Report `fa:flow-` and `pr:` tools as skipped; `<prompts>` bindings are unaffected. Never route these through the agent-action coordinator.
|
|
8
|
+
|
|
9
|
+
Use the selected tool's real `apiDefinition` / `operation` as the invocable action API name, including its namespace. Do not substitute `toolName`, a label, a folder name, or an action guessed from the identifier. Confirm this deployed action is available through a read-only Actions REST describe; never execute the MCP tool or backing action to discover its shape. If a deployed operation cannot be resolved, stop rather than falling back to stale local source. If no tools are eligible, report that explicitly and proceed to Phase 7 without changing resources.
|
|
10
|
+
|
|
11
|
+
## 2. Generate artifacts and check the response bundle
|
|
12
|
+
|
|
13
|
+
For each eligible tool, load and invoke `platform-mcp-tool-widget-coordinate` with the target org alias, server DeveloperName, actual deployed action API name (`operation`), current SFDX project, and default package metadata directory. The coordinator owns payload discovery, exactly two object-based CLTs, leaf-skill generation of the response CLT, envelope CLT and HXL widget, the envelope's default renderer, and validation. Do not duplicate its leaf generation or author those artifacts from memory.
|
|
14
|
+
|
|
15
|
+
Capture all generated filenames and named gate results. Resolve the response CLT, envelope CLT, and widget names from their actual bundle directories, and verify the reported files exist in the current project's default package. Require widget self-validation and every coordinator hard gate to pass; invented-field failures also block. Record advisory omissions. Missing or ambiguous artifacts, a failed gate, or not-run validation blocks deployment; report partial files and stop. Existing renderer conflicts must be read and resolved with the user's consent before replacement, never overwritten automatically.
|
|
16
|
+
|
|
17
|
+
The coordinator generates artifacts and reports its existing validation results; this caller owns the additional response-bundle check and deployment checklist below. Do not require the coordinator to emit a `DEPLOYMENT HANDOFF` or run the caller's extra check. Generation order is not deployment order.
|
|
18
|
+
|
|
19
|
+
**Caller-owned check: `response-bundle-schema-only`.** Run this after the coordinator's gates pass and before any artifact deployment:
|
|
20
|
+
|
|
21
|
+
1. Resolve `<default-package>/main/default/lightningTypes/<RESPONSE_CLT_NAME>/` from the verified response artifact. Inspect the entire directory recursively, including pre-existing files, hidden entries, and surface subdirectories; print its relative file inventory. Do not limit the inspection to the coordinator's generated-file list.
|
|
22
|
+
2. Require the bundle's only file to be its valid `schema.json`, matching the response CLT that passed the coordinator's gates. Any renderer, editor, surface-specific configuration, or other custom artifact makes it unsuitable for this response-first deployment plan. Report `response-bundle-schema-only: fail` with the conflicting paths and stop before deployment. Obtain approval for a new response name or reconciliation, then regenerate and rerun the affected gates and this check. Never delete unknown files to make the check pass.
|
|
23
|
+
3. Report `response-bundle-schema-only: pass` with the inspected bundle path and complete inventory only after executing the check. Missing source, an unreadable directory, an uninspected entry, or a not-run check blocks deployment. Reuse an existing response bundle only when it passes both this check and the coordinator's compatibility gates.
|
|
24
|
+
|
|
25
|
+
## 3. Prepare and execute the deployment checklist
|
|
26
|
+
|
|
27
|
+
After all generation gates and the caller's response-bundle check pass, prepare the checklist using the exact source metadata member names from the verified bundle directories. Keep these member names separate from runtime CLT FQNs, which are confirmed independently for resource attachment in step 5. Confirm that the deployed backing action from Phase 5 remains the action described for generation.
|
|
28
|
+
|
|
29
|
+
For each eligible tool, use this dependency order:
|
|
30
|
+
|
|
31
|
+
1. Deploy the schema-only response CLT. The envelope's `outputValues` references this type.
|
|
32
|
+
2. Deploy the widget bundle. The envelope's default renderer references this widget.
|
|
33
|
+
3. Deploy the envelope CLT, including its default renderer, after both dependencies are deployed.
|
|
34
|
+
|
|
35
|
+
Prepare the following narrow commands with the verified component names and confirmed target org alias, show the complete checklist, and ask for deployment confirmation:
|
|
36
|
+
```bash
|
|
37
|
+
sf project deploy start --metadata LightningTypeBundle:<RESPONSE_CLT_NAME> --target-org <target-org-alias>
|
|
38
|
+
sf project deploy start --metadata UiWidgetBundle:<WIDGET_NAME> --target-org <target-org-alias>
|
|
39
|
+
sf project deploy start --metadata LightningTypeBundle:<ENVELOPE_CLT_NAME> --target-org <target-org-alias>
|
|
40
|
+
```
|
|
41
|
+
The coordinator does not deploy; this caller executes the approved checklist. Never deploy a whole `lightningTypes/`, `uiWidgets/`, package, or metadata-type directory. Require `Succeeded` and read-only confirmation that the named component exists before advancing. Stop on the first failure; do not retrieve or modify the MCP server. For multiple tools, repeat this dependency order for each tool. An existing component can satisfy a step only after read-only verification that its deployed content matches the validated artifact; local presence alone is insufficient. Attach resources and deploy the named MCP server only after all artifact dependencies are ready, as specified in steps 4–6.
|
|
42
|
+
|
|
43
|
+
## 4. Retrieve authoritative server
|
|
44
|
+
|
|
45
|
+
After all generated artifact groups deploy successfully, retrieve the authoritative server before attaching anything. Inspect the destination file first. When local edits exist, show the diff and ask for overwrite consent **before retrieval**; without consent stop, preserving those edits. Never retrieve first and ask afterward. Preserve the approved binding snapshot for comparison; it is not a stale file to redeploy.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
sf project retrieve start --metadata McpServerDefinition:<SERVER_DEV_NAME> --target-org <target-org-alias>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Confirm the destination is `<default-package>/main/default/mcpServerDefinitions/<SERVER_DEV_NAME>.mcpServerDefinition-meta.xml`. Verify every approved tool and prompt and their field values are intact. If a binding differs, stop and reconcile with the user; do not overwrite concurrent server changes using the old local copy.
|
|
52
|
+
|
|
53
|
+
## 5. Attach widget relationships
|
|
54
|
+
|
|
55
|
+
**Phase 6 widget linkage exception:** direct XML editing is permitted only for top-level `<resources>` and the selected existing tool's `<uiResource>` in this freshly retrieved component. Phase 4 API/tool/prompt bindings must still use `merge_tools.mjs`; its JSON keys do not accept widget links. Do not add a general XML parser or reconstruct the whole server.
|
|
56
|
+
|
|
57
|
+
1. Match the target tool using its existing `apiIdentifier`, `operation`, and `toolName`. If the match is ambiguous, ask before editing.
|
|
58
|
+
2. Use the generated envelope CLT FQN independently confirmed from project/package context and deployed metadata: `c__` for a local namespace-less bundle, or `<namespace>__` only when that generated bundle's runtime identity is confirmed. Never derive it from the action namespace or folder name. The generated local source references stay `c__` and `@widget/c/`, even in a namespace-bearing org; backing Apex references have their own namespace. An installed `pkg` action in a namespace-less project can use `@apexClassType/pkg__Outer$Inner` while the runtime resource URI remains `ui://widget/lightningType/c__Envelope`. Never point the resource at the response CLT.
|
|
59
|
+
3. Select a stable MCP-local resource name and human-readable title and description. Read existing resources and the tool's link first. Use idempotent reuse when the resource URI/title/description and selected tool link already match; leave them unchanged and do not duplicate them. If a name is taken by a different resource, the tool already links another resource, or existing metadata would need replacement, show the conflict and ask for explicit reuse, rename, or replacement approval. Do not delete a resource used by other tools or rename its consumers implicitly.
|
|
60
|
+
4. Add one top-level `<resources>` block, a sibling of `<tools>`, never nested in it. Its URI is precisely `ui://widget/lightningType/<EnvelopeCLT-FQN>`. Add exactly one `<uiResource>` in the selected tool whose value matches `resourceName` byte-for-byte, including case. XML-escape user-supplied values.
|
|
61
|
+
5. Preserve the root element, namespace, existing tools, prompts, resources, all field values, indentation, and surrounding field order. Only approved widget-linkage values may change; do not reorder or rebuild unrelated metadata.
|
|
62
|
+
|
|
63
|
+
PR-compatible structural example (preserve all existing tool fields):
|
|
64
|
+
```xml
|
|
65
|
+
<McpServerDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
66
|
+
<tools>
|
|
67
|
+
<!-- Existing apiDefinition, behavior, name and title stay intact. -->
|
|
68
|
+
<uiResource>hotelDetails</uiResource>
|
|
69
|
+
</tools>
|
|
70
|
+
<resources>
|
|
71
|
+
<resourceName>hotelDetails</resourceName>
|
|
72
|
+
<resourceUri>ui://widget/lightningType/c__hotelInfoResult</resourceUri>
|
|
73
|
+
<resourceTitle>Hotel details</resourceTitle>
|
|
74
|
+
<description>Displays the selected hotel's details.</description>
|
|
75
|
+
</resources>
|
|
76
|
+
</McpServerDefinition>
|
|
77
|
+
```
|
|
78
|
+
This is a linkage fragment, not a replacement server or a complete tool spec. Use the independently confirmed deployed envelope FQN in the URI; do not infer it from a namespaced action or blanket-substitute that runtime prefix into generated local source references.
|
|
79
|
+
|
|
80
|
+
## 6. Validate and deploy the server
|
|
81
|
+
|
|
82
|
+
Validate before writing to the org:
|
|
83
|
+
|
|
84
|
+
- XML is well-formed; the root `McpServerDefinition` element and namespace are unchanged.
|
|
85
|
+
- Resources are top-level siblings of tools; `resourceName`, `resourceUri`, `resourceTitle`, and `description` are non-empty; resource names are unique.
|
|
86
|
+
- Each intended URI exactly equals `ui://widget/lightningType/<EnvelopeCLT-FQN>` and resolves to the successfully deployed envelope CLT with its renderer.
|
|
87
|
+
- Each selected tool has exactly one intended `<uiResource>` matching an existing `resourceName` including capitalization; no link is outside its selected tool.
|
|
88
|
+
- Every approved binding and all unrelated tools, prompts, resources, and field values remain intact. Review the diff against the freshly retrieved authoritative file.
|
|
89
|
+
|
|
90
|
+
Name mismatches, unresolved FQNs, missing `lightningType` URI segments, nested resources, misplaced or duplicate links, and unapproved changes are blocking. Report the tool, resource name, final URI, generated files/FQNs, and individual validation results. Ask for MCP deployment confirmation, then deploy only the named server:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
sf project deploy start --metadata McpServerDefinition:<SERVER_DEV_NAME> --target-org <target-org-alias>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Stop on failure. Re-retrieve the same named component (apply the same prior overwrite-consent rule for any new local edits), and verify that every approved resource URI and tool relationship persisted and approved bindings remain intact **before activation**. A successful deploy alone is not relationship verification. For unchanged idempotent reuse, no redundant deploy is needed, but verify deployed relationships before Phase 7. Client-side widget rendering remains pending integration verification, not a claim this metadata read-back proves.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Activate a deployed MCP server by setting Tooling McpServerAccess.Active=true.
|
|
3
|
+
// Output the re-queried state so active=true signals successful activation.
|
|
4
|
+
//
|
|
5
|
+
// Usage: node activate_server.mjs <TARGET_ORG_ALIAS> <SERVER_DEVELOPER_NAME> [--confirm]
|
|
6
|
+
//
|
|
7
|
+
// default : resolve, query, and print the proposed action without writing.
|
|
8
|
+
// --confirm : perform that Tooling write.
|
|
9
|
+
//
|
|
10
|
+
// Output: a JSON object on stdout with the server state and plannedRequest.
|
|
11
|
+
// plannedRequest is the write preview when --confirm is omitted, and null after a write.
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import { execFileSync } from "node:child_process";
|
|
14
|
+
import { isValidDeveloperName } from "./utils/developer_name.mjs";
|
|
15
|
+
|
|
16
|
+
function fail(msg, code = 1) {
|
|
17
|
+
process.stderr.write(msg + "\n");
|
|
18
|
+
process.exit(code);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const positional = [];
|
|
22
|
+
let confirm = false;
|
|
23
|
+
for (const arg of process.argv.slice(2)) {
|
|
24
|
+
if (arg === "--confirm") {
|
|
25
|
+
confirm = true;
|
|
26
|
+
} else if (arg.startsWith("--")) {
|
|
27
|
+
fail(`ABORT: unknown option '${arg}' — the only option is --confirm, which performs the write. The default previews it.`);
|
|
28
|
+
} else {
|
|
29
|
+
positional.push(arg);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const [targetOrg, serverName, extra] = positional;
|
|
33
|
+
if (!targetOrg) fail("ABORT: target org alias required");
|
|
34
|
+
if (!serverName) fail("ABORT: McpServerDefinition DeveloperName required");
|
|
35
|
+
if (extra !== undefined) {
|
|
36
|
+
fail("ABORT: too many arguments — usage: activate_server.mjs <org> <ServerDevName> [--confirm]");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// SERVER_NAME is embedded in SOQL.
|
|
40
|
+
if (!isValidDeveloperName(serverName)) {
|
|
41
|
+
fail(
|
|
42
|
+
`ABORT: invalid DeveloperName '${serverName}' — letters/digits/single underscores, optional namespace__ prefix, start with a letter, <= 80 chars.`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const V = JSON.parse(fs.readFileSync("sfdx-project.json", "utf-8")).sourceApiVersion;
|
|
47
|
+
|
|
48
|
+
function sf(argv) {
|
|
49
|
+
return execFileSync("sf", argv, { encoding: "utf-8" });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let disp;
|
|
53
|
+
try {
|
|
54
|
+
disp = JSON.parse(sf(["org", "display", "--target-org", targetOrg, "--json"]));
|
|
55
|
+
} catch {
|
|
56
|
+
disp = null;
|
|
57
|
+
}
|
|
58
|
+
const instanceUrl = disp?.result?.instanceUrl ?? "";
|
|
59
|
+
if (!instanceUrl) fail(`ABORT: could not read org connection for ${targetOrg}`);
|
|
60
|
+
|
|
61
|
+
const toolingPath = `/services/data/v${V}/tooling`;
|
|
62
|
+
const toolingUrl = `${instanceUrl}${toolingPath}`;
|
|
63
|
+
|
|
64
|
+
function toolingQuery(soql) {
|
|
65
|
+
const encoded = encodeURIComponent(soql);
|
|
66
|
+
try {
|
|
67
|
+
return sf(["api", "request", "rest", `${toolingPath}/query?q=${encoded}`, "--target-org", targetOrg, "--method", "GET"]);
|
|
68
|
+
} catch {
|
|
69
|
+
fail("ABORT: authenticated Tooling query failed.");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// A malformed successful response must not fall through to a write.
|
|
74
|
+
function requireRecords(jsonText, label) {
|
|
75
|
+
let parsed;
|
|
76
|
+
try {
|
|
77
|
+
parsed = JSON.parse(jsonText);
|
|
78
|
+
} catch {
|
|
79
|
+
parsed = null;
|
|
80
|
+
}
|
|
81
|
+
if (!parsed || !Array.isArray(parsed.records)) {
|
|
82
|
+
fail(`ABORT: malformed ${label} query response (no .records array) — failing closed before any write.`);
|
|
83
|
+
}
|
|
84
|
+
return parsed;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let mcpId, accessId, active;
|
|
88
|
+
|
|
89
|
+
// Propagate query failures out before any write.
|
|
90
|
+
function readAccess() {
|
|
91
|
+
const json = toolingQuery(`SELECT Id,Active FROM McpServerAccess WHERE McpServerId='${mcpId}'`);
|
|
92
|
+
const parsed = requireRecords(json, "McpServerAccess");
|
|
93
|
+
accessId = parsed.records[0]?.Id ?? "";
|
|
94
|
+
active = String(parsed.records[0]?.Active ?? "");
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const mcpJson = requireRecords(
|
|
98
|
+
toolingQuery(`SELECT Id FROM McpServerDefinition WHERE DeveloperName='${serverName}'`),
|
|
99
|
+
"McpServerDefinition",
|
|
100
|
+
);
|
|
101
|
+
mcpId = mcpJson.records[0]?.Id ?? "";
|
|
102
|
+
if (!mcpId) {
|
|
103
|
+
fail(`ABORT: no McpServerDefinition named '${serverName}' — deploy the prepared metadata before activating.`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
readAccess();
|
|
107
|
+
|
|
108
|
+
function emit(action, activeVal, method = "", url = "", body = null) {
|
|
109
|
+
return JSON.stringify({
|
|
110
|
+
mcpServerId: mcpId,
|
|
111
|
+
accessId: accessId ?? "",
|
|
112
|
+
action,
|
|
113
|
+
active: activeVal === "true",
|
|
114
|
+
plannedRequest: method === "" ? null : { method, url, body },
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (accessId && active === "true") {
|
|
119
|
+
console.log(emit("already_active", "true"));
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!confirm) {
|
|
124
|
+
if (!accessId) {
|
|
125
|
+
const payload = { DeveloperName: serverName, MasterLabel: serverName, Active: true, McpServerId: mcpId };
|
|
126
|
+
console.log(emit("would_create", "false", "POST", `${toolingUrl}/sobjects/McpServerAccess`, payload));
|
|
127
|
+
} else {
|
|
128
|
+
console.log(
|
|
129
|
+
emit("would_activate", "false", "PATCH", `${toolingUrl}/sobjects/McpServerAccess/${accessId}`, { Active: true }),
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
process.exit(0);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function toolingWrite(method, urlPath, data) {
|
|
136
|
+
try {
|
|
137
|
+
sf(["api", "request", "rest", urlPath, "--target-org", targetOrg, "--method", method, "--body", JSON.stringify(data)]);
|
|
138
|
+
} catch {
|
|
139
|
+
fail(`ABORT: authenticated Tooling ${method} failed.`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let did = "";
|
|
144
|
+
if (!accessId) {
|
|
145
|
+
const payload = { DeveloperName: serverName, MasterLabel: serverName, Active: true, McpServerId: mcpId };
|
|
146
|
+
toolingWrite("POST", `${toolingPath}/sobjects/McpServerAccess`, payload);
|
|
147
|
+
readAccess();
|
|
148
|
+
did = "created";
|
|
149
|
+
if (!accessId) {
|
|
150
|
+
fail(`ABORT: no McpServerAccess row exists after the create attempt for '${serverName}'.`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (active !== "true") {
|
|
155
|
+
toolingWrite("PATCH", `${toolingPath}/sobjects/McpServerAccess/${accessId}`, { Active: true });
|
|
156
|
+
did = "activated";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
readAccess();
|
|
160
|
+
if (active !== "true") {
|
|
161
|
+
process.stderr.write(`ABORT: wrote access row but Active is still '${active}' — activation failed.\n`);
|
|
162
|
+
process.stderr.write(emit(did, active) + "\n");
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
console.log(emit(did, "true"));
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Read-only progress observations after preflight and target selection.
|
|
3
|
+
// Usage: node check_setup_progress.mjs <org> <server> <eca> [--site <bundle>]
|
|
4
|
+
// Exit 0: audit returned, not setup completion; 2: some reads failed; 1: invalid input.
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { execFileSync } from "node:child_process";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { isValidDeveloperName } from "./utils/developer_name.mjs";
|
|
10
|
+
|
|
11
|
+
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
+
const checks = [];
|
|
13
|
+
let readFailed = false;
|
|
14
|
+
|
|
15
|
+
function check(area, status, evidence, nextAction) {
|
|
16
|
+
checks.push({ area, status, evidence, nextAction });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function unknown(area, nextAction) {
|
|
20
|
+
readFailed = true;
|
|
21
|
+
check(area, "unknown", "Read failed or returned ambiguous/malformed data.", nextAction);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function sfJson(args) {
|
|
25
|
+
return JSON.parse(execFileSync("sf", args, {
|
|
26
|
+
encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30000,
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function localFiles(roots, folder, file) {
|
|
31
|
+
return roots.map((root) => path.join(root, folder, file))
|
|
32
|
+
.filter((candidate) => fs.lstatSync(candidate, { throwIfNoEntry: false }));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function localPresence(area, files, expectedCount, nextAction, ambiguous = false) {
|
|
36
|
+
try {
|
|
37
|
+
if (files.some((file) => {
|
|
38
|
+
const entry = fs.lstatSync(file);
|
|
39
|
+
return !entry.isFile() || entry.size === 0;
|
|
40
|
+
})) {
|
|
41
|
+
throw new Error("Not a non-empty file");
|
|
42
|
+
}
|
|
43
|
+
const status = ambiguous || files.length > expectedCount ? "unknown" : files.length === expectedCount ? "complete" : "incomplete";
|
|
44
|
+
if (status === "unknown") readFailed = true;
|
|
45
|
+
check(area, status, { files, scope: "File presence only; contents and intent are unverified." }, nextAction);
|
|
46
|
+
} catch {
|
|
47
|
+
unknown(area, nextAction);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function toolingQuery(apiVersion, org, query) {
|
|
52
|
+
const result = sfJson(["api", "request", "rest",
|
|
53
|
+
`/services/data/v${apiVersion}/tooling/query?q=${encodeURIComponent(query)}`,
|
|
54
|
+
"--target-org", org, "--method", "GET"]);
|
|
55
|
+
if (!Array.isArray(result?.records) || result.done !== true ||
|
|
56
|
+
!Number.isInteger(result.totalSize) || result.totalSize !== result.records.length) {
|
|
57
|
+
throw new Error("Incomplete query response");
|
|
58
|
+
}
|
|
59
|
+
return result.records;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function sitePresence(siteBundle) {
|
|
63
|
+
const nextAction = "Phase 1: confirm the selected site's bundle and source readiness; a site is not required for org-level server checks.";
|
|
64
|
+
if (!siteBundle) {
|
|
65
|
+
check("site.local", "unknown", "No site bundle supplied.", nextAction);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const result = JSON.parse(execFileSync(process.execPath, [path.join(scriptDir, "list_sites.mjs")], {
|
|
70
|
+
encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30000,
|
|
71
|
+
}));
|
|
72
|
+
if (!Array.isArray(result?.sites)) throw new Error("Invalid inventory");
|
|
73
|
+
const sites = result.sites.filter((site) => site.bundle === siteBundle);
|
|
74
|
+
if (sites.length > 1) throw new Error("Ambiguous site");
|
|
75
|
+
check("site.local", sites[0]?.status === "ready" ? "complete" : "incomplete",
|
|
76
|
+
{ bundle: siteBundle, status: sites[0]?.status ?? "not-found", scope: "Local source readiness only." }, nextAction);
|
|
77
|
+
} catch {
|
|
78
|
+
unknown("site.local", nextAction);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function ecaProgress(roots, apiVersion, org, ecaName) {
|
|
83
|
+
const components = [
|
|
84
|
+
["ExternalClientApplication", "externalClientApps", ".eca-meta.xml", ""],
|
|
85
|
+
["ExtlClntAppGlobalOauthSettings", "extlClntAppGlobalOauthSets", ".ecaGlblOauth-meta.xml", ""],
|
|
86
|
+
["ExtlClntAppOauthSettings", "extlClntAppOauthSettings", ".ecaOauth-meta.xml", ""],
|
|
87
|
+
["ExtlClntAppOauthConfigurablePolicies", "extlClntAppOauthPolicies", ".ecaOauthPlcy-meta.xml", ""],
|
|
88
|
+
["ExtlClntAppConfigurablePolicies", "extlClntAppPolicies", ".ecaPlcy-meta.xml", "_defaultPolicy"],
|
|
89
|
+
];
|
|
90
|
+
const localAction = "Phase 2: review and reuse compatible files, verifying differently named child ownership before creating components. Complete confirmed partial sets from templates; render only when no destinations exist.";
|
|
91
|
+
try {
|
|
92
|
+
const groups = components.map(([, folder, suffix, nameSuffix]) => localFiles(roots, folder, `${ecaName}${nameSuffix}${suffix}`));
|
|
93
|
+
localPresence("eca.local", groups.flat(), components.length, localAction, groups.some((files) => files.length > 1));
|
|
94
|
+
} catch {
|
|
95
|
+
unknown("eca.local", localAction);
|
|
96
|
+
}
|
|
97
|
+
for (const [type, , , nameSuffix] of components) {
|
|
98
|
+
const name = `${ecaName}${nameSuffix}`;
|
|
99
|
+
const nextAction = type === "ExternalClientApplication"
|
|
100
|
+
? "Phase 5: reuse the verified parent or deploy the approved parent file before its children."
|
|
101
|
+
: "Phases 2/5: verify child ownership and settings before reuse or deployment; preserve the verified parent and deploy only approved tracked child files. Reused apps can have differently named children.";
|
|
102
|
+
try {
|
|
103
|
+
const response = sfJson(["org", "list", "metadata", "--metadata-type", type,
|
|
104
|
+
"--target-org", org, "--api-version", apiVersion, "--json"]);
|
|
105
|
+
if (response.status !== 0 || !Array.isArray(response.result) ||
|
|
106
|
+
!response.result.every((record) => typeof record?.fullName === "string")) {
|
|
107
|
+
throw new Error("Invalid metadata listing");
|
|
108
|
+
}
|
|
109
|
+
const matches = response.result.filter((record) => record.fullName === name);
|
|
110
|
+
if (matches.length > 1) throw new Error("Ambiguous metadata");
|
|
111
|
+
if (!matches.length && (response.result.length >= 1000 ||
|
|
112
|
+
(type !== "ExternalClientApplication" && response.result.length > 0))) {
|
|
113
|
+
readFailed = true;
|
|
114
|
+
check(`eca.deployed.${type}`, "unknown",
|
|
115
|
+
{ fullName: name, listed: false, scope: "Other component names or listing limits prevent inferring absence; association requires verification." }, nextAction);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
check(`eca.deployed.${type}`, matches.length ? "complete" : "incomplete",
|
|
119
|
+
{ fullName: name, present: matches.length === 1, scope: "Bundled component name presence only; ownership and settings are unverified." }, nextAction);
|
|
120
|
+
} catch {
|
|
121
|
+
unknown(`eca.deployed.${type}`, nextAction);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function serverProgress(roots, apiVersion, org, serverName) {
|
|
127
|
+
const localAction = "Phases 3–4: reconcile and reuse existing local metadata, preserving bindings and resources; retrieve an existing deployed server with prior overwrite consent, and render only when no local or deployed definition exists.";
|
|
128
|
+
try {
|
|
129
|
+
localPresence("server.local", localFiles(roots, "mcpServerDefinitions", `${serverName}.mcpServerDefinition-meta.xml`), 1, localAction);
|
|
130
|
+
} catch {
|
|
131
|
+
unknown("server.local", localAction);
|
|
132
|
+
}
|
|
133
|
+
let server;
|
|
134
|
+
try {
|
|
135
|
+
const records = toolingQuery(apiVersion, org,
|
|
136
|
+
`SELECT Id,DeveloperName FROM McpServerDefinition WHERE DeveloperName='${serverName}'`);
|
|
137
|
+
if (records.length > 1 || records.some((record) => record?.DeveloperName !== serverName ||
|
|
138
|
+
!/^[a-zA-Z0-9]{15}(?:[a-zA-Z0-9]{3})?$/.test(record.Id))) throw new Error("Ambiguous server");
|
|
139
|
+
server = records[0];
|
|
140
|
+
check("server.deployed", server ? "complete" : "incomplete", { developerName: serverName, present: !!server },
|
|
141
|
+
"Phases 3–5: reuse compatible local work and deployed bindings; deploy only approved changes if needed.");
|
|
142
|
+
} catch {
|
|
143
|
+
unknown("server.deployed", "Resolve the named server lookup before dependent deployment or activation.");
|
|
144
|
+
}
|
|
145
|
+
if (!server) {
|
|
146
|
+
check("activation", "unknown", "No verified server ID; activation was not queried.", "Resolve server deployment before checking activation.");
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const tools = toolingQuery(apiVersion, org,
|
|
151
|
+
`SELECT ToolName,ToolTitle FROM McpServerToolDefinition WHERE McpServerId='${server.Id}'`);
|
|
152
|
+
if (!tools.every((tool) => typeof tool?.ToolName === "string" && tool.ToolName.trim())) throw new Error("Invalid tools");
|
|
153
|
+
check("tools.inventory", "complete", { names: tools.map((tool) => tool.ToolName), scope: "Observed tools only; expected bindings, prompts and resources are unverified." },
|
|
154
|
+
"Phase 4: compare the authoritative definition with prior approved selections, including prompts and field values; an empty tool list can be valid for a prompt-only server.");
|
|
155
|
+
} catch {
|
|
156
|
+
unknown("tools.inventory", "Resolve tool inventory reads before comparing intended bindings.");
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const access = toolingQuery(apiVersion, org, `SELECT Active FROM McpServerAccess WHERE McpServerId='${server.Id}'`);
|
|
160
|
+
if (access.length > 1 || access.some((record) => typeof record?.Active !== "boolean")) throw new Error("Invalid activation");
|
|
161
|
+
const active = access[0]?.Active === true;
|
|
162
|
+
check("activation", active ? "complete" : "incomplete", { active },
|
|
163
|
+
"Phase 7: preview and perform only authorized activation after all backing actions and widget dependencies are verified.");
|
|
164
|
+
} catch {
|
|
165
|
+
unknown("activation", "Resolve the activation read; do not infer active state or retry a write from an error.");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function main() {
|
|
170
|
+
const args = process.argv.slice(2);
|
|
171
|
+
if (args.length !== 3 && !(args.length === 5 && args[3] === "--site")) throw new Error("Invalid arguments.");
|
|
172
|
+
const [org, serverName, ecaName, , siteBundle] = args;
|
|
173
|
+
if (!org.trim() || org.startsWith("-") || !isValidDeveloperName(serverName) || serverName.length > 60 || serverName.length < 2 ||
|
|
174
|
+
!isValidDeveloperName(ecaName) || (siteBundle !== undefined && !siteBundle.trim())) {
|
|
175
|
+
throw new Error("Invalid target org or metadata name.");
|
|
176
|
+
}
|
|
177
|
+
const project = JSON.parse(fs.readFileSync("sfdx-project.json", "utf8"));
|
|
178
|
+
const roots = project.packageDirectories?.map((pkg) => {
|
|
179
|
+
if (typeof pkg.path !== "string" || !pkg.path.trim()) throw new Error("Invalid package path.");
|
|
180
|
+
return path.resolve(pkg.path, "main/default");
|
|
181
|
+
});
|
|
182
|
+
if (!roots?.length || typeof project.sourceApiVersion !== "string") throw new Error("Run preflight from the SFDX project root first.");
|
|
183
|
+
sitePresence(siteBundle);
|
|
184
|
+
ecaProgress(roots, project.sourceApiVersion, org, ecaName);
|
|
185
|
+
serverProgress(roots, project.sourceApiVersion, org, serverName);
|
|
186
|
+
console.log(JSON.stringify({
|
|
187
|
+
scope: { org, serverName, ecaName, siteBundle: siteBundle ?? null },
|
|
188
|
+
auditStatus: readFailed ? "partial" : "completed", setupStatus: "unverified",
|
|
189
|
+
statusMeaning: "Complete applies only to the stated observation, not the whole phase or setup. Exit 0 means the audit ran; preflight remains a prerequisite.",
|
|
190
|
+
checks,
|
|
191
|
+
pendingVerification: [
|
|
192
|
+
{ area: "intent", phase: 1, nextAction: "Recover the confirmed site, ECA/client callbacks, intended tools/prompts/widgets and prior approvals from conversation; ask only for unrecoverable decisions. Metadata does not prove user intent or authorization." },
|
|
193
|
+
{ area: "eca.settings", phase: 2, nextAction: "Run render_eca.mjs <metadata-dir> <eca-name> --check locally; rerun with confirmed Phase 2 inputs plus --check for unverifiedFields. Verify deployed settings and policy review separately; component presence does not prove compatibility." },
|
|
194
|
+
{ area: "bindings", phase: 4, nextAction: "Use references/mcp-objects.md and references/tool-bindings.md to verify all approved bindings and backing actions/templates in the authoritative server; never infer completeness from tool count or local files." },
|
|
195
|
+
{ area: "widgets", phase: 6, nextAction: "Use references/widget-resources.md to verify applicable response/widget/envelope dependencies and deployed links; rerun missing or stale gates. Report no eligible Apex tools explicitly when applicable." },
|
|
196
|
+
{ area: "clientAccess", phase: 7, nextAction: "Remind the admin to check end-user API, Apex/Flow, object, field, record and tool-specific permissions; do not audit or configure them. Verify OAuth protected-resource scopes, client discovery and widget rendering separately; keep client testing pending until confirmed." },
|
|
197
|
+
],
|
|
198
|
+
resumeRules: [
|
|
199
|
+
"Continue from the earliest unmet dependency, reusing verified local and deployed work. Failed reads mean unknown, never absence.",
|
|
200
|
+
"Inspect and preserve local edits before retrieval or writes. Never bypass renderer overwrite protection or replace live bindings with an empty template.",
|
|
201
|
+
"Retain prior explicit approvals only for the same target, files and actions. Use existing phase confirmation rules for uncovered writes.",
|
|
202
|
+
"The explicit Phase 7 preview/activate-only bypass still applies to requests limited to that operation.",
|
|
203
|
+
],
|
|
204
|
+
}, null, 2));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
main();
|
|
209
|
+
} catch {
|
|
210
|
+
console.error("ERROR: invalid arguments or unreadable project configuration. Run preflight first. Usage: check_setup_progress.mjs <org> <server> <eca> [--site <bundle>]");
|
|
211
|
+
process.exitCode = 1;
|
|
212
|
+
}
|