( input: string, projectRoot: string, )
| 441 | * @param projectRoot - Project root directory to search within |
| 442 | */ |
| 443 | export 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. |
no test coverage detected