loccon
Version:
A simple local context storage and management tool with CLI and web interfaces. Store, search, and organize code snippets, notes, and development contexts with sharded JSON storage.
46 lines • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextManager = void 0;
const storage_1 = require("./storage");
class ContextManager {
constructor(storage) {
this.storage = storage;
}
static async create(customStoragePath) {
const storage = await storage_1.StorageManager.create(customStoragePath);
return new ContextManager(storage);
}
async add(tag, content, categories = []) {
return await this.storage.addContext(tag, content, categories);
}
async read(tag) {
return await this.storage.readContext(tag);
}
async update(tag, content, categories = []) {
return await this.storage.updateContext(tag, content, categories);
}
async remove(tag) {
return await this.storage.removeContext(tag);
}
async list() {
return await this.storage.listAllTags();
}
async getAll() {
return await this.storage.getAllContexts();
}
async search(query, useFuzzy = false) {
return await this.storage.searchContexts(query, useFuzzy);
}
async exists(tag) {
const context = await this.storage.readContext(tag);
return context !== null;
}
getStoragePath() {
return this.storage.getStoragePath();
}
async rebuildIndex() {
return await this.storage.rebuildIndex();
}
}
exports.ContextManager = ContextManager;
//# sourceMappingURL=context.js.map