import fs from 'node:fs'; import http from 'node:http'; export { Writr } from 'writr'; type ApiSchemaProperty = { name: string; type: string; required: boolean; description: string; enumValues?: string[]; }; type ApiOperationParameter = { name: string; in: string; required: boolean; type: string; description: string; }; type ApiRequestBody = { contentType: string; schemaProperties: ApiSchemaProperty[]; example: string; }; type ApiResponse = { statusCode: string; statusClass: string; description: string; contentType: string; schemaProperties: ApiSchemaProperty[]; example: string; }; type ApiCodeExamples = { curl: string; javascript: string; python: string; }; type ApiOperation = { id: string; method: string; methodUpper: string; path: string; summary: string; description: string; parameters: ApiOperationParameter[]; requestBody?: ApiRequestBody; responses: ApiResponse[]; codeExamples: ApiCodeExamples; }; type ApiGroup = { name: string; description: string; id: string; operations: ApiOperation[]; }; type ApiOAuth2Flow = { authorizationUrl?: string; tokenUrl?: string; refreshUrl?: string; scopes: Record; }; type ApiSecurityScheme = { key: string; type: string; scheme?: string; bearerFormat?: string; name?: string; in?: string; description: string; flows?: { authorizationCode?: ApiOAuth2Flow; implicit?: ApiOAuth2Flow; clientCredentials?: ApiOAuth2Flow; password?: ApiOAuth2Flow; }; }; type ApiSpecData = { info: { title: string; description: string; version: string; }; servers: Array<{ url: string; description: string; }>; groups: ApiGroup[]; securitySchemes: ApiSecurityScheme[]; }; type GithubData = { releases: Record; contributors: Record; }; type DoculaCookieAuth = { loginUrl: string; cookieName?: string; logoutUrl?: string; }; type DoculaHeaderLink = { label: string; url: string; icon?: string; }; type DoculaCacheOptions = { github: { ttl: number; }; }; declare class DoculaOptions { /** * Name of the built-in template to use (e.g., "modern", "classic") */ template: string; /** * Path to the template directory. When set, overrides the `template` option. */ templatePath: string; /** * Path to the output directory */ output: string; /** * Path to the site directory */ sitePath: string; /** * Path to the github repository */ githubPath: string; /** * Site title */ siteTitle: string; /** * Site description */ siteDescription: string; /** * Site URL */ siteUrl: string; /** * Port to run the server */ port: number; /** * Sections */ sections?: DoculaSection[]; /** * OpenAPI specification URL for API documentation. * When provided, creates a dedicated /api page * Supports both external URLs (https://...) and relative paths (/openapi.json) */ openApiUrl?: string; /** * When true, GitHub releases are converted to changelog entries and merged * with file-based changelog entries. Requires a changelog template to exist. */ enableReleaseChangelog: boolean; /** * When false, the first document becomes the home page (index.html) * and the home.hbs template is not rendered. */ homePage: boolean; /** * When true, generates llms.txt and llms-full.txt files for the built site. */ enableLlmsTxt: boolean; /** * Override the default theme toggle. By default the site follows the system * preference. Set to "light" or "dark" to use that theme when no user * preference is stored in localStorage. */ themeMode?: "light" | "dark"; /** * When true, automatically adds generated paths (e.g., .cache) to the * site directory's .gitignore file if not already present. */ autoUpdateIgnores: boolean; /** * File extensions to copy as assets from docs/ and changelog/ directories. * Override in docula.config to customize. */ /** * Cookie-based authentication. When set, shows a Login/Logout button * in the header based on whether a JWT cookie is present. */ cookieAuth?: DoculaCookieAuth; /** * Additional links to display in the site header navigation. * Each link requires a label and url. */ headerLinks?: DoculaHeaderLink[]; /** * File extensions to copy as assets from docs/ and changelog/ directories. * Override in docula.config to customize. */ /** * Cache settings. Controls caching of external data (e.g., GitHub API responses) * in the .cache directory within the site path. */ cache: DoculaCacheOptions; /** * File extensions to copy as assets from docs/ and changelog/ directories. * Override in docula.config to customize. */ allowedAssets: string[]; constructor(options?: Record); parseOptions(options: Record): void; } type DoculaChangelogEntry = { title: string; date: string; formattedDate: string; tag?: string; tagClass?: string; slug: string; content: string; generatedHtml: string; urlPath: string; }; type DoculaData = { siteUrl: string; siteTitle: string; siteDescription: string; sitePath: string; templatePath: string; output: string; githubPath?: string; github?: GithubData; templates?: DoculaTemplates; hasDocuments?: boolean; hasChangelog?: boolean; sections?: DoculaSection[]; documents?: DoculaDocument[]; sidebarItems?: DoculaSection[]; announcement?: string; openApiUrl?: string; hasApi?: boolean; apiSpec?: ApiSpecData; changelogEntries?: DoculaChangelogEntry[]; homePage?: boolean; themeMode?: string; cookieAuth?: { loginUrl: string; cookieName?: string; logoutUrl?: string; }; headerLinks?: Array<{ label: string; url: string; icon?: string; }>; enableLlmsTxt?: boolean; hasFeed?: boolean; }; type DoculaTemplates = { home: string; docPage?: string; api?: string; changelog?: string; changelogEntry?: string; }; type DoculaSection = { name: string; order?: number; path: string; children?: DoculaSection[]; }; type DoculaDocument = { title: string; navTitle: string; description: string; order?: number; section?: string; keywords: string[]; content: string; markdown: string; generatedHtml: string; documentPath: string; urlPath: string; isRoot: boolean; }; declare class DoculaBuilder { private readonly _options; private readonly _ecto; private readonly _console; constructor(options?: DoculaOptions, engineOptions?: any); get options(): DoculaOptions; build(): Promise; validateOptions(options: DoculaOptions): void; getGithubData(githubPath: string): Promise; getTemplates(templatePath: string, hasDocuments: boolean, hasChangelog?: boolean): Promise; getTemplateFile(path: string, name: string): Promise; buildRobotsPage(options: DoculaOptions): Promise; buildSiteMapPage(data: DoculaData): Promise; buildFeedPage(data: DoculaData): Promise; buildLlmsFiles(data: DoculaData): Promise; private generateLlmsIndexContent; private generateLlmsFullContent; private buildAbsoluteSiteUrl; private normalizePathForUrl; private escapeXml; private summarizeMarkdown; private isRemoteUrl; private resolveOpenApiSpecUrl; private resolveLocalOpenApiPath; private getSafeSiteOverrideFileContent; private getSafeLocalOpenApiSpec; private isPathWithinBasePath; private toPosixPath; buildIndexPage(data: DoculaData): Promise; buildDocsHomePage(data: DoculaData): Promise; buildReadmeSection(data: DoculaData): Promise; buildAnnouncementSection(data: DoculaData): Promise; buildDocsPages(data: DoculaData): Promise; buildApiPage(data: DoculaData): Promise; getChangelogEntries(changelogPath: string): DoculaChangelogEntry[]; parseChangelogEntry(filePath: string): DoculaChangelogEntry; convertReleaseToChangelogEntry(release: Record): DoculaChangelogEntry; getReleasesAsChangelogEntries(releases: any[]): DoculaChangelogEntry[]; buildChangelogPage(data: DoculaData): Promise; buildChangelogEntryPages(data: DoculaData): Promise; generateSidebarItems(data: DoculaData): DoculaSection[]; getDocuments(sitePath: string, doculaData: DoculaData): DoculaDocument[]; getDocumentInDirectory(sitePath: string): DoculaDocument[]; getSections(sitePath: string, doculaOptions: DoculaOptions): DoculaSection[]; mergeSectionWithOptions(section: DoculaSection, options: DoculaOptions): DoculaSection; parseDocumentData(documentPath: string): DoculaDocument; private hasTableOfContents; private directoryContainsMarkdown; private mergeTemplateOverrides; private ensureCacheInGitignore; private isCacheFresh; private listFilesRecursive; private copyDirectory; private copyPublicFolder; private copyPublicDirectory; private copyDocumentSiblingAssets; private listContentAssets; private copyContentAssets; } declare class Docula { private _options; private readonly _console; private _configFileModule; private _server; private _watcher; /** * Initialize the Docula class * @param {DoculaOptions} options * @returns {void} * @constructor */ constructor(options?: DoculaOptions); /** * Get the options * @returns {DoculaOptions} */ get options(): DoculaOptions; /** * Set the options * @param {DoculaOptions} value */ set options(value: DoculaOptions); /** * The http server used to serve the site * @returns {http.Server | undefined} */ get server(): http.Server | undefined; /** * The file watcher used in watch mode * @returns {fs.FSWatcher | undefined} */ get watcher(): fs.FSWatcher | undefined; /** * The config file module. This is the module that is loaded from the docula.config.ts or docula.config.mjs file * @returns {any} */ get configFileModule(): any; /** * Remove the .cache directory inside the site path. * Resolves the path and verifies it stays within sitePath to prevent * path-traversal attacks. * @param {string} sitePath */ private cleanCache; /** * Check for updates * @returns {void} */ checkForUpdates(): void; /** * Is the execution process that runs the docula command * @param {NodeJS.Process} process * @returns {Promise} */ execute(process: NodeJS.Process): Promise; /** * Generate the init files * @param {string} sitePath * @param {boolean} typescript - If true, generates docula.config.ts instead of docula.config.mjs * @returns {void} */ generateInit(sitePath: string, typescript?: boolean): void; /** * Get the version of the package * @returns {string} */ getVersion(): string; /** * Load the config file. Supports both .mjs and .ts config files. * Priority: docula.config.ts > docula.config.mjs * @param {string} sitePath * @returns {Promise} */ loadConfigFile(sitePath: string): Promise; /** * Watch the site path for file changes and rebuild on change * @param {DoculaOptions} options * @param {DoculaBuilder} builder * @returns {fs.FSWatcher} */ watch(options: DoculaOptions, builder: DoculaBuilder): fs.FSWatcher; /** * Serve the site based on the options (port and output path) * @param {DoculaOptions} options * @returns {Promise} */ serve(options: DoculaOptions): Promise; } export { type DoculaCacheOptions, type DoculaCookieAuth, type DoculaHeaderLink, DoculaOptions, Docula as default };