import type { AdapterSkillConfig } from "./types.js"; /** * Static configuration for all known adapter types. * This is the single source of truth for skill directory paths, formats, and * install capability across the Nexus adapter ecosystem. */ const ADAPTER_SKILL_CONFIGS: readonly AdapterSkillConfig[] = [ { adapterType: "claude_local", skillDir: "~/.claude/skills/", nativeSkillDir: null, format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "hermes_local", skillDir: "~/.hermes/skills/", nativeSkillDir: "~/.hermes/skills/", format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "openclaw_gateway", skillDir: "~/.openclaw/skills/", nativeSkillDir: null, format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "codex_local", skillDir: "~/.agents/skills/", nativeSkillDir: null, format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "cursor", skillDir: "~/.cursor/skills/", nativeSkillDir: null, format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "opencode_local", skillDir: "~/.config/opencode/skills/", nativeSkillDir: null, format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "pi_local", skillDir: "~/.pi/agent/skills/", nativeSkillDir: null, format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "gemini_local", skillDir: "~/.gemini/skills/", nativeSkillDir: null, format: "skill-md", supportsInstall: true, unsupportedReason: null, }, { adapterType: "process", skillDir: null, nativeSkillDir: null, format: "none", supportsInstall: false, unsupportedReason: "Skills not supported for this adapter type", }, { adapterType: "http", skillDir: null, nativeSkillDir: null, format: "none", supportsInstall: false, unsupportedReason: "Skills not supported for this adapter type", }, ]; /** Lookup index built from the static config array for O(1) resolution. */ const CONFIG_BY_TYPE = new Map( ADAPTER_SKILL_CONFIGS.map((cfg) => [cfg.adapterType, cfg]), ); /** Fallback returned for unknown adapter types — never throws. */ const FALLBACK_CONFIG: AdapterSkillConfig = { adapterType: "unknown", skillDir: null, nativeSkillDir: null, format: "none", supportsInstall: false, unsupportedReason: "Unknown adapter type — skills not supported", }; /** * Returns the AdapterSkillConfig for the given adapter type. * Unknown types receive a safe fallback config with supportsInstall: false. * Never throws. */ export function resolveAdapterSkillConfig(adapterType: string): AdapterSkillConfig { return CONFIG_BY_TYPE.get(adapterType) ?? { ...FALLBACK_CONFIG, adapterType }; } /** * Returns all registered adapter skill configs (one per known adapter type). */ export function listAdapterSkillConfigs(): readonly AdapterSkillConfig[] { return ADAPTER_SKILL_CONFIGS; }