import type { ProjectWithBranches, Branch } from "#ai-utils"; export declare class ProjectNotFoundError extends Error { readonly projectId: string; readonly builderPublicKey: string; constructor(projectId: string, builderPublicKey: string); } export interface ProjectSummary { id: string; name: string; repoUrl?: string; settings?: { folders?: Array<{ remoteUrl: string; }>; }; } export declare function getGitRemoteUrl(): Promise; export declare function readPinnedProjectIdAsync(): Promise; export declare function persistPinnedProjectId(projectId: string): Promise; /** * Normalize a git remote URL for comparison, mirroring the server-side logic. * Strips .git suffix, converts SSH to HTTPS-like format, removes protocol and lowercases. */ export declare function normalizeRepoUrl(url: string): string; /** * Returns whether the given URL matches the project's primary repo URL. */ export declare function isPrimaryRepo(project: ProjectSummary, normalizedRemote: string): boolean; /** * Returns whether any of the project's configured repo URLs match the given remote URL. * Checks both the primary repoUrl and any secondary repos in settings.folders. */ export declare function projectMatchesRemote(project: ProjectSummary, normalizedRemote: string): boolean; export declare function listProjects(builderPublicKey: string, builderPrivateKey: string, userId: string): Promise; export declare function getProjectWithBranches(builderPublicKey: string, builderPrivateKey: string, userId: string, projectId: string): Promise; export declare function findBranchByGitBranch(project: ProjectWithBranches, gitBranch: string): [string, Branch] | null; export declare function resolveGitBranchFromBuilderBranch(project: ProjectWithBranches, builderBranchArg: string): string | null; export declare function createFusionBranchForGitBranch(builderPublicKey: string, builderPrivateKey: string, userId: string, projectId: string, gitBranch: string, branchContext?: string, isPrimary?: boolean): Promise; export declare function notifyRemoteToSync(builderPublicKey: string, builderPrivateKey: string, userId: string, projectId: string, branchName: string): Promise; export interface ResolveProjectIdOptions { projectId?: string; builderPublicKey: string; builderPrivateKey: string; userId: string; spaceName?: string; /** * Called when multiple projects match the current git remote. * The caller should pick one and return its ID, or throw to cancel. */ onMultipleRepoMatches: (matched: ProjectSummary[]) => Promise; /** * Called when no projects match the current git remote, or there is no * remote, and multiple projects exist. The caller should pick one and * return its ID, or throw to cancel. */ onNoRepoMatch: (allProjects: ProjectSummary[]) => Promise; } export declare function resolveProjectId(options: ResolveProjectIdOptions): Promise;