driftdetect-core 0.1.2 → 0.3.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 (193) hide show
  1. package/dist/boundaries/boundary-store.d.ts +92 -0
  2. package/dist/boundaries/boundary-store.d.ts.map +1 -0
  3. package/dist/boundaries/boundary-store.js +458 -0
  4. package/dist/boundaries/boundary-store.js.map +1 -0
  5. package/dist/boundaries/index.d.ts +8 -0
  6. package/dist/boundaries/index.d.ts.map +1 -0
  7. package/dist/boundaries/index.js +8 -0
  8. package/dist/boundaries/index.js.map +1 -0
  9. package/dist/boundaries/types.d.ts +237 -0
  10. package/dist/boundaries/types.d.ts.map +1 -0
  11. package/dist/boundaries/types.js +8 -0
  12. package/dist/boundaries/types.js.map +1 -0
  13. package/dist/dna/ai-context.d.ts +10 -0
  14. package/dist/dna/ai-context.d.ts.map +1 -0
  15. package/dist/dna/ai-context.js +46 -0
  16. package/dist/dna/ai-context.js.map +1 -0
  17. package/dist/dna/dna-analyzer.d.ts +34 -0
  18. package/dist/dna/dna-analyzer.d.ts.map +1 -0
  19. package/dist/dna/dna-analyzer.js +110 -0
  20. package/dist/dna/dna-analyzer.js.map +1 -0
  21. package/dist/dna/dna-store.d.ts +13 -0
  22. package/dist/dna/dna-store.d.ts.map +1 -0
  23. package/dist/dna/dna-store.js +43 -0
  24. package/dist/dna/dna-store.js.map +1 -0
  25. package/dist/dna/gene-extractors/animation-approach.d.ts +15 -0
  26. package/dist/dna/gene-extractors/animation-approach.d.ts.map +1 -0
  27. package/dist/dna/gene-extractors/animation-approach.js +97 -0
  28. package/dist/dna/gene-extractors/animation-approach.js.map +1 -0
  29. package/dist/dna/gene-extractors/base-extractor.d.ts +53 -0
  30. package/dist/dna/gene-extractors/base-extractor.d.ts.map +1 -0
  31. package/dist/dna/gene-extractors/base-extractor.js +76 -0
  32. package/dist/dna/gene-extractors/base-extractor.js.map +1 -0
  33. package/dist/dna/gene-extractors/index.d.ts +16 -0
  34. package/dist/dna/gene-extractors/index.d.ts.map +1 -0
  35. package/dist/dna/gene-extractors/index.js +38 -0
  36. package/dist/dna/gene-extractors/index.js.map +1 -0
  37. package/dist/dna/gene-extractors/responsive-approach.d.ts +10 -0
  38. package/dist/dna/gene-extractors/responsive-approach.d.ts.map +1 -0
  39. package/dist/dna/gene-extractors/responsive-approach.js +30 -0
  40. package/dist/dna/gene-extractors/responsive-approach.js.map +1 -0
  41. package/dist/dna/gene-extractors/spacing-philosophy.d.ts +10 -0
  42. package/dist/dna/gene-extractors/spacing-philosophy.d.ts.map +1 -0
  43. package/dist/dna/gene-extractors/spacing-philosophy.js +30 -0
  44. package/dist/dna/gene-extractors/spacing-philosophy.js.map +1 -0
  45. package/dist/dna/gene-extractors/state-styling.d.ts +10 -0
  46. package/dist/dna/gene-extractors/state-styling.d.ts.map +1 -0
  47. package/dist/dna/gene-extractors/state-styling.js +29 -0
  48. package/dist/dna/gene-extractors/state-styling.js.map +1 -0
  49. package/dist/dna/gene-extractors/theming.d.ts +10 -0
  50. package/dist/dna/gene-extractors/theming.d.ts.map +1 -0
  51. package/dist/dna/gene-extractors/theming.js +30 -0
  52. package/dist/dna/gene-extractors/theming.js.map +1 -0
  53. package/dist/dna/gene-extractors/variant-handling.d.ts +13 -0
  54. package/dist/dna/gene-extractors/variant-handling.d.ts.map +1 -0
  55. package/dist/dna/gene-extractors/variant-handling.js +38 -0
  56. package/dist/dna/gene-extractors/variant-handling.js.map +1 -0
  57. package/dist/dna/health-calculator.d.ts +21 -0
  58. package/dist/dna/health-calculator.d.ts.map +1 -0
  59. package/dist/dna/health-calculator.js +113 -0
  60. package/dist/dna/health-calculator.js.map +1 -0
  61. package/dist/dna/index.d.ts +21 -0
  62. package/dist/dna/index.d.ts.map +1 -0
  63. package/dist/dna/index.js +19 -0
  64. package/dist/dna/index.js.map +1 -0
  65. package/dist/dna/mutation-detector.d.ts +10 -0
  66. package/dist/dna/mutation-detector.d.ts.map +1 -0
  67. package/dist/dna/mutation-detector.js +39 -0
  68. package/dist/dna/mutation-detector.js.map +1 -0
  69. package/dist/dna/playbook-generator.d.ts +6 -0
  70. package/dist/dna/playbook-generator.d.ts.map +1 -0
  71. package/dist/dna/playbook-generator.js +53 -0
  72. package/dist/dna/playbook-generator.js.map +1 -0
  73. package/dist/dna/types.d.ts +95 -0
  74. package/dist/dna/types.d.ts.map +1 -0
  75. package/dist/dna/types.js +8 -0
  76. package/dist/dna/types.js.map +1 -0
  77. package/dist/index.d.ts +7 -0
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +10 -0
  80. package/dist/index.js.map +1 -1
  81. package/dist/parsers/parser-manager.d.ts.map +1 -1
  82. package/dist/parsers/parser-manager.js +2 -0
  83. package/dist/parsers/parser-manager.js.map +1 -1
  84. package/dist/parsers/tree-sitter/config.d.ts +82 -0
  85. package/dist/parsers/tree-sitter/config.d.ts.map +1 -0
  86. package/dist/parsers/tree-sitter/config.js +200 -0
  87. package/dist/parsers/tree-sitter/config.js.map +1 -0
  88. package/dist/parsers/tree-sitter/csharp-ast-converter.d.ts +64 -0
  89. package/dist/parsers/tree-sitter/csharp-ast-converter.d.ts.map +1 -0
  90. package/dist/parsers/tree-sitter/csharp-ast-converter.js +271 -0
  91. package/dist/parsers/tree-sitter/csharp-ast-converter.js.map +1 -0
  92. package/dist/parsers/tree-sitter/csharp-loader.d.ts +43 -0
  93. package/dist/parsers/tree-sitter/csharp-loader.d.ts.map +1 -0
  94. package/dist/parsers/tree-sitter/csharp-loader.js +146 -0
  95. package/dist/parsers/tree-sitter/csharp-loader.js.map +1 -0
  96. package/dist/parsers/tree-sitter/index.d.ts +26 -0
  97. package/dist/parsers/tree-sitter/index.d.ts.map +1 -0
  98. package/dist/parsers/tree-sitter/index.js +47 -0
  99. package/dist/parsers/tree-sitter/index.js.map +1 -0
  100. package/dist/parsers/tree-sitter/java/annotation-extractor.d.ts +79 -0
  101. package/dist/parsers/tree-sitter/java/annotation-extractor.d.ts.map +1 -0
  102. package/dist/parsers/tree-sitter/java/annotation-extractor.js +540 -0
  103. package/dist/parsers/tree-sitter/java/annotation-extractor.js.map +1 -0
  104. package/dist/parsers/tree-sitter/java/class-extractor.d.ts +40 -0
  105. package/dist/parsers/tree-sitter/java/class-extractor.d.ts.map +1 -0
  106. package/dist/parsers/tree-sitter/java/class-extractor.js +770 -0
  107. package/dist/parsers/tree-sitter/java/class-extractor.js.map +1 -0
  108. package/dist/parsers/tree-sitter/java/index.d.ts +14 -0
  109. package/dist/parsers/tree-sitter/java/index.d.ts.map +1 -0
  110. package/dist/parsers/tree-sitter/java/index.js +25 -0
  111. package/dist/parsers/tree-sitter/java/index.js.map +1 -0
  112. package/dist/parsers/tree-sitter/java/method-extractor.d.ts +88 -0
  113. package/dist/parsers/tree-sitter/java/method-extractor.d.ts.map +1 -0
  114. package/dist/parsers/tree-sitter/java/method-extractor.js +551 -0
  115. package/dist/parsers/tree-sitter/java/method-extractor.js.map +1 -0
  116. package/dist/parsers/tree-sitter/java/types.d.ts +545 -0
  117. package/dist/parsers/tree-sitter/java/types.d.ts.map +1 -0
  118. package/dist/parsers/tree-sitter/java/types.js +81 -0
  119. package/dist/parsers/tree-sitter/java/types.js.map +1 -0
  120. package/dist/parsers/tree-sitter/loader.d.ts +50 -0
  121. package/dist/parsers/tree-sitter/loader.d.ts.map +1 -0
  122. package/dist/parsers/tree-sitter/loader.js +156 -0
  123. package/dist/parsers/tree-sitter/loader.js.map +1 -0
  124. package/dist/parsers/tree-sitter/pydantic/config-extractor.d.ts +78 -0
  125. package/dist/parsers/tree-sitter/pydantic/config-extractor.d.ts.map +1 -0
  126. package/dist/parsers/tree-sitter/pydantic/config-extractor.js +278 -0
  127. package/dist/parsers/tree-sitter/pydantic/config-extractor.js.map +1 -0
  128. package/dist/parsers/tree-sitter/pydantic/constraint-parser.d.ts +84 -0
  129. package/dist/parsers/tree-sitter/pydantic/constraint-parser.d.ts.map +1 -0
  130. package/dist/parsers/tree-sitter/pydantic/constraint-parser.js +321 -0
  131. package/dist/parsers/tree-sitter/pydantic/constraint-parser.js.map +1 -0
  132. package/dist/parsers/tree-sitter/pydantic/field-extractor.d.ts +74 -0
  133. package/dist/parsers/tree-sitter/pydantic/field-extractor.d.ts.map +1 -0
  134. package/dist/parsers/tree-sitter/pydantic/field-extractor.js +285 -0
  135. package/dist/parsers/tree-sitter/pydantic/field-extractor.js.map +1 -0
  136. package/dist/parsers/tree-sitter/pydantic/index.d.ts +18 -0
  137. package/dist/parsers/tree-sitter/pydantic/index.d.ts.map +1 -0
  138. package/dist/parsers/tree-sitter/pydantic/index.js +23 -0
  139. package/dist/parsers/tree-sitter/pydantic/index.js.map +1 -0
  140. package/dist/parsers/tree-sitter/pydantic/inheritance-resolver.d.ts +70 -0
  141. package/dist/parsers/tree-sitter/pydantic/inheritance-resolver.d.ts.map +1 -0
  142. package/dist/parsers/tree-sitter/pydantic/inheritance-resolver.js +251 -0
  143. package/dist/parsers/tree-sitter/pydantic/inheritance-resolver.js.map +1 -0
  144. package/dist/parsers/tree-sitter/pydantic/pydantic-extractor.d.ts +102 -0
  145. package/dist/parsers/tree-sitter/pydantic/pydantic-extractor.d.ts.map +1 -0
  146. package/dist/parsers/tree-sitter/pydantic/pydantic-extractor.js +399 -0
  147. package/dist/parsers/tree-sitter/pydantic/pydantic-extractor.js.map +1 -0
  148. package/dist/parsers/tree-sitter/pydantic/type-resolver.d.ts +89 -0
  149. package/dist/parsers/tree-sitter/pydantic/type-resolver.d.ts.map +1 -0
  150. package/dist/parsers/tree-sitter/pydantic/type-resolver.js +426 -0
  151. package/dist/parsers/tree-sitter/pydantic/type-resolver.js.map +1 -0
  152. package/dist/parsers/tree-sitter/pydantic/types.d.ts +177 -0
  153. package/dist/parsers/tree-sitter/pydantic/types.d.ts.map +1 -0
  154. package/dist/parsers/tree-sitter/pydantic/types.js +139 -0
  155. package/dist/parsers/tree-sitter/pydantic/types.js.map +1 -0
  156. package/dist/parsers/tree-sitter/pydantic/validator-extractor.d.ts +88 -0
  157. package/dist/parsers/tree-sitter/pydantic/validator-extractor.d.ts.map +1 -0
  158. package/dist/parsers/tree-sitter/pydantic/validator-extractor.js +315 -0
  159. package/dist/parsers/tree-sitter/pydantic/validator-extractor.js.map +1 -0
  160. package/dist/parsers/tree-sitter/python-ast-converter.d.ts +140 -0
  161. package/dist/parsers/tree-sitter/python-ast-converter.d.ts.map +1 -0
  162. package/dist/parsers/tree-sitter/python-ast-converter.js +360 -0
  163. package/dist/parsers/tree-sitter/python-ast-converter.js.map +1 -0
  164. package/dist/parsers/tree-sitter/tree-sitter-csharp-parser.d.ts +465 -0
  165. package/dist/parsers/tree-sitter/tree-sitter-csharp-parser.d.ts.map +1 -0
  166. package/dist/parsers/tree-sitter/tree-sitter-csharp-parser.js +1146 -0
  167. package/dist/parsers/tree-sitter/tree-sitter-csharp-parser.js.map +1 -0
  168. package/dist/parsers/tree-sitter/tree-sitter-python-parser.d.ts +86 -0
  169. package/dist/parsers/tree-sitter/tree-sitter-python-parser.d.ts.map +1 -0
  170. package/dist/parsers/tree-sitter/tree-sitter-python-parser.js +177 -0
  171. package/dist/parsers/tree-sitter/tree-sitter-python-parser.js.map +1 -0
  172. package/dist/parsers/tree-sitter/types.d.ts +399 -0
  173. package/dist/parsers/tree-sitter/types.d.ts.map +1 -0
  174. package/dist/parsers/tree-sitter/types.js +20 -0
  175. package/dist/parsers/tree-sitter/types.js.map +1 -0
  176. package/dist/parsers/types.d.ts +1 -1
  177. package/dist/parsers/types.d.ts.map +1 -1
  178. package/dist/scanner/file-walker.d.ts.map +1 -1
  179. package/dist/scanner/file-walker.js +5 -0
  180. package/dist/scanner/file-walker.js.map +1 -1
  181. package/dist/store/history-store.d.ts +85 -269
  182. package/dist/store/history-store.d.ts.map +1 -1
  183. package/dist/store/history-store.js +272 -624
  184. package/dist/store/history-store.js.map +1 -1
  185. package/dist/types/index.d.ts +1 -0
  186. package/dist/types/index.d.ts.map +1 -1
  187. package/dist/types/index.js +2 -0
  188. package/dist/types/index.js.map +1 -1
  189. package/dist/types/java-type-mapping.d.ts +79 -0
  190. package/dist/types/java-type-mapping.d.ts.map +1 -0
  191. package/dist/types/java-type-mapping.js +290 -0
  192. package/dist/types/java-type-mapping.js.map +1 -0
  193. package/package.json +8 -3
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Python AST Converter
3
+ *
4
+ * Converts tree-sitter AST nodes to drift's ASTNode format.
5
+ * Preserves position information and handles all Python node types.
6
+ *
7
+ * @requirements 3.5 - Unified AST query interface
8
+ */
9
+ import type { ASTNode, AST, Position } from '../types.js';
10
+ import type { TreeSitterNode, TreeSitterTree, TreeSitterPoint } from './types.js';
11
+ /**
12
+ * Options for AST conversion.
13
+ */
14
+ export interface ConversionOptions {
15
+ /** Whether to include anonymous nodes */
16
+ includeAnonymous: boolean;
17
+ /** Whether to include comment nodes */
18
+ includeComments: boolean;
19
+ /** Maximum depth to traverse (0 = unlimited) */
20
+ maxDepth: number;
21
+ /** Node types to skip */
22
+ skipTypes: Set<string>;
23
+ }
24
+ /**
25
+ * Default conversion options.
26
+ */
27
+ export declare const DEFAULT_CONVERSION_OPTIONS: ConversionOptions;
28
+ /**
29
+ * Convert a tree-sitter point to drift Position.
30
+ *
31
+ * @param point - Tree-sitter point
32
+ * @returns Drift Position
33
+ */
34
+ export declare function convertPoint(point: TreeSitterPoint): Position;
35
+ /**
36
+ * Convert a tree-sitter node type to drift node type.
37
+ *
38
+ * @param treeSitterType - Tree-sitter node type
39
+ * @returns Drift node type
40
+ */
41
+ export declare function convertNodeType(treeSitterType: string): string;
42
+ /**
43
+ * Python AST Converter class.
44
+ *
45
+ * Converts tree-sitter Python AST to drift's unified AST format.
46
+ */
47
+ export declare class PythonASTConverter {
48
+ private readonly options;
49
+ constructor(options?: Partial<ConversionOptions>);
50
+ /**
51
+ * Convert a tree-sitter tree to drift AST.
52
+ *
53
+ * @param tree - Tree-sitter tree
54
+ * @param source - Original source code
55
+ * @returns Drift AST
56
+ */
57
+ convertTree(tree: TreeSitterTree, source: string): AST;
58
+ /**
59
+ * Convert a tree-sitter node to drift ASTNode.
60
+ *
61
+ * @param node - Tree-sitter node
62
+ * @param source - Original source code
63
+ * @param depth - Current depth in the tree
64
+ * @returns Drift ASTNode
65
+ */
66
+ convertNode(node: TreeSitterNode, source: string, depth?: number): ASTNode;
67
+ /**
68
+ * Create a leaf node (no children converted).
69
+ */
70
+ private createLeafNode;
71
+ /**
72
+ * Create an error placeholder node.
73
+ */
74
+ private createErrorNode;
75
+ /**
76
+ * Convert a specific node by field name.
77
+ *
78
+ * @param node - Parent tree-sitter node
79
+ * @param fieldName - Field name to extract
80
+ * @param source - Original source code
81
+ * @param depth - Current depth
82
+ * @returns Converted node or null if field doesn't exist
83
+ */
84
+ convertField(node: TreeSitterNode, fieldName: string, source: string, depth?: number): ASTNode | null;
85
+ /**
86
+ * Convert all nodes for a field name.
87
+ *
88
+ * @param node - Parent tree-sitter node
89
+ * @param fieldName - Field name to extract
90
+ * @param source - Original source code
91
+ * @param depth - Current depth
92
+ * @returns Array of converted nodes
93
+ */
94
+ convertFieldAll(node: TreeSitterNode, fieldName: string, source: string, depth?: number): ASTNode[];
95
+ /**
96
+ * Find all nodes of a specific type in a tree-sitter tree.
97
+ *
98
+ * @param node - Root node to search from
99
+ * @param type - Node type to find
100
+ * @returns Array of matching tree-sitter nodes
101
+ */
102
+ findNodesByType(node: TreeSitterNode, type: string): TreeSitterNode[];
103
+ /**
104
+ * Find all nodes matching a predicate.
105
+ *
106
+ * @param node - Root node to search from
107
+ * @param predicate - Function to test each node
108
+ * @returns Array of matching tree-sitter nodes
109
+ */
110
+ findNodes(node: TreeSitterNode, predicate: (n: TreeSitterNode) => boolean): TreeSitterNode[];
111
+ /**
112
+ * Walk the tree and call a visitor for each node.
113
+ *
114
+ * @param node - Root node to walk from
115
+ * @param visitor - Function called for each node
116
+ */
117
+ walkTree(node: TreeSitterNode, visitor: (n: TreeSitterNode) => void): void;
118
+ /**
119
+ * Get the text of a specific field from a node.
120
+ *
121
+ * @param node - Tree-sitter node
122
+ * @param fieldName - Field name
123
+ * @returns Field text or null
124
+ */
125
+ getFieldText(node: TreeSitterNode, fieldName: string): string | null;
126
+ /**
127
+ * Extract function information from a function_definition node.
128
+ *
129
+ * @param node - Tree-sitter function_definition node
130
+ * @returns Function information object
131
+ */
132
+ extractFunctionInfo(node: TreeSitterNode): {
133
+ name: string;
134
+ parameters: string[];
135
+ returnType: string | null;
136
+ isAsync: boolean;
137
+ decorators: string[];
138
+ };
139
+ }
140
+ //# sourceMappingURL=python-ast-converter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-ast-converter.d.ts","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/python-ast-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAuHlF;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uCAAuC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,iBAKxC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,QAAQ,CAK7D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;gBAEhC,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAA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U,EAAE,MAAM,EAAE,CAAC;KACtB;CA8CF"}
@@ -0,0 +1,360 @@
1
+ /**
2
+ * Python AST Converter
3
+ *
4
+ * Converts tree-sitter AST nodes to drift's ASTNode format.
5
+ * Preserves position information and handles all Python node types.
6
+ *
7
+ * @requirements 3.5 - Unified AST query interface
8
+ */
9
+ /**
10
+ * Mapping of tree-sitter Python node types to drift node types.
11
+ * This provides semantic normalization across different parsers.
12
+ */
13
+ const NODE_TYPE_MAP = {
14
+ // Module level
15
+ module: 'Module',
16
+ // Imports
17
+ import_statement: 'Import',
18
+ import_from_statement: 'ImportFrom',
19
+ aliased_import: 'alias',
20
+ dotted_name: 'module',
21
+ relative_import: 'relative_import',
22
+ // Definitions
23
+ function_definition: 'FunctionDef',
24
+ async_function_definition: 'AsyncFunctionDef',
25
+ class_definition: 'ClassDef',
26
+ decorated_definition: 'decorated',
27
+ // Function components
28
+ parameters: 'arguments',
29
+ default_parameter: 'arg',
30
+ typed_parameter: 'arg',
31
+ typed_default_parameter: 'arg',
32
+ list_splat_pattern: 'arg',
33
+ dictionary_splat_pattern: 'arg',
34
+ keyword_separator: 'keyword_separator',
35
+ positional_separator: 'positional_separator',
36
+ // Statements
37
+ expression_statement: 'Expr',
38
+ return_statement: 'Return',
39
+ pass_statement: 'Pass',
40
+ break_statement: 'Break',
41
+ continue_statement: 'Continue',
42
+ raise_statement: 'Raise',
43
+ assert_statement: 'Assert',
44
+ global_statement: 'Global',
45
+ nonlocal_statement: 'Nonlocal',
46
+ delete_statement: 'Delete',
47
+ // Control flow
48
+ if_statement: 'If',
49
+ elif_clause: 'elif',
50
+ else_clause: 'else',
51
+ for_statement: 'For',
52
+ while_statement: 'While',
53
+ try_statement: 'Try',
54
+ except_clause: 'ExceptHandler',
55
+ finally_clause: 'finally',
56
+ with_statement: 'With',
57
+ with_clause: 'withitem',
58
+ match_statement: 'Match',
59
+ case_clause: 'match_case',
60
+ // Expressions
61
+ assignment: 'Assign',
62
+ augmented_assignment: 'AugAssign',
63
+ named_expression: 'NamedExpr',
64
+ binary_operator: 'BinOp',
65
+ unary_operator: 'UnaryOp',
66
+ comparison_operator: 'Compare',
67
+ boolean_operator: 'BoolOp',
68
+ not_operator: 'Not',
69
+ lambda: 'Lambda',
70
+ conditional_expression: 'IfExp',
71
+ await: 'Await',
72
+ yield: 'Yield',
73
+ // Subscripts and attributes
74
+ subscript: 'Subscript',
75
+ slice: 'Slice',
76
+ attribute: 'Attribute',
77
+ // Calls
78
+ call: 'Call',
79
+ argument_list: 'arguments',
80
+ keyword_argument: 'keyword',
81
+ // Comprehensions
82
+ list_comprehension: 'ListComp',
83
+ dictionary_comprehension: 'DictComp',
84
+ set_comprehension: 'SetComp',
85
+ generator_expression: 'GeneratorExp',
86
+ for_in_clause: 'comprehension',
87
+ if_clause: 'comp_if',
88
+ // Literals
89
+ string: 'Str',
90
+ concatenated_string: 'JoinedStr',
91
+ integer: 'Num',
92
+ float: 'Num',
93
+ true: 'NameConstant',
94
+ false: 'NameConstant',
95
+ none: 'NameConstant',
96
+ // Collections
97
+ list: 'List',
98
+ tuple: 'Tuple',
99
+ dictionary: 'Dict',
100
+ set: 'Set',
101
+ pair: 'dict_item',
102
+ // Identifiers and names
103
+ identifier: 'Name',
104
+ type: 'annotation',
105
+ // Decorators
106
+ decorator: 'decorator',
107
+ // Comments and docstrings
108
+ comment: 'Comment',
109
+ expression_statement_string: 'Docstring',
110
+ };
111
+ /**
112
+ * Default conversion options.
113
+ */
114
+ export const DEFAULT_CONVERSION_OPTIONS = {
115
+ includeAnonymous: false,
116
+ includeComments: true,
117
+ maxDepth: 0,
118
+ skipTypes: new Set(['ERROR']),
119
+ };
120
+ /**
121
+ * Convert a tree-sitter point to drift Position.
122
+ *
123
+ * @param point - Tree-sitter point
124
+ * @returns Drift Position
125
+ */
126
+ export function convertPoint(point) {
127
+ return {
128
+ row: point.row,
129
+ column: point.column,
130
+ };
131
+ }
132
+ /**
133
+ * Convert a tree-sitter node type to drift node type.
134
+ *
135
+ * @param treeSitterType - Tree-sitter node type
136
+ * @returns Drift node type
137
+ */
138
+ export function convertNodeType(treeSitterType) {
139
+ return NODE_TYPE_MAP[treeSitterType] ?? treeSitterType;
140
+ }
141
+ /**
142
+ * Python AST Converter class.
143
+ *
144
+ * Converts tree-sitter Python AST to drift's unified AST format.
145
+ */
146
+ export class PythonASTConverter {
147
+ options;
148
+ constructor(options = {}) {
149
+ this.options = { ...DEFAULT_CONVERSION_OPTIONS, ...options };
150
+ }
151
+ /**
152
+ * Convert a tree-sitter tree to drift AST.
153
+ *
154
+ * @param tree - Tree-sitter tree
155
+ * @param source - Original source code
156
+ * @returns Drift AST
157
+ */
158
+ convertTree(tree, source) {
159
+ const rootNode = this.convertNode(tree.rootNode, source, 0);
160
+ return {
161
+ rootNode,
162
+ text: source,
163
+ };
164
+ }
165
+ /**
166
+ * Convert a tree-sitter node to drift ASTNode.
167
+ *
168
+ * @param node - Tree-sitter node
169
+ * @param source - Original source code
170
+ * @param depth - Current depth in the tree
171
+ * @returns Drift ASTNode
172
+ */
173
+ convertNode(node, source, depth = 0) {
174
+ // Check depth limit
175
+ if (this.options.maxDepth > 0 && depth >= this.options.maxDepth) {
176
+ return this.createLeafNode(node, source);
177
+ }
178
+ // Skip certain node types
179
+ if (this.options.skipTypes.has(node.type)) {
180
+ return this.createErrorNode(node);
181
+ }
182
+ // Convert children
183
+ const children = [];
184
+ const childNodes = this.options.includeAnonymous ? node.children : node.namedChildren;
185
+ for (const child of childNodes) {
186
+ // Skip comments if not included
187
+ if (!this.options.includeComments && child.type === 'comment') {
188
+ continue;
189
+ }
190
+ // Skip error nodes
191
+ if (this.options.skipTypes.has(child.type)) {
192
+ continue;
193
+ }
194
+ children.push(this.convertNode(child, source, depth + 1));
195
+ }
196
+ return {
197
+ type: convertNodeType(node.type),
198
+ text: node.text,
199
+ startPosition: convertPoint(node.startPosition),
200
+ endPosition: convertPoint(node.endPosition),
201
+ children,
202
+ };
203
+ }
204
+ /**
205
+ * Create a leaf node (no children converted).
206
+ */
207
+ createLeafNode(node, _source) {
208
+ return {
209
+ type: convertNodeType(node.type),
210
+ text: node.text,
211
+ startPosition: convertPoint(node.startPosition),
212
+ endPosition: convertPoint(node.endPosition),
213
+ children: [],
214
+ };
215
+ }
216
+ /**
217
+ * Create an error placeholder node.
218
+ */
219
+ createErrorNode(node) {
220
+ return {
221
+ type: 'ERROR',
222
+ text: node.text,
223
+ startPosition: convertPoint(node.startPosition),
224
+ endPosition: convertPoint(node.endPosition),
225
+ children: [],
226
+ };
227
+ }
228
+ /**
229
+ * Convert a specific node by field name.
230
+ *
231
+ * @param node - Parent tree-sitter node
232
+ * @param fieldName - Field name to extract
233
+ * @param source - Original source code
234
+ * @param depth - Current depth
235
+ * @returns Converted node or null if field doesn't exist
236
+ */
237
+ convertField(node, fieldName, source, depth = 0) {
238
+ const fieldNode = node.childForFieldName(fieldName);
239
+ if (!fieldNode) {
240
+ return null;
241
+ }
242
+ return this.convertNode(fieldNode, source, depth);
243
+ }
244
+ /**
245
+ * Convert all nodes for a field name.
246
+ *
247
+ * @param node - Parent tree-sitter node
248
+ * @param fieldName - Field name to extract
249
+ * @param source - Original source code
250
+ * @param depth - Current depth
251
+ * @returns Array of converted nodes
252
+ */
253
+ convertFieldAll(node, fieldName, source, depth = 0) {
254
+ const fieldNodes = node.childrenForFieldName(fieldName);
255
+ return fieldNodes.map((n) => this.convertNode(n, source, depth));
256
+ }
257
+ /**
258
+ * Find all nodes of a specific type in a tree-sitter tree.
259
+ *
260
+ * @param node - Root node to search from
261
+ * @param type - Node type to find
262
+ * @returns Array of matching tree-sitter nodes
263
+ */
264
+ findNodesByType(node, type) {
265
+ const results = [];
266
+ this.walkTree(node, (n) => {
267
+ if (n.type === type) {
268
+ results.push(n);
269
+ }
270
+ });
271
+ return results;
272
+ }
273
+ /**
274
+ * Find all nodes matching a predicate.
275
+ *
276
+ * @param node - Root node to search from
277
+ * @param predicate - Function to test each node
278
+ * @returns Array of matching tree-sitter nodes
279
+ */
280
+ findNodes(node, predicate) {
281
+ const results = [];
282
+ this.walkTree(node, (n) => {
283
+ if (predicate(n)) {
284
+ results.push(n);
285
+ }
286
+ });
287
+ return results;
288
+ }
289
+ /**
290
+ * Walk the tree and call a visitor for each node.
291
+ *
292
+ * @param node - Root node to walk from
293
+ * @param visitor - Function called for each node
294
+ */
295
+ walkTree(node, visitor) {
296
+ visitor(node);
297
+ for (const child of node.children) {
298
+ this.walkTree(child, visitor);
299
+ }
300
+ }
301
+ /**
302
+ * Get the text of a specific field from a node.
303
+ *
304
+ * @param node - Tree-sitter node
305
+ * @param fieldName - Field name
306
+ * @returns Field text or null
307
+ */
308
+ getFieldText(node, fieldName) {
309
+ const fieldNode = node.childForFieldName(fieldName);
310
+ return fieldNode?.text ?? null;
311
+ }
312
+ /**
313
+ * Extract function information from a function_definition node.
314
+ *
315
+ * @param node - Tree-sitter function_definition node
316
+ * @returns Function information object
317
+ */
318
+ extractFunctionInfo(node) {
319
+ const name = this.getFieldText(node, 'name') ?? '';
320
+ const returnType = this.getFieldText(node, 'return_type');
321
+ const isAsync = node.type === 'async_function_definition';
322
+ // Extract parameters
323
+ const parameters = [];
324
+ const paramsNode = node.childForFieldName('parameters');
325
+ if (paramsNode) {
326
+ for (const child of paramsNode.namedChildren) {
327
+ if (child.type === 'identifier') {
328
+ parameters.push(child.text);
329
+ }
330
+ else if (child.type === 'typed_parameter' ||
331
+ child.type === 'default_parameter' ||
332
+ child.type === 'typed_default_parameter') {
333
+ const paramName = child.childForFieldName('name');
334
+ if (paramName) {
335
+ parameters.push(paramName.text);
336
+ }
337
+ }
338
+ else if (child.type === 'list_splat_pattern' ||
339
+ child.type === 'dictionary_splat_pattern') {
340
+ parameters.push(child.text);
341
+ }
342
+ }
343
+ }
344
+ // Extract decorators (need to look at parent if decorated)
345
+ const decorators = [];
346
+ const parent = node.parent;
347
+ if (parent?.type === 'decorated_definition') {
348
+ for (const child of parent.namedChildren) {
349
+ if (child.type === 'decorator') {
350
+ const decoratorName = child.namedChildren[0];
351
+ if (decoratorName) {
352
+ decorators.push(decoratorName.text);
353
+ }
354
+ }
355
+ }
356
+ }
357
+ return { name, parameters, returnType, isAsync, decorators };
358
+ }
359
+ }
360
+ //# sourceMappingURL=python-ast-converter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-ast-converter.js","sourceRoot":"","sources":["../../../src/parsers/tree-sitter/python-ast-converter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;GAGG;AACH,MAAM,aAAa,GAA2B;IAC5C,eAAe;IACf,MAAM,EAAE,QAAQ;IAEhB,UAAU;IACV,gBAAgB,EAAE,QAAQ;IAC1B,qBAAqB,EAAE,YAAY;IACnC,cAAc,EAAE,OAAO;IACvB,WAAW,EAAE,QAAQ;IACrB,eAAe,EAAE,iBAAiB;IAElC,cAAc;IACd,mBAAmB,EAAE,aAAa;IAClC,yBAAyB,EAAE,kBAAkB;IAC7C,gBAAgB,EAAE,UAAU;IAC5B,oBAAoB,EAAE,WAAW;IAEjC,sBAAsB;IACtB,UAAU,EAAE,WAAW;IACvB,iBAAiB,EAAE,KAAK;IACxB,eAAe,EAAE,KAAK;IACtB,uBAAuB,EAAE,KAAK;IAC9B,kBAAkB,EAAE,KAAK;IACzB,wBAAwB,EAAE,KAAK;IAC/B,iBAAiB,EAAE,mBAAmB;IACtC,oBAAoB,EAAE,sBAAsB;IAE5C,aAAa;IACb,oBAAoB,EAAE,MAAM;IAC5B,gBAAgB,EAAE,QAAQ;IAC1B,cAAc,EAAE,MAAM;IACtB,eAAe,EAAE,OAAO;IACxB,kBAAkB,EAAE,UAAU;IAC9B,eAAe,EAAE,OAAO;IACxB,gBAAgB,EAAE,QAAQ;IAC1B,gBAAgB,EAAE,QAAQ;IAC1B,kBAAkB,EAAE,UAAU;IAC9B,gBAAgB,EAAE,QAAQ;IAE1B,eAAe;IACf,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,MAAM;IACnB,a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