@botiverse/cc-switch exports one stateful native class, CcSwitch, plus the
TypeScript types from api.d.ts.
Opens the CC Switch store. Set CC_SWITCH_CONFIG_DIR and app-specific path
variables before construction. Only one instance may be active in a process.
Closes SQLite resources and releases the process-wide instance slot. Always
call it in finally; this is required before deleting the store on Windows.
Returns claude, codex, gemini, opencode, hermes, and openclaw.
Returns the stored provider snapshots for one application.
Returns the selected provider for Claude, Codex, Gemini, and Hermes. OpenCode
and OpenClaw are additive-mode applications and return null.
Validates and stores a provider. The first switch-mode provider becomes current.
Replaces a stored provider with the same id. If it is active, upstream live
configuration synchronization rules are applied.
Copies a provider with a collision-free ID and optional full provider override.
Selects a provider and writes its live configuration when the target app has already been initialized.
Deletes a stored provider. Upstream refuses unsafe deletion of an active or otherwise protected provider.
Imports provider entries found in the application's current live config.
Imports current live configuration as the initial default provider. Returns
false for additive-mode apps or when an existing non-official provider makes
the import unsafe.
Removes a provider from an additive live config without deleting its stored snapshot.
Sets the Hermes or OpenClaw default provider/model and returns the selected model identifier.
Reads the application's live provider settings without mutating them.
Synchronizes the current stored provider state back to live app configs.
See Codex OAuth login for the complete device-code flow.
startCodexLogin() and polling are asynchronous; tokens remain in the native
store.
Starts login and returns the verification URI, user code, device code, expiry, and polling interval.
Polls the device flow and returns null while authorization is pending.
Read credential-free authentication and account summaries.
Manage the local Codex OAuth account store.
Extracts a non-sensitive common-config snippet from the current provider.
Extracts the same sanitized snippet from an arbitrary settings object. API keys, tokens, and provider-specific endpoints are removed by upstream logic.
Stores a common-config snippet. Passing null, undefined, or an empty string
clears it.
Explicitly clears the common-config snippet.
MCP uses one unified registry with an application matrix. Claude, Codex, Gemini, OpenCode, and Hermes are supported; OpenClaw is not an MCP projection target in the pinned upstream revision.
Returns the supported MCP projection targets.
Returns the unified MCP registry keyed by server ID.
Validates and adds or replaces a server, then projects it to every application
enabled in server.apps.
Deletes a server and removes it from all live configs where it was enabled.
Changes one application flag and immediately adds/removes the live projection.
Atomically replaces all application flags. Returns false if the server does
not exist.
Reprojects the registry to one application, or all supported applications when
app is omitted.
Imports live MCP definitions from one application, or every supported application when omitted, into the unified registry.
Skills use ~/.cc-switch/skills (or the isolated CC Switch config directory)
as their single source of truth and project into Claude, Codex, Gemini,
OpenCode, and Hermes. OpenClaw remains unsupported upstream.
Returns supported Skill projection targets.
Lists managed Skills and their application matrices.
Resolves an upstream-supported repository/directory spec, downloads it into the Skills SSOT, and enables it for one application. This is the only asynchronous method in the current SDK.
Removes a managed Skill from every application and the SSOT.
Enables or disables one application projection.
Replaces the complete application matrix. Returns false only when the
upstream service reports no update.
Projects enabled Skills to one application, or all supported applications.
Finds valid SKILL.md directories in application/agent locations that are not
yet managed.
Imports unmanaged directories with explicit application matrices into the SSOT.
Manage repository sources used by Skill discovery and installation.
Returns auto, symlink, or copy.
Changes the deployment strategy used for subsequent Skill projection.
Discovers installable Skills from enabled repositories, using the upstream
cache unless forceRefresh is true.
Searches the skills.sh catalog. The upstream client clamps limit to 1–100.
Compares installed repository-backed Skills with their remote content and returns both available updates and per-repository failures.
Updates selected Skill IDs and reports successful installed records alongside per-Skill failures.
All methods except installSkill() are synchronous. They may perform
filesystem and SQLite I/O; use a Node worker thread if latency on the main
event loop matters.