@probelabs/visor 0.1.81 → 0.1.83
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/check-execution-engine.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/generated/config-schema.d.ts +4 -0
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/generated/config-schema.json +4 -0
- package/dist/index.js +194 -144
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/sdk/{check-execution-engine-47OZJFUV.mjs → check-execution-engine-47X4MPHW.mjs} +2 -2
- package/dist/sdk/{chunk-V5PUTL5N.mjs → chunk-ROXFJUTY.mjs} +190 -150
- package/dist/sdk/chunk-ROXFJUTY.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +2 -0
- package/dist/sdk/sdk.d.ts +2 -0
- package/dist/sdk/sdk.js +192 -148
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +5 -1
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/types/config.d.ts +2 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/sdk/chunk-V5PUTL5N.mjs.map +0 -1
- /package/dist/sdk/{check-execution-engine-47OZJFUV.mjs.map → check-execution-engine-47X4MPHW.mjs.map} +0 -0
|
@@ -1549,7 +1549,7 @@ var PRReviewer = class {
|
|
|
1549
1549
|
async reviewPR(owner, repo, prNumber, prInfo, options = {}) {
|
|
1550
1550
|
const { debug = false, config, checks } = options;
|
|
1551
1551
|
if (config && checks && checks.length > 0) {
|
|
1552
|
-
const { CheckExecutionEngine: CheckExecutionEngine2 } = await import("./check-execution-engine-
|
|
1552
|
+
const { CheckExecutionEngine: CheckExecutionEngine2 } = await import("./check-execution-engine-47X4MPHW.mjs");
|
|
1553
1553
|
const engine = new CheckExecutionEngine2();
|
|
1554
1554
|
const { results } = await engine.executeGroupedChecks(
|
|
1555
1555
|
prInfo,
|
|
@@ -4097,6 +4097,16 @@ return ${returnTarget};
|
|
|
4097
4097
|
return result;
|
|
4098
4098
|
} catch (error) {
|
|
4099
4099
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
4100
|
+
let isTimeout = false;
|
|
4101
|
+
if (error && typeof error === "object") {
|
|
4102
|
+
const execError = error;
|
|
4103
|
+
if (execError.killed && execError.signal === "SIGTERM") {
|
|
4104
|
+
isTimeout = true;
|
|
4105
|
+
}
|
|
4106
|
+
if (execError.code === "ETIMEDOUT") {
|
|
4107
|
+
isTimeout = true;
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4100
4110
|
let stderrOutput = "";
|
|
4101
4111
|
if (error && typeof error === "object") {
|
|
4102
4112
|
const execError = error;
|
|
@@ -4104,17 +4114,32 @@ return ${returnTarget};
|
|
|
4104
4114
|
stderrOutput = execError.stderr.trim();
|
|
4105
4115
|
}
|
|
4106
4116
|
}
|
|
4107
|
-
|
|
4117
|
+
let detailedMessage;
|
|
4118
|
+
let ruleId;
|
|
4119
|
+
if (isTimeout) {
|
|
4120
|
+
const timeoutSeconds = config.timeout || 60;
|
|
4121
|
+
detailedMessage = `Command execution timed out after ${timeoutSeconds} seconds`;
|
|
4122
|
+
if (stderrOutput) {
|
|
4123
|
+
detailedMessage += `
|
|
4124
|
+
|
|
4125
|
+
Stderr output:
|
|
4126
|
+
${stderrOutput}`;
|
|
4127
|
+
}
|
|
4128
|
+
ruleId = "command/timeout";
|
|
4129
|
+
} else {
|
|
4130
|
+
detailedMessage = stderrOutput ? `Command execution failed: ${errorMessage}
|
|
4108
4131
|
|
|
4109
4132
|
Stderr output:
|
|
4110
4133
|
${stderrOutput}` : `Command execution failed: ${errorMessage}`;
|
|
4134
|
+
ruleId = "command/execution_error";
|
|
4135
|
+
}
|
|
4111
4136
|
logger.error(`\u2717 ${detailedMessage}`);
|
|
4112
4137
|
return {
|
|
4113
4138
|
issues: [
|
|
4114
4139
|
{
|
|
4115
4140
|
file: "command",
|
|
4116
4141
|
line: 0,
|
|
4117
|
-
ruleId
|
|
4142
|
+
ruleId,
|
|
4118
4143
|
message: detailedMessage,
|
|
4119
4144
|
severity: "error",
|
|
4120
4145
|
category: "logic"
|
|
@@ -7055,172 +7080,187 @@ ${expr}
|
|
|
7055
7080
|
let finalResult;
|
|
7056
7081
|
if (isForEachDependent && forEachParentName) {
|
|
7057
7082
|
this.recordForEachPreview(checkName, forEachItems);
|
|
7058
|
-
if (
|
|
7059
|
-
|
|
7060
|
-
|
|
7083
|
+
if (forEachItems.length === 0) {
|
|
7084
|
+
if (debug) {
|
|
7085
|
+
log2(
|
|
7086
|
+
`\u{1F504} Debug: Skipping check "${checkName}" - forEach check "${forEachParentName}" returned 0 items`
|
|
7087
|
+
);
|
|
7088
|
+
}
|
|
7089
|
+
logger.info(` forEach: no items from "${forEachParentName}", skipping check...`);
|
|
7090
|
+
finalResult = {
|
|
7091
|
+
issues: [],
|
|
7092
|
+
output: []
|
|
7093
|
+
};
|
|
7094
|
+
finalResult.isForEach = true;
|
|
7095
|
+
finalResult.forEachItems = [];
|
|
7096
|
+
} else {
|
|
7097
|
+
if (debug) {
|
|
7098
|
+
log2(
|
|
7099
|
+
`\u{1F504} Debug: Check "${checkName}" depends on forEach check "${forEachParentName}", executing ${forEachItems.length} times`
|
|
7100
|
+
);
|
|
7101
|
+
}
|
|
7102
|
+
logger.info(
|
|
7103
|
+
` forEach: processing ${forEachItems.length} items from "${forEachParentName}"...`
|
|
7061
7104
|
);
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
}
|
|
7084
|
-
forEachDependencyResults.set(`${depName}-raw`, rawResult);
|
|
7105
|
+
const allIssues = [];
|
|
7106
|
+
const allOutputs = [];
|
|
7107
|
+
const aggregatedContents = [];
|
|
7108
|
+
const itemTasks = forEachItems.map((item, itemIndex) => async () => {
|
|
7109
|
+
const forEachDependencyResults = /* @__PURE__ */ new Map();
|
|
7110
|
+
for (const [depName, depResult] of dependencyResults) {
|
|
7111
|
+
if (forEachParents.includes(depName)) {
|
|
7112
|
+
const depForEachResult = depResult;
|
|
7113
|
+
if (Array.isArray(depForEachResult.output) && depForEachResult.output[itemIndex] !== void 0) {
|
|
7114
|
+
const modifiedResult = {
|
|
7115
|
+
issues: [],
|
|
7116
|
+
output: depForEachResult.output[itemIndex]
|
|
7117
|
+
};
|
|
7118
|
+
forEachDependencyResults.set(depName, modifiedResult);
|
|
7119
|
+
const rawResult = {
|
|
7120
|
+
issues: [],
|
|
7121
|
+
output: depForEachResult.output
|
|
7122
|
+
};
|
|
7123
|
+
forEachDependencyResults.set(`${depName}-raw`, rawResult);
|
|
7124
|
+
} else {
|
|
7125
|
+
forEachDependencyResults.set(depName, depResult);
|
|
7126
|
+
}
|
|
7085
7127
|
} else {
|
|
7086
7128
|
forEachDependencyResults.set(depName, depResult);
|
|
7087
7129
|
}
|
|
7088
|
-
} else {
|
|
7089
|
-
forEachDependencyResults.set(depName, depResult);
|
|
7090
7130
|
}
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7131
|
+
if (checkConfig.if) {
|
|
7132
|
+
const conditionResults = new Map(results);
|
|
7133
|
+
for (const [depName, depResult] of forEachDependencyResults) {
|
|
7134
|
+
conditionResults.set(depName, depResult);
|
|
7135
|
+
}
|
|
7136
|
+
const shouldRun = await this.evaluateCheckCondition(
|
|
7137
|
+
checkName,
|
|
7138
|
+
checkConfig.if,
|
|
7139
|
+
prInfo,
|
|
7140
|
+
conditionResults,
|
|
7141
|
+
debug
|
|
7142
|
+
);
|
|
7143
|
+
if (!shouldRun) {
|
|
7144
|
+
if (debug) {
|
|
7145
|
+
log2(
|
|
7146
|
+
`\u{1F504} Debug: Skipping forEach item ${itemIndex + 1} for check "${checkName}" (if condition evaluated to false)`
|
|
7147
|
+
);
|
|
7148
|
+
}
|
|
7149
|
+
return {
|
|
7150
|
+
index: itemIndex,
|
|
7151
|
+
itemResult: { issues: [] },
|
|
7152
|
+
skipped: true
|
|
7153
|
+
};
|
|
7154
|
+
}
|
|
7096
7155
|
}
|
|
7097
|
-
|
|
7156
|
+
if (debug) {
|
|
7157
|
+
log2(
|
|
7158
|
+
`\u{1F504} Debug: Executing check "${checkName}" for item ${itemIndex + 1}/${forEachItems.length}`
|
|
7159
|
+
);
|
|
7160
|
+
}
|
|
7161
|
+
const iterationStart = this.recordIterationStart(checkName);
|
|
7162
|
+
const itemResult = await this.executeWithRouting(
|
|
7098
7163
|
checkName,
|
|
7099
|
-
checkConfig
|
|
7164
|
+
checkConfig,
|
|
7165
|
+
provider,
|
|
7166
|
+
providerConfig,
|
|
7100
7167
|
prInfo,
|
|
7101
|
-
|
|
7102
|
-
|
|
7168
|
+
forEachDependencyResults,
|
|
7169
|
+
sessionInfo,
|
|
7170
|
+
config,
|
|
7171
|
+
dependencyGraph,
|
|
7172
|
+
debug,
|
|
7173
|
+
results,
|
|
7174
|
+
/*foreachContext*/
|
|
7175
|
+
{
|
|
7176
|
+
index: itemIndex,
|
|
7177
|
+
total: forEachItems.length,
|
|
7178
|
+
parent: forEachParentName
|
|
7179
|
+
}
|
|
7103
7180
|
);
|
|
7104
|
-
|
|
7181
|
+
const hadFatalError = (itemResult.issues || []).some((issue) => {
|
|
7182
|
+
const id = issue.ruleId || "";
|
|
7183
|
+
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");
|
|
7184
|
+
});
|
|
7185
|
+
const iterationDuration = (Date.now() - iterationStart) / 1e3;
|
|
7186
|
+
this.recordIterationComplete(
|
|
7187
|
+
checkName,
|
|
7188
|
+
iterationStart,
|
|
7189
|
+
!hadFatalError,
|
|
7190
|
+
// Success if no fatal errors
|
|
7191
|
+
itemResult.issues || [],
|
|
7192
|
+
itemResult.output
|
|
7193
|
+
);
|
|
7194
|
+
logger.info(
|
|
7195
|
+
` \u2714 ${itemIndex + 1}/${forEachItems.length} (${iterationDuration.toFixed(1)}s)`
|
|
7196
|
+
);
|
|
7197
|
+
return { index: itemIndex, itemResult };
|
|
7198
|
+
});
|
|
7199
|
+
const forEachConcurrency = Math.max(
|
|
7200
|
+
1,
|
|
7201
|
+
Math.min(forEachItems.length, effectiveMaxParallelism)
|
|
7202
|
+
);
|
|
7203
|
+
if (debug && forEachConcurrency > 1) {
|
|
7204
|
+
log2(
|
|
7205
|
+
`\u{1F504} Debug: Limiting forEach concurrency for check "${checkName}" to ${forEachConcurrency}`
|
|
7206
|
+
);
|
|
7207
|
+
}
|
|
7208
|
+
const forEachResults = await this.executeWithLimitedParallelism(
|
|
7209
|
+
itemTasks,
|
|
7210
|
+
forEachConcurrency,
|
|
7211
|
+
false
|
|
7212
|
+
);
|
|
7213
|
+
for (const result of forEachResults) {
|
|
7214
|
+
if (result.status === "rejected") {
|
|
7215
|
+
const error = result.reason;
|
|
7216
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
7217
|
+
allIssues.push({
|
|
7218
|
+
ruleId: `${checkName}/forEach/iteration_error`,
|
|
7219
|
+
severity: "error",
|
|
7220
|
+
category: "logic",
|
|
7221
|
+
message: `forEach iteration failed: ${errorMessage}`,
|
|
7222
|
+
file: "",
|
|
7223
|
+
line: 0
|
|
7224
|
+
});
|
|
7105
7225
|
if (debug) {
|
|
7106
7226
|
log2(
|
|
7107
|
-
`\u{1F504} Debug:
|
|
7227
|
+
`\u{1F504} Debug: forEach iteration for check "${checkName}" failed: ${errorMessage}`
|
|
7108
7228
|
);
|
|
7109
7229
|
}
|
|
7110
|
-
|
|
7111
|
-
index: itemIndex,
|
|
7112
|
-
itemResult: { issues: [] },
|
|
7113
|
-
skipped: true
|
|
7114
|
-
};
|
|
7230
|
+
continue;
|
|
7115
7231
|
}
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
log2(
|
|
7119
|
-
`\u{1F504} Debug: Executing check "${checkName}" for item ${itemIndex + 1}/${forEachItems.length}`
|
|
7120
|
-
);
|
|
7121
|
-
}
|
|
7122
|
-
const iterationStart = this.recordIterationStart(checkName);
|
|
7123
|
-
const itemResult = await this.executeWithRouting(
|
|
7124
|
-
checkName,
|
|
7125
|
-
checkConfig,
|
|
7126
|
-
provider,
|
|
7127
|
-
providerConfig,
|
|
7128
|
-
prInfo,
|
|
7129
|
-
forEachDependencyResults,
|
|
7130
|
-
sessionInfo,
|
|
7131
|
-
config,
|
|
7132
|
-
dependencyGraph,
|
|
7133
|
-
debug,
|
|
7134
|
-
results,
|
|
7135
|
-
/*foreachContext*/
|
|
7136
|
-
{
|
|
7137
|
-
index: itemIndex,
|
|
7138
|
-
total: forEachItems.length,
|
|
7139
|
-
parent: forEachParentName
|
|
7232
|
+
if (result.value.skipped) {
|
|
7233
|
+
continue;
|
|
7140
7234
|
}
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
itemResult.issues || [],
|
|
7153
|
-
itemResult.output
|
|
7154
|
-
);
|
|
7155
|
-
logger.info(
|
|
7156
|
-
` \u2714 ${itemIndex + 1}/${forEachItems.length} (${iterationDuration.toFixed(1)}s)`
|
|
7157
|
-
);
|
|
7158
|
-
return { index: itemIndex, itemResult };
|
|
7159
|
-
});
|
|
7160
|
-
const forEachConcurrency = Math.max(
|
|
7161
|
-
1,
|
|
7162
|
-
Math.min(forEachItems.length, effectiveMaxParallelism)
|
|
7163
|
-
);
|
|
7164
|
-
if (debug && forEachConcurrency > 1) {
|
|
7165
|
-
log2(
|
|
7166
|
-
`\u{1F504} Debug: Limiting forEach concurrency for check "${checkName}" to ${forEachConcurrency}`
|
|
7167
|
-
);
|
|
7168
|
-
}
|
|
7169
|
-
const forEachResults = await this.executeWithLimitedParallelism(
|
|
7170
|
-
itemTasks,
|
|
7171
|
-
forEachConcurrency,
|
|
7172
|
-
false
|
|
7173
|
-
);
|
|
7174
|
-
for (const result of forEachResults) {
|
|
7175
|
-
if (result.status === "rejected") {
|
|
7176
|
-
const error = result.reason;
|
|
7177
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
7178
|
-
allIssues.push({
|
|
7179
|
-
ruleId: `${checkName}/forEach/iteration_error`,
|
|
7180
|
-
severity: "error",
|
|
7181
|
-
category: "logic",
|
|
7182
|
-
message: `forEach iteration failed: ${errorMessage}`,
|
|
7183
|
-
file: "",
|
|
7184
|
-
line: 0
|
|
7185
|
-
});
|
|
7186
|
-
if (debug) {
|
|
7187
|
-
log2(
|
|
7188
|
-
`\u{1F504} Debug: forEach iteration for check "${checkName}" failed: ${errorMessage}`
|
|
7189
|
-
);
|
|
7235
|
+
const { itemResult } = result.value;
|
|
7236
|
+
if (itemResult.issues) {
|
|
7237
|
+
allIssues.push(...itemResult.issues);
|
|
7238
|
+
}
|
|
7239
|
+
const resultWithOutput = itemResult;
|
|
7240
|
+
if (resultWithOutput.output !== void 0) {
|
|
7241
|
+
allOutputs.push(resultWithOutput.output);
|
|
7242
|
+
}
|
|
7243
|
+
const itemContent = resultWithOutput.content;
|
|
7244
|
+
if (typeof itemContent === "string" && itemContent.trim()) {
|
|
7245
|
+
aggregatedContents.push(itemContent.trim());
|
|
7190
7246
|
}
|
|
7191
|
-
continue;
|
|
7192
|
-
}
|
|
7193
|
-
if (result.value.skipped) {
|
|
7194
|
-
continue;
|
|
7195
|
-
}
|
|
7196
|
-
const { itemResult } = result.value;
|
|
7197
|
-
if (itemResult.issues) {
|
|
7198
|
-
allIssues.push(...itemResult.issues);
|
|
7199
7247
|
}
|
|
7200
|
-
const
|
|
7201
|
-
|
|
7202
|
-
|
|
7248
|
+
const finalOutput = allOutputs.length > 0 ? allOutputs : void 0;
|
|
7249
|
+
finalResult = {
|
|
7250
|
+
issues: allIssues,
|
|
7251
|
+
...finalOutput !== void 0 ? { output: finalOutput } : {}
|
|
7252
|
+
};
|
|
7253
|
+
if (allOutputs.length > 0) {
|
|
7254
|
+
finalResult.isForEach = true;
|
|
7255
|
+
finalResult.forEachItems = allOutputs;
|
|
7203
7256
|
}
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
aggregatedContents.push(itemContent.trim());
|
|
7257
|
+
if (aggregatedContents.length > 0) {
|
|
7258
|
+
finalResult.content = aggregatedContents.join("\n");
|
|
7207
7259
|
}
|
|
7260
|
+
log2(
|
|
7261
|
+
`\u{1F504} Debug: Completed forEach execution for check "${checkName}", total issues: ${allIssues.length}`
|
|
7262
|
+
);
|
|
7208
7263
|
}
|
|
7209
|
-
const finalOutput = allOutputs.length > 0 ? allOutputs : void 0;
|
|
7210
|
-
finalResult = {
|
|
7211
|
-
issues: allIssues,
|
|
7212
|
-
...finalOutput !== void 0 ? { output: finalOutput } : {}
|
|
7213
|
-
};
|
|
7214
|
-
if (allOutputs.length > 0) {
|
|
7215
|
-
finalResult.isForEach = true;
|
|
7216
|
-
finalResult.forEachItems = allOutputs;
|
|
7217
|
-
}
|
|
7218
|
-
if (aggregatedContents.length > 0) {
|
|
7219
|
-
finalResult.content = aggregatedContents.join("\n");
|
|
7220
|
-
}
|
|
7221
|
-
log2(
|
|
7222
|
-
`\u{1F504} Debug: Completed forEach execution for check "${checkName}", total issues: ${allIssues.length}`
|
|
7223
|
-
);
|
|
7224
7264
|
} else {
|
|
7225
7265
|
if (checkConfig.if) {
|
|
7226
7266
|
const shouldRun = await this.evaluateCheckCondition(
|
|
@@ -8633,4 +8673,4 @@ export {
|
|
|
8633
8673
|
logger,
|
|
8634
8674
|
CheckExecutionEngine
|
|
8635
8675
|
};
|
|
8636
|
-
//# sourceMappingURL=chunk-
|
|
8676
|
+
//# sourceMappingURL=chunk-ROXFJUTY.mjs.map
|