nexus-agents 2.166.0 → 2.166.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.
@@ -43,7 +43,7 @@ import {
43
43
  } from "./chunk-DHVMSIT5.js";
44
44
 
45
45
  // src/version.ts
46
- var VERSION = true ? "2.166.0" : "dev";
46
+ var VERSION = true ? "2.166.2" : "dev";
47
47
 
48
48
  // src/config/schemas-core.ts
49
49
  import { z } from "zod";
@@ -2159,7 +2159,7 @@ async function runDoctorFix(result) {
2159
2159
  writeLine2("\u2500".repeat(40));
2160
2160
  let fixCount = 0;
2161
2161
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
2162
- const { runSetup } = await import("./setup-command-HMXY5UHN.js");
2162
+ const { runSetup } = await import("./setup-command-AVQWHV5L.js");
2163
2163
  const setupResult = runSetup({
2164
2164
  skipMcp: true,
2165
2165
  skipRules: true,
@@ -2272,4 +2272,4 @@ export {
2272
2272
  startStdioServer,
2273
2273
  closeServer
2274
2274
  };
2275
- //# sourceMappingURL=chunk-OUBDTDTC.js.map
2275
+ //# sourceMappingURL=chunk-YIEMNZUD.js.map
package/dist/cli.js CHANGED
@@ -22,7 +22,7 @@ import "./chunk-SF2AK3JB.js";
22
22
  import {
23
23
  setupCommandAsync,
24
24
  verifyCommand
25
- } from "./chunk-WOQCCQSE.js";
25
+ } from "./chunk-MLURL552.js";
26
26
  import "./chunk-2255SARF.js";
27
27
  import {
28
28
  AuthHandler,
@@ -142,11 +142,11 @@ import {
142
142
  validateCommand,
143
143
  validateWorkflow,
144
144
  wrapInMarkdownFence
145
- } from "./chunk-RC5SCDGF.js";
145
+ } from "./chunk-RLRAUL43.js";
146
146
  import "./chunk-2UMMVKUW.js";
147
147
  import "./chunk-YOFRUVPJ.js";
148
148
  import "./chunk-HFOQKCD2.js";
149
- import "./chunk-3ACDP4E6.js";
149
+ import "./chunk-AO4X3BMP.js";
150
150
  import {
151
151
  CATEGORY_DISPLAY_NAMES,
152
152
  DEFAULT_PR_REVIEW_CONFIG
@@ -170,7 +170,7 @@ import {
170
170
  loadConfig,
171
171
  runDoctor,
172
172
  validateNexusEnv
173
- } from "./chunk-OUBDTDTC.js";
173
+ } from "./chunk-YIEMNZUD.js";
174
174
  import "./chunk-FKOWIKR4.js";
175
175
  import {
176
176
  shutdownExpertBridge
@@ -10000,17 +10000,31 @@ function extractDependencies(sourceFile) {
10000
10000
  }
10001
10001
 
10002
10002
  // src/indexer/description-extraction.ts
10003
- function classifyJsDocLine(trimmed, inComment) {
10004
- if (trimmed.startsWith("/**")) return "start";
10003
+ function isPlainBlockComment(trimmed) {
10004
+ return trimmed.startsWith("/*") && trimmed.endsWith("*/");
10005
+ }
10006
+ function classifyOutsideComment(trimmed) {
10007
+ if (isPlainBlockComment(trimmed)) return "skip";
10008
+ if (trimmed.length > 0 && !trimmed.startsWith("//")) return "stop";
10009
+ return "skip";
10010
+ }
10011
+ function classifyInsideComment(trimmed) {
10005
10012
  if (trimmed.endsWith("*/")) return "end";
10006
- if (!inComment && trimmed.length > 0 && !trimmed.startsWith("//")) return "stop";
10007
- if (!inComment) return "skip";
10008
10013
  if (trimmed.startsWith("* @") || trimmed.startsWith("@")) return "skip";
10009
10014
  return "content";
10010
10015
  }
10016
+ function classifyJsDocLine(trimmed, inComment) {
10017
+ if (trimmed.startsWith("/**")) {
10018
+ return trimmed.endsWith("*/") ? "startEnd" : "start";
10019
+ }
10020
+ return inComment ? classifyInsideComment(trimmed) : classifyOutsideComment(trimmed);
10021
+ }
10011
10022
  function extractJsDocLineContent(trimmed) {
10012
10023
  return trimmed.startsWith("*") ? trimmed.slice(1).trim() : trimmed;
10013
10024
  }
10025
+ function extractInlineJsDocContent(trimmed) {
10026
+ return trimmed.slice(3, -2).trim();
10027
+ }
10014
10028
  function truncateDescription(full) {
10015
10029
  return truncateSentence(full, 150);
10016
10030
  }
@@ -10025,6 +10039,11 @@ function extractDescription(sourceFile) {
10025
10039
  inComment = true;
10026
10040
  continue;
10027
10041
  }
10042
+ if (result === "startEnd") {
10043
+ const inline = extractInlineJsDocContent(trimmed);
10044
+ if (inline.length > 0) description.push(inline);
10045
+ break;
10046
+ }
10028
10047
  if (result === "end" || result === "stop") break;
10029
10048
  if (result === "skip") continue;
10030
10049
  const content = extractJsDocLineContent(trimmed);
@@ -10056,20 +10075,11 @@ function extractFileEntry(sourceFile, rootDir, extractDescriptions) {
10056
10075
  }
10057
10076
  return entry;
10058
10077
  }
10059
- function shouldExcludeFile(filePath, excludePatterns, rootDir) {
10060
- return excludePatterns.some((pattern) => {
10061
- const patternBase = pattern.replace(/\*\*/g, "").replace(/\*/g, "");
10062
- return filePath.includes(patternBase.replace(rootDir, "").replace(/^\//, ""));
10063
- });
10064
- }
10065
- function processSourceFiles(project, rootDir, excludePatterns, extractDescriptions) {
10078
+ function processSourceFiles(project, rootDir, extractDescriptions) {
10066
10079
  const files = [];
10067
10080
  const errors = [];
10068
10081
  for (const sourceFile of project.getSourceFiles()) {
10069
10082
  const filePath = sourceFile.getFilePath();
10070
- if (shouldExcludeFile(filePath, excludePatterns, rootDir)) {
10071
- continue;
10072
- }
10073
10083
  try {
10074
10084
  files.push(extractFileEntry(sourceFile, rootDir, extractDescriptions));
10075
10085
  } catch (err2) {
@@ -10088,15 +10098,10 @@ function extractProject(options = {}) {
10088
10098
  });
10089
10099
  const rootDir = path9.resolve(process.cwd(), opts.rootDir);
10090
10100
  const includePatterns = opts.include.map((p) => path9.join(rootDir, p));
10091
- const excludePatterns = opts.exclude.map((p) => path9.join(rootDir, p));
10101
+ const excludePatterns = opts.exclude.map((p) => `!${path9.join(rootDir, p)}`);
10092
10102
  try {
10093
- project.addSourceFilesAtPaths(includePatterns);
10094
- const { files, errors } = processSourceFiles(
10095
- project,
10096
- rootDir,
10097
- excludePatterns,
10098
- opts.extractDescriptions
10099
- );
10103
+ project.addSourceFilesAtPaths([...includePatterns, ...excludePatterns]);
10104
+ const { files, errors } = processSourceFiles(project, rootDir, opts.extractDescriptions);
10100
10105
  return { files, errors, durationMs: getTimeProvider().now() - startTime };
10101
10106
  } catch (err2) {
10102
10107
  const message = err2 instanceof Error ? err2.message : String(err2);
@@ -10778,12 +10783,12 @@ function extractMcpTools(project, packageRoot, mcpToolsPath, warnings) {
10778
10783
  const fileName = path13.basename(filePath);
10779
10784
  if (fileName.endsWith(".test.ts") || fileName === "index.ts") continue;
10780
10785
  const relativePath = path13.relative(process.cwd(), filePath);
10781
- const extractedTools = extractToolsFromFile(sourceFile, relativePath);
10786
+ const extractedTools = extractToolsFromFile(sourceFile, relativePath, warnings);
10782
10787
  tools.push(...extractedTools);
10783
10788
  }
10784
10789
  return tools;
10785
10790
  }
10786
- function extractToolsFromFile(sourceFile, relativePath) {
10791
+ function extractToolsFromFile(sourceFile, relativePath, warnings) {
10787
10792
  const tools = [];
10788
10793
  if (sourceFile === void 0) return tools;
10789
10794
  const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind2.CallExpression);
@@ -10799,71 +10804,93 @@ function extractToolsFromFile(sourceFile, relativePath) {
10799
10804
  continue;
10800
10805
  }
10801
10806
  const toolName = nameArg.getText().replace(/['"`]/g, "");
10802
- const { description, schemaArg } = extractToolMeta(callText, args, sourceFile);
10807
+ const { description, schemaArg } = extractToolMeta(callText, args);
10803
10808
  let parameters = [];
10804
10809
  if (schemaArg !== void 0) {
10805
- parameters = extractParametersFromSchema(schemaArg, sourceFile);
10810
+ parameters = extractParametersFromSchema(schemaArg);
10806
10811
  }
10807
- tools.push({
10812
+ const tool = {
10808
10813
  name: toolName,
10809
10814
  description: description.replace(/\\n/g, " ").trim(),
10810
10815
  parameters,
10811
10816
  source_file: relativePath,
10812
10817
  source_line: callExpr.getStartLineNumber()
10813
- });
10818
+ };
10819
+ maybeWarnEmptyTool(tool, warnings);
10820
+ tools.push(tool);
10814
10821
  }
10815
10822
  return tools;
10816
10823
  }
10817
- function resolvePropertyValue(prop, sourceFile) {
10824
+ function maybeWarnEmptyTool(tool, warnings) {
10825
+ if (warnings === void 0) return;
10826
+ if (tool.description !== "" || tool.parameters.length > 0) return;
10827
+ warnings.push(
10828
+ `MCP tool "${tool.name}" (${tool.source_file}:${String(tool.source_line)}) resolved to an empty description AND empty parameters. Its description/inputSchema likely reference an identifier the extractor could not resolve statically (#2153).`
10829
+ );
10830
+ }
10831
+ function resolveIdentifierInitializer(symbol) {
10832
+ for (const decl of symbol?.getDeclarations() ?? []) {
10833
+ const varDecl = decl.asKind(SyntaxKind2.VariableDeclaration);
10834
+ const init = varDecl?.getInitializer();
10835
+ if (init !== void 0) return init;
10836
+ }
10837
+ return void 0;
10838
+ }
10839
+ function resolvePropertyValue(prop) {
10818
10840
  const propAssign = prop.asKind(SyntaxKind2.PropertyAssignment);
10819
- if (propAssign !== void 0) return propAssign.getInitializer();
10841
+ if (propAssign !== void 0) {
10842
+ const init = propAssign.getInitializer();
10843
+ if (init?.getKind() === SyntaxKind2.Identifier) {
10844
+ return resolveIdentifierInitializer(init.getSymbol());
10845
+ }
10846
+ return init;
10847
+ }
10820
10848
  const shorthand = prop.asKind(SyntaxKind2.ShorthandPropertyAssignment);
10821
- if (shorthand !== void 0 && sourceFile !== void 0) {
10822
- const varDecl = sourceFile.getVariableDeclaration(shorthand.getName());
10823
- return varDecl?.getInitializer();
10849
+ if (shorthand !== void 0) {
10850
+ return resolveIdentifierInitializer(shorthand.getValueSymbol());
10824
10851
  }
10825
10852
  return void 0;
10826
10853
  }
10827
- function extractToolMeta(callText, args, _sourceFile) {
10828
- let description = "";
10829
- let schemaArg;
10830
- if (callText.endsWith(".registerTool")) {
10831
- const configArg = args[1];
10832
- if (configArg !== void 0) {
10833
- const configObj = configArg.asKind(SyntaxKind2.ObjectLiteralExpression);
10834
- if (configObj !== void 0) {
10835
- const descProp = configObj.getProperty("description");
10836
- if (descProp !== void 0) {
10837
- const init = resolvePropertyValue(descProp, _sourceFile);
10838
- description = init?.getText().replace(/^['"]|['"]$/g, "") ?? "";
10839
- }
10840
- const schemaProp = configObj.getProperty("inputSchema");
10841
- if (schemaProp !== void 0) {
10842
- schemaArg = resolvePropertyValue(schemaProp, _sourceFile);
10843
- }
10844
- }
10845
- }
10846
- } else {
10847
- const descArg = args[1];
10848
- if (descArg !== void 0) {
10849
- description = descArg.getText().replace(/^['"]|['"]$/g, "");
10854
+ function extractStringValue(node) {
10855
+ if (node === void 0) return "";
10856
+ const kind = node.getKind();
10857
+ if (kind === SyntaxKind2.StringLiteral || kind === SyntaxKind2.NoSubstitutionTemplateLiteral) {
10858
+ return node.asKind(kind)?.getLiteralText() ?? "";
10859
+ }
10860
+ if (kind === SyntaxKind2.BinaryExpression) {
10861
+ const bin = node.asKind(SyntaxKind2.BinaryExpression);
10862
+ if (bin?.getOperatorToken().getKind() === SyntaxKind2.PlusToken) {
10863
+ return extractStringValue(bin.getLeft()) + extractStringValue(bin.getRight());
10850
10864
  }
10851
- schemaArg = args[2];
10852
10865
  }
10866
+ return "";
10867
+ }
10868
+ function extractToolMeta(callText, args) {
10869
+ if (callText.endsWith(".registerTool")) {
10870
+ return extractRegisterToolMeta(args[1]);
10871
+ }
10872
+ return {
10873
+ description: extractStringValue(args[1]),
10874
+ schemaArg: args[2]
10875
+ };
10876
+ }
10877
+ function extractRegisterToolMeta(configArg) {
10878
+ const configObj = configArg?.asKind(SyntaxKind2.ObjectLiteralExpression);
10879
+ if (configObj === void 0) return { description: "", schemaArg: void 0 };
10880
+ const descProp = configObj.getProperty("description");
10881
+ const description = descProp === void 0 ? "" : extractStringValue(resolvePropertyValue(descProp));
10882
+ const schemaProp = configObj.getProperty("inputSchema");
10883
+ const schemaArg = schemaProp === void 0 ? void 0 : resolvePropertyValue(schemaProp);
10853
10884
  return { description, schemaArg };
10854
10885
  }
10855
- function extractParametersFromSchema(schemaArg, sourceFile) {
10886
+ function extractParametersFromSchema(schemaArg) {
10856
10887
  if (schemaArg.getKind() === SyntaxKind2.ObjectLiteralExpression) {
10857
10888
  return extractZodParameters(schemaArg);
10858
10889
  }
10859
- if (schemaArg.getKind() === SyntaxKind2.Identifier && sourceFile !== void 0) {
10860
- const varName = schemaArg.getText();
10861
- const varDecl = sourceFile.getVariableDeclaration(varName);
10862
- if (varDecl !== void 0) {
10863
- const init = varDecl.getInitializer();
10864
- if (init !== void 0) {
10865
- return extractZodParameters(init);
10866
- }
10890
+ if (schemaArg.getKind() === SyntaxKind2.Identifier) {
10891
+ const init = resolveIdentifierInitializer(schemaArg.getSymbol());
10892
+ if (init !== void 0) {
10893
+ return extractZodParameters(init);
10867
10894
  }
10868
10895
  }
10869
10896
  return [];