@probelabs/visor 0.1.93 → 0.1.94
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 +5 -0
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/config.d.ts +3 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.js +176 -24
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/providers/log-check-provider.d.ts.map +1 -1
- package/dist/providers/memory-check-provider.d.ts.map +1 -1
- package/dist/reviewer.d.ts +8 -0
- package/dist/reviewer.d.ts.map +1 -1
- package/dist/sdk/{check-execution-engine-RORGGGGP.mjs → check-execution-engine-YBRPVUWD.mjs} +2 -2
- package/dist/sdk/{chunk-Z47UECAT.mjs → chunk-DQRFOQAP.mjs} +136 -19
- package/dist/sdk/chunk-DQRFOQAP.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +11 -2
- package/dist/sdk/sdk.d.ts +11 -2
- package/dist/sdk/sdk.js +168 -22
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +35 -6
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/sdk.d.ts +11 -2
- package/dist/sdk.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/sdk/chunk-Z47UECAT.mjs.map +0 -1
- /package/dist/sdk/{check-execution-engine-RORGGGGP.mjs.map → check-execution-engine-YBRPVUWD.mjs.map} +0 -0
- /package/dist/traces/{run-2025-10-15T11-54-04-087Z.ndjson → run-2025-10-16T11-33-32-682Z.ndjson} +0 -0
- /package/dist/traces/{run-2025-10-15T11-54-14-046Z.ndjson → run-2025-10-16T11-33-43-618Z.ndjson} +0 -0
- /package/dist/traces/{run-2025-10-15T11-54-14-575Z.ndjson → run-2025-10-16T11-33-44-157Z.ndjson} +0 -0
- /package/dist/traces/{run-2025-10-15T11-54-15-082Z.ndjson → run-2025-10-16T11-33-44-647Z.ndjson} +0 -0
- /package/dist/traces/{run-2025-10-15T11-54-15-561Z.ndjson → run-2025-10-16T11-33-45-128Z.ndjson} +0 -0
|
@@ -2178,7 +2178,7 @@ var PRReviewer = class {
|
|
|
2178
2178
|
async reviewPR(owner, repo, prNumber, prInfo, options = {}) {
|
|
2179
2179
|
const { debug = false, config, checks } = options;
|
|
2180
2180
|
if (config && checks && checks.length > 0) {
|
|
2181
|
-
const { CheckExecutionEngine: CheckExecutionEngine2 } = await import("./check-execution-engine-
|
|
2181
|
+
const { CheckExecutionEngine: CheckExecutionEngine2 } = await import("./check-execution-engine-YBRPVUWD.mjs");
|
|
2182
2182
|
const engine = new CheckExecutionEngine2();
|
|
2183
2183
|
const { results } = await engine.executeGroupedChecks(
|
|
2184
2184
|
prInfo,
|
|
@@ -2197,14 +2197,66 @@ var PRReviewer = class {
|
|
|
2197
2197
|
"No configuration provided. Please create a .visor.yaml file with check definitions. Built-in prompts have been removed - all checks must be explicitly configured."
|
|
2198
2198
|
);
|
|
2199
2199
|
}
|
|
2200
|
+
/**
|
|
2201
|
+
* Helper to check if a schema definition has a "text" field in its properties
|
|
2202
|
+
*/
|
|
2203
|
+
async schemaHasTextField(schema) {
|
|
2204
|
+
try {
|
|
2205
|
+
let schemaObj;
|
|
2206
|
+
if (typeof schema === "object") {
|
|
2207
|
+
schemaObj = schema;
|
|
2208
|
+
} else {
|
|
2209
|
+
const fs5 = __require("fs").promises;
|
|
2210
|
+
const path5 = __require("path");
|
|
2211
|
+
const sanitizedSchemaName = schema.replace(/[^a-zA-Z0-9-]/g, "");
|
|
2212
|
+
if (!sanitizedSchemaName || sanitizedSchemaName !== schema) {
|
|
2213
|
+
return false;
|
|
2214
|
+
}
|
|
2215
|
+
const schemaPath = path5.join(process.cwd(), "output", sanitizedSchemaName, "schema.json");
|
|
2216
|
+
try {
|
|
2217
|
+
const schemaContent = await fs5.readFile(schemaPath, "utf-8");
|
|
2218
|
+
schemaObj = JSON.parse(schemaContent);
|
|
2219
|
+
} catch {
|
|
2220
|
+
return false;
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
const properties = schemaObj.properties;
|
|
2224
|
+
return !!(properties && "text" in properties);
|
|
2225
|
+
} catch {
|
|
2226
|
+
return false;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
/**
|
|
2230
|
+
* Filter check results to only include those that should post GitHub comments
|
|
2231
|
+
*/
|
|
2232
|
+
async filterCommentGeneratingChecks(checkResults, config) {
|
|
2233
|
+
const filtered = [];
|
|
2234
|
+
for (const r of checkResults) {
|
|
2235
|
+
const cfg = config.checks?.[r.checkName];
|
|
2236
|
+
const type = cfg?.type || "ai";
|
|
2237
|
+
const schema = cfg?.schema;
|
|
2238
|
+
let shouldPostComment = false;
|
|
2239
|
+
const isAICheck = type === "ai" || type === "claude-code";
|
|
2240
|
+
if (!schema || schema === "") {
|
|
2241
|
+
shouldPostComment = isAICheck;
|
|
2242
|
+
} else if (typeof schema === "string") {
|
|
2243
|
+
if (schema === "text" || schema === "plain") {
|
|
2244
|
+
shouldPostComment = true;
|
|
2245
|
+
} else {
|
|
2246
|
+
shouldPostComment = await this.schemaHasTextField(schema);
|
|
2247
|
+
}
|
|
2248
|
+
} else if (typeof schema === "object") {
|
|
2249
|
+
shouldPostComment = await this.schemaHasTextField(schema);
|
|
2250
|
+
}
|
|
2251
|
+
if (shouldPostComment) {
|
|
2252
|
+
filtered.push(r);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
return filtered;
|
|
2256
|
+
}
|
|
2200
2257
|
async postReviewComment(owner, repo, prNumber, groupedResults, options = {}) {
|
|
2201
2258
|
for (const [groupName, checkResults] of Object.entries(groupedResults)) {
|
|
2202
|
-
const filteredResults = options.config ? checkResults.
|
|
2203
|
-
const cfg = options.config.checks?.[r.checkName];
|
|
2204
|
-
const t = cfg?.type || "";
|
|
2205
|
-
const isGitHubOps = t === "github" || r.group === "github" || t === "noop" || t === "command";
|
|
2206
|
-
return !isGitHubOps;
|
|
2207
|
-
}) : checkResults;
|
|
2259
|
+
const filteredResults = options.config ? await this.filterCommentGeneratingChecks(checkResults, options.config) : checkResults;
|
|
2208
2260
|
if (!filteredResults || filteredResults.length === 0) {
|
|
2209
2261
|
continue;
|
|
2210
2262
|
}
|
|
@@ -4167,7 +4219,8 @@ var LogCheckProvider = class extends CheckProvider {
|
|
|
4167
4219
|
dependencyResults,
|
|
4168
4220
|
includePrContext,
|
|
4169
4221
|
includeDependencies,
|
|
4170
|
-
includeMetadata
|
|
4222
|
+
includeMetadata,
|
|
4223
|
+
config.__outputHistory
|
|
4171
4224
|
);
|
|
4172
4225
|
const renderedMessage = await this.liquid.parseAndRender(message, templateContext);
|
|
4173
4226
|
const logOutput = this.formatLogOutput(
|
|
@@ -4188,7 +4241,7 @@ var LogCheckProvider = class extends CheckProvider {
|
|
|
4188
4241
|
logOutput
|
|
4189
4242
|
};
|
|
4190
4243
|
}
|
|
4191
|
-
buildTemplateContext(prInfo, dependencyResults, _includePrContext = true, _includeDependencies = true, includeMetadata = true) {
|
|
4244
|
+
buildTemplateContext(prInfo, dependencyResults, _includePrContext = true, _includeDependencies = true, includeMetadata = true, outputHistory) {
|
|
4192
4245
|
const context = {};
|
|
4193
4246
|
context.pr = {
|
|
4194
4247
|
number: prInfo.number,
|
|
@@ -4212,6 +4265,7 @@ var LogCheckProvider = class extends CheckProvider {
|
|
|
4212
4265
|
if (dependencyResults) {
|
|
4213
4266
|
const dependencies = {};
|
|
4214
4267
|
const outputs = {};
|
|
4268
|
+
const history = {};
|
|
4215
4269
|
context.dependencyCount = dependencyResults.size;
|
|
4216
4270
|
for (const [checkName, result] of dependencyResults.entries()) {
|
|
4217
4271
|
dependencies[checkName] = {
|
|
@@ -4222,6 +4276,12 @@ var LogCheckProvider = class extends CheckProvider {
|
|
|
4222
4276
|
const summary = result;
|
|
4223
4277
|
outputs[checkName] = summary.output !== void 0 ? summary.output : summary;
|
|
4224
4278
|
}
|
|
4279
|
+
if (outputHistory) {
|
|
4280
|
+
for (const [checkName, historyArray] of outputHistory) {
|
|
4281
|
+
history[checkName] = historyArray;
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
outputs.history = history;
|
|
4225
4285
|
context.dependencies = dependencies;
|
|
4226
4286
|
context.outputs = outputs;
|
|
4227
4287
|
}
|
|
@@ -5093,7 +5153,10 @@ var CommandCheckProvider = class extends CheckProvider {
|
|
|
5093
5153
|
},
|
|
5094
5154
|
files: prInfo.files,
|
|
5095
5155
|
fileCount: prInfo.files.length,
|
|
5096
|
-
outputs: this.buildOutputContext(
|
|
5156
|
+
outputs: this.buildOutputContext(
|
|
5157
|
+
dependencyResults,
|
|
5158
|
+
config.__outputHistory
|
|
5159
|
+
),
|
|
5097
5160
|
env: this.getSafeEnvironmentVariables()
|
|
5098
5161
|
};
|
|
5099
5162
|
logger.debug(
|
|
@@ -5819,16 +5882,23 @@ ${stderrOutput}` : `Command execution failed: ${errorMessage}`;
|
|
|
5819
5882
|
};
|
|
5820
5883
|
}
|
|
5821
5884
|
}
|
|
5822
|
-
buildOutputContext(dependencyResults) {
|
|
5885
|
+
buildOutputContext(dependencyResults, outputHistory) {
|
|
5823
5886
|
if (!dependencyResults) {
|
|
5824
5887
|
return {};
|
|
5825
5888
|
}
|
|
5826
5889
|
const outputs = {};
|
|
5890
|
+
const history = {};
|
|
5827
5891
|
for (const [checkName, result] of dependencyResults) {
|
|
5828
5892
|
const summary = result;
|
|
5829
5893
|
const value = summary.output !== void 0 ? summary.output : summary;
|
|
5830
5894
|
outputs[checkName] = this.makeJsonSmart(value);
|
|
5831
5895
|
}
|
|
5896
|
+
if (outputHistory) {
|
|
5897
|
+
for (const [checkName, historyArray] of outputHistory) {
|
|
5898
|
+
history[checkName] = historyArray.map((val) => this.makeJsonSmart(val));
|
|
5899
|
+
}
|
|
5900
|
+
}
|
|
5901
|
+
outputs.history = history;
|
|
5832
5902
|
return outputs;
|
|
5833
5903
|
}
|
|
5834
5904
|
/**
|
|
@@ -6377,7 +6447,12 @@ var MemoryCheckProvider = class extends CheckProvider {
|
|
|
6377
6447
|
const key = config.key;
|
|
6378
6448
|
const namespace = config.namespace;
|
|
6379
6449
|
const memoryStore = MemoryStore.getInstance();
|
|
6380
|
-
const templateContext = this.buildTemplateContext(
|
|
6450
|
+
const templateContext = this.buildTemplateContext(
|
|
6451
|
+
prInfo,
|
|
6452
|
+
dependencyResults,
|
|
6453
|
+
memoryStore,
|
|
6454
|
+
config.__outputHistory
|
|
6455
|
+
);
|
|
6381
6456
|
let result;
|
|
6382
6457
|
try {
|
|
6383
6458
|
switch (operation) {
|
|
@@ -6660,7 +6735,7 @@ var MemoryCheckProvider = class extends CheckProvider {
|
|
|
6660
6735
|
/**
|
|
6661
6736
|
* Build template context for Liquid and JS evaluation
|
|
6662
6737
|
*/
|
|
6663
|
-
buildTemplateContext(prInfo, dependencyResults, memoryStore) {
|
|
6738
|
+
buildTemplateContext(prInfo, dependencyResults, memoryStore, outputHistory) {
|
|
6664
6739
|
const context = {};
|
|
6665
6740
|
context.pr = {
|
|
6666
6741
|
number: prInfo.number,
|
|
@@ -6679,14 +6754,21 @@ var MemoryCheckProvider = class extends CheckProvider {
|
|
|
6679
6754
|
changes: f.changes
|
|
6680
6755
|
}))
|
|
6681
6756
|
};
|
|
6757
|
+
const outputs = {};
|
|
6758
|
+
const history = {};
|
|
6682
6759
|
if (dependencyResults) {
|
|
6683
|
-
const outputs = {};
|
|
6684
6760
|
for (const [checkName, result] of dependencyResults.entries()) {
|
|
6685
6761
|
const summary = result;
|
|
6686
6762
|
outputs[checkName] = summary.output !== void 0 ? summary.output : summary;
|
|
6687
6763
|
}
|
|
6688
|
-
context.outputs = outputs;
|
|
6689
6764
|
}
|
|
6765
|
+
if (outputHistory) {
|
|
6766
|
+
for (const [checkName, historyArray] of outputHistory) {
|
|
6767
|
+
history[checkName] = historyArray;
|
|
6768
|
+
}
|
|
6769
|
+
}
|
|
6770
|
+
outputs.history = history;
|
|
6771
|
+
context.outputs = outputs;
|
|
6690
6772
|
if (memoryStore) {
|
|
6691
6773
|
context.memory = {
|
|
6692
6774
|
get: (key, ns) => memoryStore.get(key, ns),
|
|
@@ -8263,6 +8345,8 @@ var CheckExecutionEngine = class _CheckExecutionEngine {
|
|
|
8263
8345
|
webhookContext;
|
|
8264
8346
|
routingSandbox;
|
|
8265
8347
|
executionStats = /* @__PURE__ */ new Map();
|
|
8348
|
+
// Track history of all outputs for each check (useful for loops and goto)
|
|
8349
|
+
outputHistory = /* @__PURE__ */ new Map();
|
|
8266
8350
|
// Event override to simulate alternate event (used during routing goto)
|
|
8267
8351
|
routingEventOverride;
|
|
8268
8352
|
// Cached GitHub context for context elevation when running in Actions
|
|
@@ -8506,6 +8590,8 @@ ${expr}
|
|
|
8506
8590
|
transform_js: targetCfg.transform_js,
|
|
8507
8591
|
env: targetCfg.env,
|
|
8508
8592
|
forEach: targetCfg.forEach,
|
|
8593
|
+
// Pass output history for loop/goto scenarios
|
|
8594
|
+
__outputHistory: this.outputHistory,
|
|
8509
8595
|
// Include provider-specific keys (e.g., op/values for github)
|
|
8510
8596
|
...targetCfg,
|
|
8511
8597
|
ai: {
|
|
@@ -8573,6 +8659,10 @@ ${expr}
|
|
|
8573
8659
|
timestamp: Date.now()
|
|
8574
8660
|
}));
|
|
8575
8661
|
const enriched = { ...r, issues: enrichedIssues };
|
|
8662
|
+
const enrichedWithOutput = enriched;
|
|
8663
|
+
if (enrichedWithOutput.output !== void 0) {
|
|
8664
|
+
this.trackOutputHistory(target, enrichedWithOutput.output);
|
|
8665
|
+
}
|
|
8576
8666
|
resultsMap?.set(target, enriched);
|
|
8577
8667
|
if (debug) log2(`\u{1F527} Debug: inline executed '${target}', issues: ${enrichedIssues.length}`);
|
|
8578
8668
|
return enriched;
|
|
@@ -9341,6 +9431,8 @@ ${expr}
|
|
|
9341
9431
|
ai_model: checkConfig.ai_model || config.ai_model,
|
|
9342
9432
|
// Pass claude_code config if present
|
|
9343
9433
|
claude_code: checkConfig.claude_code,
|
|
9434
|
+
// Pass output history for loop/goto scenarios
|
|
9435
|
+
__outputHistory: this.outputHistory,
|
|
9344
9436
|
// Pass any provider-specific config
|
|
9345
9437
|
...checkConfig
|
|
9346
9438
|
};
|
|
@@ -9377,10 +9469,14 @@ ${expr}
|
|
|
9377
9469
|
}
|
|
9378
9470
|
}
|
|
9379
9471
|
const content = await this.renderCheckContent(checkName, result, checkConfig, prInfo);
|
|
9472
|
+
let group = checkConfig.group || "default";
|
|
9473
|
+
if (config?.output?.pr_comment?.group_by === "check" && !checkConfig.group) {
|
|
9474
|
+
group = checkName;
|
|
9475
|
+
}
|
|
9380
9476
|
return {
|
|
9381
9477
|
checkName,
|
|
9382
9478
|
content,
|
|
9383
|
-
group
|
|
9479
|
+
group,
|
|
9384
9480
|
output: result.output,
|
|
9385
9481
|
debug: result.debug,
|
|
9386
9482
|
issues: result.issues
|
|
@@ -9519,16 +9615,19 @@ ${expr}
|
|
|
9519
9615
|
}
|
|
9520
9616
|
];
|
|
9521
9617
|
}
|
|
9618
|
+
let group = checkConfig.group || "default";
|
|
9619
|
+
if (config?.output?.pr_comment?.group_by === "check" && !checkConfig.group) {
|
|
9620
|
+
group = checkName;
|
|
9621
|
+
}
|
|
9522
9622
|
const checkResult = {
|
|
9523
9623
|
checkName,
|
|
9524
9624
|
content,
|
|
9525
|
-
group
|
|
9625
|
+
group,
|
|
9526
9626
|
output: checkSummary.output,
|
|
9527
9627
|
debug: reviewSummary.debug,
|
|
9528
9628
|
issues: issuesForCheck
|
|
9529
9629
|
// Include structured issues + rendering error if any
|
|
9530
9630
|
};
|
|
9531
|
-
const group = checkResult.group;
|
|
9532
9631
|
if (!groupedResults[group]) {
|
|
9533
9632
|
groupedResults[group] = [];
|
|
9534
9633
|
}
|
|
@@ -10429,6 +10528,10 @@ ${expr}
|
|
|
10429
10528
|
itemResult.issues || [],
|
|
10430
10529
|
itemResult.output
|
|
10431
10530
|
);
|
|
10531
|
+
const itemOutput = itemResult.output;
|
|
10532
|
+
if (itemOutput !== void 0) {
|
|
10533
|
+
this.trackOutputHistory(checkName, itemOutput);
|
|
10534
|
+
}
|
|
10432
10535
|
const descendantSet = (() => {
|
|
10433
10536
|
const visited = /* @__PURE__ */ new Set();
|
|
10434
10537
|
const stack = [checkName];
|
|
@@ -11059,6 +11162,10 @@ ${error.stack || ""}` : String(error);
|
|
|
11059
11162
|
]);
|
|
11060
11163
|
} catch {
|
|
11061
11164
|
}
|
|
11165
|
+
const reviewResultWithOutput = reviewResult;
|
|
11166
|
+
if (reviewResultWithOutput.output !== void 0) {
|
|
11167
|
+
this.trackOutputHistory(checkName, reviewResultWithOutput.output);
|
|
11168
|
+
}
|
|
11062
11169
|
results.set(checkName, reviewResult);
|
|
11063
11170
|
} else {
|
|
11064
11171
|
const errorSummary = {
|
|
@@ -12302,6 +12409,16 @@ ${result.value.result.debug.rawResponse}`;
|
|
|
12302
12409
|
stats.outputsProduced = (stats.outputsProduced || 0) + 1;
|
|
12303
12410
|
}
|
|
12304
12411
|
}
|
|
12412
|
+
/**
|
|
12413
|
+
* Track output in history for loop/goto scenarios
|
|
12414
|
+
*/
|
|
12415
|
+
trackOutputHistory(checkName, output) {
|
|
12416
|
+
if (output === void 0) return;
|
|
12417
|
+
if (!this.outputHistory.has(checkName)) {
|
|
12418
|
+
this.outputHistory.set(checkName, []);
|
|
12419
|
+
}
|
|
12420
|
+
this.outputHistory.get(checkName).push(output);
|
|
12421
|
+
}
|
|
12305
12422
|
/**
|
|
12306
12423
|
* Record that a check was skipped
|
|
12307
12424
|
*/
|
|
@@ -12494,4 +12611,4 @@ ${result.value.result.debug.rawResponse}`;
|
|
|
12494
12611
|
export {
|
|
12495
12612
|
CheckExecutionEngine
|
|
12496
12613
|
};
|
|
12497
|
-
//# sourceMappingURL=chunk-
|
|
12614
|
+
//# sourceMappingURL=chunk-DQRFOQAP.mjs.map
|