@salesforce/afv-skills 1.8.0 → 1.9.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/activating-datacloud/CREDITS.md +5 -0
- package/skills/activating-datacloud/README.md +39 -0
- package/skills/activating-datacloud/SKILL.md +118 -0
- package/skills/analyzing-omnistudio-dependencies/CREDITS.md +5 -0
- package/skills/analyzing-omnistudio-dependencies/SKILL.md +477 -0
- package/skills/analyzing-omnistudio-dependencies/references/dependency-patterns.md +508 -0
- package/skills/analyzing-omnistudio-dependencies/references/namespace-guide.md +300 -0
- package/skills/building-omnistudio-callable-apex/CREDITS.md +9 -0
- package/skills/building-omnistudio-callable-apex/README.md +80 -0
- package/skills/building-omnistudio-callable-apex/SKILL.md +276 -0
- package/skills/building-omnistudio-callable-apex/assets/pattern_callable_openinterface.cls +40 -0
- package/skills/building-omnistudio-callable-apex/assets/pattern_callable_vanilla.cls +32 -0
- package/skills/building-omnistudio-callable-apex/assets/pattern_migration.cls +54 -0
- package/skills/building-omnistudio-callable-apex/assets/pattern_openinterface.cls +45 -0
- package/skills/building-omnistudio-callable-apex/assets/pattern_test_class.cls +65 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_QuoteByProductCallable/IndustriesCallableException.cls +7 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_QuoteByProductCallable/Industries_QuoteByProductCallable.cls +115 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_QuoteByProductCallable/Industries_QuoteByProductCallableTest.cls +189 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_QuoteByProductCallable/TRANSCRIPT.md +115 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterface2Conversion/IndustriesCallableException.cls +7 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterface2Conversion/MyCustomCallable.cls +74 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterface2Conversion/MyCustomCallableTest.cls +146 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterface2Conversion/MyCustomRemoteClass.cls +16 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterface2Conversion/TRANSCRIPT.md +120 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterfaceConversion/IndustriesCallableException.cls +7 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterfaceConversion/MyCustomCallable.cls +73 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterfaceConversion/MyCustomCallableTest.cls +128 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterfaceConversion/MyCustomVlocityOpenInterface2.cls +23 -0
- package/skills/building-omnistudio-callable-apex/examples/Test_VlocityOpenInterfaceConversion/TRANSCRIPT.md +75 -0
- package/skills/building-omnistudio-datamapper/CREDITS.md +5 -0
- package/skills/building-omnistudio-datamapper/SKILL.md +270 -0
- package/skills/building-omnistudio-datamapper/assets/completion-summary-template.md +28 -0
- package/skills/building-omnistudio-datamapper/assets/omni-data-transform-extract.json +6 -0
- package/skills/building-omnistudio-datamapper/assets/omni-data-transform-item.json +12 -0
- package/skills/building-omnistudio-datamapper/assets/omni-data-transform-load.json +6 -0
- package/skills/building-omnistudio-datamapper/assets/omni-data-transform-transform.json +6 -0
- package/skills/building-omnistudio-datamapper/references/best-practices.md +277 -0
- package/skills/building-omnistudio-datamapper/references/naming-conventions.md +145 -0
- package/skills/building-omnistudio-flexcard/CREDITS.md +5 -0
- package/skills/building-omnistudio-flexcard/SKILL.md +325 -0
- package/skills/building-omnistudio-flexcard/assets/omni-ui-card.json +10 -0
- package/skills/building-omnistudio-flexcard/references/best-practices.md +291 -0
- package/skills/building-omnistudio-flexcard/references/data-binding-guide.md +311 -0
- package/skills/building-omnistudio-flexcard/references/scoring-rubric.md +66 -0
- package/skills/building-omnistudio-flexcard/scripts/flexcard-commands.sh +24 -0
- package/skills/building-omnistudio-integration-procedure/CREDITS.md +5 -0
- package/skills/building-omnistudio-integration-procedure/SKILL.md +275 -0
- package/skills/building-omnistudio-integration-procedure/assets/omni-process-element-dr-extract.json +10 -0
- package/skills/building-omnistudio-integration-procedure/assets/omni-process-element-set-values.json +10 -0
- package/skills/building-omnistudio-integration-procedure/assets/omni-process-ip.json +12 -0
- package/skills/building-omnistudio-integration-procedure/assets/scoring-report-format.txt +14 -0
- package/skills/building-omnistudio-integration-procedure/references/best-practices.md +388 -0
- package/skills/building-omnistudio-integration-procedure/references/element-types.md +588 -0
- package/skills/building-omnistudio-integration-procedure/scripts/cli-commands.sh +18 -0
- package/skills/building-omnistudio-omniscript/CREDITS.md +5 -0
- package/skills/building-omnistudio-omniscript/SKILL.md +367 -0
- package/skills/building-omnistudio-omniscript/assets/omni-process-element-step.json +10 -0
- package/skills/building-omnistudio-omniscript/assets/omni-process-element-text-block.json +11 -0
- package/skills/building-omnistudio-omniscript/assets/omni-process-omniscript.json +12 -0
- package/skills/building-omnistudio-omniscript/references/best-practices.md +480 -0
- package/skills/building-omnistudio-omniscript/references/element-types.md +1172 -0
- package/skills/building-omnistudio-omniscript/scripts/check-duplicate-omniscript.sh +13 -0
- package/skills/building-omnistudio-omniscript/scripts/cli-reference.sh +21 -0
- package/skills/building-omnistudio-omniscript/scripts/deploy-omniscript.sh +29 -0
- package/skills/building-sf-integrations/CREDITS.md +5 -0
- package/skills/building-sf-integrations/README.md +95 -0
- package/skills/building-sf-integrations/SKILL.md +192 -0
- package/skills/building-sf-integrations/assets/callouts/callout-retry-handler.cls +167 -0
- package/skills/building-sf-integrations/assets/callouts/http-response-handler.cls +257 -0
- package/skills/building-sf-integrations/assets/callouts/rest-queueable-callout.cls +262 -0
- package/skills/building-sf-integrations/assets/callouts/rest-sync-callout.cls +211 -0
- package/skills/building-sf-integrations/assets/cdc/cdc-handler.cls +246 -0
- package/skills/building-sf-integrations/assets/cdc/cdc-subscriber-trigger.trigger +139 -0
- package/skills/building-sf-integrations/assets/endpoint-security/example.cspTrustedSite-meta.xml +58 -0
- package/skills/building-sf-integrations/assets/endpoint-security/example.remoteSite-meta.xml +39 -0
- package/skills/building-sf-integrations/assets/external-credentials/jwt-external-credential.externalCredential-meta.xml +90 -0
- package/skills/building-sf-integrations/assets/external-credentials/oauth-external-credential.externalCredential-meta.xml +87 -0
- package/skills/building-sf-integrations/assets/external-services/external-service-operations.md +221 -0
- package/skills/building-sf-integrations/assets/external-services/openapi-registration.externalServiceRegistration-meta.xml +193 -0
- package/skills/building-sf-integrations/assets/named-credentials/certificate-auth.namedCredential-meta.xml +62 -0
- package/skills/building-sf-integrations/assets/named-credentials/custom-auth.namedCredential-meta.xml +71 -0
- package/skills/building-sf-integrations/assets/named-credentials/oauth-client-credentials.namedCredential-meta.xml +51 -0
- package/skills/building-sf-integrations/assets/named-credentials/oauth-jwt-bearer.namedCredential-meta.xml +67 -0
- package/skills/building-sf-integrations/assets/platform-events/event-publisher.cls +191 -0
- package/skills/building-sf-integrations/assets/platform-events/event-subscriber-action.cls +295 -0
- package/skills/building-sf-integrations/assets/platform-events/event-subscriber-trigger.trigger +108 -0
- package/skills/building-sf-integrations/assets/platform-events/platform-event-definition.object-meta.xml +124 -0
- package/skills/building-sf-integrations/assets/soap/soap-callout-service.cls +186 -0
- package/skills/building-sf-integrations/assets/soap/wsdl2apex-guide.md +213 -0
- package/skills/building-sf-integrations/hooks/scripts/suggest_credential_setup.py +271 -0
- package/skills/building-sf-integrations/hooks/scripts/validate_integration.py +363 -0
- package/skills/building-sf-integrations/references/callout-patterns.md +719 -0
- package/skills/building-sf-integrations/references/cdc-guide.md +288 -0
- package/skills/building-sf-integrations/references/cli-reference.md +94 -0
- package/skills/building-sf-integrations/references/event-driven-architecture-guide.md +266 -0
- package/skills/building-sf-integrations/references/event-patterns.md +838 -0
- package/skills/building-sf-integrations/references/external-services-guide.md +303 -0
- package/skills/building-sf-integrations/references/messaging-api-v2.md +609 -0
- package/skills/building-sf-integrations/references/named-credentials-automation.md +201 -0
- package/skills/building-sf-integrations/references/named-credentials-guide.md +173 -0
- package/skills/building-sf-integrations/references/platform-events-guide.md +288 -0
- package/skills/building-sf-integrations/references/rest-callout-patterns.md +288 -0
- package/skills/building-sf-integrations/references/scoring-rubric.md +59 -0
- package/skills/building-sf-integrations/references/security-best-practices.md +248 -0
- package/skills/building-sf-integrations/scripts/README.md +100 -0
- package/skills/building-sf-integrations/scripts/configure-named-credential.sh +236 -0
- package/skills/building-sf-integrations/scripts/set-api-credential.sh +146 -0
- package/skills/building-sf-integrations/scripts/templates/setup-credentials-with-csp.sh +158 -0
- package/skills/configuring-connected-apps/CREDITS.md +3 -0
- package/skills/configuring-connected-apps/README.md +99 -0
- package/skills/configuring-connected-apps/SKILL.md +224 -0
- package/skills/configuring-connected-apps/assets/connected-app-basic.xml +29 -0
- package/skills/configuring-connected-apps/assets/connected-app-canvas.xml +62 -0
- package/skills/configuring-connected-apps/assets/connected-app-jwt.xml +49 -0
- package/skills/configuring-connected-apps/assets/connected-app-oauth.xml +65 -0
- package/skills/configuring-connected-apps/assets/eca-global-oauth.xml +36 -0
- package/skills/configuring-connected-apps/assets/eca-oauth-settings.xml +36 -0
- package/skills/configuring-connected-apps/assets/eca-policies.xml +36 -0
- package/skills/configuring-connected-apps/assets/external-client-app.xml +35 -0
- package/skills/configuring-connected-apps/references/example-usage.md +256 -0
- package/skills/configuring-connected-apps/references/migration-guide.md +328 -0
- package/skills/configuring-connected-apps/references/oauth-flows-reference.md +660 -0
- package/skills/configuring-connected-apps/references/security-checklist.md +209 -0
- package/skills/configuring-connected-apps/references/testing-validation-guide.md +275 -0
- package/skills/connecting-datacloud/CREDITS.md +5 -0
- package/skills/connecting-datacloud/README.md +59 -0
- package/skills/connecting-datacloud/SKILL.md +155 -0
- package/skills/connecting-datacloud/examples/connections/heroku-postgres.json +15 -0
- package/skills/connecting-datacloud/examples/connections/ingest-api-connection.json +5 -0
- package/skills/connecting-datacloud/examples/connections/ingest-api-schema.json +31 -0
- package/skills/connecting-datacloud/examples/connections/redshift.json +16 -0
- package/skills/connecting-datacloud/examples/connections/sharepoint-unstructured.json +20 -0
- package/skills/connecting-datacloud/examples/connections/snowflake-connection.json +42 -0
- package/skills/debugging-apex-logs/CREDITS.md +22 -0
- package/skills/debugging-apex-logs/README.md +74 -0
- package/skills/debugging-apex-logs/SKILL.md +172 -0
- package/skills/debugging-apex-logs/assets/benchmarking-template.cls +327 -0
- package/skills/debugging-apex-logs/assets/cpu-heap-optimization.cls +307 -0
- package/skills/debugging-apex-logs/assets/dml-in-loop-fix.cls +219 -0
- package/skills/debugging-apex-logs/assets/null-pointer-fix.cls +252 -0
- package/skills/debugging-apex-logs/assets/soql-in-loop-fix.cls +157 -0
- package/skills/debugging-apex-logs/references/analysis-playbook.md +53 -0
- package/skills/debugging-apex-logs/references/benchmarking-guide.md +287 -0
- package/skills/debugging-apex-logs/references/cli-commands.md +368 -0
- package/skills/debugging-apex-logs/references/common-issues.md +68 -0
- package/skills/debugging-apex-logs/references/debug-log-reference.md +328 -0
- package/skills/debugging-apex-logs/references/log-analysis-tools.md +248 -0
- package/skills/debugging-apex-logs/references/scoring-rubric.md +21 -0
- package/skills/deploying-metadata/CREDITS.md +25 -0
- package/skills/deploying-metadata/README.md +104 -0
- package/skills/deploying-metadata/SKILL.md +214 -0
- package/skills/deploying-metadata/assets/destructiveChanges.xml +143 -0
- package/skills/deploying-metadata/assets/package.xml +121 -0
- package/skills/deploying-metadata/references/agent-deployment-guide.md +628 -0
- package/skills/deploying-metadata/references/deploy.sh +73 -0
- package/skills/deploying-metadata/references/deployment-report-template.md +89 -0
- package/skills/deploying-metadata/references/deployment-workflows.md +395 -0
- package/skills/deploying-metadata/references/orchestration.md +183 -0
- package/skills/deploying-metadata/references/trigger-deployment-safety.md +376 -0
- package/skills/deploying-omnistudio-datapacks/CREDITS.md +5 -0
- package/skills/deploying-omnistudio-datapacks/README.md +88 -0
- package/skills/deploying-omnistudio-datapacks/SKILL.md +174 -0
- package/skills/deploying-omnistudio-datapacks/examples/business-internet-plus-bundle/TRANSCRIPT.md +124 -0
- package/skills/deploying-omnistudio-datapacks/examples/business-internet-plus-bundle/deploy-business-internet-plus-bundle.yaml +11 -0
- package/skills/deploying-omnistudio-datapacks/examples/business-internet-plus-bundle-deploy/TRANSCRIPT.md +142 -0
- package/skills/deploying-omnistudio-datapacks/examples/business-internet-plus-bundle-deploy/deploy-business-internet-plus-bundle.yaml +10 -0
- package/skills/deploying-omnistudio-datapacks/references/job-file-template.md +42 -0
- package/skills/deploying-omnistudio-datapacks/references/troubleshooting-matrix.md +24 -0
- package/skills/developing-agentforce/assets/metadata/http-callout-flow.flow-meta.xml +1 -1
- package/skills/developing-agentforce/references/actions-reference.md +8 -8
- package/skills/fetching-salesforce-docs/README.md +66 -0
- package/skills/fetching-salesforce-docs/SKILL.md +209 -0
- package/skills/fetching-salesforce-docs/requirements.txt +2 -0
- package/skills/fetching-salesforce-docs/scripts/extract_help_salesforce.py +497 -0
- package/skills/fetching-salesforce-docs/scripts/extract_salesforce_doc.py +357 -0
- package/skills/fetching-salesforce-docs/scripts/runtime_bootstrap.py +58 -0
- package/skills/generating-apex/CREDITS.md +1 -26
- package/skills/generating-apex-test/CREDITS.md +2 -27
- package/skills/generating-lwc-components/CREDITS.md +5 -0
- package/skills/generating-lwc-components/README.md +126 -0
- package/skills/generating-lwc-components/SKILL.md +191 -0
- package/skills/generating-lwc-components/assets/apex-controller/LwcController.cls +327 -0
- package/skills/generating-lwc-components/assets/basic-component/basicComponent.css +72 -0
- package/skills/generating-lwc-components/assets/basic-component/basicComponent.html +111 -0
- package/skills/generating-lwc-components/assets/basic-component/basicComponent.js +163 -0
- package/skills/generating-lwc-components/assets/basic-component/basicComponent.js-meta.xml +137 -0
- package/skills/generating-lwc-components/assets/datatable-component/datatableComponent.html +111 -0
- package/skills/generating-lwc-components/assets/datatable-component/datatableComponent.js +367 -0
- package/skills/generating-lwc-components/assets/flow-screen-component/flowScreenComponent.css +63 -0
- package/skills/generating-lwc-components/assets/flow-screen-component/flowScreenComponent.html +154 -0
- package/skills/generating-lwc-components/assets/flow-screen-component/flowScreenComponent.js +348 -0
- package/skills/generating-lwc-components/assets/flow-screen-component/flowScreenComponent.js-meta.xml +87 -0
- package/skills/generating-lwc-components/assets/form-component/formComponent.html +165 -0
- package/skills/generating-lwc-components/assets/form-component/formComponent.js +275 -0
- package/skills/generating-lwc-components/assets/graphql-component/graphqlComponent.html +100 -0
- package/skills/generating-lwc-components/assets/graphql-component/graphqlComponent.js +336 -0
- package/skills/generating-lwc-components/assets/jest-test/componentName.test.js.example +371 -0
- package/skills/generating-lwc-components/assets/message-channel/RecordSelected.messageChannel-meta.xml +71 -0
- package/skills/generating-lwc-components/assets/message-channel/lmsPublisher.js +103 -0
- package/skills/generating-lwc-components/assets/message-channel/lmsSubscriber.js +181 -0
- package/skills/generating-lwc-components/assets/modal-component/modalComponent.html +85 -0
- package/skills/generating-lwc-components/assets/modal-component/modalComponent.js +199 -0
- package/skills/generating-lwc-components/assets/record-picker/recordPicker.html +55 -0
- package/skills/generating-lwc-components/assets/record-picker/recordPicker.js +199 -0
- package/skills/generating-lwc-components/assets/state-store/store.js +282 -0
- package/skills/generating-lwc-components/assets/typescript-component/typescriptComponent.css +65 -0
- package/skills/generating-lwc-components/assets/typescript-component/typescriptComponent.html +95 -0
- package/skills/generating-lwc-components/assets/typescript-component/typescriptComponent.js-meta.xml +75 -0
- package/skills/generating-lwc-components/assets/typescript-component/typescriptComponent.test.ts.example +301 -0
- package/skills/generating-lwc-components/assets/typescript-component/typescriptComponent.ts +295 -0
- package/skills/generating-lwc-components/assets/workspace-api/workspaceComponent.html +71 -0
- package/skills/generating-lwc-components/assets/workspace-api/workspaceComponent.js +316 -0
- package/skills/generating-lwc-components/hooks/scripts/lwc-lsp-validate.py +295 -0
- package/skills/generating-lwc-components/hooks/scripts/post-tool-validate.py +347 -0
- package/skills/generating-lwc-components/hooks/scripts/slds_data/deprecated_patterns.json +74 -0
- package/skills/generating-lwc-components/hooks/scripts/slds_data/styling_hooks.json +111 -0
- package/skills/generating-lwc-components/hooks/scripts/slds_data/valid_slds_classes.json +127 -0
- package/skills/generating-lwc-components/hooks/scripts/slds_linter_wrapper.py +294 -0
- package/skills/generating-lwc-components/hooks/scripts/slds_rules/__init__.py +22 -0
- package/skills/generating-lwc-components/hooks/scripts/template_validator.py +332 -0
- package/skills/generating-lwc-components/hooks/scripts/validate_slds.py +595 -0
- package/skills/generating-lwc-components/references/accessibility-guide.md +843 -0
- package/skills/generating-lwc-components/references/advanced-features.md +108 -0
- package/skills/generating-lwc-components/references/async-notification-patterns.md +661 -0
- package/skills/generating-lwc-components/references/cli-commands.md +545 -0
- package/skills/generating-lwc-components/references/component-patterns.md +1476 -0
- package/skills/generating-lwc-components/references/flow-integration-guide.md +675 -0
- package/skills/generating-lwc-components/references/jest-testing.md +1011 -0
- package/skills/generating-lwc-components/references/lms-guide.md +860 -0
- package/skills/generating-lwc-components/references/lwc-best-practices.md +1310 -0
- package/skills/generating-lwc-components/references/performance-guide.md +861 -0
- package/skills/generating-lwc-components/references/scoring-and-testing.md +116 -0
- package/skills/generating-lwc-components/references/slds-blueprints.json +14389 -0
- package/skills/generating-lwc-components/references/slds-design-guide.md +166 -0
- package/skills/generating-lwc-components/references/state-management.md +642 -0
- package/skills/generating-lwc-components/references/template-anti-patterns.md +948 -0
- package/skills/generating-lwc-components/references/triangle-pattern.md +365 -0
- package/skills/generating-lwc-components/scripts/local-dev-preview.sh +34 -0
- package/skills/generating-mermaid-diagrams/CREDITS.md +46 -0
- package/skills/generating-mermaid-diagrams/README.md +114 -0
- package/skills/generating-mermaid-diagrams/SKILL.md +218 -0
- package/skills/generating-mermaid-diagrams/assets/agentforce/agent-flow.md +313 -0
- package/skills/generating-mermaid-diagrams/assets/architecture/system-landscape.md +351 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/b2b-commerce-erd.md +317 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/campaigns-erd.md +195 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/consent-erd.md +262 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/files-erd.md +266 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/forecasting-erd.md +261 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/fsl-erd.md +332 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/party-model-erd.md +237 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/quote-order-erd.md +277 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/revenue-cloud-erd.md +343 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/sales-cloud-erd.md +192 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/salesforce-erd.md +209 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/scheduler-erd.md +276 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/service-cloud-erd.md +217 -0
- package/skills/generating-mermaid-diagrams/assets/datamodel/territory-management-erd.md +241 -0
- package/skills/generating-mermaid-diagrams/assets/integration/api-sequence.md +387 -0
- package/skills/generating-mermaid-diagrams/assets/oauth/authorization-code-pkce.md +197 -0
- package/skills/generating-mermaid-diagrams/assets/oauth/authorization-code.md +152 -0
- package/skills/generating-mermaid-diagrams/assets/oauth/client-credentials.md +233 -0
- package/skills/generating-mermaid-diagrams/assets/oauth/device-authorization.md +295 -0
- package/skills/generating-mermaid-diagrams/assets/oauth/jwt-bearer.md +256 -0
- package/skills/generating-mermaid-diagrams/assets/oauth/refresh-token.md +281 -0
- package/skills/generating-mermaid-diagrams/assets/oauth/user-agent-social-sign-on.md +281 -0
- package/skills/generating-mermaid-diagrams/assets/role-hierarchy/user-hierarchy.md +322 -0
- package/skills/generating-mermaid-diagrams/references/color-palette.md +464 -0
- package/skills/generating-mermaid-diagrams/references/diagram-conventions.md +313 -0
- package/skills/generating-mermaid-diagrams/references/erd-conventions.md +320 -0
- package/skills/generating-mermaid-diagrams/references/mermaid-reference.md +434 -0
- package/skills/generating-mermaid-diagrams/references/mermaid-styling.md +81 -0
- package/skills/generating-mermaid-diagrams/references/preview-guide.md +49 -0
- package/skills/generating-mermaid-diagrams/references/usage-examples.md +340 -0
- package/skills/generating-mermaid-diagrams/scripts/README.md +160 -0
- package/skills/generating-mermaid-diagrams/scripts/mermaid_preview.py +654 -0
- package/skills/generating-mermaid-diagrams/scripts/query-org-metadata.py +293 -0
- package/skills/generating-visual-diagrams/CREDITS.md +80 -0
- package/skills/generating-visual-diagrams/README.md +83 -0
- package/skills/generating-visual-diagrams/SKILL.md +208 -0
- package/skills/generating-visual-diagrams/assets/architecture/integration-flow.md +55 -0
- package/skills/generating-visual-diagrams/assets/erd/core-objects.md +131 -0
- package/skills/generating-visual-diagrams/assets/erd/custom-objects.md +60 -0
- package/skills/generating-visual-diagrams/assets/lwc/dashboard-card.md +45 -0
- package/skills/generating-visual-diagrams/assets/lwc/data-table.md +57 -0
- package/skills/generating-visual-diagrams/assets/lwc/record-form.md +60 -0
- package/skills/generating-visual-diagrams/assets/review/apex-review.md +57 -0
- package/skills/generating-visual-diagrams/assets/review/lwc-review.md +48 -0
- package/skills/generating-visual-diagrams/references/architect-aesthetic-guide.md +257 -0
- package/skills/generating-visual-diagrams/references/examples-index.md +35 -0
- package/skills/generating-visual-diagrams/references/gemini-cli-setup.md +65 -0
- package/skills/generating-visual-diagrams/references/interview-questions.md +529 -0
- package/skills/generating-visual-diagrams/references/iteration-workflow.md +173 -0
- package/skills/generating-visual-diagrams/scripts/check-prerequisites.sh +101 -0
- package/skills/generating-visual-diagrams/scripts/generate_image.py +243 -0
- package/skills/handling-sf-data/CREDITS.md +5 -0
- package/skills/handling-sf-data/README.md +112 -0
- package/skills/handling-sf-data/SKILL.md +235 -0
- package/skills/handling-sf-data/assets/bulk/bulk-insert-10000.apex +293 -0
- package/skills/handling-sf-data/assets/bulk/bulk-insert-200.apex +208 -0
- package/skills/handling-sf-data/assets/bulk/bulk-insert-500.apex +219 -0
- package/skills/handling-sf-data/assets/bulk/bulk-upsert-external-id.apex +324 -0
- package/skills/handling-sf-data/assets/cleanup/delete-by-created-date.apex +319 -0
- package/skills/handling-sf-data/assets/cleanup/delete-by-name.apex +240 -0
- package/skills/handling-sf-data/assets/cleanup/delete-test-data.apex +311 -0
- package/skills/handling-sf-data/assets/cleanup/rollback-transaction.apex +266 -0
- package/skills/handling-sf-data/assets/csv/account-import.csv +11 -0
- package/skills/handling-sf-data/assets/csv/contact-import.csv +11 -0
- package/skills/handling-sf-data/assets/csv/custom-object-import.csv +11 -0
- package/skills/handling-sf-data/assets/csv/opportunity-import.csv +11 -0
- package/skills/handling-sf-data/assets/factories/account-factory.apex +165 -0
- package/skills/handling-sf-data/assets/factories/case-factory.apex +237 -0
- package/skills/handling-sf-data/assets/factories/contact-factory.apex +168 -0
- package/skills/handling-sf-data/assets/factories/custom-object-factory.apex +260 -0
- package/skills/handling-sf-data/assets/factories/event-factory.apex +275 -0
- package/skills/handling-sf-data/assets/factories/hierarchy-factory.apex +372 -0
- package/skills/handling-sf-data/assets/factories/lead-factory.apex +190 -0
- package/skills/handling-sf-data/assets/factories/opportunity-factory.apex +206 -0
- package/skills/handling-sf-data/assets/factories/task-factory.apex +246 -0
- package/skills/handling-sf-data/assets/factories/user-factory.apex +278 -0
- package/skills/handling-sf-data/assets/json/account-contact-tree.json +130 -0
- package/skills/handling-sf-data/assets/json/account-opportunity-tree.json +110 -0
- package/skills/handling-sf-data/assets/json/full-hierarchy-tree.json +188 -0
- package/skills/handling-sf-data/assets/soql/aggregate.soql +226 -0
- package/skills/handling-sf-data/assets/soql/child-to-parent.soql +162 -0
- package/skills/handling-sf-data/assets/soql/parent-to-child.soql +153 -0
- package/skills/handling-sf-data/assets/soql/polymorphic.soql +198 -0
- package/skills/handling-sf-data/assets/soql/subquery.soql +287 -0
- package/skills/handling-sf-data/references/anonymous-apex-guide.md +98 -0
- package/skills/handling-sf-data/references/bulk-operations-guide.md +94 -0
- package/skills/handling-sf-data/references/bulk-testing-example.md +194 -0
- package/skills/handling-sf-data/references/cleanup-rollback-example.md +322 -0
- package/skills/handling-sf-data/references/cleanup-rollback-guide.md +84 -0
- package/skills/handling-sf-data/references/crud-workflow-example.md +183 -0
- package/skills/handling-sf-data/references/governor-limits-reference.md +74 -0
- package/skills/handling-sf-data/references/orchestration.md +174 -0
- package/skills/handling-sf-data/references/relationship-query-examples.md +249 -0
- package/skills/handling-sf-data/references/sf-cli-data-commands.md +158 -0
- package/skills/handling-sf-data/references/soql-relationship-guide.md +84 -0
- package/skills/handling-sf-data/references/test-data-best-practices.md +104 -0
- package/skills/handling-sf-data/references/test-data-factory-usage.md +290 -0
- package/skills/handling-sf-data/references/test-data-patterns.md +98 -0
- package/skills/handling-sf-data/scripts/soql_validator.py +292 -0
- package/skills/handling-sf-data/scripts/validate_data_operation.py +379 -0
- package/skills/harmonizing-datacloud/CREDITS.md +3 -0
- package/skills/harmonizing-datacloud/README.md +31 -0
- package/skills/harmonizing-datacloud/SKILL.md +117 -0
- package/skills/modeling-omnistudio-epc-catalog/CREDITS.md +14 -0
- package/skills/modeling-omnistudio-epc-catalog/README.md +89 -0
- package/skills/modeling-omnistudio-epc-catalog/SKILL.md +395 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/attribute-assignment-template.json +402 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/compiled-attribute-overrides-template.json +43 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/completion-block-template.txt +8 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/decomposition-relationships-template.json +233 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_AttributeAssignments.json +514 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_CompiledAttributeOverrides.json +21 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_DataPack.json +649 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_DecompositionRelationships.json +200 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_ObjectFieldAttributes.json +138 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_OrchestrationScenarios.json +54 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_OverrideDefinitions.json +266 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_ParentKeys.json +23 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_PriceListEntries.json +54 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_PricebookEntries.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_ProductChildItems.json +34 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-premium-fttc-simple-offer/Business-Internet-Premium-FTTC_RuleAssignments.json +21 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_AttributeAssignments.json +410 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_DataPack.json +535 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_DecompositionRelationships.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_ObjectFieldAttributes.json +138 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_OrchestrationScenarios.json +28 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_ParentKeys.json +23 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_PriceListEntries.json +220 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_PricebookEntries.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/business-internet-pro-vpl-simple-offer/Business-Internet-Pro-VPL_ProductChildItems.json +414 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_AttributeAssignments.json +382 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_DataPack.json +565 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_DecompositionRelationships.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_ObjectFieldAttributes.json +104 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_OrchestrationScenarios.json +28 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_ParentKeys.json +13 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_PriceListEntries.json +106 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_PricebookEntries.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/samsung-galaxy-s22-bundle/Samsung-Galaxy-S22-Bundle_ProductChildItems.json +72 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_AttributeAssignments.json +142 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_DataPack.json +377 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_DecompositionRelationships.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_ObjectFieldAttributes.json +36 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_ParentKeys.json +8 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_PriceListEntries.json +54 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_PricebookEntries.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/examples/static-ip-simple-offer/Static-IP_ProductChildItems.json +34 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/object-field-attributes-template.json +138 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/orchestration-scenarios-template.json +54 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/override-definitions-template.json +134 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/parent-keys-template.json +29 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/price-list-entries-template.json +158 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/pricebook-entries-template.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/product-child-item-template.json +338 -0
- package/skills/modeling-omnistudio-epc-catalog/assets/product2-offer-template.json +527 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/.gitkeep +1 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_AttributeAssignments.json +95 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_CompiledAttributeOverrides.json +1 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_DataPack.json +214 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_DecompositionRelationships.json +28 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_ObjectFieldAttributes.json +98 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_OrchestrationScenarios.json +22 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_OverrideDefinitions.json +1 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_ParentKeys.json +13 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_PriceListEntries.json +35 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_PricebookEntries.json +28 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/Business-Internet-Plus_ProductChildItems.json +110 -0
- package/skills/modeling-omnistudio-epc-catalog/examples/business-internet-plus-bundle/TRANSCRIPT.md +58 -0
- package/skills/modeling-omnistudio-epc-catalog/references/epc-field-guide.md +90 -0
- package/skills/modeling-omnistudio-epc-catalog/references/naming-conventions.md +80 -0
- package/skills/modeling-omnistudio-epc-catalog/references/scoring-model.md +57 -0
- package/skills/modeling-omnistudio-epc-catalog/scripts/cli-validation-commands.sh +19 -0
- package/skills/modeling-omnistudio-epc-catalog/scripts/sample-invocations.sh +18 -0
- package/skills/orchestrating-datacloud/CREDITS.md +15 -0
- package/skills/orchestrating-datacloud/README.md +129 -0
- package/skills/orchestrating-datacloud/SKILL.md +236 -0
- package/skills/orchestrating-datacloud/UPSTREAM.md +45 -0
- package/skills/orchestrating-datacloud/assets/definitions/activation-target.template.json +5 -0
- package/skills/orchestrating-datacloud/assets/definitions/activation.template.json +7 -0
- package/skills/orchestrating-datacloud/assets/definitions/calculated-insight.template.json +7 -0
- package/skills/orchestrating-datacloud/assets/definitions/data-action-target.template.json +5 -0
- package/skills/orchestrating-datacloud/assets/definitions/data-action.template.json +5 -0
- package/skills/orchestrating-datacloud/assets/definitions/data-graph.template.json +21 -0
- package/skills/orchestrating-datacloud/assets/definitions/data-stream.template.json +55 -0
- package/skills/orchestrating-datacloud/assets/definitions/dmo.template.json +17 -0
- package/skills/orchestrating-datacloud/assets/definitions/identity-resolution.template.json +30 -0
- package/skills/orchestrating-datacloud/assets/definitions/mapping.template.json +14 -0
- package/skills/orchestrating-datacloud/assets/definitions/relationship.template.json +12 -0
- package/skills/orchestrating-datacloud/assets/definitions/search-index.template.json +9 -0
- package/skills/orchestrating-datacloud/assets/definitions/segment.template.json +16 -0
- package/skills/orchestrating-datacloud/references/feature-readiness.md +157 -0
- package/skills/orchestrating-datacloud/references/plugin-setup.md +140 -0
- package/skills/orchestrating-datacloud/scripts/bootstrap-plugin.sh +53 -0
- package/skills/orchestrating-datacloud/scripts/diagnose-org.mjs +511 -0
- package/skills/orchestrating-datacloud/scripts/generate-manifest.mjs +68 -0
- package/skills/orchestrating-datacloud/scripts/verify-plugin.sh +58 -0
- package/skills/preparing-datacloud/CREDITS.md +7 -0
- package/skills/preparing-datacloud/README.md +51 -0
- package/skills/preparing-datacloud/SKILL.md +191 -0
- package/skills/preparing-datacloud/examples/ingestion-api/.env.example +8 -0
- package/skills/preparing-datacloud/examples/ingestion-api/README.md +48 -0
- package/skills/preparing-datacloud/examples/ingestion-api/send-data.py +144 -0
- package/skills/querying-soql/CREDITS.md +21 -0
- package/skills/querying-soql/README.md +41 -0
- package/skills/querying-soql/SKILL.md +143 -0
- package/skills/querying-soql/assets/aggregate-queries.soql +242 -0
- package/skills/querying-soql/assets/basic-queries.soql +188 -0
- package/skills/querying-soql/assets/bulkified-query-pattern.cls +280 -0
- package/skills/querying-soql/assets/optimization-patterns.soql +259 -0
- package/skills/querying-soql/assets/relationship-queries.soql +203 -0
- package/skills/querying-soql/assets/selector-class.cls +219 -0
- package/skills/querying-soql/references/anti-patterns.md +348 -0
- package/skills/querying-soql/references/cli-commands.md +358 -0
- package/skills/querying-soql/references/field-coverage-rules.md +514 -0
- package/skills/querying-soql/references/query-optimization.md +142 -0
- package/skills/querying-soql/references/selector-patterns.md +479 -0
- package/skills/querying-soql/references/soql-reference.md +227 -0
- package/skills/querying-soql/references/soql-syntax-reference.md +208 -0
- package/skills/querying-soql/scripts/post-tool-validate.py +322 -0
- package/skills/retrieving-datacloud/CREDITS.md +7 -0
- package/skills/retrieving-datacloud/README.md +44 -0
- package/skills/retrieving-datacloud/SKILL.md +120 -0
- package/skills/retrieving-datacloud/examples/search-indexes/hybrid-structured.json +44 -0
- package/skills/retrieving-datacloud/examples/search-indexes/vector-knowledge.json +43 -0
- package/skills/running-apex-tests/CREDITS.md +22 -0
- package/skills/running-apex-tests/README.md +94 -0
- package/skills/running-apex-tests/SKILL.md +158 -0
- package/skills/running-apex-tests/assets/basic-test.cls +169 -0
- package/skills/running-apex-tests/assets/bulk-test.cls +255 -0
- package/skills/running-apex-tests/assets/dml-mock.cls +339 -0
- package/skills/running-apex-tests/assets/mock-callout-test.cls +353 -0
- package/skills/running-apex-tests/assets/stub-provider-example.cls +364 -0
- package/skills/running-apex-tests/assets/test-data-factory.cls +328 -0
- package/skills/running-apex-tests/hooks/scripts/parse-test-results.py +364 -0
- package/skills/running-apex-tests/references/cli-commands.md +289 -0
- package/skills/running-apex-tests/references/mocking-patterns.md +500 -0
- package/skills/running-apex-tests/references/performance-optimization.md +283 -0
- package/skills/running-apex-tests/references/test-fix-loop.md +49 -0
- package/skills/running-apex-tests/references/test-patterns.md +154 -0
- package/skills/running-apex-tests/references/testing-best-practices.md +509 -0
- package/skills/segmenting-datacloud/CREDITS.md +3 -0
- package/skills/segmenting-datacloud/README.md +36 -0
- package/skills/segmenting-datacloud/SKILL.md +115 -0
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
SLDS 2 Validator for Lightning Web Components.
|
|
4
|
+
|
|
5
|
+
Provides a 165-point scoring system across 9 categories:
|
|
6
|
+
1. SLDS Class Usage (25 pts) - Valid SLDS 2 utility classes
|
|
7
|
+
2. Accessibility (25 pts) - aria-*, role, alt-text
|
|
8
|
+
3. Dark Mode (25 pts) - No hardcoded colors, uses CSS variables
|
|
9
|
+
4. SLDS Migration (20 pts) - No deprecated SLDS 1 patterns
|
|
10
|
+
5. Styling Hooks (20 pts) - Proper --slds-g-* variable usage
|
|
11
|
+
6. Component Structure (15 pts) - Uses lightning-* base components
|
|
12
|
+
7. Performance (10 pts) - Efficient selectors, no !important
|
|
13
|
+
8. GraphQL Patterns (15 pts) - Proper wire adapter usage, cursor pagination
|
|
14
|
+
9. Focus Management (10 pts) - ESC handlers, focus trap for modals
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
import re
|
|
19
|
+
import json
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
from typing import Dict, List, Any, Optional
|
|
22
|
+
|
|
23
|
+
# Script directory for loading data files
|
|
24
|
+
SCRIPT_DIR = Path(__file__).parent
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class SLDSValidator:
|
|
28
|
+
"""SLDS 2 validation engine for LWC files."""
|
|
29
|
+
|
|
30
|
+
# Maximum scores per category (165 total)
|
|
31
|
+
max_scores = {
|
|
32
|
+
'slds_class_usage': 25,
|
|
33
|
+
'accessibility': 25,
|
|
34
|
+
'dark_mode': 25,
|
|
35
|
+
'slds_migration': 20,
|
|
36
|
+
'styling_hooks': 20,
|
|
37
|
+
'component_structure': 15,
|
|
38
|
+
'performance': 10,
|
|
39
|
+
'graphql_patterns': 15,
|
|
40
|
+
'focus_management': 10,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
def __init__(self, file_path: str):
|
|
44
|
+
"""
|
|
45
|
+
Initialize validator with file path.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
file_path: Path to .html, .css, or .js file
|
|
49
|
+
"""
|
|
50
|
+
self.file_path = file_path
|
|
51
|
+
self.file_name = os.path.basename(file_path)
|
|
52
|
+
self.ext = Path(file_path).suffix.lower()
|
|
53
|
+
self.content = ""
|
|
54
|
+
self.lines = []
|
|
55
|
+
|
|
56
|
+
# Load file content
|
|
57
|
+
try:
|
|
58
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
59
|
+
self.content = f.read()
|
|
60
|
+
self.lines = self.content.splitlines()
|
|
61
|
+
except Exception:
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
# Load validation data
|
|
65
|
+
self._load_data()
|
|
66
|
+
|
|
67
|
+
def _load_data(self):
|
|
68
|
+
"""Load JSON data files for validation rules."""
|
|
69
|
+
data_dir = SCRIPT_DIR / 'slds_data'
|
|
70
|
+
|
|
71
|
+
# Valid SLDS classes
|
|
72
|
+
self.valid_slds_classes = set()
|
|
73
|
+
try:
|
|
74
|
+
with open(data_dir / 'valid_slds_classes.json', 'r') as f:
|
|
75
|
+
data = json.load(f)
|
|
76
|
+
for category_classes in data.values():
|
|
77
|
+
if isinstance(category_classes, list):
|
|
78
|
+
self.valid_slds_classes.update(category_classes)
|
|
79
|
+
except Exception:
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
# Deprecated patterns
|
|
83
|
+
self.deprecated_patterns = {}
|
|
84
|
+
try:
|
|
85
|
+
with open(data_dir / 'deprecated_patterns.json', 'r') as f:
|
|
86
|
+
self.deprecated_patterns = json.load(f)
|
|
87
|
+
except Exception:
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
# Valid styling hooks
|
|
91
|
+
self.valid_hooks = set()
|
|
92
|
+
try:
|
|
93
|
+
with open(data_dir / 'styling_hooks.json', 'r') as f:
|
|
94
|
+
data = json.load(f)
|
|
95
|
+
for category_hooks in data.values():
|
|
96
|
+
if isinstance(category_hooks, list):
|
|
97
|
+
self.valid_hooks.update(category_hooks)
|
|
98
|
+
except Exception:
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
def validate(self) -> Dict[str, Any]:
|
|
102
|
+
"""
|
|
103
|
+
Run all validations and return results.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
dict with score, max_score, scores by category, issues, and rating
|
|
107
|
+
"""
|
|
108
|
+
scores = {cat: max_score for cat, max_score in self.max_scores.items()}
|
|
109
|
+
issues = []
|
|
110
|
+
|
|
111
|
+
if not self.content:
|
|
112
|
+
return {
|
|
113
|
+
'score': 0,
|
|
114
|
+
'max_score': sum(self.max_scores.values()),
|
|
115
|
+
'scores': scores,
|
|
116
|
+
'issues': [{'severity': 'CRITICAL', 'message': 'Could not read file'}],
|
|
117
|
+
'rating': 'Error'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
# Run validators based on file type
|
|
121
|
+
if self.ext == '.html':
|
|
122
|
+
self._validate_html(scores, issues)
|
|
123
|
+
elif self.ext == '.css':
|
|
124
|
+
self._validate_css(scores, issues)
|
|
125
|
+
elif self.ext == '.js':
|
|
126
|
+
self._validate_js(scores, issues)
|
|
127
|
+
|
|
128
|
+
# Calculate total score
|
|
129
|
+
total_score = sum(scores.values())
|
|
130
|
+
max_total = sum(self.max_scores.values())
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
'score': total_score,
|
|
134
|
+
'max_score': max_total,
|
|
135
|
+
'scores': scores,
|
|
136
|
+
'issues': issues,
|
|
137
|
+
'rating': self._get_rating(total_score, max_total)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
def _get_rating(self, score: int, max_score: int) -> str:
|
|
141
|
+
"""Get rating string from score."""
|
|
142
|
+
pct = (score / max_score * 100) if max_score > 0 else 0
|
|
143
|
+
if pct >= 90:
|
|
144
|
+
return "Production-ready SLDS 2"
|
|
145
|
+
elif pct >= 80:
|
|
146
|
+
return "Good"
|
|
147
|
+
elif pct >= 70:
|
|
148
|
+
return "Functional"
|
|
149
|
+
elif pct >= 60:
|
|
150
|
+
return "Needs work"
|
|
151
|
+
else:
|
|
152
|
+
return "Critical issues"
|
|
153
|
+
|
|
154
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
155
|
+
# HTML VALIDATION
|
|
156
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
157
|
+
|
|
158
|
+
def _validate_html(self, scores: Dict[str, int], issues: List[Dict]):
|
|
159
|
+
"""Validate HTML template file."""
|
|
160
|
+
self._check_slds_classes(scores, issues)
|
|
161
|
+
self._check_accessibility(scores, issues)
|
|
162
|
+
self._check_component_structure(scores, issues)
|
|
163
|
+
|
|
164
|
+
def _check_slds_classes(self, scores: Dict[str, int], issues: List[Dict]):
|
|
165
|
+
"""Check SLDS class usage in HTML."""
|
|
166
|
+
# Find all class attributes
|
|
167
|
+
class_pattern = r'class\s*=\s*["\']([^"\']+)["\']'
|
|
168
|
+
|
|
169
|
+
for i, line in enumerate(self.lines, 1):
|
|
170
|
+
matches = re.findall(class_pattern, line)
|
|
171
|
+
for class_attr in matches:
|
|
172
|
+
classes = class_attr.split()
|
|
173
|
+
for cls in classes:
|
|
174
|
+
if cls.startswith('slds-'):
|
|
175
|
+
# Check if it's a valid SLDS class
|
|
176
|
+
if self.valid_slds_classes and cls not in self.valid_slds_classes:
|
|
177
|
+
# Allow pattern-based classes we might not have in our list
|
|
178
|
+
if not self._is_valid_slds_pattern(cls):
|
|
179
|
+
scores['slds_class_usage'] = max(0, scores['slds_class_usage'] - 2)
|
|
180
|
+
issues.append({
|
|
181
|
+
'severity': 'WARNING',
|
|
182
|
+
'category': 'slds_class_usage',
|
|
183
|
+
'message': f"Unknown SLDS class: {cls}",
|
|
184
|
+
'line': i,
|
|
185
|
+
'fix': f"Verify '{cls}' is a valid SLDS 2 class"
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
def _is_valid_slds_pattern(self, cls: str) -> bool:
|
|
189
|
+
"""Check if class matches valid SLDS naming patterns."""
|
|
190
|
+
patterns = [
|
|
191
|
+
r'^slds-p-(around|horizontal|vertical|left|right|top|bottom)_',
|
|
192
|
+
r'^slds-m-(around|horizontal|vertical|left|right|top|bottom)_',
|
|
193
|
+
r'^slds-size_\d+-of-\d+$',
|
|
194
|
+
# Responsive sizing: slds-small-size_, slds-medium-size_, slds-large-size_
|
|
195
|
+
r'^slds-(small|medium|large|max-small|max-medium|max-large)-size_\d+-of-\d+$',
|
|
196
|
+
r'^slds-text-(heading|body|color|align)_',
|
|
197
|
+
r'^slds-grid(_|$)',
|
|
198
|
+
r'^slds-col(_|$)',
|
|
199
|
+
r'^slds-button(_|$)',
|
|
200
|
+
r'^slds-input(_|$)',
|
|
201
|
+
r'^slds-form(_|$)',
|
|
202
|
+
r'^slds-card(_|$)',
|
|
203
|
+
r'^slds-modal(_|$)',
|
|
204
|
+
r'^slds-notify(_|$)',
|
|
205
|
+
r'^slds-illustration(_|$)',
|
|
206
|
+
r'^slds-table(_|$)',
|
|
207
|
+
r'^slds-box(_|$)',
|
|
208
|
+
r'^slds-badge(_|$)',
|
|
209
|
+
r'^slds-spinner(_|$)',
|
|
210
|
+
r'^slds-alert(_|$)',
|
|
211
|
+
# Utility patterns
|
|
212
|
+
r'^slds-has-',
|
|
213
|
+
r'^slds-no-',
|
|
214
|
+
r'^slds-var-',
|
|
215
|
+
r'^slds-is-',
|
|
216
|
+
r'^slds-theme_',
|
|
217
|
+
r'^slds-icon(_|$)',
|
|
218
|
+
r'^slds-media(_|$)',
|
|
219
|
+
r'^slds-list(_|$)',
|
|
220
|
+
r'^slds-tile(_|$)',
|
|
221
|
+
r'^slds-popover(_|$)',
|
|
222
|
+
r'^slds-dropdown(_|$)',
|
|
223
|
+
r'^slds-tabs_',
|
|
224
|
+
r'^slds-path(_|$)',
|
|
225
|
+
r'^slds-progress(_|$)',
|
|
226
|
+
]
|
|
227
|
+
return any(re.match(p, cls) for p in patterns)
|
|
228
|
+
|
|
229
|
+
def _check_accessibility(self, scores: Dict[str, int], issues: List[Dict]):
|
|
230
|
+
"""Check accessibility requirements in HTML."""
|
|
231
|
+
content = self.content
|
|
232
|
+
|
|
233
|
+
# Check lightning-icon without alternative-text
|
|
234
|
+
icon_pattern = r'<lightning-icon[^>]*>'
|
|
235
|
+
for i, line in enumerate(self.lines, 1):
|
|
236
|
+
for match in re.finditer(icon_pattern, line):
|
|
237
|
+
icon_tag = match.group(0)
|
|
238
|
+
if 'alternative-text' not in icon_tag:
|
|
239
|
+
scores['accessibility'] = max(0, scores['accessibility'] - 3)
|
|
240
|
+
issues.append({
|
|
241
|
+
'severity': 'WARNING',
|
|
242
|
+
'category': 'accessibility',
|
|
243
|
+
'message': 'lightning-icon missing alternative-text attribute',
|
|
244
|
+
'line': i,
|
|
245
|
+
'fix': 'Add alternative-text="description" for screen readers'
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
# Check lightning-button-icon without label
|
|
249
|
+
button_icon_pattern = r'<lightning-button-icon[^>]*>'
|
|
250
|
+
for i, line in enumerate(self.lines, 1):
|
|
251
|
+
for match in re.finditer(button_icon_pattern, line):
|
|
252
|
+
tag = match.group(0)
|
|
253
|
+
if 'aria-label' not in tag and 'alternative-text' not in tag:
|
|
254
|
+
scores['accessibility'] = max(0, scores['accessibility'] - 3)
|
|
255
|
+
issues.append({
|
|
256
|
+
'severity': 'WARNING',
|
|
257
|
+
'category': 'accessibility',
|
|
258
|
+
'message': 'lightning-button-icon missing aria-label or alternative-text',
|
|
259
|
+
'line': i,
|
|
260
|
+
'fix': 'Add aria-label="action description" for accessibility'
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
# Check for slds-assistive-text usage (good practice)
|
|
264
|
+
if 'slds-assistive-text' not in content and 'aria-live' not in content:
|
|
265
|
+
# Only deduct if there's dynamic content indicators
|
|
266
|
+
if '{' in content and '}' in content:
|
|
267
|
+
scores['accessibility'] = max(0, scores['accessibility'] - 2)
|
|
268
|
+
issues.append({
|
|
269
|
+
'severity': 'INFO',
|
|
270
|
+
'category': 'accessibility',
|
|
271
|
+
'message': 'Consider adding aria-live for dynamic content updates',
|
|
272
|
+
'line': 0,
|
|
273
|
+
'fix': 'Use aria-live="polite" for status updates'
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
def _check_component_structure(self, scores: Dict[str, int], issues: List[Dict]):
|
|
277
|
+
"""Check component structure for SLDS compliance."""
|
|
278
|
+
# Check for lightning-* base components (good)
|
|
279
|
+
lightning_components = re.findall(r'<lightning-[a-z-]+', self.content)
|
|
280
|
+
if not lightning_components:
|
|
281
|
+
scores['component_structure'] = max(0, scores['component_structure'] - 5)
|
|
282
|
+
issues.append({
|
|
283
|
+
'severity': 'INFO',
|
|
284
|
+
'category': 'component_structure',
|
|
285
|
+
'message': 'No lightning-* base components found',
|
|
286
|
+
'line': 0,
|
|
287
|
+
'fix': 'Consider using lightning-* components for SLDS consistency'
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
291
|
+
# CSS VALIDATION
|
|
292
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
293
|
+
|
|
294
|
+
def _validate_css(self, scores: Dict[str, int], issues: List[Dict]):
|
|
295
|
+
"""Validate CSS file."""
|
|
296
|
+
self._check_dark_mode(scores, issues)
|
|
297
|
+
self._check_styling_hooks(scores, issues)
|
|
298
|
+
self._check_slds_migration(scores, issues)
|
|
299
|
+
self._check_css_performance(scores, issues)
|
|
300
|
+
|
|
301
|
+
def _check_dark_mode(self, scores: Dict[str, int], issues: List[Dict]):
|
|
302
|
+
"""Check for dark mode compatibility (no hardcoded colors)."""
|
|
303
|
+
# Patterns for hardcoded colors
|
|
304
|
+
color_patterns = [
|
|
305
|
+
(r'#[0-9A-Fa-f]{3,8}(?![0-9A-Fa-f])', 'hex color'),
|
|
306
|
+
(r'rgb\s*\([^)]+\)', 'RGB color'),
|
|
307
|
+
(r'rgba\s*\([^)]+\)', 'RGBA color'),
|
|
308
|
+
(r'hsl\s*\([^)]+\)', 'HSL color'),
|
|
309
|
+
(r'hsla\s*\([^)]+\)', 'HSLA color'),
|
|
310
|
+
]
|
|
311
|
+
|
|
312
|
+
for i, line in enumerate(self.lines, 1):
|
|
313
|
+
# Skip comments
|
|
314
|
+
if line.strip().startswith('/*') or line.strip().startswith('//'):
|
|
315
|
+
continue
|
|
316
|
+
|
|
317
|
+
# Skip if it's inside a var() - that's allowed
|
|
318
|
+
line_without_vars = re.sub(r'var\s*\([^)]+\)', '', line)
|
|
319
|
+
|
|
320
|
+
for pattern, color_type in color_patterns:
|
|
321
|
+
matches = re.findall(pattern, line_without_vars)
|
|
322
|
+
for match in matches:
|
|
323
|
+
# Skip transparent and common exceptions
|
|
324
|
+
if match.lower() in ['#fff', '#ffffff', '#000', '#000000']:
|
|
325
|
+
scores['dark_mode'] = max(0, scores['dark_mode'] - 5)
|
|
326
|
+
issues.append({
|
|
327
|
+
'severity': 'HIGH',
|
|
328
|
+
'category': 'dark_mode',
|
|
329
|
+
'message': f'Hardcoded {color_type} ({match}) breaks dark mode',
|
|
330
|
+
'line': i,
|
|
331
|
+
'fix': f'Use var(--slds-g-color-*) instead of {match}'
|
|
332
|
+
})
|
|
333
|
+
elif match.lower() not in ['transparent', 'inherit', 'currentcolor']:
|
|
334
|
+
scores['dark_mode'] = max(0, scores['dark_mode'] - 3)
|
|
335
|
+
issues.append({
|
|
336
|
+
'severity': 'MODERATE',
|
|
337
|
+
'category': 'dark_mode',
|
|
338
|
+
'message': f'Hardcoded {color_type} ({match}) may break dark mode',
|
|
339
|
+
'line': i,
|
|
340
|
+
'fix': f'Consider using var(--slds-g-color-*) instead'
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
def _check_styling_hooks(self, scores: Dict[str, int], issues: List[Dict]):
|
|
344
|
+
"""Check for proper SLDS 2 styling hooks usage."""
|
|
345
|
+
# Find all CSS variable references
|
|
346
|
+
var_pattern = r'var\s*\(\s*(--[a-zA-Z0-9-]+)'
|
|
347
|
+
|
|
348
|
+
for i, line in enumerate(self.lines, 1):
|
|
349
|
+
matches = re.findall(var_pattern, line)
|
|
350
|
+
for var_name in matches:
|
|
351
|
+
# Check if it's an SLDS variable
|
|
352
|
+
if var_name.startswith('--slds-'):
|
|
353
|
+
# SLDS 2 global hooks use --slds-g-
|
|
354
|
+
if var_name.startswith('--slds-c-'):
|
|
355
|
+
scores['styling_hooks'] = max(0, scores['styling_hooks'] - 3)
|
|
356
|
+
issues.append({
|
|
357
|
+
'severity': 'WARNING',
|
|
358
|
+
'category': 'styling_hooks',
|
|
359
|
+
'message': f'Component hooks ({var_name}) not yet supported in SLDS 2',
|
|
360
|
+
'line': i,
|
|
361
|
+
'fix': 'Use --slds-g-* global hooks or wait for SLDS 2 component hook support'
|
|
362
|
+
})
|
|
363
|
+
elif not var_name.startswith('--slds-g-'):
|
|
364
|
+
scores['styling_hooks'] = max(0, scores['styling_hooks'] - 2)
|
|
365
|
+
issues.append({
|
|
366
|
+
'severity': 'INFO',
|
|
367
|
+
'category': 'styling_hooks',
|
|
368
|
+
'message': f'Non-standard SLDS variable: {var_name}',
|
|
369
|
+
'line': i,
|
|
370
|
+
'fix': 'Use --slds-g-* for SLDS 2 compatibility'
|
|
371
|
+
})
|
|
372
|
+
|
|
373
|
+
def _check_slds_migration(self, scores: Dict[str, int], issues: List[Dict]):
|
|
374
|
+
"""Check for deprecated SLDS 1 patterns."""
|
|
375
|
+
deprecated_tokens = self.deprecated_patterns.get('tokens', {})
|
|
376
|
+
deprecated_classes = self.deprecated_patterns.get('classes', {})
|
|
377
|
+
|
|
378
|
+
for i, line in enumerate(self.lines, 1):
|
|
379
|
+
# Check deprecated Sass tokens
|
|
380
|
+
for old_token, replacement in deprecated_tokens.items():
|
|
381
|
+
if old_token in line:
|
|
382
|
+
scores['slds_migration'] = max(0, scores['slds_migration'] - 5)
|
|
383
|
+
issues.append({
|
|
384
|
+
'severity': 'HIGH',
|
|
385
|
+
'category': 'slds_migration',
|
|
386
|
+
'message': f'Deprecated SLDS 1 token: {old_token}',
|
|
387
|
+
'line': i,
|
|
388
|
+
'fix': f'Replace with {replacement}'
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
# Check --lwc- prefix (old format)
|
|
392
|
+
if '--lwc-' in line:
|
|
393
|
+
scores['slds_migration'] = max(0, scores['slds_migration'] - 3)
|
|
394
|
+
issues.append({
|
|
395
|
+
'severity': 'MODERATE',
|
|
396
|
+
'category': 'slds_migration',
|
|
397
|
+
'message': 'Old --lwc-* token format detected',
|
|
398
|
+
'line': i,
|
|
399
|
+
'fix': 'Migrate to --slds-g-* styling hooks'
|
|
400
|
+
})
|
|
401
|
+
|
|
402
|
+
def _check_css_performance(self, scores: Dict[str, int], issues: List[Dict]):
|
|
403
|
+
"""Check for CSS performance issues."""
|
|
404
|
+
for i, line in enumerate(self.lines, 1):
|
|
405
|
+
# Check for !important
|
|
406
|
+
if '!important' in line:
|
|
407
|
+
scores['performance'] = max(0, scores['performance'] - 3)
|
|
408
|
+
issues.append({
|
|
409
|
+
'severity': 'WARNING',
|
|
410
|
+
'category': 'performance',
|
|
411
|
+
'message': '!important override detected',
|
|
412
|
+
'line': i,
|
|
413
|
+
'fix': 'Avoid !important; use more specific selectors or SLDS utilities'
|
|
414
|
+
})
|
|
415
|
+
|
|
416
|
+
# Check for overly deep selectors (> 3 levels)
|
|
417
|
+
selector_pattern = r'^[^{]+{'
|
|
418
|
+
for i, line in enumerate(self.lines, 1):
|
|
419
|
+
if '{' in line:
|
|
420
|
+
# Count selector depth
|
|
421
|
+
selector = line.split('{')[0]
|
|
422
|
+
depth = len(re.findall(r'\s+', selector.strip()))
|
|
423
|
+
if depth > 3:
|
|
424
|
+
scores['performance'] = max(0, scores['performance'] - 2)
|
|
425
|
+
issues.append({
|
|
426
|
+
'severity': 'INFO',
|
|
427
|
+
'category': 'performance',
|
|
428
|
+
'message': 'Deep CSS selector detected (>3 levels)',
|
|
429
|
+
'line': i,
|
|
430
|
+
'fix': 'Simplify selector for better performance'
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
434
|
+
# JAVASCRIPT VALIDATION
|
|
435
|
+
# ═══════════════════════════════════════════════════════════════════════
|
|
436
|
+
|
|
437
|
+
def _validate_js(self, scores: Dict[str, int], issues: List[Dict]):
|
|
438
|
+
"""Validate JavaScript controller file."""
|
|
439
|
+
# JS files have limited SLDS-specific validation
|
|
440
|
+
# Focus on inline styles, classList manipulation, GraphQL, and focus management
|
|
441
|
+
|
|
442
|
+
for i, line in enumerate(self.lines, 1):
|
|
443
|
+
# Check for inline style manipulation with colors
|
|
444
|
+
if '.style.' in line and any(c in line.lower() for c in ['color', 'background', 'border']):
|
|
445
|
+
if re.search(r'#[0-9A-Fa-f]{3,8}|rgb\s*\(', line):
|
|
446
|
+
scores['dark_mode'] = max(0, scores['dark_mode'] - 5)
|
|
447
|
+
issues.append({
|
|
448
|
+
'severity': 'HIGH',
|
|
449
|
+
'category': 'dark_mode',
|
|
450
|
+
'message': 'Inline style with hardcoded color detected',
|
|
451
|
+
'line': i,
|
|
452
|
+
'fix': 'Use CSS classes or CSS variables instead of inline styles'
|
|
453
|
+
})
|
|
454
|
+
|
|
455
|
+
# Check for classList with invalid SLDS classes
|
|
456
|
+
if 'classList' in line and 'slds-' in line:
|
|
457
|
+
# Extract class names from string literals
|
|
458
|
+
classes = re.findall(r'["\']([slds-][^"\']+)["\']', line)
|
|
459
|
+
for cls in classes:
|
|
460
|
+
if cls.startswith('slds-') and self.valid_slds_classes and cls not in self.valid_slds_classes:
|
|
461
|
+
if not self._is_valid_slds_pattern(cls):
|
|
462
|
+
scores['slds_class_usage'] = max(0, scores['slds_class_usage'] - 2)
|
|
463
|
+
issues.append({
|
|
464
|
+
'severity': 'WARNING',
|
|
465
|
+
'category': 'slds_class_usage',
|
|
466
|
+
'message': f"Unknown SLDS class in JS: {cls}",
|
|
467
|
+
'line': i,
|
|
468
|
+
'fix': f"Verify '{cls}' is a valid SLDS 2 class"
|
|
469
|
+
})
|
|
470
|
+
|
|
471
|
+
# Check GraphQL patterns
|
|
472
|
+
self._check_graphql_patterns(scores, issues)
|
|
473
|
+
|
|
474
|
+
# Check focus management patterns
|
|
475
|
+
self._check_focus_management(scores, issues)
|
|
476
|
+
|
|
477
|
+
def _check_graphql_patterns(self, scores: Dict[str, int], issues: List[Dict]):
|
|
478
|
+
"""Check for proper GraphQL wire adapter usage."""
|
|
479
|
+
content = self.content
|
|
480
|
+
|
|
481
|
+
# Check if using GraphQL wire adapter
|
|
482
|
+
has_graphql_import = 'lightning/uiGraphQLApi' in content
|
|
483
|
+
has_gql_import = "import { gql" in content or "import { graphql" in content
|
|
484
|
+
|
|
485
|
+
if has_graphql_import or has_gql_import:
|
|
486
|
+
# Verify proper patterns
|
|
487
|
+
|
|
488
|
+
# Check for storing wire result for refresh
|
|
489
|
+
if '@wire(graphql' in content or '@wire(gql' in content:
|
|
490
|
+
# Check if result is stored for refreshGraphQL
|
|
491
|
+
if 'refreshGraphQL' in content:
|
|
492
|
+
# Good pattern - using refreshGraphQL
|
|
493
|
+
pass
|
|
494
|
+
else:
|
|
495
|
+
# Check if the wire is used with a function that stores result
|
|
496
|
+
wire_pattern = r'@wire\s*\(\s*graphql[^)]*\)\s*(\w+)'
|
|
497
|
+
matches = re.findall(wire_pattern, content)
|
|
498
|
+
for match in matches:
|
|
499
|
+
# If it's a function pattern, check if it stores result
|
|
500
|
+
if f'wired{match[0].upper()}' not in content and 'Result' not in match:
|
|
501
|
+
scores['graphql_patterns'] = max(0, scores['graphql_patterns'] - 5)
|
|
502
|
+
issues.append({
|
|
503
|
+
'severity': 'INFO',
|
|
504
|
+
'category': 'graphql_patterns',
|
|
505
|
+
'message': 'GraphQL wire result not stored for potential refresh',
|
|
506
|
+
'line': 0,
|
|
507
|
+
'fix': 'Store wire result in a property for use with refreshGraphQL()'
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
# Check for cursor-based pagination pattern
|
|
511
|
+
if 'first:' in content and 'after:' not in content and 'pageInfo' not in content:
|
|
512
|
+
scores['graphql_patterns'] = max(0, scores['graphql_patterns'] - 3)
|
|
513
|
+
issues.append({
|
|
514
|
+
'severity': 'INFO',
|
|
515
|
+
'category': 'graphql_patterns',
|
|
516
|
+
'message': 'GraphQL query uses first: but missing pagination',
|
|
517
|
+
'line': 0,
|
|
518
|
+
'fix': 'Add pageInfo { hasNextPage endCursor } for cursor pagination'
|
|
519
|
+
})
|
|
520
|
+
|
|
521
|
+
# Check for proper error handling
|
|
522
|
+
if 'graphQLErrors' not in content and '.errors' not in content:
|
|
523
|
+
scores['graphql_patterns'] = max(0, scores['graphql_patterns'] - 2)
|
|
524
|
+
issues.append({
|
|
525
|
+
'severity': 'INFO',
|
|
526
|
+
'category': 'graphql_patterns',
|
|
527
|
+
'message': 'GraphQL error handling not detected',
|
|
528
|
+
'line': 0,
|
|
529
|
+
'fix': 'Handle graphQLErrors in wire result or catch block'
|
|
530
|
+
})
|
|
531
|
+
|
|
532
|
+
def _check_focus_management(self, scores: Dict[str, int], issues: List[Dict]):
|
|
533
|
+
"""Check for proper focus management patterns in modals/dialogs."""
|
|
534
|
+
content = self.content
|
|
535
|
+
|
|
536
|
+
# Check if this appears to be a modal component
|
|
537
|
+
is_modal = any(indicator in content.lower() for indicator in [
|
|
538
|
+
'modal', 'dialog', 'overlay', 'popup', 'backdrop'
|
|
539
|
+
])
|
|
540
|
+
|
|
541
|
+
if is_modal:
|
|
542
|
+
# Check for ESC key handler
|
|
543
|
+
has_esc_handler = any(pattern in content for pattern in [
|
|
544
|
+
"'Escape'", '"Escape"', 'key === 27', 'keyCode === 27',
|
|
545
|
+
"code === 'Escape'", 'code === "Escape"'
|
|
546
|
+
])
|
|
547
|
+
|
|
548
|
+
if not has_esc_handler:
|
|
549
|
+
scores['focus_management'] = max(0, scores['focus_management'] - 3)
|
|
550
|
+
issues.append({
|
|
551
|
+
'severity': 'WARNING',
|
|
552
|
+
'category': 'focus_management',
|
|
553
|
+
'message': 'Modal component missing ESC key handler',
|
|
554
|
+
'line': 0,
|
|
555
|
+
'fix': "Add window.addEventListener('keyup', handler) to close on Escape"
|
|
556
|
+
})
|
|
557
|
+
|
|
558
|
+
# Check for focus trap pattern
|
|
559
|
+
has_focus_trap = any(pattern in content for pattern in [
|
|
560
|
+
'focusable', 'tabbable', '.focus()', 'tabindex',
|
|
561
|
+
'querySelectorAll', 'firstElementChild'
|
|
562
|
+
])
|
|
563
|
+
|
|
564
|
+
if not has_focus_trap:
|
|
565
|
+
scores['focus_management'] = max(0, scores['focus_management'] - 3)
|
|
566
|
+
issues.append({
|
|
567
|
+
'severity': 'INFO',
|
|
568
|
+
'category': 'focus_management',
|
|
569
|
+
'message': 'Modal may need focus trap for accessibility',
|
|
570
|
+
'line': 0,
|
|
571
|
+
'fix': 'Implement focus trap to keep focus within modal'
|
|
572
|
+
})
|
|
573
|
+
|
|
574
|
+
# Check for cleanup in disconnectedCallback
|
|
575
|
+
if 'addEventListener' in content:
|
|
576
|
+
if 'removeEventListener' not in content and 'disconnectedCallback' not in content:
|
|
577
|
+
scores['focus_management'] = max(0, scores['focus_management'] - 4)
|
|
578
|
+
issues.append({
|
|
579
|
+
'severity': 'HIGH',
|
|
580
|
+
'category': 'focus_management',
|
|
581
|
+
'message': 'Event listener added but not cleaned up',
|
|
582
|
+
'line': 0,
|
|
583
|
+
'fix': 'Add disconnectedCallback to remove event listeners'
|
|
584
|
+
})
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
if __name__ == "__main__":
|
|
588
|
+
import sys
|
|
589
|
+
if len(sys.argv) < 2:
|
|
590
|
+
print("Usage: python validate_slds.py <file.html|file.css|file.js>")
|
|
591
|
+
sys.exit(1)
|
|
592
|
+
|
|
593
|
+
validator = SLDSValidator(sys.argv[1])
|
|
594
|
+
results = validator.validate()
|
|
595
|
+
print(json.dumps(results, indent=2))
|