/** * Project ID Generator with Duplicate Prevention (v0.29.0+) * * Generates unique SpecWeave project IDs from external tool entities: * - JIRA boards → Project IDs * - ADO area paths → Project IDs * - GitHub repos → Project IDs * * Handles collision detection and composite key generation. */ /** * Project ID generation options */ export interface ProjectIdOptions { /** External container (JIRA project key, ADO project name) */ externalContainer: string; /** Local name (board name, area path, repo name) */ localName: string; /** Provider type */ provider: 'jira' | 'ado' | 'github'; /** Existing project IDs to check for collisions */ existingIds?: string[]; } /** * Generated project ID result */ export interface ProjectIdResult { /** Generated project ID */ id: string; /** Whether collision was detected and prefix was added */ hadCollision: boolean; /** Original local name before sanitization */ originalName: string; /** Full composite key (container + local) */ compositeKey: string; } /** * Normalize a string to a valid project ID * - Lowercase * - Replace spaces and special chars with hyphens * - Remove consecutive hyphens * - Remove leading/trailing hyphens */ export declare function normalizeToProjectId(name: string): string; /** * Generate a short prefix from external container name * Used when collision is detected */ export declare function generateContainerPrefix(container: string): string; /** * Generate unique project ID with collision detection * * Algorithm: * 1. Normalize local name to project ID format * 2. Check if ID exists in existingIds * 3. If collision, add container prefix: "core-fe" instead of "fe" * 4. If still collision (rare), add numeric suffix: "core-fe-2" * * @param options Generation options * @returns Generated project ID with metadata */ export declare function generateProjectId(options: ProjectIdOptions): ProjectIdResult; /** * Batch generate project IDs from multiple sources * Ensures no collisions within the batch and with existing IDs */ export declare function generateProjectIdsBatch(sources: Array<{ container: string; localName: string; provider: 'jira' | 'ado' | 'github'; }>, existingIds?: string[]): Map; /** * Get existing project IDs from a SpecWeave project * * @param projectRoot Path to project root * @returns Array of existing project IDs */ export declare function getExistingProjectIds(projectRoot: string): string[]; /** * Create 2-level directory structure for JIRA/ADO projects * * Structure: * .specweave/docs/internal/specs/ * ├── JIRA-CORE/ (external container level) * │ ├── fe/ (SpecWeave project level) * │ ├── be/ * │ └── mobile/ * └── ADO-MyProduct/ * ├── fe/ * └── be/ * * @param projectRoot Path to project root * @param containerType Type of external container * @param containerId External container ID (JIRA project key or ADO project name) * @param specweaveProjectId SpecWeave project ID */ export declare function createTwoLevelProjectDir(projectRoot: string, containerType: 'jira' | 'ado', containerId: string, specweaveProjectId: string): string; /** * Get the 2-level path for a project * * @param projectRoot Path to project root * @param containerType Type of external container * @param containerId External container ID * @param specweaveProjectId SpecWeave project ID * @returns Full path or undefined if using flat structure */ export declare function getTwoLevelProjectPath(projectRoot: string, containerType: 'jira' | 'ado' | null, containerId: string | null, specweaveProjectId: string): string; /** * Parse a 2-level project path to extract container and project info * * @param projectPath Path like ".specweave/docs/internal/specs/JIRA-CORE/fe" * @returns Parsed container and project info */ export declare function parseTwoLevelPath(projectPath: string): { containerType: 'jira' | 'ado' | null; containerId: string | null; projectId: string; } | null; /** * Validate project ID format */ export declare function isValidProjectId(id: string): boolean; /** * Suggest a valid project ID from an invalid one */ export declare function suggestProjectId(invalidId: string): string; //# sourceMappingURL=project-id-generator.d.ts.map