codeant-cli 0.4.4 → 0.4.5
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/package.json
CHANGED
package/src/reviewHeadless.js
CHANGED
|
@@ -82,6 +82,7 @@ export async function runReviewHeadless(options = {}) {
|
|
|
82
82
|
lastNCommits = 1,
|
|
83
83
|
baseBranch = null,
|
|
84
84
|
baseCommit = null,
|
|
85
|
+
selectedCommits = [],
|
|
85
86
|
onProgress = () => {},
|
|
86
87
|
onFilesReady = () => {},
|
|
87
88
|
} = options;
|
|
@@ -108,7 +109,7 @@ export async function runReviewHeadless(options = {}) {
|
|
|
108
109
|
const helper = new ReviewApiHelper(workspacePath);
|
|
109
110
|
await helper.init();
|
|
110
111
|
const gitRoot = helper.getGitRoot() || workspacePath;
|
|
111
|
-
const requestBody = await helper.buildReviewApiRequest(scanType, include, exclude, { lastNCommits, baseBranch, baseCommit });
|
|
112
|
+
const requestBody = await helper.buildReviewApiRequest(scanType, include, exclude, { lastNCommits, baseBranch, baseCommit, selectedCommits });
|
|
112
113
|
|
|
113
114
|
const meta = requestBody?._meta || null;
|
|
114
115
|
delete requestBody._meta;
|
|
@@ -60,6 +60,19 @@ class CommonApiHelper {
|
|
|
60
60
|
return this._transformDiffsToApiFormat(diffs);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Get specific selected commits formatted for the API
|
|
65
|
+
* @param {string[]} commits - Array of commit hashes to include
|
|
66
|
+
*/
|
|
67
|
+
async getSelectCommitsFilesForApi(commits = []) {
|
|
68
|
+
const diffs = await this.gitHelper.getDiffBasedOnReviewConfig({
|
|
69
|
+
type: 'select-commits',
|
|
70
|
+
commits,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return this._transformDiffsToApiFormat(diffs);
|
|
74
|
+
}
|
|
75
|
+
|
|
63
76
|
/**
|
|
64
77
|
* Transform diff info array to API format
|
|
65
78
|
* Must be implemented by subclasses
|
|
@@ -126,6 +139,8 @@ class CommonApiHelper {
|
|
|
126
139
|
return await this.getLastCommitFilesForApi();
|
|
127
140
|
case 'last-n-commits':
|
|
128
141
|
return await this.getLastNCommitsFilesForApi(options.lastNCommits || 1);
|
|
142
|
+
case 'select-commits':
|
|
143
|
+
return await this.getSelectCommitsFilesForApi(options.selectedCommits || []);
|
|
129
144
|
case 'base-branch':
|
|
130
145
|
return await this.getBaseBranchDiffForApi(options.baseBranch);
|
|
131
146
|
case 'base-commit':
|