/** * Cross-Project Sync Orchestrator * * Handles syncing increments that span multiple projects. * Groups user stories by their target project and syncs each group * to the appropriate project folder in living docs. * * Supports both 1-level (project) and 2-level (project/board) structures. * * @module core/living-docs/cross-project-sync * @since v0.33.0 * @updated v0.34.0 - Added 2-level structure support (project/board) */ import type { UserStoryData } from './types.js'; import { Logger } from '../../utils/logger.js'; import { ProjectResolutionService } from '../project/project-resolution.js'; /** * Result of syncing to a single project */ export interface ProjectSyncResult { projectId: string; success: boolean; userStories: string[]; filesCreated: string[]; filesUpdated: string[]; errors: string[]; } /** * Result of syncing across multiple projects */ export interface MultiProjectSyncResult { success: boolean; projects: ProjectSyncResult[]; crossReferences: string[]; totalUserStories: number; projectCount: number; } /** * Options for cross-project sync */ export interface CrossProjectSyncOptions { dryRun?: boolean; force?: boolean; generateCrossReferences?: boolean; } /** * Cross-Project Sync Orchestrator */ export declare class CrossProjectSync { private projectRoot; private logger; private structureConfig; private projectResolution; constructor(projectRoot: string, options?: { logger?: Logger; projectResolution?: ProjectResolutionService; }); /** * Get structure level configuration (cached) */ private getStructureConfig; /** * Check if 2-level structure is detected */ is2LevelStructure(): boolean; /** * Get full target path for a user story * * For 1-level: returns project * For 2-level: returns project/board * * @param us - User story * @param defaultProject - Default project if US doesn't specify * @param defaultBoard - Default board if US doesn't specify (2-level only) * @returns Full path like "project" or "project/board" */ getUSTargetPath(us: UserStoryData, defaultProject: string, defaultBoard?: string): string; /** * Group user stories by their target path (project or project/board) * * @param userStories - User stories to group * @param defaultProject - Default project for USs without explicit project * @param defaultBoard - Default board for USs without explicit board (2-level only) * @returns Map of target path to user stories */ groupByProject(userStories: UserStoryData[], defaultProject: string, defaultBoard?: string): Map; /** * Group user stories by project only (ignoring board) * Useful for project-level operations like external sync */ groupByProjectOnly(userStories: UserStoryData[], defaultProject: string): Map; /** * Check if an increment is cross-project (spans multiple projects/boards) * * For 1-level: checks if USs target different projects * For 2-level: checks if USs target different project/board combinations */ isCrossProject(userStories: UserStoryData[], defaultProject: string, defaultBoard?: string): boolean; /** * Check if an increment spans multiple projects (ignoring boards) * Useful for external sync which groups at project level */ spansMultipleProjects(userStories: UserStoryData[], defaultProject: string): boolean; /** * Get the specs folder path for a target path * Handles both 1-level (project) and 2-level (project/board) * * @param targetPath - Either "project" or "project/board" */ getSpecsPath(targetPath: string): string; /** * Get the feature folder path for a target path and feature * Handles both 1-level and 2-level structures * * @param targetPath - Either "project" or "project/board" * @param featureId - Feature ID (e.g., "FS-125") */ getFeaturePath(targetPath: string, featureId: string): string; /** * Ensure specs folder exists for a target path * Handles both 1-level and 2-level structures * * CRITICAL v0.35.1: Validates project before folder creation to prevent pollution * @throws Error if project validation fails */ ensureSpecsFolder(targetPath: string): Promise; /** * Ensure feature folder exists within a target path * Handles both 1-level and 2-level structures * * CRITICAL v0.35.1: Validates project before folder creation to prevent pollution * @throws Error if project validation fails */ ensureFeatureFolder(targetPath: string, featureId: string): Promise; /** * Generate cross-references section for FEATURE.md * * @param featureId - The feature ID (e.g., "FS-125") * @param allTargetPaths - All target paths this feature spans (can be "project" or "project/board") * @param currentTargetPath - The current target path being generated * @returns Markdown content for "Related Projects" section */ generateCrossReferences(featureId: string, allTargetPaths: string[], currentTargetPath: string): string; /** * Generate cross-reference frontmatter for US files * * @param allTargetPaths - All target paths (can be "project" or "project/board") * @param currentTargetPath - Current target path */ generateRelatedProjectsFrontmatter(allTargetPaths: string[], currentTargetPath: string): string; /** * Extract project ID from target path * "project" -> "project" * "project/board" -> "project" * "./project" -> "project" (CRITICAL FIX v1.0.23) */ extractProjectId(targetPath: string): string; /** * Extract board ID from target path (for 2-level structures) * "project" -> undefined * "project/board" -> "board" * "./project/board" -> "board" (CRITICAL FIX v1.0.23) */ extractBoardId(targetPath: string): string | undefined; /** * Log cross-project sync summary */ logSyncSummary(result: MultiProjectSyncResult): void; } //# sourceMappingURL=cross-project-sync.d.ts.map