@probelabs/visor 0.1.82 → 0.1.84
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/defaults/.visor.yaml +4 -4
- package/dist/check-execution-engine.d.ts +5 -0
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/defaults/.visor.yaml +4 -4
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/generated/config-schema.d.ts +6 -2
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/generated/config-schema.json +9 -2
- package/dist/index.js +39774 -36632
- package/dist/output/code-review/schema.json +2 -2
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/sdk/{check-execution-engine-PO5XKTHP.mjs → check-execution-engine-X7VCV6KI.mjs} +2 -2
- package/dist/sdk/{chunk-G24UL45Z.mjs → chunk-Q55L5EPS.mjs} +150 -29
- package/dist/sdk/chunk-Q55L5EPS.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +4 -2
- package/dist/sdk/sdk.d.ts +4 -2
- package/dist/sdk/sdk.js +169 -33
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +22 -7
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/types/config.d.ts +4 -2
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/sdk/chunk-G24UL45Z.mjs.map +0 -1
- /package/dist/sdk/{check-execution-engine-PO5XKTHP.mjs.map → check-execution-engine-X7VCV6KI.mjs.map} +0 -0
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
},
|
|
39
39
|
"severity": {
|
|
40
40
|
"type": "string",
|
|
41
|
-
"enum": ["
|
|
42
|
-
"description": "Issue severity level based on the NEW CODE being introduced: info (suggestions/improvements), warning (should fix), error (must fix), critical (NEW security vulnerabilities, data loss risks, or breaking changes that block deployment). IMPORTANT: Use 'critical' ONLY when NEW problematic code is INTRODUCED, NOT when existing issues are being FIXED.
|
|
41
|
+
"enum": ["warning", "error", "critical"],
|
|
42
|
+
"description": "Issue severity level based on the NEW CODE being introduced: info (suggestions/improvements), warning (should fix), error (must fix), critical (NEW security vulnerabilities, data loss risks, or breaking changes that block deployment). IMPORTANT: Use 'critical' ONLY when NEW problematic code is INTRODUCED, NOT when existing issues are being FIXED. "
|
|
43
43
|
},
|
|
44
44
|
"category": {
|
|
45
45
|
"type": "string",
|
|
@@ -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;
|
|
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,MA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
export {
|
|
7
7
|
CheckExecutionEngine
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=check-execution-engine-
|
|
9
|
+
//# sourceMappingURL=check-execution-engine-X7VCV6KI.mjs.map
|
|
@@ -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-X7VCV6KI.mjs");
|
|
1553
1553
|
const engine = new CheckExecutionEngine2();
|
|
1554
1554
|
const { results } = await engine.executeGroupedChecks(
|
|
1555
1555
|
prInfo,
|
|
@@ -3908,6 +3908,7 @@ var CommandCheckProvider = class extends CheckProvider {
|
|
|
3908
3908
|
try {
|
|
3909
3909
|
const parsed = JSON.parse(rawOutput);
|
|
3910
3910
|
output = parsed;
|
|
3911
|
+
logger.debug(`\u{1F527} Debug: Parsed entire output as JSON successfully`);
|
|
3911
3912
|
} catch {
|
|
3912
3913
|
const extracted2 = this.extractJsonFromEnd(rawOutput);
|
|
3913
3914
|
if (extracted2) {
|
|
@@ -3916,13 +3917,28 @@ var CommandCheckProvider = class extends CheckProvider {
|
|
|
3916
3917
|
logger.debug(
|
|
3917
3918
|
`\u{1F527} Debug: Extracted and parsed JSON from end of output (${extracted2.length} chars from ${rawOutput.length} total)`
|
|
3918
3919
|
);
|
|
3919
|
-
|
|
3920
|
+
logger.debug(`\u{1F527} Debug: Extracted JSON content: ${extracted2.slice(0, 200)}`);
|
|
3921
|
+
} catch (parseError) {
|
|
3922
|
+
logger.debug(
|
|
3923
|
+
`\u{1F527} Debug: Extracted text is not valid JSON: ${parseError instanceof Error ? parseError.message : "Unknown error"}`
|
|
3924
|
+
);
|
|
3920
3925
|
output = rawOutput;
|
|
3921
3926
|
}
|
|
3922
3927
|
} else {
|
|
3928
|
+
logger.debug(`\u{1F527} Debug: No JSON found in output, keeping as string`);
|
|
3923
3929
|
output = rawOutput;
|
|
3924
3930
|
}
|
|
3925
3931
|
}
|
|
3932
|
+
if (output !== rawOutput) {
|
|
3933
|
+
try {
|
|
3934
|
+
const outputType = Array.isArray(output) ? `array[${output.length}]` : typeof output;
|
|
3935
|
+
logger.debug(`\u{1F527} Debug: Parsed output type: ${outputType}`);
|
|
3936
|
+
if (typeof output === "object" && output !== null) {
|
|
3937
|
+
logger.debug(`\u{1F527} Debug: Parsed output keys: ${Object.keys(output).join(", ")}`);
|
|
3938
|
+
}
|
|
3939
|
+
} catch {
|
|
3940
|
+
}
|
|
3941
|
+
}
|
|
3926
3942
|
let finalOutput = output;
|
|
3927
3943
|
if (transform) {
|
|
3928
3944
|
try {
|
|
@@ -4097,6 +4113,16 @@ return ${returnTarget};
|
|
|
4097
4113
|
return result;
|
|
4098
4114
|
} catch (error) {
|
|
4099
4115
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
4116
|
+
let isTimeout = false;
|
|
4117
|
+
if (error && typeof error === "object") {
|
|
4118
|
+
const execError = error;
|
|
4119
|
+
if (execError.killed && execError.signal === "SIGTERM") {
|
|
4120
|
+
isTimeout = true;
|
|
4121
|
+
}
|
|
4122
|
+
if (execError.code === "ETIMEDOUT") {
|
|
4123
|
+
isTimeout = true;
|
|
4124
|
+
}
|
|
4125
|
+
}
|
|
4100
4126
|
let stderrOutput = "";
|
|
4101
4127
|
if (error && typeof error === "object") {
|
|
4102
4128
|
const execError = error;
|
|
@@ -4104,17 +4130,32 @@ return ${returnTarget};
|
|
|
4104
4130
|
stderrOutput = execError.stderr.trim();
|
|
4105
4131
|
}
|
|
4106
4132
|
}
|
|
4107
|
-
|
|
4133
|
+
let detailedMessage;
|
|
4134
|
+
let ruleId;
|
|
4135
|
+
if (isTimeout) {
|
|
4136
|
+
const timeoutSeconds = config.timeout || 60;
|
|
4137
|
+
detailedMessage = `Command execution timed out after ${timeoutSeconds} seconds`;
|
|
4138
|
+
if (stderrOutput) {
|
|
4139
|
+
detailedMessage += `
|
|
4140
|
+
|
|
4141
|
+
Stderr output:
|
|
4142
|
+
${stderrOutput}`;
|
|
4143
|
+
}
|
|
4144
|
+
ruleId = "command/timeout";
|
|
4145
|
+
} else {
|
|
4146
|
+
detailedMessage = stderrOutput ? `Command execution failed: ${errorMessage}
|
|
4108
4147
|
|
|
4109
4148
|
Stderr output:
|
|
4110
4149
|
${stderrOutput}` : `Command execution failed: ${errorMessage}`;
|
|
4150
|
+
ruleId = "command/execution_error";
|
|
4151
|
+
}
|
|
4111
4152
|
logger.error(`\u2717 ${detailedMessage}`);
|
|
4112
4153
|
return {
|
|
4113
4154
|
issues: [
|
|
4114
4155
|
{
|
|
4115
4156
|
file: "command",
|
|
4116
4157
|
line: 0,
|
|
4117
|
-
ruleId
|
|
4158
|
+
ruleId,
|
|
4118
4159
|
message: detailedMessage,
|
|
4119
4160
|
severity: "error",
|
|
4120
4161
|
category: "logic"
|
|
@@ -5166,6 +5207,14 @@ var FailureConditionEvaluator = class _FailureConditionEvaluator {
|
|
|
5166
5207
|
*/
|
|
5167
5208
|
buildEvaluationContext(checkName, checkSchema, checkGroup, reviewSummary, previousOutputs) {
|
|
5168
5209
|
const { issues, debug } = reviewSummary;
|
|
5210
|
+
const reviewSummaryWithOutput = reviewSummary;
|
|
5211
|
+
const {
|
|
5212
|
+
output: extractedOutput,
|
|
5213
|
+
// Exclude issues from otherFields since we handle it separately
|
|
5214
|
+
issues: _issues,
|
|
5215
|
+
// eslint-disable-line @typescript-eslint/no-unused-vars
|
|
5216
|
+
...otherFields
|
|
5217
|
+
} = reviewSummaryWithOutput;
|
|
5169
5218
|
const context = {
|
|
5170
5219
|
output: {
|
|
5171
5220
|
issues: (issues || []).map((issue) => ({
|
|
@@ -5182,9 +5231,9 @@ var FailureConditionEvaluator = class _FailureConditionEvaluator {
|
|
|
5182
5231
|
replacement: issue.replacement
|
|
5183
5232
|
})),
|
|
5184
5233
|
// Include additional schema-specific data from reviewSummary
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5234
|
+
...otherFields,
|
|
5235
|
+
// Spread the extracted output directly (avoid output.output nesting)
|
|
5236
|
+
...extractedOutput && typeof extractedOutput === "object" ? extractedOutput : {}
|
|
5188
5237
|
},
|
|
5189
5238
|
outputs: (() => {
|
|
5190
5239
|
if (!previousOutputs) return {};
|
|
@@ -6600,6 +6649,31 @@ ${expr}
|
|
|
6600
6649
|
};
|
|
6601
6650
|
providerConfig.forEach = checkConfig.forEach;
|
|
6602
6651
|
const result = await provider.execute(prInfo, providerConfig);
|
|
6652
|
+
if (checkConfig.forEach && (!result.issues || result.issues.length === 0)) {
|
|
6653
|
+
const reviewSummaryWithOutput = result;
|
|
6654
|
+
const validation = this.validateAndNormalizeForEachOutput(
|
|
6655
|
+
checkName,
|
|
6656
|
+
reviewSummaryWithOutput.output,
|
|
6657
|
+
checkConfig.group
|
|
6658
|
+
);
|
|
6659
|
+
if (!validation.isValid) {
|
|
6660
|
+
return validation.error;
|
|
6661
|
+
}
|
|
6662
|
+
}
|
|
6663
|
+
if (config && (config.fail_if || checkConfig.fail_if)) {
|
|
6664
|
+
const failureResults = await this.evaluateFailureConditions(checkName, result, config);
|
|
6665
|
+
if (failureResults.length > 0) {
|
|
6666
|
+
const failureIssues = failureResults.filter((f) => f.failed).map((f) => ({
|
|
6667
|
+
file: "system",
|
|
6668
|
+
line: 0,
|
|
6669
|
+
ruleId: f.conditionName,
|
|
6670
|
+
message: f.message || `Failure condition met: ${f.expression}`,
|
|
6671
|
+
severity: f.severity || "error",
|
|
6672
|
+
category: "logic"
|
|
6673
|
+
}));
|
|
6674
|
+
result.issues = [...result.issues || [], ...failureIssues];
|
|
6675
|
+
}
|
|
6676
|
+
}
|
|
6603
6677
|
const content = await this.renderCheckContent(checkName, result, checkConfig, prInfo);
|
|
6604
6678
|
return {
|
|
6605
6679
|
checkName,
|
|
@@ -6610,6 +6684,53 @@ ${expr}
|
|
|
6610
6684
|
// Include structured issues
|
|
6611
6685
|
};
|
|
6612
6686
|
}
|
|
6687
|
+
/**
|
|
6688
|
+
* Validate and normalize forEach output
|
|
6689
|
+
* Returns normalized array or throws validation error result
|
|
6690
|
+
*/
|
|
6691
|
+
validateAndNormalizeForEachOutput(checkName, output, checkGroup) {
|
|
6692
|
+
if (output === void 0) {
|
|
6693
|
+
logger.error(`\u2717 forEach check "${checkName}" produced undefined output`);
|
|
6694
|
+
return {
|
|
6695
|
+
isValid: false,
|
|
6696
|
+
error: {
|
|
6697
|
+
checkName,
|
|
6698
|
+
content: "",
|
|
6699
|
+
group: checkGroup || "default",
|
|
6700
|
+
issues: [
|
|
6701
|
+
{
|
|
6702
|
+
file: "system",
|
|
6703
|
+
line: 0,
|
|
6704
|
+
ruleId: "forEach/undefined_output",
|
|
6705
|
+
message: `forEach check "${checkName}" produced undefined output. Verify your command outputs valid data and your transform_js returns a value.`,
|
|
6706
|
+
severity: "error",
|
|
6707
|
+
category: "logic"
|
|
6708
|
+
}
|
|
6709
|
+
]
|
|
6710
|
+
}
|
|
6711
|
+
};
|
|
6712
|
+
}
|
|
6713
|
+
let normalizedOutput;
|
|
6714
|
+
if (Array.isArray(output)) {
|
|
6715
|
+
normalizedOutput = output;
|
|
6716
|
+
} else if (typeof output === "string") {
|
|
6717
|
+
try {
|
|
6718
|
+
const parsed = JSON.parse(output);
|
|
6719
|
+
normalizedOutput = Array.isArray(parsed) ? parsed : [parsed];
|
|
6720
|
+
} catch {
|
|
6721
|
+
normalizedOutput = [output];
|
|
6722
|
+
}
|
|
6723
|
+
} else if (output === null) {
|
|
6724
|
+
normalizedOutput = [];
|
|
6725
|
+
} else {
|
|
6726
|
+
normalizedOutput = [output];
|
|
6727
|
+
}
|
|
6728
|
+
logger.info(` Found ${normalizedOutput.length} items for forEach iteration`);
|
|
6729
|
+
return {
|
|
6730
|
+
isValid: true,
|
|
6731
|
+
normalizedOutput
|
|
6732
|
+
};
|
|
6733
|
+
}
|
|
6613
6734
|
/**
|
|
6614
6735
|
* Execute multiple checks with dependency awareness - return grouped results with statistics
|
|
6615
6736
|
*/
|
|
@@ -6819,10 +6940,14 @@ ${expr}
|
|
|
6819
6940
|
const checkConfig = config.checks[checkName];
|
|
6820
6941
|
if (checkConfig) {
|
|
6821
6942
|
dependencies[checkName] = checkConfig.depends_on || [];
|
|
6822
|
-
if (checkConfig.reuse_ai_session
|
|
6943
|
+
if (checkConfig.reuse_ai_session) {
|
|
6823
6944
|
sessionReuseChecks.add(checkName);
|
|
6824
|
-
if (
|
|
6825
|
-
sessionProviders.set(checkName, checkConfig.
|
|
6945
|
+
if (typeof checkConfig.reuse_ai_session === "string") {
|
|
6946
|
+
sessionProviders.set(checkName, checkConfig.reuse_ai_session);
|
|
6947
|
+
} else if (checkConfig.reuse_ai_session === true) {
|
|
6948
|
+
if (checkConfig.depends_on && checkConfig.depends_on.length > 0) {
|
|
6949
|
+
sessionProviders.set(checkName, checkConfig.depends_on[0]);
|
|
6950
|
+
}
|
|
6826
6951
|
}
|
|
6827
6952
|
}
|
|
6828
6953
|
} else {
|
|
@@ -7385,27 +7510,23 @@ ${expr}
|
|
|
7385
7510
|
}
|
|
7386
7511
|
const reviewResult = result.value.result;
|
|
7387
7512
|
const reviewSummaryWithOutput = reviewResult;
|
|
7388
|
-
if (checkConfig?.forEach &&
|
|
7513
|
+
if (checkConfig?.forEach && (!reviewResult.issues || reviewResult.issues.length === 0)) {
|
|
7514
|
+
const validation2 = this.validateAndNormalizeForEachOutput(
|
|
7515
|
+
checkName,
|
|
7516
|
+
reviewSummaryWithOutput.output,
|
|
7517
|
+
checkConfig.group
|
|
7518
|
+
);
|
|
7519
|
+
if (!validation2.isValid) {
|
|
7520
|
+
results.set(
|
|
7521
|
+
checkName,
|
|
7522
|
+
validation2.error.issues ? { issues: validation2.error.issues } : {}
|
|
7523
|
+
);
|
|
7524
|
+
continue;
|
|
7525
|
+
}
|
|
7526
|
+
const normalizedOutput = validation2.normalizedOutput;
|
|
7389
7527
|
logger.debug(
|
|
7390
7528
|
`\u{1F527} Debug: Raw output for forEach check ${checkName}: ${Array.isArray(reviewSummaryWithOutput.output) ? `array(${reviewSummaryWithOutput.output.length})` : typeof reviewSummaryWithOutput.output}`
|
|
7391
7529
|
);
|
|
7392
|
-
const rawOutput = reviewSummaryWithOutput.output;
|
|
7393
|
-
let normalizedOutput;
|
|
7394
|
-
if (Array.isArray(rawOutput)) {
|
|
7395
|
-
normalizedOutput = rawOutput;
|
|
7396
|
-
} else if (typeof rawOutput === "string") {
|
|
7397
|
-
try {
|
|
7398
|
-
const parsed = JSON.parse(rawOutput);
|
|
7399
|
-
normalizedOutput = Array.isArray(parsed) ? parsed : [parsed];
|
|
7400
|
-
} catch {
|
|
7401
|
-
normalizedOutput = [rawOutput];
|
|
7402
|
-
}
|
|
7403
|
-
} else if (rawOutput === void 0 || rawOutput === null) {
|
|
7404
|
-
normalizedOutput = [];
|
|
7405
|
-
} else {
|
|
7406
|
-
normalizedOutput = [rawOutput];
|
|
7407
|
-
}
|
|
7408
|
-
logger.info(` Found ${normalizedOutput.length} items for forEach iteration`);
|
|
7409
7530
|
try {
|
|
7410
7531
|
const preview = JSON.stringify(normalizedOutput);
|
|
7411
7532
|
logger.debug(
|
|
@@ -8648,4 +8769,4 @@ export {
|
|
|
8648
8769
|
logger,
|
|
8649
8770
|
CheckExecutionEngine
|
|
8650
8771
|
};
|
|
8651
|
-
//# sourceMappingURL=chunk-
|
|
8772
|
+
//# sourceMappingURL=chunk-Q55L5EPS.mjs.map
|