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

32 lines (31 loc) • 1.56 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/. /** The default bundle's scheduled tasks, and the actions that enable or disable one on this host. */ import { loadConfig } from "../core/config/config.js"; import { UsageError } from "../core/errors.js"; import { listSetupTaskDefinitions } from "../setup/steps/tasks.js"; import { runCli } from "./cli-child.js"; /** The tasks the default bundle holds that have a schedule, and whether this host has enabled each. Nothing is written. */ export function list() { if (!loadConfig().defaultBundle) return { tasks: [] }; return { tasks: listSetupTaskDefinitions() }; } /** The arguments that name a task in the default bundle, the one `list` reads. */ function target(input) { if (typeof input?.task !== "string" || !input.task.trim()) throw new UsageError("task must name a task."); const bundle = loadConfig().defaultBundle; if (!bundle) throw new UsageError("There is no default bundle yet."); return [`--bundle=${bundle}`, "--", input.task.trim()]; } /** `akm task enable`: schedule it in this host's scheduler and sync that. */ export async function enable(input) { return runCli(["task", "enable", ...target(input)]); } /** `akm task disable`: take it out of this host's scheduler and sync that. */ export async function disable(input) { return runCli(["task", "disable", ...target(input)]); }