OpenParable
Skip to content
← Back to skills

Core Extension API

Development
core-extension-api

Core Extension API is an Agent Skill for development published in the forcedotcom/salesforcedx-vscode repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Public API exported by salesforcedx-vscode-core activate(). Use when modifying SalesforceVSCodeCoreApi, the api object in activate(), exports from core index.ts, services sub-object, or evaluating whether a change to core is breaking. Also use when someone asks "does anything use X" for a core export.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/forcedotcom/salesforcedx-vscode/blob/HEAD/.claude/skills/core-extension-api/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/core-extension-api, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Core Extension Public API

packages/salesforcedx-vscode-core/src/index.ts — activate() returns SalesforceVSCodeCoreApi.

Consumers access via:

const ext = vscode.extensions.getExtension<SalesforceVSCodeCoreApi>(
  'salesforce.salesforcedx-vscode-core'
);
const api = ext.exports;

Also consumed indirectly via @salesforce/vscode-service-provider.

Public API — external consumers depend on this

See external-consumers for full list and search commands.

Breaking (check consumers first):

  • Remove field from SalesforceVSCodeCoreApi
  • Change field type
  • Change behavior (even same signature)
  • Change static methods on services.* classes (.getInstance())
  • Rename/restructure services sub-object

Non-breaking: add new fields.

API surface

Top-level (instances/functions)

channelService, getUserId, getAuthFields, isCLIInstalled,
SfCommandlet, SfCommandletExecutor, WorkspaceContext,
telemetryService, workspaceContextUtils, sharedAuthState

services (class constructors with static methods)

RegistryAccess, ChannelService (.getInstance(name)),
TelemetryService (.getInstance(name)),
WorkspaceContext (.getInstance()), CommandEventDispatcher (.getInstance())

External consumers predominantly use services.*. The .getInstance() signatures are public contract.

Overlap

Some capabilities at both levels (e.g. telemetryService instance top-level, services.TelemetryService class). Consumers may use either/both — check both when evaluating usage.

Before changing

  1. Read external-consumers
  2. Grep monorepo: \.exports\.MEMBER — catches direct access outside wrapper files
  3. Search org:
    gh api -X GET "search/code?q=SYMBOL+org:forcedotcom&per_page=30" \
      --jq '.items[] | "\(.repository.name): \(.path)"'
    # also search salesforcecli org
    gh api -X GET "search/code?q=SYMBOL+org:salesforcecli&per_page=30" \
      --jq '.items[] | "\(.repository.name): \(.path)"'
    # also search for exports.SYMBOL (direct access pattern)
    gh api -X GET "search/code?q=exports.SYMBOL+org:forcedotcom&per_page=30" \
      --jq '.items[] | "\(.repository.name): \(.path)"'
    
  4. Read private repos: gh api repos/forcedotcom/REPO/contents/PATH --jq '.content' | base64 -d
  5. Removing something unused in monorepo? Confirm unused externally too
  6. Changing behavior? Check consumer version gates and minimum versions

Consumer patterns

  • extensionDependencies: ["salesforce.salesforcedx-vscode-core"]
  • Version-check core (semver.satisfies(version, '>=X.Y.Z'))
  • Define own minimal type (don't import SalesforceVSCodeCoreApi directly)
  • Call .getInstance(extensionName) on services classes
  • Graceful degradation if core missing/outdated