@probelabs/visor 0.1.81 → 0.1.82
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/index.js +159 -139
- package/dist/sdk/{check-execution-engine-47OZJFUV.mjs → check-execution-engine-PO5XKTHP.mjs} +2 -2
- package/dist/sdk/{chunk-V5PUTL5N.mjs → chunk-G24UL45Z.mjs} +163 -148
- package/dist/sdk/{chunk-V5PUTL5N.mjs.map → chunk-G24UL45Z.mjs.map} +1 -1
- package/dist/sdk/sdk.js +161 -146
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +1 -1
- package/package.json +1 -1
- /package/dist/sdk/{check-execution-engine-47OZJFUV.mjs.map → check-execution-engine-PO5XKTHP.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-PO5XKTHP.mjs");
|
|
1553
1553
|
const engine = new CheckExecutionEngine2();
|
|
1554
1554
|
const { results } = await engine.executeGroupedChecks(
|
|
1555
1555
|
prInfo,
|
|
@@ -7055,172 +7055,187 @@ ${expr}
|
|
|
7055
7055
|
let finalResult;
|
|
7056
7056
|
if (isForEachDependent && forEachParentName) {
|
|
7057
7057
|
this.recordForEachPreview(checkName, forEachItems);
|
|
7058
|
-
if (
|
|
7059
|
-
|
|
7060
|
-
|
|
7058
|
+
if (forEachItems.length === 0) {
|
|
7059
|
+
if (debug) {
|
|
7060
|
+
log2(
|
|
7061
|
+
`\u{1F504} Debug: Skipping check "${checkName}" - forEach check "${forEachParentName}" returned 0 items`
|
|
7062
|
+
);
|
|
7063
|
+
}
|
|
7064
|
+
logger.info(` forEach: no items from "${forEachParentName}", skipping check...`);
|
|
7065
|
+
finalResult = {
|
|
7066
|
+
issues: [],
|
|
7067
|
+
output: []
|
|
7068
|
+
};
|
|
7069
|
+
finalResult.isForEach = true;
|
|
7070
|
+
finalResult.forEachItems = [];
|
|
7071
|
+
} else {
|
|
7072
|
+
if (debug) {
|
|
7073
|
+
log2(
|
|
7074
|
+
`\u{1F504} Debug: Check "${checkName}" depends on forEach check "${forEachParentName}", executing ${forEachItems.length} times`
|
|
7075
|
+
);
|
|
7076
|
+
}
|
|
7077
|
+
logger.info(
|
|
7078
|
+
` forEach: processing ${forEachItems.length} items from "${forEachParentName}"...`
|
|
7061
7079
|
);
|
|
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);
|
|
7080
|
+
const allIssues = [];
|
|
7081
|
+
const allOutputs = [];
|
|
7082
|
+
const aggregatedContents = [];
|
|
7083
|
+
const itemTasks = forEachItems.map((item, itemIndex) => async () => {
|
|
7084
|
+
const forEachDependencyResults = /* @__PURE__ */ new Map();
|
|
7085
|
+
for (const [depName, depResult] of dependencyResults) {
|
|
7086
|
+
if (forEachParents.includes(depName)) {
|
|
7087
|
+
const depForEachResult = depResult;
|
|
7088
|
+
if (Array.isArray(depForEachResult.output) && depForEachResult.output[itemIndex] !== void 0) {
|
|
7089
|
+
const modifiedResult = {
|
|
7090
|
+
issues: [],
|
|
7091
|
+
output: depForEachResult.output[itemIndex]
|
|
7092
|
+
};
|
|
7093
|
+
forEachDependencyResults.set(depName, modifiedResult);
|
|
7094
|
+
const rawResult = {
|
|
7095
|
+
issues: [],
|
|
7096
|
+
output: depForEachResult.output
|
|
7097
|
+
};
|
|
7098
|
+
forEachDependencyResults.set(`${depName}-raw`, rawResult);
|
|
7099
|
+
} else {
|
|
7100
|
+
forEachDependencyResults.set(depName, depResult);
|
|
7101
|
+
}
|
|
7085
7102
|
} else {
|
|
7086
7103
|
forEachDependencyResults.set(depName, depResult);
|
|
7087
7104
|
}
|
|
7088
|
-
} else {
|
|
7089
|
-
forEachDependencyResults.set(depName, depResult);
|
|
7090
7105
|
}
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7106
|
+
if (checkConfig.if) {
|
|
7107
|
+
const conditionResults = new Map(results);
|
|
7108
|
+
for (const [depName, depResult] of forEachDependencyResults) {
|
|
7109
|
+
conditionResults.set(depName, depResult);
|
|
7110
|
+
}
|
|
7111
|
+
const shouldRun = await this.evaluateCheckCondition(
|
|
7112
|
+
checkName,
|
|
7113
|
+
checkConfig.if,
|
|
7114
|
+
prInfo,
|
|
7115
|
+
conditionResults,
|
|
7116
|
+
debug
|
|
7117
|
+
);
|
|
7118
|
+
if (!shouldRun) {
|
|
7119
|
+
if (debug) {
|
|
7120
|
+
log2(
|
|
7121
|
+
`\u{1F504} Debug: Skipping forEach item ${itemIndex + 1} for check "${checkName}" (if condition evaluated to false)`
|
|
7122
|
+
);
|
|
7123
|
+
}
|
|
7124
|
+
return {
|
|
7125
|
+
index: itemIndex,
|
|
7126
|
+
itemResult: { issues: [] },
|
|
7127
|
+
skipped: true
|
|
7128
|
+
};
|
|
7129
|
+
}
|
|
7096
7130
|
}
|
|
7097
|
-
|
|
7131
|
+
if (debug) {
|
|
7132
|
+
log2(
|
|
7133
|
+
`\u{1F504} Debug: Executing check "${checkName}" for item ${itemIndex + 1}/${forEachItems.length}`
|
|
7134
|
+
);
|
|
7135
|
+
}
|
|
7136
|
+
const iterationStart = this.recordIterationStart(checkName);
|
|
7137
|
+
const itemResult = await this.executeWithRouting(
|
|
7098
7138
|
checkName,
|
|
7099
|
-
checkConfig
|
|
7139
|
+
checkConfig,
|
|
7140
|
+
provider,
|
|
7141
|
+
providerConfig,
|
|
7100
7142
|
prInfo,
|
|
7101
|
-
|
|
7102
|
-
|
|
7143
|
+
forEachDependencyResults,
|
|
7144
|
+
sessionInfo,
|
|
7145
|
+
config,
|
|
7146
|
+
dependencyGraph,
|
|
7147
|
+
debug,
|
|
7148
|
+
results,
|
|
7149
|
+
/*foreachContext*/
|
|
7150
|
+
{
|
|
7151
|
+
index: itemIndex,
|
|
7152
|
+
total: forEachItems.length,
|
|
7153
|
+
parent: forEachParentName
|
|
7154
|
+
}
|
|
7103
7155
|
);
|
|
7104
|
-
|
|
7156
|
+
const hadFatalError = (itemResult.issues || []).some((issue) => {
|
|
7157
|
+
const id = issue.ruleId || "";
|
|
7158
|
+
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");
|
|
7159
|
+
});
|
|
7160
|
+
const iterationDuration = (Date.now() - iterationStart) / 1e3;
|
|
7161
|
+
this.recordIterationComplete(
|
|
7162
|
+
checkName,
|
|
7163
|
+
iterationStart,
|
|
7164
|
+
!hadFatalError,
|
|
7165
|
+
// Success if no fatal errors
|
|
7166
|
+
itemResult.issues || [],
|
|
7167
|
+
itemResult.output
|
|
7168
|
+
);
|
|
7169
|
+
logger.info(
|
|
7170
|
+
` \u2714 ${itemIndex + 1}/${forEachItems.length} (${iterationDuration.toFixed(1)}s)`
|
|
7171
|
+
);
|
|
7172
|
+
return { index: itemIndex, itemResult };
|
|
7173
|
+
});
|
|
7174
|
+
const forEachConcurrency = Math.max(
|
|
7175
|
+
1,
|
|
7176
|
+
Math.min(forEachItems.length, effectiveMaxParallelism)
|
|
7177
|
+
);
|
|
7178
|
+
if (debug && forEachConcurrency > 1) {
|
|
7179
|
+
log2(
|
|
7180
|
+
`\u{1F504} Debug: Limiting forEach concurrency for check "${checkName}" to ${forEachConcurrency}`
|
|
7181
|
+
);
|
|
7182
|
+
}
|
|
7183
|
+
const forEachResults = await this.executeWithLimitedParallelism(
|
|
7184
|
+
itemTasks,
|
|
7185
|
+
forEachConcurrency,
|
|
7186
|
+
false
|
|
7187
|
+
);
|
|
7188
|
+
for (const result of forEachResults) {
|
|
7189
|
+
if (result.status === "rejected") {
|
|
7190
|
+
const error = result.reason;
|
|
7191
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
7192
|
+
allIssues.push({
|
|
7193
|
+
ruleId: `${checkName}/forEach/iteration_error`,
|
|
7194
|
+
severity: "error",
|
|
7195
|
+
category: "logic",
|
|
7196
|
+
message: `forEach iteration failed: ${errorMessage}`,
|
|
7197
|
+
file: "",
|
|
7198
|
+
line: 0
|
|
7199
|
+
});
|
|
7105
7200
|
if (debug) {
|
|
7106
7201
|
log2(
|
|
7107
|
-
`\u{1F504} Debug:
|
|
7202
|
+
`\u{1F504} Debug: forEach iteration for check "${checkName}" failed: ${errorMessage}`
|
|
7108
7203
|
);
|
|
7109
7204
|
}
|
|
7110
|
-
|
|
7111
|
-
index: itemIndex,
|
|
7112
|
-
itemResult: { issues: [] },
|
|
7113
|
-
skipped: true
|
|
7114
|
-
};
|
|
7205
|
+
continue;
|
|
7115
7206
|
}
|
|
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
|
|
7207
|
+
if (result.value.skipped) {
|
|
7208
|
+
continue;
|
|
7140
7209
|
}
|
|
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
|
-
);
|
|
7210
|
+
const { itemResult } = result.value;
|
|
7211
|
+
if (itemResult.issues) {
|
|
7212
|
+
allIssues.push(...itemResult.issues);
|
|
7213
|
+
}
|
|
7214
|
+
const resultWithOutput = itemResult;
|
|
7215
|
+
if (resultWithOutput.output !== void 0) {
|
|
7216
|
+
allOutputs.push(resultWithOutput.output);
|
|
7217
|
+
}
|
|
7218
|
+
const itemContent = resultWithOutput.content;
|
|
7219
|
+
if (typeof itemContent === "string" && itemContent.trim()) {
|
|
7220
|
+
aggregatedContents.push(itemContent.trim());
|
|
7190
7221
|
}
|
|
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
7222
|
}
|
|
7200
|
-
const
|
|
7201
|
-
|
|
7202
|
-
|
|
7223
|
+
const finalOutput = allOutputs.length > 0 ? allOutputs : void 0;
|
|
7224
|
+
finalResult = {
|
|
7225
|
+
issues: allIssues,
|
|
7226
|
+
...finalOutput !== void 0 ? { output: finalOutput } : {}
|
|
7227
|
+
};
|
|
7228
|
+
if (allOutputs.length > 0) {
|
|
7229
|
+
finalResult.isForEach = true;
|
|
7230
|
+
finalResult.forEachItems = allOutputs;
|
|
7203
7231
|
}
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
aggregatedContents.push(itemContent.trim());
|
|
7232
|
+
if (aggregatedContents.length > 0) {
|
|
7233
|
+
finalResult.content = aggregatedContents.join("\n");
|
|
7207
7234
|
}
|
|
7235
|
+
log2(
|
|
7236
|
+
`\u{1F504} Debug: Completed forEach execution for check "${checkName}", total issues: ${allIssues.length}`
|
|
7237
|
+
);
|
|
7208
7238
|
}
|
|
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
7239
|
} else {
|
|
7225
7240
|
if (checkConfig.if) {
|
|
7226
7241
|
const shouldRun = await this.evaluateCheckCondition(
|
|
@@ -8633,4 +8648,4 @@ export {
|
|
|
8633
8648
|
logger,
|
|
8634
8649
|
CheckExecutionEngine
|
|
8635
8650
|
};
|
|
8636
|
-
//# sourceMappingURL=chunk-
|
|
8651
|
+
//# sourceMappingURL=chunk-G24UL45Z.mjs.map
|