ira-review 3.1.7 → 3.1.9
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/cli.js +9 -14
- package/dist/index.cjs +9 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -14
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -269,9 +269,9 @@ var REVIEW_CHECKLIST = `
|
|
|
269
269
|
`;
|
|
270
270
|
var REVIEW_CATEGORIES = "security, business-logic, race-condition, data-consistency, async, error-handling, defensive, best-practice";
|
|
271
271
|
var TEAM_RULES_PRECEDENCE = `
|
|
272
|
-
**PRECEDENCE \u2014 Team Rules vs general checklist guidance.** When a Team Rule in the Team Rules section above
|
|
272
|
+
**PRECEDENCE \u2014 Team Rules vs general checklist guidance.** When a Team Rule in the Team Rules section above semantically matches the code in the diff \u2014 i.e. the rule's \`description\` (or optional \`bad:\` example) clearly describes the pattern you see in the changed lines \u2014 the Team Rule WINS over any "Do NOT report" / "Skip" clause in checklist sections 1\u20136, and over the general "style-only" / "when in doubt, do not report" framing in the Rules section. Report the violation, label it under Team Standards, and use the Team Rule's stated severity. You do NOT need a literal \`bad:\` snippet \u2014 a clear, specific description is sufficient (e.g. "do not commit console.log statements" applies to any \`console.log(...)\` in the changed lines).
|
|
273
273
|
|
|
274
|
-
**Exception \u2014 checklist Section 7 (Defensive Coding) is NOT overridden.** A Team Rule that loosely mentions "type safety", "best practices", "defensive coding", or similar broad concepts does NOT authorise reporting null/undefined check suggestions on values the type system, framework, or stdlib already guarantees.
|
|
274
|
+
**Exception \u2014 checklist Section 7 (Defensive Coding) is NOT overridden by vague rules.** A Team Rule that only loosely mentions "type safety", "best practices", "defensive coding", or similar broad concepts does NOT authorise reporting null/undefined check suggestions on values the type system, framework, or stdlib already guarantees. To override Section 7 the rule must EITHER provide a specific \`bad:\` example matching the diff, OR have a description that names the exact defensive pattern required (e.g. "always null-check API response \`data\` before access").
|
|
275
275
|
`;
|
|
276
276
|
function buildStandalonePrompt(filePath, diff, framework, sourceFile, teamRulesSection, sensitiveAreaContext) {
|
|
277
277
|
const frameworkContext = framework ? `The codebase uses **${framework}**. Tailor your review to ${framework} best practices.` : "";
|
|
@@ -519,6 +519,7 @@ function annotateDiffWithLineNumbers(diff) {
|
|
|
519
519
|
// src/utils/rulesFile.ts
|
|
520
520
|
import { readFileSync as readFileSync4, existsSync as existsSync6 } from "fs";
|
|
521
521
|
import { resolve } from "path";
|
|
522
|
+
import picomatch from "picomatch";
|
|
522
523
|
var VALID_SEVERITIES = ["BLOCKER", "CRITICAL", "MAJOR", "MINOR"];
|
|
523
524
|
var RULES_SOFT_WARN_THRESHOLD = 500;
|
|
524
525
|
function loadRawRulesFile(cwd) {
|
|
@@ -652,20 +653,14 @@ function filterRulesByPath(rules, filePath) {
|
|
|
652
653
|
return rule.paths.some((pattern) => matchPattern(pattern, filePath));
|
|
653
654
|
});
|
|
654
655
|
}
|
|
656
|
+
var matcherCache = /* @__PURE__ */ new Map();
|
|
655
657
|
function matchPattern(pattern, filePath) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
return filePath.endsWith(ext);
|
|
661
|
-
}
|
|
662
|
-
return filePath.endsWith("/" + suffix) || filePath === suffix;
|
|
663
|
-
}
|
|
664
|
-
if (pattern.endsWith("/**")) {
|
|
665
|
-
const prefix = pattern.slice(0, -3);
|
|
666
|
-
return filePath.startsWith(prefix + "/") || filePath === prefix;
|
|
658
|
+
let isMatch = matcherCache.get(pattern);
|
|
659
|
+
if (!isMatch) {
|
|
660
|
+
isMatch = picomatch(pattern, { dot: true });
|
|
661
|
+
matcherCache.set(pattern, isMatch);
|
|
667
662
|
}
|
|
668
|
-
return filePath
|
|
663
|
+
return isMatch(filePath);
|
|
669
664
|
}
|
|
670
665
|
function loadSensitiveAreas(cwd) {
|
|
671
666
|
const parsed = loadRawRulesFile(cwd);
|
package/dist/index.cjs
CHANGED
|
@@ -461,9 +461,9 @@ var REVIEW_CHECKLIST = `
|
|
|
461
461
|
`;
|
|
462
462
|
var REVIEW_CATEGORIES = "security, business-logic, race-condition, data-consistency, async, error-handling, defensive, best-practice";
|
|
463
463
|
var TEAM_RULES_PRECEDENCE = `
|
|
464
|
-
**PRECEDENCE \u2014 Team Rules vs general checklist guidance.** When a Team Rule in the Team Rules section above
|
|
464
|
+
**PRECEDENCE \u2014 Team Rules vs general checklist guidance.** When a Team Rule in the Team Rules section above semantically matches the code in the diff \u2014 i.e. the rule's \`description\` (or optional \`bad:\` example) clearly describes the pattern you see in the changed lines \u2014 the Team Rule WINS over any "Do NOT report" / "Skip" clause in checklist sections 1\u20136, and over the general "style-only" / "when in doubt, do not report" framing in the Rules section. Report the violation, label it under Team Standards, and use the Team Rule's stated severity. You do NOT need a literal \`bad:\` snippet \u2014 a clear, specific description is sufficient (e.g. "do not commit console.log statements" applies to any \`console.log(...)\` in the changed lines).
|
|
465
465
|
|
|
466
|
-
**Exception \u2014 checklist Section 7 (Defensive Coding) is NOT overridden.** A Team Rule that loosely mentions "type safety", "best practices", "defensive coding", or similar broad concepts does NOT authorise reporting null/undefined check suggestions on values the type system, framework, or stdlib already guarantees.
|
|
466
|
+
**Exception \u2014 checklist Section 7 (Defensive Coding) is NOT overridden by vague rules.** A Team Rule that only loosely mentions "type safety", "best practices", "defensive coding", or similar broad concepts does NOT authorise reporting null/undefined check suggestions on values the type system, framework, or stdlib already guarantees. To override Section 7 the rule must EITHER provide a specific \`bad:\` example matching the diff, OR have a description that names the exact defensive pattern required (e.g. "always null-check API response \`data\` before access").
|
|
467
467
|
`;
|
|
468
468
|
function buildStandalonePrompt(filePath, diff, framework, sourceFile, teamRulesSection, sensitiveAreaContext) {
|
|
469
469
|
const frameworkContext = framework ? `The codebase uses **${framework}**. Tailor your review to ${framework} best practices.` : "";
|
|
@@ -757,6 +757,7 @@ function annotateDiffWithLineNumbers(diff) {
|
|
|
757
757
|
// src/utils/rulesFile.ts
|
|
758
758
|
var import_node_fs6 = require("fs");
|
|
759
759
|
var import_node_path6 = require("path");
|
|
760
|
+
var import_picomatch = __toESM(require("picomatch"), 1);
|
|
760
761
|
var VALID_SEVERITIES = ["BLOCKER", "CRITICAL", "MAJOR", "MINOR"];
|
|
761
762
|
var RULES_SOFT_WARN_THRESHOLD = 500;
|
|
762
763
|
function loadRawRulesFile(cwd) {
|
|
@@ -890,20 +891,14 @@ function filterRulesByPath(rules, filePath) {
|
|
|
890
891
|
return rule.paths.some((pattern) => matchPattern(pattern, filePath));
|
|
891
892
|
});
|
|
892
893
|
}
|
|
894
|
+
var matcherCache = /* @__PURE__ */ new Map();
|
|
893
895
|
function matchPattern(pattern, filePath) {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
return filePath.endsWith(ext);
|
|
899
|
-
}
|
|
900
|
-
return filePath.endsWith("/" + suffix) || filePath === suffix;
|
|
901
|
-
}
|
|
902
|
-
if (pattern.endsWith("/**")) {
|
|
903
|
-
const prefix = pattern.slice(0, -3);
|
|
904
|
-
return filePath.startsWith(prefix + "/") || filePath === prefix;
|
|
896
|
+
let isMatch = matcherCache.get(pattern);
|
|
897
|
+
if (!isMatch) {
|
|
898
|
+
isMatch = (0, import_picomatch.default)(pattern, { dot: true });
|
|
899
|
+
matcherCache.set(pattern, isMatch);
|
|
905
900
|
}
|
|
906
|
-
return filePath
|
|
901
|
+
return isMatch(filePath);
|
|
907
902
|
}
|
|
908
903
|
function loadSensitiveAreas(cwd) {
|
|
909
904
|
const parsed = loadRawRulesFile(cwd);
|