midas-mcp 5.15.0 → 5.18.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/README.md +4 -4
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js +21 -84
- package/dist/ai.js.map +1 -1
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +95 -57
- package/dist/analyzer.js.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/code-discovery.d.ts +75 -0
- package/dist/code-discovery.d.ts.map +1 -0
- package/dist/code-discovery.js +606 -0
- package/dist/code-discovery.js.map +1 -0
- package/dist/docs/CHEATSHEET.md +1 -1
- package/dist/docs/CURSORRULES_TEMPLATE.md +2 -2
- package/dist/docs/METHODOLOGY.md +1 -1
- package/dist/docs/SPEC.md +6 -6
- package/dist/docs/USER_RULES.md +2 -2
- package/dist/docs/WHY.md +1 -1
- package/dist/docs-discovery.d.ts +59 -0
- package/dist/docs-discovery.d.ts.map +1 -0
- package/dist/docs-discovery.js +361 -0
- package/dist/docs-discovery.js.map +1 -0
- package/dist/reality.d.ts.map +1 -1
- package/dist/reality.js +14 -37
- package/dist/reality.js.map +1 -1
- package/dist/state/phase.d.ts +5 -4
- package/dist/state/phase.d.ts.map +1 -1
- package/dist/state/phase.js +18 -18
- package/dist/state/phase.js.map +1 -1
- package/dist/tools/analyze.js +3 -3
- package/dist/tools/analyze.js.map +1 -1
- package/dist/tools/grow.js +1 -1
- package/dist/tools/grow.js.map +1 -1
- package/dist/tools/phase.d.ts +3 -3
- package/dist/tools/phase.js +7 -7
- package/dist/tools/phase.js.map +1 -1
- package/dist/tools/validate.js +2 -2
- package/dist/tools/validate.js.map +1 -1
- package/dist/tracker.d.ts.map +1 -1
- package/dist/tracker.js +25 -14
- package/dist/tracker.js.map +1 -1
- package/dist/tui.js +3 -3
- package/dist/tui.js.map +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/CURSORRULES_TEMPLATE.md +2 -2
- package/docs/METHODOLOGY.md +1 -1
- package/docs/SPEC.md +6 -6
- package/docs/USER_RULES.md +2 -2
- package/docs/WHY.md +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intelligent Source Code Discovery and Reading
|
|
3
|
+
*
|
|
4
|
+
* Instead of hardcoded file limits and arbitrary truncation, this module:
|
|
5
|
+
* 1. Discovers ALL source files intelligently
|
|
6
|
+
* 2. Prioritizes based on context (errors, git activity, phase, mentions)
|
|
7
|
+
* 3. Reads files with token-budget awareness
|
|
8
|
+
* 4. Uses semantic chunking for large files
|
|
9
|
+
* 5. Adapts to the current development phase
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
|
|
12
|
+
import { join, extname, basename, relative } from 'path';
|
|
13
|
+
import { sanitizePath } from './security.js';
|
|
14
|
+
import { estimateTokens } from './context.js';
|
|
15
|
+
import { logger } from './logger.js';
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// FILE PATTERNS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Source code extensions by language
|
|
20
|
+
const SOURCE_EXTENSIONS = {
|
|
21
|
+
typescript: ['.ts', '.tsx', '.mts', '.cts'],
|
|
22
|
+
javascript: ['.js', '.jsx', '.mjs', '.cjs'],
|
|
23
|
+
python: ['.py', '.pyw', '.pyi'],
|
|
24
|
+
rust: ['.rs'],
|
|
25
|
+
go: ['.go'],
|
|
26
|
+
java: ['.java'],
|
|
27
|
+
kotlin: ['.kt', '.kts'],
|
|
28
|
+
swift: ['.swift'],
|
|
29
|
+
csharp: ['.cs'],
|
|
30
|
+
cpp: ['.cpp', '.cc', '.cxx', '.hpp', '.h'],
|
|
31
|
+
c: ['.c', '.h'],
|
|
32
|
+
ruby: ['.rb'],
|
|
33
|
+
php: ['.php'],
|
|
34
|
+
shell: ['.sh', '.bash', '.zsh'],
|
|
35
|
+
sql: ['.sql'],
|
|
36
|
+
graphql: ['.graphql', '.gql'],
|
|
37
|
+
};
|
|
38
|
+
const ALL_SOURCE_EXTENSIONS = new Set(Object.values(SOURCE_EXTENSIONS).flat());
|
|
39
|
+
// Config file patterns
|
|
40
|
+
const CONFIG_PATTERNS = [
|
|
41
|
+
/^package\.json$/,
|
|
42
|
+
/^tsconfig.*\.json$/,
|
|
43
|
+
/^\..*rc(\.json|\.js|\.cjs|\.mjs)?$/,
|
|
44
|
+
/^.*config\.(js|ts|json|mjs|cjs)$/,
|
|
45
|
+
/^Cargo\.toml$/,
|
|
46
|
+
/^pyproject\.toml$/,
|
|
47
|
+
/^go\.(mod|sum)$/,
|
|
48
|
+
/^Gemfile$/,
|
|
49
|
+
/^Makefile$/,
|
|
50
|
+
/^Dockerfile/,
|
|
51
|
+
/^docker-compose/,
|
|
52
|
+
/^\.env\.example$/,
|
|
53
|
+
];
|
|
54
|
+
// Test file patterns
|
|
55
|
+
const TEST_PATTERNS = [
|
|
56
|
+
/\.test\./,
|
|
57
|
+
/\.spec\./,
|
|
58
|
+
/_test\./,
|
|
59
|
+
/test_/,
|
|
60
|
+
/__tests__/,
|
|
61
|
+
/tests\//,
|
|
62
|
+
/spec\//,
|
|
63
|
+
];
|
|
64
|
+
// High-priority file patterns (entry points, core files)
|
|
65
|
+
const PRIORITY_PATTERNS = [
|
|
66
|
+
/^index\./,
|
|
67
|
+
/^main\./,
|
|
68
|
+
/^app\./,
|
|
69
|
+
/^server\./,
|
|
70
|
+
/^api\./,
|
|
71
|
+
/^routes?\./,
|
|
72
|
+
/^handlers?\./,
|
|
73
|
+
/^controllers?\./,
|
|
74
|
+
/^models?\./,
|
|
75
|
+
/^schema\./,
|
|
76
|
+
/^types?\./,
|
|
77
|
+
/^utils?\./,
|
|
78
|
+
/^lib\./,
|
|
79
|
+
/^core\./,
|
|
80
|
+
/^services?\./,
|
|
81
|
+
];
|
|
82
|
+
// Directories to skip
|
|
83
|
+
const SKIP_DIRECTORIES = new Set([
|
|
84
|
+
'node_modules', '.git', 'dist', 'build', 'out', 'target',
|
|
85
|
+
'.next', '.nuxt', '.svelte-kit', '.output',
|
|
86
|
+
'coverage', '__pycache__', '.pytest_cache', '.mypy_cache',
|
|
87
|
+
'vendor', 'venv', '.venv', 'env', '.env',
|
|
88
|
+
'.midas', '.cursor', '.vscode', '.idea',
|
|
89
|
+
'assets', 'public', 'static', 'images', 'fonts',
|
|
90
|
+
]);
|
|
91
|
+
// ============================================================================
|
|
92
|
+
// FILE DISCOVERY
|
|
93
|
+
// ============================================================================
|
|
94
|
+
/**
|
|
95
|
+
* Discover all source files in a project
|
|
96
|
+
*/
|
|
97
|
+
export function discoverSourceFiles(projectPath, context = {}) {
|
|
98
|
+
const safePath = sanitizePath(projectPath);
|
|
99
|
+
const files = [];
|
|
100
|
+
function scan(dir, depth = 0) {
|
|
101
|
+
if (depth > 10)
|
|
102
|
+
return; // Prevent infinite recursion
|
|
103
|
+
if (!existsSync(dir))
|
|
104
|
+
return;
|
|
105
|
+
try {
|
|
106
|
+
const entries = readdirSync(dir);
|
|
107
|
+
for (const entry of entries) {
|
|
108
|
+
// Skip hidden files except specific configs
|
|
109
|
+
if (entry.startsWith('.') && !isConfigFile(entry))
|
|
110
|
+
continue;
|
|
111
|
+
const fullPath = join(dir, entry);
|
|
112
|
+
const relativePath = relative(safePath, fullPath);
|
|
113
|
+
try {
|
|
114
|
+
const stat = statSync(fullPath);
|
|
115
|
+
if (stat.isDirectory()) {
|
|
116
|
+
const dirName = basename(entry).toLowerCase();
|
|
117
|
+
if (!SKIP_DIRECTORIES.has(dirName)) {
|
|
118
|
+
scan(fullPath, depth + 1);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (stat.isFile()) {
|
|
122
|
+
const ext = extname(entry).toLowerCase();
|
|
123
|
+
// Include source files and config files
|
|
124
|
+
if (ALL_SOURCE_EXTENSIONS.has(ext) || isConfigFile(entry)) {
|
|
125
|
+
const file = {
|
|
126
|
+
path: relativePath,
|
|
127
|
+
absolutePath: fullPath,
|
|
128
|
+
filename: entry,
|
|
129
|
+
extension: ext,
|
|
130
|
+
sizeBytes: stat.size,
|
|
131
|
+
lastModified: stat.mtimeMs,
|
|
132
|
+
relevanceScore: 0,
|
|
133
|
+
reasons: [],
|
|
134
|
+
};
|
|
135
|
+
// Calculate relevance score
|
|
136
|
+
scoreFile(file, context);
|
|
137
|
+
files.push(file);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// Skip files we can't stat
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
// Skip directories we can't read
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
scan(safePath);
|
|
151
|
+
// Sort by relevance score (highest first)
|
|
152
|
+
files.sort((a, b) => b.relevanceScore - a.relevanceScore);
|
|
153
|
+
return files;
|
|
154
|
+
}
|
|
155
|
+
function isConfigFile(filename) {
|
|
156
|
+
return CONFIG_PATTERNS.some(p => p.test(filename));
|
|
157
|
+
}
|
|
158
|
+
function isTestFile(path) {
|
|
159
|
+
return TEST_PATTERNS.some(p => p.test(path));
|
|
160
|
+
}
|
|
161
|
+
function isPriorityFile(filename) {
|
|
162
|
+
return PRIORITY_PATTERNS.some(p => p.test(filename));
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Score a file based on context and patterns
|
|
166
|
+
*/
|
|
167
|
+
function scoreFile(file, context) {
|
|
168
|
+
let score = 50; // Base score
|
|
169
|
+
const reasons = [];
|
|
170
|
+
// 1. Priority patterns (entry points, core files)
|
|
171
|
+
if (isPriorityFile(file.filename)) {
|
|
172
|
+
score += 20;
|
|
173
|
+
reasons.push('core file');
|
|
174
|
+
}
|
|
175
|
+
// 2. Test files - score based on phase
|
|
176
|
+
if (isTestFile(file.path)) {
|
|
177
|
+
file.reasons.push('test file');
|
|
178
|
+
if (context.phase?.phase === 'BUILD' &&
|
|
179
|
+
(context.phase.step === 'TEST' || context.phase.step === 'DEBUG')) {
|
|
180
|
+
score += 15;
|
|
181
|
+
reasons.push('testing phase');
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
score -= 10; // Deprioritize tests when not testing
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// 3. Config files - always somewhat relevant
|
|
188
|
+
if (isConfigFile(file.filename)) {
|
|
189
|
+
score += 10;
|
|
190
|
+
reasons.push('config');
|
|
191
|
+
}
|
|
192
|
+
// 4. Mentioned in errors
|
|
193
|
+
if (context.errors?.some(e => e.includes(file.path) || e.includes(file.filename))) {
|
|
194
|
+
score += 30;
|
|
195
|
+
reasons.push('error location');
|
|
196
|
+
}
|
|
197
|
+
// 5. Mentioned in conversation/journal
|
|
198
|
+
if (context.mentions?.some(m => file.path.includes(m) || m.includes(file.filename))) {
|
|
199
|
+
score += 25;
|
|
200
|
+
reasons.push('mentioned');
|
|
201
|
+
}
|
|
202
|
+
// 6. Explicitly focused
|
|
203
|
+
if (context.focusFiles?.some(f => file.path.includes(f) || f.includes(file.path))) {
|
|
204
|
+
score += 40;
|
|
205
|
+
reasons.push('focus file');
|
|
206
|
+
}
|
|
207
|
+
// 7. Recently modified (last hour = +15, last day = +10, last week = +5)
|
|
208
|
+
const hourAgo = Date.now() - 3600000;
|
|
209
|
+
const dayAgo = Date.now() - 86400000;
|
|
210
|
+
const weekAgo = Date.now() - 604800000;
|
|
211
|
+
if (file.lastModified > hourAgo) {
|
|
212
|
+
score += 15;
|
|
213
|
+
reasons.push('recently modified');
|
|
214
|
+
}
|
|
215
|
+
else if (file.lastModified > dayAgo) {
|
|
216
|
+
score += 10;
|
|
217
|
+
reasons.push('modified today');
|
|
218
|
+
}
|
|
219
|
+
else if (file.lastModified > weekAgo) {
|
|
220
|
+
score += 5;
|
|
221
|
+
}
|
|
222
|
+
// 8. Mentioned in recent commits
|
|
223
|
+
if (context.recentCommits?.some(c => c.includes(file.filename))) {
|
|
224
|
+
score += 10;
|
|
225
|
+
reasons.push('in commit');
|
|
226
|
+
}
|
|
227
|
+
// 9. Source directory bonus (src/, lib/, app/)
|
|
228
|
+
if (file.path.startsWith('src/') || file.path.startsWith('lib/') || file.path.startsWith('app/')) {
|
|
229
|
+
score += 5;
|
|
230
|
+
}
|
|
231
|
+
// 10. Penalize very large files slightly
|
|
232
|
+
if (file.sizeBytes > 50000) {
|
|
233
|
+
score -= 5;
|
|
234
|
+
}
|
|
235
|
+
// Clamp score
|
|
236
|
+
file.relevanceScore = Math.max(0, Math.min(100, score));
|
|
237
|
+
file.reasons = reasons;
|
|
238
|
+
}
|
|
239
|
+
// ============================================================================
|
|
240
|
+
// SMART FILE READING
|
|
241
|
+
// ============================================================================
|
|
242
|
+
/**
|
|
243
|
+
* Read files intelligently with token budget awareness
|
|
244
|
+
*/
|
|
245
|
+
export function readSourceFiles(files, options = {}) {
|
|
246
|
+
const { maxTokens = 50000, // Default ~50k tokens for code
|
|
247
|
+
maxFilesToRead = 50, // Read up to 50 files
|
|
248
|
+
maxLinesPerFile = 500, // Max lines per file (if truncating)
|
|
249
|
+
includeTests = true, fullRead = false, } = options;
|
|
250
|
+
let tokenBudget = maxTokens;
|
|
251
|
+
let filesRead = 0;
|
|
252
|
+
// Filter files if needed
|
|
253
|
+
let filesToRead = files;
|
|
254
|
+
if (!includeTests) {
|
|
255
|
+
filesToRead = files.filter(f => !isTestFile(f.path));
|
|
256
|
+
}
|
|
257
|
+
// Read files in order of relevance until budget exhausted
|
|
258
|
+
for (const file of filesToRead) {
|
|
259
|
+
if (filesRead >= maxFilesToRead && !fullRead)
|
|
260
|
+
break;
|
|
261
|
+
if (tokenBudget <= 0 && !fullRead)
|
|
262
|
+
break;
|
|
263
|
+
try {
|
|
264
|
+
const content = readFileSync(file.absolutePath, 'utf-8');
|
|
265
|
+
const lines = content.split('\n');
|
|
266
|
+
file.lineCount = lines.length;
|
|
267
|
+
// Estimate tokens
|
|
268
|
+
const tokens = estimateTokens(content);
|
|
269
|
+
file.tokenEstimate = tokens;
|
|
270
|
+
// Check if we have budget
|
|
271
|
+
if (!fullRead && tokens > tokenBudget) {
|
|
272
|
+
// Try to read partial file
|
|
273
|
+
const availableLines = Math.floor((tokenBudget / tokens) * lines.length);
|
|
274
|
+
if (availableLines < 20) {
|
|
275
|
+
// Not enough budget for meaningful content
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
// Read with smart truncation
|
|
279
|
+
file.content = smartTruncate(content, lines, Math.min(availableLines, maxLinesPerFile));
|
|
280
|
+
file.truncated = true;
|
|
281
|
+
tokenBudget -= estimateTokens(file.content);
|
|
282
|
+
}
|
|
283
|
+
else if (!fullRead && lines.length > maxLinesPerFile) {
|
|
284
|
+
// File too long, smart truncate
|
|
285
|
+
file.content = smartTruncate(content, lines, maxLinesPerFile);
|
|
286
|
+
file.truncated = true;
|
|
287
|
+
tokenBudget -= estimateTokens(file.content);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
// Read full file
|
|
291
|
+
file.content = content;
|
|
292
|
+
file.truncated = false;
|
|
293
|
+
tokenBudget -= tokens;
|
|
294
|
+
}
|
|
295
|
+
filesRead++;
|
|
296
|
+
}
|
|
297
|
+
catch (err) {
|
|
298
|
+
logger.debug(`Could not read ${file.path}: ${err}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return filesToRead.filter(f => f.content !== undefined);
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Smart truncation that preserves important parts of code
|
|
305
|
+
*/
|
|
306
|
+
function smartTruncate(content, lines, maxLines) {
|
|
307
|
+
if (lines.length <= maxLines)
|
|
308
|
+
return content;
|
|
309
|
+
// Strategy: Keep imports/exports, beginning, and end
|
|
310
|
+
// Middle usually has implementation details that can be inferred
|
|
311
|
+
const result = [];
|
|
312
|
+
let linesTaken = 0;
|
|
313
|
+
// 1. Keep all imports/exports at the beginning (up to 30% of budget)
|
|
314
|
+
const importBudget = Math.floor(maxLines * 0.3);
|
|
315
|
+
let importLines = 0;
|
|
316
|
+
for (let i = 0; i < lines.length && importLines < importBudget; i++) {
|
|
317
|
+
const line = lines[i].trim();
|
|
318
|
+
if (line.startsWith('import ') ||
|
|
319
|
+
line.startsWith('export ') ||
|
|
320
|
+
line.startsWith('from ') ||
|
|
321
|
+
line.startsWith('require(') ||
|
|
322
|
+
line.startsWith('const ') && line.includes('require(') ||
|
|
323
|
+
line.startsWith('use ') || // Rust
|
|
324
|
+
line.startsWith('package ') || // Go/Java
|
|
325
|
+
line === '' ||
|
|
326
|
+
line.startsWith('//') ||
|
|
327
|
+
line.startsWith('#')) {
|
|
328
|
+
result.push(lines[i]);
|
|
329
|
+
importLines++;
|
|
330
|
+
linesTaken++;
|
|
331
|
+
}
|
|
332
|
+
else if (importLines > 0) {
|
|
333
|
+
// End of imports section
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// 2. Keep type definitions and function signatures (next 30%)
|
|
338
|
+
const signatureBudget = Math.floor(maxLines * 0.3);
|
|
339
|
+
let signatureLines = 0;
|
|
340
|
+
for (let i = linesTaken; i < lines.length && signatureLines < signatureBudget; i++) {
|
|
341
|
+
const line = lines[i].trim();
|
|
342
|
+
const isSignature = line.startsWith('export ') ||
|
|
343
|
+
line.startsWith('interface ') ||
|
|
344
|
+
line.startsWith('type ') ||
|
|
345
|
+
line.startsWith('class ') ||
|
|
346
|
+
line.startsWith('struct ') ||
|
|
347
|
+
line.startsWith('enum ') ||
|
|
348
|
+
line.startsWith('function ') ||
|
|
349
|
+
line.startsWith('async function ') ||
|
|
350
|
+
line.startsWith('const ') && line.includes(' = (') ||
|
|
351
|
+
line.startsWith('def ') ||
|
|
352
|
+
line.startsWith('fn ') ||
|
|
353
|
+
line.startsWith('pub ') ||
|
|
354
|
+
line.match(/^\s*(public|private|protected)\s+/);
|
|
355
|
+
if (isSignature) {
|
|
356
|
+
result.push(lines[i]);
|
|
357
|
+
signatureLines++;
|
|
358
|
+
linesTaken = i + 1;
|
|
359
|
+
// Include opening brace if next line
|
|
360
|
+
if (i + 1 < lines.length && lines[i + 1].trim() === '{') {
|
|
361
|
+
result.push(lines[i + 1]);
|
|
362
|
+
signatureLines++;
|
|
363
|
+
linesTaken = i + 2;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// 3. Add truncation marker
|
|
368
|
+
const remaining = lines.length - linesTaken;
|
|
369
|
+
if (remaining > 20) {
|
|
370
|
+
result.push(`\n// ... ${remaining} lines of implementation ...\n`);
|
|
371
|
+
}
|
|
372
|
+
// 4. Keep the last 20% (exports, main logic at end)
|
|
373
|
+
const tailBudget = Math.floor(maxLines * 0.2);
|
|
374
|
+
const tailStart = Math.max(linesTaken, lines.length - tailBudget);
|
|
375
|
+
if (tailStart < lines.length) {
|
|
376
|
+
for (let i = tailStart; i < lines.length; i++) {
|
|
377
|
+
result.push(lines[i]);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return result.join('\n');
|
|
381
|
+
}
|
|
382
|
+
// ============================================================================
|
|
383
|
+
// HIGH-LEVEL API
|
|
384
|
+
// ============================================================================
|
|
385
|
+
/**
|
|
386
|
+
* Full discovery and reading with intelligent defaults
|
|
387
|
+
*/
|
|
388
|
+
export function discoverAndReadCode(projectPath, context = {}, options = {}) {
|
|
389
|
+
// Discover all files
|
|
390
|
+
const allFiles = discoverSourceFiles(projectPath, context);
|
|
391
|
+
// Categorize
|
|
392
|
+
const sourceFiles = allFiles.filter(f => !isTestFile(f.path) && !isConfigFile(f.filename));
|
|
393
|
+
const testFiles = allFiles.filter(f => isTestFile(f.path));
|
|
394
|
+
const configFiles = allFiles.filter(f => isConfigFile(f.filename));
|
|
395
|
+
// Read with context-aware options
|
|
396
|
+
const phaseOptions = getPhaseOptions(context.phase, options);
|
|
397
|
+
const readFiles = readSourceFiles(allFiles, phaseOptions);
|
|
398
|
+
// Calculate stats
|
|
399
|
+
const totalBytes = allFiles.reduce((sum, f) => sum + f.sizeBytes, 0);
|
|
400
|
+
const totalTokens = readFiles.reduce((sum, f) => sum + (f.tokenEstimate || 0), 0);
|
|
401
|
+
// Format for prompts
|
|
402
|
+
const fileList = formatFileList(allFiles);
|
|
403
|
+
const codeContext = formatCodeContext(readFiles);
|
|
404
|
+
return {
|
|
405
|
+
files: readFiles,
|
|
406
|
+
sourceFiles: readFiles.filter(f => !isTestFile(f.path) && !isConfigFile(f.filename)),
|
|
407
|
+
testFiles: readFiles.filter(f => isTestFile(f.path)),
|
|
408
|
+
configFiles: readFiles.filter(f => isConfigFile(f.filename)),
|
|
409
|
+
totalFiles: allFiles.length,
|
|
410
|
+
totalBytes,
|
|
411
|
+
totalTokens,
|
|
412
|
+
fileList,
|
|
413
|
+
codeContext,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Get read options based on current phase
|
|
418
|
+
*/
|
|
419
|
+
function getPhaseOptions(phase, overrides) {
|
|
420
|
+
const base = {
|
|
421
|
+
maxTokens: 50000,
|
|
422
|
+
maxFilesToRead: 50,
|
|
423
|
+
maxLinesPerFile: 500,
|
|
424
|
+
includeTests: true,
|
|
425
|
+
};
|
|
426
|
+
if (!phase || phase.phase === 'IDLE') {
|
|
427
|
+
// Default behavior
|
|
428
|
+
return { ...base, ...overrides };
|
|
429
|
+
}
|
|
430
|
+
switch (phase.phase) {
|
|
431
|
+
case 'PLAN':
|
|
432
|
+
// During planning, focus on structure, less on implementation
|
|
433
|
+
return {
|
|
434
|
+
...base,
|
|
435
|
+
maxTokens: 30000,
|
|
436
|
+
maxFilesToRead: 30,
|
|
437
|
+
includeTests: false,
|
|
438
|
+
...overrides,
|
|
439
|
+
};
|
|
440
|
+
case 'BUILD':
|
|
441
|
+
switch (phase.step) {
|
|
442
|
+
case 'TEST':
|
|
443
|
+
case 'DEBUG':
|
|
444
|
+
// Testing/debugging: include tests, focus on error files
|
|
445
|
+
return {
|
|
446
|
+
...base,
|
|
447
|
+
maxTokens: 60000,
|
|
448
|
+
maxFilesToRead: 60,
|
|
449
|
+
includeTests: true,
|
|
450
|
+
...overrides,
|
|
451
|
+
};
|
|
452
|
+
case 'IMPLEMENT':
|
|
453
|
+
// Implementation: balance of source and tests
|
|
454
|
+
return {
|
|
455
|
+
...base,
|
|
456
|
+
maxTokens: 50000,
|
|
457
|
+
maxFilesToRead: 50,
|
|
458
|
+
includeTests: true,
|
|
459
|
+
...overrides,
|
|
460
|
+
};
|
|
461
|
+
default:
|
|
462
|
+
return { ...base, ...overrides };
|
|
463
|
+
}
|
|
464
|
+
case 'SHIP':
|
|
465
|
+
// Shipping: full code review, include everything
|
|
466
|
+
return {
|
|
467
|
+
...base,
|
|
468
|
+
maxTokens: 70000,
|
|
469
|
+
maxFilesToRead: 70,
|
|
470
|
+
includeTests: true,
|
|
471
|
+
...overrides,
|
|
472
|
+
};
|
|
473
|
+
case 'GROW':
|
|
474
|
+
// Growth: less code focus
|
|
475
|
+
return {
|
|
476
|
+
...base,
|
|
477
|
+
maxTokens: 20000,
|
|
478
|
+
maxFilesToRead: 20,
|
|
479
|
+
includeTests: false,
|
|
480
|
+
...overrides,
|
|
481
|
+
};
|
|
482
|
+
default:
|
|
483
|
+
return { ...base, ...overrides };
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Format file list for prompts (shows structure)
|
|
488
|
+
*/
|
|
489
|
+
function formatFileList(files) {
|
|
490
|
+
// Group by directory
|
|
491
|
+
const byDir = {};
|
|
492
|
+
for (const file of files) {
|
|
493
|
+
const parts = file.path.split('/');
|
|
494
|
+
const dir = parts.length > 1 ? parts.slice(0, -1).join('/') : '.';
|
|
495
|
+
if (!byDir[dir])
|
|
496
|
+
byDir[dir] = [];
|
|
497
|
+
byDir[dir].push(file);
|
|
498
|
+
}
|
|
499
|
+
// Format with hierarchy
|
|
500
|
+
const lines = [`## Project Structure (${files.length} files)\n`];
|
|
501
|
+
const sortedDirs = Object.keys(byDir).sort();
|
|
502
|
+
for (const dir of sortedDirs) {
|
|
503
|
+
const dirFiles = byDir[dir];
|
|
504
|
+
lines.push(`### ${dir}/`);
|
|
505
|
+
// Sort by relevance within dir
|
|
506
|
+
dirFiles.sort((a, b) => b.relevanceScore - a.relevanceScore);
|
|
507
|
+
for (const f of dirFiles.slice(0, 20)) { // Limit per directory
|
|
508
|
+
const score = f.relevanceScore > 70 ? '★' : f.relevanceScore > 50 ? '·' : '';
|
|
509
|
+
const reasons = f.reasons.length > 0 ? ` (${f.reasons.join(', ')})` : '';
|
|
510
|
+
lines.push(`- ${f.filename}${score}${reasons}`);
|
|
511
|
+
}
|
|
512
|
+
if (dirFiles.length > 20) {
|
|
513
|
+
lines.push(` ... and ${dirFiles.length - 20} more files`);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return lines.join('\n');
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Format code samples for prompts
|
|
520
|
+
*/
|
|
521
|
+
function formatCodeContext(files) {
|
|
522
|
+
const sections = [];
|
|
523
|
+
// Group by category
|
|
524
|
+
const highPriority = files.filter(f => f.relevanceScore >= 70);
|
|
525
|
+
const mediumPriority = files.filter(f => f.relevanceScore >= 50 && f.relevanceScore < 70);
|
|
526
|
+
const lowPriority = files.filter(f => f.relevanceScore < 50);
|
|
527
|
+
// Format high priority files with full context
|
|
528
|
+
if (highPriority.length > 0) {
|
|
529
|
+
sections.push('## Key Files (High Relevance)\n');
|
|
530
|
+
for (const f of highPriority) {
|
|
531
|
+
const truncNote = f.truncated ? ' [truncated]' : '';
|
|
532
|
+
const reasons = f.reasons.length > 0 ? ` — ${f.reasons.join(', ')}` : '';
|
|
533
|
+
sections.push(`### ${f.path}${truncNote}${reasons}\n\`\`\`${getLanguage(f.extension)}\n${f.content}\n\`\`\`\n`);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
// Format medium priority with less context
|
|
537
|
+
if (mediumPriority.length > 0) {
|
|
538
|
+
sections.push('## Supporting Files\n');
|
|
539
|
+
for (const f of mediumPriority) {
|
|
540
|
+
const truncNote = f.truncated ? ' [truncated]' : '';
|
|
541
|
+
sections.push(`### ${f.path}${truncNote}\n\`\`\`${getLanguage(f.extension)}\n${f.content}\n\`\`\`\n`);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
// Just list low priority
|
|
545
|
+
if (lowPriority.length > 0) {
|
|
546
|
+
sections.push(`## Other Files (${lowPriority.length} files with lower relevance, not shown)\n`);
|
|
547
|
+
sections.push(lowPriority.slice(0, 10).map(f => `- ${f.path}`).join('\n'));
|
|
548
|
+
}
|
|
549
|
+
return sections.join('\n');
|
|
550
|
+
}
|
|
551
|
+
function getLanguage(ext) {
|
|
552
|
+
const langMap = {
|
|
553
|
+
'.ts': 'typescript',
|
|
554
|
+
'.tsx': 'tsx',
|
|
555
|
+
'.js': 'javascript',
|
|
556
|
+
'.jsx': 'jsx',
|
|
557
|
+
'.py': 'python',
|
|
558
|
+
'.rs': 'rust',
|
|
559
|
+
'.go': 'go',
|
|
560
|
+
'.java': 'java',
|
|
561
|
+
'.kt': 'kotlin',
|
|
562
|
+
'.swift': 'swift',
|
|
563
|
+
'.cs': 'csharp',
|
|
564
|
+
'.cpp': 'cpp',
|
|
565
|
+
'.c': 'c',
|
|
566
|
+
'.rb': 'ruby',
|
|
567
|
+
'.php': 'php',
|
|
568
|
+
'.sh': 'bash',
|
|
569
|
+
'.sql': 'sql',
|
|
570
|
+
'.json': 'json',
|
|
571
|
+
'.yaml': 'yaml',
|
|
572
|
+
'.yml': 'yaml',
|
|
573
|
+
'.toml': 'toml',
|
|
574
|
+
};
|
|
575
|
+
return langMap[ext] || '';
|
|
576
|
+
}
|
|
577
|
+
// ============================================================================
|
|
578
|
+
// UTILITY EXPORTS
|
|
579
|
+
// ============================================================================
|
|
580
|
+
/**
|
|
581
|
+
* Quick check: does the project have tests?
|
|
582
|
+
*/
|
|
583
|
+
export function hasTestFiles(projectPath) {
|
|
584
|
+
const files = discoverSourceFiles(projectPath);
|
|
585
|
+
return files.some(f => isTestFile(f.path));
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Get files related to a specific error
|
|
589
|
+
*/
|
|
590
|
+
export function getErrorRelatedFiles(projectPath, errorMessage) {
|
|
591
|
+
const context = {
|
|
592
|
+
errors: [errorMessage],
|
|
593
|
+
};
|
|
594
|
+
const files = discoverSourceFiles(projectPath, context);
|
|
595
|
+
return files.filter(f => f.reasons.includes('error location'));
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Get recently modified files
|
|
599
|
+
*/
|
|
600
|
+
export function getRecentlyModifiedFiles(projectPath, maxAge = 86400000 // 24 hours
|
|
601
|
+
) {
|
|
602
|
+
const cutoff = Date.now() - maxAge;
|
|
603
|
+
const files = discoverSourceFiles(projectPath);
|
|
604
|
+
return files.filter(f => f.lastModified > cutoff);
|
|
605
|
+
}
|
|
606
|
+
//# sourceMappingURL=code-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-discovery.js","sourceRoot":"","sources":["../src/code-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA4DrC,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,qCAAqC;AACrC,MAAM,iBAAiB,GAA6B;IAClD,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAC3C,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,E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,7 +31,7 @@ Always complete earlier steps before jumping to implementation.
|
|
|
31
31
|
|
|
32
32
|
## The 4 Phases:
|
|
33
33
|
|
|
34
|
-
###
|
|
34
|
+
### PLAN (Planning)
|
|
35
35
|
- IDEA: Define core idea, problem, audience
|
|
36
36
|
- RESEARCH: Landscape scan, competitors
|
|
37
37
|
- BRAINLIFT: Document unique insights
|
|
@@ -55,7 +55,7 @@ Always complete earlier steps before jumping to implementation.
|
|
|
55
55
|
### GROW (Iteration)
|
|
56
56
|
- FEEDBACK: Collect user feedback
|
|
57
57
|
- ANALYZE: Study metrics and behavior
|
|
58
|
-
- ITERATE: Plan next cycle (back to
|
|
58
|
+
- ITERATE: Plan next cycle (back to PLAN)
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
## Why This Works
|
package/dist/docs/METHODOLOGY.md
CHANGED