import { execFile } from "node:child_process";
import type { OrganizationPortabilityAgentManifestEntry, OrganizationPortabilityCollisionStrategy, OrganizationPortabilityFileEntry, OrganizationPortabilityExportPreviewResult, OrganizationPortabilityInclude, OrganizationPortabilityManifest, OrganizationPortabilityPreviewResult, OrganizationPortabilityProjectWorkspaceManifestEntry, OrganizationPortabilityIssueAutomationManifestEntry, OrganizationPortabilityIssueAutomationTriggerManifestEntry, OrganizationPortabilityIssueManifestEntry, OrganizationSkill, OrganizationExportJobStage } from "@rudderhq/shared";
import { type OrgNode } from "../../routes/org-chart-svg.js";
import { automationService } from "../automations.js";
export interface OrganizationPortabilityExportOptions {
    signal?: AbortSignal;
    onProgress?: (progress: {
        stage: OrganizationExportJobStage;
        message: string;
        completed: number;
        total: number;
        fileCount?: number | null;
    }) => void;
}
/** Build OrgNode tree from manifest agent list (slug + reportsToSlug). */
export declare function buildOrgTreeFromManifest(agents: OrganizationPortabilityManifest["agents"]): OrgNode[];
export declare const DEFAULT_INCLUDE: OrganizationPortabilityInclude;
export declare const DEFAULT_COLLISION_STRATEGY: OrganizationPortabilityCollisionStrategy;
export declare const PORTABLE_AGENT_ENTRY_FILE = "AGENTS.md";
export declare const execFileAsync: typeof execFile.__promisify__;
export declare let bundledSkillsCommitPromise: Promise<string | null> | null;
export declare function resolveImportMode(options?: ImportBehaviorOptions): ImportMode;
export declare function resolveSkillConflictStrategy(mode: ImportMode, collisionStrategy: OrganizationPortabilityCollisionStrategy): "replace" | "rename" | "skip";
export declare function normalizePortablePath(input: string): string;
export declare function classifyPortableFileKind(pathValue: string): OrganizationPortabilityExportPreviewResult["fileInventory"][number]["kind"];
export declare function normalizeSkillSlug(value: string | null | undefined): string | null;
export declare function normalizeSkillKey(value: string | null | undefined): string | null;
export declare function readSkillKey(frontmatter: Record<string, unknown>): string | null;
export declare function deriveManifestSkillKey(frontmatter: Record<string, unknown>, fallbackSlug: string, metadata: Record<string, unknown> | null, sourceType: string, sourceLocator: string | null): string;
export declare function hashSkillValue(value: string): string;
export declare function normalizeExportPathSegment(value: string | null | undefined, preserveCase?: boolean): string | null;
export declare function readSkillSourceKind(skill: OrganizationSkill): string | null;
export declare function isBundledRudderSourceKind(value: string | null | undefined): value is "rudder_bundled" | "paperclip_bundled";
export declare function deriveLocalExportNamespace(skill: OrganizationSkill, slug: string): string | null;
export declare function derivePrimarySkillExportDir(skill: OrganizationSkill, slug: string, organizationIssuePrefix: string | null | undefined): string;
export declare function appendSkillExportDirSuffix(packageDir: string, suffix: string): string;
export declare function deriveSkillExportDirCandidates(skill: OrganizationSkill, slug: string, organizationIssuePrefix: string | null | undefined): string[];
export declare function buildSkillExportDirMap(skills: OrganizationSkill[], organizationIssuePrefix: string | null | undefined): Map<string, string>;
export declare function isSensitiveEnvKey(key: string): boolean;
export type ResolvedSource = {
    manifest: OrganizationPortabilityManifest;
    files: Record<string, OrganizationPortabilityFileEntry>;
    warnings: string[];
};
export type MarkdownDoc = {
    frontmatter: Record<string, unknown>;
    body: string;
};
export type CompanyPackageIncludeEntry = {
    path: string;
};
export type PaperclipExtensionDoc = {
    schema?: string;
    organization?: Record<string, unknown> | null;
    agents?: Record<string, Record<string, unknown>> | null;
    projects?: Record<string, Record<string, unknown>> | null;
    tasks?: Record<string, Record<string, unknown>> | null;
    automations?: Record<string, Record<string, unknown>> | null;
};
export type ProjectLike = {
    id: string;
    name: string;
    description: string | null;
    leadAgentId: string | null;
    targetDate: string | null;
    color: string | null;
    status: string;
    executionWorkspacePolicy: Record<string, unknown> | null;
    workspaces?: Array<{
        id: string;
        name: string;
        sourceType: string;
        cwd: string | null;
        repoUrl: string | null;
        repoRef: string | null;
        defaultRef: string | null;
        visibility: string;
        setupCommand: string | null;
        cleanupCommand: string | null;
        metadata?: Record<string, unknown> | null;
        isPrimary: boolean;
    }>;
    metadata?: Record<string, unknown> | null;
};
export type IssueLike = {
    id: string;
    identifier: string | null;
    title: string;
    description: string | null;
    projectId: string | null;
    projectWorkspaceId: string | null;
    assigneeAgentId: string | null;
    status: string;
    priority: string;
    labelIds?: string[];
    billingCode: string | null;
    executionWorkspaceSettings: Record<string, unknown> | null;
    assigneeAgentRuntimeOverrides: Record<string, unknown> | null;
};
export type AutomationLike = NonNullable<Awaited<ReturnType<ReturnType<typeof automationService>["getDetail"]>>>;
export type ImportPlanInternal = {
    preview: OrganizationPortabilityPreviewResult;
    source: ResolvedSource;
    include: OrganizationPortabilityInclude;
    collisionStrategy: OrganizationPortabilityCollisionStrategy;
    selectedAgents: OrganizationPortabilityAgentManifestEntry[];
};
export type ImportMode = "board_full" | "agent_safe";
export type ImportBehaviorOptions = {
    mode?: ImportMode;
    sourceOrganizationId?: string | null;
};
export type AgentLike = {
    id: string;
    name: string;
    agentRuntimeConfig: Record<string, unknown>;
};
export type EnvInputRecord = {
    kind: "secret" | "plain";
    requirement: "required" | "optional";
    default?: string | null;
    description?: string | null;
    portability?: "portable" | "system_dependent";
};
export declare const COMPANY_LOGO_CONTENT_TYPE_EXTENSIONS: Record<string, string>;
export declare const COMPANY_LOGO_FILE_NAME = "organization-logo";
export declare const RUNTIME_DEFAULT_RULES: Array<{
    path: string[];
    value: unknown;
}>;
export declare const ADAPTER_DEFAULT_RULES_BY_TYPE: Record<string, Array<{
    path: string[];
    value: unknown;
}>>;
export declare function isPlainRecord(value: unknown): value is Record<string, unknown>;
export declare function asString(value: unknown): string | null;
export declare function asBoolean(value: unknown): boolean | null;
export declare function asInteger(value: unknown): number | null;
export declare function normalizeAutomationTriggerExtension(value: unknown): OrganizationPortabilityIssueAutomationTriggerManifestEntry | null;
export declare function normalizeAutomationExtension(value: unknown): OrganizationPortabilityIssueAutomationManifestEntry | null;
export declare function buildAutomationManifestFromLiveAutomation(automation: AutomationLike): OrganizationPortabilityIssueAutomationManifestEntry;
export declare function containsAbsolutePathFragment(value: string): boolean;
export declare function containsSystemDependentPathValue(value: unknown): boolean;
export declare function clonePortableRecord(value: unknown): Record<string, unknown> | null;
export declare function isEmptyObject(value: unknown): boolean;
export declare function isEmptyArray(value: unknown): boolean;
export declare function stripEmptyValues(value: unknown, opts?: {
    preserveEmptyStrings?: boolean;
}): unknown;
export declare function disableImportedTimerHeartbeat(runtimeConfig: unknown): Record<string, unknown>;
export declare function normalizePortableProjectWorkspaceExtension(workspaceKey: string, value: unknown): OrganizationPortabilityProjectWorkspaceManifestEntry | null;
export declare function derivePortableProjectWorkspaceKey(workspace: NonNullable<ProjectLike["workspaces"]>[number], usedKeys: Set<string>): string;
export declare function exportPortableProjectExecutionWorkspacePolicy(projectSlug: string, policy: unknown, workspaceKeyById: Map<string, string>, warnings: string[]): Record<string, unknown> | null;
export declare function importPortableProjectExecutionWorkspacePolicy(projectSlug: string, policy: Record<string, unknown> | null | undefined, workspaceIdByKey: Map<string, string>, warnings: string[]): Record<string, unknown> | null;
export declare function stripPortableProjectExecutionWorkspaceRefs(policy: Record<string, unknown> | null | undefined): Record<string, unknown> | null;
export declare function readGitOutput(cwd: string, args: string[]): Promise<string | null>;
export declare function inferPortableWorkspaceGitMetadata(workspace: NonNullable<ProjectLike["workspaces"]>[number]): Promise<{
    repoUrl: string | null;
    repoRef: string | null;
    defaultRef: string | null;
}>;
export declare function buildPortableProjectWorkspaces(projectSlug: string, workspaces: ProjectLike["workspaces"] | undefined, warnings: string[]): Promise<{
    extension: Record<string, Record<string, unknown>> | undefined;
    manifest: OrganizationPortabilityProjectWorkspaceManifestEntry[];
    workspaceKeyById: Map<string, string>;
}>;
export declare const WEEKDAY_TO_CRON: Record<string, string>;
export declare function readZonedDateParts(startsAt: string, timeZone: string): {
    weekday: string;
    month: number;
    day: number;
    hour: number;
    minute: number;
} | null;
export declare function normalizeCronList(values: string[]): string;
export declare function buildLegacyAutomationTriggerFromRecurrence(issue: Pick<OrganizationPortabilityIssueManifestEntry, "slug" | "legacyRecurrence">, scheduleValue: unknown): {
    trigger: null;
    warnings: string[];
    errors: string[];
} | {
    trigger: {
        kind: string;
        label: string;
        enabled: true;
        cronExpression: string;
        timezone: string;
        signingMode: null;
        replayWindowSec: null;
    };
    warnings: string[];
    errors: string[];
};
export declare function resolvePortableAutomationDefinition(issue: Pick<OrganizationPortabilityIssueManifestEntry, "slug" | "recurring" | "automation" | "legacyRecurrence">, scheduleValue: unknown): {
    automation: null;
    warnings: string[];
    errors: string[];
} | {
    automation: {
        concurrencyPolicy: string | null;
        catchUpPolicy: string | null;
        triggers: OrganizationPortabilityIssueAutomationTriggerManifestEntry[];
    };
    warnings: string[];
    errors: string[];
};
export declare function toSafeSlug(input: string, fallback: string): string;
export declare function uniqueSlug(base: string, used: Set<string>): string;
export declare function uniqueNameBySlug(baseName: string, existingSlugs: Set<string>): string;
export declare function uniqueProjectName(baseName: string, existingProjectSlugs: Set<string>): string;
//# sourceMappingURL=organization-portability.core.d.ts.map