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

31 lines (30 loc) • 1.32 kB
// 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/. import { CRON_BACKEND } from "./cron.js"; import { LAUNCHD_BACKEND } from "./launchd.js"; import { SCHTASKS_BACKEND } from "./schtasks.js"; // WI-9.10e: the former `_setBackendsForTests` module-mutation seam was retired. // Tests inject a fake `SchedulerBackend` directly via the `deps.backend` parameter // the `akm task` mutation entries already accept (the backend carries its own // `name`), so no module-level override binding is needed. `selectBackend`'s // `options.platform` covers the platform-steering the seam's second override // used to provide. export function selectBackend(options = {}) { const platform = options.platform ?? process.platform; switch (platform) { case "win32": return SCHTASKS_BACKEND(options.schtasks); case "darwin": return LAUNCHD_BACKEND(options.launchd); default: return CRON_BACKEND(options.cron); } } export function backendNameForPlatform(platform = process.platform) { if (platform === "win32") return "schtasks"; if (platform === "darwin") return "launchd"; return "cron"; }