/**
 * GitHub Spec Sync (Multi-Project Architecture)
 *
 * CORRECT ARCHITECTURE:
 * - Syncs .specweave/docs/internal/specs/{project-id}/spec-*.md ↔ GitHub Projects
 * - NOT increments ↔ GitHub Issues (that was wrong!)
 *
 * MULTI-PROJECT SUPPORT (v0.18.0+):
 * - Detects which project a spec belongs to (by folder path)
 * - Routes to correct GitHub repo based on project config
 * - Supports multiple sync strategies per project
 * - Handles cross-team specs (create issues in multiple repos)
 *
 * Mapping:
 * - Spec → GitHub Project
 * - User Story → GitHub Project Card/Issue
 * - Acceptance Criteria → Checklist in Issue
 *
 * Sync Strategies:
 * - project-per-spec: One GitHub Project per spec (default)
 * - team-board: One GitHub Project per team (aggregates specs)
 * - centralized: Parent repo tracks all (multi-repo pattern)
 * - distributed: Each team syncs to their repo (microservices)
 *
 * @module github-spec-sync
 */
import { SpecSyncResult } from '../../../../../src/core/types/spec-metadata.js';
export interface GitHubProject {
    id: number;
    title: string;
    number: number;
    url: string;
    state: 'open' | 'closed';
    owner: string;
    repo: string;
}
export interface GitHubProjectCard {
    id: number;
    note?: string;
    state: string;
    column_id: number;
    content_url?: string;
}
export interface GitHubIssue {
    number: number;
    title: string;
    body: string;
    state: 'open' | 'closed';
    labels: string[];
    assignees: string[];
}
/**
 * GitHub Sync Strategy
 */
export type GitHubSyncStrategy = 'project-per-spec' | 'team-board' | 'centralized' | 'distributed';
/**
 * Project-specific GitHub configuration
 */
export interface ProjectGitHubConfig {
    projectId: string;
    strategy: GitHubSyncStrategy;
    owner: string;
    repo: string;
    teamBoardId?: number;
}
export declare class GitHubSpecSync {
    private specManager;
    private projectContextManager;
    private projectRoot;
    private token?;
    /** Configurable keywords for cross-team spec detection. Case-insensitive matching. */
    crossTeamKeywords: string[];
    constructor(projectRoot?: string);
    /**
     * Get environment object with GH_TOKEN for gh CLI commands.
     * This ensures the token from .env is passed to all gh operations,
     * regardless of `gh auth` status.
     */
    private getGhEnv;
    /**
     * Detect project from spec file path
     *
     * Spec path format: .specweave/docs/internal/specs/{project-id}/spec-*.md
     * OR (single project): .specweave/docs/internal/specs/spec-*.md
     */
    private detectProjectFromSpecPath;
    /**
     * Get GitHub configuration for a project
     */
    private getGitHubConfigForProject;
    /**
     * Sync spec to GitHub Project (CREATE or UPDATE)
     *
     * MULTI-PROJECT ARCHITECTURE:
     * - Detects which project the spec belongs to
     * - Routes to correct GitHub repo based on project config
     * - Supports multiple sync strategies
     */
    syncSpecToGitHub(specId: string): Promise<SpecSyncResult>;
    /**
     * Sync spec using specified strategy
     */
    private syncWithStrategy;
    /**
     * Strategy 1: Project-per-Spec (DEFAULT)
     * - One GitHub Project per spec
     * - Current behavior, no changes needed
     */
    private syncProjectPerSpec;
    /**
     * Sync FROM GitHub Project to spec (full sync with all permissions)
     */
    syncFromGitHub(specId: string): Promise<SpecSyncResult>;
    /**
     * Create new GitHub Project for spec
     */
    private createGitHubProject;
    /**
     * Update existing GitHub Project
     */
    private updateGitHubProject;
    /**
     * Generate project description from spec
     */
    private generateProjectDescription;
    /**
     * Generate issue body from user story
     */
    private generateIssueBody;
    /**
     * Detect conflicts between spec and GitHub
     */
    private detectConflicts;
    /**
     * Resolve conflicts
     *
     * GUARD: Only overwrites local spec title if the user explicitly configured
     * "remote-wins" as the conflict resolution strategy. Default conflicts
     * detected by detectConflicts() use 'remote-wins' but this guard ensures
     * API-sourced titles never silently replace local titles.
     */
    private resolveConflicts;
    /**
     * Execute GraphQL query against GitHub API
     */
    private executeGraphQL;
    /**
     * Get owner ID (user or organization)
     */
    private getOwnerId;
    /**
     * Fetch GitHub Project details via GraphQL ProjectV2 API
     */
    private fetchGitHubProject;
    /**
     * Find issue by title pattern
     */
    private findIssueByTitle;
    /**
     * Create GitHub issue
     */
    private createIssue;
    /**
     * Update GitHub issue
     */
    private updateIssue;
    /**
     * Strategy 2: Team-Board
     * - One GitHub Project per team (aggregates multiple specs)
     * - All specs from the same team/project sync to same board
     */
    private syncTeamBoard;
    /**
     * Strategy 3: Centralized
     * - Parent repo tracks all specs (multi-repo pattern)
     * - Issues created in parent repo with tags for child repos
     */
    private syncCentralized;
    /**
     * Strategy 4: Distributed
     * - Each team syncs to their repo (microservices)
     * - Cross-team specs create issues in multiple repos
     */
    private syncDistributed;
    /**
     * Check if spec is cross-team (touches multiple projects)
     *
     * Detection heuristics:
     * - Spec title contains keywords like "integration", "cross-team", "shared"
     * - User stories reference multiple projects/teams
     * - Tags include multiple project names
     */
    private isCrossTeamSpec;
    /**
     * Sync cross-team spec to multiple repositories
     *
     * Creates issues in multiple repos:
     * - Frontend repo gets frontend-specific user stories
     * - Backend repo gets backend-specific user stories
     * - Shared stories get created in both with cross-links
     */
    private syncCrossTeamSpec;
    /**
     * Detect related profiles for cross-team spec
     */
    private detectRelatedProfiles;
    /**
     * Filter user stories relevant to a specific project
     *
     * Heuristics:
     * - Story title/description contains project keywords
     * - Story tags include project name
     * - Story implementation references project folder
     */
    private filterRelevantUserStories;
    /**
     * Enhanced syncUserStories with optional extra labels
     */
    private syncUserStories;
    /**
     * Detect GitHub repository from git remote
     */
    private detectRepo;
}
//# sourceMappingURL=github-spec-sync.d.ts.map