/**
 * ProjectService - Singleton service for project-level EDA
 *
 * Provides a centralized service that:
 * 1. Initializes ProjectRegistry with subscribed adapters
 * 2. Bridges increment-level events to project-level events
 * 3. Manages adapter lifecycle (subscribe/unsubscribe)
 *
 * This service connects the two EDA layers:
 * - Increment-level EDA (shell hooks, detectors, handlers)
 * - Project-level EDA (ProjectRegistry, ProjectEventBus, Adapters)
 *
 * Usage:
 *   const service = await ProjectService.getInstance(projectRoot);
 *   await service.initialize(); // Subscribes adapters
 *   service.emitIncrementEvent('increment.done', '0145-project-registry');
 */
import { Logger } from '../../utils/logger.js';
import { ProjectRegistry } from './project-registry.js';
import { ProjectEventBus } from './project-event-bus.js';
/**
 * Increment event types from hooks v2
 *
 * v1.0.144: Added spec.updated, task.updated, metadata.changed for universal
 * external tool sync (GitHub/JIRA/ADO) on AC completion and task updates.
 */
export type IncrementEventType = 'increment.created' | 'increment.done' | 'increment.completed' | 'increment.archived' | 'increment.reopened' | 'increment.sync' | 'user-story.completed' | 'user-story.reopened' | 'spec.updated' | 'task.updated' | 'metadata.changed';
/**
 * Configuration for external tool adapters
 */
export interface AdapterConfig {
    github?: {
        enabled: boolean;
        owner: string;
        repo: string;
        token?: string;
    };
    ado?: {
        enabled: boolean;
        organization: string;
        project: string;
        token?: string;
    };
    jira?: {
        enabled: boolean;
        domain: string;
        email?: string;
        token?: string;
    };
}
/**
 * ProjectService - Singleton pattern for managing project EDA
 */
export declare class ProjectService {
    private static instances;
    private projectRoot;
    private registry;
    private eventBus;
    private logger;
    private adapters;
    private initialized;
    private constructor();
    /**
     * Get singleton instance for a project root
     */
    static getInstance(projectRoot: string, logger?: Logger): ProjectService;
    /**
     * Clear singleton instance (for testing)
     */
    static clearInstance(projectRoot: string): void;
    /**
     * Clear all instances (for testing)
     */
    static clearAllInstances(): void;
    /**
     * Initialize the service with adapters
     *
     * Loads adapter configuration from:
     * 1. .specweave/config.json (sync section)
     * 2. Environment variables (GITHUB_TOKEN, etc.)
     * 3. .env file
     */
    initialize(): Promise<void>;
    /**
     * Load adapter configuration from various sources
     */
    private loadAdapterConfig;
    /**
     * Load and parse .env file
     */
    private loadEnvFile;
    /**
     * Load SpecWeave config.json
     */
    private loadSpecweaveConfig;
    /**
     * Get the project registry
     */
    getRegistry(): ProjectRegistry;
    /**
     * Get the event bus
     */
    getEventBus(): ProjectEventBus;
    /**
     * Check if service is initialized
     */
    isInitialized(): boolean;
    /**
     * Bridge increment-level events to project-level events
     *
     * Called by the project-bridge-handler when increment events occur.
     * Maps increment changes to project sync requests.
     *
     * @param eventType - Increment event type
     * @param eventData - Increment ID or INC_ID:US_ID format
     */
    emitIncrementEvent(eventType: IncrementEventType, eventData: string): Promise<void>;
    /**
     * Get project ID associated with an increment
     *
     * Reads the increment's spec.md to find the project field
     */
    private getProjectForIncrement;
    /**
     * Derive a project ID from .specweave/config.json
     *
     * Fallback chain:
     * 1. project.name from config
     * 2. sync.github.owner/repo -> "owner/repo" slug
     * 3. null if nothing configured
     */
    private getProjectIdFromConfig;
    /**
     * Request sync for all projects
     */
    syncAllProjects(): Promise<void>;
    /**
     * Discover projects from external tools
     */
    discoverProjects(): Promise<Map<string, any[]>>;
}
//# sourceMappingURL=project-service.d.ts.map