nexus-agents 3.5.1 → 3.5.2

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.
@@ -8,7 +8,7 @@ import {
8
8
  checkSqlite,
9
9
  defaultConfig,
10
10
  initDataDirectories
11
- } from "./chunk-6ZOZYECZ.js";
11
+ } from "./chunk-J2FUCIPH.js";
12
12
  import {
13
13
  BUILT_IN_EXPERTS
14
14
  } from "./chunk-YPNQPT2F.js";
@@ -2001,4 +2001,4 @@ export {
2001
2001
  setupCommand,
2002
2002
  setupCommandAsync
2003
2003
  };
2004
- //# sourceMappingURL=chunk-CQ4Y7ULT.js.map
2004
+ //# sourceMappingURL=chunk-66QB5SML.js.map
@@ -49,7 +49,7 @@ import {
49
49
  } from "./chunk-OQLFRJCW.js";
50
50
 
51
51
  // src/version.ts
52
- var VERSION = true ? "3.5.1" : "dev";
52
+ var VERSION = true ? "3.5.2" : "dev";
53
53
 
54
54
  // src/config/schemas-core.ts
55
55
  import { z } from "zod";
@@ -2287,7 +2287,7 @@ async function runDoctorFix(result) {
2287
2287
  writeLine2("\u2500".repeat(40));
2288
2288
  let fixCount = 0;
2289
2289
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2290
- const { runSetup } = await import("./setup-command-VWOUSXWP.js");
2290
+ const { runSetup } = await import("./setup-command-DOPNW32N.js");
2291
2291
  const setupResult = runSetup({
2292
2292
  skipMcp: true,
2293
2293
  skipRules: true,
@@ -2400,4 +2400,4 @@ export {
2400
2400
  startStdioServer,
2401
2401
  closeServer
2402
2402
  };
2403
- //# sourceMappingURL=chunk-6ZOZYECZ.js.map
2403
+ //# sourceMappingURL=chunk-J2FUCIPH.js.map
@@ -22,7 +22,7 @@ import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  DEFAULT_TOOL_RATE_LIMITS,
24
24
  clampTaskTtl
25
- } from "./chunk-6ZOZYECZ.js";
25
+ } from "./chunk-J2FUCIPH.js";
26
26
  import {
27
27
  executeExpert
28
28
  } from "./chunk-GVLDWGSK.js";
@@ -45344,6 +45344,68 @@ function buildScanSummary(total, confirmed, falsePositives, osvCount) {
45344
45344
  return parts.join(", ");
45345
45345
  }
45346
45346
 
45347
+ // src/security/quality-gate-commands.ts
45348
+ import { existsSync as existsSync9, readFileSync as readFileSync7 } from "fs";
45349
+ import { join as join9 } from "path";
45350
+ var LOCKFILES = [
45351
+ { file: "pnpm-lock.yaml", manager: "pnpm" },
45352
+ { file: "yarn.lock", manager: "yarn" },
45353
+ { file: "bun.lockb", manager: "bun" },
45354
+ { file: "package-lock.json", manager: "npm" }
45355
+ ];
45356
+ var SCRIPT_CANDIDATES = {
45357
+ lint: ["lint"],
45358
+ typecheck: ["typecheck", "type-check", "types"],
45359
+ tests: ["test", "tests"],
45360
+ build: ["build"]
45361
+ };
45362
+ function detectPackageManager(projectDir) {
45363
+ for (const { file, manager } of LOCKFILES) {
45364
+ if (existsSync9(join9(projectDir, file))) return manager;
45365
+ }
45366
+ return "npm";
45367
+ }
45368
+ function readScripts(projectDir) {
45369
+ const manifest = join9(projectDir, "package.json");
45370
+ if (!existsSync9(manifest)) return void 0;
45371
+ try {
45372
+ const parsed = JSON.parse(readFileSync7(manifest, "utf-8"));
45373
+ if (typeof parsed !== "object" || parsed === null) return void 0;
45374
+ const scripts = parsed.scripts;
45375
+ if (typeof scripts !== "object" || scripts === null) return void 0;
45376
+ const out = {};
45377
+ for (const [name, body] of Object.entries(scripts)) {
45378
+ if (typeof body === "string") out[name] = body;
45379
+ }
45380
+ return out;
45381
+ } catch {
45382
+ return void 0;
45383
+ }
45384
+ }
45385
+ function resolveCheckCommand(projectDir, check) {
45386
+ const scripts = readScripts(projectDir);
45387
+ if (scripts === void 0) {
45388
+ return {
45389
+ kind: "unconfigured",
45390
+ reason: `no readable package.json in ${projectDir}, so the "${check}" script could not be resolved`
45391
+ };
45392
+ }
45393
+ const candidates = SCRIPT_CANDIDATES[check];
45394
+ const found = candidates.find((name) => (scripts[name] ?? "").trim() !== "");
45395
+ if (found === void 0) {
45396
+ return {
45397
+ kind: "unconfigured",
45398
+ reason: `no "${check}" script declared (looked for: ${candidates.join(", ")})`
45399
+ };
45400
+ }
45401
+ return {
45402
+ kind: "command",
45403
+ command: detectPackageManager(projectDir),
45404
+ args: ["run", "--silent", found],
45405
+ script: found
45406
+ };
45407
+ }
45408
+
45347
45409
  // src/security/quality-gate.ts
45348
45410
  async function runCommandCheck(name, command, args, cwd) {
45349
45411
  const start = Date.now();
@@ -45368,17 +45430,31 @@ async function runCommandCheck(name, command, args, cwd) {
45368
45430
  };
45369
45431
  }
45370
45432
  }
45433
+ function scriptedCheck(name, check, projectDir) {
45434
+ return async () => {
45435
+ const resolved = resolveCheckCommand(projectDir, check);
45436
+ if (resolved.kind === "unconfigured") {
45437
+ return {
45438
+ name,
45439
+ verdict: "skip",
45440
+ details: `Not run: ${resolved.reason}. Declare the script to enable this check.`,
45441
+ durationMs: 0
45442
+ };
45443
+ }
45444
+ return runCommandCheck(name, resolved.command, resolved.args, projectDir);
45445
+ };
45446
+ }
45371
45447
  function checkTypeCheck(projectDir) {
45372
- return () => runCommandCheck("type_check", "npx", ["tsc", "--noEmit", "--project", projectDir], projectDir);
45448
+ return scriptedCheck("type_check", "typecheck", projectDir);
45373
45449
  }
45374
45450
  function checkLint(projectDir) {
45375
- return () => runCommandCheck("lint", "npx", ["eslint", "--max-warnings", "0", projectDir], projectDir);
45451
+ return scriptedCheck("lint", "lint", projectDir);
45376
45452
  }
45377
45453
  function checkTests(projectDir) {
45378
- return () => runCommandCheck("tests", "npx", ["vitest", "run", "--dir", projectDir], projectDir);
45454
+ return scriptedCheck("tests", "tests", projectDir);
45379
45455
  }
45380
45456
  function checkBuild(projectDir) {
45381
- return () => runCommandCheck("build", "pnpm", ["build"], projectDir);
45457
+ return scriptedCheck("build", "build", projectDir);
45382
45458
  }
45383
45459
  function aggregateResults2(checks) {
45384
45460
  let pass = 0;
@@ -45389,14 +45465,23 @@ function aggregateResults2(checks) {
45389
45465
  else if (c.verdict === "fail") fail++;
45390
45466
  else skip2++;
45391
45467
  }
45392
- return { verdict: fail > 0 ? "fail" : "pass", summary: { pass, fail, skip: skip2 } };
45468
+ const verdict = fail > 0 ? "fail" : pass === 0 && skip2 > 0 ? "skip" : "pass";
45469
+ return { verdict, summary: { pass, fail, skip: skip2 } };
45393
45470
  }
45394
45471
  function generateFeedback2(checks) {
45395
45472
  const failures = checks.filter((c) => c.verdict === "fail");
45396
- if (failures.length === 0) return "All checks passed.";
45473
+ const skipped = checks.filter((c) => c.verdict === "skip");
45474
+ const skipNote = skipped.length > 0 ? `
45475
+ ${String(skipped.length)} check(s) did not run:
45476
+ ${skipped.map((s) => `- ${s.name}: ${s.details}`).join("\n")}` : "";
45477
+ if (failures.length === 0) {
45478
+ const ran = checks.length - skipped.length;
45479
+ const headline = ran === 0 ? "No checks ran." : `All ${String(ran)} check(s) that ran passed.`;
45480
+ return `${headline}${skipNote}`;
45481
+ }
45397
45482
  const lines = failures.map((f) => `- ${f.name}: ${f.details}`);
45398
45483
  return `${String(failures.length)} check(s) failed:
45399
- ${lines.join("\n")}`;
45484
+ ${lines.join("\n")}${skipNote}`;
45400
45485
  }
45401
45486
  async function runQualityGate(stage, checks, iteration = 1) {
45402
45487
  const results = [];
@@ -46456,8 +46541,8 @@ function reviewedDiffWasTruncated(diff) {
46456
46541
  }
46457
46542
 
46458
46543
  // src/audit/pr-review-record-store.ts
46459
- import { appendFileSync as appendFileSync4, existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync7 } from "fs";
46460
- import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve13 } from "path";
46544
+ import { appendFileSync as appendFileSync4, existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync8 } from "fs";
46545
+ import { dirname as dirname4, isAbsolute, join as join10, resolve as resolve13 } from "path";
46461
46546
 
46462
46547
  // src/audit/pr-review-record.ts
46463
46548
  import * as crypto3 from "crypto";
@@ -46588,7 +46673,7 @@ function assertNotSourceCheckoutWrite(filePath) {
46588
46673
  if (!isUnderTestRunner()) return;
46589
46674
  const here = findRepoRoot(process.cwd());
46590
46675
  if (here === null) return;
46591
- if (resolve13(filePath) !== resolve13(join9(here, PR_REVIEW_RECORDS_REL_PATH))) return;
46676
+ if (resolve13(filePath) !== resolve13(join10(here, PR_REVIEW_RECORDS_REL_PATH))) return;
46592
46677
  throw new Error(
46593
46678
  `Refusing to write ${filePath} from a test run (#4415): this is the source checkout's tracked, hash-chained audit file, and a fabricated record that chains cleanly is indistinguishable from a real verdict. Pass repoPath to a throwaway repo, or set NEXUS_PR_REVIEW_RECORDS_PATH.`
46594
46679
  );
@@ -46600,17 +46685,17 @@ function resolvePrReviewRecordsPath(repoPathOverride) {
46600
46685
  }
46601
46686
  if (repoPathOverride !== void 0 && repoPathOverride.trim() !== "") {
46602
46687
  const overrideRoot = findRepoRoot(repoPathOverride);
46603
- if (overrideRoot !== null) return join9(overrideRoot, PR_REVIEW_RECORDS_REL_PATH);
46688
+ if (overrideRoot !== null) return join10(overrideRoot, PR_REVIEW_RECORDS_REL_PATH);
46604
46689
  }
46605
46690
  const root = findRepoRoot(process.cwd());
46606
46691
  if (root === null) return void 0;
46607
- return join9(root, PR_REVIEW_RECORDS_REL_PATH);
46692
+ return join10(root, PR_REVIEW_RECORDS_REL_PATH);
46608
46693
  }
46609
46694
  function readPrReviewRecords(filePath) {
46610
46695
  const records = [];
46611
46696
  const invalidLines = [];
46612
- if (!existsSync9(filePath)) return { records, invalidLines };
46613
- const lines = readFileSync7(filePath, "utf-8").split("\n").filter((l) => l.trim() !== "");
46697
+ if (!existsSync10(filePath)) return { records, invalidLines };
46698
+ const lines = readFileSync8(filePath, "utf-8").split("\n").filter((l) => l.trim() !== "");
46614
46699
  for (const [i, line] of lines.entries()) {
46615
46700
  try {
46616
46701
  const parsed = PrReviewRecordSchema.safeParse(JSON.parse(line));
@@ -46623,7 +46708,7 @@ function readPrReviewRecords(filePath) {
46623
46708
  return { records, invalidLines };
46624
46709
  }
46625
46710
  function readPrReviewLedgerTip(filePath, logger58) {
46626
- if (!existsSync9(filePath)) return { maxSequence: -1, lastHash: void 0 };
46711
+ if (!existsSync10(filePath)) return { maxSequence: -1, lastHash: void 0 };
46627
46712
  try {
46628
46713
  const { records } = readPrReviewRecords(filePath);
46629
46714
  if (records.length === 0) return { maxSequence: -1, lastHash: void 0 };
@@ -47856,7 +47941,7 @@ function registerQueryTaskStateTool(server, deps) {
47856
47941
  import { z as z100 } from "zod";
47857
47942
 
47858
47943
  // src/mcp/tools/ci-health-log.ts
47859
- import { appendFileSync as appendFileSync5, existsSync as existsSync11, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
47944
+ import { appendFileSync as appendFileSync5, existsSync as existsSync12, readFileSync as readFileSync10, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
47860
47945
  import { z as z99 } from "zod";
47861
47946
 
47862
47947
  // src/mcp/tools/ci-health-types.ts
@@ -47898,7 +47983,7 @@ function capLogSize(path12) {
47898
47983
  }
47899
47984
  if (size <= max) return;
47900
47985
  try {
47901
- const lines = readFileSync9(path12, "utf-8").split("\n").filter((l) => l !== "");
47986
+ const lines = readFileSync10(path12, "utf-8").split("\n").filter((l) => l !== "");
47902
47987
  const kept = [];
47903
47988
  let bytes = 0;
47904
47989
  for (let i = lines.length - 1; i >= 0; i--) {
@@ -48701,7 +48786,7 @@ function createMetaOrchestrator(options) {
48701
48786
  }
48702
48787
 
48703
48788
  // src/orchestration/meta-shadow-selector.ts
48704
- import { appendFileSync as appendFileSync6, existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
48789
+ import { appendFileSync as appendFileSync6, existsSync as existsSync13, readFileSync as readFileSync11 } from "fs";
48705
48790
  import { z as z104 } from "zod";
48706
48791
  var SHADOW_STRATEGY_ARMS = [
48707
48792
  "single-shot",
@@ -48820,11 +48905,11 @@ function hydrateShadowSelector(selector) {
48820
48905
  const hydratable = selector;
48821
48906
  if (typeof hydratable.recordFromContext !== "function") return 0;
48822
48907
  const file = getMetaOutcomesFile();
48823
- if (!existsSync12(file)) return 0;
48908
+ if (!existsSync13(file)) return 0;
48824
48909
  let replayed = 0;
48825
48910
  try {
48826
48911
  const cutoff = Date.now() - HYDRATE_LOOKBACK_MS;
48827
- const lines = readFileSync10(file, "utf-8").split("\n").filter((l) => l.trim().length > 0);
48912
+ const lines = readFileSync11(file, "utf-8").split("\n").filter((l) => l.trim().length > 0);
48828
48913
  for (const line of lines) {
48829
48914
  let parsed;
48830
48915
  try {
@@ -54172,4 +54257,4 @@ export {
54172
54257
  shutdownFeedbackSubscriber,
54173
54258
  createEventBusBridge
54174
54259
  };
54175
- //# sourceMappingURL=chunk-6H5AM5SG.js.map
54260
+ //# sourceMappingURL=chunk-W7532ZQG.js.map