@code-sentinel-cli/code-sentinel-cli 4.0.14 → 4.0.15
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/dist/bin.js
CHANGED
|
@@ -59285,6 +59285,8 @@ var init_schema = __esm({
|
|
|
59285
59285
|
minSeverity: severitySchema3.default("info"),
|
|
59286
59286
|
minConfidence: configInt({ min: 0, max: 100, default: 80 }),
|
|
59287
59287
|
applyBaseline: configBool({ default: false }),
|
|
59288
|
+
// Static findings outside the MR's changed lines are dropped by default (report + gate).
|
|
59289
|
+
includeUnchangedLines: configBool({ default: false }),
|
|
59288
59290
|
aiStrategy: prAiStrategySchema.default("smart"),
|
|
59289
59291
|
diffReview: external_exports.object({
|
|
59290
59292
|
enabled: configBool({ default: true }),
|
|
@@ -59425,6 +59427,7 @@ var init_schema = __esm({
|
|
|
59425
59427
|
minSeverity: "info",
|
|
59426
59428
|
minConfidence: 80,
|
|
59427
59429
|
applyBaseline: false,
|
|
59430
|
+
includeUnchangedLines: false,
|
|
59428
59431
|
aiStrategy: "smart",
|
|
59429
59432
|
diffReview: { enabled: true, maxChunkCalls: 8 },
|
|
59430
59433
|
primarySelection: {
|
|
@@ -60364,11 +60367,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
|
|
|
60364
60367
|
var getCliBuildMetadata = (version2) => ({
|
|
60365
60368
|
version: version2,
|
|
60366
60369
|
gitSha: definedBuildValue(
|
|
60367
|
-
"
|
|
60370
|
+
"e94c92c37806" ,
|
|
60368
60371
|
"unknown"
|
|
60369
60372
|
),
|
|
60370
60373
|
buildTimestamp: definedBuildValue(
|
|
60371
|
-
"2026-11-
|
|
60374
|
+
"2026-11-27T04:03:27.198Z" ,
|
|
60372
60375
|
"unknown"
|
|
60373
60376
|
),
|
|
60374
60377
|
configSchemaRange: definedBuildValue(
|
|
@@ -67418,8 +67421,17 @@ var dedupePrFindings = (findings2) => {
|
|
|
67418
67421
|
}
|
|
67419
67422
|
return [...byKey.values()];
|
|
67420
67423
|
};
|
|
67421
|
-
var
|
|
67422
|
-
|
|
67424
|
+
var touchesChangedLines = (finding, lineMap) => {
|
|
67425
|
+
const last = Math.max(finding.range.line, finding.range.endLine ?? finding.range.line);
|
|
67426
|
+
for (let line2 = finding.range.line; line2 <= last; line2 += 1) {
|
|
67427
|
+
if (getDiffLinePosition(lineMap, finding.file, line2)) return true;
|
|
67428
|
+
}
|
|
67429
|
+
return false;
|
|
67430
|
+
};
|
|
67431
|
+
var mergePrCandidateFindings = (staticFindings, aiFindings, changedPaths, lineMap, includeUnchangedLines = false) => dedupePrFindings([
|
|
67432
|
+
...staticFindings.filter(
|
|
67433
|
+
(finding) => changedPaths.has(finding.file) && (includeUnchangedLines || touchesChangedLines(finding, lineMap))
|
|
67434
|
+
),
|
|
67423
67435
|
...aiFindings
|
|
67424
67436
|
]);
|
|
67425
67437
|
|
|
@@ -68924,7 +68936,7 @@ var runPrReview = async (options) => {
|
|
|
68924
68936
|
(finding) => changedPaths.has(finding.file)
|
|
68925
68937
|
);
|
|
68926
68938
|
const staticFindings = staticChangedFileFindings.filter(
|
|
68927
|
-
(finding) =>
|
|
68939
|
+
(finding) => touchesChangedLines(finding, lineMap)
|
|
68928
68940
|
);
|
|
68929
68941
|
const supportFiles = await buildSupportFiles(
|
|
68930
68942
|
staticResult.allSourceFiles,
|
|
@@ -69104,7 +69116,13 @@ var runPrReview = async (options) => {
|
|
|
69104
69116
|
}
|
|
69105
69117
|
const enrichFinding = createFindingContextEnricher(staticResult.allSourceFiles);
|
|
69106
69118
|
const mergedFindings = [
|
|
69107
|
-
...mergePrCandidateFindings(
|
|
69119
|
+
...mergePrCandidateFindings(
|
|
69120
|
+
staticResult.run.findings,
|
|
69121
|
+
aiFindings,
|
|
69122
|
+
changedPaths,
|
|
69123
|
+
lineMap,
|
|
69124
|
+
config.prReview.includeUnchangedLines
|
|
69125
|
+
)
|
|
69108
69126
|
].map(enrichFinding).sort(compareFindings);
|
|
69109
69127
|
const classified = classifyPrFindings(mergedFindings, changedPaths, lineMap);
|
|
69110
69128
|
const aiStats = mergePrAiStats(
|
|
@@ -45,7 +45,7 @@ var collectFunctionNodes = (root) => {
|
|
|
45
45
|
var rule = {
|
|
46
46
|
id: "general/function-too-long",
|
|
47
47
|
// v5 (Tree-sitter multi-language refactor): TS/JS + Java support
|
|
48
|
-
version:
|
|
48
|
+
version: 6,
|
|
49
49
|
kind: "static-ts",
|
|
50
50
|
title: "H\xE0m qu\xE1 d\xE0i \u2014 t\xE1ch helper ho\u1EB7c step nh\u1ECF h\u01A1n",
|
|
51
51
|
description: "H\xE0m d\xE0i th\u01B0\u1EDDng g\xE1nh qu\xE1 nhi\u1EC1u tr\xE1ch nhi\u1EC7m. T\xE1ch th\xE0nh helpers nh\u1ECF gi\xFAp \u0111\u1EB7t t\xEAn c\xF3 ngh\u0129a, d\u1EC5 test, d\u1EC5 \u0111\u1ECDc. Threshold m\u1EB7c \u0111\u1ECBnh 80 d\xF2ng \u2014 tune qua `options.maxLines`.",
|
|
@@ -78,7 +78,8 @@ var rule = {
|
|
|
78
78
|
findings.push({
|
|
79
79
|
message: `H\xE0m "${getName(node)}" d\xE0i ${lines} d\xF2ng (gi\u1EDBi h\u1EA1n ${threshold}).`,
|
|
80
80
|
file: ctx.file.path,
|
|
81
|
-
|
|
81
|
+
// `endLine` lets PR review keep this finding when the MR grew the body but not the header.
|
|
82
|
+
range: { line: start, column: node.startPosition.column + 1, endLine: end },
|
|
82
83
|
suggestion: "T\xE1ch th\xE0nh helpers nh\u1ECF \u2014 m\u1ED7i helper \u0111\u1EA3m nhi\u1EC7m m\u1ED9t b\u01B0\u1EDBc r\xF5 r\xE0ng v\xE0 \u0111\u1EB7t t\xEAn c\xF3 ngh\u0129a."
|
|
83
84
|
});
|
|
84
85
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -852,6 +852,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
852
852
|
minSeverity: z.ZodDefault<z.ZodEnum<["info", "warning", "error", "blocker"]>>;
|
|
853
853
|
minConfidence: z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]> | z.ZodDefault<z.ZodUnion<[z.ZodNumber, z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>]>>;
|
|
854
854
|
applyBaseline: z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]> | z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>;
|
|
855
|
+
includeUnchangedLines: z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]> | z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>;
|
|
855
856
|
aiStrategy: z.ZodDefault<z.ZodEnum<["smart", "specialized"]>>;
|
|
856
857
|
diffReview: z.ZodDefault<z.ZodObject<{
|
|
857
858
|
enabled: z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]> | z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodEffects<z.ZodPipeline<z.ZodString, z.ZodEnum<["true", "false", "1", "0"]>>, boolean, string>]>>;
|
|
@@ -991,6 +992,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
991
992
|
maxInlineComments: number;
|
|
992
993
|
minConfidence: number;
|
|
993
994
|
applyBaseline: boolean;
|
|
995
|
+
includeUnchangedLines: boolean;
|
|
994
996
|
aiStrategy: "smart" | "specialized";
|
|
995
997
|
diffReview: {
|
|
996
998
|
enabled: boolean;
|
|
@@ -1043,6 +1045,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1043
1045
|
maxInlineComments?: string | number | undefined;
|
|
1044
1046
|
minConfidence?: string | number | undefined;
|
|
1045
1047
|
applyBaseline?: string | boolean | undefined;
|
|
1048
|
+
includeUnchangedLines?: string | boolean | undefined;
|
|
1046
1049
|
aiStrategy?: "smart" | "specialized" | undefined;
|
|
1047
1050
|
diffReview?: {
|
|
1048
1051
|
enabled?: string | boolean | undefined;
|
|
@@ -1873,6 +1876,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1873
1876
|
maxInlineComments: number;
|
|
1874
1877
|
minConfidence: number;
|
|
1875
1878
|
applyBaseline: boolean;
|
|
1879
|
+
includeUnchangedLines: boolean;
|
|
1876
1880
|
aiStrategy: "smart" | "specialized";
|
|
1877
1881
|
diffReview: {
|
|
1878
1882
|
enabled: boolean;
|
|
@@ -2136,6 +2140,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2136
2140
|
maxInlineComments?: string | number | undefined;
|
|
2137
2141
|
minConfidence?: string | number | undefined;
|
|
2138
2142
|
applyBaseline?: string | boolean | undefined;
|
|
2143
|
+
includeUnchangedLines?: string | boolean | undefined;
|
|
2139
2144
|
aiStrategy?: "smart" | "specialized" | undefined;
|
|
2140
2145
|
diffReview?: {
|
|
2141
2146
|
enabled?: string | boolean | undefined;
|
|
@@ -2399,6 +2404,7 @@ declare const codeReviewConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
2399
2404
|
maxInlineComments: number;
|
|
2400
2405
|
minConfidence: number;
|
|
2401
2406
|
applyBaseline: boolean;
|
|
2407
|
+
includeUnchangedLines: boolean;
|
|
2402
2408
|
aiStrategy: "smart" | "specialized";
|
|
2403
2409
|
diffReview: {
|
|
2404
2410
|
enabled: boolean;
|
package/dist/index.js
CHANGED
|
@@ -59285,6 +59285,8 @@ var init_schema = __esm({
|
|
|
59285
59285
|
minSeverity: severitySchema3.default("info"),
|
|
59286
59286
|
minConfidence: configInt({ min: 0, max: 100, default: 80 }),
|
|
59287
59287
|
applyBaseline: configBool({ default: false }),
|
|
59288
|
+
// Static findings outside the MR's changed lines are dropped by default (report + gate).
|
|
59289
|
+
includeUnchangedLines: configBool({ default: false }),
|
|
59288
59290
|
aiStrategy: prAiStrategySchema.default("smart"),
|
|
59289
59291
|
diffReview: external_exports.object({
|
|
59290
59292
|
enabled: configBool({ default: true }),
|
|
@@ -59425,6 +59427,7 @@ var init_schema = __esm({
|
|
|
59425
59427
|
minSeverity: "info",
|
|
59426
59428
|
minConfidence: 80,
|
|
59427
59429
|
applyBaseline: false,
|
|
59430
|
+
includeUnchangedLines: false,
|
|
59428
59431
|
aiStrategy: "smart",
|
|
59429
59432
|
diffReview: { enabled: true, maxChunkCalls: 8 },
|
|
59430
59433
|
primarySelection: {
|
|
@@ -60364,11 +60367,11 @@ var definedBuildValue = (value, fallback) => typeof value === "string" && value.
|
|
|
60364
60367
|
var getCliBuildMetadata = (version2) => ({
|
|
60365
60368
|
version: version2,
|
|
60366
60369
|
gitSha: definedBuildValue(
|
|
60367
|
-
"
|
|
60370
|
+
"e94c92c37806" ,
|
|
60368
60371
|
"unknown"
|
|
60369
60372
|
),
|
|
60370
60373
|
buildTimestamp: definedBuildValue(
|
|
60371
|
-
"2026-11-
|
|
60374
|
+
"2026-11-27T04:03:27.198Z" ,
|
|
60372
60375
|
"unknown"
|
|
60373
60376
|
),
|
|
60374
60377
|
configSchemaRange: definedBuildValue(
|
|
@@ -67448,8 +67451,17 @@ var dedupePrFindings = (findings2) => {
|
|
|
67448
67451
|
}
|
|
67449
67452
|
return [...byKey.values()];
|
|
67450
67453
|
};
|
|
67451
|
-
var
|
|
67452
|
-
|
|
67454
|
+
var touchesChangedLines = (finding, lineMap) => {
|
|
67455
|
+
const last = Math.max(finding.range.line, finding.range.endLine ?? finding.range.line);
|
|
67456
|
+
for (let line2 = finding.range.line; line2 <= last; line2 += 1) {
|
|
67457
|
+
if (getDiffLinePosition(lineMap, finding.file, line2)) return true;
|
|
67458
|
+
}
|
|
67459
|
+
return false;
|
|
67460
|
+
};
|
|
67461
|
+
var mergePrCandidateFindings = (staticFindings, aiFindings, changedPaths, lineMap, includeUnchangedLines = false) => dedupePrFindings([
|
|
67462
|
+
...staticFindings.filter(
|
|
67463
|
+
(finding) => changedPaths.has(finding.file) && (includeUnchangedLines || touchesChangedLines(finding, lineMap))
|
|
67464
|
+
),
|
|
67453
67465
|
...aiFindings
|
|
67454
67466
|
]);
|
|
67455
67467
|
|
|
@@ -68954,7 +68966,7 @@ var runPrReview = async (options) => {
|
|
|
68954
68966
|
(finding) => changedPaths.has(finding.file)
|
|
68955
68967
|
);
|
|
68956
68968
|
const staticFindings = staticChangedFileFindings.filter(
|
|
68957
|
-
(finding) =>
|
|
68969
|
+
(finding) => touchesChangedLines(finding, lineMap)
|
|
68958
68970
|
);
|
|
68959
68971
|
const supportFiles = await buildSupportFiles(
|
|
68960
68972
|
staticResult.allSourceFiles,
|
|
@@ -69134,7 +69146,13 @@ var runPrReview = async (options) => {
|
|
|
69134
69146
|
}
|
|
69135
69147
|
const enrichFinding = createFindingContextEnricher(staticResult.allSourceFiles);
|
|
69136
69148
|
const mergedFindings = [
|
|
69137
|
-
...mergePrCandidateFindings(
|
|
69149
|
+
...mergePrCandidateFindings(
|
|
69150
|
+
staticResult.run.findings,
|
|
69151
|
+
aiFindings,
|
|
69152
|
+
changedPaths,
|
|
69153
|
+
lineMap,
|
|
69154
|
+
config.prReview.includeUnchangedLines
|
|
69155
|
+
)
|
|
69138
69156
|
].map(enrichFinding).sort(compareFindings);
|
|
69139
69157
|
const classified = classifyPrFindings(mergedFindings, changedPaths, lineMap);
|
|
69140
69158
|
const aiStats = mergePrAiStats(
|