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
55 lines (54 loc) • 2.32 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/.
/**
* `egress-endpoints` advisory for `akm health` (meta-review 08, surfaces 3/9):
* the remote-destination list, for eyeball diff. A pure projection over the
* effective config (no process.env reads); silent when nothing remote is
* configured, matching the `stash-git-exposure` / `binary-config-skew`
* advisories' pattern.
*/
import { formatRegistryUrl } from "../../core/registry-url.js";
/**
* `egress-endpoints` (08 surfaces 3/9): the full list of remote destinations
* akm can talk to under the effective config — registries, remote sources,
* LLM endpoints, embedding endpoint — as one pass-status informational entry
* for eyeball diff against expectations. Silent only when nothing remote is
* configured at all.
*/
export function collectEgressAdvisory(config) {
if (!config)
return undefined;
const endpoints = [];
for (const reg of config.registries ?? []) {
if (reg.enabled === false || !reg.url)
continue;
endpoints.push(`registry ${reg.name ?? "(unnamed)"}: ${formatRegistryUrl(reg.url)}`);
}
for (const [key, bundle] of Object.entries(config.bundles ?? {})) {
if (!bundle)
continue;
const url = bundle.git ?? bundle.website?.url;
if (!url)
continue;
endpoints.push(`source ${key} (${bundle.git ? "git" : "website"}): ${url}`);
}
for (const [name, engine] of Object.entries(config.engines ?? {})) {
if (engine?.kind !== "llm" || !engine.endpoint)
continue;
endpoints.push(`llm ${name}: ${engine.endpoint}`);
}
if (config.embedding?.endpoint)
endpoints.push(`embedding: ${config.embedding.endpoint}`);
if (endpoints.length === 0)
return undefined;
return {
name: "egress-endpoints",
kind: "deterministic",
status: "pass",
confidence: "high",
message: `${endpoints.length} remote endpoint(s) in the effective config (registries/sources/LLM/embedding) — ` +
"review the evidence list for unexpected destinations.",
evidence: { endpoints },
};
}