codesift-mcp 0.5.30 → 0.8.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.
- package/README.md +7 -2
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +25 -3
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/git-hooks-installer.d.ts +2 -0
- package/dist/cli/git-hooks-installer.d.ts.map +1 -1
- package/dist/cli/git-hooks-installer.js +47 -7
- package/dist/cli/git-hooks-installer.js.map +1 -1
- package/dist/cli/hooks.d.ts.map +1 -1
- package/dist/cli/hooks.js +53 -0
- package/dist/cli/hooks.js.map +1 -1
- package/dist/cli/setup.d.ts +5 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +31 -5
- package/dist/cli/setup.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +10 -1
- package/dist/config.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +6 -1
- package/dist/instructions.js.map +1 -1
- package/dist/parser/extractors/_shared.js +2 -2
- package/dist/parser/extractors/_shared.js.map +1 -1
- package/dist/parser/extractors/hono.d.ts.map +1 -1
- package/dist/parser/extractors/hono.js +60 -15
- package/dist/parser/extractors/hono.js.map +1 -1
- package/dist/parser/extractors/php.d.ts +12 -0
- package/dist/parser/extractors/php.d.ts.map +1 -1
- package/dist/parser/extractors/php.js +440 -26
- package/dist/parser/extractors/php.js.map +1 -1
- package/dist/parser/extractors/python.js +4 -5
- package/dist/parser/extractors/python.js.map +1 -1
- package/dist/parser/extractors/typescript.d.ts.map +1 -1
- package/dist/parser/extractors/typescript.js +70 -22
- package/dist/parser/extractors/typescript.js.map +1 -1
- package/dist/register-tool-loaders.d.ts +22 -0
- package/dist/register-tool-loaders.d.ts.map +1 -1
- package/dist/register-tool-loaders.js +38 -0
- package/dist/register-tool-loaders.js.map +1 -1
- package/dist/register-tools.d.ts +3 -1
- package/dist/register-tools.d.ts.map +1 -1
- package/dist/register-tools.js +527 -7
- package/dist/register-tools.js.map +1 -1
- package/dist/retrieval/codebase-retrieval.d.ts.map +1 -1
- package/dist/retrieval/codebase-retrieval.js +22 -0
- package/dist/retrieval/codebase-retrieval.js.map +1 -1
- package/dist/retrieval/retrieval-schemas.d.ts +4 -0
- package/dist/retrieval/retrieval-schemas.d.ts.map +1 -1
- package/dist/retrieval/semantic-handlers.js +1 -1
- package/dist/retrieval/semantic-handlers.js.map +1 -1
- package/dist/search/semantic.d.ts +21 -5
- package/dist/search/semantic.d.ts.map +1 -1
- package/dist/search/semantic.js +129 -4
- package/dist/search/semantic.js.map +1 -1
- package/dist/search/tool-ranker.js +1 -1
- package/dist/search/tool-ranker.js.map +1 -1
- package/dist/server-helpers.js +1 -1
- package/dist/server-helpers.js.map +1 -1
- package/dist/storage/index-store.d.ts +13 -1
- package/dist/storage/index-store.d.ts.map +1 -1
- package/dist/storage/index-store.js +34 -33
- package/dist/storage/index-store.js.map +1 -1
- package/dist/storage/registry.d.ts +28 -4
- package/dist/storage/registry.d.ts.map +1 -1
- package/dist/storage/registry.js +126 -5
- package/dist/storage/registry.js.map +1 -1
- package/dist/storage/usage-stats.d.ts +2 -0
- package/dist/storage/usage-stats.d.ts.map +1 -1
- package/dist/storage/usage-stats.js +6 -0
- package/dist/storage/usage-stats.js.map +1 -1
- package/dist/tools/_helpers.d.ts +2 -0
- package/dist/tools/_helpers.d.ts.map +1 -1
- package/dist/tools/_helpers.js +16 -1
- package/dist/tools/_helpers.js.map +1 -1
- package/dist/tools/astro-audit.d.ts +40 -0
- package/dist/tools/astro-audit.d.ts.map +1 -1
- package/dist/tools/astro-audit.js +94 -5
- package/dist/tools/astro-audit.js.map +1 -1
- package/dist/tools/astro-env-validator.d.ts +38 -0
- package/dist/tools/astro-env-validator.d.ts.map +1 -0
- package/dist/tools/astro-env-validator.js +190 -0
- package/dist/tools/astro-env-validator.js.map +1 -0
- package/dist/tools/astro-helpers.js +2 -2
- package/dist/tools/astro-helpers.js.map +1 -1
- package/dist/tools/astro-image-audit.d.ts +35 -0
- package/dist/tools/astro-image-audit.d.ts.map +1 -0
- package/dist/tools/astro-image-audit.js +129 -0
- package/dist/tools/astro-image-audit.js.map +1 -0
- package/dist/tools/astro-middleware.d.ts.map +1 -1
- package/dist/tools/astro-middleware.js +36 -11
- package/dist/tools/astro-middleware.js.map +1 -1
- package/dist/tools/astro-migration.d.ts.map +1 -1
- package/dist/tools/astro-migration.js +66 -0
- package/dist/tools/astro-migration.js.map +1 -1
- package/dist/tools/astro-svg-components.d.ts +32 -0
- package/dist/tools/astro-svg-components.d.ts.map +1 -0
- package/dist/tools/astro-svg-components.js +123 -0
- package/dist/tools/astro-svg-components.js.map +1 -0
- package/dist/tools/context-tools.d.ts.map +1 -1
- package/dist/tools/context-tools.js +45 -7
- package/dist/tools/context-tools.js.map +1 -1
- package/dist/tools/conversation-tools.js +1 -1
- package/dist/tools/conversation-tools.js.map +1 -1
- package/dist/tools/index-tools.d.ts +12 -0
- package/dist/tools/index-tools.d.ts.map +1 -1
- package/dist/tools/index-tools.js +54 -6
- package/dist/tools/index-tools.js.map +1 -1
- package/dist/tools/insights-tools.d.ts +137 -0
- package/dist/tools/insights-tools.d.ts.map +1 -0
- package/dist/tools/insights-tools.js +438 -0
- package/dist/tools/insights-tools.js.map +1 -0
- package/dist/tools/pattern-tools.d.ts +7 -0
- package/dist/tools/pattern-tools.d.ts.map +1 -1
- package/dist/tools/pattern-tools.js +292 -19
- package/dist/tools/pattern-tools.js.map +1 -1
- package/dist/tools/php-tools.d.ts +78 -4
- package/dist/tools/php-tools.d.ts.map +1 -1
- package/dist/tools/php-tools.js +824 -42
- package/dist/tools/php-tools.js.map +1 -1
- package/dist/tools/php8-compat-tools.d.ts +62 -0
- package/dist/tools/php8-compat-tools.d.ts.map +1 -0
- package/dist/tools/php8-compat-tools.js +287 -0
- package/dist/tools/php8-compat-tools.js.map +1 -0
- package/dist/tools/php8-migration-candidates-tools.d.ts +68 -0
- package/dist/tools/php8-migration-candidates-tools.d.ts.map +1 -0
- package/dist/tools/php8-migration-candidates-tools.js +476 -0
- package/dist/tools/php8-migration-candidates-tools.js.map +1 -0
- package/dist/tools/phpstan-baseline-tools.d.ts +62 -0
- package/dist/tools/phpstan-baseline-tools.d.ts.map +1 -0
- package/dist/tools/phpstan-baseline-tools.js +263 -0
- package/dist/tools/phpstan-baseline-tools.js.map +1 -0
- package/dist/tools/project-tools.d.ts +4 -2
- package/dist/tools/project-tools.d.ts.map +1 -1
- package/dist/tools/project-tools.js +20 -7
- package/dist/tools/project-tools.js.map +1 -1
- package/dist/tools/react-tools.d.ts +39 -9
- package/dist/tools/react-tools.d.ts.map +1 -1
- package/dist/tools/react-tools.js +313 -18
- package/dist/tools/react-tools.js.map +1 -1
- package/dist/tools/search-tools.d.ts.map +1 -1
- package/dist/tools/search-tools.js +35 -5
- package/dist/tools/search-tools.js.map +1 -1
- package/dist/tools/status-tools.d.ts +1 -0
- package/dist/tools/status-tools.d.ts.map +1 -1
- package/dist/tools/status-tools.js +1 -0
- package/dist/tools/status-tools.js.map +1 -1
- package/dist/tools/symbol-tools.d.ts +11 -0
- package/dist/tools/symbol-tools.d.ts.map +1 -1
- package/dist/tools/symbol-tools.js +107 -6
- package/dist/tools/symbol-tools.js.map +1 -1
- package/dist/tools/yii-console-tools.d.ts +69 -0
- package/dist/tools/yii-console-tools.d.ts.map +1 -0
- package/dist/tools/yii-console-tools.js +256 -0
- package/dist/tools/yii-console-tools.js.map +1 -0
- package/dist/tools/yii-migrations-tools.d.ts +79 -0
- package/dist/tools/yii-migrations-tools.d.ts.map +1 -0
- package/dist/tools/yii-migrations-tools.js +543 -0
- package/dist/tools/yii-migrations-tools.js.map +1 -0
- package/dist/tools/yii-modules-tools.d.ts +63 -0
- package/dist/tools/yii-modules-tools.d.ts.map +1 -0
- package/dist/tools/yii-modules-tools.js +201 -0
- package/dist/tools/yii-modules-tools.js.map +1 -0
- package/dist/tools/yii-rbac-tools.d.ts +89 -0
- package/dist/tools/yii-rbac-tools.d.ts.map +1 -0
- package/dist/tools/yii-rbac-tools.js +238 -0
- package/dist/tools/yii-rbac-tools.js.map +1 -0
- package/dist/tools/yii3-attribute-candidates-tools.d.ts +72 -0
- package/dist/tools/yii3-attribute-candidates-tools.d.ts.map +1 -0
- package/dist/tools/yii3-attribute-candidates-tools.js +301 -0
- package/dist/tools/yii3-attribute-candidates-tools.js.map +1 -0
- package/dist/tools/yii3-migration-tools.d.ts +74 -0
- package/dist/tools/yii3-migration-tools.d.ts.map +1 -0
- package/dist/tools/yii3-migration-tools.js +440 -0
- package/dist/tools/yii3-migration-tools.js.map +1 -0
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/constant-file-pattern.d.ts +3 -1
- package/dist/utils/constant-file-pattern.d.ts.map +1 -1
- package/dist/utils/constant-file-pattern.js +6 -4
- package/dist/utils/constant-file-pattern.js.map +1 -1
- package/dist/utils/heritage-edges.d.ts +29 -0
- package/dist/utils/heritage-edges.d.ts.map +1 -0
- package/dist/utils/heritage-edges.js +94 -0
- package/dist/utils/heritage-edges.js.map +1 -0
- package/dist/utils/source-stripper.d.ts +23 -0
- package/dist/utils/source-stripper.d.ts.map +1 -0
- package/dist/utils/source-stripper.js +239 -0
- package/dist/utils/source-stripper.js.map +1 -0
- package/dist/utils/ts-imports.d.ts +7 -1
- package/dist/utils/ts-imports.d.ts.map +1 -1
- package/dist/utils/ts-imports.js +40 -7
- package/dist/utils/ts-imports.js.map +1 -1
- package/dist/utils/tsconfig-paths.d.ts +6 -5
- package/dist/utils/tsconfig-paths.d.ts.map +1 -1
- package/dist/utils/tsconfig-paths.js +52 -14
- package/dist/utils/tsconfig-paths.js.map +1 -1
- package/dist/utils/wall-clock.d.ts +9 -0
- package/dist/utils/wall-clock.d.ts.map +1 -0
- package/dist/utils/wall-clock.js +19 -0
- package/dist/utils/wall-clock.js.map +1 -0
- package/package.json +1 -1
- package/rules/codesift.md +16 -6
- package/rules/codesift.mdc +10 -3
- package/rules/codex.md +10 -3
- package/rules/gemini.md +10 -3
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* `tsconfig.json`, using `get-tsconfig` for `extends`-chain + paths handling.
|
|
4
4
|
*
|
|
5
5
|
* Two-level cache keeps long-running MCP server processes happy:
|
|
6
|
-
* - `dirToConfigCache`:
|
|
7
|
-
* (or null when none found up to repoRoot).
|
|
8
|
-
*
|
|
6
|
+
* - `dirToConfigCache`: `${repoRoot}::${importerDir}` → nearest tsconfig.json path
|
|
7
|
+
* (or null when none found up to repoRoot). Includes repoRoot so the same
|
|
8
|
+
* importer directory analyzed under different root boundaries does not reuse
|
|
9
|
+
* a stale tsconfig from another indexing scope.
|
|
9
10
|
* - `configCache`: tsconfig.json absolute path → parsed { matcher, baseUrl }.
|
|
10
11
|
*
|
|
11
12
|
* Both caches are cleared on `clearTsconfigCache()`. The graph builder calls
|
|
@@ -34,10 +35,18 @@ const TS_EXTENSIONS = [
|
|
|
34
35
|
".d.ts",
|
|
35
36
|
".js",
|
|
36
37
|
".jsx",
|
|
38
|
+
".mts",
|
|
39
|
+
".cts",
|
|
40
|
+
".mjs",
|
|
41
|
+
".cjs",
|
|
37
42
|
"/index.ts",
|
|
38
43
|
"/index.tsx",
|
|
39
44
|
"/index.d.ts",
|
|
40
45
|
"/index.js",
|
|
46
|
+
"/index.mts",
|
|
47
|
+
"/index.cts",
|
|
48
|
+
"/index.mjs",
|
|
49
|
+
"/index.cjs",
|
|
41
50
|
];
|
|
42
51
|
/** Clear both caches. Called at the start of `index_folder`. */
|
|
43
52
|
export function clearTsconfigCache() {
|
|
@@ -52,20 +61,37 @@ function isDirInsideRepo(repoRootAbs, dir) {
|
|
|
52
61
|
const rel = relative(repoRootAbs, abs);
|
|
53
62
|
return rel !== "" && !isAbsolute(rel) && !rel.startsWith(`..${sep}`) && !rel.startsWith("..");
|
|
54
63
|
}
|
|
64
|
+
/** True when `resolvedFileAbs` is a file path inside `repoRootAbs` (no `..` escape). */
|
|
65
|
+
function isResolvedFileInsideRepo(repoRootAbs, resolvedFileAbs) {
|
|
66
|
+
const abs = resolve(resolvedFileAbs);
|
|
67
|
+
const rel = relative(repoRootAbs, abs);
|
|
68
|
+
return (rel !== "" &&
|
|
69
|
+
!isAbsolute(rel) &&
|
|
70
|
+
!rel.startsWith(`..${sep}`) &&
|
|
71
|
+
!rel.startsWith(".."));
|
|
72
|
+
}
|
|
73
|
+
function dirToConfigCacheKey(importerDir, repoRoot) {
|
|
74
|
+
return `${resolve(repoRoot)}::${resolve(importerDir)}`;
|
|
75
|
+
}
|
|
55
76
|
/** Walk up from `dir` to `repoRoot`, find nearest `tsconfig.json`.
|
|
56
77
|
* Returns absolute path of the config file, or null if none found.
|
|
57
|
-
* Caches
|
|
58
|
-
*
|
|
78
|
+
* Caches every ancestor visited during the walk under the compound `(repoRoot, dir)`
|
|
79
|
+
* key — sibling lookups under the same parent are O(1) after the first hit. */
|
|
59
80
|
function findNearestTsconfig(dir, repoRoot) {
|
|
60
|
-
const
|
|
81
|
+
const cacheKey = dirToConfigCacheKey(dir, repoRoot);
|
|
82
|
+
const cached = dirToConfigCache.get(cacheKey);
|
|
61
83
|
if (cached !== undefined)
|
|
62
84
|
return cached;
|
|
63
85
|
const repoRootAbs = resolve(repoRoot);
|
|
86
|
+
const visited = [];
|
|
64
87
|
let cur = resolve(dir);
|
|
65
88
|
while (isDirInsideRepo(repoRootAbs, cur)) {
|
|
89
|
+
visited.push(cur);
|
|
66
90
|
const candidate = join(cur, "tsconfig.json");
|
|
67
91
|
if (existsSync(candidate)) {
|
|
68
|
-
|
|
92
|
+
for (const v of visited) {
|
|
93
|
+
dirToConfigCache.set(dirToConfigCacheKey(v, repoRoot), candidate);
|
|
94
|
+
}
|
|
69
95
|
return candidate;
|
|
70
96
|
}
|
|
71
97
|
const parent = dirname(cur);
|
|
@@ -73,7 +99,9 @@ function findNearestTsconfig(dir, repoRoot) {
|
|
|
73
99
|
break;
|
|
74
100
|
cur = parent;
|
|
75
101
|
}
|
|
76
|
-
|
|
102
|
+
for (const v of visited) {
|
|
103
|
+
dirToConfigCache.set(dirToConfigCacheKey(v, repoRoot), null);
|
|
104
|
+
}
|
|
77
105
|
return null;
|
|
78
106
|
}
|
|
79
107
|
/** Parse a tsconfig.json (with `extends` chain) and build a paths matcher.
|
|
@@ -141,6 +169,11 @@ export function resolveTsAliasedImport(importerFile, importPath, repoRoot) {
|
|
|
141
169
|
// Relative paths are not aliases — short-circuit.
|
|
142
170
|
if (importPath.startsWith("."))
|
|
143
171
|
return null;
|
|
172
|
+
// Absolute POSIX/Windows specifiers must not join against baseUrl/paths targets
|
|
173
|
+
// (would escape intended repo scope).
|
|
174
|
+
if (isAbsolute(importPath))
|
|
175
|
+
return null;
|
|
176
|
+
const repoRootAbs = resolve(repoRoot);
|
|
144
177
|
const importerDir = dirname(resolve(importerFile));
|
|
145
178
|
const configPath = findNearestTsconfig(importerDir, repoRoot);
|
|
146
179
|
if (!configPath)
|
|
@@ -148,21 +181,26 @@ export function resolveTsAliasedImport(importerFile, importPath, repoRoot) {
|
|
|
148
181
|
const config = loadTsconfig(configPath);
|
|
149
182
|
if (!config)
|
|
150
183
|
return null;
|
|
184
|
+
const acceptResolved = (hit) => {
|
|
185
|
+
if (!hit)
|
|
186
|
+
return null;
|
|
187
|
+
return isResolvedFileInsideRepo(repoRootAbs, hit) ? hit : null;
|
|
188
|
+
};
|
|
151
189
|
// Try paths matcher first (alias mappings).
|
|
152
190
|
if (config.pathsMatcher) {
|
|
153
191
|
const candidates = config.pathsMatcher(importPath);
|
|
154
192
|
for (const candidate of candidates) {
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
return
|
|
193
|
+
const accepted = acceptResolved(probeFile(candidate));
|
|
194
|
+
if (accepted)
|
|
195
|
+
return accepted;
|
|
158
196
|
}
|
|
159
197
|
}
|
|
160
198
|
// Fallback: bare specifier resolved against baseUrl.
|
|
161
199
|
if (config.baseUrl) {
|
|
162
200
|
const candidate = join(config.baseUrl, importPath);
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
201
|
+
const accepted = acceptResolved(probeFile(candidate));
|
|
202
|
+
if (accepted)
|
|
203
|
+
return accepted;
|
|
166
204
|
}
|
|
167
205
|
return null;
|
|
168
206
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-paths.js","sourceRoot":"","sources":["../../src/utils/tsconfig-paths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tsconfig-paths.js","sourceRoot":"","sources":["../../src/utils/tsconfig-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQ/D,MAAM,WAAW,GAAG,IAAI,GAAG,EAAmC,CAAC;AAC/D,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAyB,CAAC;AAE1D,gFAAgF;AAChF,sDAAsD;AACtD,MAAM,aAAa,GAAG;IACpB,EAAE;IACF,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,WAAW;IACX,YAAY;IACZ,aAAa;IACb,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;CACb,CAAC;AAEF,gEAAgE;AAChE,MAAM,UAAU,kBAAkB;IAChC,WAAW,CAAC,KAAK,EAAE,CAAC;IACpB,gBAAgB,CAAC,KAAK,EAAE,CAAC;AAC3B,CAAC;AAED,sEAA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C,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;QACtD,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;IAChC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8CAA8C;AAC9C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,mBAAmB;IACnB,YAAY;IACZ,SAAS;IACT,aAAa;IACb,iEAAiE;IACjE,kBAAkB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI;IAC1C,eAAe,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI;CAC7C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Race a promise against a wall-clock timer. On timeout, resolves to the
|
|
3
|
+
* sentinel returned by `onTimeout`. The original work continues to completion
|
|
4
|
+
* and is discarded — there is no cancellation token plumbed through the
|
|
5
|
+
* search pipeline. That is intentional: cancellation would require touching
|
|
6
|
+
* every async leaf in the codebase. Discarding the result is sufficient.
|
|
7
|
+
*/
|
|
8
|
+
export declare function raceWallClock<T, R>(work: Promise<T>, ms: number, onTimeout: () => R): Promise<T | R>;
|
|
9
|
+
//# sourceMappingURL=wall-clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wall-clock.d.ts","sourceRoot":"","sources":["../../src/utils/wall-clock.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAChC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,CAAC,GACjB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAKhB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Shared wall-clock cap helpers. Used by hot search paths whose telemetry
|
|
2
|
+
// shows occasional 5-15 minute runaway calls (broad queries on huge repos,
|
|
3
|
+
// cold semantic embeddings). The cap returns control to the agent quickly
|
|
4
|
+
// with an actionable hint instead of hanging the conversation.
|
|
5
|
+
const TIMEOUT = Symbol("codesift.wall-clock.timeout");
|
|
6
|
+
/**
|
|
7
|
+
* Race a promise against a wall-clock timer. On timeout, resolves to the
|
|
8
|
+
* sentinel returned by `onTimeout`. The original work continues to completion
|
|
9
|
+
* and is discarded — there is no cancellation token plumbed through the
|
|
10
|
+
* search pipeline. That is intentional: cancellation would require touching
|
|
11
|
+
* every async leaf in the codebase. Discarding the result is sufficient.
|
|
12
|
+
*/
|
|
13
|
+
export function raceWallClock(work, ms, onTimeout) {
|
|
14
|
+
return Promise.race([
|
|
15
|
+
work,
|
|
16
|
+
new Promise((resolve) => setTimeout(() => resolve(TIMEOUT), ms)),
|
|
17
|
+
]).then((v) => (v === TIMEOUT ? onTimeout() : v));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=wall-clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wall-clock.js","sourceRoot":"","sources":["../../src/utils/wall-clock.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,0EAA0E;AAC1E,+DAA+D;AAE/D,MAAM,OAAO,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAgB,EAChB,EAAU,EACV,SAAkB;IAElB,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,IAAI;QACJ,IAAI,OAAO,CAAiB,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;KACjF,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAE,CAAO,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesift-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.2",
|
|
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",
|
package/rules/codesift.md
CHANGED
|
@@ -159,11 +159,14 @@ Use this table to pick the right tool for each task:
|
|
|
159
159
|
| starting a task, want tool recommendations | `plan_turn(query=...)` |
|
|
160
160
|
| React codebase | `trace_component_tree("App")` + `analyze_hooks` |
|
|
161
161
|
| React anti-patterns | `search_patterns("hook-in-condition")` |
|
|
162
|
-
| React derived state | `search_patterns("derived-state")` |
|
|
163
|
-
| React stale closure | `search_patterns("stale-closure-setstate")` |
|
|
164
|
-
| React context perf trap | `search_patterns("context-provider-value-inline")` |
|
|
162
|
+
| React derived state | `search_patterns("derived-state")` (T5) / `derived-state-reducer` / `derived-state-custom-setter` (T6) |
|
|
163
|
+
| React stale closure | `search_patterns("stale-closure-setstate")` (T5) / `stale-closure-toggle` / `stale-closure-broken-functional` (T6) |
|
|
164
|
+
| React context perf trap | `search_patterns("context-provider-value-inline")` (T5) / `context-provider-value-via-variable` / `context-provider-value-inline-destructured` (T6) |
|
|
165
165
|
| React tabnabbing security | `search_patterns("jsx-no-target-blank")` |
|
|
166
166
|
| React button submit foot-gun | `search_patterns("button-no-type")` |
|
|
167
|
+
| React lazy without Suspense | `search_patterns("react-lazy-no-suspense-same-file")` (T6 single-file) |
|
|
168
|
+
| React RSC non-serializable | `search_patterns("rsc-non-serializable-prop")` / `rsc-non-serializable-prop-deep` (T6 — Map/Set/Class) |
|
|
169
|
+
| React ErrorBoundary incomplete | `search_patterns("error-boundary-incomplete")` (T6) |
|
|
167
170
|
| React render-tree depth | `analyze_renders` → `entry.prop_chain_depth` (NOT prop-flow depth) |
|
|
168
171
|
| React call graph (clean) | `trace_call_chain(filter_react_hooks=true)` |
|
|
169
172
|
| new Next.js project (first look) | `framework_audit` |
|
|
@@ -188,10 +191,17 @@ Use this table to pick the right tool for each task:
|
|
|
188
191
|
- `include_source=true` — include source code in results
|
|
189
192
|
|
|
190
193
|
### search_text
|
|
191
|
-
|
|
192
|
-
- `
|
|
194
|
+
**Decision tree (read first):**
|
|
195
|
+
- **Identifier-only query** (e.g. `OrganizationService`, `useAuth`, `handleLogin`) → use `ranked=true`. Returns symbol-grouped, centrality-ranked hits with `containing_symbol`. Saves 1-3 follow-up `get_symbol` calls. **Auto-applied server-side** when caller passes no grouping options and the query matches `^[A-Za-z_][A-Za-z0-9_]{2,}$`.
|
|
196
|
+
- **Error string / unknown phrase** (e.g. `"connection refused"`, `"is not a function"`) → omit grouping options. Server auto-groups by file above 30 matches.
|
|
197
|
+
- **Already passing `top_k≥30`** → set `group_by_file=true` explicitly.
|
|
198
|
+
- **ALWAYS** pass `file_pattern=` when scope is known.
|
|
199
|
+
|
|
200
|
+
**Param reference:**
|
|
193
201
|
- `ranked=true` — classifies hits by containing function, deduplicates (max 2/function), ranks by centrality. Returns `containing_symbol` field. Takes precedence over `auto_group`.
|
|
194
|
-
- `
|
|
202
|
+
- `group_by_file=true` — ~80% output reduction on many matches.
|
|
203
|
+
- `auto_group=true` — auto-switch to grouped above 50 matches.
|
|
204
|
+
- `file_pattern=` — required scope filter for repos > 500 files.
|
|
195
205
|
|
|
196
206
|
### assemble_context levels
|
|
197
207
|
- `L0` — full source (use when editing)
|
package/rules/codesift.mdc
CHANGED
|
@@ -174,10 +174,17 @@ Use this table to pick the right tool for each task:
|
|
|
174
174
|
- `include_source=true` — include source code in results
|
|
175
175
|
|
|
176
176
|
### search_text
|
|
177
|
-
|
|
178
|
-
- `
|
|
177
|
+
**Decision tree (read first):**
|
|
178
|
+
- **Identifier-only query** (e.g. `OrganizationService`, `useAuth`, `handleLogin`) → use `ranked=true`. Returns symbol-grouped, centrality-ranked hits with `containing_symbol`. Saves 1-3 follow-up `get_symbol` calls. **Auto-applied server-side** when caller passes no grouping options and the query matches `^[A-Za-z_][A-Za-z0-9_]{2,}$`.
|
|
179
|
+
- **Error string / unknown phrase** (e.g. `"connection refused"`, `"is not a function"`) → omit grouping options. Server auto-groups by file above 30 matches.
|
|
180
|
+
- **Already passing `top_k≥30`** → set `group_by_file=true` explicitly.
|
|
181
|
+
- **ALWAYS** pass `file_pattern=` when scope is known.
|
|
182
|
+
|
|
183
|
+
**Param reference:**
|
|
179
184
|
- `ranked=true` — classifies hits by containing function, deduplicates (max 2/function), ranks by centrality. Returns `containing_symbol` field. Takes precedence over `auto_group`.
|
|
180
|
-
- `
|
|
185
|
+
- `group_by_file=true` — ~80% output reduction on many matches.
|
|
186
|
+
- `auto_group=true` — auto-switch to grouped above 50 matches.
|
|
187
|
+
- `file_pattern=` — required scope filter for repos > 500 files.
|
|
181
188
|
|
|
182
189
|
### assemble_context levels
|
|
183
190
|
- `L0` — full source (use when editing)
|
package/rules/codex.md
CHANGED
|
@@ -169,10 +169,17 @@ Use this table to pick the right tool for each task:
|
|
|
169
169
|
- `include_source=true` — include source code in results
|
|
170
170
|
|
|
171
171
|
### search_text
|
|
172
|
-
|
|
173
|
-
- `
|
|
172
|
+
**Decision tree (read first):**
|
|
173
|
+
- **Identifier-only query** (e.g. `OrganizationService`, `useAuth`, `handleLogin`) → use `ranked=true`. Returns symbol-grouped, centrality-ranked hits with `containing_symbol`. Saves 1-3 follow-up `get_symbol` calls. **Auto-applied server-side** when caller passes no grouping options and the query matches `^[A-Za-z_][A-Za-z0-9_]{2,}$`.
|
|
174
|
+
- **Error string / unknown phrase** (e.g. `"connection refused"`, `"is not a function"`) → omit grouping options. Server auto-groups by file above 30 matches.
|
|
175
|
+
- **Already passing `top_k≥30`** → set `group_by_file=true` explicitly.
|
|
176
|
+
- **ALWAYS** pass `file_pattern=` when scope is known.
|
|
177
|
+
|
|
178
|
+
**Param reference:**
|
|
174
179
|
- `ranked=true` — classifies hits by containing function, deduplicates (max 2/function), ranks by centrality. Returns `containing_symbol` field. Takes precedence over `auto_group`.
|
|
175
|
-
- `
|
|
180
|
+
- `group_by_file=true` — ~80% output reduction on many matches.
|
|
181
|
+
- `auto_group=true` — auto-switch to grouped above 50 matches.
|
|
182
|
+
- `file_pattern=` — required scope filter for repos > 500 files.
|
|
176
183
|
|
|
177
184
|
### assemble_context levels
|
|
178
185
|
- `L0` — full source (use when editing)
|
package/rules/gemini.md
CHANGED
|
@@ -170,10 +170,17 @@ Use this table to pick the right tool for each task:
|
|
|
170
170
|
- `include_source=true` — include source code in results
|
|
171
171
|
|
|
172
172
|
### search_text
|
|
173
|
-
|
|
174
|
-
- `
|
|
173
|
+
**Decision tree (read first):**
|
|
174
|
+
- **Identifier-only query** (e.g. `OrganizationService`, `useAuth`, `handleLogin`) → use `ranked=true`. Returns symbol-grouped, centrality-ranked hits with `containing_symbol`. Saves 1-3 follow-up `get_symbol` calls. **Auto-applied server-side** when caller passes no grouping options and the query matches `^[A-Za-z_][A-Za-z0-9_]{2,}$`.
|
|
175
|
+
- **Error string / unknown phrase** (e.g. `"connection refused"`, `"is not a function"`) → omit grouping options. Server auto-groups by file above 30 matches.
|
|
176
|
+
- **Already passing `top_k≥30`** → set `group_by_file=true` explicitly.
|
|
177
|
+
- **ALWAYS** pass `file_pattern=` when scope is known.
|
|
178
|
+
|
|
179
|
+
**Param reference:**
|
|
175
180
|
- `ranked=true` — classifies hits by containing function, deduplicates (max 2/function), ranks by centrality. Returns `containing_symbol` field. Takes precedence over `auto_group`.
|
|
176
|
-
- `
|
|
181
|
+
- `group_by_file=true` — ~80% output reduction on many matches.
|
|
182
|
+
- `auto_group=true` — auto-switch to grouped above 50 matches.
|
|
183
|
+
- `file_pattern=` — required scope filter for repos > 500 files.
|
|
177
184
|
|
|
178
185
|
### assemble_context levels
|
|
179
186
|
- `L0` — full source (use when editing)
|