@mnemonik/shared 1.0.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.
- package/dist/FileSystemReader.d.ts +60 -0
- package/dist/FileSystemReader.d.ts.map +1 -0
- package/dist/FileSystemReader.js +236 -0
- package/dist/FileSystemReader.js.map +1 -0
- package/dist/asyncUtils.d.ts +2 -0
- package/dist/asyncUtils.d.ts.map +1 -0
- package/dist/asyncUtils.js +12 -0
- package/dist/asyncUtils.js.map +1 -0
- package/dist/codeScanner.d.ts +96 -0
- package/dist/codeScanner.d.ts.map +1 -0
- package/dist/codeScanner.js +620 -0
- package/dist/codeScanner.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions.d.ts +34 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +52 -0
- package/dist/instructions.js.map +1 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +8 -0
- package/dist/logger.js.map +1 -0
- package/dist/usageGuide.d.ts +14 -0
- package/dist/usageGuide.d.ts.map +1 -0
- package/dist/usageGuide.js +75 -0
- package/dist/usageGuide.js.map +1 -0
- package/package.json +28 -0
- package/src/FileSystemReader.ts +299 -0
- package/src/asyncUtils.ts +16 -0
- package/src/codeScanner.ts +727 -0
- package/src/index.ts +17 -0
- package/src/instructions.ts +55 -0
- package/src/logger.ts +7 -0
- package/src/usageGuide.ts +75 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Scanner - Parse and chunk source files for embedding
|
|
3
|
+
*/
|
|
4
|
+
import { readdir, readFile, stat, lstat, realpath } from 'fs/promises';
|
|
5
|
+
import { join, relative, extname } from 'path';
|
|
6
|
+
import { createHash } from 'crypto';
|
|
7
|
+
import { debug as logDebug } from './logger.js';
|
|
8
|
+
import { withTimeout } from './asyncUtils.js';
|
|
9
|
+
/**
|
|
10
|
+
* v2.46: File operation timeout (5 seconds) to prevent hanging on slow/unresponsive filesystems
|
|
11
|
+
*/
|
|
12
|
+
const FILE_OP_TIMEOUT_MS = 5000;
|
|
13
|
+
const DEFAULT_OPTIONS = {
|
|
14
|
+
maxChunkSize: 8000, // ~2000 tokens
|
|
15
|
+
minChunkSize: 100,
|
|
16
|
+
ignorePatterns: [
|
|
17
|
+
// JavaScript/Node
|
|
18
|
+
'node_modules',
|
|
19
|
+
'.next',
|
|
20
|
+
// Python virtual environments
|
|
21
|
+
'venv',
|
|
22
|
+
'.venv',
|
|
23
|
+
'env',
|
|
24
|
+
'.env',
|
|
25
|
+
'__pycache__',
|
|
26
|
+
'.tox',
|
|
27
|
+
'.mypy_cache',
|
|
28
|
+
'.pytest_cache',
|
|
29
|
+
// Build outputs
|
|
30
|
+
'dist',
|
|
31
|
+
'build',
|
|
32
|
+
'target',
|
|
33
|
+
'bin',
|
|
34
|
+
'obj',
|
|
35
|
+
'coverage',
|
|
36
|
+
// Version control & cache
|
|
37
|
+
'.git',
|
|
38
|
+
'.cache',
|
|
39
|
+
'.DS_Store',
|
|
40
|
+
// Lock files
|
|
41
|
+
'*.log',
|
|
42
|
+
'*.lock',
|
|
43
|
+
'package-lock.json',
|
|
44
|
+
'yarn.lock',
|
|
45
|
+
// Minified/bundled files - too large and not useful for context
|
|
46
|
+
'*.min.js',
|
|
47
|
+
'*.min.css',
|
|
48
|
+
'*.bundle.js',
|
|
49
|
+
'*.legacy.js',
|
|
50
|
+
'*.map',
|
|
51
|
+
],
|
|
52
|
+
includeExtensions: [
|
|
53
|
+
'.ts',
|
|
54
|
+
'.tsx',
|
|
55
|
+
'.js',
|
|
56
|
+
'.jsx',
|
|
57
|
+
'.py',
|
|
58
|
+
'.rs',
|
|
59
|
+
'.go',
|
|
60
|
+
'.java',
|
|
61
|
+
'.c',
|
|
62
|
+
'.cpp',
|
|
63
|
+
'.h',
|
|
64
|
+
'.cs',
|
|
65
|
+
'.rb',
|
|
66
|
+
'.php',
|
|
67
|
+
'.swift',
|
|
68
|
+
'.kt',
|
|
69
|
+
'.md',
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
export class CodeScanner {
|
|
73
|
+
options;
|
|
74
|
+
constructor(options = {}) {
|
|
75
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Maximum directory depth for recursive scanning
|
|
79
|
+
* v2.43: Prevents runaway recursion on deep/symlinked structures
|
|
80
|
+
*/
|
|
81
|
+
static MAX_DEPTH = 10;
|
|
82
|
+
/**
|
|
83
|
+
* Scan a directory recursively and extract code chunks
|
|
84
|
+
* v2.43: Added max depth (10) to prevent infinite recursion
|
|
85
|
+
*/
|
|
86
|
+
async scanDirectory(rootPath) {
|
|
87
|
+
const chunks = [];
|
|
88
|
+
await this.traverseDirectory(rootPath, rootPath, chunks, 0);
|
|
89
|
+
return chunks;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Scan specific files and extract code chunks.
|
|
93
|
+
* Pass rootPath to compute proper relative file paths in chunk metadata.
|
|
94
|
+
*/
|
|
95
|
+
async scanFiles(filePaths, rootPath) {
|
|
96
|
+
const chunks = [];
|
|
97
|
+
for (const filePath of filePaths) {
|
|
98
|
+
try {
|
|
99
|
+
if (this.shouldIgnore(filePath)) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const ext = extname(filePath);
|
|
103
|
+
if (this.options.includeExtensions.includes(ext)) {
|
|
104
|
+
const fileChunks = await this.parseFile(filePath, rootPath || filePath);
|
|
105
|
+
chunks.push(...fileChunks);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
logDebug('Error scanning file', { filePath, error });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return chunks;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Recursively traverse directory
|
|
116
|
+
* v2.43: Added depth parameter with max limit
|
|
117
|
+
*/
|
|
118
|
+
async traverseDirectory(currentPath, rootPath, chunks, depth) {
|
|
119
|
+
// v2.43: Prevent infinite recursion
|
|
120
|
+
if (depth >= CodeScanner.MAX_DEPTH) {
|
|
121
|
+
logDebug('Max directory depth reached, skipping', { path: currentPath, depth });
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
// v2.46: Wrap readdir with timeout to prevent hanging
|
|
126
|
+
const entries = await withTimeout(readdir(currentPath), FILE_OP_TIMEOUT_MS, `readdir timed out: ${currentPath}`);
|
|
127
|
+
for (const entry of entries) {
|
|
128
|
+
const fullPath = join(currentPath, entry);
|
|
129
|
+
const relativePath = relative(rootPath, fullPath);
|
|
130
|
+
// Check ignore patterns
|
|
131
|
+
if (this.shouldIgnore(relativePath)) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
const lstats = await withTimeout(lstat(fullPath), FILE_OP_TIMEOUT_MS, `lstat timed out: ${fullPath}`);
|
|
135
|
+
if (lstats.isSymbolicLink()) {
|
|
136
|
+
const resolved = await realpath(fullPath);
|
|
137
|
+
const resolvedRoot = await realpath(rootPath);
|
|
138
|
+
if (!resolved.startsWith(resolvedRoot + '/') && resolved !== resolvedRoot) {
|
|
139
|
+
logDebug('Skipping symlink escaping project root', { fullPath, resolved, rootPath });
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const stats = lstats.isSymbolicLink()
|
|
144
|
+
? await withTimeout(stat(fullPath), FILE_OP_TIMEOUT_MS, `stat timed out: ${fullPath}`)
|
|
145
|
+
: lstats;
|
|
146
|
+
if (stats.isDirectory()) {
|
|
147
|
+
await this.traverseDirectory(fullPath, rootPath, chunks, depth + 1);
|
|
148
|
+
}
|
|
149
|
+
else if (stats.isFile()) {
|
|
150
|
+
const ext = extname(fullPath);
|
|
151
|
+
if (this.options.includeExtensions.includes(ext)) {
|
|
152
|
+
const fileChunks = await this.parseFile(fullPath, rootPath);
|
|
153
|
+
chunks.push(...fileChunks);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
logDebug('Error traversing directory', { path: currentPath, error });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Check if path should be ignored
|
|
164
|
+
* v2.71: Fixed glob-to-regex conversion and substring matching.
|
|
165
|
+
* - Escape regex special chars before replacing * with .*
|
|
166
|
+
* - Replace ALL * occurrences (not just the first)
|
|
167
|
+
* - For non-glob patterns, match on path segments to avoid false positives
|
|
168
|
+
* (e.g., '.env' should not match '.environment.ts')
|
|
169
|
+
*/
|
|
170
|
+
shouldIgnore(path) {
|
|
171
|
+
const segments = path.split('/');
|
|
172
|
+
return this.options.ignorePatterns.some((pattern) => {
|
|
173
|
+
if (pattern.includes('*')) {
|
|
174
|
+
// Escape regex special chars, then replace all * with .*
|
|
175
|
+
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&');
|
|
176
|
+
const regex = new RegExp(escaped.replace(/\*/g, '.*'));
|
|
177
|
+
return regex.test(path);
|
|
178
|
+
}
|
|
179
|
+
// For non-glob patterns, check if any path segment matches exactly
|
|
180
|
+
// or if the full path ends with the pattern (for extension-like patterns)
|
|
181
|
+
return segments.some((segment) => segment === pattern) || path.endsWith('/' + pattern);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Parse a file and extract code chunks
|
|
186
|
+
* v2.43: Added 10MB file size limit
|
|
187
|
+
*/
|
|
188
|
+
static MAX_FILE_SIZE = 10 * 1024 * 1024; // 10MB
|
|
189
|
+
async parseFile(filePath, rootPath) {
|
|
190
|
+
try {
|
|
191
|
+
// v2.43: Check file size before reading to avoid memory issues
|
|
192
|
+
// v2.46: Wrap stat with timeout
|
|
193
|
+
const stats = await withTimeout(stat(filePath), FILE_OP_TIMEOUT_MS, `stat timed out: ${filePath}`);
|
|
194
|
+
if (stats.size > CodeScanner.MAX_FILE_SIZE) {
|
|
195
|
+
logDebug('Skipping file exceeding size limit', {
|
|
196
|
+
filePath,
|
|
197
|
+
size: stats.size,
|
|
198
|
+
limit: CodeScanner.MAX_FILE_SIZE,
|
|
199
|
+
});
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
// v2.46: Wrap readFile with timeout
|
|
203
|
+
const content = await withTimeout(readFile(filePath, 'utf-8'), FILE_OP_TIMEOUT_MS, `readFile timed out: ${filePath}`);
|
|
204
|
+
const relativePath = relative(rootPath, filePath);
|
|
205
|
+
const language = this.detectLanguage(filePath);
|
|
206
|
+
// Try to extract functions/classes
|
|
207
|
+
if (language === 'markdown') {
|
|
208
|
+
return this.chunkMarkdown(content, relativePath, stats.size);
|
|
209
|
+
}
|
|
210
|
+
const structuredChunks = this.extractStructuredChunks(content, language);
|
|
211
|
+
const fileMetadata = {
|
|
212
|
+
fileName: filePath.split('/').pop() || '',
|
|
213
|
+
extension: extname(filePath),
|
|
214
|
+
size: stats.size,
|
|
215
|
+
};
|
|
216
|
+
if (structuredChunks.length > 0) {
|
|
217
|
+
const mapped = structuredChunks.map(({ signature, symbolName, ...chunk }) => ({
|
|
218
|
+
...chunk,
|
|
219
|
+
filePath: relativePath,
|
|
220
|
+
language,
|
|
221
|
+
metadata: {
|
|
222
|
+
...fileMetadata,
|
|
223
|
+
...(signature && { signature }),
|
|
224
|
+
...(symbolName && { symbolName }),
|
|
225
|
+
},
|
|
226
|
+
}));
|
|
227
|
+
// Coverage check: if structured chunks cover less than 50% of file lines,
|
|
228
|
+
// supplement with raw chunks for uncovered regions. This prevents a single
|
|
229
|
+
// small match from blocking all raw chunking in large files.
|
|
230
|
+
const totalLines = content.split('\n').length;
|
|
231
|
+
const coveredLines = new Set();
|
|
232
|
+
for (const chunk of structuredChunks) {
|
|
233
|
+
for (let l = chunk.startLine; l <= chunk.endLine; l++) {
|
|
234
|
+
coveredLines.add(l);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const coverageRatio = coveredLines.size / totalLines;
|
|
238
|
+
if (coverageRatio < 0.5 && totalLines > 50) {
|
|
239
|
+
const rawChunks = this.chunkRaw(content, relativePath, language, stats.size);
|
|
240
|
+
// Only keep raw chunks that don't overlap with structured chunks
|
|
241
|
+
const supplemental = rawChunks.filter((rc) => {
|
|
242
|
+
for (const sc of structuredChunks) {
|
|
243
|
+
if (rc.startLine <= sc.endLine && rc.endLine >= sc.startLine) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
});
|
|
249
|
+
mapped.push(...supplemental);
|
|
250
|
+
}
|
|
251
|
+
return mapped;
|
|
252
|
+
}
|
|
253
|
+
// Fall back to raw chunking
|
|
254
|
+
return this.chunkRaw(content, relativePath, language, stats.size);
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
logDebug('Error parsing file', { filePath, error });
|
|
258
|
+
return [];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Detect language from file extension
|
|
263
|
+
*/
|
|
264
|
+
detectLanguage(filePath) {
|
|
265
|
+
const ext = extname(filePath).toLowerCase();
|
|
266
|
+
const langMap = {
|
|
267
|
+
'.ts': 'typescript',
|
|
268
|
+
'.tsx': 'typescript',
|
|
269
|
+
'.js': 'javascript',
|
|
270
|
+
'.jsx': 'javascript',
|
|
271
|
+
'.py': 'python',
|
|
272
|
+
'.rs': 'rust',
|
|
273
|
+
'.go': 'go',
|
|
274
|
+
'.java': 'java',
|
|
275
|
+
'.c': 'c',
|
|
276
|
+
'.cpp': 'cpp',
|
|
277
|
+
'.h': 'c',
|
|
278
|
+
'.cs': 'csharp',
|
|
279
|
+
'.rb': 'ruby',
|
|
280
|
+
'.php': 'php',
|
|
281
|
+
'.swift': 'swift',
|
|
282
|
+
'.kt': 'kotlin',
|
|
283
|
+
'.md': 'markdown',
|
|
284
|
+
};
|
|
285
|
+
return langMap[ext] || 'unknown';
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Chunk markdown files by headers
|
|
289
|
+
*/
|
|
290
|
+
chunkMarkdown(content, filePath, size) {
|
|
291
|
+
const chunks = [];
|
|
292
|
+
const lines = content.split('\n');
|
|
293
|
+
let currentChunk = [];
|
|
294
|
+
let currentStartLine = 1;
|
|
295
|
+
for (let i = 0; i < lines.length; i++) {
|
|
296
|
+
const line = lines[i];
|
|
297
|
+
if (line === undefined)
|
|
298
|
+
continue;
|
|
299
|
+
const isHeader = /^#{1,6}\s/.test(line);
|
|
300
|
+
// If we hit a new header and have content, push the previous chunk
|
|
301
|
+
if (isHeader && currentChunk.length > 0) {
|
|
302
|
+
const chunkContent = currentChunk.join('\n').trim();
|
|
303
|
+
if (chunkContent.length >= this.options.minChunkSize) {
|
|
304
|
+
chunks.push({
|
|
305
|
+
content: chunkContent,
|
|
306
|
+
filePath,
|
|
307
|
+
language: 'markdown',
|
|
308
|
+
startLine: currentStartLine,
|
|
309
|
+
endLine: i, // Previous line
|
|
310
|
+
chunkType: 'module', // Treat sections as modules
|
|
311
|
+
contentHash: this.hash(chunkContent),
|
|
312
|
+
metadata: {
|
|
313
|
+
fileName: filePath.split('/').pop() || '',
|
|
314
|
+
extension: '.md',
|
|
315
|
+
size,
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
currentChunk = [];
|
|
320
|
+
currentStartLine = i + 1;
|
|
321
|
+
// currentHeader = line; // unused
|
|
322
|
+
}
|
|
323
|
+
currentChunk.push(line);
|
|
324
|
+
// If chunk gets too big, force a split (fallback to raw-like behavior but inside markdown logic)
|
|
325
|
+
if (currentChunk.join('\n').length > this.options.maxChunkSize) {
|
|
326
|
+
const chunkContent = currentChunk.join('\n').trim();
|
|
327
|
+
chunks.push({
|
|
328
|
+
content: chunkContent,
|
|
329
|
+
filePath,
|
|
330
|
+
language: 'markdown',
|
|
331
|
+
startLine: currentStartLine,
|
|
332
|
+
endLine: i + 1,
|
|
333
|
+
chunkType: 'raw',
|
|
334
|
+
contentHash: this.hash(chunkContent),
|
|
335
|
+
metadata: {
|
|
336
|
+
fileName: filePath.split('/').pop() || '',
|
|
337
|
+
extension: '.md',
|
|
338
|
+
size,
|
|
339
|
+
},
|
|
340
|
+
});
|
|
341
|
+
currentChunk = [];
|
|
342
|
+
currentStartLine = i + 2;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// Push remaining content
|
|
346
|
+
if (currentChunk.length > 0) {
|
|
347
|
+
const chunkContent = currentChunk.join('\n').trim();
|
|
348
|
+
if (chunkContent.length >= this.options.minChunkSize) {
|
|
349
|
+
chunks.push({
|
|
350
|
+
content: chunkContent,
|
|
351
|
+
filePath,
|
|
352
|
+
language: 'markdown',
|
|
353
|
+
startLine: currentStartLine,
|
|
354
|
+
endLine: lines.length,
|
|
355
|
+
chunkType: 'module',
|
|
356
|
+
contentHash: this.hash(chunkContent),
|
|
357
|
+
metadata: {
|
|
358
|
+
fileName: filePath.split('/').pop() || '',
|
|
359
|
+
extension: '.md',
|
|
360
|
+
size,
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return chunks;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Find the index of the closing brace matching the opening brace at openIndex.
|
|
369
|
+
* Handles nested braces. Skips braces inside string literals, template literals,
|
|
370
|
+
* single-line comments, multi-line comments, and regex literals.
|
|
371
|
+
*/
|
|
372
|
+
findMatchingBrace(content, openIndex) {
|
|
373
|
+
if (content[openIndex] !== '{')
|
|
374
|
+
return -1;
|
|
375
|
+
let depth = 1;
|
|
376
|
+
let i = openIndex + 1;
|
|
377
|
+
const len = content.length;
|
|
378
|
+
while (i < len) {
|
|
379
|
+
const c = content[i];
|
|
380
|
+
const next = i + 1 < len ? content[i + 1] : '';
|
|
381
|
+
// Single-line comment
|
|
382
|
+
if (c === '/' && next === '/') {
|
|
383
|
+
i = content.indexOf('\n', i);
|
|
384
|
+
if (i === -1)
|
|
385
|
+
return -1;
|
|
386
|
+
i++;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
// Multi-line comment
|
|
390
|
+
if (c === '/' && next === '*') {
|
|
391
|
+
i = content.indexOf('*/', i + 2);
|
|
392
|
+
if (i === -1)
|
|
393
|
+
return -1;
|
|
394
|
+
i += 2;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
// String literals (single or double quote)
|
|
398
|
+
if (c === "'" || c === '"') {
|
|
399
|
+
i++;
|
|
400
|
+
while (i < len && content[i] !== c) {
|
|
401
|
+
if (content[i] === '\\')
|
|
402
|
+
i++; // skip escaped char
|
|
403
|
+
i++;
|
|
404
|
+
}
|
|
405
|
+
i++; // skip closing quote
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
// Template literal
|
|
409
|
+
if (c === '`') {
|
|
410
|
+
i++;
|
|
411
|
+
while (i < len && content[i] !== '`') {
|
|
412
|
+
if (content[i] === '\\')
|
|
413
|
+
i++; // skip escaped char
|
|
414
|
+
i++;
|
|
415
|
+
}
|
|
416
|
+
i++; // skip closing backtick
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
// Regex literal — heuristic: / after operator chars or keywords that precede expressions
|
|
420
|
+
if (c === '/' && i > 0) {
|
|
421
|
+
// Look back for operator context (skip whitespace)
|
|
422
|
+
let j = i - 1;
|
|
423
|
+
while (j >= 0 && (content[j] === ' ' || content[j] === '\t'))
|
|
424
|
+
j--;
|
|
425
|
+
const prev = j >= 0 ? content[j] : '\n';
|
|
426
|
+
// Check for keywords that precede regex: return, typeof, void, delete, throw, new, case, in, instanceof
|
|
427
|
+
let isRegexContext = '=({[,;:!&|?+->~^%\n'.includes(prev);
|
|
428
|
+
if (!isRegexContext && j >= 0 && /[a-z]/.test(prev)) {
|
|
429
|
+
// Extract the word ending at position j
|
|
430
|
+
let wordStart = j;
|
|
431
|
+
while (wordStart > 0 && /[a-z]/.test(content[wordStart - 1]))
|
|
432
|
+
wordStart--;
|
|
433
|
+
const word = content.substring(wordStart, j + 1);
|
|
434
|
+
const regexKeywords = [
|
|
435
|
+
'return',
|
|
436
|
+
'typeof',
|
|
437
|
+
'void',
|
|
438
|
+
'delete',
|
|
439
|
+
'throw',
|
|
440
|
+
'new',
|
|
441
|
+
'case',
|
|
442
|
+
'in',
|
|
443
|
+
'instanceof',
|
|
444
|
+
'yield',
|
|
445
|
+
'await',
|
|
446
|
+
];
|
|
447
|
+
isRegexContext = regexKeywords.includes(word);
|
|
448
|
+
}
|
|
449
|
+
if (isRegexContext) {
|
|
450
|
+
i++;
|
|
451
|
+
while (i < len && content[i] !== '/') {
|
|
452
|
+
if (content[i] === '\\') {
|
|
453
|
+
i++; // skip escaped char
|
|
454
|
+
}
|
|
455
|
+
else if (content[i] === '[') {
|
|
456
|
+
// character class — skip to ]
|
|
457
|
+
i++;
|
|
458
|
+
while (i < len && content[i] !== ']') {
|
|
459
|
+
if (content[i] === '\\')
|
|
460
|
+
i++;
|
|
461
|
+
i++;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
i++;
|
|
465
|
+
}
|
|
466
|
+
i++; // skip closing /
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (c === '{')
|
|
471
|
+
depth++;
|
|
472
|
+
else if (c === '}') {
|
|
473
|
+
depth--;
|
|
474
|
+
if (depth === 0)
|
|
475
|
+
return i;
|
|
476
|
+
}
|
|
477
|
+
i++;
|
|
478
|
+
}
|
|
479
|
+
return -1;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Extract structured chunks (functions, classes)
|
|
483
|
+
* v2.76: Uses brace-matching for TS/JS/Rust so nested braces are not truncated at first \n}
|
|
484
|
+
*/
|
|
485
|
+
extractStructuredChunks(content, language) {
|
|
486
|
+
const chunks = [];
|
|
487
|
+
const patterns = this.getLanguagePatterns(language);
|
|
488
|
+
const useBraceMatch = ['typescript', 'javascript', 'rust'].includes(language);
|
|
489
|
+
for (const pattern of patterns) {
|
|
490
|
+
let match;
|
|
491
|
+
const regex = new RegExp(pattern.regex, 'gm');
|
|
492
|
+
while ((match = regex.exec(content)) !== null) {
|
|
493
|
+
let matchContent;
|
|
494
|
+
if (useBraceMatch && pattern.regex.endsWith('\\{')) {
|
|
495
|
+
const openBraceIndex = match.index + match[0].length - 1;
|
|
496
|
+
if (content[openBraceIndex] === '{') {
|
|
497
|
+
const closeIndex = this.findMatchingBrace(content, openBraceIndex);
|
|
498
|
+
if (closeIndex >= 0) {
|
|
499
|
+
matchContent = content.slice(match.index, closeIndex + 1);
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
matchContent = match[0];
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
matchContent = match[0];
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
matchContent = match[0];
|
|
511
|
+
}
|
|
512
|
+
const startLine = content.substring(0, match.index).split('\n').length;
|
|
513
|
+
const endLine = startLine + matchContent.split('\n').length - 1;
|
|
514
|
+
if (matchContent.length >= this.options.minChunkSize &&
|
|
515
|
+
matchContent.length <= this.options.maxChunkSize) {
|
|
516
|
+
// v3.3: Extract function/class signature and symbol name
|
|
517
|
+
const firstLine = matchContent.split('\n')[0].trim();
|
|
518
|
+
const signature = firstLine.replace(/\{$/, '').trim() || undefined;
|
|
519
|
+
const nameMatch = firstLine.match(/(?:function|class|const|interface|type|enum|export\s+(?:default\s+)?(?:function|class|const|interface|type|enum))\s+(\w+)/);
|
|
520
|
+
const symbolName = nameMatch?.[1] || undefined;
|
|
521
|
+
chunks.push({
|
|
522
|
+
content: matchContent.trim(),
|
|
523
|
+
startLine,
|
|
524
|
+
endLine,
|
|
525
|
+
chunkType: pattern.type,
|
|
526
|
+
contentHash: this.hash(matchContent),
|
|
527
|
+
signature,
|
|
528
|
+
symbolName,
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return chunks;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Get regex patterns for language
|
|
537
|
+
*/
|
|
538
|
+
getLanguagePatterns(language) {
|
|
539
|
+
switch (language) {
|
|
540
|
+
case 'typescript':
|
|
541
|
+
case 'javascript':
|
|
542
|
+
return [
|
|
543
|
+
// Classes (body extracted via brace-matching)
|
|
544
|
+
{
|
|
545
|
+
regex: '(?:export\\s+)?(?:abstract\\s+)?class\\s+\\w+[^{]*\\{',
|
|
546
|
+
type: 'class',
|
|
547
|
+
},
|
|
548
|
+
// Functions (body extracted via brace-matching)
|
|
549
|
+
{
|
|
550
|
+
regex: '(?:export\\s+)?(?:async\\s+)?function\\s+\\w+[^{]*\\{',
|
|
551
|
+
type: 'function',
|
|
552
|
+
},
|
|
553
|
+
// Arrow functions (body extracted via brace-matching)
|
|
554
|
+
{
|
|
555
|
+
regex: '(?:export\\s+)?const\\s+\\w+\\s*=\\s*(?:async\\s+)?\\([^)]*\\)\\s*=>\\s*\\{',
|
|
556
|
+
type: 'function',
|
|
557
|
+
},
|
|
558
|
+
// Class methods — matches indented methods with optional modifiers.
|
|
559
|
+
// Excludes control flow keywords (if, for, while, switch, catch, return).
|
|
560
|
+
{
|
|
561
|
+
regex: '^\\s+(?:(?:private|protected|public|static|abstract|override|readonly|async|get|set)\\s+)*(?!if|for|while|switch|catch|return|throw|new|import|export)\\w+\\s*(?:<[^>]*>)?\\s*\\([^)]*\\)[^{]*\\{',
|
|
562
|
+
type: 'function',
|
|
563
|
+
},
|
|
564
|
+
];
|
|
565
|
+
case 'python':
|
|
566
|
+
return [
|
|
567
|
+
// Classes
|
|
568
|
+
{ regex: 'class\\s+\\w+[^:]*:[^]*?(?=\\nclass\\s|\\ndef\\s|$)', type: 'class' },
|
|
569
|
+
// Functions
|
|
570
|
+
{ regex: 'def\\s+\\w+[^:]*:[^]*?(?=\\ndef\\s|\\nclass\\s|$)', type: 'function' },
|
|
571
|
+
];
|
|
572
|
+
case 'rust':
|
|
573
|
+
return [
|
|
574
|
+
// Functions (body extracted via brace-matching)
|
|
575
|
+
{ regex: '(?:pub\\s+)?fn\\s+\\w+[^{]*\\{', type: 'function' },
|
|
576
|
+
// Structs (single-line style; no nested braces in pattern)
|
|
577
|
+
{ regex: '(?:pub\\s+)?struct\\s+\\w+[^}]*\\}', type: 'class' },
|
|
578
|
+
];
|
|
579
|
+
default:
|
|
580
|
+
return [];
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Fall back to raw chunking with overlap
|
|
585
|
+
*/
|
|
586
|
+
chunkRaw(content, filePath, language, size) {
|
|
587
|
+
const chunks = [];
|
|
588
|
+
const lines = content.split('\n');
|
|
589
|
+
const chunkSizeLines = Math.floor(this.options.maxChunkSize / 80); // Assume ~80 chars per line
|
|
590
|
+
const overlapLines = Math.floor(chunkSizeLines * 0.1); // 10% overlap
|
|
591
|
+
for (let i = 0; i < lines.length; i += chunkSizeLines - overlapLines) {
|
|
592
|
+
const chunkLines = lines.slice(i, i + chunkSizeLines);
|
|
593
|
+
const chunkContent = chunkLines.join('\n');
|
|
594
|
+
if (chunkContent.length >= this.options.minChunkSize) {
|
|
595
|
+
chunks.push({
|
|
596
|
+
content: chunkContent.trim(),
|
|
597
|
+
filePath,
|
|
598
|
+
language,
|
|
599
|
+
startLine: i + 1,
|
|
600
|
+
endLine: i + chunkLines.length,
|
|
601
|
+
chunkType: 'raw',
|
|
602
|
+
contentHash: this.hash(chunkContent),
|
|
603
|
+
metadata: {
|
|
604
|
+
fileName: filePath.split('/').pop() || '',
|
|
605
|
+
extension: extname(filePath),
|
|
606
|
+
size,
|
|
607
|
+
},
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return chunks;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Generate content hash for drift detection
|
|
615
|
+
*/
|
|
616
|
+
hash(content) {
|
|
617
|
+
return createHash('sha256').update(content).digest('hex').substring(0, 16);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
//# sourceMappingURL=codeScanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeScanner.js","sourceRoot":"","sources":["../src/codeScanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AACH,MAAM,kBAAkB,GAAG,IAAI,CAAC;AA0BhC,MAAM,eAAe,GAA0B;IAC7C,YAAY,EAAE,IAAI,EAAE,eAAe;IACnC,YAAY,EAAE,GAAG;IACjB,cAAc,EAAE;QACd,kBAAkB;QAClB,cAAc;QACd,OAAO;QACP,8BAA8B;QAC9B,MAAM;QACN,OAAO;QACP,KAAK;QACL,MAAM;QACN,aAAa;QACb,MAAM;QACN,aAAa;QACb,eAAe;QACf,gBAAgB;QAChB,MAAM;QACN,OAAO;QACP,QAAQ;QACR,KAAK;QACL,KAAK;QACL,UAAU;QACV,0BAA0B;QAC1B,MAAM;QACN,QAAQ;QACR,WAAW;QACX,aAAa;QACb,OAAO;QACP,QAAQ;QACR,mBAAmB;QACnB,WAAW;QACX,gEAAgE;QAChE,UAAU;QACV,WAAW;QACX,aAAa;QACb,aAAa;QACb,OAAO;KACR;IACD,iBAAiB,EAAE;QACjB,KAAK;QACL,MAAM;QACN,KAAK;QACL,MAAM;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CAAC,GAAG,cAAc,CAAC,CAAC;YACtD,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE3C,IAAI,YAAY,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBACrD,MAAM,CAAC,IAAI,CAAC;oBACV,OAAO,EAAE,YAAY,CAAC,IAAI,EAAE;oBAC5B,QAAQ;oBACR,QAAQ;oBACR,SAAS,EAAE,CAAC,GAAG,CAAC;oBAChB,OAAO,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM;oBAC9B,SAAS,EAAE,KAAK;oBAChB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;oBACpC,QAAQ,EAAE;wBACR,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE;wBACzC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC;wBAC5B,IAAI;qBACL;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,IAAI,CAAC,OAAe;QAC1B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7E,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mnemonik/shared - Shared constants and utilities
|
|
3
|
+
*
|
|
4
|
+
* This package provides a single source of truth for constants
|
|
5
|
+
* that need to be shared across Mnemonik packages.
|
|
6
|
+
*/
|
|
7
|
+
export { MCP_INSTRUCTIONS, MCP_INSTRUCTIONS_RAW, getMcpInstructions } from './instructions.js';
|
|
8
|
+
export { USAGE_GUIDE } from './usageGuide.js';
|
|
9
|
+
export { CodeScanner, type CodeChunk, type ScanOptions } from './codeScanner.js';
|
|
10
|
+
export { FileSystemReader, getFileSystemReader, type ScanFilesResult, type ChangedFilesResult, type FileData, } from './FileSystemReader.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,GACd,MAAM,uBAAuB,CAAC"}
|