@mcp-consultant-tools/azure-devops 27.0.0-beta.1 → 27.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/AzureDevOpsService.d.ts +62 -0
- package/build/AzureDevOpsService.d.ts.map +1 -1
- package/build/AzureDevOpsService.js +395 -2
- package/build/AzureDevOpsService.js.map +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +930 -13
- package/build/index.js.map +1 -1
- package/build/sync/file-utils.d.ts +86 -0
- package/build/sync/file-utils.d.ts.map +1 -0
- package/build/sync/file-utils.js +224 -0
- package/build/sync/file-utils.js.map +1 -0
- package/build/sync/git-utils.d.ts +31 -0
- package/build/sync/git-utils.d.ts.map +1 -0
- package/build/sync/git-utils.js +116 -0
- package/build/sync/git-utils.js.map +1 -0
- package/build/sync/html-converter.d.ts +32 -0
- package/build/sync/html-converter.d.ts.map +1 -0
- package/build/sync/html-converter.js +91 -0
- package/build/sync/html-converter.js.map +1 -0
- package/build/sync/html-detection.d.ts +93 -0
- package/build/sync/html-detection.d.ts.map +1 -0
- package/build/sync/html-detection.js +169 -0
- package/build/sync/html-detection.js.map +1 -0
- package/build/sync/index.d.ts +12 -0
- package/build/sync/index.d.ts.map +1 -0
- package/build/sync/index.js +12 -0
- package/build/sync/index.js.map +1 -0
- package/build/sync/markdown-serializer.d.ts +136 -0
- package/build/sync/markdown-serializer.d.ts.map +1 -0
- package/build/sync/markdown-serializer.js +646 -0
- package/build/sync/markdown-serializer.js.map +1 -0
- package/build/sync/task-serializer.d.ts +93 -0
- package/build/sync/task-serializer.d.ts.map +1 -0
- package/build/sync/task-serializer.js +395 -0
- package/build/sync/task-serializer.js.map +1 -0
- package/build/tool-examples.d.ts +56 -0
- package/build/tool-examples.d.ts.map +1 -0
- package/build/tool-examples.js +142 -0
- package/build/tool-examples.js.map +1 -0
- package/package.json +3 -1
|
@@ -304,6 +304,15 @@ export declare class AzureDevOpsService {
|
|
|
304
304
|
* @returns Updated work item
|
|
305
305
|
*/
|
|
306
306
|
updateWorkItem(project: string, workItemId: number, patchOperations: any[]): Promise<any>;
|
|
307
|
+
/**
|
|
308
|
+
* Set work item field(s) to markdown format.
|
|
309
|
+
* This is IRREVERSIBLE - once set to markdown, cannot revert to HTML.
|
|
310
|
+
*
|
|
311
|
+
* @param project - Project name
|
|
312
|
+
* @param workItemId - Work item ID
|
|
313
|
+
* @param fields - Array of field names to set to markdown format (e.g., ['System.Description'])
|
|
314
|
+
*/
|
|
315
|
+
setFieldsToMarkdownFormat(project: string, workItemId: number, fields: string[]): Promise<void>;
|
|
307
316
|
/**
|
|
308
317
|
* Create a new work item
|
|
309
318
|
* @param project The project name
|
|
@@ -338,6 +347,30 @@ export declare class AzureDevOpsService {
|
|
|
338
347
|
* @returns Variable group details with variables
|
|
339
348
|
*/
|
|
340
349
|
getVariableGroup(project: string, groupId: number): Promise<any>;
|
|
350
|
+
/**
|
|
351
|
+
* Get build status with optional timeline and logs
|
|
352
|
+
* @param project The project name
|
|
353
|
+
* @param buildId The build ID
|
|
354
|
+
* @param detail Level of detail: 'summary', 'timeline', or 'full'
|
|
355
|
+
* @param timelineScope Scope for timeline: 'stages', 'jobs', 'all', 'problems'
|
|
356
|
+
* @param maxIssues Maximum issues per record
|
|
357
|
+
*/
|
|
358
|
+
getBuildStatus(project: string, buildId: number, detail?: string, timelineScope?: 'stages' | 'jobs' | 'all' | 'problems', maxIssues?: number): Promise<any>;
|
|
359
|
+
/**
|
|
360
|
+
* Get build timeline with step-by-step breakdown
|
|
361
|
+
* @param project The project name
|
|
362
|
+
* @param buildId The build ID
|
|
363
|
+
* @param scope Filter scope: 'stages', 'jobs', 'all', 'problems'
|
|
364
|
+
* @param maxIssues Maximum issues per record
|
|
365
|
+
*/
|
|
366
|
+
getBuildTimeline(project: string, buildId: number, scope?: 'stages' | 'jobs' | 'all' | 'problems', maxIssues?: number): Promise<any>;
|
|
367
|
+
/**
|
|
368
|
+
* Get build logs (list or specific log content)
|
|
369
|
+
* @param project The project name
|
|
370
|
+
* @param buildId The build ID
|
|
371
|
+
* @param logId Optional specific log ID to retrieve content
|
|
372
|
+
*/
|
|
373
|
+
getBuildLogs(project: string, buildId: number, logId?: number): Promise<any>;
|
|
341
374
|
/**
|
|
342
375
|
* List all Git repositories in a project
|
|
343
376
|
* @param project The project name
|
|
@@ -404,5 +437,34 @@ export declare class AzureDevOpsService {
|
|
|
404
437
|
* @returns Created thread
|
|
405
438
|
*/
|
|
406
439
|
addPullRequestThread(project: string, repositoryId: string, pullRequestId: number, content: string, filePath?: string, lineNumber?: number, status?: 'active' | 'fixed' | 'wontFix' | 'closed' | 'byDesign' | 'pending'): Promise<any>;
|
|
440
|
+
/**
|
|
441
|
+
* Create a new pull request
|
|
442
|
+
*/
|
|
443
|
+
createPullRequest(project: string, repositoryId: string, sourceRefName: string, targetRefName: string, title: string, description?: string, reviewerIds?: string[], isDraft?: boolean): Promise<any>;
|
|
444
|
+
/**
|
|
445
|
+
* Update an existing pull request (title, description, status, draft)
|
|
446
|
+
*/
|
|
447
|
+
updatePullRequest(project: string, repositoryId: string, pullRequestId: number, updates: {
|
|
448
|
+
title?: string;
|
|
449
|
+
description?: string;
|
|
450
|
+
status?: 'abandoned' | 'active';
|
|
451
|
+
isDraft?: boolean;
|
|
452
|
+
}): Promise<any>;
|
|
453
|
+
/**
|
|
454
|
+
* Complete (merge) a pull request
|
|
455
|
+
*/
|
|
456
|
+
completePullRequest(project: string, repositoryId: string, pullRequestId: number, mergeStrategy?: 'squash' | 'noFastForward' | 'rebase' | 'rebaseMerge', deleteSourceBranch?: boolean, transitionWorkItems?: boolean, mergeCommitMessage?: string): Promise<any>;
|
|
457
|
+
/**
|
|
458
|
+
* Add or remove a reviewer from a pull request
|
|
459
|
+
*/
|
|
460
|
+
addOrRemovePrReviewer(project: string, repositoryId: string, pullRequestId: number, reviewerId: string, isRequired?: boolean, remove?: boolean): Promise<any>;
|
|
461
|
+
/**
|
|
462
|
+
* Submit a vote on a pull request
|
|
463
|
+
*/
|
|
464
|
+
votePullRequest(project: string, repositoryId: string, pullRequestId: number, vote: 'approve' | 'approveWithSuggestions' | 'noResponse' | 'waitForAuthor' | 'reject', reviewerId?: string): Promise<any>;
|
|
465
|
+
/**
|
|
466
|
+
* Reply to a PR thread and optionally update thread status
|
|
467
|
+
*/
|
|
468
|
+
replyToPrThread(project: string, repositoryId: string, pullRequestId: number, threadId: number, content?: string, status?: 'active' | 'fixed' | 'wontFix' | 'closed' | 'byDesign' | 'pending'): Promise<any>;
|
|
407
469
|
}
|
|
408
470
|
//# sourceMappingURL=AzureDevOpsService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureDevOpsService.d.ts","sourceRoot":"","sources":["../src/AzureDevOpsService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AzureDevOpsService.d.ts","sourceRoot":"","sources":["../src/AzureDevOpsService.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAGpC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAGD,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAMD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM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AO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAC1E,OAAO,CAAC,GAAG,CAAC;CAsChB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { marked } from 'marked';
|
|
3
|
+
import { getAllLargeTextFields } from './sync/html-detection.js';
|
|
3
4
|
export class AzureDevOpsService {
|
|
4
5
|
config;
|
|
5
6
|
baseUrl;
|
|
@@ -514,8 +515,8 @@ export class AzureDevOpsService {
|
|
|
514
515
|
this.validateProject(project);
|
|
515
516
|
// Comments API requires -preview suffix (not GA in 7.1)
|
|
516
517
|
const response = await this.makeRequest(`${project}/_apis/wit/workItems/${workItemId}/comments?api-version=7.1-preview`);
|
|
517
|
-
//
|
|
518
|
-
const comments = response.value || [];
|
|
518
|
+
// v7.1 Comments API returns array in response.comments, not response.value
|
|
519
|
+
const comments = response.comments || response.value || [];
|
|
519
520
|
return {
|
|
520
521
|
workItemId,
|
|
521
522
|
project,
|
|
@@ -582,6 +583,25 @@ export class AzureDevOpsService {
|
|
|
582
583
|
project
|
|
583
584
|
};
|
|
584
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Set work item field(s) to markdown format.
|
|
588
|
+
* This is IRREVERSIBLE - once set to markdown, cannot revert to HTML.
|
|
589
|
+
*
|
|
590
|
+
* @param project - Project name
|
|
591
|
+
* @param workItemId - Work item ID
|
|
592
|
+
* @param fields - Array of field names to set to markdown format (e.g., ['System.Description'])
|
|
593
|
+
*/
|
|
594
|
+
async setFieldsToMarkdownFormat(project, workItemId, fields) {
|
|
595
|
+
if (!this.config.enableWorkItemWrite) {
|
|
596
|
+
throw new Error('Work item write operations are disabled. Set AZUREDEVOPS_ENABLE_WORK_ITEM_WRITE=true to enable.');
|
|
597
|
+
}
|
|
598
|
+
const patchOperations = fields.map(field => ({
|
|
599
|
+
op: 'add',
|
|
600
|
+
path: `/multilineFieldsFormat/${field}`,
|
|
601
|
+
value: 'Markdown'
|
|
602
|
+
}));
|
|
603
|
+
await this.updateWorkItem(project, workItemId, patchOperations);
|
|
604
|
+
}
|
|
585
605
|
/**
|
|
586
606
|
* Create a new work item
|
|
587
607
|
* @param project The project name
|
|
@@ -606,6 +626,19 @@ export class AzureDevOpsService {
|
|
|
606
626
|
value: fields[field]
|
|
607
627
|
});
|
|
608
628
|
});
|
|
629
|
+
// Auto-set markdown format for large text fields that are being set
|
|
630
|
+
// This ensures all new work items use markdown format (irreversible)
|
|
631
|
+
// Uses getAllLargeTextFields() to include custom fields like Custom.Howtotest
|
|
632
|
+
const allLargeTextFields = getAllLargeTextFields();
|
|
633
|
+
for (const field of allLargeTextFields) {
|
|
634
|
+
if (fields[field] !== undefined) {
|
|
635
|
+
patchOperations.push({
|
|
636
|
+
op: 'add',
|
|
637
|
+
path: `/multilineFieldsFormat/${field}`,
|
|
638
|
+
value: 'Markdown'
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
609
642
|
// Handle parentId parameter (simplified parent relationship)
|
|
610
643
|
if (parentId !== undefined) {
|
|
611
644
|
const parentUrl = `${this.baseUrl}/${encodeURIComponent(project)}/_apis/wit/workItems/${parentId}`;
|
|
@@ -726,6 +759,181 @@ export class AzureDevOpsService {
|
|
|
726
759
|
};
|
|
727
760
|
}
|
|
728
761
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
762
|
+
// BUILD TROUBLESHOOTING OPERATIONS (Read-only)
|
|
763
|
+
// NOTE: These methods are duplicated in azure-devops-admin package.
|
|
764
|
+
// If you update these, also update packages/azure-devops-admin/src/AzureDevOpsAdminService.ts
|
|
765
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
766
|
+
/**
|
|
767
|
+
* Get build status with optional timeline and logs
|
|
768
|
+
* @param project The project name
|
|
769
|
+
* @param buildId The build ID
|
|
770
|
+
* @param detail Level of detail: 'summary', 'timeline', or 'full'
|
|
771
|
+
* @param timelineScope Scope for timeline: 'stages', 'jobs', 'all', 'problems'
|
|
772
|
+
* @param maxIssues Maximum issues per record
|
|
773
|
+
*/
|
|
774
|
+
async getBuildStatus(project, buildId, detail = 'summary', timelineScope = 'problems', maxIssues = 5) {
|
|
775
|
+
this.validateProject(project);
|
|
776
|
+
const response = await this.makeRequest(`${project}/_apis/build/builds/${buildId}?api-version=${this.apiVersion}`);
|
|
777
|
+
const result = {
|
|
778
|
+
id: response.id,
|
|
779
|
+
buildNumber: response.buildNumber,
|
|
780
|
+
status: response.status,
|
|
781
|
+
result: response.result,
|
|
782
|
+
queueTime: response.queueTime,
|
|
783
|
+
startTime: response.startTime,
|
|
784
|
+
finishTime: response.finishTime,
|
|
785
|
+
sourceBranch: response.sourceBranch,
|
|
786
|
+
sourceVersion: response.sourceVersion,
|
|
787
|
+
definition: response.definition ? {
|
|
788
|
+
id: response.definition.id,
|
|
789
|
+
name: response.definition.name
|
|
790
|
+
} : null,
|
|
791
|
+
requestedBy: response.requestedBy?.displayName,
|
|
792
|
+
requestedFor: response.requestedFor?.displayName,
|
|
793
|
+
reason: response.reason,
|
|
794
|
+
priority: response.priority,
|
|
795
|
+
project: response.project?.name,
|
|
796
|
+
url: response._links?.web?.href
|
|
797
|
+
};
|
|
798
|
+
if (detail === 'timeline' || detail === 'full') {
|
|
799
|
+
const timeline = await this.getBuildTimeline(project, buildId, timelineScope, maxIssues);
|
|
800
|
+
result.timeline = timeline;
|
|
801
|
+
}
|
|
802
|
+
if (detail === 'full') {
|
|
803
|
+
const logs = await this.getBuildLogs(project, buildId);
|
|
804
|
+
result.logs = logs;
|
|
805
|
+
}
|
|
806
|
+
return result;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Get build timeline with step-by-step breakdown
|
|
810
|
+
* @param project The project name
|
|
811
|
+
* @param buildId The build ID
|
|
812
|
+
* @param scope Filter scope: 'stages', 'jobs', 'all', 'problems'
|
|
813
|
+
* @param maxIssues Maximum issues per record
|
|
814
|
+
*/
|
|
815
|
+
async getBuildTimeline(project, buildId, scope = 'problems', maxIssues = 5) {
|
|
816
|
+
this.validateProject(project);
|
|
817
|
+
const response = await this.makeRequest(`${project}/_apis/build/builds/${buildId}/timeline?api-version=${this.apiVersion}`);
|
|
818
|
+
const allRecords = response.records || [];
|
|
819
|
+
const summary = {
|
|
820
|
+
total: allRecords.length,
|
|
821
|
+
byType: {},
|
|
822
|
+
byResult: {},
|
|
823
|
+
totalErrors: 0,
|
|
824
|
+
totalWarnings: 0,
|
|
825
|
+
failed: [],
|
|
826
|
+
};
|
|
827
|
+
for (const record of allRecords) {
|
|
828
|
+
summary.byType[record.type] = (summary.byType[record.type] || 0) + 1;
|
|
829
|
+
if (record.result) {
|
|
830
|
+
summary.byResult[record.result] = (summary.byResult[record.result] || 0) + 1;
|
|
831
|
+
}
|
|
832
|
+
summary.totalErrors += record.errorCount || 0;
|
|
833
|
+
summary.totalWarnings += record.warningCount || 0;
|
|
834
|
+
if (record.result === 'failed' || record.result === 'canceled') {
|
|
835
|
+
summary.failed.push(`${record.type}: ${record.name}`);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
let filteredRecords = allRecords;
|
|
839
|
+
switch (scope) {
|
|
840
|
+
case 'stages':
|
|
841
|
+
filteredRecords = allRecords.filter((r) => r.type === 'Stage');
|
|
842
|
+
break;
|
|
843
|
+
case 'jobs':
|
|
844
|
+
filteredRecords = allRecords.filter((r) => r.type === 'Stage' || r.type === 'Job');
|
|
845
|
+
break;
|
|
846
|
+
case 'problems':
|
|
847
|
+
filteredRecords = allRecords.filter((r) => (r.errorCount && r.errorCount > 0) ||
|
|
848
|
+
(r.warningCount && r.warningCount > 0) ||
|
|
849
|
+
r.result === 'failed' ||
|
|
850
|
+
r.result === 'canceled');
|
|
851
|
+
break;
|
|
852
|
+
case 'all':
|
|
853
|
+
default:
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
const truncateIssues = (issues, max) => {
|
|
857
|
+
if (!issues || issues.length === 0)
|
|
858
|
+
return { items: [], totalCount: 0, truncated: false };
|
|
859
|
+
const sorted = [...issues].sort((a, b) => {
|
|
860
|
+
const priority = (issue) => {
|
|
861
|
+
if (issue.type === 'error')
|
|
862
|
+
return 0;
|
|
863
|
+
if (issue.type === 'warning')
|
|
864
|
+
return 1;
|
|
865
|
+
return 2;
|
|
866
|
+
};
|
|
867
|
+
return priority(a) - priority(b);
|
|
868
|
+
});
|
|
869
|
+
return {
|
|
870
|
+
items: sorted.slice(0, max),
|
|
871
|
+
totalCount: issues.length,
|
|
872
|
+
truncated: issues.length > max
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
const mappedRecords = filteredRecords.map((record) => {
|
|
876
|
+
const truncatedIssues = truncateIssues(record.issues, maxIssues);
|
|
877
|
+
return {
|
|
878
|
+
id: record.id,
|
|
879
|
+
parentId: record.parentId,
|
|
880
|
+
type: record.type,
|
|
881
|
+
name: record.name,
|
|
882
|
+
state: record.state,
|
|
883
|
+
result: record.result,
|
|
884
|
+
startTime: record.startTime,
|
|
885
|
+
finishTime: record.finishTime,
|
|
886
|
+
order: record.order,
|
|
887
|
+
errorCount: record.errorCount,
|
|
888
|
+
warningCount: record.warningCount,
|
|
889
|
+
log: record.log ? { id: record.log.id } : null,
|
|
890
|
+
issues: truncatedIssues.items,
|
|
891
|
+
issuesTruncated: truncatedIssues.truncated,
|
|
892
|
+
totalIssueCount: truncatedIssues.totalCount
|
|
893
|
+
};
|
|
894
|
+
});
|
|
895
|
+
return {
|
|
896
|
+
buildId,
|
|
897
|
+
project,
|
|
898
|
+
scope,
|
|
899
|
+
summary,
|
|
900
|
+
recordCount: mappedRecords.length,
|
|
901
|
+
records: mappedRecords
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Get build logs (list or specific log content)
|
|
906
|
+
* @param project The project name
|
|
907
|
+
* @param buildId The build ID
|
|
908
|
+
* @param logId Optional specific log ID to retrieve content
|
|
909
|
+
*/
|
|
910
|
+
async getBuildLogs(project, buildId, logId) {
|
|
911
|
+
this.validateProject(project);
|
|
912
|
+
if (logId !== undefined) {
|
|
913
|
+
const response = await this.makeRequest(`${project}/_apis/build/builds/${buildId}/logs/${logId}?api-version=${this.apiVersion}`);
|
|
914
|
+
return {
|
|
915
|
+
buildId,
|
|
916
|
+
logId,
|
|
917
|
+
project,
|
|
918
|
+
content: response
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
const response = await this.makeRequest(`${project}/_apis/build/builds/${buildId}/logs?api-version=${this.apiVersion}`);
|
|
922
|
+
return {
|
|
923
|
+
buildId,
|
|
924
|
+
project,
|
|
925
|
+
totalCount: response.value.length,
|
|
926
|
+
logs: response.value.map((log) => ({
|
|
927
|
+
id: log.id,
|
|
928
|
+
type: log.type,
|
|
929
|
+
lineCount: log.lineCount,
|
|
930
|
+
createdOn: log.createdOn,
|
|
931
|
+
lastChangedOn: log.lastChangedOn,
|
|
932
|
+
url: log.url
|
|
933
|
+
}))
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
729
937
|
// PULL REQUEST OPERATIONS
|
|
730
938
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
731
939
|
/**
|
|
@@ -1004,5 +1212,190 @@ export class AzureDevOpsService {
|
|
|
1004
1212
|
project
|
|
1005
1213
|
};
|
|
1006
1214
|
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Create a new pull request
|
|
1217
|
+
*/
|
|
1218
|
+
async createPullRequest(project, repositoryId, sourceRefName, targetRefName, title, description, reviewerIds, isDraft) {
|
|
1219
|
+
this.validateProject(project);
|
|
1220
|
+
if (!this.config.enablePullRequestWrite) {
|
|
1221
|
+
throw new Error('Pull request write operations are disabled. Set AZUREDEVOPS_ENABLE_PR_WRITE=true to enable.');
|
|
1222
|
+
}
|
|
1223
|
+
const body = {
|
|
1224
|
+
sourceRefName,
|
|
1225
|
+
targetRefName,
|
|
1226
|
+
title,
|
|
1227
|
+
description: description || '',
|
|
1228
|
+
isDraft: isDraft || false,
|
|
1229
|
+
};
|
|
1230
|
+
if (reviewerIds && reviewerIds.length > 0) {
|
|
1231
|
+
body.reviewers = reviewerIds.map(id => ({ id }));
|
|
1232
|
+
}
|
|
1233
|
+
const response = await this.makeRequest(`${project}/_apis/git/repositories/${repositoryId}/pullrequests?api-version=${this.apiVersion}`, 'POST', body, false, { 'Content-Type': 'application/json' });
|
|
1234
|
+
return {
|
|
1235
|
+
pullRequestId: response.pullRequestId,
|
|
1236
|
+
title: response.title,
|
|
1237
|
+
status: response.status,
|
|
1238
|
+
isDraft: response.isDraft,
|
|
1239
|
+
sourceBranch: response.sourceRefName?.replace('refs/heads/', ''),
|
|
1240
|
+
targetBranch: response.targetRefName?.replace('refs/heads/', ''),
|
|
1241
|
+
createdBy: response.createdBy?.displayName,
|
|
1242
|
+
creationDate: response.creationDate,
|
|
1243
|
+
url: response.url,
|
|
1244
|
+
project
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Update an existing pull request (title, description, status, draft)
|
|
1249
|
+
*/
|
|
1250
|
+
async updatePullRequest(project, repositoryId, pullRequestId, updates) {
|
|
1251
|
+
this.validateProject(project);
|
|
1252
|
+
if (!this.config.enablePullRequestWrite) {
|
|
1253
|
+
throw new Error('Pull request write operations are disabled. Set AZUREDEVOPS_ENABLE_PR_WRITE=true to enable.');
|
|
1254
|
+
}
|
|
1255
|
+
const body = {};
|
|
1256
|
+
if (updates.title !== undefined)
|
|
1257
|
+
body.title = updates.title;
|
|
1258
|
+
if (updates.description !== undefined)
|
|
1259
|
+
body.description = updates.description;
|
|
1260
|
+
if (updates.status !== undefined)
|
|
1261
|
+
body.status = updates.status;
|
|
1262
|
+
if (updates.isDraft !== undefined)
|
|
1263
|
+
body.isDraft = updates.isDraft;
|
|
1264
|
+
const response = await this.makeRequest(`${project}/_apis/git/repositories/${repositoryId}/pullrequests/${pullRequestId}?api-version=${this.apiVersion}`, 'PATCH', body, false, { 'Content-Type': 'application/json' });
|
|
1265
|
+
return {
|
|
1266
|
+
pullRequestId: response.pullRequestId,
|
|
1267
|
+
title: response.title,
|
|
1268
|
+
description: response.description ? this.truncate(response.description, 200) : null,
|
|
1269
|
+
status: response.status,
|
|
1270
|
+
isDraft: response.isDraft,
|
|
1271
|
+
project
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
/**
|
|
1275
|
+
* Complete (merge) a pull request
|
|
1276
|
+
*/
|
|
1277
|
+
async completePullRequest(project, repositoryId, pullRequestId, mergeStrategy = 'squash', deleteSourceBranch = true, transitionWorkItems = true, mergeCommitMessage) {
|
|
1278
|
+
this.validateProject(project);
|
|
1279
|
+
if (!this.config.enablePullRequestWrite) {
|
|
1280
|
+
throw new Error('Pull request write operations are disabled. Set AZUREDEVOPS_ENABLE_PR_WRITE=true to enable.');
|
|
1281
|
+
}
|
|
1282
|
+
// Fetch current PR to get lastMergeSourceCommit
|
|
1283
|
+
const currentPr = await this.makeRequest(`${project}/_apis/git/repositories/${repositoryId}/pullrequests/${pullRequestId}?api-version=${this.apiVersion}`);
|
|
1284
|
+
const mergeStrategyMap = {
|
|
1285
|
+
noFastForward: 1,
|
|
1286
|
+
squash: 2,
|
|
1287
|
+
rebase: 3,
|
|
1288
|
+
rebaseMerge: 4,
|
|
1289
|
+
};
|
|
1290
|
+
const body = {
|
|
1291
|
+
status: 'completed',
|
|
1292
|
+
lastMergeSourceCommit: currentPr.lastMergeSourceCommit,
|
|
1293
|
+
completionOptions: {
|
|
1294
|
+
mergeStrategy: mergeStrategyMap[mergeStrategy],
|
|
1295
|
+
deleteSourceBranch,
|
|
1296
|
+
transitionWorkItems,
|
|
1297
|
+
},
|
|
1298
|
+
};
|
|
1299
|
+
if (mergeCommitMessage) {
|
|
1300
|
+
body.completionOptions.mergeCommitMessage = mergeCommitMessage;
|
|
1301
|
+
}
|
|
1302
|
+
const response = await this.makeRequest(`${project}/_apis/git/repositories/${repositoryId}/pullrequests/${pullRequestId}?api-version=${this.apiVersion}`, 'PATCH', body, false, { 'Content-Type': 'application/json' });
|
|
1303
|
+
return {
|
|
1304
|
+
pullRequestId: response.pullRequestId,
|
|
1305
|
+
title: response.title,
|
|
1306
|
+
status: response.status,
|
|
1307
|
+
mergeStrategy,
|
|
1308
|
+
closedDate: response.closedDate,
|
|
1309
|
+
project
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Add or remove a reviewer from a pull request
|
|
1314
|
+
*/
|
|
1315
|
+
async addOrRemovePrReviewer(project, repositoryId, pullRequestId, reviewerId, isRequired, remove) {
|
|
1316
|
+
this.validateProject(project);
|
|
1317
|
+
if (!this.config.enablePullRequestWrite) {
|
|
1318
|
+
throw new Error('Pull request write operations are disabled. Set AZUREDEVOPS_ENABLE_PR_WRITE=true to enable.');
|
|
1319
|
+
}
|
|
1320
|
+
const url = `${project}/_apis/git/repositories/${repositoryId}/pullrequests/${pullRequestId}/reviewers/${reviewerId}?api-version=${this.apiVersion}`;
|
|
1321
|
+
if (remove) {
|
|
1322
|
+
await this.makeRequest(url, 'DELETE');
|
|
1323
|
+
return { pullRequestId, reviewerId, action: 'removed', project };
|
|
1324
|
+
}
|
|
1325
|
+
const body = { id: reviewerId };
|
|
1326
|
+
if (isRequired !== undefined) {
|
|
1327
|
+
body.isRequired = isRequired;
|
|
1328
|
+
}
|
|
1329
|
+
const response = await this.makeRequest(url, 'PUT', body, false, { 'Content-Type': 'application/json' });
|
|
1330
|
+
return {
|
|
1331
|
+
pullRequestId,
|
|
1332
|
+
reviewerId: response.id,
|
|
1333
|
+
displayName: response.displayName,
|
|
1334
|
+
isRequired: response.isRequired,
|
|
1335
|
+
vote: response.vote,
|
|
1336
|
+
action: 'added',
|
|
1337
|
+
project
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Submit a vote on a pull request
|
|
1342
|
+
*/
|
|
1343
|
+
async votePullRequest(project, repositoryId, pullRequestId, vote, reviewerId) {
|
|
1344
|
+
this.validateProject(project);
|
|
1345
|
+
if (!this.config.enablePullRequestWrite) {
|
|
1346
|
+
throw new Error('Pull request write operations are disabled. Set AZUREDEVOPS_ENABLE_PR_WRITE=true to enable.');
|
|
1347
|
+
}
|
|
1348
|
+
const voteMap = {
|
|
1349
|
+
approve: 10,
|
|
1350
|
+
approveWithSuggestions: 5,
|
|
1351
|
+
noResponse: 0,
|
|
1352
|
+
waitForAuthor: -5,
|
|
1353
|
+
reject: -10,
|
|
1354
|
+
};
|
|
1355
|
+
// If no reviewerId, resolve authenticated user
|
|
1356
|
+
let userId = reviewerId;
|
|
1357
|
+
if (!userId) {
|
|
1358
|
+
const connectionData = await this.makeRequest('_apis/connectionData');
|
|
1359
|
+
userId = connectionData.authenticatedUser?.id;
|
|
1360
|
+
if (!userId) {
|
|
1361
|
+
throw new Error('Could not resolve authenticated user ID. Provide reviewerId explicitly.');
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
const body = { vote: voteMap[vote] };
|
|
1365
|
+
const response = await this.makeRequest(`${project}/_apis/git/repositories/${repositoryId}/pullrequests/${pullRequestId}/reviewers/${userId}?api-version=${this.apiVersion}`, 'PUT', body, false, { 'Content-Type': 'application/json' });
|
|
1366
|
+
return {
|
|
1367
|
+
pullRequestId,
|
|
1368
|
+
reviewerId: response.id,
|
|
1369
|
+
displayName: response.displayName,
|
|
1370
|
+
vote: response.vote,
|
|
1371
|
+
voteLabel: vote,
|
|
1372
|
+
project
|
|
1373
|
+
};
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Reply to a PR thread and optionally update thread status
|
|
1377
|
+
*/
|
|
1378
|
+
async replyToPrThread(project, repositoryId, pullRequestId, threadId, content, status) {
|
|
1379
|
+
this.validateProject(project);
|
|
1380
|
+
if (!this.config.enablePullRequestWrite) {
|
|
1381
|
+
throw new Error('Pull request write operations are disabled. Set AZUREDEVOPS_ENABLE_PR_WRITE=true to enable.');
|
|
1382
|
+
}
|
|
1383
|
+
const results = { pullRequestId, threadId, project };
|
|
1384
|
+
// Add reply comment if content provided
|
|
1385
|
+
if (content) {
|
|
1386
|
+
const commentResponse = await this.makeRequest(`${project}/_apis/git/repositories/${repositoryId}/pullrequests/${pullRequestId}/threads/${threadId}/comments?api-version=${this.apiVersion}`, 'POST', { content, parentCommentId: 0, commentType: 1 }, false, { 'Content-Type': 'application/json' });
|
|
1387
|
+
results.comment = {
|
|
1388
|
+
id: commentResponse.id,
|
|
1389
|
+
content: commentResponse.content,
|
|
1390
|
+
author: commentResponse.author?.displayName,
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
// Update thread status if provided
|
|
1394
|
+
if (status) {
|
|
1395
|
+
await this.makeRequest(`${project}/_apis/git/repositories/${repositoryId}/pullrequests/${pullRequestId}/threads/${threadId}?api-version=${this.apiVersion}`, 'PATCH', { status }, false, { 'Content-Type': 'application/json' });
|
|
1396
|
+
results.status = status;
|
|
1397
|
+
}
|
|
1398
|
+
return results;
|
|
1399
|
+
}
|
|
1007
1400
|
}
|
|
1008
1401
|
//# sourceMappingURL=AzureDevOpsService.js.map
|