Skip to main content
Functions and classes exported by this package.

getPlatformPaths()

Get OS-appropriate paths for CAAMP’s global directories. Signature
Returns — Resolved platform paths Example

getSystemInfo()

Get a cached system information snapshot. Signature
Returns — Cached system info object Example

_resetPlatformPathsCache()

Invalidate the path and system info caches. Use in tests after mutating AGENTS_HOME env var. Signature

getPlatformLocations()

Resolves platform-specific directory locations for the current OS. Signature
Returns — Platform-specific directory locations Example

getAgentsHome()

Returns the global agents home directory path. Signature
Returns — The absolute path to the global agents home directory Example

getProjectAgentsDir(projectRoot)

Returns the project-local .agents directory path. Signature
Parameters Returns — The absolute path to the project’s .agents directory Example

resolveProjectPath(relativePath, projectDir)

Resolves a relative path against a project directory. Signature
Parameters Returns — The resolved absolute path Example

getCanonicalSkillsDir()

Returns the canonical skills storage directory path. Signature
Returns — The absolute path to the canonical skills directory Example

getLockFilePath()

Returns the path to the CAAMP lock file. Signature
Returns — The absolute path to the .caamp-lock.json file Example

getAgentsMcpDir(scope, projectDir)

Gets the MCP directory within the .agents/ standard structure. Signature
Parameters Returns — The absolute path to the MCP directory Example

getAgentsMcpServersPath(scope, projectDir)

Gets the MCP servers.json path within the .agents/ standard structure. Signature
Parameters Returns — The absolute path to the servers.json file Example

getAgentsInstructFile(scope, projectDir)

Gets the primary AGENTS.md instruction file path within .agents/. Signature
Parameters Returns — The absolute path to the AGENTS.md file Example

getAgentsConfigPath(scope, projectDir)

Gets the config.toml path within the .agents/ standard structure. Signature
Parameters Returns — The absolute path to the config.toml file Example

getAgentsWikiDir(scope, projectDir)

Gets the wiki directory within the .agents/ standard structure. Signature
Parameters Returns — The absolute path to the wiki directory Example

getAgentsSpecDir(scope, projectDir)

Gets the spec directory within the .agents/ standard structure. Signature
Parameters Returns — The absolute path to the spec directory Example

getAgentsLinksDir(scope, projectDir)

Gets the links directory within the .agents/ standard structure. Signature
Parameters Returns — The absolute path to the links directory Example

resolveRegistryTemplatePath(template)

Resolves a registry template path by substituting platform variables. Signature
Parameters Returns — The resolved absolute path with all variables expanded Example

resolveProviderConfigPath(provider, scope, projectDir)

Resolves the configuration file path for a provider at the given scope. Signature
Parameters Returns — The resolved config file path, or null if unavailable for the given scope Example

resolvePreferredConfigScope(provider, useGlobalFlag)

Determines the preferred configuration scope for a provider. Signature
Parameters Returns — The preferred path scope for configuration Example

resolveProviderSkillsDir(provider, scope, projectDir)

Resolves the skills directory path for a provider at the given scope. Signature
Parameters Returns — The resolved skills directory path Example

resolveProviderSkillsDirs(provider, scope, projectDir)

Gets all target directories for skill installation based on provider precedence. Signature
Parameters Returns — Array of target directories for symlink creation Example

resolveProviderProjectPath(provider, projectDir)

Resolves a provider’s project-level path against a project directory. Signature
Parameters Returns — The resolved absolute path for the provider’s project directory Example

resolveProvidersRegistryPath(startDir)

Locates the providers registry.json file by searching up from a start directory. Signature
Parameters Returns — The absolute path to the found providers/registry.json file Throws
  • Error if providers/registry.json cannot be found within 8 parent levels
Example

normalizeSkillSubPath(path)

Normalizes a skill sub-path by cleaning separators and removing SKILL.md suffix. Signature
Parameters Returns — The normalized path, or undefined if the input is empty or falsy Example

buildSkillSubPathCandidates(marketplacePath, parsedPath)

Builds a list of candidate sub-paths for skill file resolution. Signature
Parameters Returns — A deduplicated array of candidate sub-paths Example

getAllProviders()

Retrieve all registered providers with resolved platform paths. Providers are lazily loaded from providers/registry.json on first call and cached for subsequent calls. Signature
Returns — Array of all provider definitions Example

getProvider(idOrAlias)

Look up a provider by its ID or any of its aliases. Signature
Parameters Returns — The matching provider, or undefined if not found Example

resolveAlias(idOrAlias)

Resolve an alias to its canonical provider ID. If the input is already a canonical ID (or unrecognized), it is returned as-is. Signature
Parameters Returns — The canonical provider ID Example

getProvidersByPriority(priority)

Filter providers by their priority tier. Signature
Parameters Returns — Array of providers matching the given priority Example

getPrimaryProvider()

Get the single primary harness provider, if any is registered. Signature
Returns — The primary provider, or undefined if none is registered Example

getProvidersByStatus(status)

Filter providers by their lifecycle status. Signature
Parameters Returns — Array of providers matching the given status Example

getProvidersByInstructFile(file)

Filter providers that use a specific instruction file. Multiple providers often share the same instruction file (e.g. many use "AGENTS.md"). Signature
Parameters Returns — Array of providers that use the given instruction file Example

getInstructionFiles()

Get the set of all unique instruction file names across all providers. Signature
Returns — Array of unique instruction file names (e.g. ["CLAUDE.md", "AGENTS.md", "GEMINI.md"]) Example

getProviderCount()

Get the total number of registered providers. Signature
Returns — Count of providers in the registry Example

getRegistryVersion()

Get the semantic version string of the provider registry. Signature
Returns — Version string from providers/registry.json (e.g. "2.0.0") Example

getProvidersByHookEvent(event)

Filter providers that support a specific hook event. Signature
Parameters Returns — Array of providers whose hooks capability includes the given event Example

getCommonHookEvents(providerIds)

Get hook events common to all specified providers. If providerIds is provided, returns the intersection of their supported events. If providerIds is undefined or empty, uses all providers. Signature
Parameters Returns — Array of hook events supported by ALL specified providers Example

providerSupports(provider, dotPath)

Check whether a provider supports a specific capability via dot-path query. The dot-path addresses a value inside provider.capabilities. For boolean fields the provider “supports” the capability when the value is true. For non-boolean fields the provider “supports” it when the value is neither null nor undefined (and, for arrays, non-empty). Signature
Parameters Returnstrue when the provider has the specified capability Example

getSpawnCapableProviders()

Filter providers that support spawning subagents. Signature
Returns — Array of providers where capabilities.spawn.supportsSubagents === true Example

getProvidersBySpawnCapability(flag)

Filter providers by a specific boolean spawn capability flag. Signature
Parameters Returns — Array of providers where the specified flag is true Example

resetRegistry()

Reset cached registry data, forcing a reload on next access. Signature
Example

getProvidersBySkillsPrecedence(precedence)

Filter providers by their skills precedence value. Signature
Parameters Returns — Array of providers matching the given precedence Example

getEffectiveSkillsPaths(provider, scope, projectDir)

Get the effective skills paths for a provider, ordered by precedence. Signature
Parameters Returns — Ordered array of paths with source and scope metadata Example

buildSkillsMap()

Build a full skills map for all providers. Signature
Returns — Array of skills map entries with provider ID, tool name, precedence, and paths Example

getProviderCapabilities(idOrAlias)

Get capabilities for a provider by ID or alias. Signature
Parameters Returns — The provider’s capabilities, or undefined if not found Example

providerSupportsById(idOrAlias, capabilityPath)

Check if a provider supports a capability using ID/alias lookup. Convenience wrapper that resolves the provider first, then delegates to the provider-level providerSupports. Signature
Parameters Returns — true if the provider supports the capability, false otherwise Example

buildInjectionContent(template)

Build injection content from a structured template. Produces a string suitable for injection between CAAMP markers. References are output as @ lines, content blocks are appended as-is. Signature
Parameters Returns — Formatted injection content string Example

parseInjectionContent(content)

Parse injection content back into template form. Lines starting with @ are treated as references. All other non-empty lines are treated as content blocks. Signature
Parameters Returns — Parsed InjectionTemplate Example

generateInjectionContent(options)

Generate a standard CAAMP injection block for instruction files. Produces markdown content suitable for injection between CAAMP markers. Optionally includes MCP server and custom content sections. Signature
Parameters Returns — Generated markdown string Example

generateSkillsSection(skillNames)

Generate a skills discovery section for instruction files. Signature
Parameters Returns — Markdown string listing installed skills Example

getInstructFile(provider)

Get the correct instruction file name for a provider. Signature
Parameters Returns — Instruction file name Example

groupByInstructFile(providers)

Group providers by their instruction file name. Useful for determining which providers share the same instruction file (e.g. multiple providers using AGENTS.md). Signature
Parameters Returns — Map from instruction file name to array of providers using that file Example

checkInjection(filePath, expectedContent)

Check the status of a CAAMP injection block in an instruction file. Returns the injection status: - "missing" - File does not exist - "none" - File exists but has no CAAMP markers - "current" - CAAMP block exists and matches expected content (or no expected content given) - "outdated" - CAAMP block exists but differs from expected content Signature
Parameters Returns — The injection status Example

inject(filePath, content)

Inject content into an instruction file between CAAMP markers. Behavior depends on the file state: - File does not exist: creates the file with the injection block → "created" - File exists without markers: prepends the injection block → "added" - File exists with multiple markers (duplicates): consolidates into single block → "consolidated" - File exists with markers, content differs: replaces the block → "updated" - File exists with markers, content matches: no-op → "intact" This function is idempotent — calling it multiple times with the same content will not modify the file after the first write. Signature
Parameters Returns — Action taken: "created", "added", "consolidated", "updated", or "intact" Example

removeInjection(filePath)

Remove the CAAMP injection block from an instruction file. If removing the block would leave the file empty, the file is deleted entirely. Signature
Parameters Returnstrue if a CAAMP block was found and removed, false otherwise Example

checkAllInjections(providers, projectDir, scope, expectedContent)

Check injection status across all providers’ instruction files. Deduplicates by file path since multiple providers may share the same instruction file (e.g. many providers use AGENTS.md). Signature
Parameters Returns — Array of injection check results, one per unique instruction file Example

injectAll(providers, projectDir, scope, content)

Inject content into all providers’ instruction files. Deduplicates by file path to avoid injecting the same file multiple times. Signature
Parameters Returns — Map of file path to action taken ("created", "added", "consolidated", "updated", or "intact") Example

ensureProviderInstructionFile(providerId, projectDir, options)

Ensure a provider’s instruction file exists with the correct CAAMP block. This is the canonical API for adapters and external packages to manage provider instruction files. Instead of directly creating/modifying CLAUDE.md, GEMINI.md, etc., callers should use this function to delegate instruction file management to CAAMP. The instruction file name is resolved from CAAMP’s provider registry (single source of truth), not hardcoded by the caller. Signature
Parameters Returns — Result with file path, action taken, and provider metadata Throws
  • Error if the provider ID is not found in the registry
Example

ensureAllProviderInstructionFiles(providerIds, projectDir, options)

Ensure instruction files for multiple providers at once. Deduplicates by file path — providers sharing the same instruction file (e.g. many providers use AGENTS.md) are only written once. Signature
Parameters Returns — Array of results, one per unique instruction file Throws
  • Error if any provider ID is not found in the registry
Example

setVerbose(v)

Enable or disable verbose (debug) logging mode. When enabled, debug messages are written to stderr. Signature
Parameters Example

setQuiet(q)

Enable or disable quiet mode. When enabled, info and warning messages are suppressed. Errors are always shown. Signature
Parameters Example

debug(args)

Log a debug message to stderr when verbose mode is enabled. Signature
Parameters Example

info(args)

Log an informational message to stdout. Signature
Parameters Example

warn(args)

Log a warning message to stderr. Signature
Parameters Example

error(args)

Log an error message to stderr. Signature
Parameters Example

isVerbose()

Check if verbose (debug) logging is currently enabled. Signature
Returnstrue if verbose mode is active Example

isQuiet()

Check if quiet mode is currently enabled. Signature
Returnstrue if quiet mode is active Example

setHuman(h)

Enable or disable human-readable output mode. When enabled, commands output human-readable format instead of JSON. Signature
Parameters Example

isHuman()

Check if human-readable output mode is currently enabled. Signature
Returnstrue if human mode is active Example

detectProvider(provider)

Detect if a single provider is installed on the system. Checks each detection method configured for the provider (binary, directory, appBundle, flatpak) and returns which methods matched. Signature
Parameters Returns — Detection result with installation status and matched methods Example

detectProjectProvider(provider, projectDir)

Detect if a provider has project-level config in the given directory. Signature
Parameters Returnstrue if the provider has a config file in the project directory Example

detectAllProviders(options)

Detect all registered providers and return their installation status. Runs detection for every provider in the registry. Signature
Parameters Returns — Array of detection results for all providers Example

getInstalledProviders(options)

Get only providers that are currently installed on the system. Convenience wrapper that filters detectAllProviders results to only those with installed === true. Signature
Parameters Returns — Array of installed provider definitions Example

detectProjectProviders(projectDir, options)

Detect all providers and enrich results with project-level presence. Extends detectAllProviders by also checking whether each provider has a project-level config file in the given directory. Signature
Parameters Returns — Array of detection results with projectDetected populated Example

resetDetectionCache()

Reset the detection result cache, forcing fresh detection on next call. Signature
Example

installToCanonical(sourcePath, skillName)

Copy skill files to the canonical location. Signature
Parameters Returns — Absolute path to the canonical installation directory Example

installSkill(sourcePath, skillName, providers, isGlobal, projectDir)

Install a skill from a local path to the canonical location and link to agents. Signature
Parameters Returns — Install result with linked agents and any errors Example

removeSkill(skillName, providers, isGlobal, projectDir)

Remove a skill from the canonical location and all agent symlinks. Signature
Parameters Returns — Object with arrays of successfully removed provider IDs and error messages Example

listCanonicalSkills()

List all skills installed in the canonical skills directory. Signature
Returns — Array of skill names Example

selectProvidersByMinimumPriority(providers, minimumPriority)

Filters providers by minimum priority and returns them in deterministic tier order. Signature
Parameters Returns — A filtered and sorted array of providers meeting the priority threshold Example

installBatchWithRollback(options)

Installs multiple skills across filtered providers with rollback. Signature
Parameters Returns — A result object indicating success, applied counts, and any rollback information Example

updateInstructionsSingleOperation(providers, content, scope, projectDir)

Updates instruction files across providers as a single operation. Signature
Parameters Returns — A summary of updated files and actions taken per file Example

resolveFormat(options)

Resolves output format based on flags and defaults. Signature
Parameters Returns"json" or "human" Throws
  • Error if format flags conflict
Example

buildEnvelope(operation, mvi, result, error, page, sessionId, warnings)

Builds a standard LAFS envelope. Signature
Parameters Returns — LAFS-compliant envelope Example

emitError(operation, mvi, code, message, category, details, exitCode)

Emits a JSON error envelope to stderr and exits the process. Signature
Parameters Example

emitJsonError(operation, mvi, code, message, category, details)

Emits a JSON error envelope without exiting (for catch blocks). Signature
Parameters Example

outputSuccess(operation, mvi, result, page, sessionId, warnings)

Outputs a successful LAFS envelope to stdout. Signature
Parameters Example

handleFormatError(error, operation, mvi, jsonFlag)

Handles format resolution errors consistently. Signature
Parameters Returns — never (exits process) Example

LAFSCommandError

Structured error class for LAFS-compliant command failures with error codes and recovery hints. Signature

emitSuccess(operation, result, mvi)

Emits a successful LAFS result envelope to stdout. Signature
Parameters Example

emitError(operation, error, mvi)

Emits a failed LAFS error envelope to stderr. Signature
Parameters Example

runLafsCommand(command, mvi, action)

Runs an async action and emits the result as a LAFS success or error envelope. Signature
Parameters Returns — Resolves when the action completes and output is emitted Example

parsePriority(value)

Parses and validates a provider priority tier string. Signature
Parameters Returns — The validated ProviderPriority value Example

resolveProviders(options)

Resolves the set of target providers from CLI targeting options. Signature
Parameters Returns — An array of resolved Provider objects Example

readJsonFile(path)

Reads and parses a JSON file from disk. Signature
Parameters Returns — The parsed JSON value Example

readSkillOperations(path)

Reads and validates a JSON file containing skill batch operations. Signature
Parameters Returns — An array of validated SkillBatchOperation objects Example

readTextInput(inlineContent, filePath)

Reads text input from either inline content or a file path, enforcing mutual exclusivity. Signature
Parameters Returns — The text content string, or undefined if no input was provided Example

registerAdvancedBatch(parent)

Registers the advanced batch subcommand for rollback-capable batch install of skills. Signature
Parameters Example

registerAdvancedInstructions(parent)

Registers the advanced instructions subcommand for single-operation instruction updates. Signature
Parameters Example

registerAdvancedProviders(parent)

Registers the advanced providers subcommand for selecting providers by priority tier. Signature
Parameters Example

registerAdvancedCommands(program)

Registers the advanced command group with providers, batch, and instructions subcommands. Signature
Parameters Example

deepMerge(target, source)

Deep merge two objects, with source values winning on conflict. Recursively merges nested plain objects. Arrays and non-object values from source overwrite target values. Signature
Parameters Returns — A new merged object (does not mutate inputs) Example

setNestedValue(obj, keyPath, key, value)

Set a nested value using a dot-notation key path. Signature
Parameters Returns — A new object with the value set at the specified path Example

getNestedValue(obj, keyPath)

Get a nested value from an object using a dot-notation key path. Signature
Parameters Returns — The value at the key path, or undefined if not found Example

ensureDir(filePath)

Ensure that the parent directories of a file path exist. Creates directories recursively if they do not exist. Signature
Parameters Example

readJsonConfig(filePath)

Read and parse a JSON or JSONC config file. Signature
Parameters Returns — Parsed config object Example

writeJsonConfig(filePath, configKey, serverName, serverConfig)

Write a server config entry to a JSON/JSONC file, preserving comments. Signature
Parameters Example

removeJsonConfig(filePath, configKey, serverName)

Remove a server entry from a JSON/JSONC config file. Signature
Parameters Returnstrue if the entry was removed, false if the file or entry was not found Example

readTomlConfig(filePath)

Read and parse a TOML config file. Signature
Parameters Returns — Parsed config object Example

writeTomlConfig(filePath, configKey, serverName, serverConfig)

Write a server config entry to a TOML file. Signature
Parameters Example

removeTomlConfig(filePath, configKey, serverName)

Remove a server entry from a TOML config file. Signature
Parameters Returnstrue if the entry was removed, false if the file or entry was not found Example

readYamlConfig(filePath)

Read and parse a YAML config file. Signature
Parameters Returns — Parsed config object Example

writeYamlConfig(filePath, configKey, serverName, serverConfig)

Write a server config entry to a YAML file. Signature
Parameters Example

removeYamlConfig(filePath, configKey, serverName)

Remove a server entry from a YAML config file. Signature
Parameters Returnstrue if the entry was removed, false if the file or entry was not found Example

readConfig(filePath, format)

Read and parse a config file in the specified format. Dispatches to the appropriate format handler (JSON/JSONC, YAML, or TOML). Signature
Parameters Returns — Parsed config object Throws
  • If the file cannot be read or the format is unsupported
Example

writeConfig(filePath, format, key, serverName, serverConfig)

Write a server entry to a config file, preserving existing content. Dispatches to the appropriate format handler. For JSONC files, comments are preserved using jsonc-parser. Signature
Parameters Throws
  • If the format is unsupported
Example

removeConfig(filePath, format, key, serverName)

Remove a server entry from a config file in the specified format. Signature
Parameters Returnstrue if the entry was removed, false otherwise Throws
  • If the format is unsupported
Example

registerConfigCommand(program)

Registers the config command group with show and path subcommands for viewing provider configurations. Signature
Parameters Example

readLockFile()

Read and parse the CAAMP lock file from disk. Signature
Returns — Parsed lock file contents Example

writeLockFile(lock)

Write the lock file atomically under a process lock guard. Signature
Parameters Example

updateLockFile(updater)

Safely read-modify-write the lock file under a process lock guard. Signature
Parameters Returns — The updated lock file contents after the write Example

getCaampVersion()

Retrieve the current CAAMP package version from the nearest package.json. Signature
Returns — The semver version string (e.g. "1.8.1") Example

registerDoctorCommand(program)

Registers the doctor command for diagnosing configuration issues and overall system health. Signature
Parameters Example

registerInstructionsCheck(parent)

Registers the instructions check subcommand for verifying injection status across providers. Signature
Parameters Example

registerInstructionsInject(parent)

Registers the instructions inject subcommand for injecting instruction blocks into provider files. Signature
Parameters Example

registerInstructionsUpdate(parent)

Registers the instructions update subcommand for refreshing all instruction file injections. Signature
Parameters Example

registerInstructionsCommands(program)

Registers the instructions command group with inject, check, and update subcommands. Signature
Parameters Example

resetHookMappings()

Reset the cached hook mappings data. Signature
Example

getCanonicalEvent(event)

Get the canonical event definition (category, description, canBlock). Signature
Parameters Returns — The event definition containing category, description, and canBlock flag. Example

getAllCanonicalEvents()

Get all canonical event definitions. Signature
Returns — A record mapping every canonical event name to its definition. Example

getCanonicalEventsByCategory(category)

Get canonical events filtered by category. Signature
Parameters Returns — Array of canonical event names that belong to the specified category. Example

getProviderHookProfile(providerId)

Get the full hook profile for a provider. Signature
Parameters Returns — The provider’s hook profile, or undefined if not found. Example

getMappedProviderIds()

Get all provider IDs that have hook mappings. Signature
Returns — Array of provider ID strings. Example

toNative(canonical, providerId)

Translate a CAAMP canonical event name to the provider’s native name. Signature
Parameters Returns — The native event name, or null if unsupported. Example

toCanonical(nativeName, providerId)

Translate a provider-native event name to the CAAMP canonical name. Signature
Parameters Returns — The canonical event name, or null if no mapping exists. Example

toNativeBatch(canonicals, providerId)

Batch-translate multiple canonical events to native names for a provider. Signature
Parameters Returns — Array of normalized events (only supported ones included). Example

supportsHook(canonical, providerId)

Check if a provider supports a specific canonical hook event. Signature
Parameters Returnstrue if the provider supports this canonical event, false otherwise. Example

getHookSupport(canonical, providerId)

Get full hook support details for a canonical event on a provider. Signature
Parameters Returns — Support result including native name and optional notes. Example

getSupportedEvents(providerId)

Get all supported canonical events for a provider. Signature
Parameters Returns — Array of canonical event names the provider supports. Example

getUnsupportedEvents(providerId)

Get all unsupported canonical events for a provider. Signature
Parameters Returns — Array of canonical event names the provider does not support. Example

getProvidersForEvent(canonical)

Get providers that support a specific canonical event. Signature
Parameters Returns — Array of provider IDs that support this event. Example

getCommonEvents(providerIds)

Get canonical events common to all specified providers. Signature
Parameters Returns — Array of canonical events supported by all specified providers. Example

getProviderSummary(providerId)

Get a summary of hook support for a provider. Signature
Parameters Returns — The hook support summary, or undefined if the provider is not found. Example

buildHookMatrix(providerIds)

Build a cross-provider hook support matrix. Signature
Parameters Returns — The cross-provider matrix with events, providers, and mapping data. Example

getHookSystemType(providerId)

Get the hook system type for a provider. Signature
Parameters Returns — The hook system type ("config", "plugin", or "none"). Example

getHookConfigPath(providerId)

Get the resolved hook config path for a provider. Signature
Parameters Returns — The resolved filesystem path, or null if not available. Example

getProviderOnlyEvents(providerId)

Get provider-only events (native events with no canonical mapping). Signature
Parameters Returns — Array of native event names unique to this provider. Example

translateToAll(canonical, providerIds)

Translate a canonical event to native names across multiple providers. Signature
Parameters Returns — Record mapping provider IDs to their native event names (supported only). Example

resolveNativeEvent(nativeName)

Find the best canonical match for a native event name across all providers. Signature
Parameters Returns — Array of matches, each containing the provider ID and canonical event name. Example

getHookMappingsVersion()

Get the version of the hook mappings data. Signature
Returns — The semver version string of the loaded hook mappings data. Example

registerProvidersCommand(program)

Registers the providers command group with list, detect, show, skills-map, hooks, and capabilities subcommands. Signature
Parameters Example

getRulesByCategory(category)

Get audit rules filtered by category. Signature
Parameters Returns — Array of rules matching the given category Example

getRulesBySeverity(severity)

Get audit rules filtered by severity level. Signature
Parameters Returns — Array of rules matching the given severity Example

getCategories()

Get all unique rule categories. Signature
Returns — Array of unique category name strings Example

scanFile(filePath, rules)

Scan a single file against security audit rules. Signature
Parameters Returns — Audit result with findings, score, and pass/fail status Example

scanDirectory(dirPath)

Scan a directory of skills for security issues. Signature
Parameters Returns — Array of audit results, one per scanned SKILL.md Example

toSarif(results)

Convert audit results to SARIF 2.1.0 format (Static Analysis Results Interchange Format). Signature
Parameters Returns — SARIF 2.1.0 JSON object Example

registerSkillsAudit(parent)

Registers the skills audit subcommand for security scanning skill files. Signature
Parameters Example

parseSource(input)

Parse and classify a source string into a typed ParsedSource. Signature
Parameters Returns — Parsed source with type, value, and inferred name Example

isMarketplaceScoped(input)

Check if a source string looks like a marketplace scoped name (@author/name). Signature
Parameters Returnstrue if the input matches the @scope/name pattern Example

recordSkillInstall(skillName, scopedName, source, sourceType, agents, canonicalPath, isGlobal, projectDir, version)

Record a skill installation in the lock file. Signature
Parameters Example

removeSkillFromLock(skillName)

Remove a skill entry from the lock file. Signature
Parameters Returnstrue if the entry was found and removed, false if not found Example

getTrackedSkills()

Get all skills tracked in the lock file. Signature
Returns — Record of skill name to lock entry Example

checkSkillUpdate(skillName)

Check if a skill has updates available by comparing the installed version against the latest remote commit SHA. Signature
Parameters Returns — Object with update status, current version, and latest version Example

checkAllSkillUpdates()

Check for updates across all tracked skills. Signature
Returns — Object mapping skill names to their update status Example

registerSkillsCheck(parent)

Registers the skills check subcommand for checking available skill updates. Signature
Parameters Example

NetworkError

Structured error for network failures with categorized kind. Signature

fetchWithTimeout(url, init, timeoutMs)

Fetch a URL with an automatic timeout via AbortSignal.timeout. Signature
Parameters Returns — The Response object from the fetch call Throws
  • NetworkError on timeout or network failure
Example

ensureOkResponse(response, url)

Assert that a Response has an OK status, throwing on failure. Signature
Parameters Returns — The same Response if status is OK Throws
  • NetworkError when response.ok is false
Example

formatNetworkError(error)

Format a network error into a user-friendly message string. Signature
Parameters Returns — Human-readable error description Example

SkillsMPAdapter

Marketplace adapter for the agentskills.in API. Signature
Methods Search for skills by query string.

getSkill()

Look up a specific skill by its scoped name.

SkillsShAdapter

Marketplace adapter for the skills.sh API. Signature
Methods

search()

Search for skills by query string.

getSkill()

Look up a specific skill by its scoped name.

MarketplaceUnavailableError

Error thrown when all marketplace sources fail to respond. Signature

MarketplaceClient

Unified marketplace client that aggregates results from multiple marketplace adapters. Queries all configured marketplaces in parallel, deduplicates results by scoped name, and sorts by star count. Signature
Example
Methods

search()

Search all marketplaces and return deduplicated, sorted results. Queries all adapters in parallel and deduplicates by scopedName, keeping the entry with the highest star count. Results are sorted by stars descending.

getSkill()

Get a specific skill by its scoped name from any marketplace. Tries each adapter in order and returns the first match.

tokenizeCriteriaValue(value)

Splits a comma-separated criteria string into normalized tokens. Signature
Parameters Returns — An array of trimmed, lowercased, non-empty tokens Example

validateRecommendationCriteria(input)

Validates recommendation criteria input for correctness and consistency. Signature
Parameters Returns — A validation result indicating success or listing all issues Example

normalizeRecommendationCriteria(input)

Normalizes raw recommendation criteria into a consistent tokenized form. Signature
Parameters Returns — Normalized criteria with tokenized, sorted, deduplicated terms Example

scoreSkillRecommendation(skill, criteria, options)

Computes a recommendation score for a single skill against normalized criteria. Signature
Parameters Returns — A ranked recommendation with score, reasons, and tradeoffs Example

recommendSkills(skills, criteriaInput, options)

Validates, normalizes, scores, and ranks a list of skills against criteria. Signature
Parameters Returns — The normalized criteria and ranked skill recommendations Throws
  • Error with code and issues properties when criteria are invalid
Example

formatSkillRecommendations(result, opts)

Format skill recommendation results for display or serialization. Signature
Parameters Returns — Formatted string for human mode, or a structured object for JSON mode Example

searchSkills(query, options)

Search for skills via marketplace APIs. Signature
Parameters Returns — Array of marketplace skill entries matching the query Example

recommendSkills(query, criteria, options)

Search and rank skills based on query and recommendation criteria. Signature
Parameters Returns — Ranked recommendation results with scores and reasons Example

registerSkillsFind(parent)

Registers the skills find subcommand for searching marketplaces and recommending skills. Signature
Parameters Example

registerSkillsInit(parent)

Registers the skills init subcommand for scaffolding new SKILL.md templates. Signature
Parameters Example

loadLibraryFromModule(root)

Load a SkillLibrary from a module (index.js) at the given root directory. Signature
Parameters Returns — A validated SkillLibrary instance Throws
  • If the module cannot be loaded or does not implement SkillLibrary
Example

buildLibraryFromFiles(root)

Build a SkillLibrary from raw files in a directory. Signature
Parameters Returns — A SkillLibrary instance backed by filesystem reads Throws
  • If skills.json is not found at the root
Example

registerSkillLibrary(library)

Registers a SkillLibrary instance directly as the active catalog. Signature
Parameters Example

registerSkillLibraryFromPath(root)

Registers a skill library by loading it from a directory path. Signature
Parameters Throws
  • Error if the library cannot be loaded from the given path
Example

clearRegisteredLibrary()

Clears the registered skill library instance. Signature
Example

isCatalogAvailable()

Checks whether a skill library is available for use. Signature
Returns — True if a skill library is registered or discoverable, false otherwise Example

getSkills()

Returns all skill entries from the catalog. Signature
Returns — An array of all skill library entries Example

getManifest()

Returns the parsed skill library manifest. Signature
Returns — The skill library manifest object Example

listSkills()

Lists all available skill names in the catalog. Signature
Returns — An array of skill name strings Example

getSkill(name)

Gets skill metadata by name from the catalog. Signature
Parameters Returns — The skill entry if found, or undefined Example

getSkillPath(name)

Resolves the absolute path to a skill’s SKILL.md file. Signature
Parameters Returns — The absolute path to the skill’s SKILL.md file Example

getSkillDir(name)

Resolves the absolute path to a skill’s directory. Signature
Parameters Returns — The absolute path to the skill’s directory Example

readSkillContent(name)

Reads a skill’s SKILL.md content as a string. Signature
Parameters Returns — The full text content of the skill’s SKILL.md file Example

getCoreSkills()

Returns all skills marked as core in the catalog. Signature
Returns — An array of core skill entries Example

getSkillsByCategory(category)

Returns skills filtered by category. Signature
Parameters Returns — An array of skill entries in the specified category Example

getSkillDependencies(name)

Gets the direct dependency names for a skill. Signature
Parameters Returns — An array of direct dependency skill names Example

resolveDependencyTree(names)

Resolves the full dependency tree for a set of skill names. Signature
Parameters Returns — A deduplicated array of all required skill names including transitive dependencies Example

listProfiles()

Lists all available profile names in the catalog. Signature
Returns — An array of profile name strings Example

getProfile(name)

Gets a profile definition by name from the catalog. Signature
Parameters Returns — The profile definition if found, or undefined Example

resolveProfile(name)

Resolves a profile to its full skill list including inherited skills. Signature
Parameters Returns — A deduplicated array of all skill names required by the profile Example

listSharedResources()

Lists all available shared resource names in the catalog. Signature
Returns — An array of shared resource name strings Example

getSharedResourcePath(name)

Gets the absolute path to a shared resource file. Signature
Parameters Returns — The absolute path to the resource file, or undefined if not found Example

readSharedResource(name)

Reads a shared resource file’s content as a string. Signature
Parameters Returns — The text content of the resource, or undefined if not found Example

listProtocols()

Lists all available protocol names in the catalog. Signature
Returns — An array of protocol name strings Example

getProtocolPath(name)

Gets the absolute path to a protocol file. Signature
Parameters Returns — The absolute path to the protocol file, or undefined if not found Example

readProtocol(name)

Reads a protocol file’s content as a string. Signature
Parameters Returns — The text content of the protocol, or undefined if not found Example

validateSkillFrontmatter(name)

Validates a single skill’s frontmatter against the schema. Signature
Parameters Returns — A validation result indicating success or listing errors Example

validateAll()

Validates all skills in the catalog and returns results per skill. Signature
Returns — A map of skill names to their validation results Example

getDispatchMatrix()

Gets the dispatch matrix from the skill library manifest. Signature
Returns — The dispatch matrix object from the manifest Example

getVersion()

Returns the skill library version string. Signature
Returns — The library version string Example

getLibraryRoot()

Returns the absolute path to the skill library root directory. Signature
Returns — The absolute path to the library root Example

parseSkillFile(filePath)

Parse a SKILL.md file and extract its frontmatter metadata. Signature
Parameters Returns — Parsed metadata, or null if invalid Example

discoverSkill(skillDir)

Discover a single skill at a given directory path. Signature
Parameters Returns — Skill entry with metadata, or null if no valid SKILL.md exists Example

discoverSkills(rootDir)

Scan a directory for skill subdirectories, each containing a SKILL.md file. Signature
Parameters Returns — Array of discovered skill entries Example

discoverSkillsMulti(dirs)

Discover skills across multiple directories. Signature
Parameters Returns — Deduplicated array of discovered skill entries Example

cloneRepo(owner, repo, ref, subPath)

Clone a GitHub repo to a temp directory. Signature
Parameters Returns — Object with local path and cleanup function Example

fetchRawFile(owner, repo, path, ref)

Fetch a specific file from GitHub using the raw API. Signature
Parameters Returns — File content as a string, or null if the file cannot be fetched Example

repoExists(owner, repo)

Check if a GitHub repo exists. Signature
Parameters Returnstrue if the repository exists and is accessible Example

cloneGitLabRepo(owner, repo, ref, subPath)

Clone a GitLab repo to a temp directory. Signature
Parameters Returns — Object with local path and cleanup function Example

fetchGitLabRawFile(owner, repo, path, ref)

Fetch a specific file from GitLab using the raw API. Signature
Parameters Returns — File content as a string, or null if the file cannot be fetched Example

registerSkillsInstall(parent)

Registers the skills install subcommand for installing skills from various sources. Signature
Parameters Example

registerSkillsList(parent)

Registers the skills list subcommand for listing installed skills. Signature
Parameters Example

registerSkillsRemove(parent)

Registers the skills remove subcommand for removing installed skills. Signature
Parameters Example

registerSkillsUpdate(parent)

Registers the skills update subcommand for updating all outdated skills. Signature
Parameters Example

validateSkill(filePath)

Validate a SKILL.md file against the Agent Skills standard. Signature
Parameters Returns — Validation result with issues and parsed metadata Example

registerSkillsValidate(parent)

Registers the skills validate subcommand for validating SKILL.md file format. Signature
Parameters Example

registerSkillsCommands(program)

Registers the skills command group with all skill management subcommands. Signature
Parameters Example

isCaampOwnedSkill(skillName)

Check whether a skill name is reserved by CAAMP (ct-* prefix). Signature
Parameters Returnstrue if the skill name starts with ct- Example

checkSkillIntegrity(skillName, providers, scope, projectDir)

Check the integrity of a single installed skill. Signature
Parameters Returns — Integrity check result Example

checkAllSkillIntegrity(providers, scope, projectDir)

Check integrity of all tracked skills. Signature
Parameters Returns — Map of skill name to integrity result Example

shouldOverrideSkill(skillName, incomingSource, existingEntry)

Resolve a skill name conflict where a user-installed skill collides with a CAAMP-owned (ct-*) skill. Signature
Parameters Returnstrue if the incoming installation should proceed Example

validateInstructionIntegrity(providers, projectDir, scope, expectedContent)

Validate instruction file injection status across all providers. Signature
Parameters Returns — Array of file paths with issues Example

resolveCantImports(content, projectRoot)

Resolve *.cant references in instruction file content. Scans each line for directives pointing to .cant files. For each match, reads and parses the .cant file, converts its definitions to markdown, and replaces the line with the generated content. Lines that don’t match the .cant import pattern are left unchanged. Signature
Parameters Returns — Resolved content, imported file list, and any errors Example

cantToMarkdown(cantContent)

Convert a .cant file’s content to markdown equivalent. Parses the frontmatter to determine the document kind, then converts the body into structured markdown that providers can consume (headings, bullet lists, code blocks). Signature
Parameters Returns — Markdown representation of the .cant definitions Example

discoverWellKnown(domain)

Discover skills from a well-known URL. Signature
Parameters Returns — Array of discovered skill entries Example