@codacy/gate-cli 0.10.0 → 0.11.0

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.
Files changed (2) hide show
  1. package/bin/gate.js +25 -10
  2. package/package.json +1 -1
package/bin/gate.js CHANGED
@@ -11926,7 +11926,7 @@ function computeDiff(oldContent, newContent, filePath) {
11926
11926
  (0, import_node_fs8.writeFileSync)(tmpOld, oldContent);
11927
11927
  (0, import_node_fs8.writeFileSync)(tmpNew, newContent);
11928
11928
  const result = (0, import_node_child_process7.execSync)(
11929
- `git diff --no-index --unified=3 -- "${tmpOld}" "${tmpNew}"`,
11929
+ `git diff --no-index --unified=10 -- "${tmpOld}" "${tmpNew}"`,
11930
11930
  { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
11931
11931
  );
11932
11932
  return result || null;
@@ -12047,11 +12047,8 @@ function isGitOnlyPrompt(prompt) {
12047
12047
  return true;
12048
12048
  }
12049
12049
  function detectAnalysisMode(noFilesChanged, assistantResponse, conversationPrompts) {
12050
- if (conversationPrompts.length > 0) {
12051
- const latestPrompt = conversationPrompts[conversationPrompts.length - 1];
12052
- if (isGitOnlyPrompt(latestPrompt)) {
12053
- return "skip";
12054
- }
12050
+ if (conversationPrompts.length > 0 && conversationPrompts.every(isGitOnlyPrompt)) {
12051
+ return "skip";
12055
12052
  }
12056
12053
  if (noFilesChanged && !!assistantResponse) {
12057
12054
  return "plan";
@@ -12309,11 +12306,13 @@ async function runAnalyze(opts, globals) {
12309
12306
 
12310
12307
  `);
12311
12308
  }
12312
- if (findings.length > 0) {
12313
- process.stderr.write(`${BOLD}Found ${findings.length} issues. Fix the critical and high severity ones:${NC}
12309
+ const agentFindings = findings.filter((f) => f.scope !== "pre-existing");
12310
+ const preExistingFindings = findings.filter((f) => f.scope === "pre-existing");
12311
+ if (agentFindings.length > 0) {
12312
+ process.stderr.write(`${BOLD}Found ${agentFindings.length} issues in your changes. Fix the critical and high severity ones:${NC}
12314
12313
 
12315
12314
  `);
12316
- for (const f of findings) {
12315
+ for (const f of agentFindings) {
12317
12316
  const severity = (f.severity ?? "").toUpperCase();
12318
12317
  const title = f.title ?? "";
12319
12318
  const file = f.file ?? "";
@@ -12334,6 +12333,22 @@ async function runAnalyze(opts, globals) {
12334
12333
  process.stderr.write("\n");
12335
12334
  }
12336
12335
  }
12336
+ if (preExistingFindings.length > 0) {
12337
+ process.stderr.write(`${DIM}\u2501\u2501\u2501 Pre-existing issues (not caused by your changes, informational only) \u2501\u2501\u2501${NC}
12338
+
12339
+ `);
12340
+ for (const f of preExistingFindings) {
12341
+ const severity = (f.severity ?? "").toUpperCase();
12342
+ const title = f.title ?? "";
12343
+ const file = f.file ?? "";
12344
+ const line = f.line ?? "";
12345
+ process.stderr.write(`${DIM}[${severity}] ${title}
12346
+ `);
12347
+ process.stderr.write(` File: ${file}:${line}${NC}
12348
+
12349
+ `);
12350
+ }
12351
+ }
12337
12352
  if (viewUrl) {
12338
12353
  process.stderr.write(`${CYAN}View full report: ${viewUrl}${NC}
12339
12354
 
@@ -12619,7 +12634,7 @@ function registerInitCommand(program2) {
12619
12634
  }
12620
12635
 
12621
12636
  // src/cli.ts
12622
- program.name("gate").description("CLI for GATE.md quality gate service").version("0.10.0").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
12637
+ program.name("gate").description("CLI for GATE.md quality gate service").version("0.11.0").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
12623
12638
  registerAuthCommands(program);
12624
12639
  registerHooksCommands(program);
12625
12640
  registerIntentCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/gate-cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "CLI for GATE.md quality gate service",
5
5
  "bin": {
6
6
  "gate": "./bin/gate.js"