codesift-mcp 0.5.24 → 0.5.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.
- package/README.md +4 -4
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +28 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/help.js +1 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/hooks.d.ts +4 -0
- package/dist/cli/hooks.d.ts.map +1 -1
- package/dist/cli/hooks.js +15 -4
- package/dist/cli/hooks.js.map +1 -1
- package/dist/cli/journal-commands.d.ts +9 -0
- package/dist/cli/journal-commands.d.ts.map +1 -0
- package/dist/cli/journal-commands.js +160 -0
- package/dist/cli/journal-commands.js.map +1 -0
- package/dist/cli/wiki-commands.d.ts.map +1 -1
- package/dist/cli/wiki-commands.js +5 -0
- package/dist/cli/wiki-commands.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +41 -47
- package/dist/instructions.js.map +1 -1
- package/dist/parser/extractors/_shared.d.ts +2 -0
- package/dist/parser/extractors/_shared.d.ts.map +1 -1
- package/dist/parser/extractors/_shared.js +4 -0
- package/dist/parser/extractors/_shared.js.map +1 -1
- package/dist/parser/extractors/typescript.d.ts.map +1 -1
- package/dist/parser/extractors/typescript.js +606 -31
- package/dist/parser/extractors/typescript.js.map +1 -1
- package/dist/parser/parse-worker.d.ts +2 -0
- package/dist/parser/parse-worker.d.ts.map +1 -0
- package/dist/parser/parse-worker.js +47 -0
- package/dist/parser/parse-worker.js.map +1 -0
- package/dist/parser/parser-manager.d.ts +10 -1
- package/dist/parser/parser-manager.d.ts.map +1 -1
- package/dist/parser/parser-manager.js +40 -2
- package/dist/parser/parser-manager.js.map +1 -1
- package/dist/parser/parser-pool.d.ts +31 -0
- package/dist/parser/parser-pool.d.ts.map +1 -0
- package/dist/parser/parser-pool.js +211 -0
- package/dist/parser/parser-pool.js.map +1 -0
- package/dist/register-tool-loaders.d.ts +1 -1
- package/dist/register-tool-loaders.d.ts.map +1 -1
- package/dist/register-tool-loaders.js +2 -2
- package/dist/register-tool-loaders.js.map +1 -1
- package/dist/register-tools.d.ts.map +1 -1
- package/dist/register-tools.js +382 -35
- package/dist/register-tools.js.map +1 -1
- package/dist/retrieval/codebase-retrieval.d.ts.map +1 -1
- package/dist/retrieval/codebase-retrieval.js +9 -1
- package/dist/retrieval/codebase-retrieval.js.map +1 -1
- package/dist/search/chunker.d.ts +1 -0
- package/dist/search/chunker.d.ts.map +1 -1
- package/dist/search/chunker.js +8 -1
- package/dist/search/chunker.js.map +1 -1
- package/dist/server-helpers.d.ts +27 -0
- package/dist/server-helpers.d.ts.map +1 -1
- package/dist/server-helpers.js +90 -9
- package/dist/server-helpers.js.map +1 -1
- package/dist/server.js +31 -0
- package/dist/server.js.map +1 -1
- package/dist/storage/index-store.d.ts +41 -4
- package/dist/storage/index-store.d.ts.map +1 -1
- package/dist/storage/index-store.js +89 -6
- package/dist/storage/index-store.js.map +1 -1
- package/dist/storage/watcher.d.ts +33 -6
- package/dist/storage/watcher.d.ts.map +1 -1
- package/dist/storage/watcher.js +73 -34
- package/dist/storage/watcher.js.map +1 -1
- package/dist/storage/workspace-resolver.d.ts +15 -0
- package/dist/storage/workspace-resolver.d.ts.map +1 -0
- package/dist/storage/workspace-resolver.js +130 -0
- package/dist/storage/workspace-resolver.js.map +1 -0
- package/dist/tools/_helpers.d.ts +37 -0
- package/dist/tools/_helpers.d.ts.map +1 -0
- package/dist/tools/_helpers.js +31 -0
- package/dist/tools/_helpers.js.map +1 -0
- package/dist/tools/constant-resolution-tools.d.ts +8 -0
- package/dist/tools/constant-resolution-tools.d.ts.map +1 -0
- package/dist/tools/constant-resolution-tools.js +68 -0
- package/dist/tools/constant-resolution-tools.js.map +1 -0
- package/dist/tools/graph-tools.d.ts +27 -5
- package/dist/tools/graph-tools.d.ts.map +1 -1
- package/dist/tools/graph-tools.js +141 -18
- package/dist/tools/graph-tools.js.map +1 -1
- package/dist/tools/hotspot-tools.d.ts +6 -0
- package/dist/tools/hotspot-tools.d.ts.map +1 -1
- package/dist/tools/hotspot-tools.js +48 -8
- package/dist/tools/hotspot-tools.js.map +1 -1
- package/dist/tools/impact-tools.d.ts.map +1 -1
- package/dist/tools/impact-tools.js +9 -2
- package/dist/tools/impact-tools.js.map +1 -1
- package/dist/tools/index-tools.d.ts +15 -1
- package/dist/tools/index-tools.d.ts.map +1 -1
- package/dist/tools/index-tools.js +161 -16
- package/dist/tools/index-tools.js.map +1 -1
- package/dist/tools/journal-generator-helpers.d.ts +55 -0
- package/dist/tools/journal-generator-helpers.d.ts.map +1 -0
- package/dist/tools/journal-generator-helpers.js +250 -0
- package/dist/tools/journal-generator-helpers.js.map +1 -0
- package/dist/tools/journal-generator.d.ts +48 -0
- package/dist/tools/journal-generator.d.ts.map +1 -0
- package/dist/tools/journal-generator.js +204 -0
- package/dist/tools/journal-generator.js.map +1 -0
- package/dist/tools/journal-git-client.d.ts +20 -0
- package/dist/tools/journal-git-client.d.ts.map +1 -0
- package/dist/tools/journal-git-client.js +57 -0
- package/dist/tools/journal-git-client.js.map +1 -0
- package/dist/tools/journal-llm-client.d.ts +57 -0
- package/dist/tools/journal-llm-client.d.ts.map +1 -0
- package/dist/tools/journal-llm-client.js +175 -0
- package/dist/tools/journal-llm-client.js.map +1 -0
- package/dist/tools/journal-migrator.d.ts +22 -0
- package/dist/tools/journal-migrator.d.ts.map +1 -0
- package/dist/tools/journal-migrator.js +183 -0
- package/dist/tools/journal-migrator.js.map +1 -0
- package/dist/tools/journal-phase-detector.d.ts +26 -0
- package/dist/tools/journal-phase-detector.d.ts.map +1 -0
- package/dist/tools/journal-phase-detector.js +126 -0
- package/dist/tools/journal-phase-detector.js.map +1 -0
- package/dist/tools/journal-sentinel.d.ts +15 -0
- package/dist/tools/journal-sentinel.d.ts.map +1 -0
- package/dist/tools/journal-sentinel.js +110 -0
- package/dist/tools/journal-sentinel.js.map +1 -0
- package/dist/tools/journal-templates.d.ts +28 -0
- package/dist/tools/journal-templates.d.ts.map +1 -0
- package/dist/tools/journal-templates.js +93 -0
- package/dist/tools/journal-templates.js.map +1 -0
- package/dist/tools/pattern-tools.d.ts +2 -0
- package/dist/tools/pattern-tools.d.ts.map +1 -1
- package/dist/tools/pattern-tools.js +73 -0
- package/dist/tools/pattern-tools.js.map +1 -1
- package/dist/tools/perf-tools.d.ts.map +1 -1
- package/dist/tools/perf-tools.js +6 -0
- package/dist/tools/perf-tools.js.map +1 -1
- package/dist/tools/plan-turn-tools.d.ts.map +1 -1
- package/dist/tools/plan-turn-tools.js +38 -2
- package/dist/tools/plan-turn-tools.js.map +1 -1
- package/dist/tools/project-tools.d.ts +6 -0
- package/dist/tools/project-tools.d.ts.map +1 -1
- package/dist/tools/project-tools.js +65 -25
- package/dist/tools/project-tools.js.map +1 -1
- package/dist/tools/python-constants-tools.d.ts +6 -0
- package/dist/tools/python-constants-tools.d.ts.map +1 -1
- package/dist/tools/python-constants-tools.js.map +1 -1
- package/dist/tools/react-tools.d.ts +44 -1
- package/dist/tools/react-tools.d.ts.map +1 -1
- package/dist/tools/react-tools.js +142 -9
- 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 +21 -2
- package/dist/tools/search-tools.js.map +1 -1
- package/dist/tools/status-tools.d.ts +10 -0
- package/dist/tools/status-tools.d.ts.map +1 -1
- package/dist/tools/status-tools.js +53 -2
- package/dist/tools/status-tools.js.map +1 -1
- package/dist/tools/symbol-tools.d.ts +13 -0
- package/dist/tools/symbol-tools.d.ts.map +1 -1
- package/dist/tools/symbol-tools.js +38 -0
- package/dist/tools/symbol-tools.js.map +1 -1
- package/dist/tools/typescript-constants-tools.d.ts +6 -0
- package/dist/tools/typescript-constants-tools.d.ts.map +1 -0
- package/dist/tools/typescript-constants-tools.js +687 -0
- package/dist/tools/typescript-constants-tools.js.map +1 -0
- package/dist/tools/wiki-hub-ranker.d.ts +36 -0
- package/dist/tools/wiki-hub-ranker.d.ts.map +1 -0
- package/dist/tools/wiki-hub-ranker.js +72 -0
- package/dist/tools/wiki-hub-ranker.js.map +1 -0
- package/dist/tools/wiki-lint.d.ts +7 -2
- package/dist/tools/wiki-lint.d.ts.map +1 -1
- package/dist/tools/wiki-lint.js +73 -1
- package/dist/tools/wiki-lint.js.map +1 -1
- package/dist/tools/wiki-manifest.d.ts +129 -21
- package/dist/tools/wiki-manifest.d.ts.map +1 -1
- package/dist/tools/wiki-manifest.js +16 -9
- package/dist/tools/wiki-manifest.js.map +1 -1
- package/dist/tools/wiki-module-builder.d.ts +42 -0
- package/dist/tools/wiki-module-builder.d.ts.map +1 -0
- package/dist/tools/wiki-module-builder.js +449 -0
- package/dist/tools/wiki-module-builder.js.map +1 -0
- package/dist/tools/wiki-overview-sources.d.ts +26 -0
- package/dist/tools/wiki-overview-sources.d.ts.map +1 -0
- package/dist/tools/wiki-overview-sources.js +128 -0
- package/dist/tools/wiki-overview-sources.js.map +1 -0
- package/dist/tools/wiki-page-generators.d.ts +19 -3
- package/dist/tools/wiki-page-generators.d.ts.map +1 -1
- package/dist/tools/wiki-page-generators.js +156 -22
- package/dist/tools/wiki-page-generators.js.map +1 -1
- package/dist/tools/wiki-tools.d.ts +20 -0
- package/dist/tools/wiki-tools.d.ts.map +1 -1
- package/dist/tools/wiki-tools.js +181 -29
- package/dist/tools/wiki-tools.js.map +1 -1
- package/dist/tools/workspace-scope-helper.d.ts +21 -0
- package/dist/tools/workspace-scope-helper.d.ts.map +1 -0
- package/dist/tools/workspace-scope-helper.js +50 -0
- package/dist/tools/workspace-scope-helper.js.map +1 -0
- package/dist/tools/workspace-tools.d.ts +74 -0
- package/dist/tools/workspace-tools.d.ts.map +1 -0
- package/dist/tools/workspace-tools.js +366 -0
- package/dist/tools/workspace-tools.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/import-graph.d.ts +27 -0
- package/dist/utils/import-graph.d.ts.map +1 -1
- package/dist/utils/import-graph.js +331 -8
- package/dist/utils/import-graph.js.map +1 -1
- package/dist/utils/ts-imports.d.ts +30 -0
- package/dist/utils/ts-imports.d.ts.map +1 -0
- package/dist/utils/ts-imports.js +168 -0
- package/dist/utils/ts-imports.js.map +1 -0
- package/dist/utils/tsconfig-paths.d.ts +59 -0
- package/dist/utils/tsconfig-paths.d.ts.map +1 -0
- package/dist/utils/tsconfig-paths.js +176 -0
- package/dist/utils/tsconfig-paths.js.map +1 -0
- package/dist/utils/walk.d.ts.map +1 -1
- package/dist/utils/walk.js +1 -0
- package/dist/utils/walk.js.map +1 -1
- package/package.json +13 -3
- package/rules/codesift.md +19 -2
- package/rules/codesift.mdc +2 -2
- package/rules/codex.md +13 -2
- package/rules/gemini.md +13 -2
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ts-imports.ts — tree-sitter AST extractor for TypeScript/TSX imports + re-exports.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the structure of `python-imports.ts`. The graph builder calls
|
|
5
|
+
* `extractTypeScriptImports(tree)` to walk `import_statement` and
|
|
6
|
+
* `export_statement` (with `source` field) nodes; it returns flat edges with
|
|
7
|
+
* an `is_type_only` flag derived from statement-level OR per-specifier `type`
|
|
8
|
+
* modifiers.
|
|
9
|
+
*
|
|
10
|
+
* Detection rules:
|
|
11
|
+
* - statement-level `import type { X } from "y"` → all specifiers type-only
|
|
12
|
+
* - per-specifier `import { type X, Y } from "y"` → type_only:false (any
|
|
13
|
+
* runtime specifier present makes the entire edge runtime; the import is
|
|
14
|
+
* loaded at runtime regardless of which subset is used as types only)
|
|
15
|
+
* - `import * as ns from "y"` / default / side-effect → runtime
|
|
16
|
+
* - `export { X } from "y"` → runtime; `export type { X } from "y"` → type_only:true
|
|
17
|
+
* - `export * from "y"` → runtime; `export type * from "y"` → type_only:true
|
|
18
|
+
*/
|
|
19
|
+
/** True when this statement node has a top-level `type` keyword child
|
|
20
|
+
* (e.g., `import type {...}` or `export type {...}`).
|
|
21
|
+
*
|
|
22
|
+
* Some grammar versions wrap `type` inside an ERROR node for niche syntaxes
|
|
23
|
+
* like `export type * from "y"`. We walk one level into ERROR children to
|
|
24
|
+
* handle that case. */
|
|
25
|
+
function statementIsTypeOnly(node) {
|
|
26
|
+
for (const child of node.children) {
|
|
27
|
+
if (child.type === "type" && child.text === "type")
|
|
28
|
+
return true;
|
|
29
|
+
if (child.type === "ERROR") {
|
|
30
|
+
for (const inner of child.children) {
|
|
31
|
+
if (inner.type === "type" && inner.text === "type")
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
/** Extract source string from `import_statement` or `export_statement` source field.
|
|
39
|
+
* Returns undefined when the statement has no `from` clause (e.g. local export). */
|
|
40
|
+
function getSourcePath(node) {
|
|
41
|
+
// import_statement: source field directly
|
|
42
|
+
// export_statement: also exposes source field when `from` is present
|
|
43
|
+
const sourceField = node.childForFieldName("source");
|
|
44
|
+
if (sourceField) {
|
|
45
|
+
return sourceField.text.replace(/^['"`]|['"`]$/g, "");
|
|
46
|
+
}
|
|
47
|
+
// Fallback: scan named children for a `string` node (some grammar variants
|
|
48
|
+
// expose it without a named field)
|
|
49
|
+
for (const child of node.namedChildren) {
|
|
50
|
+
if (child.type === "string") {
|
|
51
|
+
return child.text.replace(/^['"`]|['"`]$/g, "");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
/** Walk an `import_clause` to collect specifiers.
|
|
57
|
+
* Returns { specifiers, anyRuntimeSpecifier }. anyRuntimeSpecifier is true when
|
|
58
|
+
* at least one specifier is NOT prefixed with `type` (per-specifier modifier).
|
|
59
|
+
* For default + namespace imports (no named clause) anyRuntimeSpecifier=true. */
|
|
60
|
+
function walkImportClause(clause) {
|
|
61
|
+
const specifiers = [];
|
|
62
|
+
let anyRuntimeSpecifier = false;
|
|
63
|
+
for (const child of clause.namedChildren) {
|
|
64
|
+
if (child.type === "named_imports") {
|
|
65
|
+
// import_specifier nodes; check each for leading `type` keyword
|
|
66
|
+
for (const spec of child.namedChildren) {
|
|
67
|
+
if (spec.type !== "import_specifier")
|
|
68
|
+
continue;
|
|
69
|
+
const nameNode = spec.childForFieldName("name");
|
|
70
|
+
const aliasNode = spec.childForFieldName("alias");
|
|
71
|
+
const emitName = (aliasNode ?? nameNode)?.text;
|
|
72
|
+
if (emitName)
|
|
73
|
+
specifiers.push(emitName);
|
|
74
|
+
// Per-specifier `type`: an `import_specifier` with the keyword `type`
|
|
75
|
+
// as its first child token.
|
|
76
|
+
const isTyped = spec.children.some((c) => c.type === "type" && c.text === "type");
|
|
77
|
+
if (!isTyped)
|
|
78
|
+
anyRuntimeSpecifier = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else if (child.type === "namespace_import") {
|
|
82
|
+
// import * as ns — runtime
|
|
83
|
+
anyRuntimeSpecifier = true;
|
|
84
|
+
const id = child.namedChildren.find((c) => c.type === "identifier");
|
|
85
|
+
if (id)
|
|
86
|
+
specifiers.push(id.text);
|
|
87
|
+
}
|
|
88
|
+
else if (child.type === "identifier") {
|
|
89
|
+
// default import — runtime
|
|
90
|
+
anyRuntimeSpecifier = true;
|
|
91
|
+
specifiers.push(child.text);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { specifiers, anyRuntimeSpecifier };
|
|
95
|
+
}
|
|
96
|
+
/** Walk an `export_clause` (named re-exports) to collect names.
|
|
97
|
+
* Returns specifiers list. Type-only-ness is derived from the parent
|
|
98
|
+
* export_statement, not per-specifier here (TS does not distinguish at the
|
|
99
|
+
* specifier level inside `export {X} from "y"` to the same extent as imports). */
|
|
100
|
+
function walkExportClause(clause) {
|
|
101
|
+
const specifiers = [];
|
|
102
|
+
for (const spec of clause.namedChildren) {
|
|
103
|
+
if (spec.type !== "export_specifier")
|
|
104
|
+
continue;
|
|
105
|
+
const nameNode = spec.childForFieldName("name");
|
|
106
|
+
const aliasNode = spec.childForFieldName("alias");
|
|
107
|
+
const emitName = (aliasNode ?? nameNode)?.text;
|
|
108
|
+
if (emitName)
|
|
109
|
+
specifiers.push(emitName);
|
|
110
|
+
}
|
|
111
|
+
return specifiers;
|
|
112
|
+
}
|
|
113
|
+
/** Walk the tree and return all import + re-export edges. */
|
|
114
|
+
export function extractTypeScriptImports(tree) {
|
|
115
|
+
const edges = [];
|
|
116
|
+
function visit(node) {
|
|
117
|
+
if (node.type === "import_statement") {
|
|
118
|
+
const path = getSourcePath(node);
|
|
119
|
+
if (!path)
|
|
120
|
+
return; // malformed; skip
|
|
121
|
+
const stmtTypeOnly = statementIsTypeOnly(node);
|
|
122
|
+
const importClause = node.namedChildren.find((c) => c.type === "import_clause");
|
|
123
|
+
if (!importClause) {
|
|
124
|
+
// side-effect import: `import "x"`
|
|
125
|
+
edges.push({ path, is_type_only: stmtTypeOnly, specifiers: [] });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const { specifiers, anyRuntimeSpecifier } = walkImportClause(importClause);
|
|
129
|
+
// Edge is type_only only when statement-level `type` modifier is present
|
|
130
|
+
// OR when every named specifier is per-specifier-typed (no runtime member).
|
|
131
|
+
const is_type_only = stmtTypeOnly || !anyRuntimeSpecifier;
|
|
132
|
+
edges.push({ path, is_type_only, specifiers });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (node.type === "export_statement") {
|
|
136
|
+
const path = getSourcePath(node);
|
|
137
|
+
if (!path) {
|
|
138
|
+
// Local export with no `from` clause; recurse into children for nested
|
|
139
|
+
// re-exports (rare). Continue walking.
|
|
140
|
+
for (const c of node.namedChildren)
|
|
141
|
+
visit(c);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const is_type_only = statementIsTypeOnly(node);
|
|
145
|
+
let specifiers = [];
|
|
146
|
+
for (const child of node.namedChildren) {
|
|
147
|
+
if (child.type === "export_clause") {
|
|
148
|
+
specifiers = walkExportClause(child);
|
|
149
|
+
}
|
|
150
|
+
// namespace_export `export * as ns from "y"` → record `ns` as specifier
|
|
151
|
+
if (child.type === "namespace_export") {
|
|
152
|
+
const id = child.namedChildren.find((c) => c.type === "identifier");
|
|
153
|
+
if (id)
|
|
154
|
+
specifiers.push(id.text);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
edges.push({ path, is_type_only, specifiers });
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
// Recurse into children for top-level scan (most imports are at root, but
|
|
161
|
+
// some declarations nest them — e.g., declare module).
|
|
162
|
+
for (const c of node.namedChildren)
|
|
163
|
+
visit(c);
|
|
164
|
+
}
|
|
165
|
+
visit(tree.rootNode);
|
|
166
|
+
return edges;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=ts-imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-imports.js","sourceRoot":"","sources":["../../src/utils/ts-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAaH;;;;;uBAKuB;AACvB,SAAS,mBAAmB,CAAC,IAAuB;IAClD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;YAAE,OAAO,IAAI,CAAC;QAChE,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3B,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;oBAAE,OAAO,IAAI,CAAC;YAClE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;oFACoF;AACpF,SAAS,aA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E,uCAAuC;gBACvC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,aAAa;oBAAE,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC7C,OAAO;YACT,CAAC;YACD,MAAM,YAAY,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC/C,IAAI,UAAU,GAAa,EAAE,CAAC;YAC9B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvC,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;oBACnC,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBACvC,CAAC;gBACD,wEAAwE;gBACxE,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;oBACtC,MAAM,EAAE,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;oBACpE,IAAI,EAAE;wBAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;gBACnC,CAAC;YACH,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;YAC/C,OAAO;QACT,CAAC;QAED,0EAA0E;QAC1E,uDAAuD;QACvD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,aAAa;YAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tsconfig-paths.ts — resolves `@/foo` style aliased imports against the nearest
|
|
3
|
+
* `tsconfig.json`, using `get-tsconfig` for `extends`-chain + paths handling.
|
|
4
|
+
*
|
|
5
|
+
* Two-level cache keeps long-running MCP server processes happy:
|
|
6
|
+
* - `dirToConfigCache`: directory absolute path → nearest tsconfig.json path
|
|
7
|
+
* (or null when none found up to repoRoot).
|
|
8
|
+
* - `configCache`: tsconfig.json absolute path → parsed { matcher, baseUrl }.
|
|
9
|
+
*
|
|
10
|
+
* Both caches are cleared on `clearTsconfigCache()`. The graph builder calls
|
|
11
|
+
* this at the start of every `index_folder` so config edits between runs take
|
|
12
|
+
* effect.
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: when probing `TS_EXTENSIONS`, the empty-string entry that handles
|
|
15
|
+
* exact-file aliases (`paths: { "foo": ["src/foo.ts"] }`) MUST gate on
|
|
16
|
+
* `statSync(candidate).isFile()` — `existsSync` returns true for both files
|
|
17
|
+
* and directories, and a directory match would return the dir path, then fail
|
|
18
|
+
* the downstream `normalizedPaths.get(resolved)` lookup (file-only), silently
|
|
19
|
+
* dropping the edge for `@/components/Button` style aliases pointing at a
|
|
20
|
+
* directory with `index.ts`.
|
|
21
|
+
*/
|
|
22
|
+
interface ResolvedTsconfig {
|
|
23
|
+
pathsMatcher: ((specifier: string) => string[]) | null;
|
|
24
|
+
baseUrl: string | null;
|
|
25
|
+
configPath: string;
|
|
26
|
+
}
|
|
27
|
+
/** Clear both caches. Called at the start of `index_folder`. */
|
|
28
|
+
export declare function clearTsconfigCache(): void;
|
|
29
|
+
/** Walk up from `dir` to `repoRoot`, find nearest `tsconfig.json`.
|
|
30
|
+
* Returns absolute path of the config file, or null if none found.
|
|
31
|
+
* Caches every ancestor visited during the walk, not just the input dir,
|
|
32
|
+
* so sibling lookups under the same parent are O(1). */
|
|
33
|
+
declare function findNearestTsconfig(dir: string, repoRoot: string): string | null;
|
|
34
|
+
/** Parse a tsconfig.json (with `extends` chain) and build a paths matcher.
|
|
35
|
+
* Returns null on parse error. Caches successful parses only — failures are
|
|
36
|
+
* NOT cached so a user fixing a malformed tsconfig.json mid-session does not
|
|
37
|
+
* stay broken until the next full index_folder. */
|
|
38
|
+
declare function loadTsconfig(configPath: string): ResolvedTsconfig | null;
|
|
39
|
+
/** Probe candidate path against TS_EXTENSIONS. Returns the first existing FILE
|
|
40
|
+
* (not directory) match, or null. */
|
|
41
|
+
declare function probeFile(candidate: string): string | null;
|
|
42
|
+
/** Resolve a TS aliased import against the nearest tsconfig.json.
|
|
43
|
+
*
|
|
44
|
+
* @param importerFile absolute path of the file containing the import
|
|
45
|
+
* @param importPath raw import specifier (e.g., "@/components/x")
|
|
46
|
+
* @param repoRoot walk-up termination boundary (absolute path)
|
|
47
|
+
* @returns absolute path of the resolved file, or null when no alias matches
|
|
48
|
+
* OR no real file exists with any candidate extension. */
|
|
49
|
+
export declare function resolveTsAliasedImport(importerFile: string, importPath: string, repoRoot: string): string | null;
|
|
50
|
+
export declare const __test: {
|
|
51
|
+
findNearestTsconfig: typeof findNearestTsconfig;
|
|
52
|
+
loadTsconfig: typeof loadTsconfig;
|
|
53
|
+
probeFile: typeof probeFile;
|
|
54
|
+
TS_EXTENSIONS: string[];
|
|
55
|
+
getConfigCacheSize: () => number;
|
|
56
|
+
getDirCacheSize: () => number;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=tsconfig-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig-paths.d.ts","sourceRoot":"","sources":["../../src/utils/tsconfig-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,UAAU,gBAAgB;IACxB,YAAY,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACvD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAoBD,gEAAgE;AAChE,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC;AAED;;;wDAGwD;AACxD,iBAAS,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBzE;AAED;;;mDAGmD;AACnD,iBAAS,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CA8BjE;AAED;qCACqC;AACrC,iBAAS,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcnD;AAED;;;;;;mEAMmE;AACnE,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,IAAI,CA4Bf;AAGD,eAAO,MAAM,MAAM;;;;;;;CAQlB,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tsconfig-paths.ts — resolves `@/foo` style aliased imports against the nearest
|
|
3
|
+
* `tsconfig.json`, using `get-tsconfig` for `extends`-chain + paths handling.
|
|
4
|
+
*
|
|
5
|
+
* Two-level cache keeps long-running MCP server processes happy:
|
|
6
|
+
* - `dirToConfigCache`: directory absolute path → nearest tsconfig.json path
|
|
7
|
+
* (or null when none found up to repoRoot).
|
|
8
|
+
* - `configCache`: tsconfig.json absolute path → parsed { matcher, baseUrl }.
|
|
9
|
+
*
|
|
10
|
+
* Both caches are cleared on `clearTsconfigCache()`. The graph builder calls
|
|
11
|
+
* this at the start of every `index_folder` so config edits between runs take
|
|
12
|
+
* effect.
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: when probing `TS_EXTENSIONS`, the empty-string entry that handles
|
|
15
|
+
* exact-file aliases (`paths: { "foo": ["src/foo.ts"] }`) MUST gate on
|
|
16
|
+
* `statSync(candidate).isFile()` — `existsSync` returns true for both files
|
|
17
|
+
* and directories, and a directory match would return the dir path, then fail
|
|
18
|
+
* the downstream `normalizedPaths.get(resolved)` lookup (file-only), silently
|
|
19
|
+
* dropping the edge for `@/components/Button` style aliases pointing at a
|
|
20
|
+
* directory with `index.ts`.
|
|
21
|
+
*/
|
|
22
|
+
import { existsSync, statSync } from "node:fs";
|
|
23
|
+
import { dirname, join, resolve } from "node:path";
|
|
24
|
+
import { getTsconfig, createPathsMatcher } from "get-tsconfig";
|
|
25
|
+
const configCache = new Map();
|
|
26
|
+
const dirToConfigCache = new Map();
|
|
27
|
+
// Empty string FIRST: probes the raw candidate path so exact-file aliases work.
|
|
28
|
+
// `/index.ts` etc. cover directory-as-module aliases.
|
|
29
|
+
const TS_EXTENSIONS = [
|
|
30
|
+
"",
|
|
31
|
+
".ts",
|
|
32
|
+
".tsx",
|
|
33
|
+
".d.ts",
|
|
34
|
+
".js",
|
|
35
|
+
".jsx",
|
|
36
|
+
"/index.ts",
|
|
37
|
+
"/index.tsx",
|
|
38
|
+
"/index.d.ts",
|
|
39
|
+
"/index.js",
|
|
40
|
+
];
|
|
41
|
+
/** Clear both caches. Called at the start of `index_folder`. */
|
|
42
|
+
export function clearTsconfigCache() {
|
|
43
|
+
configCache.clear();
|
|
44
|
+
dirToConfigCache.clear();
|
|
45
|
+
}
|
|
46
|
+
/** Walk up from `dir` to `repoRoot`, find nearest `tsconfig.json`.
|
|
47
|
+
* Returns absolute path of the config file, or null if none found.
|
|
48
|
+
* Caches every ancestor visited during the walk, not just the input dir,
|
|
49
|
+
* so sibling lookups under the same parent are O(1). */
|
|
50
|
+
function findNearestTsconfig(dir, repoRoot) {
|
|
51
|
+
const cached = dirToConfigCache.get(dir);
|
|
52
|
+
if (cached !== undefined)
|
|
53
|
+
return cached;
|
|
54
|
+
const repoRootAbs = resolve(repoRoot);
|
|
55
|
+
const visited = [];
|
|
56
|
+
let cur = resolve(dir);
|
|
57
|
+
// `startsWith(repoRootAbs)` is true when cur === repoRootAbs, so the
|
|
58
|
+
// explicit equality check would be redundant.
|
|
59
|
+
while (cur.startsWith(repoRootAbs)) {
|
|
60
|
+
visited.push(cur);
|
|
61
|
+
const candidate = join(cur, "tsconfig.json");
|
|
62
|
+
if (existsSync(candidate)) {
|
|
63
|
+
for (const v of visited)
|
|
64
|
+
dirToConfigCache.set(v, candidate);
|
|
65
|
+
return candidate;
|
|
66
|
+
}
|
|
67
|
+
const parent = dirname(cur);
|
|
68
|
+
if (parent === cur)
|
|
69
|
+
break;
|
|
70
|
+
cur = parent;
|
|
71
|
+
}
|
|
72
|
+
for (const v of visited)
|
|
73
|
+
dirToConfigCache.set(v, null);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
/** Parse a tsconfig.json (with `extends` chain) and build a paths matcher.
|
|
77
|
+
* Returns null on parse error. Caches successful parses only — failures are
|
|
78
|
+
* NOT cached so a user fixing a malformed tsconfig.json mid-session does not
|
|
79
|
+
* stay broken until the next full index_folder. */
|
|
80
|
+
function loadTsconfig(configPath) {
|
|
81
|
+
const cached = configCache.get(configPath);
|
|
82
|
+
if (cached !== undefined)
|
|
83
|
+
return cached;
|
|
84
|
+
try {
|
|
85
|
+
const result = getTsconfig(configPath);
|
|
86
|
+
if (!result) {
|
|
87
|
+
// Don't cache: the file might appear on a retry.
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const matcher = createPathsMatcher(result);
|
|
91
|
+
const baseUrlRaw = result.config.compilerOptions?.baseUrl;
|
|
92
|
+
const baseUrl = baseUrlRaw
|
|
93
|
+
? resolve(dirname(result.path), baseUrlRaw)
|
|
94
|
+
: null;
|
|
95
|
+
const resolved = {
|
|
96
|
+
pathsMatcher: matcher,
|
|
97
|
+
baseUrl,
|
|
98
|
+
configPath: result.path,
|
|
99
|
+
};
|
|
100
|
+
configCache.set(configPath, resolved);
|
|
101
|
+
return resolved;
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
console.warn(`[tsconfig-paths] failed to parse ${configPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
105
|
+
// Don't cache parse failures — let the next call retry once the user
|
|
106
|
+
// fixes the malformed config.
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** Probe candidate path against TS_EXTENSIONS. Returns the first existing FILE
|
|
111
|
+
* (not directory) match, or null. */
|
|
112
|
+
function probeFile(candidate) {
|
|
113
|
+
for (const ext of TS_EXTENSIONS) {
|
|
114
|
+
const probe = candidate + ext;
|
|
115
|
+
if (!existsSync(probe))
|
|
116
|
+
continue;
|
|
117
|
+
// CRITICAL: empty-string probe matches both files and directories.
|
|
118
|
+
// Without this isFile() gate, `@/components/Button` (a directory) resolves
|
|
119
|
+
// to the directory path, then fails downstream normalizedPaths.get lookup.
|
|
120
|
+
try {
|
|
121
|
+
if (statSync(probe).isFile())
|
|
122
|
+
return probe;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// statSync race; treat as not-a-file
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
/** Resolve a TS aliased import against the nearest tsconfig.json.
|
|
131
|
+
*
|
|
132
|
+
* @param importerFile absolute path of the file containing the import
|
|
133
|
+
* @param importPath raw import specifier (e.g., "@/components/x")
|
|
134
|
+
* @param repoRoot walk-up termination boundary (absolute path)
|
|
135
|
+
* @returns absolute path of the resolved file, or null when no alias matches
|
|
136
|
+
* OR no real file exists with any candidate extension. */
|
|
137
|
+
export function resolveTsAliasedImport(importerFile, importPath, repoRoot) {
|
|
138
|
+
// Relative paths are not aliases — short-circuit.
|
|
139
|
+
if (importPath.startsWith("."))
|
|
140
|
+
return null;
|
|
141
|
+
const importerDir = dirname(resolve(importerFile));
|
|
142
|
+
const configPath = findNearestTsconfig(importerDir, repoRoot);
|
|
143
|
+
if (!configPath)
|
|
144
|
+
return null;
|
|
145
|
+
const config = loadTsconfig(configPath);
|
|
146
|
+
if (!config)
|
|
147
|
+
return null;
|
|
148
|
+
// Try paths matcher first (alias mappings).
|
|
149
|
+
if (config.pathsMatcher) {
|
|
150
|
+
const candidates = config.pathsMatcher(importPath);
|
|
151
|
+
for (const candidate of candidates) {
|
|
152
|
+
const hit = probeFile(candidate);
|
|
153
|
+
if (hit)
|
|
154
|
+
return hit;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Fallback: bare specifier resolved against baseUrl.
|
|
158
|
+
if (config.baseUrl) {
|
|
159
|
+
const candidate = join(config.baseUrl, importPath);
|
|
160
|
+
const hit = probeFile(candidate);
|
|
161
|
+
if (hit)
|
|
162
|
+
return hit;
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
// Internal helpers exported for testing only.
|
|
167
|
+
export const __test = {
|
|
168
|
+
findNearestTsconfig,
|
|
169
|
+
loadTsconfig,
|
|
170
|
+
probeFile,
|
|
171
|
+
TS_EXTENSIONS,
|
|
172
|
+
// Allow tests to assert cache state without exposing it broadly.
|
|
173
|
+
getConfigCacheSize: () => configCache.size,
|
|
174
|
+
getDirCacheSize: () => dirToConfigCache.size,
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=tsconfig-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig-paths.js","sourceRoot":"","sources":["../../src/utils/tsconfig-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,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,WAAW;IACX,YAAY;IACZ,aAAa;IACb,WAAW;CACZ,CAAC;AAEF,gEAAgE;AAChE,MAAM,UAAU,kBAAkB;IAChC,WA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AAY;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"}
|
package/dist/utils/walk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,WAAW,aAOtB,CAAC;AAEH;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAID;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,EAQxC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAEpC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAEnE;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAErC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,MAAM,EAAE,CAAC,CAiHnB"}
|
package/dist/utils/walk.js
CHANGED
|
@@ -11,6 +11,7 @@ export const IGNORE_DIRS = new Set([
|
|
|
11
11
|
".venv", "venv", ".tox", ".mypy_cache", ".turbo",
|
|
12
12
|
"generated", "audit-results", ".backup", "jscpd-report",
|
|
13
13
|
"helpscout_export", ".output",
|
|
14
|
+
".pnpm", // pnpm symlink forest — recursing here can blow up file count
|
|
14
15
|
]);
|
|
15
16
|
/**
|
|
16
17
|
* Convert IGNORE_DIRS to chokidar-compatible glob patterns.
|
package/dist/utils/walk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IACjC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IACnD,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe;IACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ;IAChD,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc;IACvD,kBAAkB,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,SAAS,MAAM,WAAW,CAAC;AAEl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5C,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC7C,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;oBAChE,IAAI,CAAC,OAAO;wBAAE,SAAS;gBACzB,CAAC;gBAED,yBAAyB;gBACzB,IAAI,UAAU,EAAE,CAAC;oBACf,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC7C,IAAI,UAAU,CAAC,OAAO,CAAC;wBAAE,SAAS;gBACpC,CAAC;gBAED,gCAAgC;gBAChC,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;oBACtC,IAAI,QAAQ,CAAC,IAAI,GAAG,WAAW;wBAAE,SAAS;gBAC5C,CAAC;gBAAC,MAAM,CAAC;oBACP,SAAS;gBACX,CAAC;gBAED,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;gBAElE,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;oBAC7B,OAAO,CAAC,IAAI,CACV,qCAAqC,QAAQ,wCAAwC,CACtF,CAAC;oBACF,YAAY,GAAG,IAAI,CAAC;oBACpB,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesift-mcp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.28",
|
|
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",
|
|
@@ -30,28 +30,38 @@
|
|
|
30
30
|
"postinstall": "node ./dist/cli.js setup all 2>/dev/null && echo '\n ✨ CodeSift MCP installed and configured for all platforms.\n ⚠️ Restart your AI client (Cmd+Q for Claude Code) to load new MCP server.\n' || echo '\n ✨ CodeSift MCP installed. Run: codesift setup all\n'"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@manypkg/get-packages": "^3.1.0",
|
|
33
34
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
34
35
|
"@mrleebo/prisma-ast": "^0.15.0",
|
|
36
|
+
"@parcel/watcher": "^2.5.6",
|
|
35
37
|
"@sanity-labs/secret-scan": "^1.1.0",
|
|
36
|
-
"
|
|
38
|
+
"get-tsconfig": "^4.14.0",
|
|
39
|
+
"graphology": "^0.26.0",
|
|
40
|
+
"graphology-metrics": "^2.4.0",
|
|
37
41
|
"ignore": "^6.0.0",
|
|
38
42
|
"picomatch": "^4.0.4",
|
|
39
43
|
"web-tree-sitter": "^0.24.0",
|
|
40
44
|
"zod": "^4.3.6"
|
|
41
45
|
},
|
|
42
46
|
"optionalDependencies": {
|
|
47
|
+
"@anthropic-ai/sdk": "^0.70.0",
|
|
43
48
|
"@huggingface/transformers": "^3.0.0",
|
|
44
49
|
"openai": "^6.0.0",
|
|
45
|
-
"voyageai": "^0.2.1"
|
|
50
|
+
"voyageai": "^0.2.1",
|
|
51
|
+
"yaml": "^2.7.0"
|
|
46
52
|
},
|
|
47
53
|
"devDependencies": {
|
|
48
54
|
"@types/node": "^22.0.0",
|
|
49
55
|
"@types/picomatch": "^4.0.2",
|
|
50
56
|
"@vitest/coverage-v8": "^3.0.0",
|
|
57
|
+
"ajv": "^8.18.0",
|
|
51
58
|
"tsx": "^4.0.0",
|
|
52
59
|
"typescript": "^5.7.0",
|
|
53
60
|
"vitest": "^3.0.0"
|
|
54
61
|
},
|
|
62
|
+
"overrides": {
|
|
63
|
+
"lodash-es": ">=4.18.1"
|
|
64
|
+
},
|
|
55
65
|
"engines": {
|
|
56
66
|
"node": ">=20.0.0"
|
|
57
67
|
},
|
package/rules/codesift.md
CHANGED
|
@@ -23,12 +23,12 @@ Note: The Explore subagent does NOT have access to CodeSift MCP tools. For code
|
|
|
23
23
|
|
|
24
24
|
## Tool Discovery
|
|
25
25
|
|
|
26
|
-
**
|
|
26
|
+
**150 MCP tools total** (55 core visible + 95 discoverable).
|
|
27
27
|
|
|
28
28
|
51 core tools appear in ListTools. The remaining 95 niche tools are discovered on demand:
|
|
29
29
|
|
|
30
30
|
- `plan_turn(query="find dead code in auth")` — natural-language router: ranked tool/symbol/file recommendations with auto-reveal of hidden tools (preferred entry point at start of a task)
|
|
31
|
-
- `discover_tools(query="dead code")` — keyword search across all
|
|
31
|
+
- `discover_tools(query="dead code")` — keyword search across all 150 tools
|
|
32
32
|
- `describe_tools(names=["find_dead_code"])` — get full parameter schema
|
|
33
33
|
- `describe_tools(names=["find_dead_code"], reveal=true)` — also reveal in ListTools
|
|
34
34
|
|
|
@@ -159,6 +159,12 @@ 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")` |
|
|
165
|
+
| React tabnabbing security | `search_patterns("jsx-no-target-blank")` |
|
|
166
|
+
| React button submit foot-gun | `search_patterns("button-no-type")` |
|
|
167
|
+
| React render-tree depth | `analyze_renders` → `entry.prop_chain_depth` (NOT prop-flow depth) |
|
|
162
168
|
| React call graph (clean) | `trace_call_chain(filter_react_hooks=true)` |
|
|
163
169
|
| new Next.js project (first look) | `framework_audit` |
|
|
164
170
|
| SEO audit / metadata review | `nextjs_metadata_audit` |
|
|
@@ -266,3 +272,14 @@ Installs hooks in `.claude/settings.local.json` and rules in `~/.claude/rules/co
|
|
|
266
272
|
- **PreCompact** (`precompact-snapshot`) — injects session snapshot before context compaction
|
|
267
273
|
|
|
268
274
|
This ensures the index stays current and sub-agents use CodeSift tools automatically.
|
|
275
|
+
|
|
276
|
+
## Monorepo (Turbo / pnpm-workspace / Nx) — workspace tools
|
|
277
|
+
|
|
278
|
+
| Task | Tool |
|
|
279
|
+
|------|------|
|
|
280
|
+
| list workspace packages | `list_workspaces` |
|
|
281
|
+
| workspace dependency DAG | `workspace_graph(format=mermaid)` |
|
|
282
|
+
| affected packages on diff | `affected_workspaces(since="HEAD~1")` |
|
|
283
|
+
| boundary rules | `workspace_boundaries(rules=[…])` |
|
|
284
|
+
| package-level cycles | `find_circular_deps` (output gains `package_cycles[]` in monorepo mode) |
|
|
285
|
+
| scope a framework audit | pass `workspace=<name|path>` to `framework_audit`, `nextjs_route_map`, `nextjs_metadata_audit`, `analyze_hono_app`, `nest_audit`, `astro_audit` |
|
package/rules/codesift.mdc
CHANGED
|
@@ -15,12 +15,12 @@ For multi-repo sessions, call `list_repos()` to discover available repos.
|
|
|
15
15
|
|
|
16
16
|
## Tool Discovery
|
|
17
17
|
|
|
18
|
-
**
|
|
18
|
+
**150 MCP tools total** (55 core visible + 95 discoverable).
|
|
19
19
|
|
|
20
20
|
51 core tools appear in ListTools. The remaining 95 niche tools are discovered on demand:
|
|
21
21
|
|
|
22
22
|
- `plan_turn(query="...")` — natural-language router with auto-reveal (preferred start-of-task entry point)
|
|
23
|
-
- `discover_tools(query="dead code")` — keyword search across all
|
|
23
|
+
- `discover_tools(query="dead code")` — keyword search across all 150 tools
|
|
24
24
|
- `describe_tools(names=["find_dead_code"])` — get full parameter schema
|
|
25
25
|
- `describe_tools(names=["find_dead_code"], reveal=true)` — also reveal in ListTools
|
|
26
26
|
|
package/rules/codex.md
CHANGED
|
@@ -10,12 +10,12 @@ For multi-repo sessions, call `list_repos()` to discover available repos.
|
|
|
10
10
|
|
|
11
11
|
## Tool Discovery
|
|
12
12
|
|
|
13
|
-
**
|
|
13
|
+
**150 MCP tools total** (55 core visible + 95 discoverable).
|
|
14
14
|
|
|
15
15
|
51 core tools appear in ListTools. The remaining 95 niche tools are discovered on demand:
|
|
16
16
|
|
|
17
17
|
- `plan_turn(query="...")` — natural-language router with auto-reveal (preferred start-of-task entry point)
|
|
18
|
-
- `discover_tools(query="dead code")` — keyword search across all
|
|
18
|
+
- `discover_tools(query="dead code")` — keyword search across all 150 tools
|
|
19
19
|
- `describe_tools(names=["find_dead_code"])` — get full parameter schema
|
|
20
20
|
- `describe_tools(names=["find_dead_code"], reveal=true)` — also reveal in ListTools
|
|
21
21
|
|
|
@@ -251,3 +251,14 @@ Installs two hooks in `.claude/settings.local.json`:
|
|
|
251
251
|
- **PostToolUse** (`postindex-file`) — auto-runs `index_file` after `Edit` or `Write`
|
|
252
252
|
|
|
253
253
|
This ensures the index stays current without manual `index_file` calls after every edit.
|
|
254
|
+
|
|
255
|
+
## Monorepo (Turbo / pnpm-workspace / Nx) — workspace tools
|
|
256
|
+
|
|
257
|
+
| Task | Tool |
|
|
258
|
+
|------|------|
|
|
259
|
+
| list workspace packages | `list_workspaces` |
|
|
260
|
+
| workspace dependency DAG | `workspace_graph(format=mermaid)` |
|
|
261
|
+
| affected packages on diff | `affected_workspaces(since="HEAD~1")` |
|
|
262
|
+
| boundary rules | `workspace_boundaries(rules=[…])` |
|
|
263
|
+
| package-level cycles | `find_circular_deps` (output gains `package_cycles[]` in monorepo mode) |
|
|
264
|
+
| scope a framework audit | pass `workspace=<name|path>` to `framework_audit`, `nextjs_route_map`, `nextjs_metadata_audit`, `analyze_hono_app`, `nest_audit`, `astro_audit` |
|
package/rules/gemini.md
CHANGED
|
@@ -11,12 +11,12 @@ If the repo is not yet indexed, run `index_folder(path="/full/path/to/project")`
|
|
|
11
11
|
|
|
12
12
|
## Tool Discovery
|
|
13
13
|
|
|
14
|
-
**
|
|
14
|
+
**150 MCP tools total** (55 core visible + 95 discoverable).
|
|
15
15
|
|
|
16
16
|
51 core tools appear in ListTools. The remaining 95 niche tools are discovered on demand:
|
|
17
17
|
|
|
18
18
|
- `plan_turn(query="...")` — natural-language router with auto-reveal (preferred start-of-task entry point)
|
|
19
|
-
- `discover_tools(query="dead code")` — keyword search across all
|
|
19
|
+
- `discover_tools(query="dead code")` — keyword search across all 150 tools
|
|
20
20
|
- `describe_tools(names=["find_dead_code"])` — get full parameter schema
|
|
21
21
|
- `describe_tools(names=["find_dead_code"], reveal=true)` — also reveal in ListTools
|
|
22
22
|
|
|
@@ -252,3 +252,14 @@ Installs two hooks in `.claude/settings.local.json`:
|
|
|
252
252
|
- **PostToolUse** (`postindex-file`) — auto-runs `index_file` after `Edit` or `Write`
|
|
253
253
|
|
|
254
254
|
This ensures the index stays current without manual `index_file` calls after every edit.
|
|
255
|
+
|
|
256
|
+
## Monorepo (Turbo / pnpm-workspace / Nx) — workspace tools
|
|
257
|
+
|
|
258
|
+
| Task | Tool |
|
|
259
|
+
|------|------|
|
|
260
|
+
| list workspace packages | `list_workspaces` |
|
|
261
|
+
| workspace dependency DAG | `workspace_graph(format=mermaid)` |
|
|
262
|
+
| affected packages on diff | `affected_workspaces(since="HEAD~1")` |
|
|
263
|
+
| boundary rules | `workspace_boundaries(rules=[…])` |
|
|
264
|
+
| package-level cycles | `find_circular_deps` (output gains `package_cycles[]` in monorepo mode) |
|
|
265
|
+
| scope a framework audit | pass `workspace=<name|path>` to `framework_audit`, `nextjs_route_map`, `nextjs_metadata_audit`, `analyze_hono_app`, `nest_audit`, `astro_audit` |
|