import type { CwdOption } from '../utils/validation/file-existence'; export { isValidDocumentId, isValidDocumentType, isValidDocumentExtension, } from '../build/document-constraints'; /** * Message shown when a document `` part (which becomes the backend document * `id`) violates the backend constraints. */ export declare const INVALID_DOCUMENT_NAME: string; /** Message shown when a document `` part violates the backend constraints. */ export declare const INVALID_DOCUMENT_TYPE: string; /** Message shown when a document `` part violates the filename-part rules. */ export declare const INVALID_DOCUMENT_EXTENSION: string; /** * Hint shown before the interactive prompts, making the document filename * convention explicit so the user knows what each prompt maps to. */ export declare const DOCUMENT_NAME_CONVENTION_HINT = "Documents follow the naming convention .."; /** * Sanitizes an arbitrary string into a valid document name (`id`) by replacing * every run of disallowed characters (dots, underscores, spaces, etc.) with a * single hyphen, trimming leading/trailing hyphens, and truncating to the * backend id length limit. Returns an empty string when nothing valid remains. * * Used to derive a usable `` from an existing file whose base name is not * itself a valid document name (e.g. `test.note` -> `test-note`). */ export declare function sanitizeDocumentPart(raw: string): string; /** * Checks whether a document with the given `` part already exists in the * documents directory. The build keys document uniqueness on the `` part * only (see `getDocumentName` in `../build/bundle-documents.ts`), so a file * named `foo.dashboard` blocks the creation of `foo.notebook`. */ export declare function checkIfDocumentExists(options: { /** The `` part of the document to check for existence. */ name: string; /** Relative path where the documents are located */ documentsDir: string; } & CwdOption): boolean; /** The document parts parsed from an existing file's name. */ export interface ParsedDocumentFileName { /** The `` part, when it can be mapped from the file name. */ name?: string; /** The `` part, only present for a full `..` name. */ type?: string; /** The `` part, without the leading dot. */ extension?: string; } /** * Parses an existing file's base name into document parts, following the * ready-made document naming convention `..`. * * The base name is split on dots and mapped by segment count: * - 1 segment -> `` * - 2 segments -> `.` (the `` is considered missing) * - 3 segments -> `..` (a complete ready document) * - 4+ segments -> only the trailing `` is taken; the ``/ * `` cannot be mapped unambiguously and are left for the caller to * prompt for. * * Only the parts that could be mapped are populated; the caller validates each * one and prompts for whatever is missing or invalid. This intentionally does * not validate the parts itself, so a `..` file whose parts * are all valid can be copied as-is without re-prompting. */ export declare function parseExistingFilePath(filePath: string): ParsedDocumentFileName;