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

Function resolveMarkdownFile

packages/shared/resolve-file.ts:443–476  ·  view source on GitHub ↗
(
	input: string,
	projectRoot: string,
)

Source from the content-addressed store, hash-verified

441 * @param projectRoot - Project root directory to search within
442 */
443export function resolveMarkdownFile(
444 input: string,
445 projectRoot: string,
446): ResolveResult {
447 const originalInput = input.trim();
448 const unquotedInput = stripWrappingQuotes(originalInput);
449
450 const primary = resolveMarkdownFileCore(unquotedInput, projectRoot);
451 if (primary.kind === "found") {
452 return primary;
453 }
454 if (primary.kind === "ambiguous") {
455 return { ...primary, input: originalInput };
456 }
457
458 if (!unquotedInput.startsWith("@")) {
459 return { kind: "not_found", input: originalInput };
460 }
461
462 const normalizedInput = unquotedInput.replace(/^@+/, "");
463 if (!normalizedInput) {
464 return { kind: "not_found", input: originalInput };
465 }
466
467 const fallback = resolveMarkdownFileCore(normalizedInput, projectRoot);
468 if (fallback.kind === "found") {
469 return fallback;
470 }
471 if (fallback.kind === "ambiguous") {
472 return { ...fallback, input: originalInput };
473 }
474
475 return { kind: "not_found", input: originalInput };
476}
477
478/**
479 * Check if a directory contains at least one file matching the given extensions.

Callers 5

handleAnnotateCommandFunction · 0.90
index.tsFile · 0.90

Calls 3

stripWrappingQuotesFunction · 0.85
resolveMarkdownFileCoreFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected