@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,141 @@
1
+ import { join, basename } from "node:path";
2
+ import { existsSync } from "node:fs";
3
+ class WordPressDetector {
4
+ name = "wordpress";
5
+ language = "php";
6
+ filePattern = /\.php$/;
7
+ // Standard WP template hierarchy files
8
+ static TEMPLATE_FILES = /* @__PURE__ */ new Set([
9
+ "front-page.php",
10
+ "home.php",
11
+ "single.php",
12
+ "page.php",
13
+ "archive.php",
14
+ "category.php",
15
+ "tag.php",
16
+ "taxonomy.php",
17
+ "search.php",
18
+ "404.php",
19
+ "index.php"
20
+ ]);
21
+ async detect(projectRoot, files) {
22
+ const wpConfig = join(projectRoot, "wp-config.php");
23
+ if (existsSync(wpConfig)) return true;
24
+ return files.some((f) => f.includes("wp-content/") || f.includes("wp-includes/"));
25
+ }
26
+ async extractRoutes(filePath, content, ctx) {
27
+ const routes = [];
28
+ const fileName = basename(filePath);
29
+ if (WordPressDetector.TEMPLATE_FILES.has(fileName)) {
30
+ let pathVal = "/" + fileName.replace(/\.php$/, "");
31
+ if (fileName === "front-page.php") {
32
+ pathVal = "/";
33
+ }
34
+ routes.push({
35
+ framework: this.name,
36
+ method: "GET",
37
+ path: pathVal,
38
+ handlerFile: filePath,
39
+ handlerSymbol: fileName,
40
+ metadata: {
41
+ confidence: "inferred",
42
+ routeType: "server",
43
+ templateFile: fileName
44
+ }
45
+ });
46
+ }
47
+ const restRegex = /register_rest_route\s*\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]/g;
48
+ let match;
49
+ while ((match = restRegex.exec(content)) !== null) {
50
+ const namespace = match[1];
51
+ const routePath = match[2];
52
+ const fullPath = `/wp-json/${namespace.replace(/^\/|\/$/g, "")}/${routePath.replace(/^\/|\/$/g, "")}`;
53
+ const scanWindow = content.substring(match.index, match.index + 1e3);
54
+ const callbackMatch = scanWindow.match(/'callback'\s*=>\s*(?:['"]([^'"]+)['"]|\[\s*(?:['"]?([a-zA-Z0-9_]+)['"]?|([$]this))\s*,\s*['"]([^'"]+)['"]\s*\])/);
55
+ let handlerSymbol = "rest_callback";
56
+ if (callbackMatch) {
57
+ if (callbackMatch[1]) {
58
+ handlerSymbol = callbackMatch[1];
59
+ } else {
60
+ const className = callbackMatch[2] || "this";
61
+ const methodName = callbackMatch[4];
62
+ handlerSymbol = `${className}::${methodName}`;
63
+ }
64
+ }
65
+ let verbs = ["GET"];
66
+ const methodsMatch = scanWindow.match(/'methods'\s*=>\s*(?:['"]([^'"]+)['"]|WP_REST_Server::([A-Z_]+)|\[\s*([^\]]+)\s*\])/);
67
+ if (methodsMatch) {
68
+ if (methodsMatch[1]) {
69
+ verbs = [methodsMatch[1].toUpperCase()];
70
+ } else if (methodsMatch[2]) {
71
+ const constant = methodsMatch[2];
72
+ if (constant === "READABLE") verbs = ["GET"];
73
+ else if (constant === "CREATABLE") verbs = ["POST"];
74
+ else if (constant === "EDITABLE") verbs = ["PUT", "PATCH"];
75
+ else if (constant === "DELETABLE") verbs = ["DELETE"];
76
+ else verbs = ["ALL"];
77
+ } else if (methodsMatch[3]) {
78
+ verbs = methodsMatch[3].split(",").map((v) => v.trim().replace(/['"]/g, "").toUpperCase());
79
+ }
80
+ }
81
+ let resolvedFile = filePath;
82
+ const resolvedPath = ctx.resolveSymbolToFile(handlerSymbol.split("::")[0]);
83
+ if (resolvedPath) {
84
+ resolvedFile = resolvedPath;
85
+ }
86
+ for (const verb of verbs) {
87
+ routes.push({
88
+ framework: this.name,
89
+ method: verb,
90
+ path: fullPath,
91
+ handlerFile: resolvedFile,
92
+ handlerSymbol,
93
+ metadata: {
94
+ confidence: "inferred",
95
+ routeType: "server"
96
+ }
97
+ });
98
+ }
99
+ }
100
+ return routes;
101
+ }
102
+ async extractHooks(filePath, content, ctx) {
103
+ const hooks = [];
104
+ const hookRegex = /\badd_(action|filter|shortcode)\s*\(\s*['"]([^'"]+)['"]\s*,\s*(?:['"]([^'"]+)['"]|\[\s*(?:['"]?([a-zA-Z0-9_]+)['"]?|([$]this))\s*,\s*['"]([^'"]+)['"]\s*\])/g;
105
+ let match;
106
+ while ((match = hookRegex.exec(content)) !== null) {
107
+ const type = match[1];
108
+ const hookName = match[2];
109
+ let handlerSymbol = "callback";
110
+ if (match[3]) {
111
+ handlerSymbol = match[3];
112
+ } else {
113
+ const className = match[4] || "this";
114
+ const methodName = match[6];
115
+ handlerSymbol = `${className}::${methodName}`;
116
+ }
117
+ hooks.push({
118
+ framework: this.name,
119
+ hookName,
120
+ handlerFile: filePath,
121
+ handlerSymbol,
122
+ hookType: type === "shortcode" ? "shortcode" : type === "filter" ? "filter" : "action"
123
+ });
124
+ }
125
+ const ptRegex = /\bregister_post_type\s*\(\s*['"]([^'"]+)['"]/g;
126
+ while ((match = ptRegex.exec(content)) !== null) {
127
+ const postTypeName = match[1];
128
+ hooks.push({
129
+ framework: this.name,
130
+ hookName: postTypeName,
131
+ handlerFile: filePath,
132
+ handlerSymbol: "register_post_type",
133
+ hookType: "post_type"
134
+ });
135
+ }
136
+ return hooks;
137
+ }
138
+ }
139
+ export {
140
+ WordPressDetector
141
+ };
@@ -0,0 +1,11 @@
1
+ import { FrameworkDetector, ScanContext, RouteBinding } from '../../types.js';
2
+
3
+ declare class YiiDetector implements FrameworkDetector {
4
+ readonly name = "yii";
5
+ readonly language = "php";
6
+ readonly filePattern: RegExp;
7
+ detect(projectRoot: string, files: string[]): Promise<boolean>;
8
+ extractRoutes(filePath: string, content: string, ctx: ScanContext): Promise<RouteBinding[]>;
9
+ }
10
+
11
+ export { YiiDetector };
@@ -0,0 +1,131 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { existsSync } from "node:fs";
4
+ class YiiDetector {
5
+ name = "yii";
6
+ language = "php";
7
+ filePattern = /\.php$/;
8
+ async detect(projectRoot, files) {
9
+ const composerPath = join(projectRoot, "composer.json");
10
+ if (existsSync(composerPath)) {
11
+ try {
12
+ const pkg = JSON.parse(await readFile(composerPath, "utf-8"));
13
+ const reqs = { ...pkg.require, ...pkg["require-dev"] };
14
+ if (reqs && (reqs["yiisoft/yii2"] || reqs["yiisoft/yii3"] || reqs["yiisoft/router"])) {
15
+ return true;
16
+ }
17
+ } catch {
18
+ }
19
+ }
20
+ return files.some((f) => f.includes("config/web.php") || f.includes("config/routes.php"));
21
+ }
22
+ async extractRoutes(filePath, content, ctx) {
23
+ const routes = [];
24
+ const yii2RuleRegex = /['"](?:(GET|POST|PUT|DELETE|PATCH|OPTIONS|HEAD)\s+)?([a-zA-Z0-9_.-]+)['"]\s*=>\s*['"]([^'"]+)['"]/g;
25
+ let match;
26
+ while ((match = yii2RuleRegex.exec(content)) !== null) {
27
+ const verb = match[1] || "GET";
28
+ const pathVal = "/" + match[2].replace(/^\/|\/$/g, "");
29
+ const target = match[3];
30
+ if (target.includes("/")) {
31
+ const parts = target.split("/");
32
+ const controller = parts[0];
33
+ const action = parts[1];
34
+ const controllerClassName = controller.charAt(0).toUpperCase() + controller.slice(1) + "Controller";
35
+ const actionMethodName = "action" + action.charAt(0).toUpperCase() + action.slice(1);
36
+ let resolvedFile = filePath;
37
+ const resolvedPath = ctx.resolveSymbolToFile(controllerClassName);
38
+ if (resolvedPath) {
39
+ resolvedFile = resolvedPath;
40
+ }
41
+ routes.push({
42
+ framework: this.name,
43
+ method: verb,
44
+ path: pathVal,
45
+ handlerFile: resolvedFile,
46
+ handlerSymbol: `${controllerClassName}::${actionMethodName}`,
47
+ metadata: {
48
+ confidence: "inferred",
49
+ routeType: "server"
50
+ }
51
+ });
52
+ }
53
+ }
54
+ if (content.includes("yii\\rest\\UrlRule")) {
55
+ const restControllerRegex = /'controller'\s*=>\s*(?:['"]([^'"]+)['"]|\[\s*([^\]]+)\s*\])/g;
56
+ while ((match = restControllerRegex.exec(content)) !== null) {
57
+ const controllers = [];
58
+ if (match[1]) {
59
+ controllers.push(match[1]);
60
+ } else if (match[2]) {
61
+ controllers.push(...match[2].split(",").map((c) => c.trim().replace(/['"]/g, "")));
62
+ }
63
+ for (const controller of controllers) {
64
+ const controllerClassName = controller.charAt(0).toUpperCase() + controller.slice(1) + "Controller";
65
+ const crudEndpoints = [
66
+ { verb: "GET", path: `/${controller}`, action: "actionIndex" },
67
+ { verb: "GET", path: `/${controller}/view`, action: "actionView" },
68
+ { verb: "POST", path: `/${controller}`, action: "actionCreate" },
69
+ { verb: "PUT", path: `/${controller}/update`, action: "actionUpdate" },
70
+ { verb: "PATCH", path: `/${controller}/update`, action: "actionUpdate" },
71
+ { verb: "DELETE", path: `/${controller}/delete`, action: "actionDelete" },
72
+ { verb: "OPTIONS", path: `/${controller}`, action: "actionOptions" }
73
+ ];
74
+ let resolvedFile = filePath;
75
+ const resolvedPath = ctx.resolveSymbolToFile(controllerClassName);
76
+ if (resolvedPath) {
77
+ resolvedFile = resolvedPath;
78
+ }
79
+ for (const ep of crudEndpoints) {
80
+ routes.push({
81
+ framework: this.name,
82
+ method: ep.verb,
83
+ path: ep.path,
84
+ handlerFile: resolvedFile,
85
+ handlerSymbol: `${controllerClassName}::${ep.action}`,
86
+ metadata: {
87
+ confidence: "inferred",
88
+ routeType: "server"
89
+ }
90
+ });
91
+ }
92
+ }
93
+ }
94
+ }
95
+ let yii3GroupPrefix = "";
96
+ const groupMatch = content.match(/Route::addGroup\s*\(\s*['"]([^'"]+)['"]/);
97
+ if (groupMatch) {
98
+ yii3GroupPrefix = groupMatch[1];
99
+ }
100
+ const yii3RouteRegex = /Route::(get|post|put|delete|patch|options|head)\s*\(\s*['"]([^'"]+)['"]\s*\)\s*(?:->[a-zA-Z0-9_]+\s*\([^)]*\)\s*)*->action\s*\(\s*(?:\[\s*([a-zA-Z0-9_]+)::class\s*,\s*['"]([^'"]+)['"]\s*\]|['"]([^'"]+)['"])/g;
101
+ while ((match = yii3RouteRegex.exec(content)) !== null) {
102
+ const verb = match[1].toUpperCase();
103
+ const pathVal = match[2];
104
+ const controllerClass = match[3] || "Controller";
105
+ const actionMethod = match[4] || match[5] || "index";
106
+ const cleanGroup = yii3GroupPrefix.replace(/^\/|\/$/g, "");
107
+ const cleanPath = pathVal.replace(/^\/|\/$/g, "");
108
+ const combinedPath = "/" + [cleanGroup, cleanPath].filter(Boolean).join("/");
109
+ let resolvedFile = filePath;
110
+ const resolvedPath = ctx.resolveSymbolToFile(controllerClass);
111
+ if (resolvedPath) {
112
+ resolvedFile = resolvedPath;
113
+ }
114
+ routes.push({
115
+ framework: this.name,
116
+ method: verb,
117
+ path: combinedPath,
118
+ handlerFile: resolvedFile,
119
+ handlerSymbol: `${controllerClass}::${actionMethod}`,
120
+ metadata: {
121
+ confidence: "inferred",
122
+ routeType: "server"
123
+ }
124
+ });
125
+ }
126
+ return routes;
127
+ }
128
+ }
129
+ export {
130
+ YiiDetector
131
+ };
@@ -0,0 +1,13 @@
1
+ import { FrameworkDetector } from '../types.js';
2
+
3
+ declare class FrameworkRegistry {
4
+ private static instance;
5
+ private detectors;
6
+ private constructor();
7
+ static getInstance(): FrameworkRegistry;
8
+ register(detector: FrameworkDetector): void;
9
+ getDetectors(): FrameworkDetector[];
10
+ detectActiveFrameworks(projectRoot: string, files: string[]): Promise<FrameworkDetector[]>;
11
+ }
12
+
13
+ export { FrameworkRegistry };
@@ -0,0 +1,77 @@
1
+ import { LaravelDetector } from "./detectors/laravel.js";
2
+ import { DjangoDetector } from "./detectors/django.js";
3
+ import { FlaskDetector } from "./detectors/flask.js";
4
+ import { FastAPIDetector } from "./detectors/fastapi.js";
5
+ import { ExpressDetector } from "./detectors/express.js";
6
+ import { NestJSDetector } from "./detectors/nestjs.js";
7
+ import { ReactRouterDetector } from "./detectors/react-router.js";
8
+ import { TanstackRouterDetector } from "./detectors/tanstack-router.js";
9
+ import { NextJSDetector } from "./detectors/nextjs.js";
10
+ import { SvelteKitDetector } from "./detectors/sveltekit.js";
11
+ import { VueRouterDetector } from "./detectors/vue-router.js";
12
+ import { DrupalDetector } from "./detectors/drupal.js";
13
+ import { RailsDetector } from "./detectors/rails.js";
14
+ import { SpringDetector } from "./detectors/spring.js";
15
+ import { GoDetector } from "./detectors/go.js";
16
+ import { RustDetector } from "./detectors/rust.js";
17
+ import { AspNetDetector } from "./detectors/aspnet.js";
18
+ import { VaporDetector } from "./detectors/vapor.js";
19
+ import { SymfonyDetector } from "./detectors/symfony.js";
20
+ import { YiiDetector } from "./detectors/yii.js";
21
+ import { WordPressDetector } from "./detectors/wordpress.js";
22
+ class FrameworkRegistry {
23
+ static instance = null;
24
+ detectors = [];
25
+ constructor() {
26
+ this.register(new LaravelDetector());
27
+ this.register(new DjangoDetector());
28
+ this.register(new FlaskDetector());
29
+ this.register(new FastAPIDetector());
30
+ this.register(new ExpressDetector());
31
+ this.register(new NestJSDetector());
32
+ this.register(new ReactRouterDetector());
33
+ this.register(new TanstackRouterDetector());
34
+ this.register(new NextJSDetector());
35
+ this.register(new SvelteKitDetector());
36
+ this.register(new VueRouterDetector());
37
+ this.register(new DrupalDetector());
38
+ this.register(new RailsDetector());
39
+ this.register(new SpringDetector());
40
+ this.register(new GoDetector());
41
+ this.register(new RustDetector());
42
+ this.register(new AspNetDetector());
43
+ this.register(new VaporDetector());
44
+ this.register(new SymfonyDetector());
45
+ this.register(new YiiDetector());
46
+ this.register(new WordPressDetector());
47
+ }
48
+ static getInstance() {
49
+ if (!FrameworkRegistry.instance) {
50
+ FrameworkRegistry.instance = new FrameworkRegistry();
51
+ }
52
+ return FrameworkRegistry.instance;
53
+ }
54
+ register(detector) {
55
+ this.detectors.push(detector);
56
+ }
57
+ getDetectors() {
58
+ return this.detectors;
59
+ }
60
+ async detectActiveFrameworks(projectRoot, files) {
61
+ const active = [];
62
+ for (const detector of this.detectors) {
63
+ try {
64
+ const isDetected = await detector.detect(projectRoot, files);
65
+ if (isDetected) {
66
+ active.push(detector);
67
+ }
68
+ } catch (err) {
69
+ console.error(`Error detecting framework ${detector.name}:`, err);
70
+ }
71
+ }
72
+ return active;
73
+ }
74
+ }
75
+ export {
76
+ FrameworkRegistry
77
+ };
@@ -0,0 +1,26 @@
1
+ import { RouteBinding, HookBinding } from '../types.js';
2
+
3
+ declare class RouteRegistry {
4
+ private routes;
5
+ private hooks;
6
+ getRoutes(): RouteBinding[];
7
+ getHooks(): HookBinding[];
8
+ addRoute(route: RouteBinding): void;
9
+ addHook(hook: HookBinding): void;
10
+ clear(): void;
11
+ clearRepo(repoName: string, filePaths?: Set<string>): void;
12
+ load(workspaceRoot: string): Promise<void>;
13
+ save(workspaceRoot: string): Promise<void>;
14
+ queryRoutes(filters: {
15
+ framework?: string;
16
+ method?: string;
17
+ path?: string;
18
+ }): RouteBinding[];
19
+ queryHooks(filters: {
20
+ framework?: string;
21
+ hookType?: string;
22
+ hookName?: string;
23
+ }): HookBinding[];
24
+ }
25
+
26
+ export { RouteRegistry };
@@ -0,0 +1,102 @@
1
+ import { readFile, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { existsSync } from "node:fs";
4
+ class RouteRegistry {
5
+ routes = [];
6
+ hooks = [];
7
+ getRoutes() {
8
+ return this.routes;
9
+ }
10
+ getHooks() {
11
+ return this.hooks;
12
+ }
13
+ addRoute(route) {
14
+ this.routes.push(route);
15
+ }
16
+ addHook(hook) {
17
+ this.hooks.push(hook);
18
+ }
19
+ clear() {
20
+ this.routes = [];
21
+ this.hooks = [];
22
+ }
23
+ clearRepo(repoName, filePaths) {
24
+ this.routes = this.routes.filter((r) => {
25
+ if (r.metadata && r.metadata.repo === repoName) return false;
26
+ if (filePaths) {
27
+ if (filePaths.has(r.handlerFile)) return false;
28
+ if (r.metadata && r.metadata.sourceFile && filePaths.has(r.metadata.sourceFile)) return false;
29
+ }
30
+ return true;
31
+ });
32
+ this.hooks = this.hooks.filter((h) => {
33
+ if (h.metadata && h.metadata.repo === repoName) return false;
34
+ if (filePaths) {
35
+ if (filePaths.has(h.handlerFile)) return false;
36
+ if (h.metadata && h.metadata.sourceFile && filePaths.has(h.metadata.sourceFile)) return false;
37
+ }
38
+ return true;
39
+ });
40
+ }
41
+ async load(workspaceRoot) {
42
+ const routesPath = join(workspaceRoot, ".mapx", "routes.json");
43
+ if (existsSync(routesPath)) {
44
+ try {
45
+ const content = await readFile(routesPath, "utf-8");
46
+ this.routes = JSON.parse(content);
47
+ } catch {
48
+ this.routes = [];
49
+ }
50
+ }
51
+ const hooksPath = join(workspaceRoot, ".mapx", "hooks.json");
52
+ if (existsSync(hooksPath)) {
53
+ try {
54
+ const content = await readFile(hooksPath, "utf-8");
55
+ this.hooks = JSON.parse(content);
56
+ } catch {
57
+ this.hooks = [];
58
+ }
59
+ }
60
+ }
61
+ async save(workspaceRoot) {
62
+ const routesPath = join(workspaceRoot, ".mapx", "routes.json");
63
+ const hooksPath = join(workspaceRoot, ".mapx", "hooks.json");
64
+ try {
65
+ await writeFile(routesPath, JSON.stringify(this.routes, null, 2), "utf-8");
66
+ await writeFile(hooksPath, JSON.stringify(this.hooks, null, 2), "utf-8");
67
+ } catch (err) {
68
+ console.error("Failed to save route/hook registry:", err);
69
+ }
70
+ }
71
+ queryRoutes(filters) {
72
+ return this.routes.filter((r) => {
73
+ if (filters.framework && r.framework.toLowerCase() !== filters.framework.toLowerCase()) {
74
+ return false;
75
+ }
76
+ if (filters.method && r.method.toUpperCase() !== filters.method.toUpperCase()) {
77
+ return false;
78
+ }
79
+ if (filters.path && !r.path.toLowerCase().includes(filters.path.toLowerCase())) {
80
+ return false;
81
+ }
82
+ return true;
83
+ });
84
+ }
85
+ queryHooks(filters) {
86
+ return this.hooks.filter((h) => {
87
+ if (filters.framework && h.framework.toLowerCase() !== filters.framework.toLowerCase()) {
88
+ return false;
89
+ }
90
+ if (filters.hookType && h.hookType.toLowerCase() !== filters.hookType.toLowerCase()) {
91
+ return false;
92
+ }
93
+ if (filters.hookName && !h.hookName.toLowerCase().includes(filters.hookName.toLowerCase())) {
94
+ return false;
95
+ }
96
+ return true;
97
+ });
98
+ }
99
+ }
100
+ export {
101
+ RouteRegistry
102
+ };
@@ -0,0 +1,19 @@
1
+ export { buildCLI } from './cli.js';
2
+ export { startMcpServer } from './mcp.js';
3
+ export { Store } from './core/store.js';
4
+ export { MapxGraph } from './core/graph.js';
5
+ export { Scanner } from './core/scanner.js';
6
+ export { Config } from './core/config.js';
7
+ export { LLMExporter } from './exporters/llm-exporter.js';
8
+ export { GraphExporter } from './exporters/graph-exporter.js';
9
+ export { DotExporter } from './exporters/dot-exporter.js';
10
+ export { FlowTracer } from './core/flow-tracer.js';
11
+ export { AgentGenerator } from './agents/generator.js';
12
+ export { WorkspaceManager } from './core/workspace-manager.js';
13
+ export { ContextBuilder, ContextOptions, ContextResult } from './core/context-builder.js';
14
+ import 'commander';
15
+ import '@modelcontextprotocol/sdk/server/index.js';
16
+ import './core/store-interface.js';
17
+ import './types.js';
18
+ import './languages/registry.js';
19
+ import './agents/templates.js';
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ import { buildCLI } from "./cli.js";
2
+ import { startMcpServer } from "./mcp.js";
3
+ import { Store } from "./core/store.js";
4
+ import { MapxGraph } from "./core/graph.js";
5
+ import { Scanner } from "./core/scanner.js";
6
+ import { Config } from "./core/config.js";
7
+ import { LLMExporter } from "./exporters/llm-exporter.js";
8
+ import { GraphExporter } from "./exporters/graph-exporter.js";
9
+ import { DotExporter } from "./exporters/dot-exporter.js";
10
+ import { FlowTracer } from "./core/flow-tracer.js";
11
+ import { AgentGenerator } from "./agents/generator.js";
12
+ import { WorkspaceManager } from "./core/workspace-manager.js";
13
+ import { ContextBuilder, ContextOptions, ContextResult } from "./core/context-builder.js";
14
+ export {
15
+ AgentGenerator,
16
+ Config,
17
+ ContextBuilder,
18
+ ContextOptions,
19
+ ContextResult,
20
+ DotExporter,
21
+ FlowTracer,
22
+ GraphExporter,
23
+ LLMExporter,
24
+ MapxGraph,
25
+ Scanner,
26
+ Store,
27
+ WorkspaceManager,
28
+ buildCLI,
29
+ startMcpServer
30
+ };
@@ -0,0 +1,2 @@
1
+ export { LanguageDefinition, getBuiltinLanguages, getLanguageForFile, getLanguageNames, isBuiltInLanguage } from './registry.js';
2
+ import '../types.js';
@@ -0,0 +1,7 @@
1
+ import { getBuiltinLanguages, getLanguageForFile, getLanguageNames, isBuiltInLanguage } from "./registry.js";
2
+ export {
3
+ getBuiltinLanguages,
4
+ getLanguageForFile,
5
+ getLanguageNames,
6
+ isBuiltInLanguage
7
+ };
@@ -0,0 +1,13 @@
1
+ declare const GRAMMARS_DIR: string;
2
+ declare const QUERIES_DIR: string;
3
+ interface InstallableLanguageInfo {
4
+ name: string;
5
+ package: string;
6
+ file: string;
7
+ }
8
+ declare const INSTALLABLE_LANGUAGES: Record<string, InstallableLanguageInfo>;
9
+ declare function isLanguageInstalled(name: string): boolean;
10
+ declare function installLanguage(name: string): Promise<void>;
11
+ declare function uninstallLanguage(name: string): Promise<void>;
12
+
13
+ export { GRAMMARS_DIR, INSTALLABLE_LANGUAGES, type InstallableLanguageInfo, QUERIES_DIR, installLanguage, isLanguageInstalled, uninstallLanguage };