/** * ADO HTTP Client and business logic helpers. * * Framework-agnostic — used by both the OpenCode plugin (index.ts) * and the Pi extension (pi-entry.ts). * * Extracted from index.ts to avoid duplicating ~500 lines of ADO logic. */ import type { AdoConfig, AdoProfile } from "./shared.js"; import type { CreatePrOptions, GitRefUpdateResult, GitPullRequest } from "./chain-types.js"; export declare const API_VERSION = "7.1"; export declare const WIT_COMMENTS_API_VERSION = "7.1-preview.4"; export declare class AdoClient { private orgUrl; private project; private authHeader; private workItemTypesCache; constructor(orgUrl: string, project: string, pat: string); private buildUrl; private request; private requestRaw; getUserIdentity(): Promise<{ id: string; displayName: string; }>; listPullRequests(repo: string, options?: { status?: string; reviewerId?: string; creatorId?: string; }): Promise; getPullRequest(repo: string, prId: number): Promise; getThreads(repo: string, prId: number): Promise; voteReviewer(repo: string, prId: number, userId: string, vote: number): Promise; createThread(repo: string, prId: number, comment: string, context?: { filePath?: string; line?: number; }): Promise; getIterations(repo: string, prId: number): Promise; getIterationChanges(repo: string, prId: number, iterationId: number): Promise; getCommits(repo: string, prId: number): Promise; getFileContent(repo: string, path: string, branch: string): Promise; getPrSourceBranch(repo: string, prId: number): Promise; updateWorkItem(id: number, patchOps: Array<{ op: string; path: string; value: any; }>): Promise; /** * Create a work item. * POST /_apis/wit/workitems/$${type}?api-version=7.1 * Content-Type: application/json-patch+json * * @param customFields - Arbitrary ADO fields as key-value pairs where keys are * full ADO field paths (e.g. "/fields/Custom.Sponsors"). */ createWorkItem(type: string, fields: Record, parentRelation?: { parentId: number; relationType: string; }, customFields?: Record): Promise; getWorkItemComments(id: number): Promise; addWorkItemComment(id: number, text: string): Promise; getWorkItemTypes(): Promise; queryWiql(wiql: string): Promise<{ workItems?: Array<{ id: number; }>; workItemRelations?: Array<{ source?: { id: number; }; target?: { id: number; }; }>; }>; getWorkItemsByIds(ids: number[], fields?: string[]): Promise; getWorkItem(id: number, options?: { expandRelations?: boolean; }): Promise; getBranchTip(repo: string, branch: string): Promise; createBranch(repo: string, branchName: string, commitSha: string): Promise; createPullRequest(repo: string, options: CreatePrOptions): Promise; linkWorkItemToPr(workItemId: number, prArtifactUrl: string): Promise; getRepository(repo: string): Promise<{ repoId: string; projectId: string; }>; } export declare function guessLang(path: string): string; export declare function wiqlLiteral(value: string): string; export declare function assignedToCondition(assignedTo?: string): string; export declare function filterLabel(value?: string): string; export declare function workItemIdFromUrl(url?: string): number | undefined; export declare function relationLabel(rel: any): string; export declare function chunkArray(items: T[], size: number): T[][]; export declare function isMatchingWorkItemType(wi: any, workItemType?: string): boolean; export declare function formatComments(ado: AdoClient, id: number): Promise; export declare function formatWorkItemRelations(ado: AdoClient, wi: any): Promise; export declare function formatWorkItemFullDetail(ado: AdoClient, wi: any, title: string): Promise; export interface ResolvedClient { client: AdoClient; profile: AdoProfile; name: string; userId: { id: string; displayName: string; }; } /** * Resolve the active profile and create an ADO client. * Used by both OpenCode and Pi entry points. */ export declare function createClientFromConfig(config: AdoConfig, profileOverride?: string): Promise; /** * Search for a PR by ID across all configured profiles. */ export declare function findPrAcrossProfiles(config: AdoConfig, prId: number, profileHint?: string): Promise<{ repo: string; profileName: string; } | null>; /** * Resolve repo+prId with auto-discovery when only prId is provided. */ export declare function resolvePrArgsAuto(config: AdoConfig, args: { repo?: string; prId?: number; profile?: string; }): Promise<{ repo: string; prId: number; profileName: string; }>; //# sourceMappingURL=ado-client.d.ts.map