doctool
Version:
AI-powered documentation validation and management system
61 lines (60 loc) • 1.71 kB
TypeScript
import { DocumentationLocation, ValidationIssue } from './fileSystemValidator.js';
export interface LinkReference {
url: string;
type: 'http' | 'https' | 'ftp' | 'mailto' | 'internal' | 'anchor';
mentioned_in: DocumentationLocation;
status: 'unknown' | 'valid' | 'broken' | 'unreachable';
response_code?: number;
error_message?: string;
target_file?: string;
anchor?: string;
}
export interface LinkValidationResult {
link: LinkReference;
valid: boolean;
issues: ValidationIssue[];
}
/**
* Validates links and URLs in documentation files
*/
export declare class LinkValidator {
private basePath;
private timeoutMs;
private userAgent;
constructor(basePath?: string, timeoutMs?: number);
/**
* Validates all links in a documentation file
*/
validateDocumentationFile(docFilePath: string): Promise<ValidationIssue[]>;
/**
* Extracts all links from markdown content
*/
extractLinks(content: string, sourceFile: string): LinkReference[];
/**
* Validates a single link
*/
validateLink(link: LinkReference, docFilePath: string): Promise<LinkValidationResult>;
/**
* Validates HTTP/HTTPS URLs
*/
private validateHttpUrl;
/**
* Validates internal file links
*/
private validateInternalLink;
/**
* Validates anchor links (#heading)
*/
private validateAnchorLink;
/**
* Validates email addresses
*/
private validateEmailAddress;
private determineLinkType;
private extractAnchor;
private deduplicateLinks;
private extractHeadings;
private normalizeAnchor;
private suggestSimilarFiles;
private suggestUrlFix;
}