Phase 2: API Unification & Typed Results + Phase 2.1 Fixes
Phase 2 - Breaking Changes (v2.0.0): - Added typed result interfaces (FileMetadata, DirectoryMetadata, VaultInfo, SearchResult, SearchMatch) - Unified parameter naming: list_notes now uses 'path' parameter (removed 'folder') - Enhanced tool responses with structured JSON for all tools - list_notes: Returns array of FileMetadata/DirectoryMetadata with full metadata - search_notes: Returns SearchResult with line numbers, snippets, and match ranges - get_vault_info: Returns VaultInfo with comprehensive statistics - Updated all tool descriptions to document structured responses - Version bumped to 2.0.0 (breaking changes) Phase 2.1 - Post-Testing Fixes: - Fixed root listing to exclude vault root folder itself (handles path '', '/', and isRoot()) - Fixed alphabetical sorting to be case-insensitive for stable ordering - Improved directory metadata with better timestamp detection and error handling - Fixed parent folder validation order (check if file before checking existence) - Updated documentation with root path examples and leading slash warnings - Added comprehensive test suite for sorting and root listing behavior - Fixed test mocks to use proper TFile/TFolder instances Tests: All 64 tests passing Build: Successful, no errors
This commit is contained in:
@@ -61,3 +61,49 @@ export interface CallToolResult {
|
||||
content: ContentBlock[];
|
||||
isError?: boolean;
|
||||
}
|
||||
|
||||
// Phase 2: Typed Result Interfaces
|
||||
export type ItemKind = "file" | "directory";
|
||||
|
||||
export interface FileMetadata {
|
||||
kind: "file";
|
||||
name: string;
|
||||
path: string;
|
||||
extension: string;
|
||||
size: number;
|
||||
modified: number;
|
||||
created: number;
|
||||
}
|
||||
|
||||
export interface DirectoryMetadata {
|
||||
kind: "directory";
|
||||
name: string;
|
||||
path: string;
|
||||
childrenCount: number;
|
||||
modified: number;
|
||||
}
|
||||
|
||||
export interface VaultInfo {
|
||||
name: string;
|
||||
path: string;
|
||||
totalFiles: number;
|
||||
totalFolders: number;
|
||||
markdownFiles: number;
|
||||
totalSize: number;
|
||||
}
|
||||
|
||||
export interface SearchMatch {
|
||||
path: string;
|
||||
line: number;
|
||||
column: number;
|
||||
snippet: string;
|
||||
matchRanges: Array<{ start: number; end: number }>;
|
||||
}
|
||||
|
||||
export interface SearchResult {
|
||||
query: string;
|
||||
matches: SearchMatch[];
|
||||
totalMatches: number;
|
||||
filesSearched: number;
|
||||
filesWithMatches: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user