@equinor/fusion-framework-cli-plugin-ai-index 3.0.5 → 3.0.7

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 (195) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/esm/bin/apply-metadata.js +13 -5
  3. package/dist/esm/bin/apply-metadata.js.map +1 -1
  4. package/dist/esm/bin/apply-schema.js +7 -1
  5. package/dist/esm/bin/apply-schema.js.map +1 -1
  6. package/dist/esm/bin/apply-schema.test.js +2 -1
  7. package/dist/esm/bin/apply-schema.test.js.map +1 -1
  8. package/dist/esm/bin/{delete-removed-files.js → create-delete-removed-files-stream.js} +12 -1
  9. package/dist/esm/bin/create-delete-removed-files-stream.js.map +1 -0
  10. package/dist/esm/bin/embed.js +260 -97
  11. package/dist/esm/bin/embed.js.map +1 -1
  12. package/dist/esm/bin/execute-pipeline.js +5 -0
  13. package/dist/esm/bin/execute-pipeline.js.map +1 -1
  14. package/dist/esm/bin/get-diff.js +6 -0
  15. package/dist/esm/bin/get-diff.js.map +1 -1
  16. package/dist/esm/{embeddings-command.options.js → command-options-schema.js} +1 -1
  17. package/dist/esm/command-options-schema.js.map +1 -0
  18. package/dist/esm/{embeddings-command.js → command.js} +4 -2
  19. package/dist/esm/command.js.map +1 -0
  20. package/dist/esm/{create-command.js → create-index-command.js} +13 -5
  21. package/dist/esm/create-index-command.js.map +1 -0
  22. package/dist/esm/{schema.js → define-index-schema.js} +1 -1
  23. package/dist/esm/define-index-schema.js.map +1 -0
  24. package/dist/esm/delete-command.js +11 -2
  25. package/dist/esm/delete-command.js.map +1 -1
  26. package/dist/esm/delete-index-command.js +4 -0
  27. package/dist/esm/delete-index-command.js.map +1 -1
  28. package/dist/esm/{delete-command.options.js → delete-options-schema.js} +1 -1
  29. package/dist/esm/delete-options-schema.js.map +1 -0
  30. package/dist/esm/embed-command.js +3 -4
  31. package/dist/esm/embed-command.js.map +1 -1
  32. package/dist/esm/index.js +3 -3
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/search-command.js +20 -0
  35. package/dist/esm/search-command.js.map +1 -1
  36. package/dist/esm/utils/git/{metadata.js → extract-git-metadata.js} +4 -2
  37. package/dist/esm/utils/git/extract-git-metadata.js.map +1 -0
  38. package/dist/esm/utils/git/get-changed-files.js +87 -0
  39. package/dist/esm/utils/git/get-changed-files.js.map +1 -0
  40. package/dist/esm/utils/git/{file-changes.js → get-file-status.js} +9 -95
  41. package/dist/esm/utils/git/get-file-status.js.map +1 -0
  42. package/dist/esm/utils/git/{status.js → get-git-status.js} +5 -2
  43. package/dist/esm/utils/git/get-git-status.js.map +1 -0
  44. package/dist/esm/utils/git/get-git.js +30 -0
  45. package/dist/esm/utils/git/get-git.js.map +1 -0
  46. package/dist/esm/utils/git/index.js +7 -4
  47. package/dist/esm/utils/git/index.js.map +1 -1
  48. package/dist/esm/utils/git/is-file-changed.js +19 -0
  49. package/dist/esm/utils/git/is-file-changed.js.map +1 -0
  50. package/dist/esm/utils/git/resolve-project-root.js +22 -0
  51. package/dist/esm/utils/git/resolve-project-root.js.map +1 -0
  52. package/dist/esm/utils/markdown/index.js +3 -1
  53. package/dist/esm/utils/markdown/index.js.map +1 -1
  54. package/dist/esm/utils/markdown/is-markdown-file.js +10 -0
  55. package/dist/esm/utils/markdown/is-markdown-file.js.map +1 -0
  56. package/dist/esm/utils/markdown/parse-markdown-file.js +29 -0
  57. package/dist/esm/utils/markdown/parse-markdown-file.js.map +1 -0
  58. package/dist/esm/utils/markdown/{parser.js → parse-markdown.js} +8 -37
  59. package/dist/esm/utils/markdown/parse-markdown.js.map +1 -0
  60. package/dist/esm/utils/{embedding-dimensions.js → resolve-embedding-dimensions.js} +3 -1
  61. package/dist/esm/utils/resolve-embedding-dimensions.js.map +1 -0
  62. package/dist/esm/utils/{package-resolver.js → resolve-package.js} +4 -1
  63. package/dist/esm/utils/resolve-package.js.map +1 -0
  64. package/dist/esm/utils/ts-doc/create-typescript-document.js +27 -0
  65. package/dist/esm/utils/ts-doc/create-typescript-document.js.map +1 -0
  66. package/dist/esm/utils/ts-doc/extract-document-from-class-node.js +86 -0
  67. package/dist/esm/utils/ts-doc/extract-document-from-class-node.js.map +1 -0
  68. package/dist/esm/utils/ts-doc/extract-document-from-node.js +82 -0
  69. package/dist/esm/utils/ts-doc/extract-document-from-node.js.map +1 -0
  70. package/dist/esm/utils/ts-doc/index.js +3 -1
  71. package/dist/esm/utils/ts-doc/index.js.map +1 -1
  72. package/dist/esm/utils/ts-doc/is-typescript-file.js +10 -0
  73. package/dist/esm/utils/ts-doc/is-typescript-file.js.map +1 -0
  74. package/dist/esm/utils/ts-doc/{constants.js → node-kinds.js} +1 -1
  75. package/dist/esm/utils/ts-doc/node-kinds.js.map +1 -0
  76. package/dist/esm/utils/ts-doc/parse-ts-doc-from-file-sync.js +23 -0
  77. package/dist/esm/utils/ts-doc/parse-ts-doc-from-file-sync.js.map +1 -0
  78. package/dist/esm/utils/ts-doc/parse-ts-doc-sync.js +18 -0
  79. package/dist/esm/utils/ts-doc/parse-ts-doc-sync.js.map +1 -0
  80. package/dist/esm/utils/ts-doc/process-source-file.js +22 -0
  81. package/dist/esm/utils/ts-doc/process-source-file.js.map +1 -0
  82. package/dist/esm/utils/zod-to-azure-fields.js +7 -0
  83. package/dist/esm/utils/zod-to-azure-fields.js.map +1 -1
  84. package/dist/esm/utils/zod-to-azure-fields.test.js +8 -7
  85. package/dist/esm/utils/zod-to-azure-fields.test.js.map +1 -1
  86. package/dist/esm/version.js +1 -1
  87. package/dist/tsconfig.tsbuildinfo +1 -1
  88. package/dist/types/bin/apply-schema.d.ts +1 -1
  89. package/dist/types/config.d.ts +1 -1
  90. package/dist/types/index.d.ts +1 -1
  91. package/dist/types/utils/git/get-changed-files.d.ts +13 -0
  92. package/dist/types/utils/git/get-file-status.d.ts +13 -0
  93. package/dist/types/utils/git/{git-client.d.ts → get-git.d.ts} +0 -10
  94. package/dist/types/utils/git/index.d.ts +7 -4
  95. package/dist/types/utils/git/is-file-changed.d.ts +12 -0
  96. package/dist/types/utils/git/resolve-project-root.d.ts +10 -0
  97. package/dist/types/utils/markdown/index.d.ts +3 -1
  98. package/dist/types/utils/markdown/is-markdown-file.d.ts +7 -0
  99. package/dist/types/utils/markdown/parse-markdown-file.d.ts +14 -0
  100. package/dist/types/utils/markdown/parse-markdown.d.ts +14 -0
  101. package/dist/types/utils/ts-doc/create-typescript-document.d.ts +12 -0
  102. package/dist/types/utils/ts-doc/extract-document-from-class-node.d.ts +15 -0
  103. package/dist/types/utils/ts-doc/extract-document-from-node.d.ts +20 -0
  104. package/dist/types/utils/ts-doc/index.d.ts +3 -1
  105. package/dist/types/utils/ts-doc/is-typescript-file.d.ts +7 -0
  106. package/dist/types/utils/ts-doc/parse-ts-doc-from-file-sync.d.ts +14 -0
  107. package/dist/types/utils/ts-doc/parse-ts-doc-sync.d.ts +12 -0
  108. package/dist/types/utils/ts-doc/process-source-file.d.ts +11 -0
  109. package/dist/types/version.d.ts +1 -1
  110. package/package.json +8 -8
  111. package/src/bin/apply-metadata.ts +69 -57
  112. package/src/bin/apply-schema.test.ts +2 -1
  113. package/src/bin/apply-schema.ts +6 -1
  114. package/src/bin/{delete-removed-files.ts → create-delete-removed-files-stream.ts} +12 -1
  115. package/src/bin/embed.ts +389 -145
  116. package/src/bin/execute-pipeline.ts +5 -0
  117. package/src/bin/get-diff.ts +7 -1
  118. package/src/bin/types.ts +1 -1
  119. package/src/{embeddings-command.ts → command.ts} +3 -1
  120. package/src/config.ts +1 -1
  121. package/src/{create-command.ts → create-index-command.ts} +15 -5
  122. package/src/delete-command.ts +11 -2
  123. package/src/delete-index-command.ts +4 -0
  124. package/src/embed-command.ts +3 -6
  125. package/src/index.ts +3 -3
  126. package/src/search-command.ts +20 -0
  127. package/src/utils/git/{metadata.ts → extract-git-metadata.ts} +3 -1
  128. package/src/utils/git/get-changed-files.ts +93 -0
  129. package/src/utils/git/{file-changes.ts → get-file-status.ts} +9 -103
  130. package/src/utils/git/{status.ts → get-git-status.ts} +4 -1
  131. package/src/utils/git/{git-client.ts → get-git.ts} +4 -22
  132. package/src/utils/git/index.ts +7 -4
  133. package/src/utils/git/is-file-changed.ts +21 -0
  134. package/src/utils/git/resolve-project-root.ts +22 -0
  135. package/src/utils/markdown/index.ts +3 -1
  136. package/src/utils/markdown/is-markdown-file.ts +9 -0
  137. package/src/utils/markdown/parse-markdown-file.ts +36 -0
  138. package/src/utils/markdown/{parser.ts → parse-markdown.ts} +16 -51
  139. package/src/utils/{embedding-dimensions.ts → resolve-embedding-dimensions.ts} +2 -0
  140. package/src/utils/{package-resolver.ts → resolve-package.ts} +3 -0
  141. package/src/utils/ts-doc/create-typescript-document.ts +36 -0
  142. package/src/utils/ts-doc/extract-document-from-class-node.ts +106 -0
  143. package/src/utils/ts-doc/extract-document-from-node.ts +120 -0
  144. package/src/utils/ts-doc/index.ts +3 -1
  145. package/src/utils/ts-doc/is-typescript-file.ts +9 -0
  146. package/src/utils/ts-doc/parse-ts-doc-from-file-sync.ts +32 -0
  147. package/src/utils/ts-doc/parse-ts-doc-sync.ts +23 -0
  148. package/src/utils/ts-doc/process-source-file.ts +30 -0
  149. package/src/utils/zod-to-azure-fields.test.ts +10 -7
  150. package/src/utils/zod-to-azure-fields.ts +7 -0
  151. package/src/version.ts +1 -1
  152. package/dist/esm/bin/delete-removed-files.js.map +0 -1
  153. package/dist/esm/bin/file-stream.js +0 -22
  154. package/dist/esm/bin/file-stream.js.map +0 -1
  155. package/dist/esm/create-command.js.map +0 -1
  156. package/dist/esm/delete-command.options.js.map +0 -1
  157. package/dist/esm/embeddings-command.js.map +0 -1
  158. package/dist/esm/embeddings-command.options.js.map +0 -1
  159. package/dist/esm/schema.js.map +0 -1
  160. package/dist/esm/utils/embedding-dimensions.js.map +0 -1
  161. package/dist/esm/utils/git/file-changes.js.map +0 -1
  162. package/dist/esm/utils/git/git-client.js +0 -48
  163. package/dist/esm/utils/git/git-client.js.map +0 -1
  164. package/dist/esm/utils/git/metadata.js.map +0 -1
  165. package/dist/esm/utils/git/status.js.map +0 -1
  166. package/dist/esm/utils/markdown/parser.js.map +0 -1
  167. package/dist/esm/utils/package-resolver.js.map +0 -1
  168. package/dist/esm/utils/ts-doc/constants.js.map +0 -1
  169. package/dist/esm/utils/ts-doc/extractors.js +0 -189
  170. package/dist/esm/utils/ts-doc/extractors.js.map +0 -1
  171. package/dist/esm/utils/ts-doc/parser.js +0 -46
  172. package/dist/esm/utils/ts-doc/parser.js.map +0 -1
  173. package/dist/types/bin/file-stream.d.ts +0 -1
  174. package/dist/types/utils/git/file-changes.d.ts +0 -36
  175. package/dist/types/utils/markdown/parser.d.ts +0 -34
  176. package/dist/types/utils/ts-doc/extractors.d.ts +0 -42
  177. package/dist/types/utils/ts-doc/parser.d.ts +0 -32
  178. package/src/bin/file-stream.ts +0 -34
  179. package/src/utils/ts-doc/extractors.ts +0 -260
  180. package/src/utils/ts-doc/parser.ts +0 -60
  181. /package/dist/types/bin/{delete-removed-files.d.ts → create-delete-removed-files-stream.d.ts} +0 -0
  182. /package/dist/types/{embeddings-command.options.d.ts → command-options-schema.d.ts} +0 -0
  183. /package/dist/types/{embeddings-command.d.ts → command.d.ts} +0 -0
  184. /package/dist/types/{create-command.d.ts → create-index-command.d.ts} +0 -0
  185. /package/dist/types/{schema.d.ts → define-index-schema.d.ts} +0 -0
  186. /package/dist/types/{delete-command.options.d.ts → delete-options-schema.d.ts} +0 -0
  187. /package/dist/types/utils/git/{metadata.d.ts → extract-git-metadata.d.ts} +0 -0
  188. /package/dist/types/utils/git/{status.d.ts → get-git-status.d.ts} +0 -0
  189. /package/dist/types/utils/{embedding-dimensions.d.ts → resolve-embedding-dimensions.d.ts} +0 -0
  190. /package/dist/types/utils/{package-resolver.d.ts → resolve-package.d.ts} +0 -0
  191. /package/dist/types/utils/ts-doc/{constants.d.ts → node-kinds.d.ts} +0 -0
  192. /package/src/{embeddings-command.options.ts → command-options-schema.ts} +0 -0
  193. /package/src/{schema.ts → define-index-schema.ts} +0 -0
  194. /package/src/{delete-command.options.ts → delete-options-schema.ts} +0 -0
  195. /package/src/utils/ts-doc/{constants.ts → node-kinds.ts} +0 -0
@@ -1,189 +0,0 @@
1
- import { SyntaxKind, Node, } from 'ts-morph';
2
- import { generateChunkId } from '../generate-chunk-id.js';
3
- import { nodeKinds } from './constants.js';
4
- /**
5
- * Creates a TypescriptDocument from the given parameters.
6
- * @param sourceFile - The source file containing the node.
7
- * @param pageContent - The content of the document.
8
- * @param tsKind - The TypeScript node kind name.
9
- * @param tsName - The name of the TypeScript node.
10
- * @param options - Optional parsing configuration.
11
- * @param sourceOverride - Optional source path override (for cases where source needs transformation).
12
- * @returns A TypeScript document with metadata.
13
- */
14
- const createTypescriptDocument = (sourceFile, pageContent, tsKind, tsName, options) => {
15
- const source = sourceFile.getFilePath().replace(/^\/+/, '');
16
- return {
17
- id: generateChunkId(source),
18
- pageContent,
19
- metadata: {
20
- source,
21
- ...(options?.projectRoot && { rootPath: options.projectRoot }),
22
- attributes: {
23
- type: 'tsdoc',
24
- ts_kind: tsKind,
25
- ts_name: tsName,
26
- },
27
- },
28
- };
29
- };
30
- /**
31
- * Extracts a vector-store document from a TypeScript class declaration.
32
- *
33
- * Collects the class-level TSDoc comment, constructor signature (if documented),
34
- * and all public members with TSDoc into a single document whose `pageContent`
35
- * mirrors a minimal class interface.
36
- *
37
- * @param classNode - The `ts-morph` {@link ClassDeclaration} node to inspect.
38
- * @param sourceFile - The project source file that contains the class.
39
- * @param _options - Optional parsing configuration.
40
- * @returns A {@link TypescriptDocument}, or `null` when the class has no TSDoc.
41
- */
42
- export const extractDocumentFromClassNode = (classNode, sourceFile, _options) => {
43
- // Find TSDoc comment (/** ... */)
44
- const docCommentRange = classNode
45
- .getLeadingCommentRanges()
46
- .find((range) => range.getText().startsWith('/**'));
47
- if (!docCommentRange) {
48
- return null;
49
- }
50
- const docComment = docCommentRange.getText();
51
- const className = classNode.getName() || 'AnonymousClass';
52
- // Start with class TSDoc and declaration (without body)
53
- const classSignature = `${classNode.getText({ includeJsDocComments: false }).split('{')[0].trim()} {`;
54
- let pageContent = `${docComment}\n${classSignature}`;
55
- // Add constructor with TSDoc if present
56
- const constructorNode = classNode.getConstructors()[0]; // Get the first constructor (if any)
57
- if (constructorNode) {
58
- const constructorDocCommentRange = constructorNode
59
- .getLeadingCommentRanges()
60
- .find((range) => range.getText().startsWith('/**'));
61
- if (constructorDocCommentRange) {
62
- const constructorDocComment = constructorDocCommentRange.getText();
63
- const constructorSignature = constructorNode
64
- .getText({ includeJsDocComments: false })
65
- .split('{')[0]
66
- .trim();
67
- pageContent += `\n ${constructorDocComment}\n ${constructorSignature}`;
68
- }
69
- }
70
- // Add public methods and properties with TSDoc
71
- const publicMembers = [
72
- ...classNode.getMethods().filter((m) => m.hasModifier(SyntaxKind.PublicKeyword)),
73
- ...classNode.getProperties().filter((p) => p.hasModifier(SyntaxKind.PublicKeyword)),
74
- ];
75
- publicMembers.forEach((member) => {
76
- const memberDocCommentRange = member
77
- .getLeadingCommentRanges()
78
- .find((range) => range.getText().startsWith('/**'));
79
- if (memberDocCommentRange) {
80
- const memberDocComment = memberDocCommentRange.getText();
81
- let memberSignature = '';
82
- if (member.getKind() === SyntaxKind.MethodDeclaration) {
83
- memberSignature = member
84
- .getText({ includeJsDocComments: false })
85
- .split('{')[0]
86
- .trim();
87
- }
88
- else if (member.getKind() === SyntaxKind.PropertyDeclaration) {
89
- memberSignature = member
90
- .getText({ includeJsDocComments: false })
91
- .trim();
92
- }
93
- pageContent += `\n ${memberDocComment}\n ${memberSignature}`;
94
- }
95
- });
96
- pageContent += '\n}';
97
- return createTypescriptDocument(sourceFile, pageContent, classNode.getKindName(), className, _options);
98
- };
99
- /**
100
- * Extracts a vector-store document from a single TypeScript AST node.
101
- *
102
- * Handles function declarations, variable statements (arrow / function
103
- * expressions), interfaces, type aliases, enums, and classes. Delegates
104
- * to {@link extractDocumentFromClassNode} for class declarations.
105
- *
106
- * @param node - The `ts-morph` AST node to inspect.
107
- * @param sourceFile - The project source file that contains the node.
108
- * @param options - Optional parsing configuration.
109
- * @param nodeOptions - Optional flags (e.g. `skipKindCheck`) to override default
110
- * kind filtering.
111
- * @returns A {@link TypescriptDocument}, or `null` when the node has no TSDoc or
112
- * is not a supported kind.
113
- */
114
- export const extractDocumentFromNode = (node, sourceFile, options, nodeOptions) => {
115
- const kind = node.getKind();
116
- // Skip if not in our target kinds unless skipKindCheck is true
117
- if (!nodeOptions?.skipKindCheck && !nodeKinds.includes(kind)) {
118
- return null;
119
- }
120
- // Handle ClassDeclaration separately
121
- if (kind === SyntaxKind.ClassDeclaration) {
122
- return extractDocumentFromClassNode(node, sourceFile, options);
123
- }
124
- // Handle VariableStatement (e.g., `export const bundleApp = ...`)
125
- if (kind === SyntaxKind.VariableStatement) {
126
- const declaration = node
127
- .getDeclarations()
128
- .find((d) => d.getKind() === SyntaxKind.VariableDeclaration);
129
- if (!declaration) {
130
- return null;
131
- }
132
- const initializer = declaration.getInitializer();
133
- if (!initializer ||
134
- !(initializer.getKind() === SyntaxKind.ArrowFunction ||
135
- initializer.getKind() === SyntaxKind.FunctionExpression)) {
136
- return null;
137
- }
138
- // Get the TSDoc comment from the VariableStatement
139
- const docCommentRange = node
140
- .getLeadingCommentRanges()
141
- .find((range) => range.getText().startsWith('/**'));
142
- if (!docCommentRange) {
143
- return null;
144
- }
145
- const nodeName = declaration.getName() || 'missing_name_of_node';
146
- const docComment = docCommentRange.getText();
147
- // Only include the TSDoc comment for functions/lambdas
148
- return createTypescriptDocument(sourceFile, docComment, initializer.getKindName(), nodeName, options);
149
- }
150
- // Get name if node has one
151
- const nodeName = Node.hasName(node) ? node.getName() : 'missing_name_of_node';
152
- // Find TSDoc comment (/** ... */)
153
- const docCommentRange = node
154
- .getLeadingCommentRanges()
155
- .find((range) => range.getText().startsWith('/**'));
156
- if (!docCommentRange) {
157
- return null;
158
- }
159
- const docComment = docCommentRange.getText();
160
- let pageContent = docComment;
161
- // For interfaces and type aliases, include the full code
162
- if (kind === SyntaxKind.InterfaceDeclaration || kind === SyntaxKind.TypeAliasDeclaration) {
163
- pageContent = `${docComment}\n${node.getText()}`;
164
- }
165
- // For other nodes (e.g., FunctionDeclaration), include only TSDoc
166
- else if (kind !== SyntaxKind.FunctionDeclaration) {
167
- return null; // Skip unsupported kinds
168
- }
169
- return createTypescriptDocument(sourceFile, pageContent, node.getKindName(), nodeName, options);
170
- };
171
- /**
172
- * Walks a TypeScript source file and extracts a {@link TypescriptDocument}
173
- * for every top-level declaration that carries a TSDoc comment.
174
- *
175
- * @param sourceFile - The `ts-morph` source file to traverse.
176
- * @param options - Optional parsing configuration.
177
- * @returns Array of extracted documents (one per documented declaration).
178
- */
179
- export const processSourceFile = (sourceFile, options) => {
180
- const documents = [];
181
- sourceFile.forEachDescendant((node) => {
182
- const document = extractDocumentFromNode(node, sourceFile, options);
183
- if (document) {
184
- documents.push(document);
185
- }
186
- });
187
- return documents;
188
- };
189
- //# sourceMappingURL=extractors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractors.js","sourceRoot":"","sources":["../../../../src/utils/ts-doc/extractors.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,IAAI,GAKL,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;GASG;AACH,MAAM,wBAAwB,GAAG,CAC/B,UAA6B,EAC7B,WAAmB,EACnB,MAAc,EACd,MAAc,EACd,OAA2B,EACP,EAAE;IACtB,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5D,OAAO;QACL,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC;QAC3B,WAAW;QACX,QAAQ,EAAE;YACR,MAAM;YACN,GAAG,CAAC,OAAO,EAAE,WAAW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EAAE,CAAC;IAC7C,IAAI,WAAW,GAAG,UAAU,CAAC;IAE7B,yDAAyD;IACzD,IAAI,IAAI,KAAK,UAAU,CAAC,oBAAoB,IAAI,IAAI,KAAK,UAAU,CAAC,oBAAoB,EAAE,CAAC;QACzF,WAAW,GAAG,GAAG,UAAU,KAAK,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACnD,CAAC;IACD,kEAAkE;SAC7D,IAAI,IAAI,KAAK,UAAU,CAAC,mBAAmB,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC,CAAC,yBAAyB;IACxC,CAAC;IAED,OAAO,wBAAwB,CAAC,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAClG,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,UAA6B,EAC7B,OAA2B,EACL,EAAE;IACxB,MAAM,SAAS,GAAyB,EAAE,CAAC;IAE3C,UAAU,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,EAAE;QACpC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QACpE,IAAI,QAAQ,EAAE,CAAC;YACb,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
@@ -1,46 +0,0 @@
1
- import { assert } from 'node:console';
2
- import { readFileSync } from 'node:fs';
3
- import { Project } from 'ts-morph';
4
- import { processSourceFile } from './extractors.js';
5
- /**
6
- * Checks whether a file path has a TypeScript (`.ts`) or TSX (`.tsx`) extension.
7
- *
8
- * @param filePath - Absolute or relative file path.
9
- * @returns `true` if the file extension is `.ts` or `.tsx`.
10
- */
11
- export const isTypescriptFile = (filePath) => {
12
- return filePath.endsWith('.ts') || filePath.endsWith('.tsx');
13
- };
14
- /**
15
- * Parses TSDoc comments from an in-memory TypeScript code string.
16
- *
17
- * Creates a temporary `ts-morph` project, analyses the source, and returns
18
- * one {@link TypescriptDocument} per documented top-level declaration.
19
- *
20
- * @param content - TypeScript source code to parse.
21
- * @param options - Optional parsing configuration.
22
- * @returns Array of extracted TypeScript documents with TSDoc metadata.
23
- */
24
- export const parseTsDocSync = (content, options) => {
25
- const project = new Project({ useInMemoryFileSystem: true });
26
- const sourceFile = project.createSourceFile('temp.ts', content);
27
- return processSourceFile(sourceFile, options);
28
- };
29
- /**
30
- * Parses TSDoc comments from a TypeScript file on disk.
31
- *
32
- * Reads the file synchronously, creates a `ts-morph` project, and returns
33
- * one {@link TypescriptDocument} per documented top-level declaration.
34
- *
35
- * @param file - Source file descriptor with path and optional project root.
36
- * @param options - Optional parsing configuration.
37
- * @returns Array of extracted TypeScript documents.
38
- * @throws {AssertionError} If the file does not have a `.ts` or `.tsx` extension.
39
- */
40
- export const parseTsDocFromFileSync = (file, options) => {
41
- assert(isTypescriptFile(file.path), `File ${file.path} is not a TypeScript file`);
42
- const project = new Project({ useInMemoryFileSystem: true });
43
- const sourceFile = project.createSourceFile(file.relativePath ?? file.path, readFileSync(file.path, 'utf8'));
44
- return processSourceFile(sourceFile, options);
45
- };
46
- //# sourceMappingURL=parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../src/utils/ts-doc/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAgB,EAAW,EAAE;IAC5D,OAAO,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,OAAe,EACf,OAA2B,EACL,EAAE;IACxB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAChE,OAAO,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,IAAgB,EAChB,OAA2B,EACL,EAAE;IACxB,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,IAAI,CAAC,IAAI,2BAA2B,CAAC,CAAC;IAClF,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CACzC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,EAC9B,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAChC,CAAC;IACF,OAAO,iBAAiB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,36 +0,0 @@
1
- import type { ChangedFile, GitDiffOptions } from './types.js';
2
- /**
3
- * Returns a list of files changed between `baseRef` and HEAD.
4
- *
5
- * Parses the output of `git diff --name-status` to classify each file as
6
- * `'new'`, `'modified'`, or `'removed'`. Renames are expanded into a
7
- * `'removed'` entry for the old path and a `'new'` entry for the new path.
8
- *
9
- * @param options - Configuration controlling the diff reference and working directory.
10
- * @returns Array of changed files with their status.
11
- * @throws {Error} If the working directory is not inside a git repository.
12
- */
13
- export declare const getChangedFiles: (options: GitDiffOptions) => Promise<ChangedFile[]>;
14
- /**
15
- * Determines the git change status of a single file.
16
- *
17
- * Checks tracked status, porcelain output, and rename/copy detection to
18
- * produce one or two {@link ChangedFile} entries (two when a rename is
19
- * detected — one `'removed'` for the old path and one `'new'` for the
20
- * current path).
21
- *
22
- * @param filePath - Absolute path to the file to inspect.
23
- * @returns Array with one or two changed-file entries.
24
- */
25
- export declare const getFileStatus: (filePath: string) => Promise<ChangedFile[]>;
26
- /**
27
- * Checks whether a file path appears in a list of changed files.
28
- *
29
- * When the changed-files list is empty (no diff filtering active), every
30
- * file is considered changed so that all files are processed.
31
- *
32
- * @param filePath - Absolute file path to look up.
33
- * @param changedFiles - Array of {@link ChangedFile} entries to search.
34
- * @returns `true` if the file has changed or if diff filtering is disabled.
35
- */
36
- export declare const isFileChanged: (filePath: string, changedFiles: ChangedFile[]) => boolean;
@@ -1,34 +0,0 @@
1
- import type { SourceFile } from '../types.js';
2
- import type { MarkdownDocument } from './types.js';
3
- /**
4
- * Checks whether a file path has a Markdown (`.md`) or MDX (`.mdx`) extension.
5
- *
6
- * @param filePath - Absolute or relative file path.
7
- * @returns `true` when the extension is `.md` or `.mdx`.
8
- */
9
- export declare const isMarkdownFile: (filePath: string) => boolean;
10
- /**
11
- * Parses Markdown or MDX content into chunked vector-store documents.
12
- *
13
- * Extracts YAML frontmatter via `gray-matter`, splits the body using
14
- * {@link RecursiveCharacterTextSplitter}, and returns one
15
- * {@link MarkdownDocument} per valid chunk.
16
- *
17
- * @template T - Additional frontmatter attributes.
18
- * @param content - Raw Markdown / MDX string.
19
- * @param source - Relative source file path used as the document key.
20
- * @returns Array of chunked Markdown documents.
21
- */
22
- export declare const parseMarkdown: <T extends Record<string, unknown> = Record<string, unknown>>(content: string, source: string) => Promise<MarkdownDocument<T>[]>;
23
- /**
24
- * Reads a Markdown or MDX file from disk and parses it into chunked documents.
25
- *
26
- * Delegates to {@link parseMarkdown} after reading the file content, then
27
- * enriches each resulting document with the `rootPath` from the source file.
28
- *
29
- * @template T - Additional frontmatter attributes.
30
- * @param file - Source file descriptor with path and optional project root.
31
- * @returns Array of Markdown documents with root-path metadata.
32
- * @throws {AssertionError} If the file does not have a `.md` or `.mdx` extension.
33
- */
34
- export declare const parseMarkdownFile: <T extends Record<string, unknown> = Record<string, unknown>>(file: SourceFile) => Promise<MarkdownDocument<T>[]>;
@@ -1,42 +0,0 @@
1
- import { type SourceFile as ProjectSourceFile, Node, type ClassDeclaration } from 'ts-morph';
2
- import type { TypescriptDocument, ParseTsDocOptions } from './types.js';
3
- /**
4
- * Extracts a vector-store document from a TypeScript class declaration.
5
- *
6
- * Collects the class-level TSDoc comment, constructor signature (if documented),
7
- * and all public members with TSDoc into a single document whose `pageContent`
8
- * mirrors a minimal class interface.
9
- *
10
- * @param classNode - The `ts-morph` {@link ClassDeclaration} node to inspect.
11
- * @param sourceFile - The project source file that contains the class.
12
- * @param _options - Optional parsing configuration.
13
- * @returns A {@link TypescriptDocument}, or `null` when the class has no TSDoc.
14
- */
15
- export declare const extractDocumentFromClassNode: (classNode: ClassDeclaration, sourceFile: ProjectSourceFile, _options?: ParseTsDocOptions) => TypescriptDocument | null;
16
- /**
17
- * Extracts a vector-store document from a single TypeScript AST node.
18
- *
19
- * Handles function declarations, variable statements (arrow / function
20
- * expressions), interfaces, type aliases, enums, and classes. Delegates
21
- * to {@link extractDocumentFromClassNode} for class declarations.
22
- *
23
- * @param node - The `ts-morph` AST node to inspect.
24
- * @param sourceFile - The project source file that contains the node.
25
- * @param options - Optional parsing configuration.
26
- * @param nodeOptions - Optional flags (e.g. `skipKindCheck`) to override default
27
- * kind filtering.
28
- * @returns A {@link TypescriptDocument}, or `null` when the node has no TSDoc or
29
- * is not a supported kind.
30
- */
31
- export declare const extractDocumentFromNode: (node: Node, sourceFile: ProjectSourceFile, options?: ParseTsDocOptions, nodeOptions?: {
32
- skipKindCheck?: boolean;
33
- }) => TypescriptDocument | null;
34
- /**
35
- * Walks a TypeScript source file and extracts a {@link TypescriptDocument}
36
- * for every top-level declaration that carries a TSDoc comment.
37
- *
38
- * @param sourceFile - The `ts-morph` source file to traverse.
39
- * @param options - Optional parsing configuration.
40
- * @returns Array of extracted documents (one per documented declaration).
41
- */
42
- export declare const processSourceFile: (sourceFile: ProjectSourceFile, options?: ParseTsDocOptions) => TypescriptDocument[];
@@ -1,32 +0,0 @@
1
- import type { SourceFile } from '../types.js';
2
- import type { TypescriptDocument, ParseTsDocOptions } from './types.js';
3
- /**
4
- * Checks whether a file path has a TypeScript (`.ts`) or TSX (`.tsx`) extension.
5
- *
6
- * @param filePath - Absolute or relative file path.
7
- * @returns `true` if the file extension is `.ts` or `.tsx`.
8
- */
9
- export declare const isTypescriptFile: (filePath: string) => boolean;
10
- /**
11
- * Parses TSDoc comments from an in-memory TypeScript code string.
12
- *
13
- * Creates a temporary `ts-morph` project, analyses the source, and returns
14
- * one {@link TypescriptDocument} per documented top-level declaration.
15
- *
16
- * @param content - TypeScript source code to parse.
17
- * @param options - Optional parsing configuration.
18
- * @returns Array of extracted TypeScript documents with TSDoc metadata.
19
- */
20
- export declare const parseTsDocSync: (content: string, options?: ParseTsDocOptions) => TypescriptDocument[];
21
- /**
22
- * Parses TSDoc comments from a TypeScript file on disk.
23
- *
24
- * Reads the file synchronously, creates a `ts-morph` project, and returns
25
- * one {@link TypescriptDocument} per documented top-level declaration.
26
- *
27
- * @param file - Source file descriptor with path and optional project root.
28
- * @param options - Optional parsing configuration.
29
- * @returns Array of extracted TypeScript documents.
30
- * @throws {AssertionError} If the file does not have a `.ts` or `.tsx` extension.
31
- */
32
- export declare const parseTsDocFromFileSync: (file: SourceFile, options?: ParseTsDocOptions) => TypescriptDocument[];
@@ -1,34 +0,0 @@
1
- import { globbyStream } from 'globby';
2
- import { from, mergeMap, concatMap, shareReplay } from 'rxjs';
3
- import type { Observable } from 'rxjs';
4
- import { getFileStatus } from '../utils/git/index.js';
5
- import type { ChangedFile } from '../utils/git/index.js';
6
- import type { CommandOptions } from '../embeddings-command.options.js';
7
-
8
- /**
9
- * Creates a file stream based on diff mode or glob patterns.
10
- * @internal
11
- */
12
- export function createFileStream(
13
- options: CommandOptions,
14
- changedFiles: ChangedFile[],
15
- filePatterns: string[],
16
- ): Observable<ChangedFile> {
17
- if (options.diff) {
18
- return from(changedFiles);
19
- }
20
-
21
- return from(
22
- globbyStream(filePatterns, {
23
- onlyFiles: true,
24
- gitignore: true,
25
- absolute: true,
26
- }),
27
- ).pipe(
28
- // Get git status concurrently, then flatten array results
29
- mergeMap((path) => getFileStatus(path)),
30
- concatMap((files) => from(files)),
31
- // Share stream for multiple subscribers (removedFiles$ and indexFiles$)
32
- shareReplay({ refCount: true }),
33
- );
34
- }