@salesforce/afv-skills 1.67.0 → 1.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -5
- 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/SKILL.md +14 -22
- package/skills/agentforce-offline-experimentation-run/scripts/bt_compare.py +81 -0
- package/skills/agentforce-offline-experimentation-run/scripts/bt_fetch.py +358 -0
- package/skills/agentforce-offline-experimentation-run/scripts/bt_patch_agent.py +110 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/__init__.py +34 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentpatch.py +483 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/agentsrc.py +565 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/cache.py +95 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/compare.py +617 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/fetch.py +1012 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +140 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +93 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/patch.py +327 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/redact.py +40 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/results.py +288 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/scoring.py +340 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +354 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/splits.py +136 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/stdm.py +98 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/tokens.py +173 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/units.py +199 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/versions.py +194 -0
- package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +367 -379
- package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +23 -6
- package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +483 -796
- package/skills/commerce-react-storefront-create/SKILL.md +54 -21
- package/skills/dx-lifecycle-center/SKILL.md +22 -13
- package/skills/dx-lifecycle-center/examples/workflows.md +54 -17
- package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
- package/skills/dx-lifecycle-center/references/connect-org.md +62 -12
- 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-devhub-configure/SKILL.md +85 -84
- package/skills/dx-org-devhub-configure/examples/status-output.md +25 -2
- package/skills/dx-org-devhub-configure/scripts/devhub.sh +265 -140
- package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +100 -15
- 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 +88 -0
- package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +167 -0
- 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/dx-scratch-def-configure/SKILL.md +163 -0
- package/skills/dx-scratch-def-configure/examples/confirm-card.md +53 -0
- package/skills/dx-scratch-def-configure/examples/report-recipes.md +100 -0
- package/skills/dx-scratch-def-configure/references/features.json +3270 -0
- package/skills/dx-scratch-def-configure/references/project-scratch-def.schema.json +1841 -0
- package/skills/dx-scratch-def-configure/references/settings-map.json +682 -0
- package/skills/dx-scratch-def-configure/scripts/lib_scratch_def.py +1306 -0
- package/skills/dx-scratch-def-configure/scripts/requirements.txt +3 -0
- package/skills/dx-scratch-def-configure/scripts/scrape_config_values.py +848 -0
- package/skills/education-cloud-domain-configure/SKILL.md +1 -1
- package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/SKILL.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 +1 -1
- package/skills/experience-design-validate/SKILL.md +1 -1
- package/skills/experience-search-coordinate/SKILL.md +18 -12
- package/skills/experience-search-coordinate/references/content-route.md +79 -1
- package/skills/field-service-data-capture-migrate/SKILL.md +1 -1
- 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-apex-generate/SKILL.md +14 -11
- package/skills/platform-apex-test-generate/SKILL.md +2 -1
- 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 +52 -71
- package/skills/platform-datamask-run/references/api-surface.md +10 -4
- package/skills/platform-datamask-run/references/policy-authoring.md +56 -7
- package/skills/platform-datamask-run/references/run-and-abort.md +17 -10
- package/skills/platform-datamask-run/scripts/poll-job.sh +15 -25
- package/skills/platform-dataspace-access-configure/SKILL.md +43 -10
- 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-discovery-get/SKILL.md +185 -0
- package/skills/platform-metadata-discovery-get/references/api-map.md +25 -0
- package/skills/platform-metadata-discovery-get/references/h360-routes.md +30 -0
- package/skills/platform-metadata-discovery-get/references/scoped-soql.md +52 -0
- package/skills/platform-metadata-grounding-get/SKILL.md +170 -0
- package/skills/platform-policy-rule-generate/SKILL.md +85 -231
- package/skills/platform-policy-rule-generate/references/condition-model.md +47 -0
- package/skills/platform-policy-rule-generate/references/condition-templates.md +89 -0
- package/skills/platform-policy-rule-generate/references/conjunction-compiler.md +25 -0
- package/skills/platform-policy-rule-generate/references/conjunction-expression.md +30 -0
- package/skills/platform-policy-rule-generate/references/consumer-all.md +9 -0
- package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +99 -0
- package/skills/platform-policy-rule-generate/references/deploy-errors.md +24 -36
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitions/ExistsJoinRLS_Rule_1.policyRuleDefinition +91 -0
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitions/FieldReadDeny_Rule_1.policyRuleDefinition +72 -0
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitions/LastCharactersFieldMasking_Rule_1.policyRuleDefinition +77 -0
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitions/PrincipalFieldMatchRLS_Rule_1.policyRuleDefinition +77 -0
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/package.xml +12 -0
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +5 -0
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitions/TaggedObjectAccess_Rule_1.policyRuleDefinition +65 -0
- package/skills/platform-policy-rule-generate/references/headless-transport.md +87 -0
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +18 -11
- package/skills/platform-policy-rule-generate/references/policy-shapes.md +107 -0
- package/skills/platform-policy-rule-generate/references/principal-expression.md +31 -0
- package/skills/platform-policy-rule-generate/references/reference-resolution.md +51 -0
- package/skills/platform-policy-rule-generate/references/resource-expression.md +48 -0
- package/skills/platform-policy-rule-generate/references/runtime-context.md +9 -0
- package/skills/platform-policy-rule-generate/references/templates-access.md +11 -9
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +5 -3
- package/skills/platform-policy-rule-generate/references/templates-record.md +37 -22
- package/skills/platform-policy-rule-generate/references/templates-transform.md +10 -8
- package/skills/platform-policy-rule-generate/references/templates.md +2 -2
- package/skills/platform-policy-rule-generate/references/ui-compatibility.md +36 -18
- package/skills/platform-report-generate/SKILL.md +29 -5
- package/skills/platform-report-generate/references/chart-types.md +26 -2
- package/skills/platform-report-generate/references/column-names.md +43 -0
- 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 +22 -2
- package/skills/service-digital-engagement-channel-configure/SKILL.md +49 -110
- package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +35 -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 +128 -28
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
- 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-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/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
- 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
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Scan a source tree for MCP-tool-able backing types and report how each would
|
|
3
|
+
// bind (apiSource / apiIdentifier) and how it becomes available.
|
|
4
|
+
//
|
|
5
|
+
// Covers:
|
|
6
|
+
// - Apex @InvocableMethod (class, method, types, and fields global) -> aa:apex-<Class>
|
|
7
|
+
// - Autolaunched Flow (input AND output <variables>) -> fa:flow-<Flow>
|
|
8
|
+
// Usage: node scan_tool_candidates.mjs [SOURCE_ROOT]
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
|
|
12
|
+
function fail(msg) {
|
|
13
|
+
process.stderr.write(msg + "\n");
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const args = process.argv.slice(2);
|
|
18
|
+
if (args.length > 1) {
|
|
19
|
+
fail("Usage: scan_tool_candidates.mjs [source-root]");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let scanRoot = args[0] ?? process.cwd();
|
|
23
|
+
if (!fs.existsSync(scanRoot) || !fs.statSync(scanRoot).isDirectory()) {
|
|
24
|
+
process.stderr.write(`ERROR: source root does not exist: ${scanRoot}\n`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
scanRoot = fs.realpathSync(scanRoot);
|
|
28
|
+
|
|
29
|
+
function* walk(dir) {
|
|
30
|
+
let entries;
|
|
31
|
+
try {
|
|
32
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
33
|
+
} catch {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
for (const e of entries) {
|
|
37
|
+
const full = path.join(dir, e.name);
|
|
38
|
+
if (e.isDirectory()) {
|
|
39
|
+
yield* walk(full);
|
|
40
|
+
} else if (e.isFile()) {
|
|
41
|
+
yield full;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function stripComments(src) {
|
|
47
|
+
return src.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/\/\/[^\n]*/g, " ");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function annotationBodyEnd(rest) {
|
|
51
|
+
if (!/^\s*\(/.test(rest)) return 0;
|
|
52
|
+
let depth = 0;
|
|
53
|
+
let k = rest.indexOf("(");
|
|
54
|
+
for (; k < rest.length; k++) {
|
|
55
|
+
if (rest[k] === "(") depth++;
|
|
56
|
+
else if (rest[k] === ")") {
|
|
57
|
+
depth--;
|
|
58
|
+
if (depth === 0) return k + 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return rest.length;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const APEX_PRIMITIVE_TYPES = new Set([
|
|
65
|
+
"blob",
|
|
66
|
+
"boolean",
|
|
67
|
+
"date",
|
|
68
|
+
"datetime",
|
|
69
|
+
"decimal",
|
|
70
|
+
"double",
|
|
71
|
+
"id",
|
|
72
|
+
"integer",
|
|
73
|
+
"long",
|
|
74
|
+
"string",
|
|
75
|
+
"time",
|
|
76
|
+
]);
|
|
77
|
+
|
|
78
|
+
function globalClassBody(src, className) {
|
|
79
|
+
const header = new RegExp(
|
|
80
|
+
`global(?:\\s+(?:with|without|inherited)\\s+sharing)?\\s+class\\s+${className}\\b[^\\{]*\\{`,
|
|
81
|
+
).exec(src);
|
|
82
|
+
if (!header) return null;
|
|
83
|
+
|
|
84
|
+
const open = header.index + header[0].lastIndexOf("{");
|
|
85
|
+
let depth = 0;
|
|
86
|
+
for (let i = open; i < src.length; i++) {
|
|
87
|
+
if (src[i] === "{") depth++;
|
|
88
|
+
else if (src[i] === "}") {
|
|
89
|
+
depth--;
|
|
90
|
+
if (depth === 0) return src.slice(open + 1, i);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function hasOnlyGlobalInvocableFields(typeBody) {
|
|
97
|
+
const annotations = [...typeBody.matchAll(/@InvocableVariable\b/g)];
|
|
98
|
+
if (annotations.length === 0) return false;
|
|
99
|
+
return annotations.every((annotation) => {
|
|
100
|
+
const rest = typeBody.slice(annotation.index + annotation[0].length);
|
|
101
|
+
const declaration = rest.slice(annotationBodyEnd(rest));
|
|
102
|
+
return /^\s*global\b/.test(declaration);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function isSupportedListType(src, typeName) {
|
|
107
|
+
if (APEX_PRIMITIVE_TYPES.has(typeName.toLowerCase())) return true;
|
|
108
|
+
const typeBody = globalClassBody(src, typeName);
|
|
109
|
+
return typeBody !== null && hasOnlyGlobalInvocableFields(typeBody);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Eligibility matches the invocable contract the skill serves: the outer class
|
|
113
|
+
// and method must be global. Custom List types and all their exposed fields must
|
|
114
|
+
// also be global; supported Apex primitive List types need no wrapper class.
|
|
115
|
+
function invocableEligibility(src, className) {
|
|
116
|
+
const stripped = stripComments(src);
|
|
117
|
+
if (!stripped.includes("@InvocableMethod")) return null;
|
|
118
|
+
const globalClass = new RegExp(
|
|
119
|
+
`global(?:\\s+(?:with|without|inherited)\\s+sharing)?\\s+class\\s+${className}\\b`,
|
|
120
|
+
).test(stripped);
|
|
121
|
+
if (!globalClass) return "containing class must be global";
|
|
122
|
+
|
|
123
|
+
const re = /@InvocableMethod\b/g;
|
|
124
|
+
let found = false;
|
|
125
|
+
let m;
|
|
126
|
+
while ((m = re.exec(stripped)) !== null) {
|
|
127
|
+
found = true;
|
|
128
|
+
const rest = stripped.slice(m.index + m[0].length);
|
|
129
|
+
const decl = rest.slice(annotationBodyEnd(rest));
|
|
130
|
+
const sig = decl.split("(")[0];
|
|
131
|
+
const params = decl.slice(sig.length + 1);
|
|
132
|
+
if (!/\bglobal\b/.test(sig)) continue;
|
|
133
|
+
const resultMatch = sig.match(/List\s*<\s*([A-Za-z][A-Za-z0-9_]*)\s*>/);
|
|
134
|
+
const requestMatch = params.match(/List\s*<\s*([A-Za-z][A-Za-z0-9_]*)\s*>/);
|
|
135
|
+
if (!resultMatch || !requestMatch) {
|
|
136
|
+
return "global @InvocableMethod must take and return List types";
|
|
137
|
+
}
|
|
138
|
+
const typesOk = [requestMatch[1], resultMatch[1]].every((typeName) =>
|
|
139
|
+
isSupportedListType(stripped, typeName),
|
|
140
|
+
);
|
|
141
|
+
if (typesOk) return "";
|
|
142
|
+
return "custom request and result types and every @InvocableVariable field must be global";
|
|
143
|
+
}
|
|
144
|
+
return found ? "@InvocableMethod method must be global" : null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function flowVariableBlocks(src) {
|
|
148
|
+
return [...src.matchAll(/<variables\b[^>]*>[\s\S]*?<\/variables>/g)].map((match) =>
|
|
149
|
+
match[0].replace(/<description>[\s\S]*?<\/description>/g, ""),
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function variableFlag(blocks, flag) {
|
|
154
|
+
const re = new RegExp(`<${flag}>\\s*true\\s*</${flag}>`);
|
|
155
|
+
return blocks.some((block) => re.test(block));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
console.log("Candidate | Type | apiSource | apiIdentifier | Availability");
|
|
159
|
+
console.log("--------- | ---- | --------- | ------------- | ------------");
|
|
160
|
+
|
|
161
|
+
// --- Apex classes: full global invocable contract ---
|
|
162
|
+
for (const f of walk(scanRoot)) {
|
|
163
|
+
if (!f.endsWith(".cls")) continue;
|
|
164
|
+
const className = path.basename(f, ".cls");
|
|
165
|
+
const src = fs.readFileSync(f, "utf-8");
|
|
166
|
+
const reason = invocableEligibility(src, className);
|
|
167
|
+
if (reason === null) continue;
|
|
168
|
+
if (reason === "") {
|
|
169
|
+
console.log(`${className} | Apex @InvocableMethod | API_CATALOG | aa:apex-${className} | eligible (global)`);
|
|
170
|
+
} else {
|
|
171
|
+
console.log(`${className} | Apex @InvocableMethod | — | — | SKIP — ${reason}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// --- Flows: autolaunched only, and only with <variables> that are input and output ---
|
|
176
|
+
for (const f of walk(scanRoot)) {
|
|
177
|
+
if (!f.endsWith(".flow-meta.xml")) continue;
|
|
178
|
+
const flowName = path.basename(f, ".flow-meta.xml");
|
|
179
|
+
const src = fs.readFileSync(f, "utf-8");
|
|
180
|
+
if (!/<processType>\s*AutoLaunchedFlow\s*<\/processType>/.test(src)) {
|
|
181
|
+
console.log(`${flowName} | Flow (NOT autolaunched) | — | — | SKIP — only autolaunched flows are MCP-able`);
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const blocks = flowVariableBlocks(src);
|
|
185
|
+
if (variableFlag(blocks, "isInput") && variableFlag(blocks, "isOutput")) {
|
|
186
|
+
console.log(`${flowName} | Autolaunched Flow | API_CATALOG | fa:flow-${flowName} | eligible`);
|
|
187
|
+
} else {
|
|
188
|
+
console.log(`${flowName} | Autolaunched Flow | — | — | SKIP — needs both input and output variables`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
console.log();
|
|
193
|
+
console.log("Notes:");
|
|
194
|
+
console.log(" - This scan reports global invocable Apex actions with supported primitive or fully global custom types, plus autolaunched Flows with input and output variables.");
|
|
195
|
+
console.log(" - Confirm add-or-skip per candidate before adding its <tools> block.");
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const BLOCKED_SCHEMES = new Set(["javascript", "data", "file", "blob", "vbscript"]);
|
|
2
|
+
|
|
3
|
+
function loopbackHost(hostname) {
|
|
4
|
+
const host = hostname.replace(/^\[|\]$/g, "");
|
|
5
|
+
return host === "localhost" || host === "127.0.0.1" || host === "::1";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// OAuth redirect URIs are absolute. https is the normal case; http is only
|
|
9
|
+
// loopback; native clients may use a custom scheme with a host. Wildcards,
|
|
10
|
+
// fragments, and userinfo are not redirect URIs.
|
|
11
|
+
export function callbackRejection(raw) {
|
|
12
|
+
if (typeof raw !== "string" || !raw.trim()) return "callback URL is empty";
|
|
13
|
+
const value = raw.trim();
|
|
14
|
+
if (value.includes("*") || value.includes("#") || /\s/.test(value)) {
|
|
15
|
+
return "callback URL must be an absolute redirect URI without wildcards, fragments, or whitespace";
|
|
16
|
+
}
|
|
17
|
+
let url;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(value);
|
|
20
|
+
} catch {
|
|
21
|
+
return "callback URL must be an absolute URI";
|
|
22
|
+
}
|
|
23
|
+
if (url.username || url.password) return "callback URL must not include userinfo";
|
|
24
|
+
const scheme = url.protocol.slice(0, -1).toLowerCase();
|
|
25
|
+
if (BLOCKED_SCHEMES.has(scheme)) return `callback scheme '${scheme}' is not allowed`;
|
|
26
|
+
if (scheme === "https") {
|
|
27
|
+
return url.hostname ? "" : "https callback URL needs a host";
|
|
28
|
+
}
|
|
29
|
+
if (scheme === "http") {
|
|
30
|
+
return loopbackHost(url.hostname) ? "" : "http callbacks are limited to loopback hosts";
|
|
31
|
+
}
|
|
32
|
+
if (!/^[a-z][a-z0-9+.-]*$/.test(scheme) || !url.hostname) {
|
|
33
|
+
return "custom-scheme callbacks need a scheme and a host";
|
|
34
|
+
}
|
|
35
|
+
return "";
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// DeveloperName values are interpolated into SOQL and filenames.
|
|
2
|
+
// Allow one managed-package separator (ns__Name). Reject a second double
|
|
3
|
+
// underscore, a trailing underscore, and anything over 80 characters.
|
|
4
|
+
const DEVELOPER_NAME =
|
|
5
|
+
/^(?:[A-Za-z][A-Za-z0-9]{0,14}__)?[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/;
|
|
6
|
+
|
|
7
|
+
export function isValidDeveloperName(name) {
|
|
8
|
+
return typeof name === "string" && name.length > 0 && name.length <= 80 && DEVELOPER_NAME.test(name);
|
|
9
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { isValidDeveloperName } from "./developer_name.mjs";
|
|
4
|
+
|
|
5
|
+
const METADATA_NAMESPACE = "http://soap.sforce.com/2006/04/metadata";
|
|
6
|
+
|
|
7
|
+
function decode(text) {
|
|
8
|
+
if (/&(?!(?:amp|lt|gt|quot|apos|#\d+|#x[\da-fA-F]+);)/.test(text)) throw new Error("Invalid entity");
|
|
9
|
+
return text.replace(/&(amp|lt|gt|quot|apos|#\d+|#x[\da-fA-F]+);/g, (_, entity) => {
|
|
10
|
+
if (!entity.startsWith("#")) return { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" }[entity];
|
|
11
|
+
const point = entity.startsWith("#x") ? parseInt(entity.slice(2), 16) : Number(entity.slice(1));
|
|
12
|
+
if (![9, 10, 13].includes(point) && !(point >= 0x20 && point <= 0xD7FF) &&
|
|
13
|
+
!(point >= 0xE000 && point <= 0xFFFD) && !(point >= 0x10000 && point <= 0x10FFFF)) {
|
|
14
|
+
throw new Error("Invalid XML character");
|
|
15
|
+
}
|
|
16
|
+
return String.fromCodePoint(point);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ECA templates have a single metadata root and scalar child fields. Reject
|
|
21
|
+
// unsupported XML rather than guessing field values or resolving entities.
|
|
22
|
+
function fields(xml) {
|
|
23
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(xml)) throw new Error("Unsupported declarations");
|
|
24
|
+
if (/[\u0000-\u0008\u000B\u000C\u000E-\u001F\uFFFE\uFFFF]/.test(xml)) throw new Error("Invalid XML character");
|
|
25
|
+
let text = xml.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n").trim();
|
|
26
|
+
text = text.replace(/^<\?xml\s[^?]*\?>\s*/, "")
|
|
27
|
+
.replace(/<!\[CDATA\[[\s\S]*?\]\]>|<!--(?:[^-]|-(?!-))*-->/g,
|
|
28
|
+
(part) => part.startsWith("<!--") ? "" : part).trim();
|
|
29
|
+
const open = text.match(/^<([A-Za-z_][\w.-]*)([^<>]*?)(\/?)>/);
|
|
30
|
+
if (!open) throw new Error("Invalid root");
|
|
31
|
+
const attributes = new Map();
|
|
32
|
+
const attribute = /\s+([A-Za-z_][\w:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/y;
|
|
33
|
+
let offset = 0;
|
|
34
|
+
while (open[2].slice(offset).trim()) {
|
|
35
|
+
attribute.lastIndex = offset;
|
|
36
|
+
const match = attribute.exec(open[2]);
|
|
37
|
+
if (!match || attributes.has(match[1]) || !/^xmlns(?::[\w.-]+)?$/.test(match[1])) throw new Error("Unsupported root attributes");
|
|
38
|
+
attributes.set(match[1], decode(match[2] ?? match[3]));
|
|
39
|
+
offset = attribute.lastIndex;
|
|
40
|
+
}
|
|
41
|
+
if (attributes.get("xmlns") !== METADATA_NAMESPACE) throw new Error("Invalid namespace");
|
|
42
|
+
let body = text.slice(open[0].length);
|
|
43
|
+
if (open[3]) {
|
|
44
|
+
if (body.trim()) throw new Error("Trailing XML");
|
|
45
|
+
} else {
|
|
46
|
+
const close = body.slice(body.lastIndexOf("</")).match(/^<\/([A-Za-z_][\w.-]*)\s*>$/);
|
|
47
|
+
if (!close || close[1] !== open[1]) throw new Error("Invalid closing root");
|
|
48
|
+
body = body.slice(0, body.lastIndexOf("</"));
|
|
49
|
+
}
|
|
50
|
+
const result = new Map();
|
|
51
|
+
const field = /\s*<([A-Za-z_][\w.-]*)\s*(?:\/>|>([\s\S]*?)<\/\1\s*>)/y;
|
|
52
|
+
offset = 0;
|
|
53
|
+
while (body.slice(offset).trim()) {
|
|
54
|
+
field.lastIndex = offset;
|
|
55
|
+
const match = field.exec(body);
|
|
56
|
+
if (!match || result.has(match[1])) throw new Error("Invalid or duplicate field");
|
|
57
|
+
let value = "";
|
|
58
|
+
for (const part of (match[2] ?? "").split(/(<!\[CDATA\[[\s\S]*?\]\]>)/)) {
|
|
59
|
+
if (part.startsWith("<![CDATA[")) value += part.slice(9, -3);
|
|
60
|
+
else {
|
|
61
|
+
if (part.includes("<") || part.includes("]]>")) throw new Error("Invalid scalar field");
|
|
62
|
+
value += decode(part);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
result.set(match[1], value.trim());
|
|
66
|
+
offset = field.lastIndex;
|
|
67
|
+
}
|
|
68
|
+
return { root: open[1], values: result };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function componentFile(dest, baseline) {
|
|
72
|
+
if (!baseline.values.has("externalClientApplication")) return dest;
|
|
73
|
+
const folder = path.dirname(dest);
|
|
74
|
+
const suffix = path.basename(dest).match(/\.eca[A-Za-z]*-meta\.xml$/)?.[0];
|
|
75
|
+
if (!suffix) throw new Error("Unknown component suffix");
|
|
76
|
+
let names;
|
|
77
|
+
try {
|
|
78
|
+
names = fs.readdirSync(folder).filter((name) => name.endsWith(suffix));
|
|
79
|
+
} catch (error) {
|
|
80
|
+
if (error.code === "ENOENT") return dest;
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
const owned = [];
|
|
84
|
+
for (const name of names) {
|
|
85
|
+
const candidate = path.join(folder, name);
|
|
86
|
+
if (!fs.lstatSync(candidate).isFile()) throw new Error("Ambiguous component file");
|
|
87
|
+
const parsed = fields(fs.readFileSync(candidate, "utf8"));
|
|
88
|
+
if (parsed.root !== baseline.root) throw new Error("Wrong metadata type");
|
|
89
|
+
if (!isValidDeveloperName(parsed.values.get("externalClientApplication"))) {
|
|
90
|
+
const error = new Error("Unresolved parent reference");
|
|
91
|
+
error.file = candidate;
|
|
92
|
+
error.missingParent = !parsed.values.has("externalClientApplication");
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
if (parsed.values.get("externalClientApplication") === baseline.values.get("externalClientApplication")) owned.push(candidate);
|
|
96
|
+
}
|
|
97
|
+
if (owned.length > 1) throw new Error("Multiple associated components");
|
|
98
|
+
return owned[0] ?? dest;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function literalExpectedValues(templateFields, names) {
|
|
102
|
+
return Object.fromEntries(names.filter((name) => !/__ECA_[A-Z_]+__/.test(templateFields.get(name)))
|
|
103
|
+
.sort().map((name) => [name, templateFields.get(name)]));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function checkEcaPlan(plan) {
|
|
107
|
+
const files = plan.map(({ src, dest, template, expected }) => {
|
|
108
|
+
const report = { file: dest, template: src, status: "unknown", missingFields: [], differentFields: [], unverifiedFields: [], expectedValues: {} };
|
|
109
|
+
try {
|
|
110
|
+
const templateFields = fields(template).values;
|
|
111
|
+
const baseline = fields(expected);
|
|
112
|
+
report.file = componentFile(dest, baseline);
|
|
113
|
+
const entry = fs.lstatSync(report.file, { throwIfNoEntry: false });
|
|
114
|
+
if (!entry) {
|
|
115
|
+
report.status = "missing";
|
|
116
|
+
report.missingFields = [...baseline.values.keys()].sort();
|
|
117
|
+
report.expectedValues = literalExpectedValues(templateFields, report.missingFields);
|
|
118
|
+
return report;
|
|
119
|
+
}
|
|
120
|
+
if (!entry.isFile()) throw new Error("Not a regular file");
|
|
121
|
+
const actual = fields(fs.readFileSync(report.file, "utf8"));
|
|
122
|
+
if (actual.root !== baseline.root) throw new Error("Wrong metadata type");
|
|
123
|
+
for (const [name, value] of baseline.values) {
|
|
124
|
+
if (!actual.values.has(name)) report.missingFields.push(name);
|
|
125
|
+
else if (/__ECA_[A-Z_]+__/.test(value)) report.unverifiedFields.push(name);
|
|
126
|
+
else if (actual.values.get(name) !== value) report.differentFields.push(name);
|
|
127
|
+
}
|
|
128
|
+
for (const key of ["missingFields", "differentFields", "unverifiedFields"]) report[key].sort();
|
|
129
|
+
report.expectedValues = literalExpectedValues(templateFields, [...report.missingFields, ...report.differentFields]);
|
|
130
|
+
report.status = report.missingFields.length || report.differentFields.length
|
|
131
|
+
? "different" : report.unverifiedFields.length ? "unverified" : "match";
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (error.file) {
|
|
134
|
+
report.file = error.file;
|
|
135
|
+
report[error.missingParent ? "missingFields" : "unverifiedFields"] = ["externalClientApplication"];
|
|
136
|
+
}
|
|
137
|
+
report.reason = "Unreadable, malformed, duplicate-field, ambiguously associated, or unsupported scalar metadata XML; no absence or repair is inferred.";
|
|
138
|
+
}
|
|
139
|
+
return report;
|
|
140
|
+
});
|
|
141
|
+
const statuses = files.map((file) => file.status);
|
|
142
|
+
const comparisonStatus = statuses.includes("unknown") ? "unknown"
|
|
143
|
+
: statuses.some((status) => status === "different" || status === "missing") ? "different"
|
|
144
|
+
: statuses.includes("unverified") ? "unverified" : "match";
|
|
145
|
+
return {
|
|
146
|
+
comparisonStatus, files,
|
|
147
|
+
scope: "Read-only comparison of template-defined scalar ECA fields, not deployment or access validation. expectedValues contains literal template values for missing or different fields; actual and input-derived values are omitted.",
|
|
148
|
+
nextActions: [
|
|
149
|
+
"Review missing files/fields and differentFields using expectedValues and confirmed inputs; expected values are template baselines, not platform defaults or authorization to write.",
|
|
150
|
+
"For unverifiedFields, recover confirmed label, description, contact and callbacks; rerun the normal render command with the same inputs plus --check. Never infer approval from existing values.",
|
|
151
|
+
"Compare only template-defined fields and leave other fields unchanged. Preserve intentional overrides; use references/eca-fields.md for ownership and editing invariants, show the diff and follow Phase 2 confirmation rules before changes.",
|
|
152
|
+
"For missing files, use the named template and confirmed renderer inputs to create only that component. Never delete existing files or bypass overwrite protection to rerender a partial set.",
|
|
153
|
+
"Resolve unknown files before repair. Exit 0 means comparison ran, not that all fields match or policies were reviewed; `comparisonStatus: unknown` means some files could not be checked.",
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
// Check the nearest existing destination parent before any planned writes.
|
|
5
|
+
export function requireProjectDestination(projectRoot, destination) {
|
|
6
|
+
let parent = path.dirname(destination);
|
|
7
|
+
while (!fs.lstatSync(parent, { throwIfNoEntry: false })) parent = path.dirname(parent);
|
|
8
|
+
const actualRoot = fs.realpathSync(projectRoot);
|
|
9
|
+
const actualParent = fs.realpathSync(parent);
|
|
10
|
+
if (actualParent !== actualRoot && !actualParent.startsWith(actualRoot + path.sep)) {
|
|
11
|
+
throw new Error("ABORT: metadata destination resolves outside the project root");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Read the deployed MCP server, bound tools, and activation state. Read-only.
|
|
3
|
+
//
|
|
4
|
+
// Usage: node verify_server.mjs <TARGET_ORG_ALIAS> <SERVER_DEVELOPER_NAME> [--json]
|
|
5
|
+
//
|
|
6
|
+
// --json : emit one JSON object instead of the human-readable table.
|
|
7
|
+
//
|
|
8
|
+
// Exit: 0 when verification ran; read `status` (ready | not_found | inactive | no_tools)
|
|
9
|
+
// and `ready`. 1 on connection, query, or argument error.
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import { execFileSync } from "node:child_process";
|
|
12
|
+
import { isValidDeveloperName } from "./utils/developer_name.mjs";
|
|
13
|
+
|
|
14
|
+
function fail(msg, code = 1) {
|
|
15
|
+
process.stderr.write(msg + "\n");
|
|
16
|
+
process.exit(code);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const [targetOrg, serverName, opt, extra] = process.argv.slice(2);
|
|
20
|
+
if (!targetOrg) fail("ABORT: target org alias required");
|
|
21
|
+
if (!serverName) fail("ABORT: McpServerDefinition DeveloperName required");
|
|
22
|
+
if (extra !== undefined) {
|
|
23
|
+
fail("ABORT: too many arguments — usage: verify_server.mjs <org> <ServerDevName> [--json]");
|
|
24
|
+
}
|
|
25
|
+
let asJson = false;
|
|
26
|
+
if (opt !== undefined) {
|
|
27
|
+
if (opt === "--json") asJson = true;
|
|
28
|
+
else fail(`ABORT: unknown option '${opt}' — the only supported option is --json.`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// SERVER_NAME is embedded in SOQL.
|
|
32
|
+
if (!isValidDeveloperName(serverName)) {
|
|
33
|
+
fail(
|
|
34
|
+
`ABORT: invalid DeveloperName '${serverName}' — letters/digits/single underscores, optional namespace__ prefix, start with a letter, <= 80 chars.`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const V = JSON.parse(fs.readFileSync("sfdx-project.json", "utf-8")).sourceApiVersion;
|
|
39
|
+
const toolingPath = `/services/data/v${V}/tooling`;
|
|
40
|
+
|
|
41
|
+
function toolingQuery(soql) {
|
|
42
|
+
const encoded = encodeURIComponent(soql);
|
|
43
|
+
try {
|
|
44
|
+
return execFileSync(
|
|
45
|
+
"sf",
|
|
46
|
+
["api", "request", "rest", `${toolingPath}/query?q=${encoded}`, "--target-org", targetOrg, "--method", "GET"],
|
|
47
|
+
{ encoding: "utf-8" },
|
|
48
|
+
);
|
|
49
|
+
} catch {
|
|
50
|
+
fail("ABORT: authenticated Tooling query failed.");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Fail on a malformed 200 rather than misreport an empty tree.
|
|
55
|
+
function requireRecords(jsonText, label) {
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = JSON.parse(jsonText);
|
|
59
|
+
} catch {
|
|
60
|
+
parsed = null;
|
|
61
|
+
}
|
|
62
|
+
if (!parsed || !Array.isArray(parsed.records)) {
|
|
63
|
+
fail(`ABORT: malformed ${label} query response (no .records array).`);
|
|
64
|
+
}
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const mcpJson = requireRecords(
|
|
69
|
+
toolingQuery(`SELECT Id,DeveloperName,MasterLabel FROM McpServerDefinition WHERE DeveloperName='${serverName}'`),
|
|
70
|
+
"McpServerDefinition",
|
|
71
|
+
);
|
|
72
|
+
const mcpId = mcpJson.records[0]?.Id ?? "";
|
|
73
|
+
if (!mcpId) {
|
|
74
|
+
if (asJson) {
|
|
75
|
+
console.log(JSON.stringify({ status: "not_found", ready: false, developerName: serverName }));
|
|
76
|
+
} else {
|
|
77
|
+
console.log(`NOT FOUND: no McpServerDefinition named '${serverName}' in ${targetOrg}.`);
|
|
78
|
+
}
|
|
79
|
+
process.exit(0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const toolsJson = requireRecords(
|
|
83
|
+
toolingQuery(`SELECT ToolName,ToolTitle FROM McpServerToolDefinition WHERE McpServerId='${mcpId}'`),
|
|
84
|
+
"McpServerToolDefinition",
|
|
85
|
+
);
|
|
86
|
+
const accessJson = requireRecords(
|
|
87
|
+
toolingQuery(`SELECT Active FROM McpServerAccess WHERE McpServerId='${mcpId}'`),
|
|
88
|
+
"McpServerAccess",
|
|
89
|
+
);
|
|
90
|
+
const toolCount = toolsJson.records.length;
|
|
91
|
+
const active = String(accessJson.records[0]?.Active ?? "false");
|
|
92
|
+
const status = active !== "true" ? "inactive" : toolCount === 0 ? "no_tools" : "ready";
|
|
93
|
+
|
|
94
|
+
if (asJson) {
|
|
95
|
+
console.log(
|
|
96
|
+
JSON.stringify({
|
|
97
|
+
status,
|
|
98
|
+
ready: status === "ready",
|
|
99
|
+
mcpServerId: mcpId,
|
|
100
|
+
developerName: serverName,
|
|
101
|
+
active: active === "true",
|
|
102
|
+
toolCount,
|
|
103
|
+
tools: toolsJson.records.map((r) => ({ toolName: r.ToolName, toolTitle: r.ToolTitle })),
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
} else {
|
|
107
|
+
console.log(`McpServerDefinition : ${serverName} (${mcpId})`);
|
|
108
|
+
console.log(`McpServerAccess.Active : ${active}`);
|
|
109
|
+
console.log(`Bound tools (${toolCount}):`);
|
|
110
|
+
for (const r of toolsJson.records) {
|
|
111
|
+
console.log(` - ${r.ToolName} [${r.ToolTitle ?? "-"}]`);
|
|
112
|
+
}
|
|
113
|
+
if (toolCount === 0) console.log(" (none — deploy created no tool rows)");
|
|
114
|
+
console.log(`Status : ${status}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Readiness (exists + active + at least one tool) is reported via `status`, not the exit code.
|
|
118
|
+
process.exit(0);
|
|
@@ -431,7 +431,7 @@ Full anti-pattern table (violation / rationalization / correct action) → `refe
|
|
|
431
431
|
|
|
432
432
|
- Folder name, `<masterLabel>`, and the bundle's `title` should be consistent (PascalCase folder, human-readable label and title).
|
|
433
433
|
- Avoid `lightning__fileType` and `lightning__contentReferenceType` — currently unsupported.
|
|
434
|
-
- Eval datasets live in `
|
|
434
|
+
- Eval datasets live in `eval/experience-cms-content-type-generate/`, not in `tests/evals/`.
|
|
435
435
|
|
|
436
436
|
## Reference file index
|
|
437
437
|
|
|
@@ -3,7 +3,7 @@ name: experience-design-validate
|
|
|
3
3
|
description: "Use this skill to run a visual-craft audit of a rendered UI and produce an evidence-grounded Craft Report across Useful, Usable, Reliable, Coherent, and Well-Crafted. Invoke it for craft audits, visual critiques, design comparisons, felt-quality reviews, or visual-craft readiness checks on screenshots (.png, .jpg, .jpeg, .webp, .gif), Figma frames, rendered prototypes, and live URLs. Do not use it for source-code review, SLDS compliance (use design-systems-slds-validate), or accessibility compliance (use experience-accessibility-validate)."
|
|
4
4
|
metadata:
|
|
5
5
|
version: "1.0"
|
|
6
|
-
domains: ["Experience"]
|
|
6
|
+
domains: ["Experience", "Design Systems"]
|
|
7
7
|
relatedSkills:
|
|
8
8
|
- "design-systems-slds-validate"
|
|
9
9
|
- "experience-accessibility-validate"
|
|
@@ -14,6 +14,7 @@ metadata:
|
|
|
14
14
|
tools:
|
|
15
15
|
- get_content_types_for_workspace
|
|
16
16
|
- search_content_cms_channels
|
|
17
|
+
- search_digital_content
|
|
17
18
|
- search_electronic_media
|
|
18
19
|
- search_media_cms_channels
|
|
19
20
|
semver: ">=1.0.0"
|
|
@@ -113,13 +114,18 @@ Routes search requests to the correct sub-workflow — structured CMS content or
|
|
|
113
114
|
|
|
114
115
|
Follow this sequence for each intent Step 2 routed here. The content type FQN(s) are already known from Step 2.
|
|
115
116
|
|
|
116
|
-
1. **
|
|
117
|
-
|
|
118
|
-
- **
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
117
|
+
1. **Present search sources via `ask_followup_question` before any tool call** — only sources whose tools you have, plus "Other"; wait for the choice. → Read `references/content-route.md` § "Presenting available search sources".
|
|
118
|
+
2. **Build the query, then confirm before searching:**
|
|
119
|
+
- **Search using keywords** (`search_content_cms_channels`):
|
|
120
|
+
- **Extract keywords** — concrete nouns and named subjects likely in the title or body, plus domain synonyms; max 10, joined with ` OR `. E.g. "blog posts about sustainable business practices" → `sustainable OR sustainability OR business OR environmental`.
|
|
121
|
+
- **Extract taxonomies** — descriptive qualities, categories, or topical tags only (not concrete nouns), stringified as `{"OR": ["term1", "term2"]}`, or `"{}"` if none.
|
|
122
|
+
- Payload: `assets/search-payload-template.json`, `contentTypeFqn` = the comma-separated FQN list from Step 2. `contentAccessScope` and `channelIds` are **mutually exclusive** — never both in one call — so they're set per call in point 3.
|
|
123
|
+
- **Search using Data 360 hybrid search** (`search_digital_content`): verbatim `searchQuery`; bare ISO `searchLanguage` only if the schema lists it. On zero results or a language error, ask the user before one retry without it → `references/content-route.md`.
|
|
124
|
+
- **Other** — ask for a direct URL, asset library path, or system to check (no tool call, no confirmation).
|
|
125
|
+
|
|
126
|
+
Confirm via the two-message pattern (`Yes - search now` / `Edit search` / `Cancel`). → Read `references/content-route.md` § "Confirming the query before searching".
|
|
127
|
+
3. **Execute the search call(s)** — keyword search: one call for public-only scope, two (public + channel-scoped) when a `channelId` is in scope. Hybrid: one call, no channel scope. → Read `references/content-route.md` § "Executing the search call(s)" (keyword) or the hybrid section (field mapping) before parsing results.
|
|
128
|
+
4. **Present up to 5 unique results total** (de-duplicated by `managedContentKey` for display only — an item found under more than one channel still appears once here), grouped by content type, with a `Load More` option if more remain (keyword search only). Each item shows its **Channel** as a per-item field — never the grouping key:
|
|
123
129
|
|
|
124
130
|
```text
|
|
125
131
|
I found 3 content items:
|
|
@@ -162,7 +168,7 @@ Follow this sequence for each intent Step 2 routed here. The media content type
|
|
|
162
168
|
When a request mixes media and content intents, run the two routes **sequentially, each to full completion, not interleaved and not merged into one combined presentation**:
|
|
163
169
|
|
|
164
170
|
1. **Media Route first** — for every media intent, run Step 4 in full: present sources, build/confirm the query, search, present results, let the user select, and (point 6) offer the `experience-cms-content-render` hand-off (Yes/No). Finish this entire route — including the offer — before starting the Content Route.
|
|
165
|
-
2. **Content Route second** — for every content intent, run Step 3 in full: build/confirm the query, search, present results grouped by content type (channel shown per-item), let the user select, and (point 6) offer the `experience-cms-content-render` hand-off if a uiBundle channel is in scope.
|
|
171
|
+
2. **Content Route second** — for every content intent, run Step 3 in full: present sources, build/confirm the query, search, present results grouped by content type (channel shown per-item), let the user select, and (point 6) offer the `experience-cms-content-render` hand-off if a uiBundle channel is in scope.
|
|
166
172
|
|
|
167
173
|
Each route's results are labeled and presented on their own (e.g. "Images:" for the Media Route's output, then "Articles:" for the Content Route's) — never merge the two into one undifferentiated list, and never hold Media Route's results back to present alongside Content Route's.
|
|
168
174
|
|
|
@@ -170,12 +176,12 @@ Each route's results are labeled and presented on their own (e.g. "Images:" for
|
|
|
170
176
|
|
|
171
177
|
| Error | Response |
|
|
172
178
|
|---|---|
|
|
173
|
-
| No
|
|
179
|
+
| No content or media search tools (keyword or hybrid) found via introspection | "No content search connection is configured. Please connect a content-readonly MCP server." |
|
|
174
180
|
| Neither media tool available | "No automated media search sources are currently configured. Please provide a direct URL or asset library path." |
|
|
175
181
|
| `metadata-grounding` unavailable or no content types match | Apply the fallback chain in `references/content-type-discovery.md` — do not block or ask for an FQN |
|
|
176
182
|
| No search results (either route) | "No [content/media] found. Try broader keywords, removing descriptive terms, or a different [content type/source]." |
|
|
177
183
|
| Invalid user selection | Re-display options and ask again |
|
|
178
|
-
| Tool returns error (invalid input, missing argument, or otherwise) | Show error message, offer retry with corrected parameters **on that same tool — never fall through to the other route's search tool as a workaround** (see Key Principle 3); hybrid language errors: offer one no-language retry, with the user's OK (see
|
|
184
|
+
| Tool returns error (invalid input, missing argument, or otherwise) | Show error message, offer retry with corrected parameters **on that same tool — never fall through to the other route's search tool as a workaround** (see Key Principle 3); hybrid language errors: offer one no-language retry, with the user's OK (see each route's reference) |
|
|
179
185
|
| Search tool on the connected server returns a server error (5xx, timeout, connection failure — not "no results") | **Fail the call — do NOT silently retry against a different server.** Tell the user to check that server's connection/session and wait before retrying. |
|
|
180
186
|
|
|
181
187
|
**Never silently fail on a route the user asked for.** If one route in a mixed request comes up empty, still present the other route's results and say so explicitly. This does not mean substituting a different server when the connected one errors — see the server-error row above.
|
|
@@ -186,7 +192,7 @@ Each route's results are labeled and presented on their own (e.g. "Images:" for
|
|
|
186
192
|
2. **Search first, route second** — `search_metadata` + `query_metadata` decide the route; fall back to `get_content_types_for_workspace`, then intent wording, only when that comes up empty (Step 2)
|
|
187
193
|
3. **Never cross-route, including on failure** — content requests never hit media search tools and vice versa; if a route's search tool errors for any reason, fix and retry that same tool or stop and report the error — never fall through to the other route's tool as a workaround
|
|
188
194
|
4. **Metadata grounding is mandatory for content** — discover content type FQNs dynamically, never hardcode them
|
|
189
|
-
5. **
|
|
195
|
+
5. **Both routes start text-only** — present sources and wait before any tool call
|
|
190
196
|
6. **Confirm before searching (both routes)** — user approves query parameters before execution
|
|
191
197
|
7. **Never auto-select** — always wait for user choice, across channel scope and both routes
|
|
192
198
|
8. **Run mixed requests sequentially, Media Route first** — complete it fully (including the render offer) before starting the Content Route; present each route's results as its own labeled set, never merged
|
|
@@ -195,4 +201,4 @@ Each route's results are labeled and presented on their own (e.g. "Images:" for
|
|
|
195
201
|
11. **Never fail over to a different server on a server error** — fail the call and tell the user to check that server's session; don't silently retry elsewhere
|
|
196
202
|
12. **Group by content type, never by channel** — in both routes, channel is always a per-item field, never the group heading
|
|
197
203
|
13. **Disambiguate channel at selection, not before** — an item is shown once at presentation regardless of its delivery-details array length; only after selection do you ask which channel's copy to use, one option per entry by `managedContentChannelDetails.name`, in both routes
|
|
198
|
-
14. **Unauthenticated URL is public-channel-only** — `PUBLIC_UNAUTHENTICATED`/`COMMUNITY` entries only; never a `WEB_APP` (uiBundle) entry's `contentUrl`, in either route
|
|
204
|
+
14. **Unauthenticated URL is public-channel-only** — `PUBLIC_UNAUTHENTICATED`/`COMMUNITY` entries only; never a `WEB_APP` (uiBundle) entry's `contentUrl`, in either route. A hybrid entry on a Step 1 uiBundle `channelId` counts as `WEB_APP`
|