@kakarot-ci/core 0.6.5 → 0.7.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/dist/cli/index.js CHANGED
@@ -69,8 +69,6 @@ var GitHubClient = class {
69
69
  this.retryDelay = 1e3;
70
70
  this.owner = options.owner;
71
71
  this.repo = options.repo;
72
- const originalConsoleError = console.error;
73
- const originalConsoleWarn = console.warn;
74
72
  this.octokit = new Octokit({
75
73
  auth: options.token,
76
74
  request: {
@@ -78,8 +76,6 @@ var GitHubClient = class {
78
76
  retryAfter: this.retryDelay / 1e3
79
77
  }
80
78
  });
81
- console.error = originalConsoleError;
82
- console.warn = originalConsoleWarn;
83
79
  }
84
80
  /**
85
81
  * Retry wrapper with exponential backoff
@@ -280,21 +276,23 @@ var GitHubClient = class {
280
276
  async fileExists(ref, path) {
281
277
  const originalError = console.error;
282
278
  const originalWarn = console.warn;
283
- const suppressedError = (...args) => {
284
- const message = args.join(" ");
285
- if (!message.includes("404") && !message.includes("Not Found")) {
286
- originalError(...args);
279
+ const suppress404 = (...args) => {
280
+ const message = String(args[0] || "");
281
+ if (message.includes("404") || message.includes("Not Found")) {
282
+ return;
287
283
  }
284
+ originalError(...args);
288
285
  };
289
- const suppressedWarn = (...args) => {
290
- const message = args.join(" ");
291
- if (!message.includes("404") && !message.includes("Not Found")) {
292
- originalWarn(...args);
286
+ const suppress404Warn = (...args) => {
287
+ const message = String(args[0] || "");
288
+ if (message.includes("404") || message.includes("Not Found")) {
289
+ return;
293
290
  }
291
+ originalWarn(...args);
294
292
  };
295
293
  try {
296
- console.error = suppressedError;
297
- console.warn = suppressedWarn;
294
+ console.error = suppress404;
295
+ console.warn = suppress404Warn;
298
296
  await this.octokit.rest.repos.getContent({
299
297
  owner: this.owner,
300
298
  repo: this.repo,
@@ -358,6 +356,7 @@ var KakarotConfigSchema = z.object({
358
356
  enableAutoCommit: z.boolean().default(true),
359
357
  commitStrategy: z.enum(["direct", "branch-pr"]).default("direct"),
360
358
  enablePRComments: z.boolean().default(true),
359
+ enableCoverage: z.boolean().default(false),
361
360
  debug: z.boolean().default(false)
362
361
  });
363
362
 
@@ -1946,7 +1945,7 @@ async function runPullRequest(context) {
1946
1945
  })),
1947
1946
  errors
1948
1947
  };
1949
- if (testFiles.size > 0) {
1948
+ if (config.enableCoverage && testFiles.size > 0) {
1950
1949
  const testRunner = createTestRunner(framework);
1951
1950
  const writtenPaths = Array.from(testFiles.keys());
1952
1951
  try {
@@ -1964,13 +1963,12 @@ async function runPullRequest(context) {
1964
1963
  summary.coverageReport = coverageReport;
1965
1964
  summary.testResults = finalTestResults;
1966
1965
  } else {
1967
- warn("Could not read coverage report");
1966
+ warn("Could not read coverage report (coverage package may be missing)");
1968
1967
  }
1969
1968
  } catch (err) {
1970
1969
  const errorMessage = err instanceof Error ? err.message : String(err);
1971
1970
  if (errorMessage.includes("coverage") || errorMessage.includes("MISSING DEPENDENCY")) {
1972
- warn(`Coverage collection failed (likely missing coverage package): ${errorMessage}`);
1973
- warn("Continuing without coverage report");
1971
+ warn(`Coverage collection failed (coverage package may be missing): ${errorMessage.split("\n")[0]}`);
1974
1972
  } else {
1975
1973
  throw err;
1976
1974
  }
@@ -2067,7 +2065,8 @@ async function commitTests(githubClient, pr, testFiles, config, summary) {
2067
2065
  info(`Committing ${testFiles.length} test file(s)`);
2068
2066
  try {
2069
2067
  if (config.commitStrategy === "branch-pr") {
2070
- const branchName = `kakarot-ci/tests-pr-${pr.number}`;
2068
+ const timestamp = Date.now();
2069
+ const branchName = `kakarot-ci/tests-pr-${pr.number}-${timestamp}`;
2071
2070
  const baseSha = await githubClient.createBranch(branchName, pr.head.ref);
2072
2071
  await githubClient.commitFiles({
2073
2072
  files: testFiles.map((file) => ({