codedev-mcp 3.2.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 (229) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/LICENSE +21 -0
  3. package/README.md +760 -0
  4. package/dist/analyzers/api-contract.d.ts +46 -0
  5. package/dist/analyzers/api-contract.d.ts.map +1 -0
  6. package/dist/analyzers/api-contract.js +319 -0
  7. package/dist/analyzers/api-contract.js.map +1 -0
  8. package/dist/analyzers/architecture.d.ts +37 -0
  9. package/dist/analyzers/architecture.d.ts.map +1 -0
  10. package/dist/analyzers/architecture.js +149 -0
  11. package/dist/analyzers/architecture.js.map +1 -0
  12. package/dist/analyzers/branch-compare.d.ts +46 -0
  13. package/dist/analyzers/branch-compare.d.ts.map +1 -0
  14. package/dist/analyzers/branch-compare.js +128 -0
  15. package/dist/analyzers/branch-compare.js.map +1 -0
  16. package/dist/analyzers/cicd.d.ts +42 -0
  17. package/dist/analyzers/cicd.d.ts.map +1 -0
  18. package/dist/analyzers/cicd.js +237 -0
  19. package/dist/analyzers/cicd.js.map +1 -0
  20. package/dist/analyzers/codebase.d.ts +64 -0
  21. package/dist/analyzers/codebase.d.ts.map +1 -0
  22. package/dist/analyzers/codebase.js +354 -0
  23. package/dist/analyzers/codebase.js.map +1 -0
  24. package/dist/analyzers/complexity-heatmap.d.ts +50 -0
  25. package/dist/analyzers/complexity-heatmap.d.ts.map +1 -0
  26. package/dist/analyzers/complexity-heatmap.js +156 -0
  27. package/dist/analyzers/complexity-heatmap.js.map +1 -0
  28. package/dist/analyzers/context-pack.d.ts +43 -0
  29. package/dist/analyzers/context-pack.d.ts.map +1 -0
  30. package/dist/analyzers/context-pack.js +232 -0
  31. package/dist/analyzers/context-pack.js.map +1 -0
  32. package/dist/analyzers/coverage.d.ts +70 -0
  33. package/dist/analyzers/coverage.d.ts.map +1 -0
  34. package/dist/analyzers/coverage.js +313 -0
  35. package/dist/analyzers/coverage.js.map +1 -0
  36. package/dist/analyzers/db-schema.d.ts +55 -0
  37. package/dist/analyzers/db-schema.d.ts.map +1 -0
  38. package/dist/analyzers/db-schema.js +237 -0
  39. package/dist/analyzers/db-schema.js.map +1 -0
  40. package/dist/analyzers/dead-code.d.ts +34 -0
  41. package/dist/analyzers/dead-code.d.ts.map +1 -0
  42. package/dist/analyzers/dead-code.js +131 -0
  43. package/dist/analyzers/dead-code.js.map +1 -0
  44. package/dist/analyzers/dep-vuln.d.ts +36 -0
  45. package/dist/analyzers/dep-vuln.d.ts.map +1 -0
  46. package/dist/analyzers/dep-vuln.js +342 -0
  47. package/dist/analyzers/dep-vuln.js.map +1 -0
  48. package/dist/analyzers/docs.d.ts +47 -0
  49. package/dist/analyzers/docs.d.ts.map +1 -0
  50. package/dist/analyzers/docs.js +473 -0
  51. package/dist/analyzers/docs.js.map +1 -0
  52. package/dist/analyzers/git.d.ts +115 -0
  53. package/dist/analyzers/git.d.ts.map +1 -0
  54. package/dist/analyzers/git.js +214 -0
  55. package/dist/analyzers/git.js.map +1 -0
  56. package/dist/analyzers/iac.d.ts +39 -0
  57. package/dist/analyzers/iac.d.ts.map +1 -0
  58. package/dist/analyzers/iac.js +233 -0
  59. package/dist/analyzers/iac.js.map +1 -0
  60. package/dist/analyzers/impact.d.ts +51 -0
  61. package/dist/analyzers/impact.d.ts.map +1 -0
  62. package/dist/analyzers/impact.js +235 -0
  63. package/dist/analyzers/impact.js.map +1 -0
  64. package/dist/analyzers/monorepo.d.ts +36 -0
  65. package/dist/analyzers/monorepo.d.ts.map +1 -0
  66. package/dist/analyzers/monorepo.js +233 -0
  67. package/dist/analyzers/monorepo.js.map +1 -0
  68. package/dist/analyzers/notebook.d.ts +53 -0
  69. package/dist/analyzers/notebook.d.ts.map +1 -0
  70. package/dist/analyzers/notebook.js +149 -0
  71. package/dist/analyzers/notebook.js.map +1 -0
  72. package/dist/analyzers/perf-profile.d.ts +39 -0
  73. package/dist/analyzers/perf-profile.d.ts.map +1 -0
  74. package/dist/analyzers/perf-profile.js +222 -0
  75. package/dist/analyzers/perf-profile.js.map +1 -0
  76. package/dist/analyzers/scaffold.d.ts +46 -0
  77. package/dist/analyzers/scaffold.d.ts.map +1 -0
  78. package/dist/analyzers/scaffold.js +313 -0
  79. package/dist/analyzers/scaffold.js.map +1 -0
  80. package/dist/analyzers/security.d.ts +42 -0
  81. package/dist/analyzers/security.d.ts.map +1 -0
  82. package/dist/analyzers/security.js +281 -0
  83. package/dist/analyzers/security.js.map +1 -0
  84. package/dist/analyzers/symbols.d.ts +49 -0
  85. package/dist/analyzers/symbols.d.ts.map +1 -0
  86. package/dist/analyzers/symbols.js +212 -0
  87. package/dist/analyzers/symbols.js.map +1 -0
  88. package/dist/analyzers/tree-sitter.d.ts +71 -0
  89. package/dist/analyzers/tree-sitter.d.ts.map +1 -0
  90. package/dist/analyzers/tree-sitter.js +333 -0
  91. package/dist/analyzers/tree-sitter.js.map +1 -0
  92. package/dist/analyzers/type-flow.d.ts +39 -0
  93. package/dist/analyzers/type-flow.d.ts.map +1 -0
  94. package/dist/analyzers/type-flow.js +75 -0
  95. package/dist/analyzers/type-flow.js.map +1 -0
  96. package/dist/cache/memory-cache.d.ts +130 -0
  97. package/dist/cache/memory-cache.d.ts.map +1 -0
  98. package/dist/cache/memory-cache.js +273 -0
  99. package/dist/cache/memory-cache.js.map +1 -0
  100. package/dist/config.d.ts +32 -0
  101. package/dist/config.d.ts.map +1 -0
  102. package/dist/config.js +57 -0
  103. package/dist/config.js.map +1 -0
  104. package/dist/constants/instructions.d.ts +2 -0
  105. package/dist/constants/instructions.d.ts.map +1 -0
  106. package/dist/constants/instructions.js +82 -0
  107. package/dist/constants/instructions.js.map +1 -0
  108. package/dist/db/connection.d.ts +12 -0
  109. package/dist/db/connection.d.ts.map +1 -0
  110. package/dist/db/connection.js +34 -0
  111. package/dist/db/connection.js.map +1 -0
  112. package/dist/db/json-store.d.ts +111 -0
  113. package/dist/db/json-store.d.ts.map +1 -0
  114. package/dist/db/json-store.js +201 -0
  115. package/dist/db/json-store.js.map +1 -0
  116. package/dist/db/sqlite-store.d.ts +153 -0
  117. package/dist/db/sqlite-store.d.ts.map +1 -0
  118. package/dist/db/sqlite-store.js +388 -0
  119. package/dist/db/sqlite-store.js.map +1 -0
  120. package/dist/index.d.ts +17 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/index.js +116 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/resources/health.d.ts +35 -0
  125. package/dist/resources/health.d.ts.map +1 -0
  126. package/dist/resources/health.js +81 -0
  127. package/dist/resources/health.js.map +1 -0
  128. package/dist/schemas/output-schemas.d.ts +517 -0
  129. package/dist/schemas/output-schemas.d.ts.map +1 -0
  130. package/dist/schemas/output-schemas.js +296 -0
  131. package/dist/schemas/output-schemas.js.map +1 -0
  132. package/dist/search/fast-search.d.ts +90 -0
  133. package/dist/search/fast-search.d.ts.map +1 -0
  134. package/dist/search/fast-search.js +387 -0
  135. package/dist/search/fast-search.js.map +1 -0
  136. package/dist/search/semantic.d.ts +26 -0
  137. package/dist/search/semantic.d.ts.map +1 -0
  138. package/dist/search/semantic.js +458 -0
  139. package/dist/search/semantic.js.map +1 -0
  140. package/dist/tools/analysis.d.ts +7 -0
  141. package/dist/tools/analysis.d.ts.map +1 -0
  142. package/dist/tools/analysis.js +491 -0
  143. package/dist/tools/analysis.js.map +1 -0
  144. package/dist/tools/architecture.d.ts +7 -0
  145. package/dist/tools/architecture.d.ts.map +1 -0
  146. package/dist/tools/architecture.js +176 -0
  147. package/dist/tools/architecture.js.map +1 -0
  148. package/dist/tools/devops.d.ts +7 -0
  149. package/dist/tools/devops.d.ts.map +1 -0
  150. package/dist/tools/devops.js +179 -0
  151. package/dist/tools/devops.js.map +1 -0
  152. package/dist/tools/docs.d.ts +7 -0
  153. package/dist/tools/docs.d.ts.map +1 -0
  154. package/dist/tools/docs.js +102 -0
  155. package/dist/tools/docs.js.map +1 -0
  156. package/dist/tools/git.d.ts +7 -0
  157. package/dist/tools/git.d.ts.map +1 -0
  158. package/dist/tools/git.js +475 -0
  159. package/dist/tools/git.js.map +1 -0
  160. package/dist/tools/nav.d.ts +7 -0
  161. package/dist/tools/nav.d.ts.map +1 -0
  162. package/dist/tools/nav.js +275 -0
  163. package/dist/tools/nav.js.map +1 -0
  164. package/dist/tools/notebook.d.ts +7 -0
  165. package/dist/tools/notebook.d.ts.map +1 -0
  166. package/dist/tools/notebook.js +102 -0
  167. package/dist/tools/notebook.js.map +1 -0
  168. package/dist/tools/performance.d.ts +7 -0
  169. package/dist/tools/performance.d.ts.map +1 -0
  170. package/dist/tools/performance.js +59 -0
  171. package/dist/tools/performance.js.map +1 -0
  172. package/dist/tools/quality.d.ts +7 -0
  173. package/dist/tools/quality.d.ts.map +1 -0
  174. package/dist/tools/quality.js +279 -0
  175. package/dist/tools/quality.js.map +1 -0
  176. package/dist/tools/scaffold.d.ts +7 -0
  177. package/dist/tools/scaffold.d.ts.map +1 -0
  178. package/dist/tools/scaffold.js +80 -0
  179. package/dist/tools/scaffold.js.map +1 -0
  180. package/dist/tools/search.d.ts +7 -0
  181. package/dist/tools/search.d.ts.map +1 -0
  182. package/dist/tools/search.js +308 -0
  183. package/dist/tools/search.js.map +1 -0
  184. package/dist/tools/security.d.ts +7 -0
  185. package/dist/tools/security.d.ts.map +1 -0
  186. package/dist/tools/security.js +138 -0
  187. package/dist/tools/security.js.map +1 -0
  188. package/dist/utils/analytics.d.ts +69 -0
  189. package/dist/utils/analytics.d.ts.map +1 -0
  190. package/dist/utils/analytics.js +144 -0
  191. package/dist/utils/analytics.js.map +1 -0
  192. package/dist/utils/concurrency.d.ts +43 -0
  193. package/dist/utils/concurrency.d.ts.map +1 -0
  194. package/dist/utils/concurrency.js +78 -0
  195. package/dist/utils/concurrency.js.map +1 -0
  196. package/dist/utils/fallback.d.ts +52 -0
  197. package/dist/utils/fallback.d.ts.map +1 -0
  198. package/dist/utils/fallback.js +137 -0
  199. package/dist/utils/fallback.js.map +1 -0
  200. package/dist/utils/git-hooks.d.ts +24 -0
  201. package/dist/utils/git-hooks.d.ts.map +1 -0
  202. package/dist/utils/git-hooks.js +108 -0
  203. package/dist/utils/git-hooks.js.map +1 -0
  204. package/dist/utils/languages.d.ts +72 -0
  205. package/dist/utils/languages.d.ts.map +1 -0
  206. package/dist/utils/languages.js +463 -0
  207. package/dist/utils/languages.js.map +1 -0
  208. package/dist/utils/logger.d.ts +13 -0
  209. package/dist/utils/logger.d.ts.map +1 -0
  210. package/dist/utils/logger.js +34 -0
  211. package/dist/utils/logger.js.map +1 -0
  212. package/dist/utils/plugins.d.ts +105 -0
  213. package/dist/utils/plugins.d.ts.map +1 -0
  214. package/dist/utils/plugins.js +325 -0
  215. package/dist/utils/plugins.js.map +1 -0
  216. package/dist/utils/security.d.ts +17 -0
  217. package/dist/utils/security.d.ts.map +1 -0
  218. package/dist/utils/security.js +48 -0
  219. package/dist/utils/security.js.map +1 -0
  220. package/dist/utils/streaming.d.ts +56 -0
  221. package/dist/utils/streaming.d.ts.map +1 -0
  222. package/dist/utils/streaming.js +95 -0
  223. package/dist/utils/streaming.js.map +1 -0
  224. package/dist/version.d.ts +3 -0
  225. package/dist/version.d.ts.map +1 -0
  226. package/dist/version.js +3 -0
  227. package/dist/version.js.map +1 -0
  228. package/mcp.json +100 -0
  229. package/package.json +89 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;GAIG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChE,IAAI,MAAM;QAAE,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC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,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC7C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const SERVER_INSTRUCTIONS = "codedev-mcp provides comprehensive, read-only access to the local codebase with 42 tools across 9 categories.\n\n## Tool Categories\n\n### Search (4 tools)\n- **search_code** \u2014 Text/regex search across files\n- **search_symbols** \u2014 Find functions, classes, interfaces\n- **find_references** \u2014 Trace symbol usage\n- **semantic_search** \u2014 Concept-based search (\"authentication logic\")\n\n### Analysis (5 tools)\n- **codebase_map** \u2014 Project structure, languages, frameworks\n- **analyze_file** \u2014 Detailed file analysis with imports\n- **call_graph** \u2014 Who-calls-what analysis\n- **code_metrics** \u2014 Complexity, function lengths\n- **test_coverage** \u2014 What's tested\n\n### Navigation (2 tools)\n- **read_files** \u2014 Read files (single or batch)\n- **file_tree** \u2014 Directory listing with sizes and dates\n\n### Git (10 tools)\n- **git_log** \u2014 Commit history with filters\n- **git_diff** \u2014 Show changes between refs\n- **git_blame** \u2014 Line-by-line attribution\n- **git_status** \u2014 Working tree status\n- **git_branches** \u2014 List all branches\n- **git_show** \u2014 Commit details\n- **git_contributors** \u2014 Contributor stats\n- **change_impact** \u2014 Assess change effects\n- **branch_compare** \u2014 Structural diff between branches\n- **git_hooks** \u2014 Generate pre-commit hooks\n\n### Quality (8 tools)\n- **find_todos** \u2014 TODO/FIXME/HACK comments\n- **find_debug_logs** \u2014 console.log/print statements\n- **find_secrets** \u2014 Hardcoded credentials\n- **find_empty_catches** \u2014 Empty error handlers\n- **find_long_functions** \u2014 Functions over N lines\n- **find_large_files** \u2014 Files over N lines\n- **find_duplicates** \u2014 Duplicate code patterns\n- **find_dead_code** \u2014 Unused exports\n\n### Documentation (1 tool)\n- **code_docs** \u2014 Generate documentation\n\n### Security (2 tools)\n- **security_scan** \u2014 Vulnerability detection\n- **dep_vuln_scan** \u2014 Dependency vulnerabilities\n\n### Architecture (3 tools)\n- **architecture_check** \u2014 Layer boundary verification\n- **db_schema** \u2014 Database model analysis\n- **api_contracts** \u2014 API endpoint discovery\n\n### DevOps (4 tools)\n- **iac_analyze** \u2014 Infrastructure-as-Code analysis\n- **cicd_analyze** \u2014 CI/CD pipeline parsing\n- **monorepo_analyze** \u2014 Workspace relationships\n- **perf_profile** \u2014 Performance analysis\n\n### Scaffolding (1 tool)\n- **scaffold** \u2014 Generate boilerplate code (returns text, doesn't write)\n\n## Recommended Workflow\n1. Start with **codebase_map** to understand the project\n2. Use **search_code** or **semantic_search** to find relevant code\n3. Use **read_files** to inspect contents\n4. Use **git_log**/**git_blame** for history context\n5. Use **find_todos**/**find_secrets** for code quality\n\n## Resources\n- project://config, project://structure, project://gitinfo\n- health://status, server://stats\n\n## Key Notes\n- All tools are read-only \u2014 they never modify files\n- All file paths are relative to project root\n- Uses ripgrep when available (falls back to grep)\n- Tree-sitter AST parsing for accurate symbol extraction\n- In-memory cache for fast repeated queries";
2
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/constants/instructions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,8qGAgFY,CAAC"}
@@ -0,0 +1,82 @@
1
+ export const SERVER_INSTRUCTIONS = `codedev-mcp provides comprehensive, read-only access to the local codebase with 42 tools across 9 categories.
2
+
3
+ ## Tool Categories
4
+
5
+ ### Search (4 tools)
6
+ - **search_code** — Text/regex search across files
7
+ - **search_symbols** — Find functions, classes, interfaces
8
+ - **find_references** — Trace symbol usage
9
+ - **semantic_search** — Concept-based search ("authentication logic")
10
+
11
+ ### Analysis (5 tools)
12
+ - **codebase_map** — Project structure, languages, frameworks
13
+ - **analyze_file** — Detailed file analysis with imports
14
+ - **call_graph** — Who-calls-what analysis
15
+ - **code_metrics** — Complexity, function lengths
16
+ - **test_coverage** — What's tested
17
+
18
+ ### Navigation (2 tools)
19
+ - **read_files** — Read files (single or batch)
20
+ - **file_tree** — Directory listing with sizes and dates
21
+
22
+ ### Git (10 tools)
23
+ - **git_log** — Commit history with filters
24
+ - **git_diff** — Show changes between refs
25
+ - **git_blame** — Line-by-line attribution
26
+ - **git_status** — Working tree status
27
+ - **git_branches** — List all branches
28
+ - **git_show** — Commit details
29
+ - **git_contributors** — Contributor stats
30
+ - **change_impact** — Assess change effects
31
+ - **branch_compare** — Structural diff between branches
32
+ - **git_hooks** — Generate pre-commit hooks
33
+
34
+ ### Quality (8 tools)
35
+ - **find_todos** — TODO/FIXME/HACK comments
36
+ - **find_debug_logs** — console.log/print statements
37
+ - **find_secrets** — Hardcoded credentials
38
+ - **find_empty_catches** — Empty error handlers
39
+ - **find_long_functions** — Functions over N lines
40
+ - **find_large_files** — Files over N lines
41
+ - **find_duplicates** — Duplicate code patterns
42
+ - **find_dead_code** — Unused exports
43
+
44
+ ### Documentation (1 tool)
45
+ - **code_docs** — Generate documentation
46
+
47
+ ### Security (2 tools)
48
+ - **security_scan** — Vulnerability detection
49
+ - **dep_vuln_scan** — Dependency vulnerabilities
50
+
51
+ ### Architecture (3 tools)
52
+ - **architecture_check** — Layer boundary verification
53
+ - **db_schema** — Database model analysis
54
+ - **api_contracts** — API endpoint discovery
55
+
56
+ ### DevOps (4 tools)
57
+ - **iac_analyze** — Infrastructure-as-Code analysis
58
+ - **cicd_analyze** — CI/CD pipeline parsing
59
+ - **monorepo_analyze** — Workspace relationships
60
+ - **perf_profile** — Performance analysis
61
+
62
+ ### Scaffolding (1 tool)
63
+ - **scaffold** — Generate boilerplate code (returns text, doesn't write)
64
+
65
+ ## Recommended Workflow
66
+ 1. Start with **codebase_map** to understand the project
67
+ 2. Use **search_code** or **semantic_search** to find relevant code
68
+ 3. Use **read_files** to inspect contents
69
+ 4. Use **git_log**/**git_blame** for history context
70
+ 5. Use **find_todos**/**find_secrets** for code quality
71
+
72
+ ## Resources
73
+ - project://config, project://structure, project://gitinfo
74
+ - health://status, server://stats
75
+
76
+ ## Key Notes
77
+ - All tools are read-only — they never modify files
78
+ - All file paths are relative to project root
79
+ - Uses ripgrep when available (falls back to grep)
80
+ - Tree-sitter AST parsing for accurate symbol extraction
81
+ - In-memory cache for fast repeated queries`;
82
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/constants/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAgFS,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { SqliteStore } from './sqlite-store.js';
2
+ /**
3
+ * Get the singleton database instance.
4
+ * Initializes it if not already initialized.
5
+ * @returns The singleton SqliteStore instance.
6
+ */
7
+ export declare function getDb(): Promise<SqliteStore>;
8
+ /**
9
+ * Close the database connection.
10
+ */
11
+ export declare function closeDb(): Promise<void>;
12
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/db/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhD;;;;GAIG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,WAAW,CAAC,CAelD;AAED;;GAEG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAK7C"}
@@ -0,0 +1,34 @@
1
+ import { SqliteStore } from './sqlite-store.js';
2
+ import { CWD } from '../config.js';
3
+ let dbInstance = null;
4
+ let initPromise = null;
5
+ /**
6
+ * Get the singleton database instance.
7
+ * Initializes it if not already initialized.
8
+ * @returns The singleton SqliteStore instance.
9
+ */
10
+ export async function getDb() {
11
+ if (dbInstance)
12
+ return dbInstance;
13
+ if (!initPromise) {
14
+ initPromise = (async () => {
15
+ const store = new SqliteStore(CWD);
16
+ await store.init(CWD);
17
+ // Try to load existing
18
+ await store.load();
19
+ dbInstance = store;
20
+ return store;
21
+ })();
22
+ }
23
+ return initPromise;
24
+ }
25
+ /**
26
+ * Close the database connection.
27
+ */
28
+ export async function closeDb() {
29
+ if (dbInstance) {
30
+ dbInstance.close();
31
+ dbInstance = null;
32
+ }
33
+ }
34
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/db/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,IAAI,UAAU,GAAuB,IAAI,CAAC;AAC1C,IAAI,WAAW,GAAgC,IAAI,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK;IACzB,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAElC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,CAAC,KAAK,IAAI,EAAE;YACxB,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;YACnC,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtB,uBAAuB;YACvB,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,UAAU,GAAG,KAAK,CAAC;YACnB,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,IAAI,UAAU,EAAE,CAAC;QACf,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,UAAU,GAAG,IAAI,CAAC;IACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * JSON-file persistent index for codebase data.
3
+ * Fallback for environments where better-sqlite3 can't compile.
4
+ * Stores indexed symbols, files, and imports for fast repeated queries.
5
+ */
6
+ interface IndexedFile {
7
+ path: string;
8
+ mtime: number;
9
+ lines: number;
10
+ language: string;
11
+ size: number;
12
+ }
13
+ interface IndexedSymbol {
14
+ name: string;
15
+ /** Symbol kind: function, class, interface, etc. */
16
+ type: string;
17
+ file: string;
18
+ line: number;
19
+ exported: boolean;
20
+ }
21
+ /**
22
+ * JSON-file backed persistent index for codebase data.
23
+ */
24
+ export declare class JsonStore {
25
+ private indexPath;
26
+ private index;
27
+ private dirty;
28
+ /**
29
+ * Create a new JsonStore instance.
30
+ * @param cwd - The working directory for the index file.
31
+ */
32
+ constructor(cwd: string);
33
+ /**
34
+ * Load index from disk. Returns false if no index exists.
35
+ * @returns True if the index was loaded successfully.
36
+ */
37
+ load(): Promise<boolean>;
38
+ /**
39
+ * Save index to disk.
40
+ */
41
+ save(): Promise<void>;
42
+ /**
43
+ * Initialize a new empty index.
44
+ * @param cwd - The working directory for the index.
45
+ */
46
+ init(cwd: string): void;
47
+ /**
48
+ * Check if a file needs re-indexing (mtime changed).
49
+ * @param filePath - The file path to check.
50
+ * @returns True if the file needs re-indexing.
51
+ */
52
+ needsReindex(filePath: string): Promise<boolean>;
53
+ /**
54
+ * Update file entry in index.
55
+ * @param file - The file entry to update.
56
+ */
57
+ updateFile(file: IndexedFile): void;
58
+ /**
59
+ * Update symbols for a file.
60
+ * @param filePath - The file path whose symbols are being updated.
61
+ * @param symbols - The new symbols for the file.
62
+ */
63
+ updateSymbols(filePath: string, symbols: IndexedSymbol[]): void;
64
+ /**
65
+ * Update imports for a file.
66
+ * @param filePath - The file path whose imports are being updated.
67
+ * @param imports - The new import paths for the file.
68
+ */
69
+ updateImports(filePath: string, imports: string[]): void;
70
+ /**
71
+ * Query symbols by name pattern.
72
+ * @param pattern - Regex pattern to match symbol names.
73
+ * @param type - Optional symbol type filter.
74
+ * @returns Matching symbols.
75
+ */
76
+ findSymbols(pattern: string, type?: string): IndexedSymbol[];
77
+ /**
78
+ * Get all files in index.
79
+ * @returns All indexed files.
80
+ */
81
+ getFiles(): IndexedFile[];
82
+ /**
83
+ * Get imports for a file.
84
+ * @param filePath - The file path to look up.
85
+ * @returns The import paths for the file.
86
+ */
87
+ getImports(filePath: string): string[];
88
+ /**
89
+ * Get importers of a file (reverse lookup).
90
+ * @param filePath - The file path to find importers for.
91
+ * @returns Files that import the given file.
92
+ */
93
+ getImporters(filePath: string): string[];
94
+ /**
95
+ * Remove a file from the index.
96
+ * @param filePath - The file path to remove.
97
+ */
98
+ removeFile(filePath: string): void;
99
+ /**
100
+ * Get index stats.
101
+ * @returns Stats object or null if no index loaded.
102
+ */
103
+ stats(): {
104
+ files: number;
105
+ symbols: number;
106
+ imports: number;
107
+ updated: string;
108
+ } | null;
109
+ }
110
+ export {};
111
+ //# sourceMappingURL=json-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-store.d.ts","sourceRoot":"","sources":["../../src/db/json-store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EA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,0 +1,201 @@
1
+ /**
2
+ * JSON-file persistent index for codebase data.
3
+ * Fallback for environments where better-sqlite3 can't compile.
4
+ * Stores indexed symbols, files, and imports for fast repeated queries.
5
+ */
6
+ import { readFile, writeFile, mkdir, stat as fsStat } from 'node:fs/promises';
7
+ import path from 'node:path';
8
+ const INDEX_VERSION = 1;
9
+ const INDEX_DIR = '.codedev-mcp';
10
+ const INDEX_FILE = 'index.json';
11
+ /**
12
+ * JSON-file backed persistent index for codebase data.
13
+ */
14
+ export class JsonStore {
15
+ indexPath;
16
+ index = null;
17
+ dirty = false;
18
+ /**
19
+ * Create a new JsonStore instance.
20
+ * @param cwd - The working directory for the index file.
21
+ */
22
+ constructor(cwd) {
23
+ this.indexPath = path.join(cwd, INDEX_DIR, INDEX_FILE);
24
+ }
25
+ /**
26
+ * Load index from disk. Returns false if no index exists.
27
+ * @returns True if the index was loaded successfully.
28
+ */
29
+ async load() {
30
+ try {
31
+ const data = await readFile(this.indexPath, 'utf-8');
32
+ this.index = JSON.parse(data);
33
+ if (this.index.version !== INDEX_VERSION) {
34
+ this.index = null;
35
+ return false;
36
+ }
37
+ return true;
38
+ }
39
+ catch {
40
+ return false;
41
+ }
42
+ }
43
+ /**
44
+ * Save index to disk.
45
+ */
46
+ async save() {
47
+ if (!this.index || !this.dirty)
48
+ return;
49
+ this.index.updated = new Date().toISOString();
50
+ const dir = path.dirname(this.indexPath);
51
+ await mkdir(dir, { recursive: true });
52
+ await writeFile(this.indexPath, JSON.stringify(this.index), 'utf-8');
53
+ this.dirty = false;
54
+ }
55
+ /**
56
+ * Initialize a new empty index.
57
+ * @param cwd - The working directory for the index.
58
+ */
59
+ init(cwd) {
60
+ this.index = {
61
+ version: INDEX_VERSION,
62
+ created: new Date().toISOString(),
63
+ updated: new Date().toISOString(),
64
+ cwd,
65
+ files: [],
66
+ symbols: [],
67
+ imports: [],
68
+ };
69
+ this.dirty = true;
70
+ }
71
+ /**
72
+ * Check if a file needs re-indexing (mtime changed).
73
+ * @param filePath - The file path to check.
74
+ * @returns True if the file needs re-indexing.
75
+ */
76
+ async needsReindex(filePath) {
77
+ if (!this.index)
78
+ return true;
79
+ const existing = this.index.files.find((f) => f.path === filePath);
80
+ if (!existing)
81
+ return true;
82
+ try {
83
+ const s = await fsStat(filePath);
84
+ return s.mtimeMs !== existing.mtime;
85
+ }
86
+ catch {
87
+ return true;
88
+ }
89
+ }
90
+ /**
91
+ * Update file entry in index.
92
+ * @param file - The file entry to update.
93
+ */
94
+ updateFile(file) {
95
+ if (!this.index)
96
+ return;
97
+ const idx = this.index.files.findIndex((f) => f.path === file.path);
98
+ if (idx >= 0)
99
+ this.index.files[idx] = file;
100
+ else
101
+ this.index.files.push(file);
102
+ this.dirty = true;
103
+ }
104
+ /**
105
+ * Update symbols for a file.
106
+ * @param filePath - The file path whose symbols are being updated.
107
+ * @param symbols - The new symbols for the file.
108
+ */
109
+ updateSymbols(filePath, symbols) {
110
+ if (!this.index)
111
+ return;
112
+ this.index.symbols = this.index.symbols.filter((s) => s.file !== filePath);
113
+ this.index.symbols.push(...symbols);
114
+ this.dirty = true;
115
+ }
116
+ /**
117
+ * Update imports for a file.
118
+ * @param filePath - The file path whose imports are being updated.
119
+ * @param imports - The new import paths for the file.
120
+ */
121
+ updateImports(filePath, imports) {
122
+ if (!this.index)
123
+ return;
124
+ const idx = this.index.imports.findIndex((i) => i.file === filePath);
125
+ const entry = { file: filePath, imports };
126
+ if (idx >= 0)
127
+ this.index.imports[idx] = entry;
128
+ else
129
+ this.index.imports.push(entry);
130
+ this.dirty = true;
131
+ }
132
+ /**
133
+ * Query symbols by name pattern.
134
+ * @param pattern - Regex pattern to match symbol names.
135
+ * @param type - Optional symbol type filter.
136
+ * @returns Matching symbols.
137
+ */
138
+ findSymbols(pattern, type) {
139
+ if (!this.index)
140
+ return [];
141
+ const regex = new RegExp(pattern, 'i');
142
+ return this.index.symbols.filter((s) => {
143
+ if (type && s.type !== type)
144
+ return false;
145
+ return regex.test(s.name);
146
+ });
147
+ }
148
+ /**
149
+ * Get all files in index.
150
+ * @returns All indexed files.
151
+ */
152
+ getFiles() {
153
+ return this.index?.files || [];
154
+ }
155
+ /**
156
+ * Get imports for a file.
157
+ * @param filePath - The file path to look up.
158
+ * @returns The import paths for the file.
159
+ */
160
+ getImports(filePath) {
161
+ return this.index?.imports.find((i) => i.file === filePath)?.imports || [];
162
+ }
163
+ /**
164
+ * Get importers of a file (reverse lookup).
165
+ * @param filePath - The file path to find importers for.
166
+ * @returns Files that import the given file.
167
+ */
168
+ getImporters(filePath) {
169
+ if (!this.index)
170
+ return [];
171
+ const baseName = path.basename(filePath, path.extname(filePath));
172
+ return this.index.imports.filter((i) => i.imports.some((imp) => imp.includes(baseName))).map((i) => i.file);
173
+ }
174
+ /**
175
+ * Remove a file from the index.
176
+ * @param filePath - The file path to remove.
177
+ */
178
+ removeFile(filePath) {
179
+ if (!this.index)
180
+ return;
181
+ this.index.files = this.index.files.filter((f) => f.path !== filePath);
182
+ this.index.symbols = this.index.symbols.filter((s) => s.file !== filePath);
183
+ this.index.imports = this.index.imports.filter((i) => i.file !== filePath);
184
+ this.dirty = true;
185
+ }
186
+ /**
187
+ * Get index stats.
188
+ * @returns Stats object or null if no index loaded.
189
+ */
190
+ stats() {
191
+ if (!this.index)
192
+ return null;
193
+ return {
194
+ files: this.index.files.length,
195
+ symbols: this.index.symbols.length,
196
+ imports: this.index.imports.length,
197
+ updated: this.index.updated,
198
+ };
199
+ }
200
+ }
201
+ //# sourceMappingURL=json-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-store.js","sourceRoot":"","sources":["../../src/db/json-store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,IAAI,MAAM,WAAW,CAAC;AAkC7B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,SA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E,OAAO;QACxB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QACvE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;QAC3E,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAC7B,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM;YAC9B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;YAClC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;YAClC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;SAC5B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * SQLite-based persistent index for codebase data.
3
+ * Uses sql.js (WASM) — zero native compilation, works everywhere.
4
+ * Drop-in replacement for JsonStore with dramatically faster queries at scale.
5
+ *
6
+ * Storage: .codedev-mcp/index.sqlite in the project root.
7
+ */
8
+ interface IndexedFile {
9
+ path: string;
10
+ mtime: number;
11
+ lines: number;
12
+ language: string;
13
+ size: number;
14
+ }
15
+ interface IndexedSymbol {
16
+ name: string;
17
+ type: string;
18
+ file: string;
19
+ line: number;
20
+ exported: boolean;
21
+ }
22
+ /**
23
+ * SQLite-backed persistent index for codebase data using sql.js WASM.
24
+ */
25
+ export declare class SqliteStore {
26
+ private dbPath;
27
+ private db;
28
+ private dirty;
29
+ private SQL;
30
+ /**
31
+ * Create a new SqliteStore instance.
32
+ * @param cwd - The working directory for the database file.
33
+ */
34
+ constructor(cwd: string);
35
+ /**
36
+ * Initialize sql.js WASM module.
37
+ * @returns The initialized sql.js static instance.
38
+ */
39
+ private initSqlJs;
40
+ /**
41
+ * Run a query with bind parameters.
42
+ * Replaces db.run() which doesn't support params in all cases.
43
+ * @param sql - The SQL query string.
44
+ * @param params - Bind parameters for the query.
45
+ * @returns An array of result rows.
46
+ */
47
+ private query;
48
+ /**
49
+ * Create tables if they don't exist.
50
+ */
51
+ private createSchema;
52
+ /**
53
+ * Load existing database from disk. Returns false if none exists or version mismatch.
54
+ * @returns True if the database was loaded successfully.
55
+ */
56
+ load(): Promise<boolean>;
57
+ /**
58
+ * Save database to disk.
59
+ */
60
+ save(): Promise<void>;
61
+ /**
62
+ * Initialize a new empty database.
63
+ * @param _ - The working directory (unused, kept for interface compatibility).
64
+ */
65
+ init(_: string): Promise<void>;
66
+ /**
67
+ * Check if a file needs re-indexing (mtime changed).
68
+ * @param filePath - The file path to check.
69
+ * @returns True if the file needs re-indexing.
70
+ */
71
+ needsReindex(filePath: string): Promise<boolean>;
72
+ /**
73
+ * Update file entry in index.
74
+ * @param file - The file entry to update.
75
+ */
76
+ updateFile(file: IndexedFile): void;
77
+ /**
78
+ * Update symbols for a file (replaces all).
79
+ * @param filePath - The file path whose symbols are being updated.
80
+ * @param symbols - The new symbols for the file.
81
+ */
82
+ updateSymbols(filePath: string, symbols: IndexedSymbol[]): void;
83
+ /**
84
+ * Update imports for a file.
85
+ * @param filePath - The file path whose imports are being updated.
86
+ * @param imports - The new import paths for the file.
87
+ */
88
+ updateImports(filePath: string, imports: string[]): void;
89
+ /**
90
+ * Query symbols by name pattern.
91
+ * @param pattern - Pattern to match symbol names (uses SQL LIKE).
92
+ * @param type - Optional symbol type filter.
93
+ * @returns Matching symbols.
94
+ */
95
+ findSymbols(pattern: string, type?: string): IndexedSymbol[];
96
+ /**
97
+ * Get all files in index.
98
+ * @returns All indexed files.
99
+ */
100
+ getFiles(): IndexedFile[];
101
+ /**
102
+ * Get imports for a file.
103
+ * @param filePath - The file path to look up.
104
+ * @returns The import paths for the file.
105
+ */
106
+ getImports(filePath: string): string[];
107
+ /**
108
+ * Get importers of a file (reverse lookup).
109
+ * @param filePath - The file path to find importers for.
110
+ * @returns Files that import the given file.
111
+ */
112
+ getImporters(filePath: string): string[];
113
+ /**
114
+ * Remove a file from the index.
115
+ * @param filePath - The file path to remove.
116
+ */
117
+ removeFile(filePath: string): void;
118
+ /**
119
+ * Get index stats.
120
+ * @returns Stats object or null if no database loaded.
121
+ */
122
+ stats(): {
123
+ files: number;
124
+ symbols: number;
125
+ imports: number;
126
+ updated: string;
127
+ engine: string;
128
+ } | null;
129
+ /**
130
+ * Close the database.
131
+ */
132
+ close(): void;
133
+ /**
134
+ * Log tool usage to DB.
135
+ * @param tool - Tool name.
136
+ * @param duration - Duration in milliseconds.
137
+ * @param success - Whether the operation succeeded.
138
+ * @param cached - Whether the result was cached.
139
+ */
140
+ logUsage(tool: string, duration: number, success: boolean, cached: boolean): void;
141
+ /**
142
+ * Get usage stats.
143
+ * @returns Aggregated usage statistics per tool.
144
+ */
145
+ getUsageStats(): {
146
+ tool: string;
147
+ count: number;
148
+ errorCount: number;
149
+ avgDuration: number;
150
+ }[];
151
+ }
152
+ export {};
153
+ //# sourceMappingURL=sqlite-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-store.d.ts","sourceRoot":"","sources":["../../src/db/sqlite-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAA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