cortex-mcp 1.2.4 → 1.4.1

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 (63) hide show
  1. package/dist/db/memory-store.d.ts +2 -2
  2. package/dist/db/memory-store.d.ts.map +1 -1
  3. package/dist/db/memory-store.js +26 -4
  4. package/dist/db/memory-store.js.map +1 -1
  5. package/dist/memory/auto-learner.d.ts.map +1 -1
  6. package/dist/memory/auto-learner.js +62 -23
  7. package/dist/memory/auto-learner.js.map +1 -1
  8. package/dist/memory/convention-detector.d.ts +11 -0
  9. package/dist/memory/convention-detector.d.ts.map +1 -0
  10. package/dist/memory/convention-detector.js +294 -0
  11. package/dist/memory/convention-detector.js.map +1 -0
  12. package/dist/memory/correction-detector.d.ts +33 -0
  13. package/dist/memory/correction-detector.d.ts.map +1 -0
  14. package/dist/memory/correction-detector.js +129 -0
  15. package/dist/memory/correction-detector.js.map +1 -0
  16. package/dist/memory/error-learner.d.ts +26 -0
  17. package/dist/memory/error-learner.d.ts.map +1 -0
  18. package/dist/memory/error-learner.js +145 -0
  19. package/dist/memory/error-learner.js.map +1 -0
  20. package/dist/memory/file-relationships.d.ts +47 -0
  21. package/dist/memory/file-relationships.d.ts.map +1 -0
  22. package/dist/memory/file-relationships.js +130 -0
  23. package/dist/memory/file-relationships.js.map +1 -0
  24. package/dist/memory/impact-analyzer.d.ts +16 -0
  25. package/dist/memory/impact-analyzer.d.ts.map +1 -0
  26. package/dist/memory/impact-analyzer.js +189 -0
  27. package/dist/memory/impact-analyzer.js.map +1 -0
  28. package/dist/memory/instructions-generator.d.ts +30 -0
  29. package/dist/memory/instructions-generator.d.ts.map +1 -0
  30. package/dist/memory/instructions-generator.js +117 -0
  31. package/dist/memory/instructions-generator.js.map +1 -0
  32. package/dist/memory/pre-flight.d.ts +24 -0
  33. package/dist/memory/pre-flight.d.ts.map +1 -0
  34. package/dist/memory/pre-flight.js +121 -0
  35. package/dist/memory/pre-flight.js.map +1 -0
  36. package/dist/memory/preference-learner.d.ts +28 -0
  37. package/dist/memory/preference-learner.d.ts.map +1 -0
  38. package/dist/memory/preference-learner.js +144 -0
  39. package/dist/memory/preference-learner.js.map +1 -0
  40. package/dist/memory/regression-guard.d.ts +35 -0
  41. package/dist/memory/regression-guard.d.ts.map +1 -0
  42. package/dist/memory/regression-guard.js +90 -0
  43. package/dist/memory/regression-guard.js.map +1 -0
  44. package/dist/memory/resume-work.d.ts +37 -0
  45. package/dist/memory/resume-work.d.ts.map +1 -0
  46. package/dist/memory/resume-work.js +122 -0
  47. package/dist/memory/resume-work.js.map +1 -0
  48. package/dist/memory/success-tracker.d.ts +33 -0
  49. package/dist/memory/success-tracker.d.ts.map +1 -0
  50. package/dist/memory/success-tracker.js +75 -0
  51. package/dist/memory/success-tracker.js.map +1 -0
  52. package/dist/memory/tool-recommender.d.ts +29 -0
  53. package/dist/memory/tool-recommender.d.ts.map +1 -0
  54. package/dist/memory/tool-recommender.js +117 -0
  55. package/dist/memory/tool-recommender.js.map +1 -0
  56. package/dist/memory/usage-stats.d.ts +59 -0
  57. package/dist/memory/usage-stats.d.ts.map +1 -0
  58. package/dist/memory/usage-stats.js +122 -0
  59. package/dist/memory/usage-stats.js.map +1 -0
  60. package/dist/server/mcp-handler.d.ts.map +1 -1
  61. package/dist/server/mcp-handler.js +634 -14
  62. package/dist/server/mcp-handler.js.map +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Correction Detector — Catches user corrections automatically.
3
+ *
4
+ * The #1 gap in Cortex: when a user says "no, use X instead of Y",
5
+ * that correction is LOST when the conversation ends.
6
+ *
7
+ * This module scans text (both AI responses and user context) for
8
+ * correction patterns and auto-stores them as high-importance CORRECTION memories.
9
+ *
10
+ * Examples it catches:
11
+ * - "no, use vectors not vectorCache"
12
+ * - "that's wrong, it should be const"
13
+ * - "actually the file is in src/db/"
14
+ * - "I meant to use path.join"
15
+ */
16
+ export interface DetectedCorrection {
17
+ original: string;
18
+ corrected: string;
19
+ fullContext: string;
20
+ confidence: number;
21
+ source: 'user_correction' | 'ai_acknowledgment';
22
+ }
23
+ /**
24
+ * Detect corrections from user context text.
25
+ * Call this when auto_learn receives context about what the user said.
26
+ */
27
+ export declare function detectUserCorrections(userText: string): DetectedCorrection[];
28
+ /**
29
+ * Detect when the AI acknowledges a mistake in its own response.
30
+ * Call this from auto_learn on the AI's response text.
31
+ */
32
+ export declare function detectAIAcknowledgments(aiText: string): DetectedCorrection[];
33
+ //# sourceMappingURL=correction-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correction-detector.d.ts","sourceRoot":"","sources":["../../src/memory/correction-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,GAAG,mBAAmB,CAAC;CACnD;AA4DD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAyB5E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAuB5E"}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ /**
3
+ * Correction Detector — Catches user corrections automatically.
4
+ *
5
+ * The #1 gap in Cortex: when a user says "no, use X instead of Y",
6
+ * that correction is LOST when the conversation ends.
7
+ *
8
+ * This module scans text (both AI responses and user context) for
9
+ * correction patterns and auto-stores them as high-importance CORRECTION memories.
10
+ *
11
+ * Examples it catches:
12
+ * - "no, use vectors not vectorCache"
13
+ * - "that's wrong, it should be const"
14
+ * - "actually the file is in src/db/"
15
+ * - "I meant to use path.join"
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.detectUserCorrections = detectUserCorrections;
19
+ exports.detectAIAcknowledgments = detectAIAcknowledgments;
20
+ // ─── Correction Patterns ─────────────────────────────────────────────────────
21
+ const USER_CORRECTION_PATTERNS = [
22
+ // "no, use X not Y" / "no use X instead of Y"
23
+ {
24
+ regex: /\bno[,.]?\s+(use|it'?s|it should be|should be|change to|switch to)\s+(.{3,50}?)(?:\s+(?:not|instead of|rather than)\s+(.{3,50}))?[.!]?\s*$/gim,
25
+ extractGroups: (m) => ({ corrected: m[2]?.trim(), original: m[3]?.trim() }),
26
+ confidence: 0.90,
27
+ },
28
+ // "that's wrong" / "that's incorrect" / "that's not right"
29
+ {
30
+ regex: /\b(that'?s|this is)\s+(wrong|incorrect|not right|not correct|a mistake)\b.{0,80}/gi,
31
+ extractGroups: () => ({}),
32
+ confidence: 0.85,
33
+ },
34
+ // "actually, X" / "actually it should be X"
35
+ {
36
+ regex: /\bactually[,.]?\s+(it\s+)?(should be|is|use|the\s+\w+\s+is)\s+(.{5,80})/gi,
37
+ extractGroups: (m) => ({ corrected: m[3]?.trim() }),
38
+ confidence: 0.80,
39
+ },
40
+ // "I meant X" / "I mean X"
41
+ {
42
+ regex: /\bI\s+mean[t]?\s+(.{5,80})/gi,
43
+ extractGroups: (m) => ({ corrected: m[1]?.trim() }),
44
+ confidence: 0.75,
45
+ },
46
+ // "not X, but Y" / "not X, Y"
47
+ {
48
+ regex: /\bnot\s+(.{3,40}?)[,]\s*(but\s+)?(.{3,40})/gi,
49
+ extractGroups: (m) => ({ original: m[1]?.trim(), corrected: m[3]?.trim() }),
50
+ confidence: 0.70,
51
+ },
52
+ // "X is wrong" / "X is incorrect"
53
+ {
54
+ regex: /\b(.{5,40})\s+is\s+(wrong|incorrect|broken|outdated|deprecated)/gi,
55
+ extractGroups: (m) => ({ original: m[1]?.trim() }),
56
+ confidence: 0.75,
57
+ },
58
+ ];
59
+ // AI acknowledgment patterns — when the AI itself admits a mistake
60
+ const AI_ACKNOWLEDGMENT_PATTERNS = [
61
+ { regex: /\b(I apologize|sorry|my mistake|my bad|you'?re right|good catch)\b/gi, confidence: 0.85 },
62
+ { regex: /\b(let me fix that|let me correct|I was wrong|I made an error)\b/gi, confidence: 0.90 },
63
+ { regex: /\b(should have (used|been|done)|instead of .{3,30} I should)\b/gi, confidence: 0.85 },
64
+ { regex: /\b(the (correct|right|actual|proper) (way|approach|method|answer) is)\b/gi, confidence: 0.80 },
65
+ ];
66
+ // ─── Main Detector ───────────────────────────────────────────────────────────
67
+ /**
68
+ * Detect corrections from user context text.
69
+ * Call this when auto_learn receives context about what the user said.
70
+ */
71
+ function detectUserCorrections(userText) {
72
+ if (!userText || userText.length < 10)
73
+ return [];
74
+ const results = [];
75
+ const sentences = splitIntoSentences(userText);
76
+ for (const sentence of sentences) {
77
+ for (const pattern of USER_CORRECTION_PATTERNS) {
78
+ pattern.regex.lastIndex = 0;
79
+ const match = pattern.regex.exec(sentence);
80
+ if (match) {
81
+ const groups = pattern.extractGroups(match);
82
+ results.push({
83
+ original: groups.original || '',
84
+ corrected: groups.corrected || '',
85
+ fullContext: sentence.trim().slice(0, 200),
86
+ confidence: pattern.confidence,
87
+ source: 'user_correction',
88
+ });
89
+ break; // One match per sentence
90
+ }
91
+ }
92
+ }
93
+ return results;
94
+ }
95
+ /**
96
+ * Detect when the AI acknowledges a mistake in its own response.
97
+ * Call this from auto_learn on the AI's response text.
98
+ */
99
+ function detectAIAcknowledgments(aiText) {
100
+ if (!aiText || aiText.length < 15)
101
+ return [];
102
+ const results = [];
103
+ const sentences = splitIntoSentences(aiText);
104
+ for (const sentence of sentences) {
105
+ for (const pattern of AI_ACKNOWLEDGMENT_PATTERNS) {
106
+ pattern.regex.lastIndex = 0;
107
+ if (pattern.regex.test(sentence)) {
108
+ results.push({
109
+ original: '',
110
+ corrected: '',
111
+ fullContext: sentence.trim().slice(0, 200),
112
+ confidence: pattern.confidence,
113
+ source: 'ai_acknowledgment',
114
+ });
115
+ break;
116
+ }
117
+ }
118
+ }
119
+ return results;
120
+ }
121
+ // ─── Helper ──────────────────────────────────────────────────────────────────
122
+ function splitIntoSentences(text) {
123
+ return text
124
+ .replace(/\n+/g, '. ')
125
+ .split(/(?<=[.!?])\s+/)
126
+ .map(s => s.trim())
127
+ .filter(s => s.length > 8 && s.length < 300);
128
+ }
129
+ //# sourceMappingURL=correction-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correction-detector.js","sourceRoot":"","sources":["../../src/memory/correction-detector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAwEH,sDAyBC;AAMD,0DAuBC;AApHD,gFAAgF;AAEhF,MAAM,wBAAwB,GAIzB;IACD,8CAA8C;IAC9C;QACI,KAAK,EAAE,+IAA+I;QACtJ,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;QAC3E,UAAU,EAAE,IAAI;KACnB;IACD,2DAA2D;IAC3D;QACI,KAAK,EAAE,oFAAoF;QAC3F,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;QACzB,UAAU,EAAE,IAAI;KACnB;IACD,4CAA4C;IAC5C;QACI,KAAK,EAAE,2EAA2E;QAClF,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;QACnD,UAAU,EAAE,IAAI;KACnB;IACD,2BAA2B;IAC3B;QACI,KAAK,EAAE,8BAA8B;QACrC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;QACnD,UAAU,EAAE,IAAI;KACnB;IACD,8BAA8B;IAC9B;QAC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ACH,MAAM;YACV,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,gFAAgF;AAEhF,SAAS,kBAAkB,CAAC,IAAY;IACpC,OAAO,IAAI;SACN,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;SACrB,KAAK,CAAC,eAAe,CAAC;SACtB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Error Learner — Auto-captures build/test error patterns.
3
+ *
4
+ * When build output or test output contains errors, this module:
5
+ * 1. Extracts the error pattern (TS error codes, common messages)
6
+ * 2. Maps to a human-readable lesson ("TS2345: argument type mismatch")
7
+ * 3. Stores as BUG_FIX memory so the AI avoids repeating the same mistake
8
+ *
9
+ * This is the #1 gap: the AI keeps making the same TS compile errors
10
+ * because it forgets what went wrong last time.
11
+ */
12
+ export interface ErrorPattern {
13
+ errorType: string;
14
+ message: string;
15
+ file?: string;
16
+ confidence: number;
17
+ }
18
+ /**
19
+ * Extract error patterns from build/test output text.
20
+ */
21
+ export declare function extractErrorPatterns(text: string): ErrorPattern[];
22
+ /**
23
+ * Check if text contains build/test error indicators.
24
+ */
25
+ export declare function containsErrors(text: string): boolean;
26
+ //# sourceMappingURL=error-learner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-learner.d.ts","sourceRoot":"","sources":["../../src/memory/error-learner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,YAAY;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACtB;AAyBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAwFjE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAcpD"}
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ /**
3
+ * Error Learner — Auto-captures build/test error patterns.
4
+ *
5
+ * When build output or test output contains errors, this module:
6
+ * 1. Extracts the error pattern (TS error codes, common messages)
7
+ * 2. Maps to a human-readable lesson ("TS2345: argument type mismatch")
8
+ * 3. Stores as BUG_FIX memory so the AI avoids repeating the same mistake
9
+ *
10
+ * This is the #1 gap: the AI keeps making the same TS compile errors
11
+ * because it forgets what went wrong last time.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.extractErrorPatterns = extractErrorPatterns;
15
+ exports.containsErrors = containsErrors;
16
+ // ─── TypeScript Error Patterns ────────────────────────────────────────────────
17
+ const TS_ERROR_LESSONS = {
18
+ 'TS2345': 'Argument type mismatch — check function parameter types match expected signatures',
19
+ 'TS2322': 'Type assignment error — ensure the value matches the declared type',
20
+ 'TS2339': 'Property does not exist — check spelling or add the property to the interface',
21
+ 'TS2304': 'Cannot find name — missing import or undeclared variable',
22
+ 'TS2305': 'Module has no exported member — check the export name matches exactly',
23
+ 'TS2307': 'Cannot find module — check the import path is correct',
24
+ 'TS2554': 'Wrong number of arguments — check function signature for required params',
25
+ 'TS2769': 'No overload matches this call — check argument types against all overload signatures',
26
+ 'TS7006': 'Parameter implicitly has any type — add explicit type annotation',
27
+ 'TS2741': 'Missing property in type — add required properties to the object',
28
+ 'TS18046': 'Variable is of type unknown — add type assertion or type guard',
29
+ 'TS2352': 'Conversion of type may be a mistake — use "as unknown as T" for forced cast',
30
+ 'TS1005': 'Expected token — syntax error, check for missing brackets/semicolons',
31
+ 'TS2531': 'Object is possibly null — add null check or use optional chaining',
32
+ 'TS2532': 'Object is possibly undefined — add undefined check or use optional chaining',
33
+ 'TS2349': 'Not callable — value is not a function, check the type',
34
+ 'TS2551': 'Property does not exist, did you mean? — typo in property name',
35
+ 'TS6133': 'Declared but never used — remove unused variable or prefix with _',
36
+ };
37
+ /**
38
+ * Extract error patterns from build/test output text.
39
+ */
40
+ function extractErrorPatterns(text) {
41
+ const errors = [];
42
+ const seen = new Set();
43
+ // 1. TypeScript errors: TS2345, TS2322, etc.
44
+ const tsErrorRegex = /(?:error\s+)?(TS\d{4,5})\s*:\s*(.+?)(?:\r?\n|$)/gi;
45
+ let match;
46
+ while ((match = tsErrorRegex.exec(text)) !== null) {
47
+ const code = match[1].toUpperCase();
48
+ const msg = match[2].trim().slice(0, 150);
49
+ if (seen.has(code))
50
+ continue;
51
+ seen.add(code);
52
+ const lesson = TS_ERROR_LESSONS[code] || `${code}: ${msg}`;
53
+ errors.push({
54
+ errorType: code,
55
+ message: lesson,
56
+ confidence: 0.90,
57
+ });
58
+ }
59
+ // 2. TypeScript "not assignable" pattern (without error code)
60
+ if (!seen.has('TYPE_MISMATCH')) {
61
+ const assignRegex = /Type '([^']+)' is not assignable to type '([^']+)'/gi;
62
+ while ((match = assignRegex.exec(text)) !== null) {
63
+ if (seen.has('TYPE_MISMATCH'))
64
+ break;
65
+ seen.add('TYPE_MISMATCH');
66
+ errors.push({
67
+ errorType: 'TYPE_MISMATCH',
68
+ message: `Type mismatch: '${match[1].slice(0, 40)}' cannot be assigned to '${match[2].slice(0, 40)}' — check type compatibility`,
69
+ confidence: 0.85,
70
+ });
71
+ }
72
+ }
73
+ // 3. Module not found
74
+ const moduleRegex = /(?:Cannot find module|Module not found)[:\s]+['"]([^'"]+)['"]/gi;
75
+ while ((match = moduleRegex.exec(text)) !== null) {
76
+ const mod = match[1];
77
+ if (seen.has(`MOD:${mod}`))
78
+ continue;
79
+ seen.add(`MOD:${mod}`);
80
+ errors.push({
81
+ errorType: 'MODULE_NOT_FOUND',
82
+ message: `Module '${mod}' not found — verify it's installed in package.json and the import path is correct`,
83
+ confidence: 0.90,
84
+ });
85
+ }
86
+ // 4. Property does not exist on type
87
+ const propRegex = /Property '(\w+)' does not exist on type '([^']+)'/gi;
88
+ while ((match = propRegex.exec(text)) !== null) {
89
+ const key = `PROP:${match[1]}`;
90
+ if (seen.has(key))
91
+ continue;
92
+ seen.add(key);
93
+ errors.push({
94
+ errorType: 'MISSING_PROPERTY',
95
+ message: `Property '${match[1]}' not on type '${match[2].slice(0, 40)}' — check interface definition or use type assertion`,
96
+ confidence: 0.85,
97
+ });
98
+ }
99
+ // 5. Test failures
100
+ const testFailRegex = /(?:FAIL|FAILED|Error)[\s:]+(.+?test.+?)(?:\r?\n|$)/gi;
101
+ while ((match = testFailRegex.exec(text)) !== null) {
102
+ const key = `TEST:${match[1].slice(0, 30)}`;
103
+ if (seen.has(key))
104
+ continue;
105
+ seen.add(key);
106
+ errors.push({
107
+ errorType: 'TEST_FAILURE',
108
+ message: `Test failed: ${match[1].trim().slice(0, 100)}`,
109
+ file: match[1].trim(),
110
+ confidence: 0.75,
111
+ });
112
+ }
113
+ // 6. Function signature mismatch
114
+ const sigRegex = /Expected (\d+) arguments?, but got (\d+)/gi;
115
+ while ((match = sigRegex.exec(text)) !== null) {
116
+ if (seen.has('SIG_MISMATCH'))
117
+ continue;
118
+ seen.add('SIG_MISMATCH');
119
+ errors.push({
120
+ errorType: 'SIGNATURE_MISMATCH',
121
+ message: `Wrong argument count: expected ${match[1]} but got ${match[2]} — check the function signature`,
122
+ confidence: 0.90,
123
+ });
124
+ }
125
+ return errors;
126
+ }
127
+ /**
128
+ * Check if text contains build/test error indicators.
129
+ */
130
+ function containsErrors(text) {
131
+ const errorIndicators = [
132
+ /error TS\d{4}/i,
133
+ /\bFAIL\b.*test/i,
134
+ /Build failed/i,
135
+ /compilation error/i,
136
+ /Cannot find module/i,
137
+ /SyntaxError:/i,
138
+ /TypeError:/i,
139
+ /ReferenceError:/i,
140
+ /npm ERR!/,
141
+ /Exit code: [1-9]/,
142
+ ];
143
+ return errorIndicators.some(r => r.test(text));
144
+ }
145
+ //# sourceMappingURL=error-learner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-learner.js","sourceRoot":"","sources":["../../src/memory/error-learner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAmCH,oDAwFC;AAKD,wCAcC;AArID,iFAAiF;AAEjF,MAAM,gBAAgB,GAA2B;IAC7C,QAAQ,EAAE,mFAAmF;IAC7F,QAAQ,EAAE,oEAAoE;IAC9E,QAAQ,EAAE,+EAA+E;IACzF,QAAQ,EAAE,0DAA0D;IACpE,QAAQ,EAAE,uEAAuE;IACjF,QAAQ,EAAE,uDAAuD;IACjE,QAAQ,EAAE,0EAA0E;IACpF,QAAQ,EAAE,sFAAsF;IAChG,QAAQ,EAAE,kEAAkE;IAC5E,QAAQ,EAAE,kEAAkE;IAC5E,SAAS,EAAE,gEAAgE;IAC3E,QAAQ,EAAE,6EAA6E;IACvF,QAAQ,EAAE,sEAAsE;IAChF,QAAQ,EAAE,mEAAmE;IAC7E,QAAQ,EAAE,6EAA6E;IACvF,QAAQ,EAAE,wDAAwD;IAClE,QAAQ,EAAE,gEAAgE;IAC1E,QAAQ,EAAE,mEAAmE;CAChF,CAAC;AAEF;;GAEG;AACH,SAAgB,oBAAoB,CAAC,IAAY;IAC7C,MAAM,MAAM,GAAmB,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,6CAA6C;IAC7C,MAAM,YAAY,GAAG,mDAAmD,CAAC;IACzE,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACpC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAA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,gBAAgB,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;YACxD,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YACrB,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAED,iCAAiC;IACjC,MAAM,QAAQ,GAAG,4CAA4C,CAAC;IAC9D,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC;YAAE,SAAS;QACvC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC;YACR,SAAS,EAAE,oBAAoB;YAC/B,OAAO,EAAE,kCAAkC,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,iCAAiC;YACxG,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAY;IACvC,MAAM,eAAe,GAAG;QACpB,gBAAgB;QAChB,iBAAiB;QACjB,eAAe;QACf,oBAAoB;QACpB,qBAAqB;QACrB,eAAe;QACf,aAAa;QACb,kBAAkB;QAClB,UAAU;QACV,kBAAkB;KACrB,CAAC;IACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * File Relationship Mapper — Tracks which files are always edited together.
3
+ *
4
+ * When the AI edits file A and file B in the same session, this module:
5
+ * 1. Records the co-edit event
6
+ * 2. Over time, builds a map of "these files always change together"
7
+ * 3. Surfaces warnings when only one of a pair is being edited
8
+ *
9
+ * This prevents partial changes — the #1 cause of cascading failures.
10
+ * "You changed types.ts but didn't update mcp-handler.ts (edited together 5 times)"
11
+ */
12
+ import { MemoryStore } from '../db/memory-store';
13
+ export interface FileRelationship {
14
+ fileA: string;
15
+ fileB: string;
16
+ coEditCount: number;
17
+ lastCoEdit: number;
18
+ reason?: string;
19
+ }
20
+ /**
21
+ * Record that a file was edited in this session.
22
+ * Automatically tracks co-edit relationships.
23
+ */
24
+ export declare function recordFileEdit(filePath: string): void;
25
+ /**
26
+ * Get files that are frequently co-edited with the given file.
27
+ * Returns files that should also be checked/edited.
28
+ */
29
+ export declare function getRelatedFiles(filePath: string, memoryStore: MemoryStore): string[];
30
+ /**
31
+ * Get all co-edit relationships from this session (for end-of-session storage).
32
+ */
33
+ export declare function getSessionRelationships(): FileRelationship[];
34
+ /**
35
+ * Check if any related files are missing from the current edit set.
36
+ * Returns warnings about files that should probably also be edited.
37
+ */
38
+ export declare function checkMissingRelated(currentFile: string, memoryStore: MemoryStore): string[];
39
+ /**
40
+ * Store accumulated co-edit relationships as persistent memories.
41
+ */
42
+ export declare function storeRelationships(memoryStore: MemoryStore): number;
43
+ /**
44
+ * Reset session tracking (call at session end).
45
+ */
46
+ export declare function resetFileTracking(): void;
47
+ //# sourceMappingURL=file-relationships.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-relationships.d.ts","sourceRoot":"","sources":["../../src/memory/file-relationships.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAYrD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CA4BpF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,gBAAgB,EAAE,CAe5D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CAW3F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAyBnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAGxC"}
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.recordFileEdit = recordFileEdit;
4
+ exports.getRelatedFiles = getRelatedFiles;
5
+ exports.getSessionRelationships = getSessionRelationships;
6
+ exports.checkMissingRelated = checkMissingRelated;
7
+ exports.storeRelationships = storeRelationships;
8
+ exports.resetFileTracking = resetFileTracking;
9
+ // In-memory co-edit tracking (per session)
10
+ const sessionEdits = new Set();
11
+ const coEditMap = new Map();
12
+ /**
13
+ * Record that a file was edited in this session.
14
+ * Automatically tracks co-edit relationships.
15
+ */
16
+ function recordFileEdit(filePath) {
17
+ // Normalize to basename for cross-path matching
18
+ const basename = filePath.replace(/\\/g, '/').split('/').pop() || filePath;
19
+ // Track co-edits with all previously edited files
20
+ for (const existing of sessionEdits) {
21
+ if (existing === basename)
22
+ continue;
23
+ const key = [existing, basename].sort().join('↔');
24
+ coEditMap.set(key, (coEditMap.get(key) || 0) + 1);
25
+ }
26
+ sessionEdits.add(basename);
27
+ }
28
+ /**
29
+ * Get files that are frequently co-edited with the given file.
30
+ * Returns files that should also be checked/edited.
31
+ */
32
+ function getRelatedFiles(filePath, memoryStore) {
33
+ const basename = filePath.replace(/\\/g, '/').split('/').pop() || filePath;
34
+ const related = [];
35
+ // 1. Check session co-edits
36
+ for (const [key, count] of coEditMap.entries()) {
37
+ if (count < 2)
38
+ continue; // Need at least 2 co-edits to be meaningful
39
+ const [a, b] = key.split('↔');
40
+ if (a === basename)
41
+ related.push(b);
42
+ else if (b === basename)
43
+ related.push(a);
44
+ }
45
+ // 2. Check stored relationships from past sessions
46
+ try {
47
+ const results = memoryStore.searchFTS(`file-relationship ${basename}`, 5);
48
+ for (const r of results) {
49
+ if (r.memory.tags?.includes('file-relationship')) {
50
+ // Extract the paired file from the intent
51
+ const match = r.memory.intent.match(/(.+?)↔(.+)/);
52
+ if (match) {
53
+ const other = match[1].trim() === basename ? match[2].trim() : match[1].trim();
54
+ if (!related.includes(other))
55
+ related.push(other);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ catch { /* non-fatal */ }
61
+ return related;
62
+ }
63
+ /**
64
+ * Get all co-edit relationships from this session (for end-of-session storage).
65
+ */
66
+ function getSessionRelationships() {
67
+ const relationships = [];
68
+ for (const [key, count] of coEditMap.entries()) {
69
+ if (count < 2)
70
+ continue; // Only store meaningful relationships
71
+ const [a, b] = key.split('↔');
72
+ relationships.push({
73
+ fileA: a,
74
+ fileB: b,
75
+ coEditCount: count,
76
+ lastCoEdit: Date.now(),
77
+ });
78
+ }
79
+ return relationships;
80
+ }
81
+ /**
82
+ * Check if any related files are missing from the current edit set.
83
+ * Returns warnings about files that should probably also be edited.
84
+ */
85
+ function checkMissingRelated(currentFile, memoryStore) {
86
+ const related = getRelatedFiles(currentFile, memoryStore);
87
+ const warnings = [];
88
+ for (const file of related) {
89
+ if (!sessionEdits.has(file)) {
90
+ warnings.push(`⚠️ You're editing ${currentFile} but haven't touched ${file} — they're usually edited together`);
91
+ }
92
+ }
93
+ return warnings;
94
+ }
95
+ /**
96
+ * Store accumulated co-edit relationships as persistent memories.
97
+ */
98
+ function storeRelationships(memoryStore) {
99
+ const rels = getSessionRelationships();
100
+ let stored = 0;
101
+ for (const rel of rels) {
102
+ try {
103
+ memoryStore.add({
104
+ type: 'INSIGHT',
105
+ intent: `${rel.fileA}↔${rel.fileB} — edited together ${rel.coEditCount} times`,
106
+ action: `These files are frequently co-edited. When changing one, check the other.`,
107
+ reason: `Auto-detected file relationship from ${rel.coEditCount} co-edits`,
108
+ tags: ['file-relationship', rel.fileA, rel.fileB],
109
+ confidence: Math.min(0.95, 0.5 + rel.coEditCount * 0.1),
110
+ importance: Math.min(0.85, 0.4 + rel.coEditCount * 0.1),
111
+ timestamp: Date.now(),
112
+ isActive: true,
113
+ accessCount: 0,
114
+ createdAt: Date.now(),
115
+ id: '',
116
+ });
117
+ stored++;
118
+ }
119
+ catch { /* skip duplicates */ }
120
+ }
121
+ return stored;
122
+ }
123
+ /**
124
+ * Reset session tracking (call at session end).
125
+ */
126
+ function resetFileTracking() {
127
+ sessionEdits.clear();
128
+ coEditMap.clear();
129
+ }
130
+ //# sourceMappingURL=file-relationships.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-relationships.js","sourceRoot":"","sources":["../../src/memory/file-relationships.ts"],"names":[],"mappings":";;AA6BA,wCAYC;AAMD,0CA4BC;AAKD,0DAeC;AAMD,kDAWC;AAKD,gDAyBC;AAKD,8CAGC;AAjID,2CAA2C;AAC3C,MAAM,YAAY,GAAgB,IAAI,GAAG,EAAE,CAAC;AAC5C,MAAM,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;AAEjD;;;GAGG;AACH,SAAgB,cAAc,CAAC,QAAgB;IAC3C,gDAAgD;IAChD,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;IAE3E,kDAAkD;IAClD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;QAClC,IAAI,QAAQ,KAAK,QAAQ;YAAE,SAAS;QACpC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI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C;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC7B,YAAY,CAAC,KAAK,EAAE,CAAC;IACrB,SAAS,CAAC,KAAK,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface ImpactResult {
2
+ targetFile: string;
3
+ directDependents: string[];
4
+ indirectDependents: string[];
5
+ totalImpact: number;
6
+ exports: string[];
7
+ riskLevel: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
8
+ }
9
+ /**
10
+ * Analyze the impact of changing a file.
11
+ * Scans for import statements that reference the target file.
12
+ */
13
+ export declare function analyzeImpact(targetFile: string, workspaceRoot: string): ImpactResult;
14
+ /** Format impact analysis for AI consumption */
15
+ export declare function formatImpact(result: ImpactResult): string;
16
+ //# sourceMappingURL=impact-analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impact-analyzer.d.ts","sourceRoot":"","sources":["../../src/memory/impact-analyzer.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,YAAY;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;CACrD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CACzB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACtB,YAAY,CA4Ed;AAED,gDAAgD;AAChD,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAiCzD"}