codeant-cli 0.4.3 → 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
|
@@ -381,7 +381,41 @@ function BypassPrompt({ secrets, onSelect }) {
|
|
|
381
381
|
els.push(React.createElement(Text, { key: 'div-top', color: 'gray', dimColor: true }, DIVIDER));
|
|
382
382
|
els.push(React.createElement(
|
|
383
383
|
Text, { key: 'title', color: 'yellow', bold: true },
|
|
384
|
-
`${allSecrets.length} secret(s) detected
|
|
384
|
+
`${allSecrets.length} secret(s) detected:`,
|
|
385
|
+
));
|
|
386
|
+
els.push(React.createElement(Text, { key: 'sp-list' }, ''));
|
|
387
|
+
|
|
388
|
+
// Group by file and list each secret with line + type
|
|
389
|
+
const grouped = {};
|
|
390
|
+
allSecrets.forEach(s => {
|
|
391
|
+
const file = s.file_path || 'Unknown';
|
|
392
|
+
(grouped[file] ??= []).push(s);
|
|
393
|
+
});
|
|
394
|
+
const sortedFiles = Object.keys(grouped).sort();
|
|
395
|
+
sortedFiles.forEach(f =>
|
|
396
|
+
grouped[f].sort((a, b) => (a.line_number || 0) - (b.line_number || 0))
|
|
397
|
+
);
|
|
398
|
+
sortedFiles.forEach((file, fi) => {
|
|
399
|
+
const fileSecrets = grouped[file];
|
|
400
|
+
els.push(React.createElement(
|
|
401
|
+
Text, { key: `bp-f-${fi}`, color: 'white', bold: true }, ` ${file}`,
|
|
402
|
+
));
|
|
403
|
+
fileSecrets.forEach((secret, si) => {
|
|
404
|
+
const isLast = si === fileSecrets.length - 1;
|
|
405
|
+
const branch = isLast ? '└─' : '├─';
|
|
406
|
+
const lineStr = secret.line_number ? `L${secret.line_number}` : '';
|
|
407
|
+
els.push(React.createElement(
|
|
408
|
+
Box, { key: `bp-s-${fi}-${si}` },
|
|
409
|
+
React.createElement(Text, { color: 'gray' }, ` ${branch} `),
|
|
410
|
+
React.createElement(Text, { color: 'gray' }, padEnd(lineStr, 6)),
|
|
411
|
+
React.createElement(Text, { color: 'white' }, secret.type || ''),
|
|
412
|
+
));
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
els.push(React.createElement(Text, { key: 'sp-action' }, ''));
|
|
417
|
+
els.push(React.createElement(
|
|
418
|
+
Text, { key: 'action-label', color: 'yellow', bold: true }, 'Select an action:',
|
|
385
419
|
));
|
|
386
420
|
els.push(React.createElement(Text, { key: 'sp' }, ''));
|
|
387
421
|
|
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':
|