@probelabs/visor 0.1.78 → 0.1.80

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.
@@ -20,8 +20,14 @@ export declare class CommandCheckProvider extends CheckProvider {
20
20
  * - If it's a JSON string, expose parsed properties via Proxy (e.g., value.key)
21
21
  * - When coerced to string (toString/valueOf/Symbol.toPrimitive), return the original raw string
22
22
  * - If parsing fails or value is not a string, return the value unchanged
23
+ * - Attempts to extract JSON from the end of the output if full parse fails
23
24
  */
24
25
  private makeJsonSmart;
26
+ /**
27
+ * Extract JSON from the end of a string that may contain logs/debug output
28
+ * Looks for the last occurrence of { or [ and tries to parse from there
29
+ */
30
+ private extractJsonFromEnd;
25
31
  /**
26
32
  * Recursively apply JSON-smart wrapper to outputs object values
27
33
  */
@@ -1 +1 @@
1
- {"version":3,"file":"command-check-provider.d.ts","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/providers/command-check-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAe,MAAM,aAAa,CAAC;AAMzD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAC,CAAU;;IAY1B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,IAAI,MAAM;IAIjB,cAAc,IAAI,MAAM;IAIlB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAejD,OAAO,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAC7C,OAAO,CAAC,aAAa,CAAC;IA2TzB,OAAO,CAAC,kBAAkB;IAkB1B;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IA+DrB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,2BAA2B;IAgBnC,sBAAsB,IAAI,MAAM,EAAE;IAgB5B,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAKrC,eAAe,IAAI,MAAM,EAAE;IAQ3B,OAAO,CAAC,uBAAuB;IAkD/B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,cAAc;IAmEtB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,QAAQ;YAWF,qBAAqB;IAiBnC,OAAO,CAAC,uBAAuB;CA6ChC"}
1
+ {"version":3,"file":"command-check-provider.d.ts","sourceRoot":"","sources":["file:///home/runner/work/visor/visor/src/providers/command-check-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAe,MAAM,aAAa,CAAC;AAMzD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IACrD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAC,CAAU;;IAY1B,OAAO,CAAC,mBAAmB;IAW3B,OAAO,IAAI,MAAM;IAIjB,cAAc,IAAI,MAAM;IAIlB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAejD,OAAO,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,EAC3B,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAC7C,OAAO,CAAC,aAAa,CAAC;IAyUzB,OAAO,CAAC,kBAAkB;IAkB1B;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;IAgFrB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAyB1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,2BAA2B;IAgBnC,sBAAsB,IAAI,MAAM,EAAE;IAgB5B,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAKrC,eAAe,IAAI,MAAM,EAAE;IAQ3B,OAAO,CAAC,uBAAuB;IAkD/B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,cAAc;IAmEtB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,QAAQ;YAWF,qBAAqB;IAiBnC,OAAO,CAAC,uBAAuB;CA6ChC"}
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  CheckExecutionEngine
3
- } from "./chunk-HDGNSOMS.mjs";
3
+ } from "./chunk-GNA5GPF7.mjs";
4
4
  import "./chunk-FIL2OGF6.mjs";
5
5
  import "./chunk-WMJKH4XE.mjs";
6
6
  export {
7
7
  CheckExecutionEngine
8
8
  };
9
- //# sourceMappingURL=check-execution-engine-XBKOCBEK.mjs.map
9
+ //# sourceMappingURL=check-execution-engine-2EQWRXWI.mjs.map
@@ -1493,7 +1493,7 @@ var PRReviewer = class {
1493
1493
  async reviewPR(owner, repo, prNumber, prInfo, options = {}) {
1494
1494
  const { debug = false, config, checks } = options;
1495
1495
  if (config && checks && checks.length > 0) {
1496
- const { CheckExecutionEngine: CheckExecutionEngine2 } = await import("./check-execution-engine-XBKOCBEK.mjs");
1496
+ const { CheckExecutionEngine: CheckExecutionEngine2 } = await import("./check-execution-engine-2EQWRXWI.mjs");
1497
1497
  const engine = new CheckExecutionEngine2();
1498
1498
  const { results } = await engine.executeGroupedChecks(
1499
1499
  prInfo,
@@ -3953,7 +3953,19 @@ var CommandCheckProvider = class extends CheckProvider {
3953
3953
  const parsed = JSON.parse(rawOutput);
3954
3954
  output = parsed;
3955
3955
  } catch {
3956
- output = rawOutput;
3956
+ const extracted2 = this.extractJsonFromEnd(rawOutput);
3957
+ if (extracted2) {
3958
+ try {
3959
+ output = JSON.parse(extracted2);
3960
+ logger.debug(
3961
+ `\u{1F527} Debug: Extracted and parsed JSON from end of output (${extracted2.length} chars from ${rawOutput.length} total)`
3962
+ );
3963
+ } catch {
3964
+ output = rawOutput;
3965
+ }
3966
+ } else {
3967
+ output = rawOutput;
3968
+ }
3957
3969
  }
3958
3970
  let finalOutput = output;
3959
3971
  if (transform) {
@@ -4172,6 +4184,7 @@ ${stderrOutput}` : `Command execution failed: ${errorMessage}`;
4172
4184
  * - If it's a JSON string, expose parsed properties via Proxy (e.g., value.key)
4173
4185
  * - When coerced to string (toString/valueOf/Symbol.toPrimitive), return the original raw string
4174
4186
  * - If parsing fails or value is not a string, return the value unchanged
4187
+ * - Attempts to extract JSON from the end of the output if full parse fails
4175
4188
  */
4176
4189
  makeJsonSmart(value) {
4177
4190
  if (typeof value !== "string") {
@@ -4182,7 +4195,19 @@ ${stderrOutput}` : `Command execution failed: ${errorMessage}`;
4182
4195
  try {
4183
4196
  parsed = JSON.parse(raw);
4184
4197
  } catch {
4185
- return raw;
4198
+ const jsonMatch = this.extractJsonFromEnd(raw);
4199
+ if (jsonMatch) {
4200
+ try {
4201
+ parsed = JSON.parse(jsonMatch);
4202
+ logger.debug(
4203
+ `\u{1F527} Debug: Extracted JSON from end of output (${jsonMatch.length} chars from ${raw.length} total)`
4204
+ );
4205
+ } catch {
4206
+ return raw;
4207
+ }
4208
+ } else {
4209
+ return raw;
4210
+ }
4186
4211
  }
4187
4212
  const boxed = new String(raw);
4188
4213
  const handler = {
@@ -4231,6 +4256,24 @@ ${stderrOutput}` : `Command execution failed: ${errorMessage}`;
4231
4256
  };
4232
4257
  return new Proxy(boxed, handler);
4233
4258
  }
4259
+ /**
4260
+ * Extract JSON from the end of a string that may contain logs/debug output
4261
+ * Looks for the last occurrence of { or [ and tries to parse from there
4262
+ */
4263
+ extractJsonFromEnd(text) {
4264
+ const lines = text.split("\n");
4265
+ for (let i = lines.length - 1; i >= 0; i--) {
4266
+ const trimmed = lines[i].trim();
4267
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
4268
+ const candidate = lines.slice(i).join("\n");
4269
+ const trimmedCandidate = candidate.trim();
4270
+ if (trimmedCandidate.startsWith("{") && trimmedCandidate.endsWith("}") || trimmedCandidate.startsWith("[") && trimmedCandidate.endsWith("]")) {
4271
+ return trimmedCandidate;
4272
+ }
4273
+ }
4274
+ }
4275
+ return null;
4276
+ }
4234
4277
  /**
4235
4278
  * Recursively apply JSON-smart wrapper to outputs object values
4236
4279
  */
@@ -6987,11 +7030,15 @@ ${expr}
6987
7030
  for (const depId of directDeps) {
6988
7031
  const depRes = results.get(depId);
6989
7032
  if (!depRes) continue;
6990
- const hasFatalCommandFailure = (depRes.issues || []).some((issue) => {
7033
+ const wasSkipped = (depRes.issues || []).some((issue) => {
7034
+ const id = issue.ruleId || "";
7035
+ return id.endsWith("/__skipped");
7036
+ });
7037
+ const hasFatalFailure = (depRes.issues || []).some((issue) => {
6991
7038
  const id = issue.ruleId || "";
6992
- return id.endsWith("/command/execution_error") || id.endsWith("/command/transform_js_error") || id.endsWith("/command/transform_error");
7039
+ return id === "command/execution_error" || id.endsWith("/command/execution_error") || id === "command/transform_js_error" || id.endsWith("/command/transform_js_error") || id === "command/transform_error" || id.endsWith("/command/transform_error") || id.endsWith("/forEach/iteration_error");
6993
7040
  });
6994
- if (hasFatalCommandFailure) failedDeps.push(depId);
7041
+ if (wasSkipped || hasFatalFailure) failedDeps.push(depId);
6995
7042
  }
6996
7043
  if (failedDeps.length > 0) {
6997
7044
  this.recordSkip(checkName, "dependency_failed");
@@ -7057,7 +7104,9 @@ ${expr}
7057
7104
  `\u{1F504} Debug: Check "${checkName}" depends on forEach check "${forEachParentName}", executing ${forEachItems.length} times`
7058
7105
  );
7059
7106
  }
7060
- logger.info(` Processing ${forEachItems.length} items...`);
7107
+ logger.info(
7108
+ ` forEach: processing ${forEachItems.length} items from "${forEachParentName}"...`
7109
+ );
7061
7110
  const allIssues = [];
7062
7111
  const allOutputs = [];
7063
7112
  const aggregatedContents = [];
@@ -7134,11 +7183,16 @@ ${expr}
7134
7183
  parent: forEachParentName
7135
7184
  }
7136
7185
  );
7186
+ const hadFatalError = (itemResult.issues || []).some((issue) => {
7187
+ const id = issue.ruleId || "";
7188
+ return id === "command/execution_error" || id.endsWith("/command/execution_error") || id === "command/transform_js_error" || id.endsWith("/command/transform_js_error") || id === "command/transform_error" || id.endsWith("/command/transform_error");
7189
+ });
7137
7190
  const iterationDuration = (Date.now() - iterationStart) / 1e3;
7138
7191
  this.recordIterationComplete(
7139
7192
  checkName,
7140
7193
  iterationStart,
7141
- true,
7194
+ !hadFatalError,
7195
+ // Success if no fatal errors
7142
7196
  itemResult.issues || [],
7143
7197
  itemResult.output
7144
7198
  );
@@ -7163,7 +7217,22 @@ ${expr}
7163
7217
  );
7164
7218
  for (const result of forEachResults) {
7165
7219
  if (result.status === "rejected") {
7166
- throw result.reason;
7220
+ const error = result.reason;
7221
+ const errorMessage = error instanceof Error ? error.message : String(error);
7222
+ allIssues.push({
7223
+ ruleId: `${checkName}/forEach/iteration_error`,
7224
+ severity: "error",
7225
+ category: "logic",
7226
+ message: `forEach iteration failed: ${errorMessage}`,
7227
+ file: "",
7228
+ line: 0
7229
+ });
7230
+ if (debug) {
7231
+ log2(
7232
+ `\u{1F504} Debug: forEach iteration for check "${checkName}" failed: ${errorMessage}`
7233
+ );
7234
+ }
7235
+ continue;
7167
7236
  }
7168
7237
  if (result.value.skipped) {
7169
7238
  continue;
@@ -7231,10 +7300,15 @@ ${expr}
7231
7300
  debug,
7232
7301
  results
7233
7302
  );
7303
+ const hadFatalError = (finalResult.issues || []).some((issue) => {
7304
+ const id = issue.ruleId || "";
7305
+ return id === "command/execution_error" || id.endsWith("/command/execution_error") || id === "command/transform_js_error" || id.endsWith("/command/transform_js_error") || id === "command/transform_error" || id.endsWith("/command/transform_error");
7306
+ });
7234
7307
  this.recordIterationComplete(
7235
7308
  checkName,
7236
7309
  checkStartTime,
7237
- true,
7310
+ !hadFatalError,
7311
+ // Success if no fatal errors
7238
7312
  finalResult.issues || [],
7239
7313
  finalResult.output
7240
7314
  );
@@ -7322,8 +7396,20 @@ ${expr}
7322
7396
  if (result.status === "fulfilled" && result.value.result && !result.value.error) {
7323
7397
  if (result.value.skipped) {
7324
7398
  if (debug) {
7325
- log2(`\u{1F527} Debug: Not storing result for skipped check "${checkName}"`);
7399
+ log2(`\u{1F527} Debug: Storing skip marker for skipped check "${checkName}"`);
7326
7400
  }
7401
+ results.set(checkName, {
7402
+ issues: [
7403
+ {
7404
+ ruleId: `${checkName}/__skipped`,
7405
+ severity: "info",
7406
+ category: "logic",
7407
+ message: "Check was skipped",
7408
+ file: "",
7409
+ line: 0
7410
+ }
7411
+ ]
7412
+ });
7327
7413
  continue;
7328
7414
  }
7329
7415
  const reviewResult = result.value.result;
@@ -7348,6 +7434,7 @@ ${expr}
7348
7434
  } else {
7349
7435
  normalizedOutput = [rawOutput];
7350
7436
  }
7437
+ logger.info(` Found ${normalizedOutput.length} items for forEach iteration`);
7351
7438
  try {
7352
7439
  const preview = JSON.stringify(normalizedOutput);
7353
7440
  logger.debug(
@@ -7652,7 +7739,10 @@ ${expr}
7652
7739
  `\u2705 Check "${checkName}" completed: ${(result.issues || []).length} issues found (level ${executionGroup.level})`
7653
7740
  );
7654
7741
  }
7655
- aggregatedIssues.push(...result.issues || []);
7742
+ const nonInternalIssues = (result.issues || []).filter(
7743
+ (issue) => !issue.ruleId?.endsWith("/__skipped")
7744
+ );
7745
+ aggregatedIssues.push(...nonInternalIssues);
7656
7746
  const resultSummary = result;
7657
7747
  const resultContent = resultSummary.content;
7658
7748
  if (typeof resultContent === "string" && resultContent.trim()) {
@@ -8587,4 +8677,4 @@ export {
8587
8677
  logger,
8588
8678
  CheckExecutionEngine
8589
8679
  };
8590
- //# sourceMappingURL=chunk-HDGNSOMS.mjs.map
8680
+ //# sourceMappingURL=chunk-GNA5GPF7.mjs.map