Skip to content

Commit 57ff16d

Browse files
authored
Merge pull request #12 from CodeAnt-AI/review
select-commit added
2 parents 9d0eea4 + b509bff commit 57ff16d

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
4+
## [0.4.5] - 13/04/2026
5+
- Selected commits review
6+
37
## [0.4.4] - 09/04/2026
48
- Secrets location in hooks
59

@@ -87,4 +91,4 @@
8791

8892
## [0.1.6] - 19/03/2026
8993
- CLI UI Improvements
90-
- More review trigger options
94+
- More review trigger options

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeant-cli",
3-
"version": "0.4.4",
3+
"version": "0.4.5",
44
"description": "Code review CLI tool",
55
"type": "module",
66
"bin": {

src/reviewHeadless.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export async function runReviewHeadless(options = {}) {
8282
lastNCommits = 1,
8383
baseBranch = null,
8484
baseCommit = null,
85+
selectedCommits = [],
8586
onProgress = () => {},
8687
onFilesReady = () => {},
8788
} = options;
@@ -108,7 +109,7 @@ export async function runReviewHeadless(options = {}) {
108109
const helper = new ReviewApiHelper(workspacePath);
109110
await helper.init();
110111
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 });
112113

113114
const meta = requestBody?._meta || null;
114115
delete requestBody._meta;

src/utils/commonApiHelper.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,19 @@ class CommonApiHelper {
6060
return this._transformDiffsToApiFormat(diffs);
6161
}
6262

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+
6376
/**
6477
* Transform diff info array to API format
6578
* Must be implemented by subclasses
@@ -126,6 +139,8 @@ class CommonApiHelper {
126139
return await this.getLastCommitFilesForApi();
127140
case 'last-n-commits':
128141
return await this.getLastNCommitsFilesForApi(options.lastNCommits || 1);
142+
case 'select-commits':
143+
return await this.getSelectCommitsFilesForApi(options.selectedCommits || []);
129144
case 'base-branch':
130145
return await this.getBaseBranchDiffForApi(options.baseBranch);
131146
case 'base-commit':

0 commit comments

Comments
 (0)