/** * Module ID Alias Resolver * * Provides alias resolution for module IDs with explicit alias table support. * This allows humans to use shorthand names during /remember while maintaining * vocabulary alignment with lexmap.policy.json. */ export { AmbiguousSubstringError, NoMatchFoundError } from "./types.js"; import type { Policy } from "../types/policy.js"; import type { AliasTable, AliasResolution, ResolverOptions } from "./types.js"; /** * Load alias table from aliases.json with caching * * @param aliasTablePath - Optional path to alias table JSON file * @returns Loaded and cached alias table */ export declare function loadAliasTable(aliasTablePath?: string): AliasTable; /** * Clear the alias table cache (useful for testing) */ export declare function clearAliasTableCache(): void; /** * Find all module IDs that contain the given substring * * @param substring - The substring to search for * @param availableModules - Set of available module IDs * @param minLength - Minimum substring length (default: 3) * @returns Array of matching module IDs */ export declare function findSubstringMatches(substring: string, availableModules: Set, minLength?: number): string[]; /** * Resolve a module ID through the alias system * * Resolution order: * 1. Exact match (confidence 1.0) * 2. Alias table (confidence 1.0) [Phase 1] * 3. Fuzzy typo correction (handled by module_ids/validator) [Phase 2] * 4. Unique substring match (confidence 0.9) [Phase 3] * 5. Return unknown with confidence 0 * * @param input - The module ID string to resolve (may be an alias or substring) * @param policy - The policy containing canonical module IDs * @param aliasTable - Optional pre-loaded alias table (will load default if not provided) * @param options - Optional resolver options * @returns AliasResolution with canonical ID, confidence, and source * * @example * ```typescript * // Exact match (fast path) * const result1 = await resolveModuleId('services/auth-core', policy); * // { canonical: 'services/auth-core', confidence: 1.0, original: 'services/auth-core', source: 'exact' } * * // Alias lookup * const result2 = await resolveModuleId('auth-core', policy); * // { canonical: 'services/auth-core', confidence: 1.0, original: 'auth-core', source: 'alias' } * * // Unique substring * const result3 = await resolveModuleId('user-access', policy); * // { canonical: 'services/user-access-api', confidence: 0.9, original: 'user-access', source: 'substring' } * * // Unknown * const result4 = await resolveModuleId('unknown-module', policy); * // { canonical: 'unknown-module', confidence: 0, original: 'unknown-module', source: 'fuzzy' } * ``` */ export declare function resolveModuleId(input: string, policy: Policy, aliasTable?: AliasTable, options?: ResolverOptions): Promise;