@blamechris/repo-memory 0.12.0 → 0.13.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.
- package/dist/cache/generation.d.ts +50 -0
- package/dist/cache/generation.d.ts.map +1 -0
- package/dist/cache/generation.js +62 -0
- package/dist/cache/generation.js.map +1 -0
- package/dist/cache/invalidation.d.ts +3 -1
- package/dist/cache/invalidation.d.ts.map +1 -1
- package/dist/cache/invalidation.js +4 -5
- package/dist/cache/invalidation.js.map +1 -1
- package/dist/cache/ranking.d.ts +51 -6
- package/dist/cache/ranking.d.ts.map +1 -1
- package/dist/cache/ranking.js +92 -18
- package/dist/cache/ranking.js.map +1 -1
- package/dist/cache/store.d.ts +32 -0
- package/dist/cache/store.d.ts.map +1 -1
- package/dist/cache/store.js +110 -19
- package/dist/cache/store.js.map +1 -1
- package/dist/graph/dependency-graph.d.ts +14 -0
- package/dist/graph/dependency-graph.d.ts.map +1 -1
- package/dist/graph/dependency-graph.js +70 -5
- package/dist/graph/dependency-graph.js.map +1 -1
- package/dist/graph/refresh.d.ts +21 -0
- package/dist/graph/refresh.d.ts.map +1 -0
- package/dist/graph/refresh.js +101 -0
- package/dist/graph/refresh.js.map +1 -0
- package/dist/indexer/imports.d.ts.map +1 -1
- package/dist/indexer/imports.js +152 -86
- package/dist/indexer/imports.js.map +1 -1
- package/dist/indexer/project-map.d.ts +0 -2
- package/dist/indexer/project-map.d.ts.map +1 -1
- package/dist/indexer/project-map.js +0 -3
- package/dist/indexer/project-map.js.map +1 -1
- package/dist/indexer/source-extensions.d.ts +10 -0
- package/dist/indexer/source-extensions.d.ts.map +1 -0
- package/dist/indexer/source-extensions.js +28 -0
- package/dist/indexer/source-extensions.js.map +1 -0
- package/dist/indexer/summarize.d.ts +16 -1
- package/dist/indexer/summarize.d.ts.map +1 -1
- package/dist/indexer/summarize.js +38 -23
- package/dist/indexer/summarize.js.map +1 -1
- package/dist/persistence/db.d.ts.map +1 -1
- package/dist/persistence/db.js +78 -13
- package/dist/persistence/db.js.map +1 -1
- package/dist/server.js +18 -11
- package/dist/server.js.map +1 -1
- package/dist/tools/batch-file-summaries.d.ts +0 -1
- package/dist/tools/batch-file-summaries.d.ts.map +1 -1
- package/dist/tools/batch-file-summaries.js +1 -1
- package/dist/tools/batch-file-summaries.js.map +1 -1
- package/dist/tools/force-reread.d.ts.map +1 -1
- package/dist/tools/force-reread.js +7 -0
- package/dist/tools/force-reread.js.map +1 -1
- package/dist/tools/get-changed-files.d.ts.map +1 -1
- package/dist/tools/get-changed-files.js +23 -5
- package/dist/tools/get-changed-files.js.map +1 -1
- package/dist/tools/get-dependency-graph.d.ts +9 -7
- package/dist/tools/get-dependency-graph.d.ts.map +1 -1
- package/dist/tools/get-dependency-graph.js +51 -74
- package/dist/tools/get-dependency-graph.js.map +1 -1
- package/dist/tools/get-file-summary.d.ts +2 -3
- package/dist/tools/get-file-summary.d.ts.map +1 -1
- package/dist/tools/get-file-summary.js +11 -19
- package/dist/tools/get-file-summary.js.map +1 -1
- package/dist/tools/get-project-map.d.ts.map +1 -1
- package/dist/tools/get-project-map.js +9 -1
- package/dist/tools/get-project-map.js.map +1 -1
- package/dist/tools/get-related-files.d.ts.map +1 -1
- package/dist/tools/get-related-files.js +19 -71
- package/dist/tools/get-related-files.js.map +1 -1
- package/dist/tools/search-by-purpose.d.ts +2 -3
- package/dist/tools/search-by-purpose.d.ts.map +1 -1
- package/dist/tools/search-by-purpose.js +103 -44
- package/dist/tools/search-by-purpose.js.map +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,111 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
import { DependencyGraph } from '../graph/dependency-graph.js';
|
|
4
|
-
import { scanProject } from '../indexer/scanner.js';
|
|
1
|
+
import { loadFreshGraph } from '../graph/refresh.js';
|
|
5
2
|
import { validatePath } from '../utils/validate-path.js';
|
|
6
|
-
|
|
3
|
+
/** Default number of files included in the no-path whole-repo summary. */
|
|
4
|
+
const DEFAULT_SUMMARY_LIMIT = 50;
|
|
5
|
+
export async function getDependencyGraphTool(projectRoot, path, direction, depth, symbol, limit) {
|
|
7
6
|
if (path) {
|
|
8
7
|
path = validatePath(projectRoot, path);
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const files = await scanProject(projectRoot);
|
|
13
|
-
for (const file of files) {
|
|
14
|
-
if (!file.endsWith('.ts') && !file.endsWith('.js') && !file.endsWith('.tsx') &&
|
|
15
|
-
!file.endsWith('.jsx') && !file.endsWith('.mjs') && !file.endsWith('.cjs') &&
|
|
16
|
-
!file.endsWith('.py') && !file.endsWith('.go') && !file.endsWith('.rs')) {
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
try {
|
|
20
|
-
const contents = await readFile(join(projectRoot, file), 'utf-8');
|
|
21
|
-
graph.updateFile(file, contents);
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
// Skip unreadable files
|
|
25
|
-
}
|
|
26
|
-
}
|
|
9
|
+
// Load the persisted dependency graph, refreshing only stale files.
|
|
10
|
+
const graph = await loadFreshGraph(projectRoot);
|
|
27
11
|
if (symbol) {
|
|
28
12
|
return getSymbolEdges(graph, symbol, path);
|
|
29
13
|
}
|
|
30
14
|
if (path) {
|
|
31
15
|
return getNeighborhood(graph, path, direction ?? 'both', depth);
|
|
32
16
|
}
|
|
33
|
-
return getFullSummary(graph);
|
|
17
|
+
return getFullSummary(graph, limit ?? DEFAULT_SUMMARY_LIMIT);
|
|
34
18
|
}
|
|
35
19
|
function getNeighborhood(graph, path, direction, depth) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
const files = new Set([path]);
|
|
21
|
+
let totalEdges = 0;
|
|
22
|
+
const result = { stats: { totalFiles: 0, totalEdges: 0 } };
|
|
39
23
|
if (direction === 'dependencies' || direction === 'both') {
|
|
40
|
-
const
|
|
24
|
+
const targets = depth !== undefined
|
|
41
25
|
? graph.getTransitiveDependencies(path, depth)
|
|
42
26
|
: graph.getDependencies(path);
|
|
43
|
-
for (const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
27
|
+
for (const target of targets)
|
|
28
|
+
files.add(target);
|
|
29
|
+
totalEdges += targets.length;
|
|
30
|
+
result.deps = { [path]: [...targets].sort() };
|
|
47
31
|
}
|
|
48
32
|
if (direction === 'dependents' || direction === 'both') {
|
|
49
|
-
const
|
|
33
|
+
const sources = depth !== undefined
|
|
50
34
|
? graph.getTransitiveDependents(path, depth)
|
|
51
35
|
: graph.getDependents(path);
|
|
52
|
-
for (const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
36
|
+
for (const source of sources)
|
|
37
|
+
files.add(source);
|
|
38
|
+
totalEdges += sources.length;
|
|
39
|
+
result.dependents = { [path]: [...sources].sort() };
|
|
56
40
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
edges,
|
|
60
|
-
stats: {
|
|
61
|
-
totalFiles: nodes.size,
|
|
62
|
-
totalEdges: edges.length,
|
|
63
|
-
mostConnected: graph.getMostConnected(5),
|
|
64
|
-
},
|
|
65
|
-
};
|
|
41
|
+
result.stats = { totalFiles: files.size, totalEdges };
|
|
42
|
+
return result;
|
|
66
43
|
}
|
|
67
44
|
function getSymbolEdges(graph, symbol, path) {
|
|
68
45
|
const matchingEdges = graph.getEdgesBySymbol(symbol, path);
|
|
69
|
-
const
|
|
70
|
-
const
|
|
46
|
+
const files = new Set();
|
|
47
|
+
const deps = {};
|
|
71
48
|
for (const edge of matchingEdges) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
49
|
+
files.add(edge.source);
|
|
50
|
+
files.add(edge.target);
|
|
51
|
+
(deps[edge.source] ??= []).push(edge.target);
|
|
52
|
+
}
|
|
53
|
+
for (const source of Object.keys(deps)) {
|
|
54
|
+
deps[source].sort();
|
|
75
55
|
}
|
|
76
56
|
return {
|
|
77
|
-
|
|
78
|
-
edges,
|
|
57
|
+
deps,
|
|
79
58
|
stats: {
|
|
80
|
-
totalFiles:
|
|
81
|
-
totalEdges:
|
|
82
|
-
mostConnected: graph.getMostConnected(5),
|
|
59
|
+
totalFiles: files.size,
|
|
60
|
+
totalEdges: matchingEdges.length,
|
|
83
61
|
},
|
|
84
62
|
};
|
|
85
63
|
}
|
|
86
|
-
function getFullSummary(graph) {
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
edges.push({ from: dep, to: entry.path });
|
|
99
|
-
}
|
|
64
|
+
function getFullSummary(graph, limit) {
|
|
65
|
+
// Rank every node by connectivity; the summary covers the top `limit`.
|
|
66
|
+
const ranked = graph.getMostConnected(Number.MAX_SAFE_INTEGER);
|
|
67
|
+
const totalFiles = ranked.length;
|
|
68
|
+
let totalEdges = 0;
|
|
69
|
+
for (const { path } of ranked) {
|
|
70
|
+
totalEdges += graph.getDependencies(path).length;
|
|
71
|
+
}
|
|
72
|
+
const included = ranked.slice(0, Math.max(0, limit));
|
|
73
|
+
const deps = {};
|
|
74
|
+
for (const { path } of included) {
|
|
75
|
+
deps[path] = graph.getDependencies(path).sort();
|
|
100
76
|
}
|
|
77
|
+
const truncated = totalFiles > included.length;
|
|
101
78
|
return {
|
|
102
|
-
|
|
103
|
-
edges,
|
|
79
|
+
deps,
|
|
104
80
|
stats: {
|
|
105
|
-
totalFiles
|
|
106
|
-
totalEdges
|
|
107
|
-
mostConnected,
|
|
81
|
+
totalFiles,
|
|
82
|
+
totalEdges,
|
|
83
|
+
mostConnected: graph.getMostConnected(10),
|
|
108
84
|
},
|
|
85
|
+
...(truncated ? { truncated: true } : {}),
|
|
109
86
|
};
|
|
110
87
|
}
|
|
111
88
|
//# sourceMappingURL=get-dependency-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-dependency-graph.js","sourceRoot":"","sources":["../../src/tools/get-dependency-graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-dependency-graph.js","sourceRoot":"","sources":["../../src/tools/get-dependency-graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,0EAA0E;AAC1E,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAiBjC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,WAAmB,EACnB,IAAa,EACb,SAAkD,EAClD,KAAc,EACd,MAAe,EACf,KAAc;IAEd,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,GAAG,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IACD,oEAAoE;IACpE,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,CAAC;IAEhD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,IAAI,MAAM,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,cAAc,CAAC,KAAK,EAAE,KAAK,IAAI,qBAAqB,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,eAAe,CACtB,KAAsB,EACtB,IAAY,EACZ,SAAiD,EACjD,KAAc;IAEd,MAAM,KAAK,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,MAAM,GAA0B,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,E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AAK,MAAM,EAAE,IAAI,EAAE,IAAI,QAAQ,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC/C,OAAO;QACL,IAAI;QACJ,KAAK,EAAE;YACL,UAAU;YACV,UAAU;YACV,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC;SAC1C;QACD,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { FileSummary } from '../types.js';
|
|
2
2
|
export interface FileSummaryResult {
|
|
3
3
|
path: string;
|
|
4
|
-
hash: string;
|
|
5
4
|
summary: FileSummary;
|
|
6
5
|
fromCache: boolean;
|
|
7
|
-
|
|
8
|
-
cacheAge
|
|
6
|
+
/** Seconds since the cached entry was last validated; only present on cache hits. */
|
|
7
|
+
cacheAge?: number;
|
|
9
8
|
suggestFullRead: boolean;
|
|
10
9
|
}
|
|
11
10
|
export interface GetFileSummaryOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-summary.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-summary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-file-summary.d.ts","sourceRoot":"","sources":["../../src/tools/get-file-summary.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAsD5B"}
|
|
@@ -2,7 +2,9 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { hashContents } from '../cache/hash.js';
|
|
4
4
|
import { CacheStore } from '../cache/store.js';
|
|
5
|
+
import { isGraphIndexable } from '../indexer/source-extensions.js';
|
|
5
6
|
import { summarizeForProject, ensureSummaryGeneration } from '../indexer/summarize.js';
|
|
7
|
+
import { DependencyGraph } from '../graph/dependency-graph.js';
|
|
6
8
|
import { TelemetryTracker } from '../telemetry/tracker.js';
|
|
7
9
|
import { estimateTokensSaved } from '../telemetry/tokens.js';
|
|
8
10
|
import { validatePath } from '../utils/validate-path.js';
|
|
@@ -17,9 +19,6 @@ export async function getFileSummary(projectRoot, relativePath, options = {}) {
|
|
|
17
19
|
const currentHash = hashContents(contents);
|
|
18
20
|
// Check cache
|
|
19
21
|
const cached = store.getEntry(relativePath);
|
|
20
|
-
const cacheAge = cached
|
|
21
|
-
? Math.floor((Date.now() - cached.lastChecked) / 1000)
|
|
22
|
-
: null;
|
|
23
22
|
const tracker = new TelemetryTracker(projectRoot);
|
|
24
23
|
if (cached && cached.hash === currentHash && cached.summary) {
|
|
25
24
|
if (trackTelemetry) {
|
|
@@ -28,37 +27,30 @@ export async function getFileSummary(projectRoot, relativePath, options = {}) {
|
|
|
28
27
|
}
|
|
29
28
|
return {
|
|
30
29
|
path: relativePath,
|
|
31
|
-
hash: currentHash,
|
|
32
30
|
summary: cached.summary,
|
|
33
31
|
fromCache: true,
|
|
34
|
-
|
|
35
|
-
cacheAge,
|
|
32
|
+
cacheAge: Math.floor((Date.now() - cached.lastChecked) / 1000),
|
|
36
33
|
suggestFullRead: cached.summary.confidence === 'low',
|
|
37
34
|
};
|
|
38
35
|
}
|
|
39
36
|
// Generate fresh summary
|
|
40
37
|
const summary = await summarizeForProject(projectRoot, relativePath, contents);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
reason = 'cache_miss: no summary in cache';
|
|
38
|
+
// Persist this file's import edges alongside the summary (contents are
|
|
39
|
+
// already in hand), so the dependency graph stays as fresh as the summary
|
|
40
|
+
// cache. Edges go first: if the entry write never happens, a stale hash
|
|
41
|
+
// simply re-triggers extraction — the reverse order could mark stale edges
|
|
42
|
+
// as fresh.
|
|
43
|
+
if (isGraphIndexable(relativePath)) {
|
|
44
|
+
new DependencyGraph(projectRoot).updateFile(relativePath, contents);
|
|
51
45
|
}
|
|
46
|
+
store.setEntry(relativePath, currentHash, summary);
|
|
52
47
|
if (trackTelemetry) {
|
|
53
48
|
tracker.trackEvent('cache_miss', relativePath, 0);
|
|
54
49
|
}
|
|
55
50
|
return {
|
|
56
51
|
path: relativePath,
|
|
57
|
-
hash: currentHash,
|
|
58
52
|
summary,
|
|
59
53
|
fromCache: false,
|
|
60
|
-
reason,
|
|
61
|
-
cacheAge,
|
|
62
54
|
suggestFullRead: summary.confidence === 'low',
|
|
63
55
|
};
|
|
64
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-summary.js","sourceRoot":"","sources":["../../src/tools/get-file-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MA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C,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAEnD,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,OAAO;QACP,SAAS,EAAE,KAAK;QAChB,eAAe,EAAE,OAAO,CAAC,UAAU,KAAK,KAAK;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-project-map.d.ts","sourceRoot":"","sources":["../../src/tools/get-project-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-project-map.d.ts","sourceRoot":"","sources":["../../src/tools/get-project-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAW7E,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAErB"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { buildProjectMap } from '../indexer/project-map.js';
|
|
2
|
+
/**
|
|
3
|
+
* Default directory depth for the project map. An undepthed map of a large
|
|
4
|
+
* repo costs thousands of tokens; depth 2 keeps the first orientation call
|
|
5
|
+
* cheap while still showing the second-level structure. Pass an explicit
|
|
6
|
+
* `depth` for more (buildProjectMap itself stays unlimited-by-default for
|
|
7
|
+
* programmatic reuse).
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_DEPTH = 2;
|
|
2
10
|
export async function getProjectMap(projectRoot, depth) {
|
|
3
|
-
return buildProjectMap(projectRoot, depth
|
|
11
|
+
return buildProjectMap(projectRoot, { depth: depth ?? DEFAULT_DEPTH });
|
|
4
12
|
}
|
|
5
13
|
//# sourceMappingURL=get-project-map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-project-map.js","sourceRoot":"","sources":["../../src/tools/get-project-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmB,MAAM,2BAA2B,CAAC;AAE7E,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAmB,EACnB,KAAc;IAEd,OAAO,eAAe,CAAC,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"get-project-map.js","sourceRoot":"","sources":["../../src/tools/get-project-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmB,MAAM,2BAA2B,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAmB,EACnB,KAAc;IAEd,OAAO,eAAe,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-related-files.d.ts","sourceRoot":"","sources":["../../src/tools/get-related-files.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,KAAK,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"get-related-files.d.ts","sourceRoot":"","sources":["../../src/tools/get-related-files.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,KAAK,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CAAC,kBAAkB,CAAC,CA0F7B"}
|
|
@@ -1,60 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DependencyGraph } from '../graph/dependency-graph.js';
|
|
1
|
+
import { dirname } from 'node:path';
|
|
2
|
+
import { loadFreshGraph } from '../graph/refresh.js';
|
|
4
3
|
import { scanProject } from '../indexer/scanner.js';
|
|
5
4
|
import { validatePath } from '../utils/validate-path.js';
|
|
6
5
|
import { rankFiles } from '../cache/ranking.js';
|
|
6
|
+
import { CacheStore } from '../cache/store.js';
|
|
7
7
|
import { getTaskContext } from '../tools/task-context.js';
|
|
8
8
|
export async function getRelatedFiles(projectRoot, relativePath, options) {
|
|
9
9
|
const validated = validatePath(projectRoot, relativePath);
|
|
10
10
|
const limit = options?.limit ?? 10;
|
|
11
|
-
//
|
|
12
|
-
const graph = new DependencyGraph(projectRoot);
|
|
11
|
+
// Load the persisted dependency graph, refreshing only stale files.
|
|
13
12
|
const files = await scanProject(projectRoot);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
!file.endsWith('.mjs') &&
|
|
20
|
-
!file.endsWith('.cjs') &&
|
|
21
|
-
!file.endsWith('.py') &&
|
|
22
|
-
!file.endsWith('.go') &&
|
|
23
|
-
!file.endsWith('.rs') &&
|
|
24
|
-
!file.endsWith('.kt') &&
|
|
25
|
-
!file.endsWith('.kts') &&
|
|
26
|
-
!file.endsWith('.java')) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const contents = await readFile(join(projectRoot, file), 'utf-8');
|
|
31
|
-
graph.updateFile(file, contents);
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// Skip unreadable files
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// The graph may store paths with .js extension (from import specifiers) while
|
|
38
|
-
// actual files have .ts extension. Query both variants to get complete results.
|
|
39
|
-
const variants = getPathVariants(validated);
|
|
40
|
-
// Get direct dependencies and dependents across all path variants
|
|
41
|
-
const dependencies = new Set();
|
|
42
|
-
const dependents = new Set();
|
|
43
|
-
for (const v of variants) {
|
|
44
|
-
for (const d of graph.getDependencies(v))
|
|
45
|
-
dependencies.add(d);
|
|
46
|
-
for (const d of graph.getDependents(v))
|
|
47
|
-
dependents.add(d);
|
|
48
|
-
}
|
|
13
|
+
const graph = await loadFreshGraph(projectRoot, files);
|
|
14
|
+
// Import targets are resolved to real file paths at extraction time, so the
|
|
15
|
+
// graph can be queried with the validated path directly.
|
|
16
|
+
const dependencies = new Set(graph.getDependencies(validated));
|
|
17
|
+
const dependents = new Set(graph.getDependents(validated));
|
|
49
18
|
// Get transitive dependencies (depth 2) for "transitive-dependency" classification
|
|
50
|
-
const transitiveDeps = new Set();
|
|
51
|
-
const transitiveDependents = new Set();
|
|
52
|
-
for (const v of variants) {
|
|
53
|
-
for (const d of graph.getTransitiveDependencies(v, 2))
|
|
54
|
-
transitiveDeps.add(d);
|
|
55
|
-
for (const d of graph.getTransitiveDependents(v, 2))
|
|
56
|
-
transitiveDependents.add(d);
|
|
57
|
-
}
|
|
19
|
+
const transitiveDeps = new Set(graph.getTransitiveDependencies(validated, 2));
|
|
20
|
+
const transitiveDependents = new Set(graph.getTransitiveDependents(validated, 2));
|
|
58
21
|
// Determine same-directory files
|
|
59
22
|
const fileDir = dirname(validated);
|
|
60
23
|
const sameDirFiles = new Set(files.filter((f) => f !== validated && dirname(f) === fileDir));
|
|
@@ -70,9 +33,8 @@ export async function getRelatedFiles(projectRoot, relativePath, options) {
|
|
|
70
33
|
candidates.add(d);
|
|
71
34
|
for (const d of sameDirFiles)
|
|
72
35
|
candidates.add(d);
|
|
73
|
-
// Remove the file itself
|
|
74
|
-
|
|
75
|
-
candidates.delete(v);
|
|
36
|
+
// Remove the file itself
|
|
37
|
+
candidates.delete(validated);
|
|
76
38
|
if (candidates.size === 0) {
|
|
77
39
|
return { path: validated, relatedFiles: [] };
|
|
78
40
|
}
|
|
@@ -107,13 +69,18 @@ export async function getRelatedFiles(projectRoot, relativePath, options) {
|
|
|
107
69
|
// Task not found — proceed without context
|
|
108
70
|
}
|
|
109
71
|
}
|
|
110
|
-
// Rank candidates
|
|
72
|
+
// Rank candidates. The query file anchors dependency proximity, the
|
|
73
|
+
// classified relationships feed the relationship signal, and the cache
|
|
74
|
+
// store activates real recency data.
|
|
111
75
|
const candidateArray = [...candidates];
|
|
112
76
|
const ranked = rankFiles(candidateArray, {
|
|
113
77
|
projectRoot,
|
|
114
78
|
exploredFiles,
|
|
115
79
|
flaggedFiles,
|
|
116
80
|
graph,
|
|
81
|
+
cacheStore: new CacheStore(projectRoot),
|
|
82
|
+
queryFile: validated,
|
|
83
|
+
relationships: relationshipMap,
|
|
117
84
|
limit,
|
|
118
85
|
});
|
|
119
86
|
const relatedFiles = ranked.map((r) => ({
|
|
@@ -123,23 +90,4 @@ export async function getRelatedFiles(projectRoot, relativePath, options) {
|
|
|
123
90
|
}));
|
|
124
91
|
return { path: validated, relatedFiles };
|
|
125
92
|
}
|
|
126
|
-
/** Get path variants to handle .ts/.js extension mismatch in the dependency graph. */
|
|
127
|
-
function getPathVariants(filePath) {
|
|
128
|
-
const variants = [filePath];
|
|
129
|
-
if (filePath.endsWith('.ts')) {
|
|
130
|
-
variants.push(filePath.replace(/\.ts$/, '.js'));
|
|
131
|
-
}
|
|
132
|
-
else if (filePath.endsWith('.tsx')) {
|
|
133
|
-
variants.push(filePath.replace(/\.tsx$/, '.js'));
|
|
134
|
-
variants.push(filePath.replace(/\.tsx$/, '.jsx'));
|
|
135
|
-
}
|
|
136
|
-
else if (filePath.endsWith('.js')) {
|
|
137
|
-
variants.push(filePath.replace(/\.js$/, '.ts'));
|
|
138
|
-
variants.push(filePath.replace(/\.js$/, '.tsx'));
|
|
139
|
-
}
|
|
140
|
-
else if (filePath.endsWith('.jsx')) {
|
|
141
|
-
variants.push(filePath.replace(/\.jsx$/, '.tsx'));
|
|
142
|
-
}
|
|
143
|
-
return variants;
|
|
144
|
-
}
|
|
145
93
|
//# sourceMappingURL=get-related-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-related-files.js","sourceRoot":"","sources":["../../src/tools/get-related-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"get-related-files.js","sourceRoot":"","sources":["../../src/tools/get-related-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAA0B,MAAM,0BAA0B,CAAC;AAWlF,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,WAAmB,EACnB,YAAoB,EACpB,OAA6C;IAE7C,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;IAEnC,oEAAoE;IACpE,MAAM,KAAK,G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C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;YACzD,YAAY,GAAG,GAAG,CAAC,aAAa;iBAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC;iBACrC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,2CAA2C;QAC7C,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,uEAAuE;IACvE,qCAAqC;IACrC,MAAM,cAAc,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,SAAS,CAAC,cAAc,EAAE;QACvC,WAAW;QACX,aAAa;QACb,YAAY;QACZ,KAAK;QACL,UAAU,EAAE,IAAI,UAAU,CAAC,WAAW,CAAC;QACvC,SAAS,EAAE,SAAS;QACpB,aAAa,EAAE,eAAe;QAC9B,KAAK;KACN,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACtC,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,YAAY,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,gBAAgB;KAC9D,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
export interface SearchResult {
|
|
2
2
|
path: string;
|
|
3
3
|
purpose: string;
|
|
4
|
-
matchedOn: string[];
|
|
5
4
|
exports: string[];
|
|
5
|
+
exportsTruncated?: number;
|
|
6
6
|
confidence: string;
|
|
7
7
|
}
|
|
8
8
|
export interface SearchByPurposeResult {
|
|
9
|
-
query: string;
|
|
10
9
|
results: SearchResult[];
|
|
11
10
|
totalCached: number;
|
|
12
11
|
scope?: string;
|
|
13
12
|
}
|
|
14
|
-
export declare function searchByPurpose(projectRoot: string, query: string, limit?: number, pathPrefix?: string): SearchByPurposeResult
|
|
13
|
+
export declare function searchByPurpose(projectRoot: string, query: string, limit?: number, pathPrefix?: string): Promise<SearchByPurposeResult>;
|
|
15
14
|
//# sourceMappingURL=search-by-purpose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-by-purpose.d.ts","sourceRoot":"","sources":["../../src/tools/search-by-purpose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search-by-purpose.d.ts","sourceRoot":"","sources":["../../src/tools/search-by-purpose.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA4ED,wBAAsB,eAAe,CACnC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,qBAAqB,CAAC,CAwFhC"}
|