@mgamil/mapx 0.2.4

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 (203) hide show
  1. package/LICENSE +194 -0
  2. package/README.md +488 -0
  3. package/VERSION +1 -0
  4. package/dist/agents/generator.d.ts +74 -0
  5. package/dist/agents/generator.js +375 -0
  6. package/dist/agents/templates.d.ts +29 -0
  7. package/dist/agents/templates.js +459 -0
  8. package/dist/cli.d.ts +16 -0
  9. package/dist/cli.js +1835 -0
  10. package/dist/core/cluster-engine.d.ts +32 -0
  11. package/dist/core/cluster-engine.js +314 -0
  12. package/dist/core/config.d.ts +29 -0
  13. package/dist/core/config.js +178 -0
  14. package/dist/core/context-builder.d.ts +61 -0
  15. package/dist/core/context-builder.js +252 -0
  16. package/dist/core/flow-tracer.d.ts +63 -0
  17. package/dist/core/flow-tracer.js +366 -0
  18. package/dist/core/git-tracker.d.ts +20 -0
  19. package/dist/core/git-tracker.js +159 -0
  20. package/dist/core/graph.d.ts +42 -0
  21. package/dist/core/graph.js +186 -0
  22. package/dist/core/metrics.d.ts +24 -0
  23. package/dist/core/metrics.js +87 -0
  24. package/dist/core/scanner.d.ts +53 -0
  25. package/dist/core/scanner.js +949 -0
  26. package/dist/core/store-bun.d.ts +13 -0
  27. package/dist/core/store-bun.js +34 -0
  28. package/dist/core/store-interface.d.ts +15 -0
  29. package/dist/core/store-interface.js +7 -0
  30. package/dist/core/store-node.d.ts +13 -0
  31. package/dist/core/store-node.js +35 -0
  32. package/dist/core/store.d.ts +132 -0
  33. package/dist/core/store.js +614 -0
  34. package/dist/core/workspace-manager.d.ts +9 -0
  35. package/dist/core/workspace-manager.js +64 -0
  36. package/dist/exporters/dot-exporter.d.ts +16 -0
  37. package/dist/exporters/dot-exporter.js +179 -0
  38. package/dist/exporters/graph-exporter.d.ts +14 -0
  39. package/dist/exporters/graph-exporter.js +85 -0
  40. package/dist/exporters/index.d.ts +9 -0
  41. package/dist/exporters/index.js +12 -0
  42. package/dist/exporters/llm-exporter.d.ts +18 -0
  43. package/dist/exporters/llm-exporter.js +224 -0
  44. package/dist/exporters/svg-exporter.d.ts +19 -0
  45. package/dist/exporters/svg-exporter.js +319 -0
  46. package/dist/exporters/toon-exporter.d.ts +16 -0
  47. package/dist/exporters/toon-exporter.js +246 -0
  48. package/dist/frameworks/detectors/aspnet.d.ts +11 -0
  49. package/dist/frameworks/detectors/aspnet.js +52 -0
  50. package/dist/frameworks/detectors/django.d.ts +14 -0
  51. package/dist/frameworks/detectors/django.js +135 -0
  52. package/dist/frameworks/detectors/drupal.d.ts +13 -0
  53. package/dist/frameworks/detectors/drupal.js +94 -0
  54. package/dist/frameworks/detectors/express.d.ts +12 -0
  55. package/dist/frameworks/detectors/express.js +234 -0
  56. package/dist/frameworks/detectors/fastapi.d.ts +12 -0
  57. package/dist/frameworks/detectors/fastapi.js +203 -0
  58. package/dist/frameworks/detectors/flask.d.ts +12 -0
  59. package/dist/frameworks/detectors/flask.js +244 -0
  60. package/dist/frameworks/detectors/go.d.ts +11 -0
  61. package/dist/frameworks/detectors/go.js +75 -0
  62. package/dist/frameworks/detectors/laravel.d.ts +11 -0
  63. package/dist/frameworks/detectors/laravel.js +462 -0
  64. package/dist/frameworks/detectors/nestjs.d.ts +12 -0
  65. package/dist/frameworks/detectors/nestjs.js +155 -0
  66. package/dist/frameworks/detectors/nextjs.d.ts +11 -0
  67. package/dist/frameworks/detectors/nextjs.js +118 -0
  68. package/dist/frameworks/detectors/rails.d.ts +12 -0
  69. package/dist/frameworks/detectors/rails.js +76 -0
  70. package/dist/frameworks/detectors/react-router.d.ts +11 -0
  71. package/dist/frameworks/detectors/react-router.js +115 -0
  72. package/dist/frameworks/detectors/rust.d.ts +11 -0
  73. package/dist/frameworks/detectors/rust.js +59 -0
  74. package/dist/frameworks/detectors/spring.d.ts +11 -0
  75. package/dist/frameworks/detectors/spring.js +56 -0
  76. package/dist/frameworks/detectors/sveltekit.d.ts +11 -0
  77. package/dist/frameworks/detectors/sveltekit.js +154 -0
  78. package/dist/frameworks/detectors/symfony.d.ts +13 -0
  79. package/dist/frameworks/detectors/symfony.js +175 -0
  80. package/dist/frameworks/detectors/tanstack-router.d.ts +12 -0
  81. package/dist/frameworks/detectors/tanstack-router.js +80 -0
  82. package/dist/frameworks/detectors/vapor.d.ts +11 -0
  83. package/dist/frameworks/detectors/vapor.js +52 -0
  84. package/dist/frameworks/detectors/vue-router.d.ts +12 -0
  85. package/dist/frameworks/detectors/vue-router.js +237 -0
  86. package/dist/frameworks/detectors/wordpress.d.ts +13 -0
  87. package/dist/frameworks/detectors/wordpress.js +141 -0
  88. package/dist/frameworks/detectors/yii.d.ts +11 -0
  89. package/dist/frameworks/detectors/yii.js +131 -0
  90. package/dist/frameworks/framework-registry.d.ts +13 -0
  91. package/dist/frameworks/framework-registry.js +77 -0
  92. package/dist/frameworks/route-registry.d.ts +26 -0
  93. package/dist/frameworks/route-registry.js +102 -0
  94. package/dist/index.d.ts +19 -0
  95. package/dist/index.js +30 -0
  96. package/dist/languages/index.d.ts +2 -0
  97. package/dist/languages/index.js +7 -0
  98. package/dist/languages/installer.d.ts +13 -0
  99. package/dist/languages/installer.js +103 -0
  100. package/dist/languages/registry.d.ts +19 -0
  101. package/dist/languages/registry.js +427 -0
  102. package/dist/main.d.ts +2 -0
  103. package/dist/main.js +20 -0
  104. package/dist/mcp.d.ts +11 -0
  105. package/dist/mcp.js +1699 -0
  106. package/dist/parsers/common-methods.d.ts +3 -0
  107. package/dist/parsers/common-methods.js +33 -0
  108. package/dist/parsers/fallback-parser.d.ts +10 -0
  109. package/dist/parsers/fallback-parser.js +18 -0
  110. package/dist/parsers/generic-wasm-parser.d.ts +23 -0
  111. package/dist/parsers/generic-wasm-parser.js +168 -0
  112. package/dist/parsers/ignored-symbols.d.ts +26 -0
  113. package/dist/parsers/ignored-symbols.js +77 -0
  114. package/dist/parsers/index.d.ts +9 -0
  115. package/dist/parsers/index.js +13 -0
  116. package/dist/parsers/languages/javascript.d.ts +11 -0
  117. package/dist/parsers/languages/javascript.js +28 -0
  118. package/dist/parsers/languages/php.d.ts +15 -0
  119. package/dist/parsers/languages/php.js +648 -0
  120. package/dist/parsers/languages/typescript.d.ts +10 -0
  121. package/dist/parsers/languages/typescript.js +9 -0
  122. package/dist/parsers/languages/vue.d.ts +13 -0
  123. package/dist/parsers/languages/vue.js +63 -0
  124. package/dist/parsers/parse-worker.d.ts +2 -0
  125. package/dist/parsers/parse-worker.js +185 -0
  126. package/dist/parsers/parser-interface.d.ts +9 -0
  127. package/dist/parsers/parser-interface.js +0 -0
  128. package/dist/parsers/parser-registry.d.ts +8 -0
  129. package/dist/parsers/parser-registry.js +52 -0
  130. package/dist/parsers/wasm-parser.d.ts +16 -0
  131. package/dist/parsers/wasm-parser.js +110 -0
  132. package/dist/types.d.ts +172 -0
  133. package/dist/types.js +0 -0
  134. package/dist/ui/index.html +270 -0
  135. package/dist/ui/main.js +581 -0
  136. package/dist/ui/main.js.map +7 -0
  137. package/dist/ui/styles.css +573 -0
  138. package/dist/ui-events.d.ts +36 -0
  139. package/dist/ui-events.js +61 -0
  140. package/dist/ui-server.d.ts +12 -0
  141. package/dist/ui-server.js +504 -0
  142. package/package.json +179 -0
  143. package/queries/bash/references.scm +22 -0
  144. package/queries/bash/symbols.scm +15 -0
  145. package/queries/c/references.scm +14 -0
  146. package/queries/c/symbols.scm +30 -0
  147. package/queries/c-sharp/references.scm +26 -0
  148. package/queries/c-sharp/symbols.scm +57 -0
  149. package/queries/cpp/references.scm +21 -0
  150. package/queries/cpp/symbols.scm +44 -0
  151. package/queries/dart/references.scm +33 -0
  152. package/queries/dart/symbols.scm +38 -0
  153. package/queries/elixir/references.scm +45 -0
  154. package/queries/elixir/symbols.scm +41 -0
  155. package/queries/go/references.scm +22 -0
  156. package/queries/go/symbols.scm +53 -0
  157. package/queries/java/references.scm +32 -0
  158. package/queries/java/symbols.scm +41 -0
  159. package/queries/javascript/references.scm +14 -0
  160. package/queries/javascript/symbols.scm +23 -0
  161. package/queries/kotlin/references.scm +31 -0
  162. package/queries/kotlin/symbols.scm +24 -0
  163. package/queries/lua/references.scm +19 -0
  164. package/queries/lua/symbols.scm +29 -0
  165. package/queries/pascal/references.scm +29 -0
  166. package/queries/pascal/symbols.scm +45 -0
  167. package/queries/php/references.scm +109 -0
  168. package/queries/php/symbols.scm +33 -0
  169. package/queries/python/references.scm +50 -0
  170. package/queries/python/symbols.scm +21 -0
  171. package/queries/ruby/references.scm +48 -0
  172. package/queries/ruby/symbols.scm +24 -0
  173. package/queries/rust/references.scm +31 -0
  174. package/queries/rust/symbols.scm +35 -0
  175. package/queries/scala/references.scm +30 -0
  176. package/queries/scala/symbols.scm +35 -0
  177. package/queries/svelte/references.scm +20 -0
  178. package/queries/svelte/symbols.scm +30 -0
  179. package/queries/swift/references.scm +22 -0
  180. package/queries/swift/symbols.scm +37 -0
  181. package/queries/typescript/references.scm +25 -0
  182. package/queries/typescript/symbols.scm +35 -0
  183. package/queries/vue/references.scm +20 -0
  184. package/queries/vue/symbols.scm +28 -0
  185. package/queries/zig/references.scm +20 -0
  186. package/queries/zig/symbols.scm +22 -0
  187. package/wasm/tree-sitter-c.wasm +0 -0
  188. package/wasm/tree-sitter-c_sharp.wasm +0 -0
  189. package/wasm/tree-sitter-cpp.wasm +0 -0
  190. package/wasm/tree-sitter-dart.wasm +0 -0
  191. package/wasm/tree-sitter-go.wasm +0 -0
  192. package/wasm/tree-sitter-java.wasm +0 -0
  193. package/wasm/tree-sitter-javascript.wasm +0 -0
  194. package/wasm/tree-sitter-kotlin.wasm +0 -0
  195. package/wasm/tree-sitter-php.wasm +0 -0
  196. package/wasm/tree-sitter-python.wasm +0 -0
  197. package/wasm/tree-sitter-ruby.wasm +0 -0
  198. package/wasm/tree-sitter-rust.wasm +0 -0
  199. package/wasm/tree-sitter-scala.wasm +0 -0
  200. package/wasm/tree-sitter-swift.wasm +0 -0
  201. package/wasm/tree-sitter-tsx.wasm +0 -0
  202. package/wasm/tree-sitter-typescript.wasm +0 -0
  203. package/wasm/tree-sitter-vue.wasm +0 -0
@@ -0,0 +1,13 @@
1
+ import { StoreBackend, PreparedStmt } from './store-interface.js';
2
+
3
+ declare class BunStore implements StoreBackend {
4
+ private db;
5
+ constructor(dbPath: string);
6
+ exec(sql: string): void;
7
+ prepare(sql: string): PreparedStmt;
8
+ pragma(pragma: string): void;
9
+ inTransaction<T>(fn: () => T): T;
10
+ close(): void;
11
+ }
12
+
13
+ export { BunStore };
@@ -0,0 +1,34 @@
1
+ class BunStore {
2
+ db;
3
+ constructor(dbPath) {
4
+ const { Database } = require("bun:sqlite");
5
+ this.db = new Database(dbPath, { create: true });
6
+ this.pragma("journal_mode = WAL");
7
+ this.pragma("busy_timeout = 5000");
8
+ this.pragma("foreign_keys = ON");
9
+ }
10
+ exec(sql) {
11
+ this.db.exec(sql);
12
+ }
13
+ prepare(sql) {
14
+ const stmt = this.db.prepare(sql);
15
+ return {
16
+ run: (...args) => stmt.run(...args),
17
+ get: (...args) => stmt.get(...args),
18
+ all: (...args) => stmt.all(...args)
19
+ };
20
+ }
21
+ pragma(pragma) {
22
+ this.db.exec(`PRAGMA ${pragma}`);
23
+ }
24
+ inTransaction(fn) {
25
+ const tx = this.db.transaction(fn);
26
+ return tx();
27
+ }
28
+ close() {
29
+ this.db.close();
30
+ }
31
+ }
32
+ export {
33
+ BunStore
34
+ };
@@ -0,0 +1,15 @@
1
+ interface StoreBackend {
2
+ exec(sql: string): void;
3
+ prepare(sql: string): PreparedStmt;
4
+ pragma(pragma: string): void;
5
+ close(): void;
6
+ inTransaction<T>(fn: () => T): T;
7
+ }
8
+ interface PreparedStmt {
9
+ run(...args: unknown[]): void;
10
+ get(...args: unknown[]): Record<string, unknown> | undefined;
11
+ all(...args: unknown[]): Record<string, unknown>[];
12
+ }
13
+ declare function createDatabasePath(workspaceRoot: string): string;
14
+
15
+ export { type PreparedStmt, type StoreBackend, createDatabasePath };
@@ -0,0 +1,7 @@
1
+ import { join } from "node:path";
2
+ function createDatabasePath(workspaceRoot) {
3
+ return join(workspaceRoot, ".mapx", "mapx.db");
4
+ }
5
+ export {
6
+ createDatabasePath
7
+ };
@@ -0,0 +1,13 @@
1
+ import { StoreBackend, PreparedStmt } from './store-interface.js';
2
+
3
+ declare class NodeStore implements StoreBackend {
4
+ private db;
5
+ constructor(dbPath: string);
6
+ exec(sql: string): void;
7
+ prepare(sql: string): PreparedStmt;
8
+ pragma(pragma: string): void;
9
+ inTransaction<T>(fn: () => T): T;
10
+ close(): void;
11
+ }
12
+
13
+ export { NodeStore };
@@ -0,0 +1,35 @@
1
+ import { createRequire } from "node:module";
2
+ const _require = createRequire(import.meta.url);
3
+ class NodeStore {
4
+ db;
5
+ constructor(dbPath) {
6
+ const Database = _require("better-sqlite3");
7
+ this.db = new Database(dbPath);
8
+ this.pragma("journal_mode = WAL");
9
+ this.pragma("busy_timeout = 5000");
10
+ this.pragma("foreign_keys = ON");
11
+ }
12
+ exec(sql) {
13
+ this.db.exec(sql);
14
+ }
15
+ prepare(sql) {
16
+ const stmt = this.db.prepare(sql);
17
+ return {
18
+ run: (...args) => stmt.run(...args),
19
+ get: (...args) => stmt.get(...args),
20
+ all: (...args) => stmt.all(...args)
21
+ };
22
+ }
23
+ pragma(pragma) {
24
+ this.db.pragma(pragma);
25
+ }
26
+ inTransaction(fn) {
27
+ return this.db.transaction(fn)();
28
+ }
29
+ close() {
30
+ this.db.close();
31
+ }
32
+ }
33
+ export {
34
+ NodeStore
35
+ };
@@ -0,0 +1,132 @@
1
+ import { StoreBackend } from './store-interface.js';
2
+ import { MapxGraph } from './graph.js';
3
+ import '../types.js';
4
+
5
+ declare class Store {
6
+ private backend;
7
+ constructor(dbPath: string);
8
+ private runMigrations;
9
+ private getSchemaVersion;
10
+ private columnExists;
11
+ get raw(): StoreBackend;
12
+ setMeta(key: string, value: string): void;
13
+ getMeta(key: string): string | null;
14
+ upsertFile(file: {
15
+ path: string;
16
+ repo: string;
17
+ language: string;
18
+ gitBlobHash: string | null;
19
+ contentHash: string | null;
20
+ lastScanned: string;
21
+ sizeBytes: number;
22
+ lines: number;
23
+ metadata?: Record<string, any>;
24
+ namespace?: string | null;
25
+ }): void;
26
+ updateFileMetadata(filePath: string, metadata: Record<string, any>): void;
27
+ deleteFile(filePath: string): void;
28
+ getFile(filePath: string): Record<string, unknown> | undefined;
29
+ getAllFiles(repo?: string): Record<string, unknown>[];
30
+ insertSymbol(sym: {
31
+ filePath: string;
32
+ repo: string;
33
+ name: string;
34
+ kind: string;
35
+ scope: string | null;
36
+ signature: string;
37
+ startLine: number;
38
+ endLine: number;
39
+ metadata: string;
40
+ }): void;
41
+ deleteSymbolsForFile(filePath: string): void;
42
+ searchSymbols(namePattern: string, repo?: string): Record<string, unknown>[];
43
+ getSymbolsForFile(filePath: string): Record<string, unknown>[];
44
+ getAllSymbols(repo?: string): Record<string, unknown>[];
45
+ insertEdge(edge: {
46
+ sourceFile: string;
47
+ targetFile: string;
48
+ sourceSymbol: string | null;
49
+ targetSymbol: string | null;
50
+ edgeType: string;
51
+ repo: string;
52
+ weight: number;
53
+ verifiability?: 'verified' | 'inferred';
54
+ metadata?: Record<string, any>;
55
+ targetRepo?: string | null;
56
+ }): void;
57
+ deleteEdgesForFile(filePath: string): void;
58
+ deleteFrameworkEdgesForRepo(repoName: string): void;
59
+ getEdgesForFile(filePath: string): Record<string, unknown>[];
60
+ getReverseEdges(filePath: string): Record<string, unknown>[];
61
+ getAllEdges(repo?: string): Record<string, unknown>[];
62
+ queryEdges(options: {
63
+ type?: string;
64
+ from?: string;
65
+ to?: string;
66
+ repo?: string;
67
+ }): Record<string, unknown>[];
68
+ getFileCount(repo?: string): number;
69
+ getSymbolCount(repo?: string): number;
70
+ getEdgeCount(repo?: string): number;
71
+ getLanguageBreakdown(repo?: string): Record<string, number>;
72
+ upsertSnapshot(snap: {
73
+ commitSha: string;
74
+ parentSha: string | null;
75
+ timestamp: string;
76
+ filesAdded: string;
77
+ filesModified: string;
78
+ filesRemoved: string;
79
+ symbolsDelta: string;
80
+ }): void;
81
+ getLatestSnapshot(): Record<string, unknown> | undefined;
82
+ clearClusters(repo: string): void;
83
+ insertCluster(cluster: {
84
+ repo: string;
85
+ name: string;
86
+ label: string;
87
+ source: string;
88
+ parentName: string | null;
89
+ depth: number;
90
+ fileCount: number;
91
+ }): void;
92
+ insertClusterMembership(membership: {
93
+ filePath: string;
94
+ clusterName: string;
95
+ repo: string;
96
+ isPrimary: number;
97
+ }): void;
98
+ getClusters(repo?: string): Record<string, unknown>[];
99
+ getClusterMemberships(repo?: string): Record<string, unknown>[];
100
+ getClusterFiles(clusterName: string, repo: string): string[];
101
+ getClusterEdges(clusterName: string, repo: string): {
102
+ sourceCluster: string;
103
+ targetCluster: string;
104
+ edgeCount: number;
105
+ dominantType: string;
106
+ }[];
107
+ deleteRepo(repoName: string): void;
108
+ searchSymbolsFiltered(options: {
109
+ term: string;
110
+ kind?: string;
111
+ filePrefix?: string;
112
+ exact?: boolean;
113
+ limit?: number;
114
+ repo?: string;
115
+ }): Record<string, any>[];
116
+ getSymbolByName(fullName: string, repo?: string): Record<string, any> | undefined;
117
+ getFilesFiltered(options: {
118
+ pathPrefix?: string;
119
+ lang?: string;
120
+ sort?: 'lines' | 'path';
121
+ limit?: number;
122
+ repo?: string;
123
+ }): Record<string, any>[];
124
+ getCallersOfSymbol(fullName: string, repo?: string): Record<string, any>[];
125
+ getCalleesOfSymbol(fullName: string, repo?: string): Record<string, any>[];
126
+ getTopFilesByPageRank(graph: MapxGraph, limit?: number): any[];
127
+ getTopSymbolsByPageRank(graph: MapxGraph, limit?: number): any[];
128
+ inTransaction<T>(fn: () => T): T;
129
+ close(): void;
130
+ }
131
+
132
+ export { Store };