Step 10: Code review, testing & documentation

Code Review (REVIEW.md):
- Fixed parseSearchResponse skipping first result (critical bug)
- Fixed trashbin/versions/chunked paths missing /remote.php/dav prefix
- Fixed trash_restore to use original file location instead of /restore endpoint
- Fixed createTask/updateTask missing iCal text escaping
- Added 409 handling for createFolder (parent missing)
- Extracted duplicate decodeXmlText to utils.ts
- Extracted duplicate generateUID to utils.ts (shared with calendar/tasks)
- Removed 5 dead code functions (parseVEVENT, extractVEventBlocks, unfoldICalLines, getCalDAVXmlHeaders, local decodeXmlText)
- Cleaned unused imports across all tool files

Testing (RESULTS.md):
- 35 tests passed, 1 skipped (trash_empty), 1 server limitation (bulk_upload)
- Tested all 21+ file tools, edge cases (spaces, unicode, overwrite, empty folders)
- Verified chunked upload end-to-end

Documentation (README.md):
- Complete tool reference (21 file + 10 other tools)
- Quick start, CLI usage, size limits, troubleshooting
- Architecture overview
This commit is contained in:
2026-05-11 18:05:37 +02:00
parent 2cb1666441
commit 8461970523
9 changed files with 482 additions and 371 deletions
+1 -15
View File
@@ -9,7 +9,6 @@ import {
dedupeEvents,
formatICalDate,
formatICalDateTimeUtc,
getCalDAVXmlHeaders,
getEventSortTimestamp,
parseCalendarsFromPROPFIND,
parseEventsFromCalDAV,
@@ -18,6 +17,7 @@ import {
stripEventInternalFields,
} from "../caldav.js";
import { format } from "date-fns";
import { escapeICalText, generateUUID as generateUID } from "../utils.js";
export const calendarToolModule: ToolModule = {
definitions: [
@@ -373,20 +373,6 @@ END:VCALENDAR`;
// --- Helpers ---
function generateUID(): string {
return `${Date.now()}-${Math.random().toString(36).substring(7)}`;
}
function escapeICalText(value: string): string {
return value
.replace(/\\/g, "\\\\")
.replace(/\r\n/g, "\n")
.replace(/\r/g, "\n")
.replace(/\n/g, "\\n")
.replace(/;/g, "\\;")
.replace(/,/g, "\\,");
}
const debugEnabled = process.env.DEBUG_NEXTCLOUD_MCP === "1";
function debugLog(client: NextcloudClient, message: string): void {