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

25 lines (24 loc) • 1.17 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 { loadConfig } from "../../core/config/config.js"; import { appendEvent } from "../../core/events.js"; import { resolveWritableOverride, saveGitStash } from "../../sources/providers/git.js"; /** * `akm sync`: commit every unignored change inside a git-backed bundle (the named one, or the primary bundle), and push when * it is writable with a remote configured. The CLI and the workspace's bundle commit both run this. */ export function akmSync(args) { // Primary stash — honour the configured default bundle's writable flag. const writable = args.name === undefined ? resolveWritableOverride(loadConfig()) : undefined; const result = saveGitStash(args.name, args.message, writable, { push: args.push !== false }); appendEvent({ eventType: "sync", metadata: { name: args.name ?? null, message: args.message ?? null, ok: result.ok !== false, }, }); return result; }