@probelabs/visor 0.1.83 → 0.1.85
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/README.md +1 -1
- 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 +2 -2
- package/dist/generated/config-schema.json +5 -2
- package/dist/index.js +39741 -36629
- 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-47X4MPHW.mjs → check-execution-engine-X7VCV6KI.mjs} +2 -2
- package/dist/sdk/{chunk-ROXFJUTY.mjs → chunk-Q55L5EPS.mjs} +123 -27
- package/dist/sdk/chunk-Q55L5EPS.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +2 -2
- package/dist/sdk/sdk.d.ts +2 -2
- package/dist/sdk/sdk.js +138 -31
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +18 -7
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/sdk/chunk-ROXFJUTY.mjs.map +0 -1
- /package/dist/sdk/{check-execution-engine-47X4MPHW.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,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;IAuXzB,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"}
|
package/dist/sdk/{check-execution-engine-47X4MPHW.mjs → check-execution-engine-X7VCV6KI.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CheckExecutionEngine
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Q55L5EPS.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-
|
|
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 {
|
|
@@ -5191,6 +5207,14 @@ var FailureConditionEvaluator = class _FailureConditionEvaluator {
|
|
|
5191
5207
|
*/
|
|
5192
5208
|
buildEvaluationContext(checkName, checkSchema, checkGroup, reviewSummary, previousOutputs) {
|
|
5193
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;
|
|
5194
5218
|
const context = {
|
|
5195
5219
|
output: {
|
|
5196
5220
|
issues: (issues || []).map((issue) => ({
|
|
@@ -5207,9 +5231,9 @@ var FailureConditionEvaluator = class _FailureConditionEvaluator {
|
|
|
5207
5231
|
replacement: issue.replacement
|
|
5208
5232
|
})),
|
|
5209
5233
|
// Include additional schema-specific data from reviewSummary
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5234
|
+
...otherFields,
|
|
5235
|
+
// Spread the extracted output directly (avoid output.output nesting)
|
|
5236
|
+
...extractedOutput && typeof extractedOutput === "object" ? extractedOutput : {}
|
|
5213
5237
|
},
|
|
5214
5238
|
outputs: (() => {
|
|
5215
5239
|
if (!previousOutputs) return {};
|
|
@@ -6625,6 +6649,31 @@ ${expr}
|
|
|
6625
6649
|
};
|
|
6626
6650
|
providerConfig.forEach = checkConfig.forEach;
|
|
6627
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
|
+
}
|
|
6628
6677
|
const content = await this.renderCheckContent(checkName, result, checkConfig, prInfo);
|
|
6629
6678
|
return {
|
|
6630
6679
|
checkName,
|
|
@@ -6635,6 +6684,53 @@ ${expr}
|
|
|
6635
6684
|
// Include structured issues
|
|
6636
6685
|
};
|
|
6637
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
|
+
}
|
|
6638
6734
|
/**
|
|
6639
6735
|
* Execute multiple checks with dependency awareness - return grouped results with statistics
|
|
6640
6736
|
*/
|
|
@@ -6844,10 +6940,14 @@ ${expr}
|
|
|
6844
6940
|
const checkConfig = config.checks[checkName];
|
|
6845
6941
|
if (checkConfig) {
|
|
6846
6942
|
dependencies[checkName] = checkConfig.depends_on || [];
|
|
6847
|
-
if (checkConfig.reuse_ai_session
|
|
6943
|
+
if (checkConfig.reuse_ai_session) {
|
|
6848
6944
|
sessionReuseChecks.add(checkName);
|
|
6849
|
-
if (
|
|
6850
|
-
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
|
+
}
|
|
6851
6951
|
}
|
|
6852
6952
|
}
|
|
6853
6953
|
} else {
|
|
@@ -7410,27 +7510,23 @@ ${expr}
|
|
|
7410
7510
|
}
|
|
7411
7511
|
const reviewResult = result.value.result;
|
|
7412
7512
|
const reviewSummaryWithOutput = reviewResult;
|
|
7413
|
-
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;
|
|
7414
7527
|
logger.debug(
|
|
7415
7528
|
`\u{1F527} Debug: Raw output for forEach check ${checkName}: ${Array.isArray(reviewSummaryWithOutput.output) ? `array(${reviewSummaryWithOutput.output.length})` : typeof reviewSummaryWithOutput.output}`
|
|
7416
7529
|
);
|
|
7417
|
-
const rawOutput = reviewSummaryWithOutput.output;
|
|
7418
|
-
let normalizedOutput;
|
|
7419
|
-
if (Array.isArray(rawOutput)) {
|
|
7420
|
-
normalizedOutput = rawOutput;
|
|
7421
|
-
} else if (typeof rawOutput === "string") {
|
|
7422
|
-
try {
|
|
7423
|
-
const parsed = JSON.parse(rawOutput);
|
|
7424
|
-
normalizedOutput = Array.isArray(parsed) ? parsed : [parsed];
|
|
7425
|
-
} catch {
|
|
7426
|
-
normalizedOutput = [rawOutput];
|
|
7427
|
-
}
|
|
7428
|
-
} else if (rawOutput === void 0 || rawOutput === null) {
|
|
7429
|
-
normalizedOutput = [];
|
|
7430
|
-
} else {
|
|
7431
|
-
normalizedOutput = [rawOutput];
|
|
7432
|
-
}
|
|
7433
|
-
logger.info(` Found ${normalizedOutput.length} items for forEach iteration`);
|
|
7434
7530
|
try {
|
|
7435
7531
|
const preview = JSON.stringify(normalizedOutput);
|
|
7436
7532
|
logger.debug(
|
|
@@ -8673,4 +8769,4 @@ export {
|
|
|
8673
8769
|
logger,
|
|
8674
8770
|
CheckExecutionEngine
|
|
8675
8771
|
};
|
|
8676
|
-
//# sourceMappingURL=chunk-
|
|
8772
|
+
//# sourceMappingURL=chunk-Q55L5EPS.mjs.map
|