codesift-mcp 0.9.10 → 0.10.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/README.md +23 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +4 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/telemetry-commands.d.ts +2 -0
- package/dist/cli/telemetry-commands.d.ts.map +1 -0
- package/dist/cli/telemetry-commands.js +50 -0
- package/dist/cli/telemetry-commands.js.map +1 -0
- package/dist/register-tool-groups/meta.js +1 -1
- package/dist/register-tool-groups/meta.js.map +1 -1
- package/dist/server-helpers.d.ts.map +1 -1
- package/dist/server-helpers.js +9 -2
- package/dist/server-helpers.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +6 -0
- package/dist/server.js.map +1 -1
- package/dist/storage/_shared.d.ts +9 -0
- package/dist/storage/_shared.d.ts.map +1 -1
- package/dist/storage/_shared.js +24 -0
- package/dist/storage/_shared.js.map +1 -1
- package/dist/storage/telemetry/aggregator.d.ts +52 -0
- package/dist/storage/telemetry/aggregator.d.ts.map +1 -0
- package/dist/storage/telemetry/aggregator.js +188 -0
- package/dist/storage/telemetry/aggregator.js.map +1 -0
- package/dist/storage/telemetry/anon-id.d.ts +11 -0
- package/dist/storage/telemetry/anon-id.d.ts.map +1 -0
- package/dist/storage/telemetry/anon-id.js +62 -0
- package/dist/storage/telemetry/anon-id.js.map +1 -0
- package/dist/storage/telemetry/config.d.ts +37 -0
- package/dist/storage/telemetry/config.d.ts.map +1 -0
- package/dist/storage/telemetry/config.js +130 -0
- package/dist/storage/telemetry/config.js.map +1 -0
- package/dist/storage/telemetry/env-profile.d.ts +19 -0
- package/dist/storage/telemetry/env-profile.d.ts.map +1 -0
- package/dist/storage/telemetry/env-profile.js +67 -0
- package/dist/storage/telemetry/env-profile.js.map +1 -0
- package/dist/storage/telemetry/payload.d.ts +8 -0
- package/dist/storage/telemetry/payload.d.ts.map +1 -0
- package/dist/storage/telemetry/payload.js +22 -0
- package/dist/storage/telemetry/payload.js.map +1 -0
- package/dist/storage/telemetry/sanitizer.d.ts +48 -0
- package/dist/storage/telemetry/sanitizer.d.ts.map +1 -0
- package/dist/storage/telemetry/sanitizer.js +82 -0
- package/dist/storage/telemetry/sanitizer.js.map +1 -0
- package/dist/storage/telemetry/uploader.d.ts +11 -0
- package/dist/storage/telemetry/uploader.d.ts.map +1 -0
- package/dist/storage/telemetry/uploader.js +140 -0
- package/dist/storage/telemetry/uploader.js.map +1 -0
- package/dist/storage/usage-tracker.d.ts +13 -0
- package/dist/storage/usage-tracker.d.ts.map +1 -1
- package/dist/storage/usage-tracker.js +21 -0
- package/dist/storage/usage-tracker.js.map +1 -1
- package/dist/tools/project-tools.d.ts +3 -0
- package/dist/tools/project-tools.d.ts.map +1 -1
- package/dist/tools/project-tools.js +2 -0
- package/dist/tools/project-tools.js.map +1 -1
- package/dist/utils/edge-provenance.d.ts +55 -0
- package/dist/utils/edge-provenance.d.ts.map +1 -0
- package/dist/utils/edge-provenance.js +53 -0
- package/dist/utils/edge-provenance.js.map +1 -0
- package/dist/utils/overlay-cache.d.ts +38 -0
- package/dist/utils/overlay-cache.d.ts.map +1 -0
- package/dist/utils/overlay-cache.js +73 -0
- package/dist/utils/overlay-cache.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edge-provenance classifier — pure functions, no I/O.
|
|
3
|
+
*
|
|
4
|
+
* Classifies graph edges (call edges, import edges) as either directly
|
|
5
|
+
* "EXTRACTED" from source (high confidence, unambiguous) or "INFERRED"
|
|
6
|
+
* via heuristic resolution (lower confidence — overload/candidate
|
|
7
|
+
* disambiguation, star imports, or best-effort layout resolution).
|
|
8
|
+
* Consumers (call-hierarchy, import-graph formatters) use this to
|
|
9
|
+
* annotate ambiguous edges instead of presenting them with the same
|
|
10
|
+
* confidence as directly-resolved ones.
|
|
11
|
+
*/
|
|
12
|
+
const INFERRED_RESOLUTIONS = new Set([
|
|
13
|
+
"python-src-layout",
|
|
14
|
+
"php-psr4",
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* Classifies a call edge by how many candidate targets were resolved
|
|
18
|
+
* for it. Exactly one candidate means the call was unambiguously
|
|
19
|
+
* matched to source (EXTRACTED). Two or more candidates means the
|
|
20
|
+
* resolver had to disambiguate (e.g. overloads, dynamic dispatch),
|
|
21
|
+
* so the edge is INFERRED. Zero or negative counts are treated as
|
|
22
|
+
* the safe EXTRACTED default rather than throwing — there is no
|
|
23
|
+
* ambiguity to flag when no candidates were even considered.
|
|
24
|
+
*/
|
|
25
|
+
export function classifyCallEdgeProvenance(candidateCount) {
|
|
26
|
+
return candidateCount > 1 ? "INFERRED" : "EXTRACTED";
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Classifies an import edge. Star imports (`from x import *`) can't
|
|
30
|
+
* be tied to a specific exported symbol, so they're always INFERRED.
|
|
31
|
+
* Otherwise, the resolution strategy used to find the target file
|
|
32
|
+
* determines confidence: src-layout and PSR-4 resolution are
|
|
33
|
+
* heuristic guesses (INFERRED); direct and workspace-alias lookups
|
|
34
|
+
* are unambiguous (EXTRACTED), as is the case with no resolution
|
|
35
|
+
* hint at all (default: direct extraction).
|
|
36
|
+
*/
|
|
37
|
+
export function classifyImportEdgeProvenance(edge, resolution) {
|
|
38
|
+
if (edge.star_import)
|
|
39
|
+
return "INFERRED";
|
|
40
|
+
if (resolution && INFERRED_RESOLUTIONS.has(resolution))
|
|
41
|
+
return "INFERRED";
|
|
42
|
+
return "EXTRACTED";
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Renders a human-readable suffix for an edge's provenance. EXTRACTED
|
|
46
|
+
* is the default, unannotated case (no visual noise for the common
|
|
47
|
+
* path); INFERRED edges get a trailing ` [inferred]` tag so callers
|
|
48
|
+
* can flag lower-confidence edges in formatted output.
|
|
49
|
+
*/
|
|
50
|
+
export function formatProvenanceTag(provenance) {
|
|
51
|
+
return provenance === "INFERRED" ? " [inferred]" : "";
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=edge-provenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edge-provenance.js","sourceRoot":"","sources":["../../src/utils/edge-provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAyBH,MAAM,oBAAoB,GAAsC,IAAI,GAAG,CAAC;IACtE,mBAAmB;IACnB,UAAU;CACX,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CAAC,cAAsB;IAC/D,OAAO,cAAc,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;AACvD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAC1C,IAAoB,EACpB,UAAiC;IAEjC,IAAI,IAAI,CAAC,WAAW;QAAE,OAAO,UAAU,CAAC;IACxC,IAAI,UAAU,IAAI,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC;QAAE,OAAO,UAAU,CAAC;IAC1E,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA2B;IAC7D,OAAO,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OverlayCache — small bounded LRU cache for expensive per-symbol overlay
|
|
3
|
+
* computations, keyed `${repo}:${symbol}`.
|
|
4
|
+
*
|
|
5
|
+
* - True LRU: delete+set on hit re-inserts at the end (Map preserves
|
|
6
|
+
* insertion order), so the oldest untouched key is always evicted first.
|
|
7
|
+
* - TTL eviction: entries expire after `ttlMs`; `null` (negative) results
|
|
8
|
+
* use a shorter `negativeTtlMs` so failed lookups retry sooner.
|
|
9
|
+
* - sha-based invalidation: a lookup whose sha differs from the stored sha
|
|
10
|
+
* is a miss, and the stale entry is dropped before recomputing.
|
|
11
|
+
* - In-flight promise dedupe: concurrent getOrCompute() calls for the same
|
|
12
|
+
* key share a single loader invocation.
|
|
13
|
+
* - Injectable clock (`now`) for deterministic TTL tests — no real sleeps.
|
|
14
|
+
*/
|
|
15
|
+
export interface OverlayCacheOptions {
|
|
16
|
+
maxEntries?: number;
|
|
17
|
+
ttlMs?: number;
|
|
18
|
+
negativeTtlMs?: number;
|
|
19
|
+
now?: () => number;
|
|
20
|
+
}
|
|
21
|
+
export declare class OverlayCache<T> {
|
|
22
|
+
private entries;
|
|
23
|
+
private inflight;
|
|
24
|
+
private readonly maxEntries;
|
|
25
|
+
private readonly ttlMs;
|
|
26
|
+
private readonly negativeTtlMs;
|
|
27
|
+
private readonly now;
|
|
28
|
+
constructor(options?: OverlayCacheOptions);
|
|
29
|
+
/**
|
|
30
|
+
* Get a cached value or compute it via `loader`. A hit requires both a
|
|
31
|
+
* matching sha and an unexpired entry; otherwise any stale entry is
|
|
32
|
+
* dropped and `loader` runs. Concurrent calls for the same key share one
|
|
33
|
+
* in-flight loader invocation.
|
|
34
|
+
*/
|
|
35
|
+
getOrCompute(repo: string, symbol: string, sha: string, loader: () => Promise<T | null>): Promise<T | null>;
|
|
36
|
+
private evictOverflow;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=overlay-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-cache.d.ts","sourceRoot":"","sources":["../../src/utils/overlay-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,qBAAa,YAAY,CAAC,CAAC;IACzB,OAAO,CAAC,OAAO,CAAsC;IACrD,OAAO,CAAC,QAAQ,CAAwC;IACxD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAEvB,OAAO,GAAE,mBAAwB;IAO7C;;;;;OAKG;IACG,YAAY,CAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAC9B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IA8BpB,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OverlayCache — small bounded LRU cache for expensive per-symbol overlay
|
|
3
|
+
* computations, keyed `${repo}:${symbol}`.
|
|
4
|
+
*
|
|
5
|
+
* - True LRU: delete+set on hit re-inserts at the end (Map preserves
|
|
6
|
+
* insertion order), so the oldest untouched key is always evicted first.
|
|
7
|
+
* - TTL eviction: entries expire after `ttlMs`; `null` (negative) results
|
|
8
|
+
* use a shorter `negativeTtlMs` so failed lookups retry sooner.
|
|
9
|
+
* - sha-based invalidation: a lookup whose sha differs from the stored sha
|
|
10
|
+
* is a miss, and the stale entry is dropped before recomputing.
|
|
11
|
+
* - In-flight promise dedupe: concurrent getOrCompute() calls for the same
|
|
12
|
+
* key share a single loader invocation.
|
|
13
|
+
* - Injectable clock (`now`) for deterministic TTL tests — no real sleeps.
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_MAX_ENTRIES = 200;
|
|
16
|
+
const DEFAULT_TTL_MS = 5 * 60_000;
|
|
17
|
+
const DEFAULT_NEGATIVE_TTL_MS = 30_000;
|
|
18
|
+
export class OverlayCache {
|
|
19
|
+
entries = new Map();
|
|
20
|
+
inflight = new Map();
|
|
21
|
+
maxEntries;
|
|
22
|
+
ttlMs;
|
|
23
|
+
negativeTtlMs;
|
|
24
|
+
now;
|
|
25
|
+
constructor(options = {}) {
|
|
26
|
+
this.maxEntries = options.maxEntries ?? DEFAULT_MAX_ENTRIES;
|
|
27
|
+
this.ttlMs = options.ttlMs ?? DEFAULT_TTL_MS;
|
|
28
|
+
this.negativeTtlMs = options.negativeTtlMs ?? DEFAULT_NEGATIVE_TTL_MS;
|
|
29
|
+
this.now = options.now ?? Date.now;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get a cached value or compute it via `loader`. A hit requires both a
|
|
33
|
+
* matching sha and an unexpired entry; otherwise any stale entry is
|
|
34
|
+
* dropped and `loader` runs. Concurrent calls for the same key share one
|
|
35
|
+
* in-flight loader invocation.
|
|
36
|
+
*/
|
|
37
|
+
async getOrCompute(repo, symbol, sha, loader) {
|
|
38
|
+
const key = `${repo}:${symbol}`;
|
|
39
|
+
const cached = this.entries.get(key);
|
|
40
|
+
if (cached) {
|
|
41
|
+
if (cached.sha === sha && cached.expiresAt > this.now()) {
|
|
42
|
+
this.entries.delete(key);
|
|
43
|
+
this.entries.set(key, cached); // re-insert at end: true LRU
|
|
44
|
+
return cached.value;
|
|
45
|
+
}
|
|
46
|
+
this.entries.delete(key); // stale (expired or sha mismatch)
|
|
47
|
+
}
|
|
48
|
+
const pending = this.inflight.get(key);
|
|
49
|
+
if (pending)
|
|
50
|
+
return pending;
|
|
51
|
+
const promise = loader()
|
|
52
|
+
.then((value) => {
|
|
53
|
+
const ttl = value === null ? this.negativeTtlMs : this.ttlMs;
|
|
54
|
+
this.entries.set(key, { value, sha, expiresAt: this.now() + ttl });
|
|
55
|
+
this.evictOverflow();
|
|
56
|
+
return value;
|
|
57
|
+
})
|
|
58
|
+
.finally(() => {
|
|
59
|
+
this.inflight.delete(key);
|
|
60
|
+
});
|
|
61
|
+
this.inflight.set(key, promise);
|
|
62
|
+
return promise;
|
|
63
|
+
}
|
|
64
|
+
evictOverflow() {
|
|
65
|
+
while (this.entries.size > this.maxEntries) {
|
|
66
|
+
const oldest = this.entries.keys().next().value;
|
|
67
|
+
if (oldest === undefined)
|
|
68
|
+
break;
|
|
69
|
+
this.entries.delete(oldest);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=overlay-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-cache.js","sourceRoot":"","sources":["../../src/utils/overlay-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,cAAc,GAAG,CAAC,GAAG,MAAM,CAAC;AAClC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAevC,MAAM,OAAO,YAAY;IACf,OAAO,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC7C,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IACvC,UAAU,CAAS;IACnB,KAAK,CAAS;IACd,aAAa,CAAS;IACtB,GAAG,CAAe;IAEnC,YAAY,UAA+B,EAAE;QAC3C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,mBAAmB,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,cAAc,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,uBAAuB,CAAC;QACtE,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAChB,IAAY,EACZ,MAAc,EACd,GAAW,EACX,MAA+B;QAE/B,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,C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AEO,aAAa;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;YAChD,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAM;YAChC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesift-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "MCP server for code intelligence — 146 tools for symbol search, call graph, semantic search, route tracing, community detection, LSP bridge, secret detection, conversation search, and Hono framework intelligence",
|
|
5
5
|
"license": "BSL-1.1",
|
|
6
6
|
"author": "Greg Laskowski",
|