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
34 lines (33 loc) • 1.85 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/.
import { UsageError } from "../core/errors.js";
import { warnOnce } from "../core/warn.js";
import { getStringArg } from "./parse-args.js";
export const SELECTION_ARGS = {
connection: { type: "string", description: "Run on this connection, by name (default: the default connection)" },
harness: { type: "string", description: "Run on this harness, by name or platform (default: the default harness)" },
model: { type: "string", description: "Model alias (fast, balanced, reasoning) or exact name" },
};
/** The retired `--engine`: parsed, left out of `--help` (`withoutHelpHiddenArgs`). Spread it where the flag existed. */
export const RETIRED_ENGINE_ARG = {
engine: { type: "string", hidden: true, description: "Retired: use --connection or --harness." },
};
export function selectionFromArgs(args) {
const connection = getStringArg(args, "connection");
const harness = getStringArg(args, "harness");
if (connection !== undefined && harness !== undefined) {
throw new UsageError("--connection and --harness are mutually exclusive. Pick one.", "INVALID_FLAG_VALUE");
}
const engine = getStringArg(args, "engine");
if (engine !== undefined) {
warnOnce("retired-flag:--engine", "--engine is retired: use --connection or --harness. For now it names a connection by that name, else a harness.");
}
const model = getStringArg(args, "model");
return {
...(connection !== undefined ? { connection } : {}),
...(harness !== undefined ? { harness } : {}),
...(engine !== undefined ? { engine } : {}),
...(model !== undefined ? { model } : {}),
};
}