MCPcopy Create free account
hub / github.com/backnotprop/plannotator / validateCodeNavRequest

Function validateCodeNavRequest

packages/shared/code-nav.ts:336–358  ·  view source on GitHub ↗
(
  body: unknown,
)

Source from the content-addressed store, hash-verified

334// ---------------------------------------------------------------------------
335
336export function validateCodeNavRequest(
337 body: unknown,
338): string | null {
339 if (!body || typeof body !== "object") return "Invalid request body";
340 const b = body as Record<string, unknown>;
341
342 if (typeof b.symbol !== "string" || !b.symbol.trim()) {
343 return "Missing or empty symbol";
344 }
345 if (typeof b.filePath !== "string" || !b.filePath.trim()) {
346 return "Missing filePath";
347 }
348 try {
349 validateFilePath(b.filePath as string);
350 } catch {
351 return "Invalid filePath";
352 }
353 if (b.side !== "old" && b.side !== "new") {
354 return "side must be 'old' or 'new'";
355 }
356
357 return null;
358}
359
360// ---------------------------------------------------------------------------
361// Main entry point

Callers 3

code-nav.test.tsFile · 0.90
handleCodeNavResolveFunction · 0.90
startReviewServerFunction · 0.85

Calls 1

validateFilePathFunction · 0.70

Tested by

no test coverage detected