/** * slug — filename → kebab-case slug with collision resolution. * * Pure functions used by `cleo docs import` (T9639). Slug normalization * is delegated to {@link ../slug-normalize.ts | `../slug-normalize.js`}, * the canonical single source of truth established by T11180. * Collision resolution appends `-2`, `-3`, ... until * the slug is unique within a caller-supplied set. * * Reserved slugs are rejected outright — these names collide with * existing `cleo docs ` verbs and would be ambiguous in any * future "lookup by slug" interface. * * @epic T9628 (Saga T9625) * @task T9712 (ST-MIG-1b) */ /** * Slugs that conflict with `cleo docs ` verbs and any other * single-token names reserved for the docs surface. */ export declare const RESERVED_SLUGS: ReadonlySet; /** Result of {@link generateSlug}. */ export interface SlugResult { /** The final, collision-resolved slug. */ readonly slug: string; /** True when the base slug already existed and a suffix was appended. */ readonly collision: boolean; /** The numeric suffix used (2, 3, ...) when `collision` is true. */ readonly suffix?: number; } /** * Convert a free-form string into a normalised kebab-case slug. * * Delegates to {@link ../slug-normalize.normalizeSlug | normalizeSlug} * (T11180 SSoT). The function name `slugify` is retained for backward * compatibility so existing callers do not break. * * @param input - The source string (typically a filename without extension). * @returns The slugified form. */ export declare function slugify(input: string): string; /** * Strip the `.md` extension from a filename if present. Used to compute * the base slug from a file's basename. * * @param filename - The file basename (e.g. `My Doc.md`). * @returns The basename without its `.md` extension. */ export declare function stripMdExtension(filename: string): string; /** Options for {@link generateSlug}. */ export interface GenerateSlugOptions { /** The raw source string to slugify (typically a filename basename). */ readonly source: string; /** Slugs that already exist in the target scope (per-project per T9627). */ readonly existing: ReadonlySet; /** * Maximum suffix to try before giving up. Default: 9999. The cap * defends against pathological collision chains. */ readonly maxSuffix?: number; } /** Thrown when a slug cannot be generated within the suffix budget. */ export declare class SlugCollisionLimitError extends Error { readonly base: string; readonly limit: number; constructor(base: string, limit: number); } /** Thrown when the input slugifies to a reserved or empty value. */ export declare class SlugReservedError extends Error { readonly base: string; readonly reason: 'reserved' | 'empty'; constructor(base: string, reason: 'reserved' | 'empty'); } /** * Generate a unique slug from `source`, suffixing `-2`, `-3`, ... if * the base already exists in `existing`. * * Rejects empty and {@link RESERVED_SLUGS reserved} slugs with * {@link SlugReservedError}; rejects collision chains longer than * `maxSuffix` with {@link SlugCollisionLimitError}. * * @param options - Source + collision set. * @returns The unique slug + collision metadata. */ export declare function generateSlug(options: GenerateSlugOptions): SlugResult; //# sourceMappingURL=slug.d.ts.map