@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.
Files changed (41) hide show
  1. package/dist/{agents-md-MMVRF77L.js → agents-md-PBKKTSQY.js} +1 -1
  2. package/dist/{architecture-JAEDPYQZ.js → architecture-FBSLURIB.js} +3 -3
  3. package/dist/{assess-project-7JZCVM7D.js → assess-project-74UVWPMB.js} +1 -1
  4. package/dist/bin/harness-mcp.js +13 -13
  5. package/dist/bin/harness.js +18 -17
  6. package/dist/{check-phase-gate-YQHAH4LL.js → check-phase-gate-WY6UICCL.js} +3 -3
  7. package/dist/{chunk-MS6KDQW7.js → chunk-3VYWO6QN.js} +6 -6
  8. package/dist/chunk-3XAPHB2Z.js +43 -0
  9. package/dist/{chunk-AVVJ5EUU.js → chunk-5PMRARB5.js} +1 -1
  10. package/dist/{chunk-NU3BPEDR.js → chunk-A737JDL4.js} +2 -2
  11. package/dist/{chunk-IDZNPTYD.js → chunk-EPUKTTJZ.js} +6 -1
  12. package/dist/{chunk-2DAMN7ED.js → chunk-FJYP32IV.js} +6 -6
  13. package/dist/{chunk-PCWYYFBP.js → chunk-H4U2QNY2.js} +32 -6
  14. package/dist/{chunk-C5FTJ3EU.js → chunk-L5UONZ53.js} +58 -1
  15. package/dist/{chunk-LY3YVKXL.js → chunk-O6UF33QH.js} +351 -104
  16. package/dist/{chunk-W2OZK3KC.js → chunk-SPTKLCKC.js} +1 -1
  17. package/dist/{chunk-TUJAHI22.js → chunk-TB427QOK.js} +5 -5
  18. package/dist/{chunk-HVFCCARH.js → chunk-UFQQBGC3.js} +1 -1
  19. package/dist/{chunk-JGMCHJ6B.js → chunk-V2FGX2KD.js} +3 -3
  20. package/dist/{chunk-JT732X6S.js → chunk-WEN5Z7CL.js} +2 -2
  21. package/dist/{chunk-BWWNQPPO.js → chunk-YPKKEP3O.js} +4 -4
  22. package/dist/{chunk-ZKVLBOYA.js → chunk-ZAMT24QN.js} +426 -383
  23. package/dist/{ci-workflow-HDH4LCOF.js → ci-workflow-QZRHAIO2.js} +1 -1
  24. package/dist/{dist-TZQUURSP.js → dist-7EBSGAHX.js} +3 -1
  25. package/dist/{docs-6SPJYTRR.js → docs-H34GBVRS.js} +4 -4
  26. package/dist/{engine-CSITRE3J.js → engine-VUQEAJFZ.js} +1 -1
  27. package/dist/{entropy-FZP643BK.js → entropy-ZAY73R6A.js} +3 -3
  28. package/dist/{feedback-RSPUJCJJ.js → feedback-TMEGYMWU.js} +2 -2
  29. package/dist/{generate-agent-definitions-OLYWXTYH.js → generate-agent-definitions-PQPG6SX5.js} +1 -1
  30. package/dist/index.d.ts +8 -8
  31. package/dist/index.js +23 -21
  32. package/dist/{loader-P2P7CV2A.js → loader-Y6A42WBD.js} +1 -1
  33. package/dist/{mcp-JZG22CYT.js → mcp-LCHC4NZ5.js} +13 -13
  34. package/dist/{performance-VVWOIJTE.js → performance-N67YJJDG.js} +4 -4
  35. package/dist/{review-pipeline-XSRO7HYZ.js → review-pipeline-YXF5ITL2.js} +4 -1
  36. package/dist/{runtime-VMOIIP6B.js → runtime-XNJUJCSG.js} +1 -1
  37. package/dist/scan-U67OKDRS.js +8 -0
  38. package/dist/{security-4AQ46P3H.js → security-L2YN3CTI.js} +1 -1
  39. package/dist/{validate-T7UTXLEQ.js → validate-MNE25KLZ.js} +2 -2
  40. package/dist/{validate-cross-check-M4NP2UF5.js → validate-cross-check-Y4PDR63C.js} +1 -1
  41. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generateAgentsMd
3
3
  } from "./chunk-I4QR3HNH.js";
4
- import "./chunk-PCWYYFBP.js";
4
+ import "./chunk-H4U2QNY2.js";
5
5
  import "./chunk-5LMZA5LZ.js";
6
6
  import "./chunk-OZIHPMA7.js";
7
7
  export {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  checkDependenciesDefinition,
3
3
  handleCheckDependencies
4
- } from "./chunk-NU3BPEDR.js";
4
+ } from "./chunk-A737JDL4.js";
5
5
  import "./chunk-Q3XYV5UC.js";
6
- import "./chunk-IDZNPTYD.js";
6
+ import "./chunk-EPUKTTJZ.js";
7
7
  import "./chunk-W6Y7ZW3Y.js";
8
- import "./chunk-PCWYYFBP.js";
8
+ import "./chunk-H4U2QNY2.js";
9
9
  import "./chunk-5LMZA5LZ.js";
10
10
  import "./chunk-OZIHPMA7.js";
11
11
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  assessProjectDefinition,
3
3
  handleAssessProject
4
- } from "./chunk-2DAMN7ED.js";
4
+ } from "./chunk-FJYP32IV.js";
5
5
  import "./chunk-W6Y7ZW3Y.js";
6
6
  export {
7
7
  assessProjectDefinition,
@@ -1,24 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startServer
4
- } from "../chunk-LY3YVKXL.js";
5
- import "../chunk-BWWNQPPO.js";
6
- import "../chunk-HVFCCARH.js";
7
- import "../chunk-C5FTJ3EU.js";
8
- import "../chunk-2DAMN7ED.js";
9
- import "../chunk-JT732X6S.js";
10
- import "../chunk-NU3BPEDR.js";
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-TUJAHI22.js";
13
- import "../chunk-JGMCHJ6B.js";
14
- import "../chunk-MS6KDQW7.js";
15
- import "../chunk-IDZNPTYD.js";
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-AVVJ5EUU.js";
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-PCWYYFBP.js";
21
+ import "../chunk-H4U2QNY2.js";
22
22
  import "../chunk-5LMZA5LZ.js";
23
23
  import "../chunk-OZIHPMA7.js";
24
24
  import "../chunk-ZOVATVQC.js";
@@ -2,39 +2,40 @@
2
2
  import {
3
3
  createProgram,
4
4
  printFirstRunWelcome
5
- } from "../chunk-ZKVLBOYA.js";
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-W2OZK3KC.js";
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-FP53DDB5.js";
19
+ import "../chunk-3XAPHB2Z.js";
19
20
  import {
20
21
  dispatchSkillsFromGit
21
- } from "../chunk-LY3YVKXL.js";
22
- import "../chunk-BWWNQPPO.js";
23
- import "../chunk-HVFCCARH.js";
24
- import "../chunk-C5FTJ3EU.js";
25
- import "../chunk-2DAMN7ED.js";
26
- import "../chunk-JT732X6S.js";
27
- import "../chunk-NU3BPEDR.js";
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-TUJAHI22.js";
30
- import "../chunk-JGMCHJ6B.js";
31
- import "../chunk-MS6KDQW7.js";
32
- import "../chunk-IDZNPTYD.js";
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-AVVJ5EUU.js";
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-PCWYYFBP.js";
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-W2OZK3KC.js";
5
- import "./chunk-AVVJ5EUU.js";
6
- import "./chunk-PCWYYFBP.js";
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-IDZNPTYD.js";
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-AVVJ5EUU.js";
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-TZQUURSP.js");
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-TZQUURSP.js");
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-TZQUURSP.js");
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-TZQUURSP.js");
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
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ArchConfigSchema
3
- } from "./chunk-PCWYYFBP.js";
3
+ } from "./chunk-H4U2QNY2.js";
4
4
  import {
5
5
  Err,
6
6
  Ok
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-Q3XYV5UC.js";
4
4
  import {
5
5
  resultToMcpResponse
6
- } from "./chunk-IDZNPTYD.js";
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-TZQUURSP.js");
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: [{ type: "text", text: JSON.stringify(result.value) }]
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-T7UTXLEQ.js");
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-JAEDPYQZ.js");
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-6SPJYTRR.js");
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-FZP643BK.js");
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-4AQ46P3H.js");
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-VVWOIJTE.js");
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 (used + lineLen > charBudget) continue;
14967
- kept.push({ line: item.line, idx: item.idx });
14968
- used += lineLen;
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 available = charBudget - TRUNCATION_MARKER.length;
14983
- const kept = available > 0 ? selectLines(lines, available) : [{ line: (lines[0] ?? "").slice(0, charBudget), idx: 0 }];
14984
- return kept.map((k) => k.line).join("\n") + TRUNCATION_MARKER;
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-TZQUURSP.js");
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
  };