UNPKG

akm-cli

Version:

akm (Agent Knowledge Manager) — a portable, local-first capability library for AI agents. Discover, load, share, and improve reusable skills, scripts, workflows, and knowledge across any shell-capable coding agent, including Claude Code, OpenCode, and Cur

28 lines (27 loc) • 921 B
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. /** * Create a fresh, independent {@link CommandRegistry} backed by its own * `Map`. Each call returns a distinct registry — call once per registry * module and hold the result in a module-level `const`. */ export function createCommandRegistry() { const handlers = new Map(); return { register(command, handler) { handlers.set(command, handler); }, registerAll(entries) { for (const { command, handler } of entries) { handlers.set(command, handler); } }, deregister(command) { handlers.delete(command); }, get(command) { return handlers.get(command); }, }; }