UNPKG

@sofianedjerbi/knowledge-tree-mcp

Version:

MCP server for hierarchical project knowledge management

84 lines 2.97 kB
/** * File system utilities for Knowledge Tree MCP * Handles all file operations, directory management, and path utilities */ import type { KnowledgeEntry } from '../types/index.js'; /** * Scans the knowledge tree directory recursively for JSON files * @param knowledgeRoot - Root directory to scan * @returns Array of relative paths to JSON files */ export declare function scanKnowledgeTree(knowledgeRoot: string): Promise<string[]>; /** * Ensures a directory exists, creating it if necessary * @param dirPath - Directory path to ensure exists * @returns Whether the directory was newly created */ export declare function ensureDirectory(dirPath: string): Promise<boolean>; /** * Reads a knowledge entry from a JSON file * @param filePath - Path to the JSON file * @returns Parsed knowledge entry */ export declare function readKnowledgeEntry(filePath: string): Promise<KnowledgeEntry>; /** * Writes a knowledge entry to a JSON file * @param filePath - Path to the JSON file * @param entry - Knowledge entry to write */ export declare function writeKnowledgeEntry(filePath: string, entry: KnowledgeEntry): Promise<void>; /** * Checks if a file exists * @param filePath - Path to check * @returns Whether the file exists */ export declare function fileExists(filePath: string): Promise<boolean>; /** * Deletes a file * @param filePath - Path to the file to delete */ export declare function deleteFile(filePath: string): Promise<void>; /** * Gets file statistics * @param filePath - Path to the file * @returns File statistics */ export declare function getFileStats(filePath: string): Promise<import("fs").Stats>; /** * Appends content to a file * @param filePath - Path to the file * @param content - Content to append */ export declare function appendToFile(filePath: string, content: string): Promise<void>; /** * Reads file content as string * @param filePath - Path to the file * @returns File content */ export declare function readFile(filePath: string): Promise<string>; /** * Write content to a file * @param filePath - Path to write to * @param content - Content to write */ export declare function writeFile(filePath: string, content: string): Promise<void>; /** * Generates a description from a knowledge entry path * @param path - Relative path to the knowledge entry * @returns Human-readable description */ export declare function getDescriptionFromPath(path: string): string; /** * Ensures a path ends with .json extension * @param path - Path to check * @returns Path with .json extension */ export declare function ensureJsonExtension(path: string): string; /** * Ensures a path ends with an appropriate knowledge extension * @param path - Path to check * @param preferMarkdown - Whether to prefer .md over .json * @returns Path with appropriate extension */ export declare function ensureKnowledgeExtension(path: string, preferMarkdown?: boolean): string; //# sourceMappingURL=fileSystem.d.ts.map