@salesforce/afv-skills 1.68.0 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/package.json +1 -1
  2. package/skills/afcc-setup-coordinate/SKILL.md +348 -0
  3. package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
  4. package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
  5. package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
  6. package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
  7. package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
  8. package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
  9. package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
  10. package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
  11. package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
  12. package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
  13. package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
  14. package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
  15. package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
  16. package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
  17. package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
  18. package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
  19. package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
  20. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
  21. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
  22. package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
  23. package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
  24. package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
  25. package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
  26. package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
  27. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
  28. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
  29. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
  30. package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
  31. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
  32. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
  33. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
  34. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
  35. package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
  36. package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
  37. package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
  38. package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
  39. package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
  40. package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
  41. package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
  42. package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
  43. package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
  44. package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
  45. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
  46. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
  47. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
  48. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
  49. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
  50. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
  51. package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
  52. package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
  53. package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
  54. package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
  55. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
  56. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
  57. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
  58. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
  59. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
  60. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
  61. package/skills/commerce-react-storefront-create/SKILL.md +54 -21
  62. package/skills/dx-lifecycle-center/SKILL.md +24 -18
  63. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  64. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  65. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  66. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  67. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  68. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  69. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  70. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  71. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  72. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  73. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  74. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
  75. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  76. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  77. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  78. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  79. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  80. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  81. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  82. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  83. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  84. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  85. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  86. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  87. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  88. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  89. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  90. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  91. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  92. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  93. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  94. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  95. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  96. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  97. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  98. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  99. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  100. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  101. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  102. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  103. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  104. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  105. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  106. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  107. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  108. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  109. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  110. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  111. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  112. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  113. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  114. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  115. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  116. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  117. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  118. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  119. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  120. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  121. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  122. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  123. package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
  124. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  125. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  126. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  127. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  128. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  129. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  130. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  131. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  132. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  133. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  134. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  135. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  136. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  137. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  138. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  139. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  140. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  141. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  142. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  143. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  144. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  145. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  146. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  147. package/skills/platform-report-generate/SKILL.md +20 -1
  148. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  149. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  150. package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
  151. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  152. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  153. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  154. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  155. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  156. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  157. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
  158. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  159. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  160. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  161. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  162. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  163. package/skills/service-e911-configure/SKILL.md +242 -0
  164. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  165. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  166. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  167. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  168. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  169. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  170. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  171. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  172. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  173. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  174. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  175. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  176. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  177. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  178. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  179. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  180. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  181. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  182. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  183. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  184. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  185. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  186. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  187. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  188. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env node
2
+ // Preview or create a standalone Claude plugin without changing Salesforce,
3
+ // Git state, or an existing destination. The OAuth client ID is public; no secrets belong here.
4
+ import { createMcpConfig } from "./mcp_config.mjs";
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+
8
+ const KEBAB = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
9
+ const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
10
+ const SKIP = new Set([".git", "node_modules", ".DS_Store", "__pycache__"]);
11
+ function need(condition, message) { if (!condition) throw new Error(message); }
12
+ function text(value, name) { need(typeof value === "string" && value.trim(), `${name} must be a non-empty string`); return value.trim(); }
13
+ function readJson(file) { return JSON.parse(fs.readFileSync(file, "utf8")); }
14
+ function shellQuote(value) { return "'" + value.replaceAll("'", "'\\''") + "'"; }
15
+ function within(parent, child) { const rel = path.relative(parent, child); return rel === "" || (!rel.startsWith(`..${path.sep}`) && rel !== ".." && !path.isAbsolute(rel)); }
16
+
17
+ function iconFile(input) {
18
+ need(typeof input === "string" && path.isAbsolute(input), "iconPath must be an absolute path to the user-selected image");
19
+ const stat = fs.lstatSync(input);
20
+ need(stat.isFile(), "iconPath must be a regular file, not a directory or symlink");
21
+ need(stat.size > 0 && stat.size <= 5 * 1024 * 1024, "Plugin icon must be non-empty and at most 5 MiB");
22
+ const extension = path.extname(input).toLowerCase();
23
+ const content = fs.readFileSync(input);
24
+ const valid = extension === ".png" ? content.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
25
+ : [".jpg", ".jpeg"].includes(extension) ? content[0] === 255 && content[1] === 216 && content[2] === 255
26
+ : extension === ".webp" && content.toString("ascii", 0, 4) === "RIFF" && content.toString("ascii", 8, 12) === "WEBP";
27
+ need(valid, "iconPath must contain a PNG, JPEG or WebP image matching its extension");
28
+ return { relative: `assets/icon${extension}`, content, mode: 0o644 };
29
+ }
30
+
31
+ function skillFiles(input, destination) {
32
+ need(path.isAbsolute(input), "Skill paths must be absolute");
33
+ const source = fs.realpathSync(input);
34
+ need(fs.statSync(source).isDirectory(), "A skill path must point to a directory");
35
+ need(!within(source, destination), "Plugin destination cannot be inside an included skill");
36
+ const content = fs.readFileSync(path.join(source, "SKILL.md"), "utf8");
37
+ const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/)?.[1];
38
+ const name = frontmatter?.match(/^name:\s*["']?([a-z0-9]+(?:-[a-z0-9]+)*)["']?\s*$/m)?.[1];
39
+ need(name && name.length <= 64 && /^description:\s*\S/m.test(frontmatter), `Skill must have a kebab-case name and description in SKILL.md: ${input}`);
40
+ const files = [];
41
+ function visit(dir, relative = "") {
42
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
43
+ if (SKIP.has(entry.name)) continue;
44
+ const rel = path.posix.join(relative, entry.name);
45
+ need(!entry.isSymbolicLink(), `Resolve skill symlinks before packaging: ${rel}`);
46
+ need(!/^(?:\.env(?:\..*)?|\.npmrc|\.pypirc|\.sf|\.sfdx|a4d_mcp_settings\.json)$|\.(?:pem|key)$/i.test(entry.name), `Remove credential/configuration files from the skill before packaging: ${rel}`);
47
+ const file = path.join(dir, entry.name);
48
+ if (entry.isDirectory()) visit(file, rel);
49
+ else {
50
+ need(entry.isFile(), `Unsupported skill entry: ${rel}`);
51
+ files.push({ relative: `skills/${name}/${rel}`, content: fs.readFileSync(file), mode: fs.statSync(file).mode & 0o777 });
52
+ }
53
+ }
54
+ }
55
+ visit(source);
56
+ return { name, files };
57
+ }
58
+
59
+ function main() {
60
+ const args = process.argv.slice(2);
61
+ need(args.length === 1 || (args.length === 2 && args[1] === "--write"), "Usage: generate_plugin.mjs <CONFIG_JSON> [--write]");
62
+ const config = readJson(args[0]);
63
+ const name = text(config.name, "name");
64
+ need(KEBAB.test(name) && name.length <= 64, "Plugin name must be kebab-case and at most 64 characters");
65
+ need(!/^(?:claude|anthropic|anthropics|cc-plugin)(?:-|$)/.test(name), "Choose a plugin name that does not impersonate the client vendor");
66
+ const version = config.version ?? "1.0.0";
67
+ need(SEMVER.test(version), "Plugin version must be semantic versioning, for example 1.0.0");
68
+ need(typeof config.destination === "string" && path.isAbsolute(config.destination), "destination must be the user-selected absolute path for a new plugin directory");
69
+ const destination = path.resolve(config.destination);
70
+ need(destination !== path.parse(destination).root && !fs.existsSync(destination), "Destination already exists or is a filesystem root; select a new directory");
71
+ const description = text(config.description, "description");
72
+ const author = { name: text(config.author?.name, "author.name") };
73
+ if (config.author.email) author.email = text(config.author.email, "author.email");
74
+ const manifest = { name, version, description, author };
75
+ if (config.repository) {
76
+ need(/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/?$/.test(config.repository), "repository must be the intended github.com repository URL");
77
+ manifest.repository = config.repository;
78
+ }
79
+ if (config.license) manifest.license = text(config.license, "license");
80
+ const icon = config.iconPath === undefined ? null : iconFile(config.iconPath);
81
+ if (icon) manifest.icon = `./${icon.relative}`;
82
+ const mcpConfig = createMcpConfig(config);
83
+ const server = Object.values(mcpConfig.mcpServers)[0];
84
+ const url = server.url;
85
+ const authStyle = config.authStyle ?? "claude-code";
86
+ const sources = config.skills ?? [];
87
+ need(Array.isArray(sources), "skills must be an array of absolute skill directory paths");
88
+ const skills = sources.map((source) => skillFiles(source, destination));
89
+ need(new Set(skills.map((skill) => skill.name)).size === skills.length, "Included skills have duplicate names");
90
+ const jsonFile = (relative, value) => ({ relative, content: JSON.stringify(value, null, 2) + "\n", mode: 0o644 });
91
+ const repository = config.repository ? new URL(config.repository).pathname.replace(/^\/|\/$/g, "") : `OWNER/${name}`;
92
+ const localCheck = `Copy and run each command separately. Continue only after changing directory successfully.
93
+
94
+ Enter the plugin directory:
95
+
96
+ \`\`\`bash
97
+ cd -- ${shellQuote(destination)}
98
+ \`\`\`
99
+
100
+ Validate:
101
+
102
+ \`\`\`bash
103
+ claude plugin validate .
104
+ \`\`\`
105
+
106
+ Launch Claude with the plugin:
107
+
108
+ \`\`\`bash
109
+ claude --plugin-dir .
110
+ \`\`\``;
111
+ const publication = `Review files before uploading; a private repository must not contain secrets. Use a private GitHub repository and retain the kebab-case plugin name. ${config.repository ? "The commands use your selected repository." : "Replace OWNER below with your approved GitHub username or organization."} Check the active GitHub account and owner permissions; private visibility does not bypass enterprise-managed account restrictions.
112
+
113
+ Copy and run each command separately using its own code block, and stop on any error. Do not copy the entire multi-step section at once. The following is for a new local repository and a new remote only. For an existing repository, skip initialization, commit only changed files and inspect any existing origin before adding or changing it.
114
+
115
+ Initialize:
116
+
117
+ \`\`\`bash
118
+ git init -b main
119
+ \`\`\`
120
+
121
+ Stage files:
122
+
123
+ \`\`\`bash
124
+ git add .
125
+ \`\`\`
126
+
127
+ Commit:
128
+
129
+ \`\`\`bash
130
+ git commit -m "Initial plugin package"
131
+ \`\`\`
132
+
133
+ Create the private remote and upload:
134
+
135
+ \`\`\`bash
136
+ gh repo create ${repository} --private --source . --remote origin --push
137
+ \`\`\`
138
+
139
+ Only after successful upload, create the release tag if it does not already exist. Do not recreate or move an existing tag.
140
+
141
+ \`\`\`bash
142
+ git tag v${version}
143
+ \`\`\`
144
+
145
+ Push the tag:
146
+
147
+ \`\`\`bash
148
+ git push origin v${version}
149
+ \`\`\`
150
+
151
+ Bump the semantic version for later releases. Private hosting is separate from public directory submission: review the access/visibility requirements and licensing before submission, and do not change repository visibility automatically. Follow [Submit your plugin](https://claude.com/docs/plugins/submit); local validation does not guarantee directory approval.
152
+ `;
153
+ const files = [
154
+ jsonFile(".claude-plugin/plugin.json", manifest),
155
+ jsonFile(".mcp.json", mcpConfig),
156
+ ...(icon ? [icon] : []),
157
+ { relative: ".gitignore", content: ".DS_Store\n.env\n.env.*\n*.log\nnode_modules/\n", mode: 0o644 },
158
+ { relative: "README.md", content: `# ${name}\n\n${description}\n\n## Connection\n\nThis plugin connects to the Salesforce hosted MCP server at:\n\n${url}\n\nSign in as the intended Experience Site user through the client's OAuth flow. The ECA consumer key is a public OAuth client ID; this package contains no client secret or access token. Confirm that the ECA callback URLs match the client, that required MCP scopes are enabled, and that the user has access to the selected server and its actions.\n\n${authStyle === "requested" ? "This package uses the requested submission profile, `auth.CLIENT_ID`. Verify that the target client accepts it; current Claude Code documents `oauth.clientId` instead. This profile is not proof of runtime compatibility." : "This package uses Claude Code's documented `oauth.clientId` configuration."}\n\n## Local check\n\n${localCheck}\n\nIn Claude Code, open \`/mcp\`, complete OAuth, and check that expected tools are listed. Inspect tool descriptions before executing an action. Local metadata validation alone does not verify routing, OAuth, or tool execution.\n\n## Included skills\n\n${skills.length ? skills.map((skill) => `- \`${name}:${skill.name}\` — see \`skills/${skill.name}/SKILL.md\`.`).join("\n") : "No skills are bundled; this plugin provides the MCP connection."}\n\n## Publication\n\n${publication}`, mode: 0o644 },
159
+ ...skills.flatMap((skill) => skill.files),
160
+ ];
161
+ if (args[1] === "--write") {
162
+ const parent = path.dirname(destination);
163
+ fs.mkdirSync(parent, { recursive: true });
164
+ const staging = fs.mkdtempSync(path.join(parent, ".plugin-package-"));
165
+ try {
166
+ for (const file of files) {
167
+ const target = path.join(staging, file.relative);
168
+ fs.mkdirSync(path.dirname(target), { recursive: true });
169
+ fs.writeFileSync(target, file.content, { mode: file.mode });
170
+ }
171
+ need(!fs.existsSync(destination), "Destination appeared during generation; nothing was replaced");
172
+ fs.renameSync(staging, destination);
173
+ } catch (error) {
174
+ fs.rmSync(staging, { recursive: true, force: true });
175
+ throw error;
176
+ }
177
+ }
178
+ console.log(JSON.stringify({ status: args[1] === "--write" ? "created" : "preview", destination, plugin: name, version, url, authStyle, skills: skills.map((skill) => skill.name), files: files.map((file) => file.relative), runtimeVerified: false }, null, 2));
179
+ }
180
+
181
+ try { main(); } catch (error) {
182
+ console.log(JSON.stringify({ status: "blocked", error: error.message }, null, 2));
183
+ process.exitCode = 1;
184
+ }
@@ -0,0 +1,57 @@
1
+ // Connection validation shared by standalone configuration and plugin delivery.
2
+ function need(condition, message) { if (!condition) throw new Error(message); }
3
+ function text(value, name) { need(typeof value === "string" && value.trim(), `${name} must be a non-empty string`); return value.trim(); }
4
+
5
+ // Org environment → route segment between the domain token and the site.
6
+ const ENVIRONMENT_SEGMENTS = { production: "", developer: "develop", sandbox: "sandbox", scratch: "scratch" };
7
+
8
+ function checkDomain(domain, environment) {
9
+ need(/^[a-z0-9]+(?:[a-z0-9.-]*[a-z0-9])?$/.test(domain) && !domain.includes(".."), "domain must be the routing domain token, not a URL or full instance hostname");
10
+ need(!domain.endsWith("salesforce.com"), "Use the routing domain token, not the full Salesforce hostname");
11
+ need(!domain.includes("."), `${environment} domain must not contain dots`);
12
+ if (environment === "sandbox") need(/^[a-z0-9-]+--[a-z0-9]+$/.test(domain), "sandbox domain must be {my-domain}--{sandbox-name}");
13
+ else need(!domain.includes("--"), `${environment} domain must not contain a sandbox suffix`);
14
+ }
15
+
16
+ function mcpUrl(mcp) {
17
+ need(mcp.sitePrefix === undefined, "mcp.sitePrefix is no longer supported; supply the exact site developer name as mcp.siteDeveloperName");
18
+ if (mcp.url) {
19
+ need(!mcp.domain && !mcp.environment && mcp.siteDeveloperName === undefined, "Supply a verified URL or route components, not both");
20
+ const url = new URL(mcp.url);
21
+ need(url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash, "MCP URL must use HTTPS without credentials, query, or fragment");
22
+ return url.href;
23
+ }
24
+ const environment = text(mcp.environment, "mcp.environment");
25
+ need(Object.hasOwn(ENVIRONMENT_SEGMENTS, environment), `mcp.environment must be one of: ${Object.keys(ENVIRONMENT_SEGMENTS).join(", ")}`);
26
+ const domain = text(mcp.domain, "mcp.domain");
27
+ checkDomain(domain, environment);
28
+ const siteDeveloperName = text(mcp.siteDeveloperName, "mcp.siteDeveloperName");
29
+ need(/^[A-Za-z0-9_-]+$/.test(siteDeveloperName), "siteDeveloperName must be the exact site developer name without slashes");
30
+ const name = text(mcp.mcpName, "mcp.mcpName");
31
+ need(/^[A-Za-z][A-Za-z0-9_]*$/.test(name), "mcpName must be the exact server DeveloperName");
32
+ const segment = ENVIRONMENT_SEGMENTS[environment];
33
+ return `https://api.salesforce.com/platform/mcp/v1/p/${encodeURIComponent(domain)}/${segment ? `${segment}/` : ""}${encodeURIComponent(siteDeveloperName)}/custom/${encodeURIComponent(name)}`;
34
+ }
35
+
36
+ export function createMcpConfig(config) {
37
+ need(config.mcp && typeof config.mcp === "object", "mcp configuration is required");
38
+ const serverKey = text(config.mcp.serverName, "mcp.serverName");
39
+ need(/^[A-Za-z0-9_-]+$/.test(serverKey), "mcp.serverName must contain letters, numbers, underscores, or hyphens");
40
+ const clientId = text(config.mcp.clientId, "mcp.clientId");
41
+ need(!/[\s<>]/.test(clientId), "Use the actual ECA consumer key as clientId, not a placeholder or ECA record ID");
42
+ need(clientId !== config.mcp.ecaId, "clientId must be the ECA consumer key, not its record ID");
43
+ const url = mcpUrl(config.mcp);
44
+ // Custom client conventions must be explicitly selected, not inferred from submission.
45
+ const authStyle = config.authStyle ?? "claude-code";
46
+ need(["requested", "claude-code"].includes(authStyle), "authStyle must be requested or claude-code");
47
+ const server = { type: "http", url };
48
+ if (authStyle === "requested") server.auth = { CLIENT_ID: clientId };
49
+ else server.oauth = { clientId };
50
+ if (config.mcp.callbackPort !== undefined) {
51
+ need(authStyle === "claude-code", "mcp.callbackPort requires the claude-code OAuth profile");
52
+ const port = config.mcp.callbackPort;
53
+ need(Number.isInteger(port) && port >= 1 && port <= 65535, "mcp.callbackPort must be a JSON integer from 1 through 65535; omit it when skipped");
54
+ server.oauth.callbackPort = port;
55
+ }
56
+ return { mcpServers: { [serverKey]: server } };
57
+ }
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env node
2
+ // Run from the SFDX project root; read the JSON `decision`. Exit 0 = decision reached (incl. skip, needs_input); exit 1 = error.
3
+ // Usage: node preflight.mjs <target-org-alias> --skill-named <true|false>
4
+ import fs from "node:fs";
5
+ import { execFileSync } from "node:child_process";
6
+
7
+ const [org, option, skillNamed, ...extra] = process.argv.slice(2);
8
+ const requestNamesSkill = skillNamed === "true";
9
+ let gatePassed = false;
10
+
11
+ function finish(report, code = 0) {
12
+ console.log(JSON.stringify(report));
13
+ process.exit(code);
14
+ }
15
+
16
+ function skip(disabled = false) {
17
+ finish({
18
+ decision: disabled && requestNamesSkill ? "disabled" : "skip",
19
+ nextAction: "continue_without_this_skill",
20
+ userMessage: disabled && requestNamesSkill ? "The App MCP skill is not enabled for this org." : null,
21
+ });
22
+ }
23
+
24
+ function problem(errorCode, userMessage, nextAction, needsInput = false) {
25
+ if (!needsInput && !gatePassed && !requestNamesSkill) skip();
26
+ finish({ decision: needsInput ? "needs_input" : "error", errorCode, userMessage, nextAction, gatePassed }, needsInput ? 0 : 1);
27
+ }
28
+
29
+ if (!org || org.startsWith("--") || option !== "--skill-named" ||
30
+ !["true", "false"].includes(skillNamed) || extra.length) {
31
+ problem("invalid_arguments", "Provide a target org alias and --skill-named true or false.", "Correct the preflight arguments.", true);
32
+ }
33
+
34
+ let project;
35
+ try {
36
+ project = JSON.parse(fs.readFileSync("sfdx-project.json", "utf8"));
37
+ } catch {
38
+ problem("invalid_project", "Could not read sfdx-project.json.", "Select a valid SFDX project root, then rerun preflight.");
39
+ }
40
+ const version = project?.sourceApiVersion;
41
+ if (typeof version !== "string" || !/^\d+\.\d+$/.test(version) || Number(version) < 68) {
42
+ problem("invalid_api_version", "sfdx-project.json sourceApiVersion must use X.Y format and be at least 68.0.",
43
+ "Ask the user to correct sourceApiVersion to an org-supported version, then rerun preflight.", true);
44
+ }
45
+
46
+ function sf(args) {
47
+ let output;
48
+ let failed = false;
49
+ try {
50
+ output = execFileSync("sf", args, {
51
+ encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30000,
52
+ });
53
+ } catch (error) {
54
+ output = error.stdout ?? "";
55
+ failed = true;
56
+ }
57
+ let response;
58
+ try {
59
+ response = JSON.parse(output);
60
+ } catch {
61
+ return { failed: true, response: null };
62
+ }
63
+ if (response?.name === "NamedOrgNotFoundError" || response?.code === "NamedOrgNotFoundError") {
64
+ problem("invalid_org_alias", "No authenticated org matches the target org alias.",
65
+ "Ask the user for a valid authenticated org alias, then rerun preflight.", true);
66
+ }
67
+ return { failed, response };
68
+ }
69
+
70
+ const versionsResult = sf(["api", "request", "rest", "/services/data/",
71
+ "--target-org", org, "--method", "GET", "--json"]);
72
+ const versions = versionsResult.response?.result?.body;
73
+ if (versionsResult.failed || versionsResult.response?.status !== 0 ||
74
+ versionsResult.response?.result?.statusCode !== 200 || !Array.isArray(versions) || !versions.length ||
75
+ !versions.every((entry) => typeof entry?.version === "string" && /^\d+\.\d+$/.test(entry.version))) {
76
+ problem("gate_check_failed", "Could not determine the target org's supported API versions.",
77
+ "Check target-org authentication and connectivity, then rerun preflight.");
78
+ }
79
+ const compatibleVersions = versions.filter((entry) => Number(entry.version) >= 68).map((entry) => entry.version);
80
+ if (!compatibleVersions.length) {
81
+ problem("invalid_api_version", "The target org does not advertise an API version of at least 68.0.",
82
+ "Ask the user for an org alias supporting API 68.0 or later, then rerun preflight.", true);
83
+ }
84
+ if (!compatibleVersions.includes(version)) {
85
+ problem("invalid_api_version", "sfdx-project.json sourceApiVersion is not supported by the target org.",
86
+ "Ask the user to select a supported sourceApiVersion of at least 68.0 from: " +
87
+ compatibleVersions.join(", ") +
88
+ ". Then rerun preflight.", true);
89
+ }
90
+
91
+ const gateResult = sf(["api", "request", "rest", `/services/data/v${version}/headless/invocableaction`,
92
+ "--target-org", org, "--method", "POST", "--body",
93
+ JSON.stringify({ action: "getExperienceAppMcpMetadata-getExperienceAppMcpMetadata", inputs: {} }), "--json"]);
94
+ const gate = gateResult.response;
95
+ const body = gate?.result?.body;
96
+ if (gate?.result?.statusCode === 400 && Array.isArray(body) &&
97
+ body.some((error) => error?.errorCode === "INVALID_INPUT")) skip(true);
98
+ const unsupportedGateActionMessage = /Unsupported action type: GET_EXPERIENCE_APP_MCP_METADATA(?![A-Za-z0-9_])/;
99
+ if (Array.isArray(body) && body.some((error) =>
100
+ typeof error?.message === "string" && unsupportedGateActionMessage.test(error.message))) skip(true);
101
+ if (gateResult.failed || gate?.status !== 0 || gate?.result?.statusCode !== 200 ||
102
+ typeof body?.outputs?.isAppMcpEnabled !== "boolean") {
103
+ problem("gate_check_failed", "Could not verify whether the App MCP skill is enabled.",
104
+ "Check target-org authentication and connectivity, then rerun preflight.");
105
+ }
106
+ if (!body.outputs.isAppMcpEnabled) skip(true);
107
+ gatePassed = true;
108
+
109
+ finish({ decision: "continue" });
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env node
2
+ // Retrieve the non-secret OAuth consumer key for a deployed ECA.
3
+ //
4
+ // Usage: node retrieve_eca_consumer_key.mjs <target-org-alias> <eca-developer-name> [oauth-consumer-id] [--json]
5
+ //
6
+ // Exit 0 with JSON `status`:
7
+ // not_found - the query succeeded and no ExternalClientApplication matched that DeveloperName.
8
+ // selection_required - more than one OAuth consumer; the caller must choose an id.
9
+ // With --json and a single consumer, prints the key object (no `status`); without --json, prints the bare key.
10
+ // Exit 1: lookup, API, or response validation failed. Do not infer that the ECA is absent.
11
+ import fs from "node:fs";
12
+ import { execFileSync } from "node:child_process";
13
+ import { isValidDeveloperName } from "./developer_name.mjs";
14
+
15
+ function fail(msg, code = 1) {
16
+ process.stderr.write(msg + "\n");
17
+ process.exit(code);
18
+ }
19
+
20
+ const jsonOutput = process.argv.slice(2).includes("--json");
21
+ const args = process.argv.slice(2).filter((arg) => arg !== "--json");
22
+ if (args.length < 2 || args.length > 3) {
23
+ fail("Usage: retrieve_eca_consumer_key.mjs <target-org-alias> <eca-developer-name> [oauth-consumer-id] [--json]");
24
+ }
25
+ const [targetOrg, ecaDeveloperName, oauthConsumerId = ""] = args;
26
+ if (!targetOrg || targetOrg.startsWith("-")) fail("ERROR: target org alias is invalid.");
27
+
28
+ let apiVersion;
29
+ try {
30
+ apiVersion = JSON.parse(fs.readFileSync("sfdx-project.json", "utf-8")).sourceApiVersion;
31
+ if (!/^\d{2,3}\.0$/.test(apiVersion)) throw new Error("Invalid sourceApiVersion");
32
+ } catch {
33
+ fail("ERROR: run from an SFDX project root with a valid sourceApiVersion.");
34
+ }
35
+ if (!isValidDeveloperName(ecaDeveloperName)) {
36
+ fail("ERROR: ECA developer name is invalid.");
37
+ }
38
+ if (oauthConsumerId && !/^[A-Za-z0-9]+$/.test(oauthConsumerId)) {
39
+ fail("ERROR: OAuth consumer ID is invalid.");
40
+ }
41
+
42
+ function requestJson(url, description) {
43
+ let body;
44
+ try {
45
+ body = execFileSync(
46
+ "sf",
47
+ ["api", "request", "rest", url, "--target-org", targetOrg, "--method", "GET"],
48
+ { encoding: "utf-8" },
49
+ );
50
+ } catch {
51
+ process.stderr.write(`ERROR: ${description} request failed.\n`);
52
+ return null;
53
+ }
54
+ try {
55
+ return JSON.parse(body);
56
+ } catch {
57
+ process.stderr.write(`ERROR: ${description} returned invalid JSON.\n`);
58
+ return null;
59
+ }
60
+ }
61
+
62
+ const ecaSoql = `SELECT Id FROM ExternalClientApplication WHERE DeveloperName = '${ecaDeveloperName}'`;
63
+ let ecaQueryRaw;
64
+ try {
65
+ ecaQueryRaw = execFileSync(
66
+ "sf",
67
+ ["data", "query", "--query", ecaSoql, "--target-org", targetOrg, "--api-version", apiVersion, "--json"],
68
+ { encoding: "utf-8" },
69
+ );
70
+ } catch {
71
+ fail("ERROR: ECA query failed.");
72
+ }
73
+ let ecaQuery;
74
+ try {
75
+ ecaQuery = JSON.parse(ecaQueryRaw);
76
+ } catch {
77
+ ecaQuery = null;
78
+ }
79
+ const ecaOk =
80
+ ecaQuery &&
81
+ ecaQuery.status === 0 &&
82
+ typeof ecaQuery.result?.totalSize === "number" &&
83
+ Array.isArray(ecaQuery.result?.records) &&
84
+ ecaQuery.result.totalSize === ecaQuery.result.records.length &&
85
+ ecaQuery.result.records.every((r) => typeof r.Id === "string");
86
+ if (!ecaOk) fail("ERROR: ECA query returned an unrecognized response.");
87
+
88
+ const matchCount = ecaQuery.result.totalSize;
89
+ // A successful query that proved absence is an answer (exit 0); anything inconclusive fails.
90
+ if (matchCount === 0) {
91
+ console.log(JSON.stringify({
92
+ status: "not_found",
93
+ message: `no deployed ECA matched developer name ${ecaDeveloperName}`,
94
+ ecaDeveloperName,
95
+ }));
96
+ process.exit(0);
97
+ }
98
+ if (matchCount !== 1) fail(`ERROR: multiple deployed ECAs matched developer name ${ecaDeveloperName}.`);
99
+
100
+ const ecaIdentifier = ecaQuery.result.records[0].Id;
101
+ if (!/^[A-Za-z0-9]+$/.test(ecaIdentifier)) fail("ERROR: ECA lookup returned an invalid identifier.");
102
+
103
+ const credentialsUrl = `/services/data/v${apiVersion}/apps/oauth/credentials/${ecaIdentifier}?part=key`;
104
+ const credentials = requestJson(credentialsUrl, "OAuth consumer lookup");
105
+ if (!credentials) process.exit(1);
106
+ const credsOk =
107
+ Array.isArray(credentials.consumers) &&
108
+ credentials.consumers.every(
109
+ (c) => typeof c.id === "string" && typeof c.name === "string" && typeof c.key === "string",
110
+ );
111
+ if (!credsOk) fail("ERROR: OAuth consumer lookup returned an unrecognized response.");
112
+
113
+ const consumerCount = credentials.consumers.length;
114
+ if (consumerCount === 0) fail("ERROR: deployed ECA has no OAuth consumers.");
115
+
116
+ let selected;
117
+ if (oauthConsumerId) {
118
+ selected = credentials.consumers.filter((c) => c.id === oauthConsumerId);
119
+ if (selected.length !== 1) {
120
+ fail(`ERROR: OAuth consumer ID ${oauthConsumerId} did not match exactly one consumer.`);
121
+ }
122
+ } else if (consumerCount === 1) {
123
+ selected = [credentials.consumers[0]];
124
+ } else {
125
+ console.log(
126
+ JSON.stringify({
127
+ status: "selection_required",
128
+ apiVersion,
129
+ eca: { developerName: ecaDeveloperName, identifier: ecaIdentifier },
130
+ consumerCandidates: credentials.consumers.map((c) => ({ id: c.id, name: c.name })),
131
+ }),
132
+ );
133
+ process.exit(0);
134
+ }
135
+
136
+ if (!selected[0].key.trim()) fail("ERROR: OAuth consumer key is empty.");
137
+ console.log(jsonOutput ? JSON.stringify({
138
+ apiVersion,
139
+ ecaDeveloperName,
140
+ ecaId: ecaIdentifier,
141
+ oauthConsumerId: selected[0].id,
142
+ clientId: selected[0].key,
143
+ }) : selected[0].key);