ucn 5.4.2 → 5.5.0

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 (85) hide show
  1. package/.claude/skills/ucn/SKILL.md +58 -236
  2. package/.claude/skills/ucn/references/commands.md +144 -68
  3. package/.claude/skills/ucn/references/resolution-rules.md +171 -0
  4. package/.claude/skills/ucn/references/trust-contract.md +27 -33
  5. package/README.md +18 -12
  6. package/cli/index.js +40 -14
  7. package/core/accessors.js +118 -3
  8. package/core/account.js +30 -0
  9. package/core/analysis.js +508 -264
  10. package/core/ast-analysis.js +76 -117
  11. package/core/async-producers.js +1729 -0
  12. package/core/bridge.js +1877 -268
  13. package/core/brief.js +6 -0
  14. package/core/build-worker.js +78 -14
  15. package/core/cache.js +522 -31
  16. package/core/callers.js +12053 -1047
  17. package/core/check.js +30 -38
  18. package/core/class-identity.js +1028 -0
  19. package/core/command-contracts.js +6 -6
  20. package/core/configuration-items.js +86 -0
  21. package/core/contract-membership.js +2262 -0
  22. package/core/cpp-scope.js +532 -0
  23. package/core/deadcode.js +171 -49
  24. package/core/decorator-binding.js +260 -0
  25. package/core/discovery.js +281 -164
  26. package/core/errors.js +52 -0
  27. package/core/execute.js +21 -9
  28. package/core/external-macros.js +326 -0
  29. package/core/graph-build.js +277 -8
  30. package/core/graph.js +35 -2
  31. package/core/ignore-rules.js +472 -0
  32. package/core/imports.js +504 -42
  33. package/core/index-ir.js +94 -11
  34. package/core/inprocess-clients.js +636 -0
  35. package/core/ir.js +87 -8
  36. package/core/macro-expansion.js +1416 -0
  37. package/core/output/analysis.js +18 -2
  38. package/core/output/brief.js +3 -0
  39. package/core/output/doctor.js +4 -0
  40. package/core/output/endpoints.js +15 -6
  41. package/core/output/find.js +7 -2
  42. package/core/output/refactoring.js +121 -14
  43. package/core/output/reporting.js +31 -3
  44. package/core/output/shared.js +14 -0
  45. package/core/output-budget.js +305 -122
  46. package/core/parallel-build.js +124 -47
  47. package/core/parser.js +3 -2
  48. package/core/project.js +457 -60
  49. package/core/provenance-facts.js +156 -12
  50. package/core/provenance-overload.js +30 -3
  51. package/core/provenance.js +104 -30
  52. package/core/pytest-fixtures.js +434 -0
  53. package/core/python-fixture-flow.js +17 -3
  54. package/core/python-modules.js +173 -0
  55. package/core/reflection.js +877 -0
  56. package/core/registry.js +1 -1
  57. package/core/reporting.js +234 -52
  58. package/core/request-helpers.js +561 -0
  59. package/core/route-graph.js +1922 -0
  60. package/core/route-lists.js +2414 -0
  61. package/core/rust-macro-expansion.js +2113 -0
  62. package/core/rust-modules.js +185 -0
  63. package/core/search.js +121 -29
  64. package/core/shared.js +19 -1
  65. package/core/test-name-bindings.js +256 -0
  66. package/core/type-denotation.js +1161 -0
  67. package/core/type-references.js +3229 -0
  68. package/core/verify.js +3360 -672
  69. package/languages/adapter.js +31 -5
  70. package/languages/c-family.js +4061 -212
  71. package/languages/c-macro-invocations.js +380 -0
  72. package/languages/c-preprocessor.js +254 -0
  73. package/languages/csharp.js +1406 -49
  74. package/languages/go.js +1243 -70
  75. package/languages/index.js +728 -6
  76. package/languages/java.js +473 -61
  77. package/languages/javascript.js +1270 -197
  78. package/languages/lexical-scope.js +1280 -0
  79. package/languages/python.js +1557 -72
  80. package/languages/rust-macro-rules.js +1020 -0
  81. package/languages/rust-value-flow.js +416 -0
  82. package/languages/rust.js +2237 -115
  83. package/languages/utils.js +298 -4
  84. package/mcp/server.js +22 -8
  85. package/package.json +1 -1
@@ -19,6 +19,7 @@ const OPTIONAL_HELPERS = Object.freeze([
19
19
  'findMacros',
20
20
  'findCallbackUsages',
21
21
  'findInstanceAttributeTypes',
22
+ 'findClassFieldFacts',
22
23
  'findReExports',
23
24
  'extractScriptBlocks',
24
25
  'buildVirtualJSContent',
@@ -28,8 +29,11 @@ const OPTIONAL_HELPERS = Object.freeze([
28
29
  'getBuiltinFieldType',
29
30
  'findPytestFunctions',
30
31
  'findPythonModuleEvidence',
32
+ 'findScopeAlternativeBindings',
31
33
  'isPlatformConcreteCall',
32
34
  'isPlatformConcreteType',
35
+ 'queryTree',
36
+ 'queryTreeIsPlain',
33
37
  ]);
34
38
 
35
39
  function adapterCapabilities(languageModule) {
@@ -70,8 +74,11 @@ function createLanguageAdapter(config) {
70
74
  parse(code, parser) {
71
75
  return languageModule.parse(code, parser);
72
76
  },
73
- findCalls(code, parser) {
74
- return languageModule.findCallsInCode(code, parser);
77
+ findCalls(code, parser, options) {
78
+ // Options carry what the build passes too (Go import names, fix
79
+ // #400): a query-time re-read must see the same file.
80
+ return options ? languageModule.findCallsInCode(code, parser, options)
81
+ : languageModule.findCallsInCode(code, parser);
75
82
  },
76
83
  findImports(code, parser) {
77
84
  return languageModule.findImportsInCode(code, parser);
@@ -79,8 +86,12 @@ function createLanguageAdapter(config) {
79
86
  findExports(code, parser) {
80
87
  return languageModule.findExportsInCode(code, parser);
81
88
  },
82
- findUsages(code, name, parser, tree) {
83
- return languageModule.findUsagesInCode(code, name, parser, tree);
89
+ findUsages(code, name, parser, tree, options) {
90
+ // Only the lexical-scope request (fix #392) reaches the parser;
91
+ // other query options keep the adapter's historical behavior.
92
+ return options?.lexicalScopes
93
+ ? languageModule.findUsagesInCode(code, name, parser, tree, { lexicalScopes: true })
94
+ : languageModule.findUsagesInCode(code, name, parser, tree);
84
95
  },
85
96
  getEntryPointKind(symbol) {
86
97
  return languageModule.getEntryPointKind(symbol);
@@ -88,7 +99,7 @@ function createLanguageAdapter(config) {
88
99
  isEntryPoint(symbol) {
89
100
  return languageModule.isEntryPoint(symbol);
90
101
  },
91
- analyze(code, parser, file = null) {
102
+ analyze(code, parser, file = null, analyzeOptions = {}) {
92
103
  // Full-file indexing consumes immutable records, not native ASTs.
93
104
  // Parsers with a heavier internal recovery cache (notably C/C++)
94
105
  // may release analysis-only trees as soon as those records have
@@ -96,6 +107,9 @@ function createLanguageAdapter(config) {
96
107
  // retain their bounded cross-operation cache.
97
108
  const parsed = languageModule.parse(code, parser, {
98
109
  releaseAnalysisTree: true,
110
+ // Macro definitions the file's include closure supplies
111
+ // (C/C++ recovery, fix #396).
112
+ ...(analyzeOptions.externalMacros && { externalMacros: analyzeOptions.externalMacros }),
99
113
  });
100
114
  const parseProvidesFacts = !!languageModule.parseProvidesAnalysisFacts;
101
115
  const imports = parseProvidesFacts
@@ -115,6 +129,18 @@ function createLanguageAdapter(config) {
115
129
  const calls = parseProvidesFacts && Array.isArray(parsed.calls)
116
130
  ? parsed.calls
117
131
  : languageModule.findCallsInCode(code, parser, callOptions);
132
+ // Reflective member accesses (fix #363), from the same parse:
133
+ // safeParse returns the tree the extractors above just built.
134
+ if (config.traits?.reflectionApi && !parsed.reflectionSites) {
135
+ const { safeParse } = require('./index');
136
+ const { reflectionSitesInTree } = require('../core/reflection');
137
+ // A language reading the file through its own view (C#
138
+ // conditional compilation, fix #391) supplies that tree.
139
+ const analysisTree = typeof languageModule.analysisTree === 'function'
140
+ ? languageModule.analysisTree(code, parser) : safeParse(parser, code);
141
+ const sites = reflectionSitesInTree(analysisTree, config.name, code);
142
+ if (sites.length > 0) parsed.reflectionSites = sites;
143
+ }
118
144
  return createFileIR({
119
145
  language: config.name,
120
146
  file,