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
29 lines (28 loc) • 1.26 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 { captureFrozenDirectoryIdentity } from "../../../execution/directory-identity.js";
import { freezeEnvironment } from "../environment.js";
import { gitIdentity } from "../identity.js";
import { freezeExecSpec, } from "../step-values.js";
export function directShell(source, baseUnit, context) {
const authoredExec = baseUnit.exec;
if (!authoredExec)
throw new Error(`workflow shell step ${source.id} has no argv`);
const exec = freezeExecSpec(source, authoredExec, context);
const cwdIdentity = captureFrozenDirectoryIdentity(context.asset.sourcePath, authoredExec.cwd);
const environment = Object.freeze(freezeEnvironment(source, authoredExec, context));
const target = Object.freeze({
kind: "shell",
contentHash: "",
exec,
cwdIdentity,
...gitIdentity(baseUnit, cwdIdentity.realRoot),
});
return {
target,
environment,
unit: { ...baseUnit, exec },
instructions: source.instructions ?? `Run ${authoredExec.command.join(" ")}.`,
};
}