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

35 lines (34 loc) • 1.22 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/. import { deepMergeConfig } from "../core/config/deep-merge.js"; /** * Build a fresh `SetupContext` over a starting config. The returned context * applies deltas in-place onto an internal accumulator and exposes the * latest snapshot via `ctx.config`. */ export function createSetupContext(initial, options) { let acc = deepMergeConfig({}, initial); return { get config() { return acc; }, nonInteractive: options.nonInteractive, apply(delta) { acc = deepMergeConfig(acc, delta); }, }; } /** * Run a list of steps against a context. Steps marked interactive-only are * skipped when `ctx.nonInteractive` is true. Returns the final accumulated * config so callers can persist it without re-reading the context. */ export async function runSetupSteps(steps, ctx) { for (const step of steps) { if (ctx.nonInteractive && !step.nonInteractive) continue; await step.run(ctx); } return ctx.config; }