UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

117 lines 3.39 kB
/** * Skills Registry Coordinator * * Aggregates search results across multiple registry adapters * (local, clawhub, openclaw) into a unified interface. * * @implements #539 */ import { LocalAdapter } from './adapters/local.js'; import { ClawHubAdapter } from './adapters/clawhub.js'; import { OpenClawAdapter } from './adapters/openclaw.js'; /** * All known registry adapters */ const ALL_ADAPTERS = [ new LocalAdapter(), new ClawHubAdapter(), new OpenClawAdapter(), ]; /** * Get adapter by ID */ export function getAdapter(id) { return ALL_ADAPTERS.find((a) => a.id === id); } /** * Get all registered adapters */ export function getAllAdapters() { return ALL_ADAPTERS; } /** * Search across all adapters (or a specific one) */ export async function searchSkills(query, providerId) { const adapters = providerId ? ALL_ADAPTERS.filter((a) => a.id === providerId) : ALL_ADAPTERS; const results = []; for (const adapter of adapters) { const available = await adapter.isAvailable(); if (!available) continue; const adapterResults = await adapter.search(query); results.push(...adapterResults); } return results; } /** * List all skills across adapters (or a specific one) */ export async function listSkills(providerId) { const adapters = providerId ? ALL_ADAPTERS.filter((a) => a.id === providerId) : ALL_ADAPTERS; const results = []; for (const adapter of adapters) { const available = await adapter.isAvailable(); if (!available) continue; const adapterResults = await adapter.list(); results.push(...adapterResults); } return results; } /** * Get detailed skill info (checks adapters in order) */ export async function getSkillInfo(name, providerId) { const adapters = providerId ? ALL_ADAPTERS.filter((a) => a.id === providerId) : ALL_ADAPTERS; for (const adapter of adapters) { const available = await adapter.isAvailable(); if (!available) continue; const info = await adapter.info(name); if (info) return info; } return undefined; } /** * Install a skill from a specific registry with cross-platform deployment */ export async function installSkill(name, options, providerId) { const adapter = getAdapter(providerId); if (!adapter) { throw new Error(`Unknown registry: ${providerId}`); } if (!adapter.install) { throw new Error(`Registry '${providerId}' does not support install`); } const available = await adapter.isAvailable(); if (!available) { throw new Error(`Registry '${providerId}' is not available`); } await adapter.install(name, options); } /** * Publish a skill to a specific registry */ export async function publishSkill(packageDir, providerId) { const adapter = getAdapter(providerId); if (!adapter) { throw new Error(`Unknown registry: ${providerId}`); } if (!adapter.publish) { throw new Error(`Registry '${providerId}' does not support publish`); } const available = await adapter.isAvailable(); if (!available) { throw new Error(`Registry '${providerId}' is not available`); } await adapter.publish(packageDir); } //# sourceMappingURL=registry.js.map