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.03 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 { resolveStashDir } from "../../core/common.js";
import { ConfigError } from "../../core/errors.js";
/**
* Filesystem source — points at a directory the user already manages.
*
* Implements {@link SourceProvider} with `{ name, kind, path }`. No `sync()`:
* content is the user's own directory, never refreshed by akm.
*/
export function createFilesystemProvider(entry) {
if (entry.type !== "filesystem") {
throw new ConfigError(`filesystem source invoked with type="${entry.type}"`);
}
const stashDir = entry.path ?? resolveStashDir();
if (!stashDir) {
throw new ConfigError("filesystem source requires a `path`");
}
const name = entry.name ?? stashDir;
return {
kind: "filesystem",
name,
path() {
return stashDir;
},
};
}