@harness-engineering/cli 1.24.1 → 1.24.3
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/{agents-md-MMVRF77L.js → agents-md-PBKKTSQY.js} +1 -1
- package/dist/{architecture-JAEDPYQZ.js → architecture-FBSLURIB.js} +3 -3
- package/dist/{assess-project-7JZCVM7D.js → assess-project-74UVWPMB.js} +1 -1
- package/dist/bin/harness-mcp.js +13 -13
- package/dist/bin/harness.js +18 -17
- package/dist/{check-phase-gate-YQHAH4LL.js → check-phase-gate-WY6UICCL.js} +3 -3
- package/dist/{chunk-MS6KDQW7.js → chunk-3VYWO6QN.js} +6 -6
- package/dist/chunk-3XAPHB2Z.js +43 -0
- package/dist/{chunk-AVVJ5EUU.js → chunk-5PMRARB5.js} +1 -1
- package/dist/{chunk-NU3BPEDR.js → chunk-A737JDL4.js} +2 -2
- package/dist/{chunk-IDZNPTYD.js → chunk-EPUKTTJZ.js} +6 -1
- package/dist/{chunk-2DAMN7ED.js → chunk-FJYP32IV.js} +6 -6
- package/dist/{chunk-PCWYYFBP.js → chunk-H4U2QNY2.js} +32 -6
- package/dist/{chunk-C5FTJ3EU.js → chunk-L5UONZ53.js} +58 -1
- package/dist/{chunk-LY3YVKXL.js → chunk-O6UF33QH.js} +351 -104
- package/dist/{chunk-W2OZK3KC.js → chunk-SPTKLCKC.js} +1 -1
- package/dist/{chunk-TUJAHI22.js → chunk-TB427QOK.js} +5 -5
- package/dist/{chunk-HVFCCARH.js → chunk-UFQQBGC3.js} +1 -1
- package/dist/{chunk-JGMCHJ6B.js → chunk-V2FGX2KD.js} +3 -3
- package/dist/{chunk-JT732X6S.js → chunk-WEN5Z7CL.js} +2 -2
- package/dist/{chunk-BWWNQPPO.js → chunk-YPKKEP3O.js} +4 -4
- package/dist/{chunk-ZKVLBOYA.js → chunk-ZAMT24QN.js} +426 -383
- package/dist/{ci-workflow-HDH4LCOF.js → ci-workflow-QZRHAIO2.js} +1 -1
- package/dist/{dist-TZQUURSP.js → dist-7EBSGAHX.js} +3 -1
- package/dist/{docs-6SPJYTRR.js → docs-H34GBVRS.js} +4 -4
- package/dist/{engine-CSITRE3J.js → engine-VUQEAJFZ.js} +1 -1
- package/dist/{entropy-FZP643BK.js → entropy-ZAY73R6A.js} +3 -3
- package/dist/{feedback-RSPUJCJJ.js → feedback-TMEGYMWU.js} +2 -2
- package/dist/{generate-agent-definitions-OLYWXTYH.js → generate-agent-definitions-PQPG6SX5.js} +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +23 -21
- package/dist/{loader-P2P7CV2A.js → loader-Y6A42WBD.js} +1 -1
- package/dist/{mcp-JZG22CYT.js → mcp-LCHC4NZ5.js} +13 -13
- package/dist/{performance-VVWOIJTE.js → performance-N67YJJDG.js} +4 -4
- package/dist/{review-pipeline-XSRO7HYZ.js → review-pipeline-YXF5ITL2.js} +4 -1
- package/dist/{runtime-VMOIIP6B.js → runtime-XNJUJCSG.js} +1 -1
- package/dist/scan-U67OKDRS.js +8 -0
- package/dist/{security-4AQ46P3H.js → security-L2YN3CTI.js} +1 -1
- package/dist/{validate-T7UTXLEQ.js → validate-MNE25KLZ.js} +2 -2
- package/dist/{validate-cross-check-M4NP2UF5.js → validate-cross-check-Y4PDR63C.js} +1 -1
- package/package.json +5 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
checkDependenciesDefinition,
|
|
3
3
|
handleCheckDependencies
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A737JDL4.js";
|
|
5
5
|
import "./chunk-Q3XYV5UC.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-EPUKTTJZ.js";
|
|
7
7
|
import "./chunk-W6Y7ZW3Y.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-H4U2QNY2.js";
|
|
9
9
|
import "./chunk-5LMZA5LZ.js";
|
|
10
10
|
import "./chunk-OZIHPMA7.js";
|
|
11
11
|
export {
|
package/dist/bin/harness-mcp.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
startServer
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-O6UF33QH.js";
|
|
5
|
+
import "../chunk-YPKKEP3O.js";
|
|
6
|
+
import "../chunk-UFQQBGC3.js";
|
|
7
|
+
import "../chunk-L5UONZ53.js";
|
|
8
|
+
import "../chunk-FJYP32IV.js";
|
|
9
|
+
import "../chunk-WEN5Z7CL.js";
|
|
10
|
+
import "../chunk-A737JDL4.js";
|
|
11
11
|
import "../chunk-Q3XYV5UC.js";
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-TB427QOK.js";
|
|
13
|
+
import "../chunk-V2FGX2KD.js";
|
|
14
|
+
import "../chunk-3VYWO6QN.js";
|
|
15
|
+
import "../chunk-EPUKTTJZ.js";
|
|
16
16
|
import "../chunk-W6Y7ZW3Y.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-5PMRARB5.js";
|
|
18
18
|
import "../chunk-3ISINLYT.js";
|
|
19
19
|
import "../chunk-6B6UN6SG.js";
|
|
20
20
|
import "../chunk-TDLOFNNQ.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-H4U2QNY2.js";
|
|
22
22
|
import "../chunk-5LMZA5LZ.js";
|
|
23
23
|
import "../chunk-OZIHPMA7.js";
|
|
24
24
|
import "../chunk-ZOVATVQC.js";
|
package/dist/bin/harness.js
CHANGED
|
@@ -2,39 +2,40 @@
|
|
|
2
2
|
import {
|
|
3
3
|
createProgram,
|
|
4
4
|
printFirstRunWelcome
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-ZAMT24QN.js";
|
|
6
|
+
import "../chunk-I4QR3HNH.js";
|
|
6
7
|
import "../chunk-LOUH2LIC.js";
|
|
7
8
|
import "../chunk-LVYPPKZI.js";
|
|
9
|
+
import "../chunk-FP53DDB5.js";
|
|
8
10
|
import "../chunk-CQ553GZO.js";
|
|
9
11
|
import "../chunk-LM5Z2WCA.js";
|
|
10
|
-
import "../chunk-I4QR3HNH.js";
|
|
11
12
|
import "../chunk-GISMXMVL.js";
|
|
12
13
|
import "../chunk-UQEUYRBP.js";
|
|
13
14
|
import "../chunk-TEFCFC4H.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-SPTKLCKC.js";
|
|
15
16
|
import "../chunk-NV4FPO7J.js";
|
|
16
17
|
import "../chunk-KET4QQZB.js";
|
|
17
18
|
import "../chunk-YDRB55Q4.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-3XAPHB2Z.js";
|
|
19
20
|
import {
|
|
20
21
|
dispatchSkillsFromGit
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-O6UF33QH.js";
|
|
23
|
+
import "../chunk-YPKKEP3O.js";
|
|
24
|
+
import "../chunk-UFQQBGC3.js";
|
|
25
|
+
import "../chunk-L5UONZ53.js";
|
|
26
|
+
import "../chunk-FJYP32IV.js";
|
|
27
|
+
import "../chunk-WEN5Z7CL.js";
|
|
28
|
+
import "../chunk-A737JDL4.js";
|
|
28
29
|
import "../chunk-Q3XYV5UC.js";
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-
|
|
32
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-TB427QOK.js";
|
|
31
|
+
import "../chunk-V2FGX2KD.js";
|
|
32
|
+
import "../chunk-3VYWO6QN.js";
|
|
33
|
+
import "../chunk-EPUKTTJZ.js";
|
|
33
34
|
import "../chunk-W6Y7ZW3Y.js";
|
|
34
35
|
import {
|
|
35
36
|
findConfigFile,
|
|
36
37
|
loadConfig
|
|
37
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-5PMRARB5.js";
|
|
38
39
|
import "../chunk-3ISINLYT.js";
|
|
39
40
|
import "../chunk-6B6UN6SG.js";
|
|
40
41
|
import "../chunk-TDLOFNNQ.js";
|
|
@@ -47,7 +48,7 @@ import {
|
|
|
47
48
|
readCheckState,
|
|
48
49
|
shouldRunCheck,
|
|
49
50
|
spawnBackgroundCheck
|
|
50
|
-
} from "../chunk-
|
|
51
|
+
} from "../chunk-H4U2QNY2.js";
|
|
51
52
|
import "../chunk-5LMZA5LZ.js";
|
|
52
53
|
import "../chunk-OZIHPMA7.js";
|
|
53
54
|
import "../chunk-XNEMDKV5.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCheckPhaseGateCommand,
|
|
3
3
|
runCheckPhaseGate
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-SPTKLCKC.js";
|
|
5
|
+
import "./chunk-5PMRARB5.js";
|
|
6
|
+
import "./chunk-H4U2QNY2.js";
|
|
7
7
|
import "./chunk-5LMZA5LZ.js";
|
|
8
8
|
import "./chunk-OZIHPMA7.js";
|
|
9
9
|
import "./chunk-EBJQ6N4M.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resultToMcpResponse
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EPUKTTJZ.js";
|
|
4
4
|
import {
|
|
5
5
|
sanitizePath
|
|
6
6
|
} from "./chunk-W6Y7ZW3Y.js";
|
|
7
7
|
import {
|
|
8
8
|
findConfigFile,
|
|
9
9
|
loadConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5PMRARB5.js";
|
|
11
11
|
import {
|
|
12
12
|
Ok
|
|
13
13
|
} from "./chunk-5LMZA5LZ.js";
|
|
@@ -31,7 +31,7 @@ var checkPerformanceDefinition = {
|
|
|
31
31
|
};
|
|
32
32
|
async function handleCheckPerformance(input) {
|
|
33
33
|
try {
|
|
34
|
-
const { EntropyAnalyzer } = await import("./dist-
|
|
34
|
+
const { EntropyAnalyzer } = await import("./dist-7EBSGAHX.js");
|
|
35
35
|
const typeFilter = input.type ?? "all";
|
|
36
36
|
const projectPath = sanitizePath(input.path);
|
|
37
37
|
let entryPoints;
|
|
@@ -94,7 +94,7 @@ var getPerfBaselinesDefinition = {
|
|
|
94
94
|
};
|
|
95
95
|
async function handleGetPerfBaselines(input) {
|
|
96
96
|
try {
|
|
97
|
-
const { BaselineManager } = await import("./dist-
|
|
97
|
+
const { BaselineManager } = await import("./dist-7EBSGAHX.js");
|
|
98
98
|
const manager = new BaselineManager(sanitizePath(input.path));
|
|
99
99
|
const baselines = manager.load();
|
|
100
100
|
return resultToMcpResponse(
|
|
@@ -142,7 +142,7 @@ var updatePerfBaselinesDefinition = {
|
|
|
142
142
|
};
|
|
143
143
|
async function handleUpdatePerfBaselines(input) {
|
|
144
144
|
try {
|
|
145
|
-
const { BaselineManager } = await import("./dist-
|
|
145
|
+
const { BaselineManager } = await import("./dist-7EBSGAHX.js");
|
|
146
146
|
const manager = new BaselineManager(sanitizePath(input.path));
|
|
147
147
|
manager.save(input.results, input.commitHash);
|
|
148
148
|
const updated = manager.load();
|
|
@@ -172,7 +172,7 @@ var getCriticalPathsDefinition = {
|
|
|
172
172
|
};
|
|
173
173
|
async function handleGetCriticalPaths(input) {
|
|
174
174
|
try {
|
|
175
|
-
const { CriticalPathResolver } = await import("./dist-
|
|
175
|
+
const { CriticalPathResolver } = await import("./dist-7EBSGAHX.js");
|
|
176
176
|
const resolver = new CriticalPathResolver(sanitizePath(input.path));
|
|
177
177
|
const result = await resolver.resolve();
|
|
178
178
|
return resultToMcpResponse(Ok(result));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/commands/graph/scan.ts
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
async function runScan(projectPath) {
|
|
5
|
+
const { GraphStore, CodeIngestor, TopologicalLinker, KnowledgeIngestor, GitIngestor } = await import("./dist-QW5G3GX3.js");
|
|
6
|
+
const store = new GraphStore();
|
|
7
|
+
const start = Date.now();
|
|
8
|
+
await new CodeIngestor(store).ingest(projectPath);
|
|
9
|
+
new TopologicalLinker(store).link();
|
|
10
|
+
const knowledgeIngestor = new KnowledgeIngestor(store);
|
|
11
|
+
await knowledgeIngestor.ingestAll(projectPath);
|
|
12
|
+
try {
|
|
13
|
+
await new GitIngestor(store).ingest(projectPath);
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
const graphDir = path.join(projectPath, ".harness", "graph");
|
|
17
|
+
await store.save(graphDir);
|
|
18
|
+
return { nodeCount: store.nodeCount, edgeCount: store.edgeCount, durationMs: Date.now() - start };
|
|
19
|
+
}
|
|
20
|
+
function createScanCommand() {
|
|
21
|
+
return new Command("scan").description("Scan project and build knowledge graph").argument("[path]", "Project root path", ".").action(async (inputPath, _opts, cmd) => {
|
|
22
|
+
const projectPath = path.resolve(inputPath);
|
|
23
|
+
const globalOpts = cmd.optsWithGlobals();
|
|
24
|
+
try {
|
|
25
|
+
const result = await runScan(projectPath);
|
|
26
|
+
if (globalOpts.json) {
|
|
27
|
+
console.log(JSON.stringify(result));
|
|
28
|
+
} else {
|
|
29
|
+
console.log(
|
|
30
|
+
`Graph built: ${result.nodeCount} nodes, ${result.edgeCount} edges (${result.durationMs}ms)`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error("Scan failed:", err instanceof Error ? err.message : err);
|
|
35
|
+
process.exit(2);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
runScan,
|
|
42
|
+
createScanCommand
|
|
43
|
+
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-Q3XYV5UC.js";
|
|
4
4
|
import {
|
|
5
5
|
resultToMcpResponse
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EPUKTTJZ.js";
|
|
7
7
|
import {
|
|
8
8
|
sanitizePath
|
|
9
9
|
} from "./chunk-W6Y7ZW3Y.js";
|
|
@@ -38,7 +38,7 @@ async function handleCheckDependencies(input) {
|
|
|
38
38
|
const configResult = resolveProjectConfig(projectPath);
|
|
39
39
|
if (!configResult.ok) return resultToMcpResponse(configResult);
|
|
40
40
|
try {
|
|
41
|
-
const { validateDependencies, TypeScriptParser } = await import("./dist-
|
|
41
|
+
const { validateDependencies, TypeScriptParser } = await import("./dist-7EBSGAHX.js");
|
|
42
42
|
const config = configResult.value;
|
|
43
43
|
const rawLayers = Array.isArray(config.layers) ? config.layers : [];
|
|
44
44
|
const layers = rawLayers.map((l) => ({
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
function resultToMcpResponse(result) {
|
|
3
3
|
if (result.ok) {
|
|
4
4
|
return {
|
|
5
|
-
content: [
|
|
5
|
+
content: [
|
|
6
|
+
{
|
|
7
|
+
type: "text",
|
|
8
|
+
text: typeof result.value === "string" ? result.value : JSON.stringify(result.value)
|
|
9
|
+
}
|
|
10
|
+
]
|
|
6
11
|
};
|
|
7
12
|
}
|
|
8
13
|
return {
|
|
@@ -50,7 +50,7 @@ async function handleAssessProject(input) {
|
|
|
50
50
|
let validateResult = null;
|
|
51
51
|
if (checksToRun.has("validate")) {
|
|
52
52
|
try {
|
|
53
|
-
const { handleValidateProject } = await import("./validate-
|
|
53
|
+
const { handleValidateProject } = await import("./validate-MNE25KLZ.js");
|
|
54
54
|
const result = await handleValidateProject({ path: projectPath });
|
|
55
55
|
const first = result.content[0];
|
|
56
56
|
const parsed = first ? JSON.parse(first.text) : {};
|
|
@@ -75,7 +75,7 @@ async function handleAssessProject(input) {
|
|
|
75
75
|
parallelChecks.push(
|
|
76
76
|
(async () => {
|
|
77
77
|
try {
|
|
78
|
-
const { handleCheckDependencies } = await import("./architecture-
|
|
78
|
+
const { handleCheckDependencies } = await import("./architecture-FBSLURIB.js");
|
|
79
79
|
const result = await handleCheckDependencies({ path: projectPath });
|
|
80
80
|
const first = result.content[0];
|
|
81
81
|
const parsed = first ? JSON.parse(first.text) : {};
|
|
@@ -102,7 +102,7 @@ async function handleAssessProject(input) {
|
|
|
102
102
|
parallelChecks.push(
|
|
103
103
|
(async () => {
|
|
104
104
|
try {
|
|
105
|
-
const { handleCheckDocs } = await import("./docs-
|
|
105
|
+
const { handleCheckDocs } = await import("./docs-H34GBVRS.js");
|
|
106
106
|
const result = await handleCheckDocs({ path: projectPath, scope: "coverage" });
|
|
107
107
|
const first = result.content[0];
|
|
108
108
|
const parsed = first ? JSON.parse(first.text) : {};
|
|
@@ -129,7 +129,7 @@ async function handleAssessProject(input) {
|
|
|
129
129
|
parallelChecks.push(
|
|
130
130
|
(async () => {
|
|
131
131
|
try {
|
|
132
|
-
const { handleDetectEntropy } = await import("./entropy-
|
|
132
|
+
const { handleDetectEntropy } = await import("./entropy-ZAY73R6A.js");
|
|
133
133
|
const result = await handleDetectEntropy({ path: projectPath, type: "all" });
|
|
134
134
|
const first = result.content[0];
|
|
135
135
|
const parsed = first ? JSON.parse(first.text) : {};
|
|
@@ -156,7 +156,7 @@ async function handleAssessProject(input) {
|
|
|
156
156
|
parallelChecks.push(
|
|
157
157
|
(async () => {
|
|
158
158
|
try {
|
|
159
|
-
const { handleRunSecurityScan } = await import("./security-
|
|
159
|
+
const { handleRunSecurityScan } = await import("./security-L2YN3CTI.js");
|
|
160
160
|
const result = await handleRunSecurityScan({ path: projectPath });
|
|
161
161
|
const first = result.content[0];
|
|
162
162
|
const parsed = first ? JSON.parse(first.text) : {};
|
|
@@ -188,7 +188,7 @@ async function handleAssessProject(input) {
|
|
|
188
188
|
parallelChecks.push(
|
|
189
189
|
(async () => {
|
|
190
190
|
try {
|
|
191
|
-
const { handleCheckPerformance } = await import("./performance-
|
|
191
|
+
const { handleCheckPerformance } = await import("./performance-N67YJJDG.js");
|
|
192
192
|
const result = await handleCheckPerformance({ path: projectPath });
|
|
193
193
|
if ("isError" in result && result.isError) {
|
|
194
194
|
const msg = result.content[0]?.text ?? "Performance check failed";
|
|
@@ -14962,10 +14962,16 @@ function selectLines(lines, charBudget) {
|
|
|
14962
14962
|
const kept = [];
|
|
14963
14963
|
let used = 0;
|
|
14964
14964
|
for (const item of scored) {
|
|
14965
|
+
const remaining = charBudget - used;
|
|
14966
|
+
if (remaining <= 0) break;
|
|
14965
14967
|
const lineLen = item.line.length + 1;
|
|
14966
|
-
if (
|
|
14967
|
-
|
|
14968
|
-
|
|
14968
|
+
if (lineLen <= remaining) {
|
|
14969
|
+
kept.push({ line: item.line, idx: item.idx });
|
|
14970
|
+
used += lineLen;
|
|
14971
|
+
} else if (remaining > 1) {
|
|
14972
|
+
kept.push({ line: item.line.slice(0, remaining - 1), idx: item.idx });
|
|
14973
|
+
used += remaining;
|
|
14974
|
+
}
|
|
14969
14975
|
}
|
|
14970
14976
|
kept.sort((a, b) => a.idx - b.idx);
|
|
14971
14977
|
return kept;
|
|
@@ -14979,9 +14985,14 @@ var TruncationStrategy = class {
|
|
|
14979
14985
|
const charBudget = budget * CHARS_PER_TOKEN;
|
|
14980
14986
|
if (content.length <= charBudget) return content;
|
|
14981
14987
|
const lines = content.split("\n");
|
|
14982
|
-
const
|
|
14983
|
-
const
|
|
14984
|
-
|
|
14988
|
+
const markerCost = Math.min(TRUNCATION_MARKER.length, Math.floor(charBudget / 2));
|
|
14989
|
+
const available = Math.max(charBudget - markerCost, 0);
|
|
14990
|
+
const kept = selectLines(lines, available);
|
|
14991
|
+
const body = kept.map((k) => k.line).join("\n");
|
|
14992
|
+
if (charBudget - body.length >= TRUNCATION_MARKER.length) {
|
|
14993
|
+
return body + TRUNCATION_MARKER;
|
|
14994
|
+
}
|
|
14995
|
+
return body;
|
|
14985
14996
|
}
|
|
14986
14997
|
};
|
|
14987
14998
|
var CompactionPipeline = class {
|
|
@@ -15004,6 +15015,20 @@ var CompactionPipeline = class {
|
|
|
15004
15015
|
}, content);
|
|
15005
15016
|
}
|
|
15006
15017
|
};
|
|
15018
|
+
function paginate(items, offset, limit) {
|
|
15019
|
+
const safeOffset = Math.max(0, offset);
|
|
15020
|
+
const safeLimit = Math.max(0, limit);
|
|
15021
|
+
const sliced = items.slice(safeOffset, safeOffset + safeLimit);
|
|
15022
|
+
return {
|
|
15023
|
+
items: sliced,
|
|
15024
|
+
pagination: {
|
|
15025
|
+
offset: safeOffset,
|
|
15026
|
+
limit: safeLimit,
|
|
15027
|
+
total: items.length,
|
|
15028
|
+
hasMore: safeOffset + safeLimit < items.length
|
|
15029
|
+
}
|
|
15030
|
+
};
|
|
15031
|
+
}
|
|
15007
15032
|
var STABILITY_LOOKUP = {};
|
|
15008
15033
|
for (const [key, tier] of Object.entries(NODE_STABILITY)) {
|
|
15009
15034
|
STABILITY_LOOKUP[key] = tier;
|
|
@@ -15546,6 +15571,7 @@ export {
|
|
|
15546
15571
|
DEFAULT_TOKEN_BUDGET,
|
|
15547
15572
|
TruncationStrategy,
|
|
15548
15573
|
CompactionPipeline,
|
|
15574
|
+
paginate,
|
|
15549
15575
|
resolveStability,
|
|
15550
15576
|
AnthropicCacheAdapter,
|
|
15551
15577
|
OpenAICacheAdapter,
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sanitizePath
|
|
3
3
|
} from "./chunk-W6Y7ZW3Y.js";
|
|
4
|
+
import {
|
|
5
|
+
paginate
|
|
6
|
+
} from "./chunk-H4U2QNY2.js";
|
|
7
|
+
|
|
8
|
+
// src/mcp/utils/severity.ts
|
|
9
|
+
var SEVERITY_ORDER = {
|
|
10
|
+
error: 0,
|
|
11
|
+
critical: 0,
|
|
12
|
+
warning: 1,
|
|
13
|
+
important: 1,
|
|
14
|
+
info: 2,
|
|
15
|
+
suggestion: 2
|
|
16
|
+
};
|
|
17
|
+
function sortFindingsBySeverity(findings) {
|
|
18
|
+
return [...findings].sort((a, b) => {
|
|
19
|
+
const aObj = a;
|
|
20
|
+
const bObj = b;
|
|
21
|
+
const aSev = SEVERITY_ORDER[typeof aObj.severity === "string" ? aObj.severity : ""] ?? 99;
|
|
22
|
+
const bSev = SEVERITY_ORDER[typeof bObj.severity === "string" ? bObj.severity : ""] ?? 99;
|
|
23
|
+
return aSev - bSev;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
4
26
|
|
|
5
27
|
// src/mcp/tools/review-pipeline.ts
|
|
6
28
|
var runCodeReviewDefinition = {
|
|
@@ -38,6 +60,14 @@ var runCodeReviewDefinition = {
|
|
|
38
60
|
repo: {
|
|
39
61
|
type: "string",
|
|
40
62
|
description: "Repository in owner/repo format (required for --comment)"
|
|
63
|
+
},
|
|
64
|
+
offset: {
|
|
65
|
+
type: "number",
|
|
66
|
+
description: "Number of findings to skip (pagination). Default: 0. Findings are sorted by severity desc (critical > important > suggestion)."
|
|
67
|
+
},
|
|
68
|
+
limit: {
|
|
69
|
+
type: "number",
|
|
70
|
+
description: "Max findings to return (pagination). Default: 20."
|
|
41
71
|
}
|
|
42
72
|
},
|
|
43
73
|
required: ["path", "diff"]
|
|
@@ -45,7 +75,7 @@ var runCodeReviewDefinition = {
|
|
|
45
75
|
};
|
|
46
76
|
async function handleRunCodeReview(input) {
|
|
47
77
|
try {
|
|
48
|
-
const { parseDiff, runReviewPipeline } = await import("./dist-
|
|
78
|
+
const { parseDiff, runReviewPipeline } = await import("./dist-7EBSGAHX.js");
|
|
49
79
|
const parseResult = parseDiff(input.diff);
|
|
50
80
|
if (!parseResult.ok) {
|
|
51
81
|
return {
|
|
@@ -81,6 +111,30 @@ async function handleRunCodeReview(input) {
|
|
|
81
111
|
},
|
|
82
112
|
...input.repo != null ? { repo: input.repo } : {}
|
|
83
113
|
});
|
|
114
|
+
const sortedFindings = sortFindingsBySeverity(
|
|
115
|
+
result.findings
|
|
116
|
+
);
|
|
117
|
+
if (input._skipPagination) {
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: "text",
|
|
122
|
+
text: JSON.stringify({
|
|
123
|
+
skipped: result.skipped,
|
|
124
|
+
skipReason: result.skipReason,
|
|
125
|
+
stoppedByMechanical: result.stoppedByMechanical,
|
|
126
|
+
assessment: result.assessment,
|
|
127
|
+
findings: sortedFindings,
|
|
128
|
+
findingCount: sortedFindings.length,
|
|
129
|
+
terminalOutput: result.terminalOutput,
|
|
130
|
+
githubCommentCount: result.githubComments.length,
|
|
131
|
+
exitCode: result.exitCode
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const paged = paginate(sortedFindings, input.offset ?? 0, input.limit ?? 20);
|
|
84
138
|
return {
|
|
85
139
|
content: [
|
|
86
140
|
{
|
|
@@ -91,7 +145,9 @@ async function handleRunCodeReview(input) {
|
|
|
91
145
|
skipReason: result.skipReason,
|
|
92
146
|
stoppedByMechanical: result.stoppedByMechanical,
|
|
93
147
|
assessment: result.assessment,
|
|
148
|
+
findings: paged.items,
|
|
94
149
|
findingCount: result.findings.length,
|
|
150
|
+
pagination: paged.pagination,
|
|
95
151
|
terminalOutput: result.terminalOutput,
|
|
96
152
|
githubCommentCount: result.githubComments.length,
|
|
97
153
|
exitCode: result.exitCode
|
|
@@ -117,6 +173,7 @@ async function handleRunCodeReview(input) {
|
|
|
117
173
|
}
|
|
118
174
|
|
|
119
175
|
export {
|
|
176
|
+
sortFindingsBySeverity,
|
|
120
177
|
runCodeReviewDefinition,
|
|
121
178
|
handleRunCodeReview
|
|
122
179
|
};
|