@codacy/gate-cli 0.10.1 → 0.12.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @codacy/gate-cli
2
2
 
3
- CLI for [GATE.md](https://gatemd.lovable.app) — the quality gate for AI-generated code.
3
+ CLI for [GATE.md](https://gate.codacy.com) — the quality gate for AI-generated code.
4
4
 
5
5
  ## Install
6
6
 
package/bin/gate.js CHANGED
@@ -11848,28 +11848,35 @@ function findMdFiles(dir, maxDepth, depth = 0) {
11848
11848
  return result;
11849
11849
  }
11850
11850
  function discoverPlans() {
11851
- const plansDir = ".claude/plans";
11852
- if (!(0, import_node_fs7.existsSync)(plansDir)) return [];
11853
- const result = [];
11854
- try {
11855
- const entries = (0, import_node_fs7.readdirSync)(plansDir).filter((f) => f.endsWith(".md")).map((f) => {
11856
- const fullPath = (0, import_node_path6.join)(plansDir, f);
11857
- try {
11858
- const stat = (0, import_node_fs7.statSync)(fullPath);
11859
- return { name: f, path: fullPath, mtime: stat.mtimeMs, size: stat.size };
11860
- } catch {
11861
- return null;
11862
- }
11863
- }).filter((x) => x !== null).sort((a, b) => b.mtime - a.mtime).slice(0, MAX_PLAN_FILES);
11864
- for (const entry of entries) {
11865
- if (entry.size > MAX_PLAN_FILE_BYTES) continue;
11866
- try {
11867
- const content = (0, import_node_fs7.readFileSync)(entry.path, "utf-8");
11868
- result.push({ name: entry.name, content });
11869
- } catch {
11851
+ const homePlansDir = (0, import_node_path6.join)(process.env.HOME ?? "", ".claude", "plans");
11852
+ const localPlansDir = ".claude/plans";
11853
+ const candidates = [];
11854
+ const seen = /* @__PURE__ */ new Set();
11855
+ for (const plansDir of [localPlansDir, homePlansDir]) {
11856
+ if (!(0, import_node_fs7.existsSync)(plansDir)) continue;
11857
+ try {
11858
+ for (const f of (0, import_node_fs7.readdirSync)(plansDir)) {
11859
+ if (!f.endsWith(".md") || seen.has(f)) continue;
11860
+ seen.add(f);
11861
+ const fullPath = (0, import_node_path6.join)(plansDir, f);
11862
+ try {
11863
+ const stat = (0, import_node_fs7.statSync)(fullPath);
11864
+ candidates.push({ name: f, path: fullPath, mtime: stat.mtimeMs, size: stat.size });
11865
+ } catch {
11866
+ }
11870
11867
  }
11868
+ } catch {
11869
+ }
11870
+ }
11871
+ candidates.sort((a, b) => b.mtime - a.mtime);
11872
+ const result = [];
11873
+ for (const entry of candidates.slice(0, MAX_PLAN_FILES)) {
11874
+ if (entry.size > MAX_PLAN_FILE_BYTES) continue;
11875
+ try {
11876
+ const content = (0, import_node_fs7.readFileSync)(entry.path, "utf-8");
11877
+ result.push({ name: entry.name, content });
11878
+ } catch {
11871
11879
  }
11872
- } catch {
11873
11880
  }
11874
11881
  return result;
11875
11882
  }
@@ -12306,11 +12313,13 @@ async function runAnalyze(opts, globals) {
12306
12313
 
12307
12314
  `);
12308
12315
  }
12309
- if (findings.length > 0) {
12310
- process.stderr.write(`${BOLD}Found ${findings.length} issues. Fix the critical and high severity ones:${NC}
12316
+ const agentFindings = findings.filter((f) => f.scope !== "pre-existing");
12317
+ const preExistingFindings = findings.filter((f) => f.scope === "pre-existing");
12318
+ if (agentFindings.length > 0) {
12319
+ process.stderr.write(`${BOLD}Found ${agentFindings.length} issues in your changes. Fix the critical and high severity ones:${NC}
12311
12320
 
12312
12321
  `);
12313
- for (const f of findings) {
12322
+ for (const f of agentFindings) {
12314
12323
  const severity = (f.severity ?? "").toUpperCase();
12315
12324
  const title = f.title ?? "";
12316
12325
  const file = f.file ?? "";
@@ -12331,6 +12340,22 @@ async function runAnalyze(opts, globals) {
12331
12340
  process.stderr.write("\n");
12332
12341
  }
12333
12342
  }
12343
+ if (preExistingFindings.length > 0) {
12344
+ process.stderr.write(`${DIM}\u2501\u2501\u2501 Pre-existing issues (not caused by your changes, informational only) \u2501\u2501\u2501${NC}
12345
+
12346
+ `);
12347
+ for (const f of preExistingFindings) {
12348
+ const severity = (f.severity ?? "").toUpperCase();
12349
+ const title = f.title ?? "";
12350
+ const file = f.file ?? "";
12351
+ const line = f.line ?? "";
12352
+ process.stderr.write(`${DIM}[${severity}] ${title}
12353
+ `);
12354
+ process.stderr.write(` File: ${file}:${line}${NC}
12355
+
12356
+ `);
12357
+ }
12358
+ }
12334
12359
  if (viewUrl) {
12335
12360
  process.stderr.write(`${CYAN}View full report: ${viewUrl}${NC}
12336
12361
 
@@ -12616,7 +12641,7 @@ function registerInitCommand(program2) {
12616
12641
  }
12617
12642
 
12618
12643
  // src/cli.ts
12619
- program.name("gate").description("CLI for GATE.md quality gate service").version("0.10.1").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
12644
+ program.name("gate").description("CLI for GATE.md quality gate service").version("0.12.0").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
12620
12645
  registerAuthCommands(program);
12621
12646
  registerHooksCommands(program);
12622
12647
  registerIntentCommands(program);
@@ -193,7 +193,7 @@ Test Adequacy: 5.0/10 — missing webhook handler tests
193
193
  1. [HIGH] Add tests for webhook event handlers
194
194
  2. [MEDIUM] Refactor webhook into handler modules
195
195
 
196
- View full report: https://gatemd.lovable.app/runs/run-20260327-...?token=gateview_...
196
+ View full report: https://gate.codacy.com/runs/run-20260327-...?token=gateview_...
197
197
  ```
198
198
 
199
199
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/gate-cli",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "CLI for GATE.md quality gate service",
5
5
  "bin": {
6
6
  "gate": "./bin/gate.js"