mcp-code-context 3.9.1 → 7.0.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.
Files changed (208) hide show
  1. package/CHANGELOG.md +288 -215
  2. package/INSTRUCTIONS.md +28 -11
  3. package/README.md +124 -11
  4. package/dist/src/core/engine.d.ts +1 -1
  5. package/dist/src/core/engine.js +1 -1
  6. package/dist/src/core/indexManager.d.ts +1 -1
  7. package/dist/src/core/indexManager.js +26 -26
  8. package/dist/src/core/sessionManager.d.ts +1 -1
  9. package/dist/src/core/sessionManager.js +1 -1
  10. package/dist/src/core/validator.d.ts +2 -2
  11. package/dist/src/core/validator.js +8 -2
  12. package/dist/src/core/validator.js.map +1 -1
  13. package/dist/src/index.d.ts +4 -2
  14. package/dist/src/index.js +119 -14
  15. package/dist/src/index.js.map +1 -1
  16. package/dist/src/operations/apiRoutes.d.ts +31 -0
  17. package/dist/src/operations/apiRoutes.js +170 -0
  18. package/dist/src/operations/apiRoutes.js.map +1 -0
  19. package/dist/src/operations/architectureLinter.d.ts +45 -0
  20. package/dist/src/operations/architectureLinter.js +223 -0
  21. package/dist/src/operations/architectureLinter.js.map +1 -0
  22. package/dist/src/operations/astComplexity.d.ts +38 -0
  23. package/dist/src/operations/astComplexity.js +243 -0
  24. package/dist/src/operations/astComplexity.js.map +1 -0
  25. package/dist/src/operations/astMockGenerator.d.ts +34 -0
  26. package/dist/src/operations/astMockGenerator.js +203 -0
  27. package/dist/src/operations/astMockGenerator.js.map +1 -0
  28. package/dist/src/operations/astQuery.d.ts +47 -0
  29. package/dist/src/operations/astQuery.js +169 -0
  30. package/dist/src/operations/astQuery.js.map +1 -0
  31. package/dist/src/operations/astTransform.d.ts +1 -1
  32. package/dist/src/operations/astTransform.js +11 -2
  33. package/dist/src/operations/astTransform.js.map +1 -1
  34. package/dist/src/operations/asyncBlockers.d.ts +33 -0
  35. package/dist/src/operations/asyncBlockers.js +162 -0
  36. package/dist/src/operations/asyncBlockers.js.map +1 -0
  37. package/dist/src/operations/blastRadiusReport.d.ts +43 -0
  38. package/dist/src/operations/blastRadiusReport.js +236 -0
  39. package/dist/src/operations/blastRadiusReport.js.map +1 -0
  40. package/dist/src/operations/callHierarchy.d.ts +28 -0
  41. package/dist/src/operations/callHierarchy.js +166 -0
  42. package/dist/src/operations/callHierarchy.js.map +1 -0
  43. package/dist/src/operations/circularDependencies.d.ts +28 -0
  44. package/dist/src/operations/circularDependencies.js +201 -0
  45. package/dist/src/operations/circularDependencies.js.map +1 -0
  46. package/dist/src/operations/classHierarchyFlattener.d.ts +35 -0
  47. package/dist/src/operations/classHierarchyFlattener.js +185 -0
  48. package/dist/src/operations/classHierarchyFlattener.js.map +1 -0
  49. package/dist/src/operations/compress.d.ts +2 -2
  50. package/dist/src/operations/compress.js +154 -20
  51. package/dist/src/operations/compress.js.map +1 -1
  52. package/dist/src/operations/conceptSearch.d.ts +19 -0
  53. package/dist/src/operations/conceptSearch.js +176 -0
  54. package/dist/src/operations/conceptSearch.js.map +1 -0
  55. package/dist/src/operations/confirmationStore.d.ts +1 -1
  56. package/dist/src/operations/confirmationStore.js +1 -1
  57. package/dist/src/operations/conflictPredictor.d.ts +21 -0
  58. package/dist/src/operations/conflictPredictor.js +139 -0
  59. package/dist/src/operations/conflictPredictor.js.map +1 -0
  60. package/dist/src/operations/contextCompactor.d.ts +38 -0
  61. package/dist/src/operations/contextCompactor.js +348 -0
  62. package/dist/src/operations/contextCompactor.js.map +1 -0
  63. package/dist/src/operations/cstCodemod.d.ts +34 -0
  64. package/dist/src/operations/cstCodemod.js +205 -0
  65. package/dist/src/operations/cstCodemod.js.map +1 -0
  66. package/dist/src/operations/deadSymbols.d.ts +32 -0
  67. package/dist/src/operations/deadSymbols.js +178 -0
  68. package/dist/src/operations/deadSymbols.js.map +1 -0
  69. package/dist/src/operations/envContract.d.ts +35 -0
  70. package/dist/src/operations/envContract.js +194 -0
  71. package/dist/src/operations/envContract.js.map +1 -0
  72. package/dist/src/operations/errorAudit.d.ts +36 -0
  73. package/dist/src/operations/errorAudit.js +201 -0
  74. package/dist/src/operations/errorAudit.js.map +1 -0
  75. package/dist/src/operations/importIntegrity.d.ts +48 -0
  76. package/dist/src/operations/importIntegrity.js +395 -0
  77. package/dist/src/operations/importIntegrity.js.map +1 -0
  78. package/dist/src/operations/incrementalDiff.d.ts +47 -0
  79. package/dist/src/operations/incrementalDiff.js +216 -0
  80. package/dist/src/operations/incrementalDiff.js.map +1 -0
  81. package/dist/src/operations/lexicalScope.d.ts +51 -0
  82. package/dist/src/operations/lexicalScope.js +212 -0
  83. package/dist/src/operations/lexicalScope.js.map +1 -0
  84. package/dist/src/operations/read.d.ts +21 -0
  85. package/dist/src/operations/read.js +21 -0
  86. package/dist/src/operations/read.js.map +1 -1
  87. package/dist/src/operations/readCore.js +37 -17
  88. package/dist/src/operations/readCore.js.map +1 -1
  89. package/dist/src/operations/rename.js +35 -24
  90. package/dist/src/operations/rename.js.map +1 -1
  91. package/dist/src/operations/sqlValidator.d.ts +36 -0
  92. package/dist/src/operations/sqlValidator.js +202 -0
  93. package/dist/src/operations/sqlValidator.js.map +1 -0
  94. package/dist/src/operations/symbolQuery.js +112 -23
  95. package/dist/src/operations/symbolQuery.js.map +1 -1
  96. package/dist/src/operations/taintAnalysis.d.ts +46 -0
  97. package/dist/src/operations/taintAnalysis.js +220 -0
  98. package/dist/src/operations/taintAnalysis.js.map +1 -0
  99. package/dist/src/operations/testImpact.d.ts +31 -0
  100. package/dist/src/operations/testImpact.js +179 -0
  101. package/dist/src/operations/testImpact.js.map +1 -0
  102. package/dist/src/operations/typeInference.d.ts +54 -0
  103. package/dist/src/operations/typeInference.js +565 -0
  104. package/dist/src/operations/typeInference.js.map +1 -0
  105. package/dist/src/operations/wireContract.d.ts +34 -0
  106. package/dist/src/operations/wireContract.js +185 -0
  107. package/dist/src/operations/wireContract.js.map +1 -0
  108. package/dist/src/operations/write.d.ts +2 -2
  109. package/dist/src/operations/write.js +151 -82
  110. package/dist/src/operations/write.js.map +1 -1
  111. package/dist/src/parsers/base.d.ts +9 -1
  112. package/dist/src/parsers/base.js +61 -1
  113. package/dist/src/parsers/base.js.map +1 -1
  114. package/dist/src/parsers/csharp.d.ts +1 -1
  115. package/dist/src/parsers/csharp.js +1 -1
  116. package/dist/src/parsers/dartTreeSitter.d.ts +1 -1
  117. package/dist/src/parsers/dartTreeSitter.js +1 -1
  118. package/dist/src/parsers/go.d.ts +1 -1
  119. package/dist/src/parsers/go.js +1 -1
  120. package/dist/src/parsers/java.d.ts +1 -1
  121. package/dist/src/parsers/java.js +1 -1
  122. package/dist/src/parsers/kotlin.d.ts +1 -1
  123. package/dist/src/parsers/kotlin.js +1 -1
  124. package/dist/src/parsers/php.d.ts +1 -1
  125. package/dist/src/parsers/php.js +1 -1
  126. package/dist/src/parsers/python.d.ts +1 -1
  127. package/dist/src/parsers/python.js +1 -1
  128. package/dist/src/parsers/registry.d.ts +1 -1
  129. package/dist/src/parsers/registry.js +1 -1
  130. package/dist/src/parsers/ruby.d.ts +1 -1
  131. package/dist/src/parsers/ruby.js +1 -1
  132. package/dist/src/parsers/rust.d.ts +1 -1
  133. package/dist/src/parsers/rust.js +1 -1
  134. package/dist/src/parsers/typescript.d.ts +1 -1
  135. package/dist/src/parsers/typescript.js +1 -1
  136. package/dist/src/tools/adminHandlers.js +8 -7
  137. package/dist/src/tools/adminHandlers.js.map +1 -1
  138. package/dist/src/tools/context.d.ts +4 -0
  139. package/dist/src/tools/context.js +14 -0
  140. package/dist/src/tools/context.js.map +1 -1
  141. package/dist/src/tools/pipeline.js +27 -1
  142. package/dist/src/tools/pipeline.js.map +1 -1
  143. package/dist/src/tools/readHandlers.d.ts +150 -0
  144. package/dist/src/tools/readHandlers.js +642 -35
  145. package/dist/src/tools/readHandlers.js.map +1 -1
  146. package/dist/src/tools/toolDefinitions.d.ts +2190 -1
  147. package/dist/src/tools/toolDefinitionsAdmin.d.ts +1 -1
  148. package/dist/src/tools/toolDefinitionsAdmin.js +12 -12
  149. package/dist/src/tools/toolDefinitionsAdmin.js.map +1 -1
  150. package/dist/src/tools/toolDefinitionsCore.d.ts +2189 -0
  151. package/dist/src/tools/toolDefinitionsCore.js +422 -42
  152. package/dist/src/tools/toolDefinitionsCore.js.map +1 -1
  153. package/dist/src/tools/writeHandlers.js +31 -17
  154. package/dist/src/tools/writeHandlers.js.map +1 -1
  155. package/dist/src/utils/appDir.d.ts +1 -1
  156. package/dist/src/utils/appDir.js +1 -1
  157. package/dist/src/utils/auditLogger.d.ts +1 -1
  158. package/dist/src/utils/auditLogger.js +1 -1
  159. package/dist/src/utils/backupManager.d.ts +1 -1
  160. package/dist/src/utils/backupManager.js +1 -1
  161. package/dist/src/utils/conceptEngine.d.ts +56 -0
  162. package/dist/src/utils/conceptEngine.js +234 -0
  163. package/dist/src/utils/conceptEngine.js.map +1 -0
  164. package/dist/src/utils/constants.d.ts +1 -1
  165. package/dist/src/utils/constants.js +2 -1
  166. package/dist/src/utils/constants.js.map +1 -1
  167. package/dist/src/utils/diff.d.ts +1 -1
  168. package/dist/src/utils/diff.js +1 -1
  169. package/dist/src/utils/fileLock.d.ts +1 -1
  170. package/dist/src/utils/fileLock.js +1 -1
  171. package/dist/src/utils/fileWalker.d.ts +1 -1
  172. package/dist/src/utils/fileWalker.js +1 -1
  173. package/dist/src/utils/fileWatcher.d.ts +1 -1
  174. package/dist/src/utils/fileWatcher.js +1 -1
  175. package/dist/src/utils/fuzzySearch.d.ts +1 -1
  176. package/dist/src/utils/fuzzySearch.js +1 -1
  177. package/dist/src/utils/gemfileParser.d.ts +1 -1
  178. package/dist/src/utils/gemfileParser.js +1 -1
  179. package/dist/src/utils/logger.d.ts +1 -1
  180. package/dist/src/utils/logger.js +1 -1
  181. package/dist/src/utils/metaprogramming.d.ts +1 -1
  182. package/dist/src/utils/metaprogramming.js +1 -1
  183. package/dist/src/utils/projectRoot.d.ts +9 -0
  184. package/dist/src/utils/projectRoot.js +94 -0
  185. package/dist/src/utils/projectRoot.js.map +1 -0
  186. package/dist/src/utils/railsRoutes.d.ts +1 -1
  187. package/dist/src/utils/railsRoutes.js +1 -1
  188. package/dist/src/utils/rateLimiter.d.ts +26 -1
  189. package/dist/src/utils/rateLimiter.js +26 -1
  190. package/dist/src/utils/rateLimiter.js.map +1 -1
  191. package/dist/src/utils/streaming.d.ts +1 -1
  192. package/dist/src/utils/streaming.js +1 -1
  193. package/dist/src/utils/telemetry.d.ts +1 -1
  194. package/dist/src/utils/telemetry.js +1 -1
  195. package/dist/src/utils/virtualSchema.d.ts +31 -0
  196. package/dist/src/utils/virtualSchema.js +367 -0
  197. package/dist/src/utils/virtualSchema.js.map +1 -0
  198. package/llms.txt +24 -6
  199. package/package.json +4 -2
  200. package/skills/code-context-logo.png +0 -0
  201. package/skills/code-context-pro/SKILL.md +149 -0
  202. package/skills/code-context-pro/references/benchmarks.md +25 -0
  203. package/skills/code-context-pro/references/decision-tree.md +32 -0
  204. package/skills/code-context-pro/references/multi-ide-setup.md +104 -0
  205. package/skills/code-context-pro.zip +0 -0
  206. package/HIRE_ME.md +0 -234
  207. package/SPONSORS.md +0 -104
  208. package/vitest.config.ts +0 -37
@@ -7,10 +7,10 @@ export const CORE_TOOLS = [
7
7
  type: "object",
8
8
  properties: {
9
9
  directoryPath: { type: "string", description: "Absolute path to repository root" },
10
- projectRoot: { type: "string", description: "Project root for security boundary" },
11
- format: { type: "string", enum: ["xml", "markdown"], description: "Output format (default: xml)" },
10
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to directoryPath)" },
11
+ format: { type: "string", enum: ["xml", "markdown", "html"], description: "Output format (default: xml, markdown, or html for interactive visual architecture dashboard)" },
12
12
  },
13
- required: ["directoryPath", "projectRoot"],
13
+ required: ["directoryPath"],
14
14
  },
15
15
  },
16
16
  {
@@ -20,11 +20,11 @@ export const CORE_TOOLS = [
20
20
  type: "object",
21
21
  properties: {
22
22
  filePath: { type: "string", description: "Absolute path to file" },
23
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
23
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
24
24
  symbolName: { type: "string", description: "Symbol name to extract (optional)" },
25
25
  className: { type: "string", description: "Class name for scoping (optional)" },
26
26
  },
27
- required: ["filePath", "projectRoot"],
27
+ required: ["filePath"],
28
28
  },
29
29
  },
30
30
  {
@@ -34,10 +34,10 @@ export const CORE_TOOLS = [
34
34
  type: "object",
35
35
  properties: {
36
36
  filePath: { type: "string", description: "Absolute path to file" },
37
- projectRoot: { type: "string", description: "Project root for security boundary" },
37
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
38
38
  rootDir: { type: "string", description: "Repository root (optional, defaults to projectRoot)" },
39
39
  },
40
- required: ["filePath", "projectRoot"],
40
+ required: ["filePath"],
41
41
  },
42
42
  },
43
43
  {
@@ -47,13 +47,13 @@ export const CORE_TOOLS = [
47
47
  type: "object",
48
48
  properties: {
49
49
  filePath: { type: "string", description: "Absolute path to file" },
50
- projectRoot: { type: "string", description: "Project root for security boundary" },
50
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
51
51
  startLine: { type: "number", description: "Starting line number (1-indexed)" },
52
52
  endLine: { type: "number", description: "Ending line number (1-indexed)" },
53
53
  aroundPattern: { type: "string", description: "Search pattern to find and return surrounding lines" },
54
54
  contextLines: { type: "number", description: "Number of lines before/after pattern (default: 5)" },
55
55
  },
56
- required: ["filePath", "projectRoot"],
56
+ required: ["filePath"],
57
57
  },
58
58
  },
59
59
  {
@@ -63,7 +63,7 @@ export const CORE_TOOLS = [
63
63
  type: "object",
64
64
  properties: {
65
65
  rootDir: { type: "string", description: "Repository root directory" },
66
- projectRoot: { type: "string", description: "Project root for security boundary" },
66
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to rootDir)" },
67
67
  pattern: { type: "string", description: "Regular expression pattern to search" },
68
68
  fileExtensions: { type: "array", items: { type: "string" }, description: "Extensions to search" },
69
69
  excludeDirs: { type: "array", items: { type: "string" }, description: "Directories to exclude" },
@@ -72,7 +72,7 @@ export const CORE_TOOLS = [
72
72
  fuzzyMatch: { type: "boolean", description: "Enable fuzzy matching (default: false)" },
73
73
  fuzzyThreshold: { type: "number", description: "Fuzzy match threshold 0-1 (default: 0.4)" },
74
74
  },
75
- required: ["rootDir", "projectRoot", "pattern"],
75
+ required: ["rootDir", "pattern"],
76
76
  },
77
77
  },
78
78
  {
@@ -82,9 +82,9 @@ export const CORE_TOOLS = [
82
82
  type: "object",
83
83
  properties: {
84
84
  filePath: { type: "string", description: "Absolute path to file" },
85
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
85
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
86
86
  },
87
- required: ["filePath", "projectRoot"],
87
+ required: ["filePath"],
88
88
  },
89
89
  },
90
90
  {
@@ -94,15 +94,15 @@ export const CORE_TOOLS = [
94
94
  type: "object",
95
95
  properties: {
96
96
  filePath: { type: "string", description: "Absolute path to file" },
97
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
97
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
98
98
  symbolName: { type: "string", description: "Symbol to replace" },
99
- newContent: { type: "string", description: "New code (Phase 1 only ΓÇö omit in Phase 2, server uses stored content)" },
99
+ newContent: { type: "string", description: "New code (Phase 1 only — omit in Phase 2, server uses stored content)" },
100
100
  className: { type: "string", description: "Class name (optional, for scoping)" },
101
101
  confirm: { type: "boolean", description: "Set true to apply a pending operation (Phase 2)" },
102
102
  confirmationToken: { type: "string", description: "Token from Phase 1 dry-run (Phase 2 only)" },
103
103
  diffFormat: { type: "string", enum: ["unified", "compact", "summary", "none"], description: "Diff verbosity in Phase 1 output (default: unified). Use none to skip diff and save tokens." },
104
104
  },
105
- required: ["filePath", "projectRoot", "symbolName"],
105
+ required: ["filePath", "symbolName"],
106
106
  },
107
107
  },
108
108
  {
@@ -112,8 +112,8 @@ export const CORE_TOOLS = [
112
112
  type: "object",
113
113
  properties: {
114
114
  filePath: { type: "string", description: "Absolute path to file" },
115
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
116
- code: { type: "string", description: "Code to insert (Phase 1 only ΓÇö omit in Phase 2, server uses stored content)" },
115
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
116
+ code: { type: "string", description: "Code to insert (Phase 1 only — omit in Phase 2, server uses stored content)" },
117
117
  anchorSymbol: { type: "string", description: "Symbol to position relative to" },
118
118
  position: { type: "string", enum: ["before", "after", "inside_start", "inside_end"], description: "Where to insert" },
119
119
  className: { type: "string", description: "Class name (optional)" },
@@ -121,7 +121,7 @@ export const CORE_TOOLS = [
121
121
  confirmationToken: { type: "string", description: "Token from Phase 1 dry-run (Phase 2 only)" },
122
122
  diffFormat: { type: "string", enum: ["unified", "compact", "summary", "none"], description: "Diff verbosity in Phase 1 output (default: unified). Use none to skip diff and save tokens." },
123
123
  },
124
- required: ["filePath", "projectRoot"],
124
+ required: ["filePath", "code"],
125
125
  },
126
126
  },
127
127
  {
@@ -131,14 +131,14 @@ export const CORE_TOOLS = [
131
131
  type: "object",
132
132
  properties: {
133
133
  filePath: { type: "string", description: "Absolute path to file" },
134
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
134
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
135
135
  symbolName: { type: "string", description: "Symbol to remove" },
136
136
  className: { type: "string", description: "Class name (optional)" },
137
137
  force: { type: "boolean", description: "Skip dependency check" },
138
138
  confirm: { type: "boolean", description: "Set true to apply a pending operation" },
139
139
  confirmationToken: { type: "string", description: "Token from Phase 1 dry-run" },
140
140
  },
141
- required: ["filePath", "projectRoot", "symbolName"],
141
+ required: ["filePath", "symbolName"],
142
142
  },
143
143
  },
144
144
  {
@@ -148,17 +148,17 @@ export const CORE_TOOLS = [
148
148
  type: "object",
149
149
  properties: {
150
150
  filePath: { type: "string", description: "File where symbol is defined" },
151
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
151
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
152
152
  oldName: { type: "string", description: "Current name" },
153
153
  newName: { type: "string", description: "New name" },
154
- rootDir: { type: "string", description: "Repository root (optional)" },
154
+ rootDir: { type: "string", description: "Repository root (optional, defaults to projectRoot)" },
155
155
  confirm: { type: "boolean", description: "Set true to apply a pending operation" },
156
156
  confirmationToken: { type: "string", description: "Token from Phase 1 dry-run" },
157
157
  },
158
- required: ["filePath", "projectRoot", "oldName", "newName"],
158
+ required: ["filePath", "oldName", "newName"],
159
159
  },
160
160
  },
161
- // ── AST Transform (v3.9.1) ──────────────────────────────────────────────
161
+ // ── AST Transform (v3.9.0) ──────────────────────────────────────────────
162
162
  {
163
163
  name: "ast_transform",
164
164
  description: "Apply a declarative AST transformation to a symbol. Supports: add_parameter, wrap_with_try_catch, add_decorator, change_return_type, extract_variable. Uses two-phase write (Phase 1: preview diff, Phase 2: confirm with token).",
@@ -166,8 +166,8 @@ export const CORE_TOOLS = [
166
166
  type: "object",
167
167
  properties: {
168
168
  filePath: { type: "string", description: "Absolute path to file" },
169
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
170
- symbolName: { type: "string", description: "Target symbol to transform" },
169
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
170
+ symbolName: { type: "string", targetSymbol: true, description: "Target symbol to transform" },
171
171
  className: { type: "string", description: "Class name (optional, for scoping)" },
172
172
  transform: {
173
173
  type: "object",
@@ -192,10 +192,10 @@ export const CORE_TOOLS = [
192
192
  confirmationToken: { type: "string", description: "Token from Phase 1 dry-run (Phase 2 only)" },
193
193
  diffFormat: { type: "string", enum: ["unified", "compact", "summary", "none"], description: "Diff verbosity (default: unified)" },
194
194
  },
195
- required: ["filePath", "projectRoot", "symbolName", "transform"],
195
+ required: ["filePath", "symbolName", "transform"],
196
196
  },
197
197
  },
198
- // ── NEW TOOLS v3.9.1 ──────────────────────────────────────────────────────ΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇΓöÇ
198
+ // ── Core Inspection & Search Tools ──────────────────────────────────────────
199
199
  {
200
200
  name: "search_symbols",
201
201
  description: "Search symbols by name across the repo using AST (not text search). Finds classes, functions, methods by approximate name.",
@@ -203,7 +203,7 @@ export const CORE_TOOLS = [
203
203
  type: "object",
204
204
  properties: {
205
205
  rootDir: { type: "string", description: "Directory to search in" },
206
- projectRoot: { type: "string", description: "Project root for security boundary" },
206
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to rootDir)" },
207
207
  query: { type: "string", description: "Symbol name or partial name to search" },
208
208
  fuzzy: { type: "boolean", description: "Enable fuzzy name matching (default: false)" },
209
209
  types: { type: "array", items: { type: "string" }, description: "Filter by symbol types: class_declaration, function_declaration, method_definition, etc." },
@@ -211,7 +211,332 @@ export const CORE_TOOLS = [
211
211
  excludeDirs: { type: "array", items: { type: "string" }, description: "Directories to exclude" },
212
212
  maxResults: { type: "number", description: "Maximum results (default: 20)" },
213
213
  },
214
- required: ["rootDir", "projectRoot", "query"],
214
+ required: ["rootDir", "query"],
215
+ },
216
+ },
217
+ {
218
+ name: "search_code_concept",
219
+ description: "Search symbols and code by conceptual intent, domain semantics, and docstrings using offline in-memory vectors. Finds functions even when the exact name is unknown (e.g. searching 'VIP discount' finds 'applyLoyaltyRebate').",
220
+ inputSchema: {
221
+ type: "object",
222
+ properties: {
223
+ query: { type: "string", description: "Conceptual query (e.g. 'VIP customer discount calculation', 'auth token refresh', 'database transaction rollback')" },
224
+ rootDir: { type: "string", description: "Directory to search in (optional, defaults to projectRoot)" },
225
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to rootDir)" },
226
+ threshold: { type: "number", description: "Minimum relevance similarity threshold 0.0 - 1.0 (default: 0.25)" },
227
+ maxResults: { type: "number", description: "Maximum results to return (default: 15)" },
228
+ fileExtensions: { type: "array", items: { type: "string" }, description: "Filter by file extensions (e.g. ['.ts', '.py'])" },
229
+ excludeDirs: { type: "array", items: { type: "string" }, description: "Directories to exclude from search" },
230
+ },
231
+ required: ["query"],
232
+ },
233
+ },
234
+ {
235
+ name: "verify_import_integrity",
236
+ description: "Verify that all external package dependencies, local relative files, and named symbols imported in a file exist. Prevents build-breaking import hallucinations and phantom dependencies before applying code changes.",
237
+ inputSchema: {
238
+ type: "object",
239
+ properties: {
240
+ filePath: { type: "string", description: "Path to file being inspected or modified" },
241
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file's root)" },
242
+ content: { type: "string", description: "Optional proposed content to verify before saving to disk" },
243
+ },
244
+ required: ["filePath"],
245
+ },
246
+ },
247
+ {
248
+ name: "trace_taint_flow",
249
+ description: "Trace data flow from untrusted user inputs (req.query, req.body, $_GET, etc.) to dangerous sinks (db.query, exec, eval, fs.readFile, innerHTML). Identifies SQL Injection, RCE, Path Traversal, and SSRF vulnerabilities before code is committed.",
250
+ inputSchema: {
251
+ type: "object",
252
+ properties: {
253
+ filePath: { type: "string", description: "Path to file being analyzed" },
254
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file's root)" },
255
+ sourceParam: { type: "string", description: "Optional specific parameter name to track as tainted source" },
256
+ dangerousSink: { type: "string", description: "Optional specific sink to target (e.g. 'exec', 'db.query', 'eval', 'readFile')" },
257
+ content: { type: "string", description: "Optional proposed content to analyze before saving" },
258
+ },
259
+ required: ["filePath"],
260
+ },
261
+ },
262
+ {
263
+ name: "backfill_types",
264
+ description: "Inspect AST property accesses (param.id, param.name.trim(), param.age > 18, param.save()), method calls, and return expressions to infer strict TypeScript interfaces or Python TypedDict / BaseModel definitions for untyped or legacy code.",
265
+ inputSchema: {
266
+ type: "object",
267
+ properties: {
268
+ filePath: { type: "string", description: "Path to file to infer types for" },
269
+ projectRoot: { type: "string", description: "Project root directory (optional, resolved automatically)" },
270
+ symbolName: { type: "string", description: "Optional specific function or method name to infer types for" },
271
+ targetLanguage: {
272
+ type: "string",
273
+ enum: ["typescript", "python"],
274
+ description: "Target type system to generate ('typescript' or 'python', defaults based on file extension)"
275
+ },
276
+ content: { type: "string", description: "Optional proposed content to analyze before saving to disk" },
277
+ },
278
+ required: ["filePath"],
279
+ },
280
+ },
281
+ {
282
+ name: "enforce_architecture_rules",
283
+ description: "Enforce clean/hexagonal architectural boundary guardrails by checking AST imports against layer separation rules (e.g. domain entities cannot import infra/frameworks; UI cannot import raw database models; use cases cannot import controllers).",
284
+ inputSchema: {
285
+ type: "object",
286
+ properties: {
287
+ filePath: { type: "string", description: "Path to file being checked (optional)" },
288
+ projectRoot: { type: "string", description: "Project root directory (optional, resolved automatically)" },
289
+ content: { type: "string", description: "Optional proposed content to verify before saving to disk" },
290
+ rules: {
291
+ type: "array",
292
+ items: {
293
+ type: "object",
294
+ properties: {
295
+ layer: { type: "string", description: "Name of the architectural layer (e.g. 'domain', 'ui', 'use_cases')" },
296
+ pattern: { type: "string", description: "File path glob pattern belonging to this layer (e.g. 'src/domain/**')" },
297
+ disallow: {
298
+ type: "array",
299
+ items: { type: "string" },
300
+ description: "Array of disallowed import paths or package names (e.g. ['src/infra/**', '@prisma/client'])"
301
+ },
302
+ description: { type: "string", description: "Reason for this boundary rule" },
303
+ suggestion: { type: "string", description: "Recommended decoupled alternative pattern" }
304
+ },
305
+ required: ["layer", "pattern", "disallow"]
306
+ },
307
+ description: "Optional custom architectural rules (defaults to reading .architecturerc.json or applying standard Clean Architecture rules)"
308
+ }
309
+ },
310
+ },
311
+ },
312
+ {
313
+ name: "compact_context_ledger",
314
+ description: "Compress source files into lossless AST signature outlines (interfaces, types, classes, fields, and method signatures without implementation bodies). Saves 80% to 90% of tokens while preserving 100% of structural and type fidelity for AI LLMs.",
315
+ inputSchema: {
316
+ type: "object",
317
+ properties: {
318
+ filePaths: {
319
+ oneOf: [
320
+ { type: "array", items: { type: "string" } },
321
+ { type: "string" }
322
+ ],
323
+ description: "One or more file paths to compact into AST outlines"
324
+ },
325
+ projectRoot: { type: "string", description: "Project root directory (optional, resolved automatically)" },
326
+ dropPrivate: { type: "boolean", description: "Whether to omit private members and helper functions (default: false)" },
327
+ includeDocstrings: { type: "boolean", description: "Whether to preserve JSDoc / docstrings for intent understanding (default: true)" },
328
+ content: { type: "string", description: "Optional proposed content for single file compaction" },
329
+ },
330
+ required: ["filePaths"],
331
+ },
332
+ },
333
+ {
334
+ name: "generate_ast_impact_report",
335
+ description: "Generate an objective cryptographic PR blast radius report with SHA-256 digest, identifying changed symbols across git refs or working tree, impacted test suites via TIA, and verifying architectural boundary compliance.",
336
+ inputSchema: {
337
+ type: "object",
338
+ properties: {
339
+ baseBranch: { type: "string", description: "Base git ref or branch to compare against (default: 'main')" },
340
+ targetBranch: { type: "string", description: "Target git ref or 'WORKING_TREE' for uncommitted changes (default: 'HEAD')" },
341
+ projectRoot: { type: "string", description: "Project root directory (optional, resolved automatically)" },
342
+ includeTests: { type: "boolean", description: "Whether to run Test Impact Analysis on modified symbols (default: true)" },
343
+ includeArchitecture: { type: "boolean", description: "Whether to verify architectural boundary rules (default: true)" },
344
+ },
345
+ },
346
+ },
347
+ {
348
+ name: "query_code_ast",
349
+ description: "Execute native Tree-sitter S-Expression (Scheme DSL) queries or pre-built architectural pattern templates directly against source code in memory via WebAssembly.",
350
+ inputSchema: {
351
+ type: "object",
352
+ properties: {
353
+ filePath: { type: "string", description: "Absolute path to source file" },
354
+ query: { type: "string", description: "Tree-sitter S-Expression pattern (e.g. '(catch_clause (statement_block) @empty_catch)')" },
355
+ template: {
356
+ type: "string",
357
+ enum: ["empty-catch", "excessive-params", "nested-ternary", "eval-call", "todo-comment", "console-log", "print-call"],
358
+ description: "Pre-built AST query pattern template",
359
+ },
360
+ code: { type: "string", description: "Optional raw code content to query directly in memory" },
361
+ limit: { type: "number", description: "Maximum number of AST matches to return (default: 50)" },
362
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
363
+ },
364
+ },
365
+ },
366
+ {
367
+ name: "incremental_ast_diff",
368
+ description: "High-performance O(log N) AST incremental re-parsing and diffing using WebAssembly Tree-sitter. Pinpoints exact changed syntax subtrees and validates AST integrity before saving.",
369
+ inputSchema: {
370
+ type: "object",
371
+ properties: {
372
+ filePath: { type: "string", description: "Absolute path to source file" },
373
+ oldCode: { type: "string", description: "Previous source code buffer" },
374
+ newCode: { type: "string", description: "New or edited source code buffer" },
375
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
376
+ },
377
+ required: ["newCode"],
378
+ },
379
+ },
380
+ {
381
+ name: "get_ast_complexity_matrix",
382
+ description: "Computes McCabe Cyclomatic and Sonar Cognitive Complexity per function/method using Tree-sitter AST, identifying high-risk structural hotspots.",
383
+ inputSchema: {
384
+ type: "object",
385
+ properties: {
386
+ filePath: { type: "string", description: "Absolute path to source file" },
387
+ code: { type: "string", description: "Optional raw code content" },
388
+ threshold: { type: "number", description: "Minimum cognitive complexity threshold to filter (e.g. 10)" },
389
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
390
+ },
391
+ },
392
+ },
393
+ {
394
+ name: "generate_ast_mocks",
395
+ description: "Generates zero-hallucination typed factory mocks, fixtures, or JSON samples directly from TypeScript interfaces/types or classes.",
396
+ inputSchema: {
397
+ type: "object",
398
+ properties: {
399
+ symbolName: { type: "string", description: "Name of the interface, type alias, or class to mock" },
400
+ filePath: { type: "string", description: "Absolute path to source file" },
401
+ code: { type: "string", description: "Optional raw code content" },
402
+ format: { type: "string", enum: ["factory", "fixture", "inline_json"], description: "Output mock format (default: 'factory')" },
403
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
404
+ },
405
+ required: ["symbolName"],
406
+ },
407
+ },
408
+ {
409
+ name: "detect_dead_ast_symbols",
410
+ description: "Detects dead or unconsumed exports, unused internal functions, and unreachable statements after return/throw using AST reachability analysis.",
411
+ inputSchema: {
412
+ type: "object",
413
+ properties: {
414
+ filePath: { type: "string", description: "Absolute path to source file" },
415
+ code: { type: "string", description: "Optional raw code content" },
416
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
417
+ },
418
+ },
419
+ },
420
+ {
421
+ name: "resolve_lexical_scope",
422
+ description: "Resolves lexical scope chains (closures, blocks, functions) and detects variable shadowing or identifier collision before renaming.",
423
+ inputSchema: {
424
+ type: "object",
425
+ properties: {
426
+ filePath: { type: "string", description: "Absolute path to source file" },
427
+ code: { type: "string", description: "Optional raw code content" },
428
+ proposedRename: {
429
+ type: "object",
430
+ properties: {
431
+ targetSymbol: { type: "string" },
432
+ newSymbolName: { type: "string" },
433
+ atLine: { type: "number" },
434
+ },
435
+ required: ["targetSymbol", "newSymbolName", "atLine"],
436
+ description: "Optional rename simulation to verify if newSymbolName collides with existing scope variables",
437
+ },
438
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
439
+ },
440
+ },
441
+ },
442
+ {
443
+ name: "sql_ast_validator",
444
+ description: "Extracts and parses embedded SQL queries from TypeScript/Python/PHP code, validating syntax, checking for SQL injection risk, and cross-referencing virtual schemas.",
445
+ inputSchema: {
446
+ type: "object",
447
+ properties: {
448
+ filePath: { type: "string", description: "Absolute path to source file" },
449
+ code: { type: "string", description: "Optional raw code content" },
450
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
451
+ },
452
+ },
453
+ },
454
+ {
455
+ name: "ast_codemod_transpile",
456
+ description: "Applies lossless Concrete Syntax Tree (CST) structural codemods preserving exact comments and formatting (e.g. CommonJS require to ESM import, strip console).",
457
+ inputSchema: {
458
+ type: "object",
459
+ properties: {
460
+ rule: { type: "string", enum: ["cjs-to-esm", "strip-console"], description: "Codemod transformation rule to apply" },
461
+ filePath: { type: "string", description: "Absolute path to source file" },
462
+ code: { type: "string", description: "Optional raw code content" },
463
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
464
+ },
465
+ required: ["rule"],
466
+ },
467
+ },
468
+ {
469
+ name: "detect_async_eventloop_blockers",
470
+ description: "Scans async functions for synchronous blocking APIs (time.sleep, fs.readFileSync, execSync) that freeze single-threaded event loops.",
471
+ inputSchema: {
472
+ type: "object",
473
+ properties: {
474
+ filePath: { type: "string", description: "Absolute path to source file" },
475
+ code: { type: "string", description: "Optional raw code content" },
476
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
477
+ },
478
+ },
479
+ },
480
+ {
481
+ name: "verify_env_contract_drift",
482
+ description: "Verifies environment variable parity between source code (process.env, os.getenv) and .env.example, detecting undocumented and zombie config keys.",
483
+ inputSchema: {
484
+ type: "object",
485
+ properties: {
486
+ filePath: { type: "string", description: "Absolute path to source file" },
487
+ code: { type: "string", description: "Optional raw code content" },
488
+ envExampleContent: { type: "string", description: "Optional .env.example raw content to compare against" },
489
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
490
+ },
491
+ },
492
+ },
493
+ {
494
+ name: "audit_error_handling_contracts",
495
+ description: "Audits exception handling contracts, catching empty catch blocks, swallowed errors without logging, and suppressed critical process termination signals.",
496
+ inputSchema: {
497
+ type: "object",
498
+ properties: {
499
+ filePath: { type: "string", description: "Absolute path to source file" },
500
+ code: { type: "string", description: "Optional raw code content" },
501
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
502
+ },
503
+ },
504
+ },
505
+ {
506
+ name: "extract_api_route_matrix",
507
+ description: "Extracts HTTP REST routes, path parameters, and handlers from FastAPI, Express, NestJS, and WP REST directly from AST without executing code.",
508
+ inputSchema: {
509
+ type: "object",
510
+ properties: {
511
+ filePath: { type: "string", description: "Absolute path to source file" },
512
+ code: { type: "string", description: "Optional raw code content" },
513
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
514
+ },
515
+ },
516
+ },
517
+ {
518
+ name: "flatten_class_hierarchy",
519
+ description: "Flattens complex class hierarchies by resolving PHP traits, mixins, and inherited base classes into a unified virtual class interface.",
520
+ inputSchema: {
521
+ type: "object",
522
+ properties: {
523
+ filePath: { type: "string", description: "Absolute path to source file" },
524
+ className: { type: "string", description: "Name of the class to flatten (optional)" },
525
+ code: { type: "string", description: "Optional raw code content" },
526
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
527
+ },
528
+ },
529
+ },
530
+ {
531
+ name: "detect_circular_dependencies",
532
+ description: "Detects circular import cycles across project modules using Tarjan's strongly connected components algorithm on AST dependency graphs.",
533
+ inputSchema: {
534
+ type: "object",
535
+ properties: {
536
+ projectRoot: { type: "string", description: "Project root directory (optional)" },
537
+ filePaths: { type: "array", items: { type: "string" }, description: "List of absolute or relative file paths to analyze" },
538
+ filesMap: { type: "object", description: "Optional in-memory map of relativeFilePath -> fileContent" },
539
+ },
215
540
  },
216
541
  },
217
542
  {
@@ -221,12 +546,12 @@ export const CORE_TOOLS = [
221
546
  type: "object",
222
547
  properties: {
223
548
  filePath: { type: "string", description: "Absolute path to file" },
224
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
549
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
225
550
  symbolName: { type: "string", description: "Symbol to explain" },
226
551
  className: { type: "string", description: "Class name (optional, for scoping)" },
227
552
  rootDir: { type: "string", description: "Root dir for caller search (optional, defaults to projectRoot)" },
228
553
  },
229
- required: ["filePath", "projectRoot", "symbolName"],
554
+ required: ["filePath", "symbolName"],
230
555
  },
231
556
  },
232
557
  {
@@ -248,9 +573,9 @@ export const CORE_TOOLS = [
248
573
  required: ["filePath", "symbolName"],
249
574
  },
250
575
  },
251
- projectRoot: { type: "string", description: "Project root for security boundary" },
576
+ projectRoot: { type: "string", description: "Project root for security boundary (optional, defaults to file project root)" },
252
577
  },
253
- required: ["reads", "projectRoot"],
578
+ required: ["reads"],
254
579
  },
255
580
  },
256
581
  {
@@ -262,16 +587,16 @@ export const CORE_TOOLS = [
262
587
  required: [],
263
588
  },
264
589
  },
265
- // ── NEW TOOLS v3.9.1 — Ruby Intelligence ─────────────────────────────────
590
+ // ── Ruby Intelligence Tools (v3.9.0) ─────────────────────────────────────
266
591
  {
267
592
  name: "get_gemfile_context",
268
593
  description: "Parse Gemfile and return known gem behaviors with implicit Rails conventions. Useful for understanding what capabilities are active in a Ruby project without running the app.",
269
594
  inputSchema: {
270
595
  type: "object",
271
596
  properties: {
272
- projectRoot: { type: "string", description: "Project root (REQUIRED) — must contain a Gemfile" },
597
+ projectRoot: { type: "string", description: "Project root (optional, defaults to current directory) — must contain a Gemfile" },
273
598
  },
274
- required: ["projectRoot"],
599
+ required: [],
275
600
  },
276
601
  },
277
602
  {
@@ -280,11 +605,11 @@ export const CORE_TOOLS = [
280
605
  inputSchema: {
281
606
  type: "object",
282
607
  properties: {
283
- projectRoot: { type: "string", description: "Project root (REQUIRED)" },
608
+ projectRoot: { type: "string", description: "Project root (optional, defaults to current directory)" },
284
609
  filePath: { type: "string", description: "Scan a single file (optional — omit to scan full project)" },
285
610
  rootDir: { type: "string", description: "Scan a subdirectory (optional — e.g. app/models)" },
286
611
  },
287
- required: ["projectRoot"],
612
+ required: [],
288
613
  },
289
614
  },
290
615
  {
@@ -293,9 +618,64 @@ export const CORE_TOOLS = [
293
618
  inputSchema: {
294
619
  type: "object",
295
620
  properties: {
296
- projectRoot: { type: "string", description: "Project root (REQUIRED) — must contain config/routes.rb" },
621
+ projectRoot: { type: "string", description: "Project root (optional, defaults to current directory) — must contain config/routes.rb" },
622
+ },
623
+ required: [],
624
+ },
625
+ },
626
+ {
627
+ name: "get_impacted_tests",
628
+ description: "Test Impact Analysis (TIA): Map modified AST symbols to target test suites and detect minimal test runner commands.",
629
+ inputSchema: {
630
+ type: "object",
631
+ properties: {
632
+ filePath: { type: "string", description: "Absolute path to the modified source file" },
633
+ symbolName: { type: "string", description: "Name of the modified symbol (optional)" },
634
+ projectRoot: { type: "string", description: "Project root boundary (optional)" },
635
+ },
636
+ required: ["filePath"],
637
+ },
638
+ },
639
+ {
640
+ name: "get_call_hierarchy",
641
+ description: "AST-based 3-Hop Call Hierarchy: Trace callers and callees up to 3 hops with Mermaid graph TD visualization.",
642
+ inputSchema: {
643
+ type: "object",
644
+ properties: {
645
+ filePath: { type: "string", description: "Absolute path to file" },
646
+ symbolName: { type: "string", description: "Name of function or method to trace" },
647
+ direction: { type: "string", enum: ["callers", "callees", "both"], description: "Traversal direction (default: both)" },
648
+ maxHops: { type: "number", description: "Maximum hops to trace (default: 3, max: 5)" },
649
+ projectRoot: { type: "string", description: "Project root boundary (optional)" },
650
+ },
651
+ required: ["filePath", "symbolName"],
652
+ },
653
+ },
654
+ {
655
+ name: "validate_wire_contract",
656
+ description: "Cross-Language Wire Contract Validator: Verify frontend TypeScript interfaces against backend models/schemas for drift, type mismatches, and naming conventions.",
657
+ inputSchema: {
658
+ type: "object",
659
+ properties: {
660
+ frontendFile: { type: "string", description: "Absolute path to frontend file containing TypeScript interface/type" },
661
+ backendFile: { type: "string", description: "Absolute path to backend model/migration/entity file (optional)" },
662
+ endpoint: { type: "string", description: "API endpoint route (e.g. /api/users) (optional)" },
663
+ projectRoot: { type: "string", description: "Project root boundary (optional)" },
664
+ },
665
+ required: ["frontendFile"],
666
+ },
667
+ },
668
+ {
669
+ name: "predict_semantic_conflicts",
670
+ description: "Semantic Merge Conflict Predictor: Analyze AST divergence across Git branches/worktrees before merge to identify breaking symbol changes and affected dependents.",
671
+ inputSchema: {
672
+ type: "object",
673
+ properties: {
674
+ baseBranch: { type: "string", description: "Base Git ref or branch (default: HEAD~1)" },
675
+ targetBranch: { type: "string", description: "Target Git ref or branch (default: HEAD)" },
676
+ projectRoot: { type: "string", description: "Project root boundary (optional)" },
297
677
  },
298
- required: ["projectRoot"],
678
+ required: [],
299
679
  },
300
680
  },
301
681
  // ── END NEW TOOLS ────────────────────────────────────────────────────────