milens 0.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 (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +213 -0
  3. package/dist/analyzer/engine.d.ts +11 -0
  4. package/dist/analyzer/engine.d.ts.map +1 -0
  5. package/dist/analyzer/engine.js +163 -0
  6. package/dist/analyzer/engine.js.map +1 -0
  7. package/dist/analyzer/resolver.d.ts +12 -0
  8. package/dist/analyzer/resolver.d.ts.map +1 -0
  9. package/dist/analyzer/resolver.js +119 -0
  10. package/dist/analyzer/resolver.js.map +1 -0
  11. package/dist/analyzer/scanner.d.ts +6 -0
  12. package/dist/analyzer/scanner.d.ts.map +1 -0
  13. package/dist/analyzer/scanner.js +73 -0
  14. package/dist/analyzer/scanner.js.map +1 -0
  15. package/dist/cli.d.ts +3 -0
  16. package/dist/cli.d.ts.map +1 -0
  17. package/dist/cli.js +269 -0
  18. package/dist/cli.js.map +1 -0
  19. package/dist/parser/extract.d.ts +24 -0
  20. package/dist/parser/extract.d.ts.map +1 -0
  21. package/dist/parser/extract.js +239 -0
  22. package/dist/parser/extract.js.map +1 -0
  23. package/dist/parser/lang-go.d.ts +4 -0
  24. package/dist/parser/lang-go.d.ts.map +1 -0
  25. package/dist/parser/lang-go.js +45 -0
  26. package/dist/parser/lang-go.js.map +1 -0
  27. package/dist/parser/lang-java.d.ts +4 -0
  28. package/dist/parser/lang-java.d.ts.map +1 -0
  29. package/dist/parser/lang-java.js +46 -0
  30. package/dist/parser/lang-java.js.map +1 -0
  31. package/dist/parser/lang-js.d.ts +4 -0
  32. package/dist/parser/lang-js.d.ts.map +1 -0
  33. package/dist/parser/lang-js.js +64 -0
  34. package/dist/parser/lang-js.js.map +1 -0
  35. package/dist/parser/lang-php.d.ts +4 -0
  36. package/dist/parser/lang-php.d.ts.map +1 -0
  37. package/dist/parser/lang-php.js +54 -0
  38. package/dist/parser/lang-php.js.map +1 -0
  39. package/dist/parser/lang-py.d.ts +4 -0
  40. package/dist/parser/lang-py.d.ts.map +1 -0
  41. package/dist/parser/lang-py.js +46 -0
  42. package/dist/parser/lang-py.js.map +1 -0
  43. package/dist/parser/lang-rust.d.ts +4 -0
  44. package/dist/parser/lang-rust.d.ts.map +1 -0
  45. package/dist/parser/lang-rust.js +54 -0
  46. package/dist/parser/lang-rust.js.map +1 -0
  47. package/dist/parser/lang-ts.d.ts +4 -0
  48. package/dist/parser/lang-ts.d.ts.map +1 -0
  49. package/dist/parser/lang-ts.js +88 -0
  50. package/dist/parser/lang-ts.js.map +1 -0
  51. package/dist/parser/lang-vue.d.ts +12 -0
  52. package/dist/parser/lang-vue.d.ts.map +1 -0
  53. package/dist/parser/lang-vue.js +28 -0
  54. package/dist/parser/lang-vue.js.map +1 -0
  55. package/dist/parser/languages.d.ts +6 -0
  56. package/dist/parser/languages.d.ts.map +1 -0
  57. package/dist/parser/languages.js +24 -0
  58. package/dist/parser/languages.js.map +1 -0
  59. package/dist/parser/loader.d.ts +5 -0
  60. package/dist/parser/loader.d.ts.map +1 -0
  61. package/dist/parser/loader.js +37 -0
  62. package/dist/parser/loader.js.map +1 -0
  63. package/dist/server/mcp.d.ts +5 -0
  64. package/dist/server/mcp.d.ts.map +1 -0
  65. package/dist/server/mcp.js +355 -0
  66. package/dist/server/mcp.js.map +1 -0
  67. package/dist/skills.d.ts +8 -0
  68. package/dist/skills.d.ts.map +1 -0
  69. package/dist/skills.js +178 -0
  70. package/dist/skills.js.map +1 -0
  71. package/dist/store/db.d.ts +59 -0
  72. package/dist/store/db.d.ts.map +1 -0
  73. package/dist/store/db.js +260 -0
  74. package/dist/store/db.js.map +1 -0
  75. package/dist/store/registry.d.ts +13 -0
  76. package/dist/store/registry.d.ts.map +1 -0
  77. package/dist/store/registry.js +69 -0
  78. package/dist/store/registry.js.map +1 -0
  79. package/dist/store/schema.sql +60 -0
  80. package/dist/types.d.ts +67 -0
  81. package/dist/types.d.ts.map +1 -0
  82. package/dist/types.js +3 -0
  83. package/dist/types.js.map +1 -0
  84. package/package.json +60 -0
@@ -0,0 +1,46 @@
1
+ import { join, relative } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ const spec = {
4
+ id: 'java',
5
+ extensions: ['.java'],
6
+ wasmName: 'tree-sitter-java',
7
+ queries: {
8
+ classes: `(class_declaration name: (identifier) @name) @def`,
9
+ interfaces: `(interface_declaration name: (identifier) @name) @def`,
10
+ methods: `[
11
+ (method_declaration name: (identifier) @name) @def
12
+ (constructor_declaration name: (identifier) @name) @def
13
+ ]`,
14
+ enums: `(enum_declaration name: (identifier) @name) @def`,
15
+ imports: `(import_declaration (scoped_identifier) @source) @def`,
16
+ calls: `(method_invocation
17
+ name: (identifier) @callee
18
+ ) @def`,
19
+ heritage: `[
20
+ (class_declaration
21
+ name: (identifier) @child
22
+ (superclass (type_identifier) @parent)
23
+ ) @def
24
+ (class_declaration
25
+ name: (identifier) @child
26
+ (super_interfaces (type_list (type_identifier) @parent))
27
+ ) @def
28
+ ]`,
29
+ },
30
+ resolveImport(raw, _fromFile, root, _aliases) {
31
+ // Java: com.example.Foo → com/example/Foo.java
32
+ const parts = raw.split('.');
33
+ const candidate = join(root, ...parts) + '.java';
34
+ if (existsSync(candidate))
35
+ return relative(root, candidate).replace(/\\/g, '/');
36
+ // Try searching in common source directories
37
+ for (const srcDir of ['src', 'src/main/java']) {
38
+ const p = join(root, srcDir, ...parts) + '.java';
39
+ if (existsSync(p))
40
+ return relative(root, p).replace(/\\/g, '/');
41
+ }
42
+ return null;
43
+ },
44
+ };
45
+ export default spec;
46
+ //# sourceMappingURL=lang-java.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-java.js","sourceRoot":"","sources":["../../src/parser/lang-java.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,IAAI,GAAa;IACrB,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,QAAQ,EAAE,kBAAkB;IAC5B,OAAO,EAAE;QACP,OAAO,EAAE,mDAAmD;QAC5D,UAAU,EAAE,uDAAuD;QACnE,OAAO,EAAE;;;MAGP;QACF,KAAK,EAAE,kDAAkD;QACzD,OAAO,EAAE,uDAAuD;QAChE,KAAK,EAAE;;WAEA;QACP,QAAQ,EAAE;;;;;;;;;MASR;KACH;IACD,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ;QAC1C,+CAA+C;QAC/C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC;QACjD,IAAI,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChF,6CAA6C;QAC7C,KAAK,MAAM,MAAM,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,EAAE,CAAC;YAC9C,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC;YACjD,IAAI,UAAU,CAAC,CAAC,CAAC;gBAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { LangSpec } from './extract.js';
2
+ declare const spec: LangSpec;
3
+ export default spec;
4
+ //# sourceMappingURL=lang-js.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-js.d.ts","sourceRoot":"","sources":["../../src/parser/lang-js.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,QAyDX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { join, dirname, relative } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ const spec = {
4
+ id: 'javascript',
5
+ extensions: ['.js', '.jsx', '.mjs', '.cjs'],
6
+ wasmName: 'tree-sitter-javascript',
7
+ queries: {
8
+ functions: `[
9
+ (function_declaration name: (identifier) @name) @def
10
+ (lexical_declaration
11
+ (variable_declarator
12
+ name: (identifier) @name
13
+ value: (arrow_function)
14
+ )
15
+ ) @def
16
+ ]`,
17
+ classes: `(class_declaration name: (identifier) @name) @def`,
18
+ methods: `(method_definition name: (property_identifier) @name) @def`,
19
+ imports: `(import_statement
20
+ source: (string (string_fragment) @source)
21
+ ) @def`,
22
+ exports: `[
23
+ (export_statement
24
+ declaration: (function_declaration name: (identifier) @name)
25
+ )
26
+ (export_statement
27
+ declaration: (class_declaration name: (identifier) @name)
28
+ )
29
+ (export_statement
30
+ declaration: (lexical_declaration
31
+ (variable_declarator name: (identifier) @name)
32
+ )
33
+ )
34
+ (export_statement
35
+ (export_clause (export_specifier name: (identifier) @name))
36
+ )
37
+ ]`,
38
+ calls: `
39
+ (call_expression function: (identifier) @callee) @def
40
+ (call_expression function: (member_expression property: (property_identifier) @callee)) @def
41
+ `,
42
+ heritage: `(class_declaration
43
+ name: (identifier) @child
44
+ (class_heritage (identifier) @parent)
45
+ ) @def`,
46
+ },
47
+ resolveImport(raw, fromFile, root, _aliases) {
48
+ if (!raw.startsWith('.') && !raw.startsWith('/'))
49
+ return null;
50
+ const dir = dirname(join(root, fromFile));
51
+ const base = join(dir, raw);
52
+ const candidates = [
53
+ base + '.js', base + '.jsx', base + '.mjs',
54
+ join(base, 'index.js'), join(base, 'index.mjs'),
55
+ ];
56
+ for (const p of candidates) {
57
+ if (existsSync(p))
58
+ return relative(root, p).replace(/\\/g, '/');
59
+ }
60
+ return null;
61
+ },
62
+ };
63
+ export default spec;
64
+ //# sourceMappingURL=lang-js.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-js.js","sourceRoot":"","sources":["../../src/parser/lang-js.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,IAAI,GAAa;IACrB,EAAE,EAAE,YAAY;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAC3C,QAAQ,EAAE,wBAAwB;IAClC,OAAO,EAAE;QACP,SAAS,EAAE;;;;;;;;MAQT;QACF,OAAO,EAAE,mDAAmD;QAC5D,OAAO,EAAE,4DAA4D;QACrE,OAAO,EAAE;;WAEF;QACP,OAAO,EAAE;;;;;;;;;;;;;;;MAeP;QACF,KAAK,EAAE;;;KAGN;QACD,QAAQ,EAAE;;;WAGH;KACR;IACD,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ;QACzC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5B,MAAM,UAAU,GAAG;YACjB,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM;YAC1C,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;SAChD,CAAC;QACF,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YAC3B,IAAI,UAAU,CAAC,CAAC,CAAC;gBAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { LangSpec } from './extract.js';
2
+ declare const spec: LangSpec;
3
+ export default spec;
4
+ //# sourceMappingURL=lang-php.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-php.d.ts","sourceRoot":"","sources":["../../src/parser/lang-php.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,QA+CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { join, relative } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ const spec = {
4
+ id: 'php',
5
+ extensions: ['.php'],
6
+ wasmName: 'tree-sitter-php',
7
+ queries: {
8
+ functions: `(function_definition name: (name) @name) @def`,
9
+ classes: `(class_declaration name: (name) @name) @def`,
10
+ interfaces: `(interface_declaration name: (name) @name) @def`,
11
+ methods: `(method_declaration name: (name) @name) @def`,
12
+ imports: `(namespace_use_declaration
13
+ (namespace_use_clause (qualified_name) @source)
14
+ ) @def`,
15
+ calls: `
16
+ (function_call_expression
17
+ function: (name) @callee
18
+ ) @def
19
+ (member_call_expression
20
+ name: (name) @callee
21
+ ) @def
22
+ `,
23
+ heritage: `[
24
+ (class_declaration
25
+ name: (name) @child
26
+ (base_clause (name) @parent)
27
+ ) @def
28
+ (class_declaration
29
+ name: (name) @child
30
+ (class_interface_clause (name) @parent)
31
+ ) @def
32
+ ]`,
33
+ },
34
+ resolveImport(raw, _fromFile, root, aliases) {
35
+ // PHP PSR-4: App\Models\User → app/Models/User.php (using aliases/psr4 map)
36
+ for (const [ns, dir] of Object.entries(aliases)) {
37
+ const nsPrefix = ns.replace(/\\$/, '');
38
+ if (raw.startsWith(nsPrefix)) {
39
+ const rest = raw.slice(nsPrefix.length).replace(/\\/g, '/');
40
+ const candidate = join(root, dir, rest) + '.php';
41
+ if (existsSync(candidate))
42
+ return relative(root, candidate).replace(/\\/g, '/');
43
+ }
44
+ }
45
+ // Fallback: try direct path mapping
46
+ const filePath = raw.replace(/\\/g, '/') + '.php';
47
+ const candidate = join(root, filePath);
48
+ if (existsSync(candidate))
49
+ return relative(root, candidate).replace(/\\/g, '/');
50
+ return null;
51
+ },
52
+ };
53
+ export default spec;
54
+ //# sourceMappingURL=lang-php.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-php.js","sourceRoot":"","sources":["../../src/parser/lang-php.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,IAAI,GAAa;IACrB,EAAE,EAAE,KAAK;IACT,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,QAAQ,EAAE,iBAAiB;IAC3B,OAAO,EAAE;QACP,SAAS,EAAE,+CAA+C;QAC1D,OAAO,EAAE,6CAA6C;QACtD,UAAU,EAAE,iDAAiD;QAC7D,OAAO,EAAE,8CAA8C;QACvD,OAAO,EAAE;;WAEF;QACP,KAAK,EAAE;;;;;;;KAON;QACD,QAAQ,EAAE;;;;;;;;;MASR;KACH;IACD,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO;QACzC,4EAA4E;QAC5E,KAAK,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACvC,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC;gBACjD,IAAI,UAAU,CAAC,SAAS,CAAC;oBAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;QACD,oCAAoC;QACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;QAClD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACvC,IAAI,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { LangSpec } from './extract.js';
2
+ declare const spec: LangSpec;
3
+ export default spec;
4
+ //# sourceMappingURL=lang-py.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-py.d.ts","sourceRoot":"","sources":["../../src/parser/lang-py.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,QA2CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { join, relative } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ const spec = {
4
+ id: 'python',
5
+ extensions: ['.py'],
6
+ wasmName: 'tree-sitter-python',
7
+ queries: {
8
+ functions: `(module (function_definition name: (identifier) @name) @def)`,
9
+ classes: `(class_definition name: (identifier) @name) @def`,
10
+ methods: `(class_definition body: (block (function_definition name: (identifier) @name) @def))`,
11
+ imports: `[
12
+ (import_from_statement
13
+ module_name: (dotted_name) @source
14
+ ) @def
15
+ (import_statement
16
+ name: (dotted_name) @source
17
+ ) @def
18
+ ]`,
19
+ calls: `
20
+ (call function: (identifier) @callee) @def
21
+ (call function: (attribute attribute: (identifier) @callee)) @def
22
+ `,
23
+ heritage: `(class_definition
24
+ name: (identifier) @child
25
+ superclasses: (argument_list (identifier) @parent)
26
+ ) @def`,
27
+ },
28
+ resolveImport(raw, fromFile, root, _aliases) {
29
+ // Convert dotted path: models.user → models/user
30
+ const parts = raw.split('.');
31
+ const candidates = [
32
+ join(root, ...parts) + '.py',
33
+ join(root, ...parts, '__init__.py'),
34
+ ];
35
+ // Also try relative to current file
36
+ const fromDir = join(root, fromFile, '..');
37
+ candidates.push(join(fromDir, ...parts) + '.py', join(fromDir, ...parts, '__init__.py'));
38
+ for (const p of candidates) {
39
+ if (existsSync(p))
40
+ return relative(root, p).replace(/\\/g, '/');
41
+ }
42
+ return null;
43
+ },
44
+ };
45
+ export default spec;
46
+ //# sourceMappingURL=lang-py.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-py.js","sourceRoot":"","sources":["../../src/parser/lang-py.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,IAAI,GAAa;IACrB,EAAE,EAAE,QAAQ;IACZ,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,QAAQ,EAAE,oBAAoB;IAC9B,OAAO,EAAE;QACP,SAAS,EAAE,8DAA8D;QACzE,OAAO,EAAE,kDAAkD;QAC3D,OAAO,EAAE,sFAAsF;QAC/F,OAAO,EAAE;;;;;;;MAOP;QACF,KAAK,EAAE;;;KAGN;QACD,QAAQ,EAAE;;;WAGH;KACR;IACD,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ;QACzC,iDAAiD;QACjD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,MAAM,UAAU,GAAG;YACjB,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,KAAK;YAC5B,IAAI,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,aAAa,CAAC;SACpC,CAAC;QACF,oCAAoC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC3C,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,GAAG,KAAK,EAC/B,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,EAAE,aAAa,CAAC,CACvC,CAAC;QACF,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YAC3B,IAAI,UAAU,CAAC,CAAC,CAAC;gBAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { LangSpec } from './extract.js';
2
+ declare const spec: LangSpec;
3
+ export default spec;
4
+ //# sourceMappingURL=lang-rust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-rust.d.ts","sourceRoot":"","sources":["../../src/parser/lang-rust.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,QA8CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { join, relative } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ const spec = {
4
+ id: 'rust',
5
+ extensions: ['.rs'],
6
+ wasmName: 'tree-sitter-rust',
7
+ queries: {
8
+ functions: `(function_item name: (identifier) @name) @def`,
9
+ structs: `(struct_item name: (type_identifier) @name) @def`,
10
+ enums: `(enum_item name: (type_identifier) @name) @def`,
11
+ traits: `(trait_item name: (type_identifier) @name) @def`,
12
+ methods: `(impl_item
13
+ body: (declaration_list
14
+ (function_item name: (identifier) @name) @def
15
+ )
16
+ )`,
17
+ imports: `(use_declaration
18
+ argument: [
19
+ (scoped_identifier) @source
20
+ (use_as_clause path: (scoped_identifier) @source)
21
+ (scoped_use_list path: (scoped_identifier) @source)
22
+ ]
23
+ ) @def`,
24
+ calls: `
25
+ (call_expression function: (identifier) @callee) @def
26
+ (call_expression function: (scoped_identifier name: (identifier) @callee)) @def
27
+ (call_expression function: (field_expression field: (field_identifier) @callee)) @def
28
+ `,
29
+ heritage: `(impl_item
30
+ trait: (type_identifier) @parent
31
+ type: (type_identifier) @child
32
+ ) @def`,
33
+ },
34
+ resolveImport(raw, _fromFile, root, _aliases) {
35
+ // Rust use: crate::module::item → src/module.rs or src/module/mod.rs
36
+ if (!raw.startsWith('crate'))
37
+ return null;
38
+ const parts = raw.replace('crate::', '').split('::');
39
+ parts.pop(); // last part is usually the item, not the file
40
+ if (parts.length === 0)
41
+ return null;
42
+ const candidates = [
43
+ join(root, 'src', ...parts) + '.rs',
44
+ join(root, 'src', ...parts, 'mod.rs'),
45
+ ];
46
+ for (const p of candidates) {
47
+ if (existsSync(p))
48
+ return relative(root, p).replace(/\\/g, '/');
49
+ }
50
+ return null;
51
+ },
52
+ };
53
+ export default spec;
54
+ //# sourceMappingURL=lang-rust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-rust.js","sourceRoot":"","sources":["../../src/parser/lang-rust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,IAAI,GAAa;IACrB,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,QAAQ,EAAE,kBAAkB;IAC5B,OAAO,EAAE;QACP,SAAS,EAAE,+CAA+C;QAC1D,OAAO,EAAE,kDAAkD;QAC3D,KAAK,EAAE,gDAAgD;QACvD,MAAM,EAAE,iDAAiD;QACzD,OAAO,EAAE;;;;MAIP;QACF,OAAO,EAAE;;;;;;WAMF;QACP,KAAK,EAAE;;;;KAIN;QACD,QAAQ,EAAE;;;WAGH;KACR;IACD,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ;QAC1C,qEAAqE;QACrE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAC;QAC1C,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrD,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,8CAA8C;QAC3D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;QACpC,MAAM,UAAU,GAAG;YACjB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,KAAK;YACnC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,QAAQ,CAAC;SACtC,CAAC;QACF,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YAC3B,IAAI,UAAU,CAAC,CAAC,CAAC;gBAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { LangSpec } from './extract.js';
2
+ declare const spec: LangSpec;
3
+ export default spec;
4
+ //# sourceMappingURL=lang-ts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-ts.d.ts","sourceRoot":"","sources":["../../src/parser/lang-ts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,QAAA,MAAM,IAAI,EAAE,QAoFX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { join, dirname, relative } from 'node:path';
2
+ import { existsSync } from 'node:fs';
3
+ const spec = {
4
+ id: 'typescript',
5
+ extensions: ['.ts', '.tsx'],
6
+ wasmName: 'tree-sitter-tsx',
7
+ queries: {
8
+ functions: `[
9
+ (function_declaration name: (identifier) @name) @def
10
+ (lexical_declaration
11
+ (variable_declarator
12
+ name: (identifier) @name
13
+ value: (arrow_function)
14
+ )
15
+ ) @def
16
+ ]`,
17
+ classes: `(class_declaration name: (type_identifier) @name) @def`,
18
+ methods: `(method_definition name: (property_identifier) @name) @def`,
19
+ interfaces: `(interface_declaration name: (type_identifier) @name) @def`,
20
+ enums: `(enum_declaration name: (identifier) @name) @def`,
21
+ imports: `(import_statement
22
+ source: (string (string_fragment) @source)
23
+ ) @def`,
24
+ exports: `[
25
+ (export_statement
26
+ declaration: (function_declaration name: (identifier) @name)
27
+ )
28
+ (export_statement
29
+ declaration: (class_declaration name: (type_identifier) @name)
30
+ )
31
+ (export_statement
32
+ declaration: (interface_declaration name: (type_identifier) @name)
33
+ )
34
+ (export_statement
35
+ declaration: (enum_declaration name: (identifier) @name)
36
+ )
37
+ (export_statement
38
+ declaration: (lexical_declaration
39
+ (variable_declarator name: (identifier) @name)
40
+ )
41
+ )
42
+ (export_statement
43
+ (export_clause (export_specifier name: (identifier) @name))
44
+ )
45
+ ]`,
46
+ calls: `
47
+ (call_expression function: (identifier) @callee) @def
48
+ (call_expression function: (member_expression property: (property_identifier) @callee)) @def
49
+ `,
50
+ heritage: `[
51
+ (class_declaration
52
+ name: (type_identifier) @child
53
+ (class_heritage (extends_clause value: (identifier) @parent))
54
+ ) @def
55
+ (class_declaration
56
+ name: (type_identifier) @child
57
+ (class_heritage (implements_clause (type_identifier) @parent))
58
+ ) @def
59
+ ]`,
60
+ },
61
+ resolveImport(raw, fromFile, root, aliases) {
62
+ // Check aliases first (e.g. @ → src)
63
+ for (const [alias, target] of Object.entries(aliases)) {
64
+ if (raw.startsWith(alias + '/') || raw === alias) {
65
+ raw = raw.replace(alias, target);
66
+ break;
67
+ }
68
+ }
69
+ // Skip bare module specifiers (node_modules)
70
+ if (!raw.startsWith('.') && !raw.startsWith('/'))
71
+ return null;
72
+ const dir = dirname(join(root, fromFile));
73
+ const base = join(dir, raw);
74
+ const candidates = [
75
+ base + '.ts', base + '.tsx',
76
+ base + '.js', base + '.jsx',
77
+ join(base, 'index.ts'), join(base, 'index.tsx'),
78
+ join(base, 'index.js'),
79
+ ];
80
+ for (const p of candidates) {
81
+ if (existsSync(p))
82
+ return relative(root, p).replace(/\\/g, '/');
83
+ }
84
+ return null;
85
+ },
86
+ };
87
+ export default spec;
88
+ //# sourceMappingURL=lang-ts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-ts.js","sourceRoot":"","sources":["../../src/parser/lang-ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,MAAM,IAAI,GAAa;IACrB,EAAE,EAAE,YAAY;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,iBAAiB;IAC3B,OAAO,EAAE;QACP,SAAS,EAAE;;;;;;;;MAQT;QACF,OAAO,EAAE,wDAAwD;QACjE,OAAO,EAAE,4DAA4D;QACrE,UAAU,EAAE,4DAA4D;QACxE,KAAK,EAAE,kDAAkD;QACzD,OAAO,EAAE;;WAEF;QACP,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;MAqBP;QACF,KAAK,EAAE;;;KAGN;QACD,QAAQ,EAAE;;;;;;;;;MASR;KACH;IACD,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;QACxC,qCAAqC;QACrC,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACtD,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;gBACjD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACjC,MAAM;YACR,CAAC;QACH,CAAC;QAED,6CAA6C;QAC7C,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAE9D,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5B,MAAM,UAAU,GAAG;YACjB,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM;YAC3B,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,MAAM;YAC3B,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC;YAC/C,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;SACvB,CAAC;QAEF,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YAC3B,IAAI,UAAU,CAAC,CAAC,CAAC;gBAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { LangSpec } from './extract.js';
2
+ declare const spec: LangSpec;
3
+ /**
4
+ * Extract the <script> or <script setup> block content from a Vue SFC.
5
+ * Returns the script content and its starting line offset.
6
+ */
7
+ export declare function extractVueScript(source: string): {
8
+ content: string;
9
+ lineOffset: number;
10
+ } | null;
11
+ export default spec;
12
+ //# sourceMappingURL=lang-vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-vue.d.ts","sourceRoot":"","sources":["../../src/parser/lang-vue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI7C,QAAA,MAAM,IAAI,EAAE,QAMX,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAa/F;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,28 @@
1
+ import tsSpec from './lang-ts.js';
2
+ // Vue SFC: parse <script> or <script setup> blocks as TypeScript
3
+ const spec = {
4
+ id: 'vue',
5
+ extensions: ['.vue'],
6
+ wasmName: 'tree-sitter-tsx', // delegate to TS/TSX parser for script content
7
+ queries: tsSpec.queries, // reuse TS queries on extracted script block
8
+ resolveImport: tsSpec.resolveImport,
9
+ };
10
+ /**
11
+ * Extract the <script> or <script setup> block content from a Vue SFC.
12
+ * Returns the script content and its starting line offset.
13
+ */
14
+ export function extractVueScript(source) {
15
+ // Match <script ...> ... </script> — prefer <script setup> if present
16
+ const setupMatch = source.match(/<script\s+setup[^>]*>([\s\S]*?)<\/script>/i);
17
+ const regularMatch = source.match(/<script(?:\s+lang="(?:ts|typescript)")?[^>]*>([\s\S]*?)<\/script>/i);
18
+ const match = setupMatch ?? regularMatch;
19
+ if (!match)
20
+ return null;
21
+ const fullMatchStart = source.indexOf(match[0]);
22
+ const tagEnd = match[0].indexOf('>') + 1;
23
+ const contentStart = fullMatchStart + tagEnd;
24
+ const lineOffset = source.slice(0, contentStart).split('\n').length - 1;
25
+ return { content: match[1], lineOffset };
26
+ }
27
+ export default spec;
28
+ //# sourceMappingURL=lang-vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lang-vue.js","sourceRoot":"","sources":["../../src/parser/lang-vue.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,iEAAiE;AACjE,MAAM,IAAI,GAAa;IACrB,EAAE,EAAE,KAAK;IACT,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,QAAQ,EAAE,iBAAiB,EAAE,+CAA+C;IAC5E,OAAO,EAAE,MAAM,CAAC,OAAO,EAAM,6CAA6C;IAC1E,aAAa,EAAE,MAAM,CAAC,aAAa;CACpC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,sEAAsE;IACtE,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAC9E,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;IACxG,MAAM,KAAK,GAAG,UAAU,IAAI,YAAY,CAAC;IACzC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,MAAM,YAAY,GAAG,cAAc,GAAG,MAAM,CAAC;IAC7C,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAExE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { LangSpec } from './extract.js';
2
+ declare const ALL_LANGS: LangSpec[];
3
+ export declare function langForFile(filePath: string): LangSpec | undefined;
4
+ export declare function supportedExtensions(): string[];
5
+ export { ALL_LANGS };
6
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/parser/languages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAU7C,QAAA,MAAM,SAAS,EAAE,QAAQ,EAA2E,CAAC;AASrG,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAGlE;AAED,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import tsSpec from './lang-ts.js';
2
+ import jsSpec from './lang-js.js';
3
+ import pySpec from './lang-py.js';
4
+ import javaSpec from './lang-java.js';
5
+ import goSpec from './lang-go.js';
6
+ import rustSpec from './lang-rust.js';
7
+ import phpSpec from './lang-php.js';
8
+ import vueSpec from './lang-vue.js';
9
+ const ALL_LANGS = [tsSpec, jsSpec, pySpec, javaSpec, goSpec, rustSpec, phpSpec, vueSpec];
10
+ const byExtension = new Map();
11
+ for (const lang of ALL_LANGS) {
12
+ for (const ext of lang.extensions) {
13
+ byExtension.set(ext, lang);
14
+ }
15
+ }
16
+ export function langForFile(filePath) {
17
+ const ext = '.' + filePath.split('.').pop()?.toLowerCase();
18
+ return byExtension.get(ext);
19
+ }
20
+ export function supportedExtensions() {
21
+ return [...byExtension.keys()];
22
+ }
23
+ export { ALL_LANGS };
24
+ //# sourceMappingURL=languages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.js","sourceRoot":"","sources":["../../src/parser/languages.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,MAAM,SAAS,GAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAErG,MAAM,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAC;AAChD,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,MAAM,GAAG,GAAG,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAC;IAC3D,OAAO,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import Parser from 'web-tree-sitter';
2
+ export declare function initTreeSitter(): Promise<void>;
3
+ export declare function loadLanguage(wasmName: string): Promise<Parser.Language>;
4
+ export declare function getParser(wasmName: string): Promise<Parser>;
5
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/parser/loader.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAarC,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAIpD;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAS7E;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASjE"}
@@ -0,0 +1,37 @@
1
+ import Parser from 'web-tree-sitter';
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+ let initialized = false;
5
+ const parserCache = new Map();
6
+ const langCache = new Map();
7
+ function wasmDir() {
8
+ const req = createRequire(import.meta.url);
9
+ return join(dirname(req.resolve('tree-sitter-wasms/package.json')), 'out');
10
+ }
11
+ export async function initTreeSitter() {
12
+ if (initialized)
13
+ return;
14
+ await Parser.init();
15
+ initialized = true;
16
+ }
17
+ export async function loadLanguage(wasmName) {
18
+ const cached = langCache.get(wasmName);
19
+ if (cached)
20
+ return cached;
21
+ await initTreeSitter();
22
+ const wasmPath = join(wasmDir(), `${wasmName}.wasm`);
23
+ const lang = await Parser.Language.load(wasmPath);
24
+ langCache.set(wasmName, lang);
25
+ return lang;
26
+ }
27
+ export async function getParser(wasmName) {
28
+ const cached = parserCache.get(wasmName);
29
+ if (cached)
30
+ return cached;
31
+ const lang = await loadLanguage(wasmName);
32
+ const parser = new Parser();
33
+ parser.setLanguage(lang);
34
+ parserCache.set(wasmName, parser);
35
+ return parser;
36
+ }
37
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/parser/loader.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;AAC9C,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;AAErD,SAAS,OAAO;IACd,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,IAAI,WAAW;QAAE,OAAO;IACxB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACpB,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,cAAc,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,GAAG,QAAQ,OAAO,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAgB;IAC9C,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function createMcpServer(rootPath?: string): McpServer;
3
+ export declare function startStdio(rootPath?: string): Promise<void>;
4
+ export declare function startHttp(port: number, rootPath?: string): Promise<void>;
5
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/server/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAmEpE,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAwS5D;AAID,wBAAsB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjE;AAID,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC9E"}