@memory-bank/mcp
Version:
Memory-enabled Co-Pilot (MCP) server for managing project documentation and context
109 lines • 3.07 kB
TypeScript
import { DocumentPath } from './DocumentPath.js';
import { Tag } from './Tag.js';
import { IDocumentLogger } from '../logger/IDocumentLogger.js';
import { JsonDocumentV2 } from '@memory-bank/schemas';
/**
* Set the logger instance for MemoryDocument
* This allows dependency injection from outside the domain
* @param logger Logger implementation to use
*/
export declare function setDocumentLogger(logger: IDocumentLogger): void;
/**
* Props for MemoryDocument entity
*/
interface MemoryDocumentProps {
path: DocumentPath;
content: string;
tags: Tag[];
lastModified: Date;
}
/**
* Entity representing a document in the memory bank
*/
export declare class MemoryDocument {
private readonly props;
private constructor();
/**
* Factory method to create a new MemoryDocument
* @param props Document properties
* @returns MemoryDocument instance
*/
static create(props: MemoryDocumentProps): MemoryDocument;
/**
* Get the document path
*/
get path(): DocumentPath;
/**
* Get the document content
*/
get content(): string;
/**
* Get the document tags
*/
get tags(): Tag[];
/**
* Get the last modified date
*/
get lastModified(): Date;
/**
* Check if document has a specific tag
* @param tag Tag to check
* @returns boolean indicating if document has tag
*/
hasTag(tag: Tag): boolean;
/**
* Create a new document with updated content
* @param content New content
* @returns New MemoryDocument instance
*/
updateContent(content: string): MemoryDocument;
/**
* Create a new document with added tag
* @param tag Tag to add
* @returns New MemoryDocument instance
*/
addTag(tag: Tag): MemoryDocument;
/**
* Create a new document with removed tag
* @param tag Tag to remove
* @returns New MemoryDocument instance
*/
removeTag(tag: Tag): MemoryDocument;
/**
* Create a new document with updated tags
* @param tags New tags
* @returns New MemoryDocument instance
*/
updateTags(tags: Tag[]): MemoryDocument;
/**
* Extract the document title from content
* @returns Document title or undefined if not found
*/
get title(): string | undefined;
/**
* Check if the document is a JSON file
*/
get isJSON(): boolean;
/**
* Convert to plain object for serialization
*/
toObject(): Record<string, unknown>;
/**
* Convert document to JSON format
* @returns JSON document object
*/
toJSON(): JsonDocumentV2;
/**
* Convert JSON document to Markdown
* @param jsonDoc JSON document to convert
* @returns Markdown formatted string
*/
static fromJSON(jsonDoc: JsonDocumentV2, path: DocumentPath): MemoryDocument;
/**
* Determine the document type based on the path or content
* @returns document type
*/
private determineDocumentType;
}
export {};
//# sourceMappingURL=MemoryDocument.d.ts.map