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

39 lines (38 loc) • 1.8 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/. /** * `binary-config-skew` advisory for `akm health`: warn when config.json * carries a `configVersion` NEWER than (or unorderable against) this binary's * CURRENT_CONFIG_VERSION — a newer akm wrote the shared config, so this * install is stale. That is the proven multi-install incident class. Silent * for current or older versions and for unreadable configs (config loading * reports its own errors). */ import { readTextFile } from "../../core/common.js"; import { CURRENT_CONFIG_VERSION } from "../../core/config/config-schema.js"; import { compareConfigVersion } from "../../core/config/config-version.js"; export function collectConfigSkewAdvisory(configPath) { let raw; try { raw = JSON.parse(readTextFile(configPath, "Config file")); } catch { return undefined; } const onDisk = raw.configVersion; const order = compareConfigVersion(onDisk, CURRENT_CONFIG_VERSION); const skewed = order === 1 || (onDisk !== undefined && order === undefined); if (!skewed) return undefined; return { name: "binary-config-skew", kind: "deterministic", status: "warn", confidence: "high", message: `config.json has configVersion ${JSON.stringify(onDisk)} but this binary knows ${CURRENT_CONFIG_VERSION} — ` + "a newer akm wrote the shared config, so this install is stale. Upgrade this install; do not keep a stale " + "binary against the shared config/DBs.", evidence: { onDiskConfigVersion: onDisk, binaryConfigVersion: CURRENT_CONFIG_VERSION }, }; }