@salesforce/afv-skills 1.37.0 → 1.38.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/agentforce-generate/README.md +20 -3
- package/skills/agentforce-generate/SKILL.md +253 -440
- package/skills/agentforce-generate/assets/agent-spec-template.md +6 -2
- package/skills/agentforce-generate/assets/agents/order-service.agent +16 -12
- package/skills/agentforce-generate/assets/agents/production-faq.agent +4 -4
- package/skills/agentforce-generate/assets/agents/router-first.agent +5 -5
- package/skills/agentforce-generate/assets/agents/template-single-subagent.agent +4 -4
- package/skills/agentforce-generate/assets/agents/verification-gate.agent +8 -6
- package/skills/agentforce-generate/assets/agents/voice-knowledge-grounded.agent +9 -9
- package/skills/agentforce-generate/assets/agents/voice-service-agent.agent +7 -7
- package/skills/agentforce-generate/assets/patterns/README.md +3 -3
- package/skills/agentforce-generate/assets/patterns/action-callbacks.agent +5 -5
- package/skills/agentforce-generate/assets/patterns/advanced-input-bindings.agent +6 -8
- package/skills/agentforce-generate/assets/patterns/bidirectional-routing.agent +11 -13
- package/skills/agentforce-generate/assets/patterns/critical-input-collection.agent +11 -16
- package/skills/agentforce-generate/assets/patterns/lifecycle-events.agent +2 -3
- package/skills/agentforce-generate/assets/patterns/llm-controlled-actions.agent +6 -7
- package/skills/agentforce-generate/assets/patterns/open-gate-routing.agent +3 -3
- package/skills/agentforce-generate/assets/patterns/prompt-template-action.agent +14 -19
- package/skills/agentforce-generate/assets/patterns/system-instruction-overrides.agent +11 -20
- package/skills/agentforce-generate/references/actions-reference.md +2 -2
- package/skills/agentforce-generate/references/agent-audit-and-repair.md +135 -0
- package/skills/agentforce-generate/references/agent-audit-candidate-verification.md +160 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostic-catalog.md +156 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-actions-state.md +176 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-architecture-evaluation.md +68 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-instructions-routing.md +283 -0
- package/skills/agentforce-generate/references/agent-audit-evaluation-loop.md +191 -0
- package/skills/agentforce-generate/references/agent-audit-repair-report.md +143 -0
- package/skills/agentforce-generate/references/agent-audit-scope-path-review.md +180 -0
- package/skills/agentforce-generate/references/agent-design-and-spec-creation.md +105 -59
- package/skills/agentforce-generate/references/agent-script-core-language.md +144 -61
- package/skills/agentforce-generate/references/agent-subagent-map-diagrams.md +33 -23
- package/skills/agentforce-generate/references/agent-validation-and-debugging.md +37 -11
- package/skills/agentforce-generate/references/agentscript-toolchain.md +112 -0
- package/skills/agentforce-generate/references/architecture-patterns.md +81 -18
- package/skills/agentforce-generate/references/common-control-flow-pitfalls.md +255 -0
- package/skills/agentforce-generate/references/control-flow-actions-sequencing.md +198 -0
- package/skills/agentforce-generate/references/control-flow-lifecycle-side-effects.md +87 -0
- package/skills/agentforce-generate/references/examples.md +22 -22
- package/skills/agentforce-generate/references/instruction-resolution.md +123 -83
- package/skills/agentforce-generate/references/known-issues.md +1 -2
- package/skills/agentforce-generate/references/optimization-pattern-1-data-flow.md +4 -0
- package/skills/agentforce-generate/references/optimization-pattern-2-deterministic-logic.md +33 -0
- package/skills/agentforce-generate/references/optimization-pattern-3-reference-syntax.md +32 -3
- package/skills/agentforce-generate/references/optimization-pattern-4-escalation.md +2 -2
- package/skills/agentforce-generate/references/patterns-by-requirement.md +3 -1
- package/skills/agentforce-generate/references/posture-and-determinism.md +103 -22
- package/skills/agentforce-generate/references/reference-map.md +19 -3
- package/skills/agentforce-generate/references/scoring-rubric.md +1 -1
- package/skills/agentforce-generate/references/voice-latency-heuristics.md +4 -0
- package/skills/agentforce-generate/references/voice-modality-reference.md +4 -4
- package/skills/agentforce-generate/references/zen-of-agentscript.md +139 -23
- package/skills/agentforce-generate/scripts/agentscript-sdk-loader.mjs +133 -0
- package/skills/agentforce-generate/scripts/index-agent.mjs +141 -0
- package/skills/agentforce-generate/scripts/setup-agentscript-sdk.mjs +337 -0
- package/skills/automation-sandbox-post-copy-config-generate/SKILL.md +1 -1
- package/skills/automation-sandbox-post-copy-configure/SKILL.md +433 -0
- package/skills/automation-sandbox-post-copy-configure/assets/api_request_templates.json +89 -0
- package/skills/automation-sandbox-post-copy-configure/examples/sample_config_input.json +40 -0
- package/skills/automation-sandbox-post-copy-configure/examples/sample_execution_summary.md +79 -0
- package/skills/automation-sandbox-post-copy-configure/references/api_endpoints.md +273 -0
- package/skills/automation-sandbox-post-copy-configure/references/authentication.md +94 -0
- package/skills/automation-sandbox-post-copy-configure/references/execution_phasing.md +93 -0
- package/skills/automation-sandbox-post-copy-configure/references/rules_gotchas.md +35 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/classify-patch-result.mjs +88 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/map-metadata-key.mjs +98 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/plan-phases.mjs +98 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/resolve-target-org.mjs +56 -0
- package/skills/design-systems-slds-validate/SKILL.md +14 -13
- package/skills/dx-code-analyzer-custom-rule-create/examples/xpath-examples.md +1 -1
- package/skills/dx-code-analyzer-custom-rule-create/references/xpath-patterns-security.md +1 -1
- package/skills/dx-org-devhub-configure/SKILL.md +268 -0
- package/skills/dx-org-devhub-configure/examples/status-output.md +39 -0
- package/skills/dx-org-devhub-configure/scripts/devhub.sh +650 -0
- package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +116 -0
- package/skills/dx-org-manage/SKILL.md +135 -42
- package/skills/dx-org-manage/assets/derive-alias.sh +95 -0
- package/skills/dx-org-manage/assets/scratch-def.seed.json +6 -0
- package/skills/dx-org-manage/examples/README.md +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/delete_output.json +8 -0
- package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +23 -0
- package/skills/dx-org-manage/examples/scratch-orgs/list_output.json +58 -0
- package/skills/dx-org-manage/examples/scratch-orgs/resume_output.json +38 -0
- package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +41 -0
- package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +1 -1
- package/skills/dx-org-manage/examples/snapshots/error_output.json +3 -3
- package/skills/dx-org-manage/references/creating-scratch-org.md +2 -2
- package/skills/dx-org-manage/references/creating-snapshot.md +1 -2
- package/skills/dx-org-manage/references/definition_file_options.md +24 -0
- package/skills/dx-org-manage/references/edition_types.md +10 -8
- package/skills/dx-org-manage/references/opening-org.md +11 -12
- package/skills/dx-org-manage/references/scratch-org-create.md +303 -0
- package/skills/dx-org-manage/references/scratch-org-operations.md +135 -0
- package/skills/experience-aura-lwc-migrate/SKILL.md +120 -0
- package/skills/experience-aura-lwc-migrate/references/aura-api-expert.md +170 -0
- package/skills/experience-aura-lwc-migrate/references/aura-data-expert.md +172 -0
- package/skills/experience-aura-lwc-migrate/references/aura-migration-guidelines.md +299 -0
- package/skills/experience-aura-lwc-migrate/references/aura-prd-framework.md +79 -0
- package/skills/experience-aura-lwc-migrate/references/aura-redundant-code-expert.md +24 -0
- package/skills/experience-aura-lwc-migrate/references/aura-reference-expert.md +140 -0
- package/skills/experience-aura-lwc-migrate/references/aura-resolver-expert.md +115 -0
- package/skills/experience-aura-lwc-migrate/references/aura-slots-expert.md +67 -0
- package/skills/experience-aura-lwc-migrate/references/aura-style-expert.md +62 -0
- package/skills/experience-aura-lwc-migrate/references/aura-to-lwc-completeness-checklist.md +188 -0
- package/skills/experience-aura-lwc-migrate/references/aura-values-expert.md +67 -0
- package/skills/experience-content-media-search/SKILL.md +17 -12
- package/skills/experience-content-media-stock-image-search/SKILL.md +192 -0
- package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +102 -0
- package/skills/experience-lds-best-practices-apply/SKILL.md +245 -0
- package/skills/experience-lds-best-practices-apply/references/adapter-apis.md +1640 -0
- package/skills/experience-lds-best-practices-apply/references/lds-data-consistency.md +126 -0
- package/skills/experience-lds-best-practices-apply/references/lds-expert.md +429 -0
- package/skills/experience-lds-best-practices-apply/references/lds-referential-integrity.md +322 -0
- package/skills/experience-lds-best-practices-apply/references/wire-adapter-types.md +1511 -0
- package/skills/experience-lds-graphql-generate/SKILL.md +222 -0
- package/skills/experience-lds-graphql-generate/references/generation-guide.md +236 -0
- package/skills/experience-lds-graphql-generate/references/generation-mutation.md +277 -0
- package/skills/experience-lds-graphql-generate/references/generation-query.md +237 -0
- package/skills/experience-lds-graphql-generate/scripts/fetch-lds-graphql-schema.sh +230 -0
- package/skills/experience-lds-graphql-generate/scripts/test-lds-graphql-query.sh +128 -0
- package/skills/experience-lwc-accessibility-validate/SKILL.md +112 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-1-1-non-text-content.md +88 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-i-lists.md +52 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-ii-tables.md +106 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iii-form-labels.md +78 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iv-regions.md +26 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-v-groups.md +66 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-5-identify-input.md +70 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-4-3-contrast.md +115 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-1-1-keyboard.md +47 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-4-link-purpose.md +39 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-6-headings-labels.md +50 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-1-pointer-gestures.md +54 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-2-pointer-cancellation.md +49 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-3-label-in-name.md +77 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-7-dragging-movement.md +45 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-1-on-focus.md +55 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-2-on-input.md +51 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-1-error-identification.md +84 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-2-labels-instructions.md +50 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-3-error-suggestion.md +64 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-i-name.md +105 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-ii-role.md +99 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-iii-value.md +97 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-1-1-non-text-content.md +83 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-1-use-of-color.md +62 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-10-resize-reflow.md +18 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-11-non-text-contrast.md +43 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-3-contrast.md +25 -0
- package/skills/experience-lwc-accessibility-validate/scripts/contrast-ratio.py +153 -0
- package/skills/experience-lwc-design-generate/SKILL.md +261 -0
- package/skills/experience-lwc-design-generate/references/figma-to-prd-blueprint.md +66 -0
- package/skills/experience-lwc-design-generate/references/prd-analysis-template.md +17 -0
- package/skills/experience-lwc-design-generate/scripts/check-component-name.sh +75 -0
- package/skills/experience-lwc-design-generate/scripts/detect-project-tools.sh +97 -0
- package/skills/experience-lwc-runtime-observe/SKILL.md +244 -0
- package/skills/experience-lwc-runtime-observe/examples/component-preview-and-dom.md +41 -0
- package/skills/experience-lwc-runtime-observe/scripts/extract-dom.sh +79 -0
- package/skills/experience-lwc-runtime-observe/scripts/open-frontdoor.sh +46 -0
- package/skills/experience-lwc-runtime-observe/scripts/verify-toolchain.sh +48 -0
- package/skills/experience-lwc-security-validate/SKILL.md +151 -0
- package/skills/experience-lwc-security-validate/examples/review-report.md +6 -0
- package/skills/experience-lwc-security-validate/examples/score-report.sarif.json +32 -0
- package/skills/experience-lwc-security-validate/references/lws-security-expert.md +986 -0
- package/skills/experience-lwc-security-validate/references/security-analysis.md +611 -0
- package/skills/experience-lwc-security-validate/scripts/check-lwc-import.sh +166 -0
- package/skills/experience-lwc-security-validate/scripts/validate-sarif.sh +131 -0
- package/skills/experience-ui-bundle-2gp-deploy/SKILL.md +454 -0
- package/skills/experience-ui-bundle-2gp-deploy/assets/CustomApplication.app-meta.xml +12 -0
- package/skills/experience-ui-bundle-2gp-deploy/assets/PermissionSet.permissionset-meta.xml +9 -0
- package/skills/experience-ui-bundle-2gp-deploy/scripts/find-bundle-package-dir.sh +53 -0
- package/skills/experience-ui-bundle-agentforce-client-generate/SKILL.md +104 -26
- package/skills/experience-ui-bundle-agentforce-client-generate/references/constraints.md +35 -24
- package/skills/experience-ui-bundle-agentforce-client-generate/references/examples.md +92 -1
- package/skills/experience-ui-bundle-agentforce-client-generate/references/style-tokens.md +2 -0
- package/skills/experience-ui-bundle-agentforce-client-generate/references/troubleshooting.md +14 -1
- package/skills/experience-ui-bundle-agentforce-client-generate/scripts/detect-framework.sh +67 -0
- package/skills/experience-ui-bundle-deploy/SKILL.md +83 -14
- package/skills/experience-ui-bundle-deploy/assets/Communities.settings-meta.xml +19 -0
- package/skills/experience-ui-bundle-deploy/assets/org-setup.config.template.json +5 -0
- package/skills/experience-ui-bundle-deploy/assets/social-login-auth-providers.apex +158 -0
- package/skills/experience-ui-bundle-deploy/references/config-scaffold.md +13 -1
- package/skills/experience-ui-bundle-deploy/references/social-login.md +179 -0
- package/skills/experience-ui-bundle-frontend-generate/SKILL.md +14 -0
- package/skills/experience-ui-bundle-mfa-configure/SKILL.md +6 -5
- package/skills/experience-ui-bundle-mfa-configure/references/social-login.md +15 -7
- package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +41 -5
- package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +10 -22
- package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +4 -19
- package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +5 -0
- package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +33 -150
- package/skills/mobile-platform-native-capabilities-integrate/references/nfc.md +35 -0
- package/skills/platform-apex-generate/SKILL.md +8 -7
- package/skills/platform-apex-test-generate/SKILL.md +3 -1
- package/skills/platform-apex-test-run/SKILL.md +9 -8
- package/skills/platform-lightning-type-widget-coordinate/SKILL.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +3 -3
- package/skills/platform-mcp-tool-widget-coordinate/SKILL.md +43 -67
- package/skills/platform-mcp-tool-widget-coordinate/examples/action-name-source-prompt.md +1 -2
- package/skills/platform-mcp-tool-widget-coordinate/examples/apex-invocable-source-prompt.md +2 -3
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-list-source-prompt.md +163 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-single-source-prompt.md +198 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/pasted-tool-output-prompt.md +0 -1
- package/skills/platform-mcp-tool-widget-coordinate/references/build-plan-format.md +17 -11
- package/skills/platform-mcp-tool-widget-coordinate/references/mcp-tool-output-discovery.md +48 -15
- package/skills/platform-mcp-tool-widget-coordinate/references/two-clt-modeling.md +73 -10
- package/skills/platform-mcp-tool-widget-coordinate/references/validation-gates.md +48 -8
- package/skills/platform-policy-rule-generate/SKILL.md +22 -12
- package/skills/platform-policy-rule-generate/references/deploy-errors.md +1 -1
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +8 -29
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
- package/skills/platform-sharing-owd-configure/SKILL.md +20 -8
- package/skills/platform-sharing-owd-configure/references/access_levels.md +14 -1
- package/skills/platform-sharing-rules-generate/SKILL.md +67 -35
- package/skills/platform-sharing-rules-generate/examples/create-cases.md +16 -17
- package/skills/platform-sharing-rules-generate/examples/delete-cases.md +34 -79
- package/skills/platform-sharing-rules-generate/examples/edit-cases.md +13 -26
- package/skills/platform-sharing-rules-generate/scripts/count-remaining-rules.sh +33 -0
- package/skills/platform-widget-generate/SKILL.md +3 -5
- package/skills/platform-widget-generate/examples/conditional.json +18 -13
- package/skills/platform-widget-generate/examples/list-with-foreach.json +2 -2
- package/skills/platform-widget-generate/examples/single-object.json +2 -2
- package/skills/platform-widget-generate/references/schema-from-lightning-type.md +27 -6
- package/skills/platform-widget-generate/references/widget-bundle-layout.md +4 -3
- package/skills/service-itsm-agentic-setup-cmdb-access-assign/SKILL.md +287 -0
- package/skills/service-itsm-agentic-setup-cmdb-access-assign/references/mcp-invocation.md +260 -0
- package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/SKILL.md +252 -0
- package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/references/mcp-invocation.md +204 -0
- package/skills/service-itsm-agentic-setup-cmdb-configure/SKILL.md +259 -0
- package/skills/service-itsm-agentic-setup-cmdb-configure/references/mcp-invocation.md +188 -0
- package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +197 -0
- package/skills/service-itsm-agentic-setup-cmdb-coordinate/examples/output-templates.md +77 -0
- package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/SKILL.md +316 -0
- package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/references/mcp-invocation.md +221 -0
- package/skills/service-itsm-incident-priority-configure/SKILL.md +168 -0
- package/skills/service-itsm-incident-priority-configure/examples/matrix-operations.md +200 -0
- package/skills/service-itsm-incident-priority-configure/examples/render-matrix.md +54 -0
- package/skills/service-itsm-incident-priority-configure/examples/seed-full-matrix.md +52 -0
- package/skills/service-itsm-incident-priority-configure/references/sf-cli-invocation.md +264 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-source-prompt.md +0 -191
- package/skills/platform-policy-rule-generate/references/fixtures-index.md +0 -29
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Reports which of the Phase-4 lint/format/compile tools are configured
|
|
3
|
+
# in the target project. Emits one `<tool>=yes|no` line per checked tool
|
|
4
|
+
# on stdout so the caller can gate each Phase-4 substep deterministically
|
|
5
|
+
# instead of parsing prose.
|
|
6
|
+
#
|
|
7
|
+
# Detected tools:
|
|
8
|
+
# eslint — .eslintrc.* / eslint.config.* / package.json `eslintConfig`
|
|
9
|
+
# prettier — .prettierrc* / prettier.config.* / package.json `prettier`
|
|
10
|
+
# cursor-rules — .cursor/rules/ or .cursorrules
|
|
11
|
+
# lwc-compiler — sfdx-project.json or @lwc/compiler in package.json dependencies
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
# <skill_dir>/scripts/detect-project-tools.sh [<projectRoot>]
|
|
15
|
+
#
|
|
16
|
+
# `<projectRoot>` defaults to the current working directory.
|
|
17
|
+
#
|
|
18
|
+
# Exit codes:
|
|
19
|
+
# 0 — detection completed (output on stdout is authoritative)
|
|
20
|
+
# 2 — usage error
|
|
21
|
+
|
|
22
|
+
set -euo pipefail
|
|
23
|
+
|
|
24
|
+
if [ "$#" -gt 1 ]; then
|
|
25
|
+
echo "usage: $0 [<projectRoot>]" >&2
|
|
26
|
+
exit 2
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
root="${1:-.}"
|
|
30
|
+
|
|
31
|
+
if [ ! -d "$root" ]; then
|
|
32
|
+
echo "detect-project-tools: project root \`$root\` does not exist" >&2
|
|
33
|
+
exit 2
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
python3 - "$root" <<'PY'
|
|
37
|
+
import json
|
|
38
|
+
import os
|
|
39
|
+
import sys
|
|
40
|
+
from pathlib import Path
|
|
41
|
+
|
|
42
|
+
root = Path(sys.argv[1]).resolve()
|
|
43
|
+
|
|
44
|
+
def has_any(patterns):
|
|
45
|
+
for p in patterns:
|
|
46
|
+
# Interpret `*` as a shell-style glob relative to `root`.
|
|
47
|
+
matches = list(root.glob(p))
|
|
48
|
+
if matches:
|
|
49
|
+
return True
|
|
50
|
+
return False
|
|
51
|
+
|
|
52
|
+
def has_pkg_key(key):
|
|
53
|
+
pkg = root / "package.json"
|
|
54
|
+
if not pkg.is_file():
|
|
55
|
+
return False
|
|
56
|
+
try:
|
|
57
|
+
data = json.loads(pkg.read_text(encoding="utf-8"))
|
|
58
|
+
except Exception:
|
|
59
|
+
return False
|
|
60
|
+
if key in data:
|
|
61
|
+
return True
|
|
62
|
+
deps = {}
|
|
63
|
+
for section in ("dependencies", "devDependencies", "peerDependencies"):
|
|
64
|
+
d = data.get(section) or {}
|
|
65
|
+
if isinstance(d, dict):
|
|
66
|
+
deps.update(d)
|
|
67
|
+
return key in deps
|
|
68
|
+
|
|
69
|
+
def yn(cond):
|
|
70
|
+
return "yes" if cond else "no"
|
|
71
|
+
|
|
72
|
+
eslint = has_any([
|
|
73
|
+
".eslintrc",
|
|
74
|
+
".eslintrc.*",
|
|
75
|
+
"eslint.config.*",
|
|
76
|
+
]) or has_pkg_key("eslintConfig")
|
|
77
|
+
|
|
78
|
+
prettier = has_any([
|
|
79
|
+
".prettierrc",
|
|
80
|
+
".prettierrc.*",
|
|
81
|
+
"prettier.config.*",
|
|
82
|
+
]) or has_pkg_key("prettier")
|
|
83
|
+
|
|
84
|
+
cursor_rules = has_any([
|
|
85
|
+
".cursor/rules",
|
|
86
|
+
".cursorrules",
|
|
87
|
+
])
|
|
88
|
+
|
|
89
|
+
lwc_compiler = has_any([
|
|
90
|
+
"sfdx-project.json",
|
|
91
|
+
]) or has_pkg_key("@lwc/compiler")
|
|
92
|
+
|
|
93
|
+
print(f"eslint={yn(eslint)}")
|
|
94
|
+
print(f"prettier={yn(prettier)}")
|
|
95
|
+
print(f"cursor-rules={yn(cursor_rules)}")
|
|
96
|
+
print(f"lwc-compiler={yn(lwc_compiler)}")
|
|
97
|
+
PY
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: experience-lwc-runtime-observe
|
|
3
|
+
description: "Use when running Salesforce Lightning Preview for an app or a single LWC component to extract the runtime DOM for inspection. TRIGGER when the user says \"preview an LWC locally\", \"run sf lightning dev\", \"launch Local Dev\", \"inspect a component's shadow DOM at runtime\", \"grab rendered HTML from a live preview\", \"troubleshoot what actually renders versus the template\", \"set up Salesforce Live Preview plugin\", \"lightning preview\", \"local dev server\", or \"extract runtime DOM\". DO NOT TRIGGER when the user is authoring or editing LWC source code (use experience-lwc-generate) or reviewing component code statically without running it."
|
|
4
|
+
metadata:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
cliTools:
|
|
7
|
+
- tool: ["python3"]
|
|
8
|
+
semver: ">=3.0.0"
|
|
9
|
+
- tool: ["sf"]
|
|
10
|
+
semver: ">=2.0.0"
|
|
11
|
+
relatedSkills:
|
|
12
|
+
- experience-lwc-generate
|
|
13
|
+
---
|
|
14
|
+
<!-- adk-managed-skill -->
|
|
15
|
+
|
|
16
|
+
# Previewing LWC Runtime — Local Dev + DOM Inspection
|
|
17
|
+
|
|
18
|
+
Guides the agent through two sequential jobs that typically run together:
|
|
19
|
+
|
|
20
|
+
1. **Start a Lightning Preview session** with the Salesforce CLI so an LWC app
|
|
21
|
+
or component renders in a local dev environment.
|
|
22
|
+
2. **Navigate to that preview URL and extract the runtime DOM subtree** so the
|
|
23
|
+
agent (or user) can reason about what actually rendered.
|
|
24
|
+
|
|
25
|
+
Preview is the prerequisite for DOM inspection. Keep them in this order.
|
|
26
|
+
|
|
27
|
+
## When to Use This Skill
|
|
28
|
+
|
|
29
|
+
- The user wants to preview an LWC app or component locally before deploying
|
|
30
|
+
(`sf lightning dev app` / `sf lightning dev component`).
|
|
31
|
+
- The user wants the rendered HTML subtree for a specific component at runtime
|
|
32
|
+
— for a diff, a screenshot pipeline, or to reason about shadow DOM.
|
|
33
|
+
- The user asks why the template content "isn't in the DOM" — almost always
|
|
34
|
+
a shadow-DOM misunderstanding handled in Step 2.
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
- Salesforce CLI (`sf`) installed. Check with `sf version`.
|
|
39
|
+
- `@salesforce/plugin-lightning-dev` installed. Check with `sf plugins`.
|
|
40
|
+
- An authenticated org (`sf org list` shows at least one connected org).
|
|
41
|
+
- For DOM extraction: browser automation available in the agent harness
|
|
42
|
+
(Playwright, Puppeteer, Chrome DevTools Protocol — whatever is wired up).
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Step 1 — Start the Lightning Preview
|
|
47
|
+
|
|
48
|
+
Ask the user (or infer from the request) whether the scope is **app** or
|
|
49
|
+
**component**.
|
|
50
|
+
|
|
51
|
+
### 1a. Verify the toolchain
|
|
52
|
+
|
|
53
|
+
Ask the user for (or infer from the request) the org alias the preview
|
|
54
|
+
should target. Run the bundled verification script with that alias and
|
|
55
|
+
surface any error it emits — do not re-invoke `sf version` /
|
|
56
|
+
`sf plugins` / `sf org display` in prose. The script checks CLI
|
|
57
|
+
presence, `@salesforce/plugin-lightning-dev` installation, and that the
|
|
58
|
+
specific target alias is authenticated and Connected, and exits nonzero
|
|
59
|
+
with an actionable message on failure:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
"<skill_dir>/scripts/verify-toolchain.sh" <orgAlias>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
If it reports that the target alias is not authenticated or not
|
|
66
|
+
Connected, direct the user to
|
|
67
|
+
[Enable Local Dev](https://developer.salesforce.com/docs/platform/lwc/guide/get-started-test-components.html#enable-local-dev)
|
|
68
|
+
and have them run `sf org login web --alias <orgAlias>`, then re-run the
|
|
69
|
+
verification script before proceeding.
|
|
70
|
+
|
|
71
|
+
### 1b. Read the subcommand's flags
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# For app scope
|
|
75
|
+
sf lightning dev app --help
|
|
76
|
+
|
|
77
|
+
# For component scope
|
|
78
|
+
sf lightning dev component --help
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Note required vs optional flags. If a required flag is ambiguous, ask the user
|
|
82
|
+
before running.
|
|
83
|
+
|
|
84
|
+
### 1c. Launch the preview
|
|
85
|
+
|
|
86
|
+
Prefix every preview command with `OPEN_BROWSER=false` — the CLI opens a
|
|
87
|
+
browser window by default, which we do **not** want when an agent is driving.
|
|
88
|
+
(This env var is undocumented in `--help`; rely on it unless the user
|
|
89
|
+
explicitly asks for a browser window.)
|
|
90
|
+
|
|
91
|
+
| Scope | Command |
|
|
92
|
+
|-------------|---------------------------------------------------------------------------------------|
|
|
93
|
+
| `app` | `OPEN_BROWSER=false sf lightning dev app -o <orgAlias> -n <appName> -t desktop` |
|
|
94
|
+
| `component` | `OPEN_BROWSER=false sf lightning dev component -o <orgAlias> -n <componentName>` |
|
|
95
|
+
|
|
96
|
+
When the preview is up, capture the URL and log it in exactly this format:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
Lightning Preview running at URL: <URL>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
If any sub-step fails, stop and surface the error to the user — don't try to
|
|
103
|
+
paper over auth or plugin-install problems.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Step 2 — Extract the Runtime DOM
|
|
108
|
+
|
|
109
|
+
Only run this step once Step 1 has produced a live preview URL.
|
|
110
|
+
|
|
111
|
+
### 2a. Get an authenticated front-door URL — **without surfacing the token to agent context**
|
|
112
|
+
|
|
113
|
+
The front-door URL returned by `sf org open --url-only --json` contains a
|
|
114
|
+
short-lived OTP that authenticates the session. **Never run `sf org open`
|
|
115
|
+
directly — its output would land in the agent tool-output stream and leak
|
|
116
|
+
an auth token into the transcript, violating agent-safety standard S1.**
|
|
117
|
+
The bundled helper is the *only* supported way to obtain the URL: it runs
|
|
118
|
+
`sf org open` internally with stdout redirected into a `chmod 600` tempfile
|
|
119
|
+
and stderr suppressed, so no URL fragment or token substring ever reaches
|
|
120
|
+
agent context.
|
|
121
|
+
|
|
122
|
+
Instead, use the bundled helper script, which writes the URL to a
|
|
123
|
+
`chmod 600` tempfile and prints only `export` assignments (no token
|
|
124
|
+
material). Capture the helper output first so a nonzero exit status
|
|
125
|
+
aborts the caller — `eval "$(...)"` alone masks failures, letting the
|
|
126
|
+
agent proceed with an unset `$FRONTDOOR_URL_FILE`:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
frontdoor_env="$("<skill_dir>/scripts/open-frontdoor.sh" <orgAlias> <previewUrl>)" || exit 1
|
|
130
|
+
eval "$frontdoor_env"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The helper suppresses `sf` and `python3` stderr as well as stdout, so
|
|
134
|
+
partial URLs and progress noise never reach the agent transcript.
|
|
135
|
+
|
|
136
|
+
The browser driver must:
|
|
137
|
+
1. Read the URL from `$FRONTDOOR_URL_FILE`.
|
|
138
|
+
2. Navigate to it to establish a session.
|
|
139
|
+
3. Delete the tempfile immediately after use.
|
|
140
|
+
4. **Never `cat` or otherwise echo the file contents.**
|
|
141
|
+
|
|
142
|
+
**OTP tokens expire fast.** Bring up the browser driver *first*, then invoke
|
|
143
|
+
the helper just before navigating — otherwise the token goes stale.
|
|
144
|
+
|
|
145
|
+
### 2b. Navigate and wait
|
|
146
|
+
|
|
147
|
+
1. Open the preview URL from Step 1 in the automation browser.
|
|
148
|
+
2. Wait for the network to go idle and the initial render to complete.
|
|
149
|
+
3. If the expected element isn't there, back off briefly and retry before
|
|
150
|
+
declaring failure — local dev pages sometimes hydrate in two phases.
|
|
151
|
+
|
|
152
|
+
### 2c. Extract the subtree
|
|
153
|
+
|
|
154
|
+
Two deterministic string operations — turning a component name into its
|
|
155
|
+
`c-<kebab>` selector and wrapping the extracted HTML in the exact
|
|
156
|
+
`DOM_OUTPUT_START` / `DOM_OUTPUT_END` markers — are handled by
|
|
157
|
+
`<skill_dir>/scripts/extract-dom.sh`. Do NOT re-derive the selector or
|
|
158
|
+
compose the markers in prose; call the script.
|
|
159
|
+
|
|
160
|
+
Actual DOM traversal must be run by the browser-automation driver
|
|
161
|
+
(Playwright / Puppeteer / CDP); the script does not drive the browser.
|
|
162
|
+
|
|
163
|
+
#### If scope is `component`
|
|
164
|
+
|
|
165
|
+
Compute the selector deterministically:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
selector="$("<skill_dir>/scripts/extract-dom.sh" selector <componentName>)"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Then, using the driver, pierce the `lwr_dev-preview-container` shadow
|
|
172
|
+
root, locate the first visible element matching `$selector`, and read its
|
|
173
|
+
subtree HTML (via `element.shadowRoot.innerHTML`). Pipe that HTML into
|
|
174
|
+
the wrap step:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
printf '%s' "$html_subtree" \
|
|
178
|
+
| "<skill_dir>/scripts/extract-dom.sh" wrap component <componentName>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### If scope is `app`
|
|
182
|
+
|
|
183
|
+
Using the driver, identify the primary app root (prefer `document.body`
|
|
184
|
+
or the main app container — not `document.documentElement`), exclude
|
|
185
|
+
`<head>` and non-rendered nodes, and read the subtree HTML. Pipe it into
|
|
186
|
+
the wrap step:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
printf '%s' "$html_subtree" \
|
|
190
|
+
| "<skill_dir>/scripts/extract-dom.sh" wrap app
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Emit the script's stdout unchanged as the DOM output.
|
|
194
|
+
|
|
195
|
+
### 2d. About LWC Shadow DOM (the #1 gotcha)
|
|
196
|
+
|
|
197
|
+
Lightning Web Components use Shadow DOM. The template content is **not**
|
|
198
|
+
directly queryable on the host element:
|
|
199
|
+
|
|
200
|
+
| Access pattern | What you get |
|
|
201
|
+
|-------------------------------|--------------------------------------|
|
|
202
|
+
| `element.innerHTML` | empty, or only slotted light-DOM content |
|
|
203
|
+
| `element.outerHTML` | just the host tag, no children |
|
|
204
|
+
| `element.shadowRoot.innerHTML`| the real rendered template content |
|
|
205
|
+
|
|
206
|
+
If the browser driver's DOM query doesn't pierce shadow roots by default,
|
|
207
|
+
walk `shadowRoot` explicitly. Most modern automation drivers have a
|
|
208
|
+
shadow-piercing query helper — use it.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Examples
|
|
213
|
+
|
|
214
|
+
For a worked end-to-end example (preview a component, capture the front-door
|
|
215
|
+
URL safely, and extract its DOM), load
|
|
216
|
+
[`examples/component-preview-and-dom.md`](examples/component-preview-and-dom.md).
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Verification Checklist
|
|
221
|
+
|
|
222
|
+
- [ ] `<skill_dir>/scripts/verify-toolchain.sh <orgAlias>` exited zero for the target alias.
|
|
223
|
+
- [ ] Preview command ran with `OPEN_BROWSER=false`.
|
|
224
|
+
- [ ] Preview URL logged in the `Lightning Preview running at URL: <URL>` format.
|
|
225
|
+
- [ ] Front-door URL fetched via `<skill_dir>/scripts/open-frontdoor.sh` (never `sf org open` directly).
|
|
226
|
+
- [ ] DOM extraction used `shadowRoot` traversal (not `innerHTML` on the host).
|
|
227
|
+
- [ ] DOM output was produced by `<skill_dir>/scripts/extract-dom.sh wrap …` (script owns the markers).
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Troubleshooting
|
|
232
|
+
|
|
233
|
+
- **`verify-toolchain.sh` reports "Target org alias is not authenticated or not Connected"** —
|
|
234
|
+
run `sf org login web --alias <orgAlias>` (the alias must match the one
|
|
235
|
+
you passed to `verify-toolchain.sh` and the `-o` value the preview
|
|
236
|
+
command uses).
|
|
237
|
+
- **`verify-toolchain.sh` reports the plugin is missing** — install it with
|
|
238
|
+
`sf plugins install @salesforce/plugin-lightning-dev`.
|
|
239
|
+
- **Preview opens a browser window** — you forgot `OPEN_BROWSER=false`.
|
|
240
|
+
- **Empty DOM on extraction** — you're looking at `innerHTML` on a host. Use
|
|
241
|
+
`element.shadowRoot.innerHTML` instead. Also verify you pierced the
|
|
242
|
+
`lwr_dev-preview-container` shadow root.
|
|
243
|
+
- **Front-door token fails** — it's expired. Re-invoke
|
|
244
|
+
`<skill_dir>/scripts/open-frontdoor.sh` and navigate within ~60 seconds.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Example — preview a component and grab its DOM
|
|
2
|
+
|
|
3
|
+
**User:** "Preview `accountTile` from my org `dev-sandbox` and give me the
|
|
4
|
+
rendered HTML."
|
|
5
|
+
|
|
6
|
+
**Agent:**
|
|
7
|
+
1. `"<skill_dir>/scripts/verify-toolchain.sh" dev-sandbox` — passes.
|
|
8
|
+
2. `OPEN_BROWSER=false sf lightning dev component -o dev-sandbox -n accountTile`
|
|
9
|
+
3. Log: `Lightning Preview running at URL: http://localhost:3333/...`
|
|
10
|
+
4. Capture the helper output first so a failure aborts the caller, then
|
|
11
|
+
eval the exports:
|
|
12
|
+
```bash
|
|
13
|
+
frontdoor_env="$("<skill_dir>/scripts/open-frontdoor.sh" dev-sandbox http://localhost:3333/...)" || exit 1
|
|
14
|
+
eval "$frontdoor_env"
|
|
15
|
+
```
|
|
16
|
+
`$FRONTDOOR_URL_FILE` and `$PREVIEW_URL` are now exported for the
|
|
17
|
+
browser process (do NOT read/print the tempfile's contents).
|
|
18
|
+
5. Browser driver reads the URL from `$FRONTDOOR_URL_FILE`, navigates to
|
|
19
|
+
establish session, then deletes the file.
|
|
20
|
+
6. Navigate to preview URL, wait for network idle.
|
|
21
|
+
7. Compute the selector:
|
|
22
|
+
```bash
|
|
23
|
+
selector="$("<skill_dir>/scripts/extract-dom.sh" selector accountTile)"
|
|
24
|
+
# → c-account-tile
|
|
25
|
+
```
|
|
26
|
+
8. Pierce `lwr_dev-preview-container` shadow root via the driver, find
|
|
27
|
+
the first `$selector` host, read `element.shadowRoot.innerHTML` into
|
|
28
|
+
`$html_subtree`, and wrap:
|
|
29
|
+
```bash
|
|
30
|
+
printf '%s' "$html_subtree" \
|
|
31
|
+
| "<skill_dir>/scripts/extract-dom.sh" wrap component accountTile
|
|
32
|
+
```
|
|
33
|
+
Emits:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
DOM_OUTPUT_START
|
|
37
|
+
<c-account-tile>
|
|
38
|
+
<!-- rendered shadow DOM here -->
|
|
39
|
+
</c-account-tile>
|
|
40
|
+
DOM_OUTPUT_END
|
|
41
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Deterministic wrapper for runtime DOM extraction. Handles the two
|
|
3
|
+
# operations that are pure string ops (and therefore should not be left to
|
|
4
|
+
# an LLM):
|
|
5
|
+
# 1. Convert a component name to its LWC selector (camelCase / PascalCase
|
|
6
|
+
# → kebab-case, prefixed with `c-`).
|
|
7
|
+
# 2. Wrap an already-extracted DOM subtree in the exact
|
|
8
|
+
# DOM_OUTPUT_START / DOM_OUTPUT_END markers the harness expects.
|
|
9
|
+
#
|
|
10
|
+
# Actual DOM traversal must be done by the caller's browser-automation
|
|
11
|
+
# driver (Playwright / Puppeteer / CDP) since the agent harness controls
|
|
12
|
+
# the browser. Feed the extracted HTML into this script on stdin and its
|
|
13
|
+
# marker-wrapped output goes to stdout.
|
|
14
|
+
#
|
|
15
|
+
# Usage:
|
|
16
|
+
# # 1. Compute the selector for a component
|
|
17
|
+
# <skill_dir>/scripts/extract-dom.sh selector accountTile
|
|
18
|
+
# → c-account-tile
|
|
19
|
+
#
|
|
20
|
+
# # 2. Wrap an app-scope subtree captured by the browser driver
|
|
21
|
+
# printf '%s' "$html_subtree" | <skill_dir>/scripts/extract-dom.sh wrap app
|
|
22
|
+
#
|
|
23
|
+
# # 3. Wrap a component-scope subtree (selector inferred from the name)
|
|
24
|
+
# printf '%s' "$html_subtree" | <skill_dir>/scripts/extract-dom.sh wrap component accountTile
|
|
25
|
+
|
|
26
|
+
set -euo pipefail
|
|
27
|
+
|
|
28
|
+
usage() {
|
|
29
|
+
cat >&2 <<'EOF'
|
|
30
|
+
usage:
|
|
31
|
+
extract-dom.sh selector <componentName>
|
|
32
|
+
extract-dom.sh wrap app
|
|
33
|
+
extract-dom.sh wrap component <componentName>
|
|
34
|
+
EOF
|
|
35
|
+
exit 2
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
to_selector() {
|
|
39
|
+
local name="$1"
|
|
40
|
+
python3 - "$name" <<'PY'
|
|
41
|
+
import re, sys
|
|
42
|
+
name = sys.argv[1]
|
|
43
|
+
kebab = re.sub(r'(?<!^)(?=[A-Z])', '-', name).lower()
|
|
44
|
+
kebab = re.sub(r'[^a-z0-9]+', '-', kebab).strip('-')
|
|
45
|
+
print(f"c-{kebab}")
|
|
46
|
+
PY
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
cmd="${1:-}"
|
|
50
|
+
case "$cmd" in
|
|
51
|
+
selector)
|
|
52
|
+
[[ $# -eq 2 ]] || usage
|
|
53
|
+
to_selector "$2"
|
|
54
|
+
;;
|
|
55
|
+
wrap)
|
|
56
|
+
scope="${2:-}"
|
|
57
|
+
case "$scope" in
|
|
58
|
+
app)
|
|
59
|
+
[[ $# -eq 2 ]] || usage
|
|
60
|
+
printf 'DOM_OUTPUT_START\n'
|
|
61
|
+
cat
|
|
62
|
+
printf '\nDOM_OUTPUT_END\n'
|
|
63
|
+
;;
|
|
64
|
+
component)
|
|
65
|
+
[[ $# -eq 3 ]] || usage
|
|
66
|
+
selector="$(to_selector "$3")"
|
|
67
|
+
printf 'DOM_OUTPUT_START\n<%s>' "$selector"
|
|
68
|
+
cat
|
|
69
|
+
printf '</%s>\nDOM_OUTPUT_END\n' "$selector"
|
|
70
|
+
;;
|
|
71
|
+
*)
|
|
72
|
+
usage
|
|
73
|
+
;;
|
|
74
|
+
esac
|
|
75
|
+
;;
|
|
76
|
+
*)
|
|
77
|
+
usage
|
|
78
|
+
;;
|
|
79
|
+
esac
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Captures the Salesforce front-door URL into a mode-0600 tempfile without
|
|
3
|
+
# printing it to stdout OR stderr, then hands the browser driver the path.
|
|
4
|
+
# This keeps the OTP-bearing URL out of agent tool traces (S1: no auth
|
|
5
|
+
# tokens in context).
|
|
6
|
+
#
|
|
7
|
+
# Usage (capture output first so a helper failure aborts the caller —
|
|
8
|
+
# `eval "$(...)"` alone swallows the helper's nonzero exit status):
|
|
9
|
+
# frontdoor_env="$(scripts/open-frontdoor.sh <org-alias> <preview-url>)" || exit 1
|
|
10
|
+
# eval "$frontdoor_env"
|
|
11
|
+
# # now $FRONTDOOR_URL_FILE and $PREVIEW_URL are exported for children
|
|
12
|
+
#
|
|
13
|
+
# The browser automation driver must read the URL from the tempfile,
|
|
14
|
+
# navigate to it, then delete the file. Do NOT `cat` this file into your
|
|
15
|
+
# agent's stdout.
|
|
16
|
+
|
|
17
|
+
set -euo pipefail
|
|
18
|
+
|
|
19
|
+
if [[ $# -lt 2 ]]; then
|
|
20
|
+
echo "usage: $0 <org-alias> <preview-url>" >&2
|
|
21
|
+
exit 2
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
ORG_ALIAS="$1"
|
|
25
|
+
PREVIEW_URL="$2"
|
|
26
|
+
|
|
27
|
+
TMP_URL_FILE="$(mktemp -t sf-frontdoor.XXXXXX)"
|
|
28
|
+
chmod 600 "$TMP_URL_FILE"
|
|
29
|
+
|
|
30
|
+
# Redirect BOTH stdout and stderr from sf and python3 so no URL fragment,
|
|
31
|
+
# progress message, or JSON error trace can reach the agent's tool-output
|
|
32
|
+
# stream. Only the extracted URL lands in $TMP_URL_FILE.
|
|
33
|
+
if ! sf org open --url-only --json --target-org "$ORG_ALIAS" 2>/dev/null \
|
|
34
|
+
| python3 -c 'import json,sys; print(json.load(sys.stdin)["result"]["url"])' 2>/dev/null \
|
|
35
|
+
> "$TMP_URL_FILE"
|
|
36
|
+
then
|
|
37
|
+
rm -f "$TMP_URL_FILE"
|
|
38
|
+
echo "error: failed to capture front-door URL for org '$ORG_ALIAS'" >&2
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Emit `export` assignments so the caller must `eval` the output to make
|
|
43
|
+
# the variables reach child processes (the browser driver). No token material
|
|
44
|
+
# is printed — only the tempfile path and the preview URL.
|
|
45
|
+
printf 'export FRONTDOOR_URL_FILE=%q\n' "$TMP_URL_FILE"
|
|
46
|
+
printf 'export PREVIEW_URL=%q\n' "$PREVIEW_URL"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Verifies the toolchain required for Lightning Preview: `sf` CLI on PATH,
|
|
3
|
+
# `@salesforce/plugin-lightning-dev` installed, and the specified target
|
|
4
|
+
# org alias authenticated and Connected. Exits nonzero with an actionable
|
|
5
|
+
# message on failure so the agent can surface a single, deterministic
|
|
6
|
+
# error instead of parsing prose from three separate commands.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# <skill_dir>/scripts/verify-toolchain.sh <orgAlias>
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
fail() {
|
|
14
|
+
echo "verify-toolchain: $*" >&2
|
|
15
|
+
exit 1
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if [ "$#" -lt 1 ] || [ -z "${1:-}" ]; then
|
|
19
|
+
fail "usage: $0 <orgAlias>"
|
|
20
|
+
fi
|
|
21
|
+
alias="$1"
|
|
22
|
+
|
|
23
|
+
command -v sf >/dev/null 2>&1 \
|
|
24
|
+
|| fail "Salesforce CLI (\`sf\`) not found on PATH. Install via https://developer.salesforce.com/tools/salesforcecli then re-run."
|
|
25
|
+
|
|
26
|
+
sf version >/dev/null 2>&1 \
|
|
27
|
+
|| fail "\`sf version\` failed. Reinstall the Salesforce CLI."
|
|
28
|
+
|
|
29
|
+
if ! sf plugins --core 2>/dev/null | grep -Eq '(^|[[:space:]])@salesforce/plugin-lightning-dev([[:space:]]|$)'; then
|
|
30
|
+
if ! sf plugins 2>/dev/null | grep -Eq '(^|[[:space:]])@salesforce/plugin-lightning-dev([[:space:]]|$)'; then
|
|
31
|
+
fail "Plugin \`@salesforce/plugin-lightning-dev\` is not installed. Install via: sf plugins install @salesforce/plugin-lightning-dev"
|
|
32
|
+
fi
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if ! sf org display --target-org "$alias" --json 2>/dev/null \
|
|
36
|
+
| python3 -c 'import json,sys
|
|
37
|
+
try:
|
|
38
|
+
d = json.load(sys.stdin)
|
|
39
|
+
except Exception:
|
|
40
|
+
sys.exit(1)
|
|
41
|
+
if d.get("status") != 0:
|
|
42
|
+
sys.exit(1)
|
|
43
|
+
r = d.get("result", {}) or {}
|
|
44
|
+
sys.exit(0 if r.get("connectedStatus") == "Connected" else 1)'; then
|
|
45
|
+
fail "Target org alias \`$alias\` is not authenticated or not Connected. Run \`sf org login web --alias $alias\` and re-run."
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
echo "verify-toolchain: OK ($alias)"
|