@veewo/gitnexus 1.5.0 → 1.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.
Files changed (137) hide show
  1. package/dist/benchmark/agent-context/runner.js +3 -0
  2. package/dist/benchmark/agent-context/runner.test.js +22 -0
  3. package/dist/benchmark/agent-context/tool-runner.d.ts +7 -6
  4. package/dist/benchmark/agent-safe-query-context/io.d.ts +2 -0
  5. package/dist/benchmark/agent-safe-query-context/io.js +86 -0
  6. package/dist/benchmark/agent-safe-query-context/io.test.d.ts +1 -0
  7. package/dist/benchmark/agent-safe-query-context/io.test.js +13 -0
  8. package/dist/benchmark/agent-safe-query-context/report.d.ts +57 -0
  9. package/dist/benchmark/agent-safe-query-context/report.js +159 -0
  10. package/dist/benchmark/agent-safe-query-context/report.test.d.ts +1 -0
  11. package/dist/benchmark/agent-safe-query-context/report.test.js +362 -0
  12. package/dist/benchmark/agent-safe-query-context/runner.d.ts +44 -0
  13. package/dist/benchmark/agent-safe-query-context/runner.js +406 -0
  14. package/dist/benchmark/agent-safe-query-context/runner.test.d.ts +1 -0
  15. package/dist/benchmark/agent-safe-query-context/runner.test.js +290 -0
  16. package/dist/benchmark/agent-safe-query-context/semantic-tuple.d.ts +20 -0
  17. package/dist/benchmark/agent-safe-query-context/semantic-tuple.js +225 -0
  18. package/dist/benchmark/agent-safe-query-context/semantic-tuple.test.d.ts +1 -0
  19. package/dist/benchmark/agent-safe-query-context/semantic-tuple.test.js +122 -0
  20. package/dist/benchmark/agent-safe-query-context/subagent-live.d.ts +47 -0
  21. package/dist/benchmark/agent-safe-query-context/subagent-live.js +128 -0
  22. package/dist/benchmark/agent-safe-query-context/subagent-live.test.d.ts +1 -0
  23. package/dist/benchmark/agent-safe-query-context/subagent-live.test.js +155 -0
  24. package/dist/benchmark/agent-safe-query-context/telemetry-tool.d.ts +9 -0
  25. package/dist/benchmark/agent-safe-query-context/telemetry-tool.js +77 -0
  26. package/dist/benchmark/agent-safe-query-context/types.d.ts +61 -0
  27. package/dist/benchmark/agent-safe-query-context/types.js +8 -0
  28. package/dist/benchmark/runtime-poc/provenance-artifact.d.ts +47 -0
  29. package/dist/benchmark/runtime-poc/provenance-artifact.js +89 -0
  30. package/dist/benchmark/runtime-poc/runner.d.ts +31 -0
  31. package/dist/benchmark/runtime-poc/runner.js +163 -0
  32. package/dist/benchmark/u2-e2e/hydration-policy-repeatability-runner.d.ts +8 -0
  33. package/dist/benchmark/u2-e2e/hydration-policy-repeatability-runner.js +21 -0
  34. package/dist/benchmark/u2-e2e/phase2-runtime-claim-acceptance-runner.d.ts +0 -1
  35. package/dist/benchmark/u2-e2e/phase2-runtime-claim-acceptance-runner.js +53 -51
  36. package/dist/benchmark/u2-e2e/phase2-runtime-claim-acceptance-runner.test.js +0 -1
  37. package/dist/benchmark/u2-e2e/phase5-rule-lab-acceptance-runner.d.ts +1 -1
  38. package/dist/benchmark/u2-e2e/phase5-rule-lab-acceptance-runner.js +82 -18
  39. package/dist/benchmark/u2-e2e/phase5-rule-lab-acceptance-runner.test.js +1 -2
  40. package/dist/benchmark/u2-e2e/retrieval-runner.js +15 -7
  41. package/dist/benchmark/u2-e2e/retrieval-runner.test.js +46 -0
  42. package/dist/cli/ai-context.js +2 -12
  43. package/dist/cli/ai-context.test.js +8 -0
  44. package/dist/cli/analyze-runtime-summary.js +1 -0
  45. package/dist/cli/analyze-runtime-summary.test.js +2 -0
  46. package/dist/cli/analyze-summary.d.ts +2 -0
  47. package/dist/cli/analyze-summary.js +24 -0
  48. package/dist/cli/analyze-summary.test.js +65 -1
  49. package/dist/cli/analyze.js +5 -1
  50. package/dist/cli/benchmark-agent-safe-query-context.d.ts +20 -0
  51. package/dist/cli/benchmark-agent-safe-query-context.js +39 -0
  52. package/dist/cli/benchmark-agent-safe-query-context.test.d.ts +1 -0
  53. package/dist/cli/benchmark-agent-safe-query-context.test.js +271 -0
  54. package/dist/cli/benchmark.d.ts +29 -0
  55. package/dist/cli/benchmark.js +55 -0
  56. package/dist/cli/index.js +23 -0
  57. package/dist/cli/rule-lab.d.ts +3 -7
  58. package/dist/cli/rule-lab.js +13 -22
  59. package/dist/cli/rule-lab.test.js +23 -3
  60. package/dist/cli/tool.d.ts +2 -0
  61. package/dist/cli/tool.js +2 -0
  62. package/dist/core/config/unity-config.d.ts +0 -1
  63. package/dist/core/config/unity-config.js +0 -1
  64. package/dist/core/ingestion/pipeline.js +35 -6
  65. package/dist/core/ingestion/unity-lifecycle-synthetic-calls.test.js +18 -20
  66. package/dist/core/ingestion/unity-parity-seed.d.ts +2 -1
  67. package/dist/core/ingestion/unity-parity-seed.js +8 -0
  68. package/dist/core/ingestion/unity-resource-processor.d.ts +11 -0
  69. package/dist/core/ingestion/unity-resource-processor.js +102 -0
  70. package/dist/core/ingestion/unity-resource-processor.test.js +449 -0
  71. package/dist/core/ingestion/unity-runtime-binding-rules.d.ts +15 -0
  72. package/dist/core/ingestion/unity-runtime-binding-rules.js +178 -30
  73. package/dist/core/lbug/csv-generator.test.js +2 -2
  74. package/dist/core/unity/doc-contract.test.d.ts +1 -0
  75. package/dist/core/unity/doc-contract.test.js +30 -0
  76. package/dist/core/unity/prefab-source-scan.d.ts +25 -0
  77. package/dist/core/unity/prefab-source-scan.js +152 -0
  78. package/dist/core/unity/prefab-source-scan.test.d.ts +1 -0
  79. package/dist/core/unity/prefab-source-scan.test.js +70 -0
  80. package/dist/core/unity/scan-context.d.ts +12 -0
  81. package/dist/core/unity/scan-context.js +50 -2
  82. package/dist/core/unity/scan-context.test.js +74 -0
  83. package/dist/mcp/local/agent-safe-response.d.ts +10 -0
  84. package/dist/mcp/local/agent-safe-response.js +639 -0
  85. package/dist/mcp/local/derived-process-reader.js +1 -1
  86. package/dist/mcp/local/local-backend.d.ts +18 -1
  87. package/dist/mcp/local/local-backend.js +319 -125
  88. package/dist/mcp/local/process-confidence.d.ts +1 -2
  89. package/dist/mcp/local/process-confidence.js +0 -3
  90. package/dist/mcp/local/process-confidence.test.js +4 -2
  91. package/dist/mcp/local/process-evidence.d.ts +1 -8
  92. package/dist/mcp/local/process-evidence.js +1 -23
  93. package/dist/mcp/local/process-evidence.test.js +2 -16
  94. package/dist/mcp/local/process-ref.d.ts +1 -1
  95. package/dist/mcp/local/runtime-chain-closure-evaluator.d.ts +33 -0
  96. package/dist/mcp/local/runtime-chain-closure-evaluator.js +273 -0
  97. package/dist/mcp/local/runtime-chain-graph-candidates.d.ts +23 -0
  98. package/dist/mcp/local/runtime-chain-graph-candidates.js +131 -0
  99. package/dist/mcp/local/runtime-chain-verify.d.ts +1 -1
  100. package/dist/mcp/local/runtime-chain-verify.js +149 -138
  101. package/dist/mcp/local/runtime-chain-verify.test.js +126 -68
  102. package/dist/mcp/local/runtime-claim-rule-registry.d.ts +4 -0
  103. package/dist/mcp/local/runtime-claim-rule-registry.js +4 -0
  104. package/dist/mcp/local/runtime-claim-rule-registry.test.js +37 -4
  105. package/dist/mcp/local/runtime-claim.d.ts +11 -0
  106. package/dist/mcp/local/runtime-claim.js +28 -0
  107. package/dist/mcp/local/unity-evidence-view.d.ts +1 -1
  108. package/dist/mcp/local/unity-evidence-view.js +1 -1
  109. package/dist/mcp/local/unity-evidence-view.test.js +22 -0
  110. package/dist/mcp/tools.js +51 -21
  111. package/dist/rule-lab/analyze.d.ts +2 -1
  112. package/dist/rule-lab/analyze.js +94 -59
  113. package/dist/rule-lab/analyze.test.js +238 -20
  114. package/dist/rule-lab/curate.d.ts +2 -1
  115. package/dist/rule-lab/curate.js +24 -3
  116. package/dist/rule-lab/curate.test.js +65 -0
  117. package/dist/rule-lab/curation-input-builder.d.ts +45 -0
  118. package/dist/rule-lab/curation-input-builder.js +133 -0
  119. package/dist/rule-lab/promote.js +80 -7
  120. package/dist/rule-lab/promote.test.js +150 -0
  121. package/dist/rule-lab/review-pack.d.ts +3 -0
  122. package/dist/rule-lab/review-pack.js +41 -1
  123. package/dist/rule-lab/review-pack.test.js +67 -0
  124. package/dist/rule-lab/types.d.ts +29 -0
  125. package/dist/types/pipeline.d.ts +3 -0
  126. package/package.json +4 -3
  127. package/scripts/run-node-tests.mjs +61 -0
  128. package/skills/_shared/unity-rule-authoring-contract.md +64 -0
  129. package/skills/_shared/unity-runtime-process-contract.md +16 -0
  130. package/skills/gitnexus-cli.md +8 -0
  131. package/skills/gitnexus-debugging.md +9 -0
  132. package/skills/gitnexus-exploring.md +66 -18
  133. package/skills/gitnexus-guide.md +42 -3
  134. package/skills/gitnexus-impact-analysis.md +8 -0
  135. package/skills/gitnexus-pr-review.md +8 -0
  136. package/skills/gitnexus-refactoring.md +8 -0
  137. package/skills/gitnexus-unity-rule-gen.md +66 -312
@@ -5,6 +5,7 @@ import { createInterface } from 'node:readline';
5
5
  import { glob } from 'glob';
6
6
  import { buildAssetMetaIndex, buildMetaIndex } from './meta-index.js';
7
7
  import { buildUnityUiMetaIndex } from './ui-meta-index.js';
8
+ import { streamPrefabSourceRefs } from './prefab-source-scan.js';
8
9
  import { buildSerializableTypeIndexFromFiles } from './serialized-type-index.js';
9
10
  const DECLARATION_PATTERN = /\b(?:class|struct|interface)\s+([A-Za-z_][A-Za-z0-9_]*)\b/g;
10
11
  const SCRIPT_GUID_IN_LINE_PATTERN = /\bm_Script\s*:\s*\{[^}]*\bguid\s*:\s*([0-9a-f]{32})\b/gi;
@@ -30,10 +31,20 @@ export async function buildUnityScanContext(input) {
30
31
  scriptPathToGuid.set(normalizeSlashes(scriptPath), guid);
31
32
  }
32
33
  const resourceFiles = await resolveResourceFiles(input.repoRoot, input.scopedPaths);
33
- const guidToResourceHits = await buildGuidHitIndex(input.repoRoot, scriptPathToGuid, resourceFiles);
34
- const assetMetaFiles = resolveAssetMetaFiles(input.repoRoot, input.scopedPaths, scriptFiles, resourceFiles);
34
+ const normalizedResourceFiles = [...new Set(resourceFiles.map((resourcePath) => normalizeSlashes(resourcePath)))]
35
+ .filter((resourcePath) => resourcePath.length > 0)
36
+ .sort((left, right) => left.localeCompare(right));
37
+ const guidToResourceHits = await buildGuidHitIndex(input.repoRoot, scriptPathToGuid, normalizedResourceFiles);
38
+ const assetMetaFiles = resolveAssetMetaFiles(input.repoRoot, input.scopedPaths, scriptFiles, normalizedResourceFiles);
35
39
  const assetGuidToPath = await buildAssetMetaIndex(input.repoRoot, { metaFiles: assetMetaFiles });
36
40
  const uiMetaIndex = await buildUnityUiMetaIndex(input.repoRoot, { scopedPaths: input.scopedPaths });
41
+ const streamPrefabSourceRefsFn = (options) => streamPrefabSourceRefs({
42
+ repoRoot: input.repoRoot,
43
+ resourceFiles: normalizedResourceFiles,
44
+ assetGuidToPath,
45
+ queue: options?.queue,
46
+ hooks: options?.hooks,
47
+ });
37
48
  const symbolToCanonicalScriptPath = buildCanonicalScriptPathIndex(symbolToScriptPaths, scriptPathToGuid, guidToResourceHits);
38
49
  const symbolToScriptPath = new Map(symbolToCanonicalScriptPath);
39
50
  return {
@@ -47,6 +58,9 @@ export async function buildUnityScanContext(input) {
47
58
  assetGuidToPath,
48
59
  uxmlGuidToPath: uiMetaIndex.uxmlGuidToPath,
49
60
  ussGuidToPath: uiMetaIndex.ussGuidToPath,
61
+ prefabSourceRefs: [],
62
+ streamPrefabSourceRefs: streamPrefabSourceRefsFn,
63
+ resourceFiles: normalizedResourceFiles,
50
64
  resourceDocCache: new Map(),
51
65
  };
52
66
  }
@@ -135,6 +149,20 @@ export function buildUnityScanContextFromSeed(input) {
135
149
  ussGuidToPath.set(guid.toLowerCase(), normalizedPath);
136
150
  }
137
151
  }
152
+ const resourceFiles = [
153
+ ...new Set(Object.values(seed.guidToResourcePaths || {})
154
+ .flat()
155
+ .map((resourcePathRaw) => normalizeSlashes(String(resourcePathRaw || '').trim()))
156
+ .filter((resourcePath) => resourcePath.length > 0)),
157
+ ].sort((left, right) => left.localeCompare(right));
158
+ const prefabSourceRefs = (seed.prefabSourceRefs || [])
159
+ .map((value) => normalizePrefabSourceRef(value))
160
+ .filter((value) => Boolean(value));
161
+ const streamPrefabSourceRefsFn = async function* () {
162
+ for (const row of prefabSourceRefs) {
163
+ yield { ...row };
164
+ }
165
+ };
138
166
  return {
139
167
  symbolToScriptPaths,
140
168
  symbolToCanonicalScriptPath,
@@ -146,6 +174,9 @@ export function buildUnityScanContextFromSeed(input) {
146
174
  assetGuidToPath,
147
175
  uxmlGuidToPath,
148
176
  ussGuidToPath,
177
+ prefabSourceRefs,
178
+ streamPrefabSourceRefs: streamPrefabSourceRefsFn,
179
+ resourceFiles,
149
180
  resourceDocCache: new Map(),
150
181
  };
151
182
  }
@@ -376,6 +407,23 @@ function normalizeRelativePath(repoRoot, filePath) {
376
407
  function normalizeSlashes(filePath) {
377
408
  return filePath.replace(/\\/g, '/');
378
409
  }
410
+ function normalizePrefabSourceRef(value) {
411
+ const sourceResourcePath = normalizeSlashes(String(value?.sourceResourcePath || '').trim());
412
+ const targetGuid = String(value?.targetGuid || '').trim().toLowerCase();
413
+ const targetResourcePath = normalizeSlashes(String(value?.targetResourcePath || '').trim());
414
+ const fileId = String(value?.fileId || '').trim();
415
+ if (!sourceResourcePath || !targetGuid)
416
+ return undefined;
417
+ const sourceLayer = value?.sourceLayer === 'scene' ? 'scene' : value?.sourceLayer === 'prefab' ? 'prefab' : (sourceResourcePath.endsWith('.unity') ? 'scene' : 'prefab');
418
+ return {
419
+ sourceResourcePath,
420
+ targetGuid,
421
+ targetResourcePath: targetResourcePath || undefined,
422
+ fileId: fileId || undefined,
423
+ fieldName: 'm_SourcePrefab',
424
+ sourceLayer,
425
+ };
426
+ }
379
427
  function inferResourceType(resourcePath) {
380
428
  if (resourcePath.endsWith('.prefab'))
381
429
  return 'prefab';
@@ -23,6 +23,80 @@ test('buildUnityScanContext exposes reusable resourceDocCache for repeated resol
23
23
  assert.equal(context.resourceDocCache.size, cacheSizeAfterFirst);
24
24
  assert.ok(cacheSizeAfterFirst > 0);
25
25
  });
26
+ test('buildUnityScanContext exposes resourceFiles for scene/prefab scan pass', async () => {
27
+ const context = await buildUnityScanContext({
28
+ repoRoot: fixtureRoot,
29
+ scopedPaths: ['Assets/Scene/MainUIManager.unity', 'Assets/Prefabs/BattleMode.prefab'],
30
+ });
31
+ assert.ok(context.resourceFiles.includes('Assets/Scene/MainUIManager.unity'));
32
+ assert.ok(context.resourceFiles.includes('Assets/Prefabs/BattleMode.prefab'));
33
+ assert.equal(context.resourceFiles.includes('Assets\\Scene\\MainUIManager.unity'), false);
34
+ assert.equal(new Set(context.resourceFiles).size, context.resourceFiles.length);
35
+ });
36
+ test('buildUnityScanContext exposes prefab-source producer from scoped unity/prefab resources', async () => {
37
+ const context = await buildUnityScanContext({
38
+ repoRoot: fixtureRoot,
39
+ scopedPaths: ['Assets/Scene/MainUIManager.unity', 'Assets/Prefabs/BattleMode.prefab'],
40
+ });
41
+ assert.equal(typeof context.streamPrefabSourceRefs, 'function');
42
+ const rows = [];
43
+ for await (const row of context.streamPrefabSourceRefs()) {
44
+ rows.push(row);
45
+ }
46
+ assert.ok(rows.length > 0);
47
+ const sample = rows[0];
48
+ assert.equal(sample.fieldName, 'm_SourcePrefab');
49
+ assert.equal(sample.sourceLayer === 'scene' || sample.sourceLayer === 'prefab', true);
50
+ });
51
+ test('buildUnityScanContext keeps script-guid hits while exposing prefab-source producer', async () => {
52
+ const context = await buildUnityScanContext({ repoRoot: fixtureRoot });
53
+ assert.ok(context.guidToResourceHits.size > 0);
54
+ assert.equal(typeof context.streamPrefabSourceRefs, 'function');
55
+ });
56
+ test('buildUnityScanContextFromSeed rebuilds resourceFiles from guidToResourcePaths', () => {
57
+ const context = buildUnityScanContextFromSeed({
58
+ seed: {
59
+ version: 1,
60
+ symbolToScriptPath: {},
61
+ scriptPathToGuid: {},
62
+ guidToResourcePaths: {
63
+ '11111111111111111111111111111111': ['Assets/Scene/MainUIManager.unity', 'Assets/Prefabs/BattleMode.prefab'],
64
+ },
65
+ },
66
+ });
67
+ assert.deepEqual(context.resourceFiles.sort(), [
68
+ 'Assets/Prefabs/BattleMode.prefab',
69
+ 'Assets/Scene/MainUIManager.unity',
70
+ ]);
71
+ });
72
+ test('buildUnityScanContextFromSeed reconstructs prefabSourceRefs', () => {
73
+ const context = buildUnityScanContextFromSeed({
74
+ seed: {
75
+ version: 1,
76
+ symbolToScriptPath: {},
77
+ scriptPathToGuid: {},
78
+ guidToResourcePaths: {},
79
+ prefabSourceRefs: [
80
+ {
81
+ sourceResourcePath: 'Assets/Scene/MainUIManager.unity',
82
+ targetGuid: '99999999999999999999999999999999',
83
+ targetResourcePath: 'Assets/Prefabs/BattleMode.prefab',
84
+ fileId: '100100000',
85
+ fieldName: 'm_SourcePrefab',
86
+ sourceLayer: 'scene',
87
+ },
88
+ ],
89
+ },
90
+ });
91
+ assert.equal(context.prefabSourceRefs.length, 1);
92
+ });
93
+ test('scan-context prefab-source producer drops unresolved and zero-guid entries', async () => {
94
+ const context = await buildUnityScanContext({ repoRoot: fixtureRoot });
95
+ for await (const row of context.streamPrefabSourceRefs()) {
96
+ assert.notEqual(row.targetGuid, '00000000000000000000000000000000');
97
+ assert.ok(String(row.targetResourcePath || '').length > 0);
98
+ }
99
+ });
26
100
  test('buildUnityScanContext accepts symbol declarations as hint source', async () => {
27
101
  const context = await buildUnityScanContext({
28
102
  repoRoot: fixtureRoot,
@@ -0,0 +1,10 @@
1
+ export type ResponseProfile = 'slim' | 'full';
2
+ export declare function resolveResponseProfile(value: unknown): ResponseProfile;
3
+ export declare function buildSlimQueryResult(full: Record<string, any>, input: {
4
+ repoName?: string;
5
+ queryText: string;
6
+ }): Record<string, unknown>;
7
+ export declare function buildSlimContextResult(full: Record<string, any>, input: {
8
+ repoName?: string;
9
+ symbolName: string;
10
+ }): Record<string, unknown>;