ucn 3.7.14 → 3.7.16

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/core/output.js CHANGED
@@ -1920,6 +1920,20 @@ function formatGraph(graph, options = {}) {
1920
1920
  return lines.join('\n');
1921
1921
  }
1922
1922
 
1923
+ /**
1924
+ * Detect common double-escaping patterns in regex search terms.
1925
+ * When MCP/JSON transport is involved, agents often write \\. when they mean \. (literal dot).
1926
+ * Returns a hint string if double-escaping is suspected, empty string otherwise.
1927
+ */
1928
+ function detectDoubleEscaping(term) {
1929
+ // Look for \\. \\d \\w \\s \\b \\D \\W \\S \\B \\( \\) \\[ \\] — common double-escaped sequences
1930
+ const doubleEscaped = term.match(/\\\\[.dDwWsSbB()\[\]*+?^${}|]/g);
1931
+ if (!doubleEscaped) return '';
1932
+ const examples = [...new Set(doubleEscaped)].slice(0, 3);
1933
+ const fixed = examples.map(e => e.slice(1)); // remove one backslash
1934
+ return `\nHint: Pattern contains ${examples.join(', ')} which matches literal backslash(es). If you meant ${fixed.join(', ')}, use a single backslash (MCP/JSON parameters are already raw strings).`;
1935
+ }
1936
+
1923
1937
  /**
1924
1938
  * Format search command output
1925
1939
  */
@@ -1933,15 +1947,17 @@ function formatSearch(results, term) {
1933
1947
  if (totalMatches === 0) {
1934
1948
  if (meta) {
1935
1949
  const scope = meta.filesSkipped > 0
1936
- ? `Searched ${meta.filesScanned} of ${meta.totalFiles} files (${meta.filesSkipped} excluded by filters).`
1937
- : `Searched ${meta.filesScanned} files.`;
1938
- return `No matches found for "${term}". ${scope}${fallbackNote}`;
1950
+ ? `Searched ${meta.filesScanned} of ${meta.totalFiles} file${meta.totalFiles === 1 ? '' : 's'} (${meta.filesSkipped} excluded by filters).`
1951
+ : `Searched ${meta.filesScanned} file${meta.filesScanned === 1 ? '' : 's'}.`;
1952
+ const escapingHint = detectDoubleEscaping(term);
1953
+ return `No matches found for "${term}". ${scope}${fallbackNote}${escapingHint}`;
1939
1954
  }
1940
1955
  return `No matches found for "${term}"${fallbackNote}`;
1941
1956
  }
1942
1957
 
1943
1958
  const lines = [];
1944
- lines.push(`Found ${totalMatches} matches for "${term}" in ${results.length} files:`);
1959
+ const fileWord = results.length === 1 ? 'file' : 'files';
1960
+ lines.push(`Found ${totalMatches} match${totalMatches === 1 ? '' : 'es'} for "${term}" in ${results.length} ${fileWord}:`);
1945
1961
  if (fallbackNote) lines.push(fallbackNote.trim());
1946
1962
  lines.push('═'.repeat(60));
1947
1963
 
@@ -2358,6 +2374,7 @@ module.exports = {
2358
2374
  formatClass,
2359
2375
  formatGraph,
2360
2376
  formatSearch,
2377
+ detectDoubleEscaping,
2361
2378
  formatFileExports,
2362
2379
  formatStats,
2363
2380
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ucn",
3
- "version": "3.7.14",
3
+ "version": "3.7.16",
4
4
  "mcpName": "io.github.mleoca/ucn",
5
5
  "description": "Universal Code Navigator — AST-based call graph analysis for AI agents. Find callers, trace impact, detect dead code across JS/TS, Python, Go, Rust, Java, and HTML. CLI, MCP server, and agent skill.",
6
6
  "main": "index.js",
@@ -1 +0,0 @@
1
- ghu_k0bpQ4IVOHqywvBi3Q437S5YCpLbSA0Laxm6
@@ -1 +0,0 @@
1
- {"token":"eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJtY3AtcmVnaXN0cnkiLCJleHAiOjE3NzIwMTAwNjAsIm5iZiI6MTc3MjAwOTc2MCwiaWF0IjoxNzcyMDA5NzYwLCJhdXRoX21ldGhvZCI6ImdpdGh1Yi1hdCIsImF1dGhfbWV0aG9kX3N1YiI6Im1sZW9jYSIsInBlcm1pc3Npb25zIjpbeyJhY3Rpb24iOiJwdWJsaXNoIiwicmVzb3VyY2UiOiJpby5naXRodWIubWxlb2NhLyoifV19.hVf316b7GiborTKy9ZVvcnNEJyNHjIEE7zAC876XjNuyLXCUeV7OGHI8i9ZTPP9U2v8yEk9_awczj0Ziy6xrBQ","expires_at":1772010060}