@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,211 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// List local Experience Sites with readiness and support status.
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
if (args.length > 1) {
|
|
8
|
+
console.error("Usage: list_sites.mjs [project-root]");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function entries(dir) {
|
|
13
|
+
return fs.existsSync(dir) ? fs.readdirSync(dir, { withFileTypes: true }) : [];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function* files(dir) {
|
|
17
|
+
for (const entry of entries(dir)) {
|
|
18
|
+
const full = path.join(dir, entry.name);
|
|
19
|
+
if (entry.isDirectory() && !["node_modules", "dist", "build"].includes(entry.name) && !entry.name.startsWith(".")) {
|
|
20
|
+
yield* files(full);
|
|
21
|
+
} else if (entry.isFile()) {
|
|
22
|
+
yield full;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function readJson(file) {
|
|
28
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function* componentNames(value) {
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
for (const child of value) yield* componentNames(child);
|
|
34
|
+
} else if (value && typeof value === "object") {
|
|
35
|
+
if (typeof value.componentName === "string") yield value.componentName;
|
|
36
|
+
for (const child of Object.values(value)) yield* componentNames(child);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function hasAuraComponents(names, roots) {
|
|
41
|
+
if (names.some((name) => /^(community_builder|community_layout|community_login):/.test(name))) return false;
|
|
42
|
+
return names.some((name) => /^(forceCommunity|siteforce):/.test(name) ||
|
|
43
|
+
(/^c:[a-zA-Z][a-zA-Z0-9_]*$/.test(name) && roots.some((root) => fs.existsSync(path.join(root, "aura", name.slice(2), `${name.slice(2)}.cmp`)))));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function tag(xml, name) {
|
|
47
|
+
return (xml.match(new RegExp(`<${name}>\\s*([^<]*?)\\s*</${name}>`))?.[1] ?? "")
|
|
48
|
+
.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"')
|
|
49
|
+
.replace(/'/g, "'").replace(/&/g, "&");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function matchesUrlPathPrefix(surface, network) {
|
|
53
|
+
return !!network.urlPathPrefix && surface.urlPathPrefixes.some((prefix) => prefix === network.urlPathPrefix || prefix.replace(/\/s\/?$/, "") === network.urlPathPrefix);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function matchesSiteBundleName(surface, network) {
|
|
57
|
+
// Use the same site-name-to-bundle derivation as Core and SF CLI.
|
|
58
|
+
let decodedName;
|
|
59
|
+
try {
|
|
60
|
+
decodedName = decodeURIComponent(network.name);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
if (error instanceof URIError) return false;
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
const name = decodedName
|
|
66
|
+
.replace(/[^a-zA-Z0-9]+/g, "_")
|
|
67
|
+
.replace(/_$/, "")
|
|
68
|
+
.replace(/^([0-9])/, "X$1");
|
|
69
|
+
return !!name && surface.bundle === `${name}1`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function assignNetworkBundles(links) {
|
|
73
|
+
for (const { network, surface } of links) {
|
|
74
|
+
const matches = links.filter((link) => link.surface === surface);
|
|
75
|
+
if (matches.length > 1) surface.reason = `Multiple Networks match bundle ${surface.bundle}: ${matches.map((link) => link.network.name).join(", ")}`;
|
|
76
|
+
network.bundle = surface.bundle;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function recordAmbiguity(network, surfaces) {
|
|
81
|
+
network.reason = `Ambiguous bundles for Network ${network.name}: ${surfaces.map((surface) => surface.bundle).join(", ")}`;
|
|
82
|
+
network.candidateSurfaces = surfaces;
|
|
83
|
+
for (const surface of surfaces) surface.reason = network.reason;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function mergeSourceConflicts(surfaces) {
|
|
87
|
+
const conflicts = new Set(surfaces.filter((site) => surfaces.some((other) => other.bundle === site.bundle && other.sourceFormat !== site.sourceFormat)).map((site) => site.bundle));
|
|
88
|
+
return surfaces.filter((site, index) => {
|
|
89
|
+
if (!conflicts.has(site.bundle)) return true;
|
|
90
|
+
const sources = surfaces.filter((other) => other.bundle === site.bundle);
|
|
91
|
+
if (index !== surfaces.indexOf(sources[0])) return false;
|
|
92
|
+
site.sourceFormat = null;
|
|
93
|
+
site.reason = `Conflicting source formats for bundle ${site.bundle}`;
|
|
94
|
+
for (const key of ["uiRoots", "entryFiles", "urlPathPrefixes", "evidence"]) site[key] = sources.flatMap((source) => source[key]);
|
|
95
|
+
return true;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function listSites(projectRoot) {
|
|
100
|
+
const project = readJson(path.join(projectRoot, "sfdx-project.json"));
|
|
101
|
+
if (!project.packageDirectories?.length || project.packageDirectories.some((pkg) => typeof pkg.path !== "string" || !pkg.path)) {
|
|
102
|
+
throw new Error("sfdx-project.json must contain packageDirectories with paths");
|
|
103
|
+
}
|
|
104
|
+
const roots = project.packageDirectories.map((pkg) => path.resolve(projectRoot, pkg.path, "main/default"));
|
|
105
|
+
const networks = [];
|
|
106
|
+
const configs = [];
|
|
107
|
+
let surfaces = [];
|
|
108
|
+
for (const root of roots) {
|
|
109
|
+
for (const file of files(path.join(root, "networks"))) {
|
|
110
|
+
if (!file.endsWith(".network-meta.xml")) continue;
|
|
111
|
+
const xml = fs.readFileSync(file, "utf8");
|
|
112
|
+
networks.push({ file, bundle: tag(xml, "picassoSite"), name: path.basename(file, ".network-meta.xml"), urlPathPrefix: tag(xml, "urlPathPrefix") });
|
|
113
|
+
}
|
|
114
|
+
for (const file of files(path.join(root, "digitalExperienceConfigs"))) {
|
|
115
|
+
if (!file.endsWith(".digitalExperienceConfig-meta.xml")) continue;
|
|
116
|
+
const xml = fs.readFileSync(file, "utf8");
|
|
117
|
+
configs.push({ file, sourceFormat: "digital-experience", bundle: tag(xml, "space").replace(/^site\//, ""), name: tag(xml, "label") || path.basename(file, ".digitalExperienceConfig-meta.xml"), urlPathPrefix: tag(xml, "urlPathPrefix") });
|
|
118
|
+
}
|
|
119
|
+
const experienceBundles = new Set(entries(path.join(root, "experiences")).flatMap((entry) => entry.isDirectory() ? [entry.name] : entry.name.endsWith(".site-meta.xml") ? [entry.name.slice(0, -14)] : []));
|
|
120
|
+
for (const bundle of experienceBundles) {
|
|
121
|
+
const dir = path.join(root, "experiences", bundle);
|
|
122
|
+
const metadataFile = `${dir}.site-meta.xml`;
|
|
123
|
+
const metadata = fs.existsSync(metadataFile) ? fs.readFileSync(metadataFile, "utf8") : "";
|
|
124
|
+
const entryFiles = [...files(path.join(dir, "routes")), ...files(path.join(dir, "views"))].filter((file) => file.endsWith(".json"));
|
|
125
|
+
const viewComponents = [];
|
|
126
|
+
let reason;
|
|
127
|
+
for (const file of entryFiles) {
|
|
128
|
+
try {
|
|
129
|
+
const definition = readJson(file);
|
|
130
|
+
if (file.includes(`${path.sep}views${path.sep}`)) viewComponents.push(...componentNames(definition));
|
|
131
|
+
} catch (error) {
|
|
132
|
+
reason = `Cannot read ExperienceBundle JSON in ${file}: ${error.message}`;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
surfaces.push({ name: tag(metadata, "label") || bundle, bundle, sourceFormat: "experience-bundle", auraComponents: hasAuraComponents(viewComponents, roots), uiRoots: [dir], entryFiles, urlPathPrefixes: [tag(metadata, "urlPathPrefix")].filter(Boolean), evidence: metadata ? [metadataFile] : [], ...(reason ? { reason } : {}) });
|
|
137
|
+
}
|
|
138
|
+
for (const entry of entries(path.join(root, "digitalExperiences/site"))) {
|
|
139
|
+
if (!entry.isDirectory()) continue;
|
|
140
|
+
const dir = path.join(root, "digitalExperiences/site", entry.name);
|
|
141
|
+
const siteFiles = [...files(path.join(dir, "sfdc_cms__site"))].filter((file) => path.basename(file) === "content.json");
|
|
142
|
+
surfaces.push({ name: entry.name, bundle: entry.name, sourceFormat: "digital-experience", uiRoots: [], entryFiles: [], urlPathPrefixes: [], evidence: siteFiles });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
surfaces = mergeSourceConflicts(surfaces);
|
|
146
|
+
for (const config of configs) {
|
|
147
|
+
const surface = surfaces.find((site) => config.bundle && site.bundle === config.bundle);
|
|
148
|
+
if (surface) {
|
|
149
|
+
if (surface.sourceFormat === "experience-bundle") {
|
|
150
|
+
surface.sourceFormat = null;
|
|
151
|
+
surface.reason = `Conflicting source formats for bundle ${surface.bundle}`;
|
|
152
|
+
}
|
|
153
|
+
if (surface.sourceFormat === "digital-experience") surface.name = config.name;
|
|
154
|
+
if (config.urlPathPrefix) surface.urlPathPrefixes.push(config.urlPathPrefix);
|
|
155
|
+
} else if (config.bundle) {
|
|
156
|
+
surfaces.push({ name: config.name, bundle: config.bundle, sourceFormat: config.sourceFormat, uiRoots: [], entryFiles: [], urlPathPrefixes: [config.urlPathPrefix].filter(Boolean), evidence: [] });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const directLinks = [];
|
|
160
|
+
for (const network of networks) {
|
|
161
|
+
if (network.bundle) continue;
|
|
162
|
+
const matches = surfaces.filter((surface) => surface.bundle &&
|
|
163
|
+
!networks.some((other) => other.bundle === surface.bundle) &&
|
|
164
|
+
(!network.urlPathPrefix || !surface.urlPathPrefixes.length || matchesUrlPathPrefix(surface, network)) && (
|
|
165
|
+
surface.bundle === network.name || surface.name === network.name ||
|
|
166
|
+
matchesUrlPathPrefix(surface, network)
|
|
167
|
+
));
|
|
168
|
+
if (matches.length > 1) recordAmbiguity(network, matches);
|
|
169
|
+
if (matches.length === 1) directLinks.push({ network, surface: matches[0] });
|
|
170
|
+
}
|
|
171
|
+
assignNetworkBundles(directLinks);
|
|
172
|
+
const inferredLinks = [];
|
|
173
|
+
for (const network of networks) {
|
|
174
|
+
if (network.bundle || network.reason) continue;
|
|
175
|
+
const matches = surfaces.filter((surface) => surface.bundle &&
|
|
176
|
+
!networks.some((other) => other.bundle === surface.bundle) &&
|
|
177
|
+
(!network.urlPathPrefix || !surface.urlPathPrefixes.length || matchesUrlPathPrefix(surface, network)) &&
|
|
178
|
+
matchesSiteBundleName(surface, network));
|
|
179
|
+
if (matches.length > 1) recordAmbiguity(network, matches);
|
|
180
|
+
if (matches.length === 1) inferredLinks.push({ network, surface: matches[0] });
|
|
181
|
+
}
|
|
182
|
+
assignNetworkBundles(inferredLinks);
|
|
183
|
+
const records = [...networks, ...configs];
|
|
184
|
+
for (const surface of surfaces) {
|
|
185
|
+
const links = records.filter((record) => (record.bundle && record.bundle === surface.bundle) || record.candidateSurfaces?.includes(surface));
|
|
186
|
+
surface.networkNames = networks.filter((record) => links.includes(record)).map((record) => record.name);
|
|
187
|
+
surface.urlPathPrefixes = [...new Set([...surface.urlPathPrefixes, ...links.map((record) => record.urlPathPrefix)].filter(Boolean))];
|
|
188
|
+
surface.evidence.push(...links.map((record) => record.file));
|
|
189
|
+
}
|
|
190
|
+
for (const record of records) {
|
|
191
|
+
if (record.candidateSurfaces?.length) continue;
|
|
192
|
+
if (surfaces.some((surface) => record.bundle && surface.bundle === record.bundle)) continue;
|
|
193
|
+
const links = record.bundle ? records.filter((other) => other.bundle === record.bundle) : [record];
|
|
194
|
+
surfaces.push({ name: record.name, bundle: record.bundle || null, sourceFormat: links.find((link) => link.sourceFormat)?.sourceFormat ?? null, networkNames: networks.filter((network) => links.includes(network)).map((network) => network.name), urlPathPrefixes: [...new Set(links.map((link) => link.urlPathPrefix).filter(Boolean))], uiRoots: [], entryFiles: [], evidence: links.map((link) => link.file), ...(record.reason ? { reason: record.reason } : {}) });
|
|
195
|
+
}
|
|
196
|
+
return { sites: surfaces.map((surface) => {
|
|
197
|
+
const { entryFiles, sourceFormat, auraComponents, ...site } = surface;
|
|
198
|
+
const supported = sourceFormat === "experience-bundle" && !!auraComponents;
|
|
199
|
+
const found = entryFiles.some((file) => file.includes(`${path.sep}views${path.sep}`));
|
|
200
|
+
const status = sourceFormat === null ? "metadata-incomplete" : sourceFormat !== "experience-bundle" ? "unsupported" : site.reason ? "metadata-incomplete" : !found ? "ui-not-found" : supported ? "ready" : "unsupported";
|
|
201
|
+
return { ...site, uiFileCount: entryFiles.length, status };
|
|
202
|
+
}).sort((a, b) => a.name.localeCompare(b.name)) };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
try {
|
|
206
|
+
const result = listSites(path.resolve(args[0] ?? process.cwd()));
|
|
207
|
+
console.log(JSON.stringify(result, null, 2));
|
|
208
|
+
} catch (error) {
|
|
209
|
+
console.error(`ERROR: ${error.message}`);
|
|
210
|
+
process.exitCode = 1;
|
|
211
|
+
}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Merge tools into McpServerDefinition metadata by apiIdentifier.
|
|
3
|
+
//
|
|
4
|
+
// Usage:
|
|
5
|
+
// node merge_tools.mjs <SERVER_META_XML> <TOOLS_JSON> [--dry-run] [--skip-existing]
|
|
6
|
+
//
|
|
7
|
+
// SERVER_META_XML is modified in place. TOOLS_JSON accepts one tool, an array,
|
|
8
|
+
// or { tools: [...], prompts: [...] }; use '-' for stdin. Each tool requires
|
|
9
|
+
// apiIdentifier and the five JSON booleans
|
|
10
|
+
// destructive, idempotent, openWorld, readOnly, and returnDirect. operation is also
|
|
11
|
+
// required unless derived from an aa:apex-, fa:flow-, or pr: identifier. apiSource
|
|
12
|
+
// defaults to API_CATALOG and toolName defaults to operation. Non-empty toolTitle
|
|
13
|
+
// and descriptionOverride values are required. Unknown fields are rejected.
|
|
14
|
+
//
|
|
15
|
+
// Existing uiResource links survive tool updates; widget linkage is not a JSON input.
|
|
16
|
+
// Existing tools, prompts, and resources are preserved. --dry-run prints without
|
|
17
|
+
// writing; --skip-existing preserves already-bound entries. stderr receives a
|
|
18
|
+
// JSON summary of tool and prompt changes.
|
|
19
|
+
//
|
|
20
|
+
// This is a minimal, dependency-free XML reader/writer scoped to the flat,
|
|
21
|
+
// single-namespace, non-mixed-content shape of Salesforce metadata XML — not a
|
|
22
|
+
// general-purpose parser.
|
|
23
|
+
import fs from "node:fs";
|
|
24
|
+
|
|
25
|
+
const DOC = `Merge tools into McpServerDefinition metadata by apiIdentifier.
|
|
26
|
+
|
|
27
|
+
Usage:
|
|
28
|
+
node merge_tools.mjs <SERVER_META_XML> <TOOLS_JSON> [--dry-run] [--skip-existing]
|
|
29
|
+
|
|
30
|
+
SERVER_META_XML is modified in place. TOOLS_JSON accepts one tool, an array,
|
|
31
|
+
or { tools: [...], prompts: [...] }; use '-' for stdin. Each tool requires
|
|
32
|
+
apiIdentifier and the five JSON booleans
|
|
33
|
+
destructive, idempotent, openWorld, readOnly, and returnDirect. operation is also
|
|
34
|
+
required unless derived from an aa:apex-, fa:flow-, or pr: identifier. apiSource
|
|
35
|
+
defaults to API_CATALOG and toolName defaults to operation. Non-empty toolTitle
|
|
36
|
+
and descriptionOverride values are required. Unknown fields are rejected.
|
|
37
|
+
|
|
38
|
+
Each prompt requires promptName, promptTemplateName, promptTitle, and
|
|
39
|
+
descriptionOverride. Existing tools, prompts, and resources are preserved.
|
|
40
|
+
--dry-run prints without writing; --skip-existing preserves already-bound
|
|
41
|
+
entries. stderr receives a JSON summary of tool and prompt changes.`;
|
|
42
|
+
|
|
43
|
+
const API_DEF_ORDER = ["apiIdentifier", "apiSource", "operation"];
|
|
44
|
+
const BOOL_FIELDS = ["destructive", "idempotent", "openWorld", "readOnly", "returnDirect"];
|
|
45
|
+
const REQUIRED_TEXT_FIELDS = ["descriptionOverride", "toolTitle"];
|
|
46
|
+
const LIVE_PREFIXES = ["aa:apex-", "fa:flow-", "pr:"];
|
|
47
|
+
const PROMPT_FIELDS = ["descriptionOverride", "promptName", "promptTemplateName", "promptTitle"];
|
|
48
|
+
const ALLOWED_KEYS = new Set([
|
|
49
|
+
"apiIdentifier",
|
|
50
|
+
"apiSource",
|
|
51
|
+
"operation",
|
|
52
|
+
"toolName",
|
|
53
|
+
"toolTitle",
|
|
54
|
+
"descriptionOverride",
|
|
55
|
+
...BOOL_FIELDS,
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
// --- minimal XML parser/serializer, scoped to Salesforce metadata XML shape ---
|
|
59
|
+
|
|
60
|
+
function decodeEntities(s) {
|
|
61
|
+
return s.replace(/&(amp|lt|gt|quot|apos);/g, (_, e) => ({ amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" }[e]));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function parseXml(text) {
|
|
65
|
+
let i = 0;
|
|
66
|
+
const n = text.length;
|
|
67
|
+
|
|
68
|
+
function skipWs() {
|
|
69
|
+
while (i < n && /\s/.test(text[i])) i++;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function parseElement() {
|
|
73
|
+
skipWs();
|
|
74
|
+
if (text[i] !== "<") throw new Error(`expected '<' at offset ${i}`);
|
|
75
|
+
i++;
|
|
76
|
+
const tagStart = i;
|
|
77
|
+
while (i < n && !/[\s>/]/.test(text[i])) i++;
|
|
78
|
+
const tag = text.slice(tagStart, i);
|
|
79
|
+
const attrs = {};
|
|
80
|
+
while (true) {
|
|
81
|
+
skipWs();
|
|
82
|
+
if (text[i] === "/" && text[i + 1] === ">") {
|
|
83
|
+
i += 2;
|
|
84
|
+
return { tag, attrs, children: [], text: null };
|
|
85
|
+
}
|
|
86
|
+
if (text[i] === ">") {
|
|
87
|
+
i++;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
const nameStart = i;
|
|
91
|
+
while (i < n && text[i] !== "=" && !/\s/.test(text[i])) i++;
|
|
92
|
+
const name = text.slice(nameStart, i);
|
|
93
|
+
skipWs();
|
|
94
|
+
if (text[i] === "=") {
|
|
95
|
+
i++;
|
|
96
|
+
skipWs();
|
|
97
|
+
const quote = text[i];
|
|
98
|
+
i++;
|
|
99
|
+
const valStart = i;
|
|
100
|
+
while (i < n && text[i] !== quote) i++;
|
|
101
|
+
attrs[name] = decodeEntities(text.slice(valStart, i));
|
|
102
|
+
i++;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const node = { tag, attrs, children: [], text: null };
|
|
106
|
+
let textBuf = "";
|
|
107
|
+
while (true) {
|
|
108
|
+
if (text.slice(i, i + 2) === "</") {
|
|
109
|
+
i += 2;
|
|
110
|
+
const closeStart = i;
|
|
111
|
+
while (i < n && text[i] !== ">") i++;
|
|
112
|
+
const closeTag = text.slice(closeStart, i);
|
|
113
|
+
i++;
|
|
114
|
+
if (closeTag !== tag) {
|
|
115
|
+
throw new Error(`mismatched close tag: expected </${tag}>, got </${closeTag}>`);
|
|
116
|
+
}
|
|
117
|
+
break;
|
|
118
|
+
} else if (text.slice(i, i + 4) === "<!--") {
|
|
119
|
+
const end = text.indexOf("-->", i);
|
|
120
|
+
i = end === -1 ? n : end + 3;
|
|
121
|
+
} else if (text[i] === "<") {
|
|
122
|
+
node.children.push(parseElement());
|
|
123
|
+
} else {
|
|
124
|
+
textBuf += text[i];
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (node.children.length === 0) {
|
|
129
|
+
const decoded = decodeEntities(textBuf).trim();
|
|
130
|
+
node.text = decoded.length ? decoded : textBuf.length ? "" : null;
|
|
131
|
+
}
|
|
132
|
+
return node;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
skipWs();
|
|
136
|
+
if (text.slice(i, i + 2) === "<?") {
|
|
137
|
+
const end = text.indexOf("?>", i);
|
|
138
|
+
i = end === -1 ? i : end + 2;
|
|
139
|
+
}
|
|
140
|
+
return parseElement();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function escapeText(s) {
|
|
144
|
+
return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function escapeAttr(s) {
|
|
148
|
+
return escapeText(s).replace(/"/g, """);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function serializeNode(node, depth) {
|
|
152
|
+
const indent = " ".repeat(depth);
|
|
153
|
+
const attrs = Object.entries(node.attrs || {})
|
|
154
|
+
.map(([k, v]) => ` ${k}="${escapeAttr(v)}"`)
|
|
155
|
+
.join("");
|
|
156
|
+
if (node.children && node.children.length) {
|
|
157
|
+
const inner = node.children.map((c) => serializeNode(c, depth + 1)).join("\n");
|
|
158
|
+
return `${indent}<${node.tag}${attrs}>\n${inner}\n${indent}</${node.tag}>`;
|
|
159
|
+
}
|
|
160
|
+
const text = node.text == null ? "" : escapeText(node.text);
|
|
161
|
+
return `${indent}<${node.tag}${attrs}>${text}</${node.tag}>`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function serialize(root) {
|
|
165
|
+
return '<?xml version="1.0" encoding="UTF-8"?>\n' + serializeNode(root, 0) + "\n";
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// --- tool-element model ---
|
|
169
|
+
|
|
170
|
+
function el(tag, { children, text } = {}) {
|
|
171
|
+
return { tag, attrs: {}, children: children ?? [], text: text ?? null };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function deriveOperation(ident) {
|
|
175
|
+
for (const p of LIVE_PREFIXES) {
|
|
176
|
+
if (ident.startsWith(p)) return ident.slice(p.length);
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function toolIdentifier(toolEl) {
|
|
182
|
+
const api = toolEl.children.find((c) => c.tag === "apiDefinition");
|
|
183
|
+
if (!api) return null;
|
|
184
|
+
const ident = api.children.find((c) => c.tag === "apiIdentifier");
|
|
185
|
+
return ident ? ident.text : null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function promptIdentifier(promptEl) {
|
|
189
|
+
return promptEl.children.find((c) => c.tag === "promptName")?.text ?? null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function buildPromptElement(spec) {
|
|
193
|
+
if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
|
|
194
|
+
throw new Error("each prompt spec must be a JSON object");
|
|
195
|
+
}
|
|
196
|
+
const unknown = Object.keys(spec).filter((k) => !PROMPT_FIELDS.includes(k));
|
|
197
|
+
if (unknown.length) throw new Error(`unknown prompt field(s) ${JSON.stringify(unknown.sort())}`);
|
|
198
|
+
for (const field of PROMPT_FIELDS) {
|
|
199
|
+
if (typeof spec[field] !== "string" || !spec[field].trim()) {
|
|
200
|
+
throw new Error(`'${field}' is required and must be a non-empty string`);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return el("prompts", {
|
|
204
|
+
children: PROMPT_FIELDS.map((field) => el(field, { text: spec[field].trim() })),
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function buildToolElement(spec) {
|
|
209
|
+
if (typeof spec !== "object" || spec === null || Array.isArray(spec)) {
|
|
210
|
+
throw new Error(
|
|
211
|
+
`each tool spec must be a JSON object, got ${spec === null ? "null" : Array.isArray(spec) ? "array" : typeof spec}`,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
const unknown = Object.keys(spec).filter((k) => !ALLOWED_KEYS.has(k));
|
|
215
|
+
if (unknown.length) {
|
|
216
|
+
throw new Error(`unknown tool field(s) ${JSON.stringify(unknown.sort())} — allowed: ${JSON.stringify([...ALLOWED_KEYS].sort())}`);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const ident = spec.apiIdentifier;
|
|
220
|
+
if (!ident || typeof ident !== "string") {
|
|
221
|
+
throw new Error(`tool spec missing valid string 'apiIdentifier': ${JSON.stringify(spec)}`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
let operation = spec.operation;
|
|
225
|
+
if (operation === undefined || operation === null) {
|
|
226
|
+
operation = deriveOperation(ident);
|
|
227
|
+
if (operation === null) {
|
|
228
|
+
throw new Error(
|
|
229
|
+
`'operation' is required for '${ident}' — only derivable for aa:apex-<X>/fa:flow-<X>/pr:<X> ids`,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (typeof operation !== "string" || !operation.trim()) {
|
|
234
|
+
throw new Error(`'operation' must be a non-empty string: ${JSON.stringify(operation)}`);
|
|
235
|
+
}
|
|
236
|
+
operation = operation.trim();
|
|
237
|
+
|
|
238
|
+
for (const name of REQUIRED_TEXT_FIELDS) {
|
|
239
|
+
const value = spec[name];
|
|
240
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
241
|
+
throw new Error(`'${name}' is required and must be a non-empty string`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
let toolName = spec.toolName ?? operation;
|
|
246
|
+
if (typeof toolName !== "string" || !toolName.trim()) {
|
|
247
|
+
throw new Error(`'toolName' must be a non-empty string: ${JSON.stringify(toolName)}`);
|
|
248
|
+
}
|
|
249
|
+
toolName = toolName.trim();
|
|
250
|
+
|
|
251
|
+
for (const name of BOOL_FIELDS) {
|
|
252
|
+
if (!(name in spec)) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`'${name}' is required — set all five behavior booleans explicitly (${BOOL_FIELDS.join(", ")}); don't blind-default them`,
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
if (typeof spec[name] !== "boolean") {
|
|
258
|
+
throw new Error(`'${name}' must be a JSON boolean (true/false), got ${typeof spec[name]}: ${JSON.stringify(spec[name])}`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (spec.readOnly === spec.destructive) {
|
|
263
|
+
throw new Error("writes (including create, update, upsert and delete) require readOnly: false and destructive: true; reads require readOnly: true and destructive: false");
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const apiDefValues = { apiIdentifier: ident, apiSource: spec.apiSource ?? "API_CATALOG", operation };
|
|
267
|
+
const apiDef = el("apiDefinition", { children: API_DEF_ORDER.map((name) => el(name, { text: apiDefValues[name] })) });
|
|
268
|
+
|
|
269
|
+
const children = [apiDef, el("descriptionOverride", { text: spec.descriptionOverride.trim() })];
|
|
270
|
+
for (const name of BOOL_FIELDS) children.push(el(name, { text: spec[name] ? "true" : "false" }));
|
|
271
|
+
children.push(el("toolName", { text: toolName }));
|
|
272
|
+
children.push(el("toolTitle", { text: spec.toolTitle.trim() }));
|
|
273
|
+
|
|
274
|
+
return el("tools", { children });
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function reorderRoot(root) {
|
|
278
|
+
root.children = [...root.children].sort((a, b) => (a.tag < b.tag ? -1 : a.tag > b.tag ? 1 : 0));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// --- main ---
|
|
282
|
+
|
|
283
|
+
function main() {
|
|
284
|
+
const positional = process.argv.slice(2).filter((a) => !a.startsWith("--"));
|
|
285
|
+
const flags = new Set(process.argv.slice(2).filter((a) => a.startsWith("--")));
|
|
286
|
+
const unknownFlags = [...flags].filter((f) => f !== "--dry-run" && f !== "--skip-existing");
|
|
287
|
+
if (unknownFlags.length) {
|
|
288
|
+
throw new Error(`unknown option(s) ${JSON.stringify(unknownFlags.sort())} — allowed: --dry-run, --skip-existing`);
|
|
289
|
+
}
|
|
290
|
+
if (positional.length !== 2) {
|
|
291
|
+
console.log(DOC);
|
|
292
|
+
process.exit(1);
|
|
293
|
+
}
|
|
294
|
+
const [xmlPath, toolsArg] = positional;
|
|
295
|
+
const dryRun = flags.has("--dry-run");
|
|
296
|
+
const skipExisting = flags.has("--skip-existing");
|
|
297
|
+
|
|
298
|
+
const raw = toolsArg === "-" ? fs.readFileSync(0, "utf-8") : fs.readFileSync(toolsArg, "utf-8");
|
|
299
|
+
const input = JSON.parse(raw);
|
|
300
|
+
let toolSpecs;
|
|
301
|
+
let promptSpecs;
|
|
302
|
+
if (Array.isArray(input)) {
|
|
303
|
+
toolSpecs = input;
|
|
304
|
+
promptSpecs = [];
|
|
305
|
+
} else if (input && typeof input === "object" && ("tools" in input || "prompts" in input)) {
|
|
306
|
+
const unknown = Object.keys(input).filter((k) => k !== "tools" && k !== "prompts");
|
|
307
|
+
if (unknown.length) throw new Error(`unknown binding group(s) ${JSON.stringify(unknown.sort())}`);
|
|
308
|
+
toolSpecs = input.tools ?? [];
|
|
309
|
+
promptSpecs = input.prompts ?? [];
|
|
310
|
+
if (!Array.isArray(toolSpecs) || !Array.isArray(promptSpecs)) {
|
|
311
|
+
throw new Error("'tools' and 'prompts' must be arrays");
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
toolSpecs = [input];
|
|
315
|
+
promptSpecs = [];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const xmlText = fs.readFileSync(xmlPath, "utf-8");
|
|
319
|
+
const root = parseXml(xmlText);
|
|
320
|
+
|
|
321
|
+
const summary = { added: [], updated: [], skipped: [], deduped_existing: [], total_tools: 0, prompts_added: [], prompts_updated: [], prompts_skipped: [], prompts_deduped_existing: [], total_prompts: 0 };
|
|
322
|
+
|
|
323
|
+
const existingTools = root.children.filter((c) => c.tag === "tools");
|
|
324
|
+
const existingPrompts = root.children.filter((c) => c.tag === "prompts");
|
|
325
|
+
root.children = root.children.filter((c) => c.tag !== "tools" && c.tag !== "prompts");
|
|
326
|
+
|
|
327
|
+
const byId = new Map();
|
|
328
|
+
const order = [];
|
|
329
|
+
for (const t of existingTools) {
|
|
330
|
+
const ident = toolIdentifier(t);
|
|
331
|
+
if (!ident) throw new Error("existing <tools> block is missing apiDefinition/apiIdentifier");
|
|
332
|
+
if (byId.has(ident)) summary.deduped_existing.push(ident);
|
|
333
|
+
else order.push(ident);
|
|
334
|
+
byId.set(ident, t);
|
|
335
|
+
}
|
|
336
|
+
const originalIds = new Set(byId.keys());
|
|
337
|
+
|
|
338
|
+
for (const spec of toolSpecs) {
|
|
339
|
+
const newEl = buildToolElement(spec);
|
|
340
|
+
const ident = spec.apiIdentifier;
|
|
341
|
+
if (originalIds.has(ident)) {
|
|
342
|
+
if (skipExisting) {
|
|
343
|
+
summary.skipped.push(ident);
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
summary.updated.push(ident);
|
|
347
|
+
} else if (byId.has(ident)) {
|
|
348
|
+
summary.updated.push(ident);
|
|
349
|
+
} else {
|
|
350
|
+
summary.added.push(ident);
|
|
351
|
+
order.push(ident);
|
|
352
|
+
}
|
|
353
|
+
// Rebuilding behavior fields must not detach a previously linked widget.
|
|
354
|
+
const uiResource = byId.get(ident)?.children.find((c) => c.tag === "uiResource");
|
|
355
|
+
if (uiResource) newEl.children.push(uiResource);
|
|
356
|
+
byId.set(ident, newEl);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
for (const ident of order) root.children.push(byId.get(ident));
|
|
360
|
+
|
|
361
|
+
const promptsByName = new Map();
|
|
362
|
+
const promptOrder = [];
|
|
363
|
+
for (const prompt of existingPrompts) {
|
|
364
|
+
const name = promptIdentifier(prompt);
|
|
365
|
+
if (!name) throw new Error("existing <prompts> block is missing promptName");
|
|
366
|
+
if (promptsByName.has(name)) summary.prompts_deduped_existing.push(name);
|
|
367
|
+
else promptOrder.push(name);
|
|
368
|
+
promptsByName.set(name, prompt);
|
|
369
|
+
}
|
|
370
|
+
const originalPromptNames = new Set(promptsByName.keys());
|
|
371
|
+
for (const spec of promptSpecs) {
|
|
372
|
+
const prompt = buildPromptElement(spec);
|
|
373
|
+
const name = spec.promptName.trim();
|
|
374
|
+
if (originalPromptNames.has(name)) {
|
|
375
|
+
if (skipExisting) {
|
|
376
|
+
summary.prompts_skipped.push(name);
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
summary.prompts_updated.push(name);
|
|
380
|
+
} else if (promptsByName.has(name)) {
|
|
381
|
+
summary.prompts_updated.push(name);
|
|
382
|
+
} else {
|
|
383
|
+
summary.prompts_added.push(name);
|
|
384
|
+
promptOrder.push(name);
|
|
385
|
+
}
|
|
386
|
+
promptsByName.set(name, prompt);
|
|
387
|
+
}
|
|
388
|
+
for (const name of promptOrder) root.children.push(promptsByName.get(name));
|
|
389
|
+
reorderRoot(root);
|
|
390
|
+
summary.total_tools = root.children.filter((c) => c.tag === "tools").length;
|
|
391
|
+
summary.total_prompts = root.children.filter((c) => c.tag === "prompts").length;
|
|
392
|
+
|
|
393
|
+
const output = serialize(root);
|
|
394
|
+
if (dryRun) {
|
|
395
|
+
process.stdout.write(output);
|
|
396
|
+
} else {
|
|
397
|
+
fs.writeFileSync(xmlPath, output, "utf-8");
|
|
398
|
+
}
|
|
399
|
+
process.stderr.write(JSON.stringify(summary) + "\n");
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
try {
|
|
403
|
+
main();
|
|
404
|
+
} catch (e) {
|
|
405
|
+
process.stderr.write(`ERROR: ${e.message}\n`);
|
|
406
|
+
process.exit(1);
|
|
407
|
+
}
|