ucn 5.1.1 → 5.2.1
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/.claude/skills/ucn/SKILL.md +26 -5
- package/.claude/skills/ucn/references/commands.md +5 -5
- package/README.md +42 -15
- package/core/accessors.js +183 -0
- package/core/analysis.js +46 -0
- package/core/ast-analysis.js +104 -0
- package/core/cache.js +32 -1
- package/core/callers.js +1255 -64
- package/core/command-contracts.js +13 -13
- package/core/deadcode.js +41 -2
- package/core/execute.js +4 -1
- package/core/graph-build.js +6 -0
- package/core/graph.js +72 -5
- package/core/index-ir.js +13 -2
- package/core/ir.js +5 -3
- package/core/output/analysis.js +30 -1
- package/core/output/graph.js +28 -8
- package/core/output/public.js +4 -0
- package/core/output/refactoring.js +31 -2
- package/core/output/reporting.js +7 -0
- package/core/project.js +32 -0
- package/core/search.js +9 -0
- package/core/verify.js +1168 -38
- package/languages/c-family.js +239 -26
- package/languages/csharp.js +40 -4
- package/languages/go.js +473 -71
- package/languages/javascript.js +86 -4
- package/languages/python.js +392 -101
- package/languages/rust.js +87 -4
- package/languages/utils.js +11 -0
- package/mcp/server.js +99 -103
- package/mcp/stdio-server.js +296 -0
- package/package.json +10 -8
package/core/project.js
CHANGED
|
@@ -444,6 +444,9 @@ class ProjectIndex {
|
|
|
444
444
|
this._completenessCache = null;
|
|
445
445
|
this._attrTypeCache = null;
|
|
446
446
|
this._computedDispatchBlindspots = null;
|
|
447
|
+
this._cppVisibleFilesCache?.clear();
|
|
448
|
+
this._cppTargetVisibilityCache?.clear();
|
|
449
|
+
this._cppMacroParamOutcomesCache?.clear();
|
|
447
450
|
// Endpoints cache (server routes / client requests / bridges) becomes
|
|
448
451
|
// stale when files change; clear on every rebuild.
|
|
449
452
|
this._endpointsCache = null;
|
|
@@ -589,6 +592,13 @@ class ProjectIndex {
|
|
|
589
592
|
return false;
|
|
590
593
|
}
|
|
591
594
|
|
|
595
|
+
// These query caches depend on project symbols and include closure.
|
|
596
|
+
// A changed file can alter either even before a full rebuild reaches
|
|
597
|
+
// its graph phase, so no prior call-identity verdict may survive.
|
|
598
|
+
this._cppVisibleFilesCache?.clear();
|
|
599
|
+
this._cppTargetVisibilityCache?.clear();
|
|
600
|
+
this._cppMacroParamOutcomesCache?.clear();
|
|
601
|
+
|
|
592
602
|
if (existing) {
|
|
593
603
|
this.removeFileSymbols(filePath);
|
|
594
604
|
}
|
|
@@ -942,6 +952,28 @@ class ProjectIndex {
|
|
|
942
952
|
return entries;
|
|
943
953
|
}
|
|
944
954
|
|
|
955
|
+
/**
|
|
956
|
+
* Def-exact inheritance parents (fix #300): resolve parents for ONE
|
|
957
|
+
* specific class definition by (file, startLine). Same-name classes in
|
|
958
|
+
* one file (function-local test classes) carry different parents; the
|
|
959
|
+
* file-granular lookup above conflates them. Returns null when no entry
|
|
960
|
+
* matches — for a known def that means it extends nothing (entries are
|
|
961
|
+
* only recorded for extends-bearing defs), which callers must treat as
|
|
962
|
+
* "no parents", never fall back to a sibling def's edges.
|
|
963
|
+
* @param {string} className
|
|
964
|
+
* @param {string} contextFile
|
|
965
|
+
* @param {number} defStartLine
|
|
966
|
+
* @returns {string[]|null}
|
|
967
|
+
*/
|
|
968
|
+
_getInheritanceParentsAt(className, contextFile, defStartLine) {
|
|
969
|
+
const entries = this.extendsGraph.get(className);
|
|
970
|
+
if (!entries || entries.length === 0) return null;
|
|
971
|
+
if (typeof entries[0] !== 'object' || entries[0].file === undefined) return null;
|
|
972
|
+
const match = entries.find(e => e.file === contextFile &&
|
|
973
|
+
e.startLine === defStartLine);
|
|
974
|
+
return match ? match.parents : null;
|
|
975
|
+
}
|
|
976
|
+
|
|
945
977
|
/**
|
|
946
978
|
* Resolve which file a class is defined in, preferring contextFile.
|
|
947
979
|
* Used during inheritance BFS to find grandparent chains.
|
package/core/search.js
CHANGED
|
@@ -352,6 +352,15 @@ function usages(index, name, options = {}) {
|
|
|
352
352
|
usageType: u.usageType,
|
|
353
353
|
isDefinition: false,
|
|
354
354
|
...(u.receiver && { receiver: u.receiver }),
|
|
355
|
+
// Refactoring internals need the exact AST token and
|
|
356
|
+
// receiver provenance, but the public usages JSON is a
|
|
357
|
+
// stable line-oriented inventory. Keep this opt-in so
|
|
358
|
+
// plan gains precision without changing that surface.
|
|
359
|
+
...(options.internalEvidence && {
|
|
360
|
+
...(Number.isInteger(u.column) && { column: u.column }),
|
|
361
|
+
...(u.receiverIsModule && { receiverIsModule: true }),
|
|
362
|
+
...(u.receiverLocalBinding && { receiverLocalBinding: true }),
|
|
363
|
+
}),
|
|
355
364
|
...(callerSym && {
|
|
356
365
|
callerName: callerSym.name,
|
|
357
366
|
callerStartLine: callerSym.startLine
|