gitnexus 1.6.9-rc.27 → 1.6.9-rc.28
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.
|
@@ -32,6 +32,7 @@ export declare const HANDLES_ROUTE_QUERY = "\nMATCH (handlerFile:File)-[r:CodeRe
|
|
|
32
32
|
* - collapse `:id`, `{id}`, `[id]` path params into a single `{param}`
|
|
33
33
|
*/
|
|
34
34
|
export declare function normalizeHttpPath(p: string): string;
|
|
35
|
+
export declare function normalizeRepoRelPath(filePath: string): string;
|
|
35
36
|
export declare class HttpRouteExtractor implements ContractExtractor {
|
|
36
37
|
type: "http";
|
|
37
38
|
canExtract(_repo: RepoHandle): Promise<boolean>;
|
|
@@ -230,6 +230,9 @@ function normalizeConsumerPath(url) {
|
|
|
230
230
|
function contractIdFor(method, pathNorm) {
|
|
231
231
|
return `http::${method.toUpperCase()}::${pathNorm}`;
|
|
232
232
|
}
|
|
233
|
+
export function normalizeRepoRelPath(filePath) {
|
|
234
|
+
return filePath.replace(/\\/g, '/').replace(/^\.\//, '');
|
|
235
|
+
}
|
|
233
236
|
// ─── Graph row helpers ───────────────────────────────────────────────
|
|
234
237
|
function methodFromRouteReason(reason) {
|
|
235
238
|
const r = reason || '';
|
|
@@ -696,6 +699,7 @@ export class HttpRouteExtractor {
|
|
|
696
699
|
const out = [];
|
|
697
700
|
for (const rel of files) {
|
|
698
701
|
const detections = await getDetections(rel);
|
|
702
|
+
const filePath = normalizeRepoRelPath(rel);
|
|
699
703
|
for (const d of detections) {
|
|
700
704
|
if (d.role !== 'provider')
|
|
701
705
|
continue;
|
|
@@ -703,14 +707,14 @@ export class HttpRouteExtractor {
|
|
|
703
707
|
// Resolve the handler to a real symbol (named handler, or the inline
|
|
704
708
|
// arrow that encloses the registration line) so the contract carries a
|
|
705
709
|
// real symbolUid; fall back to the file + detection name otherwise.
|
|
706
|
-
const resolved = await resolveSymbol(
|
|
710
|
+
const resolved = await resolveSymbol(filePath, d);
|
|
707
711
|
out.push({
|
|
708
712
|
contractId: contractIdFor(d.method, pathNorm),
|
|
709
713
|
type: 'http',
|
|
710
714
|
role: 'provider',
|
|
711
715
|
symbolUid: resolved?.uid ?? '',
|
|
712
716
|
symbolRef: {
|
|
713
|
-
filePath: resolved?.filePath ||
|
|
717
|
+
filePath: resolved?.filePath || filePath,
|
|
714
718
|
name: resolved?.name ?? d.name ?? 'handler',
|
|
715
719
|
},
|
|
716
720
|
symbolName: resolved?.name ?? d.name ?? 'handler',
|
|
@@ -797,6 +801,7 @@ export class HttpRouteExtractor {
|
|
|
797
801
|
const out = [];
|
|
798
802
|
for (const rel of files) {
|
|
799
803
|
const detections = await getDetections(rel);
|
|
804
|
+
const filePath = normalizeRepoRelPath(rel);
|
|
800
805
|
for (const d of detections) {
|
|
801
806
|
if (d.role !== 'consumer')
|
|
802
807
|
continue;
|
|
@@ -804,13 +809,13 @@ export class HttpRouteExtractor {
|
|
|
804
809
|
// Resolve the function CONTAINING the fetch/axios call so the consumer
|
|
805
810
|
// contract carries a real symbolUid (was always '' — the gap that left
|
|
806
811
|
// cross-repo trace/impact unable to traverse HTTP links).
|
|
807
|
-
const resolved = await resolveSymbol(
|
|
812
|
+
const resolved = await resolveSymbol(filePath, d);
|
|
808
813
|
out.push({
|
|
809
814
|
contractId: contractIdFor(d.method, pathNorm),
|
|
810
815
|
type: 'http',
|
|
811
816
|
role: 'consumer',
|
|
812
817
|
symbolUid: resolved?.uid ?? '',
|
|
813
|
-
symbolRef: { filePath: resolved?.filePath ||
|
|
818
|
+
symbolRef: { filePath: resolved?.filePath || filePath, name: resolved?.name ?? 'fetch' },
|
|
814
819
|
symbolName: resolved?.name ?? 'fetch',
|
|
815
820
|
confidence: d.confidence,
|
|
816
821
|
meta: {
|
package/dist/storage/git.js
CHANGED
|
@@ -99,6 +99,12 @@ export const getRemoteUrl = (repoPath) => {
|
|
|
99
99
|
* Find the git repository root from any path inside the repo
|
|
100
100
|
*/
|
|
101
101
|
export const getGitRoot = (fromPath) => {
|
|
102
|
+
const resolved = path.resolve(fromPath);
|
|
103
|
+
// Avoid git rev-parse --show-toplevel trimming trailing spaces from the
|
|
104
|
+
// repository root on Windows; callers that need identity keys canonicalize
|
|
105
|
+
// this value with realpath before comparing it.
|
|
106
|
+
if (hasGitDir(resolved))
|
|
107
|
+
return resolved;
|
|
102
108
|
try {
|
|
103
109
|
const raw = chompGitOutput(execSync('git rev-parse --show-toplevel', {
|
|
104
110
|
cwd: fromPath,
|
package/package.json
CHANGED
|
@@ -36,6 +36,7 @@ const PLATFORM_LOGIC = [
|
|
|
36
36
|
'test/unit/lbug-pool-fts-load.test.ts',
|
|
37
37
|
'test/unit/repo-manager.test.ts',
|
|
38
38
|
'test/unit/repo-manager-finalize-invariant.test.ts',
|
|
39
|
+
'test/unit/git-utils.test.ts',
|
|
39
40
|
'test/unit/hooks.test.ts',
|
|
40
41
|
'test/unit/hook-db-lock-probe.test.ts',
|
|
41
42
|
'test/unit/cursor-hook.test.ts',
|