@probelabs/visor 0.1.93 → 0.1.95

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 (50) hide show
  1. package/README.md +4 -4
  2. package/defaults/.visor.yaml +86 -6
  3. package/dist/ai-review-service.d.ts +1 -1
  4. package/dist/ai-review-service.d.ts.map +1 -1
  5. package/dist/check-execution-engine.d.ts +5 -0
  6. package/dist/check-execution-engine.d.ts.map +1 -1
  7. package/dist/cli.d.ts +1 -0
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/commands.d.ts.map +1 -1
  10. package/dist/config.d.ts +9 -2
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/defaults/.visor.yaml +86 -6
  13. package/dist/failure-condition-evaluator.d.ts.map +1 -1
  14. package/dist/footer.d.ts +25 -0
  15. package/dist/footer.d.ts.map +1 -0
  16. package/dist/github-check-service.d.ts.map +1 -1
  17. package/dist/github-comments.d.ts.map +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1074 -472
  20. package/dist/output/code-review/schema.json +0 -23
  21. package/dist/providers/command-check-provider.d.ts.map +1 -1
  22. package/dist/providers/log-check-provider.d.ts.map +1 -1
  23. package/dist/providers/memory-check-provider.d.ts.map +1 -1
  24. package/dist/reviewer.d.ts +11 -0
  25. package/dist/reviewer.d.ts.map +1 -1
  26. package/dist/sdk/{check-execution-engine-RORGGGGP.mjs → check-execution-engine-NMPXJ7FQ.mjs} +2 -2
  27. package/dist/sdk/{chunk-Z47UECAT.mjs → chunk-Q4S5A5TO.mjs} +314 -111
  28. package/dist/sdk/chunk-Q4S5A5TO.mjs.map +1 -0
  29. package/dist/sdk/sdk.d.mts +11 -2
  30. package/dist/sdk/sdk.d.ts +11 -2
  31. package/dist/sdk/sdk.js +398 -152
  32. package/dist/sdk/sdk.js.map +1 -1
  33. package/dist/sdk/sdk.mjs +57 -24
  34. package/dist/sdk/sdk.mjs.map +1 -1
  35. package/dist/sdk.d.ts +11 -2
  36. package/dist/sdk.d.ts.map +1 -1
  37. package/dist/traces/{run-2025-10-15T11-54-04-087Z.ndjson → run-2025-10-18T18-27-25-085Z.ndjson} +8 -1
  38. package/dist/traces/{run-2025-10-15T11-54-14-046Z.ndjson → run-2025-10-18T18-27-35-400Z.ndjson} +8 -1
  39. package/dist/traces/{run-2025-10-15T11-54-14-575Z.ndjson → run-2025-10-18T18-27-35-937Z.ndjson} +8 -1
  40. package/dist/traces/{run-2025-10-15T11-54-15-082Z.ndjson → run-2025-10-18T18-27-36-428Z.ndjson} +8 -1
  41. package/dist/types/cli.d.ts +3 -2
  42. package/dist/types/cli.d.ts.map +1 -1
  43. package/dist/types/config.d.ts +0 -2
  44. package/dist/types/config.d.ts.map +1 -1
  45. package/dist/utils/diff-processor.d.ts +6 -0
  46. package/dist/utils/diff-processor.d.ts.map +1 -0
  47. package/package.json +2 -2
  48. package/dist/sdk/chunk-Z47UECAT.mjs.map +0 -1
  49. /package/dist/sdk/{check-execution-engine-RORGGGGP.mjs.map → check-execution-engine-NMPXJ7FQ.mjs.map} +0 -0
  50. /package/dist/traces/{run-2025-10-15T11-54-15-561Z.ndjson → run-2025-10-18T18-27-36-917Z.ndjson} +0 -0
package/dist/sdk/sdk.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CheckExecutionEngine
3
- } from "./chunk-Z47UECAT.mjs";
3
+ } from "./chunk-Q4S5A5TO.mjs";
4
4
  import "./chunk-KVHVCGY6.mjs";
5
5
  import {
6
6
  init_logger,
@@ -1417,6 +1417,16 @@ var ConfigLoader = class {
1417
1417
  // src/config.ts
1418
1418
  import Ajv from "ajv";
1419
1419
  import addFormats from "ajv-formats";
1420
+ var VALID_EVENT_TRIGGERS = [
1421
+ "pr_opened",
1422
+ "pr_updated",
1423
+ "pr_closed",
1424
+ "issue_opened",
1425
+ "issue_comment",
1426
+ "manual",
1427
+ "schedule",
1428
+ "webhook_received"
1429
+ ];
1420
1430
  var ConfigManager = class {
1421
1431
  validCheckTypes = [
1422
1432
  "ai",
@@ -1425,20 +1435,13 @@ var ConfigManager = class {
1425
1435
  "http",
1426
1436
  "http_input",
1427
1437
  "http_client",
1438
+ "memory",
1428
1439
  "noop",
1429
1440
  "log",
1441
+ "memory",
1430
1442
  "github"
1431
1443
  ];
1432
- validEventTriggers = [
1433
- "pr_opened",
1434
- "pr_updated",
1435
- "pr_closed",
1436
- "issue_opened",
1437
- "issue_comment",
1438
- "manual",
1439
- "schedule",
1440
- "webhook_received"
1441
- ];
1444
+ validEventTriggers = [...VALID_EVENT_TRIGGERS];
1442
1445
  validOutputFormats = ["table", "json", "markdown", "sarif"];
1443
1446
  validGroupByOptions = ["check", "file", "severity", "group"];
1444
1447
  /**
@@ -1446,24 +1449,25 @@ var ConfigManager = class {
1446
1449
  */
1447
1450
  async loadConfig(configPath, options = {}) {
1448
1451
  const { validate = true, mergeDefaults = true, allowedRemotePatterns } = options;
1452
+ const resolvedPath = path2.isAbsolute(configPath) ? configPath : path2.resolve(process.cwd(), configPath);
1449
1453
  try {
1450
- if (!fs2.existsSync(configPath)) {
1451
- throw new Error(`Configuration file not found: ${configPath}`);
1454
+ if (!fs2.existsSync(resolvedPath)) {
1455
+ throw new Error(`Configuration file not found: ${resolvedPath}`);
1452
1456
  }
1453
- const configContent = fs2.readFileSync(configPath, "utf8");
1457
+ const configContent = fs2.readFileSync(resolvedPath, "utf8");
1454
1458
  let parsedConfig;
1455
1459
  try {
1456
1460
  parsedConfig = yaml2.load(configContent);
1457
1461
  } catch (yamlError) {
1458
1462
  const errorMessage = yamlError instanceof Error ? yamlError.message : String(yamlError);
1459
- throw new Error(`Invalid YAML syntax in ${configPath}: ${errorMessage}`);
1463
+ throw new Error(`Invalid YAML syntax in ${resolvedPath}: ${errorMessage}`);
1460
1464
  }
1461
1465
  if (!parsedConfig || typeof parsedConfig !== "object") {
1462
1466
  throw new Error("Configuration file must contain a valid YAML object");
1463
1467
  }
1464
1468
  if (parsedConfig.extends) {
1465
1469
  const loaderOptions = {
1466
- baseDir: path2.dirname(configPath),
1470
+ baseDir: path2.dirname(resolvedPath),
1467
1471
  allowRemote: this.isRemoteExtendsAllowed(),
1468
1472
  maxDepth: 10,
1469
1473
  allowedRemotePatterns
@@ -1495,12 +1499,12 @@ var ConfigManager = class {
1495
1499
  throw error;
1496
1500
  }
1497
1501
  if (error.message.includes("ENOENT")) {
1498
- throw new Error(`Configuration file not found: ${configPath}`);
1502
+ throw new Error(`Configuration file not found: ${resolvedPath}`);
1499
1503
  }
1500
1504
  if (error.message.includes("EPERM")) {
1501
- throw new Error(`Permission denied reading configuration file: ${configPath}`);
1505
+ throw new Error(`Permission denied reading configuration file: ${resolvedPath}`);
1502
1506
  }
1503
- throw new Error(`Failed to read configuration file ${configPath}: ${error.message}`);
1507
+ throw new Error(`Failed to read configuration file ${resolvedPath}: ${error.message}`);
1504
1508
  }
1505
1509
  throw error;
1506
1510
  }
@@ -1667,8 +1671,10 @@ var ConfigManager = class {
1667
1671
  }
1668
1672
  /**
1669
1673
  * Validate configuration against schema
1674
+ * @param config The config to validate
1675
+ * @param strict If true, treat warnings as errors (default: false)
1670
1676
  */
1671
- validateConfig(config) {
1677
+ validateConfig(config, strict = false) {
1672
1678
  const errors = [];
1673
1679
  const warnings = [];
1674
1680
  this.validateWithAjvSchema(config, errors, warnings);
@@ -1776,10 +1782,13 @@ var ConfigManager = class {
1776
1782
  if (config.tag_filter) {
1777
1783
  this.validateTagFilter(config.tag_filter, errors);
1778
1784
  }
1785
+ if (strict && warnings.length > 0) {
1786
+ errors.push(...warnings);
1787
+ }
1779
1788
  if (errors.length > 0) {
1780
1789
  throw new Error(errors[0].message);
1781
1790
  }
1782
- if (warnings.length > 0) {
1791
+ if (!strict && warnings.length > 0) {
1783
1792
  for (const w of warnings) {
1784
1793
  logger.warn(`\u26A0\uFE0F Config warning [${w.field}]: ${w.message}`);
1785
1794
  }
@@ -2235,9 +2244,25 @@ var __ajvValidate = null;
2235
2244
  var __ajvErrors = null;
2236
2245
 
2237
2246
  // src/sdk.ts
2238
- async function loadConfig(configPath) {
2247
+ async function loadConfig(configOrPath, options) {
2239
2248
  const cm = new ConfigManager();
2240
- if (configPath) return cm.loadConfig(configPath);
2249
+ if (typeof configOrPath === "object" && configOrPath !== null) {
2250
+ cm.validateConfig(configOrPath, options?.strict ?? false);
2251
+ const defaultConfig = {
2252
+ version: "1.0",
2253
+ checks: {},
2254
+ max_parallelism: 3,
2255
+ fail_fast: false
2256
+ };
2257
+ return {
2258
+ ...defaultConfig,
2259
+ ...configOrPath,
2260
+ checks: configOrPath.checks || {}
2261
+ };
2262
+ }
2263
+ if (typeof configOrPath === "string") {
2264
+ return cm.loadConfig(configOrPath);
2265
+ }
2241
2266
  return cm.findAndLoadConfig();
2242
2267
  }
2243
2268
  function resolveChecks(checkIds, config) {
@@ -2263,7 +2288,15 @@ function resolveChecks(checkIds, config) {
2263
2288
  }
2264
2289
  async function runChecks(opts = {}) {
2265
2290
  const cm = new ConfigManager();
2266
- const config = opts.config ? opts.config : opts.configPath ? await cm.loadConfig(opts.configPath) : await cm.findAndLoadConfig();
2291
+ let config;
2292
+ if (opts.config) {
2293
+ cm.validateConfig(opts.config, opts.strictValidation ?? false);
2294
+ config = opts.config;
2295
+ } else if (opts.configPath) {
2296
+ config = await cm.loadConfig(opts.configPath);
2297
+ } else {
2298
+ config = await cm.findAndLoadConfig();
2299
+ }
2267
2300
  const checks = opts.checks && opts.checks.length > 0 ? resolveChecks(opts.checks, config) : Object.keys(config.checks || {});
2268
2301
  const engine = new CheckExecutionEngine(opts.cwd);
2269
2302
  const result = await engine.executeChecks({