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
39 lines (38 loc) • 1.38 kB
JavaScript
// 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/.
function planGlyph(status) {
switch (status) {
case "current":
return "✓";
case "ready":
return "⚠";
default: // "blocked"
return "✗";
}
}
export function formatMigratePlain(result) {
if (!result || typeof result !== "object")
return null;
const plan = result;
if (typeof plan.status !== "string")
return null;
const lines = [`${planGlyph(plan.status)} ${plan.status}`];
if (plan.taskFiles) {
const tasks = plan.taskFiles;
lines.push(` task files: ${tasks.changed} change, ${tasks.skipped} current, ${tasks.blocked} blocked`);
}
if (plan.blockers?.length) {
lines.push("", "blockers:", ...plan.blockers.map((blocker) => ` - ${blocker}`));
}
if (plan.backupPath) {
lines.push("", `backup: ${plan.backupPath}`);
}
if (plan.applied !== undefined)
lines.push(`applied: ${plan.applied}`);
return lines.join("\n");
}
export const migrateFormatters = [
{ command: "migrate-status", handler: (r) => formatMigratePlain(r) },
{ command: "migrate-apply", handler: (r) => formatMigratePlain(r) },
];