@gitsense/gscb-git-tools 0.1.0 → 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 (75) hide show
  1. package/package.json +1 -1
  2. package/dist/cjs/common/logger.js +0 -97
  3. package/dist/cjs/common/logger.js.map +0 -1
  4. package/dist/cjs/common/metadata-manager.js +0 -196
  5. package/dist/cjs/common/metadata-manager.js.map +0 -1
  6. package/dist/cjs/importer/chat-manager/chat-creator.js +0 -90
  7. package/dist/cjs/importer/chat-manager/chat-creator.js.map +0 -1
  8. package/dist/cjs/importer/chat-manager/chat-manager.js +0 -179
  9. package/dist/cjs/importer/chat-manager/chat-manager.js.map +0 -1
  10. package/dist/cjs/importer/chat-manager/constants.js +0 -66
  11. package/dist/cjs/importer/chat-manager/constants.js.map +0 -1
  12. package/dist/cjs/importer/chat-manager/group-manager.js +0 -56
  13. package/dist/cjs/importer/chat-manager/group-manager.js.map +0 -1
  14. package/dist/cjs/importer/chat-manager/hierarchy-manager.js +0 -115
  15. package/dist/cjs/importer/chat-manager/hierarchy-manager.js.map +0 -1
  16. package/dist/cjs/importer/chat-manager/message-manager.js +0 -189
  17. package/dist/cjs/importer/chat-manager/message-manager.js.map +0 -1
  18. package/dist/cjs/importer/constants.js +0 -30
  19. package/dist/cjs/importer/constants.js.map +0 -1
  20. package/dist/cjs/importer/core/directory-processor.js +0 -343
  21. package/dist/cjs/importer/core/directory-processor.js.map +0 -1
  22. package/dist/cjs/importer/core/error-handler.js +0 -64
  23. package/dist/cjs/importer/core/error-handler.js.map +0 -1
  24. package/dist/cjs/importer/core/import-processor.js +0 -167
  25. package/dist/cjs/importer/core/import-processor.js.map +0 -1
  26. package/dist/cjs/importer/core/importer.js +0 -135
  27. package/dist/cjs/importer/core/importer.js.map +0 -1
  28. package/dist/cjs/importer/core/utils.js +0 -66
  29. package/dist/cjs/importer/core/utils.js.map +0 -1
  30. package/dist/cjs/importer/file-processor.js +0 -199
  31. package/dist/cjs/importer/file-processor.js.map +0 -1
  32. package/dist/cjs/importer/language-utils.js +0 -286
  33. package/dist/cjs/importer/language-utils.js.map +0 -1
  34. package/dist/cjs/importer/tree-processor.js +0 -119
  35. package/dist/cjs/importer/tree-processor.js.map +0 -1
  36. package/dist/cjs/index.js +0 -12
  37. package/dist/cjs/index.js.map +0 -1
  38. package/dist/cjs/package.json +0 -3
  39. package/dist/esm/common/logger.js +0 -95
  40. package/dist/esm/common/logger.js.map +0 -1
  41. package/dist/esm/common/metadata-manager.js +0 -194
  42. package/dist/esm/common/metadata-manager.js.map +0 -1
  43. package/dist/esm/importer/chat-manager/chat-creator.js +0 -88
  44. package/dist/esm/importer/chat-manager/chat-creator.js.map +0 -1
  45. package/dist/esm/importer/chat-manager/chat-manager.js +0 -177
  46. package/dist/esm/importer/chat-manager/chat-manager.js.map +0 -1
  47. package/dist/esm/importer/chat-manager/constants.js +0 -48
  48. package/dist/esm/importer/chat-manager/constants.js.map +0 -1
  49. package/dist/esm/importer/chat-manager/group-manager.js +0 -54
  50. package/dist/esm/importer/chat-manager/group-manager.js.map +0 -1
  51. package/dist/esm/importer/chat-manager/hierarchy-manager.js +0 -113
  52. package/dist/esm/importer/chat-manager/hierarchy-manager.js.map +0 -1
  53. package/dist/esm/importer/chat-manager/message-manager.js +0 -187
  54. package/dist/esm/importer/chat-manager/message-manager.js.map +0 -1
  55. package/dist/esm/importer/constants.js +0 -28
  56. package/dist/esm/importer/constants.js.map +0 -1
  57. package/dist/esm/importer/core/directory-processor.js +0 -337
  58. package/dist/esm/importer/core/directory-processor.js.map +0 -1
  59. package/dist/esm/importer/core/error-handler.js +0 -62
  60. package/dist/esm/importer/core/error-handler.js.map +0 -1
  61. package/dist/esm/importer/core/import-processor.js +0 -165
  62. package/dist/esm/importer/core/import-processor.js.map +0 -1
  63. package/dist/esm/importer/core/importer.js +0 -133
  64. package/dist/esm/importer/core/importer.js.map +0 -1
  65. package/dist/esm/importer/core/utils.js +0 -64
  66. package/dist/esm/importer/core/utils.js.map +0 -1
  67. package/dist/esm/importer/file-processor.js +0 -193
  68. package/dist/esm/importer/file-processor.js.map +0 -1
  69. package/dist/esm/importer/language-utils.js +0 -279
  70. package/dist/esm/importer/language-utils.js.map +0 -1
  71. package/dist/esm/importer/tree-processor.js +0 -113
  72. package/dist/esm/importer/tree-processor.js.map +0 -1
  73. package/dist/esm/index.js +0 -4
  74. package/dist/esm/index.js.map +0 -1
  75. package/dist/index.d.ts +0 -215
@@ -1,279 +0,0 @@
1
- import path from 'path';
2
-
3
- /**
4
- * Component: Language Utilities
5
- * Block-UUID: 6ee96820-231a-4832-ac4d-dc17e6bf5eab
6
- * Parent-UUID: 27616faf-e61e-4089-89dc-277a29f38ec9
7
- * Version: 1.2.0
8
- * Description: Language detection and syntax highlighting
9
- * Language: TypeScript
10
- * Created-at: 2025-06-30T20:36:07.802Z
11
- * Authors: OpenRouter - DeepSeek v3 (v1.0.0), Gemini 2.5 Flash Thinking (v1.1.0), Claude 3.5 Sonnet (v1.2.0)
12
- */
13
- const detectLanguage = (filePath) => {
14
- const ext = path.extname(filePath).toLowerCase();
15
- const languageMap = {
16
- // Web Technologies
17
- '.js': 'javascript',
18
- '.jsx': 'javascript',
19
- '.ts': 'typescript',
20
- '.tsx': 'typescript',
21
- '.html': 'html',
22
- '.htm': 'html',
23
- '.xhtml': 'html',
24
- '.css': 'css',
25
- '.scss': 'scss',
26
- '.sass': 'sass',
27
- '.less': 'less',
28
- '.styl': 'stylus',
29
- '.vue': 'vue',
30
- '.svelte': 'svelte',
31
- '.astro': 'astro',
32
- '.wasm': 'wasm',
33
- '.webmanifest': 'json',
34
- // System Programming
35
- '.c': 'c',
36
- '.h': 'c',
37
- '.cpp': 'cpp',
38
- '.hpp': 'cpp',
39
- '.cc': 'cpp',
40
- '.cxx': 'cpp',
41
- '.c++': 'cpp',
42
- '.rs': 'rust',
43
- '.go': 'go',
44
- '.zig': 'zig',
45
- '.d': 'd',
46
- // JVM Languages
47
- '.java': 'java',
48
- '.kt': 'kotlin',
49
- '.kts': 'kotlin',
50
- '.scala': 'scala',
51
- '.sc': 'scala',
52
- '.groovy': 'groovy',
53
- '.clj': 'clojure',
54
- '.cljs': 'clojure',
55
- '.cljc': 'clojure',
56
- // Microsoft Stack
57
- '.cs': 'csharp',
58
- '.vb': 'vbnet',
59
- '.fs': 'fsharp',
60
- '.fsx': 'fsharp',
61
- '.fsi': 'fsharp',
62
- '.fsscript': 'fsharp',
63
- '.xaml': 'xml',
64
- '.razor': 'razor',
65
- '.cshtml': 'razor',
66
- '.vbhtml': 'razor',
67
- // Scripting Languages
68
- '.py': 'python',
69
- '.pyi': 'python',
70
- '.rb': 'ruby',
71
- '.rbw': 'ruby',
72
- '.rake': 'ruby',
73
- '.php': 'php',
74
- '.php4': 'php',
75
- '.php5': 'php',
76
- '.phtml': 'php',
77
- '.perl': 'perl',
78
- '.pl': 'perl',
79
- '.pm': 'perl',
80
- '.t': 'perl',
81
- '.lua': 'lua',
82
- '.tcl': 'tcl',
83
- '.r': 'r',
84
- '.rmd': 'rmarkdown',
85
- // Shell Scripts
86
- '.sh': 'bash',
87
- '.bash': 'bash',
88
- '.zsh': 'zsh',
89
- '.fish': 'fish',
90
- '.ksh': 'ksh',
91
- '.csh': 'csh',
92
- '.ps1': 'powershell',
93
- '.psm1': 'powershell',
94
- '.psd1': 'powershell',
95
- // Functional Languages
96
- '.hs': 'haskell',
97
- '.lhs': 'haskell',
98
- '.elm': 'elm',
99
- '.erl': 'erlang',
100
- '.hrl': 'erlang',
101
- '.ex': 'elixir',
102
- '.exs': 'elixir',
103
- '.eex': 'elixir',
104
- '.leex': 'elixir',
105
- '.mli': 'ocaml',
106
- '.re': 'reason',
107
- '.rei': 'reason',
108
- // Mobile Development
109
- '.swift': 'swift',
110
- '.m': 'objective-c',
111
- '.mm': 'objective-c',
112
- '.dart': 'dart',
113
- '.gradle': 'gradle',
114
- // Data & Config
115
- '.json': 'json',
116
- '.json5': 'json5',
117
- '.yaml': 'yaml',
118
- '.yml': 'yaml',
119
- '.toml': 'toml',
120
- '.ini': 'ini',
121
- '.conf': 'conf',
122
- '.config': 'config',
123
- '.xml': 'xml',
124
- '.plist': 'xml',
125
- '.csv': 'csv',
126
- '.tsv': 'tsv',
127
- // Database
128
- '.sql': 'sql',
129
- '.mysql': 'sql',
130
- '.pgsql': 'sql',
131
- '.sqlite': 'sql',
132
- '.prisma': 'prisma',
133
- '.graphql': 'graphql',
134
- '.gql': 'graphql',
135
- // Documentation
136
- '.md': 'markdown',
137
- '.markdown': 'markdown',
138
- '.mdown': 'markdown',
139
- '.mdx': 'mdx',
140
- '.rst': 'restructuredtext',
141
- '.asciidoc': 'asciidoc',
142
- '.adoc': 'asciidoc',
143
- '.tex': 'latex',
144
- '.ltx': 'latex',
145
- // Game Development
146
- '.gd': 'gdscript',
147
- '.hlsl': 'hlsl',
148
- '.glsl': 'glsl',
149
- '.shader': 'shaderlab',
150
- // Hardware Description
151
- '.v': 'verilog',
152
- '.vh': 'verilog',
153
- '.sv': 'systemverilog',
154
- '.svh': 'systemverilog',
155
- '.vhd': 'vhdl',
156
- '.vhdl': 'vhdl',
157
- // Other Languages
158
- '.jl': 'julia',
159
- '.cr': 'crystal',
160
- '.nim': 'nim',
161
- '.ml': 'ocaml',
162
- '.f90': 'fortran',
163
- '.f95': 'fortran',
164
- '.f03': 'fortran',
165
- '.f08': 'fortran',
166
- '.pro': 'prolog',
167
- '.bas': 'basic',
168
- '.bi': 'basic',
169
- '.coffee': 'coffeescript',
170
- '.litcoffee': 'coffeescript',
171
- '.imba': 'imba',
172
- '.rkt': 'racket',
173
- };
174
- return languageMap[ext] || 'plaintext';
175
- };
176
- const getHighlightSyntax = (filePath) => {
177
- const highlightMap = {
178
- // Web Technologies
179
- '.js': 'javascript',
180
- '.jsx': 'jsx',
181
- '.ts': 'typescript',
182
- '.tsx': 'tsx',
183
- '.html': 'html',
184
- '.htm': 'html',
185
- '.css': 'css',
186
- '.scss': 'scss',
187
- '.sass': 'sass',
188
- '.less': 'less',
189
- '.vue': 'vue',
190
- '.svelte': 'svelte',
191
- '.astro': 'astro',
192
- // System Programming
193
- '.c': 'c',
194
- '.h': 'c',
195
- '.cpp': 'cpp',
196
- '.hpp': 'cpp',
197
- '.cc': 'cpp',
198
- '.rs': 'rust',
199
- '.go': 'go',
200
- '.zig': 'zig',
201
- // JVM & .NET
202
- '.java': 'java',
203
- '.kt': 'kotlin',
204
- '.cs': 'csharp',
205
- '.fs': 'fsharp',
206
- '.scala': 'scala',
207
- '.groovy': 'groovy',
208
- // Scripting
209
- '.py': 'python',
210
- '.rb': 'ruby',
211
- '.php': 'php',
212
- '.pl': 'perl',
213
- '.lua': 'lua',
214
- '.r': 'r',
215
- '.sh': 'bash',
216
- '.bash': 'bash',
217
- '.zsh': 'zsh',
218
- '.fish': 'fish',
219
- '.ps1': 'powershell',
220
- // Data & Config
221
- '.json': 'json',
222
- '.yaml': 'yaml',
223
- '.yml': 'yaml',
224
- '.toml': 'toml',
225
- '.xml': 'xml',
226
- '.sql': 'sql',
227
- '.graphql': 'graphql',
228
- // Documentation
229
- '.md': 'markdown',
230
- '.mdx': 'mdx',
231
- '.tex': 'latex',
232
- // Others
233
- '.dockerfile': 'dockerfile',
234
- '.makefile': 'makefile',
235
- '.nim': 'nim',
236
- '.swift': 'swift',
237
- '.dart': 'dart',
238
- };
239
- const ext = path.extname(filePath).toLowerCase();
240
- const filename = path.basename(filePath).toLowerCase();
241
- const specialFiles = {
242
- 'dockerfile': 'dockerfile',
243
- 'docker-compose.yml': 'yaml',
244
- 'docker-compose.yaml': 'yaml',
245
- 'makefile': 'makefile',
246
- 'gemfile': 'ruby',
247
- 'rakefile': 'ruby',
248
- '.gitignore': 'gitignore',
249
- '.gitattributes': 'gitattributes',
250
- '.env': 'dotenv',
251
- '.env.local': 'dotenv',
252
- '.env.development': 'dotenv',
253
- '.env.production': 'dotenv',
254
- 'package.json': 'json',
255
- 'package-lock.json': 'json',
256
- 'composer.json': 'json',
257
- 'tsconfig.json': 'jsonc',
258
- 'jsconfig.json': 'jsonc',
259
- '.eslintrc': 'json',
260
- '.eslintrc.json': 'json',
261
- '.prettierrc': 'json',
262
- '.prettierrc.json': 'json',
263
- 'cargo.toml': 'toml',
264
- 'go.mod': 'gomod',
265
- 'go.sum': 'gosum',
266
- 'requirements.txt': 'pip',
267
- 'poetry.lock': 'toml',
268
- 'pyproject.toml': 'toml',
269
- 'CMakeLists.txt': 'cmake',
270
- '.editorconfig': 'editorconfig',
271
- };
272
- if (specialFiles[filename]) {
273
- return specialFiles[filename];
274
- }
275
- return highlightMap[ext] || detectLanguage(filePath);
276
- };
277
-
278
- export { detectLanguage, getHighlightSyntax };
279
- //# sourceMappingURL=language-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"language-utils.js","sources":["../../../src/importer/language-utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;;AASG;AAKU,MAAA,cAAc,GAAG,CAAC,QAAgB,KAAY;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE;AAChD,IAAA,MAAM,WAAW,GAA8B;;AAE3C,QAAA,KAAK,EAAE,YAAY;AACnB,QAAA,MAAM,EAAE,YAAY;AACpB,QAAA,KAAK,EAAE,YAAY;AACnB,QAAA,MAAM,EAAE,YAAY;AACpB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,MAAM,EAAE,MAAM;AACd,QAAA,QAAQ,EAAE,MAAM;AAChB,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,OAAO,EAAE,QAAQ;AACjB,QAAA,MAAM,EAAE,KAAK;AACb,QAAA,SAAS,EAAE,QAAQ;AACnB,QAAA,QAAQ,EAAE,OAAO;AACjB,QAAA,OAAO,EAAE,MAAM;AACf,QAAA,cAAc,EAAE,MAAM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A,eAAe,EAAE,MAAM;AACvB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,WAAW,EAAE,MAAM;AACnB,QAAA,gBAAgB,EAAE,MAAM;AACxB,QAAA,aAAa,EAAE,MAAM;AACrB,QAAA,kBAAkB,EAAE,MAAM;AAC1B,QAAA,YAAY,EAAE,MAAM;AACpB,QAAA,QAAQ,EAAE,OAAO;AACjB,QAAA,QAAQ,EAAE,OAAO;AACjB,QAAA,kBAAkB,EAAE,KAAK;AACzB,QAAA,aAAa,EAAE,MAAM;AACrB,QAAA,gBAAgB,EAAE,MAAM;AACxB,QAAA,gBAAgB,EAAE,OAAO;AACzB,QAAA,eAAe,EAAE,cAAc;KAClC;AAED,IAAA,IAAI,YAAY,CAAC,QAAQ,CAAC,EAAE;AACxB,QAAA,OAAO,YAAY,CAAC,QAAQ,CAAC;;IAGjC,OAAO,YAAY,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC;AACxD;;;;"}
@@ -1,113 +0,0 @@
1
- import path from 'path';
2
- import { PathUtils } from 'gscb-utils';
3
- import { Utils } from './core/utils.js';
4
-
5
- /**
6
- * Component: Tree Processor
7
- * Block-UUID: 5a7b9c3d-2e1f-4a5b-8c7d-6e5f4a3b2c1d
8
- * Parent-UUID: 628b49b7-ce3d-42ce-b08d-48e7debf399c
9
- * Version: 4.0.0
10
- * Purpose: Add support for handling deleted files and directories
11
- * Language: TypeScript
12
- * Created-at: 2025-03-11T20:39:00.124Z
13
- * Updated-at: 2025-03-16T06:45:00.124Z
14
- * Authors: Claude 3.5 Sonnet (v3.0.0), Bard, Claude 3.5 Sonnet (v3.1.0), together.ai - DeepSeek v3 (v3.3.0), Claude 3.7 Sonnet (v3.4.0), together.ai - DeepSeek v3 (v4.0.0)
15
- */
16
- class TreeProcessor {
17
- gitRepo;
18
- chatManager;
19
- fileProcessor;
20
- repoGroupId;
21
- logger;
22
- constructor(gitRepo, chatManager, fileProcessor, repoGroupId, logger) {
23
- this.gitRepo = gitRepo;
24
- this.chatManager = chatManager;
25
- this.fileProcessor = fileProcessor;
26
- this.repoGroupId = repoGroupId;
27
- this.logger = logger;
28
- }
29
- /**
30
- * Processes all files and directories in the repository, ensuring a proper parent-child relationship.
31
- */
32
- async processFiles(rootChatId) {
33
- try {
34
- // Start processing from the root directory. Empty string is root.
35
- await this.processDirectory('', rootChatId);
36
- }
37
- catch (error) {
38
- throw new Error(`Failed to process files: ${error instanceof Error ? error.message : String(error)}`);
39
- }
40
- }
41
- /**
42
- * Recursively processes a directory and its contents.
43
- * Returns the latest GitCommitInfo for the directory.
44
- */
45
- async processDirectory(dirPath, parentChatId, treeSha = '') {
46
- try {
47
- // Used to define chat order
48
- let orderWeight = 0;
49
- // Create a chat for the current directory
50
- const dirChatId = dirPath === ''
51
- ? parentChatId
52
- : await this.createDirectoryChat(dirPath, parentChatId, treeSha, orderWeight);
53
- // List the contents of the directory
54
- const entries = await this.gitRepo.listDirectory(dirPath);
55
- // Separate directories and files, then sort alphabetically
56
- const directories = entries
57
- .filter(entry => entry.type === 'tree')
58
- .sort((a, b) => b.path.localeCompare(a.path));
59
- const files = entries
60
- .filter(entry => entry.type === 'blob')
61
- .sort((a, b) => a.path.localeCompare(b.path));
62
- // Process directories and files
63
- const childCommits = [];
64
- for (const dir of directories) {
65
- orderWeight += 10;
66
- const childCommit = await this.processDirectory(dirPath + (dirPath === "" ? "" : "/") + dir.path, dirChatId, dir.oid);
67
- if (childCommit)
68
- childCommits.push(childCommit);
69
- }
70
- for (const file of files) {
71
- const { path } = file;
72
- if (await this.fileProcessor.shouldSkipFile(path))
73
- continue;
74
- orderWeight += 10;
75
- const fileCommit = await this.fileProcessor.processFile(dirPath + (dirPath === "" ? "" : "/") + path, dirChatId, orderWeight);
76
- if (fileCommit)
77
- childCommits.push(fileCommit);
78
- }
79
- // Determine the latest commit for the directory
80
- const latestCommit = Utils.getLatestCommit(childCommits);
81
- await this.chatManager.updateDirectoryMetadata(dirChatId, dirPath, latestCommit);
82
- return latestCommit;
83
- }
84
- catch (error) {
85
- console.trace();
86
- throw new Error(`Failed to process directory '${dirPath}': ${error instanceof Error ? error.message : String(error)}`);
87
- }
88
- }
89
- /**
90
- * Creates a chat for a directory.
91
- */
92
- async createDirectoryChat(dirPath, parentChatId, treeSha, orderWeight) {
93
- const normalizedPath = PathUtils.normalize(dirPath);
94
- const now = new Date().toISOString();
95
- const type = 'git-tree';
96
- const meta = {
97
- type,
98
- tree: treeSha,
99
- path: normalizedPath,
100
- name: path.basename(dirPath),
101
- tokens: null,
102
- commit: null,
103
- status: 'importing',
104
- importStartedAt: now
105
- };
106
- // Use ChatManager to create the chat
107
- const chatId = await this.chatManager.createChat(type, path.basename(dirPath), parentChatId, this.repoGroupId, meta, '', orderWeight);
108
- return chatId;
109
- }
110
- }
111
-
112
- export { TreeProcessor };
113
- //# sourceMappingURL=tree-processor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tree-processor.js","sources":["../../../src/importer/tree-processor.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;;;;;;;;AAUG;MAaU,aAAa,CAAA;AAED,IAAA,OAAA;AACA,IAAA,WAAA;AACA,IAAA,aAAA;AACA,IAAA,WAAA;AACA,IAAA,MAAA;IALrB,WACqB,CAAA,OAAmB,EACnB,WAAwB,EACxB,aAA4B,EAC5B,WAAmB,EACnB,MAAc,EAAA;QAJd,IAAO,CAAA,OAAA,GAAP,OAAO;QACP,IAAW,CAAA,WAAA,GAAX,WAAW;QACX,IAAa,CAAA,aAAA,GAAb,aAAa;QACb,IAAW,CAAA,WAAA,GAAX,WAAW;QACX,IAAM,CAAA,MAAA,GAAN,MAAM;;AAG3B;;AAEG;IACH,MAAM,YAAY,CAAC,UAAkB,EAAA;AACjC,QAAA,IAAI;;YAEA,MAAM,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,UAAU,CAAC;;QAC7C,OAAO,KAAK,EAAE;YACZ,MAAM,IA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AAc;AACpB,YAAA,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;AAC5B,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,MAAM,EAAE,WAAW;AACnB,YAAA,eAAe,EAAE;SACpB;;AAGD,QAAA,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAC5C,IAAI,EACJ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EACtB,YAAY,EACZ,IAAI,CAAC,WAAW,EAChB,IAAI,EACJ,EAAE,EACF,WAAW,CACd;AAED,QAAA,OAAO,MAAM;;AAEpB;;;;"}
package/dist/esm/index.js DELETED
@@ -1,4 +0,0 @@
1
- export { GitImporter } from './importer/core/importer.js';
2
- export { ChatManager } from './importer/chat-manager/chat-manager.js';
3
- export { Logger } from './common/logger.js';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
package/dist/index.d.ts DELETED
@@ -1,215 +0,0 @@
1
- import { DatabaseClient, Message, Chat } from 'gscb-db';
2
- import { Repository, GitCommitInfo } from 'gscb-git';
3
-
4
- /**
5
- * Component: Shared Types
6
- * Block-UUID: 9a8b7c6d-5e4f-3d2c-1b0a-9f8e7d6c5b4a
7
- * Parent-UUID: 3b1e5a1f-0e3a-4b0d-8e1a-7f8b9c0d1e2f
8
- * Version: 5.0.0
9
- * Description: Update this to provide a proper file description
10
- * Language: TypeScript
11
- * Created-at: 2025-02-28T12:00:00.000Z
12
- * Updated-at: 2025-03-24T01:10:00.000Z
13
- * Authors: OpenRouter - DeepSeek v3 (v1.0.0), Claude 3.5 Sonnet (v2.0.0), Bard, together.ai - DeepSeek v3 (v3.2.0),
14
- * DeepSeek v3 (v4.0.0), together.ai - DeepSeek v3 (v5.0.0)
15
- */
16
-
17
- interface ImportOptions {
18
- maxFileSize?: number;
19
- skipPatterns?: RegExp[];
20
- includePatterns?: RegExp[];
21
- promptName?: string;
22
- skipBinaryFiles?: boolean;
23
- verbose?: boolean;
24
- }
25
- /**
26
- * Allowed group types
27
- */
28
- type GroupType = 'git-repos' | 'git-repo-owner' | 'git-repo' | 'fs-trees' | 'fs-tree' | 'regular';
29
- /**
30
- * Allowed chat types
31
- */
32
- type ChatType = 'git-repos' | 'git-repo-owner' | 'git-repo' | 'git-ref' | 'git-branch' | 'git-commit' | 'git-tree' | 'git-blob';
33
- /**
34
- * Allowed reference types
35
- */
36
- type RefType = 'git-branch' | 'git-commit' | 'git-tag' | 'branch' | 'commit' | 'tag';
37
- /**
38
- * Chat Manager configuration options
39
- */
40
- interface ChatManagerOptions {
41
- verbose?: boolean;
42
- skipPatterns?: RegExp[];
43
- includePatterns?: RegExp[];
44
- }
45
-
46
- /**
47
- * Component: Git Repository Importer (Core)
48
- * Block-UUID: 237b8cc5-5d1b-4285-82c4-0e1f49459f2c
49
- * Parent-UUID: 31839e44-58af-43ea-baab-96674d745ad0
50
- * Version: 6.6.0
51
- * Purpose: Core implementation of GitImporter class
52
- * Language: TypeScript
53
- * Created-at: 2025-03-15T05:57:33.811Z
54
- * Authors: Claude 3.5 Sonnet (v5.0.1), Bard, Claude 3.5 Sonnet (v6.0.0), Claude 3.7 Sonnet (v6.3.0), OpenRouter - Gemini Flash 2.0 (v6.4.0), OpenRouter - Gemini Flash 2.0 (v6.5.0), together.ai - DeepSeek v3 (v6.6.0)
55
- */
56
-
57
- declare class GitImporter {
58
- private readonly repoPath;
59
- private readonly repoOwner;
60
- private readonly repoName;
61
- private readonly ref;
62
- private readonly refType;
63
- private readonly dbPath;
64
- private readonly options;
65
- private readonly gitRepo;
66
- private readonly dbClient;
67
- private readonly logger;
68
- private initialized;
69
- private importProcessor;
70
- private errorHandler;
71
- constructor(repoPath: string, repoOwner: string, repoName: string, ref: string, refType: RefType, dbPath: string, options?: ImportOptions);
72
- /**
73
- * Initializes the Git repository, ref commit, and database connection.
74
- */
75
- initialize(): Promise<void>;
76
- /**
77
- * Imports the repository by setting up the chat hierarchy.
78
- *
79
- * @returns An object containing the ID of the git-ref chat
80
- * @throws {Error} If initialization fails or chat hierarchy setup fails
81
- */
82
- import(): Promise<{
83
- refChatId: number;
84
- }>;
85
- /**
86
- * Cleans up resources by closing the database connection.
87
- */
88
- private cleanup;
89
- }
90
-
91
- /**
92
- * Component: Logger
93
- * Block-UUID: 8e2a3b1c-9d4f-4a5e-8b6a-7c8d9e0f1a2b
94
- * Parent-UUID: N/A
95
- * Version: 1.0.0
96
- * Purpose: Centralized logging utility for the application.
97
- * Language: TypeScript
98
- * Created-at: 2025-03-12T18:06:11.373Z
99
- * Authors: OpenRouter - Gemini Flash 2.0 (v1.0.0)
100
- */
101
- declare class Logger {
102
- private readonly verbose;
103
- constructor(verbose?: boolean);
104
- /**
105
- * Logs messages to the console if verbose mode is enabled.
106
- */
107
- log(message: string, details?: unknown, isError?: boolean): void;
108
- /**
109
- * Logs a debug message.
110
- * @param message - The message to log.
111
- * @param details - Optional details to include in the log.
112
- */
113
- debug(message: string, details?: unknown): void;
114
- /**
115
- * Logs an info message.
116
- * @param message - The message to log.
117
- * @param details - Optional details to include in the log.
118
- */
119
- info(message: string, details?: unknown): void;
120
- /**
121
- * Logs a warning message.
122
- * @param message - The message to log.
123
- * @param details - Optional details to include in the log.
124
- */
125
- warn(message: string, details?: unknown): void;
126
- /**
127
- * Logs an error message.
128
- * @param message - The message to log.
129
- * @param error - Optional error object to include in the log.
130
- */
131
- error(message: string, error?: unknown): void;
132
- }
133
-
134
- /**
135
- * Component: Chat Manager
136
- * Block-UUID: 7f9a0b1c-2d3e-4f5a-8b9c-0d1e2f3a4b5c
137
- * Parent-UUID: 5e6f7a8b-9c0d-1e2f-3a4b-5c6d7e8f9a0b
138
- * Version: 2.0.0
139
- * Purpose: Core class for managing chats, groups, and messages, with proxy methods for other managers
140
- * Language: TypeScript
141
- * Created-at: 2025-03-15T02:19:00.075Z
142
- * Updated-at: 2025-03-16T06:45:00.075Z
143
- * Authors: together.ai - DeepSeek v3 (v1.0.0), OpenRouter - Gemini Flash 2.0 (v1.1.0), together.ai - DeepSeek v3 (v2.0.0)
144
- */
145
-
146
- declare class ChatManager {
147
- private readonly dbClient;
148
- private readonly gitRepo;
149
- private readonly repoOwner;
150
- private readonly repoName;
151
- private readonly ref;
152
- private readonly refType;
153
- private readonly options;
154
- private readonly logger;
155
- private readonly chatCreator;
156
- private readonly groupManager;
157
- private readonly messageManager;
158
- private readonly metadataManager;
159
- private readonly hierarchyManager;
160
- constructor(dbClient: DatabaseClient, gitRepo: Repository, repoOwner: string, repoName: string, ref: string, refType: RefType, options: ChatManagerOptions | undefined, logger: Logger);
161
- /**
162
- * Sets up the chat hierarchy for the repository.
163
- * Creates or updates groups and chats for `git-repos`, `git-repo-owner`, `git-repo`, and `git-ref`.
164
- * Returns the ID of the `git-ref` chat.
165
- */
166
- setupChatHierarchy(): Promise<{
167
- refChatId: number;
168
- repoGroupId: number;
169
- }>;
170
- /**
171
- * Ensures the existence of a "git-repos" chat.
172
- * This method can be used independently of the GitImporter to create the chat if it doesn't exist.
173
- * @returns The ID of the "git-repos" chat
174
- */
175
- ensureGitReposChat(): Promise<number>;
176
- /**
177
- * Marks a chat as starting an import.
178
- */
179
- markImportStarted(chatId: number): Promise<void>;
180
- /**
181
- * Marks a chat as finished importing.
182
- */
183
- markImportFinished(chatId: number, commitInfo?: GitCommitInfo): Promise<void>;
184
- /**
185
- * Marks a chat as failed to import.
186
- */
187
- markImportFailed(chatId: number, error: Error): Promise<void>;
188
- /**
189
- * Updates metadata for a file chat.
190
- */
191
- updateFileMetadata(chatId: number, filePath: string, commitInfo: GitCommitInfo): Promise<void>;
192
- /**
193
- * Updates metadata for a directory chat.
194
- */
195
- updateDirectoryMetadata(chatId: number, path: string, commitInfo: GitCommitInfo | null): Promise<void>;
196
- /**
197
- * Marks a file as deleted.
198
- */
199
- markFileAsDeleted(chatId: number, filePath: string): Promise<void>;
200
- /**
201
- * Marks a directory as deleted.
202
- */
203
- markDirectoryAsDeleted(chatId: number, dirPath: string): Promise<void>;
204
- createSystemMessage(chatId: number): Promise<number>;
205
- createMainMessage(chatId: number, parentId: number, chatType: ChatType, message?: string): Promise<number>;
206
- createChatMetaMessage(chatId: number, parentId: number): Promise<number>;
207
- getMessageById(messageId: number): Promise<Message>;
208
- getMessageByChatIdAndType(chatId: number, type: string): Promise<Message>;
209
- updateMessage(messageId: number, updates: Partial<Message>): Promise<void>;
210
- createChat(type: ChatType, name: string, parentId: number, groupId: number, meta: any, mainMessage?: string, orderWeight?: number): Promise<number>;
211
- createOrUpdateGroup(type: GroupType, name: string): Promise<number>;
212
- getChatById(chatId: number): Promise<Chat>;
213
- }
214
-
215
- export { ChatManager, GitImporter, type ImportOptions, Logger };