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

47 lines (46 loc) • 1.85 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/. /** * Setup wizard step for agent platforms: detect agent platform config dirs * and offer them as bundle sources. */ import * as p from "../../cli/clack.js"; import { detectAgentPlatforms } from "../detect.js"; import { prompt } from "../prompt.js"; // The just-computed source list is threaded through the private setup draft. export async function stepAgentPlatforms(current) { const platforms = detectAgentPlatforms(); if (platforms.length === 0) { p.log.info("No agent platform configurations detected."); return []; } const existingPaths = new Set((current.additionalSources ?? []).map((s) => s.path)); // Filter out platforms already configured const newPlatforms = platforms.filter((pl) => !existingPaths.has(pl.path)); if (newPlatforms.length === 0) { p.log.info(`Detected ${platforms.length} agent platform(s), all already configured as bundle sources.`); return []; } const selected = await prompt(() => p.multiselect({ message: "Found agent platform configurations. Add as bundle sources?", options: newPlatforms.map((pl) => ({ value: pl.path, label: pl.name, hint: pl.path, })), required: false, })); const entries = []; for (const selectedPath of selected) { const platform = newPlatforms.find((pl) => pl.path === selectedPath); if (platform) { entries.push({ type: "filesystem", path: platform.path, name: platform.name.toLowerCase().replace(/\s+/g, "-"), }); } } return entries; }