/**
 * SpecWeave Hierarchy Mapper (v5.1.0 - Per-Project Epics)
 *
 * Maps increments to unified hierarchy:
 * - Epic (EP-XXX) -> {project}/_epics/EP-XXX/EPIC.md (PER-PROJECT, not root level!)
 * - Feature (FS-XXX) -> {project}/{board}/FS-XXX/FEATURE.md (+ user stories)
 * - User Story (us-{id}) -> {project}/{board}/FS-XXX/us-{id}.md
 * - Task (T-{id}) -> Checkboxes in User Story description
 *
 * CRITICAL (v0.30.3): Epics are PER-PROJECT, not at root level.
 * Each project has its own _epics/ folder: {project}/_epics/
 *
 * All features live under board folders within projects.
 * Archive: {project}/{board}/_archive/FS-XXX/
 *
 * Key Principles:
 * - NO HARDCODED PROJECT NAMES (backend, frontend are examples)
 * - Projects are DYNAMIC from config.json -> multiProject.projects
 * - Single-project mode: one project folder (e.g., 'specweave')
 * - Multi-project mode: multiple project folders
 * - Feature IDs assigned by creation date (FS-001, FS-002, etc.)
 * - NO DUPLICATE FEATURE IDS (enforced by FeatureIDManager)
 * - EPICS ARE PER-PROJECT (v0.30.3+)
 *
 * @author SpecWeave Team
 * @version 5.1.0 (Per-Project Epics)
 */
import { SpecweaveConfig } from '../types/config.js';
import { EpicMapping, FeatureMapping, ProjectContext } from './types.js';
/**
 * Hierarchy Configuration
 */
export interface HierarchyConfig {
    level: 'simple' | 'standard' | 'enterprise' | 'auto';
    specsBaseDir: string;
    detectEpicFrom: ('frontmatter' | 'config')[];
    detectFeatureFrom: ('frontmatter' | 'increment-name' | 'config')[];
    detectProjectFrom: ('frontmatter' | 'increment-name' | 'config')[];
    fallbackEpic?: string;
}
/**
 * HierarchyMapper - Maps increments to unified project structure
 *
 * Structure (v5.1.0 - Per-Project Epics):
 * 1. Epic (EP-XXX) -> {project}/_epics/EP-XXX/EPIC.md (PER-PROJECT!)
 * 2. Feature (FS-XXX) -> {project}/{board}/FS-XXX/FEATURE.md
 * 3. User Story (us-NNN-{name}) -> {project}/{board}/FS-XXX/us-{id}.md
 * 4. Task (T-NNN) -> Checkboxes in User Story description
 *
 * CRITICAL (v0.30.3): Epics are now stored per-project in {project}/_epics/
 */
export declare class HierarchyMapper {
    private config;
    private projectRoot;
    private featureIdManager;
    private configManager;
    private specweaveConfig;
    constructor(projectRoot: string, config?: Partial<HierarchyConfig>);
    /**
     * Load SpecWeave config (cached)
     */
    getSpecweaveConfig(): Promise<SpecweaveConfig>;
    /**
     * Get list of configured projects
     *
     * Returns:
     * - Single-project mode: ['default']
     * - Multi-project mode: User-configured project names (dynamic, no hardcodes)
     */
    getConfiguredProjects(): Promise<string[]>;
    /**
     * Check if a feature is archived
     *
     * Archive location: specs/{project}/_archive/FS-XXX/
     */
    isFeatureArchived(featureId: string): Promise<boolean>;
    /**
     * Check if an epic is archived
     *
     * CRITICAL (v0.30.3): Epics are per-project in {project}/_epics/_archive/
     *
     * @param epicId - Epic ID (e.g., "EP-086E")
     * @param projectId - Optional project ID. If not provided, checks all projects.
     */
    isEpicArchived(epicId: string, projectId?: string): Promise<boolean>;
    /**
     * Filter out archived items from mappings
     */
    filterArchivedItems<T extends {
        id: string;
    }>(items: T[], type: 'feature' | 'epic'): Promise<T[]>;
    /**
     * Get project context for a specific project ID
     */
    getProjectContext(projectId: string): Promise<ProjectContext | null>;
    /**
     * Detect which epic this increment belongs to (OPTIONAL)
     *
     * Epic Format: EPIC-YYYY-QN-{name}
     * Example: EPIC-2025-Q4-platform
     *
     * Detection Methods:
     * 1. Frontmatter: epic: EPIC-2025-Q4-platform
     * 2. Config: livingDocs.hierarchyMapping.incrementToEpic
     * 3. Fallback: null (no epic required)
     */
    detectEpicMapping(incrementId: string): Promise<EpicMapping | null>;
    /**
     * Detect which feature this increment belongs to (REQUIRED)
     *
     * Feature Format (Greenfield): FS-XXX (matches increment number)
     * Feature Format (Brownfield): FS-YY-MM-DD-{feature-name} (date-based)
     * Examples:
     * - Greenfield: 0031-external-tool-sync → FS-031
     * - Brownfield: Imported from JIRA → FS-25-11-14-external-tool-sync
     *
     * Detection Methods:
     * 1. Frontmatter: feature: FS-031 (greenfield) or feature: FS-25-11-14-name (brownfield)
     * 2. Increment Name: 0031-external-tool-status-sync → FS-031 (auto-extract number)
     * 3. Config: livingDocs.hierarchyMapping.incrementToFeature
     * 4. Fallback: Auto-create feature from increment number (FS-XXX format)
     */
    detectFeatureMapping(incrementId: string): Promise<FeatureMapping>;
    /**
     * Detect which projects this increment/feature affects (REQUIRED)
     *
     * Returns array of project IDs (dynamic, from config)
     *
     * Detection Methods:
     * 1. Frontmatter: project: backend OR projects: [backend, frontend]
     * 2. Increment Name: Contains project keyword (0031-backend-api-sync)
     * 3. Config: livingDocs.hierarchyMapping.incrementToProjects
     * 4. Fallback: ['default'] (single-project mode)
     */
    detectProjects(incrementId: string): Promise<string[]>;
    /**
     * Detect epic from frontmatter
     */
    private detectEpicFromFrontmatter;
    /**
     * Detect epic from config
     */
    private detectEpicFromConfig;
    /**
     * Detect feature from frontmatter
     *
     * CRITICAL: For greenfield projects, ALWAYS use increment number (FS-XXX)
     * even if frontmatter says FS-YY-MM-DD-name (date-based format)
     */
    private detectFeatureFromFrontmatter;
    /**
     * Detect feature from increment name
     *
     * Examples:
     * - 0031-external-tool-status-sync → FS-031
     * - 0032-user-authentication → FS-032
     * - 0001-core-framework → FS-001
     */
    private detectFeatureFromIncrementName;
    /**
     * Detect feature from config
     */
    private detectFeatureFromConfig;
    /**
     * Create fallback feature mapping
     */
    private createFallbackFeatureMapping;
    /**
     * Build FeatureMapping object
     *
     * CRITICAL: For greenfield (FS-XXX format), use the feature ID directly.
     * The feature ID manager is only used for brownfield (date-based) IDs.
     */
    private buildFeatureMapping;
    /**
     * Detect projects from frontmatter
     */
    private detectProjectsFromFrontmatter;
    /**
     * Extract project IDs from per-US **Project**: fields
     * v0.34.1: New method for ADR-0140
     */
    private extractPerUSProjects;
    /**
     * Detect projects from increment name (keyword matching)
     */
    private detectProjectsFromIncrementName;
    /**
     * Detect projects from config
     */
    private detectProjectsFromConfig;
    /**
     * Get increment creation date in YY-MM-DD format
     *
     * Tries: metadata.json → spec.md frontmatter → current date
     */
    private getIncrementCreationDate;
    /**
     * Format date as YY-MM-DD
     * Input: "2025-11-14" or "2025-11-14T12:00:00Z"
     * Output: "25-11-14"
     */
    private formatDateShort;
    /**
     * Find existing feature folder (exact or fuzzy match)
     *
     * Searches in: {project}/FS-XXX/
     *
     * CRITICAL: For greenfield (FS-XXX), only exact match.
     * For brownfield (FS-YY-MM-DD-name), fuzzy match allowed.
     */
    private findExistingFeatureFolder;
    /**
     * Get all feature folders from all project folders
     *
     * Scans: {project}/FS-XXX/
     */
    getAllFeatureFolders(): Promise<string[]>;
    /**
     * Get all epic folders across all projects
     *
     * CRITICAL (v0.30.3): Epics are per-project in {project}/_epics/
     *
     * @param projectId - Optional project ID. If provided, only returns epics from that project.
     * @returns Array of epic folder names (e.g., ["EP-086E", "EP-087E"])
     */
    getAllEpicFolders(projectId?: string): Promise<string[]>;
    /**
     * Get the epics path for a specific project
     *
     * @param projectId - Project ID
     * @returns Path to {project}/_epics/
     */
    getEpicsPathForProject(projectId: string): string;
    /**
     * LEGACY: Backward compatibility alias for detectFeatureMapping
     */
    detectEpicMapping_LEGACY(incrementId: string): Promise<FeatureMapping>;
}
//# sourceMappingURL=hierarchy-mapper.d.ts.map